aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/Makefile
diff options
context:
space:
mode:
authorIan Munsie <imunsie@au1.ibm.com>2013-09-22 22:05:11 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-10-11 01:48:56 -0400
commitd72b08017161ab385d4ae080ea415c9eb7ceef83 (patch)
treec20ece2f9d78bf9e7d01824aec499713053c7120 /arch/powerpc/Makefile
parent7df697c81587114ad4847598dd2d6061b73f1a12 (diff)
powerpc: Add ability to build little endian kernels
This patch allows the kbuild system to successfully compile a kernel for the little endian PowerPC64 architecture. A subsequent patch will add the CONFIG_CPU_LITTLE_ENDIAN kernel config option which must be set to build such a kernel. If cross compiling, CROSS_COMPILE must point to a suitable toolchain (compiled for the powerpc64le-linux and powerpcle-linux targets). Signed-off-by: Ian Munsie <imunsie@au1.ibm.com> Signed-off-by: Anton Blanchard <anton@samba.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/Makefile')
-rw-r--r--arch/powerpc/Makefile24
1 files changed, 21 insertions, 3 deletions
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index debfa2b1c1de..d3c91bf923b7 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -65,11 +65,29 @@ endif
65 65
66UTS_MACHINE := $(OLDARCH) 66UTS_MACHINE := $(OLDARCH)
67 67
68ifeq ($(CONFIG_CPU_LITTLE_ENDIAN),y)
69override CC += -mlittle-endian
70override AS += -mlittle-endian
71override LD += -EL
72override CROSS32CC += -mlittle-endian
73override CROSS32AS += -mlittle-endian
74LDEMULATION := lppc
75GNUTARGET := powerpcle
76MULTIPLEWORD := -mno-multiple
77else
78override CC += -mbig-endian
79override AS += -mbig-endian
80override LD += -EB
81LDEMULATION := ppc
82GNUTARGET := powerpc
83MULTIPLEWORD := -mmultiple
84endif
85
68ifeq ($(HAS_BIARCH),y) 86ifeq ($(HAS_BIARCH),y)
69override AS += -a$(CONFIG_WORD_SIZE) 87override AS += -a$(CONFIG_WORD_SIZE)
70override LD += -m elf$(CONFIG_WORD_SIZE)ppc 88override LD += -m elf$(CONFIG_WORD_SIZE)$(LDEMULATION)
71override CC += -m$(CONFIG_WORD_SIZE) 89override CC += -m$(CONFIG_WORD_SIZE)
72override AR := GNUTARGET=elf$(CONFIG_WORD_SIZE)-powerpc $(AR) 90override AR := GNUTARGET=elf$(CONFIG_WORD_SIZE)-$(GNUTARGET) $(AR)
73endif 91endif
74 92
75LDFLAGS_vmlinux-y := -Bstatic 93LDFLAGS_vmlinux-y := -Bstatic
@@ -95,7 +113,7 @@ endif
95CFLAGS-$(CONFIG_PPC64) := -mtraceback=no -mcall-aixdesc 113CFLAGS-$(CONFIG_PPC64) := -mtraceback=no -mcall-aixdesc
96CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,-mminimal-toc) 114CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mcmodel=medium,-mminimal-toc)
97CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions) 115CFLAGS-$(CONFIG_PPC64) += $(call cc-option,-mno-pointers-to-nested-functions)
98CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 -mmultiple 116CFLAGS-$(CONFIG_PPC32) := -ffixed-r2 $(MULTIPLEWORD)
99 117
100ifeq ($(CONFIG_PPC_BOOK3S_64),y) 118ifeq ($(CONFIG_PPC_BOOK3S_64),y)
101CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,-mtune=power4) 119CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,-mtune=power4)