6.4. Build Variables

Setting Host and Target

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.

First, set the host and target triplets:

export CLFS_HOST=$(echo ${MACHTYPE} | sed "s/-[^-]*/-cross/")
export CLFS_TARGET="[target triplet]"

Now we will set the architecture and endianess of the CPU based on the target triplet provided above:

export CLFS_ARCH=arm
export CLFS_ENDIAN="[endianess]"

Choose the ARM architecture (see table below) and mode of your CPU:

export CLFS_ARM_ARCH="[architecture]"
export CLFS_ARM_MODE="[arm or thumb]"

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 vairable to "soft".

export CLFS_FLOAT="[hard, softfp, or soft]"

If you chose either "hard" or "softfp" for CLFS_FLOAT, you now need to set which floating point hardware is actually included (see table below) with your ARM CPU:

export CLFS_FPU="[fpu version]"

Now we will add this to ~/.bashrc, just in case you have to exit and restart building later:

echo export CLFS_HOST=\""${CLFS_HOST}\"" >> ~/.bashrc
echo export CLFS_TARGET=\""${CLFS_TARGET}\"" >> ~/.bashrc
echo export CLFS_ARCH=\""${CLFS_ARCH}\"" >> ~/.bashrc
echo export CLFS_ENDIAN=\""${CLFS_ENDIAN}\"" >> ~/.bashrc
echo export CLFS_ARM_ARCH=\""${CLFS_ARM_ARCH}\"" >> ~/.bashrc
echo export CLFS_ARM_MODE=\""${CLFS_ARM_MODE}\"" >> ~/.bashrc
echo export CLFS_FLOAT=\""${CLFS_FLOAT}\"" >> ~/.bashrc
echo export CLFS_FPU=\""${CLFS_FPU}\"" >> ~/.bashrc

Table 6.2. Example Processor Type, ABI, and Target Triplets

Processor Endianess ABI Target Triplet
Generic arm little OABI arm-unknown-linux-uclibc
Generic arm, version 4 little OABI armv4-unknown-linux-uclibc
Generic arm, version 5 little EABI armv5l-unknown-linux-uclibceabi
Generic arm, version 5 big EABI armv5b-unknown-linux-uclibceabi
Generic arm little EABI arm-unknown-linux-uclibceabi
Generic arm, version 7-a little EABI armv7a-unknown-linux-uclibceabi

Table 6.3. ARM Archiecture 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.4. 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