2005-09-25 23:04:21 -07:00
|
|
|
# This file is included by the global makefile so that you can add your own
|
2021-10-12 23:36:22 -07:00
|
|
|
# architecture-specific flags and dependencies.
|
2005-09-25 23:04:21 -07:00
|
|
|
#
|
|
|
|
# This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
# License. See the file "COPYING" in the main directory of this archive
|
|
|
|
# for more details.
|
|
|
|
#
|
|
|
|
# Copyright (C) 1994 by Linus Torvalds
|
|
|
|
# Changes for PPC by Gary Thomas
|
|
|
|
# Rewritten by Cort Dougan and Paul Mackerras
|
|
|
|
#
|
|
|
|
|
2023-12-06 04:55:48 -07:00
|
|
|
ifdef cross_compiling
|
|
|
|
ifeq ($(CROSS_COMPILE),)
|
|
|
|
# Auto detect cross compiler prefix.
|
|
|
|
# Look for: (powerpc(64(le)?)?)(-unknown)?-linux(-gnu)?-
|
|
|
|
CC_ARCHES := powerpc powerpc64 powerpc64le
|
|
|
|
CC_SUFFIXES := linux linux-gnu unknown-linux-gnu
|
|
|
|
CROSS_COMPILE := $(call cc-cross-prefix, $(foreach a,$(CC_ARCHES), \
|
|
|
|
$(foreach s,$(CC_SUFFIXES),$(a)-$(s)-)))
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2005-09-25 23:04:21 -07:00
|
|
|
HAS_BIARCH := $(call cc-option-yn, -m32)
|
|
|
|
|
|
|
|
# Set default 32 bits cross compilers for vdso and boot wrapper
|
|
|
|
CROSS32_COMPILE ?=
|
|
|
|
|
2019-02-06 22:16:52 -07:00
|
|
|
# If we're on a ppc/ppc64/ppc64le machine use that defconfig, otherwise just use
|
2023-12-06 04:55:47 -07:00
|
|
|
# ppc64le_defconfig because we have nothing better to go on.
|
2019-02-06 22:16:52 -07:00
|
|
|
uname := $(shell uname -m)
|
2023-12-06 04:55:47 -07:00
|
|
|
KBUILD_DEFCONFIG := $(if $(filter ppc%,$(uname)),$(uname),ppc64le)_defconfig
|
2005-11-17 22:39:08 -07:00
|
|
|
|
2005-09-25 23:04:21 -07:00
|
|
|
new_nm := $(shell if $(NM) --help 2>&1 | grep -- '--synthetic' > /dev/null; then echo y; else echo n; fi)
|
|
|
|
|
|
|
|
ifeq ($(new_nm),y)
|
|
|
|
NM := $(NM) --synthetic
|
|
|
|
endif
|
|
|
|
|
2016-08-10 23:03:14 -07:00
|
|
|
# BITS is used as extension for files which are available in a 32 bit
|
|
|
|
# and a 64 bit version to simplify shared Makefiles.
|
|
|
|
# e.g.: obj-y += foo_$(BITS).o
|
|
|
|
export BITS
|
|
|
|
|
|
|
|
ifdef CONFIG_PPC64
|
|
|
|
BITS := 64
|
|
|
|
else
|
|
|
|
BITS := 32
|
2005-09-25 23:04:21 -07:00
|
|
|
endif
|
|
|
|
|
2016-08-10 23:03:15 -07:00
|
|
|
machine-y = ppc
|
|
|
|
machine-$(CONFIG_PPC64) += 64
|
|
|
|
machine-$(CONFIG_CPU_LITTLE_ENDIAN) += le
|
|
|
|
UTS_MACHINE := $(subst $(space),,$(machine-y))
|
2005-10-12 23:14:15 -07:00
|
|
|
|
2023-01-19 01:22:50 -07:00
|
|
|
ifeq ($(CONFIG_PPC64)$(CONFIG_LD_IS_BFD),yy)
|
2017-07-25 22:00:42 -07:00
|
|
|
# Have the linker provide sfpr if possible.
|
|
|
|
# There is a corresponding test in arch/powerpc/lib/Makefile
|
|
|
|
KBUILD_LDFLAGS_MODULE += --save-restore-funcs
|
|
|
|
else
|
|
|
|
KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
|
|
|
|
endif
|
|
|
|
|
2018-08-06 09:42:03 -07:00
|
|
|
ifdef CONFIG_CPU_LITTLE_ENDIAN
|
2018-05-30 05:19:21 -07:00
|
|
|
KBUILD_CFLAGS += -mlittle-endian
|
2018-08-23 16:20:39 -07:00
|
|
|
KBUILD_LDFLAGS += -EL
|
2013-09-22 19:05:11 -07:00
|
|
|
LDEMULATION := lppc
|
|
|
|
GNUTARGET := powerpcle
|
|
|
|
MULTIPLEWORD := -mno-multiple
|
2014-03-11 21:12:01 -07:00
|
|
|
KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-save-toc-indirect)
|
2013-09-22 19:05:11 -07:00
|
|
|
else
|
2018-05-30 05:19:21 -07:00
|
|
|
KBUILD_CFLAGS += $(call cc-option,-mbig-endian)
|
2018-08-23 16:20:39 -07:00
|
|
|
KBUILD_LDFLAGS += -EB
|
2013-09-22 19:05:11 -07:00
|
|
|
LDEMULATION := ppc
|
|
|
|
GNUTARGET := powerpc
|
|
|
|
MULTIPLEWORD := -mmultiple
|
|
|
|
endif
|
|
|
|
|
2016-11-26 19:46:20 -07:00
|
|
|
ifdef CONFIG_PPC64
|
2019-11-18 21:57:10 -07:00
|
|
|
ifndef CONFIG_CC_IS_CLANG
|
2022-05-08 22:36:06 -07:00
|
|
|
cflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mabi=elfv1)
|
|
|
|
cflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mcall-aixdesc)
|
|
|
|
aflags-$(CONFIG_PPC64_ELF_ABI_V1) += $(call cc-option,-mabi=elfv1)
|
|
|
|
aflags-$(CONFIG_PPC64_ELF_ABI_V2) += -mabi=elfv2
|
2016-11-26 19:46:20 -07:00
|
|
|
endif
|
2019-11-18 21:57:10 -07:00
|
|
|
endif
|
2016-11-26 19:46:20 -07:00
|
|
|
|
2018-10-30 06:26:33 -07:00
|
|
|
ifndef CONFIG_CC_IS_CLANG
|
2016-08-09 05:43:46 -07:00
|
|
|
cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mno-strict-align
|
|
|
|
endif
|
|
|
|
|
2018-05-30 05:19:21 -07:00
|
|
|
cflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian)
|
|
|
|
cflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
|
2016-08-09 05:43:46 -07:00
|
|
|
aflags-$(CONFIG_CPU_BIG_ENDIAN) += $(call cc-option,-mbig-endian)
|
|
|
|
aflags-$(CONFIG_CPU_LITTLE_ENDIAN) += -mlittle-endian
|
|
|
|
|
2005-09-25 23:04:21 -07:00
|
|
|
ifeq ($(HAS_BIARCH),y)
|
2018-05-30 05:19:21 -07:00
|
|
|
KBUILD_CFLAGS += -m$(BITS)
|
2023-01-11 20:05:02 -07:00
|
|
|
KBUILD_AFLAGS += -m$(BITS)
|
2018-08-23 16:20:39 -07:00
|
|
|
KBUILD_LDFLAGS += -m elf$(BITS)$(LDEMULATION)
|
2005-09-25 23:04:21 -07:00
|
|
|
endif
|
|
|
|
|
2018-09-27 00:05:53 -07:00
|
|
|
cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard=tls
|
2018-09-27 00:05:55 -07:00
|
|
|
ifdef CONFIG_PPC64
|
|
|
|
cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r13
|
|
|
|
else
|
2018-09-27 00:05:53 -07:00
|
|
|
cflags-$(CONFIG_STACKPROTECTOR) += -mstack-protector-guard-reg=r2
|
2018-09-27 00:05:55 -07:00
|
|
|
endif
|
2018-09-27 00:05:53 -07:00
|
|
|
|
2011-12-14 15:58:12 -07:00
|
|
|
LDFLAGS_vmlinux-y := -Bstatic
|
|
|
|
LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) := -pie
|
2021-08-13 13:05:11 -07:00
|
|
|
LDFLAGS_vmlinux-$(CONFIG_RELOCATABLE) += -z notext
|
2011-12-14 15:58:12 -07:00
|
|
|
LDFLAGS_vmlinux := $(LDFLAGS_vmlinux-y)
|
2005-09-25 23:04:21 -07:00
|
|
|
|
2018-08-06 09:42:03 -07:00
|
|
|
ifdef CONFIG_PPC64
|
2023-04-07 19:17:52 -07:00
|
|
|
ifndef CONFIG_PPC_KERNEL_PCREL
|
2012-11-26 10:41:08 -07:00
|
|
|
ifeq ($(call cc-option-yn,-mcmodel=medium),y)
|
|
|
|
# -mcmodel=medium breaks modules because it uses 32bit offsets from
|
|
|
|
# the TOC pointer to create pointers where possible. Pointers into the
|
|
|
|
# percpu data area are created by this method.
|
|
|
|
#
|
|
|
|
# The kernel module loader relocates the percpu data section from the
|
|
|
|
# original location (starting with 0xd...) to somewhere in the base
|
|
|
|
# kernel percpu data space (starting with 0xc...). We need a full
|
|
|
|
# 64bit relocation for this to work, hence -mcmodel=large.
|
|
|
|
KBUILD_CFLAGS_MODULE += -mcmodel=large
|
|
|
|
else
|
|
|
|
export NO_MINIMAL_TOC := -mno-minimal-toc
|
|
|
|
endif
|
|
|
|
endif
|
2023-04-07 19:17:52 -07:00
|
|
|
endif
|
2012-11-26 10:41:08 -07:00
|
|
|
|
2015-05-25 15:53:27 -07:00
|
|
|
CFLAGS-$(CONFIG_PPC64) := $(call cc-option,-mtraceback=no)
|
2022-05-08 22:36:06 -07:00
|
|
|
ifdef CONFIG_PPC64_ELF_ABI_V2
|
2015-05-25 15:53:29 -07:00
|
|
|
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv2,$(call cc-option,-mcall-aixdesc))
|
2014-03-10 03:06:12 -07:00
|
|
|
else
|
2023-02-15 11:41:16 -07:00
|
|
|
ifndef CONFIG_CC_IS_CLANG
|
2016-11-26 19:46:20 -07:00
|
|
|
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mabi=elfv1)
|
2015-05-25 15:53:29 -07:00
|
|
|
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcall-aixdesc)
|
2014-03-10 03:06:12 -07:00
|
|
|
endif
|
2019-11-18 21:57:10 -07:00
|
|
|
endif
|
2015-05-25 15:53:29 -07:00
|
|
|
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,$(call cc-option,-mminimal-toc))
|
2012-12-12 07:43:12 -07:00
|
|
|
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
|
powerpc/64: Always build with 128-bit long double
The amdgpu driver builds some of its code with hard-float enabled,
whereas the rest of the kernel is built with soft-float.
When building with 64-bit long double, if soft-float and hard-float
objects are linked together, the build fails due to incompatible ABI
tags.
In the past there have been build errors in the amdgpu driver caused by
this, some of those were due to bad intermingling of soft & hard-float
code, but those issues have now all been fixed since commit 58ddbecb14c7
("drm/amd/display: move remaining FPU code to dml folder").
However it's still possible for soft & hard-float objects to end up
linked together, if the amdgpu driver is built-in to the kernel along
with the test_emulate_step.c code, which uses soft-float. That happens
in an allyesconfig build.
Currently those build errors are avoided because the amdgpu driver is
gated on 128-bit long double being enabled. But that's not a detail the
amdgpu driver should need to be aware of, and if another driver starts
using hard-float the same problem would occur.
All versions of the 64-bit ABI specify that long-double is 128-bits.
However some compilers, notably the kernel.org ones, are built to use
64-bit long double by default.
Apart from this issue of soft vs hard-float, the kernel doesn't care
what size long double is. In particular the kernel using 128-bit long
double doesn't impact userspace's ability to use 64-bit long double, as
musl does.
So always build the 64-bit kernel with 128-bit long double. That should
avoid any build errors due to the incompatible ABI tags. Excluding the
code that uses soft/hard-float, the vmlinux is identical with/without
the flag.
It does mean any code which is incorrectly intermingling soft &
hard-float code will build without error, so those bugs will need to be
caught by testing rather than at build time.
For more background see:
- commit d11219ad53dc ("amdgpu: disable powerpc support for the newer display engine")
- commit c653c591789b ("drm/amdgpu: Re-enable DCN for 64-bit powerpc")
- https://lore.kernel.org/r/dab9cbd8-2626-4b99-8098-31fe76397d2d@app.fastmail.com
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Reviewed-by: Segher Boessenkool <segher@kernel.crashing.org>
Link: https://msgid.link/20230404102847.3303623-1-mpe@ellerman.id.au
2023-04-04 03:28:47 -07:00
|
|
|
CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mlong-double-128)
|
2018-02-28 18:02:49 -07:00
|
|
|
|
2018-11-11 22:28:06 -07:00
|
|
|
# Clang unconditionally reserves r2 on ppc32 and does not support the flag
|
2024-01-09 15:16:31 -07:00
|
|
|
# https://llvm.org/pr39555
|
2018-11-11 22:28:06 -07:00
|
|
|
CFLAGS-$(CONFIG_PPC32) := $(call cc-option, -ffixed-r2)
|
|
|
|
|
|
|
|
# Clang doesn't support -mmultiple / -mno-multiple
|
2024-01-09 15:16:31 -07:00
|
|
|
# https://llvm.org/pr39556
|
2018-11-11 22:28:06 -07:00
|
|
|
CFLAGS-$(CONFIG_PPC32) += $(call cc-option, $(MULTIPLEWORD))
|
|
|
|
|
2018-02-28 18:02:49 -07:00
|
|
|
CFLAGS-$(CONFIG_PPC32) += $(call cc-option,-mno-readonly-in-sdata)
|
2012-04-17 11:45:28 -07:00
|
|
|
|
2018-09-13 22:08:53 -07:00
|
|
|
ifdef CONFIG_FUNCTION_TRACER
|
2023-06-19 02:47:34 -07:00
|
|
|
ifdef CONFIG_ARCH_USING_PATCHABLE_FUNCTION_ENTRY
|
|
|
|
KBUILD_CPPFLAGS += -DCC_USING_PATCHABLE_FUNCTION_ENTRY
|
|
|
|
CC_FLAGS_FTRACE := -fpatchable-function-entry=2
|
|
|
|
else
|
2018-09-13 22:08:53 -07:00
|
|
|
CC_FLAGS_FTRACE := -pg
|
2016-03-02 21:27:00 -07:00
|
|
|
ifdef CONFIG_MPROFILE_KERNEL
|
2018-09-13 22:08:53 -07:00
|
|
|
CC_FLAGS_FTRACE += -mprofile-kernel
|
|
|
|
endif
|
2016-03-02 21:27:00 -07:00
|
|
|
endif
|
2023-06-19 02:47:34 -07:00
|
|
|
endif
|
2016-03-02 21:27:00 -07:00
|
|
|
|
powerpc/64: Set default CPU in Kconfig
Since commit 0069f3d14e7a ("powerpc/64e: Tie PPC_BOOK3E_64 to
PPC_E500MC"), the only possible BOOK3E/64 are E500, so no need of a
default CPU over the E5500.
When the user selects book3e, they must have an e500 compatible
compiler, and it won't work anymore with the default -mcpu=power64, see
commit d6b551b8f90c ("powerpc/64e: Fix build failure with GCC
12 (unrecognized opcode: `wrteei')").
For book3s/64, replace GENERIC_CPU by POWERPC64_CPU to match the PPC32
POWERPC_CPU, and set a default mpcu value in Kconfig directly.
When a user selects a particular CPU, they must ensure the compiler has
the requested capability. Therefore, remove hidden fallback, instead
offer user the possibility to say they want to use the toolchain
default.
Fixes: d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12 (unrecognized opcode: `wrteei')")
Reported-by: Pali Rohár <pali@kernel.org>
Tested-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/76c11197b058193dcb8e8b26adffba09cfbdab11.1674632329.git.christophe.leroy@csgroup.eu
2023-01-25 00:38:59 -07:00
|
|
|
CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU)
|
|
|
|
AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU)
|
2012-04-17 11:45:28 -07:00
|
|
|
|
2023-03-29 16:43:08 -07:00
|
|
|
CFLAGS-y += $(CONFIG_TUNE_CPU)
|
2013-08-20 17:55:36 -07:00
|
|
|
|
2014-05-15 09:33:42 -07:00
|
|
|
asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
|
|
|
|
|
2023-12-06 04:55:45 -07:00
|
|
|
KBUILD_CPPFLAGS += -I $(srctree)/arch/powerpc $(asinstr)
|
2019-01-10 20:22:32 -07:00
|
|
|
KBUILD_AFLAGS += $(AFLAGS-y)
|
2015-05-25 15:53:27 -07:00
|
|
|
KBUILD_CFLAGS += $(call cc-option,-msoft-float)
|
2023-06-05 23:48:30 -07:00
|
|
|
KBUILD_CFLAGS += $(CFLAGS-y)
|
2007-10-14 13:21:35 -07:00
|
|
|
CPP = $(CC) -E $(KBUILD_CFLAGS)
|
2005-09-25 23:04:21 -07:00
|
|
|
|
2016-08-10 23:03:14 -07:00
|
|
|
CHECKFLAGS += -m$(BITS) -D__powerpc__ -D__powerpc$(BITS)__
|
2016-07-11 17:54:51 -07:00
|
|
|
ifdef CONFIG_CPU_BIG_ENDIAN
|
|
|
|
CHECKFLAGS += -D__BIG_ENDIAN__
|
|
|
|
else
|
2022-05-08 22:36:08 -07:00
|
|
|
CHECKFLAGS += -D__LITTLE_ENDIAN__
|
2016-07-11 17:54:51 -07:00
|
|
|
endif
|
2005-09-25 23:04:21 -07:00
|
|
|
|
2018-08-06 09:42:03 -07:00
|
|
|
ifdef CONFIG_476FPE_ERR46
|
2014-02-24 00:00:56 -07:00
|
|
|
KBUILD_LDFLAGS_MODULE += --ppc476-workaround \
|
|
|
|
-T $(srctree)/arch/powerpc/platforms/44x/ppc476_modules.lds
|
|
|
|
endif
|
|
|
|
|
2022-09-22 20:30:04 -07:00
|
|
|
# No prefix or pcrel
|
2023-04-07 19:17:49 -07:00
|
|
|
ifdef CONFIG_PPC_KERNEL_PREFIXED
|
|
|
|
KBUILD_CFLAGS += $(call cc-option,-mprefixed)
|
|
|
|
else
|
2022-09-22 20:30:04 -07:00
|
|
|
KBUILD_CFLAGS += $(call cc-option,-mno-prefixed)
|
2023-04-07 19:17:49 -07:00
|
|
|
endif
|
2023-04-07 19:17:51 -07:00
|
|
|
ifdef CONFIG_PPC_KERNEL_PCREL
|
|
|
|
KBUILD_CFLAGS += $(call cc-option,-mpcrel)
|
|
|
|
else
|
2022-09-22 20:30:04 -07:00
|
|
|
KBUILD_CFLAGS += $(call cc-option,-mno-pcrel)
|
2023-04-07 19:17:51 -07:00
|
|
|
endif
|
2022-09-22 20:30:04 -07:00
|
|
|
|
|
|
|
# No AltiVec or VSX or MMA instructions when building kernel
|
2007-10-14 13:21:35 -07:00
|
|
|
KBUILD_CFLAGS += $(call cc-option,-mno-altivec)
|
2012-04-17 11:45:28 -07:00
|
|
|
KBUILD_CFLAGS += $(call cc-option,-mno-vsx)
|
2022-09-22 20:30:04 -07:00
|
|
|
KBUILD_CFLAGS += $(call cc-option,-mno-mma)
|
2005-10-28 22:31:17 -07:00
|
|
|
|
2007-10-18 14:53:19 -07:00
|
|
|
# No SPE instruction when building kernel
|
2008-09-01 07:23:02 -07:00
|
|
|
# (We use all available options to help semi-broken compilers)
|
2007-10-18 14:53:19 -07:00
|
|
|
KBUILD_CFLAGS += $(call cc-option,-mno-spe)
|
2008-09-01 07:23:02 -07:00
|
|
|
KBUILD_CFLAGS += $(call cc-option,-mspe=no)
|
2007-10-18 14:53:19 -07:00
|
|
|
|
2020-03-05 07:35:30 -07:00
|
|
|
# Don't emit .eh_frame since we have no use for it
|
|
|
|
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
|
|
|
|
|
2007-03-21 23:23:44 -07:00
|
|
|
# Never use string load/store instructions as they are
|
|
|
|
# often slow when they are implemented at all
|
2015-05-25 15:53:27 -07:00
|
|
|
KBUILD_CFLAGS += $(call cc-option,-mno-string)
|
2005-09-25 23:04:21 -07:00
|
|
|
|
2016-08-09 05:43:46 -07:00
|
|
|
KBUILD_AFLAGS += $(aflags-y)
|
|
|
|
KBUILD_CFLAGS += $(cflags-y)
|
|
|
|
|
2006-01-12 16:55:58 -07:00
|
|
|
# Default to zImage, override when needed
|
2008-02-06 11:18:34 -07:00
|
|
|
all: zImage
|
2005-09-25 23:04:21 -07:00
|
|
|
|
2010-08-02 13:47:48 -07:00
|
|
|
# With make 3.82 we cannot mix normal and wildcard targets
|
2010-08-15 15:26:56 -07:00
|
|
|
BOOT_TARGETS1 := zImage zImage.initrd uImage
|
2011-12-01 12:35:08 -07:00
|
|
|
BOOT_TARGETS2 := zImage% dtbImage% treeImage.% cuImage.% simpleImage.% uImage.%
|
2005-09-29 23:16:52 -07:00
|
|
|
|
2010-08-02 13:47:48 -07:00
|
|
|
PHONY += $(BOOT_TARGETS1) $(BOOT_TARGETS2)
|
2005-09-29 23:16:52 -07:00
|
|
|
|
2023-12-06 04:55:45 -07:00
|
|
|
boot := arch/powerpc/boot
|
2005-09-25 23:04:21 -07:00
|
|
|
|
2010-08-02 13:47:48 -07:00
|
|
|
$(BOOT_TARGETS1): vmlinux
|
powerpc: Stop passing ARCH=ppc64 to boot Makefile
Back in 2005 when the ppc/ppc64 merge started, we used to build the
kernel code in arch/powerpc but use the boot code from arch/ppc or
arch/ppc64 depending on whether we were building for 32 or 64-bit.
Originally we called the boot Makefile passing ARCH=$(OLDARCH), where
OLDARCH was ppc or ppc64.
In commit 20f629549b30 ("powerpc: Make building the boot image work for
both 32-bit and 64-bit") (2005-10-11) we split the call for 32/64-bit
using an ifeq check, because the two Makefiles took different targets,
and explicitly passed ARCH=ppc64 for the 64-bit case and ARCH=ppc for
the 32-bit case.
Then in commit 94b212c29f68 ("powerpc: Move ppc64 boot wrapper code over
to arch/powerpc") (2005-11-16) we moved the boot code into arch/powerpc
and dropped the ppc case, but kept passing ARCH=ppc64 to
arch/powerpc/boot/Makefile.
Since then there have been several more boot targets added, all of which
have copied the ARCH=ppc64 setting, such that now we have four targets
using it.
Currently it seems that nothing actually uses the ARCH value, but that's
basically just luck, and in particular it prevents us from using the
generic cpp_lds_S rule. It's also clearly wrong, ARCH=ppc64 is dead,
buried and cremated.
Fix it by dropping the setting of ARCH completely, the correct value is
exported by the top level Makefile.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-21 03:14:33 -07:00
|
|
|
$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
|
2010-08-02 13:47:48 -07:00
|
|
|
$(BOOT_TARGETS2): vmlinux
|
powerpc: Stop passing ARCH=ppc64 to boot Makefile
Back in 2005 when the ppc/ppc64 merge started, we used to build the
kernel code in arch/powerpc but use the boot code from arch/ppc or
arch/ppc64 depending on whether we were building for 32 or 64-bit.
Originally we called the boot Makefile passing ARCH=$(OLDARCH), where
OLDARCH was ppc or ppc64.
In commit 20f629549b30 ("powerpc: Make building the boot image work for
both 32-bit and 64-bit") (2005-10-11) we split the call for 32/64-bit
using an ifeq check, because the two Makefiles took different targets,
and explicitly passed ARCH=ppc64 for the 64-bit case and ARCH=ppc for
the 32-bit case.
Then in commit 94b212c29f68 ("powerpc: Move ppc64 boot wrapper code over
to arch/powerpc") (2005-11-16) we moved the boot code into arch/powerpc
and dropped the ppc case, but kept passing ARCH=ppc64 to
arch/powerpc/boot/Makefile.
Since then there have been several more boot targets added, all of which
have copied the ARCH=ppc64 setting, such that now we have four targets
using it.
Currently it seems that nothing actually uses the ARCH value, but that's
basically just luck, and in particular it prevents us from using the
generic cpp_lds_S rule. It's also clearly wrong, ARCH=ppc64 is dead,
buried and cremated.
Fix it by dropping the setting of ARCH completely, the correct value is
exported by the top level Makefile.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-21 03:14:33 -07:00
|
|
|
$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
|
2010-08-02 13:47:48 -07:00
|
|
|
|
|
|
|
|
2020-02-18 17:04:34 -07:00
|
|
|
PHONY += bootwrapper_install
|
2010-08-02 13:47:48 -07:00
|
|
|
bootwrapper_install:
|
powerpc: Stop passing ARCH=ppc64 to boot Makefile
Back in 2005 when the ppc/ppc64 merge started, we used to build the
kernel code in arch/powerpc but use the boot code from arch/ppc or
arch/ppc64 depending on whether we were building for 32 or 64-bit.
Originally we called the boot Makefile passing ARCH=$(OLDARCH), where
OLDARCH was ppc or ppc64.
In commit 20f629549b30 ("powerpc: Make building the boot image work for
both 32-bit and 64-bit") (2005-10-11) we split the call for 32/64-bit
using an ifeq check, because the two Makefiles took different targets,
and explicitly passed ARCH=ppc64 for the 64-bit case and ARCH=ppc for
the 32-bit case.
Then in commit 94b212c29f68 ("powerpc: Move ppc64 boot wrapper code over
to arch/powerpc") (2005-11-16) we moved the boot code into arch/powerpc
and dropped the ppc case, but kept passing ARCH=ppc64 to
arch/powerpc/boot/Makefile.
Since then there have been several more boot targets added, all of which
have copied the ARCH=ppc64 setting, such that now we have four targets
using it.
Currently it seems that nothing actually uses the ARCH value, but that's
basically just luck, and in particular it prevents us from using the
generic cpp_lds_S rule. It's also clearly wrong, ARCH=ppc64 is dead,
buried and cremated.
Fix it by dropping the setting of ARCH completely, the correct value is
exported by the top level Makefile.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
2016-11-21 03:14:33 -07:00
|
|
|
$(Q)$(MAKE) $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
|
2007-12-02 19:56:58 -07:00
|
|
|
|
2023-01-24 04:02:12 -07:00
|
|
|
include $(srctree)/scripts/Makefile.defconf
|
2023-03-29 00:23:34 -07:00
|
|
|
|
|
|
|
generated_configs += ppc64le_defconfig
|
2015-09-22 22:40:35 -07:00
|
|
|
ppc64le_defconfig:
|
|
|
|
$(call merge_into_defconfig,ppc64_defconfig,le)
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += ppc64le_guest_defconfig
|
2018-11-14 23:49:50 -07:00
|
|
|
ppc64le_guest_defconfig:
|
2023-04-14 06:24:13 -07:00
|
|
|
$(call merge_into_defconfig,ppc64_defconfig,le guest kvm_guest)
|
2018-11-14 23:49:50 -07:00
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += ppc64_guest_defconfig
|
2018-11-14 23:49:50 -07:00
|
|
|
ppc64_guest_defconfig:
|
2023-04-14 06:24:13 -07:00
|
|
|
$(call merge_into_defconfig,ppc64_defconfig,be guest kvm_guest)
|
2018-11-14 23:49:50 -07:00
|
|
|
|
2023-04-14 06:24:14 -07:00
|
|
|
generated_configs += pseries_le_defconfig
|
|
|
|
pseries_le_defconfig: ppc64le_guest_defconfig
|
|
|
|
|
2023-04-14 06:24:15 -07:00
|
|
|
generated_configs += pseries_defconfig
|
|
|
|
pseries_defconfig: ppc64le_guest_defconfig
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += powernv_be_defconfig
|
2017-07-24 05:50:45 -07:00
|
|
|
powernv_be_defconfig:
|
|
|
|
$(call merge_into_defconfig,powernv_defconfig,be)
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += mpc85xx_defconfig
|
2015-07-29 16:14:04 -07:00
|
|
|
mpc85xx_defconfig:
|
2019-05-28 01:16:14 -07:00
|
|
|
$(call merge_into_defconfig,mpc85xx_base.config,\
|
2015-07-29 16:14:04 -07:00
|
|
|
85xx-32bit 85xx-hw fsl-emb-nonhw)
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += mpc85xx_smp_defconfig
|
2015-07-29 16:14:04 -07:00
|
|
|
mpc85xx_smp_defconfig:
|
2019-05-28 01:16:14 -07:00
|
|
|
$(call merge_into_defconfig,mpc85xx_base.config,\
|
2015-07-29 16:14:04 -07:00
|
|
|
85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw)
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += corenet32_smp_defconfig
|
2015-07-29 16:14:04 -07:00
|
|
|
corenet32_smp_defconfig:
|
2019-05-28 01:16:14 -07:00
|
|
|
$(call merge_into_defconfig,corenet_base.config,\
|
2016-09-22 08:04:12 -07:00
|
|
|
85xx-32bit 85xx-smp 85xx-hw fsl-emb-nonhw dpaa)
|
2015-07-29 16:14:04 -07:00
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += corenet64_smp_defconfig
|
2015-07-29 16:14:04 -07:00
|
|
|
corenet64_smp_defconfig:
|
2019-05-28 01:16:14 -07:00
|
|
|
$(call merge_into_defconfig,corenet_base.config,\
|
2016-09-22 08:04:12 -07:00
|
|
|
85xx-64bit 85xx-smp altivec 85xx-hw fsl-emb-nonhw dpaa)
|
2015-07-29 16:14:04 -07:00
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += mpc86xx_defconfig
|
2016-02-22 02:26:14 -07:00
|
|
|
mpc86xx_defconfig:
|
2019-05-28 01:16:14 -07:00
|
|
|
$(call merge_into_defconfig,mpc86xx_base.config,\
|
2016-02-22 02:26:14 -07:00
|
|
|
86xx-hw fsl-emb-nonhw)
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += mpc86xx_smp_defconfig
|
2016-02-22 02:26:14 -07:00
|
|
|
mpc86xx_smp_defconfig:
|
2019-05-28 01:16:14 -07:00
|
|
|
$(call merge_into_defconfig,mpc86xx_base.config,\
|
2016-02-22 02:26:14 -07:00
|
|
|
86xx-smp 86xx-hw fsl-emb-nonhw)
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += ppc32_allmodconfig
|
2018-07-09 07:24:25 -07:00
|
|
|
ppc32_allmodconfig:
|
|
|
|
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/book3s_32.config \
|
|
|
|
-f $(srctree)/Makefile allmodconfig
|
2024-02-29 04:41:08 -07:00
|
|
|
|
|
|
|
generated_configs += ppc40x_allmodconfig
|
|
|
|
ppc40x_allmodconfig:
|
|
|
|
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/40x.config \
|
|
|
|
-f $(srctree)/Makefile allmodconfig
|
|
|
|
|
|
|
|
generated_configs += ppc44x_allmodconfig
|
|
|
|
ppc44x_allmodconfig:
|
|
|
|
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/44x.config \
|
|
|
|
-f $(srctree)/Makefile allmodconfig
|
|
|
|
|
|
|
|
generated_configs += ppc8xx_allmodconfig
|
|
|
|
ppc8xx_allmodconfig:
|
|
|
|
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/8xx.config \
|
|
|
|
-f $(srctree)/Makefile allmodconfig
|
|
|
|
|
|
|
|
generated_configs += ppc85xx_allmodconfig
|
|
|
|
ppc85xx_allmodconfig:
|
|
|
|
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-32bit.config \
|
|
|
|
-f $(srctree)/Makefile allmodconfig
|
2018-07-09 07:24:25 -07:00
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += ppc_defconfig
|
2019-02-06 22:16:51 -07:00
|
|
|
ppc_defconfig:
|
|
|
|
$(call merge_into_defconfig,book3s_32.config,)
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += ppc64le_allmodconfig
|
2018-07-09 07:24:26 -07:00
|
|
|
ppc64le_allmodconfig:
|
|
|
|
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/le.config \
|
|
|
|
-f $(srctree)/Makefile allmodconfig
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += ppc64le_allnoconfig
|
2020-11-24 20:15:51 -07:00
|
|
|
ppc64le_allnoconfig:
|
|
|
|
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/ppc64le.config \
|
|
|
|
-f $(srctree)/Makefile allnoconfig
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += ppc64_book3e_allmodconfig
|
2018-07-09 07:24:26 -07:00
|
|
|
ppc64_book3e_allmodconfig:
|
|
|
|
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/85xx-64bit.config \
|
|
|
|
-f $(srctree)/Makefile allmodconfig
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += ppc32_randconfig
|
2021-04-28 06:27:00 -07:00
|
|
|
ppc32_randconfig:
|
|
|
|
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/32-bit.config \
|
|
|
|
-f $(srctree)/Makefile randconfig
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
generated_configs += ppc64_randconfig
|
2021-04-28 06:27:00 -07:00
|
|
|
ppc64_randconfig:
|
|
|
|
$(Q)$(MAKE) KCONFIG_ALLCONFIG=$(srctree)/arch/powerpc/configs/64-bit.config \
|
|
|
|
-f $(srctree)/Makefile randconfig
|
|
|
|
|
2023-03-29 00:23:34 -07:00
|
|
|
PHONY += $(generated_configs)
|
|
|
|
|
2005-09-25 23:04:21 -07:00
|
|
|
define archhelp
|
2023-03-29 00:23:33 -07:00
|
|
|
echo '* zImage - Build default images selected by kernel config'
|
2023-12-06 04:55:45 -07:00
|
|
|
echo ' zImage.* - Compressed kernel image (arch/powerpc/boot/zImage.*)'
|
2023-03-29 00:23:33 -07:00
|
|
|
echo ' uImage - U-Boot native image format'
|
|
|
|
echo ' cuImage.<dt> - Backwards compatible U-Boot image for older'
|
|
|
|
echo ' versions which do not support device trees'
|
|
|
|
echo ' dtbImage.<dt> - zImage with an embedded device tree blob'
|
|
|
|
echo ' simpleImage.<dt> - Firmware independent image.'
|
|
|
|
echo ' treeImage.<dt> - Support for older IBM 4xx firmware (not U-Boot)'
|
|
|
|
echo ' install - Install kernel using'
|
|
|
|
echo ' (your) ~/bin/$(INSTALLKERNEL) or'
|
|
|
|
echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
|
|
|
|
echo ' install to $$(INSTALL_PATH) and run lilo'
|
2023-12-06 04:55:45 -07:00
|
|
|
echo ' *_defconfig - Select default config from arch/powerpc/configs'
|
2023-03-29 00:23:33 -07:00
|
|
|
echo ''
|
|
|
|
echo ' Targets with <dt> embed a device tree blob inside the image'
|
|
|
|
echo ' These targets support board with firmware that does not'
|
|
|
|
echo ' support passing a device tree directly. Replace <dt> with the'
|
2023-12-06 04:55:45 -07:00
|
|
|
echo ' name of a dts file from the arch/powerpc/boot/dts/ directory'
|
2023-03-29 00:23:33 -07:00
|
|
|
echo ' (minus the .dts extension).'
|
2023-03-29 00:23:34 -07:00
|
|
|
echo
|
|
|
|
$(foreach cfg,$(generated_configs),
|
|
|
|
printf " %-27s - Build for %s\\n" $(cfg) $(subst _defconfig,,$(cfg));)
|
2005-09-25 23:04:21 -07:00
|
|
|
endef
|
|
|
|
|
2020-02-18 17:04:34 -07:00
|
|
|
PHONY += install
|
2008-02-16 04:36:10 -07:00
|
|
|
install:
|
2022-05-02 19:47:16 -07:00
|
|
|
$(call cmd,install)
|
2007-04-10 04:05:31 -07:00
|
|
|
|
2020-09-27 02:16:33 -07:00
|
|
|
ifeq ($(KBUILD_EXTMOD),)
|
|
|
|
# We need to generate vdso-offsets.h before compiling certain files in kernel/.
|
|
|
|
# In order to do that, we should use the archprepare target, but we can't since
|
|
|
|
# asm-offsets.h is included in some files used to generate vdso-offsets.h, and
|
|
|
|
# asm-offsets.h is built in prepare0, for which archprepare is a dependency.
|
|
|
|
# Therefore we need to generate the header after prepare0 has been made, hence
|
|
|
|
# this hack.
|
|
|
|
prepare: vdso_prepare
|
|
|
|
vdso_prepare: prepare0
|
|
|
|
$(if $(CONFIG_VDSO32),$(Q)$(MAKE) \
|
2022-01-21 09:30:27 -07:00
|
|
|
$(build)=arch/powerpc/kernel/vdso include/generated/vdso32-offsets.h)
|
2020-09-27 02:16:33 -07:00
|
|
|
$(if $(CONFIG_PPC64),$(Q)$(MAKE) \
|
2022-01-21 09:30:27 -07:00
|
|
|
$(build)=arch/powerpc/kernel/vdso include/generated/vdso64-offsets.h)
|
2020-09-27 02:16:33 -07:00
|
|
|
endif
|
|
|
|
|
2005-09-25 23:04:21 -07:00
|
|
|
archprepare: checkbin
|
|
|
|
|
2018-12-17 03:40:36 -07:00
|
|
|
archheaders:
|
|
|
|
$(Q)$(MAKE) $(build)=arch/powerpc/kernel/syscalls all
|
|
|
|
|
2018-09-27 00:05:53 -07:00
|
|
|
ifdef CONFIG_STACKPROTECTOR
|
|
|
|
prepare: stack_protector_prepare
|
2005-09-25 23:04:21 -07:00
|
|
|
|
2020-02-18 17:04:34 -07:00
|
|
|
PHONY += stack_protector_prepare
|
2018-09-27 00:05:53 -07:00
|
|
|
stack_protector_prepare: prepare0
|
2018-09-27 00:05:55 -07:00
|
|
|
ifdef CONFIG_PPC64
|
|
|
|
$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "PACA_CANARY") print $$3;}' include/generated/asm-offsets.h))
|
|
|
|
else
|
2018-09-27 00:05:53 -07:00
|
|
|
$(eval KBUILD_CFLAGS += -mstack-protector-guard-offset=$(shell awk '{if ($$2 == "TASK_CANARY") print $$3;}' include/generated/asm-offsets.h))
|
|
|
|
endif
|
2018-09-27 00:05:55 -07:00
|
|
|
endif
|
2018-09-27 00:05:53 -07:00
|
|
|
|
2020-02-18 17:04:34 -07:00
|
|
|
PHONY += checkbin
|
2005-09-25 23:04:21 -07:00
|
|
|
checkbin:
|
2023-05-29 23:14:36 -07:00
|
|
|
@if test "x${CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT}" = "xy" -a \
|
|
|
|
"x${CONFIG_LD_IS_BFD}" = "xy" -a \
|
|
|
|
"${CONFIG_LD_VERSION}" = "23700" ; then \
|
|
|
|
echo -n '*** binutils 2.37 drops unused section symbols, which recordmcount ' ; \
|
|
|
|
echo 'is unable to handle.' ; \
|
|
|
|
echo '*** Please use a different binutils version.' ; \
|
|
|
|
false ; \
|
|
|
|
fi
|