summaryrefslogtreecommitdiffstats
path: root/meta/classes
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <hrw@openedhand.com>2007-06-08 08:39:22 +0000
committerMarcin Juszkiewicz <hrw@openedhand.com>2007-06-08 08:39:22 +0000
commit7fd02840ad3ed9bc6808de61a308e3ae76da8f4e (patch)
treef21c99d001a79af92cac35c0904813139ee47acb /meta/classes
parent9ac61d29688d3ed86196e156a8a234113aaa51d1 (diff)
downloadpoky-7fd02840ad3ed9bc6808de61a308e3ae76da8f4e.tar.gz
bootimg.bbclass: imported from OE, updated to recent BitBake
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1894 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/classes')
-rw-r--r--meta/classes/bootimg.bbclass90
1 files changed, 90 insertions, 0 deletions
diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
new file mode 100644
index 0000000000..24e2d296ad
--- /dev/null
+++ b/meta/classes/bootimg.bbclass
@@ -0,0 +1,90 @@
1# bootimg.oeclass
2# Copyright (C) 2004, Advanced Micro Devices, Inc. All Rights Reserved
3# Released under the MIT license (see packages/COPYING)
4
5# This creates a bootable image using syslinux, your kernel and an optional
6# initrd
7
8# External variables needed
9# ${INITRD} - indicates a filesystem image to use as an initrd (optional)
10# ${AUTO_SYSLINUXCFG} - set this to 1 to enable creating an automatic config
11# ${LABELS} - a list of targets for the automatic config
12# ${APPEND} - an override list of append strings for each label
13# ${SYSLINUX_OPTS} - additional options to add to the syslinux file ';' delimited
14
15do_rootfs[depends] +="dosfstools-native:do_populate_staging syslinux-native:do_populate_staging mtools-native:do_populate_staging cdrtools-native:do_populate_staging"
16
17BDIR="${WORKDIR}/boot"
18ISODIR="${IMAGE_ROOTFS}/isolinux/"
19
20BOOTIMG_VOLUME_ID ?= "oe"
21BOOTIMG_EXTRA_SPACE ?= "64"
22
23# Get the build_syslinux_cfg() function from the syslinux class
24
25SYSLINUXCFG="${BDIR}/syslinux.cfg"
26SYSLINUXMENU="${BDIR}/menu"
27inherit syslinux
28
29build_boot_bin() {
30 install -d ${BDIR}
31 install -m 0644 ${STAGING_KERNEL_DIR}/bzImage \
32 ${BDIR}/vmlinuz
33
34 if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then
35 install -m 0644 ${INITRD} ${BDIR}/initrd
36 fi
37
38 install -m 444 ${STAGING_DIR}/${BUILD_SYS}/share/syslinux/ldlinux.sys \
39 ${BDIR}/ldlinux.sys
40
41 # Do a little math, bash style
42 #BLOCKS=`du -s ${BDIR} | cut -f 1`
43 BLOCKS=`du -bks ${BDIR} | cut -f 1`
44 SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}`
45
46 mkdosfs -F 12 -n ${BOOTIMG_VOLUME_ID} -d ${BDIR} \
47 -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}-boot.bin $SIZE
48
49 syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}-boot.bin
50
51 #Create an ISO if we have an INITRD
52 if [ -n "${INITRD}" ] && [ -s "${INITRD}" ] && [ "${NOISO}" != "1" ] ; then
53 install -d ${ISODIR}
54
55 # Install the kernel
56
57 install -m 0644 ${STAGING_KERNEL_DIR}/bzImage \
58 ${ISODIR}/vmlinuz
59
60 # Install the configuration files
61
62 cp ${BDIR}/syslinux.cfg ${ISODIR}/isolinux.cfg
63
64 if [ -f ${SYSLINUXMENU} ]; then
65 cp ${SYSLINUXMENU} ${ISODIR}
66 fi
67
68 install -m 0644 ${INITRD} ${ISODIR}/initrd
69
70 # And install the syslinux stuff
71 cp ${STAGING_DIR}/${BUILD_SYS}/share/syslinux/isolinux.bin \
72 ${ISODIR}
73
74 mkisofs -V ${BOOTIMG_VOLUME_ID} \
75 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
76 -b isolinux/isolinux.bin -c isolinux/boot.cat -r \
77 -no-emul-boot -boot-load-size 4 -boot-info-table \
78 ${IMAGE_ROOTFS}
79 fi
80}
81
82python do_bootimg() {
83 bb.build.exec_func('build_syslinux_cfg', d)
84 bb.build.exec_func('build_boot_bin', d)
85}
86
87# We need to run after bootsplash if it exists, so thats why this line
88# is such. Don't worry, if you don't do bootsplash, nobody will notice
89
90addtask bootimg before do_build after do_bootsplash