Commit 0b7f12f5 authored by Masahiro Yamada's avatar Masahiro Yamada

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: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 8c5d4b64
...@@ -16,6 +16,12 @@ else ...@@ -16,6 +16,12 @@ else
S= S=
fi fi
if grep -q CONFIG_MODULES=y .config; then
M=
else
M=DEL
fi
if grep -q CONFIG_DRM=y .config; then if grep -q CONFIG_DRM=y .config; then
PROVIDES=kernel-drm PROVIDES=kernel-drm
fi fi
...@@ -30,6 +36,7 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \ ...@@ -30,6 +36,7 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \
# #
# Labels: # Labels:
# $S: this line is enabled only when building source package # $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 sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
Name: kernel Name: kernel
Summary: The Linux Kernel Summary: The Linux Kernel
...@@ -59,14 +66,14 @@ $S Source: kernel-$__KERNELRELEASE.tar.gz ...@@ -59,14 +66,14 @@ $S Source: kernel-$__KERNELRELEASE.tar.gz
building most standard programs and are also needed for rebuilding the building most standard programs and are also needed for rebuilding the
glibc package. glibc package.
$S %package devel $S$M %package devel
$S Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel $S$M Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel
$S Group: System Environment/Kernel $S$M Group: System Environment/Kernel
$S AutoReqProv: no $S$M AutoReqProv: no
$S %description -n kernel-devel $S$M %description -n kernel-devel
$S This package provides kernel headers and makefiles sufficient to build modules $S$M This package provides kernel headers and makefiles sufficient to build modules
$S against the $__KERNELRELEASE kernel package. $S$M against the $__KERNELRELEASE kernel package.
$S $S$M
$S %prep $S %prep
$S %setup -q $S %setup -q
$S $S
...@@ -82,19 +89,19 @@ $S ...@@ -82,19 +89,19 @@ $S
%else %else
cp \$(make image_name) \$RPM_BUILD_ROOT/boot/vmlinuz-$KERNELRELEASE cp \$(make image_name) \$RPM_BUILD_ROOT/boot/vmlinuz-$KERNELRELEASE
%endif %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 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 System.map \$RPM_BUILD_ROOT/boot/System.map-$KERNELRELEASE
cp .config \$RPM_BUILD_ROOT/boot/config-$KERNELRELEASE cp .config \$RPM_BUILD_ROOT/boot/config-$KERNELRELEASE
bzip2 -9 --keep vmlinux bzip2 -9 --keep vmlinux
mv vmlinux.bz2 \$RPM_BUILD_ROOT/boot/vmlinux-$KERNELRELEASE.bz2 mv vmlinux.bz2 \$RPM_BUILD_ROOT/boot/vmlinux-$KERNELRELEASE.bz2
$S rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/build $S$M rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/build
$S rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/source $S$M rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/source
$S mkdir -p \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE $S$M mkdir -p \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE
$S tar cf - . $EXCLUDES | tar xf - -C \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE $S$M tar cf - . $EXCLUDES | tar xf - -C \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE
$S cd \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE $S$M cd \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE
$S ln -sf /usr/src/kernels/$KERNELRELEASE build $S$M ln -sf /usr/src/kernels/$KERNELRELEASE build
$S ln -sf /usr/src/kernels/$KERNELRELEASE source $S$M ln -sf /usr/src/kernels/$KERNELRELEASE source
%clean %clean
rm -rf \$RPM_BUILD_ROOT rm -rf \$RPM_BUILD_ROOT
...@@ -120,18 +127,18 @@ $S ln -sf /usr/src/kernels/$KERNELRELEASE source ...@@ -120,18 +127,18 @@ $S ln -sf /usr/src/kernels/$KERNELRELEASE source
%files %files
%defattr (-, root, root) %defattr (-, root, root)
/lib/modules/$KERNELRELEASE $M /lib/modules/$KERNELRELEASE
%exclude /lib/modules/$KERNELRELEASE/build $M %exclude /lib/modules/$KERNELRELEASE/build
%exclude /lib/modules/$KERNELRELEASE/source $M %exclude /lib/modules/$KERNELRELEASE/source
/boot/* /boot/*
%files headers %files headers
%defattr (-, root, root) %defattr (-, root, root)
/usr/include /usr/include
$S $S$M
$S %files devel $S$M %files devel
$S %defattr (-, root, root) $S$M %defattr (-, root, root)
$S /usr/src/kernels/$KERNELRELEASE $S$M /usr/src/kernels/$KERNELRELEASE
$S /lib/modules/$KERNELRELEASE/build $S$M /lib/modules/$KERNELRELEASE/build
$S /lib/modules/$KERNELRELEASE/source $S$M /lib/modules/$KERNELRELEASE/source
EOF EOF
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment