Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 1 | # fitImage kernel compression algorithm |
| 2 | FIT_KERNEL_COMP_ALG ?= "gzip" |
| 3 | FIT_KERNEL_COMP_ALG_EXTENSION ?= ".gz" |
| 4 | |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 5 | # Kernel image type passed to mkimage (i.e. kernel kernel_noload...) |
| 6 | UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel" |
| 7 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 8 | uboot_prep_kimage() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 9 | if [ -e arch/${ARCH}/boot/compressed/vmlinux ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 10 | vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux" |
| 11 | linux_suffix="" |
| 12 | linux_comp="none" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 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" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 19 | else |
| 20 | vmlinux_path="vmlinux" |
Andrew Geissler | 615f2f1 | 2022-07-15 14:00:58 -0500 | [diff] [blame] | 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 |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 27 | linux_suffix="${FIT_KERNEL_COMP_ALG_EXTENSION}" |
| 28 | linux_comp="${FIT_KERNEL_COMP_ALG}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 29 | fi |
| 30 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 31 | [ -n "${vmlinux_path}" ] && ${OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 32 | |
| 33 | if [ "${linux_comp}" != "none" ] ; then |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame] | 34 | if [ "${linux_comp}" = "gzip" ] ; then |
| 35 | gzip -9 linux.bin |
| 36 | elif [ "${linux_comp}" = "lzo" ] ; then |
| 37 | lzop -9 linux.bin |
| 38 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 39 | mv -f "linux.bin${linux_suffix}" linux.bin |
| 40 | fi |
| 41 | |
| 42 | echo "${linux_comp}" |
| 43 | } |