Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications
@ 2019-09-11  9:29 dbaryshkov
  2019-09-11  9:29 ` [PATCH 2/9] grub-bootconf: switch to uefi.bbclass dbaryshkov
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: dbaryshkov @ 2019-09-11  9:29 UTC (permalink / raw)
  To: openembedded-core; +Cc: Dmitry Eremin-Solenikov

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

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

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

diff --git a/meta/classes/uefi.bbclass b/meta/classes/uefi.bbclass
new file mode 100644
index 000000000000..d3fc4b686676
--- /dev/null
+++ b/meta/classes/uefi.bbclass
@@ -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



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/9] grub-bootconf: switch to uefi.bbclass
  2019-09-11  9:29 [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications dbaryshkov
@ 2019-09-11  9:29 ` dbaryshkov
  2019-09-11  9:29 ` [PATCH 3/9] grub-efi: " dbaryshkov
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: dbaryshkov @ 2019-09-11  9:29 UTC (permalink / raw)
  To: openembedded-core; +Cc: Dmitry Eremin-Solenikov

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

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

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
---
 meta/recipes-bsp/grub/grub-bootconf_1.00.bb | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/meta/recipes-bsp/grub/grub-bootconf_1.00.bb b/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
index 750f8c808a8e..ff3e27e3779b 100644
--- a/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
+++ b/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
@@ -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"
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/9] grub-efi: switch to uefi.bbclass
  2019-09-11  9:29 [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications dbaryshkov
  2019-09-11  9:29 ` [PATCH 2/9] grub-bootconf: switch to uefi.bbclass dbaryshkov
@ 2019-09-11  9:29 ` dbaryshkov
  2019-09-11  9:29 ` [PATCH 4/9] grub-efi.bbclass: " dbaryshkov
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: dbaryshkov @ 2019-09-11  9:29 UTC (permalink / raw)
  To: openembedded-core; +Cc: Dmitry Eremin-Solenikov

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

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

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
---
 meta/recipes-bsp/grub/grub-efi_2.04.bb | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/meta/recipes-bsp/grub/grub-efi_2.04.bb b/meta/recipes-bsp/grub/grub-efi_2.04.bb
index aaa198ea23ec..bff3f6c25a20 100644
--- a/meta/recipes-bsp/grub/grub-efi_2.04.bb
+++ b/meta/recipes-bsp/grub/grub-efi_2.04.bb
@@ -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"
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/9] grub-efi.bbclass: switch to uefi.bbclass
  2019-09-11  9:29 [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications dbaryshkov
  2019-09-11  9:29 ` [PATCH 2/9] grub-bootconf: switch to uefi.bbclass dbaryshkov
  2019-09-11  9:29 ` [PATCH 3/9] grub-efi: " dbaryshkov
@ 2019-09-11  9:29 ` dbaryshkov
  2019-09-11  9:29 ` [PATCH 5/9] systemd-boot: " dbaryshkov
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: dbaryshkov @ 2019-09-11  9:29 UTC (permalink / raw)
  To: openembedded-core; +Cc: Dmitry Eremin-Solenikov

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

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

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
---
 meta/classes/grub-efi-cfg.bbclass |  1 -
 meta/classes/grub-efi.bbclass     | 20 ++++----------------
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/meta/classes/grub-efi-cfg.bbclass b/meta/classes/grub-efi-cfg.bbclass
index f661a69f833a..8b5ff20c72c0 100644
--- a/meta/classes/grub-efi-cfg.bbclass
+++ b/meta/classes/grub-efi-cfg.bbclass
@@ -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 ?= ""
 
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index ec692f1646f3..a0a95d0e1e45 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -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
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/9] systemd-boot: switch to uefi.bbclass
  2019-09-11  9:29 [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications dbaryshkov
                   ` (2 preceding siblings ...)
  2019-09-11  9:29 ` [PATCH 4/9] grub-efi.bbclass: " dbaryshkov
@ 2019-09-11  9:29 ` dbaryshkov
  2019-09-11  9:29 ` [PATCH 6/9] systemd-boot.bbclass: " dbaryshkov
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: dbaryshkov @ 2019-09-11  9:29 UTC (permalink / raw)
  To: openembedded-core; +Cc: Dmitry Eremin-Solenikov

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

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

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
---
 meta/recipes-core/systemd/systemd-boot_242.bb | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/meta/recipes-core/systemd/systemd-boot_242.bb b/meta/recipes-core/systemd/systemd-boot_242.bb
index 56a25c35babc..3cb05db345ff 100644
--- a/meta/recipes-core/systemd/systemd-boot_242.bb
+++ b/meta/recipes-core/systemd/systemd-boot_242.bb
@@ -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 () {
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/9] systemd-boot.bbclass: switch to uefi.bbclass
  2019-09-11  9:29 [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications dbaryshkov
                   ` (3 preceding siblings ...)
  2019-09-11  9:29 ` [PATCH 5/9] systemd-boot: " dbaryshkov
@ 2019-09-11  9:29 ` dbaryshkov
  2019-09-11  9:29 ` [PATCH 7/9] uefi.bbclass: provide efi population functions for live images dbaryshkov
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: dbaryshkov @ 2019-09-11  9:29 UTC (permalink / raw)
  To: openembedded-core; +Cc: Dmitry Eremin-Solenikov

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

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

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
---
 meta/classes/systemd-boot.bbclass | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/meta/classes/systemd-boot.bbclass b/meta/classes/systemd-boot.bbclass
index 3cd6811a6ce1..ad565414a142 100644
--- a/meta/classes/systemd-boot.bbclass
+++ b/meta/classes/systemd-boot.bbclass
@@ -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
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 7/9] uefi.bbclass: provide efi population functions for live images
  2019-09-11  9:29 [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications dbaryshkov
                   ` (4 preceding siblings ...)
  2019-09-11  9:29 ` [PATCH 6/9] systemd-boot.bbclass: " dbaryshkov
@ 2019-09-11  9:29 ` dbaryshkov
  2019-09-11  9:30 ` [PATCH 8/9] grub-efi.bbclass: use efi_*_populate_common dbaryshkov
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: dbaryshkov @ 2019-09-11  9:29 UTC (permalink / raw)
  To: openembedded-core; +Cc: Dmitry Eremin-Solenikov

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

Define common functions for populating EFI directories in live image.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@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 d3fc4b686676..062f0c3859b2 100644
--- a/meta/classes/uefi.bbclass
+++ b/meta/classes/uefi.bbclass
@@ -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
+}
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 8/9] grub-efi.bbclass: use efi_*_populate_common
  2019-09-11  9:29 [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications dbaryshkov
                   ` (5 preceding siblings ...)
  2019-09-11  9:29 ` [PATCH 7/9] uefi.bbclass: provide efi population functions for live images dbaryshkov
@ 2019-09-11  9:30 ` dbaryshkov
  2019-09-11  9:30 ` [PATCH 9/9] systemd-boot.bbclass: " dbaryshkov
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 13+ messages in thread
From: dbaryshkov @ 2019-09-11  9:30 UTC (permalink / raw)
  To: openembedded-core; +Cc: Dmitry Eremin-Solenikov

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

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

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
---
 meta/classes/grub-efi.bbclass | 22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index a0a95d0e1e45..188515ef9edc 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -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() {
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 9/9] systemd-boot.bbclass: use efi_*_populate_common
  2019-09-11  9:29 [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications dbaryshkov
                   ` (6 preceding siblings ...)
  2019-09-11  9:30 ` [PATCH 8/9] grub-efi.bbclass: use efi_*_populate_common dbaryshkov
@ 2019-09-11  9:30 ` dbaryshkov
  2019-09-12 23:12 ` [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications Mittal, Anuj
  2019-09-13  2:14 ` Ang, Chin Huat
  9 siblings, 0 replies; 13+ messages in thread
From: dbaryshkov @ 2019-09-11  9:30 UTC (permalink / raw)
  To: openembedded-core; +Cc: Dmitry Eremin-Solenikov

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

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

Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
---
 meta/classes/systemd-boot.bbclass | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)

diff --git a/meta/classes/systemd-boot.bbclass b/meta/classes/systemd-boot.bbclass
index ad565414a142..6594a2331f7d 100644
--- a/meta/classes/systemd-boot.bbclass
+++ b/meta/classes/systemd-boot.bbclass
@@ -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() {
-- 
2.23.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications
  2019-09-11  9:29 [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications dbaryshkov
                   ` (7 preceding siblings ...)
  2019-09-11  9:30 ` [PATCH 9/9] systemd-boot.bbclass: " dbaryshkov
@ 2019-09-12 23:12 ` Mittal, Anuj
  2019-09-13 11:59   ` Dmitry Eremin-Solenikov
  2019-09-13  2:14 ` Ang, Chin Huat
  9 siblings, 1 reply; 13+ messages in thread
From: Mittal, Anuj @ 2019-09-12 23:12 UTC (permalink / raw)
  To: openembedded-core@lists.openembedded.org, dbaryshkov@gmail.com
  Cc: dmitry_eremin-solenikov@mentor.com

Hello,

On Wed, 2019-09-11 at 12:29 +0300, dbaryshkov@gmail.com wrote:
> From: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
> 
> 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

> 
> Signed-off-by: Dmitry Eremin-Solenikov <
> dmitry_eremin-solenikov@mentor.com>
> ---
>  meta/classes/uefi.bbclass | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>  create mode 100644 meta/classes/uefi.bbclass
> 
> diff --git a/meta/classes/uefi.bbclass b/meta/classes/uefi.bbclass
> new file mode 100644
> index 000000000000..d3fc4b686676
> --- /dev/null
> +++ b/meta/classes/uefi.bbclass
> @@ -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
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications
  2019-09-11  9:29 [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications dbaryshkov
                   ` (8 preceding siblings ...)
  2019-09-12 23:12 ` [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications Mittal, Anuj
@ 2019-09-13  2:14 ` Ang, Chin Huat
  2019-09-13 12:06   ` Dmitry Eremin-Solenikov
  9 siblings, 1 reply; 13+ messages in thread
From: Ang, Chin Huat @ 2019-09-13  2:14 UTC (permalink / raw)
  To: dbaryshkov@gmail.com, openembedded-core@lists.openembedded.org
  Cc: Dmitry Eremin-Solenikov

> +        image = "bootUNKNOWN.efi"

It might be better to raise an error here.

-----Original Message-----
From: openembedded-core-bounces@lists.openembedded.org <openembedded-core-bounces@lists.openembedded.org> On Behalf Of dbaryshkov@gmail.com
Sent: Wednesday, September 11, 2019 5:30 PM
To: openembedded-core@lists.openembedded.org
Cc: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
Subject: [OE-core] [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications

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

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

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

diff --git a/meta/classes/uefi.bbclass b/meta/classes/uefi.bbclass new file mode 100644 index 000000000000..d3fc4b686676
--- /dev/null
+++ b/meta/classes/uefi.bbclass
@@ -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
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications
  2019-09-12 23:12 ` [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications Mittal, Anuj
@ 2019-09-13 11:59   ` Dmitry Eremin-Solenikov
  0 siblings, 0 replies; 13+ messages in thread
From: Dmitry Eremin-Solenikov @ 2019-09-13 11:59 UTC (permalink / raw)
  To: Mittal, Anuj
  Cc: dmitry_eremin-solenikov@mentor.com,
	openembedded-core@lists.openembedded.org

пт, 13 сент. 2019 г. в 02:12, Mittal, Anuj <anuj.mittal@intel.com>:
>
> Hello,
>
> On Wed, 2019-09-11 at 12:29 +0300, dbaryshkov@gmail.com wrote:
> > From: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
> >
> > 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.

-- 
With best wishes
Dmitry


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications
  2019-09-13  2:14 ` Ang, Chin Huat
@ 2019-09-13 12:06   ` Dmitry Eremin-Solenikov
  0 siblings, 0 replies; 13+ messages in thread
From: Dmitry Eremin-Solenikov @ 2019-09-13 12:06 UTC (permalink / raw)
  To: Ang, Chin Huat
  Cc: Dmitry Eremin-Solenikov, openembedded-core@lists.openembedded.org

пт, 13 сент. 2019 г. в 05:14, Ang, Chin Huat <chin.huat.ang@intel.com>:
>
> > +        image = "bootUNKNOWN.efi"
>
> It might be better to raise an error here.

Fine, I can change in v2.

>
> -----Original Message-----
> From: openembedded-core-bounces@lists.openembedded.org <openembedded-core-bounces@lists.openembedded.org> On Behalf Of dbaryshkov@gmail.com
> Sent: Wednesday, September 11, 2019 5:30 PM
> To: openembedded-core@lists.openembedded.org
> Cc: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
> Subject: [OE-core] [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications
>
> From: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
>
> Create new bbclass defining common variables for all UEFI-related packages (bootloaders, test applications, etc).
>
> Signed-off-by: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
> ---
>  meta/classes/uefi.bbclass | 26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
>  create mode 100644 meta/classes/uefi.bbclass
>
> diff --git a/meta/classes/uefi.bbclass b/meta/classes/uefi.bbclass new file mode 100644 index 000000000000..d3fc4b686676
> --- /dev/null
> +++ b/meta/classes/uefi.bbclass
> @@ -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
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core



-- 
With best wishes
Dmitry


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2019-09-13 12:07 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-09-11  9:29 [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications dbaryshkov
2019-09-11  9:29 ` [PATCH 2/9] grub-bootconf: switch to uefi.bbclass dbaryshkov
2019-09-11  9:29 ` [PATCH 3/9] grub-efi: " dbaryshkov
2019-09-11  9:29 ` [PATCH 4/9] grub-efi.bbclass: " dbaryshkov
2019-09-11  9:29 ` [PATCH 5/9] systemd-boot: " dbaryshkov
2019-09-11  9:29 ` [PATCH 6/9] systemd-boot.bbclass: " dbaryshkov
2019-09-11  9:29 ` [PATCH 7/9] uefi.bbclass: provide efi population functions for live images dbaryshkov
2019-09-11  9:30 ` [PATCH 8/9] grub-efi.bbclass: use efi_*_populate_common dbaryshkov
2019-09-11  9:30 ` [PATCH 9/9] systemd-boot.bbclass: " dbaryshkov
2019-09-12 23:12 ` [PATCH 1/9] uefi.bbclass: add bbclass holding configuration for UEFI applications Mittal, Anuj
2019-09-13 11:59   ` Dmitry Eremin-Solenikov
2019-09-13  2:14 ` Ang, Chin Huat
2019-09-13 12:06   ` Dmitry Eremin-Solenikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox