Skip to content

Commit

Permalink
run style formatter
Browse files Browse the repository at this point in the history
Signed-off-by: Gerwin Klein <[email protected]>
  • Loading branch information
lsf37 committed Jul 28, 2021
1 parent 5295c07 commit 028faaa
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 43 deletions.
92 changes: 72 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ include(settings.cmake)

project(sel4webserver C ASM)


find_package(camkes-arm-vm REQUIRED)
camkes_arm_vm_setup_arm_vm_environment()

Expand All @@ -36,32 +35,77 @@ elseif("${PLATFORM}" STREQUAL "qemu-arm-virt")
endif()
elseif("${PLATFORM}" STREQUAL "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")
elseif("${PLATFORM}" STREQUAL "tx2")
set(cpp_flags "-DKERNELARMPLATFORM_TX2")
set(rootfs_file "${CAMKES_VM_IMAGES_DIR}/${KernelARMPlatform}/rootfs.cpio.gz")
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 "")
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()

if(MULTI_VM_LAN)
# Setup our passthrough vm overlay
AddFileToOverlayDir("inittab" ${CMAKE_CURRENT_SOURCE_DIR}/overlay_files/inittab_hvc0 "etc" 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)
AddFileToOverlayDir(
"inittab"
${CMAKE_CURRENT_SOURCE_DIR}/overlay_files/inittab_hvc0
"etc"
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
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)
docsite_install_to_overlay(overlay_client_vm)
AddOverlayDirToRootfs(overlay_client_vm ${rootfs_file} "buildroot" "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)
AddOverlayDirToRootfs(
overlay_client_vm
${rootfs_file}
"buildroot"
"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()

# Build crossvm kernel module for qemu
Expand Down Expand Up @@ -91,13 +135,17 @@ else()
""
CONFIGURE_COMMAND
""
USES_TERMINAL_DOWNLOAD TRUE
USES_TERMINAL_DOWNLOAD
TRUE
SOURCE_DIR
${CMAKE_CURRENT_BINARY_DIR}/linux_out
)
# Linux config and symvers are to be copied to unpacked archive
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
ConfigureLinux(
${CMAKE_CURRENT_BINARY_DIR}/linux_out
Expand Down Expand Up @@ -161,7 +209,8 @@ else()
ON
EXCLUDE_FROM_ALL
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(
Expand All @@ -174,7 +223,6 @@ else()
)
endforeach()


# Generate overlayed rootfs
AddOverlayDirToRootfs(
overlay
Expand Down Expand Up @@ -204,11 +252,15 @@ DefineCAmkESVMFileServer()

CAmkESAddImportPath(${KernelARMPlatform})


# Define our demo component that shares a dataport with the VM
include(cpio)
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
DeclareCAmkESComponent(VM SOURCES src/cross_vm_connections.c)
Expand Down
23 changes: 13 additions & 10 deletions apps/cgi-load-file/cgi-load-file.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,24 @@
#include <errno.h>
#include <string.h>

void block_event(int fd) {
int val;
/* Blocking read */
int result = read(fd, &val, sizeof(val));
if (result < 0) {
printf("Error: %s\n", strerror(errno));
}
void block_event(int fd)
{
int val;
/* Blocking read */
int result = read(fd, &val, sizeof(val));
if (result < 0) {
printf("Error: %s\n", strerror(errno));
}

}

void emit_event(char* emit) {
emit[0] = 1;
void emit_event(char *emit)
{
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 *src_c = src;
for (int i = 0; i < size; i++) {
Expand Down
7 changes: 4 additions & 3 deletions components/logging-fileserver/fileserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ extern void done_emit_underlying(void);

#define MAX_FILENAME_LENGTH 200

void pre_init() {
void pre_init()
{
/* install the _cpio_archive */
unsigned long cpio_size = _cpio_archive_end - _cpio_archive;
muslcsys_install_cpio_interface(_cpio_archive, cpio_size, cpio_get_file);
Expand All @@ -31,11 +32,11 @@ int run(void)
{
/* Zero out the data port */
memset(dest, '\0', 4096);
char* dest_c = (char*)dest;
char *dest_c = (char *)dest;
char filename[MAX_FILENAME_LENGTH] = {0};
while (1) {
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);
if (fd < 0) {
snprintf(dest_c, 4, "404");
Expand Down
3 changes: 2 additions & 1 deletion docsite/Finddocsite.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ macro(docsite_build_site_tar outfile)
ON
BUILD_IN_SOURCE
TRUE
USES_TERMINAL_BUILD TRUE
USES_TERMINAL_BUILD
TRUE
BUILD_COMMAND
"make;build"
INSTALL_COMMAND
Expand Down
25 changes: 20 additions & 5 deletions lighttpd/Findlighttpd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ set(LIGHTTPD_RUN_SCRIPT "${LIGHTTPD_DIR}/lighttpd.sh" CACHE STRING "")
mark_as_advanced(LIGHTTPD_DIR LIGHTTPD_CONF LIGHTTPD_RUN_SCRIPT)

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}")
include(ExternalProject)
# Static compile of pcre library
Expand All @@ -26,12 +32,18 @@ macro(lighttpd_build_server outfile)
SOURCE_DIR
${CMAKE_CURRENT_BINARY_DIR}/libprce-prefix/src/libpcre
CONFIGURE_COMMAND
./configure --host=${config_host} CC=${CMAKE_C_COMPILER} AR=${CMAKE_AR} STRIP=${DCMAKE_STRIP}
RANLIB=${CMAKE_RANLIB} --prefix=${CMAKE_CURRENT_BINARY_DIR}/libpcre/_install
./configure
--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
make
INSTALL_COMMAND
make install
make
install
)
# Force static linking of pthread symbols
set(linker_flags -static\ -u\ pthread_mutex_lock\ -u\ pthread_mutex_unlock\ -lpthread)
Expand All @@ -47,7 +59,10 @@ macro(lighttpd_build_server outfile)
GIT_TAG
lighttpd-1.4.55
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
${CMAKE_CURRENT_BINARY_DIR}/lighttpd
BUILD_ALWAYS
Expand Down
13 changes: 9 additions & 4 deletions settings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,26 @@ include(application_settings)
if("${PLATFORM}" STREQUAL "")
set(PLATFORM "exynos5422")
endif()
if (NOT "${PLATFORM}" IN_LIST supported)
if(NOT "${PLATFORM}" IN_LIST supported)
message(FATAL_ERROR "PLATFORM: ${PLATFORM} not supported. Supported: ${supported}")
endif()
if("${PLATFORM}" STREQUAL "exynos5422")
set(KernelPlatform exynos5 CACHE STRING "" FORCE)
set(KernelARMPlatform exynos5422 CACHE STRING "" FORCE)
endif()
if("${PLATFORM}" STREQUAL "qemu-arm-virt")
if (MULTI_VM_LAN)
message(FATAL_ERROR "The Multi-VM configuration is not supported on the qemu-arm-virt platform")
if(MULTI_VM_LAN)
message(
FATAL_ERROR "The Multi-VM configuration is not supported on the qemu-arm-virt platform"
)
endif()
set(KernelPlatform qemu-arm-virt CACHE STRING "" FORCE)
set(KernelARMPlatform qemu-arm-virt CACHE STRING "" FORCE)
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(KernelArmHypervisorSupport ON CACHE BOOL "" FORCE)
endif()
Expand Down

0 comments on commit 028faaa

Please sign in to comment.