diff options
Diffstat (limited to 'meta/classes/kernel-uimage.bbclass')
-rw-r--r-- | meta/classes/kernel-uimage.bbclass | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/meta/classes/kernel-uimage.bbclass b/meta/classes/kernel-uimage.bbclass new file mode 100644 index 0000000000..8a3efc6835 --- /dev/null +++ b/meta/classes/kernel-uimage.bbclass | |||
@@ -0,0 +1,48 @@ | |||
1 | python __anonymous () { | ||
2 | kerneltype = d.getVar('KERNEL_IMAGETYPE', True) | ||
3 | if kerneltype == 'uImage': | ||
4 | depends = d.getVar("DEPENDS", True) | ||
5 | depends = "%s u-boot-mkimage-native" % depends | ||
6 | d.setVar("DEPENDS", depends) | ||
7 | } | ||
8 | |||
9 | uboot_prep_kimage() { | ||
10 | if test -e arch/${ARCH}/boot/compressed/vmlinux ; then | ||
11 | vmlinux_path="arch/${ARCH}/boot/compressed/vmlinux" | ||
12 | linux_suffix="" | ||
13 | linux_comp="none" | ||
14 | else | ||
15 | vmlinux_path="vmlinux" | ||
16 | linux_suffix=".gz" | ||
17 | linux_comp="gzip" | ||
18 | fi | ||
19 | |||
20 | ${OBJCOPY} -O binary -R .note -R .comment -S "${vmlinux_path}" linux.bin | ||
21 | |||
22 | if [ "${linux_comp}" != "none" ] ; then | ||
23 | rm -f linux.bin | ||
24 | gzip -9 linux.bin | ||
25 | mv -f "linux.bin${linux_suffix}" linux.bin | ||
26 | fi | ||
27 | |||
28 | echo "${linux_comp}" | ||
29 | } | ||
30 | |||
31 | do_uboot_mkimage() { | ||
32 | if test "x${KERNEL_IMAGETYPE}" = "xuImage" ; then | ||
33 | if test "x${KEEPUIMAGE}" != "xyes" ; then | ||
34 | uboot_prep_kimage | ||
35 | |||
36 | ENTRYPOINT=${UBOOT_ENTRYPOINT} | ||
37 | if test -n "${UBOOT_ENTRYSYMBOL}"; then | ||
38 | ENTRYPOINT=`${HOST_PREFIX}nm ${S}/vmlinux | \ | ||
39 | awk '$3=="${UBOOT_ENTRYSYMBOL}" {print $1}'` | ||
40 | fi | ||
41 | |||
42 | uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C "${linux_comp}" -a ${UBOOT_LOADADDRESS} -e $ENTRYPOINT -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d linux.bin arch/${ARCH}/boot/uImage | ||
43 | rm -f linux.bin | ||
44 | fi | ||
45 | fi | ||
46 | } | ||
47 | |||
48 | addtask uboot_mkimage before do_install after do_compile | ||