summaryrefslogtreecommitdiffstats
path: root/scripts/Makefile.vmlinux_o
diff options
context:
space:
mode:
authorMasahiro Yamada <masahiroy@kernel.org>2022-09-28 08:39:40 +0200
committerMasahiro Yamada <masahiroy@kernel.org>2022-10-02 20:52:58 +0200
commit7a342e6c7735e13b294374cb0a0f6283d8667496 (patch)
tree784cf59af95127834224b9977a226160e6ea08f3 /scripts/Makefile.vmlinux_o
parentzstd: Fixing mixed module-builtin objects (diff)
downloadlinux-7a342e6c7735e13b294374cb0a0f6283d8667496.tar.xz
linux-7a342e6c7735e13b294374cb0a0f6283d8667496.zip
kbuild: move modules.builtin(.modinfo) rules to Makefile.vmlinux_o
Do not build modules.builtin(.modinfo) as a side-effect of vmlinux. There are no good reason to rebuild them just because any of vmlinux's prerequistes (vmlinux.lds, .vmlinux.export.c, etc.) has been updated. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'scripts/Makefile.vmlinux_o')
-rw-r--r--scripts/Makefile.vmlinux_o26
1 files changed, 25 insertions, 1 deletions
diff --git a/scripts/Makefile.vmlinux_o b/scripts/Makefile.vmlinux_o
index 68c22879bade..0edfdb40364b 100644
--- a/scripts/Makefile.vmlinux_o
+++ b/scripts/Makefile.vmlinux_o
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
PHONY := __default
-__default: vmlinux.o
+__default: vmlinux.o modules.builtin.modinfo modules.builtin
include include/config/auto.conf
include $(srctree)/scripts/Kbuild.include
@@ -62,6 +62,30 @@ vmlinux.o: $(initcalls-lds) vmlinux.a $(KBUILD_VMLINUX_LIBS) FORCE
targets += vmlinux.o
+# module.builtin.modinfo
+# ---------------------------------------------------------------------------
+
+OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
+
+targets += modules.builtin.modinfo
+modules.builtin.modinfo: vmlinux.o FORCE
+ $(call if_changed,objcopy)
+
+# module.builtin
+# ---------------------------------------------------------------------------
+
+# The second line aids cases where multiple modules share the same object.
+
+quiet_cmd_modules_builtin = GEN $@
+ cmd_modules_builtin = \
+ tr '\0' '\n' < $< | \
+ sed -n 's/^[[:alnum:]:_]*\.file=//p' | \
+ tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$$/.ko/' > $@
+
+targets += modules.builtin
+modules.builtin: modules.builtin.modinfo FORCE
+ $(call if_changed,modules_builtin)
+
# Add FORCE to the prequisites of a target to force it to be always rebuilt.
# ---------------------------------------------------------------------------