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 | |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 5 | uboot_prep_kimage() { |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 6 | if [ -e arch/${ARCH}/boot/compressed/vmlinux ]; then |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 7 | vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux" |
| 8 | linux_suffix="" |
| 9 | linux_comp="none" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 10 | elif [ -e arch/${ARCH}/boot/vmlinuz.bin ]; then |
| 11 | rm -f linux.bin |
| 12 | cp -l arch/${ARCH}/boot/vmlinuz.bin linux.bin |
| 13 | vmlinux_path="" |
| 14 | linux_suffix="" |
| 15 | linux_comp="none" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 16 | else |
| 17 | vmlinux_path="vmlinux" |
Andrew Geissler | 6ce62a2 | 2020-11-30 19:58:47 -0600 | [diff] [blame] | 18 | linux_suffix="${FIT_KERNEL_COMP_ALG_EXTENSION}" |
| 19 | linux_comp="${FIT_KERNEL_COMP_ALG}" |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 20 | fi |
| 21 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 22 | [ -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] | 23 | |
| 24 | if [ "${linux_comp}" != "none" ] ; then |
Patrick Williams | 213cb26 | 2021-08-07 19:21:33 -0500 | [diff] [blame^] | 25 | if [ "${linux_comp}" = "gzip" ] ; then |
| 26 | gzip -9 linux.bin |
| 27 | elif [ "${linux_comp}" = "lzo" ] ; then |
| 28 | lzop -9 linux.bin |
| 29 | fi |
Patrick Williams | c124f4f | 2015-09-15 14:41:29 -0500 | [diff] [blame] | 30 | mv -f "linux.bin${linux_suffix}" linux.bin |
| 31 | fi |
| 32 | |
| 33 | echo "${linux_comp}" |
| 34 | } |