diff mbox series

kbuild: rpm-pkg: fix build error with CONFIG_MODULES=n

Message ID 20240616170516.502261-1-masahiroy@kernel.org (mailing list archive)
State New
Headers show
Series kbuild: rpm-pkg: fix build error with CONFIG_MODULES=n | expand

Commit Message

Masahiro Yamada June 16, 2024, 5:05 p.m. UTC
When CONFIG_MODULES is disabled, 'make (bin)rpm-pkg' fails.

  $ make allnoconfig binrpm-pkg
    [ snip ]
  error: File not found: .../linux/rpmbuild/BUILDROOT/kernel-6.10.0_rc3-1.i386/lib/modules/6.10.0-rc3/kernel
  error: File not found: .../linux/rpmbuild/BUILDROOT/kernel-6.10.0_rc3-1.i386/lib/modules/6.10.0-rc3/modules.order

Fixes: 615b3a3d2d41 ("kbuild: rpm-pkg: do not include depmod-generated files")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/package/kernel.spec | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index 19e458341f45..f1c7a5ea338f 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -70,13 +70,11 @@  ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
 %endif
 
 {
-	for x in System.map config kernel modules.builtin \
-			modules.builtin.modinfo modules.order vmlinuz; do
-		echo "/lib/modules/%{KERNELRELEASE}/${x}"
-	done
+	echo "/lib/modules/%{KERNELRELEASE}"
 
 	for x in alias alias.bin builtin.alias.bin builtin.bin dep dep.bin \
 					devname softdep symbols symbols.bin; do
+		rm -f "%{buildroot}/lib/modules/%{KERNELRELEASE}/modules.${x}"
 		echo "%ghost /lib/modules/%{KERNELRELEASE}/modules.${x}"
 	done