aboutsummaryrefslogtreecommitdiffstats
path: root/certs
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-02-25 11:31:32 -0500
committerDavid Howells <dhowells@redhat.com>2016-02-26 06:16:38 -0500
commit5d06ee20b662a78417245714fc576cba90e6374f (patch)
treeaef804366c0ee86ec6fd2746d7487c252b78fa41 /certs
parente5a2e3c8478215aea5b4c58e6154f1b6b170b0ca (diff)
modsign: hide openssl output in silent builds
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 redirected to /dev/null on "-s" builds. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'certs')
-rw-r--r--certs/Makefile33
1 files 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
36$(error Could not determine digest type to use from kernel config) 36$(error Could not determine digest type to use from kernel config)
37endif 37endif
38 38
39redirect_openssl = 2>&1
40quiet_redirect_openssl = 2>&1
41silent_redirect_openssl = 2>/dev/null
42
39# We do it this way rather than having a boolean option for enabling an 43# We do it this way rather than having a boolean option for enabling an
40# external private key, because 'make randconfig' might enable such a 44# external private key, because 'make randconfig' might enable such a
41# boolean option and we unfortunately can't make it depend on !RANDCONFIG. 45# boolean option and we unfortunately can't make it depend on !RANDCONFIG.
42ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem") 46ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem")
43$(obj)/signing_key.pem: $(obj)/x509.genkey 47$(obj)/signing_key.pem: $(obj)/x509.genkey
44 @echo "###" 48 @$(kecho) "###"
45 @echo "### Now generating an X.509 key pair to be used for signing modules." 49 @$(kecho) "### Now generating an X.509 key pair to be used for signing modules."
46 @echo "###" 50 @$(kecho) "###"
47 @echo "### If this takes a long time, you might wish to run rngd in the" 51 @$(kecho) "### If this takes a long time, you might wish to run rngd in the"
48 @echo "### background to keep the supply of entropy topped up. It" 52 @$(kecho) "### background to keep the supply of entropy topped up. It"
49 @echo "### needs to be run as root, and uses a hardware random" 53 @$(kecho) "### needs to be run as root, and uses a hardware random"
50 @echo "### number generator if one is available." 54 @$(kecho) "### number generator if one is available."
51 @echo "###" 55 @$(kecho) "###"
52 openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \ 56 $(Q)openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \
53 -batch -x509 -config $(obj)/x509.genkey \ 57 -batch -x509 -config $(obj)/x509.genkey \
54 -outform PEM -out $(obj)/signing_key.pem \ 58 -outform PEM -out $(obj)/signing_key.pem \
55 -keyout $(obj)/signing_key.pem 2>&1 59 -keyout $(obj)/signing_key.pem \
56 @echo "###" 60 $($(quiet)redirect_openssl)
57 @echo "### Key pair generated." 61 @$(kecho) "###"
58 @echo "###" 62 @$(kecho) "### Key pair generated."
63 @$(kecho) "###"
59 64
60$(obj)/x509.genkey: 65$(obj)/x509.genkey:
61 @echo Generating X.509 key generation config 66 @$(kecho) Generating X.509 key generation config
62 @echo >$@ "[ req ]" 67 @echo >$@ "[ req ]"
63 @echo >>$@ "default_bits = 4096" 68 @echo >>$@ "default_bits = 4096"
64 @echo >>$@ "distinguished_name = req_distinguished_name" 69 @echo >>$@ "distinguished_name = req_distinguished_name"