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 13402928b5SMichael Ellermanifdef cross_compiling 14402928b5SMichael Ellerman ifeq ($(CROSS_COMPILE),) 15402928b5SMichael Ellerman # Auto detect cross compiler prefix. 16402928b5SMichael Ellerman # Look for: (powerpc(64(le)?)?)(-unknown)?-linux(-gnu)?- 17402928b5SMichael Ellerman CC_ARCHES := powerpc powerpc64 powerpc64le 18402928b5SMichael Ellerman CC_SUFFIXES := linux linux-gnu unknown-linux-gnu 19402928b5SMichael Ellerman CROSS_COMPILE := $(call cc-cross-prefix, $(foreach a,$(CC_ARCHES), \ 20402928b5SMichael Ellerman $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-))) 21402928b5SMichael Ellerman endif 22402928b5SMichael Ellermanendif 23402928b5SMichael Ellerman 2414cf11afSPaul MackerrasHAS_BIARCH := $(call cc-option-yn, -m32) 2514cf11afSPaul Mackerras 2614cf11afSPaul Mackerras# Set default 32 bits cross compilers for vdso and boot wrapper 2714cf11afSPaul MackerrasCROSS32_COMPILE ?= 2814cf11afSPaul Mackerras 29af5cd05dSMichael Ellerman# If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use 3022f17b02SMichael Ellerman# ppc64le_defconfig because we have nothing better to go on. 31af5cd05dSMichael Ellermanuname := $(shell uname -m) 3222f17b02SMichael EllermanKBUILD_DEFCONFIG := $(if $(filter ppc%,$(uname)),$(uname),ppc64le)_defconfig 338a5abdf8SPaul Mackerras 3414cf11afSPaul Mackerrasnew_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi) 3514cf11afSPaul Mackerras 3614cf11afSPaul Mackerrasifeq ($(new_nm),y) 3714cf11afSPaul MackerrasNM := $(NM) --synthetic 3814cf11afSPaul Mackerrasendif 3914cf11afSPaul Mackerras 4068201fbbSMichael Ellerman# BITS is used as extension for files which are available in a 32 bit 4168201fbbSMichael Ellerman# and a 64 bit version to simplify shared Makefiles. 4268201fbbSMichael Ellerman# e.g.: obj-y += foo_$(BITS).o 4368201fbbSMichael Ellermanexport BITS 4468201fbbSMichael Ellerman 4568201fbbSMichael Ellermanifdef CONFIG_PPC64 4668201fbbSMichael Ellerman BITS := 64 4768201fbbSMichael Ellermanelse 4868201fbbSMichael Ellerman BITS := 32 4914cf11afSPaul Mackerrasendif 5014cf11afSPaul Mackerras 5157073e27SMichael Ellermanmachine-y = ppc 5257073e27SMichael Ellermanmachine-$(CONFIG_PPC64) += 64 5357073e27SMichael Ellermanmachine-$(CONFIG_CPU_LITTLE_ENDIAN) += le 5457073e27SMichael EllermanUTS_MACHINE := $(subst $(space),,$(machine-y)) 55190554dbSStephen Rothwell 5654a11654SMasahiro Yamadaifeq ($(CONFIG_PPC64)$(CONFIG_LD_IS_BFD),yy) 57b40b2386SMichael Ellerman# Have the linker provide sfpr if possible. 58b40b2386SMichael Ellerman# There is a corresponding test in arch/powerpc/lib/Makefile 59b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += --save-restore-funcs 60b40b2386SMichael Ellermanelse 61b40b2386SMichael EllermanKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o 62b40b2386SMichael Ellermanendif 63b40b2386SMichael Ellerman 64badf436fSRodrigo R. Galvaoifdef CONFIG_CPU_LITTLE_ENDIAN 65a5371018SArnd BergmannKBUILD_CPPFLAGS += -mlittle-endian 66d503ac53SMasahiro YamadaKBUILD_LDFLAGS += -EL 67d72b0801SIan MunsieLDEMULATION := lppc 68d72b0801SIan MunsieGNUTARGET := powerpcle 69d72b0801SIan MunsieMULTIPLEWORD := -mno-multiple 70d3d35d95STony BreedsKBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect) 71d72b0801SIan Munsieelse 72a5371018SArnd BergmannKBUILD_CPPFLAGS += $(call cc-option,-mbig-endian) 73d503ac53SMasahiro YamadaKBUILD_LDFLAGS += -EB 74d72b0801SIan MunsieLDEMULATION := ppc 75d72b0801SIan MunsieGNUTARGET := powerpc 76d72b0801SIan MunsieMULTIPLEWORD := -mmultiple 77d72b0801SIan Munsieendif 78d72b0801SIan Munsie 794dc831aaSNicholas Pigginifdef CONFIG_PPC64 80465bfd9cSNathan Chancellorifndef CONFIG_CC_IS_CLANG 81661aa880SChristophe Leroycflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mabi=elfv1) 82661aa880SChristophe Leroycflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mcall-aixdesc) 83661aa880SChristophe Leroyaflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mabi=elfv1) 84661aa880SChristophe Leroyaflags-$(CONFIG_PPC64_ELF_ABI_V2) += -mabi=elfv2 854dc831aaSNicholas Pigginendif 86465bfd9cSNathan Chancellorendif 874dc831aaSNicholas Piggin 88076f421dSMasahiro Yamadaifndef CONFIG_CC_IS_CLANG 89164af597SMichael Ellerman cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align 90164af597SMichael Ellermanendif 91164af597SMichael Ellerman 921421dc6dSNicholas Piggincflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) 931421dc6dSNicholas Piggincflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian 94164af597SMichael Ellermanaflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian) 95164af597SMichael Ellermanaflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian 96164af597SMichael Ellerman 9714cf11afSPaul Mackerrasifeq ($(HAS_BIARCH),y) 98a5371018SArnd BergmannKBUILD_CPPFLAGS += -m$(BITS) 9931f48f16SNathan ChancellorKBUILD_AFLAGS += -m$(BITS) 100d503ac53SMasahiro YamadaKBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION) 10114cf11afSPaul Mackerrasendif 10214cf11afSPaul Mackerras 1039c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-y := -Bstatic 1049c5f7d39SSuzuki PouloseLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie 10503557853SFangrui SongLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) += -z notext 1069c5f7d39SSuzuki PouloseLDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y) 10714cf11afSPaul Mackerras 108badf436fSRodrigo R. Galvaoifdef CONFIG_PPC64 10977e69ee7SNicholas Pigginifndef CONFIG_PPC_KERNEL_PCREL 1101fbe9cf2SAnton Blanchard # -mcmodel=medium breaks modules because it uses 32bit offsets from 1111fbe9cf2SAnton Blanchard # the TOC pointer to create pointers where possible. Pointers into the 1121fbe9cf2SAnton Blanchard # percpu data area are created by this method. 1131fbe9cf2SAnton Blanchard # 1141fbe9cf2SAnton Blanchard # The kernel module loader relocates the percpu data section from the 1151fbe9cf2SAnton Blanchard # original location (starting with 0xd...) to somewhere in the base 1161fbe9cf2SAnton Blanchard # kernel percpu data space (starting with 0xc...). We need a full 1171fbe9cf2SAnton Blanchard # 64bit relocation for this to work, hence -mcmodel=large. 1181fbe9cf2SAnton Blanchard KBUILD_CFLAGS_MODULE += -mcmodel=large 1191fbe9cf2SAnton Blanchardendif 12077e69ee7SNicholas Pigginendif 1211fbe9cf2SAnton Blanchard 122a50a862eSAnton BlanchardCFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no) 123661aa880SChristophe Leroyifdef CONFIG_PPC64_ELF_ABI_V2 124238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc)) 125721aeaa9SAnton Blanchardelse 1267c3bd836SNathan Chancellorifndef CONFIG_CC_IS_CLANG 1274dc831aaSNicholas PigginCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1) 128238abecdSAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc) 129721aeaa9SAnton Blanchardendif 130465bfd9cSNathan Chancellorendif 131c330b50dSNaveen N RaoCFLAGS-$(CONFIG_PPC64) += -mcmodel=medium 13298679fb0SAnton BlanchardCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions) 13378f09298SMichael EllermanCFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mlong-double-128) 13451d42f0fSSegher Boessenkool 13572e7bcc2SJoel Stanley# Clang unconditionally reserves r2 on ppc32 and does not support the flag 1362947a456SNathan Chancellor# https://llvm.org/pr39555 13772e7bcc2SJoel StanleyCFLAGS-$(CONFIG_PPC32) := $(call cc-option, -ffixed-r2) 13872e7bcc2SJoel Stanley 13972e7bcc2SJoel Stanley# Clang doesn't support -mmultiple / -mno-multiple 1402947a456SNathan Chancellor# https://llvm.org/pr39556 14172e7bcc2SJoel StanleyCFLAGS-$(CONFIG_PPC32) += $(call cc-option, $(MULTIPLEWORD)) 14272e7bcc2SJoel Stanley 14351d42f0fSSegher BoessenkoolCFLAGS-$(CONFIG_PPC32) += $(call cc-option,-mno-readonly-in-sdata) 144d23c6fb4SAnton Blanchard 14501db473eSSamuel HollandCC_FLAGS_FPU := $(call cc-option,-mhard-float) 14601db473eSSamuel HollandCC_FLAGS_NO_FPU := $(call cc-option,-msoft-float) 14701db473eSSamuel Holland 1482a056f58SNicholas Pigginifdef CONFIG_FUNCTION_TRACER 1490f71dcfbSNaveen N Raoifdef CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY 1500f71dcfbSNaveen N RaoKBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY 151eec37961SNaveen N Raoifdef CONFIG_PPC_FTRACE_OUT_OF_LINE 152eec37961SNaveen N RaoCC_FLAGS_FTRACE := -fpatchable-function-entry=1 153eec37961SNaveen N Raoelse 154e717754fSNaveen N Raoifdef CONFIG_DYNAMIC_FTRACE_WITH_CALL_OPS # PPC32 only 155e717754fSNaveen N RaoCC_FLAGS_FTRACE := -fpatchable-function-entry=3,1 156e717754fSNaveen N Raoelse 1570f71dcfbSNaveen N RaoCC_FLAGS_FTRACE := -fpatchable-function-entry=2 158eec37961SNaveen N Raoendif 159e717754fSNaveen N Raoendif 1600f71dcfbSNaveen N Raoelse 1612a056f58SNicholas PigginCC_FLAGS_FTRACE := -pg 1628c50b72aSTorsten Duweifdef CONFIG_MPROFILE_KERNEL 1632a056f58SNicholas PigginCC_FLAGS_FTRACE += -mprofile-kernel 1642a056f58SNicholas Pigginendif 1658c50b72aSTorsten Duweendif 1660f71dcfbSNaveen N Raoendif 1678c50b72aSTorsten Duwe 16845f7091aSChristophe LeroyCFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU) 16945f7091aSChristophe LeroyAFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU) 170d23c6fb4SAnton Blanchard 17150832720SMichael EllermanCFLAGS-y += $(CONFIG_TUNE_CPU) 17201718ba6SScott Wood 1737998eb3dSGuenter Roeckasinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1) 1747998eb3dSGuenter Roeck 175dc420877SMichael EllermanKBUILD_CPPFLAGS += -I $(srctree)/arch/powerpc $(asinstr) 176b00899b8SMasahiro YamadaKBUILD_AFLAGS += $(AFLAGS-y) 17701db473eSSamuel HollandKBUILD_CFLAGS += $(CC_FLAGS_NO_FPU) 178f5df87b8SNicholas PigginKBUILD_CFLAGS += $(CFLAGS-y) 17914cf11afSPaul Mackerras 18068201fbbSMichael EllermanCHECKFLAGS += -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__ 18162c2c5cfSDaniel Axtensifdef CONFIG_CPU_BIG_ENDIAN 18262c2c5cfSDaniel AxtensCHECKFLAGS += -D__BIG_ENDIAN__ 18362c2c5cfSDaniel Axtenselse 1845b89492cSChristophe LeroyCHECKFLAGS += -D__LITTLE_ENDIAN__ 18562c2c5cfSDaniel Axtensendif 18614cf11afSPaul Mackerras 187badf436fSRodrigo R. Galvaoifdef CONFIG_476FPE_ERR46 188d5b35cffSAlistair Popple KBUILD_LDFLAGS_MODULE += --ppc476-workaround \ 189d5b35cffSAlistair Popple -T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds 190d5b35cffSAlistair Poppleendif 191d5b35cffSAlistair Popple 1924b2a9315SNicholas Piggin# No prefix or pcrel 193dc5dac74SNicholas Pigginifdef CONFIG_PPC_KERNEL_PREFIXED 194dc5dac74SNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mprefixed) 195dc5dac74SNicholas Pigginelse 1964b2a9315SNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mno-prefixed) 197dc5dac74SNicholas Pigginendif 1987e3a68beSNicholas Pigginifdef CONFIG_PPC_KERNEL_PCREL 1997e3a68beSNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mpcrel) 2007e3a68beSNicholas Pigginelse 2014b2a9315SNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mno-pcrel) 2027e3a68beSNicholas Pigginendif 2034b2a9315SNicholas Piggin 2044b2a9315SNicholas Piggin# No AltiVec or VSX or MMA instructions when building kernel 205a0f97e06SSam RavnborgKBUILD_CFLAGS += $(call cc-option,-mno-altivec) 206d23c6fb4SAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-mno-vsx) 2074b2a9315SNicholas PigginKBUILD_CFLAGS += $(call cc-option,-mno-mma) 208d3f67fbbSPaul Mackerras 2090197cd2eSKumar Gala# No SPE instruction when building kernel 210ce400c01SThiemo Seufer# (We use all available options to help semi-broken compilers) 2110197cd2eSKumar GalaKBUILD_CFLAGS += $(call cc-option,-mno-spe) 212ce400c01SThiemo SeuferKBUILD_CFLAGS += $(call cc-option,-mspe=no) 2130197cd2eSKumar Gala 214ba96301cSNaveen N. Rao# Don't emit .eh_frame since we have no use for it 215ba96301cSNaveen N. RaoKBUILD_CFLAGS += -fno-asynchronous-unwind-tables 216ba96301cSNaveen N. Rao 21757647a4dSBenjamin Herrenschmidt# Never use string load/store instructions as they are 21857647a4dSBenjamin Herrenschmidt# often slow when they are implemented at all 219a50a862eSAnton BlanchardKBUILD_CFLAGS += $(call cc-option,-mno-string) 22014cf11afSPaul Mackerras 221164af597SMichael EllermanKBUILD_AFLAGS += $(aflags-y) 222164af597SMichael EllermanKBUILD_CFLAGS += $(cflags-y) 223164af597SMichael Ellerman 224135f0b17STom Rini# Default to zImage, override when needed 22525431333SGrant Likelyall: zImage 22614cf11afSPaul Mackerras 227e32e78c5SSam Ravnborg# With make 3.82 we cannot mix normal and wildcard targets 228c686ecf5SAnatolij GustschinBOOT_TARGETS1 := zImage zImage.initrd uImage 22911eab297SBenjamin HerrenschmidtBOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% uImage.% 230cabb5587SStephen Rothwell 231e32e78c5SSam RavnborgPHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2) 232cabb5587SStephen Rothwell 233dc420877SMichael Ellermanboot := arch/powerpc/boot 23414cf11afSPaul Mackerras 235e32e78c5SSam Ravnborg$(BOOT_TARGETS1): vmlinux 2361196d7aaSMichael Ellerman $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 237e32e78c5SSam Ravnborg$(BOOT_TARGETS2): vmlinux 2381196d7aaSMichael Ellerman $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 23914cf11afSPaul Mackerras 240e32e78c5SSam Ravnborg 241d42c6d0fSMichael EllermanPHONY += bootwrapper_install 242e32e78c5SSam Ravnborgbootwrapper_install: 2431196d7aaSMichael Ellerman $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@) 244e32e78c5SSam Ravnborg 245a400c287SNicolas Saenz Julienneinclude $(srctree)/scripts/Makefile.defconf 24622db99d6SMichael Ellerman 24722db99d6SMichael Ellermangenerated_configs += ppc64le_defconfig 2482adc48a6SMichael Ellermanppc64le_defconfig: 2492adc48a6SMichael Ellerman $(call merge_into_defconfig,ppc64_defconfig,le) 2502adc48a6SMichael Ellerman 25122db99d6SMichael Ellermangenerated_configs += ppc64le_guest_defconfig 252721c01baSSatheesh Rajendranppc64le_guest_defconfig: 253bac94962SMichael Ellerman $(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest) 254721c01baSSatheesh Rajendran 25522db99d6SMichael Ellermangenerated_configs += ppc64_guest_defconfig 256721c01baSSatheesh Rajendranppc64_guest_defconfig: 257bac94962SMichael Ellerman $(call merge_into_defconfig,ppc64_defconfig,be guest kvm_guest) 258721c01baSSatheesh Rajendran 259596ddea8SMichael Ellermangenerated_configs += pseries_le_defconfig 260596ddea8SMichael Ellermanpseries_le_defconfig: ppc64le_guest_defconfig 261596ddea8SMichael Ellerman 2629ecda934SMichael Ellermangenerated_configs += pseries_defconfig 2639ecda934SMichael Ellermanpseries_defconfig: ppc64le_guest_defconfig 2649ecda934SMichael Ellerman 26522db99d6SMichael Ellermangenerated_configs += powernv_be_defconfig 2663603c52fSMichael Ellermanpowernv_be_defconfig: 2673603c52fSMichael Ellerman $(call merge_into_defconfig,powernv_defconfig,be) 2683603c52fSMichael Ellerman 26922db99d6SMichael Ellermangenerated_configs += mpc85xx_defconfig 27044d54014SScott Woodmpc85xx_defconfig: 27158b12eb2SMichael Ellerman $(call merge_into_defconfig,mpc85xx_base.config,\ 27244d54014SScott Wood 85xx-32bit 85xx-hw fsl-emb-nonhw) 27344d54014SScott Wood 27422db99d6SMichael Ellermangenerated_configs += mpc85xx_smp_defconfig 27544d54014SScott Woodmpc85xx_smp_defconfig: 27658b12eb2SMichael Ellerman $(call merge_into_defconfig,mpc85xx_base.config,\ 27744d54014SScott Wood 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw) 27844d54014SScott Wood 27922db99d6SMichael Ellermangenerated_configs += corenet32_smp_defconfig 28044d54014SScott Woodcorenet32_smp_defconfig: 28158b12eb2SMichael Ellerman $(call merge_into_defconfig,corenet_base.config,\ 282e0b80f00SClaudiu Manoil 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa) 28344d54014SScott Wood 28422db99d6SMichael Ellermangenerated_configs += corenet64_smp_defconfig 28544d54014SScott Woodcorenet64_smp_defconfig: 28658b12eb2SMichael Ellerman $(call merge_into_defconfig,corenet_base.config,\ 287e0b80f00SClaudiu Manoil 85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa) 28844d54014SScott Wood 28922db99d6SMichael Ellermangenerated_configs += mpc86xx_defconfig 29043de32c5SAlessio Igor Boganimpc86xx_defconfig: 29158b12eb2SMichael Ellerman $(call merge_into_defconfig,mpc86xx_base.config,\ 29243de32c5SAlessio Igor Bogani 86xx-hw fsl-emb-nonhw) 29343de32c5SAlessio Igor Bogani 29422db99d6SMichael Ellermangenerated_configs += mpc86xx_smp_defconfig 29543de32c5SAlessio Igor Boganimpc86xx_smp_defconfig: 29658b12eb2SMichael Ellerman $(call merge_into_defconfig,mpc86xx_base.config,\ 29743de32c5SAlessio Igor Bogani 86xx-smp 86xx-hw fsl-emb-nonhw) 29843de32c5SAlessio Igor Bogani 29922db99d6SMichael Ellermangenerated_configs += ppc32_allmodconfig 3008db0c9d4SMichael Ellermanppc32_allmodconfig: 3018db0c9d4SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \ 3028db0c9d4SMichael Ellerman -f $(srctree)/Makefile allmodconfig 3038db0c9d4SMichael Ellerman 304af1ebca5SMichael Ellermangenerated_configs += ppc44x_allmodconfig 305af1ebca5SMichael Ellermanppc44x_allmodconfig: 306af1ebca5SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/44x.config \ 307af1ebca5SMichael Ellerman -f $(srctree)/Makefile allmodconfig 308af1ebca5SMichael Ellerman 309af1ebca5SMichael Ellermangenerated_configs += ppc8xx_allmodconfig 310af1ebca5SMichael Ellermanppc8xx_allmodconfig: 311af1ebca5SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/8xx.config \ 312af1ebca5SMichael Ellerman -f $(srctree)/Makefile allmodconfig 313af1ebca5SMichael Ellerman 314af1ebca5SMichael Ellermangenerated_configs += ppc85xx_allmodconfig 315af1ebca5SMichael Ellermanppc85xx_allmodconfig: 316af1ebca5SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-32bit.config \ 317af1ebca5SMichael Ellerman -f $(srctree)/Makefile allmodconfig 318af1ebca5SMichael Ellerman 31922db99d6SMichael Ellermangenerated_configs += ppc_defconfig 320a273fa38SMichael Ellermanppc_defconfig: 321a273fa38SMichael Ellerman $(call merge_into_defconfig,book3s_32.config,) 322a273fa38SMichael Ellerman 32322db99d6SMichael Ellermangenerated_configs += ppc64le_allmodconfig 32464de5d8dSMichael Ellermanppc64le_allmodconfig: 32564de5d8dSMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/le.config \ 32664de5d8dSMichael Ellerman -f $(srctree)/Makefile allmodconfig 32764de5d8dSMichael Ellerman 32822db99d6SMichael Ellermangenerated_configs += ppc64le_allnoconfig 3295d823447SMichael Ellermanppc64le_allnoconfig: 3305d823447SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/ppc64le.config \ 3315d823447SMichael Ellerman -f $(srctree)/Makefile allnoconfig 3325d823447SMichael Ellerman 33322db99d6SMichael Ellermangenerated_configs += ppc64_book3e_allmodconfig 33464de5d8dSMichael Ellermanppc64_book3e_allmodconfig: 33564de5d8dSMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-64bit.config \ 33664de5d8dSMichael Ellerman -f $(srctree)/Makefile allmodconfig 33764de5d8dSMichael Ellerman 33822db99d6SMichael Ellermangenerated_configs += ppc32_randconfig 339f259fb89SMichael Ellermanppc32_randconfig: 340f259fb89SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/32-bit.config \ 341f259fb89SMichael Ellerman -f $(srctree)/Makefile randconfig 342f259fb89SMichael Ellerman 34322db99d6SMichael Ellermangenerated_configs += ppc64_randconfig 344f259fb89SMichael Ellermanppc64_randconfig: 345f259fb89SMichael Ellerman $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/64-bit.config \ 346f259fb89SMichael Ellerman -f $(srctree)/Makefile randconfig 347f259fb89SMichael Ellerman 34822db99d6SMichael EllermanPHONY += $(generated_configs) 34922db99d6SMichael Ellerman 35014cf11afSPaul Mackerrasdefine archhelp 351228c7a95SMichael Ellerman echo '* zImage - Build default images selected by kernel config' 352dc420877SMichael Ellerman echo ' zImage.* - Compressed kernel image (arch/powerpc/boot/zImage.*)' 353228c7a95SMichael Ellerman echo ' uImage - U-Boot native image format' 354228c7a95SMichael Ellerman echo ' cuImage.<dt> - Backwards compatible U-Boot image for older' 355228c7a95SMichael Ellerman echo ' versions which do not support device trees' 356228c7a95SMichael Ellerman echo ' dtbImage.<dt> - zImage with an embedded device tree blob' 357228c7a95SMichael Ellerman echo ' simpleImage.<dt> - Firmware independent image.' 358228c7a95SMichael Ellerman echo ' treeImage.<dt> - Support for older IBM 4xx firmware (not U-Boot)' 359228c7a95SMichael Ellerman echo ' install - Install kernel using' 360228c7a95SMichael Ellerman echo ' (your) ~/bin/$(INSTALLKERNEL) or' 361228c7a95SMichael Ellerman echo ' (distribution) /sbin/$(INSTALLKERNEL) or' 362c7182a0bSMichael Ellerman echo ' install to $$(INSTALL_PATH)' 363dc420877SMichael Ellerman echo ' *_defconfig - Select default config from arch/powerpc/configs' 364228c7a95SMichael Ellerman echo '' 365228c7a95SMichael Ellerman echo ' Targets with <dt> embed a device tree blob inside the image' 366228c7a95SMichael Ellerman echo ' These targets support board with firmware that does not' 367228c7a95SMichael Ellerman echo ' support passing a device tree directly. Replace <dt> with the' 368dc420877SMichael Ellerman echo ' name of a dts file from the arch/powerpc/boot/dts/ directory' 369228c7a95SMichael Ellerman echo ' (minus the .dts extension).' 37022db99d6SMichael Ellerman echo 37122db99d6SMichael Ellerman $(foreach cfg,$(generated_configs), 37222db99d6SMichael Ellerman printf " %-27s - Build for %s\\n" $(cfg) $(subst _defconfig,,$(cfg));) 37314cf11afSPaul Mackerrasendef 37414cf11afSPaul Mackerras 375d42c6d0fSMichael EllermanPHONY += install 3763f85d63eSSam Ravnborginstall: 377f774f5bbSMasahiro Yamada $(call cmd,install) 378928370c6SAkinobu Mita 37991bf6955SChristophe Leroyifeq ($(KBUILD_EXTMOD),) 38091bf6955SChristophe Leroy# We need to generate vdso-offsets.h before compiling certain files in kernel/. 38191bf6955SChristophe Leroy# In order to do that, we should use the archprepare target, but we can't since 38291bf6955SChristophe Leroy# asm-offsets.h is included in some files used to generate vdso-offsets.h, and 38391bf6955SChristophe Leroy# asm-offsets.h is built in prepare0, for which archprepare is a dependency. 38491bf6955SChristophe Leroy# Therefore we need to generate the header after prepare0 has been made, hence 38591bf6955SChristophe Leroy# this hack. 38691bf6955SChristophe Leroyprepare: vdso_prepare 38791bf6955SChristophe Leroyvdso_prepare: prepare0 38891bf6955SChristophe Leroy $(if $(CONFIG_VDSO32),$(Q)$(MAKE) \ 389fd1feadeSChristophe Leroy $(build)=arch/powerpc/kernel/vdso include/generated/vdso32-offsets.h) 39091bf6955SChristophe Leroy $(if $(CONFIG_PPC64),$(Q)$(MAKE) \ 391fd1feadeSChristophe Leroy $(build)=arch/powerpc/kernel/vdso include/generated/vdso64-offsets.h) 39291bf6955SChristophe Leroyendif 39391bf6955SChristophe Leroy 39414cf11afSPaul Mackerrasarchprepare: checkbin 39514cf11afSPaul Mackerras 396ab66dcc7SFiroz Khanarchheaders: 397ab66dcc7SFiroz Khan $(Q)$(MAKE) $(build)=arch/powerpc/kernel/syscalls all 398ab66dcc7SFiroz Khan 399c3ff2a51SChristophe Leroyifdef CONFIG_STACKPROTECTOR 400c3ff2a51SChristophe Leroyprepare: stack_protector_prepare 40114cf11afSPaul Mackerras 402d42c6d0fSMichael EllermanPHONY += stack_protector_prepare 403c3ff2a51SChristophe Leroystack_protector_prepare: prepare0 40406ec27aeSChristophe Leroyifdef CONFIG_PPC64 405bee08a9eSNathan Chancellor $(eval KBUILD_CFLAGS += -mstack-protector-guard=tls -mstack-protector-guard-reg=r13 \ 406*6a34dfa1SLinus Torvalds -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' \ 407*6a34dfa1SLinus Torvalds $(objtree)/include/generated/asm-offsets.h)) 40806ec27aeSChristophe Leroyelse 409bee08a9eSNathan Chancellor $(eval KBUILD_CFLAGS += -mstack-protector-guard=tls -mstack-protector-guard-reg=r2 \ 410*6a34dfa1SLinus Torvalds -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' \ 411*6a34dfa1SLinus Torvalds $(objtree)/include/generated/asm-offsets.h)) 412c3ff2a51SChristophe Leroyendif 41306ec27aeSChristophe Leroyendif 414c3ff2a51SChristophe Leroy 415d42c6d0fSMichael EllermanPHONY += checkbin 41614cf11afSPaul Mackerrascheckbin: 41725ea739eSNaveen N Rao @if test "x${CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT}" = "xy" -a \ 41825ea739eSNaveen N Rao "x${CONFIG_LD_IS_BFD}" = "xy" -a \ 41925ea739eSNaveen N Rao "${CONFIG_LD_VERSION}" = "23700" ; then \ 42025ea739eSNaveen N Rao echo -n '*** binutils 2.37 drops unused section symbols, which recordmcount ' ; \ 42125ea739eSNaveen N Rao echo 'is unable to handle.' ; \ 42225ea739eSNaveen N Rao echo '*** Please use a different binutils version.' ; \ 42325ea739eSNaveen N Rao false ; \ 42425ea739eSNaveen N Rao fi 425