All programs compiled in this chapter will be installed under $LFS/tools to keep them separate from the programs compiled in the next chapter. The programs compiled here are only temporary tools and won't be a part of the final LFS system and by keeping them in a separate directory, we can later easily throw them away. This also helps prevent them from ending up in your host's production directories (easy to do in Chapter 5), which could be a very bad thing.
Later on you might wish to search through the binaries of your system to see what files they make use of or link against. To make this searching easier you may want to choose a unique name for the directory in which the temporary tools are stored. Instead of the simple “tools” you could use something like “tools-for-lfs”. However, you'll need to be careful to adjust all references to “tools” throughout the book -- including those in any patches, notably the GCC Specs Patch.
Create the required directory by running the following:
mkdir $LFS/tools
The next step is to create a /tools symlink on your host system. It will point to the directory we just created on the LFS partition:
ln -s $LFS/tools /
Note | |
---|---|
The above command is correct. The ln command has a few syntactic variations, so be sure to check the info page before reporting what you may think is an error. |
The created symlink enables us to compile our toolchain 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 LFS partition).