Skip to content

Commit 1789fc9

Browse files
committed
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: Masahiro Yamada <[email protected]>
1 parent d4f6512 commit 1789fc9

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

scripts/Makefile.package

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ srcrpm-pkg: linux.tar.gz
8686
# ---------------------------------------------------------------------------
8787
PHONY += binrpm-pkg
8888
binrpm-pkg:
89-
$(MAKE) -f $(srctree)/Makefile
9089
$(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec
9190
+rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \
9291
$(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec \
92+
--build-in-place --noprep --define='_smp_mflags %{nil}' \
9393
--define='make $(MAKE)'
9494

9595
# deb-pkg srcdeb-pkg bindeb-pkg

scripts/package/mkspec

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ fi
3535
sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
3636
%define ARCH ${ARCH}
3737
%define KERNELRELEASE ${KERNELRELEASE}
38+
%define pkg_release $("${srctree}/init/build-version")
3839
3940
# _arch is undefined if /usr/lib/rpm/platform/*/macros was not included.
4041
%{!?_arch: %define _arch dummy}
@@ -44,18 +45,18 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
4445
Name: kernel
4546
Summary: The Linux Kernel
4647
Version: %(echo %{KERNELRELEASE} | sed -e 's/-/_/g')
47-
Release: $(cat .version 2>/dev/null || echo 1)
48+
Release: %{pkg_release}
4849
License: GPL
4950
Group: System Environment/Kernel
5051
Vendor: The Linux Community
5152
URL: https://www.kernel.org
52-
$S Source0: linux.tar.gz
53-
$S Source1: config
54-
$S Source2: diff.patch
53+
Source0: linux.tar.gz
54+
Source1: config
55+
Source2: diff.patch
5556
Provides: kernel-%{KERNELRELEASE}
56-
$S BuildRequires: bc binutils bison dwarves
57-
$S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
58-
$S BuildRequires: gcc make openssl openssl-devel perl python3 rsync
57+
BuildRequires: bc binutils bison dwarves
58+
BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
59+
BuildRequires: gcc make openssl openssl-devel perl python3 rsync
5960
6061
%define __spec_install_post /usr/lib/rpm/brp-compress || :
6162
%define debug_package %{nil}
@@ -83,14 +84,14 @@ $S$M %description -n kernel-devel
8384
$S$M This package provides kernel headers and makefiles sufficient to build modules
8485
$S$M against the %{version} kernel package.
8586
$S$M
86-
$S %prep
87-
$S %setup -q -n linux
88-
$S cp %{SOURCE1} .config
89-
$S patch -p1 < %{SOURCE2}
90-
$S
91-
$S %build
92-
$S %{make} %{makeflags} KERNELRELEASE=%{KERNELRELEASE} KBUILD_BUILD_VERSION=%{release}
93-
$S
87+
%prep
88+
%setup -q -n linux
89+
cp %{SOURCE1} .config
90+
patch -p1 < %{SOURCE2}
91+
92+
%build
93+
%{make} %{makeflags} KERNELRELEASE=%{KERNELRELEASE} KBUILD_BUILD_VERSION=%{release}
94+
9495
%install
9596
mkdir -p %{buildroot}/boot
9697
%ifarch ia64

0 commit comments

Comments
 (0)