]> code.ossystems Code Review - openembedded-core.git/commitdiff
live-vm-common.bbclass: provide efi population functions for live images
authorDmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
Wed, 18 Sep 2019 13:12:47 +0000 (16:12 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 19 Sep 2019 09:54:26 +0000 (10:54 +0100)
Define common functions for populating EFI directories in live image by
reusing common code from grub-efi and systemd-boot bbclasses.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/grub-efi.bbclass
meta/classes/live-vm-common.bbclass
meta/classes/systemd-boot.bbclass

index 724bbe86842c59d8ce4cc199d9f9336397667528..8fc6999e52a8a0fe58b0526e42ee4d10a238eec0 100644 (file)
@@ -2,33 +2,7 @@ inherit grub-efi-cfg
 require conf/image-uefi.conf
 
 efi_populate() {
-       # 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}/grub-efi-${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_populate_common "$1" grub-efi
 
        install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg
 }
-
-efi_iso_populate() {
-       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" "grub-efi-${EFI_BOOT_IMAGE}" > ${EFIIMGDIR}/startup.nsh
-       if [ -f "$iso_dir/initrd" ] ; then
-               cp $iso_dir/initrd ${EFIIMGDIR}
-       fi
-}
-
-efi_hddimg_populate() {
-       efi_populate $1
-}
index 68105d9b84f916c8d86ad7aa7301b19aa2652e56..74e7074a5397b6c2b017c9833ded4ff369fc80c1 100644 (file)
@@ -29,6 +29,39 @@ def pcbios(d):
 PCBIOS = "${@pcbios(d)}"
 PCBIOS_CLASS = "${@['','syslinux'][d.getVar('PCBIOS') == '1']}"
 
+# efi_populate_common DEST BOOTLOADER
+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() {
+        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
+}
+
+efi_hddimg_populate() {
+       efi_populate $1
+}
+
 inherit ${EFI_CLASS}
 inherit ${PCBIOS_CLASS}
 
index bb3221dacca89063329dbe0c7df4e6f71f7ac257..336c4c2ff58cca2d77ce34aa3641a028d586b843 100644 (file)
@@ -16,38 +16,20 @@ require conf/image-uefi.conf
 inherit fs-uuid
 
 efi_populate() {
-        DEST=$1
+        efi_populate_common "$1" systemd
 
-        install -d ${DEST}${EFIDIR}
         # systemd-boot requires these paths for configuration files
         # they are not customizable so no point in new vars
         install -d ${DEST}/loader
         install -d ${DEST}/loader/entries
-        install -m 0644 ${DEPLOY_DIR_IMAGE}/systemd-${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
         install -m 0644 ${SYSTEMD_BOOT_CFG} ${DEST}/loader/loader.conf
         for i in ${SYSTEMD_BOOT_ENTRIES}; do
             install -m 0644 ${i} ${DEST}/loader/entries
         done
 }
 
-efi_iso_populate() {
-        iso_dir=$1
-        efi_populate $iso_dir
-        mkdir -p ${EFIIMGDIR}/${EFIDIR}
-        cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
+efi_iso_populate_append() {
         cp -r $iso_dir/loader ${EFIIMGDIR}
-        cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
-        EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
-        echo "fs0:${EFIPATH}\\${EFI_BOOT_IMAGE}" > ${EFIIMGDIR}/startup.nsh
-        if [ -f "$iso_dir/initrd" ] ; then
-            cp $iso_dir/initrd ${EFIIMGDIR}
-        fi
-}
-
-efi_hddimg_populate() {
-        efi_populate $1
 }
 
 inherit systemd-boot-cfg