Chapter 4 Final Preparations

There are only a few small issues to deal with in this chapter. They all occur in section 4.3 of the book. Other than the slight change in one command, you should follow all the directions in the chapter.

Section 4.3

The book will have you create a special user called lfs to build all of the stuff in chapter five. We need to store this user's information onto the virtual hard drive rather than the in the CD's fake filesystem. This way we will not need to reconfigure this user when we reboot the system. To store this user onto the hard drive we need to alter the useradd command a little bit. Use this command instead:

useradd -s /bin/bash -g lfs -m -b $LFS/home -k /dev/null lfs

You do not need to create a password of the lfs user. That step is optional. If you create it be sure you will remember it for later.

Section 4.5

At the bottom of the section you will see a yellow box with information about setting parallel build make flags. If your VM has Vt-x or AMD-V enabled, then be sure to carefully read this section.

Building in parallel can speed up the build process enormously. But there is a price. First, you need to make sure that the number of cores set here will not be used by the host system. Task switching is expensive time wise, you need to minimize that. Second, some builds must not be done in parallel! The book will warn you about it, you will need to remember to reset the environment variable for those packages. Finally, your SBU's may be way off, but generally the actual compile time should be considerably smaller than the listed SBU.

If you have decided to use parallel building then copy this little script into your system. The script works by appending to your bashrc file the number of processors assigned to the VM.

cat >> ~/.bashrc << "EOF"
export MAKEFLAGS="-j $(grep 'processor' /proc/cpuinfo | wc -l)"
EOF

Now you need to make the setting take effect.

source ~/.bash_profile