[OE-core] [PATCH v2] boot-directdisk: fix the support of vmdk
Previous change (086ce22b88f5ef5f75a83119a32c8b3fdcfa296d) broke the creating of vmdk images. This protects shell expansion variables and let dd generate the image to be transformed to vmdk by image-vmdk.class. Signed-off-by: Joao Henrique Ferreira de Freitas --- Using IMAGE_FSTYPE to hold the result of base_contains(). meta/classes/boot-directdisk.bbclass | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass index 3277666..d0113ac 100644 --- a/meta/classes/boot-directdisk.bbclass +++ b/meta/classes/boot-directdisk.bbclass @@ -61,6 +61,8 @@ DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" SYSLINUX_ROOT ?= "root=/dev/sda2" SYSLINUX_TIMEOUT ?= "10" +IMAGE_FSTYPE = '${@base_contains("IMAGE_FSTYPES", "vmdk", "image-vmdk", "", d)}' + boot_direct_populate() { dest=$1 install -d $dest @@ -88,10 +90,10 @@ build_boot_dd() { grubefi_hddimg_populate $HDDDIR fi - if [ ${IMAGE_FSTYPE} = "vmdk" ]; then - if [ x${AUTO_SYSLINUXMENU} = x1 ] ; then + if [ "${IMAGE_FSTYPE}" = "image-vmdk" ]; then + if [ "x${AUTO_SYSLINUXMENU}" = "x1" ] ; then install -m 0644 ${STAGING_DIR}/${MACHINE}/usr/share/syslinux/vesamenu.c32 ${HDDDIR}${SYSLINUXDIR}/vesamenu.c32 - if [ x${SYSLINUX_SPLASH} != x ] ; then + if [ "x${SYSLINUX_SPLASH}" != "x" ] ; then install -m 0644 ${SYSLINUX_SPLASH} ${HDDDIR}${SYSLINUXDIR}/splash.lss fi fi @@ -129,9 +131,7 @@ build_boot_dd() { parted $IMAGE unit B mkpart primary ext2 ${END2}B ${END3}B parted $IMAGE set 1 boot on - if [ ${IMAGE_FSTYPE} != "vmdk" ]; then - parted $IMAGE print - fi + parted $IMAGE print awk "BEGIN { printf \"$(echo ${DISK_SIGNATURE} | fold -w 2 | tac | paste -sd '' | sed 's/\(..\)/\\x&/g')\" }" | \ dd of=$IMAGE bs=1 seek=440 conv=notrunc @@ -141,10 +141,8 @@ build_boot_dd() { dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc fi - if [ ${IMAGE_FSTYPE} != "vmdk" ]; then - dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512 - dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512 - fi + dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512 + dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512 cd ${DEPLOY_DIR_IMAGE} rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect -- 1.8.3.2 ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATH v2] boot-directdisk: fix the support of vmdk
Previous change (086ce22b88f5ef5f75a83119a32c8b3fdcfa296d) broke the creating of vmdk images. This protects shell expansion variables and let dd generate the image to be transformed to vmdk by image-vmdk.class. Signed-off-by: Joao Henrique Ferreira de Freitas --- Using IMAGE_FSTYPE to hold the result of base_contains(). meta/classes/boot-directdisk.bbclass | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass index 3277666..d0113ac 100644 --- a/meta/classes/boot-directdisk.bbclass +++ b/meta/classes/boot-directdisk.bbclass @@ -61,6 +61,8 @@ DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" SYSLINUX_ROOT ?= "root=/dev/sda2" SYSLINUX_TIMEOUT ?= "10" +IMAGE_FSTYPE = '${@base_contains("IMAGE_FSTYPES", "vmdk", "image-vmdk", "", d)}' + boot_direct_populate() { dest=$1 install -d $dest @@ -88,10 +90,10 @@ build_boot_dd() { grubefi_hddimg_populate $HDDDIR fi - if [ ${IMAGE_FSTYPE} = "vmdk" ]; then - if [ x${AUTO_SYSLINUXMENU} = x1 ] ; then + if [ "${IMAGE_FSTYPE}" = "image-vmdk" ]; then + if [ "x${AUTO_SYSLINUXMENU}" = "x1" ] ; then install -m 0644 ${STAGING_DIR}/${MACHINE}/usr/share/syslinux/vesamenu.c32 ${HDDDIR}${SYSLINUXDIR}/vesamenu.c32 - if [ x${SYSLINUX_SPLASH} != x ] ; then + if [ "x${SYSLINUX_SPLASH}" != "x" ] ; then install -m 0644 ${SYSLINUX_SPLASH} ${HDDDIR}${SYSLINUXDIR}/splash.lss fi fi @@ -129,9 +131,7 @@ build_boot_dd() { parted $IMAGE unit B mkpart primary ext2 ${END2}B ${END3}B parted $IMAGE set 1 boot on - if [ ${IMAGE_FSTYPE} != "vmdk" ]; then - parted $IMAGE print - fi + parted $IMAGE print awk "BEGIN { printf \"$(echo ${DISK_SIGNATURE} | fold -w 2 | tac | paste -sd '' | sed 's/\(..\)/\\x&/g')\" }" | \ dd of=$IMAGE bs=1 seek=440 conv=notrunc @@ -141,10 +141,8 @@ build_boot_dd() { dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc fi - if [ ${IMAGE_FSTYPE} != "vmdk" ]; then - dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512 - dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512 - fi + dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512 + dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512 cd ${DEPLOY_DIR_IMAGE} rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect -- 1.8.3.2 ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] boot-directdisk: fix the support of vmdk
Previous change (086ce22b88f5ef5f75a83119a32c8b3fdcfa296d) broke the creating of vmdk images. This protects shell expansion variables and let dd generate the image to be transformed to vmdk by image-vmdk.class. --- meta/classes/boot-directdisk.bbclass | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass index 3277666..4f26f47 100644 --- a/meta/classes/boot-directdisk.bbclass +++ b/meta/classes/boot-directdisk.bbclass @@ -88,10 +88,10 @@ build_boot_dd() { grubefi_hddimg_populate $HDDDIR fi - if [ ${IMAGE_FSTYPE} = "vmdk" ]; then - if [ x${AUTO_SYSLINUXMENU} = x1 ] ; then + if [ "${IMAGE_FSTYPES}" = "vmdk" ]; then + if [ "x${AUTO_SYSLINUXMENU}" = "x1" ] ; then install -m 0644 ${STAGING_DIR}/${MACHINE}/usr/share/syslinux/vesamenu.c32 ${HDDDIR}${SYSLINUXDIR}/vesamenu.c32 - if [ x${SYSLINUX_SPLASH} != x ] ; then + if [ "x${SYSLINUX_SPLASH}" != "x" ] ; then install -m 0644 ${SYSLINUX_SPLASH} ${HDDDIR}${SYSLINUXDIR}/splash.lss fi fi @@ -129,9 +129,7 @@ build_boot_dd() { parted $IMAGE unit B mkpart primary ext2 ${END2}B ${END3}B parted $IMAGE set 1 boot on - if [ ${IMAGE_FSTYPE} != "vmdk" ]; then - parted $IMAGE print - fi + parted $IMAGE print awk "BEGIN { printf \"$(echo ${DISK_SIGNATURE} | fold -w 2 | tac | paste -sd '' | sed 's/\(..\)/\\x&/g')\" }" | \ dd of=$IMAGE bs=1 seek=440 conv=notrunc @@ -141,10 +139,8 @@ build_boot_dd() { dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc fi - if [ ${IMAGE_FSTYPE} != "vmdk" ]; then - dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512 - dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512 - fi + dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512 + dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512 cd ${DEPLOY_DIR_IMAGE} rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect -- 1.8.3.2 ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] grub-efi.bbclass: Fixes GRUB_IMAGE when using boot-directdisk class
When boot-directdisk class is used and EFI boot is set the grub-efi-${TRANSLATED_TARGET_ARCH}-native need to be dependent. Allowing GRUB_IMAGE to be created and bootia32.efi got from the image directory. Signed-off-by: Joao Henrique Ferreira de Freitas --- meta/classes/grub-efi.bbclass | 1 + 1 file changed, 1 insertion(+) diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass index 96fb98b..3765bfd 100644 --- a/meta/classes/grub-efi.bbclass +++ b/meta/classes/grub-efi.bbclass @@ -16,6 +16,7 @@ # ${GRUB_TIMEOUT} - timeout before executing the deault label (optional) do_bootimg[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy" +do_bootdirectdisk[depends] += "grub-efi-${TRANSLATED_TARGET_ARCH}-native:do_deploy" GRUB_SERIAL ?= "console=ttyS0,115200" GRUBCFG = "${S}/grub.cfg" -- 1.8.3.2 ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH v2] boot-directdisk: Allow for EFI-only boot direct disk images
From: João Henrique Ferreira de Freitas Condition building PCBIOS legacy images on MACHINE_FEATURES containing "pcbios" or not containing "efi". This ensures existing BSPs will continue to get the old PCBIOS legacy-only images. New BSPs can add "efi", "pcbios", or both. The images created likewise support one or the other or both. Signed-off-by: João Henrique Ferreira de Freitas --- meta/classes/boot-directdisk.bbclass | 65 ++-- meta/classes/syslinux.bbclass| 5 +++ 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass index 8a55aae..4b9d7bd 100644 --- a/meta/classes/boot-directdisk.bbclass +++ b/meta/classes/boot-directdisk.bbclass @@ -31,6 +31,29 @@ EXCLUDE_FROM_WORLD = "1" BOOTDD_VOLUME_ID ?= "boot" BOOTDD_EXTRA_SPACE ?= "16384" +EFI = "${@base_contains("MACHINE_FEATURES", "efi", "1", "0", d)}" +EFI_CLASS = "${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "", d)}" + +# Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it does not +# contain "efi". This way legacy is supported by default if neither is +# specified, maintaining the original behavior. +def pcbios(d): +pcbios = base_contains("MACHINE_FEATURES", "pcbios", "1", "0", d) +if pcbios == "0": +pcbios = base_contains("MACHINE_FEATURES", "efi", "0", "1", d) +return pcbios + +def pcbios_class(d): +if d.getVar("PCBIOS", True) == "1": +return "syslinux" +return "" + +PCBIOS = "${@pcbios(d)}" +PCBIOS_CLASS = "${@pcbios_class(d)}" + +inherit ${PCBIOS_CLASS} +inherit ${EFI_CLASS} + # Get the build_syslinux_cfg() function from the syslinux class AUTO_SYSLINUXCFG = "1" @@ -38,17 +61,32 @@ DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" SYSLINUX_ROOT ?= "root=/dev/sda2" SYSLINUX_TIMEOUT ?= "10" -inherit syslinux - +populate() { + DEST=$1 + install -d ${DEST} + + # Install bzImage, initrd, and rootfs.img in DEST for all loaders to use. + install -m 0644 ${STAGING_KERNEL_DIR}/bzImage ${DEST}/vmlinuz + + if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then + install -m 0644 ${INITRD} ${DEST}/initrd + fi + +} + build_boot_dd() { HDDDIR="${S}/hdd/boot" HDDIMG="${S}/hdd.image" IMAGE=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect - install -d $HDDDIR - install -m 0644 ${STAGING_KERNEL_DIR}/bzImage $HDDDIR/vmlinuz - install -m 0644 ${S}/syslinux.cfg $HDDDIR/syslinux.cfg - install -m 444 ${STAGING_DATADIR}/syslinux/ldlinux.sys $HDDDIR/ldlinux.sys + populate ${HDDDIR} + + if [ "${PCBIOS}" = "1" ]; then + syslinux_hddimg_populate + fi + if [ "${EFI}" = "1" ]; then + grubefi_hddimg_populate + fi BLOCKS=`du -bks $HDDDIR | cut -f 1` BLOCKS=`expr $BLOCKS + ${BOOTDD_EXTRA_SPACE}` @@ -62,7 +100,9 @@ build_boot_dd() { mkdosfs -n ${BOOTDD_VOLUME_ID} -S 512 -C $HDDIMG $BLOCKS mcopy -i $HDDIMG -s $HDDDIR/* ::/ - syslinux $HDDIMG + if [ "${PCBIOS}" = "1" ]; then + syslinux_hdddirect_install $HDDIMG + fi chmod 644 $HDDIMG ROOTFSBLOCKS=`du -Lbks ${ROOTFS} | cut -f 1` @@ -85,9 +125,11 @@ build_boot_dd() { dd of=$IMAGE bs=1 seek=440 conv=notrunc OFFSET=`expr $END2 / 512` - dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc + if [ "${PCBIOS}" = "1" ]; then + dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc + fi dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512 - dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512 + dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512 cd ${DEPLOY_DIR_IMAGE} rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect @@ -96,7 +138,10 @@ build_boot_dd() { python do_bootdirectdisk() { validate_disk_signature(d) -bb.build.exec_func('build_syslinux_cfg', d) +if d.getVar("PCBIOS", True) == "1": +bb.build.exec_func('build_syslinux_cfg', d) +if d.getVar("EFI", True) == "1": +bb.build.exec_func('build_grub_cfg', d) bb.build.exec_func('build_boot_dd', d) } diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass index 501bc6d..dae6609 100644 --- a/meta/classes/syslinux.bbclass +++ b/meta/classes/syslinux.bbclass @@ -64,6 +64,11 @@ syslinux_hddimg_install() { syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg } +syslinux_hdddirect_install() { + DEST=$1 + syslinux $DEST +} + python build_syslinux_cfg () { import copy import sys -- 1.8.1.2 ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core
[OE-core] [PATCH] boot-directdisk: Allow for EFI-only boot direct disk images
From: João Henrique Ferreira de Freitas Condition building PCBIOS legacy images on MACHINE_FEATURES containing "pcbios" or not containing "efi". This ensures existing BSPs will continue to get the old PCBIOS legacy-only images. New BSPs can add "efi", "pcbios", or both. The images created likewise support one or the other or both. Signed-off-by: João Henrique Ferreira de Freitas --- meta/classes/boot-directdisk.bbclass | 65 ++-- meta/classes/syslinux.bbclass| 5 +++ 2 files changed, 60 insertions(+), 10 deletions(-) diff --git a/meta/classes/boot-directdisk.bbclass b/meta/classes/boot-directdisk.bbclass index 8a55aae..4b9d7bd 100644 --- a/meta/classes/boot-directdisk.bbclass +++ b/meta/classes/boot-directdisk.bbclass @@ -31,6 +31,29 @@ EXCLUDE_FROM_WORLD = "1" BOOTDD_VOLUME_ID ?= "boot" BOOTDD_EXTRA_SPACE ?= "16384" +EFI = "${@base_contains("MACHINE_FEATURES", "efi", "1", "0", d)}" +EFI_CLASS = "${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "", d)}" + +# Include legacy boot if MACHINE_FEATURES includes "pcbios" or if it does not +# contain "efi". This way legacy is supported by default if neither is +# specified, maintaining the original behavior. +def pcbios(d): +pcbios = base_contains("MACHINE_FEATURES", "pcbios", "1", "0", d) +if pcbios == "0": +pcbios = base_contains("MACHINE_FEATURES", "efi", "0", "1", d) +return pcbios + +def pcbios_class(d): +if d.getVar("PCBIOS", True) == "1": +return "syslinux" +return "" + +PCBIOS = "${@pcbios(d)}" +PCBIOS_CLASS = "${@pcbios_class(d)}" + +inherit ${PCBIOS_CLASS} +inherit ${EFI_CLASS} + # Get the build_syslinux_cfg() function from the syslinux class AUTO_SYSLINUXCFG = "1" @@ -38,17 +61,32 @@ DISK_SIGNATURE ?= "${DISK_SIGNATURE_GENERATED}" SYSLINUX_ROOT ?= "root=/dev/sda2" SYSLINUX_TIMEOUT ?= "10" -inherit syslinux - +populate() { + DEST=$1 + install -d ${DEST} + + # Install bzImage, initrd, and rootfs.img in DEST for all loaders to use. + install -m 0644 ${STAGING_KERNEL_DIR}/bzImage ${DEST}/vmlinuz + + if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then + install -m 0644 ${INITRD} ${DEST}/initrd + fi + +} + build_boot_dd() { HDDDIR="${S}/hdd/boot" HDDIMG="${S}/hdd.image" IMAGE=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hdddirect - install -d $HDDDIR - install -m 0644 ${STAGING_KERNEL_DIR}/bzImage $HDDDIR/vmlinuz - install -m 0644 ${S}/syslinux.cfg $HDDDIR/syslinux.cfg - install -m 444 ${STAGING_DATADIR}/syslinux/ldlinux.sys $HDDDIR/ldlinux.sys + populate ${HDDDIR} + + if [ "${PCBIOS}" = "1" ]; then + syslinux_hddimg_populate + fi + if [ "${EFI}" = "1" ]; then + grubefi_hddimg_populate + fi BLOCKS=`du -bks $HDDDIR | cut -f 1` BLOCKS=`expr $BLOCKS + ${BOOTDD_EXTRA_SPACE}` @@ -62,7 +100,9 @@ build_boot_dd() { mkdosfs -n ${BOOTDD_VOLUME_ID} -S 512 -C $HDDIMG $BLOCKS mcopy -i $HDDIMG -s $HDDDIR/* ::/ - syslinux $HDDIMG + if [ "${PCBIOS}" = "1" ]; then + syslinux_hdddirect_install $HDDIMG + fi chmod 644 $HDDIMG ROOTFSBLOCKS=`du -Lbks ${ROOTFS} | cut -f 1` @@ -85,9 +125,11 @@ build_boot_dd() { dd of=$IMAGE bs=1 seek=440 conv=notrunc OFFSET=`expr $END2 / 512` - dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc + if [ "${PCBIOS}" = "1" ]; then + dd if=${STAGING_DATADIR}/syslinux/mbr.bin of=$IMAGE conv=notrunc + fi dd if=$HDDIMG of=$IMAGE conv=notrunc seek=1 bs=512 - dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512 + dd if=${ROOTFS} of=$IMAGE conv=notrunc seek=$OFFSET bs=512 cd ${DEPLOY_DIR_IMAGE} rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.hdddirect @@ -96,7 +138,10 @@ build_boot_dd() { python do_bootdirectdisk() { validate_disk_signature(d) -bb.build.exec_func('build_syslinux_cfg', d) +if d.getVar("PCBIOS", True) == "1": +bb.build.exec_func('build_syslinux_cfg', d) +if d.getVar("EFI", True) == "1": +bb.build.exec_func('build_grub_cfg', d) bb.build.exec_func('build_boot_dd', d) } diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass index 501bc6d..dae6609 100644 --- a/meta/classes/syslinux.bbclass +++ b/meta/classes/syslinux.bbclass @@ -64,6 +64,11 @@ syslinux_hddimg_install() { syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg } +syslinux_hdddirect_install() { + DEST=$1 + syslinux $DEST +} + python build_syslinux_cfg () { import copy import sys -- 1.8.1.2 ___ Openembedded-core mailing list Openembedded-core@lists.openembedded.org http://lists.openembedded.org/mailman/listinfo/openembedded-core