summaryrefslogtreecommitdiffstats
path: root/meta/classes-recipe/kernel-uboot.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes-recipe/kernel-uboot.bbclass')
-rw-r--r--meta/classes-recipe/kernel-uboot.bbclass36
1 files changed, 23 insertions, 13 deletions
diff --git a/meta/classes-recipe/kernel-uboot.bbclass b/meta/classes-recipe/kernel-uboot.bbclass
index 30a85ccc28..62974baaf0 100644
--- a/meta/classes-recipe/kernel-uboot.bbclass
+++ b/meta/classes-recipe/kernel-uboot.bbclass
@@ -12,19 +12,27 @@ FIT_KERNEL_COMP_ALG_EXTENSION ?= ".gz"
12UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel" 12UBOOT_MKIMAGE_KERNEL_TYPE ?= "kernel"
13 13
14uboot_prep_kimage() { 14uboot_prep_kimage() {
15 if [ -e arch/${ARCH}/boot/compressed/vmlinux ]; then 15 output_dir=$1
16 # For backward compatibility with kernel-fitimage.bbclass and kernel-uboot.bbclass
17 # support calling without parameter as well
18 if [ -z "$output_dir" ]; then
19 output_dir='.'
20 fi
21
22 linux_bin=$output_dir/linux.bin
23 if [ -e "arch/${ARCH}/boot/compressed/vmlinux" ]; then
16 vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux" 24 vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux"
17 linux_suffix="" 25 linux_suffix=""
18 linux_comp="none" 26 linux_comp="none"
19 elif [ -e arch/${ARCH}/boot/vmlinuz.bin ]; then 27 elif [ -e "arch/${ARCH}/boot/vmlinuz.bin" ]; then
20 rm -f linux.bin 28 rm -f "$linux_bin"
21 cp -l arch/${ARCH}/boot/vmlinuz.bin linux.bin 29 cp -l "arch/${ARCH}/boot/vmlinuz.bin" "$linux_bin"
22 vmlinux_path="" 30 vmlinux_path=""
23 linux_suffix="" 31 linux_suffix=""
24 linux_comp="none" 32 linux_comp="none"
25 else 33 else
26 vmlinux_path="vmlinux" 34 vmlinux_path="vmlinux"
27 # Use vmlinux.initramfs for linux.bin when INITRAMFS_IMAGE_BUNDLE set 35 # Use vmlinux.initramfs for $linux_bin when INITRAMFS_IMAGE_BUNDLE set
28 # As per the implementation in kernel.bbclass. 36 # As per the implementation in kernel.bbclass.
29 # See do_bundle_initramfs function 37 # See do_bundle_initramfs function
30 if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ] && [ -e vmlinux.initramfs ]; then 38 if [ "${INITRAMFS_IMAGE_BUNDLE}" = "1" ] && [ -e vmlinux.initramfs ]; then
@@ -34,16 +42,18 @@ uboot_prep_kimage() {
34 linux_comp="${FIT_KERNEL_COMP_ALG}" 42 linux_comp="${FIT_KERNEL_COMP_ALG}"
35 fi 43 fi
36 44
37 [ -n "${vmlinux_path}" ] && ${KERNEL_OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin 45 [ -n "$vmlinux_path" ] && ${KERNEL_OBJCOPY} -O binary -R .note -R .comment -S "$vmlinux_path" "$linux_bin"
38 46
39 if [ "${linux_comp}" != "none" ] ; then 47 if [ "$linux_comp" != "none" ] ; then
40 if [ "${linux_comp}" = "gzip" ] ; then 48 if [ "$linux_comp" = "gzip" ] ; then
41 gzip -9 linux.bin 49 gzip -9 "$linux_bin"
42 elif [ "${linux_comp}" = "lzo" ] ; then 50 elif [ "$linux_comp" = "lzo" ] ; then
43 lzop -9 linux.bin 51 lzop -9 "$linux_bin"
52 elif [ "$linux_comp" = "lzma" ] ; then
53 xz --format=lzma -f -6 "$linux_bin"
44 fi 54 fi
45 mv -f "linux.bin${linux_suffix}" linux.bin 55 mv -f "$linux_bin$linux_suffix" "$linux_bin"
46 fi 56 fi
47 57
48 echo "${linux_comp}" 58 printf "$linux_comp" > "$output_dir/linux_comp"
49} 59}