Skip to contentSkip to conversation

Bli: fix hidden module dependency

PATCH Superseded Oliver Steffen 3 participants 9 messages Nov 15, 2023 – Nov 30, 2023

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover Bli: fix hidden module dependency

The bli module has a hidden/implicit dependency on the part_gpt module. The part_gpt module has to be loaded before the bli module. This dependency is not picked up automatically by the build system because the bli module does not use any function of part_gpt. It just expects Grub to be able to parse GPT formatted disks.

This series introduces a mechanism that allows specifying module dependencies explicitly in a new file called extra_deps.lst.

An explicit dependency is then added for the bli module on the part_gpt module and the documentation is improved.

Changes since v1 [1]:
- rename explicit_dependencies.lst -> extra_deps.lst
- explain what bli does/why it needs part_gpt in the commit message
- and in the module documentation as well.

[1] https://mail.gnu.org/archive/html/grub-devel/2023-11/msg00077.html

Oliver Steffen (3):
Allow explicit module dependencies
bli: Add explicit dependency on the part_gpt module
bli: Improve documentation

 docs/grub.texi           | 17 +++++++++++++----
 grub-core/Makefile.am    |  4 ++--
 grub-core/extra_deps.lst |  1 +
 grub-core/genmoddep.awk  |  4 ++++
 4 files changed, 20 insertions(+), 6 deletions(-)
 create mode 100644 grub-core/extra_deps.lst
Signature · 7 lines
2.41.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#1 lore raw

PATCH v2 1/3 Allow explicit module dependencies

The build system deduces inter-module dependencies from the symbols required and exported by the modules. This works well, except for some rare cases where the dependency is indirect or hidden. A module might not make use of any function of some other module, but still expect its functionality to be available to Grub.

To solve this, introduce a new file (currently empty) called extra_deps.lst to track these cases manually. This file gets processed in the same way as the (automatically generated) syminfo.lst, making it possible to inject data into the dependency resolver.

Additionally, introduce a new keyword for the syminfo.lst syntax:
"depends" allows specifying a module dependency directly:

depends <module> <depdendency>...

---
 grub-core/Makefile.am    | 4 ++--
 grub-core/extra_deps.lst | 0
 grub-core/genmoddep.awk  | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)
 create mode 100644 grub-core/extra_deps.lst
grub-core/Makefile.am +2 -2
index f0cb2f2cc..b8173f4e1 100644
@@ -452,8 +452,8 @@ crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst
 platform_DATA += crypto.lst
 CLEANFILES += crypto.lst
 
-syminfo.lst: gensyminfo.sh kernel_syms.lst $(MODULE_FILES)
-	cat kernel_syms.lst > [email protected]
+syminfo.lst: gensyminfo.sh kernel_syms.lst extra_deps.lst $(MODULE_FILES)
+	cat kernel_syms.lst extra_deps.lst > [email protected]
 	for m in $(MODULE_FILES); do \
 	  sh $< $$m >> [email protected] || exit 1; \
 	done
grub-core/extra_deps.lst new file +0 -0
new file mode 100644
index 000000000..e69de29bb
grub-core/genmoddep.awk +4 -0
index 247436392..cc987a53a 100644
@@ -31,6 +31,10 @@ BEGIN {
       printf "%s in %s is not defined\n", $3, $2 >"/dev/stderr";
       error++;
     }
+  } else if ($1 == "depends") {
+    for (i = 3; i <= NF; i++) {
+      modtab[$2] = modtab[$2] " " $i;
+    }
   }
   else {
     printf "error: %u: unrecognized input format\n", NR >"/dev/stderr";
Signature · 7 lines
2.41.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#2 lore raw

PATCH v2 2/3 bli: Add explicit dependency on the part_gpt module

In reply to Oliver Steffen

The bli module has a "hidden" dependency on the part_gpt module, which is not picked up automatically by the build system. One purpose of the bli module is to communicate the GPT UUID of the partition Grub was launched from to Linux user-space (systemd-gpt-auto-generator). Without the part_gpt module, bli is not able to obtain the UUID. Since bli does its work in the module initialization function, the order in which the modules are loaded is also important: part_gpt needs to be loaded before the bli module.

To solve this, track this dependency explicitly.

Note that the Boot Loader Interface specification, which bli aims to implement, requires GPT formatted drives. The bli module ignores all other partition formats.

---
 grub-core/extra_deps.lst | 1 +
 1 file changed, 1 insertion(+)
grub-core/extra_deps.lst +1 -0
index e69de29bb..f44ad6a0c 100644
@@ -0,0 +1 @@
+depends bli part_gpt
Signature · 7 lines
2.41.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#3 lore raw

PATCH v2 3/3 bli: Improve documentation

In reply to Oliver Steffen

Improve the documentation of the bli module, explain in more detail what it does. Make clear that GPT formatted drives are expected and other partition formats are ignored.
Also reorder and reword this section a bit.

---
 docs/grub.texi | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
docs/grub.texi +13 -4
index 975e521d1..4b9ceceb7 100644
@@ -3880,11 +3880,20 @@ Modules can be loaded via the @command{insmod} (@pxref{insmod}) command.
 @section bli
 This module provides basic support for the Boot Loader Interface. The Boot
 Loader Interface specifies a set of EFI variables that are used to communicate
-boot-time information between the boot loader and the operating system.
+boot-time information between the bootloader and the operating system.
 
-When loaded, the bli module publishes the GPT partition UUID of the EFI System
-Partition used during boot and a string identifying GRUB as the active boot
-loader, including the version number.
+The following variables are placed under the vendor UUID
+@code{4a67b082-0a4c-41cf-b6c7-440b29bb8c4f} when the module is loaded:
+
+The GPT partition UUID of the EFI System Partition used during boot is
+published via the @code{LoaderDevicePartUUID} variable. The Boot Loader
+Interface specification requires GPT formatted drives. The bli module ignores
+drives/partitions in any other format. If Grub is loaded from a non-GPT
+partition (for example from an MSDOS formatted drive, or the network)
+this variable will not be set.
+
+A string identifying GRUB as the active bootloader including the version
+number is stored in @code{LoaderInfo}.
 
 This module is only available on UEFI platforms.
 
Signature · 7 lines
2.41.0


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#4 lore raw
In reply to Oliver Steffen

Adding a few folks who can be interested in this patch set...

Quoted 5 lines · Oliver Steffen

The bli module has a hidden/implicit dependency on the part_gpt module. The part_gpt module has to be loaded before the bli module. This dependency is not picked up automatically by the build system because the bli module does not use any function of part_gpt. It just expects Grub to be able to parse GPT formatted disks.

Please be more consistent and use GRUB instead of Grub or other forms everywhere.

Additionally, we are missing extra_deps.lst exception entry in .gitignore. Could you add it?

Quoted 11 lines

This series introduces a mechanism that allows specifying module dependencies explicitly in a new file called extra_deps.lst.

An explicit dependency is then added for the bli module on the part_gpt module and the documentation is improved.

Changes since v1 [1]:
- rename explicit_dependencies.lst -> extra_deps.lst
- explain what bli does/why it needs part_gpt in the commit message
- and in the module documentation as well.

Quoted 6 lines

[1] https://mail.gnu.org/archive/html/grub-devel/2023-11/msg00077.html

Oliver Steffen (3):
Allow explicit module dependencies
bli: Add explicit dependency on the part_gpt module
bli: Improve documentation

Otherwise patch set LGTM...

A few days ago Vladimir pushed fixes for GUID types. I hope together with this patch set all known x86_64, aarch64 and IA-64 EFI issues are fixed. So, folks, in particular Tobias, please test the latest GRUB upstream master branch with these patches on top. Even if they require some minor polishing. When everything is OK we can assume at least this release roadblock has been lifted...

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#5 lore raw
Quoted 33 lines · Daniel Kiper

Adding a few folks who can be interested in this patch set...

Quoted 5 lines · Oliver Steffen

The bli module has a hidden/implicit dependency on the part_gpt module. The part_gpt module has to be loaded before the bli module. This dependency is not picked up automatically by the build system because the bli module does not use any function of part_gpt. It just expects Grub to be able to parse GPT formatted disks.

Please be more consistent and use GRUB instead of Grub or other forms everywhere.

Additionally, we are missing extra_deps.lst exception entry in .gitignore. Could you add it?

Quoted 11 lines

This series introduces a mechanism that allows specifying module dependencies explicitly in a new file called extra_deps.lst.

An explicit dependency is then added for the bli module on the part_gpt module and the documentation is improved.

Changes since v1 [1]:
- rename explicit_dependencies.lst -> extra_deps.lst
- explain what bli does/why it needs part_gpt in the commit message
- and in the module documentation as well.

Quoted 6 lines

[1] https://mail.gnu.org/archive/html/grub-devel/2023-11/msg00077.html

Oliver Steffen (3):
Allow explicit module dependencies
bli: Add explicit dependency on the part_gpt module
bli: Improve documentation

Quoted 8 lines

Otherwise patch set LGTM...

A few days ago Vladimir pushed fixes for GUID types. I hope together with this patch set all known x86_64, aarch64 and IA-64 EFI issues are fixed. So, folks, in particular Tobias, please test the latest GRUB upstream master branch with these patches on top. Even if they require some minor polishing. When everything is OK we can assume at least this release roadblock has been lifted...

Tobias and other folks, ping? I would really love to hear something from you soon...

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#6 lore raw
Quoted 43 lines · Daniel Kiper
Quoted 33 lines · Daniel Kiper

Adding a few folks who can be interested in this patch set...

Quoted 5 lines · Oliver Steffen

The bli module has a hidden/implicit dependency on the part_gpt module. The part_gpt module has to be loaded before the bli module. This dependency is not picked up automatically by the build system because the bli module does not use any function of part_gpt. It just expects Grub to be able to parse GPT formatted disks.

Please be more consistent and use GRUB instead of Grub or other forms everywhere.

Additionally, we are missing extra_deps.lst exception entry in .gitignore. Could you add it?

Quoted 11 lines

This series introduces a mechanism that allows specifying module dependencies explicitly in a new file called extra_deps.lst.

An explicit dependency is then added for the bli module on the part_gpt module and the documentation is improved.

Changes since v1 [1]:
- rename explicit_dependencies.lst -> extra_deps.lst
- explain what bli does/why it needs part_gpt in the commit message
- and in the module documentation as well.

Quoted 6 lines

[1] https://mail.gnu.org/archive/html/grub-devel/2023-11/msg00077.html

Oliver Steffen (3):
Allow explicit module dependencies
bli: Add explicit dependency on the part_gpt module
bli: Improve documentation

Quoted 8 lines

Otherwise patch set LGTM...

A few days ago Vladimir pushed fixes for GUID types. I hope together with this patch set all known x86_64, aarch64 and IA-64 EFI issues are fixed. So, folks, in particular Tobias, please test the latest GRUB upstream master branch with these patches on top. Even if they require some minor polishing. When everything is OK we can assume at least this release roadblock has been lifted...

Quoted 2 lines

Tobias and other folks, ping? I would really love to hear something from you soon...

Ping? If I do not hear anything from you guys soon I will assume everything works as expected, merge these patches and cut the release by the end of next week or so... We are long behind the schedule...

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#7 lore raw

Am 29.11.23 um 20:43 schrieb Daniel Kiper:

Quoted 41 lines · Daniel Kiper
Quoted 40 lines · Daniel Kiper
Quoted 39 lines

Adding a few folks who can be interested in this patch set...

Quoted 5 lines · Oliver Steffen

The bli module has a hidden/implicit dependency on the part_gpt module. The part_gpt module has to be loaded before the bli module. This dependency is not picked up automatically by the build system because the bli module does not use any function of part_gpt. It just expects Grub to be able to parse GPT formatted disks.

Please be more consistent and use GRUB instead of Grub or other forms everywhere.

Additionally, we are missing extra_deps.lst exception entry in .gitignore. Could you add it?

Quoted 11 lines

This series introduces a mechanism that allows specifying module dependencies explicitly in a new file called extra_deps.lst.

An explicit dependency is then added for the bli module on the part_gpt module and the documentation is improved.

Changes since v1 [1]:
- rename explicit_dependencies.lst -> extra_deps.lst
- explain what bli does/why it needs part_gpt in the commit message
- and in the module documentation as well.

Quoted 6 lines

[1] https://mail.gnu.org/archive/html/grub-devel/2023-11/msg00077.html

Oliver Steffen (3):
Allow explicit module dependencies
bli: Add explicit dependency on the part_gpt module
bli: Improve documentation

Otherwise patch set LGTM...

A few days ago Vladimir pushed fixes for GUID types. I hope together with this patch set all known x86_64, aarch64 and IA-64 EFI issues are fixed. So, folks, in particular Tobias, please test the latest GRUB upstream master branch with these patches on top. Even if they require some minor polishing. When everything is OK we can assume at least this release roadblock has been lifted...

Quoted 7 lines
Quoted 2 lines

Tobias and other folks, ping? I would really love to hear something from you soon...

Ping? If I do not hear anything from you guys soon I will assume everything works as expected, merge these patches and cut the release by the end of next week or so... We are long behind the schedule...

Daniel

Hi,

sorry my use case changed, so I don't use bli as module in the included array anymore.

Best regards

tpowa

Signature · 19 lines
Tobias Powalowski
Arch Linux Developer (tpowa)
https://www.archlinux.org
[email protected]

Archboot Developer
https://archboot.com

St. Martin-Apotheke
Herzog-Georg-Str. 25
89415 Lauingen
https://www.st-martin-apo.de
[email protected]


_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
#8 lore raw
Quoted 3 lines · Tobias Powalowski via Grub-devel

Am 29.11.23 um 20:43 schrieb Daniel Kiper:

Quoted 2 lines · Daniel Kiper
Quoted 1 line · Daniel Kiper

[...]

Quoted 12 lines
Quoted 12 lines
Quoted 8 lines
Quoted 6 lines

A few days ago Vladimir pushed fixes for GUID types. I hope together with this patch set all known x86_64, aarch64 and IA-64 EFI issues are fixed. So, folks, in particular Tobias, please test the latest GRUB upstream master branch with these patches on top. Even if they require some minor polishing. When everything is OK we can assume at least this release roadblock has been lifted...

Tobias and other folks, ping? I would really love to hear something from you soon...

Ping? If I do not hear anything from you guys soon I will assume everything works as expected, merge these patches and cut the release by the end of next week or so... We are long behind the schedule...

Quoted 6 lines
Quoted 1 line

Daniel

Hi,

sorry my use case changed, so I don't use bli as module in the included array anymore.

No worries. Thank you for update!

Daniel

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel