All programs compiled in Chapter 5
will be installed under $HLFS/tools to
keep them separate from the programs compiled in Chapter
6. The programs compiled here are temporary tools and will not be
a part of the final HLFS system. By keeping these programs in a
separate directory, they can easily be discarded later after their
use. This also prevents these programs from ending up in the host
production directories (easy to do by accident in Chapter
5).
Create the required directory by running the following as root:
mkdir $HLFS/tools
The next step is to create a /tools
symlink on the host system. This will point to the newly-created
directory on the HLFS partition. Run this command as root as well:
ln -s $HLFS/tools /
The above command is correct. The ln command has a few syntactic variations, so be sure to check the info and man pages before reporting what you may think is an error.
The created symlink enables the toolchain to be compiled so that it
always refers to /tools, meaning that
the compiler, assembler, and linker will work both in this chapter
(when we are still using some tools from the host) and in the next
(when we are “chrooted” to the
HLFS partition).
Downloaded packages and patches will need to be stored somewhere that
is conveniently available throughout the entire build. A working
directory is also required to unpack the sources and build them.
$HLFS/sources can be used both as the
place to store the tarballs and patches and as a working directory.
By using this directory, the required elements will be located on the
HLFS partition and will be available during all stages of the
building process.
To create this directory, execute the following command:
mkdir $HLFS/sources
Make this directory writable and sticky. “Sticky” means that even if multiple users have write permission on a directory, only the owner of a file can delete the file within a sticky directory. The following command will enable the write and sticky modes:
chmod a+wt $HLFS/sources