]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
build: Allow explicit module dependencies
authorOliver Steffen <osteffen@redhat.com>
Thu, 16 Nov 2023 15:37:38 +0000 (16:37 +0100)
committerDaniel Kiper <daniel.kiper@oracle.com>
Tue, 5 Dec 2023 13:58:36 +0000 (14:58 +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 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>...

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
.gitignore
grub-core/Makefile.am
grub-core/extra_deps.lst [new file with mode: 0644]
grub-core/genmoddep.awk

index 11fcecf5c40bb3af0c0622ccad504ee28ef6de3b..4d0dfb700e470a3b5a5562810f4759cf8ffdb447 100644 (file)
@@ -11,6 +11,7 @@
 *.img
 *.log
 *.lst
+!/grub-core/extra_deps.lst
 *.marker
 *.mod
 *.o
index fc9fc6a908d75c1491ecec5ac5d887b3dad99105..a48ce37b4815b462ad227cffb2def70ac7ef67e3 100644 (file)
@@ -454,8 +454,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 extra_deps.lst $(MODULE_FILES)
+       cat kernel_syms.lst extra_deps.lst > $@.new
        for m in $(MODULE_FILES); do \
          sh $< $$m >> $@.new || exit 1; \
        done
diff --git a/grub-core/extra_deps.lst b/grub-core/extra_deps.lst
new file mode 100644 (file)
index 0000000..e69de29
index 247436392134f1f0bb4ef679f6f4611ec51776fa..cc987a53aa81688e650dc2d2b6e00af6debe606d 100644 (file)
@@ -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";