[U-Boot] [PATCH 6/9] sunxi: allow 32-bit builds for 64-bit SoCs

Andre Przywara andre.przywara at arm.com
Thu Feb 21 01:30:31 UTC 2019


At the moment we build the SPL and U-Boot proper for the 64-bit AArch64
instruction set. But since the cores provide an AArch32 compatibility mode
and in fact the BootROM runs in 32-bit mode, it can be useful to have at
least the SPL run in AArch32 as well. This has two advantages:
- As AArch32 features the compact Thumb2 instruction encoding, we can
  get a much smaller image size, which is a relief for our SPL.
- Staying in AArch32, with the MMU turned off, allows an easy return to
  the BootROM and its FEL mode. This enables FEL booting on those SoCs.

Introduce a Kconfig option which toggles between CONFIG_ARM64 and
CONFIG_CPU_V7A, to allow easy switching between the two modes. This can
be manually selected in menuconfig, but follow-up patches will introduce
a separate defconfig for that purpose.

Signed-off-by: Andre Przywara <andre.przywara at arm.com>
---
 arch/arm/mach-sunxi/Kconfig | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig
index 74e234cded..347d737fd0 100644
--- a/arch/arm/mach-sunxi/Kconfig
+++ b/arch/arm/mach-sunxi/Kconfig
@@ -146,6 +146,10 @@ config SUNXI_DRAM_MAX_SIZE
 	default 0xC0000000 if MACH_SUN50I || MACH_SUN50I_H5 || MACH_SUN50I_H6
 	default 0x80000000
 
+config SUNXI_ARMV8_32BIT_BUILD
+	bool "Build 32-bit binaries for ARMv8 SoCs"
+	default n
+
 choice
 	prompt "Sunxi SoC Variant"
 	optional
@@ -275,7 +279,8 @@ config MACH_SUN9I
 
 config MACH_SUN50I
 	bool "sun50i (Allwinner A64)"
-	select ARM64
+	select ARM64 if !SUNXI_ARMV8_32BIT_BUILD
+	select CPU_V7A if SUNXI_ARMV8_32BIT_BUILD
 	select DM_I2C
 	select PHY_SUN4I_USB
 	select SUN6I_PRCM
@@ -291,14 +296,16 @@ config MACH_SUN50I
 
 config MACH_SUN50I_H5
 	bool "sun50i (Allwinner H5)"
-	select ARM64
+	select ARM64 if !SUNXI_ARMV8_32BIT_BUILD
+	select CPU_V7A if SUNXI_ARMV8_32BIT_BUILD
 	select MACH_SUNXI_H3_H5
 	select FIT
 	select SPL_LOAD_FIT
 
 config MACH_SUN50I_H6
 	bool "sun50i (Allwinner H6)"
-	select ARM64
+	select ARM64 if !SUNXI_ARMV8_32BIT_BUILD
+	select CPU_V7A if SUNXI_ARMV8_32BIT_BUILD
 	select SUPPORT_SPL
 	select FIT
 	select SPL_LOAD_FIT
-- 
2.14.5



More information about the U-Boot mailing list