All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: linux-kbuild@vger.kernel.org
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>,
	Michal Marek <mmarek@suse.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 5/9] kbuild: rpm-pkg: fix build error when CONFIG_MODULES is disabled
Date: Sat, 30 Sep 2017 10:10:07 +0900	[thread overview]
Message-ID: <1506733811-24636-5-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1506733811-24636-1-git-send-email-yamada.masahiro@socionext.com>

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>
---

 scripts/package/mkspec | 57 ++++++++++++++++++++++++++++----------------------
 1 file changed, 32 insertions(+), 25 deletions(-)

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index f34e3bf..8a9ab85 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
-- 
2.7.4

  parent reply	other threads:[~2017-09-30  1:10 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-30  1:10 [PATCH 1/9] kbuild: rpm-pkg: remove ppc64 specific image handling Masahiro Yamada
2017-09-30  1:10 ` [PATCH 2/9] kbuild: rpm-pkg: install vmlinux.bz2 unconditionally Masahiro Yamada
2017-09-30  1:10 ` [PATCH 3/9] kbuild: rpm-pkg: clean up mkspec Masahiro Yamada
2017-09-30  1:10 ` [PATCH 4/9] kbuild: rpm-pkg: refactor mkspec with here doc Masahiro Yamada
2017-09-30  1:10 ` Masahiro Yamada [this message]
2017-09-30  1:10 ` [PATCH 6/9] kbuild: rpm-pkg: replace $RPM_BUILD_ROOT with %{buildroot} Masahiro Yamada
2017-09-30  1:10 ` [PATCH 7/9] kbuild: rpm-pkg: fix jobserver unavailable warning Masahiro Yamada
2017-09-30  1:10 ` [PATCH 8/9] kbuild: rpm-pkg: keep spec file until make mrproper Masahiro Yamada
2017-09-30  1:10 ` [PATCH 9/9] kbuild: rpm-pkg: do not force -jN in submake Masahiro Yamada
2017-10-09 16:43 ` [PATCH 1/9] kbuild: rpm-pkg: remove ppc64 specific image handling Masahiro Yamada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1506733811-24636-5-git-send-email-yamada.masahiro@socionext.com \
    --to=yamada.masahiro@socionext.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmarek@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.