Supported values for FIT_KERNEL_COMP_ALG are hardcoded, and we can
always derive the resulting extension from the used compression tool.

Signed-off-by: Nora Schiffer <[email protected]>
---
 meta/classes-recipe/kernel-uboot.bbclass | 24 +++++++++++-------------
 meta/lib/oeqa/selftest/cases/fitimage.py |  1 -
 2 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/meta/classes-recipe/kernel-uboot.bbclass 
b/meta/classes-recipe/kernel-uboot.bbclass
index 62974baaf0..fa28be1715 100644
--- a/meta/classes-recipe/kernel-uboot.bbclass
+++ b/meta/classes-recipe/kernel-uboot.bbclass
@@ -6,7 +6,6 @@
 
 # fitImage kernel compression algorithm
 FIT_KERNEL_COMP_ALG ?= "gzip"
-FIT_KERNEL_COMP_ALG_EXTENSION ?= ".gz"
 
 # Kernel image type passed to mkimage (i.e. kernel kernel_noload...)
 UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel"
@@ -22,13 +21,11 @@ uboot_prep_kimage() {
        linux_bin=$output_dir/linux.bin
        if [ -e "arch/${ARCH}/boot/compressed/vmlinux" ]; then
                vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
-               linux_suffix=""
                linux_comp="none"
        elif [ -e "arch/${ARCH}/boot/vmlinuz.bin" ]; then
                rm -f "$linux_bin"
                cp -l "arch/${ARCH}/boot/vmlinuz.bin" "$linux_bin"
                vmlinux_path=""
-               linux_suffix=""
                linux_comp="none"
        else
                vmlinux_path="vmlinux"
@@ -38,21 +35,22 @@ uboot_prep_kimage() {
                if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ] && [ -e 
vmlinux.initramfs ]; then
                        vmlinux_path="vmlinux.initramfs"
                fi
-               linux_suffix="${FIT_KERNEL_COMP_ALG_EXTENSION}"
                linux_comp="${FIT_KERNEL_COMP_ALG}"
        fi
 
        [ -n "$vmlinux_path" ] && ${KERNEL_OBJCOPY} -O binary -R .note -R 
.comment -S "$vmlinux_path" "$linux_bin"
 
-       if [ "$linux_comp" != "none" ] ; then
-               if [ "$linux_comp" = "gzip" ] ; then
-                       gzip -9 "$linux_bin"
-               elif [ "$linux_comp" = "lzo" ] ; then
-                       lzop -9 "$linux_bin"
-               elif [ "$linux_comp" = "lzma" ] ; then
-                       xz --format=lzma -f -6 "$linux_bin"
-               fi
-               mv -f "$linux_bin$linux_suffix" "$linux_bin"
+       if [ "$linux_comp" = "gzip" ] ; then
+               gzip -9 "$linux_bin"
+               mv -f "$linux_bin.gz" "$linux_bin"
+       elif [ "$linux_comp" = "lzo" ] ; then
+               lzop -9 "$linux_bin"
+               mv -f "$linux_bin.lzo" "$linux_bin"
+       elif [ "$linux_comp" = "lzma" ] ; then
+               xz --format=lzma -f -6 "$linux_bin"
+               mv -f "$linux_bin.lzma" "$linux_bin"
+       elif [ "$linux_comp" != "none" ] ; then
+               bbfatal "Unsupported FIT_KERNEL_COMP_ALG '$linux_comp'"
        fi
 
        printf "$linux_comp" > "$output_dir/linux_comp"
diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py 
b/meta/lib/oeqa/selftest/cases/fitimage.py
index b3c54cebed..451878aafd 100644
--- a/meta/lib/oeqa/selftest/cases/fitimage.py
+++ b/meta/lib/oeqa/selftest/cases/fitimage.py
@@ -1525,7 +1525,6 @@ class FitImagePyTests(KernelFitImageBase):
             'INITRAMFS_IMAGE_BUNDLE': "",
             # kernel-uboot.bbclass
             'FIT_KERNEL_COMP_ALG': "gzip",
-            'FIT_KERNEL_COMP_ALG_EXTENSION': ".gz",
             'UBOOT_MKIMAGE_KERNEL_TYPE': "kernel",
             # uboot-config.bbclass
             'UBOOT_MKIMAGE_DTCOPTS': "",
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#241539): 
https://lists.openembedded.org/g/openembedded-core/message/241539
Mute This Topic: https://lists.openembedded.org/mt/120377528/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to