xref: /linux/arch/powerpc/Makefile (revision d503ac531a5246e4d910f971b213807fea925956)
114cf11afSPaul Mackerras# This file is included by the global makefile so that you can add your own
214cf11afSPaul Mackerras# architecture-specific flags and dependencies. Remember to do have actions
314cf11afSPaul Mackerras# for "archclean" and "archdep" for cleaning up and making dependencies for
414cf11afSPaul Mackerras# this architecture.
514cf11afSPaul Mackerras#
614cf11afSPaul Mackerras# This file is subject to the terms and conditions of the GNU General Public
714cf11afSPaul Mackerras# License.  See the file "COPYING" in the main directory of this archive
814cf11afSPaul Mackerras# for more details.
914cf11afSPaul Mackerras#
1014cf11afSPaul Mackerras# Copyright (C) 1994 by Linus Torvalds
1114cf11afSPaul Mackerras# Changes for PPC by Gary Thomas
1214cf11afSPaul Mackerras# Rewritten by Cort Dougan and Paul Mackerras
1314cf11afSPaul Mackerras#
1414cf11afSPaul Mackerras
1514cf11afSPaul MackerrasHAS_BIARCH	:= $(call cc-option-yn, -m32)
1614cf11afSPaul Mackerras
1714cf11afSPaul Mackerras# Set default 32 bits cross compilers for vdso and boot wrapper
1814cf11afSPaul MackerrasCROSS32_COMPILE ?=
1914cf11afSPaul Mackerras
2014cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y)
2114cf11afSPaul Mackerrasifeq ($(CROSS32_COMPILE),)
224bf4f42aSNicholas Pigginifdef CONFIG_PPC32
234bf4f42aSNicholas Piggin# These options will be overridden by any -mcpu option that the CPU
244bf4f42aSNicholas Piggin# or platform code sets later on the command line, but they are needed
254bf4f42aSNicholas Piggin# to set a sane 32-bit cpu target for the 64-bit cross compiler which
264bf4f42aSNicholas Piggin# may default to the wrong ISA.
274bf4f42aSNicholas PigginKBUILD_CFLAGS		+= -mcpu=powerpc
284bf4f42aSNicholas PigginKBUILD_AFLAGS		+= -mcpu=powerpc
294bf4f42aSNicholas Pigginendif
3014cf11afSPaul Mackerrasendif
3114cf11afSPaul Mackerrasendif
3214cf11afSPaul Mackerras
33ca786f83SAdrian Bunkifeq ($(CROSS_COMPILE),)
348a5abdf8SPaul MackerrasKBUILD_DEFCONFIG := $(shell uname -m)_defconfig
35ca786f83SAdrian Bunkelse
36ca786f83SAdrian BunkKBUILD_DEFCONFIG := ppc64_defconfig
37ca786f83SAdrian Bunkendif
388a5abdf8SPaul Mackerras
39badf436fSRodrigo R. Galvaoifdef CONFIG_PPC64
4014cf11afSPaul Mackerrasnew_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
4114cf11afSPaul Mackerras
4214cf11afSPaul Mackerrasifeq ($(new_nm),y)
4314cf11afSPaul MackerrasNM		:= $(NM) --synthetic
4414cf11afSPaul Mackerrasendif
45a0588015SAnton Blanchardendif
4614cf11afSPaul Mackerras
4768201fbbSMichael Ellerman# BITS is used as extension for files which are available in a 32 bit
4868201fbbSMichael Ellerman# and a 64 bit version to simplify shared Makefiles.
4968201fbbSMichael Ellerman# e.g.: obj-y += foo_$(BITS).o
5068201fbbSMichael Ellermanexport BITS
5168201fbbSMichael Ellerman
5268201fbbSMichael Ellermanifdef CONFIG_PPC64
5368201fbbSMichael Ellerman        BITS := 64
5468201fbbSMichael Ellermanelse
5568201fbbSMichael Ellerman        BITS := 32
5614cf11afSPaul Mackerrasendif
5714cf11afSPaul Mackerras
5857073e27SMichael Ellermanmachine-y = ppc
5957073e27SMichael Ellermanmachine-$(CONFIG_PPC64) += 64
6057073e27SMichael Ellermanmachine-$(CONFIG_CPU_LITTLE_ENDIAN) += le
6157073e27SMichael EllermanUTS_MACHINE := $(subst $(space),,$(machine-y))
62190554dbSStephen Rothwell
63b40b2386SMichael Ellerman# XXX This needs to be before we override LD below
64b40b2386SMichael Ellermanifdef CONFIG_PPC32
65b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
66b40b2386SMichael Ellermanelse
675c45b528SAlan ModraKBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/powerpc/kernel/module.lds
68b40b2386SMichael Ellermanifeq ($(call ld-ifversion, -ge, 225000000, y),y)
69b40b2386SMichael Ellerman# Have the linker provide sfpr if possible.
70b40b2386SMichael Ellerman# There is a corresponding test in arch/powerpc/lib/Makefile
71b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += --save-restore-funcs
72b40b2386SMichael Ellermanelse
73b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
74b40b2386SMichael Ellermanendif
75b40b2386SMichael Ellermanendif
76b40b2386SMichael Ellerman
77badf436fSRodrigo R. Galvaoifdef CONFIG_CPU_LITTLE_ENDIAN
781421dc6dSNicholas PigginKBUILD_CFLAGS	+= -mlittle-endian
79*d503ac53SMasahiro YamadaKBUILD_LDFLAGS	+= -EL
80d72b0801SIan MunsieLDEMULATION	:= lppc
81d72b0801SIan MunsieGNUTARGET	:= powerpcle
82d72b0801SIan MunsieMULTIPLEWORD	:= -mno-multiple
83d3d35d95STony BreedsKBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
84d72b0801SIan Munsieelse
851421dc6dSNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mbig-endian)
86*d503ac53SMasahiro YamadaKBUILD_LDFLAGS	+= -EB
87d72b0801SIan MunsieLDEMULATION	:= ppc
88d72b0801SIan MunsieGNUTARGET	:= powerpc
89d72b0801SIan MunsieMULTIPLEWORD	:= -mmultiple
90d72b0801SIan Munsieendif
91d72b0801SIan Munsie
924dc831aaSNicholas Pigginifdef CONFIG_PPC64
934dc831aaSNicholas Piggincflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
944dc831aaSNicholas Piggincflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mcall-aixdesc)
954dc831aaSNicholas Pigginaflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
964dc831aaSNicholas Pigginaflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mabi=elfv2
974dc831aaSNicholas Pigginendif
984dc831aaSNicholas Piggin
99164af597SMichael Ellermanifneq ($(cc-name),clang)
100164af597SMichael Ellerman  cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mno-strict-align
101164af597SMichael Ellermanendif
102164af597SMichael Ellerman
1031421dc6dSNicholas Piggincflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
1041421dc6dSNicholas Piggincflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
105164af597SMichael Ellermanaflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
106164af597SMichael Ellermanaflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
107164af597SMichael Ellerman
10814cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y)
1091421dc6dSNicholas PigginKBUILD_CFLAGS	+= -m$(BITS)
1101421dc6dSNicholas PigginKBUILD_AFLAGS	+= -m$(BITS) -Wl,-a$(BITS)
111*d503ac53SMasahiro YamadaKBUILD_LDFLAGS	+= -m elf$(BITS)$(LDEMULATION)
11243c9127dSNicholas PigginKBUILD_ARFLAGS	+= --target=elf$(BITS)-$(GNUTARGET)
11314cf11afSPaul Mackerrasendif
11414cf11afSPaul Mackerras
1159c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-y := -Bstatic
1169c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
1179c5f7d39SSuzuki PouloseLDFLAGS_vmlinux	:= $(LDFLAGS_vmlinux-y)
11883a092cfSNicholas PigginLDFLAGS_vmlinux += $(call ld-option,--orphan-handling=warn)
11914cf11afSPaul Mackerras
120badf436fSRodrigo R. Galvaoifdef CONFIG_PPC64
1211fbe9cf2SAnton Blanchardifeq ($(call cc-option-yn,-mcmodel=medium),y)
1221fbe9cf2SAnton Blanchard	# -mcmodel=medium breaks modules because it uses 32bit offsets from
1231fbe9cf2SAnton Blanchard	# the TOC pointer to create pointers where possible. Pointers into the
1241fbe9cf2SAnton Blanchard	# percpu data area are created by this method.
1251fbe9cf2SAnton Blanchard	#
1261fbe9cf2SAnton Blanchard	# The kernel module loader relocates the percpu data section from the
1271fbe9cf2SAnton Blanchard	# original location (starting with 0xd...) to somewhere in the base
1281fbe9cf2SAnton Blanchard	# kernel percpu data space (starting with 0xc...). We need a full
1291fbe9cf2SAnton Blanchard	# 64bit relocation for this to work, hence -mcmodel=large.
1301fbe9cf2SAnton Blanchard	KBUILD_CFLAGS_MODULE += -mcmodel=large
1311fbe9cf2SAnton Blanchardelse
1321fbe9cf2SAnton Blanchard	export NO_MINIMAL_TOC := -mno-minimal-toc
1331fbe9cf2SAnton Blanchardendif
1341fbe9cf2SAnton Blanchardendif
1351fbe9cf2SAnton Blanchard
136a50a862eSAnton BlanchardCFLAGS-$(CONFIG_PPC64)	:= $(call cc-option,-mtraceback=no)
137badf436fSRodrigo R. Galvaoifdef CONFIG_CPU_LITTLE_ENDIAN
138238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
139721aeaa9SAnton BlanchardAFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2)
140721aeaa9SAnton Blanchardelse
1414dc831aaSNicholas PigginCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
142238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcall-aixdesc)
1434dc831aaSNicholas PigginAFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
144721aeaa9SAnton Blanchardendif
145238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
14698679fb0SAnton BlanchardCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mno-pointers-to-nested-functions)
14751d42f0fSSegher Boessenkool
148d72b0801SIan MunsieCFLAGS-$(CONFIG_PPC32)	:= -ffixed-r2 $(MULTIPLEWORD)
14951d42f0fSSegher BoessenkoolCFLAGS-$(CONFIG_PPC32)	+= $(call cc-option,-mno-readonly-in-sdata)
150d23c6fb4SAnton Blanchard
151badf436fSRodrigo R. Galvaoifdef CONFIG_PPC_BOOK3S_64
152badf436fSRodrigo R. Galvaoifdef CONFIG_CPU_LITTLE_ENDIAN
153a73657eaSNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
1544b7e5532SNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8)
155a73657eaSNicholas Pigginelse
156471d7ff8SNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5))
157471d7ff8SNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4)
158a73657eaSNicholas Pigginendif
15901718ba6SScott Woodelse
16001718ba6SScott WoodCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
16101718ba6SScott Woodendif
16201718ba6SScott Wood
1638c50b72aSTorsten Duweifdef CONFIG_MPROFILE_KERNEL
1648c50b72aSTorsten Duwe	CC_FLAGS_FTRACE := -pg -mprofile-kernel
1658c50b72aSTorsten Duweendif
1668c50b72aSTorsten Duwe
167cc62d20cSChristophe LeroyCFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
168d23c6fb4SAnton Blanchard
169cbf8a358STiejun Chen# Altivec option not allowed with e500mc64 in GCC.
170badf436fSRodrigo R. Galvaoifdef CONFIG_ALTIVEC
171cbf8a358STiejun ChenE5500_CPU := -mcpu=powerpc64
172cbf8a358STiejun Chenelse
17301718ba6SScott WoodE5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
174cbf8a358STiejun Chenendif
17501718ba6SScott WoodCFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
17601718ba6SScott WoodCFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
17701718ba6SScott Wood
178badf436fSRodrigo R. Galvaoifdef CONFIG_PPC32
179badf436fSRodrigo R. Galvaoifdef CONFIG_PPC_E500MC
180847f56b0SScott WoodCFLAGS-y += $(call cc-option,-mcpu=e500mc,-mcpu=powerpc)
181847f56b0SScott Woodelse
182847f56b0SScott WoodCFLAGS-$(CONFIG_E500) += $(call cc-option,-mcpu=8540 -msoft-float,-mcpu=powerpc)
183847f56b0SScott Woodendif
184847f56b0SScott Woodendif
185847f56b0SScott Wood
1867998eb3dSGuenter Roeckasinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
1877998eb3dSGuenter Roeck
1887998eb3dSGuenter RoeckKBUILD_CPPFLAGS	+= -Iarch/$(ARCH) $(asinstr)
18958aedccbSAnton BlanchardKBUILD_AFLAGS	+= -Iarch/$(ARCH) $(AFLAGS-y)
190a50a862eSAnton BlanchardKBUILD_CFLAGS	+= $(call cc-option,-msoft-float)
191a50a862eSAnton BlanchardKBUILD_CFLAGS	+= -pipe -Iarch/$(ARCH) $(CFLAGS-y)
192a0f97e06SSam RavnborgCPP		= $(CC) -E $(KBUILD_CFLAGS)
19314cf11afSPaul Mackerras
19468201fbbSMichael EllermanCHECKFLAGS	+= -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__
19562c2c5cfSDaniel Axtensifdef CONFIG_CPU_BIG_ENDIAN
19662c2c5cfSDaniel AxtensCHECKFLAGS	+= -D__BIG_ENDIAN__
19762c2c5cfSDaniel Axtenselse
19862c2c5cfSDaniel AxtensCHECKFLAGS	+= -D__LITTLE_ENDIAN__
19962c2c5cfSDaniel Axtensendif
20014cf11afSPaul Mackerras
201badf436fSRodrigo R. Galvaoifdef CONFIG_476FPE_ERR46
202d5b35cffSAlistair Popple	KBUILD_LDFLAGS_MODULE += --ppc476-workaround \
203d5b35cffSAlistair Popple		-T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds
204d5b35cffSAlistair Poppleendif
205d5b35cffSAlistair Popple
206d23c6fb4SAnton Blanchard# No AltiVec or VSX instructions when building kernel
207a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-mno-altivec)
208d23c6fb4SAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-mno-vsx)
209d3f67fbbSPaul Mackerras
2100197cd2eSKumar Gala# No SPE instruction when building kernel
211ce400c01SThiemo Seufer# (We use all available options to help semi-broken compilers)
2120197cd2eSKumar GalaKBUILD_CFLAGS += $(call cc-option,-mno-spe)
213ce400c01SThiemo SeuferKBUILD_CFLAGS += $(call cc-option,-mspe=no)
2140197cd2eSKumar Gala
21514cf11afSPaul Mackerras# Enable unit-at-a-time mode when possible. It shrinks the
21614cf11afSPaul Mackerras# kernel considerably.
217a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-funit-at-a-time)
21814cf11afSPaul Mackerras
219d0679c73SAndi Kleen# FIXME: the module load should be taught about the additional relocs
220d0679c73SAndi Kleen# generated by this.
221d0679c73SAndi Kleen# revert to pre-gcc-4.4 behaviour of .eh_frame
222d0679c73SAndi KleenKBUILD_CFLAGS	+= $(call cc-option,-fno-dwarf2-cfi-asm)
223d0679c73SAndi Kleen
22457647a4dSBenjamin Herrenschmidt# Never use string load/store instructions as they are
22557647a4dSBenjamin Herrenschmidt# often slow when they are implemented at all
226a50a862eSAnton BlanchardKBUILD_CFLAGS		+= $(call cc-option,-mno-string)
22714cf11afSPaul Mackerras
228badf436fSRodrigo R. Galvaoifdef CONFIG_6xx
229a0f97e06SSam RavnborgKBUILD_CFLAGS		+= -mcpu=powerpc
230f48b8296SOlaf Heringendif
231f48b8296SOlaf Hering
2327563dc64STony Breeds# Work around a gcc code-gen bug with -fno-omit-frame-pointer.
233badf436fSRodrigo R. Galvaoifdef CONFIG_FUNCTION_TRACER
2347563dc64STony BreedsKBUILD_CFLAGS		+= -mno-sched-epilog
2357563dc64STony Breedsendif
2367563dc64STony Breeds
23714cf11afSPaul Mackerrascpu-as-$(CONFIG_4xx)		+= -Wa,-m405
2389ddf0075SAnton Blanchardcpu-as-$(CONFIG_ALTIVEC)	+= $(call as-option,-Wa$(comma)-maltivec)
23914cf11afSPaul Mackerrascpu-as-$(CONFIG_E200)		+= -Wa,-me200
2404e4a4b75SJames Clarkecpu-as-$(CONFIG_E500)		+= -Wa,-me500
24115a3204dSNicholas Piggincpu-as-$(CONFIG_PPC_BOOK3S_64)	+= -Wa,-mpower4
24269a84059SMichael Jeansoncpu-as-$(CONFIG_PPC_E500MC)	+= $(call as-option,-Wa$(comma)-me500mc)
24314cf11afSPaul Mackerras
244222d394dSSam RavnborgKBUILD_AFLAGS += $(cpu-as-y)
245a0f97e06SSam RavnborgKBUILD_CFLAGS += $(cpu-as-y)
24614cf11afSPaul Mackerras
247164af597SMichael EllermanKBUILD_AFLAGS += $(aflags-y)
248164af597SMichael EllermanKBUILD_CFLAGS += $(cflags-y)
249164af597SMichael Ellerman
25068201fbbSMichael Ellermanhead-y				:= arch/powerpc/kernel/head_$(BITS).o
251968159c0SChristophe Leroyhead-$(CONFIG_PPC_8xx)		:= arch/powerpc/kernel/head_8xx.o
25215f6527eSJosh Boyerhead-$(CONFIG_40x)		:= arch/powerpc/kernel/head_40x.o
25314cf11afSPaul Mackerrashead-$(CONFIG_44x)		:= arch/powerpc/kernel/head_44x.o
25414cf11afSPaul Mackerrashead-$(CONFIG_FSL_BOOKE)	:= arch/powerpc/kernel/head_fsl_booke.o
25514cf11afSPaul Mackerras
2569994a338SPaul Mackerrashead-$(CONFIG_PPC64)		+= arch/powerpc/kernel/entry_64.o
25714cf11afSPaul Mackerrashead-$(CONFIG_PPC_FPU)		+= arch/powerpc/kernel/fpu.o
258e821ea70SBenjamin Herrenschmidthead-$(CONFIG_ALTIVEC)		+= arch/powerpc/kernel/vector.o
2595ac47f7aSAnton Blanchardhead-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE)  += arch/powerpc/kernel/prom_init.o
26014cf11afSPaul Mackerras
261daec962eSPaul Mackerrascore-y				+= arch/powerpc/kernel/ \
262daec962eSPaul Mackerras				   arch/powerpc/mm/ \
263daec962eSPaul Mackerras				   arch/powerpc/lib/ \
264daec962eSPaul Mackerras				   arch/powerpc/sysdev/ \
2651a3d1fc2SLiu Yu				   arch/powerpc/platforms/ \
2660ca87f05SMatt Evans				   arch/powerpc/math-emu/ \
267323a6bf1SMichael Ellerman				   arch/powerpc/crypto/ \
2680ca87f05SMatt Evans				   arch/powerpc/net/
269f78541dcSPaul Mackerrascore-$(CONFIG_XMON)		+= arch/powerpc/xmon/
270bbf45ba5SHollis Blanchardcore-$(CONFIG_KVM) 		+= arch/powerpc/kvm/
271f2699491SMichael Ellermancore-$(CONFIG_PERF_EVENTS)	+= arch/powerpc/perf/
2720d976313SThiago Jung Bauermanncore-$(CONFIG_KEXEC_FILE)	+= arch/powerpc/purgatory/
27314cf11afSPaul Mackerras
27414cf11afSPaul Mackerrasdrivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
27514cf11afSPaul Mackerras
276135f0b17STom Rini# Default to zImage, override when needed
27725431333SGrant Likelyall: zImage
27814cf11afSPaul Mackerras
279e32e78c5SSam Ravnborg# With make 3.82 we cannot mix normal and wildcard targets
280c686ecf5SAnatolij GustschinBOOT_TARGETS1 := zImage zImage.initrd uImage
28111eab297SBenjamin HerrenschmidtBOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% uImage.%
282cabb5587SStephen Rothwell
283e32e78c5SSam RavnborgPHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2)
284cabb5587SStephen Rothwell
28594b212c2SPaul Mackerrasboot := arch/$(ARCH)/boot
28614cf11afSPaul Mackerras
287e32e78c5SSam Ravnborg$(BOOT_TARGETS1): vmlinux
2881196d7aaSMichael Ellerman	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
289e32e78c5SSam Ravnborg$(BOOT_TARGETS2): vmlinux
2901196d7aaSMichael Ellerman	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
29114cf11afSPaul Mackerras
292e32e78c5SSam Ravnborg
293e32e78c5SSam Ravnborgbootwrapper_install:
2941196d7aaSMichael Ellerman	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
295e32e78c5SSam Ravnborg
2968662d0bcSMatthew McClintock%.dtb: scripts
2971196d7aaSMichael Ellerman	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
298773f76b1SDavid Woodhouse
299ea4d1a87SCyril Bur# Used to create 'merged defconfigs'
300ea4d1a87SCyril Bur# To use it $(call) it with the first argument as the base defconfig
301ea4d1a87SCyril Bur# and the second argument as a space separated list of .config files to merge,
302ea4d1a87SCyril Bur# without the .config suffix.
303ea4d1a87SCyril Burdefine merge_into_defconfig
304ea4d1a87SCyril Bur	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
305ea4d1a87SCyril Bur		-m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
306ea4d1a87SCyril Bur		$(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
307ea4d1a87SCyril Bur	+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
308ea4d1a87SCyril Burendef
309ea4d1a87SCyril Bur
310ea4d1a87SCyril BurPHONY += pseries_le_defconfig
311ea4d1a87SCyril Burpseries_le_defconfig:
312ea4d1a87SCyril Bur	$(call merge_into_defconfig,pseries_defconfig,le)
313ea4d1a87SCyril Bur
3142adc48a6SMichael EllermanPHONY += ppc64le_defconfig
3152adc48a6SMichael Ellermanppc64le_defconfig:
3162adc48a6SMichael Ellerman	$(call merge_into_defconfig,ppc64_defconfig,le)
3172adc48a6SMichael Ellerman
3183603c52fSMichael EllermanPHONY += powernv_be_defconfig
3193603c52fSMichael Ellermanpowernv_be_defconfig:
3203603c52fSMichael Ellerman	$(call merge_into_defconfig,powernv_defconfig,be)
3213603c52fSMichael Ellerman
32244d54014SScott WoodPHONY += mpc85xx_defconfig
32344d54014SScott Woodmpc85xx_defconfig:
32444d54014SScott Wood	$(call merge_into_defconfig,mpc85xx_basic_defconfig,\
32544d54014SScott Wood		85xx-32bit 85xx-hw fsl-emb-nonhw)
32644d54014SScott Wood
32744d54014SScott WoodPHONY += mpc85xx_smp_defconfig
32844d54014SScott Woodmpc85xx_smp_defconfig:
32944d54014SScott Wood	$(call merge_into_defconfig,mpc85xx_basic_defconfig,\
33044d54014SScott Wood		85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
33144d54014SScott Wood
33244d54014SScott WoodPHONY += corenet32_smp_defconfig
33344d54014SScott Woodcorenet32_smp_defconfig:
33444d54014SScott Wood	$(call merge_into_defconfig,corenet_basic_defconfig,\
335e0b80f00SClaudiu Manoil		85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa)
33644d54014SScott Wood
33744d54014SScott WoodPHONY += corenet64_smp_defconfig
33844d54014SScott Woodcorenet64_smp_defconfig:
33944d54014SScott Wood	$(call merge_into_defconfig,corenet_basic_defconfig,\
340e0b80f00SClaudiu Manoil		85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa)
34144d54014SScott Wood
34243de32c5SAlessio Igor BoganiPHONY += mpc86xx_defconfig
34343de32c5SAlessio Igor Boganimpc86xx_defconfig:
34443de32c5SAlessio Igor Bogani	$(call merge_into_defconfig,mpc86xx_basic_defconfig,\
34543de32c5SAlessio Igor Bogani		86xx-hw fsl-emb-nonhw)
34643de32c5SAlessio Igor Bogani
34743de32c5SAlessio Igor BoganiPHONY += mpc86xx_smp_defconfig
34843de32c5SAlessio Igor Boganimpc86xx_smp_defconfig:
34943de32c5SAlessio Igor Bogani	$(call merge_into_defconfig,mpc86xx_basic_defconfig,\
35043de32c5SAlessio Igor Bogani		86xx-smp 86xx-hw fsl-emb-nonhw)
35143de32c5SAlessio Igor Bogani
3528db0c9d4SMichael EllermanPHONY += ppc32_allmodconfig
3538db0c9d4SMichael Ellermanppc32_allmodconfig:
3548db0c9d4SMichael Ellerman	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \
3558db0c9d4SMichael Ellerman		-f $(srctree)/Makefile allmodconfig
3568db0c9d4SMichael Ellerman
35764de5d8dSMichael EllermanPHONY += ppc64le_allmodconfig
35864de5d8dSMichael Ellermanppc64le_allmodconfig:
35964de5d8dSMichael Ellerman	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/le.config \
36064de5d8dSMichael Ellerman		-f $(srctree)/Makefile allmodconfig
36164de5d8dSMichael Ellerman
36264de5d8dSMichael EllermanPHONY += ppc64_book3e_allmodconfig
36364de5d8dSMichael Ellermanppc64_book3e_allmodconfig:
36464de5d8dSMichael Ellerman	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-64bit.config \
36564de5d8dSMichael Ellerman		-f $(srctree)/Makefile allmodconfig
36664de5d8dSMichael Ellerman
36714cf11afSPaul Mackerrasdefine archhelp
36870bf0333SGrant Likely  @echo '* zImage          - Build default images selected by kernel config'
36970bf0333SGrant Likely  @echo '  zImage.*        - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)'
37070bf0333SGrant Likely  @echo '  uImage          - U-Boot native image format'
37170bf0333SGrant Likely  @echo '  cuImage.<dt>    - Backwards compatible U-Boot image for older'
37270bf0333SGrant Likely  @echo '                    versions which do not support device trees'
37370bf0333SGrant Likely  @echo '  dtbImage.<dt>   - zImage with an embedded device tree blob'
37470bf0333SGrant Likely  @echo '  simpleImage.<dt> - Firmware independent image.'
37570bf0333SGrant Likely  @echo '  treeImage.<dt>  - Support for older IBM 4xx firmware (not U-Boot)'
37614cf11afSPaul Mackerras  @echo '  install         - Install kernel using'
377caa27b66SSam Ravnborg  @echo '                    (your) ~/bin/$(INSTALLKERNEL) or'
378caa27b66SSam Ravnborg  @echo '                    (distribution) /sbin/$(INSTALLKERNEL) or'
37914cf11afSPaul Mackerras  @echo '                    install to $$(INSTALL_PATH) and run lilo'
380437a58dbSPaul Mackerras  @echo '  *_defconfig     - Select default config from arch/$(ARCH)/configs'
38170bf0333SGrant Likely  @echo ''
38270bf0333SGrant Likely  @echo '  Targets with <dt> embed a device tree blob inside the image'
38370bf0333SGrant Likely  @echo '  These targets support board with firmware that does not'
38470bf0333SGrant Likely  @echo '  support passing a device tree directly.  Replace <dt> with the'
38570bf0333SGrant Likely  @echo '  name of a dts file from the arch/$(ARCH)/boot/dts/ directory'
38670bf0333SGrant Likely  @echo '  (minus the .dts extension).'
38714cf11afSPaul Mackerrasendef
38814cf11afSPaul Mackerras
3893f85d63eSSam Ravnborginstall:
39025431333SGrant Likely	$(Q)$(MAKE) $(build)=$(boot) install
391928370c6SAkinobu Mita
3928150caadSRoland McGrathvdso_install:
393badf436fSRodrigo R. Galvaoifdef CONFIG_PPC64
3948150caadSRoland McGrath	$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
3958150caadSRoland McGrathendif
3968150caadSRoland McGrath	$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@
3978150caadSRoland McGrath
39814cf11afSPaul Mackerrasarchclean:
399a3a9e99eSPaul Mackerras	$(Q)$(MAKE) $(clean)=$(boot)
40070567293SAndreas Gruenbacher
40114cf11afSPaul Mackerrasarchprepare: checkbin
40214cf11afSPaul Mackerras
40314cf11afSPaul Mackerras# Use the file '.tmp_gas_check' for binutils tests, as gas won't output
40414cf11afSPaul Mackerras# to stdout and these checks are run even on install targets.
40514cf11afSPaul MackerrasTOUT	:= .tmp_gas_check
40614cf11afSPaul Mackerras
40782a85084SAnton Blanchard# Check gcc and binutils versions:
40882a85084SAnton Blanchard# - gcc-3.4 and binutils-2.14 are a fatal combination
40982a85084SAnton Blanchard# - Require gcc 4.0 or above on 64-bit
41082a85084SAnton Blanchard# - gcc-4.2.0 has issues compiling modules on 64-bit
41114cf11afSPaul Mackerrascheckbin:
4125631d9c4SMichal Marek	@if test "$(cc-name)" != "clang" \
413e79c8385SMichael Ellerman	    && test "$(cc-version)" = "0304" ; then \
41414cf11afSPaul Mackerras		if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
41514cf11afSPaul Mackerras			echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
41614cf11afSPaul Mackerras			echo 'correctly with gcc-3.4 and your version of binutils.'; \
41714cf11afSPaul Mackerras			echo '*** Please upgrade your binutils or downgrade your gcc'; \
41814cf11afSPaul Mackerras			false; \
41914cf11afSPaul Mackerras		fi ; \
42014cf11afSPaul Mackerras	fi
4215631d9c4SMichal Marek	@if test "$(cc-name)" != "clang" \
422e79c8385SMichael Ellerman	    && test "$(cc-version)" -lt "0400" \
42382a85084SAnton Blanchard	    && test "x${CONFIG_PPC64}" = "xy" ; then \
42482a85084SAnton Blanchard                echo -n "Sorry, GCC v4.0 or above is required to build " ; \
42582a85084SAnton Blanchard                echo "the 64-bit powerpc kernel." ; \
42682a85084SAnton Blanchard                false ; \
42782a85084SAnton Blanchard        fi
4285631d9c4SMichal Marek	@if test "$(cc-name)" != "clang" \
429e79c8385SMichael Ellerman	    && test "$(cc-fullversion)" = "040200" \
430f5e83fa4SSegher Boessenkool	    && test "x${CONFIG_MODULES}${CONFIG_PPC64}" = "xyy" ; then \
431f5e83fa4SSegher Boessenkool		echo -n '*** GCC-4.2.0 cannot compile the 64-bit powerpc ' ; \
432f5e83fa4SSegher Boessenkool		echo 'kernel with modules enabled.' ; \
433f5e83fa4SSegher Boessenkool		echo -n '*** Please use a different GCC version or ' ; \
434f5e83fa4SSegher Boessenkool		echo 'disable kernel modules' ; \
435f5e83fa4SSegher Boessenkool		false ; \
436f5e83fa4SSegher Boessenkool	fi
43760e065f7SMichael Ellerman	@if test "x${CONFIG_CPU_LITTLE_ENDIAN}" = "xy" \
43860e065f7SMichael Ellerman	    && $(LD) --version | head -1 | grep ' 2\.24$$' >/dev/null ; then \
43960e065f7SMichael Ellerman		echo -n '*** binutils 2.24 miscompiles weak symbols ' ; \
44060e065f7SMichael Ellerman		echo 'in some circumstances.' ; \
44160e065f7SMichael Ellerman		echo -n '*** Please use a different binutils version.' ; \
44260e065f7SMichael Ellerman		false ; \
44360e065f7SMichael Ellerman	fi
44460e065f7SMichael Ellerman
44514cf11afSPaul Mackerras
44614cf11afSPaul MackerrasCLEAN_FILES += $(TOUT)
44714cf11afSPaul Mackerras
448