From patchwork Sat Jul 22 04:47:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13322768 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AE37EB64DA for ; Sat, 22 Jul 2023 04:48:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229872AbjGVEsT (ORCPT ); Sat, 22 Jul 2023 00:48:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjGVEsR (ORCPT ); Sat, 22 Jul 2023 00:48:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDAF03583; Fri, 21 Jul 2023 21:48:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7354560A50; Sat, 22 Jul 2023 04:48:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEBB8C433C8; Sat, 22 Jul 2023 04:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001295; bh=to0i+TXIMK7bCy8RaewkN9+QjUncbqhaUH3zl5VbVio=; h=From:To:Cc:Subject:Date:From; b=E0Dmzn2ghuAuyAi1IgYuH4ejF8Z0Xj2/p4wYLJKDRrThlNiyRjhaLkw1zH4NOxMcB 3QKmJChruhyHnBrqZCO1SF8Ej7yAzL4vlrwhFkshLNhoQCxR49xiLWSTazLK9zSEcC LfVwjc/E/dMkbfT9X0US4ypv9fJeLuV3Uol3/tlaPZmpz7Efo96+eux4ivkktrgsoa SNFXGGmluQ6RE1Hi5QhGJeznxBa5hTIn+ay/fetmaOGeut5VzkJ7ZrcQnIG4nXQ41n mYIoyZvpAtKjL1DRQpjwfSk4h/HfFF0u/uwMXQhJE+gzsC/30R5fDaaifCEOTcbOv/ +CUc7nKq3Rqgg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 01/19] kbuild: rpm-pkg: define _arch conditionally Date: Sat, 22 Jul 2023 13:47:48 +0900 Message-Id: <20230722044806.3867434-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Commit 3089b2be0cce ("kbuild: rpm-pkg: fix build error when _arch is undefined") does not work as intended; _arch is always defined as $UTS_MACHINE. The intention was to define _arch to $UTS_MACHINE only when it is not defined. Fixes: 3089b2be0cce ("kbuild: rpm-pkg: fix build error when _arch is undefined") Signed-off-by: Masahiro Yamada --- scripts/package/mkspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 8049f0e2c110..c9299f9c1f3e 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -57,7 +57,7 @@ $S BuildRequires: gcc make openssl openssl-devel perl python3 rsync # $UTS_MACHINE as a fallback of _arch in case # /usr/lib/rpm/platform/*/macros was not included. - %define _arch %{?_arch:$UTS_MACHINE} + %{!?_arch: %define _arch $UTS_MACHINE} %define __spec_install_post /usr/lib/rpm/brp-compress || : %define debug_package %{nil} From patchwork Sat Jul 22 04:47:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13322769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57480C001DC for ; Sat, 22 Jul 2023 04:48:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbjGVEsU (ORCPT ); Sat, 22 Jul 2023 00:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229797AbjGVEsT (ORCPT ); Sat, 22 Jul 2023 00:48:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 608E13ABA; Fri, 21 Jul 2023 21:48:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EFBE260A51; Sat, 22 Jul 2023 04:48:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47478C433C9; Sat, 22 Jul 2023 04:48:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001297; bh=CDil0JK2xmUHuM70QKfOZW0pk8H2R7ZRW4rGvSI1TTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GXeCIRVombrbgT0Y07kWVLU/V7YkpYnP+NN4JBZxBqvg3m5d8u9RbLLqio+iloFxi y3PWAG0rfHznRAhmFL0p3CmBzfR+/DmhSwinrswO6BPHoEEn2YUBVjjETXDFMbQI22 BaSbJJUfo8sb01+RTgiDi6ChZwr9T/hdDtawJVT9LfPZq3Z1sgJSY9DmdMttIZN+IN 41Bq7qDEt/TWjsrvlqzUMzaPTw+rSDSnZdNEvnjJpKyKGCWdd89hXY0dinks1s5yq/ YFJjiN5UgtJxGfrUekikG6KeGnDcb5Vk2pbyniToR6UminDnKCRevw27kAq1pM2XtG +DRmtLaN9rcrQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 02/19] kbuild: rpm-pkg: remove unneeded '-f $srctree/Makefile' in spec file Date: Sat, 22 Jul 2023 13:47:49 +0900 Message-Id: <20230722044806.3867434-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org This is unneeded because the Makefile in the output directory wraps the top-level Makefile in the srctree. Just run $MAKE irrespective of the build location. Signed-off-by: Masahiro Yamada --- scripts/package/mkspec | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index c9299f9c1f3e..a83b17b4a0d9 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -12,7 +12,6 @@ # how we were called determines which rpms we build and how we build them if [ "$1" = prebuilt ]; then S=DEL - MAKE="$MAKE -f $srctree/Makefile" else S= From patchwork Sat Jul 22 04:47:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13322770 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D891C001B0 for ; Sat, 22 Jul 2023 04:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229713AbjGVEsV (ORCPT ); Sat, 22 Jul 2023 00:48:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230141AbjGVEsV (ORCPT ); Sat, 22 Jul 2023 00:48:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D49173583; Fri, 21 Jul 2023 21:48:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7364160A4C; Sat, 22 Jul 2023 04:48:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C53EFC433CB; Sat, 22 Jul 2023 04:48:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001298; bh=b+tgQJzqqP7hzh4EZCRAABtIzrvO2u08e4LOuvHC6/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X5J6n3mnOrcTUsbm2l4+l1/oNSQmhesOSf2I+V9TO7cg2A8V85HP8E/k3IjYk+sct U9TBvU1sq3kgockPpAAK37eBAFtY2IvUu5LmTyA7fmI0rOfx1qlcGubZeL4N9jFN+Y KZ1LHYJe6c0gJMTAaUkZKHCNsbnUOFliaOxi8Lv2VGOc9VuhrLcY4m7UnD7GUAfQNy 9OjtMMmFvGeFpjDamtSZYuBA0jXdR/ZbgydZJ4XHJu9nzeLT2zbL1aJA7hh7d+HZnb +LYw39R+jzVi/2tE5aZYhAOsylsm6TMqu9z5CqOW659Uao6ezwpUF26myGiaFwxYBB m55B8EtN/3j8g== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 03/19] kbuild: rpm-pkg: do not hard-code $MAKE in spec file Date: Sat, 22 Jul 2023 13:47:50 +0900 Message-Id: <20230722044806.3867434-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Currently, $MAKE will expand to the GNU Make program that created the source RPM. This is problematic if you carry it to a different build host to run 'rpmbuild' there. Consider this command: $ /path/to/my/custom/make srcrpm-pkg The spec file in the SRPM will record '/path/to/my/custom/make', which exists only on that build environment. To create a portable SRPM, the spec file should avoid hard-coding $MAKE. Signed-off-by: Masahiro Yamada --- scripts/Makefile.package | 5 +++-- scripts/package/mkspec | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 92dbc889bd7c..e9217e997c68 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -72,7 +72,7 @@ PHONY += rpm-pkg rpm-pkg: srpm = $(shell rpmspec --srpm --query --queryformat='%{name}-%{VERSION}-%{RELEASE}.src.rpm' kernel.spec) rpm-pkg: srcrpm-pkg +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -rb $(srpm) \ - --define='_smp_mflags %{nil}' + --define='_smp_mflags %{nil}' --define='make $(MAKE)' # srcrpm-pkg # --------------------------------------------------------------------------- @@ -89,7 +89,8 @@ 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 + $(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec \ + --define='make $(MAKE)' # deb-pkg srcdeb-pkg bindeb-pkg # --------------------------------------------------------------------------- diff --git a/scripts/package/mkspec b/scripts/package/mkspec index a83b17b4a0d9..9b2b4386019d 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -38,6 +38,8 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \ # $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*//' < X-Patchwork-Id: 13322771 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77675C001B0 for ; Sat, 22 Jul 2023 04:48:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230232AbjGVEsY (ORCPT ); Sat, 22 Jul 2023 00:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjGVEsW (ORCPT ); Sat, 22 Jul 2023 00:48:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61D043583; Fri, 21 Jul 2023 21:48:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ECDE960A57; Sat, 22 Jul 2023 04:48:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CBB4C433CA; Sat, 22 Jul 2023 04:48:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001300; bh=8bWzrXDFr490RC9P5zcq6jqr8is5wzIWgnKM5w+Z3y0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g6UumIi0rFoYZ6kXBy48R132DOo8EDMKwo0NcId/amxMXv9Oj32Ht82zOeNtZdiro chnCcXClRykreyPTAifA8hUYZXdJhv6sO8Z6xv7A7Aezx7qT2lT6uNiUf3a7zK69YH oWZTlseQqt3l1EQBreIAEM31VZVmqKHSlOWaMvD1Iy5GdpBuAsO+NPLtQljIs8XfvN /+C7Xyxcrqdp+LQ7XZkJ4VTaNQh1sOJGWWAPL4mQ/b1cx+bAheb5MsvwzxbQmyucpr 28wMASJNIfKL4soQC/o9dSZHfaRUM5OCPCQ//QGreDUiGD2GaUQrNykQGjn/MJBq7T ghXhvJFHFw92w== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 04/19] kbuild: rpm-pkg: use %{makeflags} to pass common Make options Date: Sat, 22 Jul 2023 13:47:51 +0900 Message-Id: <20230722044806.3867434-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org This is useful to pass more common Make options. Signed-off-by: Masahiro Yamada --- scripts/package/mkspec | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 9b2b4386019d..a1ce6677880a 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -39,6 +39,7 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \ # $M: this line is enabled only when CONFIG_MODULES is enabled sed -e '/^DEL/d' -e 's/^\t*//' < X-Patchwork-Id: 13322772 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C360FC001DC for ; Sat, 22 Jul 2023 04:48:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230442AbjGVEsa (ORCPT ); Sat, 22 Jul 2023 00:48:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbjGVEsX (ORCPT ); Sat, 22 Jul 2023 00:48:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD5333ABD; Fri, 21 Jul 2023 21:48:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6BBB460A51; Sat, 22 Jul 2023 04:48:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C30ECC433CC; Sat, 22 Jul 2023 04:48:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001301; bh=t8YlK1uWf9LCj4heDmlRtPcElfIsnxIYNXcfywQoPUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uxEWXM0e+9QgvIdfQvgcDoqV9m3IEmvla0iVylQM5PT1J2ODdzugzDYm3EG4sEuED lST9iTrfjYxA5Zkfrzcoqfv0RdhhLwaXXCrpKa7udV9SvkZ/tGy2CqDgz3IGJeuOhT LevupHhDm6OaLeNnB3dAvhQ+NSAclWISXZA9+iV4QQ6DJixQkFUuaUqS0w5gk3wdoP anML9gFduWlZeRoEh9ebtThfiuAvSAbMOalX/5nTVtjnfFL6AzjYrs2DzojLy2DBZd WO2ukqtqQmCDF6V20TTb4neErFh/QbBjCIGNtKCvGf9SCN5/nVsyaLVC76bJshobn1 MW5yM9pwoZP3Q== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 05/19] kbuild: rpm-pkg: record ARCH option in spec file Date: Sat, 22 Jul 2023 13:47:52 +0900 Message-Id: <20230722044806.3867434-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Currently, we rely on the top Makefile defining ARCH option when we run 'make rpm-pkg' or 'make binrpm-pkg'. It does not apply when we run 'make srcrpm-pkg', and separately run 'rpmbuild' for the generated SRPM. This is a problem for cross-build. Just like the Debian package, save the value of ARCH in the spec file. Signed-off-by: Masahiro Yamada --- scripts/package/mkspec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index a1ce6677880a..0befb4e2ac6b 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -38,8 +38,10 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \ # $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*//' < X-Patchwork-Id: 13322773 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B165EEB64DA for ; Sat, 22 Jul 2023 04:48:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230502AbjGVEse (ORCPT ); Sat, 22 Jul 2023 00:48:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230246AbjGVEsZ (ORCPT ); Sat, 22 Jul 2023 00:48:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B5A03ABA; Fri, 21 Jul 2023 21:48:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E798560A58; Sat, 22 Jul 2023 04:48:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47903C433C9; Sat, 22 Jul 2023 04:48:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001303; bh=cMGx1e3bJT94xzdbCntW6kEvaWujCMXDy0LRihc5JIA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FnAa9e+bbFLQ9QTWiAxYlX7jtdd0t90rvszunjXfUFFqB0prlfD+VXDhH8MGCsa6i AQQknk/x5+zKszJz2A9LkkzgEUnq321T8Fbt7e2K6vb0nv2rWY1ap5FzgnMwYJqTQh 40Bl5569+R5cxcxgqJWpEfGowVsnj5PAGBGKlE0aVw2WW6UXLNEaPn9CtzUVouXdGK neY06HwkY+E3oHHZUjZnrDUThANqQTi9l5Wg0Kd9FcWHkKTdh3BJJRJiwfPCIYXI8L dFbWqiISLGNd04ghejk76ClpextopA702OvUFQtMYfRj0PHVBtLPVwlfTfVsk8YaRp Zy3Bs0irIIIoA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 06/19] kbuild: rpm-pkg: replace $__KERNELRELEASE in spec file with %{version} Date: Sat, 22 Jul 2023 13:47:53 +0900 Message-Id: <20230722044806.3867434-6-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org ${version} will be replaced with the value of the Version field. Signed-off-by: Masahiro Yamada --- scripts/package/mkspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 0befb4e2ac6b..a6a383aaaea7 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -81,12 +81,12 @@ $S BuildRequires: gcc make openssl openssl-devel perl python3 rsync glibc package. $S$M %package devel -$S$M Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel +$S$M Summary: Development package for building kernel modules to match the %{version} 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 against the %{version} kernel package. $S$M $S %prep $S %setup -q -n linux From patchwork Sat Jul 22 04:47:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13322774 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED3C0EB64DA for ; Sat, 22 Jul 2023 04:48:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229971AbjGVEs5 (ORCPT ); Sat, 22 Jul 2023 00:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230309AbjGVEs1 (ORCPT ); Sat, 22 Jul 2023 00:48:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF9E83C0A; Fri, 21 Jul 2023 21:48:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6872460A4C; Sat, 22 Jul 2023 04:48:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEF7BC433CC; Sat, 22 Jul 2023 04:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001304; bh=VV5tg2oV5uhqxjDebBRYN7lAbnxJg/0q4gs6El0Bz/M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mG08w/YO2AVy4RvhlsZYRzU8pZ7AOynAFV251+7dUAQpeLDr1wrX6xYt+W3+8fKtR wwhZySwk/6Yn49cDO/EzC/F6iKyyHLB8hiu4fUvVsHTUb8hfie25cCiwMl9fyPvgb/ licrRafLcsQK5IOU5RdwNE7AWRynJZB0bStUf/nfYmC2O/ycmkr+HJi/SwiICuu+jC wJC195JJ1ouMd9Qaq/qHAzNrjYKb3a9y1H6/UEKgjLL5x4m03YL4abKtW4NtY3Zsle LnV1g/BfowWXyKagezKfu1wsu3mfGmCbAwHUWq5/H/NY3H5yB3qFLUwdB9J99awvOp BavFmJ8F7OGkA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 07/19] kbuild: rpm-pkg: replace $KERNELRELEASE in spec file with %{KERNELRELEASE} Date: Sat, 22 Jul 2023 13:47:54 +0900 Message-Id: <20230722044806.3867434-7-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Avoid hard-coding the value of KERNELRELEASE in the generated spec file. Signed-off-by: Masahiro Yamada --- scripts/package/mkspec | 59 +++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index a6a383aaaea7..34b2489106cf 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -39,6 +39,7 @@ EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \ # $M: this line is enabled only when CONFIG_MODULES is enabled sed -e '/^DEL/d' -e 's/^\t*//' < X-Patchwork-Id: 13322775 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18655EB64DA for ; Sat, 22 Jul 2023 04:49:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230429AbjGVEtH (ORCPT ); Sat, 22 Jul 2023 00:49:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229757AbjGVEse (ORCPT ); Sat, 22 Jul 2023 00:48:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79CF03C1B; Fri, 21 Jul 2023 21:48:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E733C60A51; Sat, 22 Jul 2023 04:48:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44787C433C7; Sat, 22 Jul 2023 04:48:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001306; bh=Tseeay/kHUJT/g4fC6akk3UE+1foZq5ZUvDTIeFuPSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MggZCs3OIoVl/nagMrqEkVze7pAPoBo9PJ+hhthCiO1gzwf8rVkCN4IqQbgoGmuPd PxUaoXZW/6AdTVTHxFY9HgOt/anClFxO+zecXP/aSBC845lvPEAIxNSYVUBz/3WAoO BiLfjYE5kRHA0JieR58PbuD2l1oDulHtxXM1K1KaoG+6+LXBbI1BRqHt/lYvJc7Fzu srAPxNuAjYOFMF1Pp6p2nK5THIalvJpWOsctU98NvxqRexH4yvwKQS8zdBAT8DgmZZ HnzdUOXoHvsrQ7iqgnmtwdvk2UaXWgWukZeaPzRJQXDqyxLgrMdKa7geI0hXdd8tuK cgGfBq9z7nVXw== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 08/19] kbuild: add a phony target to run a command with Kbuild env vars Date: Sat, 22 Jul 2023 13:47:55 +0900 Message-Id: <20230722044806.3867434-8-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org There are some cases where we want to run a command with the same environment variables as Kbuild uses. For example, 'make coccicheck' invokes scripts/coccicheck from the top Makefile so that the script can reference to ${LINUXINCLUDE}, ${KBUILD_EXTMOD}, etc. The top Makefile defines several phony targets that run a script. We do it also for an internally used script, which results in a somewhat complex call graph. One example: debian/rules binary-arch -> make intdeb-pkg -> scripts/package/builddeb It is also tedious to add a dedicated target like 'intdeb-pkg' for each use case. Add a generic target 'run-command' to run an arbitrary command in an environment with all Kbuild variables set. The usage is: $ make run-command KBUILD_RUN_COMMAND= The concept is similar to: $ dpkg-architecture -c This executes in an environment which has all DEB_* variables defined. Convert the existing 'make intdeb-pkg'. Another possible usage is to interrogate a Make variable. $ make run-command KBUILD_RUN_COMMAND='echo $(KBUILD_CFLAGS)' might be useful to see KBUILD_CFLAGS set by the top Makefile. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- Makefile | 4 ++++ scripts/Makefile.package | 4 ---- scripts/package/mkdebian | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 47690c28456a..f258ef13fa5d 100644 --- a/Makefile +++ b/Makefile @@ -2133,6 +2133,10 @@ kernelversion: image_name: @echo $(KBUILD_IMAGE) +PHONY += run-command +run-command: + $(Q)$(KBUILD_RUN_COMMAND) + quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) cmd_rmfiles = rm -rf $(rm-files) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index e9217e997c68..7cd61a374dae 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -146,10 +146,6 @@ deb-pkg srcdeb-pkg bindeb-pkg: --no-check-builddeps) \ $(DPKG_FLAGS)) -PHONY += intdeb-pkg -intdeb-pkg: - +$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb - # snap-pkg # --------------------------------------------------------------------------- PHONY += snap-pkg diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian index ba2453e08d40..9105abab9728 100755 --- a/scripts/package/mkdebian +++ b/scripts/package/mkdebian @@ -283,7 +283,8 @@ build: build-arch binary-indep: binary-arch: build-arch \$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \ - KERNELRELEASE=\$(KERNELRELEASE) intdeb-pkg + KERNELRELEASE=\$(KERNELRELEASE) \ + run-command KBUILD_RUN_COMMAND=+\$(srctree)/scripts/package/builddeb clean: rm -rf debian/files debian/linux-* From patchwork Sat Jul 22 04:47:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13322776 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14128EB64DA for ; Sat, 22 Jul 2023 04:49:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231181AbjGVEtP (ORCPT ); Sat, 22 Jul 2023 00:49:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230343AbjGVEtF (ORCPT ); Sat, 22 Jul 2023 00:49:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45D683C3A; Fri, 21 Jul 2023 21:48:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6807260A64; Sat, 22 Jul 2023 04:48:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF563C433CB; Sat, 22 Jul 2023 04:48:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001307; bh=cuTukx/nqcQppGnMG50r7nMzOf11MWzBvrfhG/qxv+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ghrFSViTYGLOEr8m9iwmuZEqXL5DGGDY68BgcoSlkfyMMZLowxj1FthOUvtiGpYOU XgWK3EdP8gAdlmiiNAZ6PyNVyK/S9AuCENMBct8ZnROrezO5YdgVwmiaHiGhvw7G5C i4v5GScJZ3Mi9rMEAW97IgKXfGLRPEECQv/hOiAVFpI5cIo1PNFdwEdmJ0U57vcuxW WhDdEyeKJtkfwHsNODzO8jmHOIyMYnRFRFsGyz8SPGAvXgzHgqXQCg/cXUayGCQLQu jRmU2NDJl3VAyQqgopRaN9EbdT70PkqNLiebKTs2BqflUTdbKJkEmDd6lZ9bQPnFNG 5KzQMi6SICH5A== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 09/19] kbuild: refactor kernel-devel RPM package and linux-headers Deb package Date: Sat, 22 Jul 2023 13:47:56 +0900 Message-Id: <20230722044806.3867434-9-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org The kernel-devel RPM package and the linux-headers Debian package provide headers and scripts needed for building external modules. They copy the necessary files in slightly different ways - the RPM copies almost everything except some exclude patterns, while the Debian copies less number of files. There is no need to maintain different code to do the same thing. Split the Debian code out to scripts/package/install-extmod-build, which is called from both of the packages. Signed-off-by: Masahiro Yamada --- scripts/package/builddeb | 29 +-------------------- scripts/package/install-extmod-build | 39 ++++++++++++++++++++++++++++ scripts/package/mkspec | 6 +---- 3 files changed, 41 insertions(+), 33 deletions(-) create mode 100755 scripts/package/install-extmod-build diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 032774eb061e..bf3f8561aa68 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -162,34 +162,7 @@ install_kernel_headers () { rm -rf $pdir - ( - cd $srctree - find . arch/$SRCARCH -maxdepth 1 -name Makefile\* - find include scripts -type f -o -type l - find arch/$SRCARCH -name Kbuild.platforms -o -name Platform - find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f - ) > debian/hdrsrcfiles - - { - if is_enabled CONFIG_OBJTOOL; then - echo tools/objtool/objtool - fi - - find arch/$SRCARCH/include Module.symvers include scripts -type f - - if is_enabled CONFIG_GCC_PLUGINS; then - find scripts/gcc-plugins -name \*.so - fi - } > debian/hdrobjfiles - - destdir=$pdir/usr/src/linux-headers-$version - mkdir -p $destdir - tar -c -f - -C $srctree -T debian/hdrsrcfiles | tar -xf - -C $destdir - tar -c -f - -T debian/hdrobjfiles | tar -xf - -C $destdir - rm -f debian/hdrsrcfiles debian/hdrobjfiles - - # copy .config manually to be where it's expected to be - cp $KCONFIG_CONFIG $destdir/.config + "${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}" mkdir -p $pdir/lib/modules/$version/ ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build diff --git a/scripts/package/install-extmod-build b/scripts/package/install-extmod-build new file mode 100755 index 000000000000..af7fe9f5b1e4 --- /dev/null +++ b/scripts/package/install-extmod-build @@ -0,0 +1,39 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-only + +set -e + +destdir=${1} + +test -n "${srctree}" +test -n "${SRCARCH}" + +is_enabled() { + grep -q "^$1=y" include/config/auto.conf +} + +mkdir -p "${destdir}" + +( + cd "${srctree}" + echo Makefile + find "arch/${SRCARCH}" -maxdepth 1 -name 'Makefile*' + find include scripts -type f -o -type l + find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform + find "$(find "arch/${SRCARCH}" -name include -o -name scripts -type d)" -type f +) | tar -c -f - -C "${srctree}" -T - | tar -xf - -C "${destdir}" + +{ + if is_enabled CONFIG_OBJTOOL; then + echo tools/objtool/objtool + fi + + find "arch/${SRCARCH}/include" Module.symvers include scripts -type f + + if is_enabled CONFIG_GCC_PLUGINS; then + find scripts/gcc-plugins -name '*.so' + fi +} | tar -c -f - -T - | tar -xf - -C "${destdir}" + +# copy .config manually to be where it's expected to be +cp "${KCONFIG_CONFIG}" "${destdir}/.config" diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 34b2489106cf..22e290d23d8a 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -28,9 +28,6 @@ else fi __KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g") -EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \ ---exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \ ---exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s" # We can label the here-doc lines for conditional output to the spec file # @@ -112,8 +109,7 @@ $M %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install cp .config %{buildroot}/boot/config-%{KERNELRELEASE} $S$M rm -f %{buildroot}/lib/modules/%{KERNELRELEASE}/build $S$M rm -f %{buildroot}/lib/modules/%{KERNELRELEASE}/source -$S$M mkdir -p %{buildroot}/usr/src/kernels/%{KERNELRELEASE} -$S$M tar cf - $EXCLUDES . | tar xf - -C %{buildroot}/usr/src/kernels/%{KERNELRELEASE} +$S$M %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='\${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}' $S$M cd %{buildroot}/lib/modules/%{KERNELRELEASE} $S$M ln -sf /usr/src/kernels/%{KERNELRELEASE} build $S$M ln -sf /usr/src/kernels/%{KERNELRELEASE} source From patchwork Sat Jul 22 04:47:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13322777 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0C25C001DC for ; Sat, 22 Jul 2023 04:49:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231209AbjGVEtR (ORCPT ); Sat, 22 Jul 2023 00:49:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229679AbjGVEtH (ORCPT ); Sat, 22 Jul 2023 00:49:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C05E3C3E; Fri, 21 Jul 2023 21:48:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E744C60A4C; Sat, 22 Jul 2023 04:48:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45568C433CC; Sat, 22 Jul 2023 04:48:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001309; bh=GAV/eLhMDGBWsU4RkH60dgfKVcN7IvGPnaFM8V2OKes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lp6FOQo44sQPExuQZjESFj1zb62XPACYDO5tkQkWDaiHdCTv9LFS0Q9KtXa0ffkPj K9ek+TTO6Tg1il21/dLxohqckw9/8aSrqZuyrrPyIQU6DX7NNFTlC+a6KRe+AU5Ye2 dN7PHYzAvJ4gldhG/Uc4t5x2NXmbL3hR2EOY2aVtjKv+ADOt/iEI3IK59F/Qcehfxl t8KbPuPRgL9WzkyKAce/SRAI5PSAWWOjWeKDFYNYfpaFmVB8ywDqXdnW25u2LVl/XJ 1U2jeyYQ1lap77PVhtvRQ8Z5AtBKbrzQb+VE39IM6Yieh99JNDPHWeVxN8ceJCS/da e8HBT9m2E+noQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 10/19] kbuild: rpm-pkg: derive the Version from %{KERNELRELEASE} Date: Sat, 22 Jul 2023 13:47:57 +0900 Message-Id: <20230722044806.3867434-10-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Avoid hard-coding the Version field in the generated spec file. Signed-off-by: Masahiro Yamada --- scripts/package/mkspec | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 22e290d23d8a..783e1997d94a 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -27,8 +27,6 @@ else M=DEL fi -__KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g") - # We can label the here-doc lines for conditional output to the spec file # # Labels: @@ -43,7 +41,7 @@ sed -e '/^DEL/d' -e 's/^\t*//' </dev/null || echo 1) License: GPL Group: System Environment/Kernel From patchwork Sat Jul 22 04:47:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13322778 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45C92EB64DA for ; Sat, 22 Jul 2023 04:49:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231148AbjGVEtV (ORCPT ); Sat, 22 Jul 2023 00:49:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231145AbjGVEtJ (ORCPT ); Sat, 22 Jul 2023 00:49:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4BB5420B; Fri, 21 Jul 2023 21:48:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 65A7B60A4E; Sat, 22 Jul 2023 04:48:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC1DCC433CA; Sat, 22 Jul 2023 04:48:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001310; bh=fBL9JE5iepvra98mZ0IoB0g7RFTsWLA/SDkRPTHrAaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZcYnw9kXlTlBpvjRum6fzEUZ8kOXy+Q5Eb6/zToLfcb+HO2UVJQBpdYNLPGDI8XLT IScI6lQR/jkzEyHiRUDZ/g5XJsEruKQxZP5vlopbm6PEmB1uOf4dT/V+qSVqXhKt1R XC1+C3X5HpqtS4bhzNx0t1xsGWVC5auC5/7i8rEKDre+e3yJ7K2YDcdzYY3uFlenY7 VGguZPUx0v4EmY3W3Orto4VQim8tnh9Ej9u3NTy5rS6fs7mWjUY2a1U6M8JbYjXBPD D+flhjKFBMIumd/Yv2J0n18AdobDDUk3Xt7xs9l05Oo8OyG7PfJeUUjU/5g0Ye3Tmw dj70gXNaRilLA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 11/19] kbuild: rpm-pkg: use a dummy string for _arch when undefined Date: Sat, 22 Jul 2023 13:47:58 +0900 Message-Id: <20230722044806.3867434-11-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org If this affects only %{buildroot}, it should be enough to use a fixed string for _arch when it is undefined. Signed-off-by: Masahiro Yamada --- scripts/package/mkspec | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 783e1997d94a..22b980cf3d00 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -36,6 +36,8 @@ sed -e '/^DEL/d' -e 's/^\t*//' < X-Patchwork-Id: 13322779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88AC6EB64DA for ; Sat, 22 Jul 2023 04:49:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231289AbjGVEte (ORCPT ); Sat, 22 Jul 2023 00:49:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230324AbjGVEtK (ORCPT ); Sat, 22 Jul 2023 00:49:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA767421D; Fri, 21 Jul 2023 21:48:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E7EE360A54; Sat, 22 Jul 2023 04:48:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FC71C433C8; Sat, 22 Jul 2023 04:48:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001312; bh=kxFfSb2hxE1tRo3e11RL0sCUAGyQ5rQOcl7k3i5D0Iw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mgZT8I4PmlGjzvsmMpDUlhWvXHHrVa8HbIZ+uoRfCH8I+OdHDBD7/4YP8obMnKSdy cqzrGKIkBWjqPp4PYWcz0qlQLDPxVZI6Czx0o3Y3VBOFnpWFjzE1t85wYi3PpfJ0Xq 7DcooBmcyWbvzsSqj6rm++dzJX8gD8RNPd+APdcICOtDU4iOE5kKar2GeopBIq+NY/ sWXVqYNmqdPawX2DhJGVDwiHEx2ADKfz3p9T690bRgCaSAyqMRj2dVDIF9zxmHpayh L3IWmySUPuKJF7FltPdUfdN67pUPrU58S+wZpEfWjOn6M5J4+486/+m8pSYNFywmjl JdbrfPlN01sYA== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 12/19] kbuild: rpm-pkg: invoke the kernel build from rpmbuild for binrpm-pkg Date: Sat, 22 Jul 2023 13:47:59 +0900 Message-Id: <20230722044806.3867434-12-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org 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 --- 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*//' </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 From patchwork Sat Jul 22 04:48:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13322780 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF9DEEB64DA for ; Sat, 22 Jul 2023 04:49:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231190AbjGVEtt (ORCPT ); Sat, 22 Jul 2023 00:49:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230395AbjGVEtR (ORCPT ); Sat, 22 Jul 2023 00:49:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC229422D; Fri, 21 Jul 2023 21:48:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 83DF560A50; Sat, 22 Jul 2023 04:48:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C40CAC4AF5C; Sat, 22 Jul 2023 04:48:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001313; bh=Yh5NDvGzKmVhPTG6BJRkKiMxxKF+DwrUyiZddGRbJl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=il5/ZfknhIxh0Cr99e+F8tGMNdjpII+DpE7e6jyAMpoJwIG3quo7TDBlPseGCTKSw 89+eHUWaHfUNPrA1c4Roq+9S7x4dIsDfsUs0SH5i1bgC3Qy6p9D1DwKw66GcnwRyUO HAIqPk4XSKrPz0Pq7A8xm0WF9CH0pXGA1BUKv+N2hIK3lj43SsNBINiGOsaPPfUwR5 R2V0n0o04JiZrDDi/hNpe10Fgr/+0cdlG1TuZU4wfSX1W+nM/sJpuejUt4DKR+sIpc pmralMy8/aeoitfO4ycbpNTYhpUrK7hAAjJSB4akeUy+KqTevuSJW59C67Fp7u1KDW LUxvJNSub9f/w== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 13/19] kbuild: rpm-pkg: run modules_install for non-modular kernel Date: Sat, 22 Jul 2023 13:48:00 +0900 Message-Id: <20230722044806.3867434-13-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org For the same reason as commit 4243afdb9326 ("kbuild: builddeb: always make modules_install, to install modules.builtin*"), run modules_install even when CONFIG_MODULES=n to install modules.builtin*. Signed-off-by: Masahiro Yamada --- scripts/package/mkspec | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/scripts/package/mkspec b/scripts/package/mkspec index a9425d993667..2613e85cd844 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -101,16 +101,13 @@ $S$M %else cp \$(%{make} %{makeflags} -s image_name) %{buildroot}/boot/vmlinuz-%{KERNELRELEASE} %endif -$M %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install + %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install %{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install cp System.map %{buildroot}/boot/System.map-%{KERNELRELEASE} cp .config %{buildroot}/boot/config-%{KERNELRELEASE} -$S$M rm -f %{buildroot}/lib/modules/%{KERNELRELEASE}/build -$S$M rm -f %{buildroot}/lib/modules/%{KERNELRELEASE}/source + ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build + ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/source $S$M %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='\${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}' -$S$M cd %{buildroot}/lib/modules/%{KERNELRELEASE} -$S$M ln -sf /usr/src/kernels/%{KERNELRELEASE} build -$S$M ln -sf /usr/src/kernels/%{KERNELRELEASE} source %clean rm -rf %{buildroot} @@ -138,9 +135,9 @@ $S$M ln -sf /usr/src/kernels/%{KERNELRELEASE} source %files %defattr (-, root, root) -$M /lib/modules/%{KERNELRELEASE} -$M %exclude /lib/modules/%{KERNELRELEASE}/build -$M %exclude /lib/modules/%{KERNELRELEASE}/source + /lib/modules/%{KERNELRELEASE} + %exclude /lib/modules/%{KERNELRELEASE}/build + %exclude /lib/modules/%{KERNELRELEASE}/source /boot/* %files headers From patchwork Sat Jul 22 04:48:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13322781 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B951C001DC for ; Sat, 22 Jul 2023 04:49:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231231AbjGVEty (ORCPT ); Sat, 22 Jul 2023 00:49:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231234AbjGVEtU (ORCPT ); Sat, 22 Jul 2023 00:49:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2ECE4481; Fri, 21 Jul 2023 21:48:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F1C1A60A38; Sat, 22 Jul 2023 04:48:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55880C433C9; Sat, 22 Jul 2023 04:48:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001315; bh=K5EMB4EDqAGzw3tXLfrUnbHaTr83QeJOoKsDtkrvNl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSnQAo56iRUsS9UpvQS8Tv/WMntDW2EL0COYoZ9ju4fYGHiojyYq66XRWIAlZws9z wR5/Q0BorMYEOn70a1bOY1kVIPfkSMX6rnS4zCrDtN+WtGVm6vsLO4+ODowQEdi9XY 1JhZr/B21BHoUhsD/I1vJW5WZCEx/23SVJLxgrH4pKc0K1Mix5sonG3xeubBQYkpER tibuS9Xr9h+i0x6SFPCx30El76Y4/fkMp86sOgw29Jn5H9eEe9V5tOj4mRbllye+LO bH3NlSKlcLzW88LW0FQt5iMN7EzKXWGF6D7ge/AmReM6ejGIyNqN7QJl5h3V7szdlG IBYiBp7SEuagg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 14/19] kbuild: rpm-pkg: introduce %{with_devel} switch to select devel package Date: Sat, 22 Jul 2023 13:48:01 +0900 Message-Id: <20230722044806.3867434-14-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org scripts/package/mkspec preprocesses the spec file by sed, but it is unreadable. This commit removes the last portion of the sed scripting. Remove the $S$M prefixes from the conditionally generated lines. Instead, surround the code with %if %{with_devel} ... %endif. Signed-off-by: Masahiro Yamada --- scripts/Makefile.package | 2 +- scripts/package/mkspec | 53 +++++++++++++++++++--------------------- 2 files changed, 26 insertions(+), 29 deletions(-) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 8373644a0473..c36ae03d6002 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -89,7 +89,7 @@ binrpm-pkg: $(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}' \ + --build-in-place --noprep --define='_smp_mflags %{nil}' --without devel \ --define='make $(MAKE)' # deb-pkg srcdeb-pkg bindeb-pkg diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 2613e85cd844..511cae46a90d 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -10,11 +10,7 @@ # # how we were called determines which rpms we build and how we build them -if [ "$1" = prebuilt ]; then - S=DEL -else - S= - +if [ -z "$1" ]; then mkdir -p rpmbuild/SOURCES cp linux.tar.gz rpmbuild/SOURCES cp "${KCONFIG_CONFIG}" rpmbuild/SOURCES/config @@ -22,17 +18,12 @@ else fi if grep -q CONFIG_MODULES=y include/config/auto.conf; then - M= +echo '%define with_devel %{?_without_devel: 0} %{?!_without_devel: 1}' else - M=DEL +echo '%define with_devel 0' fi -# We can label the here-doc lines for conditional output to the spec file -# -# 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*//' < X-Patchwork-Id: 13322784 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51B48C001DC for ; Sat, 22 Jul 2023 04:50:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231336AbjGVEu2 (ORCPT ); Sat, 22 Jul 2023 00:50:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231338AbjGVEtr (ORCPT ); Sat, 22 Jul 2023 00:49:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 519914687; Fri, 21 Jul 2023 21:48:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 09E9D60B07; Sat, 22 Jul 2023 04:48:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 518E5C43391; Sat, 22 Jul 2023 04:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001318; bh=VPUaxVtXdPuq4HOqNcJIyglxoF0IOoqdg44mkFjj0xo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T/gQUaCOpGdMRfrDiYuPDjF9izqAaP27voG5UdnyPecGtsnuRCiyG37Kb9Dd6GO5t 0UYVo0WEkGpNWGcXJL6i9JzTvhLjvoZk16PipBBZxDfSNMbzlJVH7I4Dx91D/TIPz9 FCRKTt1yCqsf0pc8OzR/YK3irXNF4Wjva5gY4aAtuL2bbMkge4qdHSfMtplKSYmdIF quV6ZSRrtxRzk9U0kF4xUIOload+bM/ie6Y/dvrdesW5NOL4cv4DyvoOPQss7uxIsS 67p0fNvIwB5V1GV8VHXVyP+T9luA+vnG61bMn6vR1yza7vHcHnDmNlImpZWa+VRpdn HqQwuYrsqkoNQ== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 16/19] kbuild: rpm-pkg: rename binkernel.spec to kernel.spec Date: Sat, 22 Jul 2023 13:48:03 +0900 Message-Id: <20230722044806.3867434-16-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Now kernel.spec and binkernel.spec have the exactly same contents. Use kernel.spec for binrpm-pkg as well. Signed-off-by: Masahiro Yamada --- .gitignore | 2 +- Makefile | 2 +- scripts/Makefile.package | 4 ++-- scripts/remove-stale-files | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 9fd4c9533b3d..0bbae167bf93 100644 --- a/.gitignore +++ b/.gitignore @@ -74,7 +74,7 @@ modules.order # # RPM spec file (make rpm-pkg) # -/*.spec +/kernel.spec /rpmbuild/ # diff --git a/Makefile b/Makefile index f258ef13fa5d..5a263e5f6559 100644 --- a/Makefile +++ b/Makefile @@ -1595,7 +1595,7 @@ MRPROPER_FILES += include/config include/generated \ certs/signing_key.pem \ certs/x509.genkey \ vmlinux-gdb.py \ - *.spec rpmbuild \ + kernel.spec rpmbuild \ rust/libmacros.so # clean - Delete most, but leave enough to build external modules diff --git a/scripts/Makefile.package b/scripts/Makefile.package index c36ae03d6002..be9602fa98da 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -86,9 +86,9 @@ srcrpm-pkg: linux.tar.gz # --------------------------------------------------------------------------- PHONY += binrpm-pkg binrpm-pkg: - $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/binkernel.spec + $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/kernel.spec +rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ - $(UTS_MACHINE)-linux -bb $(objtree)/binkernel.spec \ + $(UTS_MACHINE)-linux -bb $(objtree)/kernel.spec \ --build-in-place --noprep --define='_smp_mflags %{nil}' --without devel \ --define='make $(MAKE)' diff --git a/scripts/remove-stale-files b/scripts/remove-stale-files index f3659ea0335b..8b1a636f8543 100755 --- a/scripts/remove-stale-files +++ b/scripts/remove-stale-files @@ -37,3 +37,5 @@ rm -f .scmversion rm -rf include/ksym find . -name '*.usyms' | xargs rm -f + +rm -f binkernel.spec From patchwork Sat Jul 22 04:48:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13322783 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F90EEB64DA for ; Sat, 22 Jul 2023 04:50:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231179AbjGVEuZ (ORCPT ); Sat, 22 Jul 2023 00:50:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231172AbjGVEtp (ORCPT ); Sat, 22 Jul 2023 00:49:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFC1F4683; Fri, 21 Jul 2023 21:48:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7595B60A4E; Sat, 22 Jul 2023 04:48:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC532C433C7; Sat, 22 Jul 2023 04:48:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001319; bh=lUV+hV9+Om7+zu7Ta7+cYxJn7GpO7yeT62vr+Z7xZLI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GYOnQB7LGmg6UQ7ATyc5uftAZKL+fpYqV41VkuWTsdYUh9V2Mc7FxbzKtA/qVshgI B3ljmZn6jRLhZ/XlfMVWcYSVyx2o5c4qTd9N32cQuV9I95ed+8u6FykKZKkihv+8S6 AYsfV0td7uVd0VezHUy/wmq5BI65RhVxFGBXZJY8NZSU97cO9PqrybHCsK7Ms3rfO6 wOPj5b9smmmlz0svNP8y/BOXJvoeA68U/0wCoRJJkH6N5jEfuXq8uaWsMnebmXyR99 jJ8FDBInwRkw6In4widAxuK9TPsse2RTjzZMQ53eYai5ZmlF7H6dC0AWrYfY5QHvZk 4p8u/5ySS1Uwg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 17/19] kbuild: rpm-pkg: build the kernel in-place for rpm-pkg Date: Sat, 22 Jul 2023 13:48:04 +0900 Message-Id: <20230722044806.3867434-17-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Currently, 'make rpm-pkg' always builds the kernel from the pristine source tree in the ~/rpmbuild/BUILD/ directory. Build the kernel incrementally just like 'make binrpm-pkg'. Signed-off-by: Masahiro Yamada --- scripts/Makefile.package | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index be9602fa98da..bf2da97f29d0 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -72,6 +72,7 @@ PHONY += rpm-pkg rpm-pkg: srpm = $(shell rpmspec --srpm --query --queryformat='%{name}-%{VERSION}-%{RELEASE}.src.rpm' kernel.spec) rpm-pkg: srcrpm-pkg +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -rb $(srpm) \ + --build-in-place --noprep \ --define='_smp_mflags %{nil}' --define='make $(MAKE)' # srcrpm-pkg From patchwork Sat Jul 22 04:48:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13322785 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CA7BEB64DA for ; Sat, 22 Jul 2023 04:50:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231132AbjGVEur (ORCPT ); Sat, 22 Jul 2023 00:50:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229557AbjGVEuC (ORCPT ); Sat, 22 Jul 2023 00:50:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F82F46AC; Fri, 21 Jul 2023 21:48:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F0DFD60A64; Sat, 22 Jul 2023 04:48:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52774C433CB; Sat, 22 Jul 2023 04:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001321; bh=48TYLXDk2TZk+T1Fx9XPl8wRZKrGD3cF6zfP4SYoA0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YoU0nAY1eP4T61+9clSYpSNgSfwWWh5UlvXHQA//yjU3npmsHTTOKSvm94lha13Oz VlQR+ktlhlf2gImIIzl4WuCm3bwrzllNjw1HT93s9YXAW/b3nJdMoKSdZSJ85c3Quz I/m6oaHdjG3haE1snv63ELmDYLmC3bxtdl1YhBLbX434PIqwU7SoAQA1rrb3Ykfek6 PCl4jK408qph6rby2DCGuCbOYY9onlVrywe+VW+ZoMyhUB621OEviungDsh/gJtF6G AmDAwQ6gafSHqU2SVT7k4BsYvnTrDTFUSjhiBTlMSu27sDFLjSNomBlchLc5PQHWul 30V1JW4Jha8Qg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 18/19] kbuild: rpm-pkg: refactor *rpm-pkg targets Date: Sat, 22 Jul 2023 13:48:05 +0900 Message-Id: <20230722044806.3867434-18-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Merge the similar build targets. Also, make the output location consistent. Previously, source packages were created in the build directory, while binary packages under ~/rpmbuild/RPMS/. Now, Kbuild creates the rpmbuild/ directory in the build directory, and saves all packages under it. Signed-off-by: Masahiro Yamada --- scripts/Makefile.package | 52 +++++++++++++++++++++------------------- scripts/package/mkspec | 8 ------- 2 files changed, 28 insertions(+), 32 deletions(-) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index bf2da97f29d0..0ace3973a0d1 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -11,7 +11,6 @@ TAR_CONTENT := Documentation LICENSES arch block certs crypto drivers fs \ samples scripts security sound tools usr virt \ .config Makefile \ Kbuild Kconfig COPYING $(wildcard localversion*) -MKSPEC := $(srctree)/scripts/package/mkspec quiet_cmd_src_tar = TAR $(2).tar.gz cmd_src_tar = \ @@ -66,32 +65,37 @@ $(linux-tarballs): archive-args = --prefix=linux/ $$(cat $<) $(linux-tarballs): .tmp_HEAD FORCE $(call if_changed,archive) -# rpm-pkg +# rpm-pkg srcrpm-pkg binrpm-pkg # --------------------------------------------------------------------------- -PHONY += rpm-pkg -rpm-pkg: srpm = $(shell rpmspec --srpm --query --queryformat='%{name}-%{VERSION}-%{RELEASE}.src.rpm' kernel.spec) -rpm-pkg: srcrpm-pkg - +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -rb $(srpm) \ - --build-in-place --noprep \ - --define='_smp_mflags %{nil}' --define='make $(MAKE)' -# srcrpm-pkg -# --------------------------------------------------------------------------- -PHONY += srcrpm-pkg -srcrpm-pkg: linux.tar.gz - $(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec - +rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -bs kernel.spec \ - --define='_smp_mflags %{nil}' --define='_sourcedir rpmbuild/SOURCES' --define='_srcrpmdir .' +quiet_cmd_mkspec = GEN $@ + cmd_mkspec = $(srctree)/scripts/package/mkspec > $@ -# binrpm-pkg -# --------------------------------------------------------------------------- -PHONY += binrpm-pkg -binrpm-pkg: - $(CONFIG_SHELL) $(MKSPEC) prebuilt > $(objtree)/kernel.spec - +rpmbuild $(RPMOPTS) --define "_builddir $(objtree)" --target \ - $(UTS_MACHINE)-linux -bb $(objtree)/kernel.spec \ - --build-in-place --noprep --define='_smp_mflags %{nil}' --without devel \ - --define='make $(MAKE)' +kernel.spec: FORCE + $(call cmd,mkspec) + +PHONY += rpm-sources +rpm-sources: linux.tar.gz + $(Q)mkdir -p rpmbuild/SOURCES + $(Q)ln -f linux.tar.gz rpmbuild/SOURCES/linux.tar.gz + $(Q)cp $(KCONFIG_CONFIG) rpmbuild/SOURCES/config + $(Q)$(srctree)/scripts/package/gen-diff-patch rpmbuild/SOURCES/diff.patch + +PHONY += rpm-pkg srcrpm-pkg binrpm-pkg + +rpm-pkg: private build-type := a +srcrpm-pkg: private build-type := s +binrpm-pkg: private build-type := b + +rpm-pkg srcrpm-pkg: rpm-sources +rpm-pkg srcrpm-pkg binrpm-pkg: kernel.spec + +$(strip rpmbuild -b$(build-type) kernel.spec \ + --define='_topdir $(abspath rpmbuild)' \ + $(if $(filter a b, $(build-type)), \ + --target $(UTS_MACHINE)-linux --build-in-place --noprep --define='_smp_mflags %{nil}') \ + $(if $(filter b, $(build-type)), \ + --without devel) \ + $(RPMOPTS)) # deb-pkg srcdeb-pkg bindeb-pkg # --------------------------------------------------------------------------- diff --git a/scripts/package/mkspec b/scripts/package/mkspec index c08567ae7fb1..d41608efb747 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -9,14 +9,6 @@ # Patched for non-x86 by Opencon (L) 2002 # -# how we were called determines which rpms we build and how we build them -if [ -z "$1" ]; then - mkdir -p rpmbuild/SOURCES - cp linux.tar.gz rpmbuild/SOURCES - cp "${KCONFIG_CONFIG}" rpmbuild/SOURCES/config - "${srctree}/scripts/package/gen-diff-patch" rpmbuild/SOURCES/diff.patch -fi - if grep -q CONFIG_MODULES=y include/config/auto.conf; then echo '%define with_devel %{?_without_devel: 0} %{?!_without_devel: 1}' else From patchwork Sat Jul 22 04:48:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13322786 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EBE7C001B0 for ; Sat, 22 Jul 2023 04:51:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231314AbjGVEvJ (ORCPT ); Sat, 22 Jul 2023 00:51:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231316AbjGVEuZ (ORCPT ); Sat, 22 Jul 2023 00:50:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6717F49D6; Fri, 21 Jul 2023 21:48:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7BCD560A66; Sat, 22 Jul 2023 04:48:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC55BC433CA; Sat, 22 Jul 2023 04:48:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690001322; bh=gIGxS34xwv5NpXZcfC9AaBQEdsBf6s43cS3YwnJ+Ftc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RS9DH271H+aEdQwyuVGvK4kBz0UmFUzuLF0i0tyWYK8sNzUm/C2aB5xhjLgBRPEYw GlRZeb+ElAZz3MmOebTdETVntOdVEY8WqhV+wlwZFsNQzP/rotqnFb3dSv/cw/3nto qPw9yrQ/+1puX6wKNRuBI5YQXrDBuDNJmiUWZu7LjzahUVog8shGKbGgnZ3sWo+307 A9wkSWHjiGr/vUCVxPEMI1FiIoNVIJhAnxnDJnhIDb+gRxkrzKYrAUJ+359uYRB7hI pDu1PnRfolaa6HkMt595NRYyx3R86FpL+O/6klXOLKEL5FZao2xDBAuOgtP+mHlrL4 6SoVYLTU8aYkg== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH 19/19] kbuild: rpm-pkg: skip build dependency check on non-rpm systems Date: Sat, 22 Jul 2023 13:48:06 +0900 Message-Id: <20230722044806.3867434-19-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230722044806.3867434-1-masahiroy@kernel.org> References: <20230722044806.3867434-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Commit 8818039f959b ("kbuild: add ability to make source rpm buildable using koji") added the BuildRequires: field. Checking the build dependency is fine, but one annoyance is that 'make (bin)rpm-pkg' fails on non-rpm systems [1]. For example, Debian provides rpmbuild via 'apt install rpm', but of course cannot meet the requirement listed in the BuildRequires: field. It is possible to pass RPMOPTS=--nodeps to work around it, but it is reasonable to do it automatically. If 'rpm -q rpm' fails, it is not an RPM-managed system. (The command 'rpm' is not installed at all, or was installed by other means.) In that case, pass --nodeps to skip the build dependency check. [1]: https://lore.kernel.org/linux-kbuild/Y6mkdYQYmjUz7bqV@li-4a3a4a4c-28e5-11b2-a85c-a8d192c6f089.ibm.com/ Signed-off-by: Masahiro Yamada --- scripts/Makefile.package | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.package b/scripts/Makefile.package index 0ace3973a0d1..85beab0363d7 100644 --- a/scripts/Makefile.package +++ b/scripts/Makefile.package @@ -92,7 +92,8 @@ rpm-pkg srcrpm-pkg binrpm-pkg: kernel.spec +$(strip rpmbuild -b$(build-type) kernel.spec \ --define='_topdir $(abspath rpmbuild)' \ $(if $(filter a b, $(build-type)), \ - --target $(UTS_MACHINE)-linux --build-in-place --noprep --define='_smp_mflags %{nil}') \ + --target $(UTS_MACHINE)-linux --build-in-place --noprep --define='_smp_mflags %{nil}' \ + $$(rpm -q rpm >/dev/null 2>&1 || echo --nodeps)) \ $(if $(filter b, $(build-type)), \ --without devel) \ $(RPMOPTS))