Skip to content
Merged
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
82 changes: 29 additions & 53 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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(camkes-vm-linux C)

Expand Down Expand Up @@ -32,13 +32,13 @@ if(CAmkESVMDefaultBuildrootOverlay)
set(binary_dir ${CMAKE_BINARY_DIR}/camkes-linux-artifacts)

if(KernelSel4ArchX86_64)
# Get Custom toolchain for 64-bit Linux
FindCustomPollyToolchain(LINUX_TOOLCHAIN "linux-gcc-64bit-pic")
set(arch_size_dir "64")
# Get Custom toolchain for 64-bit Linux
FindCustomPollyToolchain(LINUX_TOOLCHAIN "linux-gcc-64bit-pic")
set(arch_size_dir "64")
else()
# Get Custom toolchain for 32-bit Linux
FindCustomPollyToolchain(LINUX_TOOLCHAIN "linux-gcc-32bit-pic")
set(arch_size_dir "32")
# Get Custom toolchain for 32-bit Linux
FindCustomPollyToolchain(LINUX_TOOLCHAIN "linux-gcc-32bit-pic")
set(arch_size_dir "32")
endif()

# Setup Linux Sources
Expand All @@ -47,21 +47,15 @@ if(CAmkESVMDefaultBuildrootOverlay)
GetDefaultLinuxMd5(linux_md5)
DownloadLinux(${linux_major} ${linux_minor} ${linux_md5} vm_linux_extract_dir download_vm_linux)
# Linux config and symvers are to be copied to unpacked archive
set(
linux_config
set(linux_config
"${CMAKE_CURRENT_SOURCE_DIR}/linux_configs/${linux_major}.${linux_minor}/${arch_size_dir}/config"
)
set(
linux_symvers
set(linux_symvers
"${CMAKE_CURRENT_SOURCE_DIR}/linux_configs/${linux_major}.${linux_minor}/${arch_size_dir}/Module.symvers"
)
# Configure unpacked archive with config and symvers
ConfigureLinux(
${vm_linux_extract_dir}
${linux_config}
${linux_symvers}
configure_vm_linux
DEPENDS
${vm_linux_extract_dir} ${linux_config} ${linux_symvers} configure_vm_linux DEPENDS
download_vm_linux
)

Expand All @@ -70,46 +64,32 @@ if(CAmkESVMDefaultBuildrootOverlay)
set(connector_apps_binary_dir ${binary_dir}/connector-apps)
ExternalProject_Add(
camkes-connector-apps
URL
file:///${CMAKE_CURRENT_SOURCE_DIR}/camkes-linux-artifacts/camkes-linux-apps/camkes-connector-apps
BINARY_DIR
${connector_apps_binary_dir}
BUILD_ALWAYS
ON
STAMP_DIR
${connector_apps_stamp_dir}
EXCLUDE_FROM_ALL
INSTALL_COMMAND
URL file:///${CMAKE_CURRENT_SOURCE_DIR}/camkes-linux-artifacts/camkes-linux-apps/camkes-connector-apps
BINARY_DIR ${connector_apps_binary_dir}
BUILD_ALWAYS ON
STAMP_DIR ${connector_apps_stamp_dir}
EXCLUDE_FROM_ALL INSTALL_COMMAND
""
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_TOOLCHAIN_FILE=${LINUX_32BIT_TOOLCHAIN}
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_TOOLCHAIN_FILE=${LINUX_32BIT_TOOLCHAIN}
)

# Build camkes connector modules
set(connector_modules_stamp_dir ${CMAKE_CURRENT_BINARY_DIR}/camkes-connector-modules-stamp)
set(connector_modules_binary_dir ${binary_dir}/connector-modules)
ExternalProject_Add(
camkes-connector-modules
URL
file:///${CMAKE_CURRENT_SOURCE_DIR}/camkes-linux-artifacts/camkes-linux-modules/camkes-connector-modules
BINARY_DIR
${connector_modules_binary_dir}
BUILD_ALWAYS
ON
STAMP_DIR
${connector_modules_stamp_dir}
EXCLUDE_FROM_ALL
INSTALL_COMMAND
URL file:///${CMAKE_CURRENT_SOURCE_DIR}/camkes-linux-artifacts/camkes-linux-modules/camkes-connector-modules
BINARY_DIR ${connector_modules_binary_dir}
BUILD_ALWAYS ON
STAMP_DIR ${connector_modules_stamp_dir}
EXCLUDE_FROM_ALL INSTALL_COMMAND
""
DEPENDS
download_vm_linux
configure_vm_linux
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_TOOLCHAIN_FILE=${LINUX_32BIT_TOOLCHAIN}
-DLINUX_KERNEL_DIR=${vm_linux_extract_dir}
-DMODULE_HELPERS_FILE=${CMAKE_CURRENT_SOURCE_DIR}/linux-module-helpers.cmake
DEPENDS download_vm_linux configure_vm_linux
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_TOOLCHAIN_FILE=${LINUX_32BIT_TOOLCHAIN}
-DLINUX_KERNEL_DIR=${vm_linux_extract_dir}
-DMODULE_HELPERS_FILE=${CMAKE_CURRENT_SOURCE_DIR}/linux-module-helpers.cmake
)

# Declare camkes connector apps
Expand All @@ -128,12 +108,8 @@ if(CAmkESVMDefaultBuildrootOverlay)

# Declare camkes connector modules
AddExternalProjFilesToOverlay(
camkes-connector-modules
${connector_modules_binary_dir}
default_buildroot_overlay
"lib/modules/4.8.16/kernel/drivers/vmm"
FILES
connection.ko
camkes-connector-modules ${connector_modules_binary_dir} default_buildroot_overlay
"lib/modules/4.8.16/kernel/drivers/vmm" FILES connection.ko
)

# Add additional init scripts to the default buildroot overlay
Expand Down
30 changes: 15 additions & 15 deletions Findcamkes-vm-linux.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,24 @@
# SPDX-License-Identifier: BSD-2-Clause
#

set(CAMKES_VM_LINUX_DIR "${CMAKE_CURRENT_LIST_DIR}" CACHE STRING "")
set(CAMKES_VM_LINUX_HELPERS_PATH "${CMAKE_CURRENT_LIST_DIR}/vm-linux-helpers.cmake" CACHE STRING "")
set(
CAMKES_VM_LINUX_MODULE_HELPERS_PATH "${CMAKE_CURRENT_LIST_DIR}/linux-module-helpers.cmake"
set(CAMKES_VM_LINUX_DIR
"${CMAKE_CURRENT_LIST_DIR}"
CACHE STRING ""
)
set(
CAMKES_VM_LINUX_SOURCE_HELPERS_PATH "${CMAKE_CURRENT_LIST_DIR}/linux-source-helpers.cmake"
set(CAMKES_VM_LINUX_HELPERS_PATH
"${CMAKE_CURRENT_LIST_DIR}/vm-linux-helpers.cmake"
CACHE STRING ""
)
set(CAMKES_VM_LINUX_MODULE_HELPERS_PATH
"${CMAKE_CURRENT_LIST_DIR}/linux-module-helpers.cmake"
CACHE STRING ""
)
set(CAMKES_VM_LINUX_SOURCE_HELPERS_PATH
"${CMAKE_CURRENT_LIST_DIR}/linux-source-helpers.cmake"
CACHE STRING ""
)
mark_as_advanced(
CAMKES_VM_LINUX_DIR
CAMKES_VM_LINUX_HELPERS_PATH
CAMKES_VM_LINUX_MODULE_HELPERS_PATH
CAMKES_VM_LINUX_DIR CAMKES_VM_LINUX_HELPERS_PATH CAMKES_VM_LINUX_MODULE_HELPERS_PATH
CAMKES_VM_LINUX_SOURCE_HELPERS_PATH
)

Expand All @@ -27,10 +31,6 @@ endmacro()

include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(
camkes-vm-linux
DEFAULT_MSG
CAMKES_VM_LINUX_DIR
CAMKES_VM_LINUX_HELPERS_PATH
CAMKES_VM_LINUX_MODULE_HELPERS_PATH
CAMKES_VM_LINUX_SOURCE_HELPERS_PATH
camkes-vm-linux DEFAULT_MSG CAMKES_VM_LINUX_DIR CAMKES_VM_LINUX_HELPERS_PATH
CAMKES_VM_LINUX_MODULE_HELPERS_PATH CAMKES_VM_LINUX_SOURCE_HELPERS_PATH
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: BSD-2-Clause
#

cmake_minimum_required(VERSION 3.8.2)
cmake_minimum_required(VERSION 3.16.0)

add_subdirectory(pkgs/consumes_event)
add_subdirectory(pkgs/dataport)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(consumes-event C)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(dataport C)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(emits-event C)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(string_reverse C)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# SPDX-License-Identifier: BSD-2-Clause
#

cmake_minimum_required(VERSION 3.8.2)
cmake_minimum_required(VERSION 3.16.0)

add_subdirectory(pkgs/introspect)
Original file line number Diff line number Diff line change
Expand Up @@ -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(introspect C)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(helloworld C)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: BSD-2-Clause
#

cmake_minimum_required(VERSION 3.8.2)
cmake_minimum_required(VERSION 3.16.0)

if(NOT MODULE_HELPERS_FILE)
message(FATAL_ERROR "MODULE_HELPERS_FILE is not defined")
Expand All @@ -17,10 +17,6 @@ if(NOT LINUX_KERNEL_DIR)
endif()

DefineLinuxModule(
${CMAKE_CURRENT_SOURCE_DIR}/connection
connection_output
connection_target
INCLUDES
KERNEL_DIR
${CMAKE_CURRENT_SOURCE_DIR}/connection connection_output connection_target INCLUDES KERNEL_DIR
${LINUX_KERNEL_DIR}
)
17 changes: 7 additions & 10 deletions linux-module-helpers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# SPDX-License-Identifier: BSD-2-Clause
#

cmake_minimum_required(VERSION 3.8.2)
cmake_minimum_required(VERSION 3.16.0)

# Function to define a linux kernel module. Given the directory to the
# kernel module
Expand All @@ -13,12 +13,7 @@ cmake_minimum_required(VERSION 3.8.2)
# output_module_target: Target name to be used for compiled linux kernel module
function(DefineLinuxModule module_dir output_module_location output_module_target)
cmake_parse_arguments(
PARSE_ARGV
1
DEFINE_LINUX_MODULE
""
"KERNEL_DIR;ARCH;CROSS_COMPILE"
"DEPENDS;INCLUDES"
PARSE_ARGV 1 DEFINE_LINUX_MODULE "" "KERNEL_DIR;ARCH;CROSS_COMPILE" "DEPENDS;INCLUDES"
)
# Check that the linux kerenl directory has been passed
if(NOT DEFINE_LINUX_MODULE_KERNEL_DIR)
Expand Down Expand Up @@ -64,8 +59,10 @@ function(DefineLinuxModule module_dir output_module_location output_module_targe
)
# Add target for linux module
add_custom_target(
${output_module_target} ALL
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.ko"
${output_module_target} ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.ko"
)
set(${output_module_location}
"${CMAKE_CURRENT_BINARY_DIR}/${module_name}.ko"
PARENT_SCOPE
)
set(${output_module_location} "${CMAKE_CURRENT_BINARY_DIR}/${module_name}.ko" PARENT_SCOPE)
endfunction(DefineLinuxModule)
Loading