2 # Copyright (C) 2004, Advanced Micro Devices, Inc. All Rights Reserved
3 # Released under the MIT license (see packages/COPYING)
5 # This creates a bootable image using syslinux, your kernel and an optional
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
15 do_bootimg[depends] += "dosfstools-native:do_populate_staging \
16 syslinux-native:do_populate_staging \
17 mtools-native:do_populate_staging \
18 cdrtools-native:do_populate_staging"
22 HDDDIR = "${S}/hdd/boot"
23 ISODIR = "${S}/cd/isolinux"
25 BOOTIMG_VOLUME_ID ?= "oe"
26 BOOTIMG_EXTRA_SPACE ?= "64"
28 # Get the build_syslinux_cfg() function from the syslinux class
30 SYSLINUXCFG = "${HDDDIR}/syslinux.cfg"
31 SYSLINUXMENU = "${HDDDIR}/menu"
37 install -m 0644 ${STAGING_DIR}/${MACHINE}${HOST_VENDOR}-${HOST_OS}/kernel/bzImage \
40 if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then
41 install -m 0644 ${INITRD} ${HDDDIR}/initrd
44 install -m 444 ${STAGING_DATADIR_NATIVE}/syslinux/ldlinux.sys \
47 # Do a little math, bash style
48 #BLOCKS=`du -s ${HDDDIR} | cut -f 1`
49 BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
50 SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}`
52 mkdosfs -F 12 -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \
53 -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE
55 syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
56 chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
58 #Create an ISO if we have an INITRD
59 if [ -n "${INITRD}" ] && [ -s "${INITRD}" ] && [ "${NOISO}" != "1" ] ; then
64 install -m 0644 ${STAGING_DIR}/${MACHINE}${HOST_VENDOR}-${HOST_OS}/kernel/bzImage \
67 # Install the configuration files
69 cp ${HDDDIR}/syslinux.cfg ${ISODIR}/isolinux.cfg
71 if [ -f ${SYSLINUXMENU} ]; then
72 cp ${SYSLINUXMENU} ${ISODIR}
75 install -m 0644 ${INITRD} ${ISODIR}/initrd
77 # And install the syslinux stuff
78 cp ${STAGING_DATADIR_NATIVE}/syslinux/isolinux.bin \
81 mkisofs -V ${BOOTIMG_VOLUME_ID} \
82 -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
83 -b isolinux/isolinux.bin -c isolinux/boot.cat -r \
84 -no-emul-boot -boot-load-size 4 -boot-info-table \
90 bb.build.exec_func('build_syslinux_cfg', d)
91 bb.build.exec_func('build_boot_bin', d)
94 # We need to run after bootsplash if it exists, so thats why this line
95 # is such. Don't worry, if you don't do bootsplash, nobody will notice
97 addtask bootimg before do_build after do_bootsplash