Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | # |
| 2 | # Makefile for the linux kernel. |
| 3 | # |
| 4 | |
Joe Perches | b9ee979 | 2013-07-31 13:53:42 -0700 | [diff] [blame] | 5 | obj-y = fork.o exec_domain.o panic.o \ |
Max Krasnyansky | 68f4f1e | 2008-05-29 11:17:02 -0700 | [diff] [blame] | 6 | cpu.o exit.o itimer.o time.o softirq.o resource.o \ |
Eric W. Biederman | afa588b | 2009-04-02 23:44:59 -0700 | [diff] [blame] | 7 | sysctl.o sysctl_binary.o capability.o ptrace.o timer.o user.o \ |
Oleg Nesterov | e73f895 | 2012-05-11 10:59:07 +1000 | [diff] [blame] | 8 | signal.o sys.o kmod.o workqueue.o pid.o task_work.o \ |
Paul E. McKenney | 4102ada | 2013-10-08 20:23:47 -0700 | [diff] [blame] | 9 | extable.o params.o posix-timers.o \ |
Peter Zijlstra | 01768b4 | 2013-10-31 18:11:53 +0100 | [diff] [blame] | 10 | kthread.o sys_ni.o posix-cpu-timers.o \ |
Peter Zijlstra | ed428bf | 2013-10-31 18:19:28 +0100 | [diff] [blame] | 11 | hrtimer.o nsproxy.o \ |
Robin Holt | 15d94b8 | 2013-07-08 16:01:32 -0700 | [diff] [blame] | 12 | notifier.o ksysfs.o cred.o reboot.o \ |
Peter Zijlstra | cd4d241 | 2013-11-04 11:51:33 +0100 | [diff] [blame] | 13 | async.o range.o groups.o smpboot.o |
Peter Zijlstra | 029632f | 2011-10-25 10:00:11 +0200 | [diff] [blame] | 14 | |
Steven Rostedt | 606576c | 2008-10-06 19:06:12 -0400 | [diff] [blame] | 15 | ifdef CONFIG_FUNCTION_TRACER |
Steven Rostedt | 6ec5623 | 2008-05-14 21:30:30 -0400 | [diff] [blame] | 16 | # Do not trace debug files and internal ftrace files |
Steven Rostedt | 6ec5623 | 2008-05-14 21:30:30 -0400 | [diff] [blame] | 17 | CFLAGS_REMOVE_cgroup-debug.o = -pg |
Peter Zijlstra | e360adb | 2010-10-14 14:01:34 +0800 | [diff] [blame] | 18 | CFLAGS_REMOVE_irq_work.o = -pg |
Steven Rostedt | 1d09daa | 2008-05-12 21:20:55 +0200 | [diff] [blame] | 19 | endif |
| 20 | |
Andi Kleen | 58edae3 | 2014-02-08 09:01:10 +0100 | [diff] [blame] | 21 | # cond_syscall is currently not LTO compatible |
| 22 | CFLAGS_sys_ni.o = $(DISABLE_LTO) |
| 23 | |
Peter Zijlstra | 391e43d | 2011-11-15 17:14:39 +0100 | [diff] [blame] | 24 | obj-y += sched/ |
Peter Zijlstra | 01768b4 | 2013-10-31 18:11:53 +0100 | [diff] [blame] | 25 | obj-y += locking/ |
Rafael J. Wysocki | dae5cbc | 2012-01-14 00:33:03 +0100 | [diff] [blame] | 26 | obj-y += power/ |
Joe Perches | b9ee979 | 2013-07-31 13:53:42 -0700 | [diff] [blame] | 27 | obj-y += printk/ |
Martin Schwidefsky | 0244ad0 | 2013-08-30 09:39:53 +0200 | [diff] [blame] | 28 | obj-y += irq/ |
Paul E. McKenney | 4102ada | 2013-10-08 20:23:47 -0700 | [diff] [blame] | 29 | obj-y += rcu/ |
Peter Zijlstra | 391e43d | 2011-11-15 17:14:39 +0100 | [diff] [blame] | 30 | |
Cyrill Gorcunov | 1e142b2 | 2013-02-27 17:05:58 -0800 | [diff] [blame] | 31 | obj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o |
Matt Helsley | 8174f15 | 2008-10-18 20:27:19 -0700 | [diff] [blame] | 32 | obj-$(CONFIG_FREEZER) += freezer.o |
Adrian Bunk | b03f648 | 2008-07-25 01:45:35 -0700 | [diff] [blame] | 33 | obj-$(CONFIG_PROFILING) += profile.o |
Ingo Molnar | 8637c09 | 2006-07-03 00:24:38 -0700 | [diff] [blame] | 34 | obj-$(CONFIG_STACKTRACE) += stacktrace.o |
john stultz | ad59617 | 2006-06-26 00:25:06 -0700 | [diff] [blame] | 35 | obj-y += time/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | obj-$(CONFIG_FUTEX) += futex.o |
Ingo Molnar | 34f192c | 2006-03-27 01:16:24 -0800 | [diff] [blame] | 37 | ifeq ($(CONFIG_COMPAT),y) |
| 38 | obj-$(CONFIG_FUTEX) += futex_compat.o |
| 39 | endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 40 | obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o |
Amerigo Wang | 351f8f8 | 2011-01-12 16:59:39 -0800 | [diff] [blame] | 41 | obj-$(CONFIG_SMP) += smp.o |
Andrew Morton | 9316fca | 2009-01-14 09:35:44 -0800 | [diff] [blame] | 42 | ifneq ($(CONFIG_SMP),y) |
Andrew Morton | 53ce3d9 | 2009-01-09 12:27:08 -0800 | [diff] [blame] | 43 | obj-y += up.o |
| 44 | endif |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 45 | obj-$(CONFIG_UID16) += uid16.o |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 46 | obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | obj-$(CONFIG_MODULES) += module.o |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 48 | obj-$(CONFIG_MODULE_SIG) += module_signing.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | obj-$(CONFIG_KALLSYMS) += kallsyms.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o |
Eric W. Biederman | dc009d9 | 2005-06-25 14:57:52 -0700 | [diff] [blame] | 51 | obj-$(CONFIG_KEXEC) += kexec.o |
Arjan van de Ven | 6dab277 | 2008-01-30 13:33:08 +0100 | [diff] [blame] | 52 | obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 53 | obj-$(CONFIG_COMPAT) += compat.o |
Paul Menage | ddbcc7e | 2007-10-18 23:39:30 -0700 | [diff] [blame] | 54 | obj-$(CONFIG_CGROUPS) += cgroup.o |
Matt Helsley | dc52ddc | 2008-10-18 20:27:21 -0700 | [diff] [blame] | 55 | obj-$(CONFIG_CGROUP_FREEZER) += cgroup_freezer.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 56 | obj-$(CONFIG_CPUSETS) += cpuset.o |
Pavel Emelyanov | aee16ce | 2008-02-08 04:18:23 -0800 | [diff] [blame] | 57 | obj-$(CONFIG_UTS_NS) += utsname.o |
| 58 | obj-$(CONFIG_USER_NS) += user_namespace.o |
Pavel Emelyanov | 74bd59b | 2008-02-08 04:18:24 -0800 | [diff] [blame] | 59 | obj-$(CONFIG_PID_NS) += pid_namespace.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | obj-$(CONFIG_IKCONFIG) += configs.o |
Pavel Emelianov | e552b66 | 2008-02-07 00:13:49 -0800 | [diff] [blame] | 61 | obj-$(CONFIG_RESOURCE_COUNTERS) += res_counter.o |
Tejun Heo | bbf1bb3 | 2010-05-08 16:20:53 +0200 | [diff] [blame] | 62 | obj-$(CONFIG_SMP) += stop_machine.o |
Ananth N Mavinakayanahalli | 8c1c935 | 2008-01-30 13:32:53 +0100 | [diff] [blame] | 63 | obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o |
Eric Paris | 939a67f | 2009-12-17 20:12:06 -0500 | [diff] [blame] | 64 | obj-$(CONFIG_AUDIT) += audit.o auditfilter.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 65 | obj-$(CONFIG_AUDITSYSCALL) += auditsc.o |
Eric Paris | 939a67f | 2009-12-17 20:12:06 -0500 | [diff] [blame] | 66 | obj-$(CONFIG_AUDIT_WATCH) += audit_watch.o |
Al Viro | 74c3cbe | 2007-07-22 08:04:18 -0400 | [diff] [blame] | 67 | obj-$(CONFIG_AUDIT_TREE) += audit_tree.o |
Eric Paris | 939a67f | 2009-12-17 20:12:06 -0500 | [diff] [blame] | 68 | obj-$(CONFIG_GCOV_KERNEL) += gcov/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 69 | obj-$(CONFIG_KPROBES) += kprobes.o |
Jason Wessel | c433820 | 2009-05-19 07:49:32 -0500 | [diff] [blame] | 70 | obj-$(CONFIG_KGDB) += debug/ |
Mandeep Singh Baines | e162b39 | 2009-01-15 11:08:40 -0800 | [diff] [blame] | 71 | obj-$(CONFIG_DETECT_HUNG_TASK) += hung_task.o |
Don Zickus | 58687ac | 2010-05-07 17:11:44 -0400 | [diff] [blame] | 72 | obj-$(CONFIG_LOCKUP_DETECTOR) += watchdog.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | obj-$(CONFIG_SECCOMP) += seccomp.o |
Jens Axboe | b86ff981 | 2006-03-23 19:56:55 +0100 | [diff] [blame] | 74 | obj-$(CONFIG_RELAY) += relay.o |
Eric W. Biederman | 39732ac | 2007-02-14 00:33:58 -0800 | [diff] [blame] | 75 | obj-$(CONFIG_SYSCTL) += utsname_sysctl.o |
Shailabh Nagar | ca74e92 | 2006-07-14 00:24:36 -0700 | [diff] [blame] | 76 | obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o |
Jay Lan | f3cef7a | 2006-09-30 23:28:55 -0700 | [diff] [blame] | 77 | obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o |
Mathieu Desnoyers | 97e1c18 | 2008-07-18 12:16:16 -0400 | [diff] [blame] | 78 | obj-$(CONFIG_TRACEPOINTS) += tracepoint.o |
Arjan van de Ven | 9745512 | 2008-01-25 21:08:34 +0100 | [diff] [blame] | 79 | obj-$(CONFIG_LATENCYTOP) += latencytop.o |
Daisuke HATAYAMA | 1fcccba | 2010-03-05 13:44:07 -0800 | [diff] [blame] | 80 | obj-$(CONFIG_BINFMT_ELF) += elfcore.o |
| 81 | obj-$(CONFIG_COMPAT_BINFMT_ELF) += elfcore.o |
| 82 | obj-$(CONFIG_BINFMT_ELF_FDPIC) += elfcore.o |
Steven Rostedt | 606576c | 2008-10-06 19:06:12 -0400 | [diff] [blame] | 83 | obj-$(CONFIG_FUNCTION_TRACER) += trace/ |
Steven Rostedt | bc0c38d | 2008-05-12 21:20:42 +0200 | [diff] [blame] | 84 | obj-$(CONFIG_TRACING) += trace/ |
Josh Triplett | ea632e9 | 2012-09-02 19:45:14 -0700 | [diff] [blame] | 85 | obj-$(CONFIG_TRACE_CLOCK) += trace/ |
Paul Mundt | 1155de4 | 2009-06-25 14:30:12 +0900 | [diff] [blame] | 86 | obj-$(CONFIG_RING_BUFFER) += trace/ |
Mathieu Desnoyers | 870915e | 2010-10-28 11:31:17 -0400 | [diff] [blame] | 87 | obj-$(CONFIG_TRACEPOINTS) += trace/ |
Peter Zijlstra | e360adb | 2010-10-14 14:01:34 +0800 | [diff] [blame] | 88 | obj-$(CONFIG_IRQ_WORK) += irq_work.o |
Colin Cross | ab10023 | 2011-02-10 02:04:45 -0800 | [diff] [blame] | 89 | obj-$(CONFIG_CPU_PM) += cpu_pm.o |
Borislav Petkov | fae85b7 | 2010-10-26 20:24:03 +0200 | [diff] [blame] | 90 | |
| 91 | obj-$(CONFIG_PERF_EVENTS) += events/ |
| 92 | |
Avi Kivity | 7a04109 | 2009-10-25 14:24:45 +0200 | [diff] [blame] | 93 | obj-$(CONFIG_USER_RETURN_NOTIFIER) += user-return-notifier.o |
Steffen Klassert | 16295be | 2010-01-06 19:47:10 +1100 | [diff] [blame] | 94 | obj-$(CONFIG_PADATA) += padata.o |
Olaf Hering | 93a7205 | 2011-03-23 16:43:29 -0700 | [diff] [blame] | 95 | obj-$(CONFIG_CRASH_DUMP) += crash_dump.o |
Jason Baron | b77f0f3 | 2011-08-05 16:40:40 -0400 | [diff] [blame] | 96 | obj-$(CONFIG_JUMP_LABEL) += jump_label.o |
Frederic Weisbecker | 91d1aa43 | 2012-11-27 19:33:25 +0100 | [diff] [blame] | 97 | obj-$(CONFIG_CONTEXT_TRACKING) += context_tracking.o |
Paul E. McKenney | 51b1130 | 2014-01-27 11:49:39 -0800 | [diff] [blame] | 98 | obj-$(CONFIG_TORTURE_TEST) += torture.o |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | $(obj)/configs.o: $(obj)/config_data.h |
| 101 | |
| 102 | # config_data.h contains the same information as ikconfig.h but gzipped. |
| 103 | # Info from config_data can be extracted from /proc/config* |
| 104 | targets += config_data.gz |
Ben Gardiner | 41263fc | 2010-12-14 11:39:44 -0500 | [diff] [blame] | 105 | $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 106 | $(call if_changed,gzip) |
| 107 | |
Peter Foley | e78e8f2 | 2011-07-05 19:42:18 -0400 | [diff] [blame] | 108 | filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/bin2c; echo "MAGIC_END;") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | targets += config_data.h |
| 110 | $(obj)/config_data.h: $(obj)/config_data.gz FORCE |
Peter Foley | e78e8f2 | 2011-07-05 19:42:18 -0400 | [diff] [blame] | 111 | $(call filechk,ikconfiggz) |
H. Peter Anvin | bdc8078 | 2008-02-08 04:21:26 -0800 | [diff] [blame] | 112 | |
| 113 | $(obj)/time.o: $(obj)/timeconst.h |
| 114 | |
H. Peter Anvin | 70730bc | 2013-02-14 15:13:55 -0800 | [diff] [blame] | 115 | quiet_cmd_hzfile = HZFILE $@ |
| 116 | cmd_hzfile = echo "hz=$(CONFIG_HZ)" > $@ |
| 117 | |
| 118 | targets += hz.bc |
| 119 | $(obj)/hz.bc: $(objtree)/include/config/hz.h FORCE |
| 120 | $(call if_changed,hzfile) |
| 121 | |
| 122 | quiet_cmd_bc = BC $@ |
| 123 | cmd_bc = bc -q $(filter-out FORCE,$^) > $@ |
| 124 | |
H. Peter Anvin | bdc8078 | 2008-02-08 04:21:26 -0800 | [diff] [blame] | 125 | targets += timeconst.h |
H. Peter Anvin | 70730bc | 2013-02-14 15:13:55 -0800 | [diff] [blame] | 126 | $(obj)/timeconst.h: $(obj)/hz.bc $(src)/timeconst.bc FORCE |
| 127 | $(call if_changed,bc) |
David Howells | d441108 | 2012-09-26 10:09:51 +0100 | [diff] [blame] | 128 | |
David Howells | f0e6d22 | 2013-08-30 16:07:13 +0100 | [diff] [blame] | 129 | ############################################################################### |
David Howells | 631cc66e | 2012-09-26 10:09:51 +0100 | [diff] [blame] | 130 | # |
David Howells | 0fbd39c | 2013-08-30 17:13:15 +0100 | [diff] [blame] | 131 | # Roll all the X.509 certificates that we can find together and pull them into |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 132 | # the kernel so that they get loaded into the system trusted keyring during |
| 133 | # boot. |
David Howells | 0fbd39c | 2013-08-30 17:13:15 +0100 | [diff] [blame] | 134 | # |
| 135 | # We look in the source root and the build root for all files whose name ends |
| 136 | # in ".x509". Unfortunately, this will generate duplicate filenames, so we |
| 137 | # have make canonicalise the pathnames and then sort them to discard the |
| 138 | # duplicates. |
David Howells | 631cc66e | 2012-09-26 10:09:51 +0100 | [diff] [blame] | 139 | # |
David Howells | f0e6d22 | 2013-08-30 16:07:13 +0100 | [diff] [blame] | 140 | ############################################################################### |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 141 | ifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y) |
David Howells | f0e6d22 | 2013-08-30 16:07:13 +0100 | [diff] [blame] | 142 | X509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509) |
David Howells | d7ec435 | 2013-12-13 15:20:19 +0000 | [diff] [blame] | 143 | X509_CERTIFICATES-$(CONFIG_MODULE_SIG) += $(objtree)/signing_key.x509 |
| 144 | X509_CERTIFICATES-raw := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \ |
David Howells | 0fbd39c | 2013-08-30 17:13:15 +0100 | [diff] [blame] | 145 | $(or $(realpath $(CERT)),$(CERT)))) |
David Howells | d7ec435 | 2013-12-13 15:20:19 +0000 | [diff] [blame] | 146 | X509_CERTIFICATES := $(subst $(realpath $(objtree))/,,$(X509_CERTIFICATES-raw)) |
David Howells | 631cc66e | 2012-09-26 10:09:51 +0100 | [diff] [blame] | 147 | |
David Howells | f0e6d22 | 2013-08-30 16:07:13 +0100 | [diff] [blame] | 148 | ifeq ($(X509_CERTIFICATES),) |
| 149 | $(warning *** No X.509 certificates found ***) |
| 150 | endif |
Michal Marek | e10e1774 | 2012-12-11 12:26:22 +1030 | [diff] [blame] | 151 | |
David Howells | f0e6d22 | 2013-08-30 16:07:13 +0100 | [diff] [blame] | 152 | ifneq ($(wildcard $(obj)/.x509.list),) |
| 153 | ifneq ($(shell cat $(obj)/.x509.list),$(X509_CERTIFICATES)) |
| 154 | $(info X.509 certificate list changed) |
| 155 | $(shell rm $(obj)/.x509.list) |
| 156 | endif |
| 157 | endif |
David Howells | 631cc66e | 2012-09-26 10:09:51 +0100 | [diff] [blame] | 158 | |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 159 | kernel/system_certificates.o: $(obj)/x509_certificate_list |
David Howells | f0e6d22 | 2013-08-30 16:07:13 +0100 | [diff] [blame] | 160 | |
| 161 | quiet_cmd_x509certs = CERTS $@ |
David Howells | b56e5a1 | 2013-08-30 16:07:30 +0100 | [diff] [blame] | 162 | cmd_x509certs = cat $(X509_CERTIFICATES) /dev/null >$@ $(foreach X509,$(X509_CERTIFICATES),; echo " - Including cert $(X509)") |
| 163 | |
David Howells | f0e6d22 | 2013-08-30 16:07:13 +0100 | [diff] [blame] | 164 | targets += $(obj)/x509_certificate_list |
| 165 | $(obj)/x509_certificate_list: $(X509_CERTIFICATES) $(obj)/.x509.list |
| 166 | $(call if_changed,x509certs) |
| 167 | |
| 168 | targets += $(obj)/.x509.list |
| 169 | $(obj)/.x509.list: |
| 170 | @echo $(X509_CERTIFICATES) >$@ |
Kirill Tkhai | f46a3cb | 2013-12-10 22:39:57 +0400 | [diff] [blame] | 171 | endif |
David Howells | f0e6d22 | 2013-08-30 16:07:13 +0100 | [diff] [blame] | 172 | |
| 173 | clean-files := x509_certificate_list .x509.list |
David Howells | d441108 | 2012-09-26 10:09:51 +0100 | [diff] [blame] | 174 | |
H. Peter Anvin | bdc8078 | 2008-02-08 04:21:26 -0800 | [diff] [blame] | 175 | ifeq ($(CONFIG_MODULE_SIG),y) |
David Howells | d441108 | 2012-09-26 10:09:51 +0100 | [diff] [blame] | 176 | ############################################################################### |
| 177 | # |
| 178 | # If module signing is requested, say by allyesconfig, but a key has not been |
| 179 | # supplied, then one will need to be generated to make sure the build does not |
| 180 | # fail and that the kernel may be used afterwards. |
| 181 | # |
| 182 | ############################################################################### |
Michal Marek | 2275367 | 2013-01-25 13:41:00 +1030 | [diff] [blame] | 183 | ifndef CONFIG_MODULE_SIG_HASH |
David Howells | 5e8cb1e | 2012-09-28 11:16:57 +0100 | [diff] [blame] | 184 | $(error Could not determine digest type to use from kernel config) |
| 185 | endif |
| 186 | |
David Howells | d441108 | 2012-09-26 10:09:51 +0100 | [diff] [blame] | 187 | signing_key.priv signing_key.x509: x509.genkey |
| 188 | @echo "###" |
| 189 | @echo "### Now generating an X.509 key pair to be used for signing modules." |
| 190 | @echo "###" |
| 191 | @echo "### If this takes a long time, you might wish to run rngd in the" |
| 192 | @echo "### background to keep the supply of entropy topped up. It" |
H. Peter Anvin | 2008713 | 2012-10-24 14:11:48 -0700 | [diff] [blame] | 193 | @echo "### needs to be run as root, and uses a hardware random" |
| 194 | @echo "### number generator if one is available." |
David Howells | d441108 | 2012-09-26 10:09:51 +0100 | [diff] [blame] | 195 | @echo "###" |
Michal Marek | 2275367 | 2013-01-25 13:41:00 +1030 | [diff] [blame] | 196 | openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \ |
| 197 | -batch -x509 -config x509.genkey \ |
David Howells | d441108 | 2012-09-26 10:09:51 +0100 | [diff] [blame] | 198 | -outform DER -out signing_key.x509 \ |
David Cohen | 07c449b | 2013-04-11 13:22:14 +0930 | [diff] [blame] | 199 | -keyout signing_key.priv 2>&1 |
David Howells | d441108 | 2012-09-26 10:09:51 +0100 | [diff] [blame] | 200 | @echo "###" |
| 201 | @echo "### Key pair generated." |
| 202 | @echo "###" |
| 203 | |
| 204 | x509.genkey: |
| 205 | @echo Generating X.509 key generation config |
| 206 | @echo >x509.genkey "[ req ]" |
| 207 | @echo >>x509.genkey "default_bits = 4096" |
| 208 | @echo >>x509.genkey "distinguished_name = req_distinguished_name" |
| 209 | @echo >>x509.genkey "prompt = no" |
David Howells | e7d113b | 2012-09-28 11:16:57 +0100 | [diff] [blame] | 210 | @echo >>x509.genkey "string_mask = utf8only" |
David Howells | d441108 | 2012-09-26 10:09:51 +0100 | [diff] [blame] | 211 | @echo >>x509.genkey "x509_extensions = myexts" |
| 212 | @echo >>x509.genkey |
| 213 | @echo >>x509.genkey "[ req_distinguished_name ]" |
| 214 | @echo >>x509.genkey "O = Magrathea" |
| 215 | @echo >>x509.genkey "CN = Glacier signing key" |
| 216 | @echo >>x509.genkey "emailAddress = slartibartfast@magrathea.h2g2" |
| 217 | @echo >>x509.genkey |
| 218 | @echo >>x509.genkey "[ myexts ]" |
| 219 | @echo >>x509.genkey "basicConstraints=critical,CA:FALSE" |
| 220 | @echo >>x509.genkey "keyUsage=digitalSignature" |
| 221 | @echo >>x509.genkey "subjectKeyIdentifier=hash" |
| 222 | @echo >>x509.genkey "authorityKeyIdentifier=keyid" |
| 223 | endif |