4.6. 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. The first variable will be the triplet of the host machine, which will be put into the CLFS_HOST variable. To account for the possibility that the host and target are the same arch, as cross-compiling won't work when host and target are the same, part of the triplet needs to be changed slightly - in our case, we will change part of the triplet to "cross". Set CLFS_HOST using the following command:

export CLFS_HOST=$(echo ${MACHTYPE} | sed -e 's/-[^-]*/-cross/')

Now you will need to set the triplet for the target architecture. Set the target variable using the following command:

For a MIPS Little Endian Machine:

export CLFS_TARGET="mipsel-unknown-linux-gnu"

For a MIPS Big Endian Machine:

export CLFS_TARGET="mips-unknown-linux-gnu"

Copy settings to Environment

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

cat >> ~/.bashrc << EOF