1# Copyright (c) 2023 Intel Corporation 2# SPDX-License-Identifier: Apache-2.0 3 4menuconfig LLEXT 5 bool "Linkable loadable extensions" 6 select CACHE_MANAGEMENT if DCACHE 7 select KERNEL_WHOLE_ARCHIVE 8 help 9 Enable the linkable loadable extension subsystem 10 11if LLEXT 12 13choice LLEXT_BINARY_TYPE 14 prompt "Binary object type for llext" 15 default LLEXT_TYPE_ELF_OBJECT if ARM || ARM64 16 default LLEXT_TYPE_ELF_SHAREDLIB if XTENSA 17 default LLEXT_TYPE_ELF_RELOCATABLE if RISCV 18 help 19 Object type for llext 20 21config LLEXT_TYPE_ELF_OBJECT 22 bool "Single object ELF file" 23 depends on !RISCV 24 help 25 Build and expect object files as binary object type for the 26 llext subsystem. A single compiler invocation is used to 27 generate the object file. Currently not supported on RISC-V. 28 29config LLEXT_TYPE_ELF_RELOCATABLE 30 bool "Relocatable ELF file" 31 help 32 Build and expect relocatable (partially linked) files as the 33 binary object type for the llext subsystem. These object files 34 are generated by the linker by combining multiple object files 35 into a single one. 36 37config LLEXT_TYPE_ELF_SHAREDLIB 38 bool "Shared library ELF file" 39 help 40 Build and expect shared libraries as binary object type for 41 the llext subsystem. The usual linking process is used to 42 generate the shared library from multiple object files. 43 44endchoice 45 46config LLEXT_HEAP_DYNAMIC 47 bool "Do not allocate static LLEXT heap" 48 help 49 Some applications require loading extensions into the memory which does not 50 exist during the boot time and cannot be allocated statically. Make the application 51 responsible for LLEXT heap allocation. Do not allocate LLEXT heap statically. 52 53 Application must call llext_heap_init() in order to assign a buffer to be used 54 as the LLEXT heap, otherwise LLEXT modules will not load. When the application 55 does not need LLEXT functionality any more, it should call llext_heap_uninit(), 56 which releases control of the buffer back to the application. 57 58config LLEXT_HEAP_SIZE 59 int "llext heap memory size in kilobytes" 60 depends on !LLEXT_HEAP_DYNAMIC && !HARVARD 61 default 8 62 help 63 Heap size in kilobytes available to llext for dynamic allocation 64 65config LLEXT_INSTR_HEAP_SIZE 66 int "llext ICCM heap memory size in kilobytes" 67 depends on !LLEXT_HEAP_DYNAMIC && HARVARD 68 default 4 69 help 70 ICCM heap size in kilobytes available to llext for dynamic allocation. 71 Only executable sections will be placed in this heap. 72 73config LLEXT_DATA_HEAP_SIZE 74 int "llext DCCM heap memory size in kilobytes" 75 depends on !LLEXT_HEAP_DYNAMIC && HARVARD 76 default 8 77 help 78 DCCM heap size in kilobytes available to llext for dynamic allocation. 79 Extension data and metadata will be placed in this heap. 80 81config LLEXT_BUILD_PIC 82 bool "Use -fPIC when building LLEXT" 83 depends on XTENSA 84 default y if LLEXT_TYPE_ELF_SHAREDLIB 85 help 86 By default LLEXT compilation is performed with -fno-pic -fno-pie compiler 87 flags. Some platforms can benefit from using -fPIC instead, in which case 88 most internal linking is performed by the linker at build time. Select "y" 89 to make use of that advantage. 90 91config LLEXT_SHELL 92 bool "llext shell commands" 93 depends on SHELL 94 help 95 Manage llext with shell commands for loading, unloading, and introspection 96 97config LLEXT_SHELL_MAX_SIZE 98 int "Maximum size of llext in bytes" 99 depends on LLEXT_SHELL 100 default 8192 101 help 102 When loading llext with shell it is stored in a temporary buffer of this size 103 104config LLEXT_STORAGE_WRITABLE 105 bool "llext storage is writable" 106 default y if XTENSA 107 help 108 Select if LLEXT storage is writable, i.e. if extensions are stored in 109 RAM and can be modified in place 110 111config LLEXT_EXPORT_DEVICES 112 bool "Export all DT devices to llexts" 113 select LLEXT_EXPORT_SYMBOL_GROUP_DEVICE 114 help 115 When enabled, all Zephyr devices defined in the device tree are 116 made available to llexts via the standard DT_ / DEVICE_* macros. 117 118config LLEXT_EXPORT_DEV_IDS_BY_HASH 119 bool "Use hash of device path in device name" 120 depends on LLEXT_EXPORT_SYMBOL_GROUP_DEVICE 121 help 122 When enabled, exported device names are generated from a hash of the 123 node path instead of an ordinal number. Identifiers generated this 124 way are stable across rebuilds. 125 126config LLEXT_EXPORT_BUILTINS_BY_SLID 127 bool "Export built-in symbols to llexts via SLIDs" 128 help 129 When enabled, symbols exported from the Zephyr kernel 130 or application (via EXPORT_SYMBOL) are linked to LLEXTs 131 via Symbol Link Identifiers (SLIDs) instead of name. 132 133 Enabling this option provides a huge size reduction, 134 makes the linking process faster and provides more 135 confidentiality, as exported symbol names are dropped 136 from the binary. However, it can make LLEXT debugging 137 harder and prevents usage of 'llext_find_sym' to look 138 up symbols from the built-in table by name. It also 139 requires the LLEXTs to be post-processed after build. 140 141config LLEXT_IMPORT_ALL_GLOBALS 142 bool "Import all global symbols from extensions" 143 help 144 When loading an extension, by default only symbols that are mentioned 145 in the '.exported_sym' section (possibly via EXPORT_SYMBOL) are made 146 available to the Zephyr core. 147 148 This option instead allows all global symbols from extensions to be 149 used by the main application. This is useful to load basic extensions 150 that have been compiled without the full Zephyr EDK. 151 152config LLEXT_EXPERIMENTAL 153 bool "LLEXT experimental functionality" 154 help 155 Include support for LLEXT experimental and unstable functionality that 156 has a very high likelihood to change in the future. 157 158menu "Exported symbol groups" 159 160config LLEXT_EXPORT_DEFAULT_GROUPS 161 bool "Export the default set of Zephyr application symbols" 162 default y 163 help 164 Exports default, syscall and libc symbols 165 166config LLEXT_EXPORT_SYMBOL_GROUP_UNASSIGNED 167 bool "Export all symbols from the UNASSIGNED group" 168 default y if LLEXT_EXPORT_DEFAULT_GROUPS 169 help 170 Exports all symbols declared without an explicit group. 171 172config LLEXT_EXPORT_SYMBOL_GROUP_SYSCALL 173 bool "Export all syscalls" 174 default y if LLEXT_EXPORT_DEFAULT_GROUPS 175 help 176 Exports all syscall symbols. 177 178config LLEXT_EXPORT_SYMBOL_GROUP_LIBC 179 bool "Export standard library symbols" 180 default y if LLEXT_EXPORT_DEFAULT_GROUPS 181 help 182 Export symbols such as memcpy, memset, strlen. 183 184config LLEXT_EXPORT_SYMBOL_GROUP_DEVICE 185 bool "Export Zephyr devices" 186 help 187 When enabled, all Zephyr devices defined in the device tree are 188 made available to llexts via the standard DT_ / DEVICE_* macros. 189 190endmenu 191 192module = LLEXT 193module-str = llext 194source "subsys/logging/Kconfig.template.log_config" 195 196endif 197 198menuconfig LLEXT_EDK 199 bool "Linkable loadable Extension Development Kit (EDK)" 200 default y if LLEXT 201 help 202 Enable the generation of an Extension Development Kit (EDK) for the 203 Linkable Loadable Extension subsystem. The EDK is an archive that 204 contains the necessary files and build settings to build extensions 205 for Zephyr without the need to have the full Zephyr source tree. 206 207if LLEXT_EDK 208 209config LLEXT_EDK_NAME 210 string "Name for llext EDK (Extension Development Kit)" 211 default "llext-edk" 212 help 213 <name> will be used when generating the EDK file; the appropriate 214 extension will be appended depending on the chosen output format. 215 It will also be used, normalized, as the prefix for the variable 216 stating EDK location, used on generated Makefile.cflags. For 217 instance, the default name, "llext-edk", becomes LLEXT_EDK_INSTALL_DIR. 218 219choice LLEXT_EDK_FORMAT 220 prompt "EDK compression and output format" 221 default LLEXT_EDK_FORMAT_TAR_ZSTD if LLEXT_EDK_PRESERVE_INPUT_FOLDER 222 default LLEXT_EDK_FORMAT_TAR_XZ 223 224config LLEXT_EDK_FORMAT_TAR_XZ 225 bool ".tar.xz" 226 help 227 Use GNU tar with XZ compression for the EDK file. Highest compression 228 ratio, slower choice. 229 230config LLEXT_EDK_FORMAT_TAR_ZSTD 231 bool ".tar.Z" 232 help 233 Use GNU tar with Zstd compression for the EDK file. Way faster than 234 XZ, but still with a high compression ratio. 235 236config LLEXT_EDK_FORMAT_ZIP 237 bool ".zip" 238 help 239 Use Zip format and compression for the EDK file. This is the most 240 portable option, but it may not compress as well as XZ or Zstd. 241 242endchoice 243 244config LLEXT_EDK_USERSPACE_ONLY 245 bool "Only generate the Userspace codepath on syscall stubs for the EDK" 246 help 247 Syscall stubs can contain code that verifies if running code is at user 248 or kernel space and route the call accordingly. If the EDK is expected 249 to be used by userspace only extensions, this option will make EDK stubs 250 not contain the routing code, and only generate the userspace one. 251 252config LLEXT_EDK_PRESERVE_INPUT_FOLDER 253 bool "Don't delete the EDK source folder" 254 255endif 256