diff options
author | Rick Altherr <raltherr@google.com> | 2017-01-20 22:28:53 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2017-01-25 06:58:02 +0300 |
commit | bc1b880de32c0ced8b676c7ef8864753ecea938a (patch) | |
tree | 6b23e85643edd117bf8bc8525926c46e3dcebcb0 /import-layers/yocto-poky/meta | |
parent | 1ed6fe335cda50cf60b7afddbe530077a1b25d27 (diff) | |
download | openbmc-bc1b880de32c0ced8b676c7ef8864753ecea938a.tar.xz |
kernel-fitimage: Use compressed ramdisks in FIT images if available
kernel-fitimage:fitimage_assemble() was calling copy_initramfs from
kernel.bbclass which decompresses the initramfs cpio. Assume that if
INITRAMFS_FSTYPES includes a compressed cpio, that is what it desired in
the FIT image.
(From OE-Core rev: 842ad404b36e00c89f615a3f7db4a2d30062effa)
Change-Id: I4a6d9ca0a35e73933650321eb17b57d91634cd6e
Signed-off-by: Rick Altherr <raltherr@google.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit 4aa6644f92975ded908ef99cf313466e0845e071)
Diffstat (limited to 'import-layers/yocto-poky/meta')
-rw-r--r-- | import-layers/yocto-poky/meta/classes/kernel-fitimage.bbclass | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/import-layers/yocto-poky/meta/classes/kernel-fitimage.bbclass b/import-layers/yocto-poky/meta/classes/kernel-fitimage.bbclass index d5d0fce19..332384de3 100644 --- a/import-layers/yocto-poky/meta/classes/kernel-fitimage.bbclass +++ b/import-layers/yocto-poky/meta/classes/kernel-fitimage.bbclass @@ -140,6 +140,7 @@ EOF fitimage_emit_section_ramdisk() { ramdisk_csum="sha1" + ramdisk_ctype="none" ramdisk_loadline="" ramdisk_entryline="" @@ -150,14 +151,32 @@ fitimage_emit_section_ramdisk() { ramdisk_entryline="entry = <${UBOOT_RD_ENTRYPOINT}>;" fi + case $3 in + *.gz) + ramdisk_ctype="gzip" + ;; + *.bz2) + ramdisk_ctype="bzip2" + ;; + *.lzma) + ramdisk_ctype="lzma" + ;; + *.lzo) + ramdisk_ctype="lzo" + ;; + *.lz4) + ramdisk_ctype="lz4" + ;; + esac + cat << EOF >> ${1} ramdisk@${2} { - description = "ramdisk image"; + description = "${INITRAMFS_IMAGE}"; data = /incbin/("${3}"); type = "ramdisk"; arch = "${UBOOT_ARCH}"; os = "linux"; - compression = "none"; + compression = "${ramdisk_ctype}"; ${ramdisk_loadline} ${ramdisk_entryline} hash@1 { @@ -258,8 +277,15 @@ fitimage_assemble() { # Step 3: Prepare a ramdisk section. # if [ "x${ramdiskcount}" = "x1" ] ; then - copy_initramfs - fitimage_emit_section_ramdisk ${1} "${ramdiskcount}" usr/${INITRAMFS_IMAGE}-${MACHINE}.cpio + # Find and use the first initramfs image archive type we find + for img in cpio.lz4 cpio.lzo cpio.lzma cpio.xz cpio.gz cpio; do + initramfs_path="${DEPLOY_DIR_IMAGE}/${INITRAMFS_IMAGE}-${MACHINE}.${img}" + echo "Using $initramfs_path" + if [ -e "${initramfs_path}" ]; then + fitimage_emit_section_ramdisk ${1} "${ramdiskcount}" "${initramfs_path}" + break + fi + done fi fitimage_emit_section_maint ${1} sectend |