Commit 1789fc91 authored by Masahiro Yamada's avatar Masahiro Yamada

kbuild: rpm-pkg: invoke the kernel build from rpmbuild for binrpm-pkg

To reduce the preprocess of the spec file, invoke the kernel build
from rpmbuild.

Run init/build-version to increment the release number not only for
binrpm-pkg but also for srcrpm-pkg and rpm-pkg.
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
parent d4f65127
...@@ -86,10 +86,10 @@ srcrpm-pkg: linux.tar.gz ...@@ -86,10 +86,10 @@ srcrpm-pkg: linux.tar.gz
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
PHONY += binrpm-pkg PHONY += binrpm-pkg
binrpm-pkg: binrpm-pkg:
$(MAKE) -f $(srctree)/Makefile
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec
+rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ +rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
$(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec \ $(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec \
--build-in-place --noprep --define='_smp_mflags %{nil}' \
--define='make $(MAKE)' --define='make $(MAKE)'
# deb-pkg srcdeb-pkg bindeb-pkg # deb-pkg srcdeb-pkg bindeb-pkg
......
...@@ -35,6 +35,7 @@ fi ...@@ -35,6 +35,7 @@ fi
sed -e '/^DEL/d' -e 's/^\t*//' <<EOF sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
%define ARCH ${ARCH} %define ARCH ${ARCH}
%define KERNELRELEASE ${KERNELRELEASE} %define KERNELRELEASE ${KERNELRELEASE}
%define pkg_release $("${srctree}/init/build-version")
# _arch is undefined if /usr/lib/rpm/platform/*/macros was not included. # _arch is undefined if /usr/lib/rpm/platform/*/macros was not included.
%{!?_arch: %define _arch dummy} %{!?_arch: %define _arch dummy}
...@@ -44,18 +45,18 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF ...@@ -44,18 +45,18 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
Name: kernel Name: kernel
Summary: The Linux Kernel Summary: The Linux Kernel
Version: %(echo %{KERNELRELEASE} | sed -e 's/-/_/g') Version: %(echo %{KERNELRELEASE} | sed -e 's/-/_/g')
Release: $(cat .version 2>/dev/null || echo 1) Release: %{pkg_release}
License: GPL License: GPL
Group: System Environment/Kernel Group: System Environment/Kernel
Vendor: The Linux Community Vendor: The Linux Community
URL: https://www.kernel.org URL: https://www.kernel.org
$S Source0: linux.tar.gz Source0: linux.tar.gz
$S Source1: config Source1: config
$S Source2: diff.patch Source2: diff.patch
Provides: kernel-%{KERNELRELEASE} Provides: kernel-%{KERNELRELEASE}
$S BuildRequires: bc binutils bison dwarves BuildRequires: bc binutils bison dwarves
$S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
$S BuildRequires: gcc make openssl openssl-devel perl python3 rsync BuildRequires: gcc make openssl openssl-devel perl python3 rsync
%define __spec_install_post /usr/lib/rpm/brp-compress || : %define __spec_install_post /usr/lib/rpm/brp-compress || :
%define debug_package %{nil} %define debug_package %{nil}
...@@ -83,14 +84,14 @@ $S$M %description -n kernel-devel ...@@ -83,14 +84,14 @@ $S$M %description -n kernel-devel
$S$M 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$M against the %{version} kernel package. $S$M against the %{version} kernel package.
$S$M $S$M
$S %prep %prep
$S %setup -q -n linux %setup -q -n linux
$S cp %{SOURCE1} .config cp %{SOURCE1} .config
$S patch -p1 < %{SOURCE2} patch -p1 < %{SOURCE2}
$S
$S %build %build
$S %{make} %{makeflags} KERNELRELEASE=%{KERNELRELEASE} KBUILD_BUILD_VERSION=%{release} %{make} %{makeflags} KERNELRELEASE=%{KERNELRELEASE} KBUILD_BUILD_VERSION=%{release}
$S
%install %install
mkdir -p %{buildroot}/boot mkdir -p %{buildroot}/boot
%ifarch ia64 %ifarch ia64
......
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