11da177e4SLinus Torvalds# 21da177e4SLinus Torvalds# Makefile for the linux kernel. 31da177e4SLinus Torvalds# 41da177e4SLinus Torvalds 5b9ee979eSJoe Perchesobj-y = fork.o exec_domain.o panic.o \ 65cee9645SThomas Gleixner cpu.o exit.o softirq.o resource.o \ 75cee9645SThomas Gleixner sysctl.o sysctl_binary.o capability.o ptrace.o user.o \ 8e73f8959SOleg Nesterov signal.o sys.o kmod.o workqueue.o pid.o task_work.o \ 95cee9645SThomas Gleixner extable.o params.o \ 105cee9645SThomas Gleixner kthread.o sys_ni.o nsproxy.o \ 1115d94b82SRobin Holt notifier.o ksysfs.o cred.o reboot.o \ 12*2813893fSIulia Manda async.o range.o smpboot.o 13*2813893fSIulia Manda 14*2813893fSIulia Mandaobj-$(CONFIG_MULTIUSER) += groups.o 15029632fbSPeter Zijlstra 16606576ceSSteven Rostedtifdef CONFIG_FUNCTION_TRACER 176ec56232SSteven Rostedt# Do not trace debug files and internal ftrace files 18c0a80c0cSHeiko CarstensCFLAGS_REMOVE_cgroup-debug.o = $(CC_FLAGS_FTRACE) 19c0a80c0cSHeiko CarstensCFLAGS_REMOVE_irq_work.o = $(CC_FLAGS_FTRACE) 201d09daa5SSteven Rostedtendif 211d09daa5SSteven Rostedt 2258edae3aSAndi Kleen# cond_syscall is currently not LTO compatible 2358edae3aSAndi KleenCFLAGS_sys_ni.o = $(DISABLE_LTO) 2458edae3aSAndi Kleen 25391e43daSPeter Zijlstraobj-y += sched/ 2601768b42SPeter Zijlstraobj-y += locking/ 27dae5cbc2SRafael J. Wysockiobj-y += power/ 28b9ee979eSJoe Perchesobj-y += printk/ 290244ad00SMartin Schwidefskyobj-y += irq/ 304102adabSPaul E. McKenneyobj-y += rcu/ 31b700e7f0SSeth Jenningsobj-y += livepatch/ 32391e43daSPeter Zijlstra 331e142b29SCyrill Gorcunovobj-$(CONFIG_CHECKPOINT_RESTORE) += kcmp.o 348174f150SMatt Helsleyobj-$(CONFIG_FREEZER) += freezer.o 35b03f6489SAdrian Bunkobj-$(CONFIG_PROFILING) += profile.o 368637c099SIngo Molnarobj-$(CONFIG_STACKTRACE) += stacktrace.o 37ad596171Sjohn stultzobj-y += time/ 381da177e4SLinus Torvaldsobj-$(CONFIG_FUTEX) += futex.o 3934f192c6SIngo Molnarifeq ($(CONFIG_COMPAT),y) 4034f192c6SIngo Molnarobj-$(CONFIG_FUTEX) += futex_compat.o 4134f192c6SIngo Molnarendif 421da177e4SLinus Torvaldsobj-$(CONFIG_GENERIC_ISA_DMA) += dma.o 43351f8f8eSAmerigo Wangobj-$(CONFIG_SMP) += smp.o 449316fcacSAndrew Mortonifneq ($(CONFIG_SMP),y) 4553ce3d95SAndrew Mortonobj-y += up.o 4653ce3d95SAndrew Mortonendif 471da177e4SLinus Torvaldsobj-$(CONFIG_UID16) += uid16.o 48b56e5a17SDavid Howellsobj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o 491da177e4SLinus Torvaldsobj-$(CONFIG_MODULES) += module.o 50b56e5a17SDavid Howellsobj-$(CONFIG_MODULE_SIG) += module_signing.o 511da177e4SLinus Torvaldsobj-$(CONFIG_KALLSYMS) += kallsyms.o 521da177e4SLinus Torvaldsobj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o 53dc009d92SEric W. Biedermanobj-$(CONFIG_KEXEC) += kexec.o 546dab2778SArjan van de Venobj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o 551da177e4SLinus Torvaldsobj-$(CONFIG_COMPAT) += compat.o 56ddbcc7e8SPaul Menageobj-$(CONFIG_CGROUPS) += cgroup.o 57dc52ddc0SMatt Helsleyobj-$(CONFIG_CGROUP_FREEZER) += cgroup_freezer.o 581da177e4SLinus Torvaldsobj-$(CONFIG_CPUSETS) += cpuset.o 59aee16ce7SPavel Emelyanovobj-$(CONFIG_UTS_NS) += utsname.o 60aee16ce7SPavel Emelyanovobj-$(CONFIG_USER_NS) += user_namespace.o 6174bd59bbSPavel Emelyanovobj-$(CONFIG_PID_NS) += pid_namespace.o 621da177e4SLinus Torvaldsobj-$(CONFIG_IKCONFIG) += configs.o 63bbf1bb3eSTejun Heoobj-$(CONFIG_SMP) += stop_machine.o 648c1c9356SAnanth N Mavinakayanahalliobj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o 65939a67fcSEric Parisobj-$(CONFIG_AUDIT) += audit.o auditfilter.o 661da177e4SLinus Torvaldsobj-$(CONFIG_AUDITSYSCALL) += auditsc.o 67939a67fcSEric Parisobj-$(CONFIG_AUDIT_WATCH) += audit_watch.o 6874c3cbe3SAl Viroobj-$(CONFIG_AUDIT_TREE) += audit_tree.o 69939a67fcSEric Parisobj-$(CONFIG_GCOV_KERNEL) += gcov/ 701da177e4SLinus Torvaldsobj-$(CONFIG_KPROBES) += kprobes.o 71c4338209SJason Wesselobj-$(CONFIG_KGDB) += debug/ 72e162b39aSMandeep Singh Bainesobj-$(CONFIG_DETECT_HUNG_TASK) += hung_task.o 7358687acbSDon Zickusobj-$(CONFIG_LOCKUP_DETECTOR) += watchdog.o 741da177e4SLinus Torvaldsobj-$(CONFIG_SECCOMP) += seccomp.o 75b86ff981SJens Axboeobj-$(CONFIG_RELAY) += relay.o 7639732acdSEric W. Biedermanobj-$(CONFIG_SYSCTL) += utsname_sysctl.o 77ca74e92bSShailabh Nagarobj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o 78f3cef7a9SJay Lanobj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o 7997e1c18eSMathieu Desnoyersobj-$(CONFIG_TRACEPOINTS) += tracepoint.o 809745512cSArjan van de Venobj-$(CONFIG_LATENCYTOP) += latencytop.o 811fcccbacSDaisuke HATAYAMAobj-$(CONFIG_BINFMT_ELF) += elfcore.o 821fcccbacSDaisuke HATAYAMAobj-$(CONFIG_COMPAT_BINFMT_ELF) += elfcore.o 831fcccbacSDaisuke HATAYAMAobj-$(CONFIG_BINFMT_ELF_FDPIC) += elfcore.o 84606576ceSSteven Rostedtobj-$(CONFIG_FUNCTION_TRACER) += trace/ 85bc0c38d1SSteven Rostedtobj-$(CONFIG_TRACING) += trace/ 86ea632e9fSJosh Triplettobj-$(CONFIG_TRACE_CLOCK) += trace/ 871155de47SPaul Mundtobj-$(CONFIG_RING_BUFFER) += trace/ 88870915e0SMathieu Desnoyersobj-$(CONFIG_TRACEPOINTS) += trace/ 89e360adbeSPeter Zijlstraobj-$(CONFIG_IRQ_WORK) += irq_work.o 90ab10023eSColin Crossobj-$(CONFIG_CPU_PM) += cpu_pm.o 91f89b7755SAlexei Starovoitovobj-$(CONFIG_BPF) += bpf/ 92fae85b7cSBorislav Petkov 93fae85b7cSBorislav Petkovobj-$(CONFIG_PERF_EVENTS) += events/ 94fae85b7cSBorislav Petkov 957a041097SAvi Kivityobj-$(CONFIG_USER_RETURN_NOTIFIER) += user-return-notifier.o 9616295becSSteffen Klassertobj-$(CONFIG_PADATA) += padata.o 9793a72052SOlaf Heringobj-$(CONFIG_CRASH_DUMP) += crash_dump.o 98b77f0f3cSJason Baronobj-$(CONFIG_JUMP_LABEL) += jump_label.o 9991d1aa43SFrederic Weisbeckerobj-$(CONFIG_CONTEXT_TRACKING) += context_tracking.o 10051b1130eSPaul E. McKenneyobj-$(CONFIG_TORTURE_TEST) += torture.o 1011da177e4SLinus Torvalds 1021da177e4SLinus Torvalds$(obj)/configs.o: $(obj)/config_data.h 1031da177e4SLinus Torvalds 1041da177e4SLinus Torvalds# config_data.h contains the same information as ikconfig.h but gzipped. 1051da177e4SLinus Torvalds# Info from config_data can be extracted from /proc/config* 1061da177e4SLinus Torvaldstargets += config_data.gz 10741263fc6SBen Gardiner$(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE 1081da177e4SLinus Torvalds $(call if_changed,gzip) 1091da177e4SLinus Torvalds 1108370edeaSVivek Goyal filechk_ikconfiggz = (echo "static const char kernel_config_data[] __used = MAGIC_START"; cat $< | scripts/basic/bin2c; echo "MAGIC_END;") 1111da177e4SLinus Torvaldstargets += config_data.h 1121da177e4SLinus Torvalds$(obj)/config_data.h: $(obj)/config_data.gz FORCE 113e78e8f2dSPeter Foley $(call filechk,ikconfiggz) 114bdc80787SH. Peter Anvin 115f0e6d220SDavid Howells############################################################################### 116631cc66eSDavid Howells# 1170fbd39cfSDavid Howells# Roll all the X.509 certificates that we can find together and pull them into 118b56e5a17SDavid Howells# the kernel so that they get loaded into the system trusted keyring during 119b56e5a17SDavid Howells# boot. 1200fbd39cfSDavid Howells# 1210fbd39cfSDavid Howells# We look in the source root and the build root for all files whose name ends 1220fbd39cfSDavid Howells# in ".x509". Unfortunately, this will generate duplicate filenames, so we 1230fbd39cfSDavid Howells# have make canonicalise the pathnames and then sort them to discard the 1240fbd39cfSDavid Howells# duplicates. 125631cc66eSDavid Howells# 126f0e6d220SDavid Howells############################################################################### 127b56e5a17SDavid Howellsifeq ($(CONFIG_SYSTEM_TRUSTED_KEYRING),y) 128f0e6d220SDavid HowellsX509_CERTIFICATES-y := $(wildcard *.x509) $(wildcard $(srctree)/*.x509) 129d7ec435fSDavid HowellsX509_CERTIFICATES-$(CONFIG_MODULE_SIG) += $(objtree)/signing_key.x509 130d7ec435fSDavid HowellsX509_CERTIFICATES-raw := $(sort $(foreach CERT,$(X509_CERTIFICATES-y), \ 1310fbd39cfSDavid Howells $(or $(realpath $(CERT)),$(CERT)))) 132d7ec435fSDavid HowellsX509_CERTIFICATES := $(subst $(realpath $(objtree))/,,$(X509_CERTIFICATES-raw)) 133631cc66eSDavid Howells 134f0e6d220SDavid Howellsifeq ($(X509_CERTIFICATES),) 135f0e6d220SDavid Howells$(warning *** No X.509 certificates found ***) 136f0e6d220SDavid Howellsendif 137e10e1774SMichal Marek 138f0e6d220SDavid Howellsifneq ($(wildcard $(obj)/.x509.list),) 139f0e6d220SDavid Howellsifneq ($(shell cat $(obj)/.x509.list),$(X509_CERTIFICATES)) 140f0e6d220SDavid Howells$(info X.509 certificate list changed) 141f0e6d220SDavid Howells$(shell rm $(obj)/.x509.list) 142f0e6d220SDavid Howellsendif 143f0e6d220SDavid Howellsendif 144631cc66eSDavid Howells 145b56e5a17SDavid Howellskernel/system_certificates.o: $(obj)/x509_certificate_list 146f0e6d220SDavid Howells 147f0e6d220SDavid Howellsquiet_cmd_x509certs = CERTS $@ 14889f703f0SArnd Bergmann cmd_x509certs = cat $(X509_CERTIFICATES) /dev/null >$@ $(foreach X509,$(X509_CERTIFICATES),; $(kecho) " - Including cert $(X509)") 149b56e5a17SDavid Howells 150f0e6d220SDavid Howellstargets += $(obj)/x509_certificate_list 151f0e6d220SDavid Howells$(obj)/x509_certificate_list: $(X509_CERTIFICATES) $(obj)/.x509.list 152f0e6d220SDavid Howells $(call if_changed,x509certs) 153f0e6d220SDavid Howells 154f0e6d220SDavid Howellstargets += $(obj)/.x509.list 155f0e6d220SDavid Howells$(obj)/.x509.list: 156f0e6d220SDavid Howells @echo $(X509_CERTIFICATES) >$@ 157f46a3cbbSKirill Tkhaiendif 158f0e6d220SDavid Howells 159f0e6d220SDavid Howellsclean-files := x509_certificate_list .x509.list 160d441108cSDavid Howells 161bdc80787SH. Peter Anvinifeq ($(CONFIG_MODULE_SIG),y) 162d441108cSDavid Howells############################################################################### 163d441108cSDavid Howells# 164d441108cSDavid Howells# If module signing is requested, say by allyesconfig, but a key has not been 165d441108cSDavid Howells# supplied, then one will need to be generated to make sure the build does not 166d441108cSDavid Howells# fail and that the kernel may be used afterwards. 167d441108cSDavid Howells# 168d441108cSDavid Howells############################################################################### 16922753674SMichal Marekifndef CONFIG_MODULE_SIG_HASH 1705e8cb1e4SDavid Howells$(error Could not determine digest type to use from kernel config) 1715e8cb1e4SDavid Howellsendif 1725e8cb1e4SDavid Howells 173d441108cSDavid Howellssigning_key.priv signing_key.x509: x509.genkey 174d441108cSDavid Howells @echo "###" 175d441108cSDavid Howells @echo "### Now generating an X.509 key pair to be used for signing modules." 176d441108cSDavid Howells @echo "###" 177d441108cSDavid Howells @echo "### If this takes a long time, you might wish to run rngd in the" 178d441108cSDavid Howells @echo "### background to keep the supply of entropy topped up. It" 1792008713cSH. Peter Anvin @echo "### needs to be run as root, and uses a hardware random" 1802008713cSH. Peter Anvin @echo "### number generator if one is available." 181d441108cSDavid Howells @echo "###" 18222753674SMichal Marek openssl req -new -nodes -utf8 -$(CONFIG_MODULE_SIG_HASH) -days 36500 \ 18322753674SMichal Marek -batch -x509 -config x509.genkey \ 184d441108cSDavid Howells -outform DER -out signing_key.x509 \ 18507c449bbSDavid Cohen -keyout signing_key.priv 2>&1 186d441108cSDavid Howells @echo "###" 187d441108cSDavid Howells @echo "### Key pair generated." 188d441108cSDavid Howells @echo "###" 189d441108cSDavid Howells 190d441108cSDavid Howellsx509.genkey: 191d441108cSDavid Howells @echo Generating X.509 key generation config 192d441108cSDavid Howells @echo >x509.genkey "[ req ]" 193d441108cSDavid Howells @echo >>x509.genkey "default_bits = 4096" 194d441108cSDavid Howells @echo >>x509.genkey "distinguished_name = req_distinguished_name" 195d441108cSDavid Howells @echo >>x509.genkey "prompt = no" 196e7d113bcSDavid Howells @echo >>x509.genkey "string_mask = utf8only" 197d441108cSDavid Howells @echo >>x509.genkey "x509_extensions = myexts" 198d441108cSDavid Howells @echo >>x509.genkey 199d441108cSDavid Howells @echo >>x509.genkey "[ req_distinguished_name ]" 200d441108cSDavid Howells @echo >>x509.genkey "O = Magrathea" 201d441108cSDavid Howells @echo >>x509.genkey "CN = Glacier signing key" 202d441108cSDavid Howells @echo >>x509.genkey "emailAddress = slartibartfast@magrathea.h2g2" 203d441108cSDavid Howells @echo >>x509.genkey 204d441108cSDavid Howells @echo >>x509.genkey "[ myexts ]" 205d441108cSDavid Howells @echo >>x509.genkey "basicConstraints=critical,CA:FALSE" 206d441108cSDavid Howells @echo >>x509.genkey "keyUsage=digitalSignature" 207d441108cSDavid Howells @echo >>x509.genkey "subjectKeyIdentifier=hash" 208d441108cSDavid Howells @echo >>x509.genkey "authorityKeyIdentifier=keyid" 209d441108cSDavid Howellsendif 210