18c2ecf20Sopenharmony_ci# This file is included by the global makefile so that you can add your own
28c2ecf20Sopenharmony_ci# architecture-specific flags and dependencies. Remember to do have actions
38c2ecf20Sopenharmony_ci# for "archclean" and "archdep" for cleaning up and making dependencies for
48c2ecf20Sopenharmony_ci# this architecture.
58c2ecf20Sopenharmony_ci#
68c2ecf20Sopenharmony_ci# This file is subject to the terms and conditions of the GNU General Public
78c2ecf20Sopenharmony_ci# License.  See the file "COPYING" in the main directory of this archive
88c2ecf20Sopenharmony_ci# for more details.
98c2ecf20Sopenharmony_ci#
108c2ecf20Sopenharmony_ci# Copyright (C) 1994 by Linus Torvalds
118c2ecf20Sopenharmony_ci# Changes for PPC by Gary Thomas
128c2ecf20Sopenharmony_ci# Rewritten by Cort Dougan and Paul Mackerras
138c2ecf20Sopenharmony_ci#
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciHAS_BIARCH	:= $(call cc-option-yn, -m32)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci# Set default 32 bits cross compilers for vdso and boot wrapper
188c2ecf20Sopenharmony_ciCROSS32_COMPILE ?=
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci# If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use
218c2ecf20Sopenharmony_ci# ppc64_defconfig because we have nothing better to go on.
228c2ecf20Sopenharmony_ciuname := $(shell uname -m)
238c2ecf20Sopenharmony_ciKBUILD_DEFCONFIG := $(if $(filter ppc%,$(uname)),$(uname),ppc64)_defconfig
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_cinew_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciifeq ($(new_nm),y)
288c2ecf20Sopenharmony_ciNM		:= $(NM) --synthetic
298c2ecf20Sopenharmony_ciendif
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci# BITS is used as extension for files which are available in a 32 bit
328c2ecf20Sopenharmony_ci# and a 64 bit version to simplify shared Makefiles.
338c2ecf20Sopenharmony_ci# e.g.: obj-y += foo_$(BITS).o
348c2ecf20Sopenharmony_ciexport BITS
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ciifdef CONFIG_PPC64
378c2ecf20Sopenharmony_ci        BITS := 64
388c2ecf20Sopenharmony_cielse
398c2ecf20Sopenharmony_ci        BITS := 32
408c2ecf20Sopenharmony_ciendif
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_cimachine-y = ppc
438c2ecf20Sopenharmony_cimachine-$(CONFIG_PPC64) += 64
448c2ecf20Sopenharmony_cimachine-$(CONFIG_CPU_LITTLE_ENDIAN) += le
458c2ecf20Sopenharmony_ciUTS_MACHINE := $(subst $(space),,$(machine-y))
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci# XXX This needs to be before we override LD below
488c2ecf20Sopenharmony_ciifdef CONFIG_PPC32
498c2ecf20Sopenharmony_ciKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
508c2ecf20Sopenharmony_cielse
518c2ecf20Sopenharmony_ciifeq ($(call ld-ifversion, -ge, 225000000, y),y)
528c2ecf20Sopenharmony_ci# Have the linker provide sfpr if possible.
538c2ecf20Sopenharmony_ci# There is a corresponding test in arch/powerpc/lib/Makefile
548c2ecf20Sopenharmony_ciKBUILD_LDFLAGS_MODULE += --save-restore-funcs
558c2ecf20Sopenharmony_cielse
568c2ecf20Sopenharmony_ciKBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
578c2ecf20Sopenharmony_ciendif
588c2ecf20Sopenharmony_ciendif
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciifdef CONFIG_CPU_LITTLE_ENDIAN
618c2ecf20Sopenharmony_ciKBUILD_CFLAGS	+= -mlittle-endian
628c2ecf20Sopenharmony_ciKBUILD_LDFLAGS	+= -EL
638c2ecf20Sopenharmony_ciLDEMULATION	:= lppc
648c2ecf20Sopenharmony_ciGNUTARGET	:= powerpcle
658c2ecf20Sopenharmony_ciMULTIPLEWORD	:= -mno-multiple
668c2ecf20Sopenharmony_ciKBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
678c2ecf20Sopenharmony_cielse
688c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mbig-endian)
698c2ecf20Sopenharmony_ciKBUILD_LDFLAGS	+= -EB
708c2ecf20Sopenharmony_ciLDEMULATION	:= ppc
718c2ecf20Sopenharmony_ciGNUTARGET	:= powerpc
728c2ecf20Sopenharmony_ciMULTIPLEWORD	:= -mmultiple
738c2ecf20Sopenharmony_ciendif
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ciifdef CONFIG_PPC64
768c2ecf20Sopenharmony_ciifndef CONFIG_CC_IS_CLANG
778c2ecf20Sopenharmony_cicflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
788c2ecf20Sopenharmony_cicflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mcall-aixdesc)
798c2ecf20Sopenharmony_ciaflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mabi=elfv1)
808c2ecf20Sopenharmony_ciaflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mabi=elfv2
818c2ecf20Sopenharmony_ciendif
828c2ecf20Sopenharmony_ciendif
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ciifndef CONFIG_CC_IS_CLANG
858c2ecf20Sopenharmony_ci  cflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mno-strict-align
868c2ecf20Sopenharmony_ciendif
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_cicflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
898c2ecf20Sopenharmony_cicflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
908c2ecf20Sopenharmony_ciaflags-$(CONFIG_CPU_BIG_ENDIAN)		+= $(call cc-option,-mbig-endian)
918c2ecf20Sopenharmony_ciaflags-$(CONFIG_CPU_LITTLE_ENDIAN)	+= -mlittle-endian
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ciifeq ($(HAS_BIARCH),y)
948c2ecf20Sopenharmony_ciKBUILD_CFLAGS	+= -m$(BITS)
958c2ecf20Sopenharmony_ciKBUILD_AFLAGS	+= -m$(BITS)
968c2ecf20Sopenharmony_ciKBUILD_LDFLAGS	+= -m elf$(BITS)$(LDEMULATION)
978c2ecf20Sopenharmony_ciendif
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_cicflags-$(CONFIG_STACKPROTECTOR)	+= -mstack-protector-guard=tls
1008c2ecf20Sopenharmony_ciifdef CONFIG_PPC64
1018c2ecf20Sopenharmony_cicflags-$(CONFIG_STACKPROTECTOR)	+= -mstack-protector-guard-reg=r13
1028c2ecf20Sopenharmony_cielse
1038c2ecf20Sopenharmony_cicflags-$(CONFIG_STACKPROTECTOR)	+= -mstack-protector-guard-reg=r2
1048c2ecf20Sopenharmony_ciendif
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ciLDFLAGS_vmlinux-y := -Bstatic
1078c2ecf20Sopenharmony_ciLDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
1088c2ecf20Sopenharmony_ciLDFLAGS_vmlinux	:= $(LDFLAGS_vmlinux-y)
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ciifdef CONFIG_PPC64
1118c2ecf20Sopenharmony_ciifeq ($(call cc-option-yn,-mcmodel=medium),y)
1128c2ecf20Sopenharmony_ci	# -mcmodel=medium breaks modules because it uses 32bit offsets from
1138c2ecf20Sopenharmony_ci	# the TOC pointer to create pointers where possible. Pointers into the
1148c2ecf20Sopenharmony_ci	# percpu data area are created by this method.
1158c2ecf20Sopenharmony_ci	#
1168c2ecf20Sopenharmony_ci	# The kernel module loader relocates the percpu data section from the
1178c2ecf20Sopenharmony_ci	# original location (starting with 0xd...) to somewhere in the base
1188c2ecf20Sopenharmony_ci	# kernel percpu data space (starting with 0xc...). We need a full
1198c2ecf20Sopenharmony_ci	# 64bit relocation for this to work, hence -mcmodel=large.
1208c2ecf20Sopenharmony_ci	KBUILD_CFLAGS_MODULE += -mcmodel=large
1218c2ecf20Sopenharmony_cielse
1228c2ecf20Sopenharmony_ci	export NO_MINIMAL_TOC := -mno-minimal-toc
1238c2ecf20Sopenharmony_ciendif
1248c2ecf20Sopenharmony_ciendif
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	:= $(call cc-option,-mtraceback=no)
1278c2ecf20Sopenharmony_ciifndef CONFIG_CC_IS_CLANG
1288c2ecf20Sopenharmony_ciifdef CONFIG_CPU_LITTLE_ENDIAN
1298c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
1308c2ecf20Sopenharmony_ciAFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv2)
1318c2ecf20Sopenharmony_cielse
1328c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
1338c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcall-aixdesc)
1348c2ecf20Sopenharmony_ciAFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mabi=elfv1)
1358c2ecf20Sopenharmony_ciendif
1368c2ecf20Sopenharmony_ciendif
1378c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
1388c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_PPC64)	+= $(call cc-option,-mno-pointers-to-nested-functions)
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci# Clang unconditionally reserves r2 on ppc32 and does not support the flag
1418c2ecf20Sopenharmony_ci# https://bugs.llvm.org/show_bug.cgi?id=39555
1428c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_PPC32)	:= $(call cc-option, -ffixed-r2)
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci# Clang doesn't support -mmultiple / -mno-multiple
1458c2ecf20Sopenharmony_ci# https://bugs.llvm.org/show_bug.cgi?id=39556
1468c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_PPC32)	+= $(call cc-option, $(MULTIPLEWORD))
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_PPC32)	+= $(call cc-option,-mno-readonly-in-sdata)
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ciifdef CONFIG_PPC_BOOK3S_64
1518c2ecf20Sopenharmony_ciifdef CONFIG_CPU_LITTLE_ENDIAN
1528c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
1538c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power9,-mtune=power8)
1548c2ecf20Sopenharmony_cielse
1558c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5))
1568c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4
1578c2ecf20Sopenharmony_ciendif
1588c2ecf20Sopenharmony_cielse ifdef CONFIG_PPC_BOOK3E_64
1598c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
1608c2ecf20Sopenharmony_ciendif
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ciifdef CONFIG_FUNCTION_TRACER
1638c2ecf20Sopenharmony_ciCC_FLAGS_FTRACE := -pg
1648c2ecf20Sopenharmony_ciifdef CONFIG_MPROFILE_KERNEL
1658c2ecf20Sopenharmony_ciCC_FLAGS_FTRACE += -mprofile-kernel
1668c2ecf20Sopenharmony_ciendif
1678c2ecf20Sopenharmony_ci# Work around gcc code-gen bugs with -pg / -fno-omit-frame-pointer in gcc <= 4.8
1688c2ecf20Sopenharmony_ci# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44199
1698c2ecf20Sopenharmony_ci# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52828
1708c2ecf20Sopenharmony_ciifndef CONFIG_CC_IS_CLANG
1718c2ecf20Sopenharmony_ciCC_FLAGS_FTRACE	+= $(call cc-ifversion, -lt, 0409, -mno-sched-epilog)
1728c2ecf20Sopenharmony_ciendif
1738c2ecf20Sopenharmony_ciendif
1748c2ecf20Sopenharmony_ci
1758c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
1768c2ecf20Sopenharmony_ciAFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call cc-option,-mcpu=$(CONFIG_TARGET_CPU))
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci# Altivec option not allowed with e500mc64 in GCC.
1798c2ecf20Sopenharmony_ciifdef CONFIG_ALTIVEC
1808c2ecf20Sopenharmony_ciE5500_CPU := -mcpu=powerpc64
1818c2ecf20Sopenharmony_cielse
1828c2ecf20Sopenharmony_ciE5500_CPU := $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
1838c2ecf20Sopenharmony_ciendif
1848c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_E5500_CPU) += $(E5500_CPU)
1858c2ecf20Sopenharmony_ciCFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ciasinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ciKBUILD_CPPFLAGS	+= -I $(srctree)/arch/$(ARCH) $(asinstr)
1908c2ecf20Sopenharmony_ciKBUILD_AFLAGS	+= $(AFLAGS-y)
1918c2ecf20Sopenharmony_ciKBUILD_CFLAGS	+= $(call cc-option,-msoft-float)
1928c2ecf20Sopenharmony_ciKBUILD_CFLAGS	+= -pipe $(CFLAGS-y)
1938c2ecf20Sopenharmony_ciCPP		= $(CC) -E $(KBUILD_CFLAGS)
1948c2ecf20Sopenharmony_ci
1958c2ecf20Sopenharmony_ciCHECKFLAGS	+= -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__
1968c2ecf20Sopenharmony_ciifdef CONFIG_CPU_BIG_ENDIAN
1978c2ecf20Sopenharmony_ciCHECKFLAGS	+= -D__BIG_ENDIAN__
1988c2ecf20Sopenharmony_cielse
1998c2ecf20Sopenharmony_ciCHECKFLAGS	+= -D__LITTLE_ENDIAN__
2008c2ecf20Sopenharmony_ciendif
2018c2ecf20Sopenharmony_ci
2028c2ecf20Sopenharmony_ciifdef CONFIG_476FPE_ERR46
2038c2ecf20Sopenharmony_ci	KBUILD_LDFLAGS_MODULE += --ppc476-workaround \
2048c2ecf20Sopenharmony_ci		-T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds
2058c2ecf20Sopenharmony_ciendif
2068c2ecf20Sopenharmony_ci
2078c2ecf20Sopenharmony_ci# No AltiVec or VSX instructions when building kernel
2088c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mno-altivec)
2098c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mno-vsx)
2108c2ecf20Sopenharmony_ci
2118c2ecf20Sopenharmony_ci# No SPE instruction when building kernel
2128c2ecf20Sopenharmony_ci# (We use all available options to help semi-broken compilers)
2138c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mno-spe)
2148c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(call cc-option,-mspe=no)
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_ci# Don't emit .eh_frame since we have no use for it
2178c2ecf20Sopenharmony_ciKBUILD_CFLAGS += -fno-asynchronous-unwind-tables
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci# Never use string load/store instructions as they are
2208c2ecf20Sopenharmony_ci# often slow when they are implemented at all
2218c2ecf20Sopenharmony_ciKBUILD_CFLAGS		+= $(call cc-option,-mno-string)
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_cicpu-as-$(CONFIG_40x)		+= -Wa,-m405
2248c2ecf20Sopenharmony_cicpu-as-$(CONFIG_44x)		+= -Wa,-m440
2258c2ecf20Sopenharmony_cicpu-as-$(CONFIG_ALTIVEC)	+= $(call as-option,-Wa$(comma)-maltivec)
2268c2ecf20Sopenharmony_cicpu-as-$(CONFIG_E500)		+= -Wa,-me500
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci# When using '-many -mpower4' gas will first try and find a matching power4
2298c2ecf20Sopenharmony_ci# mnemonic and failing that it will allow any valid mnemonic that GAS knows
2308c2ecf20Sopenharmony_ci# about. GCC will pass -many to GAS when assembling, clang does not.
2318c2ecf20Sopenharmony_cicpu-as-$(CONFIG_PPC_BOOK3S_64)	+= -Wa,-mpower4 -Wa,-many
2328c2ecf20Sopenharmony_cicpu-as-$(CONFIG_PPC_E500MC)	+= $(call as-option,-Wa$(comma)-me500mc)
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ciKBUILD_AFLAGS += $(cpu-as-y)
2358c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(cpu-as-y)
2368c2ecf20Sopenharmony_ci
2378c2ecf20Sopenharmony_ciKBUILD_AFLAGS += $(aflags-y)
2388c2ecf20Sopenharmony_ciKBUILD_CFLAGS += $(cflags-y)
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_cihead-$(CONFIG_PPC64)		:= arch/powerpc/kernel/head_64.o
2418c2ecf20Sopenharmony_cihead-$(CONFIG_PPC_BOOK3S_32)	:= arch/powerpc/kernel/head_book3s_32.o
2428c2ecf20Sopenharmony_cihead-$(CONFIG_PPC_8xx)		:= arch/powerpc/kernel/head_8xx.o
2438c2ecf20Sopenharmony_cihead-$(CONFIG_40x)		:= arch/powerpc/kernel/head_40x.o
2448c2ecf20Sopenharmony_cihead-$(CONFIG_44x)		:= arch/powerpc/kernel/head_44x.o
2458c2ecf20Sopenharmony_cihead-$(CONFIG_FSL_BOOKE)	:= arch/powerpc/kernel/head_fsl_booke.o
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_cihead-$(CONFIG_PPC64)		+= arch/powerpc/kernel/entry_64.o
2488c2ecf20Sopenharmony_cihead-$(CONFIG_PPC_FPU)		+= arch/powerpc/kernel/fpu.o
2498c2ecf20Sopenharmony_cihead-$(CONFIG_ALTIVEC)		+= arch/powerpc/kernel/vector.o
2508c2ecf20Sopenharmony_cihead-$(CONFIG_PPC_OF_BOOT_TRAMPOLINE)  += arch/powerpc/kernel/prom_init.o
2518c2ecf20Sopenharmony_ci
2528c2ecf20Sopenharmony_ci# See arch/powerpc/Kbuild for content of core part of the kernel
2538c2ecf20Sopenharmony_cicore-y += arch/powerpc/
2548c2ecf20Sopenharmony_ci
2558c2ecf20Sopenharmony_cidrivers-$(CONFIG_OPROFILE)	+= arch/powerpc/oprofile/
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci# Default to zImage, override when needed
2588c2ecf20Sopenharmony_ciall: zImage
2598c2ecf20Sopenharmony_ci
2608c2ecf20Sopenharmony_ci# With make 3.82 we cannot mix normal and wildcard targets
2618c2ecf20Sopenharmony_ciBOOT_TARGETS1 := zImage zImage.initrd uImage
2628c2ecf20Sopenharmony_ciBOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% uImage.%
2638c2ecf20Sopenharmony_ci
2648c2ecf20Sopenharmony_ciPHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2)
2658c2ecf20Sopenharmony_ci
2668c2ecf20Sopenharmony_ciboot := arch/$(ARCH)/boot
2678c2ecf20Sopenharmony_ci
2688c2ecf20Sopenharmony_ci$(BOOT_TARGETS1): vmlinux
2698c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
2708c2ecf20Sopenharmony_ci$(BOOT_TARGETS2): vmlinux
2718c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ciPHONY += bootwrapper_install
2758c2ecf20Sopenharmony_cibootwrapper_install:
2768c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci# Used to create 'merged defconfigs'
2798c2ecf20Sopenharmony_ci# To use it $(call) it with the first argument as the base defconfig
2808c2ecf20Sopenharmony_ci# and the second argument as a space separated list of .config files to merge,
2818c2ecf20Sopenharmony_ci# without the .config suffix.
2828c2ecf20Sopenharmony_cidefine merge_into_defconfig
2838c2ecf20Sopenharmony_ci	$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh \
2848c2ecf20Sopenharmony_ci		-m -O $(objtree) $(srctree)/arch/$(ARCH)/configs/$(1) \
2858c2ecf20Sopenharmony_ci		$(foreach config,$(2),$(srctree)/arch/$(ARCH)/configs/$(config).config)
2868c2ecf20Sopenharmony_ci	+$(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
2878c2ecf20Sopenharmony_ciendef
2888c2ecf20Sopenharmony_ci
2898c2ecf20Sopenharmony_ciPHONY += pseries_le_defconfig
2908c2ecf20Sopenharmony_cipseries_le_defconfig:
2918c2ecf20Sopenharmony_ci	$(call merge_into_defconfig,pseries_defconfig,le)
2928c2ecf20Sopenharmony_ci
2938c2ecf20Sopenharmony_ciPHONY += ppc64le_defconfig
2948c2ecf20Sopenharmony_cippc64le_defconfig:
2958c2ecf20Sopenharmony_ci	$(call merge_into_defconfig,ppc64_defconfig,le)
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ciPHONY += ppc64le_guest_defconfig
2988c2ecf20Sopenharmony_cippc64le_guest_defconfig:
2998c2ecf20Sopenharmony_ci	$(call merge_into_defconfig,ppc64_defconfig,le guest)
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ciPHONY += ppc64_guest_defconfig
3028c2ecf20Sopenharmony_cippc64_guest_defconfig:
3038c2ecf20Sopenharmony_ci	$(call merge_into_defconfig,ppc64_defconfig,be guest)
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ciPHONY += powernv_be_defconfig
3068c2ecf20Sopenharmony_cipowernv_be_defconfig:
3078c2ecf20Sopenharmony_ci	$(call merge_into_defconfig,powernv_defconfig,be)
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ciPHONY += mpc85xx_defconfig
3108c2ecf20Sopenharmony_cimpc85xx_defconfig:
3118c2ecf20Sopenharmony_ci	$(call merge_into_defconfig,mpc85xx_base.config,\
3128c2ecf20Sopenharmony_ci		85xx-32bit 85xx-hw fsl-emb-nonhw)
3138c2ecf20Sopenharmony_ci
3148c2ecf20Sopenharmony_ciPHONY += mpc85xx_smp_defconfig
3158c2ecf20Sopenharmony_cimpc85xx_smp_defconfig:
3168c2ecf20Sopenharmony_ci	$(call merge_into_defconfig,mpc85xx_base.config,\
3178c2ecf20Sopenharmony_ci		85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ciPHONY += corenet32_smp_defconfig
3208c2ecf20Sopenharmony_cicorenet32_smp_defconfig:
3218c2ecf20Sopenharmony_ci	$(call merge_into_defconfig,corenet_base.config,\
3228c2ecf20Sopenharmony_ci		85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa)
3238c2ecf20Sopenharmony_ci
3248c2ecf20Sopenharmony_ciPHONY += corenet64_smp_defconfig
3258c2ecf20Sopenharmony_cicorenet64_smp_defconfig:
3268c2ecf20Sopenharmony_ci	$(call merge_into_defconfig,corenet_base.config,\
3278c2ecf20Sopenharmony_ci		85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa)
3288c2ecf20Sopenharmony_ci
3298c2ecf20Sopenharmony_ciPHONY += mpc86xx_defconfig
3308c2ecf20Sopenharmony_cimpc86xx_defconfig:
3318c2ecf20Sopenharmony_ci	$(call merge_into_defconfig,mpc86xx_base.config,\
3328c2ecf20Sopenharmony_ci		86xx-hw fsl-emb-nonhw)
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ciPHONY += mpc86xx_smp_defconfig
3358c2ecf20Sopenharmony_cimpc86xx_smp_defconfig:
3368c2ecf20Sopenharmony_ci	$(call merge_into_defconfig,mpc86xx_base.config,\
3378c2ecf20Sopenharmony_ci		86xx-smp 86xx-hw fsl-emb-nonhw)
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ciPHONY += ppc32_allmodconfig
3408c2ecf20Sopenharmony_cippc32_allmodconfig:
3418c2ecf20Sopenharmony_ci	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \
3428c2ecf20Sopenharmony_ci		-f $(srctree)/Makefile allmodconfig
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ciPHONY += ppc_defconfig
3458c2ecf20Sopenharmony_cippc_defconfig:
3468c2ecf20Sopenharmony_ci	$(call merge_into_defconfig,book3s_32.config,)
3478c2ecf20Sopenharmony_ci
3488c2ecf20Sopenharmony_ciPHONY += ppc64le_allmodconfig
3498c2ecf20Sopenharmony_cippc64le_allmodconfig:
3508c2ecf20Sopenharmony_ci	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/le.config \
3518c2ecf20Sopenharmony_ci		-f $(srctree)/Makefile allmodconfig
3528c2ecf20Sopenharmony_ci
3538c2ecf20Sopenharmony_ciPHONY += ppc64_book3e_allmodconfig
3548c2ecf20Sopenharmony_cippc64_book3e_allmodconfig:
3558c2ecf20Sopenharmony_ci	$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-64bit.config \
3568c2ecf20Sopenharmony_ci		-f $(srctree)/Makefile allmodconfig
3578c2ecf20Sopenharmony_ci
3588c2ecf20Sopenharmony_cidefine archhelp
3598c2ecf20Sopenharmony_ci  @echo '* zImage          - Build default images selected by kernel config'
3608c2ecf20Sopenharmony_ci  @echo '  zImage.*        - Compressed kernel image (arch/$(ARCH)/boot/zImage.*)'
3618c2ecf20Sopenharmony_ci  @echo '  uImage          - U-Boot native image format'
3628c2ecf20Sopenharmony_ci  @echo '  cuImage.<dt>    - Backwards compatible U-Boot image for older'
3638c2ecf20Sopenharmony_ci  @echo '                    versions which do not support device trees'
3648c2ecf20Sopenharmony_ci  @echo '  dtbImage.<dt>   - zImage with an embedded device tree blob'
3658c2ecf20Sopenharmony_ci  @echo '  simpleImage.<dt> - Firmware independent image.'
3668c2ecf20Sopenharmony_ci  @echo '  treeImage.<dt>  - Support for older IBM 4xx firmware (not U-Boot)'
3678c2ecf20Sopenharmony_ci  @echo '  install         - Install kernel using'
3688c2ecf20Sopenharmony_ci  @echo '                    (your) ~/bin/$(INSTALLKERNEL) or'
3698c2ecf20Sopenharmony_ci  @echo '                    (distribution) /sbin/$(INSTALLKERNEL) or'
3708c2ecf20Sopenharmony_ci  @echo '                    install to $$(INSTALL_PATH) and run lilo'
3718c2ecf20Sopenharmony_ci  @echo '  *_defconfig     - Select default config from arch/$(ARCH)/configs'
3728c2ecf20Sopenharmony_ci  @echo ''
3738c2ecf20Sopenharmony_ci  @echo '  Targets with <dt> embed a device tree blob inside the image'
3748c2ecf20Sopenharmony_ci  @echo '  These targets support board with firmware that does not'
3758c2ecf20Sopenharmony_ci  @echo '  support passing a device tree directly.  Replace <dt> with the'
3768c2ecf20Sopenharmony_ci  @echo '  name of a dts file from the arch/$(ARCH)/boot/dts/ directory'
3778c2ecf20Sopenharmony_ci  @echo '  (minus the .dts extension).'
3788c2ecf20Sopenharmony_ciendef
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ciPHONY += install
3818c2ecf20Sopenharmony_ciinstall:
3828c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=$(boot) install
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ciPHONY += vdso_install
3858c2ecf20Sopenharmony_civdso_install:
3868c2ecf20Sopenharmony_ciifdef CONFIG_PPC64
3878c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso64 $@
3888c2ecf20Sopenharmony_ciendif
3898c2ecf20Sopenharmony_ciifdef CONFIG_VDSO32
3908c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=arch/$(ARCH)/kernel/vdso32 $@
3918c2ecf20Sopenharmony_ciendif
3928c2ecf20Sopenharmony_ci
3938c2ecf20Sopenharmony_ciarchclean:
3948c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(clean)=$(boot)
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_ciarchprepare: checkbin
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ciarchheaders:
3998c2ecf20Sopenharmony_ci	$(Q)$(MAKE) $(build)=arch/powerpc/kernel/syscalls all
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ciifdef CONFIG_STACKPROTECTOR
4028c2ecf20Sopenharmony_ciprepare: stack_protector_prepare
4038c2ecf20Sopenharmony_ci
4048c2ecf20Sopenharmony_ciPHONY += stack_protector_prepare
4058c2ecf20Sopenharmony_cistack_protector_prepare: prepare0
4068c2ecf20Sopenharmony_ciifdef CONFIG_PPC64
4078c2ecf20Sopenharmony_ci	$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h))
4088c2ecf20Sopenharmony_cielse
4098c2ecf20Sopenharmony_ci	$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h))
4108c2ecf20Sopenharmony_ciendif
4118c2ecf20Sopenharmony_ciendif
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_ciifdef CONFIG_SMP
4148c2ecf20Sopenharmony_ciprepare: task_cpu_prepare
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_ciPHONY += task_cpu_prepare
4178c2ecf20Sopenharmony_citask_cpu_prepare: prepare0
4188c2ecf20Sopenharmony_ci	$(eval KBUILD_CFLAGS += -D_TASK_CPU=$(shell awk '{if ($$2 == "TASK_CPU") print $$3;}' include/generated/asm-offsets.h))
4198c2ecf20Sopenharmony_ciendif
4208c2ecf20Sopenharmony_ci
4218c2ecf20Sopenharmony_ciPHONY += checkbin
4228c2ecf20Sopenharmony_ci# Check toolchain versions:
4238c2ecf20Sopenharmony_ci# - gcc-4.6 is the minimum kernel-wide version so nothing required.
4248c2ecf20Sopenharmony_cicheckbin:
4258c2ecf20Sopenharmony_ci	@if test "x${CONFIG_CPU_LITTLE_ENDIAN}" = "xy" \
4268c2ecf20Sopenharmony_ci	    && $(LD) --version | head -1 | grep ' 2\.24$$' >/dev/null ; then \
4278c2ecf20Sopenharmony_ci		echo -n '*** binutils 2.24 miscompiles weak symbols ' ; \
4288c2ecf20Sopenharmony_ci		echo 'in some circumstances.' ; \
4298c2ecf20Sopenharmony_ci		echo -n '*** Please use a different binutils version.' ; \
4308c2ecf20Sopenharmony_ci		false ; \
4318c2ecf20Sopenharmony_ci	fi
4328c2ecf20Sopenharmony_ci	@if test "x${CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT}" = "xy" -a \
4338c2ecf20Sopenharmony_ci		"x${CONFIG_LD_IS_BFD}" = "xy" -a \
4348c2ecf20Sopenharmony_ci		"${CONFIG_LD_VERSION}" = "23700" ; then \
4358c2ecf20Sopenharmony_ci		echo -n '*** binutils 2.37 drops unused section symbols, which recordmcount ' ; \
4368c2ecf20Sopenharmony_ci		echo 'is unable to handle.' ; \
4378c2ecf20Sopenharmony_ci		echo '*** Please use a different binutils version.' ; \
4388c2ecf20Sopenharmony_ci		false ; \
4398c2ecf20Sopenharmony_ci	fi
440