Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up CMake, fail build for unsupported platforms #41

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/Arm/vm_cross_connector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -35,6 +35,8 @@ elseif("${KernelARMPlatform}" STREQUAL "qemu-arm-virt")
if(SIMULATION)
GenerateSimulateScript()
endif()
else()
message(FATAL_ERROR "unsupported KernelARMPlatform: ${KernelARMPlatform}")
endif()

AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux")
Expand Down
8 changes: 7 additions & 1 deletion apps/Arm/vm_cross_connector/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ if(NOT "${PLATFORM}" IN_LIST supported)
message(FATAL_ERROR "PLATFORM: ${PLATFORM} not supported.
Supported: ${supported}")
endif()

set(VmPCISupport ON CACHE BOOL "" FORCE)
set(LibUSB OFF CACHE BOOL "" FORCE)
set(VmInitRdFile ON CACHE BOOL "" FORCE)
if(${PLATFORM} STREQUAL "qemu-arm-virt")

if(${PLATFORM} STREQUAL "exynos5422")
# nothing special here
elseif(${PLATFORM} STREQUAL "qemu-arm-virt")
# force cpu
set(QEMU_MEMORY "2048")
set(KernelArmCPU cortex-a53 CACHE STRING "" FORCE)
else()
message(FATAL_ERROR "unsupported PLATFORM: ${PLATFORM}")
endif()
6 changes: 4 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 All @@ -52,6 +52,8 @@ elseif("${KernelARMPlatform}" STREQUAL "qemu-arm-virt")
GenerateSimulateScript()
endif()

else()
message(FATAL_ERROR "unsupported KernelARMPlatform: ${KernelARMPlatform}")
endif()

AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux")
Expand Down
8 changes: 7 additions & 1 deletion apps/Arm/vm_introspect/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ if(NOT "${PLATFORM}" IN_LIST supported)
message(FATAL_ERROR "PLATFORM: ${PLATFORM} not supported.
Supported: ${supported}")
endif()

set(VmPCISupport ON CACHE BOOL "" FORCE)
set(LibUSB OFF CACHE BOOL "" FORCE)
set(VmInitRdFile ON CACHE BOOL "" FORCE)
if(${PLATFORM} STREQUAL "qemu-arm-virt")

if(${PLATFORM} STREQUAL "exynos5422")
# nothing here
elseif(${PLATFORM} STREQUAL "qemu-arm-virt")
# force cpu
set(QEMU_MEMORY "2048")
set(KernelArmCPU cortex-a53 CACHE STRING "" FORCE)
else()
message(FATAL_ERROR "unsupported PLATFORM: ${PLATFORM}")
endif()
18 changes: 11 additions & 7 deletions apps/Arm/vm_minimal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -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)

# QEMU supports ARMv7/aarch32 and ARMv8/aarch32, but currently there are
# Linux images for aarch64 only. However, it is unclear if that is the only
Expand All @@ -94,6 +94,7 @@ elseif("${KernelARMPlatform}" STREQUAL "qemu-arm-virt")
message(FATAL_ERROR "Only AARCH64 is supported")
endif()

elseif("${KernelARMPlatform}" STREQUAL "qemu-arm-virt")
find_package(camkes-vm-linux REQUIRED)
include(${CAMKES_VM_LINUX_HELPERS_PATH})
set(cpp_flags "-DKERNELARMPLATFORM_QEMU-ARM-VIRT")
Expand All @@ -116,7 +117,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 All @@ -138,7 +139,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(
Expand Down Expand Up @@ -170,6 +171,9 @@ elseif("${KernelARMPlatform}" STREQUAL "zcu102")
list(APPEND cpp_includes "${CAMKES_VM_DIR}/components/VM_Arm/plat_include/zynqmp")

CAmkESAddImportPath(${KernelARMPlatform}/${VmZynqmpPetalinuxVersion})

else()
message(FATAL_ERROR "unsupported KernelARMPlatform: ${KernelARMPlatform}")
endif()

AddCamkesCPPFlag(cpp_flags CONFIG_VARS VmEmmc2NoDMA VmVUSB Tk1DeviceFwd Tk1Insecure)
Expand Down
23 changes: 12 additions & 11 deletions apps/Arm/vm_minimal/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,35 @@ if(NOT "${PLATFORM}" IN_LIST supported)
message(FATAL_ERROR "PLATFORM: ${PLATFORM} not supported.
Supported: ${supported}")
endif()

set(LibUSB OFF CACHE BOOL "" FORCE)

if(${PLATFORM} STREQUAL "tk1")
set(KernelTk1SMMU ON CACHE BOOL "" FORCE)
set(KernelTk1SMMUInterruptEnable ON CACHE BOOL "" FORCE)
endif()

set(LibUSB OFF CACHE BOOL "" FORCE)
if(${PLATFORM} STREQUAL "exynos5422")
elseif(${PLATFORM} STREQUAL "exynos5422")
set(VmPCISupport ON CACHE BOOL "" FORCE)
set(VmVirtioNet ON CACHE BOOL "" FORCE)
set(VmInitRdFile ON CACHE BOOL "" FORCE)
endif()
if(${PLATFORM} STREQUAL "tx2")
elseif(${PLATFORM} STREQUAL "tx1")
# nothing here
elseif(${PLATFORM} STREQUAL "tx2")
set(VmPCISupport ON CACHE BOOL "" FORCE)
set(VmVirtioNet ON CACHE BOOL "" FORCE)
set(VmInitRdFile ON CACHE BOOL "" FORCE)
set(VmDtbFile ON CACHE BOOL "" FORCE)
endif()
if(${PLATFORM} STREQUAL "odroidc2")
elseif(${PLATFORM} STREQUAL "odroidc2")
set(VmInitRdFile ON CACHE BOOL "" FORCE)
set(VmDtbFile ON CACHE BOOL "" FORCE)
endif()
if(${PLATFORM} STREQUAL "qemu-arm-virt")
elseif(${PLATFORM} STREQUAL "qemu-arm-virt")
# force cpu
set(QEMU_MEMORY "2048")
set(KernelArmCPU cortex-a53 CACHE STRING "" FORCE)
set(VmInitRdFile ON CACHE BOOL "" FORCE)
endif()
if(${PLATFORM} STREQUAL "zcu102")
elseif(${PLATFORM} STREQUAL "zcu102")
set(AARCH64 ON CACHE BOOL "" FORCE)
set(KernelAllowSMCCalls ON CACHE BOOL "" FORCE)
else()
message(FATAL_ERROR "unsupported PLATFORM: ${PLATFORM}")
endif()
8 changes: 5 additions & 3 deletions apps/Arm/vm_multi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ include(${CAMKES_ARM_VM_HELPERS_PATH})
find_package(camkes-vm-linux REQUIRED)
include(${CAMKES_VM_LINUX_HELPERS_PATH})

if("${PLATFORM}" STREQUAL "exynos5422")
# Create our CPP Flags based on ARM VM config variables
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)
if(SIMULATION)
GenerateSimulateScript()
endif()
else()
message(FATAL_ERROR "unsupported PLATFORM: ${PLATFORM}")
endif()

# Generate our overlayed rootfs images
Expand Down
13 changes: 11 additions & 2 deletions apps/Arm/vm_multi/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,25 @@ if(NOT "${PLATFORM}" IN_LIST supported)
message(FATAL_ERROR "PLATFORM: ${PLATFORM} not supported.
Supported: ${supported}")
endif()

set(LibUSB OFF CACHE BOOL "" FORCE)
set(VmPCISupport ON CACHE BOOL "" FORCE)
set(VmVirtioConsole ON CACHE BOOL "" FORCE)
set(VmVirtioNetArping OFF CACHE BOOL "" FORCE)
set(VmVirtioNetVirtqueue ON CACHE BOOL "" FORCE)
set(VmInitRdFile ON CACHE BOOL "" FORCE)
if("${PLATFORM}" STREQUAL "qemu-arm-virt")

if("${PLATFORM}" STREQUAL "exynos5422")
# nothing special here
elseif("${PLATFORM}" STREQUAL "qemu-arm-virt")
set(QEMU_MEMORY "2048")
set(KernelArmCPU cortex-a53 CACHE STRING "" FORCE)
set(qemu_sim_extra_args "-netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no -device virtio-net,netdev=mynet0,mac=52:55:00:d1:55:01")
set(
qemu_sim_extra_args
"-netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no -device virtio-net,netdev=mynet0,mac=52:55:00:d1:55:01"
)
set(KernelArmExportPCNTUser ON CACHE BOOL "" FORCE)
set(KernelArmExportPTMRUser ON CACHE BOOL "" FORCE)
else()
message(FATAL_ERROR "unsupported PLATFORM: ${PLATFORM}")
endif()
9 changes: 6 additions & 3 deletions apps/Arm/vm_virtio_net/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -56,6 +56,9 @@ elseif("${KernelARMPlatform}" STREQUAL "zcu102")
list(APPEND cpp_includes "${CAMKES_VM_DIR}/components/VM_Arm/plat_include/zynqmp")

CAmkESAddImportPath(${KernelARMPlatform}/${VmZynqmpPetalinuxVersion})

else()
message(FATAL_ERROR "unsupported KernelARMPlatform: ${KernelARMPlatform}")
endif()

# Generate overlayed rootfs
Expand Down
9 changes: 8 additions & 1 deletion apps/Arm/vm_virtio_net/settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if(NOT "${PLATFORM}" IN_LIST supported)
message(FATAL_ERROR "PLATFORM: ${PLATFORM} not supported.
Supported: ${supported}")
endif()

set(LibUSB OFF CACHE BOOL "" FORCE)
set(VmPCISupport ON CACHE BOOL "" FORCE)
if(VIRTIO_NET_PING)
Expand All @@ -19,8 +20,14 @@ endif()
set(VmInitRdFile ON CACHE BOOL "" FORCE)
set(VmDtbFile ON CACHE BOOL "provide dtb" FORCE)

if(${PLATFORM} STREQUAL "zcu102")
if("${PLATFORM}" STREQUAL "exynos5422")
# nothing special here
elseif("${PLATFORM}" STREQUAL "tx2")
# nothing special here
elseif(${PLATFORM} STREQUAL "zcu102")
set(AARCH64 ON CACHE BOOL "" FORCE)
set(KernelAllowSMCCalls ON CACHE BOOL "" FORCE)
set(VmZynqmpPetalinuxVersion 2022_1 CACHE STRING "" FORCE)
else()
message(FATAL_ERROR "unsupported PLATFORM: ${PLATFORM}")
endif()
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