kbuild: deb-pkg: do not build linux-headers package if CONFIG_MODULES=n
authorMasahiro Yamada <masahiroy@kernel.org>
Tue, 13 Oct 2020 18:38:19 +0000 (03:38 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Wed, 14 Oct 2020 03:49:34 +0000 (12:49 +0900)
Since commit 269a535ca931 ("modpost: generate vmlinux.symvers and
reuse it for the second modpost"), with CONFIG_MODULES disabled,
"make deb-pkg" (or "make bindeb-pkg") fails with:

  find: ‘Module.symvers’: No such file or directory

If CONFIG_MODULES is disabled, it doesn't really make sense to build
the linux-headers package.

Fixes: 269a535ca931 ("modpost: generate vmlinux.symvers and reuse it for the second modpost")
Reported-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
scripts/package/builddeb
scripts/package/mkdebian

index 6474084..1b11f89 100755 (executable)
@@ -207,8 +207,10 @@ EOF
 done
 
 if [ "$ARCH" != "um" ]; then
-       deploy_kernel_headers debian/linux-headers
-       create_package linux-headers-$version debian/linux-headers
+       if is_enabled CONFIG_MODULES; then
+               deploy_kernel_headers debian/linux-headers
+               create_package linux-headers-$version debian/linux-headers
+       fi
 
        deploy_libc_headers debian/linux-libc-dev
        create_package linux-libc-dev debian/linux-libc-dev
index 3a13b83..273fd6e 100755 (executable)
@@ -184,13 +184,6 @@ Description: Linux kernel, version $version
  This package contains the Linux kernel, modules and corresponding other
  files, version: $version.
 
-Package: $kernel_headers_packagename
-Architecture: $debarch
-Description: Linux kernel headers for $version on $debarch
- This package provides kernel header files for $version on $debarch
- .
- This is useful for people who need to build external modules
-
 Package: linux-libc-dev
 Section: devel
 Provides: linux-kernel-headers
@@ -201,6 +194,18 @@ Description: Linux support headers for userspace development
 Multi-Arch: same
 EOF
 
+if is_enabled CONFIG_MODULES; then
+cat <<EOF >> debian/control
+
+Package: $kernel_headers_packagename
+Architecture: $debarch
+Description: Linux kernel headers for $version on $debarch
+ This package provides kernel header files for $version on $debarch
+ .
+ This is useful for people who need to build external modules
+EOF
+fi
+
 if is_enabled CONFIG_DEBUG_INFO; then
 cat <<EOF >> debian/control