[OE-core] [PATCH v2 2/2] grub-efi/live-vm-common: allow grub as EFI_PROVIDER

Awais Belal awais_belal at mentor.com
Fri Dec 16 12:19:16 UTC 2016


This allows grub to be used as EFI_PROVIDER and
extends the grub-efi class so it can be used as is
when EFI_PROVIDER is grub.
Currently this can only be leveraged if you are
using the grub_git recipe and GRUBPLATFORM plus
EFI_PROVIDER are set correctly.

Signed-off-by: Awais Belal <awais_belal at mentor.com>
---
 meta/classes/grub-efi.bbclass       | 23 +++++++++++++++++------
 meta/classes/live-vm-common.bbclass |  2 +-
 2 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 17417ba..c847645 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -16,8 +16,8 @@
 # ${GRUB_TIMEOUT} - timeout before executing the deault label (optional)
 # ${GRUB_ROOT} - grub's root device.
 
-do_bootimg[depends] += "${MLPREFIX}grub-efi:do_deploy"
-do_bootdirectdisk[depends] += "${MLPREFIX}grub-efi:do_deploy"
+do_bootimg[depends] += "${MLPREFIX}${EFI_PROVIDER}:do_deploy"
+do_bootdirectdisk[depends] += "${MLPREFIX}${EFI_PROVIDER}:do_deploy"
 
 GRUB_SERIAL ?= "console=ttyS0,115200"
 GRUB_CFG_VM = "${S}/grub_vm.cfg"
@@ -40,10 +40,21 @@ efi_populate() {
 
 	install -d ${DEST}${EFIDIR}
 
-	GRUB_IMAGE="bootia32.efi"
-	if [ "${TARGET_ARCH}" = "x86_64" ]; then
-		GRUB_IMAGE="bootx64.efi"
-	fi
+    if [ "${EFI_PROVIDER}" = "grub" ]; then
+	    GRUB_IMAGE="bootia32.${GRUBPLATFORM}"
+	    if [ "${TARGET_ARCH}" = "x86_64" ]; then
+		    GRUB_IMAGE="bootx64.${GRUBPLATFORM}"
+	    elif [ "${TARGET_ARCH}" = "arm" ]; then
+            grubimage = "bootarm.${GRUBPLATFORM}"
+	    elif [ "${TARGET_ARCH}" = "aarch64" ]; then
+            grubimage = "bootaa64.${GRUBPLATFORM}"
+        fi
+    else
+        GRUB_IMAGE="bootia32.efi"
+	    if [ "${TARGET_ARCH}" = "x86_64" ]; then
+		    GRUB_IMAGE="bootx64.efi"
+        fi
+    fi
 	install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR}
 	EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
 	printf 'fs0:%s\%s\n' "$EFIPATH" "$GRUB_IMAGE" >${DEST}/startup.nsh
diff --git a/meta/classes/live-vm-common.bbclass b/meta/classes/live-vm-common.bbclass
index 734697f..0af228b 100644
--- a/meta/classes/live-vm-common.bbclass
+++ b/meta/classes/live-vm-common.bbclass
@@ -13,7 +13,7 @@ def set_live_vm_vars(d, suffix):
 
 EFI = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "1", "0", d)}"
 EFI_PROVIDER ?= "grub-efi"
-EFI_CLASS = "${@bb.utils.contains("MACHINE_FEATURES", "efi", "${EFI_PROVIDER}", "", d)}"
+EFI_CLASS = "${@bb.utils.contains("EFI_PROVIDER", "grub", "grub-efi", "${EFI_PROVIDER}", 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
-- 
1.9.1




More information about the Openembedded-core mailing list