6.5. Build Variables

6.5.1. Set Host

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

6.5.2. Set Endianess

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

6.5.3. Set 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.

6.5.4. MIPS specific variables

Now you will need to set the MIPS LEVEL. This determines how your GCC and uClibc are built. There are currently 5 MIPS ISA Levels. To keep things simple we are only using two. See the following table to dsetermine the appropriate level. For more information, see http://www.linux-mips.org/wiki/Instruction_Set_Architecture


export CLFS_MIPS_LEVEL=1
echo export CLFS_MIPS_LEVEL=\""${CLFS_MIPS_LEVEL}\"" >> ~/.bashrc

We also need to select the floating point capability of the CPU. That is code built for hardware floating point will always run correctly, even on systems without an FPU. Gcc's mips-linux, mipsel-linux, mips64-linux and mips64el-linux targets default to hardware floating point. If the CPU has built-in hardware for performing floating point calculations, choose "hard", otherwise choose "soft":


export CLFS_FLOAT=soft
echo export CLFS_FLOAT=\""${CLFS_FLOAT}\"" >> ~/.bashrc

Table 6.2. Processor Type and Target Triplets

Kernel Processor Target Triplet MIPS Level
CONFIG_CPU_MIPS32 MIPS 32 bits Little Endian mipsel-unknown-linux-uclibc 1
CONFIG_CPU_MIPS32 MIPS 32 bits Big Endian mips-unknown-linux-uclibc 1
  MIPS 64 bits Little Endian mips64el-unknown-linux-uclibc 3
  MIPS 64 bits Big Endian mips64-unknown-linux-uclibc 3

Now we will set the target based on the preceeding table:


export CLFS_TARGET=mipsel-unknown-linux-gnu
echo export CLFS_TARGET=\""${CLFS_TARGET}\"" >> ~/.bashrc