blob: a8479c881cac82bf61cce9fe8338b182053cdc0e [file] [log] [blame]
Paul Mackerras14cf11a2005-09-26 16:04:21 +10001# This file is included by the global makefile so that you can add your own
Masahiro Yamada8212f892021-10-13 15:36:22 +09002# architecture-specific flags and dependencies.
Paul Mackerras14cf11a2005-09-26 16:04:21 +10003#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8# Copyright (C) 1994 by Linus Torvalds
9# Changes for PPC by Gary Thomas
10# Rewritten by Cort Dougan and Paul Mackerras
11#
12
Michael Ellerman402928b52023-12-06 22:55:48 +110013ifdef cross_compiling
14 ifeq ($(CROSS_COMPILE),)
15 # Auto detect cross compiler prefix.
16 # Look for: (powerpc(64(le)?)?)(-unknown)?-linux(-gnu)?-
17 CC_ARCHES := powerpc powerpc64 powerpc64le
18 CC_SUFFIXES := linux linux-gnu unknown-linux-gnu
19 CROSS_COMPILE := $(call cc-cross-prefix, $(foreach a,$(CC_ARCHES), \
20 $(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
21 endif
22endif
23
Paul Mackerras14cf11a2005-09-26 16:04:21 +100024HAS_BIARCH := $(call cc-option-yn, -m32)
25
Paul Mackerras14cf11a2005-09-26 16:04:21 +100026# Set default 32 bits cross compilers for vdso and boot wrapper
27CROSS32_COMPILE ?=
28
Michael Ellermanaf5cd052019-02-07 16:16:52 +110029# If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use
Michael Ellerman22f17b02023-12-06 22:55:47 +110030# ppc64le_defconfig because we have nothing better to go on.
Michael Ellermanaf5cd052019-02-07 16:16:52 +110031uname := $(shell uname -m)
Michael Ellerman22f17b02023-12-06 22:55:47 +110032KBUILD_DEFCONFIG := $(if $(filter ppc%,$(uname)),$(uname),ppc64le)_defconfig
Paul Mackerras8a5abdf2005-11-18 16:39:08 +110033
Paul Mackerras14cf11a2005-09-26 16:04:21 +100034new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
35
36ifeq ($(new_nm),y)
37NM := $(NM) --synthetic
38endif
39
Michael Ellerman68201fb2016-08-11 16:03:14 +100040# BITS is used as extension for files which are available in a 32 bit
41# and a 64 bit version to simplify shared Makefiles.
42# e.g.: obj-y += foo_$(BITS).o
43export BITS
44
45ifdef CONFIG_PPC64
46 BITS := 64
47else
48 BITS := 32
Paul Mackerras14cf11a2005-09-26 16:04:21 +100049endif
50
Michael Ellerman57073e22016-08-11 16:03:15 +100051machine-y = ppc
52machine-$(CONFIG_PPC64) += 64
53machine-$(CONFIG_CPU_LITTLE_ENDIAN) += le
54UTS_MACHINE := $(subst $(space),,$(machine-y))
Stephen Rothwell190554d2005-10-13 16:14:15 +100055
Masahiro Yamada54a11652023-01-19 17:22:50 +090056ifeq ($(CONFIG_PPC64)$(CONFIG_LD_IS_BFD),yy)
Michael Ellermanb40b2382017-07-26 15:00:42 +100057# Have the linker provide sfpr if possible.
58# There is a corresponding test in arch/powerpc/lib/Makefile
59KBUILD_LDFLAGS_MODULE += --save-restore-funcs
60else
61KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
62endif
Michael Ellermanb40b2382017-07-26 15:00:42 +100063
Rodrigo R. Galvaobadf4362018-08-06 13:42:03 -030064ifdef CONFIG_CPU_LITTLE_ENDIAN
Nicholas Piggin1421dc62018-05-30 22:19:21 +100065KBUILD_CFLAGS += -mlittle-endian
Masahiro Yamadad503ac52018-08-24 08:20:39 +090066KBUILD_LDFLAGS += -EL
Ian Munsied72b0802013-09-23 12:05:11 +100067LDEMULATION := lppc
68GNUTARGET := powerpcle
69MULTIPLEWORD := -mno-multiple
Tony Breedsd3d35d92014-03-12 15:12:01 +110070KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
Ian Munsied72b0802013-09-23 12:05:11 +100071else
Nicholas Piggin1421dc62018-05-30 22:19:21 +100072KBUILD_CFLAGS += $(call cc-option,-mbig-endian)
Masahiro Yamadad503ac52018-08-24 08:20:39 +090073KBUILD_LDFLAGS += -EB
Ian Munsied72b0802013-09-23 12:05:11 +100074LDEMULATION := ppc
75GNUTARGET := powerpc
76MULTIPLEWORD := -mmultiple
77endif
78
Nicholas Piggin4dc831a2016-11-27 13:46:20 +110079ifdef CONFIG_PPC64
Nathan Chancellor465bfd92019-11-18 21:57:10 -070080ifndef CONFIG_CC_IS_CLANG
Christophe Leroy661aa882022-05-09 07:36:06 +020081cflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mabi=elfv1)
82cflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mcall-aixdesc)
83aflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mabi=elfv1)
84aflags-$(CONFIG_PPC64_ELF_ABI_V2) += -mabi=elfv2
Nicholas Piggin4dc831a2016-11-27 13:46:20 +110085endif
Nathan Chancellor465bfd92019-11-18 21:57:10 -070086endif
Nicholas Piggin4dc831a2016-11-27 13:46:20 +110087
Masahiro Yamada076f4212018-10-30 22:26:33 +090088ifndef CONFIG_CC_IS_CLANG
Michael Ellerman164af592016-08-09 22:43:46 +100089 cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align
90endif
91
Nicholas Piggin1421dc62018-05-30 22:19:21 +100092cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian)
93cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
Michael Ellerman164af592016-08-09 22:43:46 +100094aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian)
95aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
96
Paul Mackerras14cf11a2005-09-26 16:04:21 +100097ifeq ($(HAS_BIARCH),y)
Nicholas Piggin1421dc62018-05-30 22:19:21 +100098KBUILD_CFLAGS += -m$(BITS)
Nathan Chancellor31f48f12023-01-11 20:05:02 -070099KBUILD_AFLAGS += -m$(BITS)
Masahiro Yamadad503ac52018-08-24 08:20:39 +0900100KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000101endif
102
Christophe Leroyc3ff2a52018-09-27 07:05:53 +0000103cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard=tls
Christophe Leroy06ec27ae2018-09-27 07:05:55 +0000104ifdef CONFIG_PPC64
105cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r13
106else
Christophe Leroyc3ff2a52018-09-27 07:05:53 +0000107cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r2
Christophe Leroy06ec27ae2018-09-27 07:05:55 +0000108endif
Christophe Leroyc3ff2a52018-09-27 07:05:53 +0000109
Suzuki Poulose9c5f7d32011-12-14 22:58:12 +0000110LDFLAGS_vmlinux-y := -Bstatic
111LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
Fangrui Song03557852021-08-13 13:05:11 -0700112LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) += -z notext
Suzuki Poulose9c5f7d32011-12-14 22:58:12 +0000113LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000114
Rodrigo R. Galvaobadf4362018-08-06 13:42:03 -0300115ifdef CONFIG_PPC64
Nicholas Piggin77e69ee2023-04-08 12:17:52 +1000116ifndef CONFIG_PPC_KERNEL_PCREL
Anton Blanchard1fbe9cf2012-11-26 17:41:08 +0000117 # -mcmodel=medium breaks modules because it uses 32bit offsets from
118 # the TOC pointer to create pointers where possible. Pointers into the
119 # percpu data area are created by this method.
120 #
121 # The kernel module loader relocates the percpu data section from the
122 # original location (starting with 0xd...) to somewhere in the base
123 # kernel percpu data space (starting with 0xc...). We need a full
124 # 64bit relocation for this to work, hence -mcmodel=large.
125 KBUILD_CFLAGS_MODULE += -mcmodel=large
Anton Blanchard1fbe9cf2012-11-26 17:41:08 +0000126endif
Nicholas Piggin77e69ee2023-04-08 12:17:52 +1000127endif
Anton Blanchard1fbe9cf2012-11-26 17:41:08 +0000128
Anton Blancharda50a8622015-05-26 08:53:27 +1000129CFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no)
Christophe Leroy661aa882022-05-09 07:36:06 +0200130ifdef CONFIG_PPC64_ELF_ABI_V2
Anton Blanchard238abec2015-05-26 08:53:29 +1000131CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
Anton Blanchard721aeaa2014-03-10 21:06:12 +1100132else
Nathan Chancellor7c3bd832023-02-15 11:41:16 -0700133ifndef CONFIG_CC_IS_CLANG
Nicholas Piggin4dc831a2016-11-27 13:46:20 +1100134CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1)
Anton Blanchard238abec2015-05-26 08:53:29 +1000135CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc)
Anton Blanchard721aeaa2014-03-10 21:06:12 +1100136endif
Nathan Chancellor465bfd92019-11-18 21:57:10 -0700137endif
Naveen N Raoc330b502024-01-10 19:42:37 +0530138CFLAGS-$(CONFIG_PPC64) += -mcmodel=medium
Anton Blanchard98679fb2012-12-12 14:43:12 +0000139CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
Michael Ellerman78f09292023-04-04 20:28:47 +1000140CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mlong-double-128)
Segher Boessenkool51d42f02018-02-28 17:02:49 -0800141
Joel Stanley72e7bcc2018-11-12 15:58:06 +1030142# Clang unconditionally reserves r2 on ppc32 and does not support the flag
Nathan Chancellor2947a452024-01-09 15:16:31 -0700143# https://llvm.org/pr39555
Joel Stanley72e7bcc2018-11-12 15:58:06 +1030144CFLAGS-$(CONFIG_PPC32) := $(call cc-option, -ffixed-r2)
145
146# Clang doesn't support -mmultiple / -mno-multiple
Nathan Chancellor2947a452024-01-09 15:16:31 -0700147# https://llvm.org/pr39556
Joel Stanley72e7bcc2018-11-12 15:58:06 +1030148CFLAGS-$(CONFIG_PPC32) += $(call cc-option, $(MULTIPLEWORD))
149
Segher Boessenkool51d42f02018-02-28 17:02:49 -0800150CFLAGS-$(CONFIG_PPC32) += $(call cc-option,-mno-readonly-in-sdata)
Anton Blanchardd23c6fb2012-04-17 18:45:28 +0000151
Samuel Holland01db4732024-03-29 00:18:23 -0700152CC_FLAGS_FPU := $(call cc-option,-mhard-float)
153CC_FLAGS_NO_FPU := $(call cc-option,-msoft-float)
154
Nicholas Piggin2a056f52018-09-14 15:08:53 +1000155ifdef CONFIG_FUNCTION_TRACER
Naveen N Rao0f71dcf2023-06-19 15:17:34 +0530156ifdef CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY
157KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY
158CC_FLAGS_FTRACE := -fpatchable-function-entry=2
159else
Nicholas Piggin2a056f52018-09-14 15:08:53 +1000160CC_FLAGS_FTRACE := -pg
Torsten Duwe8c50b722016-03-03 15:27:00 +1100161ifdef CONFIG_MPROFILE_KERNEL
Nicholas Piggin2a056f52018-09-14 15:08:53 +1000162CC_FLAGS_FTRACE += -mprofile-kernel
163endif
Torsten Duwe8c50b722016-03-03 15:27:00 +1100164endif
Naveen N Rao0f71dcf2023-06-19 15:17:34 +0530165endif
Torsten Duwe8c50b722016-03-03 15:27:00 +1100166
Christophe Leroy45f70912023-01-25 08:38:59 +0100167CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU)
168AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU)
Anton Blanchardd23c6fb2012-04-17 18:45:28 +0000169
Michael Ellerman50832722023-03-30 10:43:08 +1100170CFLAGS-y += $(CONFIG_TUNE_CPU)
Scott Wood01718ba2013-08-20 19:55:36 -0500171
Guenter Roeck7998eb32014-05-15 09:33:42 -0700172asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
173
Michael Ellermandc420872023-12-06 22:55:45 +1100174KBUILD_CPPFLAGS += -I $(srctree)/arch/powerpc $(asinstr)
Masahiro Yamadab00899b2019-01-11 12:22:32 +0900175KBUILD_AFLAGS += $(AFLAGS-y)
Samuel Holland01db4732024-03-29 00:18:23 -0700176KBUILD_CFLAGS += $(CC_FLAGS_NO_FPU)
Nicholas Pigginf5df87b2023-06-06 16:48:30 +1000177KBUILD_CFLAGS += $(CFLAGS-y)
Sam Ravnborga0f97e02007-10-14 22:21:35 +0200178CPP = $(CC) -E $(KBUILD_CFLAGS)
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000179
Michael Ellerman68201fb2016-08-11 16:03:14 +1000180CHECKFLAGS += -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__
Daniel Axtens62c2c5c2016-07-12 10:54:51 +1000181ifdef CONFIG_CPU_BIG_ENDIAN
182CHECKFLAGS += -D__BIG_ENDIAN__
183else
Christophe Leroy5b894922022-05-09 07:36:08 +0200184CHECKFLAGS += -D__LITTLE_ENDIAN__
Daniel Axtens62c2c5c2016-07-12 10:54:51 +1000185endif
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000186
Rodrigo R. Galvaobadf4362018-08-06 13:42:03 -0300187ifdef CONFIG_476FPE_ERR46
Alistair Poppled5b35cf2014-02-24 18:00:56 +1100188 KBUILD_LDFLAGS_MODULE += --ppc476-workaround \
189 -T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds
190endif
191
Nicholas Piggin4b2a9312022-09-23 13:30:04 +1000192# No prefix or pcrel
Nicholas Piggindc5dac72023-04-08 12:17:49 +1000193ifdef CONFIG_PPC_KERNEL_PREFIXED
194KBUILD_CFLAGS += $(call cc-option,-mprefixed)
195else
Nicholas Piggin4b2a9312022-09-23 13:30:04 +1000196KBUILD_CFLAGS += $(call cc-option,-mno-prefixed)
Nicholas Piggindc5dac72023-04-08 12:17:49 +1000197endif
Nicholas Piggin7e3a68b2023-04-08 12:17:51 +1000198ifdef CONFIG_PPC_KERNEL_PCREL
199KBUILD_CFLAGS += $(call cc-option,-mpcrel)
200else
Nicholas Piggin4b2a9312022-09-23 13:30:04 +1000201KBUILD_CFLAGS += $(call cc-option,-mno-pcrel)
Nicholas Piggin7e3a68b2023-04-08 12:17:51 +1000202endif
Nicholas Piggin4b2a9312022-09-23 13:30:04 +1000203
204# No AltiVec or VSX or MMA instructions when building kernel
Sam Ravnborga0f97e02007-10-14 22:21:35 +0200205KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
Anton Blanchardd23c6fb2012-04-17 18:45:28 +0000206KBUILD_CFLAGS += $(call cc-option,-mno-vsx)
Nicholas Piggin4b2a9312022-09-23 13:30:04 +1000207KBUILD_CFLAGS += $(call cc-option,-mno-mma)
Paul Mackerrasd3f67fb2005-10-29 15:31:17 +1000208
Kumar Gala0197cd22007-10-18 16:53:19 -0500209# No SPE instruction when building kernel
Thiemo Seuferce400c02008-09-02 00:23:02 +1000210# (We use all available options to help semi-broken compilers)
Kumar Gala0197cd22007-10-18 16:53:19 -0500211KBUILD_CFLAGS += $(call cc-option,-mno-spe)
Thiemo Seuferce400c02008-09-02 00:23:02 +1000212KBUILD_CFLAGS += $(call cc-option,-mspe=no)
Kumar Gala0197cd22007-10-18 16:53:19 -0500213
Naveen N. Raoba963012020-03-05 20:05:30 +0530214# Don't emit .eh_frame since we have no use for it
215KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
216
Benjamin Herrenschmidt57647a42007-03-22 17:23:44 +1100217# Never use string load/store instructions as they are
218# often slow when they are implemented at all
Anton Blancharda50a8622015-05-26 08:53:27 +1000219KBUILD_CFLAGS += $(call cc-option,-mno-string)
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000220
Michael Ellerman164af592016-08-09 22:43:46 +1000221KBUILD_AFLAGS += $(aflags-y)
222KBUILD_CFLAGS += $(cflags-y)
223
Tom Rini135f0b12006-01-12 16:55:58 -0700224# Default to zImage, override when needed
Grant Likely254313332008-02-07 05:18:34 +1100225all: zImage
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000226
Sam Ravnborge32e78c2010-08-02 20:47:48 +0000227# With make 3.82 we cannot mix normal and wildcard targets
Anatolij Gustschinc686ecf2010-08-15 22:26:56 +0000228BOOT_TARGETS1 := zImage zImage.initrd uImage
Benjamin Herrenschmidt11eab2972011-12-01 19:35:08 +0000229BOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% uImage.%
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000230
Sam Ravnborge32e78c2010-08-02 20:47:48 +0000231PHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2)
Stephen Rothwellcabb55872005-09-30 16:16:52 +1000232
Michael Ellermandc420872023-12-06 22:55:45 +1100233boot := arch/powerpc/boot
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000234
Sam Ravnborge32e78c2010-08-02 20:47:48 +0000235$(BOOT_TARGETS1): vmlinux
Michael Ellerman1196d7a2016-11-21 21:14:33 +1100236 $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
Sam Ravnborge32e78c2010-08-02 20:47:48 +0000237$(BOOT_TARGETS2): vmlinux
Michael Ellerman1196d7a2016-11-21 21:14:33 +1100238 $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000239
Sam Ravnborge32e78c2010-08-02 20:47:48 +0000240
Michael Ellermand42c6d02020-02-19 11:04:34 +1100241PHONY += bootwrapper_install
Sam Ravnborge32e78c2010-08-02 20:47:48 +0000242bootwrapper_install:
Michael Ellerman1196d7a2016-11-21 21:14:33 +1100243 $(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
Sam Ravnborge32e78c2010-08-02 20:47:48 +0000244
Nicolas Saenz Juliennea400c282023-01-24 12:02:12 +0100245include $(srctree)/scripts/Makefile.defconf
Michael Ellerman22db99d2023-03-29 18:23:34 +1100246
Michael Ellerman22db99d2023-03-29 18:23:34 +1100247generated_configs += ppc64le_defconfig
Michael Ellerman2adc48a2015-09-23 15:40:35 +1000248ppc64le_defconfig:
249 $(call merge_into_defconfig,ppc64_defconfig,le)
250
Michael Ellerman22db99d2023-03-29 18:23:34 +1100251generated_configs += ppc64le_guest_defconfig
Satheesh Rajendran721c01b2018-11-15 12:19:50 +0530252ppc64le_guest_defconfig:
Michael Ellermanbac94962023-04-14 23:24:13 +1000253 $(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest)
Satheesh Rajendran721c01b2018-11-15 12:19:50 +0530254
Michael Ellerman22db99d2023-03-29 18:23:34 +1100255generated_configs += ppc64_guest_defconfig
Satheesh Rajendran721c01b2018-11-15 12:19:50 +0530256ppc64_guest_defconfig:
Michael Ellermanbac94962023-04-14 23:24:13 +1000257 $(call merge_into_defconfig,ppc64_defconfig,be guest kvm_guest)
Satheesh Rajendran721c01b2018-11-15 12:19:50 +0530258
Michael Ellerman596ddea2023-04-14 23:24:14 +1000259generated_configs += pseries_le_defconfig
260pseries_le_defconfig: ppc64le_guest_defconfig
261
Michael Ellerman9ecda932023-04-14 23:24:15 +1000262generated_configs += pseries_defconfig
263pseries_defconfig: ppc64le_guest_defconfig
264
Michael Ellerman22db99d2023-03-29 18:23:34 +1100265generated_configs += powernv_be_defconfig
Michael Ellerman3603c522017-07-24 22:50:45 +1000266powernv_be_defconfig:
267 $(call merge_into_defconfig,powernv_defconfig,be)
268
Michael Ellerman22db99d2023-03-29 18:23:34 +1100269generated_configs += mpc85xx_defconfig
Scott Wood44d54012015-07-29 18:14:04 -0500270mpc85xx_defconfig:
Michael Ellerman58b12eb2019-05-28 18:16:14 +1000271 $(call merge_into_defconfig,mpc85xx_base.config,\
Scott Wood44d54012015-07-29 18:14:04 -0500272 85xx-32bit 85xx-hw fsl-emb-nonhw)
273
Michael Ellerman22db99d2023-03-29 18:23:34 +1100274generated_configs += mpc85xx_smp_defconfig
Scott Wood44d54012015-07-29 18:14:04 -0500275mpc85xx_smp_defconfig:
Michael Ellerman58b12eb2019-05-28 18:16:14 +1000276 $(call merge_into_defconfig,mpc85xx_base.config,\
Scott Wood44d54012015-07-29 18:14:04 -0500277 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
278
Michael Ellerman22db99d2023-03-29 18:23:34 +1100279generated_configs += corenet32_smp_defconfig
Scott Wood44d54012015-07-29 18:14:04 -0500280corenet32_smp_defconfig:
Michael Ellerman58b12eb2019-05-28 18:16:14 +1000281 $(call merge_into_defconfig,corenet_base.config,\
Claudiu Manoile0b80f02016-09-22 18:04:12 +0300282 85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa)
Scott Wood44d54012015-07-29 18:14:04 -0500283
Michael Ellerman22db99d2023-03-29 18:23:34 +1100284generated_configs += corenet64_smp_defconfig
Scott Wood44d54012015-07-29 18:14:04 -0500285corenet64_smp_defconfig:
Michael Ellerman58b12eb2019-05-28 18:16:14 +1000286 $(call merge_into_defconfig,corenet_base.config,\
Claudiu Manoile0b80f02016-09-22 18:04:12 +0300287 85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa)
Scott Wood44d54012015-07-29 18:14:04 -0500288
Michael Ellerman22db99d2023-03-29 18:23:34 +1100289generated_configs += mpc86xx_defconfig
Alessio Igor Bogani43de32c2016-02-22 10:26:14 +0100290mpc86xx_defconfig:
Michael Ellerman58b12eb2019-05-28 18:16:14 +1000291 $(call merge_into_defconfig,mpc86xx_base.config,\
Alessio Igor Bogani43de32c2016-02-22 10:26:14 +0100292 86xx-hw fsl-emb-nonhw)
293
Michael Ellerman22db99d2023-03-29 18:23:34 +1100294generated_configs += mpc86xx_smp_defconfig
Alessio Igor Bogani43de32c2016-02-22 10:26:14 +0100295mpc86xx_smp_defconfig:
Michael Ellerman58b12eb2019-05-28 18:16:14 +1000296 $(call merge_into_defconfig,mpc86xx_base.config,\
Alessio Igor Bogani43de32c2016-02-22 10:26:14 +0100297 86xx-smp 86xx-hw fsl-emb-nonhw)
298
Michael Ellerman22db99d2023-03-29 18:23:34 +1100299generated_configs += ppc32_allmodconfig
Michael Ellerman8db0c9d2018-07-10 00:24:25 +1000300ppc32_allmodconfig:
301 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \
302 -f $(srctree)/Makefile allmodconfig
303
Michael Ellermanaf1ebca2024-02-29 22:41:08 +1100304generated_configs += ppc40x_allmodconfig
305ppc40x_allmodconfig:
306 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/40x.config \
307 -f $(srctree)/Makefile allmodconfig
308
309generated_configs += ppc44x_allmodconfig
310ppc44x_allmodconfig:
311 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/44x.config \
312 -f $(srctree)/Makefile allmodconfig
313
314generated_configs += ppc8xx_allmodconfig
315ppc8xx_allmodconfig:
316 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/8xx.config \
317 -f $(srctree)/Makefile allmodconfig
318
319generated_configs += ppc85xx_allmodconfig
320ppc85xx_allmodconfig:
321 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-32bit.config \
322 -f $(srctree)/Makefile allmodconfig
323
Michael Ellerman22db99d2023-03-29 18:23:34 +1100324generated_configs += ppc_defconfig
Michael Ellermana273fa32019-02-07 16:16:51 +1100325ppc_defconfig:
326 $(call merge_into_defconfig,book3s_32.config,)
327
Michael Ellerman22db99d2023-03-29 18:23:34 +1100328generated_configs += ppc64le_allmodconfig
Michael Ellerman64de5d82018-07-10 00:24:26 +1000329ppc64le_allmodconfig:
330 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/le.config \
331 -f $(srctree)/Makefile allmodconfig
332
Michael Ellerman22db99d2023-03-29 18:23:34 +1100333generated_configs += ppc64le_allnoconfig
Michael Ellerman5d8234472020-11-25 14:15:51 +1100334ppc64le_allnoconfig:
335 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/ppc64le.config \
336 -f $(srctree)/Makefile allnoconfig
337
Michael Ellerman22db99d2023-03-29 18:23:34 +1100338generated_configs += ppc64_book3e_allmodconfig
Michael Ellerman64de5d82018-07-10 00:24:26 +1000339ppc64_book3e_allmodconfig:
340 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-64bit.config \
341 -f $(srctree)/Makefile allmodconfig
342
Michael Ellerman22db99d2023-03-29 18:23:34 +1100343generated_configs += ppc32_randconfig
Michael Ellermanf259fb82021-04-28 23:27:00 +1000344ppc32_randconfig:
345 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/32-bit.config \
346 -f $(srctree)/Makefile randconfig
347
Michael Ellerman22db99d2023-03-29 18:23:34 +1100348generated_configs += ppc64_randconfig
Michael Ellermanf259fb82021-04-28 23:27:00 +1000349ppc64_randconfig:
350 $(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/64-bit.config \
351 -f $(srctree)/Makefile randconfig
352
Michael Ellerman22db99d2023-03-29 18:23:34 +1100353PHONY += $(generated_configs)
354
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000355define archhelp
Michael Ellerman228c7a92023-03-29 18:23:33 +1100356 echo '* zImage - Build default images selected by kernel config'
Michael Ellermandc420872023-12-06 22:55:45 +1100357 echo ' zImage.* - Compressed kernel image (arch/powerpc/boot/zImage.*)'
Michael Ellerman228c7a92023-03-29 18:23:33 +1100358 echo ' uImage - U-Boot native image format'
359 echo ' cuImage.<dt> - Backwards compatible U-Boot image for older'
360 echo ' versions which do not support device trees'
361 echo ' dtbImage.<dt> - zImage with an embedded device tree blob'
362 echo ' simpleImage.<dt> - Firmware independent image.'
363 echo ' treeImage.<dt> - Support for older IBM 4xx firmware (not U-Boot)'
364 echo ' install - Install kernel using'
365 echo ' (your) ~/bin/$(INSTALLKERNEL) or'
366 echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
367 echo ' install to $$(INSTALL_PATH) and run lilo'
Michael Ellermandc420872023-12-06 22:55:45 +1100368 echo ' *_defconfig - Select default config from arch/powerpc/configs'
Michael Ellerman228c7a92023-03-29 18:23:33 +1100369 echo ''
370 echo ' Targets with <dt> embed a device tree blob inside the image'
371 echo ' These targets support board with firmware that does not'
372 echo ' support passing a device tree directly. Replace <dt> with the'
Michael Ellermandc420872023-12-06 22:55:45 +1100373 echo ' name of a dts file from the arch/powerpc/boot/dts/ directory'
Michael Ellerman228c7a92023-03-29 18:23:33 +1100374 echo ' (minus the .dts extension).'
Michael Ellerman22db99d2023-03-29 18:23:34 +1100375 echo
376 $(foreach cfg,$(generated_configs),
377 printf " %-27s - Build for %s\\n" $(cfg) $(subst _defconfig,,$(cfg));)
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000378endef
379
Michael Ellermand42c6d02020-02-19 11:04:34 +1100380PHONY += install
Sam Ravnborg3f85d632008-02-16 12:36:10 +0100381install:
Masahiro Yamadaf774f5b2022-05-03 11:47:16 +0900382 $(call cmd,install)
Akinobu Mita928370c2007-04-10 21:05:31 +1000383
Christophe Leroy91bf6952020-09-27 09:16:33 +0000384ifeq ($(KBUILD_EXTMOD),)
385# We need to generate vdso-offsets.h before compiling certain files in kernel/.
386# In order to do that, we should use the archprepare target, but we can't since
387# asm-offsets.h is included in some files used to generate vdso-offsets.h, and
388# asm-offsets.h is built in prepare0, for which archprepare is a dependency.
389# Therefore we need to generate the header after prepare0 has been made, hence
390# this hack.
391prepare: vdso_prepare
392vdso_prepare: prepare0
393 $(if $(CONFIG_VDSO32),$(Q)$(MAKE) \
Christophe Leroyfd1feade2022-01-21 16:30:27 +0000394 $(build)=arch/powerpc/kernel/vdso include/generated/vdso32-offsets.h)
Christophe Leroy91bf6952020-09-27 09:16:33 +0000395 $(if $(CONFIG_PPC64),$(Q)$(MAKE) \
Christophe Leroyfd1feade2022-01-21 16:30:27 +0000396 $(build)=arch/powerpc/kernel/vdso include/generated/vdso64-offsets.h)
Christophe Leroy91bf6952020-09-27 09:16:33 +0000397endif
398
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000399archprepare: checkbin
400
Firoz Khanab66dcc2018-12-17 16:10:36 +0530401archheaders:
402 $(Q)$(MAKE) $(build)=arch/powerpc/kernel/syscalls all
403
Christophe Leroyc3ff2a52018-09-27 07:05:53 +0000404ifdef CONFIG_STACKPROTECTOR
405prepare: stack_protector_prepare
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000406
Michael Ellermand42c6d02020-02-19 11:04:34 +1100407PHONY += stack_protector_prepare
Christophe Leroyc3ff2a52018-09-27 07:05:53 +0000408stack_protector_prepare: prepare0
Christophe Leroy06ec27ae2018-09-27 07:05:55 +0000409ifdef CONFIG_PPC64
410 $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h))
411else
Christophe Leroyc3ff2a52018-09-27 07:05:53 +0000412 $(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h))
413endif
Christophe Leroy06ec27ae2018-09-27 07:05:55 +0000414endif
Christophe Leroyc3ff2a52018-09-27 07:05:53 +0000415
Michael Ellermand42c6d02020-02-19 11:04:34 +1100416PHONY += checkbin
Paul Mackerras14cf11a2005-09-26 16:04:21 +1000417checkbin:
Naveen N Rao25ea7392023-05-30 11:44:36 +0530418 @if test "x${CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT}" = "xy" -a \
419 "x${CONFIG_LD_IS_BFD}" = "xy" -a \
420 "${CONFIG_LD_VERSION}" = "23700" ; then \
421 echo -n '*** binutils 2.37 drops unused section symbols, which recordmcount ' ; \
422 echo 'is unable to handle.' ; \
423 echo '*** Please use a different binutils version.' ; \
424 false ; \
425 fi