From: Oliver Steffen <osteffen@redhat.com>
To: grub-devel@gnu.org
Cc: Oliver Steffen <osteffen@redhat.com>,
Olaf Hering <olaf@aepfle.de>,
mate.kukri@canonical.com, Daniel Kiper <dkiper@net-space.pl>,
Oskari Pirhonen <xxc3ncoredxx@gmail.com>,
Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>,
Daniel Kiper <daniel.kiper@oracle.com>
Subject: [PATCH v2] Track explicit module dependencies in Makefile.core.def
Date: Wed, 28 Feb 2024 13:36:00 +0100 [thread overview]
Message-ID: <20240228123600.93727-1-osteffen@redhat.com> (raw)
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 <osteffen@redhat.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
v2:
- fix out-of-source builds
.gitignore | 1 -
conf/Makefile.common | 1 +
gentpl.py | 7 +++++++
grub-core/Makefile.am | 9 ++++++---
grub-core/Makefile.core.def | 1 +
| 1 -
grub-core/genmoddep.awk | 2 +-
7 files changed, 16 insertions(+), 6 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..1eda467e0 100644
--- a/grub-core/Makefile.am
+++ b/grub-core/Makefile.am
@@ -454,8 +454,11 @@ 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)
- cat kernel_syms.lst $(top_srcdir)/grub-core/extra_deps.lst > $@.new
+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 extra_deps.lst > $@.new
for m in $(MODULE_FILES); do \
sh $< $$m >> $@.new || exit 1; \
done
@@ -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.44.0
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next reply other threads:[~2024-02-28 12:36 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-28 12:36 Oliver Steffen [this message]
2024-03-04 2:46 ` [PATCH v2] Track explicit module dependencies in Makefile.core.def Oskari Pirhonen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240228123600.93727-1-osteffen@redhat.com \
--to=osteffen@redhat.com \
--cc=daniel.kiper@oracle.com \
--cc=dkiper@net-space.pl \
--cc=grub-devel@gnu.org \
--cc=mate.kukri@canonical.com \
--cc=olaf@aepfle.de \
--cc=phcoder@gmail.com \
--cc=xxc3ncoredxx@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).