From 771372e0e46fb845b0818373ccb5958ad120e795 Mon Sep 17 00:00:00 2001 From: Axel Heider Date: Fri, 5 May 2023 16:42:40 +0200 Subject: [PATCH] CMake: check platform variables directly Signed-off-by: Axel Heider --- apps/Arm/vm_cross_connector/CMakeLists.txt | 4 ++-- apps/Arm/vm_introspect/CMakeLists.txt | 4 ++-- apps/Arm/vm_minimal/CMakeLists.txt | 14 +++++++------- apps/Arm/vm_multi/CMakeLists.txt | 4 ++-- apps/Arm/vm_virtio_net/CMakeLists.txt | 6 +++--- settings.cmake | 5 +---- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/apps/Arm/vm_cross_connector/CMakeLists.txt b/apps/Arm/vm_cross_connector/CMakeLists.txt index 66c599d0..de680755 100644 --- a/apps/Arm/vm_cross_connector/CMakeLists.txt +++ b/apps/Arm/vm_cross_connector/CMakeLists.txt @@ -18,13 +18,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") diff --git a/apps/Arm/vm_introspect/CMakeLists.txt b/apps/Arm/vm_introspect/CMakeLists.txt index b0482d85..09fc03eb 100644 --- a/apps/Arm/vm_introspect/CMakeLists.txt +++ b/apps/Arm/vm_introspect/CMakeLists.txt @@ -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") @@ -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") diff --git a/apps/Arm/vm_minimal/CMakeLists.txt b/apps/Arm/vm_minimal/CMakeLists.txt index 068b2f60..13961672 100644 --- a/apps/Arm/vm_minimal/CMakeLists.txt +++ b/apps/Arm/vm_minimal/CMakeLists.txt @@ -13,7 +13,7 @@ include(${CAMKES_ARM_VM_HELPERS_PATH}) set(cpp_includes "${CAMKES_VM_DIR}/components/VM_Arm") # 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 @@ -42,13 +42,13 @@ if("${KernelARMPlatform}" STREQUAL "tk1") AddToFileServer("linux" "${CAMKES_ARM_LINUX_DIR}/${linux_binary_name}") AddToFileServer("linux-dtb" "${CMAKE_CURRENT_BINARY_DIR}/linux/linux-dtb" DEPENDS set_dtb) -elseif("${KernelARMPlatform}" STREQUAL "tx1") +elseif(KernelPlatformTx1) set(cpp_flags "-DKERNELARMPLATFORM_TX1") AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/tx1/linux") AddToFileServer("linux-dtb" "${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") @@ -67,7 +67,7 @@ elseif("${KernelARMPlatform}" STREQUAL "exynos5422") ) AddToFileServer("linux-dtb" "${output_dtb_location}" DEPENDS dtb_gen_target) -elseif("${KernelARMPlatform}" STREQUAL "tx2") +elseif(KernelPlatformTx2) find_package(camkes-vm-linux REQUIRED) include(${CAMKES_VM_LINUX_HELPERS_PATH}) set(cpp_flags "-DKERNELARMPLATFORM_TX2") @@ -85,7 +85,7 @@ elseif("${KernelARMPlatform}" STREQUAL "tx2") ) AddToFileServer("linux-dtb" "${output_dtb_location}" DEPENDS dtb_gen_target) -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") @@ -108,7 +108,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") @@ -130,7 +130,7 @@ elseif("${KernelARMPlatform}" STREQUAL "odroidc2") ) AddToFileServer("linux-dtb" "${output_dtb_location}" DEPENDS dtb_gen_target) -elseif("${KernelARMPlatform}" STREQUAL "zcu102") +elseif(KernelPlatformZynqmpZcu102) if("${VmZynqmpPetalinuxVersion}" STREQUAL "") message( diff --git a/apps/Arm/vm_multi/CMakeLists.txt b/apps/Arm/vm_multi/CMakeLists.txt index 597c12f1..4cb395f6 100644 --- a/apps/Arm/vm_multi/CMakeLists.txt +++ b/apps/Arm/vm_multi/CMakeLists.txt @@ -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) diff --git a/apps/Arm/vm_virtio_net/CMakeLists.txt b/apps/Arm/vm_virtio_net/CMakeLists.txt index 82ac5dd2..1f5a2ebf 100644 --- a/apps/Arm/vm_virtio_net/CMakeLists.txt +++ b/apps/Arm/vm_virtio_net/CMakeLists.txt @@ -18,18 +18,18 @@ set(cpp_includes "${CAMKES_VM_DIR}/components/VM_Arm") 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") set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/rootfs_crossvm.cpio.gz") -elseif("${KernelARMPlatform}" STREQUAL "zcu102") +elseif(KernelPlatformZynqmpZcu102) if(NOT VmZynqmpPetalinux2022_1) message(FATAL_ERROR "Petalinux 2022_1 is the only supported version for this application") diff --git a/settings.cmake b/settings.cmake index db7fbf3b..38efb0f1 100644 --- a/settings.cmake +++ b/settings.cmake @@ -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")