diff options
author | 2024-03-05 23:28:49 +0300 | |
---|---|---|
committer | 2024-05-20 07:58:59 -0500 | |
commit | 9d16c25da9935b1b0beb38357fe3c8b4ee2e236b (patch) | |
tree | 75d53602738796683ef415c0a76e4708e044e0ac /gen_funcs.sh | |
parent | gen_initramfs.sh: copy compressed firmwares (diff) | |
download | genkernel-9d16c25da9935b1b0beb38357fe3c8b4ee2e236b.tar.gz genkernel-9d16c25da9935b1b0beb38357fe3c8b4ee2e236b.tar.bz2 genkernel-9d16c25da9935b1b0beb38357fe3c8b4ee2e236b.zip |
gen_initramfs.sh: unpack compressed modules/firmwares to reduce image size
Signed-off-by: Dmitriy Baranov <reagentoo@gmail.com>
Signed-off-by: Ben Kohler <bkohler@gentoo.org>
Diffstat (limited to 'gen_funcs.sh')
-rwxr-xr-x | gen_funcs.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gen_funcs.sh b/gen_funcs.sh index c31e15a..70a4969 100755 --- a/gen_funcs.sh +++ b/gen_funcs.sh @@ -2054,6 +2054,40 @@ expand_file() { echo "${expanded_file}" } +find_and_unpack() { + local flist + + local fmt + for fmt in "$@" + do + case "${fmt}" in + "gz"|"xz"|"zstd") + flist=( $(find -type f -name "*.${fmt}") ) + ;; + *) + gen_die "unknown compression format: ${fmt}" + ;; + esac + + if [ ${#flist[@]} -lt 1 ] + then + continue + fi + + case "${fmt}" in + "gz") + gunzip "${flist[@]}" + ;; + "xz") + unxz "${flist[@]}" + ;; + "zstd") + unzstd "${flist[@]}" + ;; + esac + done +} + find_kernel_binary() { local kernel_binary=${*} local kernel_binary_found= |