In the process of building the cross-compilation toolchain a local toolchain is also created. To avoid confusion with any existing native compilation tools the "triplet" for this toolchain has the word "cross" embedded into it.
export CLFS_HOST=$(echo ${MACHTYPE} | sed "s/-[^-]*/-cross/") echo export CLFS_HOST=\""${CLFS_HOST}\"" >> ~/.bashrc
The Endianess of system refers to how numbers are represented. See the following wiki entry for additional details: http://en.wikipedia.org/wiki/Endianness Based on the selected platform the following setting is appropriate:
export CLFS_ENDIAN=little echo export CLFS_ENDIAN=\""${CLFS_ENDIAN}\"" >> ~/.bashrc
The ARM architecture supports 16 bity instruction reffered to as THUMB,see the following wiki entry for additional information: http://en.wikipedia.org/wiki/ARM_architecture#Thumb If we review the configuration file created earlier under the section "Processor Features" we see that the following config flag has been set CONFIG_ARM_THUMB=y thus we set the arm mode to thumb to enable a 16 bit instruction set or use the generally applicable arm mode.
export CLFS_ARM_MODE=arm echo export CLFS_ARM_MODE=\""${CLFS_ARM_MODE}\"" >> ~/.bashrc
There are a number of arm architectures (see table below).If we review the configuration file created earlier under the section "Processor type" we see that the following config flag has been set CONFIG_CPU_32v5=y thus we set the arm architecture as follows:
export CLFS_ARM_ARCH=armv7-a echo export CLFS_ARM_ARCH=\""${CLFS_ARM_ARCH}\"" >> ~/.bashrc
If your target CPU has hard floating point support (not all ARM CPUs do), set the following CLFS_FLOAT variable to either "hard" or "softfp". If your target CPU does not have hard floating point support, set the following CLFS_FLOAT variable to "soft".
export CLFS_FLOAT=soft echo export CLFS_FLOAT=\""${CLFS_FLOAT}\"" >> ~/.bashrc
In all cases the has to support a floating point emulation. If the floating point support is hard/softp this emulation needs to line up with the hardware. Based on the review of ${CLFS}/boot/config-3.10.13 we will set CLFS_FPU as follows:
export CLFS_FPU=vfp echo export CLFS_FPU=\""${CLFS_FPU}\"" >> ~/.bashrc
Table 6.2. ARM Architecture Choices
armv2 | armv2a | armv3 | armv3m |
armv4 | armv4t | armv5 | armv5t |
armv5te | armv6 | armv6j | armv6t2 |
armv6z | armv6zk | armv6-m | armv7 |
armv7-a | armv7-r | armv7-m | iwmmxt |
iwmmxt2 | ep9312 |
Table 6.3. ARM Hard Floating Point Versions
fpa | fpe2 | fpe3 | maverick |
vfp | vfpv3 | vfpv3-fp16 | vfpv3-d16 |
vfpv3-d16-fp16 | vfpv3xd | vfpv3xd-fp16 | neon |
neon-fp16 | vfpv4 | vfpv4-d16 | fpv4-sp-d16 |
neon-vfpv4 | softvfp | none |
During the building of the cross-compile tools, you will need to set a few variables that will be dependent on your particular needs. You will need to select the target triplet for the target architecture, the CPU endianess, the CPU architecture, the CPU mode, the CPU floating point hardware availability, and (if available) the type of floating point hardware. If you do not know what values can be chosen for each of these, you can use the tables at the bottom of this page as a reference.
Most ARM processors are little endian, it is a safe choice. If your processor is an ARM9, good choices include: triplet of armv5l-unknown-linux-uclibeabi, ARM arch of armv5t, float of softfp, and fpu of either none or softvfp. ARM9 processors do not always have hardware floating point abilities. If your processor is a Cortex-A8 or Cortex-A9, good choices include: triplet of armv7a-unknown-linux-musleabi, ARM arch of armv7-a, float of hard, and fpu of vfpv3-d16.
Now we will set the architecture and endianess of the CPU based on the target triplet provided above:
The target triplet is a smart name that is used during the compilation of binutils to set certain options (e.g. endianness). The following table gives examples:
Table 6.4. Example Processor Type, ABI, and Target Triplets
Processor | Endianess | ABI | Target Triplet |
---|---|---|---|
Generic arm, version 5 | little | EABI | armv5l-unknown-linux-musleabi |
Generic arm, version 5 | big | EABI | armv5b-unknown-linux-musleabi |
Generic arm | little | EABI | arm-unknown-linux-musleabi |
Generic arm, version 7-a | little | EABI | armv7a-unknown-linux-musleabi |
export CLFS_TARGET=armel-unknown-linux-musleabi echo export CLFS_TARGET=\""${CLFS_TARGET}\"" >> ~/.bashrc