llext-edk: add support for Zstd and Zip formats
This patch adds support for Zstd and Zip formats to the EDK generation process. The user can now choose between XZ, Zstd, and Zip compression and output formats for the EDK file. Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This commit is contained in:
parent
d043a21426
commit
c188dee334
3 changed files with 48 additions and 5 deletions
|
@ -2221,7 +2221,16 @@ endif()
|
|||
|
||||
# Extension Development Kit (EDK) generation.
|
||||
if(CONFIG_LLEXT_EDK)
|
||||
set(llext_edk_file ${PROJECT_BINARY_DIR}/${CONFIG_LLEXT_EDK_NAME}.tar.xz)
|
||||
if(CONFIG_LLEXT_EDK_FORMAT_TAR_XZ)
|
||||
set(llext_edk_extension "tar.xz")
|
||||
elseif(CONFIG_LLEXT_EDK_FORMAT_TAR_ZSTD)
|
||||
set(llext_edk_extension "tar.Z")
|
||||
elseif(CONFIG_LLEXT_EDK_FORMAT_ZIP)
|
||||
set(llext_edk_extension "zip")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported LLEXT_EDK_FORMAT choice")
|
||||
endif()
|
||||
set(llext_edk_file ${PROJECT_BINARY_DIR}/${CONFIG_LLEXT_EDK_NAME}.${llext_edk_extension})
|
||||
|
||||
# TODO maybe generate flags for C CXX ASM
|
||||
zephyr_get_compile_definitions_for_lang(C zephyr_defs)
|
||||
|
|
|
@ -238,12 +238,21 @@ foreach(target ${edk_targets})
|
|||
edk_write_var(${target} "LLEXT_GENERATED_IMACROS_CFLAGS" "${imacros_gen}")
|
||||
endforeach()
|
||||
|
||||
if(CONFIG_LLEXT_EDK_FORMAT_TAR_XZ)
|
||||
set(llext_edk_format FORMAT gnutar COMPRESSION XZ)
|
||||
elseif(CONFIG_LLEXT_EDK_FORMAT_TAR_ZSTD)
|
||||
set(llext_edk_format FORMAT gnutar COMPRESSION Zstd)
|
||||
elseif(CONFIG_LLEXT_EDK_FORMAT_ZIP)
|
||||
set(llext_edk_format FORMAT zip)
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported LLEXT_EDK_FORMAT choice")
|
||||
endif()
|
||||
|
||||
# Generate the tarball
|
||||
file(ARCHIVE_CREATE
|
||||
OUTPUT ${llext_edk_file}
|
||||
PATHS ${llext_edk}
|
||||
FORMAT gnutar
|
||||
COMPRESSION XZ
|
||||
${llext_edk_format}
|
||||
)
|
||||
|
||||
file(REMOVE_RECURSE ${llext_edk})
|
||||
|
|
|
@ -141,13 +141,38 @@ config LLEXT_EDK_NAME
|
|||
string "Name for llext EDK (Extension Development Kit)"
|
||||
default "llext-edk"
|
||||
help
|
||||
Name will be used when generating the EDK file, as <name>.tar.xz.
|
||||
<name> will be used when generating the EDK file; the appropriate
|
||||
extension will be appended depending on the chosen output format.
|
||||
It will also be used, normalized, as the prefix for the variable
|
||||
stating EDK location, used on generated Makefile.cflags. For
|
||||
instance, the default name, "llext-edk", becomes LLEXT_EDK_INSTALL_DIR.
|
||||
|
||||
choice LLEXT_EDK_FORMAT
|
||||
prompt "EDK compression and output format"
|
||||
default LLEXT_EDK_FORMAT_TAR_XZ
|
||||
|
||||
config LLEXT_EDK_FORMAT_TAR_XZ
|
||||
bool ".tar.xz"
|
||||
help
|
||||
Use GNU tar with XZ compression for the EDK file. Highest compression
|
||||
ratio, slower choice.
|
||||
|
||||
config LLEXT_EDK_FORMAT_TAR_ZSTD
|
||||
bool ".tar.Z"
|
||||
help
|
||||
Use GNU tar with Zstd compression for the EDK file. Way faster than
|
||||
XZ, but still with a high compression ratio.
|
||||
|
||||
config LLEXT_EDK_FORMAT_ZIP
|
||||
bool ".zip"
|
||||
help
|
||||
Use Zip format and compression for the EDK file. This is the most
|
||||
portable option, but it may not compress as well as XZ or Zstd.
|
||||
|
||||
endchoice
|
||||
|
||||
config LLEXT_EDK_USERSPACE_ONLY
|
||||
bool "Only generate the Userpace codepath on syscall stubs for the EDK"
|
||||
bool "Only generate the Userspace codepath on syscall stubs for the EDK"
|
||||
help
|
||||
Syscall stubs can contain code that verifies if running code is at user
|
||||
or kernel space and route the call accordingly. If the EDK is expected
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue