History

kbuild: support 'make modules_sign' with CONFIG_MODULE_SIG_ALL=n

Commit d890f510c8e4 ("MODSIGN: Add modules_sign make target") introduced 'make modules_sign' to manually sign modules. Some time later, commit d9d8d7ed498e ("MODSIGN: Add option to not sign modules during modules_install") introduced CONFIG_MODULE_SIG_ALL. If it was disabled, mod_sign_cmd was set to no-op ('true' command). It affected not only 'make modules_install' but also 'make modules_sign'. With CONFIG_MODULE_SIG_ALL=n, neither modules_install nor modules_sign is able to sign modules. Kbuild has kept that behavior, and nobody has complained about it, but I think it is weird. CONFIG_MODULE_SIG_ALL=n should turn off signing only for modules_install. If users want to sign modules manually, modules_sign should be offered.

Masahiro Yamada committed 3 years ago

Commit 02e84871 parent 5e027971 file · +5 −4Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/Makefile.modinst+5−4
@@ -95,7 +95,6 @@ endif · 94 unmodified lines
95# Signing95# Signing
96# Don't stop modules_install even if we can't sign external modules.96# Don't stop modules_install even if we can't sign external modules.
97#97#
98ifeq ($(CONFIG_MODULE_SIG_ALL),y)
99ifeq ($(filter pkcs11:%, $(CONFIG_MODULE_SIG_KEY)),)98ifeq ($(filter pkcs11:%, $(CONFIG_MODULE_SIG_KEY)),)
100sig-key := $(if $(wildcard $(CONFIG_MODULE_SIG_KEY)),,$(srctree)/)$(CONFIG_MODULE_SIG_KEY)99sig-key := $(if $(wildcard $(CONFIG_MODULE_SIG_KEY)),,$(srctree)/)$(CONFIG_MODULE_SIG_KEY)
101else100else
@@ -104,13 +103,15 @@ endif · 2 unmodified lines
104quiet_cmd_sign = SIGN $@103quiet_cmd_sign = SIGN $@
105 cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) "$(sig-key)" certs/signing_key.x509 $@ \104 cmd_sign = scripts/sign-file $(CONFIG_MODULE_SIG_HASH) "$(sig-key)" certs/signing_key.x509 $@ \
106 $(if $(KBUILD_EXTMOD),|| true)105 $(if $(KBUILD_EXTMOD),|| true)
107else106
107ifeq ($(modules_sign_only),)
108
109# During modules_install, modules are signed only when CONFIG_MODULE_SIG_ALL=y.
110ifndef CONFIG_MODULE_SIG_ALL
108quiet_cmd_sign :=111quiet_cmd_sign :=
109 cmd_sign := :112 cmd_sign := :
110endif113endif
111 114
112ifeq ($(modules_sign_only),)
113
114# Create necessary directories115# Create necessary directories
115$(shell mkdir -p $(sort $(dir $(install-y))))116$(shell mkdir -p $(sort $(dir $(install-y))))
116 117