Skip to contentSkip to conversation

grub-efi-native: use RDEPENDS on grub-native instead of duplicating tools

PATCH In review Christopher Clark 3 participants 6 messages Jun 17, 2020 – Jun 19, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 grub-efi-native: use RDEPENDS on grub-native instead of duplicating tools

Both grub-native and grub-efi-native included packaging for the grub-mkimage and grub-editenv tools, which prevented concurrent installation of both the grub-native and grub-efi-native packages. This caused errors on image generation with wic when populating partitions with both legacy and efi boot support, so resolve this by removing the duplicated tools from grub-efi-native and add a runtime dependency from it to grub-native.

---
 meta/recipes-bsp/grub/grub-efi_2.04.bb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meta/recipes-bsp/grub/grub-efi_2.04.bb +2 -3
index b9d6225d27..ed43dee152 100644
@@ -6,6 +6,7 @@ GRUBPLATFORM = "efi"
 
 DEPENDS_append_class-target = " grub-efi-native"
 RDEPENDS_${PN}_class-target = "grub-common virtual/grub-bootconf"
+RDEPENDS_${PN}_class-native = "grub-native"
 
 SRC_URI += " \
            file://cfg \
@@ -61,9 +62,7 @@ do_install_append_class-target() {
 }
 
 do_install_class-native() {
-	install -d ${D}${bindir}
-	install -m 755 grub-mkimage ${D}${bindir}
-	install -m 755 grub-editenv ${D}${bindir}
+	:
 }
 
 do_install_class-target() {
Signature · 1 line
2.17.1
#1 lore raw
Quoted 27 lines · Christopher Clark

Both grub-native and grub-efi-native included packaging for the grub-mkimage and grub-editenv tools, which prevented concurrent installation of both the grub-native and grub-efi-native packages. This caused errors on image generation with wic when populating partitions with both legacy and efi boot support, so resolve this by removing the duplicated tools from grub-efi-native and add a runtime dependency from it to grub-native.

---
 meta/recipes-bsp/grub/grub-efi_2.04.bb | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
meta/recipes- renamed from meta/recipes-bsp/grub/grub-efi_2.04.bb +0 -0

bsp/grub/grub-efi_2.04.bb
index b9d6225d27..ed43dee152 100644

meta/recipes-bsp/grub/grub-efi_2.04.bb +1 -0
@@ -6,6 +6,7 @@ GRUBPLATFORM = "efi"
 
 DEPENDS_append_class-target = " grub-efi-native"
 RDEPENDS_${PN}_class-target = "grub-common virtual/grub-bootconf"
+RDEPENDS_${PN}_class-native = "grub-native"
 
 SRC_URI += " \
            file://cfg \

meta/recipes-bsp/grub/grub-efi_2.04.bb do_install_append_class-target() { · line 68

Quoted 10 lines
meta/recipes-bsp/grub/grub-efi_2.04.bb +1 -3
@@ -61,9 +62,7 @@ do_install_append_class-target() {
 }
 
 do_install_class-native() {
-	install -d ${D}${bindir}
-	install -m 755 grub-mkimage ${D}${bindir}
-	install -m 755 grub-editenv ${D}${bindir}
+	:
 }
 
 do_install_class-target() {

I think we want to PROVIDES_append_class-native = " grub-efi-native" in grub and then drop the BBCLASSEXTEND from grub-efi?

Cheers,

Richard

#2 lore raw
Quoted 37 lines · Richard Purdie
Quoted 36 lines · Christopher Clark

Both grub-native and grub-efi-native included packaging for the grub-mkimage and grub-editenv tools, which prevented concurrent installation of both the grub-native and grub-efi-native packages. This caused errors on image generation with wic when populating partitions with both legacy and efi boot support, so resolve this by removing the duplicated tools from grub-efi-native and add a runtime dependency from it to grub-native.

---
  meta/recipes-bsp/grub/grub-efi_2.04.bb | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
meta/recipes- renamed from meta/recipes-bsp/grub/grub-efi_2.04.bb +0 -0

bsp/grub/grub-efi_2.04.bb
index b9d6225d27..ed43dee152 100644

meta/recipes-bsp/grub/grub-efi_2.04.bb +2 -3
@@ -6,6 +6,7 @@ GRUBPLATFORM = "efi"
 
  DEPENDS_append_class-target = " grub-efi-native"
  RDEPENDS_${PN}_class-target = "grub-common virtual/grub-bootconf"
+RDEPENDS_${PN}_class-native = "grub-native"
 
  SRC_URI += " \
             file://cfg \
@@ -61,9 +62,7 @@ do_install_append_class-target() {
  }
 
  do_install_class-native() {
-	install -d ${D}${bindir}
-	install -m 755 grub-mkimage ${D}${bindir}
-	install -m 755 grub-editenv ${D}${bindir}
+	:
  }
 
Quoted 5 lines

meta/recipes-bsp/grub/grub-efi_2.04.bb do_install_append_class-target() { · line 68

Quoted 1 line
meta/recipes-bsp/grub/grub-efi_2.04.bb +0 -0
  do_install_class-target() {

I think we want to PROVIDES_append_class-native = " grub-efi-native" in grub and then drop the BBCLASSEXTEND from grub-efi?

Just for the record, I tested building grub-native (x86-64) both with platform "pc" and "efi", and in the same build directory, and all tools in ${bindir} were binary identical. Asking in #grub on freenode also confirmed this, apparently Debian packaging also assumes this.

So no grub-efi-native required, and we can remove that _class_target/_class_native special handling as well.

Jacob

#3 lore raw
Quoted 14 lines · Jacob Kroon
Quoted 11 lines · Richard Purdie
Quoted 7 lines · Christopher Clark

Both grub-native and grub-efi-native included packaging for the grub-mkimage and grub-editenv tools, which prevented concurrent installation of both the grub-native and grub-efi-native packages. This caused errors on image generation with wic when populating partitions with both legacy and efi boot support, so resolve this by removing the duplicated tools from grub-efi-native and add a runtime dependency from it to grub-native.> >>

I think we want to PROVIDES_append_class-native = " grub-efi-native" in grub and then drop the BBCLASSEXTEND from grub-efi?

Quoted 7 lines

Just for the record, I tested building grub-native (x86-64) both with platform "pc" and "efi", and in the same build directory, and all tools in ${bindir} were binary identical. Asking in #grub on freenode also confirmed this, apparently Debian packaging also assumes this.

So no grub-efi-native required, and we can remove that _class_target/_class_native special handling as well.

I'm not as confident as I was about the results of the binary comparison that I did, since objdump definitely wasn't showing the strings differences that were clearly present between those binaries. I think that proposing this change was a mistake since there could well be other layers that depend on core having separate packages with behaviour specific to those that is needed. Sorry for the noise.

Christopher

#4 lore raw
Quoted 23 lines · Christopher Clark
Quoted 14 lines · Jacob Kroon
Quoted 11 lines · Richard Purdie
Quoted 7 lines · Christopher Clark

Both grub-native and grub-efi-native included packaging for the grub-mkimage and grub-editenv tools, which prevented concurrent installation of both the grub-native and grub-efi-native packages. This caused errors on image generation with wic when populating partitions with both legacy and efi boot support, so resolve this by removing the duplicated tools from grub-efi-native and add a runtime dependency from it to grub-native.> >>

I think we want to PROVIDES_append_class-native = " grub-efi-native" in grub and then drop the BBCLASSEXTEND from grub-efi?

Quoted 7 lines

Just for the record, I tested building grub-native (x86-64) both with platform "pc" and "efi", and in the same build directory, and all tools in ${bindir} were binary identical. Asking in #grub on freenode also confirmed this, apparently Debian packaging also assumes this.

So no grub-efi-native required, and we can remove that _class_target/_class_native special handling as well.

Quoted 7 lines

I'm not as confident as I was about the results of the binary comparison that I did, since objdump definitely wasn't showing the strings differences that were clearly present between those binaries. I think that proposing this change was a mistake since there could well be other layers that depend on core having separate packages with behaviour specific to those that is needed. Sorry for the noise.

I dug some more into this. That GRUB_PKGLIBDIR define which references the recipe specific install sysroot is actually unused and could be removed. But there are 3 other values that contain the install sysroot being encoding in the binaries:

GRUB_DATADIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/usr/share

GRUB_LIBDIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/usr/lib

GRUB_SYSCONFDIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/etc

But all three values refer to directories that are not expected to exists at the time they are executed, right ? At least not for me using rm_work.bbclass. Where grub-mkimage is used in the efi recipe, -d is passed to override the libdir.

So I'd still vote for removing grub-efi-native.

Jacob

#5 lore raw
Quoted 44 lines · Jacob Kroon
Quoted 23 lines · Christopher Clark
Quoted 14 lines · Jacob Kroon
Quoted 11 lines · Richard Purdie
Quoted 7 lines · Christopher Clark

Both grub-native and grub-efi-native included packaging for the grub-mkimage and grub-editenv tools, which prevented concurrent installation of both the grub-native and grub-efi-native packages. This caused errors on image generation with wic when populating partitions with both legacy and efi boot support, so resolve this by removing the duplicated tools from grub-efi-native and add a runtime dependency from it to grub-native.> >>

I think we want to PROVIDES_append_class-native = " grub-efi-native" in grub and then drop the BBCLASSEXTEND from grub-efi?

Quoted 7 lines

Just for the record, I tested building grub-native (x86-64) both with platform "pc" and "efi", and in the same build directory, and all tools in ${bindir} were binary identical. Asking in #grub on freenode also confirmed this, apparently Debian packaging also assumes this.

So no grub-efi-native required, and we can remove that _class_target/_class_native special handling as well.

Quoted 7 lines

I'm not as confident as I was about the results of the binary comparison that I did, since objdump definitely wasn't showing the strings differences that were clearly present between those binaries. I think that proposing this change was a mistake since there could well be other layers that depend on core having separate packages with behaviour specific to those that is needed. Sorry for the noise.

I dug some more into this. That GRUB_PKGLIBDIR define which references the recipe specific install sysroot is actually unused and could be removed. But there are 3 other values that contain the install sysroot being encoding in the binaries:

GRUB_DATADIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/usr/share

GRUB_LIBDIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/usr/lib

Quoted 7 lines

GRUB_SYSCONFDIR = $TMPDIR/work/x86_64-linux/grub-native/2.04-r0/recipe-sysroot-native/etc

But all three values refer to directories that are not expected to exists at the time they are executed, right ? At least not for me using rm_work.bbclass. Where grub-mkimage is used in the efi recipe, -d is passed to override the libdir.

grub and grub-efi are separate packages because they build different software to build systems that boot differently, and are packaged that way in multiple distros. It allows for one version of one tool to be used and a different version of the other to be used in building the same system, via Yocto/OE's flexible layer architecture. The same is true when they are used natively during a build.

I don't know of a case where installing the native version of a package would instead slipstream in the tools from the other in this way, and I don't think it's right to do so: it would be counterintuitive, and so potentially time-consuming to diagnose any issues arising.

Quoted 1 line

So I'd still vote for removing grub-efi-native.

Please don't.

Christopher