diff options
Diffstat (limited to 'kernel/Makefile')
| -rw-r--r-- | kernel/Makefile | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/kernel/Makefile b/kernel/Makefile index 09a9c94f42bd..bbaf7d59c1bb 100644 --- a/kernel/Makefile +++ b/kernel/Makefile | |||
| @@ -41,8 +41,9 @@ ifneq ($(CONFIG_SMP),y) | |||
| 41 | obj-y += up.o | 41 | obj-y += up.o |
| 42 | endif | 42 | endif |
| 43 | obj-$(CONFIG_UID16) += uid16.o | 43 | obj-$(CONFIG_UID16) += uid16.o |
| 44 | obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o | ||
| 44 | obj-$(CONFIG_MODULES) += module.o | 45 | obj-$(CONFIG_MODULES) += module.o |
| 45 | obj-$(CONFIG_MODULE_SIG) += module_signing.o modsign_pubkey.o modsign_certificate.o | 46 | obj-$(CONFIG_MODULE_SIG) += module_signing.o |
| 46 | obj-$(CONFIG_KALLSYMS) += kallsyms.o | 47 | obj-$(CONFIG_KALLSYMS) += kallsyms.o |
| 47 | obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o | 48 | obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o |
| 48 | obj-$(CONFIG_KEXEC) += kexec.o | 49 | obj-$(CONFIG_KEXEC) += kexec.o |
| @@ -122,19 +123,52 @@ targets += timeconst.h | |||
| 122 | $(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE | 123 | $(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE |
| 123 | $(call if_changed,bc) | 124 | $(call if_changed,bc) |
| 124 | 125 | ||
| 125 | ifeq ($(CONFIG_MODULE_SIG),y) | 126 | ############################################################################### |
| 127 | # | ||
| 128 | # Roll all the X.509 certificates that we can find together and pull them into | ||
| 129 | # the kernel so that they get loaded into the system trusted keyring during | ||
| 130 | # boot. | ||
| 126 | # | 131 | # |
| 127 | # Pull the signing certificate and any extra certificates into the kernel | 132 | # We look in the source root and the build root for all files whose name ends |
| 133 | # in ".x509". Unfortunately, this will generate duplicate filenames, so we | ||
| 134 | # have make canonicalise the pathnames and then sort them to discard the | ||
| 135 | # duplicates. | ||
| 128 | # | 136 | # |
| 137 | ############################################################################### | ||
| 138 | ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y) | ||
| 139 | X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509) | ||
| 140 | X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += signing_key.x509 | ||
| 141 | X509_CERTIFICATES := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \ | ||
| 142 | $(or $(realpath $(CERT)),$(CERT)))) | ||
| 143 | |||
| 144 | ifeq ($(X509_CERTIFICATES),) | ||
| 145 | $(warning *** No X.509 certificates found ***) | ||
| 146 | endif | ||
| 147 | |||
| 148 | ifneq ($(wildcard $(obj)/.x509.list),) | ||
| 149 | ifneq ($(shell cat $(obj)/.x509.list),$(X509_CERTIFICATES)) | ||
| 150 | $(info X.509 certificate list changed) | ||
| 151 | $(shell rm $(obj)/.x509.list) | ||
| 152 | endif | ||
| 153 | endif | ||
| 154 | |||
| 155 | kernel/system_certificates.o: $(obj)/x509_certificate_list | ||
| 129 | 156 | ||
| 130 | quiet_cmd_touch = TOUCH $@ | 157 | quiet_cmd_x509certs = CERTS $@ |
| 131 | cmd_touch = touch $@ | 158 | cmd_x509certs = cat $(X509_CERTIFICATES) /dev/null >$@ $(foreach X509,$(X509_CERTIFICATES),; echo " - Including cert $(X509)") |
| 132 | 159 | ||
| 133 | extra_certificates: | 160 | targets += $(obj)/x509_certificate_list |
| 134 | $(call cmd,touch) | 161 | $(obj)/x509_certificate_list: $(X509_CERTIFICATES) $(obj)/.x509.list |
| 162 | $(call if_changed,x509certs) | ||
| 135 | 163 | ||
| 136 | kernel/modsign_certificate.o: signing_key.x509 extra_certificates | 164 | targets += $(obj)/.x509.list |
| 165 | $(obj)/.x509.list: | ||
| 166 | @echo $(X509_CERTIFICATES) >$@ | ||
| 137 | 167 | ||
| 168 | clean-files := x509_certificate_list .x509.list | ||
| 169 | endif | ||
| 170 | |||
| 171 | ifeq ($(CONFIG_MODULE_SIG),y) | ||
| 138 | ############################################################################### | 172 | ############################################################################### |
| 139 | # | 173 | # |
| 140 | # If module signing is requested, say by allyesconfig, but a key has not been | 174 | # If module signing is requested, say by allyesconfig, but a key has not been |
