diff --git a/CHANGES.md b/CHANGES.md index e2887e4646..320590a608 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -259,6 +259,7 @@ description indicates whether it is SOURCE-COMPATIBLE, BINARY-COMPATIBLE, or BRE * General minor build system improvements and clean-up * Set up automated tests for CI and GitHub pull requests on seL4 * Add vulnerability disclosure policy +* Removed autoconf.h for kernel and libsel4. ### Upgrade Notes diff --git a/CMakeLists.txt b/CMakeLists.txt index d9413b8adc..5c74f3e465 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -350,30 +350,16 @@ include_directories( # include_directories($) -# The kernel expects to be able to include an 'autoconf.h' file at the moment. -# So lets generate one for it to use -# TODO: use the kernel_Config directly -generate_autoconf(kernel_autoconf "kernel") -include_directories($) -# Target for the config / autoconf headers. This is what all the other generated headers +# Target for the config headers. This is what all the other generated headers # can depend upon -add_custom_target( - kernel_config_headers - DEPENDS - kernel_autoconf_Gen - kernel_autoconf - kernel_Config - kernel_Gen -) +add_custom_target(kernel_config_headers DEPENDS kernel_Config kernel_Gen) -# Target for all generated headers. We start with just all the config / autoconf headers +# Target for all generated headers. We start with just all the config headers add_custom_target(kernel_headers DEPENDS kernel_config_headers) # Build up a list of generated files. needed for dependencies in custom commands -get_generated_files(gen_files_list kernel_autoconf_Gen) -get_generated_files(gen_files2 kernel_Gen) -list(APPEND gen_files_list "${gen_files2}") +get_generated_files(gen_files_list kernel_Gen) # # C source generation @@ -673,7 +659,7 @@ add_executable(kernel.elf EXCLUDE_FROM_ALL ${asm_sources} kernel_all.c) target_include_directories(kernel.elf PRIVATE ${config_dir}) target_include_directories(kernel.elf PRIVATE include) target_include_directories(kernel.elf PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/generated") -target_link_libraries(kernel.elf PRIVATE kernel_Config kernel_autoconf) +target_link_libraries(kernel.elf PRIVATE kernel_Config) set_property(TARGET kernel.elf APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-T ${linker_lds_path} ") set_target_properties(kernel.elf PROPERTIES LINK_DEPENDS "${linker_lds_path}") add_dependencies(kernel.elf circular_includes) @@ -711,10 +697,9 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") "${CMAKE_CURRENT_BINARY_DIR}/libsel4/include/" "${CMAKE_CURRENT_BINARY_DIR}/libsel4/arch_include/${KernelArch}/" "${CMAKE_CURRENT_BINARY_DIR}/libsel4/sel4_arch_include/${KernelSel4Arch}/" - # The following directories install the autoconf headers + # The following directories install the configuration headers "${CMAKE_CURRENT_BINARY_DIR}/gen_config/" "${CMAKE_CURRENT_BINARY_DIR}/libsel4/gen_config/" - "${CMAKE_CURRENT_BINARY_DIR}/libsel4/autoconf/" DESTINATION libsel4/include FILES_MATCHING PATTERN "*.h" diff --git a/include/sel4/gen_config.h b/include/sel4/gen_config.h new file mode 100644 index 0000000000..6c60b19769 --- /dev/null +++ b/include/sel4/gen_config.h @@ -0,0 +1,15 @@ +/* + * Copyright 2024, Codasip GmbH + * + * SPDX-License-Identifier: GPL-2.0-only + */ + +#pragma once + +/* + * This file exists, because the kernel includes the libsel4 headers, which + * need the header file 'sel4/gen_config.h' with the libsel4 configuration. When + * compiling the kernel, the libsel4 configuration has not been created yet, so + * we provide a dummy file here. This is fine because nothing in the libsel4 + * configuration is relevant for the kernel. + */ diff --git a/libsel4/CMakeLists.txt b/libsel4/CMakeLists.txt index 88188ae7a2..d82f548d6a 100644 --- a/libsel4/CMakeLists.txt +++ b/libsel4/CMakeLists.txt @@ -51,9 +51,6 @@ RequireFile(SYSCALL_STUB_GEN_PATH syscall_stub_gen.py PATHS tools) add_config_library(sel4 "${configure_string}") -# Currently we use autoconf.h, so generate one of those -generate_autoconf(sel4_autoconf "kernel;sel4") - gen_invocation_header( OUTPUT "include/sel4/invocation.h" XML "include/interfaces/object-api.xml" @@ -83,16 +80,8 @@ set( ) include_directories("${source_header_dirs}") -# Add the include directory of autoconf.h to the cflags for the bitfield generation -include_directories("$") - function(genbf target_prefix pbf_location bf_location header_output) - get_generated_files(gen_list sel4_autoconf_Gen) - cppfile( - "${pbf_location}" ${target_prefix}_pbf "${bf_location}" - EXTRA_FLAGS -P - EXTRA_DEPS sel4_autoconf_Gen ${gen_list} - ) + cppfile("${pbf_location}" ${target_prefix}_pbf "${bf_location}" EXTRA_FLAGS -P) GenHBFTarget( "libsel4" ${target_prefix}_h @@ -176,7 +165,7 @@ add_custom_target( ) add_library(sel4 src/sel4_bootinfo.c) -target_link_libraries(sel4 PRIVATE kernel_Config sel4_Config sel4_autoconf) +target_link_libraries(sel4 PRIVATE kernel_Config sel4_Config) target_include_directories( sel4 PUBLIC diff --git a/libsel4/include/sel4/config.h b/libsel4/include/sel4/config.h index 5ae039efc9..1369b23936 100644 --- a/libsel4/include/sel4/config.h +++ b/libsel4/include/sel4/config.h @@ -6,6 +6,8 @@ #pragma once -/* Compile-time configuration parameters. Might be set by the build system. */ +/* Kernel configuration */ +#include -#include +/* Libsel4 configuration */ +#include diff --git a/tools/helpers.cmake b/tools/helpers.cmake index f600e46935..ebc50eafd5 100644 --- a/tools/helpers.cmake +++ b/tools/helpers.cmake @@ -575,40 +575,6 @@ macro(get_generated_files output target) get_property(${output} TARGET ${target} PROPERTY GENERATED_FILES) endmacro(get_generated_files) -# This rule tries to emulate an 'autoconf' header. autoconf generated headers -# were previously used as configuration, so this rule provides a way for previous -# applications and libraries to build without modification. The config_list -# is a list of 'prefix' values that have been passed to add_config_library -# This generates a library with ${targetname} that when linked against -# will allow code to simply #include -function(generate_autoconf targetname config_list) - set(link_list "") - set(gen_list "") - set(config_header_contents "\n#pragma once\n\n") - foreach(config IN LISTS config_list) - list(APPEND link_list "${config}_Config") - get_generated_files(gens ${config}_Gen) - list(APPEND gen_list ${gens}) - string(APPEND config_header_contents "#include <${config}/gen_config.h>\n") - endforeach() - set(config_dir "${CMAKE_CURRENT_BINARY_DIR}/autoconf") - set(config_file "${config_dir}/autoconf.h") - - file(GENERATE OUTPUT "${config_file}" CONTENT "${config_header_contents}") - add_custom_target(${targetname}_Gen DEPENDS "${config_file}" ${gen_list}) - add_library(${targetname} INTERFACE) - target_link_libraries(${targetname} INTERFACE ${link_list}) - target_include_directories(${targetname} INTERFACE "${config_dir}") - add_dependencies(${targetname} ${targetname}_Gen ${config_file} ${gen_list}) - # Set our GENERATED_FILES property to include the GENERATED_FILES of all of our input - # configurations, as well as the files we generated - set_property( - TARGET ${targetname}_Gen - APPEND - PROPERTY GENERATED_FILES "${config_file}" ${gen_list} - ) -endfunction(generate_autoconf) - # Macro that allows for appending to a specified list only if all the supplied conditions are true macro(list_append_if list dep) set(list_append_local_list ${${list}})