2007-06-08 08:39:22 +00:00
|
|
|
# bootimg.oeclass
|
|
|
|
# Copyright (C) 2004, Advanced Micro Devices, Inc. All Rights Reserved
|
|
|
|
# Released under the MIT license (see packages/COPYING)
|
|
|
|
|
|
|
|
# This creates a bootable image using syslinux, your kernel and an optional
|
|
|
|
# initrd
|
|
|
|
|
|
|
|
# External variables needed
|
|
|
|
# ${INITRD} - indicates a filesystem image to use as an initrd (optional)
|
|
|
|
# ${AUTO_SYSLINUXCFG} - set this to 1 to enable creating an automatic config
|
|
|
|
# ${LABELS} - a list of targets for the automatic config
|
|
|
|
# ${APPEND} - an override list of append strings for each label
|
|
|
|
# ${SYSLINUX_OPTS} - additional options to add to the syslinux file ';' delimited
|
|
|
|
|
2007-10-11 21:46:11 +00:00
|
|
|
do_bootimg[depends] += "dosfstools-native:do_populate_staging \
|
2008-10-20 00:22:07 +00:00
|
|
|
syslinux:do_populate_staging \
|
|
|
|
syslinux-installer-native:do_populate_staging \
|
2007-06-08 18:21:18 +00:00
|
|
|
mtools-native:do_populate_staging \
|
|
|
|
cdrtools-native:do_populate_staging"
|
2007-06-08 08:39:22 +00:00
|
|
|
|
2007-06-08 20:45:44 +00:00
|
|
|
PACKAGES = " "
|
|
|
|
|
|
|
|
HDDDIR = "${S}/hdd/boot"
|
|
|
|
ISODIR = "${S}/cd/isolinux"
|
2007-06-08 08:39:22 +00:00
|
|
|
|
2007-06-08 18:22:19 +00:00
|
|
|
BOOTIMG_VOLUME_ID ?= "oe"
|
2008-09-10 21:19:19 +00:00
|
|
|
BOOTIMG_EXTRA_SPACE ?= "512"
|
2007-06-08 08:39:22 +00:00
|
|
|
|
|
|
|
# Get the build_syslinux_cfg() function from the syslinux class
|
|
|
|
|
2007-06-08 20:45:44 +00:00
|
|
|
SYSLINUXCFG = "${HDDDIR}/syslinux.cfg"
|
|
|
|
SYSLINUXMENU = "${HDDDIR}/menu"
|
2007-06-08 18:22:19 +00:00
|
|
|
|
2007-06-08 08:39:22 +00:00
|
|
|
inherit syslinux
|
|
|
|
|
|
|
|
build_boot_bin() {
|
2007-06-08 20:45:44 +00:00
|
|
|
install -d ${HDDDIR}
|
2007-06-11 10:35:28 +00:00
|
|
|
install -m 0644 ${STAGING_DIR}/${MACHINE}${HOST_VENDOR}-${HOST_OS}/kernel/bzImage \
|
2007-06-08 20:45:44 +00:00
|
|
|
${HDDDIR}/vmlinuz
|
2007-06-08 08:39:22 +00:00
|
|
|
|
|
|
|
if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then
|
2007-06-08 20:45:44 +00:00
|
|
|
install -m 0644 ${INITRD} ${HDDDIR}/initrd
|
2007-06-08 08:39:22 +00:00
|
|
|
fi
|
|
|
|
|
2008-09-10 21:19:19 +00:00
|
|
|
if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then
|
|
|
|
install -m 0644 ${ROOTFS} ${HDDDIR}/rootfs.img
|
|
|
|
fi
|
|
|
|
|
2008-10-20 00:22:07 +00:00
|
|
|
install -m 444 ${STAGING_DATADIR}/syslinux/ldlinux.sys \
|
2007-06-08 20:45:44 +00:00
|
|
|
${HDDDIR}/ldlinux.sys
|
2007-06-08 08:39:22 +00:00
|
|
|
|
|
|
|
# Do a little math, bash style
|
2007-06-08 20:45:44 +00:00
|
|
|
#BLOCKS=`du -s ${HDDDIR} | cut -f 1`
|
|
|
|
BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
|
2007-06-08 08:39:22 +00:00
|
|
|
SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}`
|
|
|
|
|
2008-11-10 18:26:19 +00:00
|
|
|
mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \
|
2007-06-08 20:45:44 +00:00
|
|
|
-C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE
|
2007-06-08 08:39:22 +00:00
|
|
|
|
2007-06-08 20:45:44 +00:00
|
|
|
syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
|
|
|
|
chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
|
2007-06-08 08:39:22 +00:00
|
|
|
|
2008-10-17 11:04:51 +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
|
|
|
|
|
2007-06-08 08:39:22 +00:00
|
|
|
#Create an ISO if we have an INITRD
|
|
|
|
if [ -n "${INITRD}" ] && [ -s "${INITRD}" ] && [ "${NOISO}" != "1" ] ; then
|
|
|
|
install -d ${ISODIR}
|
|
|
|
|
|
|
|
# Install the kernel
|
|
|
|
|
2007-06-11 10:35:28 +00:00
|
|
|
install -m 0644 ${STAGING_DIR}/${MACHINE}${HOST_VENDOR}-${HOST_OS}/kernel/bzImage \
|
2007-06-08 08:39:22 +00:00
|
|
|
${ISODIR}/vmlinuz
|
|
|
|
|
|
|
|
# Install the configuration files
|
|
|
|
|
2007-06-08 20:45:44 +00:00
|
|
|
cp ${HDDDIR}/syslinux.cfg ${ISODIR}/isolinux.cfg
|
2007-06-08 08:39:22 +00:00
|
|
|
|
|
|
|
if [ -f ${SYSLINUXMENU} ]; then
|
|
|
|
cp ${SYSLINUXMENU} ${ISODIR}
|
|
|
|
fi
|
|
|
|
|
|
|
|
install -m 0644 ${INITRD} ${ISODIR}/initrd
|
|
|
|
|
2008-10-27 12:43:38 +00:00
|
|
|
if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then
|
|
|
|
install -m 0644 ${ROOTFS} ${ISODIR}/rootfs.img
|
|
|
|
fi
|
|
|
|
|
2007-06-08 08:39:22 +00:00
|
|
|
# And install the syslinux stuff
|
2008-10-20 00:22:07 +00:00
|
|
|
cp ${STAGING_DATADIR}/syslinux/isolinux.bin \
|
2007-06-08 08:39:22 +00:00
|
|
|
${ISODIR}
|
|
|
|
|
|
|
|
mkisofs -V ${BOOTIMG_VOLUME_ID} \
|
|
|
|
-o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
|
|
|
|
-b isolinux/isolinux.bin -c isolinux/boot.cat -r \
|
|
|
|
-no-emul-boot -boot-load-size 4 -boot-info-table \
|
2007-06-08 20:45:44 +00:00
|
|
|
${S}/cd/
|
2008-10-17 11:04:51 +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
|
|
|
|
|
2007-06-08 08:39:22 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
python do_bootimg() {
|
|
|
|
bb.build.exec_func('build_syslinux_cfg', d)
|
|
|
|
bb.build.exec_func('build_boot_bin', d)
|
|
|
|
}
|
|
|
|
|
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"
|