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:

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

We will need to setup target specific flags for the compiler and linkers. You can choose the appropriate BUILD64 and GCCTARGET from the table at the bottom of the page.

export BUILD64="[BUILD64 entries]"
export GCCTARGET="[GCCTARGET entries]"

Copy settings to Environment

Now add the host and target variables, and compiler and linker flags, to ~/.bashrc, just in case you have to exit and restart building later:

cat >> ~/.bashrc << EOF
export CLFS_HOST="${CLFS_HOST}"
export CLFS_TARGET="${CLFS_TARGET}"
export BUILD64="${BUILD64}"
export GCCTARGET="${GCCTARGET}"
EOF

The following table gives the entries for different Sparc 64 capable processors. Pick the processor that matches your system. Note: GCC settings are only needed in the early sections of the book, and will not be used in the final-system builds.

Table 4.1. List of architectures, target triplets, and recommended book

Processor BUILD64 GCCTARGET
Ultrasparc and Ultrasparc2 -m64 -mcpu=ultrasparc -mtune=ultrasparc -mcpu=ultrasparc -mtune=ultrasparc
Ultrasparc3 -m64 -mcpu=ultrasparc3 -mtune=ultrasparc3 -mcpu=ultrasparc3 -mtune=ultrasparc3