From patchwork Tue Dec 14 02:53:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12675353 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 D9D5CC433F5 for ; Tue, 14 Dec 2021 02:55:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232326AbhLNCzZ (ORCPT ); Mon, 13 Dec 2021 21:55:25 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:41811 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229725AbhLNCzZ (ORCPT ); Mon, 13 Dec 2021 21:55:25 -0500 Received: from grover.. (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-11.nifty.com with ESMTP id 1BE2s0bc012823; Tue, 14 Dec 2021 11:54:02 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 1BE2s0bc012823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1639450442; bh=LGynaWzvzbJKWj82OApHAklbGHeVobCQAmfnlsI/HGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ACTz+RJ/Fx/9ZbT5HV9NlfphtPCmqQSCoyAcBn5hZBMbbhV4yk9inMq8oDaDFe+3U MEvzzBMiv0gRDHhU5C6JPUugNeDX78A5mM1bRnbME2qyrCH8ZVwtU33gIhBvS4cXRE 2LhiVmDgzHXlZb5hGmz8kK20C8b6P8pchl0u/HekhKCr3skejW5iWXQxN96BeWZ8sv uBjXoPMWzyYmV9Vr+aMRPiArtr66qfj1tvTMik0MaP59y9/q3Qg+9lW4MKTY4v+L49 nQDmr+MYJyII2vF29uE1FC/wHJQqeviBUM+jx9U09n0E7LwRJqFpzJTGOjwfWbFFR3 Nm7OlpOk3dZBA== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , linux-arch@vger.kernel.org, David Howells , David Woodhouse , keyrings@vger.kernel.org, Richard Weinberger , Nicolas Schier , Masahiro Yamada Subject: [PATCH v2 01/11] certs: use $< and $@ to simplify the key generation rule Date: Tue, 14 Dec 2021 11:53:45 +0900 Message-Id: <20211214025355.1267796-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214025355.1267796-1-masahiroy@kernel.org> References: <20211214025355.1267796-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org Do not repeat $(obj)/x509.genkey or $(obj)/signing_key.pem Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- Changes in v2: - Use $< instead of x509.genkey certs/Makefile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/certs/Makefile b/certs/Makefile index a702b70f3cb9..aba9e782f940 100644 --- a/certs/Makefile +++ b/certs/Makefile @@ -60,9 +60,8 @@ keytype-$(CONFIG_MODULE_SIG_KEY_TYPE_ECDSA) := -newkey ec -pkeyopt ec_paramgen_c quiet_cmd_gen_key = GENKEY $@ cmd_gen_key = openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \ - -batch -x509 -config $(obj)/x509.genkey \ - -outform PEM -out $(obj)/signing_key.pem \ - -keyout $(obj)/signing_key.pem $(keytype-y) 2>&1 + -batch -x509 -config $< \ + -outform PEM -out $@ -keyout $@ $(keytype-y) 2>&1 $(obj)/signing_key.pem: $(obj)/x509.genkey FORCE $(call if_changed,gen_key) From patchwork Tue Dec 14 02:53:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12675365 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 1C63DC43217 for ; Tue, 14 Dec 2021 02:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244302AbhLNCzf (ORCPT ); Mon, 13 Dec 2021 21:55:35 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:41855 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232273AbhLNCz2 (ORCPT ); Mon, 13 Dec 2021 21:55:28 -0500 Received: from grover.. (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-11.nifty.com with ESMTP id 1BE2s0bd012823; Tue, 14 Dec 2021 11:54:03 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 1BE2s0bd012823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1639450443; bh=lFwAie+ACL1Bul6UeqzOBCuhJg5PqZ9pwxEdlcaA3ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I+/s/E5aF1eVcsI7nt7N8I2vbUjj7JeZaVKgZ9jJFvrdJzqdv3xrrhEctuvczi1G5 GU+lZpy/xyHqiua4aWcOUKPPNhK2p/OHkinqvnFSvTgI7tpJfENdj4gi1HK38zhRVA hbrvaA7nerzFZa02yz3l+yZvgvM5eFUip7Z8A8sgFIfvU/BUclyyBPlLSyelkCDtU3 /D5kJDXhJnj1eS7kG42yEaQW98IYoNzCECvoU9QIHsCpNvXXmHbJ/YDwUkQdYYOqUA Ut7Ui6tMtYshCAhqIh8e54huFU5jU9RUl4n4Q7lGAus6rKA1qLrESd0NQ+Ta2fU4Xw Bki8XjPqm15lw== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , linux-arch@vger.kernel.org, David Howells , David Woodhouse , keyrings@vger.kernel.org, Richard Weinberger , Nicolas Schier , Masahiro Yamada Subject: [PATCH v2 02/11] certs: unify duplicated cmd_extract_certs and improve the log Date: Tue, 14 Dec 2021 11:53:46 +0900 Message-Id: <20211214025355.1267796-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214025355.1267796-1-masahiroy@kernel.org> References: <20211214025355.1267796-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org cmd_extract_certs is defined twice. Unify them. The current log shows the input file $(2), which might be empty. You cannot know what is being created from the log, "EXTRACT_CERTS". Change the log to show the output file with better alignment. [Before] EXTRACT_CERTS certs/signing_key.pem CC certs/system_keyring.o EXTRACT_CERTS AS certs/system_certificates.o CC certs/common.o CC certs/blacklist.o EXTRACT_CERTS AS certs/revocation_certificates.o [After] CERT certs/signing_key.x509 CC certs/system_keyring.o CERT certs/x509_certificate_list AS certs/system_certificates.o CC certs/common.o CC certs/blacklist.o CERT certs/x509_revocation_list AS certs/revocation_certificates.o Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- (no changes since v1) certs/Makefile | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/certs/Makefile b/certs/Makefile index aba9e782f940..bdddcd21cbb3 100644 --- a/certs/Makefile +++ b/certs/Makefile @@ -12,6 +12,9 @@ else obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o endif +quiet_cmd_extract_certs = CERT $@ + cmd_extract_certs = scripts/extract-cert $(2) $@ + ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y) $(eval $(call config_filename,SYSTEM_TRUSTED_KEYS)) @@ -22,9 +25,6 @@ $(obj)/system_certificates.o: $(obj)/x509_certificate_list # Cope with signing_key.x509 existing in $(srctree) not $(objtree) AFLAGS_system_certificates.o := -I$(srctree) -quiet_cmd_extract_certs = EXTRACT_CERTS $(patsubst "%",%,$(2)) - cmd_extract_certs = scripts/extract-cert $(2) $@ - targets += x509_certificate_list $(obj)/x509_certificate_list: scripts/extract-cert $(SYSTEM_TRUSTED_KEYS_SRCPREFIX)$(SYSTEM_TRUSTED_KEYS_FILENAME) FORCE $(call if_changed,extract_certs,$(SYSTEM_TRUSTED_KEYS_SRCPREFIX)$(CONFIG_SYSTEM_TRUSTED_KEYS)) @@ -98,9 +98,6 @@ $(eval $(call config_filename,SYSTEM_REVOCATION_KEYS)) $(obj)/revocation_certificates.o: $(obj)/x509_revocation_list -quiet_cmd_extract_certs = EXTRACT_CERTS $(patsubst "%",%,$(2)) - cmd_extract_certs = scripts/extract-cert $(2) $@ - targets += x509_revocation_list $(obj)/x509_revocation_list: scripts/extract-cert $(SYSTEM_REVOCATION_KEYS_SRCPREFIX)$(SYSTEM_REVOCATION_KEYS_FILENAME) FORCE $(call if_changed,extract_certs,$(SYSTEM_REVOCATION_KEYS_SRCPREFIX)$(CONFIG_SYSTEM_REVOCATION_KEYS)) From patchwork Tue Dec 14 02:53:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12675359 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 F3E1CC4321E for ; Tue, 14 Dec 2021 02:55:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241579AbhLNCzc (ORCPT ); Mon, 13 Dec 2021 21:55:32 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:41820 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231146AbhLNCz0 (ORCPT ); Mon, 13 Dec 2021 21:55:26 -0500 Received: from grover.. (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-11.nifty.com with ESMTP id 1BE2s0be012823; Tue, 14 Dec 2021 11:54:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 1BE2s0be012823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1639450444; bh=wPFF+Cf9ni7mATaDne62tPUjwtjii9GCqqYEBla6e6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SfEOspQ7zZ2XC5WsalrdCQXbzE6sADgIdOQzhTBh9w+uXS3Ut2kB6xh0tCQXl5Rk+ EqylYoPDzaXx98S8avjABrY2eYWRj14r718K1QbpLHpkETbeER0pX7qdzM61sffNyW w0A1zi0XzwQ9plTtbXPquZtltlRaGIO8IZZHBoq0fuSEqMLCAfVKLAFq+q16ZQEnfo hy4voVTvTvNWfhXXsuOIPYP1oxiXmyH+HvT833Vrl1LMtCAdoe8BGPZLwCwU4L4/NH FUAQcpB9yQqWtw+gDslFdnUvzcKeoz7JmlceJ2NDVGheAWWyR91WyysKM4qVPXsR5g MsYIzsLcxISbA== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , linux-arch@vger.kernel.org, David Howells , David Woodhouse , keyrings@vger.kernel.org, Richard Weinberger , Nicolas Schier , Masahiro Yamada Subject: [PATCH v2 03/11] certs: remove unneeded -I$(srctree) option for system_certificates.o Date: Tue, 14 Dec 2021 11:53:47 +0900 Message-Id: <20211214025355.1267796-4-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214025355.1267796-1-masahiroy@kernel.org> References: <20211214025355.1267796-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org The .incbin directive in certs/system_certificates.S includes certs/signing_key.x509 and certs/x509_certificate_list, both of which are generated by extract_certs, i.e. exist in $(objtree). This option -I$(srctree) is unneeded. Signed-off-by: Masahiro Yamada --- (no changes since v1) certs/Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/certs/Makefile b/certs/Makefile index bdddcd21cbb3..d1e0dad038ca 100644 --- a/certs/Makefile +++ b/certs/Makefile @@ -22,9 +22,6 @@ $(eval $(call config_filename,SYSTEM_TRUSTED_KEYS)) # GCC doesn't include .incbin files in -MD generated dependencies (PR#66871) $(obj)/system_certificates.o: $(obj)/x509_certificate_list -# Cope with signing_key.x509 existing in $(srctree) not $(objtree) -AFLAGS_system_certificates.o := -I$(srctree) - targets += x509_certificate_list $(obj)/x509_certificate_list: scripts/extract-cert $(SYSTEM_TRUSTED_KEYS_SRCPREFIX)$(SYSTEM_TRUSTED_KEYS_FILENAME) FORCE $(call if_changed,extract_certs,$(SYSTEM_TRUSTED_KEYS_SRCPREFIX)$(CONFIG_SYSTEM_TRUSTED_KEYS)) From patchwork Tue Dec 14 02:53:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12675371 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 C67F3C433F5 for ; Tue, 14 Dec 2021 02:55:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237482AbhLNCzb (ORCPT ); Mon, 13 Dec 2021 21:55:31 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:41813 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230302AbhLNCz0 (ORCPT ); Mon, 13 Dec 2021 21:55:26 -0500 Received: from grover.. (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-11.nifty.com with ESMTP id 1BE2s0bf012823; Tue, 14 Dec 2021 11:54:04 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 1BE2s0bf012823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1639450445; bh=ycfN/18OUImXg3GfQ9MnYJuonV/TkQumnCQ5gyi4HgI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bX8LdUwO+h/aBNVZSYWPEN3hnaK+FxGPlhv7Gt5Dnrpv7jMT1aj4e+AiKZ7PsD0PL XkPTxTEDNTMp0aBGeLURdgt/dRNwRqUCFwWklGbGzQ0WBwJfsg3jz94OZVCivtm93h vgwjEl7g1x5rMNr2TVcT3eYn3JzBb6RN5nO2S5s5iUx6Z1i8nG6dsXW8X1xTPP0LKS f6k2zj1ET7cWAIV+HmNi1uImCCQlxe87MYJAiIQPmozbk1u40OCPWJsFLkmCSqtdMc qQM9FH1Anvp+ZH+naoGwg1B8d0Ow1NGdOIMzz/QN8X5qdqRDp3spnVsxy4RGW2aqm/ DOeQO9YdPlOYA== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , linux-arch@vger.kernel.org, David Howells , David Woodhouse , keyrings@vger.kernel.org, Richard Weinberger , Nicolas Schier , Masahiro Yamada Subject: [PATCH v2 04/11] certs: refactor file cleaning Date: Tue, 14 Dec 2021 11:53:48 +0900 Message-Id: <20211214025355.1267796-5-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214025355.1267796-1-masahiroy@kernel.org> References: <20211214025355.1267796-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org 'make clean' removes files listed in 'targets'. It is redundant to specify both 'targets' and 'clean-files'. Move 'targets' assignments out of the ifeq-conditionals so scripts/Makefile.clean can see them. One effective change is that certs/certs/signing_key.x509 is now deleted by 'make clean' instead of 'make mrproper. This certificate is embedded in the kernel. It is not used in any way by external module builds. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- (no changes since v1) Makefile | 2 +- certs/Makefile | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 0a6ecc8bb2d2..4e8ac0730f51 100644 --- a/Makefile +++ b/Makefile @@ -1503,7 +1503,7 @@ MRPROPER_FILES += include/config include/generated \ debian snap tar-install \ .config .config.old .version \ Module.symvers \ - certs/signing_key.pem certs/signing_key.x509 \ + certs/signing_key.pem \ certs/x509.genkey \ vmlinux-gdb.py \ *.spec diff --git a/certs/Makefile b/certs/Makefile index d1e0dad038ca..bb1763150547 100644 --- a/certs/Makefile +++ b/certs/Makefile @@ -22,12 +22,11 @@ $(eval $(call config_filename,SYSTEM_TRUSTED_KEYS)) # GCC doesn't include .incbin files in -MD generated dependencies (PR#66871) $(obj)/system_certificates.o: $(obj)/x509_certificate_list -targets += x509_certificate_list $(obj)/x509_certificate_list: scripts/extract-cert $(SYSTEM_TRUSTED_KEYS_SRCPREFIX)$(SYSTEM_TRUSTED_KEYS_FILENAME) FORCE $(call if_changed,extract_certs,$(SYSTEM_TRUSTED_KEYS_SRCPREFIX)$(CONFIG_SYSTEM_TRUSTED_KEYS)) endif # CONFIG_SYSTEM_TRUSTED_KEYRING -clean-files := x509_certificate_list .x509.list x509_revocation_list +targets += x509_certificate_list ifeq ($(CONFIG_MODULE_SIG),y) SIGN_KEY = y @@ -84,18 +83,20 @@ endif # GCC PR#66871 again. $(obj)/system_certificates.o: $(obj)/signing_key.x509 -targets += signing_key.x509 $(obj)/signing_key.x509: scripts/extract-cert $(X509_DEP) FORCE $(call if_changed,extract_certs,$(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY)) endif # CONFIG_MODULE_SIG +targets += signing_key.x509 + ifeq ($(CONFIG_SYSTEM_REVOCATION_LIST),y) $(eval $(call config_filename,SYSTEM_REVOCATION_KEYS)) $(obj)/revocation_certificates.o: $(obj)/x509_revocation_list -targets += x509_revocation_list $(obj)/x509_revocation_list: scripts/extract-cert $(SYSTEM_REVOCATION_KEYS_SRCPREFIX)$(SYSTEM_REVOCATION_KEYS_FILENAME) FORCE $(call if_changed,extract_certs,$(SYSTEM_REVOCATION_KEYS_SRCPREFIX)$(CONFIG_SYSTEM_REVOCATION_KEYS)) endif + +targets += x509_revocation_list From patchwork Tue Dec 14 02:53:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12675361 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 79119C43219 for ; Tue, 14 Dec 2021 02:55:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243075AbhLNCze (ORCPT ); Mon, 13 Dec 2021 21:55:34 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:41823 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231237AbhLNCz0 (ORCPT ); Mon, 13 Dec 2021 21:55:26 -0500 Received: from grover.. (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-11.nifty.com with ESMTP id 1BE2s0bg012823; Tue, 14 Dec 2021 11:54:05 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 1BE2s0bg012823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1639450446; bh=nVXwzb0FLjY8aEGAEFsUewOVCSlE7SBFJlhSFGwALBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mp5NYfuo69xmD9CRfU539KblGs9XgtMLAEv7zEC08tuUDcNSc1PfhuVU6w9zykq1m eR59YBMsTengL1p88rusrJW6De+x9p27ZlP4rjfNG/Lc8lAkQV+DEph/jh5sTAwe8s ok7lT4YaZ9Efbd4b6v1RyjoZuZTK6wSQOB1Nsxaysh1eMkyCbYnMIaV/ipopM3IIpH 3+TRVdE2NfNWxOdXTwOe3ay2vBdXbqmwUI2XX88Z15x2hCqjyiT3fwm5Or2I7YY3J9 82Dd3cp9+YIWXB0MITGw5lHwrZdvmkYGR+cAQizm2CkLrqi2BSjLBplK0z6uqFxx4V NHUJzwaIUPqdQ== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , linux-arch@vger.kernel.org, David Howells , David Woodhouse , keyrings@vger.kernel.org, Richard Weinberger , Nicolas Schier , Masahiro Yamada Subject: [PATCH v2 05/11] certs: remove misleading comments about GCC PR Date: Tue, 14 Dec 2021 11:53:49 +0900 Message-Id: <20211214025355.1267796-6-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214025355.1267796-1-masahiroy@kernel.org> References: <20211214025355.1267796-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org This dependency is necessary irrespective of the mentioned GCC PR because the embedded certificates are build artifacts and must be generated by extract_certs before *.S files are compiled. The comment sounds like we are hoping to remove these dependencies someday. No, we cannot remove them. Signed-off-by: Masahiro Yamada --- (no changes since v1) certs/Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/certs/Makefile b/certs/Makefile index bb1763150547..c3c8da03b04b 100644 --- a/certs/Makefile +++ b/certs/Makefile @@ -19,7 +19,6 @@ ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y) $(eval $(call config_filename,SYSTEM_TRUSTED_KEYS)) -# GCC doesn't include .incbin files in -MD generated dependencies (PR#66871) $(obj)/system_certificates.o: $(obj)/x509_certificate_list $(obj)/x509_certificate_list: scripts/extract-cert $(SYSTEM_TRUSTED_KEYS_SRCPREFIX)$(SYSTEM_TRUSTED_KEYS_FILENAME) FORCE @@ -80,7 +79,6 @@ ifeq ($(patsubst pkcs11:%,%,$(firstword $(MODULE_SIG_KEY_FILENAME))),$(firstword X509_DEP := $(MODULE_SIG_KEY_SRCPREFIX)$(MODULE_SIG_KEY_FILENAME) endif -# GCC PR#66871 again. $(obj)/system_certificates.o: $(obj)/signing_key.x509 $(obj)/signing_key.x509: scripts/extract-cert $(X509_DEP) FORCE From patchwork Tue Dec 14 02:53:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12675355 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 64257C433F5 for ; Tue, 14 Dec 2021 02:55:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233879AbhLNCz2 (ORCPT ); Mon, 13 Dec 2021 21:55:28 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:41829 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232050AbhLNCz0 (ORCPT ); Mon, 13 Dec 2021 21:55:26 -0500 Received: from grover.. (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-11.nifty.com with ESMTP id 1BE2s0bh012823; Tue, 14 Dec 2021 11:54:06 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 1BE2s0bh012823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1639450447; bh=4XnqdxB/jmNQDTR4+enp7rYM+3kt4+2zAQ+n7Gz8fa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NWWVSGX/HbTEIAfDfQ0ej8gtj8Muxol4VzrXGqAEo/zzAw+O5FFSbClXZkXkZT3VI IUTLI8y8djcvH7bEAz8bCU1z9FJVwbfppbNTgXmR+xM82I3qgZne/RMEalx3QS3yeL IQx32Slov+nbK2yInks4itIRA8Ypj+dzuftpTLkSOC+nXbQiQH6vqZvWNcjnEs2ee9 fQdCTjnN4uzyVqZrPzTLixapN8rIG9FnNgHPuev40y68iIuZvu+lyg9Q0gxNCruQH3 mwzicIp98dCMjzB8VeYbJsPmBD3VM17Ai2864E0ZyJ1H/ofl4dj+8uHISOy1gZiF0X Kb71y+GBcstEg== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , linux-arch@vger.kernel.org, David Howells , David Woodhouse , keyrings@vger.kernel.org, Richard Weinberger , Nicolas Schier , Masahiro Yamada Subject: [PATCH v2 06/11] kbuild: stop using config_filename in scripts/Makefile.modsign Date: Tue, 14 Dec 2021 11:53:50 +0900 Message-Id: <20211214025355.1267796-7-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214025355.1267796-1-masahiroy@kernel.org> References: <20211214025355.1267796-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org Toward the goal of removing the config_filename macro, drop the double-quotes and add $(srctree)/ prefix in an ad hoc way. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- (no changes since v1) scripts/Makefile.modinst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index ff9b09e4cfca..df7e3d578ef5 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst @@ -66,9 +66,10 @@ endif # Don't stop modules_install even if we can't sign external modules. # ifeq ($(CONFIG_MODULE_SIG_ALL),y) +CONFIG_MODULE_SIG_KEY := $(CONFIG_MODULE_SIG_KEY:"%"=%) +sig-key := $(if $(wildcard $(CONFIG_MODULE_SIG_KEY)),,$(srctree)/)$(CONFIG_MODULE_SIG_KEY) quiet_cmd_sign = SIGN $@ -$(eval $(call config_filename,MODULE_SIG_KEY)) - cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY) certs/signing_key.x509 $@ \ + cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(sig-key) certs/signing_key.x509 $@ \ $(if $(KBUILD_EXTMOD),|| true) else quiet_cmd_sign := From patchwork Tue Dec 14 02:53:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12675375 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 EDCC1C4332F for ; Tue, 14 Dec 2021 02:55:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235886AbhLNCz3 (ORCPT ); Mon, 13 Dec 2021 21:55:29 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:41827 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231919AbhLNCz0 (ORCPT ); Mon, 13 Dec 2021 21:55:26 -0500 Received: from grover.. (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-11.nifty.com with ESMTP id 1BE2s0bi012823; Tue, 14 Dec 2021 11:54:07 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 1BE2s0bi012823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1639450448; bh=30IqlpIC5GLWBsrKPT7oz+p6+AmM0HnlncKcSJNr3OE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VO8TXRFmlTKxZrvs7iDP+9+UdT8EfWMKeXN/MyXBbmYghyXzYcZJ4dAkBHh0B01dQ PZXnAKCrTmfqbOSoir0LT6Q7mmtO4qF5/PGANzEyNwGn7yb6FU1wA2H5Opf+etdUao LjF0WDCRiYIJ+K0Akr9IutVJ4LYBcqH0wY+PWLPmeFmCmDwZmL8H9KEmtxgorn1uxx R2xilBUwqdDYS7DytvSRqIMGw+DnbNixScZj+gd0Fz4emL411ePlXdzeIyIqDfZ8Qk I+2xYfp+KZlYG1eqO2068s8GpXtfHPyje5lLZSwOUdvXm3cFQKiyw23fjeOHnnbG+4 lujeiM34+H1EQ== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , linux-arch@vger.kernel.org, David Howells , David Woodhouse , keyrings@vger.kernel.org, Richard Weinberger , Nicolas Schier , Masahiro Yamada Subject: [PATCH v2 07/11] certs: simplify $(srctree)/ handling and remove config_filename macro Date: Tue, 14 Dec 2021 11:53:51 +0900 Message-Id: <20211214025355.1267796-8-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214025355.1267796-1-masahiroy@kernel.org> References: <20211214025355.1267796-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org The complex macro, config_filename, was introduced to do: [1] drop double-quotes from the string value [2] add $(srctree)/ prefix in case the file is not found in $(objtree) [3] escape spaces and more [1] will be more generally handled by Kconfig later. As for [2], Kbuild uses VPATH to search for files in $(objtree), $(srctree) in this order. GNU Make can natively handle it. As for [3], converting $(space) to $(space_escape) back and forth looks questionable to me. It is well-known that GNU Make cannot handle file paths with spaces in the first place. Instead of using the complex macro, use $< so it will be expanded to the file path of the key. Remove config_filename, finally. Signed-off-by: Masahiro Yamada --- (no changes since v1) certs/Makefile | 32 ++++++++++++---------------- scripts/Kbuild.include | 47 ------------------------------------------ 2 files changed, 13 insertions(+), 66 deletions(-) diff --git a/certs/Makefile b/certs/Makefile index c3c8da03b04b..69c1404152ef 100644 --- a/certs/Makefile +++ b/certs/Makefile @@ -15,15 +15,12 @@ endif quiet_cmd_extract_certs = CERT $@ cmd_extract_certs = scripts/extract-cert $(2) $@ -ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y) - -$(eval $(call config_filename,SYSTEM_TRUSTED_KEYS)) - $(obj)/system_certificates.o: $(obj)/x509_certificate_list -$(obj)/x509_certificate_list: scripts/extract-cert $(SYSTEM_TRUSTED_KEYS_SRCPREFIX)$(SYSTEM_TRUSTED_KEYS_FILENAME) FORCE - $(call if_changed,extract_certs,$(SYSTEM_TRUSTED_KEYS_SRCPREFIX)$(CONFIG_SYSTEM_TRUSTED_KEYS)) -endif # CONFIG_SYSTEM_TRUSTED_KEYRING +CONFIG_SYSTEM_TRUSTED_KEYS := $(CONFIG_SYSTEM_TRUSTED_KEYS:"%"=%) + +$(obj)/x509_certificate_list: $(CONFIG_SYSTEM_TRUSTED_KEYS) scripts/extract-cert FORCE + $(call if_changed,extract_certs,$(if $(CONFIG_SYSTEM_TRUSTED_KEYS),$<,"")) targets += x509_certificate_list @@ -72,29 +69,26 @@ $(obj)/x509.genkey: endif # CONFIG_MODULE_SIG_KEY -$(eval $(call config_filename,MODULE_SIG_KEY)) +CONFIG_MODULE_SIG_KEY := $(CONFIG_MODULE_SIG_KEY:"%"=%) # If CONFIG_MODULE_SIG_KEY isn't a PKCS#11 URI, depend on it -ifeq ($(patsubst pkcs11:%,%,$(firstword $(MODULE_SIG_KEY_FILENAME))),$(firstword $(MODULE_SIG_KEY_FILENAME))) -X509_DEP := $(MODULE_SIG_KEY_SRCPREFIX)$(MODULE_SIG_KEY_FILENAME) +ifneq ($(filter-out pkcs11:%, %(CONFIG_MODULE_SIG_KEY)),) +X509_DEP := $(CONFIG_MODULE_SIG_KEY) endif $(obj)/system_certificates.o: $(obj)/signing_key.x509 -$(obj)/signing_key.x509: scripts/extract-cert $(X509_DEP) FORCE - $(call if_changed,extract_certs,$(MODULE_SIG_KEY_SRCPREFIX)$(CONFIG_MODULE_SIG_KEY)) +$(obj)/signing_key.x509: $(X509_DEP) scripts/extract-cert FORCE + $(call if_changed,extract_certs,$(if $(X509_DEP),$<,$(CONFIG_MODULE_SIG_KEY))) endif # CONFIG_MODULE_SIG targets += signing_key.x509 -ifeq ($(CONFIG_SYSTEM_REVOCATION_LIST),y) - -$(eval $(call config_filename,SYSTEM_REVOCATION_KEYS)) - $(obj)/revocation_certificates.o: $(obj)/x509_revocation_list -$(obj)/x509_revocation_list: scripts/extract-cert $(SYSTEM_REVOCATION_KEYS_SRCPREFIX)$(SYSTEM_REVOCATION_KEYS_FILENAME) FORCE - $(call if_changed,extract_certs,$(SYSTEM_REVOCATION_KEYS_SRCPREFIX)$(CONFIG_SYSTEM_REVOCATION_KEYS)) -endif +CONFIG_SYSTEM_REVOCATION_KEYS := $(CONFIG_SYSTEM_REVOCATION_KEYS:"%"=%) + +$(obj)/x509_revocation_list: $(CONFIG_SYSTEM_REVOCATION_KEYS) scripts/extract-cert FORCE + $(call if_changed,extract_certs,$(if $(CONFIG_SYSTEM_REVOCATION_KEYS),$<,"")) targets += x509_revocation_list diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index cdec22088423..3514c2149e9d 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include @@ -195,53 +195,6 @@ why = \ echo-why = $(call escsq, $(strip $(why))) endif -############################################################################### -# -# When a Kconfig string contains a filename, it is suitable for -# passing to shell commands. It is surrounded by double-quotes, and -# any double-quotes or backslashes within it are escaped by -# backslashes. -# -# This is no use for dependencies or $(wildcard). We need to strip the -# surrounding quotes and the escaping from quotes and backslashes, and -# we *do* need to escape any spaces in the string. So, for example: -# -# Usage: $(eval $(call config_filename,FOO)) -# -# Defines FOO_FILENAME based on the contents of the CONFIG_FOO option, -# transformed as described above to be suitable for use within the -# makefile. -# -# Also, if the filename is a relative filename and exists in the source -# tree but not the build tree, define FOO_SRCPREFIX as $(srctree)/ to -# be prefixed to *both* command invocation and dependencies. -# -# Note: We also print the filenames in the quiet_cmd_foo text, and -# perhaps ought to have a version specially escaped for that purpose. -# But it's only cosmetic, and $(patsubst "%",%,$(CONFIG_FOO)) is good -# enough. It'll strip the quotes in the common case where there's no -# space and it's a simple filename, and it'll retain the quotes when -# there's a space. There are some esoteric cases in which it'll print -# the wrong thing, but we don't really care. The actual dependencies -# and commands *do* get it right, with various combinations of single -# and double quotes, backslashes and spaces in the filenames. -# -############################################################################### -# -define config_filename -ifneq ($$(CONFIG_$(1)),"") -$(1)_FILENAME := $$(subst \\,\,$$(subst \$$(quote),$$(quote),$$(subst $$(space_escape),\$$(space),$$(patsubst "%",%,$$(subst $$(space),$$(space_escape),$$(CONFIG_$(1))))))) -ifneq ($$(patsubst /%,%,$$(firstword $$($(1)_FILENAME))),$$(firstword $$($(1)_FILENAME))) -else -ifeq ($$(wildcard $$($(1)_FILENAME)),) -ifneq ($$(wildcard $$(srctree)/$$($(1)_FILENAME)),) -$(1)_SRCPREFIX := $(srctree)/ -endif -endif -endif -endif -endef -# ############################################################################### # delete partially updated (i.e. corrupted) files on error From patchwork Tue Dec 14 02:53:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12675367 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 0C095C4321E for ; Tue, 14 Dec 2021 02:55:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244581AbhLNCzj (ORCPT ); Mon, 13 Dec 2021 21:55:39 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:41852 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232243AbhLNCz2 (ORCPT ); Mon, 13 Dec 2021 21:55:28 -0500 Received: from grover.. (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-11.nifty.com with ESMTP id 1BE2s0bj012823; Tue, 14 Dec 2021 11:54:08 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 1BE2s0bj012823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1639450449; bh=bSsT+oNOssdEjmkWLWizU8OgYkwVi5/vGKiY/1TkX8o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FHypkgG9mGJmdTSr0ola0me2FGZbIrw2GEWCmH6m/6X9GujqLjTB6r/KAQHVIM4wd t8JMR0MRqynOiPFxES9V5hulRj2p/Wmn8aST/70rDAV0u/klsAUFN8w2NQr9cNIc0i MGSMfwZNdXm1AV8j8i/bOYY8VyETfN0ABxQrdRx4CZ/MHBT6fk7qxl5e849c2uSy+7 kcX0+M8qyJujPFCeRYBEjgE+UzCOo96cLBiQkgc6bU7STnl9+cRmu15Uytph7l2X9y JswDfiDJOr2jt69+PwWsLBJMLq5sa2sXHS+b3LPTIrTbVTt2mcnLql4iTsrz7p4vxe m0DlECfP4YwJA== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , linux-arch@vger.kernel.org, David Howells , David Woodhouse , keyrings@vger.kernel.org, Richard Weinberger , Nicolas Schier , Masahiro Yamada Subject: [PATCH v2 08/11] kbuild: do not include include/config/auto.conf from shell scripts Date: Tue, 14 Dec 2021 11:53:52 +0900 Message-Id: <20211214025355.1267796-9-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214025355.1267796-1-masahiroy@kernel.org> References: <20211214025355.1267796-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org Richard Weinberger pointed out the risk of sourcing the kernel config from shell scripts [1], and proposed some patches [2], [3]. It is a good point, but it took a long time because I was wondering how to fix this. This commit goes with simple grep approach because there are only a few scripts including the kernel configuration. scripts/link_vmlinux.sh has references to a bunch of CONFIG options, all of which are boolean. I added is_enabled() helper as scripts/package/{mkdebian,builddeb} do. scripts/gen_autoksyms.sh uses 'eval', stating "to expand the whitelist path". I removed it since it is the issue we are trying to fix. I was a bit worried about the cost of invoking the grep command over again. I extracted the grep parts from it, and measured the cost. It was approximately 0.03 sec, which I hope is acceptable. [test code] $ cat test-grep.sh #!/bin/sh is_enabled() { grep -q "^$1=y" include/config/auto.conf } is_enabled CONFIG_LTO_CLANG is_enabled CONFIG_LTO_CLANG is_enabled CONFIG_STACK_VALIDATION is_enabled CONFIG_UNWINDER_ORC is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL is_enabled CONFIG_VMLINUX_VALIDATION is_enabled CONFIG_FRAME_POINTER is_enabled CONFIG_GCOV_KERNEL is_enabled CONFIG_LTO_CLANG is_enabled CONFIG_RETPOLINE is_enabled CONFIG_X86_SMAP is_enabled CONFIG_LTO_CLANG is_enabled CONFIG_VMLINUX_MAP is_enabled CONFIG_KALLSYMS_ALL is_enabled CONFIG_KALLSYMS_ABSOLUTE_PERCPU is_enabled CONFIG_KALLSYMS_BASE_RELATIVE is_enabled CONFIG_DEBUG_INFO_BTF is_enabled CONFIG_KALLSYMS is_enabled CONFIG_DEBUG_INFO_BTF is_enabled CONFIG_BPF is_enabled CONFIG_BUILDTIME_TABLE_SORT is_enabled CONFIG_KALLSYMS $ time ./test-grep.sh real 0m0.036s user 0m0.027s sys m0.009s [1]: https://lore.kernel.org/all/1919455.eZKeABUfgV@blindfold/ [2]: https://lore.kernel.org/all/20180219092245.26404-1-richard@nod.at/ [3]: https://lore.kernel.org/all/20210920213957.1064-2-richard@nod.at/ Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- Changes in v2: - complete the fixes of gen_autoksyms.sh scripts/gen_autoksyms.sh | 11 +++------- scripts/link-vmlinux.sh | 47 ++++++++++++++++++++-------------------- scripts/setlocalversion | 9 ++++---- 3 files changed, 31 insertions(+), 36 deletions(-) diff --git a/scripts/gen_autoksyms.sh b/scripts/gen_autoksyms.sh index 6ed0d225c8b1..949d6a054034 100755 --- a/scripts/gen_autoksyms.sh +++ b/scripts/gen_autoksyms.sh @@ -16,20 +16,15 @@ case "$KBUILD_VERBOSE" in ;; esac -# We need access to CONFIG_ symbols -. include/config/auto.conf - needed_symbols= # Special case for modversions (see modpost.c) -if [ -n "$CONFIG_MODVERSIONS" ]; then +if grep -q "^CONFIG_MODVERSIONS=y$" include/config/auto.conf; then needed_symbols="$needed_symbols module_layout" fi -ksym_wl= -if [ -n "$CONFIG_UNUSED_KSYMS_WHITELIST" ]; then - # Use 'eval' to expand the whitelist path and check if it is relative - eval ksym_wl="$CONFIG_UNUSED_KSYMS_WHITELIST" +ksym_wl=$(sed -n 's/^CONFIG_UNUSED_KSYMS_WHITELIST="\(.*\)"$/\1/p' include/config/auto.conf) +if [ -n "$ksym_wl" ]; then [ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl" if [ ! -f "$ksym_wl" ] || [ ! -r "$ksym_wl" ]; then echo "ERROR: '$ksym_wl' whitelist file not found" >&2 diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh index 5cdd9bc5c385..a4b61a2f65db 100755 --- a/scripts/link-vmlinux.sh +++ b/scripts/link-vmlinux.sh @@ -34,6 +34,10 @@ LD="$1" KBUILD_LDFLAGS="$2" LDFLAGS_vmlinux="$3" +is_enabled() { + grep -q "^$1=y" include/config/auto.conf +} + # Nice output in kbuild format # Will be supressed by "make -s" info() @@ -80,11 +84,11 @@ modpost_link() ${KBUILD_VMLINUX_LIBS} \ --end-group" - if [ -n "${CONFIG_LTO_CLANG}" ]; then + if is_enabled CONFIG_LTO_CLANG; then gen_initcalls lds="-T .tmp_initcalls.lds" - if [ -n "${CONFIG_MODVERSIONS}" ]; then + if is_enabled CONFIG_MODVERSIONS; then gen_symversions lds="${lds} -T .tmp_symversions.lds" fi @@ -104,21 +108,21 @@ objtool_link() local objtoolcmd; local objtoolopt; - if [ "${CONFIG_LTO_CLANG} ${CONFIG_STACK_VALIDATION}" = "y y" ]; then + if is_enabled CONFIG_LTO_CLANG && is_enabled CONFIG_STACK_VALIDATION; then # Don't perform vmlinux validation unless explicitly requested, # but run objtool on vmlinux.o now that we have an object file. - if [ -n "${CONFIG_UNWINDER_ORC}" ]; then + if is_enabled CONFIG_UNWINDER_ORC; then objtoolcmd="orc generate" fi objtoolopt="${objtoolopt} --duplicate" - if [ -n "${CONFIG_FTRACE_MCOUNT_USE_OBJTOOL}" ]; then + if is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL; then objtoolopt="${objtoolopt} --mcount" fi fi - if [ -n "${CONFIG_VMLINUX_VALIDATION}" ]; then + if is_enabled CONFIG_VMLINUX_VALIDATION; then objtoolopt="${objtoolopt} --noinstr" fi @@ -127,16 +131,16 @@ objtool_link() objtoolcmd="check" fi objtoolopt="${objtoolopt} --vmlinux" - if [ -z "${CONFIG_FRAME_POINTER}" ]; then + if ! is_enabled CONFIG_FRAME_POINTER; then objtoolopt="${objtoolopt} --no-fp" fi - if [ -n "${CONFIG_GCOV_KERNEL}" ] || [ -n "${CONFIG_LTO_CLANG}" ]; then + if is_enabled CONFIG_GCOV_KERNEL || is_enabled CONFIG_LTO_CLANG; then objtoolopt="${objtoolopt} --no-unreachable" fi - if [ -n "${CONFIG_RETPOLINE}" ]; then + if is_enabled CONFIG_RETPOLINE; then objtoolopt="${objtoolopt} --retpoline" fi - if [ -n "${CONFIG_X86_SMAP}" ]; then + if is_enabled CONFIG_X86_SMAP; then objtoolopt="${objtoolopt} --uaccess" fi info OBJTOOL ${1} @@ -161,7 +165,7 @@ vmlinux_link() # skip output file argument shift - if [ -n "${CONFIG_LTO_CLANG}" ]; then + if is_enabled CONFIG_LTO_CLANG; then # Use vmlinux.o instead of performing the slow LTO link again. objs=vmlinux.o libs= @@ -189,7 +193,7 @@ vmlinux_link() ldflags="${ldflags} ${wl}--strip-debug" fi - if [ -n "${CONFIG_VMLINUX_MAP}" ]; then + if is_enabled CONFIG_VMLINUX_MAP; then ldflags="${ldflags} ${wl}-Map=${output}.map" fi @@ -239,15 +243,15 @@ kallsyms() { local kallsymopt; - if [ -n "${CONFIG_KALLSYMS_ALL}" ]; then + if is_enabled CONFIG_KALLSYMS_ALL; then kallsymopt="${kallsymopt} --all-symbols" fi - if [ -n "${CONFIG_KALLSYMS_ABSOLUTE_PERCPU}" ]; then + if is_enabled CONFIG_KALLSYMS_ABSOLUTE_PERCPU; then kallsymopt="${kallsymopt} --absolute-percpu" fi - if [ -n "${CONFIG_KALLSYMS_BASE_RELATIVE}" ]; then + if is_enabled CONFIG_KALLSYMS_BASE_RELATIVE; then kallsymopt="${kallsymopt} --base-relative" fi @@ -312,9 +316,6 @@ if [ "$1" = "clean" ]; then exit 0 fi -# We need access to CONFIG_ symbols -. include/config/auto.conf - # Update version info GEN .version if [ -r .version ]; then @@ -343,7 +344,7 @@ tr '\0' '\n' < modules.builtin.modinfo | sed -n 's/^[[:alnum:]:_]*\.file=//p' | tr ' ' '\n' | uniq | sed -e 's:^:kernel/:' -e 's/$/.ko/' > modules.builtin btf_vmlinux_bin_o="" -if [ -n "${CONFIG_DEBUG_INFO_BTF}" ]; then +if is_enabled CONFIG_DEBUG_INFO_BTF; then btf_vmlinux_bin_o=.btf.vmlinux.bin.o if ! gen_btf .tmp_vmlinux.btf $btf_vmlinux_bin_o ; then echo >&2 "Failed to generate BTF for vmlinux" @@ -355,7 +356,7 @@ fi kallsymso="" kallsymso_prev="" kallsyms_vmlinux="" -if [ -n "${CONFIG_KALLSYMS}" ]; then +if is_enabled CONFIG_KALLSYMS; then # kallsyms support # Generate section listing all symbols and add it into vmlinux @@ -395,12 +396,12 @@ fi vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o} # fill in BTF IDs -if [ -n "${CONFIG_DEBUG_INFO_BTF}" -a -n "${CONFIG_BPF}" ]; then +if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then info BTFIDS vmlinux ${RESOLVE_BTFIDS} vmlinux fi -if [ -n "${CONFIG_BUILDTIME_TABLE_SORT}" ]; then +if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then info SORTTAB vmlinux if ! sorttable vmlinux; then echo >&2 Failed to sort kernel tables @@ -412,7 +413,7 @@ info SYSMAP System.map mksysmap vmlinux System.map # step a (see comment above) -if [ -n "${CONFIG_KALLSYMS}" ]; then +if is_enabled CONFIG_KALLSYMS; then mksysmap ${kallsyms_vmlinux} .tmp_System.map if ! cmp -s System.map .tmp_System.map; then diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 6b54e46a0f12..d06137405190 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -111,9 +111,7 @@ if $scm_only; then exit fi -if test -e include/config/auto.conf; then - . include/config/auto.conf -else +if ! test -e include/config/auto.conf; then echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2 exit 1 fi @@ -125,10 +123,11 @@ if test ! "$srctree" -ef .; then fi # CONFIG_LOCALVERSION and LOCALVERSION (if set) -res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}" +config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION="\(.*\)"$/\1/p' include/config/auto.conf) +res="${res}${config_localversion}${LOCALVERSION}" # scm version string if not at a tagged commit -if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then +if grep -q "^CONFIG_LOCALVERSION_AUTO=y$" include/config/auto.conf; then # full scm version string res="$res$(scm_version)" elif [ "${LOCALVERSION+set}" != "set" ]; then From patchwork Tue Dec 14 02:53:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12675357 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 51055C433FE for ; Tue, 14 Dec 2021 02:55:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236306AbhLNCza (ORCPT ); Mon, 13 Dec 2021 21:55:30 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:41839 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbhLNCz1 (ORCPT ); Mon, 13 Dec 2021 21:55:27 -0500 Received: from grover.. (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-11.nifty.com with ESMTP id 1BE2s0bk012823; Tue, 14 Dec 2021 11:54:09 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 1BE2s0bk012823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1639450449; bh=XY3Y8BgBvFVYU2BMULL8b3z5Iscv+dC8iPHww02Ieas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IoCc5boAAarw6DfFrrIzXr/Rq+52DhjG3MsYHbiT2OuePfM6eH44BpyUQsoTDEYpg /VC8GDyeRCnwuGi5Vks+WCJ0sd/3oheGvedXhihxloTEaqBEbICX31Rv9gREGdiott HP4gYj262JOwAp5lzLol1xuKOzrvoSd9Xj+b4ObgKyWPOPN07LIIg1pUVx33hJcoMV yb5AizyHBtE0htvPFOqGCi742RcMfXcXZn+qdl3uOsb0zo1ku/mfP5SyvAAbX9smSR LlUtum5sCDybyurgCIa410Zry01gIjjv0fPXoKtQDd8wO3KYRnfeNoPqOsf7DiIj9E ufu2QDW/d0yTg== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , linux-arch@vger.kernel.org, David Howells , David Woodhouse , keyrings@vger.kernel.org, Richard Weinberger , Nicolas Schier , Masahiro Yamada Subject: [PATCH v2 09/11] kbuild: do not quote string values in include/config/auto.conf Date: Tue, 14 Dec 2021 11:53:53 +0900 Message-Id: <20211214025355.1267796-10-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214025355.1267796-1-masahiroy@kernel.org> References: <20211214025355.1267796-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org The previous commit fixed up all shell scripts to not include include/config/auto.conf. Now that include/config/auto.conf is only included by Makefiles, we can change it into a more Make-friendly form. Previously, Kconfig output string values enclosed with double-quotes (both in the .config and include/config/auto.conf): CONFIG_X="foo bar" Unlike shell, Make handles double-quotes (and single-quotes as well) verbatim. We must rip them off when used. There are some patterns: [1] $(patsubst "%",%,$(CONFIG_X)) [2] $(CONFIG_X:"%"=%) [3] $(subst ",,$(CONFIG_X)) [4] $(shell echo $(CONFIG_X)) These are not only ugly, but also fragile. [1] and [2] do not work if the value contains spaces, like CONFIG_X=" foo bar " [3] does not work correctly if the value contains double-quotes like CONFIG_X="foo\"bar" [4] seems to work better, but has a cost of forking a process. Anyway, quoted strings were always PITA for our Makefiles. This commit changes Kconfig to stop quoting in include/config/auto.conf. These are the string type symbols referenced in Makefiles or scripts: ACPI_CUSTOM_DSDT_FILE ARC_BUILTIN_DTB_NAME ARC_TUNE_MCPU BUILTIN_DTB_SOURCE CC_IMPLICIT_FALLTHROUGH CC_VERSION_TEXT CFG80211_EXTRA_REGDB_KEYDIR EXTRA_FIRMWARE EXTRA_FIRMWARE_DIR EXTRA_TARGETS H8300_BUILTIN_DTB INITRAMFS_SOURCE LOCALVERSION MODULE_SIG_HASH MODULE_SIG_KEY NDS32_BUILTIN_DTB NIOS2_DTB_SOURCE OPENRISC_BUILTIN_DTB SOC_CANAAN_K210_DTB_SOURCE SYSTEM_BLACKLIST_HASH_LIST SYSTEM_REVOCATION_KEYS SYSTEM_TRUSTED_KEYS TARGET_CPU UNUSED_KSYMS_WHITELIST XILINX_MICROBLAZE0_FAMILY XILINX_MICROBLAZE0_HW_VER XTENSA_VARIANT_NAME I checked them one by one, and fixed up the code where necessary. Signed-off-by: Masahiro Yamada --- (no changes since v1) Makefile | 4 ++-- arch/arc/Makefile | 4 ++-- arch/arc/boot/dts/Makefile | 4 ++-- arch/h8300/boot/dts/Makefile | 6 +----- arch/microblaze/Makefile | 2 +- arch/nds32/boot/dts/Makefile | 7 +------ arch/nios2/boot/dts/Makefile | 2 +- arch/openrisc/boot/dts/Makefile | 7 +------ arch/powerpc/boot/Makefile | 2 +- arch/riscv/boot/dts/canaan/Makefile | 4 +--- arch/sh/boot/dts/Makefile | 4 +--- arch/xtensa/Makefile | 2 +- arch/xtensa/boot/dts/Makefile | 5 +---- certs/Makefile | 10 ++-------- drivers/acpi/Makefile | 2 +- drivers/base/firmware_loader/builtin/Makefile | 4 ++-- init/Makefile | 2 +- net/wireless/Makefile | 4 ++-- scripts/Makefile.modinst | 1 - scripts/gen_autoksyms.sh | 2 +- scripts/kconfig/confdata.c | 2 +- scripts/setlocalversion | 2 +- usr/Makefile | 2 +- 23 files changed, 28 insertions(+), 56 deletions(-) diff --git a/Makefile b/Makefile index 4e8ac0730f51..aa4e5dc12049 100644 --- a/Makefile +++ b/Makefile @@ -1729,9 +1729,9 @@ PHONY += prepare # now expand this into a simple variable to reduce the cost of shell evaluations prepare: CC_VERSION_TEXT := $(CC_VERSION_TEXT) prepare: - @if [ "$(CC_VERSION_TEXT)" != $(CONFIG_CC_VERSION_TEXT) ]; then \ + @if [ "$(CC_VERSION_TEXT)" != "$(CONFIG_CC_VERSION_TEXT)" ]; then \ echo >&2 "warning: the compiler differs from the one used to build the kernel"; \ - echo >&2 " The kernel was built by: "$(CONFIG_CC_VERSION_TEXT); \ + echo >&2 " The kernel was built by: $(CONFIG_CC_VERSION_TEXT)"; \ echo >&2 " You are using: $(CC_VERSION_TEXT)"; \ fi diff --git a/arch/arc/Makefile b/arch/arc/Makefile index f252e7b924e9..efc54f3e35e0 100644 --- a/arch/arc/Makefile +++ b/arch/arc/Makefile @@ -14,10 +14,10 @@ cflags-y += -fno-common -pipe -fno-builtin -mmedium-calls -D__linux__ tune-mcpu-def-$(CONFIG_ISA_ARCOMPACT) := -mcpu=arc700 tune-mcpu-def-$(CONFIG_ISA_ARCV2) := -mcpu=hs38 -ifeq ($(CONFIG_ARC_TUNE_MCPU),"") +ifeq ($(CONFIG_ARC_TUNE_MCPU),) cflags-y += $(tune-mcpu-def-y) else -tune-mcpu := $(shell echo $(CONFIG_ARC_TUNE_MCPU)) +tune-mcpu := $(CONFIG_ARC_TUNE_MCPU) ifneq ($(call cc-option,$(tune-mcpu)),) cflags-y += $(tune-mcpu) else diff --git a/arch/arc/boot/dts/Makefile b/arch/arc/boot/dts/Makefile index 8483a86c743d..4237aa5de3a3 100644 --- a/arch/arc/boot/dts/Makefile +++ b/arch/arc/boot/dts/Makefile @@ -2,8 +2,8 @@ # Built-in dtb builtindtb-y := nsim_700 -ifneq ($(CONFIG_ARC_BUILTIN_DTB_NAME),"") - builtindtb-y := $(patsubst "%",%,$(CONFIG_ARC_BUILTIN_DTB_NAME)) +ifneq ($(CONFIG_ARC_BUILTIN_DTB_NAME),) + builtindtb-y := $(CONFIG_ARC_BUILTIN_DTB_NAME) endif obj-y += $(builtindtb-y).dtb.o diff --git a/arch/h8300/boot/dts/Makefile b/arch/h8300/boot/dts/Makefile index 69fcd817892c..c36bbd1f2592 100644 --- a/arch/h8300/boot/dts/Makefile +++ b/arch/h8300/boot/dts/Makefile @@ -1,9 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 -ifneq '$(CONFIG_H8300_BUILTIN_DTB)' '""' -BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_H8300_BUILTIN_DTB)).dtb.o -endif - -obj-y += $(BUILTIN_DTB) +obj-y += $(addsuffix .dtb.o, $(CONFIG_H8300_BUILTIN_DTB)) dtb-$(CONFIG_H8300H_SIM) := h8300h_sim.dtb dtb-$(CONFIG_H8S_SIM) := h8s_sim.dtb diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile index e775a696aa6f..a25e76d89e86 100644 --- a/arch/microblaze/Makefile +++ b/arch/microblaze/Makefile @@ -5,7 +5,7 @@ UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\" # What CPU version are we building for, and crack it open # as major.minor.rev -CPU_VER := $(shell echo $(CONFIG_XILINX_MICROBLAZE0_HW_VER)) +CPU_VER := $(CONFIG_XILINX_MICROBLAZE0_HW_VER) CPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1) CPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2) CPU_REV := $(shell echo $(CPU_VER) | cut -d '.' -f 3) diff --git a/arch/nds32/boot/dts/Makefile b/arch/nds32/boot/dts/Makefile index f84bd529b6fd..4fc69562eae8 100644 --- a/arch/nds32/boot/dts/Makefile +++ b/arch/nds32/boot/dts/Makefile @@ -1,7 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -ifneq '$(CONFIG_NDS32_BUILTIN_DTB)' '""' -BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_NDS32_BUILTIN_DTB)).dtb.o -else -BUILTIN_DTB := -endif -obj-$(CONFIG_OF) += $(BUILTIN_DTB) +obj-$(CONFIG_OF) += $(addsuffix .dtb.o, $(CONFIG_NDS32_BUILTIN_DTB)) diff --git a/arch/nios2/boot/dts/Makefile b/arch/nios2/boot/dts/Makefile index a91a0b09be63..e9e31bb40df8 100644 --- a/arch/nios2/boot/dts/Makefile +++ b/arch/nios2/boot/dts/Makefile @@ -1,6 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 -obj-y := $(patsubst "%.dts",%.dtb.o,$(CONFIG_NIOS2_DTB_SOURCE)) +obj-y := $(patsubst %.dts,%.dtb.o,$(CONFIG_NIOS2_DTB_SOURCE)) dtstree := $(srctree)/$(src) dtb-$(CONFIG_OF_ALL_DTBS) := $(patsubst $(dtstree)/%.dts,%.dtb, $(wildcard $(dtstree)/*.dts)) diff --git a/arch/openrisc/boot/dts/Makefile b/arch/openrisc/boot/dts/Makefile index 17dd791a833f..13db5a2aab52 100644 --- a/arch/openrisc/boot/dts/Makefile +++ b/arch/openrisc/boot/dts/Makefile @@ -1,9 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 -ifneq '$(CONFIG_OPENRISC_BUILTIN_DTB)' '""' -BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_OPENRISC_BUILTIN_DTB)).dtb.o -else -BUILTIN_DTB := -endif -obj-y += $(BUILTIN_DTB) +obj-y += $(addsuffix .dtb.o, $(CONFIG_OPENRISC_BUILTIN_DTB)) #DTC_FLAGS ?= -p 1024 diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile index 9993c6256ad2..4b4827c475c6 100644 --- a/arch/powerpc/boot/Makefile +++ b/arch/powerpc/boot/Makefile @@ -365,7 +365,7 @@ image-$(CONFIG_PPC_PMAC) += zImage.coff zImage.miboot endif # Allow extra targets to be added to the defconfig -image-y += $(subst ",,$(CONFIG_EXTRA_TARGETS)) +image-y += $(CONFIG_EXTRA_TARGETS) initrd- := $(patsubst zImage%, zImage.initrd%, $(image-)) initrd-y := $(patsubst zImage%, zImage.initrd%, \ diff --git a/arch/riscv/boot/dts/canaan/Makefile b/arch/riscv/boot/dts/canaan/Makefile index 9ee7156c0c31..c61b08ac8554 100644 --- a/arch/riscv/boot/dts/canaan/Makefile +++ b/arch/riscv/boot/dts/canaan/Makefile @@ -1,5 +1,3 @@ # SPDX-License-Identifier: GPL-2.0 -ifneq ($(CONFIG_SOC_CANAAN_K210_DTB_SOURCE),"") -dtb-y += $(strip $(shell echo $(CONFIG_SOC_CANAAN_K210_DTB_SOURCE))).dtb +dtb-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += $(addsuffix .dtb, $(CONFIG_SOC_CANAAN_K210_DTB_SOURCE)) obj-$(CONFIG_SOC_CANAAN_K210_DTB_BUILTIN) += $(addsuffix .o, $(dtb-y)) -endif diff --git a/arch/sh/boot/dts/Makefile b/arch/sh/boot/dts/Makefile index c17d65b82abe..4a6dec9714a9 100644 --- a/arch/sh/boot/dts/Makefile +++ b/arch/sh/boot/dts/Makefile @@ -1,4 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"") -obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o -endif +obj-$(CONFIG_USE_BUILTIN_DTB) += $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_SOURCE)) diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile index 9778216d6e09..ee2769519eaf 100644 --- a/arch/xtensa/Makefile +++ b/arch/xtensa/Makefile @@ -12,7 +12,7 @@ # Core configuration. # (Use VAR= to use another default compiler.) -variant-y := $(patsubst "%",%,$(CONFIG_XTENSA_VARIANT_NAME)) +variant-y := $(CONFIG_XTENSA_VARIANT_NAME) VARIANT = $(variant-y) diff --git a/arch/xtensa/boot/dts/Makefile b/arch/xtensa/boot/dts/Makefile index 0b8d00cdae7c..720628c0d8b9 100644 --- a/arch/xtensa/boot/dts/Makefile +++ b/arch/xtensa/boot/dts/Makefile @@ -7,10 +7,7 @@ # # -BUILTIN_DTB_SOURCE := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o -ifneq ($(CONFIG_BUILTIN_DTB_SOURCE),"") -obj-$(CONFIG_OF) += $(BUILTIN_DTB_SOURCE) -endif +obj-$(CONFIG_OF) += $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_SOURCE)) # for CONFIG_OF_ALL_DTBS test dtstree := $(srctree)/$(src) diff --git a/certs/Makefile b/certs/Makefile index 69c1404152ef..7b48445d71f6 100644 --- a/certs/Makefile +++ b/certs/Makefile @@ -6,7 +6,7 @@ obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o common.o obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist.o common.o obj-$(CONFIG_SYSTEM_REVOCATION_LIST) += revocation_certificates.o -ifneq ($(CONFIG_SYSTEM_BLACKLIST_HASH_LIST),"") +ifneq ($(CONFIG_SYSTEM_BLACKLIST_HASH_LIST),) obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_hashes.o else obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o @@ -17,8 +17,6 @@ quiet_cmd_extract_certs = CERT $@ $(obj)/system_certificates.o: $(obj)/x509_certificate_list -CONFIG_SYSTEM_TRUSTED_KEYS := $(CONFIG_SYSTEM_TRUSTED_KEYS:"%"=%) - $(obj)/x509_certificate_list: $(CONFIG_SYSTEM_TRUSTED_KEYS) scripts/extract-cert FORCE $(call if_changed,extract_certs,$(if $(CONFIG_SYSTEM_TRUSTED_KEYS),$<,"")) @@ -46,7 +44,7 @@ ifdef SIGN_KEY # We do it this way rather than having a boolean option for enabling an # external private key, because 'make randconfig' might enable such a # boolean option and we unfortunately can't make it depend on !RANDCONFIG. -ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem") +ifeq ($(CONFIG_MODULE_SIG_KEY),certs/signing_key.pem) keytype-$(CONFIG_MODULE_SIG_KEY_TYPE_ECDSA) := -newkey ec -pkeyopt ec_paramgen_curve:secp384r1 @@ -69,8 +67,6 @@ $(obj)/x509.genkey: endif # CONFIG_MODULE_SIG_KEY -CONFIG_MODULE_SIG_KEY := $(CONFIG_MODULE_SIG_KEY:"%"=%) - # If CONFIG_MODULE_SIG_KEY isn't a PKCS#11 URI, depend on it ifneq ($(filter-out pkcs11:%, %(CONFIG_MODULE_SIG_KEY)),) X509_DEP := $(CONFIG_MODULE_SIG_KEY) @@ -86,8 +82,6 @@ targets += signing_key.x509 $(obj)/revocation_certificates.o: $(obj)/x509_revocation_list -CONFIG_SYSTEM_REVOCATION_KEYS := $(CONFIG_SYSTEM_REVOCATION_KEYS:"%"=%) - $(obj)/x509_revocation_list: $(CONFIG_SYSTEM_REVOCATION_KEYS) scripts/extract-cert FORCE $(call if_changed,extract_certs,$(if $(CONFIG_SYSTEM_REVOCATION_KEYS),$<,"")) diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 3018714e87d9..da0cdd1e9380 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -9,7 +9,7 @@ ccflags-$(CONFIG_ACPI_DEBUG) += -DACPI_DEBUG_OUTPUT # ACPI Boot-Time Table Parsing # ifeq ($(CONFIG_ACPI_CUSTOM_DSDT),y) -tables.o: $(src)/../../include/$(subst $\",,$(CONFIG_ACPI_CUSTOM_DSDT_FILE)) ; +tables.o: $(src)/../../include/$(CONFIG_ACPI_CUSTOM_DSDT_FILE) ; endif diff --git a/drivers/base/firmware_loader/builtin/Makefile b/drivers/base/firmware_loader/builtin/Makefile index eb4be452062a..6c067dedc01e 100644 --- a/drivers/base/firmware_loader/builtin/Makefile +++ b/drivers/base/firmware_loader/builtin/Makefile @@ -3,10 +3,10 @@ obj-y += main.o # Create $(fwdir) from $(CONFIG_EXTRA_FIRMWARE_DIR) -- if it doesn't have a # leading /, it's relative to $(srctree). -fwdir := $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE_DIR)) +fwdir := $(CONFIG_EXTRA_FIRMWARE_DIR) fwdir := $(addprefix $(srctree)/,$(filter-out /%,$(fwdir)))$(filter /%,$(fwdir)) -firmware := $(addsuffix .gen.o, $(subst $(quote),,$(CONFIG_EXTRA_FIRMWARE))) +firmware := $(addsuffix .gen.o, $(CONFIG_EXTRA_FIRMWARE)) obj-y += $(firmware) FWNAME = $(patsubst $(obj)/%.gen.S,%,$@) diff --git a/init/Makefile b/init/Makefile index 04eeee12c076..06326e304384 100644 --- a/init/Makefile +++ b/init/Makefile @@ -31,7 +31,7 @@ quiet_cmd_compile.h = CHK $@ cmd_compile.h = \ $(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT_BUILD)" \ - "$(CONFIG_PREEMPT_RT)" $(CONFIG_CC_VERSION_TEXT) "$(LD)" + "$(CONFIG_PREEMPT_RT)" "$(CONFIG_CC_VERSION_TEXT)" "$(LD)" include/generated/compile.h: FORCE $(call cmd,compile.h) diff --git a/net/wireless/Makefile b/net/wireless/Makefile index 756e7de7e33f..1e9be50469ce 100644 --- a/net/wireless/Makefile +++ b/net/wireless/Makefile @@ -33,8 +33,8 @@ $(obj)/shipped-certs.c: $(wildcard $(srctree)/$(src)/certs/*.hex) echo 'unsigned int shipped_regdb_certs_len = sizeof(shipped_regdb_certs);'; \ ) > $@ -$(obj)/extra-certs.c: $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%) \ - $(wildcard $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR:"%"=%)/*.x509) +$(obj)/extra-certs.c: $(CONFIG_CFG80211_EXTRA_REGDB_KEYDI) \ + $(wildcard $(CONFIG_CFG80211_EXTRA_REGDB_KEYDIR)/*.x509) @$(kecho) " GEN $@" $(Q)(set -e; \ allf=""; \ diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index df7e3d578ef5..c2c43a0ecfe0 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst @@ -66,7 +66,6 @@ endif # Don't stop modules_install even if we can't sign external modules. # ifeq ($(CONFIG_MODULE_SIG_ALL),y) -CONFIG_MODULE_SIG_KEY := $(CONFIG_MODULE_SIG_KEY:"%"=%) sig-key := $(if $(wildcard $(CONFIG_MODULE_SIG_KEY)),,$(srctree)/)$(CONFIG_MODULE_SIG_KEY) quiet_cmd_sign = SIGN $@ cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) $(sig-key) certs/signing_key.x509 $@ \ diff --git a/scripts/gen_autoksyms.sh b/scripts/gen_autoksyms.sh index 949d6a054034..120225c541c5 100755 --- a/scripts/gen_autoksyms.sh +++ b/scripts/gen_autoksyms.sh @@ -23,7 +23,7 @@ if grep -q "^CONFIG_MODVERSIONS=y$" include/config/auto.conf; then needed_symbols="$needed_symbols module_layout" fi -ksym_wl=$(sed -n 's/^CONFIG_UNUSED_KSYMS_WHITELIST="\(.*\)"$/\1/p' include/config/auto.conf) +ksym_wl=$(sed -n 's/^CONFIG_UNUSED_KSYMS_WHITELIST=\(.*\)$/\1/p' include/config/auto.conf) if [ -n "$ksym_wl" ]; then [ "${ksym_wl}" != "${ksym_wl#/}" ] || ksym_wl="$abs_srctree/$ksym_wl" if [ ! -f "$ksym_wl" ] || [ ! -r "$ksym_wl" ]; then diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 42bc56ee238c..35a723a2a4c2 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -700,7 +700,7 @@ static void print_symbol_for_dotconfig(FILE *fp, struct symbol *sym) static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym) { - __print_symbol(fp, sym, OUTPUT_N_NONE, true); + __print_symbol(fp, sym, OUTPUT_N_NONE, false); } void print_symbol_for_listconfig(struct symbol *sym) diff --git a/scripts/setlocalversion b/scripts/setlocalversion index d06137405190..af4754a35e66 100755 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion @@ -123,7 +123,7 @@ if test ! "$srctree" -ef .; then fi # CONFIG_LOCALVERSION and LOCALVERSION (if set) -config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION="\(.*\)"$/\1/p' include/config/auto.conf) +config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf) res="${res}${config_localversion}${LOCALVERSION}" # scm version string if not at a tagged commit diff --git a/usr/Makefile b/usr/Makefile index b1a81a40eab1..7374873a539f 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -21,7 +21,7 @@ obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o $(obj)/initramfs_data.o: $(obj)/initramfs_inc_data -ramfs-input := $(strip $(shell echo $(CONFIG_INITRAMFS_SOURCE))) +ramfs-input := $(CONFIG_INITRAMFS_SOURCE) cpio-data := # If CONFIG_INITRAMFS_SOURCE is empty, generate a small initramfs with the From patchwork Tue Dec 14 02:53:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12675363 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 92970C433EF for ; Tue, 14 Dec 2021 02:55:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240114AbhLNCze (ORCPT ); Mon, 13 Dec 2021 21:55:34 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:41846 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232270AbhLNCz1 (ORCPT ); Mon, 13 Dec 2021 21:55:27 -0500 Received: from grover.. (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-11.nifty.com with ESMTP id 1BE2s0bl012823; Tue, 14 Dec 2021 11:54:10 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 1BE2s0bl012823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1639450450; bh=CTygUjJA1h3CqGPioCmYHYypWW1IAIFm8zAYLRIwBG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tTA2qyKVFbfzPkPVBVH3djKHBYCAREWVDKNjU/RIH8hfFYdPp6e5kj5um4FL3RLyL sxhb6xMn4FM92gAj1UJjtzbv8cGg3gAMvJYOhcVCGiVlrewjqpKROZoih/mCOs8Wd7 7RW4pPaA++BVxBwUe9+sFxN7pp6jiut1z2zTIBl2BIrIcPhLobibN0FUMfdGx9r725 7V7lJs69gpVASCkqAUezXRmPeApweWdthltDWbIM6h2Jwk1xXHSj2O5o07p2VLlbYO uPteVf46ZTo3BqZH1GJCu/Uwg29zWXI762O1w0Y/1/Rum+pC7ADQvuBrfPJIzLIWBW ii9CZ7MDahNOA== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , linux-arch@vger.kernel.org, David Howells , David Woodhouse , keyrings@vger.kernel.org, Richard Weinberger , Nicolas Schier , Masahiro Yamada Subject: [PATCH v2 10/11] certs: move scripts/extract-cert to certs/ Date: Tue, 14 Dec 2021 11:53:54 +0900 Message-Id: <20211214025355.1267796-11-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214025355.1267796-1-masahiroy@kernel.org> References: <20211214025355.1267796-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org extract-cert is only used in certs/Makefile. Move it there and build extract-cert on demand. Signed-off-by: Masahiro Yamada --- Changes in v2: - new patch MAINTAINERS | 1 - certs/.gitignore | 1 + certs/Makefile | 13 +++++++++---- {scripts => certs}/extract-cert.c | 2 +- scripts/.gitignore | 1 - scripts/Makefile | 11 ++--------- scripts/remove-stale-files | 2 ++ 7 files changed, 15 insertions(+), 16 deletions(-) rename {scripts => certs}/extract-cert.c (98%) diff --git a/MAINTAINERS b/MAINTAINERS index 360e9aa0205d..f321ddbb1ab0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -4410,7 +4410,6 @@ L: keyrings@vger.kernel.org S: Maintained F: Documentation/admin-guide/module-signing.rst F: certs/ -F: scripts/extract-cert.c F: scripts/sign-file.c CFAG12864B LCD DRIVER diff --git a/certs/.gitignore b/certs/.gitignore index 8c3763f80be3..9e42fe3e02f5 100644 --- a/certs/.gitignore +++ b/certs/.gitignore @@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only +/extract-cert /x509_certificate_list /x509_revocation_list diff --git a/certs/Makefile b/certs/Makefile index 7b48445d71f6..f7041c29a2e0 100644 --- a/certs/Makefile +++ b/certs/Makefile @@ -13,11 +13,11 @@ obj-$(CONFIG_SYSTEM_BLACKLIST_KEYRING) += blacklist_nohashes.o endif quiet_cmd_extract_certs = CERT $@ - cmd_extract_certs = scripts/extract-cert $(2) $@ + cmd_extract_certs = $(obj)/extract-cert $(2) $@ $(obj)/system_certificates.o: $(obj)/x509_certificate_list -$(obj)/x509_certificate_list: $(CONFIG_SYSTEM_TRUSTED_KEYS) scripts/extract-cert FORCE +$(obj)/x509_certificate_list: $(CONFIG_SYSTEM_TRUSTED_KEYS) $(obj)/extract-cert FORCE $(call if_changed,extract_certs,$(if $(CONFIG_SYSTEM_TRUSTED_KEYS),$<,"")) targets += x509_certificate_list @@ -74,7 +74,7 @@ endif $(obj)/system_certificates.o: $(obj)/signing_key.x509 -$(obj)/signing_key.x509: $(X509_DEP) scripts/extract-cert FORCE +$(obj)/signing_key.x509: $(X509_DEP) $(obj)/extract-cert FORCE $(call if_changed,extract_certs,$(if $(X509_DEP),$<,$(CONFIG_MODULE_SIG_KEY))) endif # CONFIG_MODULE_SIG @@ -82,7 +82,12 @@ targets += signing_key.x509 $(obj)/revocation_certificates.o: $(obj)/x509_revocation_list -$(obj)/x509_revocation_list: $(CONFIG_SYSTEM_REVOCATION_KEYS) scripts/extract-cert FORCE +$(obj)/x509_revocation_list: $(CONFIG_SYSTEM_REVOCATION_KEYS) $(obj)/extract-cert FORCE $(call if_changed,extract_certs,$(if $(CONFIG_SYSTEM_REVOCATION_KEYS),$<,"")) targets += x509_revocation_list + +hostprogs := extract-cert + +HOSTCFLAGS_extract-cert.o = $(shell pkg-config --cflags libcrypto 2> /dev/null) +HOSTLDLIBS_extract-cert = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto) diff --git a/scripts/extract-cert.c b/certs/extract-cert.c similarity index 98% rename from scripts/extract-cert.c rename to certs/extract-cert.c index 3bc48c726c41..f7ef7862f207 100644 --- a/scripts/extract-cert.c +++ b/certs/extract-cert.c @@ -29,7 +29,7 @@ static __attribute__((noreturn)) void format(void) { fprintf(stderr, - "Usage: scripts/extract-cert \n"); + "Usage: extract-cert \n"); exit(2); } diff --git a/scripts/.gitignore b/scripts/.gitignore index e83c620ef52c..eed308bef604 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -1,7 +1,6 @@ # SPDX-License-Identifier: GPL-2.0-only /asn1_compiler /bin2c -/extract-cert /insert-sys-cert /kallsyms /module.lds diff --git a/scripts/Makefile b/scripts/Makefile index 9adb6d247818..e198b22dc476 100644 --- a/scripts/Makefile +++ b/scripts/Makefile @@ -3,25 +3,18 @@ # scripts contains sources for various helper programs used throughout # the kernel for the build process. -CRYPTO_LIBS = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto) -CRYPTO_CFLAGS = $(shell pkg-config --cflags libcrypto 2> /dev/null) - hostprogs-always-$(CONFIG_BUILD_BIN2C) += bin2c hostprogs-always-$(CONFIG_KALLSYMS) += kallsyms hostprogs-always-$(BUILD_C_RECORDMCOUNT) += recordmcount hostprogs-always-$(CONFIG_BUILDTIME_TABLE_SORT) += sorttable hostprogs-always-$(CONFIG_ASN1) += asn1_compiler hostprogs-always-$(CONFIG_MODULE_SIG_FORMAT) += sign-file -hostprogs-always-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += extract-cert hostprogs-always-$(CONFIG_SYSTEM_EXTRA_CERTIFICATE) += insert-sys-cert -hostprogs-always-$(CONFIG_SYSTEM_REVOCATION_LIST) += extract-cert HOSTCFLAGS_sorttable.o = -I$(srctree)/tools/include HOSTCFLAGS_asn1_compiler.o = -I$(srctree)/include -HOSTCFLAGS_sign-file.o = $(CRYPTO_CFLAGS) -HOSTLDLIBS_sign-file = $(CRYPTO_LIBS) -HOSTCFLAGS_extract-cert.o = $(CRYPTO_CFLAGS) -HOSTLDLIBS_extract-cert = $(CRYPTO_LIBS) +HOSTCFLAGS_sign-file.o = $(shell pkg-config --cflags libcrypto 2> /dev/null) +HOSTLDLIBS_sign-file = $(shell pkg-config --libs libcrypto 2> /dev/null || echo -lcrypto) ifdef CONFIG_UNWINDER_ORC ifeq ($(ARCH),x86_64) diff --git a/scripts/remove-stale-files b/scripts/remove-stale-files index 0114c41e6938..dd230792056a 100755 --- a/scripts/remove-stale-files +++ b/scripts/remove-stale-files @@ -34,3 +34,5 @@ if [ -n "${building_out_of_srctree}" ]; then rm -f arch/mips/boot/compressed/${f} done fi + +rm -f scripts/extract-cert From patchwork Tue Dec 14 02:53:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 12675373 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 D1C36C43219 for ; Tue, 14 Dec 2021 02:55:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235546AbhLNCzm (ORCPT ); Mon, 13 Dec 2021 21:55:42 -0500 Received: from conuserg-11.nifty.com ([210.131.2.78]:41871 "EHLO conuserg-11.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232304AbhLNCz2 (ORCPT ); Mon, 13 Dec 2021 21:55:28 -0500 Received: from grover.. (133-32-232-101.west.xps.vectant.ne.jp [133.32.232.101]) (authenticated) by conuserg-11.nifty.com with ESMTP id 1BE2s0bm012823; Tue, 14 Dec 2021 11:54:11 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-11.nifty.com 1BE2s0bm012823 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1639450451; bh=Uo2wVxpq5SIkUQ/3oMi05zuPyyww+WvElNbVfIYdJLc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AIecPvYWD6lNmekG0+UAJrV6XABX8t59eeqEJaOO0VjCiO5j5qDOWro9hKhHKcV1c nPthLbLAVJPyGpB7QxJI/DTFZXk5v+/IxYSwZnOgVKBWf+XN92NmMennHq3lzjw0up 5GKfr/bcNsF6omCaR/95DogWgKA0Lj8O05/GZhHUXCqxlR9rp9rJWxeYPIq9/dMxEc 3BANcXh1pEkaEg2SOYCHO7d7rzKV09fAL46XnBY1Tv60G8PPZfzUcDK2Ju/Sakimai TvYbHbAP1uvkak3k4e/CERQirnmWQvR2R3DSNcm5s7mVCBRxvCFBB2sB7Xwbgzj27N 5H1kctIxDiayQ== X-Nifty-SrcIP: [133.32.232.101] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Michal Simek , linux-arch@vger.kernel.org, David Howells , David Woodhouse , keyrings@vger.kernel.org, Richard Weinberger , Nicolas Schier , Masahiro Yamada Subject: [PATCH v2 11/11] microblaze: use built-in function to get CPU_{MAJOR,MINOR,REV} Date: Tue, 14 Dec 2021 11:53:55 +0900 Message-Id: <20211214025355.1267796-12-masahiroy@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211214025355.1267796-1-masahiroy@kernel.org> References: <20211214025355.1267796-1-masahiroy@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: keyrings@vger.kernel.org Use built-in functions instead of shell commands to avoid forking processes. Signed-off-by: Masahiro Yamada Reviewed-by: Nicolas Schier --- (no changes since v1) arch/microblaze/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile index a25e76d89e86..1826d9ce4459 100644 --- a/arch/microblaze/Makefile +++ b/arch/microblaze/Makefile @@ -6,9 +6,9 @@ UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\" # What CPU version are we building for, and crack it open # as major.minor.rev CPU_VER := $(CONFIG_XILINX_MICROBLAZE0_HW_VER) -CPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1) -CPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2) -CPU_REV := $(shell echo $(CPU_VER) | cut -d '.' -f 3) +CPU_MAJOR := $(word 1, $(subst ., , $(CPU_VER))) +CPU_MINOR := $(word 2, $(subst ., , $(CPU_VER))) +CPU_REV := $(word 3, $(subst ., , $(CPU_VER))) export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV