From 3857c2463ecab2feca8e7cf03e028ecee7a18bf8 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 | 12 ++++++------ apps/Arm/vm_multi/CMakeLists.txt | 4 ++-- apps/Arm/vm_virtio_net/CMakeLists.txt | 4 ++-- settings.cmake | 5 +---- 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/apps/Arm/vm_cross_connector/CMakeLists.txt b/apps/Arm/vm_cross_connector/CMakeLists.txt index 64697289..24864ed3 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 8db76bbf..5563d6db 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 2469f648..43255b2d 100644 --- a/apps/Arm/vm_minimal/CMakeLists.txt +++ b/apps/Arm/vm_minimal/CMakeLists.txt @@ -11,7 +11,7 @@ project(camkes-arm-tk1-vm C) include(${CAMKES_ARM_VM_HELPERS_PATH}) # 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 @@ -41,13 +41,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") @@ -66,7 +66,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") @@ -84,7 +84,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") @@ -107,7 +107,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") diff --git a/apps/Arm/vm_multi/CMakeLists.txt b/apps/Arm/vm_multi/CMakeLists.txt index 26456ece..cfa4f15d 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 77fca436..66dbf272 100644 --- a/apps/Arm/vm_virtio_net/CMakeLists.txt +++ b/apps/Arm/vm_virtio_net/CMakeLists.txt @@ -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") 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")