2007-06-08 08:39:22 +00:00
|
|
|
# Copyright (C) 2004, Advanced Micro Devices, Inc. All Rights Reserved
|
|
|
|
# Released under the MIT license (see packages/COPYING)
|
|
|
|
|
2010-03-25 11:36:40 +00:00
|
|
|
# Creates a bootable image using syslinux, your kernel and an optional
|
2007-06-08 08:39:22 +00:00
|
|
|
# initrd
|
|
|
|
|
2010-03-25 11:36:40 +00:00
|
|
|
#
|
|
|
|
# End result is two things:
|
|
|
|
#
|
2011-10-02 17:20:38 +00:00
|
|
|
# 1. A .hddimg file which is an msdos filesystem containing syslinux, a kernel,
|
2010-03-25 11:36:40 +00:00
|
|
|
# an initrd and a rootfs image. These can be written to harddisks directly and
|
|
|
|
# also booted on USB flash disks (write them there with dd).
|
|
|
|
#
|
|
|
|
# 2. A CD .iso image
|
|
|
|
|
|
|
|
# Boot process is that the initrd will boot and process which label was selected
|
|
|
|
# in syslinux. Actions based on the label are then performed (e.g. installing to
|
|
|
|
# an hdd)
|
|
|
|
|
2011-11-24 00:41:32 +00:00
|
|
|
# External variables (also used by syslinux.bbclass)
|
2007-06-08 08:39:22 +00:00
|
|
|
# ${INITRD} - indicates a filesystem image to use as an initrd (optional)
|
2011-11-24 00:41:32 +00:00
|
|
|
# ${NOISO} - skip building the ISO image if set to 1
|
2010-03-25 11:36:40 +00:00
|
|
|
# ${ROOTFS} - indicates a filesystem image to include as the root filesystem (optional)
|
2007-06-08 08:39:22 +00:00
|
|
|
|
2009-11-10 14:55:23 +00:00
|
|
|
do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
|
2011-11-24 00:41:32 +00:00
|
|
|
mtools-native:do_populate_sysroot \
|
|
|
|
cdrtools-native:do_populate_sysroot"
|
2007-06-08 08:39:22 +00:00
|
|
|
|
2007-06-08 20:45:44 +00:00
|
|
|
PACKAGES = " "
|
2010-03-25 11:36:40 +00:00
|
|
|
EXCLUDE_FROM_WORLD = "1"
|
2007-06-08 20:45:44 +00:00
|
|
|
|
|
|
|
HDDDIR = "${S}/hdd/boot"
|
2011-11-24 00:41:32 +00:00
|
|
|
ISODIR = "${S}/cd"
|
2007-06-08 08:39:22 +00:00
|
|
|
|
2010-03-25 11:36:40 +00:00
|
|
|
BOOTIMG_VOLUME_ID ?= "boot"
|
2008-09-10 21:19:19 +00:00
|
|
|
BOOTIMG_EXTRA_SPACE ?= "512"
|
2007-06-08 08:39:22 +00:00
|
|
|
|
|
|
|
inherit syslinux
|
2011-11-24 00:41:32 +00:00
|
|
|
|
2011-11-24 00:01:21 +00:00
|
|
|
build_iso() {
|
|
|
|
# Only create an ISO if we have an INITRD and NOISO was not set
|
|
|
|
if [ -z "${INITRD}" ] || [ ! -s "${INITRD}" ] || [ "${NOISO}" = "1" ]; then
|
|
|
|
bbnote "ISO image will not be created."
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
install -d ${ISODIR}
|
|
|
|
|
2011-11-24 00:41:32 +00:00
|
|
|
syslinux_iso_populate
|
2011-11-24 00:01:21 +00:00
|
|
|
|
|
|
|
mkisofs -V ${BOOTIMG_VOLUME_ID} \
|
2011-11-24 00:41:32 +00:00
|
|
|
-o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
|
|
|
|
-b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \
|
|
|
|
${MKISOFS_OPTIONS} ${ISODIR}
|
2011-11-24 00:01:21 +00:00
|
|
|
|
|
|
|
cd ${DEPLOY_DIR_IMAGE}
|
|
|
|
rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso
|
|
|
|
ln -s ${IMAGE_NAME}.iso ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso
|
|
|
|
}
|
|
|
|
|
|
|
|
build_hddimg() {
|
2011-10-19 18:36:49 +00:00
|
|
|
# Create an HDD image
|
|
|
|
if [ "${NOHDD}" != "1" ] ; then
|
|
|
|
install -d ${HDDDIR}
|
2011-11-24 00:41:32 +00:00
|
|
|
syslinux_hddimg_populate
|
2008-09-10 21:19:19 +00:00
|
|
|
|
2011-11-24 00:41:32 +00:00
|
|
|
# Determine the block count for the final image
|
2011-10-19 18:36:49 +00:00
|
|
|
BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
|
|
|
|
SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}`
|
2007-06-08 08:39:22 +00:00
|
|
|
|
2011-10-19 18:36:49 +00:00
|
|
|
mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \
|
2011-11-24 00:41:32 +00:00
|
|
|
-C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE
|
|
|
|
|
|
|
|
syslinux_hddimg_install
|
2007-06-08 08:39:22 +00:00
|
|
|
|
2011-10-19 18:36:49 +00:00
|
|
|
chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
|
2007-06-08 08:39:22 +00:00
|
|
|
|
2011-10-19 18:36:49 +00:00
|
|
|
cd ${DEPLOY_DIR_IMAGE}
|
|
|
|
rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg
|
|
|
|
ln -s ${IMAGE_NAME}.hddimg ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg
|
|
|
|
fi
|
2011-11-24 00:41:32 +00:00
|
|
|
}
|
2007-06-08 08:39:22 +00:00
|
|
|
|
|
|
|
python do_bootimg() {
|
|
|
|
bb.build.exec_func('build_syslinux_cfg', d)
|
2011-11-24 00:01:21 +00:00
|
|
|
bb.build.exec_func('build_hddimg', d)
|
|
|
|
bb.build.exec_func('build_iso', d)
|
2007-06-08 08:39:22 +00:00
|
|
|
}
|
|
|
|
|
2008-03-11 12:57:09 +00:00
|
|
|
addtask bootimg before do_build
|
2008-10-01 13:56:29 +00:00
|
|
|
do_bootimg[nostamp] = "1"
|