From fee46e6c3e0025d77366b569a7274a6a7bd4255a Mon Sep 17 00:00:00 2001 From: Axel Heider Date: Fri, 24 Mar 2023 21:20:05 +0100 Subject: [PATCH] CMake: use params for DefineCAmkESVMFileServer() - avoid calling AddToFileServer(), build the file list as CMake variable instead. - clean up the CMake target dependencies, avoid explicit references to (helper) targets, when this is not necessary. Signed-off-by: Axel Heider --- apps/Arm/odroid_vm/CMakeLists.txt | 12 ++--- apps/Arm/vm_cross_connector/CMakeLists.txt | 16 +++--- apps/Arm/vm_introspect/CMakeLists.txt | 15 +++--- apps/Arm/vm_minimal/CMakeLists.txt | 58 ++++++++++++---------- apps/Arm/vm_multi/CMakeLists.txt | 30 +++++------ apps/Arm/vm_serial_server/CMakeLists.txt | 21 +++++--- apps/Arm/vm_virtio_net/CMakeLists.txt | 24 +++++---- apps/x86/cma34cr_centos/CMakeLists.txt | 23 ++++++--- apps/x86/cma34cr_ubuntu/CMakeLists.txt | 25 +++++++--- apps/x86/minimal/CMakeLists.txt | 22 +++++--- apps/x86/optiplex9020/CMakeLists.txt | 25 +++++++--- apps/x86/virtio_blk_sample/CMakeLists.txt | 20 +++++--- apps/x86/zmq_samples/CMakeLists.txt | 21 ++++++-- 13 files changed, 186 insertions(+), 126 deletions(-) diff --git a/apps/Arm/odroid_vm/CMakeLists.txt b/apps/Arm/odroid_vm/CMakeLists.txt index aeab0695..13e708b2 100644 --- a/apps/Arm/odroid_vm/CMakeLists.txt +++ b/apps/Arm/odroid_vm/CMakeLists.txt @@ -32,8 +32,6 @@ add_subdirectory(components/spi) add_subdirectory(components/clk) add_subdirectory(components/timer) -set(linux_binary_name "${CAMKES_ARM_LINUX_DIR}/linux") - # Different device tree if compiling with VmVUSB if(VmVUSB) set(device_tree_src "${CAMKES_ARM_LINUX_DIR}/linux-secure-vusb-dtb") @@ -49,14 +47,12 @@ add_custom_command( bash -c "sed \"s/root=\\/dev\\/mmcblk1p2/root=\\/dev\\/${VmRootfs}/g\" ${device_tree_src} > ${linux_dtb}" VERBATIM + DEPENDS "${device_tree_src}" ) -# Create custom target for setting the dtb -add_custom_target(set_dtb DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/linux/linux-dtb") -# Add Linux VM images into file server -AddToFileServer("linux" "${linux_binary_name}") -AddToFileServer("linux-dtb" "${CMAKE_CURRENT_BINARY_DIR}/linux/linux-dtb" DEPENDS set_dtb) -DefineCAmkESVMFileServer() +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +DefineCAmkESVMFileServer(FILES "linux:${CAMKES_ARM_LINUX_DIR}/linux" "linux-dtb:${linux_dtb}") # Declare odroid root server DeclareCAmkESRootserver( diff --git a/apps/Arm/vm_cross_connector/CMakeLists.txt b/apps/Arm/vm_cross_connector/CMakeLists.txt index 64697289..4560c29d 100644 --- a/apps/Arm/vm_cross_connector/CMakeLists.txt +++ b/apps/Arm/vm_cross_connector/CMakeLists.txt @@ -37,8 +37,6 @@ elseif("${KernelARMPlatform}" STREQUAL "qemu-arm-virt") endif() endif() -AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux") - if(BUILD_CROSSVM) set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/rootfs.cpio.gz") # Checkout and configure linux to build crossvm module @@ -195,17 +193,16 @@ AddFileToOverlayDir( overlay ) -# Construct new rootfs +# Construct new rootfs. AddOverlayDirToRootfs( overlay ${rootfs_file} "buildroot" "rootfs_install" output_overlayed_rootfs_location - rootfs_target + rootfs_target # helper CMake target to be created, not used GZIP ) -AddToFileServer("linux-initrd" ${output_overlayed_rootfs_location} DEPENDS rootfs_target) AddCamkesCPPFlag( cpp_flags @@ -218,7 +215,14 @@ AddCamkesCPPFlag( VmVirtioNetVirtqueue ) -DefineCAmkESVMFileServer() +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +# There is no need to specify an explicit dependency on the helper target +# 'rootfs_target'. +DefineCAmkESVMFileServer( + FILES "linux:${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux" + "linux-initrd:${output_overlayed_rootfs_location}" +) CAmkESAddImportPath(${KernelARMPlatform}) diff --git a/apps/Arm/vm_introspect/CMakeLists.txt b/apps/Arm/vm_introspect/CMakeLists.txt index 8db76bbf..fecb68a6 100644 --- a/apps/Arm/vm_introspect/CMakeLists.txt +++ b/apps/Arm/vm_introspect/CMakeLists.txt @@ -54,8 +54,6 @@ elseif("${KernelARMPlatform}" STREQUAL "qemu-arm-virt") endif() -AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux") - set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/rootfs_crossvm.cpio.gz") ExternalProject_Add( @@ -104,11 +102,18 @@ AddOverlayDirToRootfs( "buildroot" "rootfs_install" output_overlayed_rootfs_location - rootfs_target + rootfs_target # helper CMake target to be created, not used GZIP ) -AddToFileServer("linux-initrd" ${output_overlayed_rootfs_location} DEPENDS rootfs_target) +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +# There is no need to specify an explicit dependency on the helper target +# 'rootfs_target'. +DefineCAmkESVMFileServer( + FILES "linux:${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux" + "linux-initrd:${output_overlayed_rootfs_location}" +) AddCamkesCPPFlag( cpp_flags @@ -121,8 +126,6 @@ AddCamkesCPPFlag( VmVirtioNetVirtqueue ) -DefineCAmkESVMFileServer() - CAmkESAddImportPath(${KernelARMPlatform}) # Define our VM Component with out cross vm dataports glue code diff --git a/apps/Arm/vm_minimal/CMakeLists.txt b/apps/Arm/vm_minimal/CMakeLists.txt index b5d62b1d..324fa9ef 100644 --- a/apps/Arm/vm_minimal/CMakeLists.txt +++ b/apps/Arm/vm_minimal/CMakeLists.txt @@ -10,6 +10,10 @@ project(camkes-arm-tk1-vm C) include(${CAMKES_ARM_VM_HELPERS_PATH}) +# On some platforms, there is no dedicated rootfs, because it's part of the +# Linux kernel image. +set(rootfs_file "") + # Create our CPP Flags based on ARM VM config variables if("${KernelARMPlatform}" STREQUAL "tk1") set(cpp_flags "-DKERNELARMPLATFORM_TK1") @@ -21,10 +25,11 @@ if("${KernelARMPlatform}" STREQUAL "tk1") set(device_tree_src "${CAMKES_ARM_LINUX_DIR}/linux-tk1-secure.dts") endif() + # kernel image contains rootfs if(VmTk1InitrdRootfs) - set(linux_binary_name "${CAMKES_ARM_LINUX_DIR}/linux-tk1-initrd") + set(linux_image "${CAMKES_ARM_LINUX_DIR}/linux-tk1-initrd") else() - set(linux_binary_name "${CAMKES_ARM_LINUX_DIR}/linux-tk1-debian") + set(linux_image "${CAMKES_ARM_LINUX_DIR}/linux-tk1-debian") endif() set(output_dtb_location "${CMAKE_CURRENT_BINARY_DIR}/linux/linux-dtb") @@ -34,73 +39,65 @@ if("${KernelARMPlatform}" STREQUAL "tk1") VERBATIM DEPENDS ${device_tree_src} ) - # Create custom target for setting the dtb - add_custom_target(set_dtb DEPENDS "${output_dtb_location}") - - # Add Linux VM images into file server - AddToFileServer("linux" "${linux_binary_name}") - AddToFileServer("linux-dtb" "${output_dtb_location}" DEPENDS set_dtb) + # There is no need to create an explicit target there, any step that uses + # '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") set(cpp_flags "-DKERNELARMPLATFORM_TX1") - AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/tx1/linux") - AddToFileServer("linux-dtb" "${CAMKES_VM_IMAGES_DIR}/tx1/linux-dtb") + # 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") find_package(camkes-vm-linux REQUIRED) include(${CAMKES_VM_LINUX_HELPERS_PATH}) set(cpp_flags "-DKERNELARMPLATFORM_EXYNOS5422") - AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/exynos5422/linux") + set(linux_image "${CAMKES_VM_IMAGES_DIR}/exynos5422/linux") # Generate overlayed rootfs set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/exynos5422/rootfs.cpio.gz") - AddToFileServer("linux-initrd" ${rootfs_file}) # Updated dtb based on initrd UpdateDtbFromInitrd( "${CAMKES_VM_IMAGES_DIR}/exynos5422/linux-dtb" ${rootfs_file} "0x4d700000" - dtb_gen_target + dtb_gen_target # helper CMake target to be created, not used output_dtb_location ) - AddToFileServer("linux-dtb" "${output_dtb_location}" DEPENDS dtb_gen_target) elseif("${KernelARMPlatform}" STREQUAL "tx2") find_package(camkes-vm-linux REQUIRED) include(${CAMKES_VM_LINUX_HELPERS_PATH}) set(cpp_flags "-DKERNELARMPLATFORM_TX2") - AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/tx2/linux") + set(linux_image "${CAMKES_VM_IMAGES_DIR}/tx2/linux") set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/tx2/rootfs.cpio.gz") - AddToFileServer("linux-initrd" ${rootfs_file}) # Updated dtb based on initrd UpdateDtbFromInitrd( "${CAMKES_VM_IMAGES_DIR}/tx2/linux-dtb" ${rootfs_file} "0xf7000000" - dtb_gen_target + dtb_gen_target # helper CMake target to be created, not used output_dtb_location ) - AddToFileServer("linux-dtb" "${output_dtb_location}" DEPENDS dtb_gen_target) 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") - AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/qemu-arm-virt/linux") + set(linux_image "${CAMKES_VM_IMAGES_DIR}/qemu-arm-virt/linux") set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/qemu-arm-virt/rootfs.cpio.gz") - AddToFileServer("linux-initrd" ${rootfs_file}) # Updated dtb based on initrd UpdateDtbFromInitrd( "${CAMKES_VM_IMAGES_DIR}/qemu-arm-virt/linux-dtb" ${rootfs_file} "0x4d700000" - dtb_gen_target + dtb_gen_target # helper CMake target to be created, not used output_dtb_location ) - AddToFileServer("linux-dtb" "${output_dtb_location}" DEPENDS dtb_gen_target) include(simulation) set(SIMULATION ON CACHE BOOL "Generate simulation script to run qemu with the proper arguments") if(SIMULATION) @@ -116,23 +113,30 @@ elseif("${KernelARMPlatform}" STREQUAL "odroidc2") CAMKES_ROOT_DTB_FILE_PATH "${CAMKES_VM_IMAGES_DIR}/odroidc2/camkes-linux-dtb" CACHE STRING "" ) - AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/odroidc2/linux") + set(linux_image "${CAMKES_VM_IMAGES_DIR}/odroidc2/linux") set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/odroidc2/rootfs.cpio.gz") - AddToFileServer("linux-initrd" ${rootfs_file}) # Updated dtb based on initrd UpdateDtbFromInitrd( "${CAMKES_VM_IMAGES_DIR}/odroidc2/linux-dtb" ${rootfs_file} "0x2d700000" - dtb_gen_target + dtb_gen_target # helper CMake target to be created, not used output_dtb_location ) - AddToFileServer("linux-dtb" "${output_dtb_location}" DEPENDS dtb_gen_target) endif() AddCamkesCPPFlag(cpp_flags CONFIG_VARS VmEmmc2NoDMA VmVUSB Tk1DeviceFwd Tk1Insecure) -DefineCAmkESVMFileServer() +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +# There is no need to specify an explicit dependency on the helper target +# 'dtb_gen_target' +set(cpio_files "linux:${linux_image}" "linux-dtb:${output_dtb_location}") +if(rootfs_file) + list(APPEND cpio_files "linux-initrd:${rootfs_file}") +endif() + +DefineCAmkESVMFileServer(FILES ${cpio_files}) CAmkESAddImportPath(${KernelARMPlatform}) diff --git a/apps/Arm/vm_multi/CMakeLists.txt b/apps/Arm/vm_multi/CMakeLists.txt index 26456ece..ab0b0d06 100644 --- a/apps/Arm/vm_multi/CMakeLists.txt +++ b/apps/Arm/vm_multi/CMakeLists.txt @@ -46,7 +46,7 @@ AddOverlayDirToRootfs( "buildroot" "rootfs_install" vm0_output_overlayed_rootfs_location - rootfs_target_vm0 + rootfs_target_vm0 # helper CMake target to be created, not used GZIP ) @@ -69,28 +69,22 @@ AddOverlayDirToRootfs( "buildroot" "rootfs_install" client_output_overlayed_rootfs_location - rootfs_target_client_vm + rootfs_target_client_vm # helper CMake target to be created, not used GZIP ) -AddToFileServer( - "linux-initrd-vm0" - "${vm0_output_overlayed_rootfs_location}" - DEPENDS - rootfs_target_vm0 -) -AddToFileServer( - "linux-initrd-vm-client" - "${client_output_overlayed_rootfs_location}" - DEPENDS - rootfs_target_client_vm -) - -AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux") - AddCamkesCPPFlag(cpp_flags CONFIG_VARS VmEmmc2NoDMA VmVUSB VmVchan Tk1DeviceFwd Tk1Insecure) -DefineCAmkESVMFileServer() +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +# There is no need to specify an explicit dependency on the helper targets +# 'rootfs_target_vm0' and 'rootfs_target_client_vm' +DefineCAmkESVMFileServer( + FILES + "linux-initrd-vm0:${vm0_output_overlayed_rootfs_location}" + "linux-initrd-vm-client:${client_output_overlayed_rootfs_location}" + "linux:${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux" +) CAmkESAddImportPath(${KernelARMPlatform}) diff --git a/apps/Arm/vm_serial_server/CMakeLists.txt b/apps/Arm/vm_serial_server/CMakeLists.txt index 1547aef0..df72cced 100644 --- a/apps/Arm/vm_serial_server/CMakeLists.txt +++ b/apps/Arm/vm_serial_server/CMakeLists.txt @@ -16,7 +16,6 @@ include(${CAMKES_VM_LINUX_HELPERS_PATH}) # Create our CPP Flags based on ARM VM config variables set(cpp_flags "-DKERNELARMPLATFORM_EXYNOS5422") -AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/exynos5422/linux") # Generate overlayed rootfs set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/exynos5422/rootfs.cpio.gz") AddFileToOverlayDir( @@ -32,25 +31,31 @@ AddOverlayDirToRootfs( "buildroot" "rootfs_install" output_overlayed_rootfs_location - rootfs_target + rootfs_target # helper CMake target to be created, not used GZIP ) -AddToFileServer("linux-initrd" ${output_overlayed_rootfs_location} DEPENDS rootfs_target) + # Updated dtb based on generated initrd UpdateDtbFromInitrd( "${CAMKES_VM_IMAGES_DIR}/exynos5422/linux-dtb-virtcon" ${output_overlayed_rootfs_location} "0x4d700000" - dtb_gen_target + dtb_gen_target # helper CMake target to be created, not used output_dtb_location - DEPENDS - rootfs_target ) -AddToFileServer("linux-dtb" "${output_dtb_location}" DEPENDS dtb_gen_target) AddCamkesCPPFlag(cpp_flags CONFIG_VARS VmEmmc2NoDMA VmVUSB Tk1DeviceFwd Tk1Insecure) -DefineCAmkESVMFileServer() +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +# There is no need to specify an explicit dependency on the helper targets +# 'rootfs_target' and 'dtb_gen_target' +DefineCAmkESVMFileServer( + FILES + "linux:${CAMKES_VM_IMAGES_DIR}/exynos5422/linux" + "linux-initrd:${output_overlayed_rootfs_location}" + "linux-dtb:${output_dtb_location}" +) CAmkESAddImportPath(exynos5422) diff --git a/apps/Arm/vm_virtio_net/CMakeLists.txt b/apps/Arm/vm_virtio_net/CMakeLists.txt index 77fca436..6afd3656 100644 --- a/apps/Arm/vm_virtio_net/CMakeLists.txt +++ b/apps/Arm/vm_virtio_net/CMakeLists.txt @@ -58,25 +58,20 @@ AddOverlayDirToRootfs( "buildroot" "rootfs_install" output_overlayed_rootfs_location - rootfs_target + rootfs_target # helper CMake target to be created, not used 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 + dtb_gen_target # helper CMake target to be created, not used output_dtb_location - DEPENDS - rootfs_target ) -AddToFileServer("linux-dtb" "${output_dtb_location}" DEPENDS dtb_gen_target) -AddToFileServer("linux-initrd" ${output_overlayed_rootfs_location} DEPENDS rootfs_target) -AddToFileServer("linux" "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux") - AddCamkesCPPFlag( cpp_flags CONFIG_VARS @@ -87,7 +82,16 @@ AddCamkesCPPFlag( VmVirtioNetVirtqueue ) -DefineCAmkESVMFileServer() +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +# There is no need to specify an explicit dependency on the helper targets +# 'rootfs_target' or 'dtb_gen_target' +DefineCAmkESVMFileServer( + FILES + "linux:${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux" + "linux-initrd:${output_overlayed_rootfs_location}" + "linux-dtb:${output_dtb_location}" +) CAmkESAddImportPath(${KernelARMPlatform}) diff --git a/apps/x86/cma34cr_centos/CMakeLists.txt b/apps/x86/cma34cr_centos/CMakeLists.txt index 4c389037..e6e9a67f 100644 --- a/apps/x86/cma34cr_centos/CMakeLists.txt +++ b/apps/x86/cma34cr_centos/CMakeLists.txt @@ -18,21 +18,28 @@ DeclareCAmkESVM(Init0 EXTRA_SOURCES ${init0_extra} EXTRA_LIBS ethdrivers) # Declare C162 Kernel DecompressLinuxKernel( - decompress_linux decompressed_kernel ${CMAKE_CURRENT_SOURCE_DIR}/centos_linux/bzimage + decompress_linux # helper CMake target to be created, not used + decompressed_kernel + ${CMAKE_CURRENT_SOURCE_DIR}/centos_linux/bzimage ) -AddToFileServer("bzimage" ${decompressed_kernel} DEPENDS decompress_linux) - -# Declare C162 Rootfs -AddToFileServer("rootfs.cpio" ${CMAKE_CURRENT_SOURCE_DIR}/centos_linux/rootfs.cpio) # Provided by find_package(util_libs) include(${LWIP_HELPERS}) # Declare lwipopts.h include AddLWIPConfiguration(${CMAKE_CURRENT_SOURCE_DIR}/lwip_include) -# Initialise CAmkES Root Server with addition CPP includes -DeclareCAmkESVMRootServer( - cma34cr_centos.camkes +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +# There is no need to specify an explicit dependency on the helper target +# 'decompress_linux'. +DefineCAmkESVMFileServer( + FILES "bzimage:${decompressed_kernel}" + "rootfs.cpio:${CMAKE_CURRENT_SOURCE_DIR}/centos_linux/rootfs.cpio" +) + +# Declare CAmkES Root Server +DeclareCAmkESRootserver( + "cma34cr_centos.camkes" CPP_INCLUDES ${CAMKES_VM_DIR}/components/StringReverse/include ${CAMKES_VM_DIR}/components/Ethdriver/include diff --git a/apps/x86/cma34cr_ubuntu/CMakeLists.txt b/apps/x86/cma34cr_ubuntu/CMakeLists.txt index 84855785..44c22076 100644 --- a/apps/x86/cma34cr_ubuntu/CMakeLists.txt +++ b/apps/x86/cma34cr_ubuntu/CMakeLists.txt @@ -20,11 +20,20 @@ DeclareCAmkESVM(Init0) # Declare C162 Kernel GetArchSpecificLinuxKernelFile("32" kernel_file) -DecompressLinuxKernel(extract_linux_kernel decompressed_kernel ${kernel_file}) -AddToFileServer("bzimage" ${decompressed_kernel} DEPENDS extract_linux_kernel) - -# Declare C162 Rootfs -AddToFileServer("rootfs.cpio" ${CMAKE_CURRENT_SOURCE_DIR}/ubuntu_linux/rootfs.cpio) - -# Initialise CAmkES Root Server with addition CPP includes -DeclareCAmkESVMRootServer(cma34cr_ubuntu.camkes) +DecompressLinuxKernel( + extract_linux_kernel # helper CMake target to be created, not used + decompressed_kernel + ${kernel_file} +) + +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +# There is no need to specify an explicit dependency on the helper target +# 'extract_linux_kernel'. +DefineCAmkESVMFileServer( + FILES "bzimage:${decompressed_kernel}" + "rootfs.cpio:${CMAKE_CURRENT_SOURCE_DIR}/ubuntu_linux/rootfs.cpio" +) + +# Declare CAmkES Root Server +DeclareCAmkESRootserver("cma34cr_centos.camkes") diff --git a/apps/x86/minimal/CMakeLists.txt b/apps/x86/minimal/CMakeLists.txt index 6888adc4..0f0254b3 100644 --- a/apps/x86/minimal/CMakeLists.txt +++ b/apps/x86/minimal/CMakeLists.txt @@ -24,14 +24,20 @@ GetDefaultLinuxKernelFile(kernel_file) GetDefaultLinuxRootfsFile(rootfs_file) # Decompress Linux Kernel image and add to file server -DecompressLinuxKernel(extract_linux_kernel decompressed_kernel ${kernel_file}) -AddToFileServer("bzimage" ${decompressed_kernel} DEPENDS extract_linux_kernel) - -# Add rootfs images into file server -AddToFileServer("rootfs.cpio" ${rootfs_file}) - -# Initialise CAmkES Root Server with addition CPP includes -DeclareCAmkESVMRootServer(minimal.camkes) +DecompressLinuxKernel( + extract_linux_kernel # helper CMake target to be created, not used + decompressed_kernel + ${kernel_file} +) + +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +# There is no need to specify an explicit dependency on the helper target +# 'extract_linux_kernel'. +DefineCAmkESVMFileServer(FILES "bzimage:${decompressed_kernel}" "rootfs.cpio:${rootfs_file}") + +# Declare CAmkES Root Server +DeclareCAmkESRootserver("minimal.camkes" CPP_INCLUDES "${VM_PROJECT_DIR}/components/VM") if(SIMULATION) include(simulation) diff --git a/apps/x86/optiplex9020/CMakeLists.txt b/apps/x86/optiplex9020/CMakeLists.txt index 8ae43a20..1b21b293 100644 --- a/apps/x86/optiplex9020/CMakeLists.txt +++ b/apps/x86/optiplex9020/CMakeLists.txt @@ -25,13 +25,22 @@ GetArchDefaultLinuxKernelFile("32" kernel_file) GetArchDefaultLinuxRootfsFile("32" rootfs_file) # Decompress Linux Kernel image -DecompressLinuxKernel(extract_linux_kernel decompressed_kernel ${kernel_file}) - -# Add Linux VM images into file server -AddToFileServer("bzimage" ${decompressed_kernel} DEPENDS extract_linux_kernel) -AddToFileServer("rootfs.cpio" ${rootfs_file}) +DecompressLinuxKernel( + extract_linux_kernel # helper CMake target to be created, not used + decompressed_kernel + ${kernel_file} +) -# Initialise CAmkES Root Server with additional CPP includes -DeclareCAmkESVMRootServer( - optiplex9020.camkes CPP_INCLUDES ${CAMKES_VM_DIR}/components/StringReverse/include +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +# There is no need to specify an explicit dependency on the helper target +# 'extract_linux_kernel'. +DefineCAmkESVMFileServer(FILES "bzimage:${decompressed_kernel}" "rootfs.cpio:${rootfs_file}") + +# Declare CAmkES Root Server +DeclareCAmkESRootserver( + "optiplex9020.camkes" + CPP_INCLUDES + "${VM_PROJECT_DIR}/components/VM" + "${CAMKES_VM_DIR}/components/StringReverse/include" ) diff --git a/apps/x86/virtio_blk_sample/CMakeLists.txt b/apps/x86/virtio_blk_sample/CMakeLists.txt index e6160dcd..f6f6cd76 100644 --- a/apps/x86/virtio_blk_sample/CMakeLists.txt +++ b/apps/x86/virtio_blk_sample/CMakeLists.txt @@ -21,12 +21,20 @@ GetDefaultLinuxKernelFile(kernel_file) GetDefaultLinuxRootfsFile(rootfs_file) # Decompress Linux Kernel image and add to file server -DecompressLinuxKernel(extract_linux_kernel decompressed_kernel ${kernel_file}) -AddToFileServer("bzimage" ${decompressed_kernel} DEPENDS extract_linux_kernel) - -AddToFileServer("rootfs.cpio" ${rootfs_file}) - -DeclareCAmkESVMRootServer(virtio_blk_sample.camkes) +DecompressLinuxKernel( + extract_linux_kernel # helper CMake target to be created, not used + decompressed_kernel + ${kernel_file} +) + +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +# There is no need to specify an explicit dependency on the helper target +# 'extract_linux_kernel'. +DefineCAmkESVMFileServer(FILES "bzimage:${decompressed_kernel}" "rootfs.cpio:${rootfs_file}") + +# Declare CAmkES Root Server +DeclareCAmkESRootserver("virtio_blk_sample.camkes") if(SIMULATION) include(simulation) diff --git a/apps/x86/zmq_samples/CMakeLists.txt b/apps/x86/zmq_samples/CMakeLists.txt index f8d80204..4b35e913 100644 --- a/apps/x86/zmq_samples/CMakeLists.txt +++ b/apps/x86/zmq_samples/CMakeLists.txt @@ -135,6 +135,8 @@ AddZMQBinary(worker) AddZMQBinary(pub) AddZMQBinary(sub) +set(rootfs_images "") + foreach(i RANGE ${NumberVMsLess1}) set(overlay_target "overlay_vm${i}") set(rootfs_target "rootfs_target_vm${i}") @@ -153,14 +155,23 @@ foreach(i RANGE ${NumberVMsLess1}) "buildroot" "rootfs_install" rootfs_img - "${rootfs_target}" + "${rootfs_target}" # helper CMake target to be created, not used ) - AddToFileServer("vm${i}_rootfs.cpio" "${rootfs_img}" DEPENDS "${rootfs_target}") + list(APPEND rootfs_images "vm${i}_rootfs.cpio:${rootfs_img}") endforeach() # Decompress Linux Kernel image and add to file server -DecompressLinuxKernel(extract_linux_kernel decompressed_kernel ${kernel_file}) -AddToFileServer("bzimage" ${decompressed_kernel} DEPENDS extract_linux_kernel) +DecompressLinuxKernel( + extract_linux_kernel # helper CMake target to be created, not used + decompressed_kernel + ${kernel_file} +) + +# Create file server with VM images. There is an implicit dependency on the +# input files, so the rules above will be invoked to generate/update the files. +# There is no need to specify an explicit dependency on the helper targets +# 'extract_linux_kernel' and each '${rootfs_target}' +DefineCAmkESVMFileServer(FILES "bzimage:${decompressed_kernel}" "${rootfs_images}") # Initialise CAmkES Root Server with addition CPP includes -DeclareCAmkESVMRootServer("${zmq_camkes}") +DeclareCAmkESRootserver("${zmq_camkes}" CPP_INCLUDES "${VM_PROJECT_DIR}/components/VM")