[PATCH] arch/powerpc: Fix zImage wrapper with 64bit only toolchains

Cyril Bur cyrilbur at gmail.com
Thu Mar 16 18:49:48 AEDT 2017


Historically the zImage wrapper has needed to be compiled 32bit to run
on 32bit only platforms. Today some platforms can have 64bit wrappers as
they've always been 64bit compatible, notably little endian systems.

Problems arise when a kernel and zImage are cross compiled with a 64bit
only toolchain. The Makefile will determine that the toolchain is not
32bit compatible and whilst attempting to fall back to CROSS32CC or
CROSS32_COMPILE which are unlikely to be set, it falls back to using
`gcc`, the host compiler.

On platforms that can have the wrapper compiled 64bit (and where the
compiler is not 32bit capable), the Makefile should first fall back to
the compiler it used for the rest of the kernel.

Signed-off-by: Cyril Bur <cyrilbur at gmail.com>
---
 arch/powerpc/Makefile | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 8b433334d5af..e7a90952ed36 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -25,6 +25,16 @@ ifeq ($(CROSS32_COMPILE),)
 CROSS32CC	:= $(CC) -m32
 KBUILD_ARFLAGS	+= --target=elf32-powerpc
 endif
+else
+ifeq ($(CONFIG_PPC64_BOOT_WRAPPER),y)
+ifeq ($(CROSS32_COMPILE),)
+#The 64bit only toolchain is perfectly capable of building a 64bit
+#boot wrapper.
+#So use it
+CROSS32CC	:= $(CC)
+CROSS32AR	:= $(AR)
+endif
+endif
 endif
 
 export CROSS32CC CROSS32AR
-- 
2.12.0



More information about the Linuxppc-dev mailing list