Message ID | 1483357730-6800-27-git-send-email-andre.przywara@arm.com |
---|---|
State | Changes Requested |
Delegated to: | Jagannadha Sutradharudu Teki |
Headers | show |
Hi Andre, On 2 January 2017 at 04:48, Andre Przywara <andre.przywara@arm.com> wrote: > When compiling the SPL for the Allwinner A64 in AArch64 mode, we can't > use the more compact Thumb2 encoding, which only exists for AArch32 > code. This makes the SPL rather big, up to a point where any code > additions or even a different compiler may easily exceed the 32KB limit > that the Allwinner BROM imposes. > Introduce a separate, mostly generic sun50i-a64 configuration, which > defines the CPU_V7 symbol and thus will create a 32-bit binary using > the memory-saving Thumb2 encoding. > This should only be used for the SPL, the U-Boot proper should still be > using the existing 64-bit configuration. The SPL code can switch to > AArch64 if needed, so a 32-bit SPL can be combined with a 64-bit U-Boot > proper to eventually launch arm64 kernels. > > Signed-off-by: Andre Przywara <andre.przywara@arm.com> > --- > board/sunxi/Kconfig | 14 ++++++++++++-- > configs/pine64_plus_defconfig | 2 +- > configs/sun50i_spl32_defconfig | 10 ++++++++++ > 3 files changed, 23 insertions(+), 3 deletions(-) > create mode 100644 configs/sun50i_spl32_defconfig Following up on the previous discussion, I take it that one on problem is that U-Boot does not support building SPL with one toolchain and U-Boot proper with another? Re wanting to build SPL either as 32-bit or 64-bit, could this be a Kconfig option perhaps? Anyway, if this is what we have for now, fine. But I'd like to see at least a TODO suggesting a better solution. Regards, Simon
Hi, On 13/01/17 02:19, Simon Glass wrote: > Hi Andre, > > On 2 January 2017 at 04:48, Andre Przywara <andre.przywara@arm.com> wrote: >> When compiling the SPL for the Allwinner A64 in AArch64 mode, we can't >> use the more compact Thumb2 encoding, which only exists for AArch32 >> code. This makes the SPL rather big, up to a point where any code >> additions or even a different compiler may easily exceed the 32KB limit >> that the Allwinner BROM imposes. >> Introduce a separate, mostly generic sun50i-a64 configuration, which >> defines the CPU_V7 symbol and thus will create a 32-bit binary using >> the memory-saving Thumb2 encoding. >> This should only be used for the SPL, the U-Boot proper should still be >> using the existing 64-bit configuration. The SPL code can switch to >> AArch64 if needed, so a 32-bit SPL can be combined with a 64-bit U-Boot >> proper to eventually launch arm64 kernels. >> >> Signed-off-by: Andre Przywara <andre.przywara@arm.com> >> --- >> board/sunxi/Kconfig | 14 ++++++++++++-- >> configs/pine64_plus_defconfig | 2 +- >> configs/sun50i_spl32_defconfig | 10 ++++++++++ >> 3 files changed, 23 insertions(+), 3 deletions(-) >> create mode 100644 configs/sun50i_spl32_defconfig > > Following up on the previous discussion, I take it that one on problem > is that U-Boot does not support building SPL with one toolchain and > U-Boot proper with another? Yes. For the time being I have a script [1] that first configures and compiles everything with an ARM cross compiler, then repeats this with an aarch64 cross compiler. Then I combine the 32-bit SPL and the 64-bit U-Boot proper. While we are at it: I didn't find a Makefile target to just compile the SPL (or just U-Boot proper), is that worth looking at? Or can we somehow influence Kconfig options on the command line to achieve that on that level? > Re wanting to build SPL either as 32-bit or 64-bit, could this be a > Kconfig option perhaps? Sounds like a direction worth to investigate. In the moment we have two separate defconfig files, because CPU_V7 and ARM64 are actually mutually exclusive, which is really a pain and the main reason that part wasn't merged. > Anyway, if this is what we have for now, fine. But I'd like to see at > least a TODO suggesting a better solution. So yes, the series was now merged omitting the 32-bit SPL part, which is really optional. For the time being we seem to get away with only 64-bit, but I will definitely revisit this after having handled the higher priority patches in my queue. Cheers, Andre. [1] http://pastebin.com/kH7u2h7M
On Fri, Jan 13, 2017 at 09:42:28AM +0000, Andre Przywara wrote: > > Re wanting to build SPL either as 32-bit or 64-bit, could this be a > > Kconfig option perhaps? > > Sounds like a direction worth to investigate. > In the moment we have two separate defconfig files, because CPU_V7 and > ARM64 are actually mutually exclusive, which is really a pain and the > main reason that part wasn't merged. I really like that option. Maxime
On 16/01/17 08:55, Maxime Ripard wrote: > On Fri, Jan 13, 2017 at 09:42:28AM +0000, Andre Przywara wrote: >>> Re wanting to build SPL either as 32-bit or 64-bit, could this be a >>> Kconfig option perhaps? >> >> Sounds like a direction worth to investigate. >> In the moment we have two separate defconfig files, because CPU_V7 and >> ARM64 are actually mutually exclusive, which is really a pain and the >> main reason that part wasn't merged. > > I really like that option. So I gave this a try this weekend, I have something like: +choice + prompt "32/64 bit build selection" + depends on MACH_SUN50I + +config SUNXI_64BIT_BUILD + bool "64-bit Aarch64 build" + select ARM64 + +config SUNXI_32BIT_BUILD + bool "32-bit ARM build" + select CPU_V7 + select PHYS_64BIT + +endchoice I then set CONFIG_SUNXI_64BIT_BUILD=y in the defconfig. That seems to work, however switching to a 32-bit build requires either a) a separate defconfig - which is what we didn't want b) manually toggling this via menuconfig c) sed-ing these two lines in .config I was hoping that there was some simple command line way of toggling a Kconfig option, à la: $ make pine64_plus_defconfig CONFIG_SUNXI_32BIT_BUILD=y But that didn't work. mergeconfig.sh wasn't helpful as well. Any ideas on how we could easily switch between the two options? Cheers, Andre.
On Mon, Jan 16, 2017 at 09:47:06AM +0000, André Przywara wrote: > On 16/01/17 08:55, Maxime Ripard wrote: > > On Fri, Jan 13, 2017 at 09:42:28AM +0000, Andre Przywara wrote: > >>> Re wanting to build SPL either as 32-bit or 64-bit, could this be a > >>> Kconfig option perhaps? > >> > >> Sounds like a direction worth to investigate. > >> In the moment we have two separate defconfig files, because CPU_V7 and > >> ARM64 are actually mutually exclusive, which is really a pain and the > >> main reason that part wasn't merged. > > > > I really like that option. > > So I gave this a try this weekend, I have something like: > > +choice > + prompt "32/64 bit build selection" > + depends on MACH_SUN50I > + > +config SUNXI_64BIT_BUILD > + bool "64-bit Aarch64 build" > + select ARM64 > + > +config SUNXI_32BIT_BUILD > + bool "32-bit ARM build" > + select CPU_V7 > + select PHYS_64BIT > + > +endchoice > > I then set CONFIG_SUNXI_64BIT_BUILD=y in the defconfig. > That seems to work, however switching to a 32-bit build requires either > a) a separate defconfig - which is what we didn't want > b) manually toggling this via menuconfig > c) sed-ing these two lines in .config > > I was hoping that there was some simple command line way of toggling a > Kconfig option, à la: > $ make pine64_plus_defconfig CONFIG_SUNXI_32BIT_BUILD=y > > But that didn't work. > mergeconfig.sh wasn't helpful as well. > > Any ideas on how we could easily switch between the two options? I know that Linux has a way to append defconfig fragments (originally for android options iirc). That could be worth a look. Maxime
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig index 0001133..0d77c3a 100644 --- a/board/sunxi/Kconfig +++ b/board/sunxi/Kconfig @@ -43,6 +43,10 @@ config SUNXI_GEN_SUN6I watchdog, etc. +config MACH_SUN50I + bool + select SUNXI_GEN_SUN6I + choice prompt "Sunxi SoC Variant" optional @@ -121,10 +125,16 @@ config MACH_SUN9I select SUNXI_GEN_SUN6I select SUPPORT_SPL -config MACH_SUN50I +config MACH_SUN50I_64 bool "sun50i (Allwinner A64)" + select MACH_SUN50I select ARM64 - select SUNXI_GEN_SUN6I + select SUPPORT_SPL + +config MACH_SUN50I_32 + bool "sun50i (Allwinner A64) SPL-32bit" + select MACH_SUN50I + select CPU_V7 select SUPPORT_SPL endchoice diff --git a/configs/pine64_plus_defconfig b/configs/pine64_plus_defconfig index 2374170..a76f66a 100644 --- a/configs/pine64_plus_defconfig +++ b/configs/pine64_plus_defconfig @@ -1,7 +1,7 @@ CONFIG_ARM=y CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER=y CONFIG_ARCH_SUNXI=y -CONFIG_MACH_SUN50I=y +CONFIG_MACH_SUN50I_64=y CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pine64-plus" # CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set CONFIG_CONSOLE_MUX=y diff --git a/configs/sun50i_spl32_defconfig b/configs/sun50i_spl32_defconfig new file mode 100644 index 0000000..29c6a47 --- /dev/null +++ b/configs/sun50i_spl32_defconfig @@ -0,0 +1,10 @@ +CONFIG_ARM=y +CONFIG_ARCH_SUNXI=y +CONFIG_MACH_SUN50I_32=y +CONFIG_SPL=y +CONFIG_DEFAULT_DEVICE_TREE="sun50i-a64-pine64-plus" +CONFIG_OF_LIST="sun50i-a64-pine64 sun50i-a64-pine64-plus" +# CONFIG_CMD_IMLS is not set +# CONFIG_CMD_FLASH is not set +# CONFIG_CMD_FPGA is not set +CONFIG_MMC_SUNXI_SLOT_EXTRA=2
When compiling the SPL for the Allwinner A64 in AArch64 mode, we can't use the more compact Thumb2 encoding, which only exists for AArch32 code. This makes the SPL rather big, up to a point where any code additions or even a different compiler may easily exceed the 32KB limit that the Allwinner BROM imposes. Introduce a separate, mostly generic sun50i-a64 configuration, which defines the CPU_V7 symbol and thus will create a 32-bit binary using the memory-saving Thumb2 encoding. This should only be used for the SPL, the U-Boot proper should still be using the existing 64-bit configuration. The SPL code can switch to AArch64 if needed, so a 32-bit SPL can be combined with a 64-bit U-Boot proper to eventually launch arm64 kernels. Signed-off-by: Andre Przywara <andre.przywara@arm.com> --- board/sunxi/Kconfig | 14 ++++++++++++-- configs/pine64_plus_defconfig | 2 +- configs/sun50i_spl32_defconfig | 10 ++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 configs/sun50i_spl32_defconfig