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 4554a11654SMasahiro Yamadaifeq ($(CONFIG_PPC64)$(CONFIG_LD_IS_BFD),yy) 46b40b2386SMichael Ellerman# Have the linker provide sfpr if possible. 47b40b2386SMichael Ellerman# There is a corresponding test in arch/powerpc/lib/Makefile 48b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += --save-restore-funcs 49b40b2386SMichael Ellermanelse 50b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o 51b40b2386SMichael Ellermanendif 52b40b2386SMichael Ellerman 53badf436fSRodrigo R. Galvaoifdef CONFIG_CPU_LITTLE_ENDIAN 541421dc6dSNicholas PigginKBUILD_CFLAGS += -mlittle-endian 55d503ac53SMasahiro YamadaKBUILD_LDFLAGS += -EL 56d72b0801SIan MunsieLDEMULATION := lppc 57d72b0801SIan MunsieGNUTARGET := powerpcle 58d72b0801SIan MunsieMULTIPLEWORD := -mno-multiple 59d3d35d95STony BreedsKBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect) 60d72b0801SIan Munsieelse 611421dc6dSNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mbig-endian) 62d503ac53SMasahiro YamadaKBUILD_LDFLAGS += -EB 63d72b0801SIan MunsieLDEMULATION := ppc 64d72b0801SIan MunsieGNUTARGET := powerpc 65d72b0801SIan MunsieMULTIPLEWORD := -mmultiple 66d72b0801SIan Munsieendif 67d72b0801SIan Munsie 684dc831aaSNicholas Pigginifdef CONFIG_PPC64 69465bfd9cSNathan Chancellorifndef CONFIG_CC_IS_CLANG 70661aa880SChristophe Leroycflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mabi=elfv1) 71661aa880SChristophe Leroycflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mcall-aixdesc) 72661aa880SChristophe Leroyaflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mabi=elfv1) 73661aa880SChristophe Leroyaflags-$(CONFIG_PPC64_ELF_ABI_V2) += -mabi=elfv2 744dc831aaSNicholas Pigginendif 75465bfd9cSNathan Chancellorendif 764dc831aaSNicholas Piggin 77076f421dSMasahiro Yamadaifndef CONFIG_CC_IS_CLANG 78164af597SMichael Ellerman cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align 79164af597SMichael Ellermanendif 80164af597SMichael Ellerman 811421dc6dSNicholas Piggincflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) 821421dc6dSNicholas Piggincflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian 83164af597SMichael Ellermanaflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) 84164af597SMichael Ellermanaflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian 85164af597SMichael Ellerman 8614cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y) 871421dc6dSNicholas PigginKBUILD_CFLAGS += -m$(BITS) 8831f48f16SNathan ChancellorKBUILD_AFLAGS += -m$(BITS) 89d503ac53SMasahiro YamadaKBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION) 9014cf11afSPaul Mackerrasendif 9114cf11afSPaul Mackerras 929c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-y := -Bstatic 939c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie 9403557853SFangrui SongLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) += -z notext 959c5f7d39SSuzuki PouloseLDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y) 9614cf11afSPaul Mackerras 97badf436fSRodrigo R. Galvaoifdef CONFIG_PPC64 9877e69ee7SNicholas Pigginifndef CONFIG_PPC_KERNEL_PCREL 991fbe9cf2SAnton Blanchardifeq ($(call cc-option-yn,-mcmodel=medium),y) 1001fbe9cf2SAnton Blanchard # -mcmodel=medium breaks modules because it uses 32bit offsets from 1011fbe9cf2SAnton Blanchard # the TOC pointer to create pointers where possible. Pointers into the 1021fbe9cf2SAnton Blanchard # percpu data area are created by this method. 1031fbe9cf2SAnton Blanchard # 1041fbe9cf2SAnton Blanchard # The kernel module loader relocates the percpu data section from the 1051fbe9cf2SAnton Blanchard # original location (starting with 0xd...) to somewhere in the base 1061fbe9cf2SAnton Blanchard # kernel percpu data space (starting with 0xc...). We need a full 1071fbe9cf2SAnton Blanchard # 64bit relocation for this to work, hence -mcmodel=large. 1081fbe9cf2SAnton Blanchard KBUILD_CFLAGS_MODULE += -mcmodel=large 1091fbe9cf2SAnton Blanchardelse 1101fbe9cf2SAnton Blanchard export NO_MINIMAL_TOC := -mno-minimal-toc 1111fbe9cf2SAnton Blanchardendif 1121fbe9cf2SAnton Blanchardendif 11377e69ee7SNicholas Pigginendif 1141fbe9cf2SAnton Blanchard 115a50a862eSAnton BlanchardCFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no) 116661aa880SChristophe Leroyifdef CONFIG_PPC64_ELF_ABI_V2 117238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) 118721aeaa9SAnton Blanchardelse 1197c3bd836SNathan Chancellorifndef CONFIG_CC_IS_CLANG 1204dc831aaSNicholas PigginCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) 121238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc) 122721aeaa9SAnton Blanchardendif 123465bfd9cSNathan Chancellorendif 124238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc)) 12598679fb0SAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions) 12678f09298SMichael EllermanCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mlong-double-128) 12751d42f0fSSegher Boessenkool 12872e7bcc2SJoel Stanley# Clang unconditionally reserves r2 on ppc32 and does not support the flag 12972e7bcc2SJoel Stanley# https://bugs.llvm.org/show_bug.cgi?id=39555 13072e7bcc2SJoel StanleyCFLAGS-$(CONFIG_PPC32) := $(call cc-option, -ffixed-r2) 13172e7bcc2SJoel Stanley 13272e7bcc2SJoel Stanley# Clang doesn't support -mmultiple / -mno-multiple 13372e7bcc2SJoel Stanley# https://bugs.llvm.org/show_bug.cgi?id=39556 13472e7bcc2SJoel StanleyCFLAGS-$(CONFIG_PPC32) += $(call cc-option, $(MULTIPLEWORD)) 13572e7bcc2SJoel Stanley 13651d42f0fSSegher BoessenkoolCFLAGS-$(CONFIG_PPC32) += $(call cc-option,-mno-readonly-in-sdata) 137d23c6fb4SAnton Blanchard 1382a056f58SNicholas Pigginifdef CONFIG_FUNCTION_TRACER 1390f71dcfbSNaveen N Raoifdef CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY 1400f71dcfbSNaveen N RaoKBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY 1410f71dcfbSNaveen N RaoCC_FLAGS_FTRACE := -fpatchable-function-entry=2 1420f71dcfbSNaveen N Raoelse 1432a056f58SNicholas PigginCC_FLAGS_FTRACE := -pg 1448c50b72aSTorsten Duweifdef CONFIG_MPROFILE_KERNEL 1452a056f58SNicholas PigginCC_FLAGS_FTRACE += -mprofile-kernel 1462a056f58SNicholas Pigginendif 1478c50b72aSTorsten Duweendif 1480f71dcfbSNaveen N Raoendif 1498c50b72aSTorsten Duwe 15045f7091aSChristophe LeroyCFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU) 15145f7091aSChristophe LeroyAFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU) 152d23c6fb4SAnton Blanchard 15350832720SMichael EllermanCFLAGS-y += $(CONFIG_TUNE_CPU) 15401718ba6SScott Wood 1557998eb3dSGuenter Roeckasinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) 1567998eb3dSGuenter Roeck 1579cc342f6SMasahiro YamadaKBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr) 158b00899b8SMasahiro YamadaKBUILD_AFLAGS += $(AFLAGS-y) 159a50a862eSAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-msoft-float) 160f5df87b8SNicholas PigginKBUILD_CFLAGS += $(CFLAGS-y) 161a0f97e06SSam RavnborgCPP = $(CC) -E $(KBUILD_CFLAGS) 16214cf11afSPaul Mackerras 16368201fbbSMichael EllermanCHECKFLAGS += -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__ 16462c2c5cfSDaniel Axtensifdef CONFIG_CPU_BIG_ENDIAN 16562c2c5cfSDaniel AxtensCHECKFLAGS += -D__BIG_ENDIAN__ 16662c2c5cfSDaniel Axtenselse 1675b89492cSChristophe LeroyCHECKFLAGS += -D__LITTLE_ENDIAN__ 16862c2c5cfSDaniel Axtensendif 16914cf11afSPaul Mackerras 170badf436fSRodrigo R. Galvaoifdef CONFIG_476FPE_ERR46 171d5b35cffSAlistair Popple KBUILD_LDFLAGS_MODULE += --ppc476-workaround \ 172d5b35cffSAlistair Popple -T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds 173d5b35cffSAlistair Poppleendif 174d5b35cffSAlistair Popple 1754b2a9315SNicholas Piggin# No prefix or pcrel 176dc5dac74SNicholas Pigginifdef CONFIG_PPC_KERNEL_PREFIXED 177dc5dac74SNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mprefixed) 178dc5dac74SNicholas Pigginelse 1794b2a9315SNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mno-prefixed) 180dc5dac74SNicholas Pigginendif 1817e3a68beSNicholas Pigginifdef CONFIG_PPC_KERNEL_PCREL 1827e3a68beSNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mpcrel) 1837e3a68beSNicholas Pigginelse 1844b2a9315SNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mno-pcrel) 1857e3a68beSNicholas Pigginendif 1864b2a9315SNicholas Piggin 1874b2a9315SNicholas Piggin# No AltiVec or VSX or MMA instructions when building kernel 188a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-mno-altivec) 189d23c6fb4SAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-mno-vsx) 1904b2a9315SNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mno-mma) 191d3f67fbbSPaul Mackerras 1920197cd2eSKumar Gala# No SPE instruction when building kernel 193ce400c01SThiemo Seufer# (We use all available options to help semi-broken compilers) 1940197cd2eSKumar GalaKBUILD_CFLAGS += $(call cc-option,-mno-spe) 195ce400c01SThiemo SeuferKBUILD_CFLAGS += $(call cc-option,-mspe=no) 1960197cd2eSKumar Gala 197ba96301cSNaveen N. Rao# Don't emit .eh_frame since we have no use for it 198ba96301cSNaveen N. RaoKBUILD_CFLAGS += -fno-asynchronous-unwind-tables 199ba96301cSNaveen N. Rao 20057647a4dSBenjamin Herrenschmidt# Never use string load/store instructions as they are 20157647a4dSBenjamin Herrenschmidt# often slow when they are implemented at all 202a50a862eSAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-mno-string) 20314cf11afSPaul Mackerras 2049ddf0075SAnton Blanchardcpu-as-$(CONFIG_ALTIVEC) += $(call as-option,-Wa$(comma)-maltivec) 205960e3002SJoel Stanley 206960e3002SJoel Stanley# When using '-many -mpower4' gas will first try and find a matching power4 207960e3002SJoel Stanley# mnemonic and failing that it will allow any valid mnemonic that GAS knows 208960e3002SJoel Stanley# about. GCC will pass -many to GAS when assembling, clang does not. 209f5140cabSDaniel Axtens# LLVM IAS doesn't understand either flag: https://github.com/ClangBuiltLinux/linux/issues/675 210f5140cabSDaniel Axtens# but LLVM IAS only supports ISA >= 2.06 for Book3S 64 anyway... 211f5140cabSDaniel Axtenscpu-as-$(CONFIG_PPC_BOOK3S_64) += $(call as-option,-Wa$(comma)-mpower4) $(call as-option,-Wa$(comma)-many) 21214cf11afSPaul Mackerras 213222d394dSSam RavnborgKBUILD_AFLAGS += $(cpu-as-y) 214a0f97e06SSam RavnborgKBUILD_CFLAGS += $(cpu-as-y) 21514cf11afSPaul Mackerras 216164af597SMichael EllermanKBUILD_AFLAGS += $(aflags-y) 217164af597SMichael EllermanKBUILD_CFLAGS += $(cflags-y) 218164af597SMichael Ellerman 219135f0b17STom Rini# Default to zImage, override when needed 22025431333SGrant Likelyall: zImage 22114cf11afSPaul Mackerras 222e32e78c5SSam Ravnborg# With make 3.82 we cannot mix normal and wildcard targets 223c686ecf5SAnatolij GustschinBOOT_TARGETS1 := zImage zImage.initrd uImage 22411eab297SBenjamin HerrenschmidtBOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% uImage.% 225cabb5587SStephen Rothwell 226e32e78c5SSam RavnborgPHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2) 227cabb5587SStephen Rothwell 22894b212c2SPaul Mackerrasboot := arch/$(ARCH)/boot 22914cf11afSPaul Mackerras 230e32e78c5SSam Ravnborg$(BOOT_TARGETS1): vmlinux 2311196d7aaSMichael Ellerman $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 232e32e78c5SSam Ravnborg$(BOOT_TARGETS2): vmlinux 2331196d7aaSMichael Ellerman $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 23414cf11afSPaul Mackerras 235e32e78c5SSam Ravnborg 236d42c6d0fSMichael EllermanPHONY += bootwrapper_install 237e32e78c5SSam Ravnborgbootwrapper_install: 2381196d7aaSMichael Ellerman $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 239e32e78c5SSam Ravnborg 240a400c287SNicolas Saenz Julienneinclude $(srctree)/scripts/Makefile.defconf 24122db99d6SMichael Ellerman 24222db99d6SMichael Ellermangenerated_configs += ppc64le_defconfig 2432adc48a6SMichael Ellermanppc64le_defconfig: 2442adc48a6SMichael Ellerman $(call merge_into_defconfig,ppc64_defconfig,le) 2452adc48a6SMichael Ellerman 24622db99d6SMichael Ellermangenerated_configs += ppc64le_guest_defconfig 247721c01baSSatheesh Rajendranppc64le_guest_defconfig: 248bac94962SMichael Ellerman $(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest) 249721c01baSSatheesh Rajendran 25022db99d6SMichael Ellermangenerated_configs += ppc64_guest_defconfig 251721c01baSSatheesh Rajendranppc64_guest_defconfig: 252bac94962SMichael Ellerman $(call merge_into_defconfig,ppc64_defconfig,be guest kvm_guest) 253721c01baSSatheesh Rajendran 254596ddea8SMichael Ellermangenerated_configs += pseries_le_defconfig 255596ddea8SMichael Ellermanpseries_le_defconfig: ppc64le_guest_defconfig 256596ddea8SMichael Ellerman 2579ecda934SMichael Ellermangenerated_configs += pseries_defconfig 2589ecda934SMichael Ellermanpseries_defconfig: ppc64le_guest_defconfig 2599ecda934SMichael Ellerman 26022db99d6SMichael Ellermangenerated_configs += powernv_be_defconfig 2613603c52fSMichael Ellermanpowernv_be_defconfig: 2623603c52fSMichael Ellerman $(call merge_into_defconfig,powernv_defconfig,be) 2633603c52fSMichael Ellerman 26422db99d6SMichael Ellermangenerated_configs += mpc85xx_defconfig 26544d54014SScott Woodmpc85xx_defconfig: 26658b12eb2SMichael Ellerman $(call merge_into_defconfig,mpc85xx_base.config,\ 26744d54014SScott Wood 85xx-32bit 85xx-hw fsl-emb-nonhw) 26844d54014SScott Wood 26922db99d6SMichael Ellermangenerated_configs += mpc85xx_smp_defconfig 27044d54014SScott Woodmpc85xx_smp_defconfig: 27158b12eb2SMichael Ellerman $(call merge_into_defconfig,mpc85xx_base.config,\ 27244d54014SScott Wood 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw) 27344d54014SScott Wood 27422db99d6SMichael Ellermangenerated_configs += corenet32_smp_defconfig 27544d54014SScott Woodcorenet32_smp_defconfig: 27658b12eb2SMichael Ellerman $(call merge_into_defconfig,corenet_base.config,\ 277e0b80f00SClaudiu Manoil 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa) 27844d54014SScott Wood 27922db99d6SMichael Ellermangenerated_configs += corenet64_smp_defconfig 28044d54014SScott Woodcorenet64_smp_defconfig: 28158b12eb2SMichael Ellerman $(call merge_into_defconfig,corenet_base.config,\ 282e0b80f00SClaudiu Manoil 85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa) 28344d54014SScott Wood 28422db99d6SMichael Ellermangenerated_configs += mpc86xx_defconfig 28543de32c5SAlessio Igor Boganimpc86xx_defconfig: 28658b12eb2SMichael Ellerman $(call merge_into_defconfig,mpc86xx_base.config,\ 28743de32c5SAlessio Igor Bogani 86xx-hw fsl-emb-nonhw) 28843de32c5SAlessio Igor Bogani 28922db99d6SMichael Ellermangenerated_configs += mpc86xx_smp_defconfig 29043de32c5SAlessio Igor Boganimpc86xx_smp_defconfig: 29158b12eb2SMichael Ellerman $(call merge_into_defconfig,mpc86xx_base.config,\ 29243de32c5SAlessio Igor Bogani 86xx-smp 86xx-hw fsl-emb-nonhw) 29343de32c5SAlessio Igor Bogani 29422db99d6SMichael Ellermangenerated_configs += ppc32_allmodconfig 2958db0c9d4SMichael Ellermanppc32_allmodconfig: 2968db0c9d4SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \ 2978db0c9d4SMichael Ellerman -f $(srctree)/Makefile allmodconfig 2988db0c9d4SMichael Ellerman 29922db99d6SMichael Ellermangenerated_configs += ppc_defconfig 300a273fa38SMichael Ellermanppc_defconfig: 301a273fa38SMichael Ellerman $(call merge_into_defconfig,book3s_32.config,) 302a273fa38SMichael Ellerman 30322db99d6SMichael Ellermangenerated_configs += ppc64le_allmodconfig 30464de5d8dSMichael Ellermanppc64le_allmodconfig: 30564de5d8dSMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/le.config \ 30664de5d8dSMichael Ellerman -f $(srctree)/Makefile allmodconfig 30764de5d8dSMichael Ellerman 30822db99d6SMichael Ellermangenerated_configs += ppc64le_allnoconfig 3095d823447SMichael Ellermanppc64le_allnoconfig: 3105d823447SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/ppc64le.config \ 3115d823447SMichael Ellerman -f $(srctree)/Makefile allnoconfig 3125d823447SMichael Ellerman 31322db99d6SMichael Ellermangenerated_configs += ppc64_book3e_allmodconfig 31464de5d8dSMichael Ellermanppc64_book3e_allmodconfig: 31564de5d8dSMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-64bit.config \ 31664de5d8dSMichael Ellerman -f $(srctree)/Makefile allmodconfig 31764de5d8dSMichael Ellerman 31822db99d6SMichael Ellermangenerated_configs += ppc32_randconfig 319f259fb89SMichael Ellermanppc32_randconfig: 320f259fb89SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/32-bit.config \ 321f259fb89SMichael Ellerman -f $(srctree)/Makefile randconfig 322f259fb89SMichael Ellerman 32322db99d6SMichael Ellermangenerated_configs += ppc64_randconfig 324f259fb89SMichael Ellermanppc64_randconfig: 325f259fb89SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/64-bit.config \ 326f259fb89SMichael Ellerman -f $(srctree)/Makefile randconfig 327f259fb89SMichael Ellerman 32822db99d6SMichael EllermanPHONY += $(generated_configs) 32922db99d6SMichael Ellerman 33014cf11afSPaul Mackerrasdefine archhelp 331228c7a95SMichael Ellerman echo '* zImage - Build default images selected by kernel config' 332228c7a95SMichael Ellerman echo ' zImage.* - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)' 333228c7a95SMichael Ellerman echo ' uImage - U-Boot native image format' 334228c7a95SMichael Ellerman echo ' cuImage.<dt> - Backwards compatible U-Boot image for older' 335228c7a95SMichael Ellerman echo ' versions which do not support device trees' 336228c7a95SMichael Ellerman echo ' dtbImage.<dt> - zImage with an embedded device tree blob' 337228c7a95SMichael Ellerman echo ' simpleImage.<dt> - Firmware independent image.' 338228c7a95SMichael Ellerman echo ' treeImage.<dt> - Support for older IBM 4xx firmware (not U-Boot)' 339228c7a95SMichael Ellerman echo ' install - Install kernel using' 340228c7a95SMichael Ellerman echo ' (your) ~/bin/$(INSTALLKERNEL) or' 341228c7a95SMichael Ellerman echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 342228c7a95SMichael Ellerman echo ' install to $$(INSTALL_PATH) and run lilo' 343228c7a95SMichael Ellerman echo ' *_defconfig - Select default config from arch/$(ARCH)/configs' 344228c7a95SMichael Ellerman echo '' 345228c7a95SMichael Ellerman echo ' Targets with <dt> embed a device tree blob inside the image' 346228c7a95SMichael Ellerman echo ' These targets support board with firmware that does not' 347228c7a95SMichael Ellerman echo ' support passing a device tree directly. Replace <dt> with the' 348228c7a95SMichael Ellerman echo ' name of a dts file from the arch/$(ARCH)/boot/dts/ directory' 349228c7a95SMichael Ellerman echo ' (minus the .dts extension).' 35022db99d6SMichael Ellerman echo 35122db99d6SMichael Ellerman $(foreach cfg,$(generated_configs), 35222db99d6SMichael Ellerman printf " %-27s - Build for %s\\n" $(cfg) $(subst _defconfig,,$(cfg));) 35314cf11afSPaul Mackerrasendef 35414cf11afSPaul Mackerras 355d42c6d0fSMichael EllermanPHONY += install 3563f85d63eSSam Ravnborginstall: 357f774f5bbSMasahiro Yamada $(call cmd,install) 358928370c6SAkinobu Mita 35991bf6955SChristophe Leroyifeq ($(KBUILD_EXTMOD),) 36091bf6955SChristophe Leroy# We need to generate vdso-offsets.h before compiling certain files in kernel/. 36191bf6955SChristophe Leroy# In order to do that, we should use the archprepare target, but we can't since 36291bf6955SChristophe Leroy# asm-offsets.h is included in some files used to generate vdso-offsets.h, and 36391bf6955SChristophe Leroy# asm-offsets.h is built in prepare0, for which archprepare is a dependency. 36491bf6955SChristophe Leroy# Therefore we need to generate the header after prepare0 has been made, hence 36591bf6955SChristophe Leroy# this hack. 36691bf6955SChristophe Leroyprepare: vdso_prepare 36791bf6955SChristophe Leroyvdso_prepare: prepare0 36891bf6955SChristophe Leroy $(if $(CONFIG_VDSO32),$(Q)$(MAKE) \ 369fd1feadeSChristophe Leroy $(build)=arch/powerpc/kernel/vdso include/generated/vdso32-offsets.h) 37091bf6955SChristophe Leroy $(if $(CONFIG_PPC64),$(Q)$(MAKE) \ 371fd1feadeSChristophe Leroy $(build)=arch/powerpc/kernel/vdso include/generated/vdso64-offsets.h) 37291bf6955SChristophe Leroyendif 37391bf6955SChristophe Leroy 37414cf11afSPaul Mackerrasarchprepare: checkbin 37514cf11afSPaul Mackerras 376ab66dcc7SFiroz Khanarchheaders: 377ab66dcc7SFiroz Khan $(Q)$(MAKE) $(build)=arch/powerpc/kernel/syscalls all 378ab66dcc7SFiroz Khan 379c3ff2a51SChristophe Leroyifdef CONFIG_STACKPROTECTOR 380c3ff2a51SChristophe Leroyprepare: stack_protector_prepare 38114cf11afSPaul Mackerras 382d42c6d0fSMichael EllermanPHONY += stack_protector_prepare 383c3ff2a51SChristophe Leroystack_protector_prepare: prepare0 38406ec27aeSChristophe Leroyifdef CONFIG_PPC64 385*c062bba1SNathan Chancellor $(eval KBUILD_CFLAGS += -mstack-protector-guard=tls -mstack-protector-guard-reg=r13 \ 386*c062bba1SNathan Chancellor -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h)) 38706ec27aeSChristophe Leroyelse 388*c062bba1SNathan Chancellor $(eval KBUILD_CFLAGS += -mstack-protector-guard=tls -mstack-protector-guard-reg=r2 \ 389*c062bba1SNathan Chancellor -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h)) 390c3ff2a51SChristophe Leroyendif 39106ec27aeSChristophe Leroyendif 392c3ff2a51SChristophe Leroy 393d42c6d0fSMichael EllermanPHONY += checkbin 39414cf11afSPaul Mackerrascheckbin: 39525ea739eSNaveen N Rao @if test "x${CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT}" = "xy" -a \ 39625ea739eSNaveen N Rao "x${CONFIG_LD_IS_BFD}" = "xy" -a \ 39725ea739eSNaveen N Rao "${CONFIG_LD_VERSION}" = "23700" ; then \ 39825ea739eSNaveen N Rao echo -n '*** binutils 2.37 drops unused section symbols, which recordmcount ' ; \ 39925ea739eSNaveen N Rao echo 'is unable to handle.' ; \ 40025ea739eSNaveen N Rao echo '*** Please use a different binutils version.' ; \ 40125ea739eSNaveen N Rao false ; \ 40225ea739eSNaveen N Rao fi 403