run style formatter
Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
This commit is contained in:
parent
5295c0774a
commit
028faaabc6
|
@ -9,7 +9,6 @@ include(settings.cmake)
|
||||||
|
|
||||||
project(sel4webserver C ASM)
|
project(sel4webserver C ASM)
|
||||||
|
|
||||||
|
|
||||||
find_package(camkes-arm-vm REQUIRED)
|
find_package(camkes-arm-vm REQUIRED)
|
||||||
camkes_arm_vm_setup_arm_vm_environment()
|
camkes_arm_vm_setup_arm_vm_environment()
|
||||||
|
|
||||||
|
@ -36,32 +35,77 @@ elseif("${PLATFORM}" STREQUAL "qemu-arm-virt")
|
||||||
endif()
|
endif()
|
||||||
elseif("${PLATFORM}" STREQUAL "odroidc2")
|
elseif("${PLATFORM}" STREQUAL "odroidc2")
|
||||||
set(cpp_flags "-DKERNELARMPLATFORM_ODROIDC2")
|
set(cpp_flags "-DKERNELARMPLATFORM_ODROIDC2")
|
||||||
set(CAMKES_ROOT_DTB_FILE_PATH "${CAMKES_VM_IMAGES_DIR}/odroidc2/camkes-linux-dtb" CACHE STRING "")
|
set(
|
||||||
|
CAMKES_ROOT_DTB_FILE_PATH "${CAMKES_VM_IMAGES_DIR}/odroidc2/camkes-linux-dtb"
|
||||||
|
CACHE STRING ""
|
||||||
|
)
|
||||||
AddToFileServer("linux-dtb" "${CAMKES_VM_IMAGES_DIR}/odroidc2/linux_crossvm-dtb")
|
AddToFileServer("linux-dtb" "${CAMKES_VM_IMAGES_DIR}/odroidc2/linux_crossvm-dtb")
|
||||||
elseif("${PLATFORM}" STREQUAL "tx2")
|
elseif("${PLATFORM}" STREQUAL "tx2")
|
||||||
set(cpp_flags "-DKERNELARMPLATFORM_TX2")
|
set(cpp_flags "-DKERNELARMPLATFORM_TX2")
|
||||||
set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/rootfs.cpio.gz")
|
set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/rootfs.cpio.gz")
|
||||||
set(dtb_file "${CAMKES_VM_IMAGES_DIR}/tx2/linux-ethernet-dtb")
|
set(dtb_file "${CAMKES_VM_IMAGES_DIR}/tx2/linux-ethernet-dtb")
|
||||||
set(CAMKES_ROOT_DTB_FILE_PATH "${CAMKES_VM_IMAGES_DIR}/tx2/linux-ethernet-dtb" CACHE STRING "")
|
set(CAMKES_ROOT_DTB_FILE_PATH "${CAMKES_VM_IMAGES_DIR}/tx2/linux-ethernet-dtb" CACHE STRING "")
|
||||||
AddFileToOverlayDir("connection.ko" "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/connection.ko" "lib/modules/4.4.38L4T kernel 4.4.38/kernel/drivers/vmm" overlay)
|
AddFileToOverlayDir(
|
||||||
|
"connection.ko"
|
||||||
|
"${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/connection.ko"
|
||||||
|
"lib/modules/4.4.38L4T kernel 4.4.38/kernel/drivers/vmm"
|
||||||
|
overlay
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(MULTI_VM_LAN)
|
if(MULTI_VM_LAN)
|
||||||
# Setup our passthrough vm overlay
|
# Setup our passthrough vm overlay
|
||||||
AddFileToOverlayDir("inittab" ${CMAKE_CURRENT_SOURCE_DIR}/overlay_files/inittab_hvc0 "etc" overlay_vm0)
|
AddFileToOverlayDir(
|
||||||
AddFileToOverlayDir("S90bridge_setup" ${CMAKE_CURRENT_SOURCE_DIR}/overlay_files/vm0_bridge_setup.sh "etc/init.d" overlay_vm0)
|
"inittab"
|
||||||
AddOverlayDirToRootfs(overlay_vm0 ${rootfs_file} "buildroot" "rootfs_install"
|
${CMAKE_CURRENT_SOURCE_DIR}/overlay_files/inittab_hvc0
|
||||||
vm0_output_overlayed_rootfs_location rootfs_target_vm0
|
"etc"
|
||||||
GZIP)
|
overlay_vm0
|
||||||
|
)
|
||||||
|
AddFileToOverlayDir(
|
||||||
|
"S90bridge_setup"
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/overlay_files/vm0_bridge_setup.sh
|
||||||
|
"etc/init.d"
|
||||||
|
overlay_vm0
|
||||||
|
)
|
||||||
|
AddOverlayDirToRootfs(
|
||||||
|
overlay_vm0
|
||||||
|
${rootfs_file}
|
||||||
|
"buildroot"
|
||||||
|
"rootfs_install"
|
||||||
|
vm0_output_overlayed_rootfs_location
|
||||||
|
rootfs_target_vm0
|
||||||
|
GZIP
|
||||||
|
)
|
||||||
# Setup our client vm overlays
|
# Setup our client vm overlays
|
||||||
AddFileToOverlayDir("inittab" ${CMAKE_CURRENT_SOURCE_DIR}/overlay_files/inittab_hvc0 "etc" overlay_client_vm)
|
AddFileToOverlayDir(
|
||||||
|
"inittab"
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/overlay_files/inittab_hvc0
|
||||||
|
"etc"
|
||||||
|
overlay_client_vm
|
||||||
|
)
|
||||||
lighttpd_install_to_overlay(overlay_client_vm)
|
lighttpd_install_to_overlay(overlay_client_vm)
|
||||||
docsite_install_to_overlay(overlay_client_vm)
|
docsite_install_to_overlay(overlay_client_vm)
|
||||||
AddOverlayDirToRootfs(overlay_client_vm ${rootfs_file} "buildroot" "rootfs_install"
|
AddOverlayDirToRootfs(
|
||||||
client_output_overlayed_rootfs_location rootfs_target_client_vm
|
overlay_client_vm
|
||||||
GZIP)
|
${rootfs_file}
|
||||||
AddToFileServer("linux-initrd-vm0" "${vm0_output_overlayed_rootfs_location}" DEPENDS rootfs_target_vm0)
|
"buildroot"
|
||||||
AddToFileServer("linux-initrd-vm-client" "${client_output_overlayed_rootfs_location}" DEPENDS rootfs_target_client_vm)
|
"rootfs_install"
|
||||||
|
client_output_overlayed_rootfs_location
|
||||||
|
rootfs_target_client_vm
|
||||||
|
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
|
||||||
|
)
|
||||||
else()
|
else()
|
||||||
|
|
||||||
# Build crossvm kernel module for qemu
|
# Build crossvm kernel module for qemu
|
||||||
|
@ -91,13 +135,17 @@ else()
|
||||||
""
|
""
|
||||||
CONFIGURE_COMMAND
|
CONFIGURE_COMMAND
|
||||||
""
|
""
|
||||||
USES_TERMINAL_DOWNLOAD TRUE
|
USES_TERMINAL_DOWNLOAD
|
||||||
|
TRUE
|
||||||
SOURCE_DIR
|
SOURCE_DIR
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/linux_out
|
${CMAKE_CURRENT_BINARY_DIR}/linux_out
|
||||||
)
|
)
|
||||||
# Linux config and symvers are to be copied to unpacked archive
|
# Linux config and symvers are to be copied to unpacked archive
|
||||||
set(linux_config "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux_configs/config")
|
set(linux_config "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux_configs/config")
|
||||||
set(linux_symvers "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux_configs/Module.symvers")
|
set(
|
||||||
|
linux_symvers
|
||||||
|
"${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/linux_configs/Module.symvers"
|
||||||
|
)
|
||||||
# Configure unpacked archive with config and symvers
|
# Configure unpacked archive with config and symvers
|
||||||
ConfigureLinux(
|
ConfigureLinux(
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/linux_out
|
${CMAKE_CURRENT_BINARY_DIR}/linux_out
|
||||||
|
@ -161,7 +209,8 @@ else()
|
||||||
ON
|
ON
|
||||||
EXCLUDE_FROM_ALL
|
EXCLUDE_FROM_ALL
|
||||||
CMAKE_ARGS
|
CMAKE_ARGS
|
||||||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} -DCMAKE_C_FLAGS=${BASE_C_FLAGS}
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
||||||
|
-DCMAKE_C_FLAGS=${BASE_C_FLAGS}
|
||||||
)
|
)
|
||||||
|
|
||||||
AddExternalProjFilesToOverlay(
|
AddExternalProjFilesToOverlay(
|
||||||
|
@ -174,7 +223,6 @@ else()
|
||||||
)
|
)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
||||||
# Generate overlayed rootfs
|
# Generate overlayed rootfs
|
||||||
AddOverlayDirToRootfs(
|
AddOverlayDirToRootfs(
|
||||||
overlay
|
overlay
|
||||||
|
@ -204,11 +252,15 @@ DefineCAmkESVMFileServer()
|
||||||
|
|
||||||
CAmkESAddImportPath(${KernelARMPlatform})
|
CAmkESAddImportPath(${KernelARMPlatform})
|
||||||
|
|
||||||
|
|
||||||
# Define our demo component that shares a dataport with the VM
|
# Define our demo component that shares a dataport with the VM
|
||||||
include(cpio)
|
include(cpio)
|
||||||
MakeCPIO(secure_file_archive.o ${CMAKE_CURRENT_SOURCE_DIR}/secure_file.html)
|
MakeCPIO(secure_file_archive.o ${CMAKE_CURRENT_SOURCE_DIR}/secure_file.html)
|
||||||
DeclareCAmkESComponent(LoggingFileserver SOURCES components/logging-fileserver/fileserver.c secure_file_archive.o)
|
DeclareCAmkESComponent(
|
||||||
|
LoggingFileserver
|
||||||
|
SOURCES
|
||||||
|
components/logging-fileserver/fileserver.c
|
||||||
|
secure_file_archive.o
|
||||||
|
)
|
||||||
|
|
||||||
# Define our VM Component with out cross vm dataports glue code
|
# Define our VM Component with out cross vm dataports glue code
|
||||||
DeclareCAmkESComponent(VM SOURCES src/cross_vm_connections.c)
|
DeclareCAmkESComponent(VM SOURCES src/cross_vm_connections.c)
|
||||||
|
|
|
@ -17,21 +17,24 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
void block_event(int fd) {
|
void block_event(int fd)
|
||||||
int val;
|
{
|
||||||
/* Blocking read */
|
int val;
|
||||||
int result = read(fd, &val, sizeof(val));
|
/* Blocking read */
|
||||||
if (result < 0) {
|
int result = read(fd, &val, sizeof(val));
|
||||||
printf("Error: %s\n", strerror(errno));
|
if (result < 0) {
|
||||||
}
|
printf("Error: %s\n", strerror(errno));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void emit_event(char* emit) {
|
void emit_event(char *emit)
|
||||||
emit[0] = 1;
|
{
|
||||||
|
emit[0] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void memcpy_byte(void *dst, void *src, size_t size) {
|
void memcpy_byte(void *dst, void *src, size_t size)
|
||||||
|
{
|
||||||
char *dst_c = dst;
|
char *dst_c = dst;
|
||||||
char *src_c = src;
|
char *src_c = src;
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
|
|
|
@ -20,7 +20,8 @@ extern void done_emit_underlying(void);
|
||||||
|
|
||||||
#define MAX_FILENAME_LENGTH 200
|
#define MAX_FILENAME_LENGTH 200
|
||||||
|
|
||||||
void pre_init() {
|
void pre_init()
|
||||||
|
{
|
||||||
/* install the _cpio_archive */
|
/* install the _cpio_archive */
|
||||||
unsigned long cpio_size = _cpio_archive_end - _cpio_archive;
|
unsigned long cpio_size = _cpio_archive_end - _cpio_archive;
|
||||||
muslcsys_install_cpio_interface(_cpio_archive, cpio_size, cpio_get_file);
|
muslcsys_install_cpio_interface(_cpio_archive, cpio_size, cpio_get_file);
|
||||||
|
@ -31,11 +32,11 @@ int run(void)
|
||||||
{
|
{
|
||||||
/* Zero out the data port */
|
/* Zero out the data port */
|
||||||
memset(dest, '\0', 4096);
|
memset(dest, '\0', 4096);
|
||||||
char* dest_c = (char*)dest;
|
char *dest_c = (char *)dest;
|
||||||
char filename[MAX_FILENAME_LENGTH] = {0};
|
char filename[MAX_FILENAME_LENGTH] = {0};
|
||||||
while (1) {
|
while (1) {
|
||||||
ready_wait();
|
ready_wait();
|
||||||
strncpy(filename, dest_c+strlen("/"), MAX_FILENAME_LENGTH-1);
|
strncpy(filename, dest_c + strlen("/"), MAX_FILENAME_LENGTH - 1);
|
||||||
int fd = open(filename, O_RDONLY);
|
int fd = open(filename, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
snprintf(dest_c, 4, "404");
|
snprintf(dest_c, 4, "404");
|
||||||
|
|
|
@ -24,7 +24,8 @@ macro(docsite_build_site_tar outfile)
|
||||||
ON
|
ON
|
||||||
BUILD_IN_SOURCE
|
BUILD_IN_SOURCE
|
||||||
TRUE
|
TRUE
|
||||||
USES_TERMINAL_BUILD TRUE
|
USES_TERMINAL_BUILD
|
||||||
|
TRUE
|
||||||
BUILD_COMMAND
|
BUILD_COMMAND
|
||||||
"make;build"
|
"make;build"
|
||||||
INSTALL_COMMAND
|
INSTALL_COMMAND
|
||||||
|
|
|
@ -10,7 +10,13 @@ set(LIGHTTPD_RUN_SCRIPT "${LIGHTTPD_DIR}/lighttpd.sh" CACHE STRING "")
|
||||||
mark_as_advanced(LIGHTTPD_DIR LIGHTTPD_CONF LIGHTTPD_RUN_SCRIPT)
|
mark_as_advanced(LIGHTTPD_DIR LIGHTTPD_CONF LIGHTTPD_RUN_SCRIPT)
|
||||||
|
|
||||||
macro(lighttpd_build_server outfile)
|
macro(lighttpd_build_server outfile)
|
||||||
string(REGEX MATCH "^(.+)\-$" config_host "${CROSS_COMPILER_PREFIX}" )
|
string(
|
||||||
|
REGEX
|
||||||
|
MATCH
|
||||||
|
"^(.+)\-$"
|
||||||
|
config_host
|
||||||
|
"${CROSS_COMPILER_PREFIX}"
|
||||||
|
)
|
||||||
set(config_host "${CMAKE_MATCH_1}")
|
set(config_host "${CMAKE_MATCH_1}")
|
||||||
include(ExternalProject)
|
include(ExternalProject)
|
||||||
# Static compile of pcre library
|
# Static compile of pcre library
|
||||||
|
@ -26,12 +32,18 @@ macro(lighttpd_build_server outfile)
|
||||||
SOURCE_DIR
|
SOURCE_DIR
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/libprce-prefix/src/libpcre
|
${CMAKE_CURRENT_BINARY_DIR}/libprce-prefix/src/libpcre
|
||||||
CONFIGURE_COMMAND
|
CONFIGURE_COMMAND
|
||||||
./configure --host=${config_host} CC=${CMAKE_C_COMPILER} AR=${CMAKE_AR} STRIP=${DCMAKE_STRIP}
|
./configure
|
||||||
RANLIB=${CMAKE_RANLIB} --prefix=${CMAKE_CURRENT_BINARY_DIR}/libpcre/_install
|
--host=${config_host}
|
||||||
|
CC=${CMAKE_C_COMPILER}
|
||||||
|
AR=${CMAKE_AR}
|
||||||
|
STRIP=${DCMAKE_STRIP}
|
||||||
|
RANLIB=${CMAKE_RANLIB}
|
||||||
|
--prefix=${CMAKE_CURRENT_BINARY_DIR}/libpcre/_install
|
||||||
BUILD_COMMAND
|
BUILD_COMMAND
|
||||||
make
|
make
|
||||||
INSTALL_COMMAND
|
INSTALL_COMMAND
|
||||||
make install
|
make
|
||||||
|
install
|
||||||
)
|
)
|
||||||
# Force static linking of pthread symbols
|
# Force static linking of pthread symbols
|
||||||
set(linker_flags -static\ -u\ pthread_mutex_lock\ -u\ pthread_mutex_unlock\ -lpthread)
|
set(linker_flags -static\ -u\ pthread_mutex_lock\ -u\ pthread_mutex_unlock\ -lpthread)
|
||||||
|
@ -47,7 +59,10 @@ macro(lighttpd_build_server outfile)
|
||||||
GIT_TAG
|
GIT_TAG
|
||||||
lighttpd-1.4.55
|
lighttpd-1.4.55
|
||||||
PATCH_COMMAND
|
PATCH_COMMAND
|
||||||
${GIT_EXECUTABLE} apply ${LIGHTTPD_DIR}/lighttpd_cmake.patch ${LIGHTTPD_DIR}/lemon_cmake.patch
|
${GIT_EXECUTABLE}
|
||||||
|
apply
|
||||||
|
${LIGHTTPD_DIR}/lighttpd_cmake.patch
|
||||||
|
${LIGHTTPD_DIR}/lemon_cmake.patch
|
||||||
BINARY_DIR
|
BINARY_DIR
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/lighttpd
|
${CMAKE_CURRENT_BINARY_DIR}/lighttpd
|
||||||
BUILD_ALWAYS
|
BUILD_ALWAYS
|
||||||
|
|
|
@ -25,7 +25,7 @@ include(application_settings)
|
||||||
if("${PLATFORM}" STREQUAL "")
|
if("${PLATFORM}" STREQUAL "")
|
||||||
set(PLATFORM "exynos5422")
|
set(PLATFORM "exynos5422")
|
||||||
endif()
|
endif()
|
||||||
if (NOT "${PLATFORM}" IN_LIST supported)
|
if(NOT "${PLATFORM}" IN_LIST supported)
|
||||||
message(FATAL_ERROR "PLATFORM: ${PLATFORM} not supported. Supported: ${supported}")
|
message(FATAL_ERROR "PLATFORM: ${PLATFORM} not supported. Supported: ${supported}")
|
||||||
endif()
|
endif()
|
||||||
if("${PLATFORM}" STREQUAL "exynos5422")
|
if("${PLATFORM}" STREQUAL "exynos5422")
|
||||||
|
@ -33,13 +33,18 @@ if("${PLATFORM}" STREQUAL "exynos5422")
|
||||||
set(KernelARMPlatform exynos5422 CACHE STRING "" FORCE)
|
set(KernelARMPlatform exynos5422 CACHE STRING "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
if("${PLATFORM}" STREQUAL "qemu-arm-virt")
|
if("${PLATFORM}" STREQUAL "qemu-arm-virt")
|
||||||
if (MULTI_VM_LAN)
|
if(MULTI_VM_LAN)
|
||||||
message(FATAL_ERROR "The Multi-VM configuration is not supported on the qemu-arm-virt platform")
|
message(
|
||||||
|
FATAL_ERROR "The Multi-VM configuration is not supported on the qemu-arm-virt platform"
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
set(KernelPlatform qemu-arm-virt CACHE STRING "" FORCE)
|
set(KernelPlatform qemu-arm-virt CACHE STRING "" FORCE)
|
||||||
set(KernelARMPlatform qemu-arm-virt CACHE STRING "" FORCE)
|
set(KernelARMPlatform qemu-arm-virt CACHE STRING "" FORCE)
|
||||||
set(QEMU_MEMORY "2048")
|
set(QEMU_MEMORY "2048")
|
||||||
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(KernelArmCPU cortex-a53 CACHE STRING "" FORCE)
|
set(KernelArmCPU cortex-a53 CACHE STRING "" FORCE)
|
||||||
set(KernelArmHypervisorSupport ON CACHE BOOL "" FORCE)
|
set(KernelArmHypervisorSupport ON CACHE BOOL "" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue