summaryrefslogtreecommitdiffstats
path: root/meta/classes/bootimg.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/bootimg.bbclass')
-rw-r--r--meta/classes/bootimg.bbclass71
1 files changed, 16 insertions, 55 deletions
diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index dbaa677600..0554ffa00a 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -17,36 +17,26 @@
17# in syslinux. Actions based on the label are then performed (e.g. installing to 17# in syslinux. Actions based on the label are then performed (e.g. installing to
18# an hdd) 18# an hdd)
19 19
20# External variables 20# External variables (also used by syslinux.bbclass)
21# ${INITRD} - indicates a filesystem image to use as an initrd (optional) 21# ${INITRD} - indicates a filesystem image to use as an initrd (optional)
22# ${NOISO} - skip building the ISO image if set to 1
22# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional) 23# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
23# ${AUTO_SYSLINUXCFG} - set this to 1 to enable creating an automatic config
24# ${LABELS} - a list of targets for the automatic config
25# ${APPEND} - an override list of append strings for each label
26# ${SYSLINUX_OPTS} - additional options to add to the syslinux file ';' delimited
27 24
28do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \ 25do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
29 syslinux:do_populate_sysroot \ 26 mtools-native:do_populate_sysroot \
30 syslinux-native:do_populate_sysroot \ 27 cdrtools-native:do_populate_sysroot"
31 mtools-native:do_populate_sysroot \
32 cdrtools-native:do_populate_sysroot"
33 28
34PACKAGES = " " 29PACKAGES = " "
35EXCLUDE_FROM_WORLD = "1" 30EXCLUDE_FROM_WORLD = "1"
36 31
37HDDDIR = "${S}/hdd/boot" 32HDDDIR = "${S}/hdd/boot"
38ISODIR = "${S}/cd/isolinux" 33ISODIR = "${S}/cd"
39 34
40BOOTIMG_VOLUME_ID ?= "boot" 35BOOTIMG_VOLUME_ID ?= "boot"
41BOOTIMG_EXTRA_SPACE ?= "512" 36BOOTIMG_EXTRA_SPACE ?= "512"
42 37
43# Get the build_syslinux_cfg() function from the syslinux class
44
45SYSLINUXCFG = "${HDDDIR}/syslinux.cfg"
46SYSLINUXMENU = "${HDDDIR}/menu"
47
48inherit syslinux 38inherit syslinux
49 39
50build_iso() { 40build_iso() {
51 # Only create an ISO if we have an INITRD and NOISO was not set 41 # Only create an ISO if we have an INITRD and NOISO was not set
52 if [ -z "${INITRD}" ] || [ ! -s "${INITRD}" ] || [ "${NOISO}" = "1" ]; then 42 if [ -z "${INITRD}" ] || [ ! -s "${INITRD}" ] || [ "${NOISO}" = "1" ]; then
@@ -56,31 +46,12 @@ build_iso() {
56 46
57 install -d ${ISODIR} 47 install -d ${ISODIR}
58 48
59 # Install the kernel 49 syslinux_iso_populate
60 install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage \
61 ${ISODIR}/vmlinuz
62
63 # Install the configuration files
64 cp ${HDDDIR}/syslinux.cfg ${ISODIR}/isolinux.cfg
65
66 if [ -f ${SYSLINUXMENU} ]; then
67 cp ${SYSLINUXMENU} ${ISODIR}
68 fi
69
70 install -m 0644 ${INITRD} ${ISODIR}/initrd
71
72 if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then
73 install -m 0644 ${ROOTFS} ${ISODIR}/rootfs.img
74 fi
75
76 # And install the syslinux stuff
77 cp ${STAGING_LIBDIR}/syslinux/isolinux.bin ${ISODIR}
78 50
79 mkisofs -V ${BOOTIMG_VOLUME_ID} \ 51 mkisofs -V ${BOOTIMG_VOLUME_ID} \
80 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \ 52 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
81 -b isolinux/isolinux.bin -c isolinux/boot.cat -r \ 53 -b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \
82 -no-emul-boot -boot-load-size 4 -boot-info-table \ 54 ${MKISOFS_OPTIONS} ${ISODIR}
83 ${S}/cd/
84 55
85 cd ${DEPLOY_DIR_IMAGE} 56 cd ${DEPLOY_DIR_IMAGE}
86 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso 57 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso
@@ -91,34 +62,24 @@ build_hddimg() {
91 # Create an HDD image 62 # Create an HDD image
92 if [ "${NOHDD}" != "1" ] ; then 63 if [ "${NOHDD}" != "1" ] ; then
93 install -d ${HDDDIR} 64 install -d ${HDDDIR}
94 install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage \ 65 syslinux_hddimg_populate
95 ${HDDDIR}/vmlinuz
96
97 if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then
98 install -m 0644 ${INITRD} ${HDDDIR}/initrd
99 fi
100
101 if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then
102 install -m 0644 ${ROOTFS} ${HDDDIR}/rootfs.img
103 fi
104 66
105 install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}/ldlinux.sys 67 # Determine the block count for the final image
106
107 # Do a little math, bash style
108 BLOCKS=`du -bks ${HDDDIR} | cut -f 1` 68 BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
109 SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}` 69 SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}`
110 70
111 mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \ 71 mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \
112 -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE 72 -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE
73
74 syslinux_hddimg_install
113 75
114 syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
115 chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg 76 chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
116 77
117 cd ${DEPLOY_DIR_IMAGE} 78 cd ${DEPLOY_DIR_IMAGE}
118 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg 79 rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg
119 ln -s ${IMAGE_NAME}.hddimg ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg 80 ln -s ${IMAGE_NAME}.hddimg ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg
120 fi 81 fi
121} 82}
122 83
123python do_bootimg() { 84python do_bootimg() {
124 bb.build.exec_func('build_syslinux_cfg', d) 85 bb.build.exec_func('build_syslinux_cfg', d)