114cf11afSPaul Mackerras# This file is included by the global makefile so that you can add your own 28212f898SMasahiro Yamada# architecture-specific flags and dependencies. 314cf11afSPaul Mackerras# 414cf11afSPaul Mackerras# This file is subject to the terms and conditions of the GNU General Public 514cf11afSPaul Mackerras# License. See the file "COPYING" in the main directory of this archive 614cf11afSPaul Mackerras# for more details. 714cf11afSPaul Mackerras# 814cf11afSPaul Mackerras# Copyright (C) 1994 by Linus Torvalds 914cf11afSPaul Mackerras# Changes for PPC by Gary Thomas 1014cf11afSPaul Mackerras# Rewritten by Cort Dougan and Paul Mackerras 1114cf11afSPaul Mackerras# 1214cf11afSPaul Mackerras 1314cf11afSPaul MackerrasHAS_BIARCH := $(call cc-option-yn, -m32) 1414cf11afSPaul Mackerras 1514cf11afSPaul Mackerras# Set default 32 bits cross compilers for vdso and boot wrapper 1614cf11afSPaul MackerrasCROSS32_COMPILE ?= 1714cf11afSPaul Mackerras 18af5cd05dSMichael Ellerman# If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use 19af5cd05dSMichael Ellerman# ppc64_defconfig because we have nothing better to go on. 20af5cd05dSMichael Ellermanuname := $(shell uname -m) 21af5cd05dSMichael EllermanKBUILD_DEFCONFIG := $(if $(filter ppc%,$(uname)),$(uname),ppc64)_defconfig 228a5abdf8SPaul Mackerras 2314cf11afSPaul Mackerrasnew_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) 2414cf11afSPaul Mackerras 2514cf11afSPaul Mackerrasifeq ($(new_nm),y) 2614cf11afSPaul MackerrasNM := $(NM) --synthetic 2714cf11afSPaul Mackerrasendif 2814cf11afSPaul Mackerras 2968201fbbSMichael Ellerman# BITS is used as extension for files which are available in a 32 bit 3068201fbbSMichael Ellerman# and a 64 bit version to simplify shared Makefiles. 3168201fbbSMichael Ellerman# e.g.: obj-y += foo_$(BITS).o 3268201fbbSMichael Ellermanexport BITS 3368201fbbSMichael Ellerman 3468201fbbSMichael Ellermanifdef CONFIG_PPC64 3568201fbbSMichael Ellerman BITS := 64 3668201fbbSMichael Ellermanelse 3768201fbbSMichael Ellerman BITS := 32 3814cf11afSPaul Mackerrasendif 3914cf11afSPaul Mackerras 4057073e27SMichael Ellermanmachine-y = ppc 4157073e27SMichael Ellermanmachine-$(CONFIG_PPC64) += 64 4257073e27SMichael Ellermanmachine-$(CONFIG_CPU_LITTLE_ENDIAN) += le 4357073e27SMichael EllermanUTS_MACHINE := $(subst $(space),,$(machine-y)) 44190554dbSStephen Rothwell 45b40b2386SMichael Ellerman# XXX This needs to be before we override LD below 46b40b2386SMichael Ellermanifdef CONFIG_PPC32 47b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o 48b40b2386SMichael Ellermanelse 49052c805aSMasahiro Yamadaifeq ($(call ld-ifversion, -ge, 22500, y),y) 50b40b2386SMichael Ellerman# Have the linker provide sfpr if possible. 51b40b2386SMichael Ellerman# There is a corresponding test in arch/powerpc/lib/Makefile 52b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += --save-restore-funcs 53b40b2386SMichael Ellermanelse 54b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o 55b40b2386SMichael Ellermanendif 56b40b2386SMichael Ellermanendif 57b40b2386SMichael Ellerman 58badf436fSRodrigo R. Galvaoifdef CONFIG_CPU_LITTLE_ENDIAN 591421dc6dSNicholas PigginKBUILD_CFLAGS += -mlittle-endian 60d503ac53SMasahiro YamadaKBUILD_LDFLAGS += -EL 61d72b0801SIan MunsieLDEMULATION := lppc 62d72b0801SIan MunsieGNUTARGET := powerpcle 63d72b0801SIan MunsieMULTIPLEWORD := -mno-multiple 64d3d35d95STony BreedsKBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect) 65d72b0801SIan Munsieelse 661421dc6dSNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mbig-endian) 67d503ac53SMasahiro YamadaKBUILD_LDFLAGS += -EB 68d72b0801SIan MunsieLDEMULATION := ppc 69d72b0801SIan MunsieGNUTARGET := powerpc 70d72b0801SIan MunsieMULTIPLEWORD := -mmultiple 71d72b0801SIan Munsieendif 72d72b0801SIan Munsie 734dc831aaSNicholas Pigginifdef CONFIG_PPC64 74465bfd9cSNathan Chancellorifndef CONFIG_CC_IS_CLANG 75661aa880SChristophe Leroycflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mabi=elfv1) 76661aa880SChristophe Leroycflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mcall-aixdesc) 77661aa880SChristophe Leroyaflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mabi=elfv1) 78661aa880SChristophe Leroyaflags-$(CONFIG_PPC64_ELF_ABI_V2) += -mabi=elfv2 794dc831aaSNicholas Pigginendif 80465bfd9cSNathan Chancellorendif 814dc831aaSNicholas Piggin 82076f421dSMasahiro Yamadaifndef CONFIG_CC_IS_CLANG 83164af597SMichael Ellerman cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align 84164af597SMichael Ellermanendif 85164af597SMichael Ellerman 861421dc6dSNicholas Piggincflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) 871421dc6dSNicholas Piggincflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian 88164af597SMichael Ellermanaflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) 89164af597SMichael Ellermanaflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian 90164af597SMichael Ellerman 9114cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y) 921421dc6dSNicholas PigginKBUILD_CFLAGS += -m$(BITS) 931421dc6dSNicholas PigginKBUILD_AFLAGS += -m$(BITS) -Wl,-a$(BITS) 94d503ac53SMasahiro YamadaKBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION) 9514cf11afSPaul Mackerrasendif 9614cf11afSPaul Mackerras 97c3ff2a51SChristophe Leroycflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard=tls 9806ec27aeSChristophe Leroyifdef CONFIG_PPC64 9906ec27aeSChristophe Leroycflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r13 10006ec27aeSChristophe Leroyelse 101c3ff2a51SChristophe Leroycflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r2 10206ec27aeSChristophe Leroyendif 103c3ff2a51SChristophe Leroy 1049c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-y := -Bstatic 1059c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie 10603557853SFangrui SongLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) += -z notext 1079c5f7d39SSuzuki PouloseLDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y) 10814cf11afSPaul Mackerras 109badf436fSRodrigo R. Galvaoifdef CONFIG_PPC64 1101fbe9cf2SAnton Blanchardifeq ($(call cc-option-yn,-mcmodel=medium),y) 1111fbe9cf2SAnton Blanchard # -mcmodel=medium breaks modules because it uses 32bit offsets from 1121fbe9cf2SAnton Blanchard # the TOC pointer to create pointers where possible. Pointers into the 1131fbe9cf2SAnton Blanchard # percpu data area are created by this method. 1141fbe9cf2SAnton Blanchard # 1151fbe9cf2SAnton Blanchard # The kernel module loader relocates the percpu data section from the 1161fbe9cf2SAnton Blanchard # original location (starting with 0xd...) to somewhere in the base 1171fbe9cf2SAnton Blanchard # kernel percpu data space (starting with 0xc...). We need a full 1181fbe9cf2SAnton Blanchard # 64bit relocation for this to work, hence -mcmodel=large. 1191fbe9cf2SAnton Blanchard KBUILD_CFLAGS_MODULE += -mcmodel=large 1201fbe9cf2SAnton Blanchardelse 1211fbe9cf2SAnton Blanchard export NO_MINIMAL_TOC := -mno-minimal-toc 1221fbe9cf2SAnton Blanchardendif 1231fbe9cf2SAnton Blanchardendif 1241fbe9cf2SAnton Blanchard 125a50a862eSAnton BlanchardCFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no) 126465bfd9cSNathan Chancellorifndef CONFIG_CC_IS_CLANG 127661aa880SChristophe Leroyifdef CONFIG_PPC64_ELF_ABI_V2 128238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) 129721aeaa9SAnton BlanchardAFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2) 130721aeaa9SAnton Blanchardelse 1314dc831aaSNicholas PigginCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) 132238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc) 1334dc831aaSNicholas PigginAFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) 134721aeaa9SAnton Blanchardendif 135465bfd9cSNathan Chancellorendif 136238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc)) 13798679fb0SAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions) 13851d42f0fSSegher Boessenkool 13972e7bcc2SJoel Stanley# Clang unconditionally reserves r2 on ppc32 and does not support the flag 14072e7bcc2SJoel Stanley# https://bugs.llvm.org/show_bug.cgi?id=39555 14172e7bcc2SJoel StanleyCFLAGS-$(CONFIG_PPC32) := $(call cc-option, -ffixed-r2) 14272e7bcc2SJoel Stanley 14372e7bcc2SJoel Stanley# Clang doesn't support -mmultiple / -mno-multiple 14472e7bcc2SJoel Stanley# https://bugs.llvm.org/show_bug.cgi?id=39556 14572e7bcc2SJoel StanleyCFLAGS-$(CONFIG_PPC32) += $(call cc-option, $(MULTIPLEWORD)) 14672e7bcc2SJoel Stanley 14751d42f0fSSegher BoessenkoolCFLAGS-$(CONFIG_PPC32) += $(call cc-option,-mno-readonly-in-sdata) 148d23c6fb4SAnton Blanchard 149badf436fSRodrigo R. Galvaoifdef CONFIG_PPC_BOOK3S_64 150badf436fSRodrigo R. Galvaoifdef CONFIG_CPU_LITTLE_ENDIAN 151a73657eaSNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8 1524b7e5532SNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8) 153a73657eaSNicholas Pigginelse 154471d7ff8SNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) 155471d7ff8SNicholas PigginCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) 156a73657eaSNicholas Pigginendif 1572863dd2dSMichael Ellermanelse ifdef CONFIG_PPC_BOOK3E_64 15801718ba6SScott WoodCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 15901718ba6SScott Woodendif 16001718ba6SScott Wood 1612a056f58SNicholas Pigginifdef CONFIG_FUNCTION_TRACER 1622a056f58SNicholas PigginCC_FLAGS_FTRACE := -pg 1638c50b72aSTorsten Duweifdef CONFIG_MPROFILE_KERNEL 1642a056f58SNicholas PigginCC_FLAGS_FTRACE += -mprofile-kernel 1652a056f58SNicholas Pigginendif 1668c50b72aSTorsten Duweendif 1678c50b72aSTorsten Duwe 168cc62d20cSChristophe LeroyCFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU)) 169*446cda1bSChristophe LeroyAFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU)) 170d23c6fb4SAnton Blanchard 171cbf8a358STiejun Chen# Altivec option not allowed with e500mc64 in GCC. 172badf436fSRodrigo R. Galvaoifdef CONFIG_ALTIVEC 173cbf8a358STiejun ChenE5500_CPU := -mcpu=powerpc64 174cbf8a358STiejun Chenelse 17501718ba6SScott WoodE5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64) 176cbf8a358STiejun Chenendif 17701718ba6SScott WoodCFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU) 17801718ba6SScott WoodCFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU)) 17901718ba6SScott Wood 1807998eb3dSGuenter Roeckasinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) 1817998eb3dSGuenter Roeck 1829cc342f6SMasahiro YamadaKBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr) 183b00899b8SMasahiro YamadaKBUILD_AFLAGS += $(AFLAGS-y) 184a50a862eSAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-msoft-float) 185b00899b8SMasahiro YamadaKBUILD_CFLAGS += -pipe $(CFLAGS-y) 186a0f97e06SSam RavnborgCPP = $(CC) -E $(KBUILD_CFLAGS) 18714cf11afSPaul Mackerras 18868201fbbSMichael EllermanCHECKFLAGS += -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__ 18962c2c5cfSDaniel Axtensifdef CONFIG_CPU_BIG_ENDIAN 19062c2c5cfSDaniel AxtensCHECKFLAGS += -D__BIG_ENDIAN__ 19162c2c5cfSDaniel Axtenselse 1925b89492cSChristophe LeroyCHECKFLAGS += -D__LITTLE_ENDIAN__ 19362c2c5cfSDaniel Axtensendif 19414cf11afSPaul Mackerras 195badf436fSRodrigo R. Galvaoifdef CONFIG_476FPE_ERR46 196d5b35cffSAlistair Popple KBUILD_LDFLAGS_MODULE += --ppc476-workaround \ 197d5b35cffSAlistair Popple -T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds 198d5b35cffSAlistair Poppleendif 199d5b35cffSAlistair Popple 200d23c6fb4SAnton Blanchard# No AltiVec or VSX instructions when building kernel 201a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-mno-altivec) 202d23c6fb4SAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-mno-vsx) 203d3f67fbbSPaul Mackerras 2040197cd2eSKumar Gala# No SPE instruction when building kernel 205ce400c01SThiemo Seufer# (We use all available options to help semi-broken compilers) 2060197cd2eSKumar GalaKBUILD_CFLAGS += $(call cc-option,-mno-spe) 207ce400c01SThiemo SeuferKBUILD_CFLAGS += $(call cc-option,-mspe=no) 2080197cd2eSKumar Gala 209ba96301cSNaveen N. Rao# Don't emit .eh_frame since we have no use for it 210ba96301cSNaveen N. RaoKBUILD_CFLAGS += -fno-asynchronous-unwind-tables 211ba96301cSNaveen N. Rao 21257647a4dSBenjamin Herrenschmidt# Never use string load/store instructions as they are 21357647a4dSBenjamin Herrenschmidt# often slow when they are implemented at all 214a50a862eSAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-mno-string) 21514cf11afSPaul Mackerras 216548ad77dSImre Kalozcpu-as-$(CONFIG_40x) += -Wa,-m405 217548ad77dSImre Kalozcpu-as-$(CONFIG_44x) += -Wa,-m440 2189ddf0075SAnton Blanchardcpu-as-$(CONFIG_ALTIVEC) += $(call as-option,-Wa$(comma)-maltivec) 2194e4a4b75SJames Clarkecpu-as-$(CONFIG_E500) += -Wa,-me500 220960e3002SJoel Stanley 221960e3002SJoel Stanley# When using '-many -mpower4' gas will first try and find a matching power4 222960e3002SJoel Stanley# mnemonic and failing that it will allow any valid mnemonic that GAS knows 223960e3002SJoel Stanley# about. GCC will pass -many to GAS when assembling, clang does not. 224f5140cabSDaniel Axtens# LLVM IAS doesn't understand either flag: https://github.com/ClangBuiltLinux/linux/issues/675 225f5140cabSDaniel Axtens# but LLVM IAS only supports ISA >= 2.06 for Book3S 64 anyway... 226f5140cabSDaniel Axtenscpu-as-$(CONFIG_PPC_BOOK3S_64) += $(call as-option,-Wa$(comma)-mpower4) $(call as-option,-Wa$(comma)-many) 22769a84059SMichael Jeansoncpu-as-$(CONFIG_PPC_E500MC) += $(call as-option,-Wa$(comma)-me500mc) 22814cf11afSPaul Mackerras 229222d394dSSam RavnborgKBUILD_AFLAGS += $(cpu-as-y) 230a0f97e06SSam RavnborgKBUILD_CFLAGS += $(cpu-as-y) 23114cf11afSPaul Mackerras 232164af597SMichael EllermanKBUILD_AFLAGS += $(aflags-y) 233164af597SMichael EllermanKBUILD_CFLAGS += $(cflags-y) 234164af597SMichael Ellerman 235533090e5SChristophe Leroyhead-$(CONFIG_PPC64) := arch/powerpc/kernel/head_64.o 236533090e5SChristophe Leroyhead-$(CONFIG_PPC_BOOK3S_32) := arch/powerpc/kernel/head_book3s_32.o 237968159c0SChristophe Leroyhead-$(CONFIG_PPC_8xx) := arch/powerpc/kernel/head_8xx.o 23815f6527eSJosh Boyerhead-$(CONFIG_40x) := arch/powerpc/kernel/head_40x.o 23914cf11afSPaul Mackerrashead-$(CONFIG_44x) := arch/powerpc/kernel/head_44x.o 24014cf11afSPaul Mackerrashead-$(CONFIG_FSL_BOOKE) := arch/powerpc/kernel/head_fsl_booke.o 24114cf11afSPaul Mackerras 2429994a338SPaul Mackerrashead-$(CONFIG_PPC64) += arch/powerpc/kernel/entry_64.o 24314cf11afSPaul Mackerrashead-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o 244e821ea70SBenjamin Herrenschmidthead-$(CONFIG_ALTIVEC) += arch/powerpc/kernel/vector.o 2455ac47f7aSAnton Blanchardhead-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE) += arch/powerpc/kernel/prom_init.o 24614cf11afSPaul Mackerras 247135f0b17STom Rini# Default to zImage, override when needed 24825431333SGrant Likelyall: zImage 24914cf11afSPaul Mackerras 250e32e78c5SSam Ravnborg# With make 3.82 we cannot mix normal and wildcard targets 251c686ecf5SAnatolij GustschinBOOT_TARGETS1 := zImage zImage.initrd uImage 25211eab297SBenjamin HerrenschmidtBOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% uImage.% 253cabb5587SStephen Rothwell 254e32e78c5SSam RavnborgPHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2) 255cabb5587SStephen Rothwell 25694b212c2SPaul Mackerrasboot := arch/$(ARCH)/boot 25714cf11afSPaul Mackerras 258e32e78c5SSam Ravnborg$(BOOT_TARGETS1): vmlinux 2591196d7aaSMichael Ellerman $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 260e32e78c5SSam Ravnborg$(BOOT_TARGETS2): vmlinux 2611196d7aaSMichael Ellerman $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 26214cf11afSPaul Mackerras 263e32e78c5SSam Ravnborg 264d42c6d0fSMichael EllermanPHONY += bootwrapper_install 265e32e78c5SSam Ravnborgbootwrapper_install: 2661196d7aaSMichael Ellerman $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 267e32e78c5SSam Ravnborg 268ea4d1a87SCyril Bur# Used to create 'merged defconfigs' 269ea4d1a87SCyril Bur# To use it $(call) it with the first argument as the base defconfig 270ea4d1a87SCyril Bur# and the second argument as a space separated list of .config files to merge, 271ea4d1a87SCyril Bur# without the .config suffix. 272ea4d1a87SCyril Burdefine merge_into_defconfig 273ea4d1a87SCyril Bur $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \ 274ea4d1a87SCyril Bur -m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \ 275ea4d1a87SCyril Bur $(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config) 276ea4d1a87SCyril Bur +$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig 277ea4d1a87SCyril Burendef 278ea4d1a87SCyril Bur 279ea4d1a87SCyril BurPHONY += pseries_le_defconfig 280ea4d1a87SCyril Burpseries_le_defconfig: 281ea4d1a87SCyril Bur $(call merge_into_defconfig,pseries_defconfig,le) 282ea4d1a87SCyril Bur 2832adc48a6SMichael EllermanPHONY += ppc64le_defconfig 2842adc48a6SMichael Ellermanppc64le_defconfig: 2852adc48a6SMichael Ellerman $(call merge_into_defconfig,ppc64_defconfig,le) 2862adc48a6SMichael Ellerman 287721c01baSSatheesh RajendranPHONY += ppc64le_guest_defconfig 288721c01baSSatheesh Rajendranppc64le_guest_defconfig: 289721c01baSSatheesh Rajendran $(call merge_into_defconfig,ppc64_defconfig,le guest) 290721c01baSSatheesh Rajendran 291721c01baSSatheesh RajendranPHONY += ppc64_guest_defconfig 292721c01baSSatheesh Rajendranppc64_guest_defconfig: 293721c01baSSatheesh Rajendran $(call merge_into_defconfig,ppc64_defconfig,be guest) 294721c01baSSatheesh Rajendran 2953603c52fSMichael EllermanPHONY += powernv_be_defconfig 2963603c52fSMichael Ellermanpowernv_be_defconfig: 2973603c52fSMichael Ellerman $(call merge_into_defconfig,powernv_defconfig,be) 2983603c52fSMichael Ellerman 29944d54014SScott WoodPHONY += mpc85xx_defconfig 30044d54014SScott Woodmpc85xx_defconfig: 30158b12eb2SMichael Ellerman $(call merge_into_defconfig,mpc85xx_base.config,\ 30244d54014SScott Wood 85xx-32bit 85xx-hw fsl-emb-nonhw) 30344d54014SScott Wood 30444d54014SScott WoodPHONY += mpc85xx_smp_defconfig 30544d54014SScott Woodmpc85xx_smp_defconfig: 30658b12eb2SMichael Ellerman $(call merge_into_defconfig,mpc85xx_base.config,\ 30744d54014SScott Wood 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw) 30844d54014SScott Wood 30944d54014SScott WoodPHONY += corenet32_smp_defconfig 31044d54014SScott Woodcorenet32_smp_defconfig: 31158b12eb2SMichael Ellerman $(call merge_into_defconfig,corenet_base.config,\ 312e0b80f00SClaudiu Manoil 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa) 31344d54014SScott Wood 31444d54014SScott WoodPHONY += corenet64_smp_defconfig 31544d54014SScott Woodcorenet64_smp_defconfig: 31658b12eb2SMichael Ellerman $(call merge_into_defconfig,corenet_base.config,\ 317e0b80f00SClaudiu Manoil 85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa) 31844d54014SScott Wood 31943de32c5SAlessio Igor BoganiPHONY += mpc86xx_defconfig 32043de32c5SAlessio Igor Boganimpc86xx_defconfig: 32158b12eb2SMichael Ellerman $(call merge_into_defconfig,mpc86xx_base.config,\ 32243de32c5SAlessio Igor Bogani 86xx-hw fsl-emb-nonhw) 32343de32c5SAlessio Igor Bogani 32443de32c5SAlessio Igor BoganiPHONY += mpc86xx_smp_defconfig 32543de32c5SAlessio Igor Boganimpc86xx_smp_defconfig: 32658b12eb2SMichael Ellerman $(call merge_into_defconfig,mpc86xx_base.config,\ 32743de32c5SAlessio Igor Bogani 86xx-smp 86xx-hw fsl-emb-nonhw) 32843de32c5SAlessio Igor Bogani 3298db0c9d4SMichael EllermanPHONY += ppc32_allmodconfig 3308db0c9d4SMichael Ellermanppc32_allmodconfig: 3318db0c9d4SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \ 3328db0c9d4SMichael Ellerman -f $(srctree)/Makefile allmodconfig 3338db0c9d4SMichael Ellerman 334a273fa38SMichael EllermanPHONY += ppc_defconfig 335a273fa38SMichael Ellermanppc_defconfig: 336a273fa38SMichael Ellerman $(call merge_into_defconfig,book3s_32.config,) 337a273fa38SMichael Ellerman 33864de5d8dSMichael EllermanPHONY += ppc64le_allmodconfig 33964de5d8dSMichael Ellermanppc64le_allmodconfig: 34064de5d8dSMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/le.config \ 34164de5d8dSMichael Ellerman -f $(srctree)/Makefile allmodconfig 34264de5d8dSMichael Ellerman 3435d823447SMichael EllermanPHONY += ppc64le_allnoconfig 3445d823447SMichael Ellermanppc64le_allnoconfig: 3455d823447SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/ppc64le.config \ 3465d823447SMichael Ellerman -f $(srctree)/Makefile allnoconfig 3475d823447SMichael Ellerman 34864de5d8dSMichael EllermanPHONY += ppc64_book3e_allmodconfig 34964de5d8dSMichael Ellermanppc64_book3e_allmodconfig: 35064de5d8dSMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-64bit.config \ 35164de5d8dSMichael Ellerman -f $(srctree)/Makefile allmodconfig 35264de5d8dSMichael Ellerman 353f259fb89SMichael EllermanPHONY += ppc32_randconfig 354f259fb89SMichael Ellermanppc32_randconfig: 355f259fb89SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/32-bit.config \ 356f259fb89SMichael Ellerman -f $(srctree)/Makefile randconfig 357f259fb89SMichael Ellerman 358f259fb89SMichael EllermanPHONY += ppc64_randconfig 359f259fb89SMichael Ellermanppc64_randconfig: 360f259fb89SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/64-bit.config \ 361f259fb89SMichael Ellerman -f $(srctree)/Makefile randconfig 362f259fb89SMichael Ellerman 36314cf11afSPaul Mackerrasdefine archhelp 36470bf0333SGrant Likely @echo '* zImage - Build default images selected by kernel config' 36570bf0333SGrant Likely @echo ' zImage.* - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)' 36670bf0333SGrant Likely @echo ' uImage - U-Boot native image format' 36770bf0333SGrant Likely @echo ' cuImage.<dt> - Backwards compatible U-Boot image for older' 36870bf0333SGrant Likely @echo ' versions which do not support device trees' 36970bf0333SGrant Likely @echo ' dtbImage.<dt> - zImage with an embedded device tree blob' 37070bf0333SGrant Likely @echo ' simpleImage.<dt> - Firmware independent image.' 37170bf0333SGrant Likely @echo ' treeImage.<dt> - Support for older IBM 4xx firmware (not U-Boot)' 37214cf11afSPaul Mackerras @echo ' install - Install kernel using' 373caa27b66SSam Ravnborg @echo ' (your) ~/bin/$(INSTALLKERNEL) or' 374caa27b66SSam Ravnborg @echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 37514cf11afSPaul Mackerras @echo ' install to $$(INSTALL_PATH) and run lilo' 376437a58dbSPaul Mackerras @echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' 37770bf0333SGrant Likely @echo '' 37870bf0333SGrant Likely @echo ' Targets with <dt> embed a device tree blob inside the image' 37970bf0333SGrant Likely @echo ' These targets support board with firmware that does not' 38070bf0333SGrant Likely @echo ' support passing a device tree directly. Replace <dt> with the' 38170bf0333SGrant Likely @echo ' name of a dts file from the arch/$(ARCH)/boot/dts/ directory' 38270bf0333SGrant Likely @echo ' (minus the .dts extension).' 38314cf11afSPaul Mackerrasendef 38414cf11afSPaul Mackerras 385d42c6d0fSMichael EllermanPHONY += install 3863f85d63eSSam Ravnborginstall: 387f774f5bbSMasahiro Yamada $(call cmd,install) 388928370c6SAkinobu Mita 38991bf6955SChristophe Leroyifeq ($(KBUILD_EXTMOD),) 39091bf6955SChristophe Leroy# We need to generate vdso-offsets.h before compiling certain files in kernel/. 39191bf6955SChristophe Leroy# In order to do that, we should use the archprepare target, but we can't since 39291bf6955SChristophe Leroy# asm-offsets.h is included in some files used to generate vdso-offsets.h, and 39391bf6955SChristophe Leroy# asm-offsets.h is built in prepare0, for which archprepare is a dependency. 39491bf6955SChristophe Leroy# Therefore we need to generate the header after prepare0 has been made, hence 39591bf6955SChristophe Leroy# this hack. 39691bf6955SChristophe Leroyprepare: vdso_prepare 39791bf6955SChristophe Leroyvdso_prepare: prepare0 39891bf6955SChristophe Leroy $(if $(CONFIG_VDSO32),$(Q)$(MAKE) \ 399fd1feadeSChristophe Leroy $(build)=arch/powerpc/kernel/vdso include/generated/vdso32-offsets.h) 40091bf6955SChristophe Leroy $(if $(CONFIG_PPC64),$(Q)$(MAKE) \ 401fd1feadeSChristophe Leroy $(build)=arch/powerpc/kernel/vdso include/generated/vdso64-offsets.h) 40291bf6955SChristophe Leroyendif 40391bf6955SChristophe Leroy 40414cf11afSPaul Mackerrasarchprepare: checkbin 40514cf11afSPaul Mackerras 406ab66dcc7SFiroz Khanarchheaders: 407ab66dcc7SFiroz Khan $(Q)$(MAKE) $(build)=arch/powerpc/kernel/syscalls all 408ab66dcc7SFiroz Khan 409c3ff2a51SChristophe Leroyifdef CONFIG_STACKPROTECTOR 410c3ff2a51SChristophe Leroyprepare: stack_protector_prepare 41114cf11afSPaul Mackerras 412d42c6d0fSMichael EllermanPHONY += stack_protector_prepare 413c3ff2a51SChristophe Leroystack_protector_prepare: prepare0 41406ec27aeSChristophe Leroyifdef CONFIG_PPC64 41506ec27aeSChristophe Leroy $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h)) 41606ec27aeSChristophe Leroyelse 417c3ff2a51SChristophe Leroy $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h)) 418c3ff2a51SChristophe Leroyendif 41906ec27aeSChristophe Leroyendif 420c3ff2a51SChristophe Leroy 421d42c6d0fSMichael EllermanPHONY += checkbin 422f2910f0eSNicholas Piggin# Check toolchain versions: 423f2910f0eSNicholas Piggin# - gcc-4.6 is the minimum kernel-wide version so nothing required. 42414cf11afSPaul Mackerrascheckbin: 425a3ad84daSAlan Modra @if test "x${CONFIG_LD_IS_LLD}" != "xy" -a \ 426a3ad84daSAlan Modra "x$(call ld-ifversion, -le, 22400, y)" = "xy" ; then \ 42760e065f7SMichael Ellerman echo -n '*** binutils 2.24 miscompiles weak symbols ' ; \ 42860e065f7SMichael Ellerman echo 'in some circumstances.' ; \ 429a3ad84daSAlan Modra echo '*** binutils 2.23 do not define the TOC symbol ' ; \ 43060e065f7SMichael Ellerman echo -n '*** Please use a different binutils version.' ; \ 43160e065f7SMichael Ellerman false ; \ 43260e065f7SMichael Ellerman fi 433