mirror of
https://github.com/flatcar/scripts.git
synced 2026-05-05 04:06:33 +02:00
eclass/dist-kernel-utils: Sync with Gentoo
It's from Gentoo commit 5d417624a82991d4786b59dff1213e10ee641a12. Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
parent
954d823d4d
commit
9bc18b25d1
@ -1,4 +1,4 @@
|
||||
# Copyright 2020-2025 Gentoo Authors
|
||||
# Copyright 2020-2026 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# @ECLASS: dist-kernel-utils.eclass
|
||||
@ -215,6 +215,43 @@ dist-kernel_PV_to_KV() {
|
||||
echo "${kv}"
|
||||
}
|
||||
|
||||
# @FUNCTION: dist-kernel_get_compressor
|
||||
# @USAGE: <kernel_config>
|
||||
# @DESCRIPTION:
|
||||
# Returns the compressor with arguments for compressing kernel modules
|
||||
# based on the CONFIG_MODULES_COMPESS_* setting in the kernel config.
|
||||
dist-kernel_get_compressor() {
|
||||
debug-print-function ${FUNCNAME} "$@"
|
||||
|
||||
[[ ${#} -eq 1 ]] || die "${FUNCNAME}: invalid arguments"
|
||||
|
||||
local suffix=$(dist-kernel_get_module_suffix "${1}")
|
||||
local compress=()
|
||||
# Options taken from linux-mod-r1.eclass.
|
||||
# We don't instruct the compressor to parallelize because it applies
|
||||
# multithreading per file, so it works only for big files, and we have
|
||||
# lots of small files instead.
|
||||
case ${suffix} in
|
||||
.ko)
|
||||
return
|
||||
;;
|
||||
.ko.gz)
|
||||
compress+=( gzip )
|
||||
;;
|
||||
.ko.xz)
|
||||
compress+=( xz --check=crc32 --lzma2=dict=1MiB )
|
||||
;;
|
||||
.ko.zst)
|
||||
compress+=( zstd -q --rm )
|
||||
;;
|
||||
*)
|
||||
die "Unknown compressor: ${suffix}"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "${compress[@]}"
|
||||
}
|
||||
|
||||
# @FUNCTION: dist-kernel_get_module_suffix
|
||||
# @USAGE: <kernel_config>
|
||||
# @DESCRIPTION:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user