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 DEPENDS_append=" dosfstools-native syslinux-native mtools-native cdrtools-native"
17 BDIR="${WORKDIR}/boot"
18 ISODIR="${IMAGE_ROOTFS}/isolinux/"
20 BOOTIMG_VOLUME_ID ?= "oe"
21 BOOTIMG_EXTRA_SPACE ?= "64"
23 # Get the build_syslinux_cfg() function from the syslinux class
25 SYSLINUXCFG="${BDIR}/syslinux.cfg"
26 SYSLINUXMENU="${BDIR}/menu"
31 install -m 0644 ${STAGING_KERNEL_DIR}/bzImage \
34 if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then
35 install -m 0644 ${INITRD} ${BDIR}/initrd
38 install -m 444 ${STAGING_DIR}/${BUILD_SYS}/share/syslinux/ldlinux.sys \
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}`
46 mkdosfs -F 12 -n ${BOOTIMG_VOLUME_ID} -d ${BDIR} \
47 -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}-boot.bin $SIZE
49 syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}-boot.bin
51 #Create an ISO if we have an INITRD
52 if [ -n "${INITRD}" ] && [ -s "${INITRD}" ] && [ "${NOISO}" != "1" ] ; then
57 install -m 0644 ${STAGING_KERNEL_DIR}/bzImage \
60 # Install the configuration files
62 cp ${BDIR}/syslinux.cfg ${ISODIR}/isolinux.cfg
64 if [ -f ${SYSLINUXMENU} ]; then
65 cp ${SYSLINUXMENU} ${ISODIR}
68 install -m 0644 ${INITRD} ${ISODIR}/initrd
70 # And install the syslinux stuff
71 cp ${STAGING_DIR}/${BUILD_SYS}/share/syslinux/isolinux.bin \
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 \
83 docfg = bb.data.getVar('AUTO_SYSLINUXCFG', d, 1)
85 bb.build.exec_func('build_syslinux_cfg', d)
86 bb.build.exec_func('build_boot_bin', d)
89 # We need to run after bootsplash if it exists, so thats why this line
90 # is such. Don't worry, if you don't do bootsplash, nobody will notice
92 addtask bootimg before do_build after do_bootsplash