diff --git a/CMakeLists.txt b/CMakeLists.txt index 1dca8360..9038ffeb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,16 +4,12 @@ # SPDX-License-Identifier: BSD-2-Clause # -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.16.0) set(configure_string "") config_option( - CAmkESVMGuestDMAIommu - CAMKES_VM_GUEST_DMA_IOMMU - "Enable DMA through the IOMMU" - DEFAULT - ON + CAmkESVMGuestDMAIommu CAMKES_VM_GUEST_DMA_IOMMU "Enable DMA through the IOMMU" DEFAULT ON ) # Create VMM configuration library @@ -35,22 +31,10 @@ add_subdirectory(libs/libvirtio camkes-arm-vm/libs/libvirtio) # Declare connectors with templates. # We can rely on the naming scheme being consistent to allow for easier declaration. -foreach( - connector - IN - ITEMS - seL4UDPSend - seL4UDPRecv - seL4PicoUDPSend - seL4PicoUDPRecv - seL4MultiSharedData - seL4Sataserver +foreach(connector IN ITEMS seL4UDPSend seL4UDPRecv seL4PicoUDPSend seL4PicoUDPRecv + seL4MultiSharedData seL4Sataserver ) DeclareCAmkESConnector( - ${connector} - FROM - ${connector}-from.template.c - TO - ${connector}-to.template.c + ${connector} FROM ${connector}-from.template.c TO ${connector}-to.template.c ) endforeach() diff --git a/Findcamkes-arm-vm.cmake b/Findcamkes-arm-vm.cmake index 9797c5cd..9b59be40 100644 --- a/Findcamkes-arm-vm.cmake +++ b/Findcamkes-arm-vm.cmake @@ -4,8 +4,14 @@ # SPDX-License-Identifier: BSD-2-Clause # -set(CAMKES_ARM_VM_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE STRING "") -set(CAMKES_ARM_VM_HELPERS_PATH "${CMAKE_CURRENT_LIST_DIR}/arm_vm_helpers.cmake" CACHE STRING "") +set(CAMKES_ARM_VM_DIR + "${CMAKE_CURRENT_LIST_DIR}" + CACHE STRING "" +) +set(CAMKES_ARM_VM_HELPERS_PATH + "${CMAKE_CURRENT_LIST_DIR}/arm_vm_helpers.cmake" + CACHE STRING "" +) mark_as_advanced(CAMKES_ARM_VM_DIR CAMKES_ARM_VM_HELPERS_PATH) macro(camkes_arm_vm_import_project) @@ -16,10 +22,7 @@ macro(camkes_arm_vm_import_project) CAmkESAddImportPath(${CAMKES_ARM_VM_DIR}/interfaces camkes-arm-vm/interfaces) CAmkESAddTemplatesPath(${CAMKES_ARM_VM_DIR}/templates camkes-arm-vm/templates) DeclareCAmkESConnector( - seL4VMDTBPassthrough - FROM - seL4VMDTBPassthrough-from.template.c - TO + seL4VMDTBPassthrough FROM seL4VMDTBPassthrough-from.template.c TO seL4VMDTBPassthrough-to.template.c ) @@ -47,8 +50,5 @@ endmacro() include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS( - camkes-arm-vm - DEFAULT_MSG - CAMKES_ARM_VM_DIR - CAMKES_ARM_VM_HELPERS_PATH + camkes-arm-vm DEFAULT_MSG CAMKES_ARM_VM_DIR CAMKES_ARM_VM_HELPERS_PATH ) diff --git a/Findcamkes-vm.cmake b/Findcamkes-vm.cmake index 8d16585f..854380a7 100644 --- a/Findcamkes-vm.cmake +++ b/Findcamkes-vm.cmake @@ -4,9 +4,18 @@ # SPDX-License-Identifier: BSD-2-Clause # -set(CAMKES_VM_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE STRING "") -set(CAMKES_VM_HELPERS_PATH "${CMAKE_CURRENT_LIST_DIR}/camkes_vm_helpers.cmake" CACHE STRING "") -set(CAMKES_VM_SETTINGS_PATH "${CMAKE_CURRENT_LIST_DIR}/camkes_vm_settings.cmake" CACHE STRING "") +set(CAMKES_VM_DIR + "${CMAKE_CURRENT_LIST_DIR}" + CACHE STRING "" +) +set(CAMKES_VM_HELPERS_PATH + "${CMAKE_CURRENT_LIST_DIR}/camkes_vm_helpers.cmake" + CACHE STRING "" +) +set(CAMKES_VM_SETTINGS_PATH + "${CMAKE_CURRENT_LIST_DIR}/camkes_vm_settings.cmake" + CACHE STRING "" +) mark_as_advanced(CAMKES_VM_DIR CAMKES_VM_HELPERS_PATH CAMKES_VM_SETTINGS_PATH) macro(camkes_x86_vm_setup_x86_vm_environment) @@ -25,9 +34,5 @@ endmacro() include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS( - camkes-vm - DEFAULT_MSG - CAMKES_VM_DIR - CAMKES_VM_HELPERS_PATH - CAMKES_VM_SETTINGS_PATH + camkes-vm DEFAULT_MSG CAMKES_VM_DIR CAMKES_VM_HELPERS_PATH CAMKES_VM_SETTINGS_PATH ) diff --git a/arm_vm_helpers.cmake b/arm_vm_helpers.cmake index 4aea6663..4089492f 100644 --- a/arm_vm_helpers.cmake +++ b/arm_vm_helpers.cmake @@ -4,8 +4,11 @@ # SPDX-License-Identifier: BSD-2-Clause # -cmake_minimum_required(VERSION 3.8.2) -set(ARM_VM_PROJECT_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "") +cmake_minimum_required(VERSION 3.16.0) +set(ARM_VM_PROJECT_DIR + "${CMAKE_CURRENT_LIST_DIR}" + CACHE INTERNAL "" +) # Function appends a given list of CMake config variables as CAmkES CPP flags # 'configure_string': The variable to append the CPP flags onto @@ -28,21 +31,19 @@ function(AddCamkesCPPFlag configure_string) endif() endforeach() # Update the configure_string value - set(${configure_string} "${${configure_string}}" PARENT_SCOPE) + set(${configure_string} + "${${configure_string}}" + PARENT_SCOPE + ) endfunction(AddCamkesCPPFlag) function(DeclareCAmkESARMVM init_component) cmake_parse_arguments( - PARSE_ARGV - 1 - VM_COMP - "" - "" + PARSE_ARGV 1 VM_COMP "" "" "EXTRA_SOURCES;EXTRA_INCLUDES;EXTRA_LIBS;EXTRA_C_FLAGS;EXTRA_LD_FLAGS" ) - set( - vm_src + set(vm_src ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/main.c ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/fdt_manipulation.c ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/crossvm.c @@ -55,15 +56,14 @@ function(DeclareCAmkESARMVM init_component) endif() if(Tk1DeviceFwd) - list( - APPEND vm_src ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/plat/tk1/device_fwd.c + list(APPEND vm_src + ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/plat/tk1/device_fwd.c ) endif() # A module that is expected to exist for each platform but not required. # It should provide basic device intialisation required for every vm configuratoin - set( - platform_module + set(platform_module ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/plat/${KernelPlatform}/init.c ) if(EXISTS ${platform_module}) @@ -76,8 +76,8 @@ function(DeclareCAmkESARMVM init_component) endif() if(VmVirtioNetVirtqueue) - list( - APPEND vm_src ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/virtio_net_virtqueue.c + list(APPEND vm_src + ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/virtio_net_virtqueue.c ) endif() @@ -86,8 +86,8 @@ function(DeclareCAmkESARMVM init_component) endif() if(KernelPlatformExynos5410) - list( - APPEND vm_src ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/plat/exynos5410/init.c + list(APPEND vm_src + ${ARM_VM_PROJECT_DIR}/components/VM_Arm/src/modules/plat/exynos5410/init.c ) set(vm_plat_include "${ARM_VM_PROJECT_DIR}/components/VM_Arm/plat_include/exynos5410") elseif(KernelPlatformExynos5422) @@ -95,8 +95,7 @@ function(DeclareCAmkESARMVM init_component) elseif(KernelPlatformZynqmpUltra96v2) set(vm_plat_include "${ARM_VM_PROJECT_DIR}/components/VM_Arm/plat_include/ultra96v2") else() - set( - vm_plat_include + set(vm_plat_include "${ARM_VM_PROJECT_DIR}/components/VM_Arm/plat_include/${KernelPlatform}" ) endif() @@ -138,7 +137,10 @@ function(DeclareCAmkESARMVM init_component) seL4VMParameters.template.h ) - if(VmVirtioNetArping OR VmVirtioNetVirtqueue OR VmVirtioConsole) + if(VmVirtioNetArping + OR VmVirtioNetVirtqueue + OR VmVirtioConsole + ) DeclareCAmkESComponent(${init_component} LIBS virtioarm vswitch) endif() diff --git a/camkes_vm_helpers.cmake b/camkes_vm_helpers.cmake index 9f742fa6..bdfe305b 100644 --- a/camkes_vm_helpers.cmake +++ b/camkes_vm_helpers.cmake @@ -4,9 +4,12 @@ # SPDX-License-Identifier: BSD-2-Clause # -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.16.0) -set(VM_PROJECT_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "") +set(VM_PROJECT_DIR + "${CMAKE_CURRENT_LIST_DIR}" + CACHE INTERNAL "" +) # Function for declaring a CAmkESVM. This is called for each Init component in the applications # camkes config. @@ -15,11 +18,7 @@ set(VM_PROJECT_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE INTERNAL "") # the SOURCES, INCLUDES, LIBS, LD_FLAGS and C_FLAGS arguments. function(DeclareCAmkESVM init_component) cmake_parse_arguments( - PARSE_ARGV - 1 - VM_COMP - "" - "" + PARSE_ARGV 1 VM_COMP "" "" "EXTRA_SOURCES;EXTRA_INCLUDES;EXTRA_LIBS;EXTRA_C_FLAGS;EXTRA_LD_FLAGS" ) # Retrieve sources for Init component @@ -133,7 +132,11 @@ function(DefineCAmkESVMFileServer) foreach(element IN LISTS PARAM_DEPENDS) foreach(item IN LISTS element) if(item) - set_property(TARGET ${FSRV_TARGET} APPEND PROPERTY DEPS ${item}) + set_property( + TARGET ${FSRV_TARGET} + APPEND + PROPERTY DEPS ${item} + ) endif() endforeach() endforeach() @@ -141,13 +144,7 @@ function(DefineCAmkESVMFileServer) foreach(element IN LISTS PARAM_FILES) foreach(item IN LISTS element) # [:] if(item) - string( - REGEX - MATCH - "^([^:]+)(:([^:]+))?$" - cpio_item - "${item}" - ) + string(REGEX MATCH "^([^:]+)(:([^:]+))?$" cpio_item "${item}") if(NOT cpio_item) message(FATAL_ERROR "invalid parameter format: '${item}'") endif() @@ -179,13 +176,7 @@ function(DefineCAmkESVMFileServer) set(CPIO_FILES "") foreach(item IN LISTS files) # : - string( - REGEX - MATCH - "^([^:]+):([^:]+)$" - cpio_item - "${item}" - ) + string(REGEX MATCH "^([^:]+):([^:]+)$" cpio_item "${item}") if(NOT cpio_item) message(FATAL_ERROR "invalid CPIO file format: '${item}'") endif() @@ -195,8 +186,7 @@ function(DefineCAmkESVMFileServer) add_custom_command( OUTPUT "${CPIO_FILE}" COMMENT "copy: ${FILE_NAME} -> ${CPIO_FILE}" - COMMAND - ${CMAKE_COMMAND} -E copy "${FILE_NAME}" "${CPIO_FILE}" + COMMAND ${CMAKE_COMMAND} -E copy "${FILE_NAME}" "${CPIO_FILE}" VERBATIM DEPENDS ${FILE_NAME} ${deps} ) @@ -248,12 +238,8 @@ function(DeclareCAmkESVMRootServer camkes_config) get_absolute_source_or_binary(config_file "${camkes_config}") # Declare CAmkES root server DeclareCAmkESRootserver( - ${config_file} - CPP_FLAGS - ${CAMKES_ROOT_VM_CPP_FLAGS} - CPP_INCLUDES - "${VM_PROJECT_DIR}/components/VM" - ${CAMKES_ROOT_VM_CPP_INCLUDES} + ${config_file} CPP_FLAGS ${CAMKES_ROOT_VM_CPP_FLAGS} CPP_INCLUDES + "${VM_PROJECT_DIR}/components/VM" ${CAMKES_ROOT_VM_CPP_INCLUDES} ) endfunction(DeclareCAmkESVMRootServer) @@ -306,10 +292,18 @@ function(AddToFileServer filename_pref file_dest) add_custom_target(${FSRV_TARGET}) endif() - set_property(TARGET ${FSRV_TARGET} APPEND PROPERTY FILES "${filename_pref}:${file_dest}") + set_property( + TARGET ${FSRV_TARGET} + APPEND + PROPERTY FILES "${filename_pref}:${file_dest}" + ) if(PARAM_DEPENDS) - set_property(TARGET ${FSRV_TARGET} APPEND PROPERTY DEPS ${PARAM_DEPENDS}) + set_property( + TARGET ${FSRV_TARGET} + APPEND + PROPERTY DEPS ${PARAM_DEPENDS} + ) endif() endfunction(AddToFileServer) @@ -339,12 +333,11 @@ function(DecompressLinuxKernel decompress_target decompressed_kernel_image compr ) # Create custom target for extraction add_custom_target( - ${decompress_target} - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/decomp/${kernel_basename}" + ${decompress_target} DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/decomp/${kernel_basename}" ) # Set parameter to tell the caller location of decompressed kernel image - set( - ${decompressed_kernel_image} ${CMAKE_CURRENT_BINARY_DIR}/decomp/${kernel_basename} + set(${decompressed_kernel_image} + ${CMAKE_CURRENT_BINARY_DIR}/decomp/${kernel_basename} PARENT_SCOPE ) endfunction(DecompressLinuxKernel) diff --git a/camkes_vm_settings.cmake b/camkes_vm_settings.cmake index a054df55..fa0fc4fb 100644 --- a/camkes_vm_settings.cmake +++ b/camkes_vm_settings.cmake @@ -4,26 +4,56 @@ # SPDX-License-Identifier: BSD-2-Clause # -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.16.0) # Kernel settings -set(KernelArch x86 CACHE STRING "" FORCE) -set(KernelPlatform pc99 CACHE STRING "" FORCE) -set(KernelVTX ON CACHE BOOL "" FORCE) -set(KernelRootCNodeSizeBits 20 CACHE STRING "" FORCE) -set(KernelIRQController IOAPIC CACHE STRING "" FORCE) +set(KernelArch + x86 + CACHE STRING "" FORCE +) +set(KernelPlatform + pc99 + CACHE STRING "" FORCE +) +set(KernelVTX + ON + CACHE BOOL "" FORCE +) +set(KernelRootCNodeSizeBits + 20 + CACHE STRING "" FORCE +) +set(KernelIRQController + IOAPIC + CACHE STRING "" FORCE +) if(CAmkESVMGuestDMAIommu) - set(KernelIOMMU ON CACHE BOOL "" FORCE) + set(KernelIOMMU + ON + CACHE BOOL "" FORCE + ) endif() # Release settings -set(RELEASE OFF CACHE BOOL "Performance optimized build") +set(RELEASE + OFF + CACHE BOOL "Performance optimized build" +) # capDL settings -set(CapDLLoaderMaxObjects 900000 CACHE STRING "" FORCE) +set(CapDLLoaderMaxObjects + 900000 + CACHE STRING "" FORCE +) # Our components will all define their own heaps if needed # Otherwise we provide enough of a heap to initialise libc -set(CAmkESDefaultHeapSize 4096 CACHE STRING "" FORCE) +set(CAmkESDefaultHeapSize + 4096 + CACHE STRING "" FORCE +) # We need to pre-process our specs -set(CAmkESCPP ON CACHE BOOL "" FORCE) +set(CAmkESCPP + ON + CACHE BOOL "" FORCE +) # Set release/verification configuration ApplyCommonReleaseVerificationSettings(${RELEASE} FALSE) diff --git a/components/Echo/CMakeLists.txt b/components/Echo/CMakeLists.txt index 7393cc59..b26f83f1 100644 --- a/components/Echo/CMakeLists.txt +++ b/components/Echo/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: BSD-2-Clause # -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.16.0) project(Echo C) diff --git a/components/Firewall/CMakeLists.txt b/components/Firewall/CMakeLists.txt index ff2edfe6..5cb64bc7 100644 --- a/components/Firewall/CMakeLists.txt +++ b/components/Firewall/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: BSD-2-Clause # -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.16.0) project(Firewall C) diff --git a/components/Sataserver/CMakeLists.txt b/components/Sataserver/CMakeLists.txt index b4182e50..fd54ac3e 100644 --- a/components/Sataserver/CMakeLists.txt +++ b/components/Sataserver/CMakeLists.txt @@ -4,18 +4,15 @@ # # SPDX-License-Identifier: BSD-2-Clause # -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.16.0) project(Sataserver C) set(configure_string "") config_option( - SataserverUseAHCI - SATASERVER_USE_AHCI - "Enables the use of SATA AHCI interface for the Sataserver." - DEFAULT - OFF + SataserverUseAHCI SATASERVER_USE_AHCI + "Enables the use of SATA AHCI interface for the Sataserver." DEFAULT OFF ) add_config_library(sataserver "${configure_string}") diff --git a/components/StringReverse/CMakeLists.txt b/components/StringReverse/CMakeLists.txt index e84198cd..6ec39d55 100644 --- a/components/StringReverse/CMakeLists.txt +++ b/components/StringReverse/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: BSD-2-Clause # -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.16.0) project(StringReverse C) diff --git a/components/UDPServer/CMakeLists.txt b/components/UDPServer/CMakeLists.txt index 5c8108ef..403a00fe 100644 --- a/components/UDPServer/CMakeLists.txt +++ b/components/UDPServer/CMakeLists.txt @@ -4,8 +4,17 @@ # SPDX-License-Identifier: BSD-2-Clause # -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.16.0) project(UDPServer C) -DeclareCAmkESComponent(UDPServer SOURCES src/udpserver.c LIBS sel4camkes ethdrivers lwip sel4vspace) +DeclareCAmkESComponent( + UDPServer + SOURCES + src/udpserver.c + LIBS + sel4camkes + ethdrivers + lwip + sel4vspace +) diff --git a/components/VM_Arm/CMakeLists.txt b/components/VM_Arm/CMakeLists.txt index 7d6ab734..a29ade24 100644 --- a/components/VM_Arm/CMakeLists.txt +++ b/components/VM_Arm/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: BSD-2-Clause # -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.16.0) project(VM C) @@ -12,20 +12,27 @@ set(configure_string "") # ARM VM Configuration Options config_option( - VmOnDemandDeviceInstall - VM_ONDEMAND_DEVICE_INSTALL - "Allow the VMM to install arbitrary devices into the VM as they are accessed." - DEFAULT - ON + VmOnDemandDeviceInstall VM_ONDEMAND_DEVICE_INSTALL + "Allow the VMM to install arbitrary devices into the VM as they are accessed." DEFAULT ON ) -config_option(VmEmmc2NoDMA VM_EMMC2_NODMA "SD access control to prevent DMA \ +config_option( + VmEmmc2NoDMA VM_EMMC2_NODMA "SD access control to prevent DMA \ Installs SD card into the VM with read only access. Write access is \ - trapped and emulated to ensure that DMA is not used." DEFAULT OFF) + trapped and emulated to ensure that DMA is not used." DEFAULT OFF +) -config_option(VmVUSB VM_VUSB "Para-virtual USB driver \ +config_option( + VmVUSB + VM_VUSB + "Para-virtual USB driver \ Selects the device tree which enables the para virtual USB driver and \ - installs the device into the VM." DEPENDS "KernelPlatformExynos5410" DEFAULT OFF) + installs the device into the VM." + DEPENDS + "KernelPlatformExynos5410" + DEFAULT + OFF +) config_option( VmPCISupport @@ -112,19 +119,13 @@ config_option( ) config_option( - VmInitRdFile - VM_INITRD_FILE - "Enables the option for the VM to open and load a seperate initrd file" - DEFAULT - OFF + VmInitRdFile VM_INITRD_FILE + "Enables the option for the VM to open and load a seperate initrd file" DEFAULT OFF ) config_option( - VmDtbFile - VM_DTB_FILE - "Enables the option for the VM to open and load a seperate dtb file" - DEFAULT - OFF + VmDtbFile VM_DTB_FILE "Enables the option for the VM to open and load a seperate dtb file" + DEFAULT OFF ) config_option( diff --git a/libs/libvirtio/CMakeLists.txt b/libs/libvirtio/CMakeLists.txt index b424dac2..6f9519c2 100644 --- a/libs/libvirtio/CMakeLists.txt +++ b/libs/libvirtio/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: BSD-2-Clause # -cmake_minimum_required(VERSION 3.8.2) +cmake_minimum_required(VERSION 3.16.0) project(libvirtio C) @@ -16,4 +16,12 @@ add_library(virtioarm STATIC EXCLUDE_FROM_ALL ${sources}) target_include_directories(virtioarm PUBLIC include plat_include/${KernelPlatform}) -target_link_libraries(virtioarm muslc sel4 sel4camkes sel4vm sel4vmmplatsupport sel4_autoconf) +target_link_libraries( + virtioarm + muslc + sel4 + sel4camkes + sel4vm + sel4vmmplatsupport + sel4_autoconf +)