Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1343303 > unrolled thread

[PATCH] modsign: hide openssl output in silent builds

Started byArnd Bergmann <arnd@arndb.de>
First post2016-02-25 17:40 +0100
Last post2016-02-26 12:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] modsign: hide openssl output in silent builds Arnd Bergmann <arnd@arndb.de> - 2016-02-25 17:40 +0100
    Re: [PATCH] modsign: hide openssl output in silent builds David Howells <dhowells@redhat.com> - 2016-02-26 12:30 +0100

#1343303 — [PATCH] modsign: hide openssl output in silent builds

FromArnd Bergmann <arnd@arndb.de>
Date2016-02-25 17:40 +0100
Subject[PATCH] modsign: hide openssl output in silent builds
Message-ID<r677k-6vJ-23@gated-at.bofh.it>
When a user calls 'make -s', we can assume they don't want to
see any output except for warnings and errors, but instead
they see this for a warning free build:

 ###
 ### Now generating an X.509 key pair to be used for signing modules.
 ###
 ### If this takes a long time, you might wish to run rngd in the
 ### background to keep the supply of entropy topped up.  It
 ### needs to be run as root, and uses a hardware random
 ### number generator if one is available.
 ###
 Generating a 4096 bit RSA private key
 .................................................................................................................................................................................................................................++
 ..............................................................................................................................++
 writing new private key to 'certs/signing_key.pem'
 -----
 ###
 ### Key pair generated.
 ###

The output can confuse simple build testing scripts that just check
for an empty build log.

This patch silences all the output:
 - "echo" is changed to "@$(kecho)", which is dropped when "-s" gets
   passed
 - the openssl command itself is only printed with V=1, using the
   $(Q) macro
 - The output of openssl gets redircted to /dev/null on "-s" builds.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 certs/Makefile | 33 +++++++++++++++++++--------------
 1 file changed, 19 insertions(+), 14 deletions(-)

diff --git a/certs/Makefile b/certs/Makefile
index 28ac694dd11a..2773c4afa24c 100644
--- a/certs/Makefile
+++ b/certs/Makefile
@@ -36,29 +36,34 @@ ifndef CONFIG_MODULE_SIG_HASH
 $(error Could not determine digest type to use from kernel config)
 endif
 
+redirect_openssl	= 2>&1
+quiet_redirect_openssl	= 2>&1
+silent_redirect_openssl = 2>/dev/null
+
 # 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")
 $(obj)/signing_key.pem: $(obj)/x509.genkey
-	@echo "###"
-	@echo "### Now generating an X.509 key pair to be used for signing modules."
-	@echo "###"
-	@echo "### If this takes a long time, you might wish to run rngd in the"
-	@echo "### background to keep the supply of entropy topped up.  It"
-	@echo "### needs to be run as root, and uses a hardware random"
-	@echo "### number generator if one is available."
-	@echo "###"
-	openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \
+	@$(kecho) "###"
+	@$(kecho) "### Now generating an X.509 key pair to be used for signing modules."
+	@$(kecho) "###"
+	@$(kecho) "### If this takes a long time, you might wish to run rngd in the"
+	@$(kecho) "### background to keep the supply of entropy topped up.  It"
+	@$(kecho) "### needs to be run as root, and uses a hardware random"
+	@$(kecho) "### number generator if one is available."
+	@$(kecho) "###"
+	$(Q)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 2>&1
-	@echo "###"
-	@echo "### Key pair generated."
-	@echo "###"
+		-keyout $(obj)/signing_key.pem \
+		$($(quiet)redirect_openssl)
+	@$(kecho) "###"
+	@$(kecho) "### Key pair generated."
+	@$(kecho) "###"
 
 $(obj)/x509.genkey:
-	@echo Generating X.509 key generation config
+	@$(kecho) Generating X.509 key generation config
 	@echo  >$@ "[ req ]"
 	@echo >>$@ "default_bits = 4096"
 	@echo >>$@ "distinguished_name = req_distinguished_name"
-- 
2.7.0

[toc] | [next] | [standalone]


#1344179

FromDavid Howells <dhowells@redhat.com>
Date2016-02-26 12:30 +0100
Message-ID<r6oKR-2sN-1@gated-at.bofh.it>
In reply to#1343303
Arnd Bergmann <arnd@arndb.de> wrote:

> When a user calls 'make -s', we can assume they don't want to
> see any output except for warnings and errors, but instead
> they see this for a warning free build:
> 
>  ###
>  ### Now generating an X.509 key pair to be used for signing modules.
>  ###
>  ### If this takes a long time, you might wish to run rngd in the
>  ### background to keep the supply of entropy topped up.  It
>  ### needs to be run as root, and uses a hardware random
>  ### number generator if one is available.
>  ###
>  Generating a 4096 bit RSA private key
>  .................................................................................................................................................................................................................................++
>  ..............................................................................................................................++
>  writing new private key to 'certs/signing_key.pem'
>  -----
>  ###
>  ### Key pair generated.
>  ###
> 
> The output can confuse simple build testing scripts that just check
> for an empty build log.
> 
> This patch silences all the output:
>  - "echo" is changed to "@$(kecho)", which is dropped when "-s" gets
>    passed
>  - the openssl command itself is only printed with V=1, using the
>    $(Q) macro
>  - The output of openssl gets redircted to /dev/null on "-s" builds.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Applied.

David

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web