meta-phosphor: fit-image.bbclass: support compress kernel image
Extract relevant functions from upstream's kernel-uboot.bbclass
in order to be able to support compress kernel image.
Signed-off-by: James Chiang <cpchiang1@nuvoton.com>
Signed-off-by: Tim Lee <timlee660101@gmail.com>
Change-Id: I74c144e2d60d8276b74dc45767b88ff174e11937
diff --git a/meta-phosphor/classes/fit-image.bbclass b/meta-phosphor/classes/fit-image.bbclass
index 8be3043..f37aa02 100644
--- a/meta-phosphor/classes/fit-image.bbclass
+++ b/meta-phosphor/classes/fit-image.bbclass
@@ -6,6 +6,9 @@
INITRAMFS_IMAGE="${IMAGE_NAME}.cpio.${INITRAMFS_CTYPE}"
KERNEL_OUTPUT_DIR="${DEPLOY_DIR_IMAGE}"
+FIT_KERNEL_COMP_ALG ?= "none"
+FIT_KERNEL_COMP_ALG_EXTENSION ?= ""
+
do_image_cpio[depends] += "virtual/kernel:do_deploy"
run_assemble_fitimage() {
@@ -23,6 +26,16 @@
UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel"
uboot_prep_kimage() {
cp ${DEPLOY_DIR_IMAGE}/${KERNEL_IMAGETYPE} linux.bin
+
+ if [ "${linux_comp}" != "none" ] ; then
+ linux_suffix="${FIT_KERNEL_COMP_ALG_EXTENSION}"
+ if [ "${linux_comp}" = "gzip" ] ; then
+ gzip -9 linux.bin
+ elif [ "${linux_comp}" = "lzo" ] ; then
+ lzop -9 linux.bin
+ fi
+ mv -f "linux.bin${linux_suffix}" linux.bin
+ fi
}
DEPENDS:append = " u-boot-tools-native dtc-native virtual/${TARGET_PREFIX}binutils"