diff options
Diffstat (limited to 'meta/classes-recipe/kernel-uboot.bbclass')
-rw-r--r-- | meta/classes-recipe/kernel-uboot.bbclass | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/meta/classes-recipe/kernel-uboot.bbclass b/meta/classes-recipe/kernel-uboot.bbclass new file mode 100644 index 0000000000..4aab02671e --- /dev/null +++ b/meta/classes-recipe/kernel-uboot.bbclass | |||
@@ -0,0 +1,49 @@ | |||
1 | # | ||
2 | # Copyright OpenEmbedded Contributors | ||
3 | # | ||
4 | # SPDX-License-Identifier: MIT | ||
5 | # | ||
6 | |||
7 | # fitImage kernel compression algorithm | ||
8 | FIT_KERNEL_COMP_ALG ?= "gzip" | ||
9 | FIT_KERNEL_COMP_ALG_EXTENSION ?= ".gz" | ||
10 | |||
11 | # Kernel image type passed to mkimage (i.e. kernel kernel_noload...) | ||
12 | UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel" | ||
13 | |||
14 | uboot_prep_kimage() { | ||
15 | if [ -e arch/${ARCH}/boot/compressed/vmlinux ]; then | ||
16 | vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux" | ||
17 | linux_suffix="" | ||
18 | linux_comp="none" | ||
19 | elif [ -e arch/${ARCH}/boot/vmlinuz.bin ]; then | ||
20 | rm -f linux.bin | ||
21 | cp -l arch/${ARCH}/boot/vmlinuz.bin linux.bin | ||
22 | vmlinux_path="" | ||
23 | linux_suffix="" | ||
24 | linux_comp="none" | ||
25 | else | ||
26 | vmlinux_path="vmlinux" | ||
27 | # Use vmlinux.initramfs for linux.bin when INITRAMFS_IMAGE_BUNDLE set | ||
28 | # As per the implementation in kernel.bbclass. | ||
29 | # See do_bundle_initramfs function | ||
30 | if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ] && [ -e vmlinux.initramfs ]; then | ||
31 | vmlinux_path="vmlinux.initramfs" | ||
32 | fi | ||
33 | linux_suffix="${FIT_KERNEL_COMP_ALG_EXTENSION}" | ||
34 | linux_comp="${FIT_KERNEL_COMP_ALG}" | ||
35 | fi | ||
36 | |||
37 | [ -n "${vmlinux_path}" ] && ${OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin | ||
38 | |||
39 | if [ "${linux_comp}" != "none" ] ; then | ||
40 | if [ "${linux_comp}" = "gzip" ] ; then | ||
41 | gzip -9 linux.bin | ||
42 | elif [ "${linux_comp}" = "lzo" ] ; then | ||
43 | lzop -9 linux.bin | ||
44 | fi | ||
45 | mv -f "linux.bin${linux_suffix}" linux.bin | ||
46 | fi | ||
47 | |||
48 | echo "${linux_comp}" | ||
49 | } | ||