Add a new keyword, "depends", to the module definition syntax
used in Makefile.core.def. This allows specifying explicit module
dependencies together with the module definition.

Do not track the "extra_deps.lst" file in the repository anymore,
it is now auto-generated.

Make use of this new keyword in the bli module definition.

Signed-off-by: Oliver Steffen <ostef...@redhat.com>
---
 .gitignore                  | 1 -
 conf/Makefile.common        | 1 +
 gentpl.py                   | 7 +++++++
 grub-core/Makefile.am       | 7 +++++--
 grub-core/Makefile.core.def | 1 +
 grub-core/extra_deps.lst    | 1 -
 grub-core/genmoddep.awk     | 2 +-
 7 files changed, 15 insertions(+), 5 deletions(-)
 delete mode 100644 grub-core/extra_deps.lst

diff --git a/.gitignore b/.gitignore
index 4d0dfb700..11fcecf5c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,7 +11,6 @@
 *.img
 *.log
 *.lst
-!/grub-core/extra_deps.lst
 *.marker
 *.mod
 *.o
diff --git a/conf/Makefile.common b/conf/Makefile.common
index b8f216f6c..c60f55386 100644
--- a/conf/Makefile.common
+++ b/conf/Makefile.common
@@ -111,6 +111,7 @@ MOD_FILES =
 MODULE_FILES =
 MARKER_FILES =
 KERNEL_HEADER_FILES =
+EXTRA_DEPS =
 
 bin_SCRIPTS =
 bin_PROGRAMS =
diff --git a/gentpl.py b/gentpl.py
index bfab2113a..3b12eca6c 100644
--- a/gentpl.py
+++ b/gentpl.py
@@ -631,6 +631,9 @@ def platform_values(defn, platform, suffix):
 def extra_dist(defn):
     return foreach_value(defn, "extra_dist", lambda value: value + " ")
 
+def extra_dep(defn):
+    return foreach_value(defn, "depends", lambda value: value + " ")
+
 def platform_sources(defn, p): return platform_values(defn, p, "")
 def platform_nodist_sources(defn, p): return platform_values(defn, p, 
"_nodist")
 
@@ -699,6 +702,10 @@ def module(defn, platform):
     gvar_add("MOD_FILES", name + ".mod")
     gvar_add("MARKER_FILES", name + ".marker")
     gvar_add("CLEANFILES", name + ".marker")
+
+    for dep in defn.find_all("depends"):
+        gvar_add("EXTRA_DEPS", "depends " + name + " " + dep + ":")
+
     output("""
 """ + name + """.marker: $(""" + cname(defn) + """_SOURCES) $(nodist_""" + 
cname(defn) + """_SOURCES)
        $(TARGET_CPP) -DGRUB_LST_GENERATOR $(CPPFLAGS_MARKER) $(DEFS) 
$(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname(defn) + """_CPPFLAGS) $(CPPFLAGS) 
$^ > $@.new || (rm -f $@; exit 1)
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
index f18550c1c..5df36744e 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -454,7 +454,10 @@ crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst
 platform_DATA += crypto.lst
 CLEANFILES += crypto.lst
 
-syminfo.lst: gensyminfo.sh kernel_syms.lst 
$(top_srcdir)/grub-core/extra_deps.lst $(MODULE_FILES)
+extra_deps.lst:
+       @echo $(EXTRA_DEPS) | sed "s/\s*:\s*/\n/g" > $@
+
+syminfo.lst: gensyminfo.sh kernel_syms.lst extra_deps.lst $(MODULE_FILES)
        cat kernel_syms.lst $(top_srcdir)/grub-core/extra_deps.lst > $@.new
        for m in $(MODULE_FILES); do \
          sh $< $$m >> $@.new || exit 1; \
@@ -465,7 +468,7 @@ syminfo.lst: gensyminfo.sh kernel_syms.lst 
$(top_srcdir)/grub-core/extra_deps.ls
 moddep.lst: syminfo.lst genmoddep.awk video.lst
        cat $< | sort | $(AWK) -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; 
exit 1)
 platform_DATA += moddep.lst
-CLEANFILES += config.log syminfo.lst moddep.lst
+CLEANFILES += config.log syminfo.lst moddep.lst extra_deps.lst
 
 $(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT) 
build-grub-module-verifier$(BUILD_EXEEXT)
        TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
index 1571421d7..142faeff0 100644
--- a/grub-core/Makefile.core.def
+++ b/grub-core/Makefile.core.def
@@ -2594,4 +2594,5 @@ module = {
   name = bli;
   efi = commands/bli.c;
   enable = efi;
+  depends = part_gpt;
 };
diff --git a/grub-core/extra_deps.lst b/grub-core/extra_deps.lst
deleted file mode 100644
index f44ad6a0c..000000000
--- a/grub-core/extra_deps.lst
+++ /dev/null
@@ -1 +0,0 @@
-depends bli part_gpt
diff --git a/grub-core/genmoddep.awk b/grub-core/genmoddep.awk
index cc987a53a..ab457cb2b 100644
--- a/grub-core/genmoddep.awk
+++ b/grub-core/genmoddep.awk
@@ -35,7 +35,7 @@ BEGIN {
     for (i = 3; i <= NF; i++) {
       modtab[$2] = modtab[$2] " " $i;
     }
-  }
+  } else if ($1 == "") {} #Skip empty lines
   else {
     printf "error: %u: unrecognized input format\n", NR >"/dev/stderr";
     error++;
-- 
2.43.2


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to