The toolchain is a set of binaries, system libraries and tools which allow you to build (in our case, cross-compile) u-boot and the kernel for a target platform. This will, to some limited extent, need to match the target rootfs. A large and incompatible change has taken place recently, through the Hard Float ABI. Now, two different debian and ubuntu ports are binary incompatible with each other.
This is the cross compiler used by cubian developers. Arm-none-linux-gnueabiis initially provided by codesourcery.The toolchain is based on GCC and optimized for ARM devices. Codesourcery has a product called Sourcery G Lite Edition, the command-line version is free, the IDE is not. Make ARCH=arm CROSSCOMPILE=arm-linux-gnueabihf-Replace arm-linux-gnueabihf- with arm-linux-gnueabi- if your are not using a hardfloat toolchain. Another option is to install the Sourcery toolchain from Code Sourcery (now in Mentor Graphics). The first part is about Simplicity Studio, and energyAwareTools which are specific to Energy Micro, but the second part deals with setting up Eclipse and CodeSourcery ARM toolchain for MCU development which should be reusable for other MCUs from vendors such as Texas Instruments, NXP and STMicro. Install the GNU ARM toolchain under Linux. Embedded development tools for a popular processor. From the developerWorks archives. Date archived: April 18, 2019 First published: May 20, 2009. Many tools are available for programming various versions of ARM cores, but one particularly popular set is the GNU ARM toolchain. CodeSourcery says 'CodeSourcery, in partnership with ARM, Ltd., develops improvements to the GNU Toolchain for ARM processors and provides regular, validated releases of the GNU Toolchain'.
|
Ubuntu
A complete cross toolchain is available as a package, just run:
The gcc cross compiler from the standard package in Ubuntu 16 may have a bug that manifests itself as the following error while compiling U-Boot:
Version of the compiler with the bug:
A suggested solution is to use the Linaro toolchain
Debian
Details on cross-development Toolchains for Debian are at the Debian Wiki.
Installing Cross Compiler and build utilities: Quidam 3d model.
armhf
Codesourcery Arm Eabi Toolchain
arm64
You might want additional tools for building a sunxi system that are not related to the cross-compiler:
Fedora
A complete cross toolchain is available as a package, just run:
Gentoo
The crossdev tool[1]is the standard way of dealing with crosscompilers in Gentoo. Command line options are used to specify any arbitrary mix of different versions of the kernel headers, glibc, binutils and gcc. You can also use the -S option instead (to pick whatever is considered to be stable at the moment), but in this case the crosscompiler will be also upgraded as part of the regular distribution updates, which might be a bit annoying.
ARM crosscompiler
Even though Gentoo normally uses armv7a-hardfloat-linux-gnueabi as the toolchain triplet on ARM, we can also use Debian alike arm-linux-gnueabihf variant in order to be able to use the compilation instructions from the linux-sunxi wiki as-is (without substituting the toolchain name).
The toolchain is a set of binaries, system libraries and tools which allow you to build (in our case, cross-compile) u-boot and the kernel for a target platform. This will, to some limited extent, need to match the target rootfs. A large and incompatible change has taken place recently, through the Hard Float ABI. Now, two different debian and ubuntu ports are binary incompatible with each other.
This is the cross compiler used by cubian developers. Arm-none-linux-gnueabiis initially provided by codesourcery.The toolchain is based on GCC and optimized for ARM devices. Codesourcery has a product called Sourcery G Lite Edition, the command-line version is free, the IDE is not. Make ARCH=arm CROSSCOMPILE=arm-linux-gnueabihf-Replace arm-linux-gnueabihf- with arm-linux-gnueabi- if your are not using a hardfloat toolchain. Another option is to install the Sourcery toolchain from Code Sourcery (now in Mentor Graphics). The first part is about Simplicity Studio, and energyAwareTools which are specific to Energy Micro, but the second part deals with setting up Eclipse and CodeSourcery ARM toolchain for MCU development which should be reusable for other MCUs from vendors such as Texas Instruments, NXP and STMicro. Install the GNU ARM toolchain under Linux. Embedded development tools for a popular processor. From the developerWorks archives. Date archived: April 18, 2019 First published: May 20, 2009. Many tools are available for programming various versions of ARM cores, but one particularly popular set is the GNU ARM toolchain. CodeSourcery says 'CodeSourcery, in partnership with ARM, Ltd., develops improvements to the GNU Toolchain for ARM processors and provides regular, validated releases of the GNU Toolchain'.
|
Ubuntu
A complete cross toolchain is available as a package, just run:
The gcc cross compiler from the standard package in Ubuntu 16 may have a bug that manifests itself as the following error while compiling U-Boot:
Version of the compiler with the bug:
A suggested solution is to use the Linaro toolchain
Debian
Details on cross-development Toolchains for Debian are at the Debian Wiki.
Installing Cross Compiler and build utilities: Quidam 3d model.
armhf
Codesourcery Arm Eabi Toolchain
arm64
You might want additional tools for building a sunxi system that are not related to the cross-compiler:
Fedora
A complete cross toolchain is available as a package, just run:
Gentoo
The crossdev tool[1]is the standard way of dealing with crosscompilers in Gentoo. Command line options are used to specify any arbitrary mix of different versions of the kernel headers, glibc, binutils and gcc. You can also use the -S option instead (to pick whatever is considered to be stable at the moment), but in this case the crosscompiler will be also upgraded as part of the regular distribution updates, which might be a bit annoying.
ARM crosscompiler
Even though Gentoo normally uses armv7a-hardfloat-linux-gnueabi as the toolchain triplet on ARM, we can also use Debian alike arm-linux-gnueabihf variant in order to be able to use the compilation instructions from the linux-sunxi wiki as-is (without substituting the toolchain name).
ARM64 crosscompiler
Note: binutils =9999 (fetch sources from git) should be replaced with =2.26 as soon as binutils 2.26 is added to portage. Such new binutils version is necessary for having a Cortex-A53 erratum 843419 workaround.
OpenRISC crosscompiler
If you have one of the Allwinner SoC variants with an additional OpenRISC core (for example A31 and H3 have it), then you might want to also build an OpenRISC crosscompiler too:
Please note that the upstream GCC does not support OpenRISC yet, so the OpenRISC code is still brewing in https://github.com/openrisc/or1k-gcc.git and we can solve this problem by just providing a patch for GCC in the /etc/portage/patches directory.
- ↑The Gentoo website has undergone a major overhaul as of April 2015. While a backup of the old content is still available, it seems to have left the Gentoo Embedded Handbook in a non-functional state. You can still find a copy via archive.org. The wiki article on Raspberry Pi Cross building might also be helpful.
These standalone toolchains are big tarballs which come with everything you need.
Linaro toolchain
Download
Linaro has been very good at changing the location and availability of just about everything, making it very hard to keep a wiki up to date which refers to it. So the below download locations might be stale already.
Currently, the main selection page is here.
It lists the following toolchains:
When in doubt, try 4.9 first.
WARNING: Do not use the 4.8 gcc versions of the linaro toolchain to build legacy kernels (sunxi-3.4 etc.), those seem to have issues building the kernel. (TODO: Verify that this is still true today).
Usage
Take a gcc-linaro-.-..tar.xz file and untar it. You will find a bin directory in there. Temporarily add it to the environment you are building from:
no hardfloat?
Recent linaro toolchains are Hard Float (hf), this will be used throughout the wiki you see something like:
Replace arm-linux-gnueabihf- with arm-linux-gnueabi- if your are not using a hardfloat toolchain.
Code Sourcery
Another option is to install the Sourcery toolchain from Code Sourcery (now in Mentor Graphics). Download Code Sourcery G++ 2010 9-50https://sourcery.mentor.com/sgpp/lite/arm/portal/release1600 (official link, email registration required)
Direct link: https://netst.org/pub/linux/ARM/CodeSourcery/arm-2010.09-50-arm-none-linux-gnueabi.bin (unofficial link)
If you are using Ubuntu, you may need to switch to use bash shell (instead of dash shell)
It will now install CodeSourcery with a GUI installer
Follow default settings and do Next , Next, Next, etc…
It should install in: ~/CodeSourcery/ ( for example: /home/penguin/CodeSourcery/ )
Make sure the CodeSourcery binaries are added to your path (if your username is penguin, then this should be correct):
Bootlin
Code-sourcery-toolchain-arm-2011.03
Bootlin also provices glibc / musl / uclibc based toolchains for building:
Codesourcery Arm Toolchain 2009q1-203
- Homepage (mentor.com)
- Direct download (mentor.com)