aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/Kbuild.include
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2015-08-14 11:17:16 -0400
committerDavid Howells <dhowells@redhat.com>2015-08-14 11:32:52 -0400
commit3ee550f12c1529a023f71c9b5becb3351911047b (patch)
treea60711f8662b42d5720b90567daf718cb90eca93 /scripts/Kbuild.include
parent62172c81f2d6c2311284467d6aaa00bd8967e136 (diff)
modsign: Handle signing key in source tree
Since commit 1329e8cc69 ("modsign: Extract signing cert from CONFIG_MODULE_SIG_KEY if needed"), the build system has carefully coped with the signing key being specified as a relative path in either the source or or the build trees. However, the actual signing of modules has not worked if the filename is relative to the source tree. Fix that by moving the config_filename helper into scripts/Kbuild.include so that it can be used from elsewhere, and then using it in the top-level Makefile to find the signing key file. Kill the intermediate $(MODPUBKEY) and $(MODSECKEY) variables too, while we're at it. There's no need for them. Signed-off-by: David Woodhouse <David.Woodhouse@intel.com> Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'scripts/Kbuild.include')
-rw-r--r--scripts/Kbuild.include51
1 files changed, 51 insertions, 0 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include
index d3437b82ac25..608ac65c61e3 100644
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -303,3 +303,54 @@ why = \
303 303
304echo-why = $(call escsq, $(strip $(why))) 304echo-why = $(call escsq, $(strip $(why)))
305endif 305endif
306
307###############################################################################
308#
309# When a Kconfig string contains a filename, it is suitable for
310# passing to shell commands. It is surrounded by double-quotes, and
311# any double-quotes or backslashes within it are escaped by
312# backslashes.
313#
314# This is no use for dependencies or $(wildcard). We need to strip the
315# surrounding quotes and the escaping from quotes and backslashes, and
316# we *do* need to escape any spaces in the string. So, for example:
317#
318# Usage: $(eval $(call config_filename,FOO))
319#
320# Defines FOO_FILENAME based on the contents of the CONFIG_FOO option,
321# transformed as described above to be suitable for use within the
322# makefile.
323#
324# Also, if the filename is a relative filename and exists in the source
325# tree but not the build tree, define FOO_SRCPREFIX as $(srctree)/ to
326# be prefixed to *both* command invocation and dependencies.
327#
328# Note: We also print the filenames in the quiet_cmd_foo text, and
329# perhaps ought to have a version specially escaped for that purpose.
330# But it's only cosmetic, and $(patsubst "%",%,$(CONFIG_FOO)) is good
331# enough. It'll strip the quotes in the common case where there's no
332# space and it's a simple filename, and it'll retain the quotes when
333# there's a space. There are some esoteric cases in which it'll print
334# the wrong thing, but we don't really care. The actual dependencies
335# and commands *do* get it right, with various combinations of single
336# and double quotes, backslashes and spaces in the filenames.
337#
338###############################################################################
339#
340space_escape := %%%SPACE%%%
341#
342define config_filename
343ifneq ($$(CONFIG_$(1)),"")
344$(1)_FILENAME := $$(subst \\,\,$$(subst \$$(quote),$$(quote),$$(subst $$(space_escape),\$$(space),$$(patsubst "%",%,$$(subst $$(space),$$(space_escape),$$(CONFIG_$(1)))))))
345ifneq ($$(patsubst /%,%,$$(firstword $$($(1)_FILENAME))),$$(firstword $$($(1)_FILENAME)))
346else
347ifeq ($$(wildcard $$($(1)_FILENAME)),)
348ifneq ($$(wildcard $$(srctree)/$$($(1)_FILENAME)),)
349$(1)_SRCPREFIX := $(srctree)/
350endif
351endif
352endif
353endif
354endef
355#
356###############################################################################