From 2da25c7c6649757350782a939bcc7553c5c86570 Mon Sep 17 00:00:00 2001 From: Darren Hart Date: Wed, 23 Nov 2011 16:01:21 -0800 Subject: bootimg: Refactor build_hddimg and build_iso routines Separate the construction of the ISO image from that of the hddimg. This is part of the groundwork for creating a much more flexible live image builder. Signed-off-by: Darren Hart --- meta/classes/bootimg.bbclass | 85 ++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 42 deletions(-) (limited to 'meta/classes/bootimg.bbclass') diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass index 3914311254..dbaa677600 100644 --- a/meta/classes/bootimg.bbclass +++ b/meta/classes/bootimg.bbclass @@ -47,7 +47,47 @@ SYSLINUXMENU = "${HDDDIR}/menu" inherit syslinux -build_boot_bin() { +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} + + # Install the kernel + install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage \ + ${ISODIR}/vmlinuz + + # Install the configuration files + cp ${HDDDIR}/syslinux.cfg ${ISODIR}/isolinux.cfg + + if [ -f ${SYSLINUXMENU} ]; then + cp ${SYSLINUXMENU} ${ISODIR} + fi + + install -m 0644 ${INITRD} ${ISODIR}/initrd + + if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then + install -m 0644 ${ROOTFS} ${ISODIR}/rootfs.img + fi + + # And install the syslinux stuff + cp ${STAGING_LIBDIR}/syslinux/isolinux.bin ${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 \ + ${S}/cd/ + + 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() { # Create an HDD image if [ "${NOHDD}" != "1" ] ; then install -d ${HDDDIR} @@ -78,51 +118,12 @@ build_boot_bin() { rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg ln -s ${IMAGE_NAME}.hddimg ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hddimg fi - - #Create an ISO if we have an INITRD - if [ -n "${INITRD}" ] && [ -s "${INITRD}" ] && [ "${NOISO}" != "1" ] ; then - install -d ${ISODIR} - - # Install the kernel - - install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage \ - ${ISODIR}/vmlinuz - - # Install the configuration files - - cp ${HDDDIR}/syslinux.cfg ${ISODIR}/isolinux.cfg - - if [ -f ${SYSLINUXMENU} ]; then - cp ${SYSLINUXMENU} ${ISODIR} - fi - - install -m 0644 ${INITRD} ${ISODIR}/initrd - - if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then - install -m 0644 ${ROOTFS} ${ISODIR}/rootfs.img - fi - - # And install the syslinux stuff - cp ${STAGING_LIBDIR}/syslinux/isolinux.bin ${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 \ - ${S}/cd/ - - isohybrid ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso - - 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 - - fi } python do_bootimg() { bb.build.exec_func('build_syslinux_cfg', d) - bb.build.exec_func('build_boot_bin', d) + bb.build.exec_func('build_hddimg', d) + bb.build.exec_func('build_iso', d) } addtask bootimg before do_build -- cgit 1.2.3-korg