162306a36Sopenharmony_ci# This file is included by the global makefile so that you can add your own
262306a36Sopenharmony_ci# architecture-specific flags and dependencies.
362306a36Sopenharmony_ci#
462306a36Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public
562306a36Sopenharmony_ci# License.  See the file "COPYING" in the main directory of this archive
662306a36Sopenharmony_ci# for more details.
762306a36Sopenharmony_ci#
862306a36Sopenharmony_ci# Copyright (C) 1994 by Linus Torvalds
962306a36Sopenharmony_ci# Changes for PPC by Gary Thomas
1062306a36Sopenharmony_ci# Rewritten by Cort Dougan and Paul Mackerras
1162306a36Sopenharmony_ci#
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciHAS_BIARCH	:= $(call cc-option-yn, -m32)
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci# Set default 32 bits cross compilers for vdso and boot wrapper
1662306a36Sopenharmony_ciCROSS32_COMPILE ?=
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci# If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use
1962306a36Sopenharmony_ci# ppc64_defconfig because we have nothing better to go on.
2062306a36Sopenharmony_ciuname := $(shell uname -m)
2162306a36Sopenharmony_ciKBUILD_DEFCONFIG := $(if $(filter ppc%,$(uname)),$(uname),ppc64)_defconfig
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_cinew_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciifeq ($(new_nm),y)
2662306a36Sopenharmony_ciNM		:= $(NM) --synthetic
2762306a36Sopenharmony_ciendif
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci# BITS is used as extension for files which are available in a 32 bit
3062306a36Sopenharmony_ci# and a 64 bit version to simplify shared Makefiles.
3162306a36Sopenharmony_ci# e.g.: obj-y += foo_$(BITS).o
3262306a36Sopenharmony_ciexport BITS
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ciifdef CONFIG_PPC64
3562306a36Sopenharmony_ci        BITS := 64
3662306a36Sopenharmony_cielse
3762306a36Sopenharmony_ci        BITS := 32
3862306a36Sopenharmony_ciendif
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_cimachine-y = ppc
4162306a36Sopenharmony_cimachine-$(CONFIG_PPC64) += 64
4262306a36Sopenharmony_cimachine-$(CONFIG_CPU_LITTLE_ENDIAN) += le
4362306a36Sopenharmony_ciUTS_MACHINE := $(subst $(space),,$(machine-y))
4462306a36Sopenharmony_ci
4562306a36Sopenharmony_ciifeq ($(CONFIG_PPC64)$(CONFIG_LD_IS_BFD),yy)
4662306a36Sopenharmony_ci# Have the linker provide sfpr if possible.
4762306a36Sopenharmony_ci# There is a corresponding test in arch/powerpc/lib/Makefile
4862306a36Sopenharmony_ciKBUILD_LDFLAGS_MODULE += --save-restore-funcs
4962306a36Sopenharmony_cielse
5062306a36Sopenharmony_ciKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
5162306a36Sopenharmony_ciendif
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ciifdef CONFIG_CPU_LITTLE_ENDIAN
5462306a36Sopenharmony_ciKBUILD_CFLAGS	+= -mlittle-endian
5562306a36Sopenharmony_ciKBUILD_LDFLAGS	+= -EL
5662306a36Sopenharmony_ciLDEMULATION	:= lppc
5762306a36Sopenharmony_ciGNUTARGET	:= powerpcle
5862306a36Sopenharmony_ciMULTIPLEWORD	:= -mno-multiple
5962306a36Sopenharmony_ciKBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
6062306a36Sopenharmony_cielse
6162306a36Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mbig-endian)
6262306a36Sopenharmony_ciKBUILD_LDFLAGS	+= -EB
6362306a36Sopenharmony_ciLDEMULATION	:= ppc
6462306a36Sopenharmony_ciGNUTARGET	:= powerpc
6562306a36Sopenharmony_ciMULTIPLEWORD	:= -mmultiple
6662306a36Sopenharmony_ciendif
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ciifdef CONFIG_PPC64
6962306a36Sopenharmony_ciifndef CONFIG_CC_IS_CLANG
7062306a36Sopenharmony_cicflags-$(CONFIG_PPC64_ELF_ABI_V1)	+= $(call cc-option,-mabi=elfv1)
7162306a36Sopenharmony_cicflags-$(CONFIG_PPC64_ELF_ABI_V1)	+= $(call cc-option,-mcall-aixdesc)
7262306a36Sopenharmony_ciaflags-$(CONFIG_PPC64_ELF_ABI_V1)	+= $(call cc-option,-mabi=elfv1)
7362306a36Sopenharmony_ciaflags-$(CONFIG_PPC64_ELF_ABI_V2)	+= -mabi=elfv2
7462306a36Sopenharmony_ciendif
7562306a36Sopenharmony_ciendif
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ciifndef CONFIG_CC_IS_CLANG
7862306a36Sopenharmony_ci  cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mno-strict-align
7962306a36Sopenharmony_ciendif
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_cicflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
8262306a36Sopenharmony_cicflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
8362306a36Sopenharmony_ciaflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
8462306a36Sopenharmony_ciaflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ciifeq ($(HAS_BIARCH),y)
8762306a36Sopenharmony_ciKBUILD_CFLAGS	+= -m$(BITS)
8862306a36Sopenharmony_ciKBUILD_AFLAGS	+= -m$(BITS)
8962306a36Sopenharmony_ciKBUILD_LDFLAGS	+= -m elf$(BITS)$(LDEMULATION)
9062306a36Sopenharmony_ciendif
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_cicflags-$(CONFIG_STACKPROTECTOR)	+= -mstack-protector-guard=tls
9362306a36Sopenharmony_ciifdef CONFIG_PPC64
9462306a36Sopenharmony_cicflags-$(CONFIG_STACKPROTECTOR)	+= -mstack-protector-guard-reg=r13
9562306a36Sopenharmony_cielse
9662306a36Sopenharmony_cicflags-$(CONFIG_STACKPROTECTOR)	+= -mstack-protector-guard-reg=r2
9762306a36Sopenharmony_ciendif
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ciLDFLAGS_vmlinux-y := -Bstatic
10062306a36Sopenharmony_ciLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
10162306a36Sopenharmony_ciLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) += -z notext
10262306a36Sopenharmony_ciLDFLAGS_vmlinux	:= $(LDFLAGS_vmlinux-y)
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ciifdef CONFIG_PPC64
10562306a36Sopenharmony_ciifndef CONFIG_PPC_KERNEL_PCREL
10662306a36Sopenharmony_ciifeq ($(call cc-option-yn,-mcmodel=medium),y)
10762306a36Sopenharmony_ci	# -mcmodel=medium breaks modules because it uses 32bit offsets from
10862306a36Sopenharmony_ci	# the TOC pointer to create pointers where possible. Pointers into the
10962306a36Sopenharmony_ci	# percpu data area are created by this method.
11062306a36Sopenharmony_ci	#
11162306a36Sopenharmony_ci	# The kernel module loader relocates the percpu data section from the
11262306a36Sopenharmony_ci	# original location (starting with 0xd...) to somewhere in the base
11362306a36Sopenharmony_ci	# kernel percpu data space (starting with 0xc...). We need a full
11462306a36Sopenharmony_ci	# 64bit relocation for this to work, hence -mcmodel=large.
11562306a36Sopenharmony_ci	KBUILD_CFLAGS_MODULE += -mcmodel=large
11662306a36Sopenharmony_cielse
11762306a36Sopenharmony_ci	export NO_MINIMAL_TOC := -mno-minimal-toc
11862306a36Sopenharmony_ciendif
11962306a36Sopenharmony_ciendif
12062306a36Sopenharmony_ciendif
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	:= $(call cc-option,-mtraceback=no)
12362306a36Sopenharmony_ciifdef CONFIG_PPC64_ELF_ABI_V2
12462306a36Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
12562306a36Sopenharmony_cielse
12662306a36Sopenharmony_ciifndef CONFIG_CC_IS_CLANG
12762306a36Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
12862306a36Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcall-aixdesc)
12962306a36Sopenharmony_ciendif
13062306a36Sopenharmony_ciendif
13162306a36Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
13262306a36Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mno-pointers-to-nested-functions)
13362306a36Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mlong-double-128)
13462306a36Sopenharmony_ci
13562306a36Sopenharmony_ci# Clang unconditionally reserves r2 on ppc32 and does not support the flag
13662306a36Sopenharmony_ci# https://bugs.llvm.org/show_bug.cgi?id=39555
13762306a36Sopenharmony_ciCFLAGS-$(CONFIG_PPC32)	:= $(call cc-option, -ffixed-r2)
13862306a36Sopenharmony_ci
13962306a36Sopenharmony_ci# Clang doesn't support -mmultiple / -mno-multiple
14062306a36Sopenharmony_ci# https://bugs.llvm.org/show_bug.cgi?id=39556
14162306a36Sopenharmony_ciCFLAGS-$(CONFIG_PPC32)	+= $(call cc-option, $(MULTIPLEWORD))
14262306a36Sopenharmony_ci
14362306a36Sopenharmony_ciCFLAGS-$(CONFIG_PPC32)	+= $(call cc-option,-mno-readonly-in-sdata)
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ciifdef CONFIG_FUNCTION_TRACER
14662306a36Sopenharmony_ciifdef CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY
14762306a36Sopenharmony_ciKBUILD_CPPFLAGS	+= -DCC_USING_PATCHABLE_FUNCTION_ENTRY
14862306a36Sopenharmony_ciCC_FLAGS_FTRACE := -fpatchable-function-entry=2
14962306a36Sopenharmony_cielse
15062306a36Sopenharmony_ciCC_FLAGS_FTRACE := -pg
15162306a36Sopenharmony_ciifdef CONFIG_MPROFILE_KERNEL
15262306a36Sopenharmony_ciCC_FLAGS_FTRACE += -mprofile-kernel
15362306a36Sopenharmony_ciendif
15462306a36Sopenharmony_ciendif
15562306a36Sopenharmony_ciendif
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ciCFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU)
15862306a36Sopenharmony_ciAFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU)
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ciCFLAGS-y += $(CONFIG_TUNE_CPU)
16162306a36Sopenharmony_ci
16262306a36Sopenharmony_ciasinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ciKBUILD_CPPFLAGS	+= -I $(srctree)/arch/$(ARCH) $(asinstr)
16562306a36Sopenharmony_ciKBUILD_AFLAGS	+= $(AFLAGS-y)
16662306a36Sopenharmony_ciKBUILD_CFLAGS	+= $(call cc-option,-msoft-float)
16762306a36Sopenharmony_ciKBUILD_CFLAGS	+= $(CFLAGS-y)
16862306a36Sopenharmony_ciCPP		= $(CC) -E $(KBUILD_CFLAGS)
16962306a36Sopenharmony_ci
17062306a36Sopenharmony_ciCHECKFLAGS	+= -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__
17162306a36Sopenharmony_ciifdef CONFIG_CPU_BIG_ENDIAN
17262306a36Sopenharmony_ciCHECKFLAGS	+= -D__BIG_ENDIAN__
17362306a36Sopenharmony_cielse
17462306a36Sopenharmony_ciCHECKFLAGS	+= -D__LITTLE_ENDIAN__
17562306a36Sopenharmony_ciendif
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ciifdef CONFIG_476FPE_ERR46
17862306a36Sopenharmony_ci	KBUILD_LDFLAGS_MODULE += --ppc476-workaround \
17962306a36Sopenharmony_ci		-T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds
18062306a36Sopenharmony_ciendif
18162306a36Sopenharmony_ci
18262306a36Sopenharmony_ci# No prefix or pcrel
18362306a36Sopenharmony_ciifdef CONFIG_PPC_KERNEL_PREFIXED
18462306a36Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mprefixed)
18562306a36Sopenharmony_cielse
18662306a36Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mno-prefixed)
18762306a36Sopenharmony_ciendif
18862306a36Sopenharmony_ciifdef CONFIG_PPC_KERNEL_PCREL
18962306a36Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mpcrel)
19062306a36Sopenharmony_cielse
19162306a36Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mno-pcrel)
19262306a36Sopenharmony_ciendif
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ci# No AltiVec or VSX or MMA instructions when building kernel
19562306a36Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mno-altivec)
19662306a36Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mno-vsx)
19762306a36Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mno-mma)
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci# No SPE instruction when building kernel
20062306a36Sopenharmony_ci# (We use all available options to help semi-broken compilers)
20162306a36Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mno-spe)
20262306a36Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mspe=no)
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ci# Don't emit .eh_frame since we have no use for it
20562306a36Sopenharmony_ciKBUILD_CFLAGS += -fno-asynchronous-unwind-tables
20662306a36Sopenharmony_ci
20762306a36Sopenharmony_ci# Never use string load/store instructions as they are
20862306a36Sopenharmony_ci# often slow when they are implemented at all
20962306a36Sopenharmony_ciKBUILD_CFLAGS		+= $(call cc-option,-mno-string)
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_cicpu-as-$(CONFIG_ALTIVEC)	+= $(call as-option,-Wa$(comma)-maltivec)
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ci# When using '-many -mpower4' gas will first try and find a matching power4
21462306a36Sopenharmony_ci# mnemonic and failing that it will allow any valid mnemonic that GAS knows
21562306a36Sopenharmony_ci# about. GCC will pass -many to GAS when assembling, clang does not.
21662306a36Sopenharmony_ci# LLVM IAS doesn't understand either flag: https://github.com/ClangBuiltLinux/linux/issues/675
21762306a36Sopenharmony_ci# but LLVM IAS only supports ISA >= 2.06 for Book3S 64 anyway...
21862306a36Sopenharmony_cicpu-as-$(CONFIG_PPC_BOOK3S_64)	+= $(call as-option,-Wa$(comma)-mpower4) $(call as-option,-Wa$(comma)-many)
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ciKBUILD_AFLAGS += $(cpu-as-y)
22162306a36Sopenharmony_ciKBUILD_CFLAGS += $(cpu-as-y)
22262306a36Sopenharmony_ci
22362306a36Sopenharmony_ciKBUILD_AFLAGS += $(aflags-y)
22462306a36Sopenharmony_ciKBUILD_CFLAGS += $(cflags-y)
22562306a36Sopenharmony_ci
22662306a36Sopenharmony_ci# Default to zImage, override when needed
22762306a36Sopenharmony_ciall: zImage
22862306a36Sopenharmony_ci
22962306a36Sopenharmony_ci# With make 3.82 we cannot mix normal and wildcard targets
23062306a36Sopenharmony_ciBOOT_TARGETS1 := zImage zImage.initrd uImage
23162306a36Sopenharmony_ciBOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% uImage.%
23262306a36Sopenharmony_ci
23362306a36Sopenharmony_ciPHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2)
23462306a36Sopenharmony_ci
23562306a36Sopenharmony_ciboot := arch/$(ARCH)/boot
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ci$(BOOT_TARGETS1): vmlinux
23862306a36Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
23962306a36Sopenharmony_ci$(BOOT_TARGETS2): vmlinux
24062306a36Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
24162306a36Sopenharmony_ci
24262306a36Sopenharmony_ci
24362306a36Sopenharmony_ciPHONY += bootwrapper_install
24462306a36Sopenharmony_cibootwrapper_install:
24562306a36Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
24662306a36Sopenharmony_ci
24762306a36Sopenharmony_ciinclude $(srctree)/scripts/Makefile.defconf
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_cigenerated_configs += ppc64le_defconfig
25062306a36Sopenharmony_cippc64le_defconfig:
25162306a36Sopenharmony_ci	$(call merge_into_defconfig,ppc64_defconfig,le)
25262306a36Sopenharmony_ci
25362306a36Sopenharmony_cigenerated_configs += ppc64le_guest_defconfig
25462306a36Sopenharmony_cippc64le_guest_defconfig:
25562306a36Sopenharmony_ci	$(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest)
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_cigenerated_configs += ppc64_guest_defconfig
25862306a36Sopenharmony_cippc64_guest_defconfig:
25962306a36Sopenharmony_ci	$(call merge_into_defconfig,ppc64_defconfig,be guest kvm_guest)
26062306a36Sopenharmony_ci
26162306a36Sopenharmony_cigenerated_configs += pseries_le_defconfig
26262306a36Sopenharmony_cipseries_le_defconfig: ppc64le_guest_defconfig
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_cigenerated_configs += pseries_defconfig
26562306a36Sopenharmony_cipseries_defconfig: ppc64le_guest_defconfig
26662306a36Sopenharmony_ci
26762306a36Sopenharmony_cigenerated_configs += powernv_be_defconfig
26862306a36Sopenharmony_cipowernv_be_defconfig:
26962306a36Sopenharmony_ci	$(call merge_into_defconfig,powernv_defconfig,be)
27062306a36Sopenharmony_ci
27162306a36Sopenharmony_cigenerated_configs += mpc85xx_defconfig
27262306a36Sopenharmony_cimpc85xx_defconfig:
27362306a36Sopenharmony_ci	$(call merge_into_defconfig,mpc85xx_base.config,\
27462306a36Sopenharmony_ci		85xx-32bit 85xx-hw fsl-emb-nonhw)
27562306a36Sopenharmony_ci
27662306a36Sopenharmony_cigenerated_configs += mpc85xx_smp_defconfig
27762306a36Sopenharmony_cimpc85xx_smp_defconfig:
27862306a36Sopenharmony_ci	$(call merge_into_defconfig,mpc85xx_base.config,\
27962306a36Sopenharmony_ci		85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
28062306a36Sopenharmony_ci
28162306a36Sopenharmony_cigenerated_configs += corenet32_smp_defconfig
28262306a36Sopenharmony_cicorenet32_smp_defconfig:
28362306a36Sopenharmony_ci	$(call merge_into_defconfig,corenet_base.config,\
28462306a36Sopenharmony_ci		85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa)
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_cigenerated_configs += corenet64_smp_defconfig
28762306a36Sopenharmony_cicorenet64_smp_defconfig:
28862306a36Sopenharmony_ci	$(call merge_into_defconfig,corenet_base.config,\
28962306a36Sopenharmony_ci		85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa)
29062306a36Sopenharmony_ci
29162306a36Sopenharmony_cigenerated_configs += mpc86xx_defconfig
29262306a36Sopenharmony_cimpc86xx_defconfig:
29362306a36Sopenharmony_ci	$(call merge_into_defconfig,mpc86xx_base.config,\
29462306a36Sopenharmony_ci		86xx-hw fsl-emb-nonhw)
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_cigenerated_configs += mpc86xx_smp_defconfig
29762306a36Sopenharmony_cimpc86xx_smp_defconfig:
29862306a36Sopenharmony_ci	$(call merge_into_defconfig,mpc86xx_base.config,\
29962306a36Sopenharmony_ci		86xx-smp 86xx-hw fsl-emb-nonhw)
30062306a36Sopenharmony_ci
30162306a36Sopenharmony_cigenerated_configs += ppc32_allmodconfig
30262306a36Sopenharmony_cippc32_allmodconfig:
30362306a36Sopenharmony_ci	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \
30462306a36Sopenharmony_ci		-f $(srctree)/Makefile allmodconfig
30562306a36Sopenharmony_ci
30662306a36Sopenharmony_cigenerated_configs += ppc_defconfig
30762306a36Sopenharmony_cippc_defconfig:
30862306a36Sopenharmony_ci	$(call merge_into_defconfig,book3s_32.config,)
30962306a36Sopenharmony_ci
31062306a36Sopenharmony_cigenerated_configs += ppc64le_allmodconfig
31162306a36Sopenharmony_cippc64le_allmodconfig:
31262306a36Sopenharmony_ci	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/le.config \
31362306a36Sopenharmony_ci		-f $(srctree)/Makefile allmodconfig
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_cigenerated_configs += ppc64le_allnoconfig
31662306a36Sopenharmony_cippc64le_allnoconfig:
31762306a36Sopenharmony_ci	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/ppc64le.config \
31862306a36Sopenharmony_ci		-f $(srctree)/Makefile allnoconfig
31962306a36Sopenharmony_ci
32062306a36Sopenharmony_cigenerated_configs += ppc64_book3e_allmodconfig
32162306a36Sopenharmony_cippc64_book3e_allmodconfig:
32262306a36Sopenharmony_ci	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-64bit.config \
32362306a36Sopenharmony_ci		-f $(srctree)/Makefile allmodconfig
32462306a36Sopenharmony_ci
32562306a36Sopenharmony_cigenerated_configs += ppc32_randconfig
32662306a36Sopenharmony_cippc32_randconfig:
32762306a36Sopenharmony_ci	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/32-bit.config \
32862306a36Sopenharmony_ci		-f $(srctree)/Makefile randconfig
32962306a36Sopenharmony_ci
33062306a36Sopenharmony_cigenerated_configs += ppc64_randconfig
33162306a36Sopenharmony_cippc64_randconfig:
33262306a36Sopenharmony_ci	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/64-bit.config \
33362306a36Sopenharmony_ci		-f $(srctree)/Makefile randconfig
33462306a36Sopenharmony_ci
33562306a36Sopenharmony_ciPHONY += $(generated_configs)
33662306a36Sopenharmony_ci
33762306a36Sopenharmony_cidefine archhelp
33862306a36Sopenharmony_ci  echo '* zImage          - Build default images selected by kernel config'
33962306a36Sopenharmony_ci  echo '  zImage.*        - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)'
34062306a36Sopenharmony_ci  echo '  uImage          - U-Boot native image format'
34162306a36Sopenharmony_ci  echo '  cuImage.<dt>    - Backwards compatible U-Boot image for older'
34262306a36Sopenharmony_ci  echo '                    versions which do not support device trees'
34362306a36Sopenharmony_ci  echo '  dtbImage.<dt>   - zImage with an embedded device tree blob'
34462306a36Sopenharmony_ci  echo '  simpleImage.<dt> - Firmware independent image.'
34562306a36Sopenharmony_ci  echo '  treeImage.<dt>  - Support for older IBM 4xx firmware (not U-Boot)'
34662306a36Sopenharmony_ci  echo '  install         - Install kernel using'
34762306a36Sopenharmony_ci  echo '                    (your) ~/bin/$(INSTALLKERNEL) or'
34862306a36Sopenharmony_ci  echo '                    (distribution) /sbin/$(INSTALLKERNEL) or'
34962306a36Sopenharmony_ci  echo '                    install to $$(INSTALL_PATH) and run lilo'
35062306a36Sopenharmony_ci  echo '  *_defconfig     - Select default config from arch/$(ARCH)/configs'
35162306a36Sopenharmony_ci  echo ''
35262306a36Sopenharmony_ci  echo '  Targets with <dt> embed a device tree blob inside the image'
35362306a36Sopenharmony_ci  echo '  These targets support board with firmware that does not'
35462306a36Sopenharmony_ci  echo '  support passing a device tree directly.  Replace <dt> with the'
35562306a36Sopenharmony_ci  echo '  name of a dts file from the arch/$(ARCH)/boot/dts/ directory'
35662306a36Sopenharmony_ci  echo '  (minus the .dts extension).'
35762306a36Sopenharmony_ci  echo
35862306a36Sopenharmony_ci  $(foreach cfg,$(generated_configs),
35962306a36Sopenharmony_ci    printf "  %-27s - Build for %s\\n" $(cfg) $(subst _defconfig,,$(cfg));)
36062306a36Sopenharmony_ciendef
36162306a36Sopenharmony_ci
36262306a36Sopenharmony_ciPHONY += install
36362306a36Sopenharmony_ciinstall:
36462306a36Sopenharmony_ci	$(call cmd,install)
36562306a36Sopenharmony_ci
36662306a36Sopenharmony_ciifeq ($(KBUILD_EXTMOD),)
36762306a36Sopenharmony_ci# We need to generate vdso-offsets.h before compiling certain files in kernel/.
36862306a36Sopenharmony_ci# In order to do that, we should use the archprepare target, but we can't since
36962306a36Sopenharmony_ci# asm-offsets.h is included in some files used to generate vdso-offsets.h, and
37062306a36Sopenharmony_ci# asm-offsets.h is built in prepare0, for which archprepare is a dependency.
37162306a36Sopenharmony_ci# Therefore we need to generate the header after prepare0 has been made, hence
37262306a36Sopenharmony_ci# this hack.
37362306a36Sopenharmony_ciprepare: vdso_prepare
37462306a36Sopenharmony_civdso_prepare: prepare0
37562306a36Sopenharmony_ci	$(if $(CONFIG_VDSO32),$(Q)$(MAKE) \
37662306a36Sopenharmony_ci		$(build)=arch/powerpc/kernel/vdso include/generated/vdso32-offsets.h)
37762306a36Sopenharmony_ci	$(if $(CONFIG_PPC64),$(Q)$(MAKE) \
37862306a36Sopenharmony_ci		$(build)=arch/powerpc/kernel/vdso include/generated/vdso64-offsets.h)
37962306a36Sopenharmony_ciendif
38062306a36Sopenharmony_ci
38162306a36Sopenharmony_ciarchprepare: checkbin
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_ciarchheaders:
38462306a36Sopenharmony_ci	$(Q)$(MAKE) $(build)=arch/powerpc/kernel/syscalls all
38562306a36Sopenharmony_ci
38662306a36Sopenharmony_ciifdef CONFIG_STACKPROTECTOR
38762306a36Sopenharmony_ciprepare: stack_protector_prepare
38862306a36Sopenharmony_ci
38962306a36Sopenharmony_ciPHONY += stack_protector_prepare
39062306a36Sopenharmony_cistack_protector_prepare: prepare0
39162306a36Sopenharmony_ciifdef CONFIG_PPC64
39262306a36Sopenharmony_ci	$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h))
39362306a36Sopenharmony_cielse
39462306a36Sopenharmony_ci	$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h))
39562306a36Sopenharmony_ciendif
39662306a36Sopenharmony_ciendif
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_ciPHONY += checkbin
39962306a36Sopenharmony_cicheckbin:
40062306a36Sopenharmony_ci	@if test "x${CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT}" = "xy" -a \
40162306a36Sopenharmony_ci		"x${CONFIG_LD_IS_BFD}" = "xy" -a \
40262306a36Sopenharmony_ci		"${CONFIG_LD_VERSION}" = "23700" ; then \
40362306a36Sopenharmony_ci		echo -n '*** binutils 2.37 drops unused section symbols, which recordmcount ' ; \
40462306a36Sopenharmony_ci		echo 'is unable to handle.' ; \
40562306a36Sopenharmony_ci		echo '*** Please use a different binutils version.' ; \
40662306a36Sopenharmony_ci		false ; \
40762306a36Sopenharmony_ci	fi
408