summaryrefslogtreecommitdiff
path: root/scripts/package
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-09-30 10:10:07 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-11-14 23:18:53 +0900
commit0b7f12f5912de636a9c1671ee343f31f21c42b2f (patch)
tree12131f4400c81b991961df72bd8b60b1cfffb5d7 /scripts/package
parent8c5d4b648b46b3f5b721b9aff021c9f639d42c35 (diff)
kbuild: rpm-pkg: fix build error when CONFIG_MODULES is disabled
When CONFIG_MODULES is disabled, make rpm-pkg / binrpm-pkg fails with the following message: The present kernel configuration has modules disabled. Type 'make config' and enable loadable module support. Then build a kernel with module support enabled. Do not install modules in the case. Also, omit the devel package. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/package')
-rwxr-xr-xscripts/package/mkspec57
1 files changed, 32 insertions, 25 deletions
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index b341d5d8e793..d352a0188770 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -16,6 +16,12 @@ else
S=
fi
+if grep -q CONFIG_MODULES=y .config; then
+ M=
+else
+ M=DEL
+fi
+
if grep -q CONFIG_DRM=y .config; then
PROVIDES=kernel-drm
fi
@@ -30,6 +36,7 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \
#
# Labels:
# $S: this line is enabled only when building source package
+# $M: this line is enabled only when CONFIG_MODULES is enabled
sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
Name: kernel
Summary: The Linux Kernel
@@ -59,14 +66,14 @@ $S Source: kernel-$__KERNELRELEASE.tar.gz
building most standard programs and are also needed for rebuilding the
glibc package.
-$S %package devel
-$S Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel
-$S Group: System Environment/Kernel
-$S AutoReqProv: no
-$S %description -n kernel-devel
-$S This package provides kernel headers and makefiles sufficient to build modules
-$S against the $__KERNELRELEASE kernel package.
-$S
+$S$M %package devel
+$S$M Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel
+$S$M Group: System Environment/Kernel
+$S$M AutoReqProv: no
+$S$M %description -n kernel-devel
+$S$M This package provides kernel headers and makefiles sufficient to build modules
+$S$M against the $__KERNELRELEASE kernel package.
+$S$M
$S %prep
$S %setup -q
$S
@@ -82,19 +89,19 @@ $S
%else
cp \$(make image_name) \$RPM_BUILD_ROOT/boot/vmlinuz-$KERNELRELEASE
%endif
- make %{?_smp_mflags} INSTALL_MOD_PATH=\$RPM_BUILD_ROOT KBUILD_SRC= modules_install
+$M make %{?_smp_mflags} INSTALL_MOD_PATH=\$RPM_BUILD_ROOT KBUILD_SRC= modules_install
make %{?_smp_mflags} INSTALL_HDR_PATH=\$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install
cp System.map \$RPM_BUILD_ROOT/boot/System.map-$KERNELRELEASE
cp .config \$RPM_BUILD_ROOT/boot/config-$KERNELRELEASE
bzip2 -9 --keep vmlinux
mv vmlinux.bz2 \$RPM_BUILD_ROOT/boot/vmlinux-$KERNELRELEASE.bz2
-$S rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/build
-$S rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/source
-$S mkdir -p \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE
-$S tar cf - . $EXCLUDES | tar xf - -C \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE
-$S cd \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE
-$S ln -sf /usr/src/kernels/$KERNELRELEASE build
-$S ln -sf /usr/src/kernels/$KERNELRELEASE source
+$S$M rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/build
+$S$M rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/source
+$S$M mkdir -p \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE
+$S$M tar cf - . $EXCLUDES | tar xf - -C \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE
+$S$M cd \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE
+$S$M ln -sf /usr/src/kernels/$KERNELRELEASE build
+$S$M ln -sf /usr/src/kernels/$KERNELRELEASE source
%clean
rm -rf \$RPM_BUILD_ROOT
@@ -120,18 +127,18 @@ $S ln -sf /usr/src/kernels/$KERNELRELEASE source
%files
%defattr (-, root, root)
- /lib/modules/$KERNELRELEASE
- %exclude /lib/modules/$KERNELRELEASE/build
- %exclude /lib/modules/$KERNELRELEASE/source
+$M /lib/modules/$KERNELRELEASE
+$M %exclude /lib/modules/$KERNELRELEASE/build
+$M %exclude /lib/modules/$KERNELRELEASE/source
/boot/*
%files headers
%defattr (-, root, root)
/usr/include
-$S
-$S %files devel
-$S %defattr (-, root, root)
-$S /usr/src/kernels/$KERNELRELEASE
-$S /lib/modules/$KERNELRELEASE/build
-$S /lib/modules/$KERNELRELEASE/source
+$S$M
+$S$M %files devel
+$S$M %defattr (-, root, root)
+$S$M /usr/src/kernels/$KERNELRELEASE
+$S$M /lib/modules/$KERNELRELEASE/build
+$S$M /lib/modules/$KERNELRELEASE/source
EOF