[OE-core] [PATCH v2 7/9] uefi.bbclass: provide efi population functions for live images

dbaryshkov at gmail.com dbaryshkov at gmail.com
Fri Sep 13 15:44:32 UTC 2019


From: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov at mentor.com>

Define common functions for populating EFI directories in live image.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov at mentor.com>
---
 meta/classes/uefi.bbclass | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/meta/classes/uefi.bbclass b/meta/classes/uefi.bbclass
index 7991640a2aaa..dab654d73d52 100644
--- a/meta/classes/uefi.bbclass
+++ b/meta/classes/uefi.bbclass
@@ -24,3 +24,31 @@ python __anonymous () {
         raise bb.parse.SkipRecipe("UEFI unsupported on target %s, skipping" % target)
     d.setVar("EFI_BOOT_IMAGE", image)
 }
+
+efi_populate_common() {
+        # DEST must be the root of the image so that EFIDIR is not
+        # nested under a top level directory.
+        DEST=$1
+
+        install -d ${DEST}${EFIDIR}
+
+        install -m 0644 ${DEPLOY_DIR_IMAGE}/$2-${EFI_BOOT_IMAGE} ${DEST}${EFIDIR}/${EFI_BOOT_IMAGE}
+        EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
+        printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${DEST}/startup.nsh
+}
+
+efi_iso_populate_common() {
+        iso_dir=$1
+        efi_populate $iso_dir
+        # Build a EFI directory to create efi.img
+        mkdir -p ${EFIIMGDIR}/${EFIDIR}
+        cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
+        cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
+
+        EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
+        printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${EFIIMGDIR}/startup.nsh
+
+        if [ -f "$iso_dir/initrd" ] ; then
+                cp $iso_dir/initrd ${EFIIMGDIR}
+        fi
+}
-- 
2.23.0



More information about the Openembedded-core mailing list