Skip to contentSkip to conversation

uefi.bbclass: add bbclass holding configuration for UEFI applications

PATCH Superseded [email protected] 3 participants 13 messages Sep 11, 2019 – Sep 13, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/9 uefi.bbclass: add bbclass holding configuration for UEFI applications

From: Dmitry Eremin-Solenikov <[email protected]>

Create new bbclass defining common variables for all UEFI-related packages (bootloaders, test applications, etc).

---
 meta/classes/uefi.bbclass | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 meta/classes/uefi.bbclass
meta/classes/uefi.bbclass new file +26 -0
new file mode 100644
index 000000000000..d3fc4b686676
@@ -0,0 +1,26 @@
+# Location of EFI files inside EFI System Partition
+EFIDIR ?= "/EFI/BOOT"
+
+# Prefix where ESP is mounted inside rootfs. Set to empty if package is going
+# to be installed to ESP directly
+EFI_PREFIX ?= "/boot"
+
+# Location inside rootfs.
+EFI_FILES_PATH = "${EFI_PREFIX}${EFIDIR}"
+
+# Determine name of bootloader image
+python __anonymous () {
+    import re
+    target = d.getVar('TARGET_ARCH')
+    if target == "x86_64":
+        image = "bootx64.efi"
+    elif re.match('i.86', target):
+        image = "bootia32.efi"
+    elif re.match('aarch64', target):
+        image = "bootaa64.efi"
+    elif re.match('arm', target):
+        image = "bootarm.efi"
+    else:
+        image = "bootUNKNOWN.efi"
+    d.setVar("EFI_BOOT_IMAGE", image)
+}
Signature · 1 line
2.23.0
#1 lore raw

PATCH 2/9 grub-bootconf: switch to uefi.bbclass

From: Dmitry Eremin-Solenikov <[email protected]>

Use variables from uefi.bbclass instead of hardcoding them in the recipe.

---
 meta/recipes-bsp/grub/grub-bootconf_1.00.bb | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
meta/recipes-bsp/grub/grub-bootconf_1.00.bb +4 -5
index 750f8c808a8e..ff3e27e3779b 100644
@@ -5,6 +5,7 @@ SUMMARY = "Basic grub.cfg for use in EFI systems"
 RPROVIDES_${PN} += "virtual/grub-bootconf"
 
 inherit grub-efi-cfg
+inherit uefi
 
 S = "${WORKDIR}"
 
@@ -20,10 +21,8 @@ python do_configure() {
 do_configure[vardeps] += "APPEND ROOT"
 
 do_install() {
-	install -d ${D}/boot
-	install -d ${D}/boot/EFI
-	install -d ${D}/boot/EFI/BOOT
-	install grub-bootconf ${D}/boot/EFI/BOOT/grub.cfg
+	install -d ${D}${EFI_FILES_PATH}
+	install grub-bootconf ${D}${EFI_FILES_PATH}/grub.cfg
 }
 
-FILES_${PN} = "/boot/EFI/BOOT/grub.cfg"
+FILES_${PN} = "${EFI_FILES_PATH}/grub.cfg"
Signature · 1 line
2.23.0
#2 lore raw

PATCH 3/9 grub-efi: switch to uefi.bbclass

In reply to [email protected]

From: Dmitry Eremin-Solenikov <[email protected]>

Use variables from uefi.bbclass instead of hardcoding them in the recipe.

---
 meta/recipes-bsp/grub/grub-efi_2.04.bb | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
meta/recipes-bsp/grub/grub-efi_2.04.bb +7 -10
index aaa198ea23ec..bff3f6c25a20 100644
@@ -1,5 +1,7 @@
 require grub2.inc
 
+inherit uefi
+
 GRUBPLATFORM = "efi"
 
 DEPENDS_append_class-target = " grub-efi-native"
@@ -18,18 +20,15 @@ python __anonymous () {
     prefix = "" if d.getVar('EFI_PROVIDER') == "grub-efi" else "grub-efi-"
     if target == "x86_64":
         grubtarget = 'x86_64'
-        grubimage = prefix + "bootx64.efi"
     elif re.match('i.86', target):
         grubtarget = 'i386'
-        grubimage = prefix + "bootia32.efi"
     elif re.match('aarch64', target):
         grubtarget = 'arm64'
-        grubimage = prefix + "bootaa64.efi"
     elif re.match('arm', target):
         grubtarget = 'arm'
-        grubimage = prefix + "bootarm.efi"
     else:
         raise bb.parse.SkipRecipe("grub-efi is incompatible with target %s" % target)
+    grubimage = prefix + d.getVar("EFI_BOOT_IMAGE")
     d.setVar("GRUB_TARGET", grubtarget)
     d.setVar("GRUB_IMAGE", grubimage)
     prefix = "grub-efi-" if prefix == "" else ""
@@ -45,7 +44,7 @@ do_mkimage() {
 	cd ${B}
 	# Search for the grub.cfg on the local boot media by using the
 	# built in cfg file provided via this recipe
-	grub-mkimage -c ../cfg -p /EFI/BOOT -d ./grub-core/ \
+	grub-mkimage -c ../cfg -p ${EFIDIR} -d ./grub-core/ \
 	               -O ${GRUB_TARGET}-efi -o ./${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} \
 	               ${GRUB_BUILDIN}
 }
@@ -57,10 +56,8 @@ do_mkimage_class-native() {
 }
 
 do_install_append_class-target() {
-	install -d ${D}/boot
-	install -d ${D}/boot/EFI
-	install -d ${D}/boot/EFI/BOOT
-	install -m 644 ${B}/${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} ${D}/boot/EFI/BOOT/${GRUB_IMAGE}
+	install -d ${D}${EFI_FILES_PATH}
+	install -m 644 ${B}/${GRUB_IMAGE_PREFIX}${GRUB_IMAGE} ${D}${EFI_FILES_PATH}/${GRUB_IMAGE}
 }
 
 do_install_class-native() {
@@ -100,7 +97,7 @@ addtask deploy after do_install before do_build
 
 FILES_${PN} = "${libdir}/grub/${GRUB_TARGET}-efi \
                ${datadir}/grub \
-               /boot/EFI/BOOT/${GRUB_IMAGE} \
+               ${EFI_FILES_PATH}/${GRUB_IMAGE} \
                "
 
 FILES_${PN}_remove_aarch64 = "${libdir}/grub/${GRUB_TARGET}-efi"
Signature · 1 line
2.23.0
#3 lore raw

PATCH 4/9 grub-efi.bbclass: switch to uefi.bbclass

In reply to [email protected]

From: Dmitry Eremin-Solenikov <[email protected]>

Use variables from uefi.bbclass instead of hardcoding them in the class.

---
 meta/classes/grub-efi-cfg.bbclass |  1 -
 meta/classes/grub-efi.bbclass     | 20 ++++----------------
 2 files changed, 4 insertions(+), 17 deletions(-)
meta/classes/grub-efi-cfg.bbclass +0 -1
index f661a69f833a..8b5ff20c72c0 100644
@@ -23,7 +23,6 @@ GRUB_TIMEOUT ?= "10"
 #FIXME: build this from the machine config
 GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
 
-EFIDIR = "/EFI/BOOT"
 GRUB_ROOT ?= "${ROOT}"
 APPEND ?= ""
 
meta/classes/grub-efi.bbclass +4 -16
index ec692f1646f3..a0a95d0e1e45 100644
@@ -1,4 +1,5 @@
 inherit grub-efi-cfg
+inherit uefi
 
 efi_populate() {
 	# DEST must be the root of the image so that EFIDIR is not
@@ -7,22 +8,9 @@ efi_populate() {
 
 	install -d ${DEST}${EFIDIR}
 
-	GRUB_IMAGE="grub-efi-bootia32.efi"
-	DEST_IMAGE="bootia32.efi"
-	if [ -n "${MLPREFIX}" ]; then
-		if [ "${TARGET_ARCH_MULTILIB_ORIGINAL}" = "x86_64" ]; then
-			GRUB_IMAGE="grub-efi-bootx64.efi"
-			DEST_IMAGE="bootx64.efi"
-		fi
-	else
-		if [ "${TARGET_ARCH}" = "x86_64" ]; then
-			GRUB_IMAGE="grub-efi-bootx64.efi"
-			DEST_IMAGE="bootx64.efi"
-		fi
-	fi
-	install -m 0644 ${DEPLOY_DIR_IMAGE}/${GRUB_IMAGE} ${DEST}${EFIDIR}/${DEST_IMAGE}
+	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" "$DEST_IMAGE" >${DEST}/startup.nsh
+	printf 'fs0:%s\%s\n' "$EFIPATH" "${EFI_BOOT_IMAGE}" >${DEST}/startup.nsh
 
 	install -m 0644 ${GRUB_CFG} ${DEST}${EFIDIR}/grub.cfg
 }
@@ -35,7 +23,7 @@ efi_iso_populate() {
 	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_IMAGE" > ${EFIIMGDIR}/startup.nsh
+	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
Signature · 1 line
2.23.0
#4 lore raw

PATCH 5/9 systemd-boot: switch to uefi.bbclass

In reply to [email protected]

From: Dmitry Eremin-Solenikov <[email protected]>

Use variables from uefi.bbclass instead of hardcoding them in the recipe.

---
 meta/recipes-core/systemd/systemd-boot_242.bb | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
meta/recipes-core/systemd/systemd-boot_242.bb +6 -9
index 56a25c35babc..3cb05db345ff 100644
@@ -1,6 +1,8 @@
 require systemd.inc
 FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
 
+inherit uefi
+
 DEPENDS = "intltool-native libcap util-linux gnu-efi gperf-native"
 
 # NOTE: These three patches are in theory not needed, but we haven't
@@ -33,16 +35,13 @@ python __anonymous () {
     import re
     target = d.getVar('TARGET_ARCH')
     prefix = "" if d.getVar('EFI_PROVIDER') == "systemd-boot" else "systemd-"
-    if target == "x86_64":
-        systemdimage = prefix + "bootx64.efi"
-    else:
-        systemdimage = prefix + "bootia32.efi"
+    systemdimage = prefix + d.getVar("EFI_BOOT_IMAGE")
     d.setVar("SYSTEMD_BOOT_IMAGE", systemdimage)
     prefix = "systemd-" if prefix == "" else ""
     d.setVar("SYSTEMD_BOOT_IMAGE_PREFIX", prefix)
 }
 
-FILES_${PN} = "/boot/EFI/BOOT/${SYSTEMD_BOOT_IMAGE}"
+FILES_${PN} = "${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}"
 
 RDEPENDS_${PN} += "virtual/systemd-bootconf"
 
@@ -61,10 +60,8 @@ do_compile() {
 }
 
 do_install() {
-	install -d ${D}/boot
-	install -d ${D}/boot/EFI
-	install -d ${D}/boot/EFI/BOOT
-	install ${B}/src/boot/efi/systemd-boot*.efi ${D}/boot/EFI/BOOT/${SYSTEMD_BOOT_IMAGE}
+	install -d ${D}${EFI_FILES_PATH}
+	install ${B}/src/boot/efi/systemd-boot*.efi ${D}${EFI_FILES_PATH}/${SYSTEMD_BOOT_IMAGE}
 }
 
 do_deploy () {
Signature · 1 line
2.23.0
#5 lore raw

PATCH 6/9 systemd-boot.bbclass: switch to uefi.bbclass

In reply to [email protected]

From: Dmitry Eremin-Solenikov <[email protected]>

Use variables from uefi.bbclass instead of hardcoding them in the class.

---
 meta/classes/systemd-boot.bbclass | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)
meta/classes/systemd-boot.bbclass +4 -11
index 3cd6811a6ce1..ad565414a142 100644
@@ -11,28 +11,21 @@
 
 do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy"
 
-EFIDIR = "/EFI/BOOT"
+inherit uefi
 # Need UUID utility code.
 inherit fs-uuid
 
 efi_populate() {
         DEST=$1
 
-        EFI_IMAGE="systemd-bootia32.efi"
-        DEST_EFI_IMAGE="bootia32.efi"
-        if [ "${TARGET_ARCH}" = "x86_64" ]; then
-            EFI_IMAGE="systemd-bootx64.efi"
-            DEST_EFI_IMAGE="bootx64.efi"
-        fi
-
         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}/${EFI_IMAGE} ${DEST}${EFIDIR}/${DEST_EFI_IMAGE}
+        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" "$DEST_EFI_IMAGE" >${DEST}/startup.nsh
+        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
@@ -47,7 +40,7 @@ efi_iso_populate() {
         cp -r $iso_dir/loader ${EFIIMGDIR}
         cp $iso_dir/${KERNEL_IMAGETYPE} ${EFIIMGDIR}
         EFIPATH=$(echo "${EFIDIR}" | sed 's/\//\\/g')
-        echo "fs0:${EFIPATH}\\${DEST_EFI_IMAGE}" > ${EFIIMGDIR}/startup.nsh
+        echo "fs0:${EFIPATH}\\${EFI_BOOT_IMAGE}" > ${EFIIMGDIR}/startup.nsh
         if [ -f "$iso_dir/initrd" ] ; then
             cp $iso_dir/initrd ${EFIIMGDIR}
         fi
Signature · 1 line
2.23.0
#6 lore raw

PATCH 7/9 uefi.bbclass: provide efi population functions for live images

In reply to [email protected]

From: Dmitry Eremin-Solenikov <[email protected]>

Define common functions for populating EFI directories in live image.

---
 meta/classes/uefi.bbclass | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
meta/classes/uefi.bbclass +28 -0
index d3fc4b686676..062f0c3859b2 100644
@@ -24,3 +24,31 @@ python __anonymous () {
         image = "bootUNKNOWN.efi"
     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
+}
Signature · 1 line
2.23.0
#7 lore raw

PATCH 8/9 grub-efi.bbclass: use efi_*_populate_common

In reply to [email protected]

From: Dmitry Eremin-Solenikov <[email protected]>

Use common code form uefi.bbclass to populate efi directories.

---
 meta/classes/grub-efi.bbclass | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)
meta/classes/grub-efi.bbclass +2 -20
index a0a95d0e1e45..188515ef9edc 100644
@@ -2,31 +2,13 @@ inherit grub-efi-cfg
 inherit uefi
 
 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_iso_populate_common "$1"
 }
 
 efi_hddimg_populate() {
Signature · 1 line
2.23.0
#8 lore raw

PATCH 9/9 systemd-boot.bbclass: use efi_*_populate_common

In reply to [email protected]

From: Dmitry Eremin-Solenikov <[email protected]>

Use common code form uefi.bbclass to populate efi directories.

---
 meta/classes/systemd-boot.bbclass | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
meta/classes/systemd-boot.bbclass +3 -15
index ad565414a142..6594a2331f7d 100644
@@ -16,16 +16,12 @@ inherit uefi
 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
@@ -33,17 +29,9 @@ efi_populate() {
 }
 
 efi_iso_populate() {
-        iso_dir=$1
-        efi_populate $iso_dir
-        mkdir -p ${EFIIMGDIR}/${EFIDIR}
-        cp $iso_dir/${EFIDIR}/* ${EFIIMGDIR}${EFIDIR}
+        efi_iso_populate_common "$1"
+
         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() {
Signature · 1 line
2.23.0
#9 lore raw
In reply to [email protected]

Hello,

Quoted 4 lines · On Wed, 2019-09-11 at 12:29 +0300, [email protected] wrote:

From: Dmitry Eremin-Solenikov <[email protected]>

Create new bbclass defining common variables for all UEFI-related packages (bootloaders, test applications, etc).

Have these changes been tested using wic as well with non default values? There are places in there in EFI plugins where EFI/BOOT is hardcoded. They might have to be changed as well ...

Thanks,

Anuj

Quoted 44 lines

Signed-off-by: Dmitry Eremin-Solenikov <
[email protected]>

---
 meta/classes/uefi.bbclass | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 meta/classes/uefi.bbclass
meta/classes/uefi.bbclass new file +4 -0
new file mode 100644
index 000000000000..d3fc4b686676
@@ -0,0 +1,26 @@
+# Location of EFI files inside EFI System Partition
+EFIDIR ?= "/EFI/BOOT"
+
+# Prefix where ESP is mounted inside rootfs. Set to empty if package

is going

meta/classes/uefi.bbclass new file +22 -0
+# to be installed to ESP directly
+EFI_PREFIX ?= "/boot"
+
+# Location inside rootfs.
+EFI_FILES_PATH = "${EFI_PREFIX}${EFIDIR}"
+
+# Determine name of bootloader image
+python __anonymous () {
+    import re
+    target = d.getVar('TARGET_ARCH')
+    if target == "x86_64":
+        image = "bootx64.efi"
+    elif re.match('i.86', target):
+        image = "bootia32.efi"
+    elif re.match('aarch64', target):
+        image = "bootaa64.efi"
+    elif re.match('arm', target):
+        image = "bootarm.efi"
+    else:
+        image = "bootUNKNOWN.efi"
+    d.setVar("EFI_BOOT_IMAGE", image)
+}
Signature · 1 line
2.23.0
#11 lore raw
In reply to [email protected]
Quoted 1 line

+ image = "bootUNKNOWN.efi"

It might be better to raise an error here.

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of [email protected]
Sent: Wednesday, September 11, 2019 5:30 PM
To: [email protected]
Cc: Dmitry Eremin-Solenikov <[email protected]>
Subject: [OE-core] [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications

From: Dmitry Eremin-Solenikov <[email protected]>

Create new bbclass defining common variables for all UEFI-related packages (bootloaders, test applications, etc).

---
 meta/classes/uefi.bbclass | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 meta/classes/uefi.bbclass
meta/classes/uefi.bbclass new file +25 -0
@@ -0,0 +1,26 @@
+# Location of EFI files inside EFI System Partition EFIDIR ?= 
+"/EFI/BOOT"
+
+# Prefix where ESP is mounted inside rootfs. Set to empty if package is 
+going # to be installed to ESP directly EFI_PREFIX ?= "/boot"
+
+# Location inside rootfs.
+EFI_FILES_PATH = "${EFI_PREFIX}${EFIDIR}"
+
+# Determine name of bootloader image
+python __anonymous () {
+    import re
+    target = d.getVar('TARGET_ARCH')
+    if target == "x86_64":
+        image = "bootx64.efi"
+    elif re.match('i.86', target):
+        image = "bootia32.efi"
+    elif re.match('aarch64', target):
+        image = "bootaa64.efi"
+    elif re.match('arm', target):
+        image = "bootarm.efi"
+    else:
+        image = "bootUNKNOWN.efi"
+    d.setVar("EFI_BOOT_IMAGE", image)
+}

--
2.23.0

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

#10 lore raw
In reply to Mittal, Anuj

пт, 13 сент. 2019 г. в 02:12, Mittal, Anuj <[email protected]>:

Quoted 4 lines

Hello,

On Wed, 2019-09-11 at 12:29 +0300, [email protected] wrote:

Quoted 8 lines
Quoted 4 lines

From: Dmitry Eremin-Solenikov <[email protected]>

Create new bbclass defining common variables for all UEFI-related packages (bootloaders, test applications, etc).

Have these changes been tested using wic as well with non default values? There are places in there in EFI plugins where EFI/BOOT is hardcoded. They might have to be changed as well ...

This would be the next step. For now I wanted to consolidate code in recipes, so that it won't be duplicated all over the repo.

Signature · 2 lines
With best wishes
Dmitry
#12 lore raw
In reply to Ang, Chin Huat

пт, 13 сент. 2019 г. в 05:14, Ang, Chin Huat <[email protected]>:

Quoted 4 lines
Quoted 2 lines

+ image = "bootUNKNOWN.efi"

It might be better to raise an error here.

Fine, I can change in v2.

Quoted 55 lines

-----Original Message-----
From: [email protected] <[email protected]> On Behalf Of [email protected]
Sent: Wednesday, September 11, 2019 5:30 PM
To: [email protected]
Cc: Dmitry Eremin-Solenikov <[email protected]>
Subject: [OE-core] [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications

From: Dmitry Eremin-Solenikov <[email protected]>

Create new bbclass defining common variables for all UEFI-related packages (bootloaders, test applications, etc).

---
 meta/classes/uefi.bbclass | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 meta/classes/uefi.bbclass
meta/classes/uefi.bbclass new file +25 -1
@@ -0,0 +1,26 @@
+# Location of EFI files inside EFI System Partition EFIDIR ?=
+"/EFI/BOOT"
+
+# Prefix where ESP is mounted inside rootfs. Set to empty if package is
+going # to be installed to ESP directly EFI_PREFIX ?= "/boot"
+
+# Location inside rootfs.
+EFI_FILES_PATH = "${EFI_PREFIX}${EFIDIR}"
+
+# Determine name of bootloader image
+python __anonymous () {
+    import re
+    target = d.getVar('TARGET_ARCH')
+    if target == "x86_64":
+        image = "bootx64.efi"
+    elif re.match('i.86', target):
+        image = "bootia32.efi"
+    elif re.match('aarch64', target):
+        image = "bootaa64.efi"
+    elif re.match('arm', target):
+        image = "bootarm.efi"
+    else:
+        image = "bootUNKNOWN.efi"
+    d.setVar("EFI_BOOT_IMAGE", image)
+}
--

2.23.0

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Signature · 2 lines
With best wishes
Dmitry