From: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Date: Tue, 16 Dec 2025 20:18:18 +0100
Subject: [PATCH] kbuild: extract modules.builtin.modinfo from vmlinux.o

Partially reverse https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-6.18.y&id=39cfd5b12160be4f57df1c3ba60139741c827616
to prevent generation of empty modules.builtin.modinfo and modules.builtin
files that cause modules compilation errors.
If an out-of-tree package or any kernel-install rule ran modprobe xyz while
the build was still in progress, and xyz had been configured =y, a clean tree
would already have xyz listed in modules.builtin; with the empty file produced
by the buggy rule it was missing, so modprobe emitted "module xyz not found"
even though the code was sitting inside the freshly built vmlinux.

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
---
 scripts/Makefile.vmlinux | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/scripts/Makefile.vmlinux
+++ b/scripts/Makefile.vmlinux
@@ -119,7 +119,7 @@ quiet_cmd_modules_builtin_modinfo = GEN
 OBJCOPYFLAGS_modules.builtin.modinfo := -j .modinfo -O binary
 
 targets += modules.builtin.modinfo
-modules.builtin.modinfo: vmlinux.unstripped FORCE
+modules.builtin.modinfo: vmlinux.o FORCE
 	$(call if_changed,modules_builtin_modinfo)
 
 # modules.builtin
