Skip to contentSkip to conversation

EFI live image support

PATCH In review Darren Hart 2 participants 7 messages Nov 30, 2011

lore
Share & tools
lore
#0 lore raw

cover EFI live image support

This series provides optional support for EFI boot for live images, both hddimg and ISO, on ia32 platforms. It creates a new grub-efi-native recipe to create the boot image. bootimg.bbclass has been refactored and syslinux support has been made optional. The new live images can be built as PCBIOS-legacy (the original type), EFI, or both. The MACHINE_FEATURES values "pcbios" and "efi" dictate this behavior, if neither are specified, it defaults to PCBIOS-legacy only to maintain current behavior.

It is careful not to add unecessary dependencies to the build by dynamically including only the necessary bootloader classes (syslinux and/or grub-efi).

EFI hddimg's do not install into /EFI/BOOT as is proper due to a bug in the
dosfstools: http://bugzilla.yoctoproject.org/show_bug.cgi?id=1783. For now, the files are installed in the root directory and users will need to update their firmware or use a startup.nsh script for pure EFI booting, or move them to /EFI/BOOT manually.

Testing performed includes verification of the images built for the n450 BSP with all combinations of the MACHINE_FEATURES. The syslinux and grub-efi boot methods were validated on the n450 hardware as well. EFI-only ISO images are untested, help here would be appreciated.

While the "install" target is preserved for the EFI boot, it will perform the same install as it does currently - namely a GRUB legacy boot mechanism. Support for EFI boot post install will follow in another patch series.

Thanks to Koen Kooi, Chris Larson, Richard Purdie, Josef Ahmad, Saul Wold, and Joshua Lock for their contributions of expertise, code, and testing.

The following changes since commit 2864ff6a4b3c3f9b3bbb6d2597243cc5d3715939:

getVar/setVar cleanups (2011-11-26 22:42:00 +0000)

are available in the git repository at:
git://git.yoctoproject.org/user-contrib/dvhart/oe-core efi/v1
http://git.yoctoproject.org/cgit.cgi/user-contrib/dvhart/oe-core/log/?h=efi/v1

Darren Hart (5):
grub-efi-native: New recipe to build GRUB EFI images
bootimg: Refactor build_hddimg and build_iso routines
bootimg: Pull syslinux specific bits into syslinux.bbclass
bootimg: Add grub-efi support
bootimg: Allow for EFI-only boot images

 meta/classes/bootimg.bbclass                  |  148 +++++++++++++------------
 meta/classes/dummy.bbclass                    |    2 +
 meta/classes/grub-efi.bbclass                 |  140 +++++++++++++++++++++++
 meta/classes/syslinux.bbclass                 |   68 ++++++++++--
 meta/recipes-bsp/grub/grub-efi-native_1.99.bb |   74 ++++++++++++
 5 files changed, 353 insertions(+), 79 deletions(-)
 create mode 100644 meta/classes/dummy.bbclass
 create mode 100644 meta/classes/grub-efi.bbclass
 create mode 100644 meta/recipes-bsp/grub/grub-efi-native_1.99.bb
Signature · 1 line
1.7.6.4
#1 lore raw

PATCH 1/5 grub-efi-native: New recipe to build GRUB EFI images

From: Darren Hart <[email protected]>

Add a recipe to build the GRUB efi images. This recipe is written as a native recipe as the resulting GRUB utils are required to assemble the final image. Rather than build a native and a target recipe (and increase build times), this recipe builds the utils for the host and passes an appropriate --target argument to the GRUB configure script to build the modules for the target arch. The only output of this recipe is an EFI image in the deploy directory.

Care is taken to ensure changing targets will force a rebuild of this native recipe by including the target arch in the PN.

---
 meta/recipes-bsp/grub/grub-efi-native_1.99.bb |   74 +++++++++++++++++++++++++
 1 files changed, 74 insertions(+), 0 deletions(-)
 create mode 100644 meta/recipes-bsp/grub/grub-efi-native_1.99.bb
meta/recipes-bsp/grub/grub-efi-native_1.99.bb new file +74 -0
new file mode 100644
index 0000000..3c52ec9
@@ -0,0 +1,74 @@
+SUMMARY = "GRUB2 is the next-generation GRand Unified Bootloader"
+
+DESCRIPTION = "GRUB2 is the next generaion of a GPLed bootloader \
+intended to unify bootloading across x86 operating systems. In \
+addition to loading the Linux kernel, it implements the Multiboot \
+standard, which allows for flexible loading of multiple boot images. \
+This recipe builds an EFI binary for the target. It does not install \
+or package anything, it only deploys a target-arch GRUB EFI image."
+
+HOMEPAGE = "http://www.gnu.org/software/grub/"
+SECTION = "bootloaders"
+PRIORITY = "optional"
+
+LICENSE = "GPLv3"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504"
+
+# FIXME: We should be able to optionally drop freetype as a dependency
+DEPENDS = "help2man-native"
+RDEPENDS_${PN} = "diffutils freetype"
+PR = "r1"
+
+# Native packages do not normally rebuild when the target changes.
+# Ensure this is built once per HOST-TARGET pair.
+PN := "grub-efi-${TRANSLATED_TARGET_ARCH}-native"
+
+SRC_URI = "ftp://ftp.gnu.org/gnu/grub/grub-${PV}.tar.gz"
+
+SRC_URI[md5sum] = "ca9f2a2d571b57fc5c53212d1d22e2b5"
+SRC_URI[sha256sum] = "b91f420f2c51f6155e088e34ff99bea09cc1fb89585cf7c0179644e57abd28ff"
+
+COMPATIBLE_HOST = '(x86_64.*|i.86.*)-(linux|freebsd.*)'
+
+S = "${WORKDIR}/grub-${PV}"
+
+# Determine the target arch for the grub modules before the native class
+# clobbers TARGET_ARCH.
+ORIG_TARGET_ARCH := ${TARGET_ARCH}
+python __anonymous () {
+    import re
+    target = d.getVar('ORIG_TARGET_ARCH', True)
+    if target == "x86_64":
+        grubtarget = 'x86_64'
+        grubimage = "bootx64.efi"
+    elif re.match('i.86', target):
+        grubtarget = 'i386'
+        grubimage = "bootia32.efi"
+    else:
+        raise bb.parse.SkipPackage("grub-efi is incompatible with target %s" % target)
+    d.setVar("GRUB_TARGET", grubtarget)
+    d.setVar("GRUB_IMAGE", grubimage)
+}
+
+inherit autotools
+inherit gettext
+inherit native
+inherit deploy
+
+EXTRA_OECONF = "--with-platform=efi --disable-grub-mkfont \
+                --target=${GRUB_TARGET} --enable-efiemu=no --program-prefix=''"
+
+do_mkimage() {
+	./grub-mkimage -p / -d ./grub-core/ \
+		       -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE} \
+	               boot linux fat serial part_msdos normal
+}
+addtask mkimage after do_compile before do_install
+
+do_deploy() {
+	install -m 644 ${S}/${GRUB_IMAGE} ${DEPLOYDIR}
+}
+addtask deploy after do_install before do_build
+
+do_install[noexec] = "1"
+do_populate_sysroot[noexec] = "1"
Signature · 1 line
1.7.6.4
#2 lore raw

PATCH 2/5 bootimg: Refactor build_hddimg and build_iso routines

From: Darren Hart <[email protected]>

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.

---
 meta/classes/bootimg.bbclass |   85 +++++++++++++++++++++---------------------
 1 files changed, 43 insertions(+), 42 deletions(-)
meta/classes/bootimg.bbclass +43 -42
index 3914311..dbaa677 100644
@@ -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
Signature · 1 line
1.7.6.4
#3 lore raw

PATCH 3/5 bootimg: Pull syslinux specific bits into syslinux.bbclass

In reply to Darren Hart

From: Darren Hart <[email protected]>

Working towards a more generic bootimg.bbclass, pull out all syslinux specific bits and let syslinux.bbclass manage them directly. This introduces no functional changes to the images constructed and the behavior remains unchanged.

---
 meta/classes/bootimg.bbclass  |   71 +++++++++-------------------------------
 meta/classes/syslinux.bbclass |   68 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 76 insertions(+), 63 deletions(-)
meta/classes/bootimg.bbclass +16 -55
index dbaa677..0554ffa 100644
@@ -17,36 +17,26 @@
 # in syslinux. Actions based on the label are then performed (e.g. installing to 
 # an hdd)
 
-# External variables
+# External variables (also used by syslinux.bbclass)
 # ${INITRD} - indicates a filesystem image to use as an initrd (optional)
+# ${NOISO}  - skip building the ISO image if set to 1
 # ${ROOTFS} - indicates a filesystem image to include as the root filesystem (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 
 
 do_bootimg[depends] += "dosfstools-native:do_populate_sysroot \
-                       syslinux:do_populate_sysroot \
-                       syslinux-native:do_populate_sysroot \
-		       mtools-native:do_populate_sysroot \
-		       cdrtools-native:do_populate_sysroot"
+                        mtools-native:do_populate_sysroot \
+                        cdrtools-native:do_populate_sysroot"
 
 PACKAGES = " "
 EXCLUDE_FROM_WORLD = "1"
 
 HDDDIR = "${S}/hdd/boot"
-ISODIR = "${S}/cd/isolinux"
+ISODIR = "${S}/cd"
 
 BOOTIMG_VOLUME_ID   ?= "boot"
 BOOTIMG_EXTRA_SPACE ?= "512"
 
-# Get the build_syslinux_cfg() function from the syslinux class
-
-SYSLINUXCFG  = "${HDDDIR}/syslinux.cfg"
-SYSLINUXMENU = "${HDDDIR}/menu"
-
 inherit syslinux
-		
+
 build_iso() {
 	# Only create an ISO if we have an INITRD and NOISO was not set
 	if [ -z "${INITRD}" ] || [ ! -s "${INITRD}" ] || [ "${NOISO}" = "1" ]; then
@@ -56,31 +46,12 @@ build_iso() {
 
 	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}
+	syslinux_iso_populate
 
 	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/
+	        -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
+		-b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \
+		${MKISOFS_OPTIONS} ${ISODIR}
 
 	cd ${DEPLOY_DIR_IMAGE}
 	rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso
@@ -91,34 +62,24 @@ build_hddimg() {
 	# Create an HDD image
 	if [ "${NOHDD}" != "1" ] ; then
 		install -d ${HDDDIR}
-		install -m 0644 ${STAGING_DIR_HOST}/kernel/bzImage \
-		${HDDDIR}/vmlinuz
-
-		if [ -n "${INITRD}" ] && [ -s "${INITRD}" ]; then
-				install -m 0644 ${INITRD} ${HDDDIR}/initrd
-		fi
-
-		if [ -n "${ROOTFS}" ] && [ -s "${ROOTFS}" ]; then
-				install -m 0644 ${ROOTFS} ${HDDDIR}/rootfs.img
-		fi
+		syslinux_hddimg_populate
 
-		install -m 444 ${STAGING_LIBDIR}/syslinux/ldlinux.sys ${HDDDIR}/ldlinux.sys
-
-		# Do a little math, bash style
+		# Determine the block count for the final image
 		BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
 		SIZE=`expr $BLOCKS + ${BOOTIMG_EXTRA_SPACE}`
 
 		mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \
-		-C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE
+		        -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE
+
+		syslinux_hddimg_install
 
-		syslinux ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
 		chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
 
 		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
-} 
+}
 
 python do_bootimg() {
 	bb.build.exec_func('build_syslinux_cfg', d)
meta/classes/syslinux.bbclass +60 -8

94 lines not on this page · raw message

Signature · 1 line
1.7.6.4
#4 lore raw

PATCH 4/5 bootimg: Add grub-efi support

In reply to Darren Hart

From: Darren Hart <[email protected]>

Create a new grub-efi.bbclass and integrate it into bootimg alongside the syslinux support. This new class uses the output from the grub-efi-native recipe. Thanks goes to Josef Ahmad <[email protected]> for the original build_grub_cfg() routine.

The EFI features are only added to the image if MACHINE_FEATURES contains "efi". The resulting images are therefor either legacy boot only (like they were originally) or legacy boot and EFI boot.

A new "dummy.bbclass" was added to allow for the conditional include of grub-efi. This makes it so if efi support is not to be built in, we don't spend time building grub-efi-native just because the include adds the dependency.

There is a bug in the mkdosfs tool from the dosfstools package which causes it to crash when the directory passed with the -d parameter contains sub-directories. An /EFI/BOOT directory is required for a proper EFI installation. Until it is fixed, we install to the top level directory for the hddimg.

---
 meta/classes/bootimg.bbclass  |   13 ++++
 meta/classes/dummy.bbclass    |    2 +
 meta/classes/grub-efi.bbclass |  140 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 155 insertions(+), 0 deletions(-)
 create mode 100644 meta/classes/dummy.bbclass
 create mode 100644 meta/classes/grub-efi.bbclass
meta/classes/bootimg.bbclass +13 -0
index 0554ffa..ce95801 100644
@@ -35,7 +35,12 @@ ISODIR = "${S}/cd"
 BOOTIMG_VOLUME_ID   ?= "boot"
 BOOTIMG_EXTRA_SPACE ?= "512"
 
+EFI = ${@base_contains("MACHINE_FEATURES", "efi", "1", "0", d)}
+EFI_CLASS = ${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "dummy", d)}
+
 inherit syslinux
+inherit ${EFI_CLASS}
+
 
 build_iso() {
 	# Only create an ISO if we have an INITRD and NOISO was not set
@@ -47,6 +52,9 @@ build_iso() {
 	install -d ${ISODIR}
 
 	syslinux_iso_populate
+	if [ "${EFI}" = "1" ]; then
+		grubefi_iso_populate
+	fi
 
 	mkisofs -V ${BOOTIMG_VOLUME_ID} \
 	        -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
@@ -63,6 +71,9 @@ build_hddimg() {
 	if [ "${NOHDD}" != "1" ] ; then
 		install -d ${HDDDIR}
 		syslinux_hddimg_populate
+		if [ "${EFI}" = "1" ]; then
+			grubefi_hddimg_populate
+		fi
 
 		# Determine the block count for the final image
 		BLOCKS=`du -bks ${HDDDIR} | cut -f 1`
@@ -83,6 +94,8 @@ build_hddimg() {
 
 python do_bootimg() {
 	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_hddimg', d)
 	bb.build.exec_func('build_iso', d)
 }
meta/classes/dummy.bbclass new file +2 -0
new file mode 100644
index 0000000..8c30071
@@ -0,0 +1,2 @@
+# An empty bbclass to facilitate dynamic inherit, include,
+# and require statements.
meta/classes/grub-efi.bbclass new file +140 -0

140 lines not on this page · raw message

Signature · 1 line
1.7.6.4
#5 lore raw

PATCH 5/5 bootimg: Allow for EFI-only boot images

In reply to Darren Hart

From: Darren Hart <[email protected]>

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.

EFI-only ISO images are untested.

---
 meta/classes/bootimg.bbclass |   49 ++++++++++++++++++++++++++++++++++-------
 1 files changed, 40 insertions(+), 9 deletions(-)
meta/classes/bootimg.bbclass +40 -9
index ce95801..0d06351 100644
@@ -38,7 +38,24 @@ BOOTIMG_EXTRA_SPACE ?= "512"
 EFI = ${@base_contains("MACHINE_FEATURES", "efi", "1", "0", d)}
 EFI_CLASS = ${@base_contains("MACHINE_FEATURES", "efi", "grub-efi", "dummy", d)}
 
-inherit syslinux
+# 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 "dummy"
+
+PCBIOS = ${@pcbios(d)}
+PCBIOS_CLASS = ${@pcbios_class(d)}
+
+inherit ${PCBIOS_CLASS}
 inherit ${EFI_CLASS}
 
 
@@ -51,15 +68,24 @@ build_iso() {
 
 	install -d ${ISODIR}
 
-	syslinux_iso_populate
+	if [ "${PCBIOS}" = "1" ]; then
+		syslinux_iso_populate
+	fi
 	if [ "${EFI}" = "1" ]; then
 		grubefi_iso_populate
 	fi
 
-	mkisofs -V ${BOOTIMG_VOLUME_ID} \
-	        -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
-		-b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \
-		${MKISOFS_OPTIONS} ${ISODIR}
+	if [ "${PCBIOS}" = "1" ]; then
+		mkisofs -V ${BOOTIMG_VOLUME_ID} \
+		        -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
+			-b ${ISO_BOOTIMG} -c ${ISO_BOOTCAT} -r \
+			${MKISOFS_OPTIONS} ${ISODIR}
+	else
+		bbnote "EFI-only ISO images are untested, please provide feedback."
+		mkisofs -V ${BOOTIMG_VOLUME_ID} \
+		        -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.iso \
+			-r ${ISODIR}
+	fi
 
 	cd ${DEPLOY_DIR_IMAGE}
 	rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.iso
@@ -70,7 +96,9 @@ build_hddimg() {
 	# Create an HDD image
 	if [ "${NOHDD}" != "1" ] ; then
 		install -d ${HDDDIR}
-		syslinux_hddimg_populate
+		if [ "${PCBIOS}" = "1" ]; then
+			syslinux_hddimg_populate
+		fi
 		if [ "${EFI}" = "1" ]; then
 			grubefi_hddimg_populate
 		fi
@@ -82,7 +110,9 @@ build_hddimg() {
 		mkdosfs -n ${BOOTIMG_VOLUME_ID} -d ${HDDDIR} \
 		        -C ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg $SIZE
 
-		syslinux_hddimg_install
+		if [ "${PCBIOS}" = "1" ]; then
+			syslinux_hddimg_install
+		fi
 
 		chmod 644 ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
 
@@ -93,7 +123,8 @@ build_hddimg() {
 }
 
 python do_bootimg() {
-	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_hddimg', d)
Signature · 1 line
1.7.6.4
#6 lore raw
In reply to Darren Hart
Quoted 38 lines · Darren Hart

This series provides optional support for EFI boot for live images, both hddimg and ISO, on ia32 platforms. It creates a new grub-efi-native recipe to create the boot image. bootimg.bbclass has been refactored and syslinux support has been made optional. The new live images can be built as PCBIOS-legacy (the original type), EFI, or both. The MACHINE_FEATURES values "pcbios" and "efi" dictate this behavior, if neither are specified, it defaults to PCBIOS-legacy only to maintain current behavior.

It is careful not to add unecessary dependencies to the build by dynamically including only the necessary bootloader classes (syslinux and/or grub-efi).

EFI hddimg's do not install into /EFI/BOOT as is proper due to a bug in the
dosfstools: http://bugzilla.yoctoproject.org/show_bug.cgi?id=1783. For now, the files are installed in the root directory and users will need to update their firmware or use a startup.nsh script for pure EFI booting, or move them to /EFI/BOOT manually.

Testing performed includes verification of the images built for the n450 BSP with all combinations of the MACHINE_FEATURES. The syslinux and grub-efi boot methods were validated on the n450 hardware as well. EFI-only ISO images are untested, help here would be appreciated.

While the "install" target is preserved for the EFI boot, it will perform the same install as it does currently - namely a GRUB legacy boot mechanism. Support for EFI boot post install will follow in another patch series.

Thanks to Koen Kooi, Chris Larson, Richard Purdie, Josef Ahmad, Saul Wold, and Joshua Lock for their contributions of expertise, code, and testing.

The following changes since commit 2864ff6a4b3c3f9b3bbb6d2597243cc5d3715939:

getVar/setVar cleanups (2011-11-26 22:42:00 +0000)

are available in the git repository at:
git://git.yoctoproject.org/user-contrib/dvhart/oe-core efi/v1
http://git.yoctoproject.org/cgit.cgi/user-contrib/dvhart/oe-core/log/?h=efi/v1

Quoted 6 lines

Darren Hart (5):
grub-efi-native: New recipe to build GRUB EFI images
bootimg: Refactor build_hddimg and build_iso routines
bootimg: Pull syslinux specific bits into syslinux.bbclass
bootimg: Add grub-efi support
bootimg: Allow for EFI-only boot images

Thanks for this, I know its taken a bit of work!

I'm a little frustrated we have to jump through the dummy class hoop but that isn't your fault and we need to improve bitbake to better deal with it. Some of the syntax in places isn't ideal either but I can't come up with anything much better.

I'm going to merge it on the grounds this provides a good starting point and if we find improvements we can make them on top of this.

Cheers

Richard