On Sat, Jul 18, 2020 at 07:19:37PM +0200, Paul Boddie wrote:
I saw that there is a section about legacy U-Boot in the page:
http://rhombus-tech.net/allwinner/a20/EOMA68-A20_2-7-4_preproduction/
Yes, obviously I had to start with U-Boot first. Luke told me that sunxi U-Boot should build fine and that nothing has changed so I started there.
For mainline U-Boot I still need a valid config file to do 'make eoma68_foo_defconfig'. There is a .dts file here (http://rhombus-tech.net/allwinner/a20/boot/sun7i-a20-eoma68-a20.dts) but I don't know if it was used for mainline U-Boot and not just for Kernel compilation.
The experience I had with old U-Boot versions that were contemporary with older versions of GCC is that the compiler-tweaking headers from Linux generally spew out lots of errors with newer compilers. One apparent solution was to just copy in the header from a more recent version of Linux (or maybe U-Boot) which is what I did for the MIPS Creator CI20 U-Boot, copying from a more recent version of Linux:
cp ../CI20_linux-ci20-v3.18/include/linux/compiler-gcc.h include/linux
However, that doesn't seem to be sufficient here. The structure of the Linux headers have changed, and while newer U-Boot versions seem to have adopted this structure, it doesn't seem to be easy to introduce to the legacy U-Boot for the Allwinner boards.
So, what seems to be necessary is to get an older compiler and to use that instead. Since distributions retire older compilers regularly, I used Buildroot to create a suitable GCC 4.9 cross-compiler than can then build the legacy U-Boot.
I have realised that on Debian gcc versions are kept installed. I have a native armhf installation (initially installed with Jessie) currently upgraded to stretch and gcc-4.9 is still installed. Changed between gcc versions with 'update-alternatives'. I don't know if this also apllies to cross-toolchains because my experience with crossbuilding is limited.
Sid (unstable) still has gcc-4.9 and even gcc-4.7 native armhf packages so this could be another solution I have not tested yes as I have no armhf sid installation.
To make things complicated here, Buildroot also retires support for older compilers, so I had to find a version still supporting GCC 4.x that didn't also suffer from this issue:
https://git.busybox.net/buildroot/commit/? id=c48f8a64626c60bd1b46804b7cf1a699ff53cdf3
Anyway, here are the commands I used:
git clone git://git.buildroot.net/buildroot cd buildroot git checkout 2018.08.4 make menuconfig
In the menu, the following settings were inspected/changed:
Target options Target Architecture (ARM (little endian)) Target Binary Format (ELF) Target Architecture Variant Target ABI (EABIhf) Floating point strategy (NEON/VFPv4) ARM instruction set (ARM)
Toolchain GCC compiler Version (gcc 4.9.x)
To build the toolchain, run...
make toolchain
(Use -j <processes> for parallel builds, of course. You may need to install rsync if you haven't already done so. Other packages may also be necessary.)
Setting PATH to reference this toolchain in output/host/bin, you can now build the legacy U-Boot as follows:
git clone https://github.com/linux-sunxi/u-boot-sunxi.git cd u-boot-sunxi make CROSS_COMPILE=arm-linux- EOMA68_A20_config make CROSS_COMPILE=arm-linux-
(Again, use -j <processes> to make this go faster. Note that Buildroot compilers tend to use their own naming, so it is arm-linux- and not arm-linux- gnueabihf- that needs to be used.)
This is extremly helpful. I am going to try it out. Can you copy that to the wiki? Maybe as a separate subpage or at the end. I think we should keep everything short and clear for those who know what they are doing but still provide enough hand-holding and external context for those with less experience.
Here, the use of EOMA68_A20_config sets up a bootloader for SD cards, whereas EOMA68_A20_FEL_config would set up a USB-bootable payload. See here for all the details:
https://github.com/linux-sunxi/u-boot-sunxi/wiki
This should get you the u-boot-sunxi-with-spl.bin file that needs to be deployed.
Good news is that I made it to the sunxi U-Boot prompt on Friday. Booted via USB-FEL. So my soldered Pins, UART connection, Power Supply, µUSB-OTG on the card work fine.
Next I have planned to compile a sunxi 3.4 Kernel and debootstrap a Debian rootfs. Then I want to try mainline U-Boot and a mainline Kernel. Feel free to share your solutions and best practices with me!
Hope this was helpful!
Thank you for your help. Please add to the wiki.
Pablo