All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications
@ 2019-09-17 15:36 dbaryshkov
  2019-09-17 15:36 ` [PATCH v3 2/9] grub-bootconf: switch to uefi.conf dbaryshkov
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: dbaryshkov @ 2019-09-17 15:36 UTC (permalink / raw)
  To: openembedded-core; +Cc: Dmitry Eremin-Solenikov

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

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

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

diff --git a/meta/conf/uefi.conf b/meta/conf/uefi.conf
new file mode 100644
index 000000000000..aaeff12ccb80
--- /dev/null
+++ b/meta/conf/uefi.conf
@@ -0,0 +1,16 @@
+# 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
+EFI_BOOT_IMAGE ?= "bootINVALID.efi"
+EFI_BOOT_IMAGE_x86-64 = "bootx64.efi"
+EFI_BOOT_IMAGE_x86 = "bootia32.efi"
+EFI_BOOT_IMAGE_aarch64 = "bootaa64.efi"
+EFI_BOOT_IMAGE_arm = "bootarm.efi"
-- 
2.23.0



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

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

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

Use variables from uefi.conf 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 | 10 +++++-----
 1 file changed, 5 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 9d5dab9aa808..7a09da26d683 100644
--- a/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
+++ b/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
@@ -9,6 +9,8 @@ RPROVIDES_${PN} += "virtual/grub-bootconf"
 
 inherit grub-efi-cfg
 
+require conf/uefi.conf
+
 S = "${WORKDIR}"
 
 GRUB_CFG = "${S}/grub-bootconf"
@@ -23,10 +25,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] 12+ messages in thread

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

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

Use variables from uefi.conf 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 c85879b6772f..4a73a7dfddd9 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
 
+require conf/uefi.conf
+
 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] 12+ messages in thread

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

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

Use variables from uefi.conf 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..4aa173e23bb1 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -1,4 +1,5 @@
 inherit grub-efi-cfg
+require conf/uefi.conf
 
 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] 12+ messages in thread

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

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

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

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

diff --git a/meta/recipes-core/systemd/systemd-boot_243.bb b/meta/recipes-core/systemd/systemd-boot_243.bb
index 56a25c35babc..8e5d00bbec91 100644
--- a/meta/recipes-core/systemd/systemd-boot_243.bb
+++ b/meta/recipes-core/systemd/systemd-boot_243.bb
@@ -1,6 +1,8 @@
 require systemd.inc
 FILESEXTRAPATHS =. "${FILE_DIRNAME}/systemd:"
 
+require conf/uefi.conf
+
 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] 12+ messages in thread

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

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

Use variables from uefi.conf 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..47f2adcd7744 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"
+require conf/uefi.conf
 # 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] 12+ messages in thread

* [PATCH v3 7/9] uefi.bbclass: provide efi population functions for live images
  2019-09-17 15:36 [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications dbaryshkov
                   ` (4 preceding siblings ...)
  2019-09-17 15:36 ` [PATCH v3 6/9] systemd-boot.bbclass: " dbaryshkov
@ 2019-09-17 15:36 ` dbaryshkov
  2019-09-17 15:36 ` [PATCH v3 8/9] grub-efi.bbclass: use efi_*_populate_common dbaryshkov
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: dbaryshkov @ 2019-09-17 15:36 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 | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 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..4baba81369c8
--- /dev/null
+++ b/meta/classes/uefi.bbclass
@@ -0,0 +1,29 @@
+require conf/uefi.conf
+
+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] 12+ messages in thread

* [PATCH v3 8/9] grub-efi.bbclass: use efi_*_populate_common
  2019-09-17 15:36 [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications dbaryshkov
                   ` (5 preceding siblings ...)
  2019-09-17 15:36 ` [PATCH v3 7/9] uefi.bbclass: provide efi population functions for live images dbaryshkov
@ 2019-09-17 15:36 ` dbaryshkov
  2019-09-17 15:36 ` [PATCH v3 9/9] systemd-boot.bbclass: " dbaryshkov
  2019-09-17 22:16 ` [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications Richard Purdie
  8 siblings, 0 replies; 12+ messages in thread
From: dbaryshkov @ 2019-09-17 15:36 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 | 24 +++---------------------
 1 file changed, 3 insertions(+), 21 deletions(-)

diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 4aa173e23bb1..188515ef9edc 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -1,32 +1,14 @@
 inherit grub-efi-cfg
-require conf/uefi.conf
+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] 12+ messages in thread

* [PATCH v3 9/9] systemd-boot.bbclass: use efi_*_populate_common
  2019-09-17 15:36 [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications dbaryshkov
                   ` (6 preceding siblings ...)
  2019-09-17 15:36 ` [PATCH v3 8/9] grub-efi.bbclass: use efi_*_populate_common dbaryshkov
@ 2019-09-17 15:36 ` dbaryshkov
  2019-09-17 22:16 ` [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications Richard Purdie
  8 siblings, 0 replies; 12+ messages in thread
From: dbaryshkov @ 2019-09-17 15:36 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 | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/meta/classes/systemd-boot.bbclass b/meta/classes/systemd-boot.bbclass
index 47f2adcd7744..6594a2331f7d 100644
--- a/meta/classes/systemd-boot.bbclass
+++ b/meta/classes/systemd-boot.bbclass
@@ -11,21 +11,17 @@
 
 do_bootimg[depends] += "${MLPREFIX}systemd-boot:do_deploy"
 
-require conf/uefi.conf
+inherit uefi
 # Need UUID utility code.
 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] 12+ messages in thread

* Re: [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications
  2019-09-17 15:36 [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications dbaryshkov
                   ` (7 preceding siblings ...)
  2019-09-17 15:36 ` [PATCH v3 9/9] systemd-boot.bbclass: " dbaryshkov
@ 2019-09-17 22:16 ` Richard Purdie
  2019-09-18  9:04   ` Dmitry Eremin-Solenikov
  8 siblings, 1 reply; 12+ messages in thread
From: Richard Purdie @ 2019-09-17 22:16 UTC (permalink / raw)
  To: dbaryshkov, openembedded-core; +Cc: Dmitry Eremin-Solenikov

On Tue, 2019-09-17 at 18:36 +0300, dbaryshkov@gmail.com wrote:
> From: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
> 
> Create new config file defining common variables for all UEFI-related
> packages (bootloaders, test applications, etc).
> 
> Signed-off-by: Dmitry Eremin-Solenikov <
> dmitry_eremin-solenikov@mentor.com>
> ---
>  meta/conf/uefi.conf | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>  create mode 100644 meta/conf/uefi.conf

This is heading in the right direction however if we're going to try
and clean things up I've concluded we need to do it properly and get it
right.

Now I understand more about how this configuration file is being used,
should it be called image-uefi.conf ?

I feel really strongly that we do not want an uefi.bbclass, its simply
not warranted and will just continue to expand the current mess of
classes. If all we need it for is some functions, those functions
should be added elsewhere.

I hadn't realised they were shell functions earlier, sorry about that.
One option could be to convert them to python since they could be
written in python easily. You could call a python function as a prefunc
or postfunc of another shell or python function.

Other options could be to make them shell commands (via the script
directory) or create an image-functions.bbclass which contains such
shared functions generically. As long as things are namespaced (which
they already are), that should be fine. I would ask that documentation
comments be added to them to say what the functions do.

I'm also on the lookout for tests of these kinds of codepaths. Code is
much more likely to be accepted if tests are added for it. I'm not
quite sure what would make most sense here in this case buts its a
general point I will be pushing for going forward.

Cheers,

Richard




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

* Re: [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications
  2019-09-17 22:16 ` [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications Richard Purdie
@ 2019-09-18  9:04   ` Dmitry Eremin-Solenikov
  2019-09-18 12:37     ` richard.purdie
  0 siblings, 1 reply; 12+ messages in thread
From: Dmitry Eremin-Solenikov @ 2019-09-18  9:04 UTC (permalink / raw)
  To: Richard Purdie
  Cc: Dmitry Eremin-Solenikov, Patches and discussions about the oe-core layer

Hello,

ср, 18 сент. 2019 г. в 01:16, Richard Purdie
<richard.purdie@linuxfoundation.org>:
>
> On Tue, 2019-09-17 at 18:36 +0300, dbaryshkov@gmail.com wrote:
> > From: Dmitry Eremin-Solenikov <dmitry_eremin-solenikov@mentor.com>
> >
> > Create new config file defining common variables for all UEFI-related
> > packages (bootloaders, test applications, etc).
> >
> > Signed-off-by: Dmitry Eremin-Solenikov <
> > dmitry_eremin-solenikov@mentor.com>
> > ---
> >  meta/conf/uefi.conf | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> >  create mode 100644 meta/conf/uefi.conf
>
> This is heading in the right direction however if we're going to try
> and clean things up I've concluded we need to do it properly and get it
> right.
>
> Now I understand more about how this configuration file is being used,
> should it be called image-uefi.conf ?

Fine, I will rename the conf file

> I feel really strongly that we do not want an uefi.bbclass, its simply
> not warranted and will just continue to expand the current mess of
> classes. If all we need it for is some functions, those functions
> should be added elsewhere.

As those EFI_PROVIDER bootloader classes are called only form
live-vm-common, maybe I should just add them to live-vm-common and
make individual classes _append those functions?

> I'm also on the lookout for tests of these kinds of codepaths. Code is
> much more likely to be accepted if tests are added for it. I'm not
> quite sure what would make most sense here in this case buts its a
> general point I will be pushing for going forward.

What kind of tests would you like? This code already exists and is
called as a part of any live image generation.

-- 
With best wishes
Dmitry


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

* Re: [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications
  2019-09-18  9:04   ` Dmitry Eremin-Solenikov
@ 2019-09-18 12:37     ` richard.purdie
  0 siblings, 0 replies; 12+ messages in thread
From: richard.purdie @ 2019-09-18 12:37 UTC (permalink / raw)
  To: Dmitry Eremin-Solenikov
  Cc: Dmitry Eremin-Solenikov, Patches and discussions about the oe-core layer

On Wed, 2019-09-18 at 12:04 +0300, Dmitry Eremin-Solenikov wrote:
> ср, 18 сент. 2019 г. в 01:16, Richard Purdie
> <richard.purdie@linuxfoundation.org>:
> > On Tue, 2019-09-17 at 18:36 +0300, dbaryshkov@gmail.com wrote:
> > > 
> > Now I understand more about how this configuration file is being
> > used,
> > should it be called image-uefi.conf ?
> 
> Fine, I will rename the conf file
> 
> > I feel really strongly that we do not want an uefi.bbclass, its
> > simply
> > not warranted and will just continue to expand the current mess of
> > classes. If all we need it for is some functions, those functions
> > should be added elsewhere.
> 
> As those EFI_PROVIDER bootloader classes are called only form
> live-vm-common, maybe I should just add them to live-vm-common and
> make individual classes _append those functions?

That sounds much better.

> > I'm also on the lookout for tests of these kinds of codepaths. Code
> > is
> > much more likely to be accepted if tests are added for it. I'm not
> > quite sure what would make most sense here in this case buts its a
> > general point I will be pushing for going forward.
> 
> What kind of tests would you like? This code already exists and is
> called as a part of any live image generation.

I think these patches are ok, you hinted this was part of a larger set
of changes and I'm worried about the fit/signed image/uboot codepaths
though which are in a similar area to some of this.

Its something to be mindful of as if changes are made to something
which isn't currently tested I will be asking for tests.

Cheers,

Richard




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

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

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-17 15:36 [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications dbaryshkov
2019-09-17 15:36 ` [PATCH v3 2/9] grub-bootconf: switch to uefi.conf dbaryshkov
2019-09-17 15:36 ` [PATCH v3 3/9] grub-efi: " dbaryshkov
2019-09-17 15:36 ` [PATCH v3 4/9] grub-efi.bbclass: " dbaryshkov
2019-09-17 15:36 ` [PATCH v3 5/9] systemd-boot: " dbaryshkov
2019-09-17 15:36 ` [PATCH v3 6/9] systemd-boot.bbclass: " dbaryshkov
2019-09-17 15:36 ` [PATCH v3 7/9] uefi.bbclass: provide efi population functions for live images dbaryshkov
2019-09-17 15:36 ` [PATCH v3 8/9] grub-efi.bbclass: use efi_*_populate_common dbaryshkov
2019-09-17 15:36 ` [PATCH v3 9/9] systemd-boot.bbclass: " dbaryshkov
2019-09-17 22:16 ` [PATCH v3 1/9] uefi.conf: add config file holding configuration for UEFI applications Richard Purdie
2019-09-18  9:04   ` Dmitry Eremin-Solenikov
2019-09-18 12:37     ` richard.purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.