From: David Howells <dhowells@redhat.com>
Date: Fri, 30 Aug 2013 16:13:15 +0000 (+0100)
Subject: KEYS: Have make canonicalise the paths of the X.509 certs better to deduplicate
X-Git-Tag: firefly_0821_release~176^2~2675^2~146
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=0fbd39cf7ffe3b6a787b66b672d21b84e4675352;p=firefly-linux-kernel-4.4.55.git

KEYS: Have make canonicalise the paths of the X.509 certs better to deduplicate

Have make canonicalise the paths of the X.509 certificates before we sort them
as this allows $(sort) to better remove duplicates.

Signed-off-by: David Howells <dhowells@redhat.com>
---

diff --git a/kernel/Makefile b/kernel/Makefile
index c34e5f993a21..2c24195249d5 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -144,13 +144,19 @@ $(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE
 ifeq ($(CONFIG_MODULE_SIG),y)
 ###############################################################################
 #
-# Roll all the X.509 certificates that we can find together and pull
-# them into the kernel.
+# Roll all the X.509 certificates that we can find together and pull them into
+# the kernel.
+#
+# We look in the source root and the build root for all files whose name ends
+# in ".x509".  Unfortunately, this will generate duplicate filenames, so we
+# have make canonicalise the pathnames and then sort them to discard the
+# duplicates.
 #
 ###############################################################################
 X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509)
 X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += signing_key.x509
-X509_CERTIFICATES := $(sort $(X509_CERTIFICATES-y))
+X509_CERTIFICATES := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \
+				$(or $(realpath $(CERT)),$(CERT))))
 
 ifeq ($(X509_CERTIFICATES),)
 $(warning *** No X.509 certificates found ***)