Skip to content

Commit

Permalink
CMake: remove redundancy
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Heider <[email protected]>
  • Loading branch information
Axel Heider committed Jan 2, 2024
1 parent 8ddf7c1 commit 9f936d3
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 32 deletions.
10 changes: 6 additions & 4 deletions apps/Arm/odroid_vm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,18 @@ set(linux_binary_name "${CAMKES_ARM_LINUX_DIR}/linux")

# Different device tree if compiling with VmVUSB
if(VmVUSB)
set(device_tree_src "linux-secure-vusb-dtb")
set(device_tree_src "${CAMKES_ARM_LINUX_DIR}/linux-secure-vusb-dtb")
else()
set(device_tree_src "linux-secure-dtb")
set(device_tree_src "${CAMKES_ARM_LINUX_DIR}/linux-secure-dtb")
endif()

# Sed the device tree updating the rootfs name
set(linux_dtb "${CMAKE_CURRENT_BINARY_DIR}/linux/linux-dtb")
add_custom_command(
OUTPUT linux/linux-dtb
OUTPUT "${linux_dtb}"
COMMAND
bash -c
"sed \"s/root=\\/dev\\/mmcblk1p2/root=\\/dev\\/${VmRootfs}/g\" ${CAMKES_ARM_LINUX_DIR}/${device_tree_src} > linux/linux-dtb"
"sed \"s/root=\\/dev\\/mmcblk1p2/root=\\/dev\\/${VmRootfs}/g\" ${device_tree_src} > ${linux_dtb}"
VERBATIM
)
# Create custom target for setting the dtb
Expand Down
24 changes: 12 additions & 12 deletions apps/Arm/vm_minimal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ if("${KernelARMPlatform}" STREQUAL "tk1")

# Different device tree if compiling with Tk1Insecure
if(Tk1Insecure)
set(device_tree_src "linux-tk1-nonsecured.dts")
set(device_tree_src "${CAMKES_ARM_LINUX_DIR}/linux-tk1-nonsecured.dts")
else()
set(device_tree_src "linux-tk1-secure.dts")
set(device_tree_src "${CAMKES_ARM_LINUX_DIR}/linux-tk1-secure.dts")
endif()

if(VmTk1InitrdRootfs)
set(linux_binary_name "linux-tk1-initrd")
set(linux_binary_name "${CAMKES_ARM_LINUX_DIR}/linux-tk1-initrd")
else()
set(linux_binary_name "linux-tk1-debian")
set(linux_binary_name "${CAMKES_ARM_LINUX_DIR}/linux-tk1-debian")
endif()

set(output_dtb_location "${CMAKE_CURRENT_BINARY_DIR}/linux/linux-dtb")
add_custom_command(
OUTPUT linux/linux-dtb
COMMAND
bash -c
"which dtc && dtc -I dts -O dtb ${CAMKES_ARM_LINUX_DIR}/${device_tree_src} > linux/linux-dtb"
OUTPUT "${output_dtb_location}"
COMMAND bash -c "which dtc && dtc -I dts -O dtb ${device_tree_src} > ${output_dtb_location}"
VERBATIM
DEPENDS ${CAMKES_ARM_LINUX_DIR}/${device_tree_src}
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_custom_target(set_dtb DEPENDS "${output_dtb_location}")

# Add Linux VM images into file server
AddToFileServer("linux" "${CAMKES_ARM_LINUX_DIR}/${linux_binary_name}")
AddToFileServer("linux-dtb" "${CMAKE_CURRENT_BINARY_DIR}/linux/linux-dtb" DEPENDS set_dtb)
AddToFileServer("linux" "${linux_binary_name}")
AddToFileServer("linux-dtb" "${output_dtb_location}" DEPENDS set_dtb)

elseif("${KernelARMPlatform}" STREQUAL "tx1")
set(cpp_flags "-DKERNELARMPLATFORM_TX1")
Expand Down
27 changes: 11 additions & 16 deletions apps/x86/zmq_samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ find_package(camkes-vm-linux REQUIRED)
include(${CAMKES_VM_LINUX_HELPERS_PATH})

if(CAKEML_FILTER)
set(zmq_camkes "zmq_cakeml.camkes")
include("libs/cakeml_helpers.cmake")

# Number of vms.
Expand All @@ -37,6 +38,7 @@ if(CAKEML_FILTER)
50
)
else()
set(zmq_camkes "zmq_samples.camkes")
# Number of vms.
set(NumberVMs 3)
endif()
Expand Down Expand Up @@ -134,38 +136,31 @@ AddZMQBinary(pub)
AddZMQBinary(sub)

foreach(i RANGE ${NumberVMsLess1})
set(overlay_target "overlay_vm${i}")
set(rootfs_target "rootfs_target_vm${i}")
if(NOT CAKEML_FILTER)
AddFileToOverlayDir(
"S91zmq_bench"
${CMAKE_CURRENT_SOURCE_DIR}/src/user/zmq_bench_${i}.sh
"etc/init.d"
overlay_vm${i}
"${overlay_target}"
)
endif()
# Add the buildroot overlay to our bare rootfs image
AddOverlayDirToRootfs(
overlay_vm${i}
${rootfs_file}
"${overlay_target}"
"${rootfs_file}"
"buildroot"
"rootfs_install"
output_rootfs_location_vm${i}
rootfs_target_vm${i}
)
AddToFileServer(
"vm${i}_rootfs.cpio"
"${output_rootfs_location_vm${i}}"
DEPENDS
rootfs_target_vm${i}
rootfs_img
"${rootfs_target}"
)
AddToFileServer("vm${i}_rootfs.cpio" "${rootfs_img}" DEPENDS "${rootfs_target}")
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)

# Initialise CAmkES Root Server with addition CPP includes
if(CAKEML_FILTER)
DeclareCAmkESVMRootServer(zmq_cakeml.camkes)
else()
DeclareCAmkESVMRootServer(zmq_samples.camkes)
endif()
DeclareCAmkESVMRootServer("${zmq_camkes}")

0 comments on commit 9f936d3

Please sign in to comment.