1# fitImage kernel compression algorithm 2FIT_KERNEL_COMP_ALG ?= "gzip" 3FIT_KERNEL_COMP_ALG_EXTENSION ?= ".gz" 4 5# Kernel image type passed to mkimage (i.e. kernel kernel_noload...) 6UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel" 7 8uboot_prep_kimage() { 9 if [ -e arch/${ARCH}/boot/compressed/vmlinux ]; then 10 vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux" 11 linux_suffix="" 12 linux_comp="none" 13 elif [ -e arch/${ARCH}/boot/vmlinuz.bin ]; then 14 rm -f linux.bin 15 cp -l arch/${ARCH}/boot/vmlinuz.bin linux.bin 16 vmlinux_path="" 17 linux_suffix="" 18 linux_comp="none" 19 else 20 vmlinux_path="vmlinux" 21 # Use vmlinux.initramfs for linux.bin when INITRAMFS_IMAGE_BUNDLE set 22 # As per the implementation in kernel.bbclass. 23 # See do_bundle_initramfs function 24 if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ] && [ -e vmlinux.initramfs ]; then 25 vmlinux_path="vmlinux.initramfs" 26 fi 27 linux_suffix="${FIT_KERNEL_COMP_ALG_EXTENSION}" 28 linux_comp="${FIT_KERNEL_COMP_ALG}" 29 fi 30 31 [ -n "${vmlinux_path}" ] && ${OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin 32 33 if [ "${linux_comp}" != "none" ] ; then 34 if [ "${linux_comp}" = "gzip" ] ; then 35 gzip -9 linux.bin 36 elif [ "${linux_comp}" = "lzo" ] ; then 37 lzop -9 linux.bin 38 fi 39 mv -f "linux.bin${linux_suffix}" linux.bin 40 fi 41 42 echo "${linux_comp}" 43} 44