Skip to content

Commit

Permalink
CMake: check platform variables directly
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Heider <[email protected]>
  • Loading branch information
Axel Heider committed Mar 25, 2023
1 parent 825153b commit cbdf6c9
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions apps/Arm/vm_cross_connector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ include(ExternalProject)
include(external-project-helpers)

# Create our CPP Flags based on ARM VM config variables
if("${KernelARMPlatform}" STREQUAL "exynos5422")
if(KernelPlatformExynos5422)
set(cpp_flags "-DKERNELARMPLATFORM_EXYNOS5422")
set(linux_repo "https://github.com/hardkernel/linux.git")
set(linux_tag "4.14.87-153")
set(linux_arch "arm")
set(linux_cross_compile "arm-linux-gnueabi-")
elseif("${KernelARMPlatform}" STREQUAL "qemu-arm-virt")
elseif(KernelPlatformQEMUArmVirt)
set(cpp_flags "-DKERNELARMPLATFORM_QEMU-ARM-VIRT")
set(linux_repo "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git")
set(linux_tag "v4.9.189")
Expand Down
4 changes: 2 additions & 2 deletions apps/Arm/vm_introspect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ include(${CAMKES_VM_LINUX_MODULE_HELPERS_PATH})
include(ExternalProject)
include(external-project-helpers)

if("${KernelARMPlatform}" STREQUAL "exynos5422")
if(KernelPlatformExynos5422)
set(cpp_flags "-DKERNELARMPLATFORM_EXYNOS5422")
set(linux_repo "https://github.com/hardkernel/linux.git")
set(linux_tag "4.14.87-153")
Expand All @@ -33,7 +33,7 @@ if("${KernelARMPlatform}" STREQUAL "exynos5422")
# Generate overlayed rootfs
set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/exynos5422/rootfs.cpio.gz")

elseif("${KernelARMPlatform}" STREQUAL "qemu-arm-virt")
elseif(KernelPlatformQEMUArmVirt)
set(cpp_flags "-DKERNELARMPLATFORM_QEMU-ARM-VIRT")
set(linux_repo "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git")
set(linux_tag "v4.9.189")
Expand Down
12 changes: 6 additions & 6 deletions apps/Arm/vm_minimal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include(${CAMKES_ARM_VM_HELPERS_PATH})
set(rootfs_file "")

# Create our CPP Flags based on ARM VM config variables
if("${KernelARMPlatform}" STREQUAL "tk1")
if(KernelPlatformTK1)
set(cpp_flags "-DKERNELARMPLATFORM_TK1")

# Different device tree if compiling with Tk1Insecure
Expand Down Expand Up @@ -44,14 +44,14 @@ if("${KernelARMPlatform}" STREQUAL "tk1")
# 'output_dtb_location' and lists it properly as dependency will make CMake
# run the command above to create (or update) it.

elseif("${KernelARMPlatform}" STREQUAL "tx1")
elseif(KernelPlatformTx1)
set(cpp_flags "-DKERNELARMPLATFORM_TX1")

# kernel image contains rootfs
set(linux_image "${CAMKES_VM_IMAGES_DIR}/tx1/linux")
set(output_dtb_location "${CAMKES_VM_IMAGES_DIR}/tx1/linux-dtb")

elseif("${KernelARMPlatform}" STREQUAL "exynos5422")
elseif(KernelPlatformExynos5422)
find_package(camkes-vm-linux REQUIRED)
include(${CAMKES_VM_LINUX_HELPERS_PATH})
set(cpp_flags "-DKERNELARMPLATFORM_EXYNOS5422")
Expand All @@ -68,7 +68,7 @@ elseif("${KernelARMPlatform}" STREQUAL "exynos5422")
output_dtb_location
)

elseif("${KernelARMPlatform}" STREQUAL "tx2")
elseif(KernelPlatformTx2)
find_package(camkes-vm-linux REQUIRED)
include(${CAMKES_VM_LINUX_HELPERS_PATH})
set(cpp_flags "-DKERNELARMPLATFORM_TX2")
Expand All @@ -84,7 +84,7 @@ elseif("${KernelARMPlatform}" STREQUAL "tx2")
output_dtb_location
)

elseif("${KernelARMPlatform}" STREQUAL "qemu-arm-virt")
elseif(KernelPlatformQEMUArmVirt)
find_package(camkes-vm-linux REQUIRED)
include(${CAMKES_VM_LINUX_HELPERS_PATH})
set(cpp_flags "-DKERNELARMPLATFORM_QEMU-ARM-VIRT")
Expand All @@ -105,7 +105,7 @@ elseif("${KernelARMPlatform}" STREQUAL "qemu-arm-virt")
GenerateSimulateScript()
endif()

elseif("${KernelARMPlatform}" STREQUAL "odroidc2")
elseif(KernelPlatformOdroidc2)
find_package(camkes-vm-linux REQUIRED)
include(${CAMKES_VM_LINUX_HELPERS_PATH})
set(cpp_flags "-DKERNELARMPLATFORM_ODROIDC2")
Expand Down
4 changes: 2 additions & 2 deletions apps/Arm/vm_multi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ include(${CAMKES_ARM_VM_HELPERS_PATH})
find_package(camkes-vm-linux REQUIRED)
include(${CAMKES_VM_LINUX_HELPERS_PATH})

if("${PLATFORM}" STREQUAL "exynos5422")
if(KernelPlatformExynos5422)
# Create our CPP Flags based on ARM VM config variables
set(cpp_flags "-DKERNELARMPLATFORM_EXYNOS5422")
elseif("${PLATFORM}" STREQUAL "qemu-arm-virt")
elseif(KernelPlatformQEMUArmVirt)
set(cpp_flags "-DKERNELARMPLATFORM_QEMU-ARM-VIRT")
set(SIMULATION ON CACHE BOOL "Generate simulation script to run qemu with the proper arguments")
include(simulation)
Expand Down
9 changes: 4 additions & 5 deletions apps/Arm/vm_virtio_net/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ include(${CAMKES_VM_LINUX_HELPERS_PATH})
set(dtb_file "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux-dtb")
set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/rootfs.cpio.gz")

if("${KernelARMPlatform}" STREQUAL "exynos5422")
if(KernelPlatformExynos5422)
# Create our CPP Flags based on ARM VM config variables
set(cpp_flags "-DKERNELARMPLATFORM_EXYNOS5422")
set(rootfs_address "0x4d700000")

elseif("${KernelARMPlatform}" STREQUAL "tx2")
elseif(KernelPlatformTx2)
set(cpp_flags "-DKERNELARMPLATFORM_TX2")
set(rootfs_address "0xf7000000")
set(dtb_file "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux-pci-dtb")
Expand Down Expand Up @@ -65,15 +65,14 @@ AddOverlayDirToRootfs(
GZIP
)

# Updated dtb based on generated initrd
# Updated dtb based on generated initrd. 'output_overlayed_rootfs_location' is
# taken as input, there there is an implicit dependency This implicitly depends on
UpdateDtbFromInitrd(
${dtb_file}
${output_overlayed_rootfs_location}
${rootfs_address}
dtb_gen_target
output_dtb_location
DEPENDS
rootfs_target
)

AddCamkesCPPFlag(
Expand Down
5 changes: 1 addition & 4 deletions settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,7 @@ if(AppArch STREQUAL "Arm")

# We dont support SMP configurations on the exynos5422, exynos5410 or TK1
if(
("${KernelARMPlatform}" STREQUAL "exynos5422"
OR "${KernelARMPlatform}" STREQUAL "exynos5410"
OR "${KernelARMPlatform}" STREQUAL "tk1"
)
(KernelPlatformExynos5422 OR KernelPlatformExynos5410 OR KernelPlatformTK1)
AND (${KernelMaxNumNodes} GREATER 1)
)
message(FATAL_ERROR "${KernelARMPlatform} does not support SMP VMs")
Expand Down

0 comments on commit cbdf6c9

Please sign in to comment.