Abstract away some names so one can select using EFI_PROVIDER a different
class than grub-efi for populating live images, basically allowing the use
of a different bootloader than grub-efi.

Signed-off-by: Stefan Stanacar <stefanx.stana...@intel.com>
---
 meta/classes/boot-directdisk.bbclass | 7 ++++---
 meta/classes/bootimg.bbclass         | 9 +++++----
 meta/classes/grub-efi.bbclass        | 6 ++++++
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/meta/classes/boot-directdisk.bbclass 
b/meta/classes/boot-directdisk.bbclass
index 42b3415..c35b4bb 100644
--- a/meta/classes/boot-directdisk.bbclass
+++ b/meta/classes/boot-directdisk.bbclass
@@ -32,7 +32,8 @@ 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)}"
+EFI_PROVIDER ?= "grub-efi"
+EFI_CLASS = "${@base_contains("MACHINE_FEATURES", "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
@@ -87,7 +88,7 @@ build_boot_dd() {
                syslinux_hddimg_populate $HDDDIR
        fi
        if [ "${EFI}" = "1" ]; then
-               grubefi_hddimg_populate $HDDDIR
+               ${EFICLASS_FUNC_PREFIX}_hddimg_populate $HDDDIR
        fi
 
        if [ "${IS_VMDK}" = "true" ]; then
@@ -154,7 +155,7 @@ python do_bootdirectdisk() {
     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_efi_cfg', d)
     bb.build.exec_func('build_boot_dd', d)
 }
 
diff --git a/meta/classes/bootimg.bbclass b/meta/classes/bootimg.bbclass
index c370bd6..f8cfd37 100644
--- a/meta/classes/bootimg.bbclass
+++ b/meta/classes/bootimg.bbclass
@@ -42,7 +42,8 @@ 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", "", d)}"
+EFI_PROVIDER ?= "grub-efi"
+EFI_CLASS = "${@base_contains("MACHINE_FEATURES", "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
@@ -89,7 +90,7 @@ build_iso() {
                syslinux_iso_populate ${ISODIR}
        fi
        if [ "${EFI}" = "1" ]; then
-               grubefi_iso_populate ${ISODIR}
+               ${EFICLASS_FUNC_PREFIX}_iso_populate ${ISODIR}
                build_fat_img ${EFIIMGDIR} ${ISODIR}/efi.img
        fi
 
@@ -206,7 +207,7 @@ build_hddimg() {
                        syslinux_hddimg_populate ${HDDDIR}
                fi
                if [ "${EFI}" = "1" ]; then
-                       grubefi_hddimg_populate ${HDDDIR}
+                       ${EFICLASS_FUNC_PREFIX}_hddimg_populate ${HDDDIR}
                fi
 
                build_fat_img ${HDDDIR} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.hddimg
@@ -227,7 +228,7 @@ python do_bootimg() {
     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_efi_cfg', d)
     bb.build.exec_func('build_hddimg', d)
     bb.build.exec_func('build_iso', d)
 }
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 71bd00f..f7fe8d8 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -15,6 +15,8 @@
 # ${GRUB_OPTS} - additional options to add to the config, ';' delimited # 
(optional)
 # ${GRUB_TIMEOUT} - timeout before executing the deault label (optional)
 
+EFICLASS_FUNC_PREFIX = "grubefi"
+
 do_bootimg[depends] += "grub-efi:do_deploy"
 do_bootdirectdisk[depends] += "grub-efi:do_deploy"
 
@@ -139,3 +141,7 @@ python build_grub_cfg() {
 
     cfgfile.close()
 }
+
+python build_efi_cfg() {
+    bb.build.exec_func("build_grub_cfg", d)
+}
-- 
1.8.5.3

_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Reply via email to