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 33ebd1d3b7SMathieu Malaterreifdef CONFIG_PPC_BOOK3S_32 34ebd1d3b7SMathieu MalaterreKBUILD_CFLAGS += -mcpu=powerpc 35ebd1d3b7SMathieu Malaterreendif 36ebd1d3b7SMathieu Malaterre 37ca786f83SAdrian Bunkifeq ($(CROSS_COMPILE),) 388a5abdf8SPaul MackerrasKBUILD_DEFCONFIG := $(shell uname -m)_defconfig 39ca786f83SAdrian Bunkelse 40ca786f83SAdrian BunkKBUILD_DEFCONFIG := ppc64_defconfig 41ca786f83SAdrian Bunkendif 428a5abdf8SPaul Mackerras 43badf436fSRodrigo R. Galvaoifdef CONFIG_PPC64 4414cf11afSPaul Mackerrasnew_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) 4514cf11afSPaul Mackerras 4614cf11afSPaul Mackerrasifeq ($(new_nm),y) 4714cf11afSPaul MackerrasNM := $(NM) --synthetic 4814cf11afSPaul Mackerrasendif 49a0588015SAnton Blanchardendif 5014cf11afSPaul Mackerras 5168201fbbSMichael Ellerman# BITS is used as extension for files which are available in a 32 bit 5268201fbbSMichael Ellerman# and a 64 bit version to simplify shared Makefiles. 5368201fbbSMichael Ellerman# e.g.: obj-y += foo_$(BITS).o 5468201fbbSMichael Ellermanexport BITS 5568201fbbSMichael Ellerman 5668201fbbSMichael Ellermanifdef CONFIG_PPC64 5768201fbbSMichael Ellerman BITS := 64 5868201fbbSMichael Ellermanelse 5968201fbbSMichael Ellerman BITS := 32 6014cf11afSPaul Mackerrasendif 6114cf11afSPaul Mackerras 6257073e27SMichael Ellermanmachine-y = ppc 6357073e27SMichael Ellermanmachine-$(CONFIG_PPC64) += 64 6457073e27SMichael Ellermanmachine-$(CONFIG_CPU_LITTLE_ENDIAN) += le 6557073e27SMichael EllermanUTS_MACHINE := $(subst $(space),,$(machine-y)) 66190554dbSStephen Rothwell 67b40b2386SMichael Ellerman# XXX This needs to be before we override LD below 68b40b2386SMichael Ellermanifdef CONFIG_PPC32 69b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o 70b40b2386SMichael Ellermanelse 715c45b528SAlan ModraKBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/powerpc/kernel/module.lds 72b40b2386SMichael Ellermanifeq ($(call ld-ifversion, -ge, 225000000, y),y) 73b40b2386SMichael Ellerman# Have the linker provide sfpr if possible. 74b40b2386SMichael Ellerman# There is a corresponding test in arch/powerpc/lib/Makefile 75b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += --save-restore-funcs 76b40b2386SMichael Ellermanelse 77b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o 78b40b2386SMichael Ellermanendif 79b40b2386SMichael Ellermanendif 80b40b2386SMichael Ellerman 81badf436fSRodrigo R. Galvaoifdef CONFIG_CPU_LITTLE_ENDIAN 821421dc6dSNicholas PigginKBUILD_CFLAGS += -mlittle-endian 83d503ac53SMasahiro YamadaKBUILD_LDFLAGS += -EL 84d72b0801SIan MunsieLDEMULATION := lppc 85d72b0801SIan MunsieGNUTARGET := powerpcle 86d72b0801SIan MunsieMULTIPLEWORD := -mno-multiple 87d3d35d95STony BreedsKBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect) 88d72b0801SIan Munsieelse 891421dc6dSNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mbig-endian) 90d503ac53SMasahiro YamadaKBUILD_LDFLAGS += -EB 91d72b0801SIan MunsieLDEMULATION := ppc 92d72b0801SIan MunsieGNUTARGET := powerpc 93d72b0801SIan MunsieMULTIPLEWORD := -mmultiple 94d72b0801SIan Munsieendif 95d72b0801SIan Munsie 964dc831aaSNicholas Pigginifdef CONFIG_PPC64 974dc831aaSNicholas Piggincflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) 984dc831aaSNicholas Piggincflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mcall-aixdesc) 994dc831aaSNicholas Pigginaflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mabi=elfv1) 1004dc831aaSNicholas Pigginaflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mabi=elfv2 1014dc831aaSNicholas Pigginendif 1024dc831aaSNicholas Piggin 103076f421dSMasahiro Yamadaifndef CONFIG_CC_IS_CLANG 104164af597SMichael Ellerman cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align 105164af597SMichael Ellermanendif 106164af597SMichael Ellerman 1071421dc6dSNicholas Piggincflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) 1081421dc6dSNicholas Piggincflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian 109164af597SMichael Ellermanaflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) 110164af597SMichael Ellermanaflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian 111164af597SMichael Ellerman 11214cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y) 1131421dc6dSNicholas PigginKBUILD_CFLAGS += -m$(BITS) 1141421dc6dSNicholas PigginKBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS) 115d503ac53SMasahiro YamadaKBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION) 11643c9127dSNicholas PigginKBUILD_ARFLAGS += --target=elf$(BITS)-$(GNUTARGET) 11714cf11afSPaul Mackerrasendif 11814cf11afSPaul Mackerras 119c3ff2a51SChristophe Leroycflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard=tls 12006ec27aeSChristophe Leroyifdef CONFIG_PPC64 12106ec27aeSChristophe Leroycflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r13 12206ec27aeSChristophe Leroyelse 123c3ff2a51SChristophe Leroycflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r2 12406ec27aeSChristophe Leroyendif 125c3ff2a51SChristophe Leroy 1269c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-y := -Bstatic 1279c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie 1289c5f7d39SSuzuki PouloseLDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y) 12983a092cfSNicholas PigginLDFLAGS_vmlinux += $(call ld-option,--orphan-handling=warn) 13014cf11afSPaul Mackerras 131badf436fSRodrigo R. Galvaoifdef CONFIG_PPC64 1321fbe9cf2SAnton Blanchardifeq ($(call cc-option-yn,-mcmodel=medium),y) 1331fbe9cf2SAnton Blanchard # -mcmodel=medium breaks modules because it uses 32bit offsets from 1341fbe9cf2SAnton Blanchard # the TOC pointer to create pointers where possible. Pointers into the 1351fbe9cf2SAnton Blanchard # percpu data area are created by this method. 1361fbe9cf2SAnton Blanchard # 1371fbe9cf2SAnton Blanchard # The kernel module loader relocates the percpu data section from the 1381fbe9cf2SAnton Blanchard # original location (starting with 0xd...) to somewhere in the base 1391fbe9cf2SAnton Blanchard # kernel percpu data space (starting with 0xc...). We need a full 1401fbe9cf2SAnton Blanchard # 64bit relocation for this to work, hence -mcmodel=large. 1411fbe9cf2SAnton Blanchard KBUILD_CFLAGS_MODULE += -mcmodel=large 1421fbe9cf2SAnton Blanchardelse 1431fbe9cf2SAnton Blanchard export NO_MINIMAL_TOC := -mno-minimal-toc 1441fbe9cf2SAnton Blanchardendif 1451fbe9cf2SAnton Blanchardendif 1461fbe9cf2SAnton Blanchard 147a50a862eSAnton BlanchardCFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no) 148badf436fSRodrigo R. Galvaoifdef CONFIG_CPU_LITTLE_ENDIAN 149238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) 150721aeaa9SAnton BlanchardAFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2) 151721aeaa9SAnton Blanchardelse 1524dc831aaSNicholas PigginCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) 153238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc) 1544dc831aaSNicholas PigginAFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) 155721aeaa9SAnton Blanchardendif 156238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc)) 15798679fb0SAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions) 15851d42f0fSSegher Boessenkool 159*72e7bcc2SJoel Stanley# Clang unconditionally reserves r2 on ppc32 and does not support the flag 160*72e7bcc2SJoel Stanley# https://bugs.llvm.org/show_bug.cgi?id=39555 161*72e7bcc2SJoel StanleyCFLAGS-$(CONFIG_PPC32) := $(call cc-option, -ffixed-r2) 162*72e7bcc2SJoel Stanley 163*72e7bcc2SJoel Stanley# Clang doesn't support -mmultiple / -mno-multiple 164*72e7bcc2SJoel Stanley# https://bugs.llvm.org/show_bug.cgi?id=39556 165*72e7bcc2SJoel StanleyCFLAGS-$(CONFIG_PPC32) += $(call cc-option, $(MULTIPLEWORD)) 166*72e7bcc2SJoel Stanley 16751d42f0fSSegher BoessenkoolCFLAGS-$(CONFIG_PPC32) += $(call cc-option,-mno-readonly-in-sdata) 168d23c6fb4SAnton Blanchard 169badf436fSRodrigo R. Galvaoifdef CONFIG_PPC_BOOK3S_64 170badf436fSRodrigo R. Galvaoifdef CONFIG_CPU_LITTLE_ENDIAN 171a73657eaSNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8 1724b7e5532SNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8) 173a73657eaSNicholas Pigginelse 174471d7ff8SNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) 175471d7ff8SNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) 176a73657eaSNicholas Pigginendif 17701718ba6SScott Woodelse 17801718ba6SScott WoodCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 17901718ba6SScott Woodendif 18001718ba6SScott Wood 1812a056f58SNicholas Pigginifdef CONFIG_FUNCTION_TRACER 1822a056f58SNicholas PigginCC_FLAGS_FTRACE := -pg 1838c50b72aSTorsten Duweifdef CONFIG_MPROFILE_KERNEL 1842a056f58SNicholas PigginCC_FLAGS_FTRACE += -mprofile-kernel 1852a056f58SNicholas Pigginendif 1866977f95eSNicholas Piggin# Work around gcc code-gen bugs with -pg / -fno-omit-frame-pointer in gcc <= 4.8 1876977f95eSNicholas Piggin# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44199 1886977f95eSNicholas Piggin# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52828 189076f421dSMasahiro Yamadaifndef CONFIG_CC_IS_CLANG 1906977f95eSNicholas PigginCC_FLAGS_FTRACE += $(call cc-ifversion, -lt, 0409, -mno-sched-epilog) 1916977f95eSNicholas Pigginendif 1928c50b72aSTorsten Duweendif 1938c50b72aSTorsten Duwe 194cc62d20cSChristophe LeroyCFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU)) 195d23c6fb4SAnton Blanchard 196cbf8a358STiejun Chen# Altivec option not allowed with e500mc64 in GCC. 197badf436fSRodrigo R. Galvaoifdef CONFIG_ALTIVEC 198cbf8a358STiejun ChenE5500_CPU := -mcpu=powerpc64 199cbf8a358STiejun Chenelse 20001718ba6SScott WoodE5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64) 201cbf8a358STiejun Chenendif 20201718ba6SScott WoodCFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU) 20301718ba6SScott WoodCFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU)) 20401718ba6SScott Wood 205badf436fSRodrigo R. Galvaoifdef CONFIG_PPC32 206badf436fSRodrigo R. Galvaoifdef CONFIG_PPC_E500MC 207847f56b0SScott WoodCFLAGS-y += $(call cc-option,-mcpu=e500mc,-mcpu=powerpc) 208847f56b0SScott Woodelse 209847f56b0SScott WoodCFLAGS-$(CONFIG_E500) += $(call cc-option,-mcpu=8540 -msoft-float,-mcpu=powerpc) 210847f56b0SScott Woodendif 211847f56b0SScott Woodendif 212847f56b0SScott Wood 2137998eb3dSGuenter Roeckasinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) 2147998eb3dSGuenter Roeck 2157998eb3dSGuenter RoeckKBUILD_CPPFLAGS += -Iarch/$(ARCH) $(asinstr) 21658aedccbSAnton BlanchardKBUILD_AFLAGS += -Iarch/$(ARCH) $(AFLAGS-y) 217a50a862eSAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-msoft-float) 218a50a862eSAnton BlanchardKBUILD_CFLAGS += -pipe -Iarch/$(ARCH) $(CFLAGS-y) 219a0f97e06SSam RavnborgCPP = $(CC) -E $(KBUILD_CFLAGS) 22014cf11afSPaul Mackerras 22168201fbbSMichael EllermanCHECKFLAGS += -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__ 22262c2c5cfSDaniel Axtensifdef CONFIG_CPU_BIG_ENDIAN 22362c2c5cfSDaniel AxtensCHECKFLAGS += -D__BIG_ENDIAN__ 22462c2c5cfSDaniel Axtenselse 22562c2c5cfSDaniel AxtensCHECKFLAGS += -D__LITTLE_ENDIAN__ 22662c2c5cfSDaniel Axtensendif 22714cf11afSPaul Mackerras 228badf436fSRodrigo R. Galvaoifdef CONFIG_476FPE_ERR46 229d5b35cffSAlistair Popple KBUILD_LDFLAGS_MODULE += --ppc476-workaround \ 230d5b35cffSAlistair Popple -T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds 231d5b35cffSAlistair Poppleendif 232d5b35cffSAlistair Popple 233d23c6fb4SAnton Blanchard# No AltiVec or VSX instructions when building kernel 234a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-mno-altivec) 235d23c6fb4SAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-mno-vsx) 236d3f67fbbSPaul Mackerras 2370197cd2eSKumar Gala# No SPE instruction when building kernel 238ce400c01SThiemo Seufer# (We use all available options to help semi-broken compilers) 2390197cd2eSKumar GalaKBUILD_CFLAGS += $(call cc-option,-mno-spe) 240ce400c01SThiemo SeuferKBUILD_CFLAGS += $(call cc-option,-mspe=no) 2410197cd2eSKumar Gala 24214cf11afSPaul Mackerras# Enable unit-at-a-time mode when possible. It shrinks the 24314cf11afSPaul Mackerras# kernel considerably. 244a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-funit-at-a-time) 24514cf11afSPaul Mackerras 246d0679c73SAndi Kleen# FIXME: the module load should be taught about the additional relocs 247d0679c73SAndi Kleen# generated by this. 248d0679c73SAndi Kleen# revert to pre-gcc-4.4 behaviour of .eh_frame 249d0679c73SAndi KleenKBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) 250d0679c73SAndi Kleen 25157647a4dSBenjamin Herrenschmidt# Never use string load/store instructions as they are 25257647a4dSBenjamin Herrenschmidt# often slow when they are implemented at all 253a50a862eSAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-mno-string) 25414cf11afSPaul Mackerras 25514cf11afSPaul Mackerrascpu-as-$(CONFIG_4xx) += -Wa,-m405 2569ddf0075SAnton Blanchardcpu-as-$(CONFIG_ALTIVEC) += $(call as-option,-Wa$(comma)-maltivec) 25714cf11afSPaul Mackerrascpu-as-$(CONFIG_E200) += -Wa,-me200 2584e4a4b75SJames Clarkecpu-as-$(CONFIG_E500) += -Wa,-me500 259960e3002SJoel Stanley 260960e3002SJoel Stanley# When using '-many -mpower4' gas will first try and find a matching power4 261960e3002SJoel Stanley# mnemonic and failing that it will allow any valid mnemonic that GAS knows 262960e3002SJoel Stanley# about. GCC will pass -many to GAS when assembling, clang does not. 263960e3002SJoel Stanleycpu-as-$(CONFIG_PPC_BOOK3S_64) += -Wa,-mpower4 -Wa,-many 26469a84059SMichael Jeansoncpu-as-$(CONFIG_PPC_E500MC) += $(call as-option,-Wa$(comma)-me500mc) 26514cf11afSPaul Mackerras 266222d394dSSam RavnborgKBUILD_AFLAGS += $(cpu-as-y) 267a0f97e06SSam RavnborgKBUILD_CFLAGS += $(cpu-as-y) 26814cf11afSPaul Mackerras 269164af597SMichael EllermanKBUILD_AFLAGS += $(aflags-y) 270164af597SMichael EllermanKBUILD_CFLAGS += $(cflags-y) 271164af597SMichael Ellerman 27268201fbbSMichael Ellermanhead-y := arch/powerpc/kernel/head_$(BITS).o 273968159c0SChristophe Leroyhead-$(CONFIG_PPC_8xx) := arch/powerpc/kernel/head_8xx.o 27415f6527eSJosh Boyerhead-$(CONFIG_40x) := arch/powerpc/kernel/head_40x.o 27514cf11afSPaul Mackerrashead-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o 27614cf11afSPaul Mackerrashead-$(CONFIG_FSL_BOOKE) := arch/powerpc/kernel/head_fsl_booke.o 27714cf11afSPaul Mackerras 2789994a338SPaul Mackerrashead-$(CONFIG_PPC64) += arch/powerpc/kernel/entry_64.o 27914cf11afSPaul Mackerrashead-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o 280e821ea70SBenjamin Herrenschmidthead-$(CONFIG_ALTIVEC) += arch/powerpc/kernel/vector.o 2815ac47f7aSAnton Blanchardhead-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += arch/powerpc/kernel/prom_init.o 28214cf11afSPaul Mackerras 283c47ca98dSMichael Ellerman# See arch/powerpc/Kbuild for content of core part of the kernel 284c47ca98dSMichael Ellermancore-y += arch/powerpc/ 28514cf11afSPaul Mackerras 28614cf11afSPaul Mackerrasdrivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ 28714cf11afSPaul Mackerras 288135f0b17STom Rini# Default to zImage, override when needed 28925431333SGrant Likelyall: zImage 29014cf11afSPaul Mackerras 291e32e78c5SSam Ravnborg# With make 3.82 we cannot mix normal and wildcard targets 292c686ecf5SAnatolij GustschinBOOT_TARGETS1 := zImage zImage.initrd uImage 29311eab297SBenjamin HerrenschmidtBOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% uImage.% 294cabb5587SStephen Rothwell 295e32e78c5SSam RavnborgPHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2) 296cabb5587SStephen Rothwell 29794b212c2SPaul Mackerrasboot := arch/$(ARCH)/boot 29814cf11afSPaul Mackerras 299e32e78c5SSam Ravnborg$(BOOT_TARGETS1): vmlinux 3001196d7aaSMichael Ellerman $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 301e32e78c5SSam Ravnborg$(BOOT_TARGETS2): vmlinux 3021196d7aaSMichael Ellerman $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 30314cf11afSPaul Mackerras 304e32e78c5SSam Ravnborg 305e32e78c5SSam Ravnborgbootwrapper_install: 3061196d7aaSMichael Ellerman $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 307e32e78c5SSam Ravnborg 308ea4d1a87SCyril Bur# Used to create 'merged defconfigs' 309ea4d1a87SCyril Bur# To use it $(call) it with the first argument as the base defconfig 310ea4d1a87SCyril Bur# and the second argument as a space separated list of .config files to merge, 311ea4d1a87SCyril Bur# without the .config suffix. 312ea4d1a87SCyril Burdefine merge_into_defconfig 313ea4d1a87SCyril Bur $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \ 314ea4d1a87SCyril Bur -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \ 315ea4d1a87SCyril Bur $(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config) 316ea4d1a87SCyril Bur +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig 317ea4d1a87SCyril Burendef 318ea4d1a87SCyril Bur 319ea4d1a87SCyril BurPHONY += pseries_le_defconfig 320ea4d1a87SCyril Burpseries_le_defconfig: 321ea4d1a87SCyril Bur $(call merge_into_defconfig,pseries_defconfig,le) 322ea4d1a87SCyril Bur 3232adc48a6SMichael EllermanPHONY += ppc64le_defconfig 3242adc48a6SMichael Ellermanppc64le_defconfig: 3252adc48a6SMichael Ellerman $(call merge_into_defconfig,ppc64_defconfig,le) 3262adc48a6SMichael Ellerman 327721c01baSSatheesh RajendranPHONY += ppc64le_guest_defconfig 328721c01baSSatheesh Rajendranppc64le_guest_defconfig: 329721c01baSSatheesh Rajendran $(call merge_into_defconfig,ppc64_defconfig,le guest) 330721c01baSSatheesh Rajendran 331721c01baSSatheesh RajendranPHONY += ppc64_guest_defconfig 332721c01baSSatheesh Rajendranppc64_guest_defconfig: 333721c01baSSatheesh Rajendran $(call merge_into_defconfig,ppc64_defconfig,be guest) 334721c01baSSatheesh Rajendran 3353603c52fSMichael EllermanPHONY += powernv_be_defconfig 3363603c52fSMichael Ellermanpowernv_be_defconfig: 3373603c52fSMichael Ellerman $(call merge_into_defconfig,powernv_defconfig,be) 3383603c52fSMichael Ellerman 33944d54014SScott WoodPHONY += mpc85xx_defconfig 34044d54014SScott Woodmpc85xx_defconfig: 34144d54014SScott Wood $(call merge_into_defconfig,mpc85xx_basic_defconfig,\ 34244d54014SScott Wood 85xx-32bit 85xx-hw fsl-emb-nonhw) 34344d54014SScott Wood 34444d54014SScott WoodPHONY += mpc85xx_smp_defconfig 34544d54014SScott Woodmpc85xx_smp_defconfig: 34644d54014SScott Wood $(call merge_into_defconfig,mpc85xx_basic_defconfig,\ 34744d54014SScott Wood 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw) 34844d54014SScott Wood 34944d54014SScott WoodPHONY += corenet32_smp_defconfig 35044d54014SScott Woodcorenet32_smp_defconfig: 35144d54014SScott Wood $(call merge_into_defconfig,corenet_basic_defconfig,\ 352e0b80f00SClaudiu Manoil 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa) 35344d54014SScott Wood 35444d54014SScott WoodPHONY += corenet64_smp_defconfig 35544d54014SScott Woodcorenet64_smp_defconfig: 35644d54014SScott Wood $(call merge_into_defconfig,corenet_basic_defconfig,\ 357e0b80f00SClaudiu Manoil 85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa) 35844d54014SScott Wood 35943de32c5SAlessio Igor BoganiPHONY += mpc86xx_defconfig 36043de32c5SAlessio Igor Boganimpc86xx_defconfig: 36143de32c5SAlessio Igor Bogani $(call merge_into_defconfig,mpc86xx_basic_defconfig,\ 36243de32c5SAlessio Igor Bogani 86xx-hw fsl-emb-nonhw) 36343de32c5SAlessio Igor Bogani 36443de32c5SAlessio Igor BoganiPHONY += mpc86xx_smp_defconfig 36543de32c5SAlessio Igor Boganimpc86xx_smp_defconfig: 36643de32c5SAlessio Igor Bogani $(call merge_into_defconfig,mpc86xx_basic_defconfig,\ 36743de32c5SAlessio Igor Bogani 86xx-smp 86xx-hw fsl-emb-nonhw) 36843de32c5SAlessio Igor Bogani 3698db0c9d4SMichael EllermanPHONY += ppc32_allmodconfig 3708db0c9d4SMichael Ellermanppc32_allmodconfig: 3718db0c9d4SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \ 3728db0c9d4SMichael Ellerman -f $(srctree)/Makefile allmodconfig 3738db0c9d4SMichael Ellerman 37464de5d8dSMichael EllermanPHONY += ppc64le_allmodconfig 37564de5d8dSMichael Ellermanppc64le_allmodconfig: 37664de5d8dSMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/le.config \ 37764de5d8dSMichael Ellerman -f $(srctree)/Makefile allmodconfig 37864de5d8dSMichael Ellerman 37964de5d8dSMichael EllermanPHONY += ppc64_book3e_allmodconfig 38064de5d8dSMichael Ellermanppc64_book3e_allmodconfig: 38164de5d8dSMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-64bit.config \ 38264de5d8dSMichael Ellerman -f $(srctree)/Makefile allmodconfig 38364de5d8dSMichael Ellerman 38414cf11afSPaul Mackerrasdefine archhelp 38570bf0333SGrant Likely @echo '* zImage - Build default images selected by kernel config' 38670bf0333SGrant Likely @echo ' zImage.* - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)' 38770bf0333SGrant Likely @echo ' uImage - U-Boot native image format' 38870bf0333SGrant Likely @echo ' cuImage.<dt> - Backwards compatible U-Boot image for older' 38970bf0333SGrant Likely @echo ' versions which do not support device trees' 39070bf0333SGrant Likely @echo ' dtbImage.<dt> - zImage with an embedded device tree blob' 39170bf0333SGrant Likely @echo ' simpleImage.<dt> - Firmware independent image.' 39270bf0333SGrant Likely @echo ' treeImage.<dt> - Support for older IBM 4xx firmware (not U-Boot)' 39314cf11afSPaul Mackerras @echo ' install - Install kernel using' 394caa27b66SSam Ravnborg @echo ' (your) ~/bin/$(INSTALLKERNEL) or' 395caa27b66SSam Ravnborg @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 39614cf11afSPaul Mackerras @echo ' install to $$(INSTALL_PATH) and run lilo' 397437a58dbSPaul Mackerras @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' 39870bf0333SGrant Likely @echo '' 39970bf0333SGrant Likely @echo ' Targets with <dt> embed a device tree blob inside the image' 40070bf0333SGrant Likely @echo ' These targets support board with firmware that does not' 40170bf0333SGrant Likely @echo ' support passing a device tree directly. Replace <dt> with the' 40270bf0333SGrant Likely @echo ' name of a dts file from the arch/$(ARCH)/boot/dts/ directory' 40370bf0333SGrant Likely @echo ' (minus the .dts extension).' 40414cf11afSPaul Mackerrasendef 40514cf11afSPaul Mackerras 4063f85d63eSSam Ravnborginstall: 40725431333SGrant Likely $(Q)$(MAKE) $(build)=$(boot) install 408928370c6SAkinobu Mita 4098150caadSRoland McGrathvdso_install: 410badf436fSRodrigo R. Galvaoifdef CONFIG_PPC64 4118150caadSRoland McGrath $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@ 4128150caadSRoland McGrathendif 4138150caadSRoland McGrath $(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@ 4148150caadSRoland McGrath 41514cf11afSPaul Mackerrasarchclean: 416a3a9e99eSPaul Mackerras $(Q)$(MAKE) $(clean)=$(boot) 41770567293SAndreas Gruenbacher 41814cf11afSPaul Mackerrasarchprepare: checkbin 41914cf11afSPaul Mackerras 420c3ff2a51SChristophe Leroyifdef CONFIG_STACKPROTECTOR 421c3ff2a51SChristophe Leroyprepare: stack_protector_prepare 42214cf11afSPaul Mackerras 423c3ff2a51SChristophe Leroystack_protector_prepare: prepare0 42406ec27aeSChristophe Leroyifdef CONFIG_PPC64 42506ec27aeSChristophe Leroy $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h)) 42606ec27aeSChristophe Leroyelse 427c3ff2a51SChristophe Leroy $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h)) 428c3ff2a51SChristophe Leroyendif 42906ec27aeSChristophe Leroyendif 430c3ff2a51SChristophe Leroy 431f2910f0eSNicholas Piggin# Check toolchain versions: 432f2910f0eSNicholas Piggin# - gcc-4.6 is the minimum kernel-wide version so nothing required. 43314cf11afSPaul Mackerrascheckbin: 43460e065f7SMichael Ellerman @if test "x${CONFIG_CPU_LITTLE_ENDIAN}" = "xy" \ 43560e065f7SMichael Ellerman && $(LD) --version | head -1 | grep ' 2\.24$$' >/dev/null ; then \ 43660e065f7SMichael Ellerman echo -n '*** binutils 2.24 miscompiles weak symbols ' ; \ 43760e065f7SMichael Ellerman echo 'in some circumstances.' ; \ 43860e065f7SMichael Ellerman echo -n '*** Please use a different binutils version.' ; \ 43960e065f7SMichael Ellerman false ; \ 44060e065f7SMichael Ellerman fi 441