aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
committerJonathan Herman <hermanjl@cs.unc.edu>2013-01-17 16:15:55 -0500
commit8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch)
treea8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /Makefile
parent406089d01562f1e2bf9f089fd7637009ebaad589 (diff)
Patched in Tegra support.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile409
1 files changed, 274 insertions, 135 deletions
diff --git a/Makefile b/Makefile
index a1667c4bcce..64562abe90a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,8 @@
1VERSION = 3 1VERSION = 3
2PATCHLEVEL = 8 2PATCHLEVEL = 1
3SUBLEVEL = 0 3SUBLEVEL = 10
4EXTRAVERSION = -rc3 4EXTRAVERSION =
5NAME = Terrified Chipmunk 5NAME = "Divemaster Edition"
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
8# To see a list of typical targets execute "make help" 8# To see a list of typical targets execute "make help"
@@ -124,7 +124,7 @@ $(if $(KBUILD_OUTPUT),, \
124PHONY += $(MAKECMDGOALS) sub-make 124PHONY += $(MAKECMDGOALS) sub-make
125 125
126$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make 126$(filter-out _all sub-make $(CURDIR)/Makefile, $(MAKECMDGOALS)) _all: sub-make
127 @: 127 $(Q)@:
128 128
129sub-make: FORCE 129sub-make: FORCE
130 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \ 130 $(if $(KBUILD_VERBOSE:1=),@)$(MAKE) -C $(KBUILD_OUTPUT) \
@@ -162,7 +162,7 @@ export srctree objtree VPATH
162# SUBARCH tells the usermode build what the underlying arch is. That is set 162# SUBARCH tells the usermode build what the underlying arch is. That is set
163# first, and if a usermode build is happening, the "ARCH=um" on the command 163# first, and if a usermode build is happening, the "ARCH=um" on the command
164# line overrides the setting of ARCH below. If a native build is happening, 164# line overrides the setting of ARCH below. If a native build is happening,
165# then ARCH is assigned, getting whatever value it gets normally, and 165# then ARCH is assigned, getting whatever value it gets normally, and
166# SUBARCH is subsequently ignored. 166# SUBARCH is subsequently ignored.
167 167
168SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \ 168SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
@@ -231,6 +231,10 @@ endif
231# Where to locate arch specific headers 231# Where to locate arch specific headers
232hdr-arch := $(SRCARCH) 232hdr-arch := $(SRCARCH)
233 233
234ifeq ($(ARCH),m68knommu)
235 hdr-arch := m68k
236endif
237
234KCONFIG_CONFIG ?= .config 238KCONFIG_CONFIG ?= .config
235export KCONFIG_CONFIG 239export KCONFIG_CONFIG
236 240
@@ -285,7 +289,7 @@ export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
285# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< 289# cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $<
286# 290#
287# If $(quiet) is empty, the whole command will be printed. 291# If $(quiet) is empty, the whole command will be printed.
288# If it is set to "quiet_", only the short version will be printed. 292# If it is set to "quiet_", only the short version will be printed.
289# If it is set to "silent_", nothing will be printed at all, since 293# If it is set to "silent_", nothing will be printed at all, since
290# the variable $(silent_cmd_cc_o_c) doesn't exist. 294# the variable $(silent_cmd_cc_o_c) doesn't exist.
291# 295#
@@ -308,7 +312,7 @@ endif
308# If the user is running make -s (silent mode), suppress echoing of 312# If the user is running make -s (silent mode), suppress echoing of
309# commands 313# commands
310 314
311ifneq ($(filter s% -s%,$(MAKEFLAGS)),) 315ifneq ($(findstring s,$(MAKEFLAGS)),)
312 quiet=silent_ 316 quiet=silent_
313endif 317endif
314 318
@@ -337,6 +341,7 @@ AWK = awk
337GENKSYMS = scripts/genksyms/genksyms 341GENKSYMS = scripts/genksyms/genksyms
338INSTALLKERNEL := installkernel 342INSTALLKERNEL := installkernel
339DEPMOD = /sbin/depmod 343DEPMOD = /sbin/depmod
344KALLSYMS = scripts/kallsyms
340PERL = perl 345PERL = perl
341CHECK = sparse 346CHECK = sparse
342 347
@@ -350,22 +355,12 @@ AFLAGS_KERNEL =
350CFLAGS_GCOV = -fprofile-arcs -ftest-coverage 355CFLAGS_GCOV = -fprofile-arcs -ftest-coverage
351 356
352 357
353# Use USERINCLUDE when you must reference the UAPI directories only.
354USERINCLUDE := \
355 -I$(srctree)/arch/$(hdr-arch)/include/uapi \
356 -Iarch/$(hdr-arch)/include/generated/uapi \
357 -I$(srctree)/include/uapi \
358 -Iinclude/generated/uapi \
359 -include $(srctree)/include/linux/kconfig.h
360
361# Use LINUXINCLUDE when you must reference the include/ directory. 358# Use LINUXINCLUDE when you must reference the include/ directory.
362# Needed to be compatible with the O= option 359# Needed to be compatible with the O= option
363LINUXINCLUDE := \ 360LINUXINCLUDE := -I$(srctree)/arch/$(hdr-arch)/include \
364 -I$(srctree)/arch/$(hdr-arch)/include \ 361 -Iarch/$(hdr-arch)/include/generated -Iinclude \
365 -Iarch/$(hdr-arch)/include/generated \ 362 $(if $(KBUILD_SRC), -I$(srctree)/include) \
366 $(if $(KBUILD_SRC), -I$(srctree)/include) \ 363 -include $(srctree)/include/linux/kconfig.h
367 -Iinclude \
368 $(USERINCLUDE)
369 364
370KBUILD_CPPFLAGS := -D__KERNEL__ 365KBUILD_CPPFLAGS := -D__KERNEL__
371 366
@@ -405,10 +400,8 @@ export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_ve
405 400
406# Files to ignore in find ... statements 401# Files to ignore in find ... statements
407 402
408RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS \ 403RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc -o -name .hg -o -name .git \) -prune -o
409 -o -name .pc -o -name .hg -o -name .git \) -prune -o 404export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS --exclude .pc --exclude .hg --exclude .git
410export RCS_TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn \
411 --exclude CVS --exclude .pc --exclude .hg --exclude .git
412 405
413# =========================================================================== 406# ===========================================================================
414# Rules shared between *config targets and build targets 407# Rules shared between *config targets and build targets
@@ -437,9 +430,7 @@ endif
437PHONY += asm-generic 430PHONY += asm-generic
438asm-generic: 431asm-generic:
439 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \ 432 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
440 src=asm obj=arch/$(SRCARCH)/include/generated/asm 433 obj=arch/$(SRCARCH)/include/generated/asm
441 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.asm-generic \
442 src=uapi/asm obj=arch/$(SRCARCH)/include/generated/uapi/asm
443 434
444# To make sure we do not include .config for any of the *config targets 435# To make sure we do not include .config for any of the *config targets
445# catch them early, and hand them over to scripts/kconfig/Makefile 436# catch them early, and hand them over to scripts/kconfig/Makefile
@@ -449,11 +440,9 @@ asm-generic:
449# Detect when mixed targets is specified, and make a second invocation 440# Detect when mixed targets is specified, and make a second invocation
450# of make so .config is not included in this case either (for *config). 441# of make so .config is not included in this case either (for *config).
451 442
452version_h := include/generated/uapi/linux/version.h
453
454no-dot-config-targets := clean mrproper distclean \ 443no-dot-config-targets := clean mrproper distclean \
455 cscope gtags TAGS tags help %docs check% coccicheck \ 444 cscope gtags TAGS tags help %docs check% coccicheck \
456 $(version_h) headers_% archheaders archscripts \ 445 include/linux/version.h headers_% \
457 kernelversion %src-pkg 446 kernelversion %src-pkg
458 447
459config-targets := 0 448config-targets := 0
@@ -549,11 +538,11 @@ PHONY += include/config/auto.conf
549 538
550include/config/auto.conf: 539include/config/auto.conf:
551 $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \ 540 $(Q)test -e include/generated/autoconf.h -a -e $@ || ( \
552 echo >&2; \ 541 echo; \
553 echo >&2 " ERROR: Kernel configuration is invalid."; \ 542 echo " ERROR: Kernel configuration is invalid."; \
554 echo >&2 " include/generated/autoconf.h or $@ are missing.";\ 543 echo " include/generated/autoconf.h or $@ are missing.";\
555 echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \ 544 echo " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
556 echo >&2 ; \ 545 echo; \
557 /bin/false) 546 /bin/false)
558 547
559endif # KBUILD_EXTMOD 548endif # KBUILD_EXTMOD
@@ -577,16 +566,6 @@ endif
577 566
578include $(srctree)/arch/$(SRCARCH)/Makefile 567include $(srctree)/arch/$(SRCARCH)/Makefile
579 568
580ifdef CONFIG_READABLE_ASM
581# Disable optimizations that make assembler listings hard to read.
582# reorder blocks reorders the control in the function
583# ipa clone creates specialized cloned functions
584# partial inlining inlines only parts of functions
585KBUILD_CFLAGS += $(call cc-option,-fno-reorder-blocks,) \
586 $(call cc-option,-fno-ipa-cp-clone,) \
587 $(call cc-option,-fno-partial-inlining)
588endif
589
590ifneq ($(CONFIG_FRAME_WARN),0) 569ifneq ($(CONFIG_FRAME_WARN),0)
591KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN}) 570KBUILD_CFLAGS += $(call cc-option,-Wframe-larger-than=${CONFIG_FRAME_WARN})
592endif 571endif
@@ -623,11 +602,7 @@ KBUILD_CFLAGS += $(call cc-option, -femit-struct-debug-baseonly)
623endif 602endif
624 603
625ifdef CONFIG_FUNCTION_TRACER 604ifdef CONFIG_FUNCTION_TRACER
626ifdef CONFIG_HAVE_FENTRY 605KBUILD_CFLAGS += -pg
627CC_USING_FENTRY := $(call cc-option, -mfentry -DCC_USING_FENTRY)
628endif
629KBUILD_CFLAGS += -pg $(CC_USING_FENTRY)
630KBUILD_AFLAGS += $(CC_USING_FENTRY)
631ifdef CONFIG_DYNAMIC_FTRACE 606ifdef CONFIG_DYNAMIC_FTRACE
632 ifdef CONFIG_HAVE_C_RECORDMCOUNT 607 ifdef CONFIG_HAVE_C_RECORDMCOUNT
633 BUILD_C_RECORDMCOUNT := y 608 BUILD_C_RECORDMCOUNT := y
@@ -666,9 +641,22 @@ ifeq ($(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-goto.sh $(CC)), y)
666endif 641endif
667 642
668# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments 643# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
669KBUILD_CPPFLAGS += $(KCPPFLAGS) 644# But warn user when we do so
670KBUILD_AFLAGS += $(KAFLAGS) 645warn-assign = \
671KBUILD_CFLAGS += $(KCFLAGS) 646$(warning "WARNING: Appending $$K$(1) ($(K$(1))) from $(origin K$(1)) to kernel $$$(1)")
647
648ifneq ($(KCPPFLAGS),)
649 $(call warn-assign,CPPFLAGS)
650 KBUILD_CPPFLAGS += $(KCPPFLAGS)
651endif
652ifneq ($(KAFLAGS),)
653 $(call warn-assign,AFLAGS)
654 KBUILD_AFLAGS += $(KAFLAGS)
655endif
656ifneq ($(KCFLAGS),)
657 $(call warn-assign,CFLAGS)
658 KBUILD_CFLAGS += $(KCFLAGS)
659endif
672 660
673# Use --build-id when available. 661# Use --build-id when available.
674LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\ 662LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
@@ -719,17 +707,6 @@ endif # INSTALL_MOD_STRIP
719export mod_strip_cmd 707export mod_strip_cmd
720 708
721 709
722ifeq ($(CONFIG_MODULE_SIG),y)
723MODSECKEY = ./signing_key.priv
724MODPUBKEY = ./signing_key.x509
725export MODPUBKEY
726mod_sign_cmd = perl $(srctree)/scripts/sign-file $(MODSECKEY) $(MODPUBKEY)
727else
728mod_sign_cmd = true
729endif
730export mod_sign_cmd
731
732
733ifeq ($(KBUILD_EXTMOD),) 710ifeq ($(KBUILD_EXTMOD),)
734core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ 711core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
735 712
@@ -750,21 +727,187 @@ libs-y1 := $(patsubst %/, %/lib.a, $(libs-y))
750libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y)) 727libs-y2 := $(patsubst %/, %/built-in.o, $(libs-y))
751libs-y := $(libs-y1) $(libs-y2) 728libs-y := $(libs-y1) $(libs-y2)
752 729
753# Externally visible symbols (used by link-vmlinux.sh) 730# Build vmlinux
754export KBUILD_VMLINUX_INIT := $(head-y) $(init-y) 731# ---------------------------------------------------------------------------
755export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y) 732# vmlinux is built from the objects selected by $(vmlinux-init) and
756export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds 733# $(vmlinux-main). Most are built-in.o files from top-level directories
757export LDFLAGS_vmlinux 734# in the kernel tree, others are specified in arch/$(ARCH)/Makefile.
735# Ordering when linking is important, and $(vmlinux-init) must be first.
736#
737# vmlinux
738# ^
739# |
740# +-< $(vmlinux-init)
741# | +--< init/version.o + more
742# |
743# +--< $(vmlinux-main)
744# | +--< driver/built-in.o mm/built-in.o + more
745# |
746# +-< kallsyms.o (see description in CONFIG_KALLSYMS section)
747#
748# vmlinux version (uname -v) cannot be updated during normal
749# descending-into-subdirs phase since we do not yet know if we need to
750# update vmlinux.
751# Therefore this step is delayed until just before final link of vmlinux -
752# except in the kallsyms case where it is done just before adding the
753# symbols to the kernel.
754#
755# System.map is generated to document addresses of all kernel symbols
756
757vmlinux-init := $(head-y) $(init-y)
758vmlinux-main := $(core-y) $(libs-y) $(drivers-y) $(net-y)
759vmlinux-all := $(vmlinux-init) $(vmlinux-main)
760vmlinux-lds := arch/$(SRCARCH)/kernel/vmlinux.lds
761export KBUILD_VMLINUX_OBJS := $(vmlinux-all)
762
763# Rule to link vmlinux - also used during CONFIG_KALLSYMS
764# May be overridden by arch/$(ARCH)/Makefile
765quiet_cmd_vmlinux__ ?= LD $@
766 cmd_vmlinux__ ?= $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) -o $@ \
767 -T $(vmlinux-lds) $(vmlinux-init) \
768 --start-group $(vmlinux-main) --end-group \
769 $(filter-out $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o FORCE ,$^)
770
771# Generate new vmlinux version
772quiet_cmd_vmlinux_version = GEN .version
773 cmd_vmlinux_version = set -e; \
774 if [ ! -r .version ]; then \
775 rm -f .version; \
776 echo 1 >.version; \
777 else \
778 mv .version .old_version; \
779 expr 0$$(cat .old_version) + 1 >.version; \
780 fi; \
781 $(MAKE) $(build)=init
782
783# Generate System.map
784quiet_cmd_sysmap = SYSMAP
785 cmd_sysmap = $(CONFIG_SHELL) $(srctree)/scripts/mksysmap
786
787# Link of vmlinux
788# If CONFIG_KALLSYMS is set .version is already updated
789# Generate System.map and verify that the content is consistent
790# Use + in front of the vmlinux_version rule to silent warning with make -j2
791# First command is ':' to allow us to use + in front of the rule
792define rule_vmlinux__
793 :
794 $(if $(CONFIG_KALLSYMS),,+$(call cmd,vmlinux_version))
795
796 $(call cmd,vmlinux__)
797 $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
798
799 $(Q)$(if $($(quiet)cmd_sysmap), \
800 echo ' $($(quiet)cmd_sysmap) System.map' &&) \
801 $(cmd_sysmap) $@ System.map; \
802 if [ $$? -ne 0 ]; then \
803 rm -f $@; \
804 /bin/false; \
805 fi;
806 $(verify_kallsyms)
807endef
808
758 809
759vmlinux-deps := $(KBUILD_LDS) $(KBUILD_VMLINUX_INIT) $(KBUILD_VMLINUX_MAIN) 810ifdef CONFIG_KALLSYMS
811# Generate section listing all symbols and add it into vmlinux $(kallsyms.o)
812# It's a three stage process:
813# o .tmp_vmlinux1 has all symbols and sections, but __kallsyms is
814# empty
815# Running kallsyms on that gives us .tmp_kallsyms1.o with
816# the right size - vmlinux version (uname -v) is updated during this step
817# o .tmp_vmlinux2 now has a __kallsyms section of the right size,
818# but due to the added section, some addresses have shifted.
819# From here, we generate a correct .tmp_kallsyms2.o
820# o The correct .tmp_kallsyms2.o is linked into the final vmlinux.
821# o Verify that the System.map from vmlinux matches the map from
822# .tmp_vmlinux2, just in case we did not generate kallsyms correctly.
823# o If 'make KALLSYMS_EXTRA_PASS=1" was used, do an extra pass using
824# .tmp_vmlinux3 and .tmp_kallsyms3.o. This is only meant as a
825# temporary bypass to allow the kernel to be built while the
826# maintainers work out what went wrong with kallsyms.
827
828last_kallsyms := 2
829
830ifdef KALLSYMS_EXTRA_PASS
831ifneq ($(KALLSYMS_EXTRA_PASS),0)
832last_kallsyms := 3
833endif
834endif
760 835
761# Final link of vmlinux 836kallsyms.o := .tmp_kallsyms$(last_kallsyms).o
762 cmd_link-vmlinux = $(CONFIG_SHELL) $< $(LD) $(LDFLAGS) $(LDFLAGS_vmlinux) 837
763quiet_cmd_link-vmlinux = LINK $@ 838define verify_kallsyms
839 $(Q)$(if $($(quiet)cmd_sysmap), \
840 echo ' $($(quiet)cmd_sysmap) .tmp_System.map' &&) \
841 $(cmd_sysmap) .tmp_vmlinux$(last_kallsyms) .tmp_System.map
842 $(Q)cmp -s System.map .tmp_System.map || \
843 (echo Inconsistent kallsyms data; \
844 echo This is a bug - please report about it; \
845 echo Try "make KALLSYMS_EXTRA_PASS=1" as a workaround; \
846 rm .tmp_kallsyms* ; /bin/false )
847endef
848
849# Update vmlinux version before link
850# Use + in front of this rule to silent warning about make -j1
851# First command is ':' to allow us to use + in front of this rule
852cmd_ksym_ld = $(cmd_vmlinux__)
853define rule_ksym_ld
854 :
855 +$(call cmd,vmlinux_version)
856 $(call cmd,vmlinux__)
857 $(Q)echo 'cmd_$@ := $(cmd_vmlinux__)' > $(@D)/.$(@F).cmd
858endef
764 859
765# Include targets which we want to 860# Generate .S file with all kernel symbols
766# execute if the rest of the kernel build went well. 861quiet_cmd_kallsyms = KSYM $@
767vmlinux: scripts/link-vmlinux.sh $(vmlinux-deps) FORCE 862 cmd_kallsyms = $(NM) -n $< | $(KALLSYMS) \
863 $(if $(CONFIG_KALLSYMS_ALL),--all-symbols) > $@
864
865.tmp_kallsyms1.o .tmp_kallsyms2.o .tmp_kallsyms3.o: %.o: %.S scripts FORCE
866 $(call if_changed_dep,as_o_S)
867
868.tmp_kallsyms%.S: .tmp_vmlinux% $(KALLSYMS)
869 $(call cmd,kallsyms)
870
871# .tmp_vmlinux1 must be complete except kallsyms, so update vmlinux version
872.tmp_vmlinux1: $(vmlinux-lds) $(vmlinux-all) FORCE
873 $(call if_changed_rule,ksym_ld)
874
875.tmp_vmlinux2: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms1.o FORCE
876 $(call if_changed,vmlinux__)
877
878.tmp_vmlinux3: $(vmlinux-lds) $(vmlinux-all) .tmp_kallsyms2.o FORCE
879 $(call if_changed,vmlinux__)
880
881# Needs to visit scripts/ before $(KALLSYMS) can be used.
882$(KALLSYMS): scripts ;
883
884# Generate some data for debugging strange kallsyms problems
885debug_kallsyms: .tmp_map$(last_kallsyms)
886
887.tmp_map%: .tmp_vmlinux% FORCE
888 ($(OBJDUMP) -h $< | $(AWK) '/^ +[0-9]/{print $$4 " 0 " $$2}'; $(NM) $<) | sort > $@
889
890.tmp_map3: .tmp_map2
891
892.tmp_map2: .tmp_map1
893
894endif # ifdef CONFIG_KALLSYMS
895
896# Do modpost on a prelinked vmlinux. The finally linked vmlinux has
897# relevant sections renamed as per the linker script.
898quiet_cmd_vmlinux-modpost = LD $@
899 cmd_vmlinux-modpost = $(LD) $(LDFLAGS) -r -o $@ \
900 $(vmlinux-init) --start-group $(vmlinux-main) --end-group \
901 $(filter-out $(vmlinux-init) $(vmlinux-main) FORCE ,$^)
902define rule_vmlinux-modpost
903 :
904 +$(call cmd,vmlinux-modpost)
905 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost $@
906 $(Q)echo 'cmd_$@ := $(cmd_vmlinux-modpost)' > $(dot-target).cmd
907endef
908
909# vmlinux image - including updated kernel symbols
910vmlinux: $(vmlinux-lds) $(vmlinux-init) $(vmlinux-main) vmlinux.o $(kallsyms.o) FORCE
768ifdef CONFIG_HEADERS_CHECK 911ifdef CONFIG_HEADERS_CHECK
769 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check 912 $(Q)$(MAKE) -f $(srctree)/Makefile headers_check
770endif 913endif
@@ -774,11 +917,22 @@ endif
774ifdef CONFIG_BUILD_DOCSRC 917ifdef CONFIG_BUILD_DOCSRC
775 $(Q)$(MAKE) $(build)=Documentation 918 $(Q)$(MAKE) $(build)=Documentation
776endif 919endif
777 +$(call if_changed,link-vmlinux) 920 $(call vmlinux-modpost)
921 $(call if_changed_rule,vmlinux__)
922 $(Q)rm -f .old_version
778 923
779# The actual objects are generated when descending, 924# build vmlinux.o first to catch section mismatch errors early
925ifdef CONFIG_KALLSYMS
926.tmp_vmlinux1: vmlinux.o
927endif
928
929modpost-init := $(filter-out init/built-in.o, $(vmlinux-init))
930vmlinux.o: $(modpost-init) $(vmlinux-main) FORCE
931 $(call if_changed_rule,vmlinux-modpost)
932
933# The actual objects are generated when descending,
780# make sure no implicit rule kicks in 934# make sure no implicit rule kicks in
781$(sort $(vmlinux-deps)): $(vmlinux-dirs) ; 935$(sort $(vmlinux-init) $(vmlinux-main)) $(vmlinux-lds): $(vmlinux-dirs) ;
782 936
783# Handle descending into subdirectories listed in $(vmlinux-dirs) 937# Handle descending into subdirectories listed in $(vmlinux-dirs)
784# Preset locale variables to speed up the build process. Limit locale 938# Preset locale variables to speed up the build process. Limit locale
@@ -812,8 +966,8 @@ prepare3: include/config/kernel.release
812ifneq ($(KBUILD_SRC),) 966ifneq ($(KBUILD_SRC),)
813 @$(kecho) ' Using $(srctree) as source for kernel' 967 @$(kecho) ' Using $(srctree) as source for kernel'
814 $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \ 968 $(Q)if [ -f $(srctree)/.config -o -d $(srctree)/include/config ]; then \
815 echo >&2 " $(srctree) is not clean, please run 'make mrproper'"; \ 969 echo " $(srctree) is not clean, please run 'make mrproper'";\
816 echo >&2 " in the '$(srctree)' directory.";\ 970 echo " in the '$(srctree)' directory.";\
817 /bin/false; \ 971 /bin/false; \
818 fi; 972 fi;
819endif 973endif
@@ -821,14 +975,15 @@ endif
821# prepare2 creates a makefile if using a separate output directory 975# prepare2 creates a makefile if using a separate output directory
822prepare2: prepare3 outputmakefile asm-generic 976prepare2: prepare3 outputmakefile asm-generic
823 977
824prepare1: prepare2 $(version_h) include/generated/utsrelease.h \ 978prepare1: prepare2 include/linux/version.h include/generated/utsrelease.h \
825 include/config/auto.conf 979 include/config/auto.conf
826 $(cmd_crmodverdir) 980 $(cmd_crmodverdir)
827 981
828archprepare: archheaders archscripts prepare1 scripts_basic 982archprepare: prepare1 scripts_basic
829 983
830prepare0: archprepare FORCE 984prepare0: archprepare FORCE
831 $(Q)$(MAKE) $(build)=. 985 $(Q)$(MAKE) $(build)=.
986 $(Q)$(MAKE) $(build)=. missing-syscalls
832 987
833# All the preparing.. 988# All the preparing..
834prepare: prepare0 989prepare: prepare0
@@ -849,12 +1004,12 @@ define filechk_utsrelease.h
849endef 1004endef
850 1005
851define filechk_version.h 1006define filechk_version.h
852 (echo \#define LINUX_VERSION_CODE $(shell \ 1007 (echo \#define LINUX_VERSION_CODE $(shell \
853 expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \ 1008 expr $(VERSION) \* 65536 + 0$(PATCHLEVEL) \* 256 + 0$(SUBLEVEL)); \
854 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';) 1009 echo '#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))';)
855endef 1010endef
856 1011
857$(version_h): $(srctree)/Makefile FORCE 1012include/linux/version.h: $(srctree)/Makefile FORCE
858 $(call filechk,version.h) 1013 $(call filechk,version.h)
859 1014
860include/generated/utsrelease.h: include/config/kernel.release FORCE 1015include/generated/utsrelease.h: include/config/kernel.release FORCE
@@ -892,14 +1047,8 @@ hdr-inst := -rR -f $(srctree)/scripts/Makefile.headersinst obj
892# If we do an all arch process set dst to asm-$(hdr-arch) 1047# If we do an all arch process set dst to asm-$(hdr-arch)
893hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm) 1048hdr-dst = $(if $(KBUILD_HEADERS), dst=include/asm-$(hdr-arch), dst=include/asm)
894 1049
895PHONY += archheaders
896archheaders:
897
898PHONY += archscripts
899archscripts:
900
901PHONY += __headers 1050PHONY += __headers
902__headers: $(version_h) scripts_basic asm-generic archheaders archscripts FORCE 1051__headers: include/linux/version.h scripts_basic asm-generic FORCE
903 $(Q)$(MAKE) $(build)=scripts build_unifdef 1052 $(Q)$(MAKE) $(build)=scripts build_unifdef
904 1053
905PHONY += headers_install_all 1054PHONY += headers_install_all
@@ -908,10 +1057,10 @@ headers_install_all:
908 1057
909PHONY += headers_install 1058PHONY += headers_install
910headers_install: __headers 1059headers_install: __headers
911 $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/uapi/asm/Kbuild),, \ 1060 $(if $(wildcard $(srctree)/arch/$(hdr-arch)/include/asm/Kbuild),, \
912 $(error Headers not exportable for the $(SRCARCH) architecture)) 1061 $(error Headers not exportable for the $(SRCARCH) architecture))
913 $(Q)$(MAKE) $(hdr-inst)=include/uapi 1062 $(Q)$(MAKE) $(hdr-inst)=include
914 $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) 1063 $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst)
915 1064
916PHONY += headers_check_all 1065PHONY += headers_check_all
917headers_check_all: headers_install_all 1066headers_check_all: headers_install_all
@@ -919,8 +1068,8 @@ headers_check_all: headers_install_all
919 1068
920PHONY += headers_check 1069PHONY += headers_check
921headers_check: headers_install 1070headers_check: headers_install
922 $(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1 1071 $(Q)$(MAKE) $(hdr-inst)=include HDRCHECK=1
923 $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/uapi/asm $(hdr-dst) HDRCHECK=1 1072 $(Q)$(MAKE) $(hdr-inst)=arch/$(hdr-arch)/include/asm $(hdr-dst) HDRCHECK=1
924 1073
925# --------------------------------------------------------------------------- 1074# ---------------------------------------------------------------------------
926# Modules 1075# Modules
@@ -981,23 +1130,17 @@ _modinst_post: _modinst_
981 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modinst 1130 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modinst
982 $(call cmd,depmod) 1131 $(call cmd,depmod)
983 1132
984ifeq ($(CONFIG_MODULE_SIG), y)
985PHONY += modules_sign
986modules_sign:
987 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modsign
988endif
989
990else # CONFIG_MODULES 1133else # CONFIG_MODULES
991 1134
992# Modules not configured 1135# Modules not configured
993# --------------------------------------------------------------------------- 1136# ---------------------------------------------------------------------------
994 1137
995modules modules_install: FORCE 1138modules modules_install: FORCE
996 @echo >&2 1139 @echo
997 @echo >&2 "The present kernel configuration has modules disabled." 1140 @echo "The present kernel configuration has modules disabled."
998 @echo >&2 "Type 'make config' and enable loadable module support." 1141 @echo "Type 'make config' and enable loadable module support."
999 @echo >&2 "Then build a kernel with module support enabled." 1142 @echo "Then build a kernel with module support enabled."
1000 @echo >&2 1143 @echo
1001 @exit 1 1144 @exit 1
1002 1145
1003endif # CONFIG_MODULES 1146endif # CONFIG_MODULES
@@ -1011,30 +1154,27 @@ endif # CONFIG_MODULES
1011 1154
1012# Directories & files removed with 'make clean' 1155# Directories & files removed with 'make clean'
1013CLEAN_DIRS += $(MODVERDIR) 1156CLEAN_DIRS += $(MODVERDIR)
1157CLEAN_FILES += vmlinux System.map \
1158 .tmp_kallsyms* .tmp_version .tmp_vmlinux* .tmp_System.map
1014 1159
1015# Directories & files removed with 'make mrproper' 1160# Directories & files removed with 'make mrproper'
1016MRPROPER_DIRS += include/config usr/include include/generated \ 1161MRPROPER_DIRS += include/config usr/include include/generated \
1017 arch/*/include/generated 1162 arch/*/include/generated
1018MRPROPER_FILES += .config .config.old .version .old_version $(version_h) \ 1163MRPROPER_FILES += .config .config.old .version .old_version \
1019 Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS \ 1164 include/linux/version.h \
1020 signing_key.priv signing_key.x509 x509.genkey \ 1165 Module.symvers tags TAGS cscope* GPATH GTAGS GRTAGS GSYMS
1021 extra_certificates signing_key.x509.keyid \
1022 signing_key.x509.signer
1023 1166
1024# clean - Delete most, but leave enough to build external modules 1167# clean - Delete most, but leave enough to build external modules
1025# 1168#
1026clean: rm-dirs := $(CLEAN_DIRS) 1169clean: rm-dirs := $(CLEAN_DIRS)
1027clean: rm-files := $(CLEAN_FILES) 1170clean: rm-files := $(CLEAN_FILES)
1028clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation samples) 1171clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation)
1029 1172
1030PHONY += $(clean-dirs) clean archclean vmlinuxclean 1173PHONY += $(clean-dirs) clean archclean
1031$(clean-dirs): 1174$(clean-dirs):
1032 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) 1175 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
1033 1176
1034vmlinuxclean: 1177clean: archclean
1035 $(Q)$(CONFIG_SHELL) $(srctree)/scripts/link-vmlinux.sh clean
1036
1037clean: archclean vmlinuxclean
1038 1178
1039# mrproper - Delete all generated files, including .config 1179# mrproper - Delete all generated files, including .config
1040# 1180#
@@ -1058,7 +1198,7 @@ distclean: mrproper
1058 @find $(srctree) $(RCS_FIND_IGNORE) \ 1198 @find $(srctree) $(RCS_FIND_IGNORE) \
1059 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \ 1199 \( -name '*.orig' -o -name '*.rej' -o -name '*~' \
1060 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \ 1200 -o -name '*.bak' -o -name '#*#' -o -name '.*.orig' \
1061 -o -name '.*.rej' \ 1201 -o -name '.*.rej' -o -size 0 \
1062 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \ 1202 -o -name '*%' -o -name '.*.cmd' -o -name 'core' \) \
1063 -type f -print | xargs rm -f 1203 -type f -print | xargs rm -f
1064 1204
@@ -1156,6 +1296,7 @@ help:
1156 @echo ' 2: warnings which occur quite often but may still be relevant' 1296 @echo ' 2: warnings which occur quite often but may still be relevant'
1157 @echo ' 3: more obscure warnings, can most likely be ignored' 1297 @echo ' 3: more obscure warnings, can most likely be ignored'
1158 @echo ' Multiple levels can be combined with W=12 or W=123' 1298 @echo ' Multiple levels can be combined with W=12 or W=123'
1299 @echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
1159 @echo '' 1300 @echo ''
1160 @echo 'Execute "make" or "make all" to build all targets marked with [*] ' 1301 @echo 'Execute "make" or "make all" to build all targets marked with [*] '
1161 @echo 'For further info see the ./README file' 1302 @echo 'For further info see the ./README file'
@@ -1265,7 +1406,6 @@ clean: $(clean-dirs)
1265 $(call cmd,rmfiles) 1406 $(call cmd,rmfiles)
1266 @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \ 1407 @find $(if $(KBUILD_EXTMOD), $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
1267 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \ 1408 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1268 -o -name '*.ko.*' \
1269 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \ 1409 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1270 -o -name '*.symtypes' -o -name 'modules.order' \ 1410 -o -name '*.symtypes' -o -name 'modules.order' \
1271 -o -name modules.builtin -o -name '.tmp_*.o.*' \ 1411 -o -name modules.builtin -o -name '.tmp_*.o.*' \
@@ -1327,15 +1467,6 @@ kernelrelease:
1327kernelversion: 1467kernelversion:
1328 @echo $(KERNELVERSION) 1468 @echo $(KERNELVERSION)
1329 1469
1330# Clear a bunch of variables before executing the submake
1331tools/: FORCE
1332 $(Q)mkdir -p $(objtree)/tools
1333 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/
1334
1335tools/%: FORCE
1336 $(Q)mkdir -p $(objtree)/tools
1337 $(Q)$(MAKE) LDFLAGS= MAKEFLAGS= O=$(objtree) subdir=tools -C $(src)/tools/ $*
1338
1339# Single targets 1470# Single targets
1340# --------------------------------------------------------------------------- 1471# ---------------------------------------------------------------------------
1341# Single targets are compatible with: 1472# Single targets are compatible with:
@@ -1385,7 +1516,7 @@ endif
1385 $(build)=$(build-dir) $(@:.ko=.o) 1516 $(build)=$(build-dir) $(@:.ko=.o)
1386 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost 1517 $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
1387 1518
1388# FIXME Should go into a make.lib or something 1519# FIXME Should go into a make.lib or something
1389# =========================================================================== 1520# ===========================================================================
1390 1521
1391quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) 1522quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs)))
@@ -1404,6 +1535,14 @@ quiet_cmd_depmod = DEPMOD $(KERNELRELEASE)
1404cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \ 1535cmd_crmodverdir = $(Q)mkdir -p $(MODVERDIR) \
1405 $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*) 1536 $(if $(KBUILD_MODULES),; rm -f $(MODVERDIR)/*)
1406 1537
1538a_flags = -Wp,-MD,$(depfile) $(KBUILD_AFLAGS) $(AFLAGS_KERNEL) \
1539 $(KBUILD_AFLAGS_KERNEL) \
1540 $(NOSTDINC_FLAGS) $(LINUXINCLUDE) $(KBUILD_CPPFLAGS) \
1541 $(modkern_aflags) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o)
1542
1543quiet_cmd_as_o_S = AS $@
1544cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $<
1545
1407# read all saved command lines 1546# read all saved command lines
1408 1547
1409targets := $(wildcard $(sort $(targets))) 1548targets := $(wildcard $(sort $(targets)))