Bli: fix hidden module dependency
v3 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 v2 [2]:
- add exception for extra_deps.lst to gitignore
- fix the spelling of GRUB
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
[2] https://mail.gnu.org/archive/html/grub-devel/2023-11/msg00096.html
Oliver Steffen (3):
Allow explicit module dependencies
bli: Add explicit dependency on the part_gpt module
bli: Improve documentation
.gitignore | 1 + docs/grub.texi | 17 +++++++++++++---- grub-core/Makefile.am | 4 ++-- grub-core/extra_deps.lst | 1 + grub-core/genmoddep.awk | 4 ++++ 5 files changed, 21 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
PATCH v3 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.
Since *.lst files are set to be ignored by git, add an exception for extra_deps.lst.
Additionally, introduce a new keyword for the syminfo.lst syntax:
"depends" allows specifying a module dependency directly:
depends <module> <depdendency>...
--- .gitignore | 1 + grub-core/Makefile.am | 4 ++-- grub-core/extra_deps.lst | 0 grub-core/genmoddep.awk | 4 ++++ 4 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 grub-core/extra_deps.lst
.gitignore +1 -0
@@ -11,6 +11,7 @@ *.img *.log *.lst +!/grub-core/extra_deps.lst *.marker *.mod *.o
grub-core/Makefile.am +2 -2
@@ -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
grub-core/genmoddep.awk +4 -0
@@ -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
Re: [PATCH v3 1/3] Allow explicit module dependencies
Thu, 16 Nov 2023 16:37:38 +0100 Oliver Steffen <[email protected]>:
grub-core/Makefile.am crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst · line 456
Quoted 2 lines
grub-core/Makefile.am +2
-0+syminfo.lst: gensyminfo.sh kernel_syms.lst extra_deps.lst $(MODULE_FILES) + cat kernel_syms.lst extra_deps.lst > [email protected]
There are rules to create gensyminfo.sh and kernel_syms.lst, but there is no rule to create extra_deps.lst. As a result out of tree builds fail with 154dcb1aea9f8fc42b2bce98bebed004d7783a7d.
Olaf
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH v3 1/3] Allow explicit module dependencies
Hi Olaf,
Quoted 7 lines · Olaf Hering
Thu, 16 Nov 2023 16:37:38 +0100 Oliver Steffen <[email protected]>:
grub-core/Makefile.am crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst · line 456
Quoted 2 lines
grub-core/Makefile.am +2
-0+syminfo.lst: gensyminfo.sh kernel_syms.lst extra_deps.lst $(MODULE_FILES) + cat kernel_syms.lst extra_deps.lst > [email protected]There are rules to create
gensyminfo.shand kernel_syms.lst, but there is no rule to create extra_deps.lst. As a result out of tree builds fail with154dcb1aea9f8fc42b2bce98bebed004d7783a7d.
I run build tests before push and did not spot any issues. Could you provide us exact steps to reproduce the problem?
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH v3 1/3] Allow explicit module dependencies
Wed, 6 Dec 2023 16:24:53 +0100 Daniel Kiper <[email protected]>:
Quoted 1 line
Could you provide us exact steps to reproduce the problem?
Something like this?
mkdir .b
cd $_
../grub-src-dir/configure [options]
A brief look at the sources indicates the new file could be generated during build, with "echo content > $@".
Olaf
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH v3 1/3] Allow explicit module dependencies
Quoted 9 lines · Olaf Hering
Wed, 6 Dec 2023 16:24:53 +0100 Daniel Kiper <[email protected]>:
Quoted 1 line
Could you provide us exact steps to reproduce the problem?
Something like this?
mkdir .b
cd $_
../grub-src-dir/configure [options]
Ugh, yeah, the file is missing in this case. Oliver, could you fix that?
Quoted 1 line
A brief look at the sources indicates the new file could be generated during build, with "echo content > $@".
Or copy original file... But generation can be a bit more universal...
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH v3 1/3] Allow explicit module dependencies
Quoted 11 lines · Daniel Kiper
Quoted 9 lines · Olaf Hering
Wed, 6 Dec 2023 16:24:53 +0100 Daniel Kiper <[email protected]>:
Quoted 1 line
Could you provide us exact steps to reproduce the problem?
Something like this?
mkdir .b
cd $_
../grub-src-dir/configure [options]
Quoted 5 lines
Ugh, yeah, the file is missing in this case. Oliver, could you fix that?
Quoted 1 line
A brief look at the sources indicates the new file could be generated during build, with "echo content > $@".
Or copy original file... But generation can be a bit more universal...
Oliver, ping?
I really want to cut release next week and this is a blocker...
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH v3 1/3] Allow explicit module dependencies
Quoted 14 lines · Daniel Kiper
Quoted 13 lines · Daniel Kiper
Quoted 9 lines · Olaf Hering
Wed, 6 Dec 2023 16:24:53 +0100 Daniel Kiper <[email protected]>:
Quoted 1 line
Could you provide us exact steps to reproduce the problem?
Something like this?
mkdir .b
cd $_
../grub-src-dir/configure [options]Ugh, yeah, the file is missing in this case. Oliver, could you fix that?
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
A brief look at the sources indicates the new file could be generated during build, with "echo content > $@".
Or copy original file... But generation can be a bit more universal...
Oliver, ping?
I really want to cut release next week and this is a blocker...
Mate just posted
[PATCH] grub-core/Makefile.am: Make path to extra_deps.lst relative to $(top_srcdir)/grub-core
which should resolve this issue.
Signature · 7 lines
debian developer - deb.li/jak | jak-linux.org - free software dev ubuntu core developer i speak de, en _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
Re: [PATCH v3 1/3] Allow explicit module dependencies
Quoting Julian Andres Klode (2023-12-08 18:29:52)
Quoted 21 lines · Daniel Kiper
Quoted 20 lines · Daniel Kiper
Quoted 11 lines · Olaf Hering
Quoted 9 lines
Wed, 6 Dec 2023 16:24:53 +0100 Daniel Kiper <[email protected]>:
Quoted 1 line
Could you provide us exact steps to reproduce the problem?
Something like this?
mkdir .b
cd $_
../grub-src-dir/configure [options]Quoted 5 lines
Ugh, yeah, the file is missing in this case. Oliver, could you fix that?
Quoted 1 line
A brief look at the sources indicates the new file could be generated during build, with "echo content > $@".
Or copy original file... But generation can be a bit more universal...
Oliver, ping?
Quoted 9 lines
Quoted 1 line
I really want to cut release next week and this is a blocker...
Mate just posted
[PATCH] grub-core/Makefile.am: Make path to extra_deps.lst relative to $(top_srcdir)/grub-core
which should resolve this issue.
Sorry for the late reply, I was away.
-Oliver
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
PATCH v3 2/3 bli: Add explicit dependency on the part_gpt module
In reply to Oliver SteffenThe 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
@@ -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
PATCH v3 3/3 bli: Improve documentation
In reply to Oliver SteffenImprove 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
@@ -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
Quoted 11 lines · Oliver Steffen
The bli module has a hidden/implicit dependency on the
part_gptmodule. Thepart_gptmodule 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 ofpart_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_gptmodule and the documentation is improved.
For all patches Reviewed-by: Daniel Kiper <[email protected]>...
Daniel
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel