lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230722044806.3867434-12-masahiroy@kernel.org>
Date:   Sat, 22 Jul 2023 13:47:59 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     linux-kbuild@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org,
        Masahiro Yamada <masahiroy@...nel.org>,
        Nathan Chancellor <nathan@...nel.org>,
        Nick Desaulniers <ndesaulniers@...gle.com>,
        Nicolas Schier <nicolas@...sle.eu>
Subject: [PATCH 12/19] 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 <masahiroy@...nel.org>
---

 scripts/Makefile.package |  2 +-
 scripts/package/mkspec   | 31 ++++++++++++++++---------------
 2 files changed, 17 insertions(+), 16 deletions(-)

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ