grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] Allow explicit module dependencies


From: Oliver Steffen
Subject: [PATCH 1/2] Allow explicit module dependencies
Date: Tue, 14 Nov 2023 17:44:52 +0100

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
explicit_depdendencies.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>...

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
---
 grub-core/Makefile.am               | 4 ++--
 grub-core/explicit_dependencies.lst | 0
 grub-core/genmoddep.awk             | 4 ++++
 3 files changed, 6 insertions(+), 2 deletions(-)
 create mode 100644 grub-core/explicit_dependencies.lst

diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index f0cb2f2cc..8c3a7d83b 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -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 > $@.new
+syminfo.lst: gensyminfo.sh kernel_syms.lst explicit_dependencies.lst 
$(MODULE_FILES)
+       cat kernel_syms.lst explicit_dependencies.lst > $@.new
        for m in $(MODULE_FILES); do \
          sh $< $$m >> $@.new || exit 1; \
        done
diff --git a/grub-core/explicit_dependencies.lst 
b/grub-core/explicit_dependencies.lst
new file mode 100644
index 000000000..e69de29bb
diff --git a/grub-core/genmoddep.awk b/grub-core/genmoddep.awk
index 247436392..cc987a53a 100644
--- a/grub-core/genmoddep.awk
+++ b/grub-core/genmoddep.awk
@@ -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";
-- 
2.41.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]