blob: 2daa068298950fa7f2d0aaa232c4c805e4f9fb46 [file] [log] [blame]
Andrew Geissler6ce62a22020-11-30 19:58:47 -06001# fitImage kernel compression algorithm
2FIT_KERNEL_COMP_ALG ?= "gzip"
3FIT_KERNEL_COMP_ALG_EXTENSION ?= ".gz"
4
Patrick Williamsc124f4f2015-09-15 14:41:29 -05005uboot_prep_kimage() {
Brad Bishop6e60e8b2018-02-01 10:27:11 -05006 if [ -e arch/${ARCH}/boot/compressed/vmlinux ]; then
Patrick Williamsc124f4f2015-09-15 14:41:29 -05007 vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
8 linux_suffix=""
9 linux_comp="none"
Brad Bishop6e60e8b2018-02-01 10:27:11 -050010 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 Williamsc124f4f2015-09-15 14:41:29 -050016 else
17 vmlinux_path="vmlinux"
Andrew Geissler6ce62a22020-11-30 19:58:47 -060018 linux_suffix="${FIT_KERNEL_COMP_ALG_EXTENSION}"
19 linux_comp="${FIT_KERNEL_COMP_ALG}"
Patrick Williamsc124f4f2015-09-15 14:41:29 -050020 fi
21
Brad Bishop6e60e8b2018-02-01 10:27:11 -050022 [ -n "${vmlinux_path}" ] && ${OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin
Patrick Williamsc124f4f2015-09-15 14:41:29 -050023
24 if [ "${linux_comp}" != "none" ] ; then
Patrick Williams213cb262021-08-07 19:21:33 -050025 if [ "${linux_comp}" = "gzip" ] ; then
26 gzip -9 linux.bin
27 elif [ "${linux_comp}" = "lzo" ] ; then
28 lzop -9 linux.bin
29 fi
Patrick Williamsc124f4f2015-09-15 14:41:29 -050030 mv -f "linux.bin${linux_suffix}" linux.bin
31 fi
32
33 echo "${linux_comp}"
34}