summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2017-09-29 21:10:07 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-11-14 09:18:53 -0500
commit0b7f12f5912de636a9c1671ee343f31f21c42b2f (patch)
tree12131f4400c81b991961df72bd8b60b1cfffb5d7 /scripts
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')
-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
16 S= 16 S=
17fi 17fi
18 18
19if grep -q CONFIG_MODULES=y .config; then
20 M=
21else
22 M=DEL
23fi
24
19if grep -q CONFIG_DRM=y .config; then 25if grep -q CONFIG_DRM=y .config; then
20 PROVIDES=kernel-drm 26 PROVIDES=kernel-drm
21fi 27fi
@@ -30,6 +36,7 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=.tmp_versions --exclude=*vmlinux* \
30# 36#
31# Labels: 37# Labels:
32# $S: this line is enabled only when building source package 38# $S: this line is enabled only when building source package
39# $M: this line is enabled only when CONFIG_MODULES is enabled
33sed -e '/^DEL/d' -e 's/^\t*//' <<EOF 40sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
34 Name: kernel 41 Name: kernel
35 Summary: The Linux Kernel 42 Summary: The Linux Kernel
@@ -59,14 +66,14 @@ $S Source: kernel-$__KERNELRELEASE.tar.gz
59 building most standard programs and are also needed for rebuilding the 66 building most standard programs and are also needed for rebuilding the
60 glibc package. 67 glibc package.
61 68
62$S %package devel 69$S$M %package devel
63$S Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel 70$S$M Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel
64$S Group: System Environment/Kernel 71$S$M Group: System Environment/Kernel
65$S AutoReqProv: no 72$S$M AutoReqProv: no
66$S %description -n kernel-devel 73$S$M %description -n kernel-devel
67$S This package provides kernel headers and makefiles sufficient to build modules 74$S$M This package provides kernel headers and makefiles sufficient to build modules
68$S against the $__KERNELRELEASE kernel package. 75$S$M against the $__KERNELRELEASE kernel package.
69$S 76$S$M
70$S %prep 77$S %prep
71$S %setup -q 78$S %setup -q
72$S 79$S
@@ -82,19 +89,19 @@ $S
82 %else 89 %else
83 cp \$(make image_name) \$RPM_BUILD_ROOT/boot/vmlinuz-$KERNELRELEASE 90 cp \$(make image_name) \$RPM_BUILD_ROOT/boot/vmlinuz-$KERNELRELEASE
84 %endif 91 %endif
85 make %{?_smp_mflags} INSTALL_MOD_PATH=\$RPM_BUILD_ROOT KBUILD_SRC= modules_install 92$M make %{?_smp_mflags} INSTALL_MOD_PATH=\$RPM_BUILD_ROOT KBUILD_SRC= modules_install
86 make %{?_smp_mflags} INSTALL_HDR_PATH=\$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install 93 make %{?_smp_mflags} INSTALL_HDR_PATH=\$RPM_BUILD_ROOT/usr KBUILD_SRC= headers_install
87 cp System.map \$RPM_BUILD_ROOT/boot/System.map-$KERNELRELEASE 94 cp System.map \$RPM_BUILD_ROOT/boot/System.map-$KERNELRELEASE
88 cp .config \$RPM_BUILD_ROOT/boot/config-$KERNELRELEASE 95 cp .config \$RPM_BUILD_ROOT/boot/config-$KERNELRELEASE
89 bzip2 -9 --keep vmlinux 96 bzip2 -9 --keep vmlinux
90 mv vmlinux.bz2 \$RPM_BUILD_ROOT/boot/vmlinux-$KERNELRELEASE.bz2 97 mv vmlinux.bz2 \$RPM_BUILD_ROOT/boot/vmlinux-$KERNELRELEASE.bz2
91$S rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/build 98$S$M rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/build
92$S rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/source 99$S$M rm -f \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE/source
93$S mkdir -p \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE 100$S$M mkdir -p \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE
94$S tar cf - . $EXCLUDES | tar xf - -C \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE 101$S$M tar cf - . $EXCLUDES | tar xf - -C \$RPM_BUILD_ROOT/usr/src/kernels/$KERNELRELEASE
95$S cd \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE 102$S$M cd \$RPM_BUILD_ROOT/lib/modules/$KERNELRELEASE
96$S ln -sf /usr/src/kernels/$KERNELRELEASE build 103$S$M ln -sf /usr/src/kernels/$KERNELRELEASE build
97$S ln -sf /usr/src/kernels/$KERNELRELEASE source 104$S$M ln -sf /usr/src/kernels/$KERNELRELEASE source
98 105
99 %clean 106 %clean
100 rm -rf \$RPM_BUILD_ROOT 107 rm -rf \$RPM_BUILD_ROOT
@@ -120,18 +127,18 @@ $S ln -sf /usr/src/kernels/$KERNELRELEASE source
120 127
121 %files 128 %files
122 %defattr (-, root, root) 129 %defattr (-, root, root)
123 /lib/modules/$KERNELRELEASE 130$M /lib/modules/$KERNELRELEASE
124 %exclude /lib/modules/$KERNELRELEASE/build 131$M %exclude /lib/modules/$KERNELRELEASE/build
125 %exclude /lib/modules/$KERNELRELEASE/source 132$M %exclude /lib/modules/$KERNELRELEASE/source
126 /boot/* 133 /boot/*
127 134
128 %files headers 135 %files headers
129 %defattr (-, root, root) 136 %defattr (-, root, root)
130 /usr/include 137 /usr/include
131$S 138$S$M
132$S %files devel 139$S$M %files devel
133$S %defattr (-, root, root) 140$S$M %defattr (-, root, root)
134$S /usr/src/kernels/$KERNELRELEASE 141$S$M /usr/src/kernels/$KERNELRELEASE
135$S /lib/modules/$KERNELRELEASE/build 142$S$M /lib/modules/$KERNELRELEASE/build
136$S /lib/modules/$KERNELRELEASE/source 143$S$M /lib/modules/$KERNELRELEASE/source
137EOF 144EOF