Linux From ScratchVersion 6.1.1Gerard BeekmansCopyright © 1999–2005 Gerard BeekmansCopyright (c) 1999–2005, Gerard BeekmansAll rights reserved.Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions in any form must retain the above copyright notice, this list of conditions and the following disclaimer Neither the name of “Linux From Scratch” nor the names of its contributors may be used to endorse or promote products derived from this material without specific prior written permission Any material derived from Linux From Scratch must contain a reference to the “Linux From Scratch” projectTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.Table of Contents Preface Foreword Audience Prerequisites Host System Requirements Typography Structure Errata I. Introduction 1. Introduction How to Build an LFS System Changelog Resources Help II. Preparing for the Build 2. Preparing a New Partition Introduction Creating a New Partition Creating a File System on the Partition Mounting the New Partition 3. Packages and Patches Introduction All Packages Needed Patches 4. Final Preparations About $LFS Creating the $LFS/tools Directory Adding the LFS User Setting Up the Environment About SBUs About the Test Suites 5. Constructing a Temporary System Introduction Toolchain Technical Notes Binutils-2.15.94.0.2.2 - Pass 1 GCC-3.4.3 - Pass 1 Linux-Libc-Headers-2.6.11.2 Glibc-2.3.4 Adjusting the Toolchain Tcl-8.4.9 Expect-5.43.0 DejaGNU-1.4.4 GCC-3.4.3 - Pass 2 Binutils-2.15.94.0.2.2 - Pass 2 Gawk-3.1.4 Coreutils-5.2.1 Bzip2-1.0.3 Gzip-1.3.5 Diffutils-2.8.1 Findutils-4.2.23 Make-3.80 Grep-2.5.1a Sed-4.1.4 Gettext-0.14.3 Ncurses-5.4 Patch-2.5.4 Tar-1.15.1 Texinfo-4.8 Bash-3.0 M4-1.4.3 Bison-2.0 Flex-2.5.31 Util-linux-2.12q Perl-5.8.7 Stripping III. Building the LFS System 6. Installing Basic System Software Introduction Mounting Virtual Kernel File Systems Entering the Chroot Environment Changing Ownership Creating Directories Creating Essential Symlinks Creating the passwd, group, and log Files Populating /dev Linux-Libc-Headers-2.6.11.2 Man-pages-2.01 Glibc-2.3.4 Re-adjusting the Toolchain Binutils-2.15.94.0.2.2 GCC-3.4.3 Coreutils-5.2.1 Zlib-1.2.3 Mktemp-1.5 Iana-Etc-1.04 Findutils-4.2.23 Gawk-3.1.4 Ncurses-5.4 Readline-5.0 Vim-6.3 M4-1.4.3 Bison-2.0 Less-382 Groff-1.19.1 Sed-4.1.4 Flex-2.5.31 Gettext-0.14.3 Inetutils-1.4.2 IPRoute2-2.6.11-050330 Perl-5.8.7 Texinfo-4.8 Autoconf-2.59 Automake-1.9.5 Bash-3.0 File-4.13 Libtool-1.5.14 Bzip2-1.0.3 Diffutils-2.8.1 Kbd-1.12 E2fsprogs-1.37 Grep-2.5.1a GRUB-0.96 Gzip-1.3.5 Hotplug-2004_09_23 Man-1.5p Make-3.80 Module-Init-Tools-3.1 Patch-2.5.4 Procps-3.2.5 Psmisc-21.6 Shadow-4.0.9 Sysklogd-1.4.1 Sysvinit-2.86 Tar-1.15.1 Udev-056 Util-linux-2.12q About Debugging Symbols Stripping Again Cleaning Up 7. Setting Up System Bootscripts Introduction LFS-Bootscripts-3.2.1 How Do These Bootscripts Work? Device and Module Handling on an LFS System Configuring the setclock Script Configuring the Linux Console Configuring the sysklogd script Creating the /etc/inputrc File The Bash Shell Startup Files Configuring the localnet Script Creating the /etc/hosts File Configuring the network Script 8. Making the LFS System Bootable Introduction Creating the /etc/fstab File Linux-2.6.11.12 Making the LFS System Bootable 9. The End The End Get Counted Rebooting the System What Now? IV. Appendices A. Acronyms and Terms B. Acknowledgments IndexPreface1. ForewordMy adventures in Linux began in 1998 when I downloaded and installed my first distribution. After working with it for a while, I discovered issues I definitely would have liked to see improved upon. For example, I didn't like the arrangement of the bootscripts or the way programs were configured by default. I tried a number of alternative distributions to address these issues, yet eachhad its pros and cons. Finally, I realized that if I wanted full satisfaction from my Linux system, I would have to build my own from scratch.What does this mean? I resolved not to use pre-compiled packages of any kind, nor CD-ROMs or boot disks that would install basic utilities. I would use my current Linux system to develop my own customized system. This “perfect” Linux system would then have the strengths of various systems without their associated weaknesses. In the beginning, the idea was rather daunting, but Iremained committed to the idea that a system could be built that would conform to my needs and desires rather than to a standard that just did not fit what I was looking for.After sorting through issues such as circular dependencies and compile-time errors, I created a custom-built Linux system that was fully operational and suitable to individual needs. This process also allowed me to create compact and streamlined Linux systems which are faster and take up less space than traditional operating systems. I called this system a Linux From Scratch system, oran LFS system for short.As I shared my goals and experiences with other members of the Linux community, it became apparent that there was sustained interest in the ideas set forth in my Linux adventures. Such custom-built LFS systems serve not only to meet user specifications and requirements, but also serve as an ideal learning opportunity for programmers and system administrators to enhance their Linuxskills. Out of this broadened interest, the Linux From Scratch Project was born.This Linux From Scratch book provides readers with the background and instruction to design and build custom Linux systems. This book highlights the Linux from Scratch project and the benefits of using this system. Users can dictate all aspects of their system, including directory layout, script setup, and security. The resulting system will be compiled completely from the source code,and the user will be able to specify where, why, and how programs are installed. This book allows readers to fully customize Linux systems to their own needs and allows users more control over their system.I hope you will have a great time working on your own LFS system, and enjoy the numerous benefits of having a system that is truly your own.--Gerard Beekmansgerard AT linuxfromscratch D0T org2. AudienceThere are many reasons why somebody would want to read this book. The principal reason is to install a Linux system from the source code. A question many people raise is, “why go through all the hassle of manually building a Linux system from scratch when you can just download and install an existing one?” That is a good question and is the impetus for this section of the book.One important reason for LFS's existence is to help people learn how a Linux system works from the inside out. Building an LFS system helps demonstrate what makes Linux tick, and how things work together and depend on each other. One of the best things that this learning experience provides is the ability to customize Linux to your own tastes and needs.A key benefit of LFS is that it allows users to have more control over the system without relying on someone else's Linux implementation. With LFS, you are in the driver's seat and dictate every aspect of the system, such as the directory layout and bootscript setup. You also dictate where, why, and how programs are installed.Another benefit of LFS is the ability to create a very compact Linux system. When installing a regular distribution, one is often forced to include several programs which are probably never used. These programs waste disk space, or worse, CPU cycles. It is not difficult to build an LFS system of less than 100 megabytes (MB), which is substantially smaller than the majority of existinginstallations. Does this still sound like a lot of space? A few of us have been working on creating a very small embedded LFS system. We successfully built a system that was specialized to run the Apache web server with approximately 8MB of disk space used. Further stripping could bring this down to 5 MB or less. Try that with a regular distribution! This is only one of the many benefitsof designing your own Linux implementation.We could compare Linux distributions to a hamburger purchased at a fast-food restaurant—you have no idea what might be in what you are eating. LFS, on the other hand, does not give you a hamburger. Rather, LFS provides the recipe to make the exact hamburger desired. This allows users to review the recipe, omit unwanted ingredients, and add your own ingredients to enhance the flavor ofthe burger. When you are satisfied with the recipe, move on to preparing it. It can be made to exact specifications—broil it, bake it, deep-fry it, or barbecue it.Another analogy that we can use is that of comparing LFS with a finished house. LFS provides the skeletal plan of a house, but it is up to you to build it. LFS maintains the freedom to adjust plans throughout the process, customizing it to the user's needs and preferences.An additional advantage of a custom built Linux system is security. By compiling the entire system from source code, you are empowered to audit everything and apply all the security patches desired. It is no longer necessary to wait for somebody else to compile binary packages that fix a security hole. Unless you examine the patch and implement it yourself, you have no guarantee that thenew binary package was built correctly and adequately fixes the problem.The goal of Linux From Scratch is to build a complete and usable foundation-level system. Readers who do not wish to build their own Linux system from scratch may not benefit from the information in this book. If you only want to know what happens while the computer boots, we recommend the “From Power Up To Bash Prompt” HOWTO located at http://axiom.anu.edu.au/~okeefe/p2b/ or on TheLinux Documentation Project's (TLDP) website at http://www.tldp.org/HOWTO/From-PowerUp-To-Bash-Prompt-HOWTO.html. The HOWTO builds a system which is similar to that of this book, but it focuses strictly on creating a system capable of booting to a BASH prompt. Consider your objective. If you wish to build a Linux system while learning along the way, then this book is your best choice.There are too many good reasons to build your own LFS system to list them all here. This section is only the tip of the iceberg. As you continue in your LFS experience, you will find the power that information and knowledge truly bring.3. PrerequisitesBuilding an LFS system is not a simple task. It requires a certain level of existing knowledge of Unix system administration in order to resolve problems, and correctly execute the commands listed. In particular, as an absolute minimum, the reader should already have the ability to use the command line (shell) to copy or move files and directories, list directory and file contents, andchange the current directory. It is also expected that the reader has a reasonable knowledge of using and installing Linux software.Because the LFS book assumes at least this basic level of skill, the various LFS support forums are unlikely to be able to provide you with much assistance; you will find that your questions regarding such basic knowledge will likely go unanswered, or you will simply be referred to the LFS essential pre-reading list.Before building an LFS system, we recommend reading the following HOWTOs: Software-Building-HOWTO http://www.tldp.org/HOWTO/Software-Building-HOWTO.html This is a comprehensive guide to building and installing “generic” Unix software distributions under Linux. The Linux Users' Guide http://www.linuxhq.com/guides/LUG/guide.html This guide covers the usage of assorted Linux software. The Essential Pre-Reading Hint http://www.linuxfromscratch.org/hints/downloads/files/essential_prereading.txt This is an LFS Hint written specifically for users new to Linux. It includes a list of links to excellent sources of information on a wide range of topics. Anyone attempting to install LFS should have an understanding of many of the topics in this hint.4. Host System RequirementsThe host must be running at least a 2.6.2 kernel compiled with GCC-3.0 or higher. There are two main reasons for this requirement. First, the Native POSIX Threading Library (NPTL) test suite will segfault if the host's kernel has not been compiled with GCC-3.0 or a later version. Second, the 2.6.2 or later version of the kernel is required for the use of Udev. Udev creates devicesdynamically by reading from the sysfs file system. However, support for this filesystem has only recently been implemented in most of the kernel drivers. We must be sure that all critical system devices get created properly.In order to determine whether the host kernel meets the requirements outlined above, run the following command:cat /proc/versionThis will produce output similar to:Linux version 2.6.2 (user@host) (gcc version 3.4.0) #1 Tue Apr 20 21:22:18 GMT 2004If the results of the above command do not state that the host kernel is either 2.6.2 (or later), or that it was not compiled using a GCC-3.0 (or later) compiler, one will need to be installed. There are two methods you can take to solve this. First, see if your Linux vendor provides a 2.6.2 (or later) kernel package. If so, you may wish to install it. If your vendor doesn't offer a2.6.2 (or later) kernel package, or you would prefer not to install it, then you can compile a 2.6 kernel yourself. Instructions for compiling the kernel and configuring the boot loader (assuming the host uses GRUB) are located in Chapter 8. This second option can also be seen as a gauge of your current Linux skills. If this second requirement is too steep, then the LFS book will notlikely be much use to you at this time.5. TypographyTo make things easier to follow, there are a few typographical conventions used throughout this book. This section contains some examples of the typographical format found throughout Linux From Scratch../configure --prefix=/usrThis form of text is designed to be typed exactly as seen unless otherwise noted in the surrounding text. It is also used in the explanation sections to identify which of the commands is being referenced.install-info: unknown option '--dir-file=/mnt/lfs/usr/info/dir'This form of text (fixed-width text) shows screen output, probably as the result of commands issued. This format is also used to show filenames, such as /etc/ld.so.conf.EmphasisThis form of text is used for several purposes in the book. Its main purpose is to emphasize important points or items.http://www.linuxfromscratch.org/This format is used for hyperlinks both within the LFS community and to external pages. It includes HOWTOs, download locations, and websites.cat > $LFS/etc/group << "EOF"root:x:0:bin:x:1:......EOFThis format is used when creating configuration files. The first command tells the system to create the file $LFS/etc/group from whatever is typed on the following lines until the sequence end of file (EOF) is encountered. Therefore, this entire section is generally typed as seen.[REPLACED TEXT]This format is used to encapsulate text that is not to be typed as seen or copied-and-pasted.passwd(5)This format is used to refer to a specific manual page (hereinafter referred to simply as a “man” page). The number inside parentheses indicates a specific section inside of man. For example, passwd has two man pages. Per LFS installation instructions, those two man pages will be located at /usr/share/man/man1/passwd.1 and /usr/share/man/man5/passwd.5. Both man pages have differentinformation in them. When the book uses passwd(5) it is specifically referring to /usr/share/man/man5/passwd.5. man passwd will print the first man page it finds that matches “passwd”, which will be /usr/share/man/man1/passwd.1. For this example, you will need to run man 5 passwd in order to read the specific page being referred to. It should be noted that most man pages do not haveduplicate page names in different sections. Therefore, man [program name] is generally sufficient.6. StructureThis book is divided into the following parts.6.1. Part I - IntroductionPart I explains a few important notes on how to proceed with the LFS installation. This section also provides meta-information about the book.6.2. Part II - Preparing for the BuildPart II describes how to prepare for the building process—making a partition, downloading the packages, and compiling temporary tools.6.3. Part III - Building the LFS SystemPart III guides the reader through the building of the LFS system—compiling and installing all the packages one by one, setting up the boot scripts, and installing the kernel. The resulting Linux system is the foundation on which other software can be built to expand the system as desired. At the end of this book, there is an easy to use reference listing all of the programs,libraries, and important files that have been installed.7. ErrataThe software used to create an LFS system is constantly being updated and enhanced. Security warnings and bug fixes may become available after the LFS book has been released. To check whether the package versions or instructions in this release of LFS need any modifications to accommodate security vulnerabilities or other bug fixes, please visithttp://www.linuxfromscratch.org/lfs/errata/6.1.1/ before proceeding with your build. You should note any changes shown and apply them to the relevant section of the book as you progress with building the LFS system.Part I. IntroductionTable of Contents 1. Introduction How to Build an LFS System Changelog Resources HelpChapter 1. Introduction1.1. How to Build an LFS SystemThe LFS system will be built by using a previously installed Linux distribution (such as Debian, Mandrake, Red Hat, or SuSE). This existing Linux system (the host) will be used as a starting point to provide necessary programs, including a compiler, linker, and shell, to build the new system. Select the “development” option during the distribution installation to be able to accessthese tools.As an alternative to installing an entire separate distribution onto your machine, you may wish to use the Linux From Scratch LiveCD. The CD works well as a host system, providing all the tools you need to successfully follow the instructions in this book. Additionally, it contains all the source packages, patches and a copy of this book. So once you have the CD, no network connection oradditional downloads are necessary. For more information about the LFS LiveCD or to download a copy, visit http://www.linuxfromscratch.org/livecd/.Chapter 2 of this book describes how to create a new Linux native partition and file system, the place where the new LFS system will be compiled and installed. Chapter 3 explains which packages and patches need to be downloaded to build an LFS system and how to store them on the new file system. Chapter 4 discusses the setup for an appropriate working environment. Please read Chapter 4carefully as it explains several important issues the developer should be aware of before beginning to work through Chapter 5 and beyond.Chapter 5 explains the installation of a number of packages that will form the basic development suite (or toolchain) which is used to build the actual system in Chapter 6. Some of these packages are needed to resolve circular dependencies—for example, to compile a compiler, you need a compiler.Chapter 5 also shows the user how to build a first pass of the toolchain, including Binutils and GCC (first pass basically means these two core packages will be re-installed a second time). The next step is to build Glibc, the C library. Glibc will be compiled by the toolchain programs built in the first pass. Then, a second pass of the toolchain will be built. This time, the toolchainwill be dynamically linked against the newly built Glibc. The remaining Chapter 5 packages are built using this second pass toolchain. When this is done, the LFS installation process will no longer depend on the host distribution, with the exception of the running kernel.This effort to isolate the new system from the host distribution may seem excessive, but a full technical explanation is provided in Section 5.2, “Toolchain Technical Notes”.In Chapter 6, the full LFS system is built. The chroot (change root) program is used to enter a virtual environment and start a new shell whose root directory will be set to the LFS partition. This is very similar to rebooting and instructing the kernel to mount the LFS partition as the root partition. The system does not actually reboot, but instead chroot's because creating a bootablesystem requires additional work which is not necessary just yet. The major advantage is that “chrooting” allows the builder to continue using the host while LFS is being built. While waiting for package compilation to complete, a user can switch to a different virtual console (VC) or X desktop and continue using the computer as normal.To finish the installation, the LFS-Bootscripts are set up in Chapter 7, and the kernel and boot loader are set up in Chapter 8. Chapter 9 contains information on furthering the LFS experience beyond this book. After the steps in this book have been implemented, the computer will be ready to reboot into the new LFS system.This is the process in a nutshell. Detailed information on each step is discussed in the following chapters and package descriptions. Items that may seem complicated will be clarified, and everything will fall into place as the reader embarks on the LFS adventure.1.2. ChangelogThis is version 6.1.1 of the Linux From Scratch book, dated November 30, 2005. If this book is more than six months old, a newer and better version is probably already available. To find out, please check one of the mirrors via http://www.linuxfromscratch.org/.Below is a list of changes made since the previous release of the book. First a summary, then a detailed log. Upgraded to: Perl 5.8.7 Zlib 1.2.3 Added: binutils-2.15.94.0.2.2-gcc4-1.patch bzip2-1.0.3-install_docs-1.patch bzip2-1.0.3-bzgrep_security-1.patch glibc-2.3.4-rtld_search_dirs-1.patch glibc-2.3.4-tls_assert-1.patch texinfo-4.8-tempfile_fix-1.patch util-linux-2.12q-umount_fix-1.patch vim-6.3-security_fix-2.patch Removed: zlib-1.2.2-security_fix-1.patch; November 30, 2005 [matt]: LFS-6.1.1 release. November 24, 2005 [matt]: LFS-6.1.1-pre2 release. November 24, 2005 [matt]: Fix an issue with Glibc that prevents some programs (including OpenOffice.org) from running. November 23, 2005 [gerard]: Corrected reference to 'man page' to 'HTML documentation' in chapter 6/sec November 18, 2005 [manuel]: Fixed the unpack of the module-init-tools-testsuite package. November 18, 2005 [manuel]: PDF fixes. November 17, 2005 [matt]: LFS-6.1.1-pre1 release. November 12, 2005 [matt]: Improve the heuristic for determining a locale that is supported by both Glibc and packages outside LFS (bug 1642). Many thanks to Alexander Patrakov for highlighting the numerous issues and for reviewing the various suggested fixes. November 12, 2005 [matt]: Omit running Bzip2's testsuite as a separate step, as make runs it automatically (bug 1652). November 7, 2005 [matt]: Stop Udev from killing udevd processes on the host system (fixes bug 1651). Thanks to Alexander Patrakov for the report and the fix. November 5, 2005 [matt]: Add a note to the toolchain sanity check in chapter 5 to explain that if TCL fails to build, it's an indication of a broken toolchain (bug 1581). November 4, 2005 [matt]: Correct the instructions for running Module-Init-Tools' testsuite (fixes bug 1597). Thanks to Greg Schafer, Tushar Teredesai and to Randy McMurchy for providing the patch. October 29, 2005 [manuel]: PDF fixes. October 23, 2005 [manuel]: Added Bash documentation installation. Added notes about libiconv and Cracklib. Fixed the installation of Sed documentation. Replaced a patch for IPRoute2 by a sed command. October 19, 2005 [manuel]: Updated the acknowledgements to current trunk version. Ported some redaction changes in preface and chapter01 pages. Moved chapter02 to part II. Added -v switches. Ported several typos and redaction fixes from trunk. October 19, 2005 [manuel]: Updated the stylesheets, Makefile and related files to current trunk versions. October 15, 2005 [matt]: Use an updated version of the Udev rules file (fixes bug 1639). October 15, 2005 [matt]: Add a cdrom group as required by the Udev rules file October 14th, 2005 [ken]: Added a patch to allow binutils to be built from a host running gcc-4, updated glibc instructions for the rtld patch, updated space/time for perl and zlib. October 14th, 2005 [matt]: Added a patch to fix a security vulnerability in util-linux. October 14th, 2005 [matt]: Added the updated vim security patch. October 14th, 2005 [jhuntwork]: Added the bzip2 security and install docs patches. October 14th, 2005 [jhuntwork]: Added the tempfile patch for texinfo. October 14th, 2005 [ken]: Update packages and patches in the changelog to only reflect changes since 6.1. Update zlib. October 13th, 2005 [ken]: Fix known errors in lists of installed files and bump the perl version.1.3. Resources1.3.1. FAQIf during the building of the LFS system you encounter any errors, have any questions, or think there is a typo in the book, please start by consulting the Frequently Asked Questions (FAQ) that is located at http://www.linuxfromscratch.org/faq/.1.3.2. Mailing ListsThe linuxfromscratch.org server hosts a number of mailing lists used for the development of the LFS project. These lists include the main development and support lists, among others. If the FAQ does not solve the problem you are having, the next step would be to search the mailing lists at http://www.linuxfromscratch.org/search.html.For information on the different lists, how to subscribe, archive locations, and additional information, visit http://www.linuxfromscratch.org/mail.html.1.3.3. News ServerThe mailing lists hosted at linuxfromscratch.org are also accessible via the Network News Transfer Protocol (NNTP) server. All messages posted to a mailing list are copied to the corresponding newsgroup, and vice versa.The news server is located at news.linuxfromscratch.org.1.3.4. IRCSeveral members of the LFS community offer assistance on our community Internet Relay Chat (IRC) network. Before using this support, please make sure that your question is not already answered in the LFS FAQ or the mailing list archives. You can find the IRC network at irc.linuxfromscratch.org. The support channel is named #LFS-support.1.3.5. ReferencesFor additional information on the packages, useful tips are available in the LFS Package Reference page located at http://www.linuxfromscratch.org/~matthew/LFS-references.html.1.3.6. Mirror SitesThe LFS project has a number of world-wide mirrors to make accessing the website and downloading the required packages more convenient. Please visit the LFS website at http://www.linuxfromscratch.org/mirrors.html for a list of current mirrors.1.3.7. Contact InformationPlease direct all your questions and comments to one of the LFS mailing lists (see above).1.4. HelpIf an issue or a question is encountered while working through this book, check the FAQ page at http://www.linuxfromscratch.org/faq/#generalfaq. Questions are often already answered there. If your question is not answered on this page, try to find the source of the problem. The following hint will give you some guidance for troubleshooting:http://www.linuxfromscratch.org/hints/downloads/files/errors.txt.If you cannot find your problem listed in the FAQ, search the mailing lists at http://www.linuxfromscratch.org/search.html.We also have a wonderful LFS community that is willing to offer assistance through the mailing lists and IRC (see the Section 1.3, “Resources” section of this book). However, we get several support questions everyday and many of them can be easily answered by going to the FAQ and by searching the mailing lists first. So for us to offer the best assistance possible, you need to dosome research on your own first. That allows us to focus on the more unusual support needs. If your searches do not produce a solution, please include all relevant information (mentioned below) in your request for help.1.4.1. Things to MentionApart from a brief explanation of the problem being experienced, the essential things to include in any request for help are: The version of the book being used (in this case 6.1.1) The host distribution and version being used to create LFS The package or section the problem was encountered in The exact error message or symptom being received Note whether you have deviated from the book at allNoteDeviating from this book does not mean that we will not help you. After all, LFS is about personal preference. Being upfront about any changes to the established procedure helps us evaluate and determine possible causes of your problem.1.4.2. Configure Script ProblemsIf something goes wrong while running the configure script, review the config.log file. This file may contain errors encountered during configure which were not printed to the screen. Include the relevant lines if you need to ask for help.1.4.3. Compilation ProblemsBoth the screen output and the contents of various files are useful in determining the cause of compilation problems. The screen output from the configure script and the make run can be helpful. It is not necessary to include the entire output, but do include enough of the relevant information. Below is an example of the type of information to include from the screen output from make:gcc -DALIASPATH=\"/mnt/lfs/usr/share/locale:.\"-DLOCALEDIR=\"/mnt/lfs/usr/share/locale\" -DLIBDIR=\"/mnt/lfs/usr/lib\"-DINCLUDEDIR=\"/mnt/lfs/usr/include\" -DHAVE_CONFIG_H -I. -I.-g -O2 -c getopt1.cgcc -g -O2 -static -o make ar.o arscan.o commands.o dir.o expand.o file.o function.o getopt.o implicit.o job.o main.o misc.o read.o remake.o rule.o signame.o variable.o vpath.o default.o remote-stub.o version.o opt1.o-lutil job.o: In function `load_too_high':/lfs/tmp/make-3.79.1/job.c:1565: undefined reference to `getloadavg'collect2: ld returned 1 exit statusmake[2]: *** [make] Error 1make[2]: Leaving directory `/lfs/tmp/make-3.79.1'make[1]: *** [all-recursive] Error 1make[1]: Leaving directory `/lfs/tmp/make-3.79.1'make: *** [all-recursive-am] Error 2In this case, many people would just include the bottom section:make [2]: *** [make] Error 1This is not enough information to properly diagnose the problem because it only notes that something went wrong, not what went wrong. The entire section, as in the example above, is what should be saved because it includes the command that was executed and the associated error message(s).An excellent article about asking for help on the Internet is available online at http://catb.org/~esr/faqs/smart-questions.html. Read and follow the hints in this document to increase the likelihood of getting the help you need.Part II. Preparing for the BuildTable of Contents 2. Preparing a New Partition Introduction Creating a New Partition Creating a File System on the Partition Mounting the New Partition 3. Packages and Patches Introduction All Packages Needed Patches 4. Final Preparations About $LFS Creating the $LFS/tools Directory Adding the LFS User Setting Up the Environment About SBUs About the Test Suites 5. Constructing a Temporary System Introduction Toolchain Technical Notes Binutils-2.15.94.0.2.2 - Pass 1 GCC-3.4.3 - Pass 1 Linux-Libc-Headers-2.6.11.2 Glibc-2.3.4 Adjusting the Toolchain Tcl-8.4.9 Expect-5.43.0 DejaGNU-1.4.4 GCC-3.4.3 - Pass 2 Binutils-2.15.94.0.2.2 - Pass 2 Gawk-3.1.4 Coreutils-5.2.1 Bzip2-1.0.3 Gzip-1.3.5 Diffutils-2.8.1 Findutils-4.2.23 Make-3.80 Grep-2.5.1a Sed-4.1.4 Gettext-0.14.3 Ncurses-5.4 Patch-2.5.4 Tar-1.15.1 Texinfo-4.8 Bash-3.0 M4-1.4.3 Bison-2.0 Flex-2.5.31 Util-linux-2.12q Perl-5.8.7 StrippingChapter 2. Preparing a New Partition2.1. IntroductionIn this chapter, the partition which will host the LFS system is prepared. We will create the partition itself, create a file system on it, and mount it.2.2. Creating a New PartitionLike most other operating systems, LFS is usually installed on a dedicated partition. The recommended approach to building an LFS system is to use an available empty partition or, if you have enough unpartitioned space, to create one. However, an LFS system (in fact even multiple LFS systems) may also be installed on a partition already occupied by another operating system and thedifferent systems will co-exist peacefully. The document http://www.linuxfromscratch.org/hints/downloads/files/lfs_next_to_existing_systems.txt explains how to implement this, whereas this book discusses the method of using a fresh partition for the installation.A minimal system requires a partition of around 1.3 gigabytes (GB). This is enough to store all the source tarballs and compile the packages. However, if the LFS system is intended to be the primary Linux system, additional software will probably be installed which will require additional space (2-3 GB). The LFS system itself will not take up this much room. A large portion of thisrequirement is to provide sufficient free temporary storage. Compiling packages can require a lot of disk space which will be reclaimed after the package is installed.Because there is not always enough Random Access Memory (RAM) available for compilation processes, it is a good idea to use a small disk partition as swap space. This is used by the kernel to store seldom-used data and leave more memory available for active processes. The swap partition for an LFS system can be the same as the one used by the host system, in which case it is notnecessary to create another one.Start a disk partitioning program such as cfdisk or fdisk with a command line option naming the hard disk on which the new partition will be created—for example /dev/hda for the primary Integrated Drive Electronics (IDE) disk. Create a Linux native partition and a swap partition, if needed. Please refer to cfdisk(8) or fdisk(8) if you do not yet know how to use the programs.Remember the designation of the new partition (e.g., hda5). This book will refer to this as the LFS partition. Also remember the designation of the swap partition. These names will be needed later for the /etc/fstab file.2.3. Creating a File System on the PartitionNow that a blank partition has been set up, the file system can be created. The most widely-used system in the Linux world is the second extended file system (ext2), but with newer high-capacity hard disks, journaling file systems are becoming increasingly popular. We will create an ext2 file system. Build instructions for other file systems can be found athttp://www.linuxfromscratch.org/blfs/view/svn/postlfs/filesystems.html.To create an ext2 file system on the LFS partition, run the following:mke2fs -v /dev/[xxx]Replace [xxx] with the name of the LFS partition (hda5 in our previous example).NoteSome host distributions use custom features in their filesystem creation tools (e2fsprogs). This can cause problems when booting into your new LFS in Chapter 9, as those features will not be supported by the LFS-installed e2fsprogs; you will get an error similar to “unsupported filesystem features, upgrade your e2fsprogs”. To check if your host system uses custom enhancements, runthe following command:debugfs -R feature /dev/[xxx]If the output contains features other than: dir_index; filetype; large_file; resize_inode or sparse_super then your host system may have custom enhancements. In that case, to avoid later problems, you should compile the stock e2fsprogs package and use the resulting binaries to re-create the filesystem on your LFS partition:cd /tmptar -xjvf /path/to/sources/e2fsprogs-1.37.tar.bz2cd e2fsprogs-1.37mkdir -v buildcd build../configuremake #note that we intentionally don't 'make install' here!./misc/mke2fs -v /dev/[xxx]cd /tmprm -rfv e2fsprogs-1.37If a swap partition was created, it will need to be initialized for use by issuing the command below. If you are using an existing swap partition, there is no need to format it.mkswap -v /dev/[yyy]Replace [yyy] with the name of the swap partition.2.4. Mounting the New PartitionNow that a file system has been created, the partition needs to be made accessible. In order to do this, the partition needs to be mounted at a chosen mount point. For the purposes of this book, it is assumed that the file system is mounted under /mnt/lfs, but the directory choice is up to you.Choose a mount point and assign it to the LFS environment variable by running:export LFS=/mnt/lfsNext, create the mount point and mount the LFS file system by running:mkdir -pv $LFSmount -v /dev/[xxx] $LFSReplace [xxx] with the designation of the LFS partition.If using multiple partitions for LFS (e.g., one for / and another for /usr), mount them using:mkdir -pv $LFSmount -v /dev/[xxx] $LFSmkdir -v $LFS/usrmount -v /dev/[yyy] $LFS/usrReplace [xxx] and [yyy] with the appropriate partition names.Ensure that this new partition is not mounted with permissions that are too restrictive (such as the nosuid, nodev, or noatime options). Run the mount command without any parameters to see what options are set for the mounted LFS partition. If nosuid, nodev, and/or noatime are set, the partition will need to be remounted.Now that there is an established place to work, it is time to download the packages.Chapter 3. Packages and Patches3.1. IntroductionThis chapter includes a list of packages that need to be downloaded for building a basic Linux system. The listed version numbers correspond to versions of the software that are known to work, and this book is based on their use. We highly recommend not using newer versions because the build commands for one version may not work with a newer version. The newest package versions may alsohave problems that require work-arounds. These work-arounds will be developed and stabilized in the development version of the book.Download locations may not always be accessible. If a download location has changed since this book was published, Google (http://www.google.com/) provides a useful search engine for most packages. If this search is unsuccessful, try one of the alternative means of downloading discussed at http://www.linuxfromscratch.org/lfs/packages.html.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. $LFS/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 LFS partitionand will be available during all stages of the building process.To create this directory, execute, as user root, the following command before starting the download session:mkdir -v $LFS/sourcesMake 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 -v a+wt $LFS/sources3.2. All PackagesDownload or otherwise obtain the following packages:Autoconf (2.59) - 908 kilobytes (KB): http://ftp.gnu.org/gnu/autoconf/Automake (1.9.5) - 748 KB: http://ftp.gnu.org/gnu/automake/Bash (3.0) - 1,824 KB: http://ftp.gnu.org/gnu/bash/Bash Documentation (3.0) - 1,994 KB: http://ftp.gnu.org/gnu/bash/Binutils (2.15.94.0.2.2) - 11,056 KB: http://www.kernel.org/pub/linux/devel/binutils/Bison (2.0) - 916 KB: http://ftp.gnu.org/gnu/bison/Bzip2 (1.0.3) - 596 KB: http://www.bzip.org/Coreutils (5.2.1) - 4,184 KB: http://ftp.gnu.org/gnu/coreutils/DejaGNU (1.4.4) - 852 KB: http://ftp.gnu.org/gnu/dejagnu/Diffutils (2.8.1) - 648 KB: http://ftp.gnu.org/gnu/diffutils/E2fsprogs (1.37) - 3,100 KB: http://prdownloads.sourceforge.net/e2fsprogs/Expect (5.43.0) - 416 KB: http://expect.nist.gov/src/File (4.13) - 324 KB: ftp://ftp.gw.com/mirrors/pub/unix/file/ Note File (4.13) may no longer be available at the listed location. The site administrators of the master download location occasionally remove older versions when new ones are released. An alternative download location that may have the correct version available can also be found at: http://www.linuxfromscratch.org/lfs/download.html#ftp.Findutils (4.2.23) - 784 KB: http://ftp.gnu.org/gnu/findutils/Flex (2.5.31) - 672 KB: http://prdownloads.sourceforge.net/lex/Gawk (3.1.4) - 1,696 KB: http://ftp.gnu.org/gnu/gawk/GCC (3.4.3) - 26,816 KB: http://ftp.gnu.org/gnu/gcc/Gettext (0.14.3) - 4,568 KB: http://ftp.gnu.org/gnu/gettext/Glibc (2.3.4) - 12,924 KB: http://ftp.gnu.org/gnu/glibc/Glibc-Linuxthreads (2.3.4) - 236 KB: http://ftp.gnu.org/gnu/glibc/Grep (2.5.1a) - 520 KB: http://ftp.gnu.org/gnu/grep/Groff (1.19.1) - 2,096 KB: http://ftp.gnu.org/gnu/groff/GRUB (0.96) - 768 KB: ftp://alpha.gnu.org/gnu/grub/Gzip (1.3.5) - 284 KB: ftp://alpha.gnu.org/gnu/gzip/Hotplug (2004_09_23) - 40 KB: http://www.kernel.org/pub/linux/utils/kernel/hotplug/Iana-Etc (1.04) - 176 KB: http://www.sethwklein.net/projects/iana-etc/downloads/Inetutils (1.4.2) - 752 KB: http://ftp.gnu.org/gnu/inetutils/IPRoute2 (2.6.11-050330) - 276 KB: http://developer.osdl.org/dev/iproute2/download/Kbd (1.12) - 624 KB: http://www.kernel.org/pub/linux/utils/kbd/Less (382) - 216 KB: http://ftp.gnu.org/gnu/less/LFS-Bootscripts (3.2.1) - 32 KB: http://downloads.linuxfromscratch.org/Libtool (1.5.14) - 1,604 KB: http://ftp.gnu.org/gnu/libtool/Linux (2.6.11.12) - 35,792 KB: http://www.kernel.org/pub/linux/kernel/v2.6/Linux-Libc-Headers (2.6.11.2) - 2,476 KB: http://ep09.pld-linux.org/~mmazur/linux-libc-headers/M4 (1.4.3) - 304 KB: http://ftp.gnu.org/gnu/m4/Make (3.80) - 904 KB: http://ftp.gnu.org/gnu/make/Man (1.5p) - 208 KB: http://www.kernel.org/pub/linux/utils/man/Man-pages (2.01) - 1,640 KB: http://www.kernel.org/pub/linux/docs/manpages/Mktemp (1.5) - 68 KB: ftp://ftp.mktemp.org/pub/mktemp/Module-Init-Tools (3.1) - 128 KB: http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/Module-Init-Tools-Testsuite (3.1) - 34 KB: http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/Ncurses (5.4) - 1,556 KB: ftp://invisible-island.net/ncurses/Patch (2.5.4) - 156 KB: http://ftp.gnu.org/gnu/patch/Perl (5.8.7) - 9,628 KB: http://ftp.funet.fi/pub/CPAN/src/Procps (3.2.5) - 224 KB: http://procps.sourceforge.net/Psmisc (21.6) - 188 KB: http://prdownloads.sourceforge.net/psmisc/Readline (5.0) - 1,456 KB: http://ftp.gnu.org/gnu/readline/Sed (4.1.4) - 632 KB: http://ftp.gnu.org/gnu/sed/Shadow (4.0.9) - 1,084 KB: ftp://ftp.pld.org.pl/software/shadow/ Note Shadow (4.0.9) may no longer be available at the listed location. The site administrators of the master download location occasionally remove older versions when new ones are released. An alternative download location that may have the correct version available cat also be found at: http://www.linuxfromscratch.org/lfs/download.html#ftp.Sysklogd (1.4.1) - 72 KB: http://www.infodrom.org/projects/sysklogd/download/Sysvinit (2.86) - 88 KB: ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/Tar (1.15.1) - 1,580 KB: http://ftp.gnu.org/gnu/tar/Tcl (8.4.9) - 2,748 KB: http://prdownloads.sourceforge.net/tcl/Texinfo (4.8) - 1,492 KB: http://ftp.gnu.org/gnu/texinfo/Udev (056) - 476 KB: http://www.kernel.org/pub/linux/utils/kernel/hotplug/Udev Rules Configuration - 5 KB: http://downloads.linuxfromscratch.org/udev-config-4.rulesUtil-linux (2.12q) - 1,344 KB: http://www.kernel.org/pub/linux/utils/util-linux/Vim (6.3) - 3,620 KB: ftp://ftp.vim.org/pub/vim/unix/Vim (6.3) language files (optional) - 540 KB: ftp://ftp.vim.org/pub/vim/extra/Zlib (1.2.3) - 415 KB: http://www.zlib.net/Total size of these packages: 146 MB3.3. Needed PatchesIn addition to the packages, several patches are also required. These patches correct any mistakes in the packages that should be fixed by the maintainer. The patches also make small modifications to make the packages easier to work with. The following patches will be needed to build an LFS system:Bash Avoid Wcontinued Patch - 1 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/bash-3.0-avoid_WCONTINUED-1.patchBash Various Fixes - 23 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/bash-3.0-fixes-3.patchBinutils Build From Host Running Gcc4 Patch - 2 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/binutils-2.15.94.0.2.2-gcc4-1.patchBzip2 Documentation Patch - 1 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/bzip2-1.0.3-install_docs-1.patchBzip2 Bzgrep Security Fixes Patch - 1 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/bzip2-1.0.3-bzgrep_security-1.patchCoreutils Suppress Uptime, Kill, Su Patch - 15 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/coreutils-5.2.1-suppress_uptime_kill_su-1.patchCoreutils Uname Patch - 4 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/coreutils-5.2.1-uname-2.patchExpect Spawn Patch - 7 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/expect-5.43.0-spawn-1.patchFlex Brokenness Patch - 156 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/flex-2.5.31-debian_fixes-3.patchGCC Linkonce Patch - 12 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/gcc-3.4.3-linkonce-1.patchGCC No-Fixincludes Patch - 1 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/gcc-3.4.3-no_fixincludes-1.patchGCC Specs Patch - 14 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/gcc-3.4.3-specs-2.patchGlibc Rtld Search Dirs Patch - 1 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/glibc-2.3.4-rtld_search_dirs-1.patchGlibc Fix Testsuite Patch - 1 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/glibc-2.3.4-fix_test-1.patchGlibc TLS Assertion Patch - 6 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/glibc-2.3.4-tls_assert-1.patchGzip Security Patch - 2 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/gzip-1.3.5-security_fixes-1.patchInetutils Kernel Headers Patch - 1 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/inetutils-1.4.2-kernel_headers-1.patchInetutils No-Server-Man-Pages Patch - 4 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/inetutils-1.4.2-no_server_man_pages-1.patchMktemp Tempfile Patch - 3 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/mktemp-1.5-add_tempfile-2.patchPerl Libc Patch - 1 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/perl-5.8.7-libc-1.patchReadline Fixes Patch - 7 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/readline-5.0-fixes-1.patchSysklogd Fixes Patch - 27 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/sysklogd-1.4.1-fixes-1.patchTar Sparse Fix Patch - 1 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/tar-1.15.1-sparse_fix-1.patchTexinfo Tempfile Fix Patch - 2 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/texinfo-4.8-tempfile_fix-1.patchUtil-linux Cramfs Patch - 3 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/util-linux-2.12q-cramfs-1.patchUtil-linux Umount Patch - 1 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/util-linux-2.12q-umount_fix-1.patchVim Security Patch - 8 KB: http://www.linuxfromscratch.org/patches/lfs/6.1.1/vim-6.3-security_fix-2.patchIn addition to the above required patches, there exist a number of optional patches created by the LFS community. These optional patches solve minor problems or enable functionality that is not enabled by default. Feel free to peruse the patches database located at http://www.linuxfromscratch.org/patches/ and acquire any additional patches to suit the system needs.Chapter 4. Final Preparations4.1. About $LFSThroughout this book, the environment variable LFS will be used several times. It is paramount that this variable is always defined. It should be set to the mount point chosen for the LFS partition. Check that the LFS variable is set up properly with:echo $LFSMake sure the output shows the path to the LFS partition's mount point, which is /mnt/lfs if the provided example was followed. If the output is incorrect, the variable can be set with:export LFS=/mnt/lfsHaving this variable set is beneficial in that commands such as mkdir $LFS/tools can be typed literally. The shell will automatically replace “$LFS” with “/mnt/lfs” (or whatever the variable was set to) when it processes the command line.Do not forget to check that $LFS is set whenever you leave and reenter the current working environment (as when doing a “su” to root or another user).4.2. Creating the $LFS/tools DirectoryAll programs compiled in Chapter 5 will be installed under $LFS/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 LFS 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 thehost production directories (easy to do by accident in Chapter 5).Create the required directory by running the following as root:mkdir -v $LFS/toolsThe next step is to create a /tools symlink on the host system. This will point to the newly-created directory on the LFS partition. Run this command as root as well:ln -sv $LFS/tools /NoteThe above command is correct. The ln command has a few syntactic variations, so be sure to check info coreutils ln and ln(1) 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 LFS partition).4.3. Adding the LFS UserWhen logged in as user root, making a single mistake can damage or destroy a system. Therefore, we recommend building the packages in this chapter as an unprivileged user. You could use your own user name, but to make it easier to set up a clean working environment, create a new user called lfs as a member of a new group (also named lfs) and use this user during the installation process.As root, issue the following commands to add the new user:groupadd lfsuseradd -s /bin/bash -g lfs -m -k /dev/null lfsThe meaning of the command line options:-s /bin/bash This makes bash the default shell for user lfs.-g lfs This option adds user lfs to group lfs.-m This creates a home directory for lfs.-k /dev/null This parameter prevents possible copying of files from a skeleton directory (default is /etc/skel) by changing the input location to the special null device.lfs This is the actual name for the created group and user.To log in as lfs (as opposed to switching to user lfs when logged in as root, which does not require the lfs user to have a password), give lfs a password:passwd lfsGrant lfs full access to $LFS/tools by making lfs the directory owner:chown -v lfs $LFS/toolsIf a separate working directory was created as suggested, give user lfs ownership of this directory:chown -v lfs $LFS/sourcesNext, login as user lfs. This can be done via a virtual console, through a display manager, or with the following substitute user command:su - lfsThe “-” instructs su to start a login shell as opposed to a non-login shell. The difference between these two types of shells can be found in detail in bash(1) and info bash.4.4. Setting Up the EnvironmentSet up a good working environment by creating two new startup files for the bash shell. While logged in as user lfs, issue the following command to create a new .bash_profile:cat > ~/.bash_profile << "EOF"exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bashEOFWhen logged on as user lfs, the initial shell is usually a login shell which reads the /etc/profile of the host (probably containing some settings and environment variables) and then .bash_profile. The exec env -i.../bin/bash command in the .bash_profile file replaces the running shell with a new one with a completely empty environment, except for the HOME, TERM, and PS1 variables. Thisensures that no unwanted and potentially hazardous environment variables from the host system leak into the build environment. The technique used here achieves the goal of ensuring a clean environment.The new instance of the shell is a non-login shell, which does not read the /etc/profile or .bash_profile files, but rather reads the .bashrc file instead. Create the .bashrc file now:cat > ~/.bashrc << "EOF"set +humask 022LFS=/mnt/lfsLC_ALL=POSIXPATH=/tools/bin:/bin:/usr/binexport LFS LC_ALL PATHEOFThe set +h command turns off bash's hash function. Hashing is ordinarily a useful feature—bash uses a hash table to remember the full path of executable files to avoid searching the PATH time and again to find the same executable. However, the new tools should be used as soon as they are installed. By switching off the hash function, the shell will always search the PATH when a programis to be run. As such, the shell will find the newly compiled tools in $LFS/tools as soon as they are available without remembering a previous version of the same program in a different location.Setting the user file-creation mask (umask) to 022 ensures that newly created files and directories are only writable by their owner, but are readable and executable by anyone (assuming default modes are used by the open(2) system call, new files will end up with permission mode 644 and directories with mode 755).The LFS variable should be set to the chosen mount point.The LC_ALL variable controls the localization of certain programs, making their messages follow the conventions of a specified country. If the host system uses a version of Glibc older than 2.2.4, having LC_ALL set to something other than “POSIX” or “C” (during this chapter) may cause issues if you exit the chroot environment and wish to return later. Setting LC_ALL to“POSIX” or “C” (the two are equivalent) ensures that everything will work as expected in the chroot environment.By putting /tools/bin ahead of the standard PATH, all the programs installed in Chapter 5 are picked up by the shell immediately after their installation. This, combined with turning off hashing, limits the risk that old programs are used from the host when the same programs are available in the chapter 5 environment.Finally, to have the environment fully prepared for building the temporary tools, source the just-created user profile:source ~/.bash_profile4.5. About SBUsMany people would like to know beforehand approximately how long it takes to compile and install each package. Because Linux From Scratch can be built on many different systems, it is impossible to provide accurate time estimates. The biggest package (Glibc) will take approximately 20 minutes on the fastest systems, but could take up to three days on slower systems! Instead of providingactual times, the Standard Build Unit (SBU) measure will be used instead.The SBU measure works as follows. The first package to be compiled from this book is Binutils in Chapter 5. The time it takes to compile this package is what will be referred to as the Standard Build Unit or SBU. All other compile times will be expressed relative to this time.For example, consider a package whose compilation time is 4.5 SBUs. This means that if a system took 10 minutes to compile and install the first pass of Binutils, it will take approximately 45 minutes to build this example package. Fortunately, most build times are shorter than the one for Binutils.In general, SBUs are not entirely accurate because they depend on many factors, including the host system's version of GCC. Note that on Symmetric Multi-Processor (SMP)-based machines, SBUs are even less accurate. They are provided here to give an estimate of how long it might take to install a package, but the numbers can vary by as much as dozens of minutes in some cases.To view actual timings for a number of specific machines, we recommend The LinuxFromScratch SBU Home Page at http://www.linuxfromscratch.org/~bdubbs/.4.6. About the Test SuitesMost packages provide a test suite. Running the test suite for a newly built package is a good idea because it can provide a “sanity check” indicating that everything compiled correctly. A test suite that passes its set of checks usually proves that the package is functioning as the developer intended. It does not, however, guarantee that the package is totally bug free.Some test suites are more important than others. For example, the test suites for the core toolchain packages—GCC, Binutils, and Glibc—are of the utmost importance due to their central role in a properly functioning system. The test suites for GCC and Glibc can take a very long time to complete, especially on slower hardware, but are strongly recommended.NoteExperience has shown that there is little to be gained from running the test suites in Chapter 5. There can be no escaping the fact that the host system always exerts some influence on the tests in that chapter, often causing inexplicable failures. Because the tools built in Chapter 5 are temporary and eventually discarded, we do not recommend running the test suites in Chapter 5 for theaverage reader. The instructions for running those test suites are provided for the benefit of testers and developers, but they are strictly optional.A common issue with running the test suites for Binutils and GCC is running out of pseudo terminals (PTYs). This can result in a high number of failing tests. This may happen for several reasons, but the most likely cause is that the host system does not have the devpts file system set up correctly. This issue is discussed in greater detail in Chapter 5.Sometimes package test suites will fail, but for reasons which the developers are aware of and have deemed non-critical. Consult the logs located at http://www.linuxfromscratch.org/lfs/build-logs/6.1.1/ to verify whether or not these failures are expected. This site is valid for all tests throughout this book.Chapter 5. Constructing a Temporary System5.1. IntroductionThis chapter shows how to compile and install a minimal Linux system. This system will contain just enough tools to start constructing the final LFS system in Chapter 6 and allow a working environment with more user convenience than a minimum environment would.There are two steps in building this minimal system. The first step is to build a new and host-independent toolchain (compiler, assembler, linker, libraries, and a few useful utilities). The second step uses this toolchain to build the other essential tools.The files compiled in this chapter will be installed under the $LFS/tools directory to keep them separate from the files installed in the next chapter and the host production directories. Since the packages compiled here are temporary, we do not want them to pollute the soon-to-be LFS system.ImportantBefore issuing the build instructions for a package, the package should be unpacked as user lfs, and a cd into the created directory should be performed. The build instructions assume that the bash shell is in use.Several of the packages are patched before compilation, but only when the patch is needed to circumvent a problem. A patch is often needed in both this and the next chapter, but sometimes in only one or the other. Therefore, do not be concerned if instructions for a downloaded patch seem to be missing. Warning messages about offset or fuzz may also be encountered when applying a patch.Do not worry about these warnings, as the patch was still successfully applied.During the compilation of most packages, there will be several warnings that scroll by on the screen. These are normal and can safely be ignored. These warnings are as they appear—warnings about deprecated, but not invalid, use of the C or C++ syntax. C standards change fairly often, and some packages still use the older standard. This is not a problem, but does prompt the warning.ImportantAfter installing each package, delete its source and build directories, unless specifically instructed otherwise. Deleting the sources prevents mis-configuration when the same package is reinstalled later. Only three of the packages need to retain the source and build directories in order for their contents to be used by later commands. Pay special attention to these reminders.Check one last time that the LFS environment variable is set up properly:echo $LFSMake sure the output shows the path to the LFS partition's mount point, which is /mnt/lfs, using our example.5.2. Toolchain Technical NotesThis section explains some of the rationale and technical details behind the overall build method. It is not essential to immediately understand everything in this section. Most of this information will be clearer after performing an actual build. This section can be referred back to at any time during the process.The overall goal of Chapter 5 is to provide a temporary environment that can be chrooted into and from which can be produced a clean, trouble-free build of the target LFS system in Chapter 6. Along the way, we separate the new system from the host system as much as possible, and in doing so, build a self-contained and self-hosted toolchain. It should be noted that the build process hasbeen designed to minimize the risks for new readers and provide maximum educational value at the same time.ImportantBefore continuing, be aware of the name of the working platform, often referred to as the target triplet. Many times, the target triplet will probably be i686-pc-linux-gnu. A simple way to determine the name of the target triplet is to run the config.guess script that comes with the source for many packages. Unpack the Binutils sources and run the script: ./config.guess and note theoutput.Also be aware of the name of the platform's dynamic linker, often referred to as the dynamic loader (not to be confused with the standard linker ld that is part of Binutils). The dynamic linker provided by Glibc finds and loads the shared libraries needed by a program, prepares the program to run, and then runs it. The name of the dynamic linker will usually be ld-linux.so.2. Onplatforms that are less prevalent, the name might be ld.so.1, and newer 64 bit platforms might be named something else entirely. The name of the platform's dynamic linker can be determined by looking in the /lib directory on the host system. A sure-fire way to determine the name is to inspect a random binary from the host system by running: readelf -l | grep interpreterand noting the output. The authoritative reference covering all platforms is in the shlib-versions file in the root of the Glibc source tree.Some key technical points of how the Chapter 5 build method works: The process is similar in principle to cross-compiling, whereby tools installed in the same prefix work in cooperation, and thus utilize a little GNU “magic” Careful manipulation of the standard linker's library search path ensures programs are linked only against chosen libraries Careful manipulation of gcc's specs file tells the compiler which target dynamic linker will be usedBinutils is installed first because the configure runs of both GCC and Glibc perform various feature tests on the assembler and linker to determine which software features to enable or disable. This is more important than one might first realize. An incorrectly configured GCC or Glibc can result in a subtly broken toolchain, where the impact of such breakage might not show up until nearthe end of the build of an entire distribution. A test suite failure will usually highlight this error before too much additional work is performed.Binutils installs its assembler and linker in two locations, /tools/bin and /tools/$TARGET_TRIPLET/bin. The tools in one location are hard linked to the other. An important facet of the linker is its library search order. Detailed information can be obtained from ld by passing it the --verbose flag. For example, an ld --verbose | grep SEARCH will illustrate the current search paths andtheir order. It shows which files are linked by ld by compiling a dummy program and passing the --verbose switch to the linker. For example, gcc dummy.c -Wl,--verbose 2>&1 | grep succeeded will show all the files successfully opened during the linking.The next package installed is GCC. An example of what can be seen during its run of configure is:checking what assembler to use... /tools/i686-pc-linux-gnu/bin/aschecking what linker to use... /tools/i686-pc-linux-gnu/bin/ldThis is important for the reasons mentioned above. It also demonstrates that GCC's configure script does not search the PATH directories to find which tools to use. However, during the actual operation of gcc itself, the same search paths are not necessarily used. To find out which standard linker gcc will use, run: gcc -print-prog-name=ld.Detailed information can be obtained from gcc by passing it the -v command line option while compiling a dummy program. For example, gcc -v dummy.c will show detailed information about the preprocessor, compilation, and assembly stages, including gcc's included search paths and their order.The next package installed is Glibc. The most important considerations for building Glibc are the compiler, binary tools, and kernel headers. The compiler is generally not an issue since Glibc will always use the gcc found in a PATH directory. The binary tools and kernel headers can be a bit more complicated. Therefore, take no risks and use the available configure switches to enforcethe correct selections. After the run of configure, check the contents of the config.make file in the glibc-build directory for all important details. Note the use of CC="gcc -B/tools/bin/" to control which binary tools are used and the use of the -nostdinc and -isystem flags to control the compiler's include search path. These items highlight an important aspect of the Glibcpackage—it is very self-sufficient in terms of its build machinery and generally does not rely on toolchain defaults.After the Glibc installation, make some adjustments to ensure that searching and linking take place only within the /tools prefix. Install an adjusted ld, which has a hard-wired search path limited to /tools/lib. Then amend gcc's specs file to point to the new dynamic linker in /tools/lib. This last step is vital to the whole process. As mentioned above, a hard-wired path to a dynamiclinker is embedded into every Executable and Link Format (ELF)-shared executable. This can be inspected by running: readelf -l | grep interpreter. Amending gcc's specs file ensures that every program compiled from here through the end of this chapter will use the new dynamic linker in /tools/lib.The need to use the new dynamic linker is also the reason why the Specs patch is applied for the second pass of GCC. Failure to do so will result in the GCC programs themselves having the name of the dynamic linker from the host system's /lib directory embedded into them, which would defeat the goal of getting away from the host.During the second pass of Binutils, we are able to utilize the --with-lib-path configure switch to control ld's library search path. From this point onwards, the core toolchain is self-contained and self-hosted. The remainder of the Chapter 5 packages all build against the new Glibc in /tools.Upon entering the chroot environment in Chapter 6, the first major package to be installed is Glibc, due to its self-sufficient nature mentioned above. Once this Glibc is installed into /usr, perform a quick changeover of the toolchain defaults, then proceed in building the rest of the target LFS system.5.3. Binutils-2.15.94.0.2.2 - Pass 1The Binutils package contains a linker, an assembler, and other tools for handling object files.Approximate build time: 1.0 SBURequired disk space: 179 MBInstallation depends on: Bash, Bison, Coreutils, Diffutils, Flex, GCC, Gettext, Glibc, Grep, M4, Make, Perl, Sed, and Texinfo5.3.1. Installation of BinutilsIt is important that Binutils be the first package compiled because both Glibc and GCC perform various tests on the available linker and assembler to determine which of their own features to enable.This package is known to have issues when its default optimization flags (including the -march and -mcpu options) are changed. If any environment variables that override default optimizations have been defined, such as CFLAGS and CXXFLAGS, unset them when building Binutils.If you are building from a host running Gcc-4 or later, it is necessary to patch the first build of this version of Binutils so that it can be compiled by the host system.patch -Np1 -i ../binutils-2.15.94.0.2.2-gcc4-1.patchThe Binutils documentation recommends building Binutils outside of the source directory in a dedicated build directory:mkdir -v ../binutils-buildcd ../binutils-buildNoteIn order for the SBU values listed in the rest of the book to be of any use, measure the time it takes to build this package from the configuration, up to and including the first install. To achieve this easily, wrap the three commands in a time command like this: time { ./configure ... && make && make install; }.Now prepare Binutils for compilation:../binutils-2.15.94.0.2.2/configure --prefix=/tools --disable-nlsThe meaning of the configure options:--prefix=/tools This tells the configure script to prepare to install the Binutils programs in the /tools directory.--disable-nls This disables internationalization as i18n is not needed for the temporary tools.Continue with compiling the package:makeCompilation is now complete. Ordinarily we would now run the test suite, but at this early stage the test suite framework (Tcl, Expect, and DejaGNU) is not yet in place. The benefits of running the tests at this point are minimal since the programs from this first pass will soon be replaced by those from the second.Install the package:make installNext, prepare the linker for the “Adjusting” phase later on:make -C ld cleanmake -C ld LIB_PATH=/tools/libThe meaning of the make parameters:-C ld clean This tells the make program to remove all compiled files in the ld subdirectory.-C ld LIB_PATH=/tools/lib This option rebuilds everything in the ld subdirectory. Specifying the LIB_PATH Makefile variable on the command line allows us to override the default value and point it to the temporary tools location. The value of this variable specifies the linker's default library search path. This preparation is used later in the chapter.WarningDo not remove the Binutils build and source directories yet. These will be needed again in their current state later in this chapter.Details on this package are located in Section 6.13.2, “Contents of Binutils.”5.4. GCC-3.4.3 - Pass 1The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.Approximate build time: 4.4 SBURequired disk space: 219 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, Findutils, Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, and Texinfo5.4.1. Installation of GCCThis package is known to have issues when its default optimization flags (including the -march and -mcpu options) are changed. If any environment variables that override default optimizations have been defined, such as CFLAGS and CXXFLAGS, unset them when building GCC.The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory:mkdir -v ../gcc-buildcd ../gcc-buildPrepare GCC for compilation:../gcc-3.4.3/configure --prefix=/tools \ --libexecdir=/tools/lib --with-local-prefix=/tools \ --disable-nls --enable-shared --enable-languages=cThe meaning of the configure options:--with-local-prefix=/tools The purpose of this switch is to remove /usr/local/include from gcc's include search path. This is not absolutely essential, however, it helps to minimize the influence of the host system.--enable-shared This switch allows the building of libgcc_s.so.1 and libgcc_eh.a. Having libgcc_eh.a available ensures that the configure script for Glibc (the next package we compile) produces the proper results.--enable-languages=c This option ensures that only the C compiler is built.Continue with compiling the package:make bootstrapThe meaning of the make parameters:bootstrap This target does not just compile GCC, but compiles it several times. It uses the programs compiled in a first round to compile itself a second time, and then again a third time. It then compares these second and third compiles to make sure it can reproduce itself flawlessly. This also implies that it was compiled correctly.Compilation is now complete. At this point, the test suite would normally be run, but, as mentioned before, the test suite framework is not in place yet. The benefits of running the tests at this point are minimal since the programs from this first pass will soon be replaced.Install the package:make installAs a finishing touch, create a symlink. Many programs and scripts run cc instead of gcc, which is used to keep programs generic and therefore usable on all kinds of UNIX systems where the GNU C compiler is not always installed. Running cc leaves the system administrator free to decide which C compiler to install.ln -vs gcc /tools/bin/ccDetails on this package are located in Section 6.14.2, “Contents of GCC.”5.5. Linux-Libc-Headers-2.6.11.2The Linux-Libc-Headers package contains the “sanitized” kernel headers.Approximate build time: 0.1 SBURequired disk space: 26.9 MBInstallation depends on: Coreutils5.5.1. Installation of Linux-Libc-HeadersFor years it has been common practice to use “raw” kernel headers (straight from a kernel tarball) in /usr/include, but over the last few years, the kernel developers have taken a strong stance that this should not be done. This gave birth to the Linux-Libc-Headers Project, which was designed to maintain an Application Programming Interface (API) stable version of the Linux headers.Install the header files:cp -Rv include/asm-i386 /tools/include/asmcp -Rv include/linux /tools/includeIf your architecture is not i386 (compatible), adjust the first command accordingly.Details on this package are located in Section 6.9.2, “Contents of Linux-Libc-Headers.”5.6. Glibc-2.3.4The Glibc package contains the main C library. This library provides the basic routines for allocating memory, searching directories, opening and closing files, reading and writing files, string handling, pattern matching, arithmetic, and so on.Approximate build time: 11.8 SBURequired disk space: 454 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Gettext, Grep, Make, Perl, Sed, and Texinfo5.6.1. Installation of GlibcThis package is known to have issues when its default optimization flags (including the -march and -mcpu options) are changed. If any environment variables that override default optimizations have been defined, such as CFLAGS and CXXFLAGS, unset them when building Glibc.It should be noted that compiling Glibc in any way other than the method suggested in this book puts the stability of the system at risk.Glibc has two tests which fail when the running kernel is 2.6.11 or later. The problem has been determined to be with the tests themselves, not with the C library or the kernel. If you plan to run the testsuite apply this patch:patch -Np1 -i ../glibc-2.3.4-fix_test-1.patchThe Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory:mkdir -v ../glibc-buildcd ../glibc-buildNext, prepare Glibc for compilation:../glibc-2.3.4/configure --prefix=/tools \ --disable-profile --enable-add-ons \ --enable-kernel=2.6.0 --with-binutils=/tools/bin \ --without-gd --with-headers=/tools/include \ --without-selinuxThe meaning of the configure options:--disable-profile This builds the libraries without profiling information. Omit this option if profiling on the temporary tools is necessary.--enable-add-ons This tells Glibc to use the NPTL add-on as its threading library.--enable-kernel=2.6.0 This tells Glibc to compile the library with support for 2.6.x Linux kernels.--with-binutils=/tools/bin While not required, this switch ensures that there are no errors pertaining to which Binutils programs get used during the Glibc build.--without-gd This prevents the build of the memusagestat program, which insists on linking against the host's libraries (libgd, libpng, libz, etc.).--with-headers=/tools/include This tells Glibc to compile itself against the headers recently installed to the tools directory, so that it knows exactly what features the kernel has and can optimize itself accordingly.--without-selinux When building from hosts that include SELinux functionality (e.g. Fedora Core 3), Glibc will build with support for SELinux. As the LFS tools environment does not contain support for SELinux, a Glibc compiled with such support will fail to operate correctly.During this stage the following warning might appear: configure: WARNING: *** These auxiliary programs are missing or *** incompatible versions: msgfmt *** some features will be disabled. *** Check the INSTALL file for required versions.The missing or incompatible msgfmt program is generally harmless, but it can sometimes cause issues when running the test suite. This msgfmt program is part of the Gettext package which the host distribution should provide. If msgfmt is present but deemed incompatible, upgrade the host system's Gettext package or continue without it and see if the test suite runs without problemsregardless.Compile the package:makeCompilation is now complete. As mentioned earlier, running the test suites for the temporary tools installed in this chapter is not mandatory. To run the Glibc test suite (if desired), the following command will do so:make checkFor a discussion of test failures that are of particular importance, please see Section 6.11, “Glibc-2.3.4.”In this chapter, some tests can be adversely affected by existing tools or environmental issues on the host system. Glibc test suite failures in this chapter are typically not worrisome. The Glibc installed in Chapter 6 is the one that will ultimately end up being used, so that is the one that needs to pass most tests (even in Chapter 6, some failures could still occur, for example, withthe math tests).When experiencing a failure, make a note of it, then continue by reissuing the make check command. The test suite should pick up where it left off and continue. This stop-start sequence can be circumvented by issuing a make -k check command. If using this option, be sure to log the output so that the log file can be examined for failures later.The install stage of Glibc will issue a harmless warning at the end about the absence of /tools/etc/ld.so.conf. Prevent this warning with:mkdir -v /tools/etctouch /tools/etc/ld.so.confInstall the package:make installDifferent countries and cultures have varying conventions for how to communicate. These conventions range from the format for representing dates and times to more complex issues, such as the language spoken. The “internationalization” of GNU programs works by locale.NoteIf the test suites are not being run in this chapter (as per the recommendation), there is no need to install the locales now. The appropriate locales will be installed in the next chapter.To install the Glibc locales anyway, use the following command:make localedata/install-localesTo save time, an alternative to running the previous command (which generates and installs every locale Glibc is aware of) is to install only those locales that are wanted and needed. This can be achieved by using the localedef command. Information on this command is located in the INSTALL file in the Glibc source. However, there are a number of locales that are essential in order forthe tests of future packages to pass, in particular, the libstdc++ tests from GCC. The following instructions, instead of the install-locales target used above, will install the minimum set of locales necessary for the tests to run successfully:mkdir -pv /tools/lib/localelocaledef -i de_DE -f ISO-8859-1 de_DElocaledef -i de_DE@euro -f ISO-8859-15 de_DE@eurolocaledef -i en_HK -f ISO-8859-1 en_HKlocaledef -i en_PH -f ISO-8859-1 en_PHlocaledef -i en_US -f ISO-8859-1 en_USlocaledef -i es_MX -f ISO-8859-1 es_MXlocaledef -i fa_IR -f UTF-8 fa_IRlocaledef -i fr_FR -f ISO-8859-1 fr_FRlocaledef -i fr_FR@euro -f ISO-8859-15 fr_FR@eurolocaledef -i it_IT -f ISO-8859-1 it_ITlocaledef -i ja_JP -f EUC-JP ja_JPDetails on this package are located in Section 6.11.4, “Contents of Glibc.”5.7. Adjusting the ToolchainNow that the temporary C libraries have been installed, all tools compiled in the rest of this chapter should be linked against these libraries. In order to accomplish this, the linker and the compiler's specs file need to be adjusted.The linker, adjusted at the end of the first pass of Binutils, is installed by running the following command from within the binutils-build directory:make -C ld installFrom this point onwards, everything will link only against the libraries in /tools/lib.NoteIf the earlier warning to retain the Binutils source and build directories from the first pass was missed, ignore the above command. This results in a small chance that the subsequent testing programs will link against libraries on the host. This is not ideal, but it is not a major problem. The situation is corrected when the second pass of Binutils is installed later.Now that the adjusted linker is installed, the Binutils build and source directories should be removed.The next task is to amend the GCC specs file so that it points to the new dynamic linker. A simple sed script will accomplish this:SPECFILE=`gcc --print-file specs` &&sed 's@ /lib/ld-linux.so.2@ /tools/lib/ld-linux.so.2@g' \ $SPECFILE > tempspecfile &&mv -f tempspecfile $SPECFILE &&unset SPECFILEIt is recommended that the above command be copy-and-pasted in order to ensure accuracy. Alternatively, the specs file can be edited by hand. This is done by replacing every occurrence of “/lib/ld-linux.so.2” with “/tools/lib/ld-linux.so.2”Be sure to visually inspect the specs file in order to verify the intended changes have been made.ImportantIf working on a platform where the name of the dynamic linker is something other than ld-linux.so.2, replace “ld-linux.so.2” with the name of the platform's dynamic linker in the above commands. Refer back to Section 5.2, “Toolchain Technical Notes,” if necessary.There is a possibility that some include files from the host system have found their way into GCC's private include dir. This can happen as a result of GCC's “fixincludes” process, which runs as part of the GCC build. This is explained in more detail later in this chapter. Run the following command to eliminate this possibility:rm -vf /tools/lib/gcc/*/*/include/{pthread.h,bits/sigthread.h}CautionAt this point, it is imperative to stop and ensure that the basic functions (compiling and linking) of the new toolchain are working as expected. To perform a sanity check, run the following commands:echo 'main(){}' > dummy.ccc dummy.creadelf -l a.out | grep ': /tools'If everything is working correctly, there should be no errors, and the output of the last command will be of the form:[Requesting program interpreter: /tools/lib/ld-linux.so.2]Note that /tools/lib appears as the prefix of the dynamic linker.If the output is not shown as above or there was no output at all, then something is wrong. Investigate and retrace the steps to find out where the problem is and correct it. This issue must be resolved before continuing on. First, perform the sanity check again, using gcc instead of cc. If this works, then the /tools/bin/cc symlink is missing. Revisit Section 5.4, “GCC-3.4.3 - Pass1,” and install the symlink. Next, ensure that the PATH is correct. This can be checked by running echo $PATH and verifying that /tools/bin is at the head of the list. If the PATH is wrong it could mean that you are not logged in as user lfs or that something went wrong back in Section 4.4, “Setting Up the Environment.” Another option is that something may have gone wrong with thespecs file amendment above. In this case, redo the specs file amendment, being careful to copy-and-paste the commands.Once all is well, clean up the test files:rm -v dummy.c a.outBuilding TCL in the next section will serve as an additional check that the toolchain has been built properly. If TCL fails to build, it is an indication that something has gone wrong with the Binutils, GCC, or Glibc installation, but not with TCL itself.5.8. Tcl-8.4.9The Tcl package contains the Tool Command Language.Approximate build time: 0.9 SBURequired disk space: 23.3 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, and Sed5.8.1. Installation of TclThis package and the next two (Expect and DejaGNU) are installed to support running the test suites for GCC and Binutils. Installing three packages for testing purposes may seem excessive, but it is very reassuring, if not essential, to know that the most important tools are working properly. Even if the test suites are not run in this chapter (they are not mandatory), these packages arerequired to run the test suites in Chapter 6.Prepare Tcl for compilation:cd unix./configure --prefix=/toolsBuild the package:makeTo test the results, issue: TZ=UTC make test. The Tcl test suite is known to experience failures under certain host conditions that are not fully understood. Therefore, test suite failures here are not surprising, and are not considered critical. The TZ=UTC parameter sets the time zone to Coordinated Universal Time (UTC), also known as Greenwich Mean Time (GMT), but only for the durationof the test suite run. This ensures that the clock tests are exercised correctly. Details on the TZ environment variable are provided in Chapter 7.Install the package:make installWarningDo not remove the tcl8.4.9 source directory yet, as the next package will need its internal headers.Set a variable containing the full path of the current directory. The next package, Expect, will use this variable to find Tcl's headers.cd ..export TCLPATH=`pwd`Now make a necessary symbolic link:ln -sv tclsh8.4 /tools/bin/tclsh5.8.2. Contents of TclInstalled programs: tclsh (link to tclsh8.4) and tclsh8.4Installed library: libtcl8.4.soShort Descriptionstclsh8.4 The Tcl command shelltclsh A link to tclsh8.4libtcl8.4.so The Tcl library5.9. Expect-5.43.0The Expect package contains a program for carrying out scripted dialogues with other interactive programs.Approximate build time: 0.1 SBURequired disk space: 4.0 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Sed, and Tcl5.9.1. Installation of ExpectFirst, fix a bug that can result in false failures during the GCC test suite run:patch -Np1 -i ../expect-5.43.0-spawn-1.patchNow prepare Expect for compilation:./configure --prefix=/tools --with-tcl=/tools/lib \ --with-tclinclude=$TCLPATH --with-x=noThe meaning of the configure options:--with-tcl=/tools/lib This ensures that the configure script finds the Tcl installation in the temporary tools location instead of possibly locating an existing one on the host system.--with-tclinclude=$TCLPATH This explicitly tells Expect where to find Tcl's source directory and internal headers. Using this option avoids conditions where configure fails because it cannot automatically discover the location of the Tcl source directory.--with-x=no This tells the configure script not to search for Tk (the Tcl GUI component) or the X Window System libraries, both of which may reside on the host system but will not exist in the temporary environment.Build the package:makeTo test the results, issue: make test. Note that the Expect test suite is known to experience failures under certain host conditions that are not within our control. Therefore, test suite failures here are not surprising and are not considered critical.Install the package:make SCRIPTS="" installThe meaning of the make parameter:SCRIPTS="" This prevents installation of the supplementary expect scripts, which are not needed.Now remove the TCLPATH variable:unset TCLPATHThe source directories of both Tcl and Expect can now be removed.5.9.2. Contents of ExpectInstalled program: expectInstalled library: libexpect-5.43.aShort Descriptionsexpect Communicates with other interactive programs according to a scriptlibexpect-5.43.a Contains functions that allow Expect to be used as a Tcl extension or to be used directly from C or C++ (without Tcl)5.10. DejaGNU-1.4.4The DejaGNU package contains a framework for testing other programs.Approximate build time: 0.1 SBURequired disk space: 6.1 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, and Sed5.10.1. Installation of DejaGNUPrepare DejaGNU for compilation:./configure --prefix=/toolsBuild and install the package:make install5.10.2. Contents of DejaGNUInstalled program: runtestShort Descriptionsruntest A wrapper script that locates the proper expect shell and then runs DejaGNU5.11. GCC-3.4.3 - Pass 2Approximate build time: 11.0 SBURequired disk space: 292 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, Findutils, Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, and Texinfo5.11.1. Re-installation of GCCThis package is known to have issues when its default optimization flags (including the -march and -mcpu options) are changed. If any environment variables that override default optimizations have been defined, such as CFLAGS and CXXFLAGS, unset them when building GCC.The tools required to test GCC and Binutils—Tcl, Expect and DejaGNU—are installed now. GCC and Binutils can now be rebuilt, linking them against the new Glibc and testing them properly (if running the test suites in this chapter). Please note that these test suites are highly dependent on properly functioning PTYs which are provided by the host. PTYs are most commonly implemented viathe devpts file system. Check to see if the host system is set up correctly in this regard by performing a quick test:expect -c "spawn ls"The response might be:The system has no more ptys. Ask your system administrator to create more.If the above message is received, the host does not have its PTYs set up properly. In this case, there is no point in running the test suites for GCC and Binutils until this issue is resolved. Please consult the LFS FAQ at http://www.linuxfromscratch.org//lfs/faq.html#no-ptys for more information on how to get PTYs working.First correct a known problem and make an essential adjustment:patch -Np1 -i ../gcc-3.4.3-no_fixincludes-1.patchpatch -Np1 -i ../gcc-3.4.3-specs-2.patchThe first patch disables the GCC fixincludes script. This was briefly mentioned earlier, but a more in-depth explanation of the fixincludes process is warranted here. Under normal circumstances, the GCC fixincludes script scans the system for header files that need to be fixed. It might find that some Glibc header files on the host system need to be fixed, and will fix them and put themin the GCC private include directory. In Chapter 6, after the newer Glibc has been installed, this private include directory will be searched before the system include directory. This may result in GCC finding the fixed headers from the host system, which most likely will not match the Glibc version used for the LFS system.The second patch changes GCC's default location of the dynamic linker (typically ld-linux.so.2). It also removes /usr/include from GCC's include search path. Patching now rather than adjusting the specs file after installation ensures that the new dynamic linker is used during the actual build of GCC. That is, all of the final (and temporary) binaries created during the build will linkagainst the new Glibc.ImportantThe above patches are critical in ensuring a successful overall build. Do not forget to apply them.Create a separate build directory again:mkdir -v ../gcc-buildcd ../gcc-buildBefore starting to build GCC, remember to unset any environment variables that override the default optimization flags.Now prepare GCC for compilation:../gcc-3.4.3/configure --prefix=/tools \ --libexecdir=/tools/lib --with-local-prefix=/tools \ --enable-clocale=gnu --enable-shared \ --enable-threads=posix --enable-__cxa_atexit \ --enable-languages=c,c++ --disable-libstdcxx-pchThe meaning of the new configure options:--enable-clocale=gnu This option ensures the correct locale model is selected for the C++ libraries under all circumstances. If the configure script finds the de_DE locale installed, it will select the correct gnu locale model. However, if the de_DE locale is not installed, there is the risk of building Application Binary Interface (ABI)-incompatible C++ libraries because the incorrect generic localemodel may be selected.--enable-threads=posix This enables C++ exception handling for multi-threaded code.--enable-__cxa_atexit This option allows use of __cxa_atexit, rather than atexit, to register C++ destructors for local statics and global objects. This option is essential for fully standards-compliant handling of destructors. It also affects the C++ ABI, and therefore results in C++ shared libraries and C++ programs that are interoperable with other Linux distributions.--enable-languages=c,c++ This option ensures that both the C and C++ compilers are built.--disable-libstdcxx-pch Do not build the pre-compiled header (PCH) for libstdc++. It takes up a lot of space, and we have no use for it.Compile the package:makeThere is no need to use the bootstrap target now because the compiler being used to compile this GCC was built from the exact same version of the GCC sources used earlier.Compilation is now complete. As previously mentioned, running the test suites for the temporary tools compiled in this chapter is not mandatory. To run the GCC test suite anyway, use the following command:make -k checkThe -k flag is used to make the test suite run through to completion and not stop at the first failure. The GCC test suite is very comprehensive and is almost guaranteed to generate a few failures. To receive a summary of the test suite results, run:../gcc-3.4.3/contrib/test_summaryFor only the summaries, pipe the output through grep -A7 Summ.Results can be compared with those located at http://www.linuxfromscratch.org/lfs/build-logs/6.1.1/.A few unexpected failures cannot always be avoided. The GCC developers are usually aware of these issues, but have not resolved them yet. Unless the test results are vastly different from those at the above URL, it is safe to continue.Install the package:make installNoteAt this point it is strongly recommended to repeat the sanity check we performed earlier in this chapter. Refer back to Section 5.7, “Adjusting the Toolchain,” and repeat the test compilation. If the result is wrong, the most likely reason is that the GCC Specs patch was not properly applied.Details on this package are located in Section 6.14.2, “Contents of GCC.”5.12. Binutils-2.15.94.0.2.2 - Pass 2The Binutils package contains a linker, an assembler, and other tools for handling object files.Approximate build time: 1.5 SBURequired disk space: 114 MBInstallation depends on: Bash, Bison, Coreutils, Diffutils, Flex, GCC, Gettext, Glibc, Grep, M4, Make, Perl, Sed, and Texinfo5.12.1. Re-installation of BinutilsThis package is known to have issues when its default optimization flags (including the -march and -mcpu options) are changed. If any environment variables that override default optimizations have been defined, such as CFLAGS and CXXFLAGS, unset them when building Binutils.Create a separate build directory again:mkdir -v ../binutils-buildcd ../binutils-buildPrepare Binutils for compilation:../binutils-2.15.94.0.2.2/configure --prefix=/tools \ --disable-nls --enable-shared --with-lib-path=/tools/libThe meaning of the new configure options:--with-lib-path=/tools/lib This tells the configure script to specify the library search path during the compilation of Binutils, resulting in /tools/lib being passed to the linker. This prevents the linker from searching through library directories on the host.Compile the package:makeCompilation is now complete. As discussed earlier, running the test suite is not mandatory for the temporary tools here in this chapter. To run the Binutils test suite anyway, issue the following command:make checkInstall the package:make installNow prepare the linker for the “Re-adjusting” phase in the next chapter:make -C ld cleanmake -C ld LIB_PATH=/usr/lib:/libWarningDo not remove the Binutils source and build directories yet. These directories will be needed again in the next chapter in their current state.Details on this package are located in Section 6.13.2, “Contents of Binutils.”5.13. Gawk-3.1.4The Gawk package contains programs for manipulating text files.Approximate build time: 0.2 SBURequired disk space: 16.4 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, and Sed5.13.1. Installation of GawkPrepare Gawk for compilation:./configure --prefix=/toolsCompile the package:makeTo test the results, issue: make check.Install the package:make installDetails on this package are located in Section 6.20.2, “Contents of Gawk.”5.14. Coreutils-5.2.1The Coreutils package contains utilities for showing and setting the basic system characteristics.Approximate build time: 0.9 SBURequired disk space: 53.3 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Perl, and Sed5.14.1. Installation of CoreutilsPrepare Coreutils for compilation:DEFAULT_POSIX2_VERSION=199209 ./configure --prefix=/toolsThis package has an issue when compiled against versions of Glibc later than 2.3.2. Some of the Coreutils utilities (such as head, tail, and sort) will reject their traditional syntax, a syntax that has been in use for approximately 30 years. This old syntax is so pervasive that compatibility should be preserved until the many places where it is used can be updated. Backwardscompatibility is achieved by setting the DEFAULT_POSIX2_VERSION environment variable to “199209” in the above command. If you do not want Coreutils to be backwards compatible with the traditional syntax, then omit setting the DEFAULT_POSIX2_VERSION environment variable. It is important to remember that doing so will have consequences, including the need to patch the many packagesthat still use the old syntax. Therefore, it is recommended that the instructions be followed exactly as given above.Compile the package:makeTo test the results, issue: make RUN_EXPENSIVE_TESTS=yes check. The RUN_EXPENSIVE_TESTS=yes parameter tells the test suite to run several additional tests that are considered relatively expensive (in terms of CPU power and memory usage) on some platforms, but generally are not a problem on Linux.Install the package:make installDetails on this package are located in Section 6.15.2, “Contents of Coreutils.”5.15. Bzip2-1.0.3The Bzip2 package contains programs for compressing and decompressing files. Compressing text files with bzip2 yields a much better compression percentage than with the traditional gzip.Approximate build time: 0.1 SBURequired disk space: 3.5 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, and Make5.15.1. Installation of Bzip2The Bzip2 package does not contain a configure script. Compile and test it with:makeInstall the package:make PREFIX=/tools installDetails on this package are located in Section 6.40.2, “Contents of Bzip2.”5.16. Gzip-1.3.5The Gzip package contains programs for compressing and decompressing files.Approximate build time: 0.1 SBURequired disk space: 2.2 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, and Sed5.16.1. Installation of GzipPrepare Gzip for compilation:./configure --prefix=/toolsCompile the package:makeThis package does not come with a test suite.Install the package:make installDetails on this package are located in Section 6.46.2, “Contents of Gzip.”5.17. Diffutils-2.8.1The Diffutils package contains programs that show the differences between files or directories.Approximate build time: 0.1 SBURequired disk space: 5.6 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, and Sed5.17.1. Installation of DiffutilsPrepare Diffutils for compilation:./configure --prefix=/toolsCompile the package:makeThis package does not come with a test suite.Install the package:make installDetails on this package are located in Section 6.41.2, “Contents of Diffutils.”5.18. Findutils-4.2.23The Findutils package contains programs to find files. These programs are provided to recursively search through a directory tree and to create, maintain, and search a database (often faster than the recursive find, but unreliable if the database has not been recently updated).Approximate build time: 0.2 SBURequired disk space: 8.9 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make and Sed5.18.1. Installation of FindutilsPrepare Findutils for compilation:./configure --prefix=/toolsCompile the package:makeTo test the results, issue: make check.Install the package:make installDetails on this package are located in Section 6.19.2, “Contents of Findutils.”5.19. Make-3.80The Make package contains a program for compiling packages.Approximate build time: 0.2 SBURequired disk space: 7.1 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, and Sed5.19.1. Installation of MakePrepare Make for compilation:./configure --prefix=/toolsCompile the package:makeTo test the results, issue: make check.Install the package:make installDetails on this package are located in Section 6.49.2, “Contents of Make.”5.20. Grep-2.5.1aThe Grep package contains programs for searching through files.Approximate build time: 0.1 SBURequired disk space: 4.5 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Make, Sed, and Texinfo5.20.1. Installation of GrepPrepare Grep for compilation:./configure --prefix=/tools \ --disable-perl-regexpThe meaning of the configure options:--disable-perl-regexp This ensures that the grep program does not get linked against a Perl Compatible Regular Expression (PCRE) library that may be present on the host but will not be available once we enter the chroot environment.Compile the package:makeTo test the results, issue: make check.Install the package:make installDetails on this package are located in Section 6.44.2, “Contents of Grep.”5.21. Sed-4.1.4The Sed package contains a stream editor.Approximate build time: 0.2 SBURequired disk space: 8.4 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, and Texinfo5.21.1. Installation of SedPrepare Sed for compilation:./configure --prefix=/toolsCompile the package:makeTo test the results, issue: make check.Install the package:make installDetails on this package are located in Section 6.28.2, “Contents of Sed.”5.22. Gettext-0.14.3The Gettext package contains utilities for internationalization and localization. These allow programs to be compiled with NLS (Native Language Support), enabling them to output messages in the user's native language.Approximate build time: 0.5 SBURequired disk space: 63.0 MBInstallation depends on: Bash, Binutils, Bison, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, and Sed5.22.1. Installation of GettextPrepare Gettext for compilation:./configure --prefix=/tools --disable-libasprintf \ --without-csharpThe meaning of the configure options:--disable-libasprintf This flag tells Gettext not to build the asprintf library. Because nothing in this chapter or the next requires this library and Gettext gets rebuilt later, exclude it to save time and space.--without-csharp This ensures that Gettext does not build support for the C# compiler which may be present on the host but will not be available once we enter the chroot environment.Compile the package:makeTo test the results, issue: make check. This takes quite some time, around 7 SBUs. The Gettext test suite is known to experience failures under certain host conditions, for example when it finds a Java compiler on the host. An experimental patch to disable Java is available from the LFS Patches project at http://www.linuxfromscratch.org/patches/.Install the package:make installDetails on this package are located in Section 6.30.2, “Contents of Gettext.”5.23. Ncurses-5.4The Ncurses package contains libraries for terminal-independent handling of character screens.Approximate build time: 0.7 SBURequired disk space: 27.5 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, and Sed5.23.1. Installation of NcursesPrepare Ncurses for compilation:./configure --prefix=/tools --with-shared \ --without-debug --without-ada --enable-overwriteThe meaning of the configure options:--without-ada This ensures that Ncurses does not build support for the Ada compiler which may be present on the host but will not be available once we enter the chroot environment.--enable-overwrite This tells Ncurses to install its header files into /tools/include, instead of /tools/include/ncurses, to ensure that other packages can find the Ncurses headers successfully.Compile the package:makeThis package does not come with a test suite.Install the package:make installDetails on this package are located in Section 6.21.2, “Contents of Ncurses.”5.24. Patch-2.5.4The Patch package contains a program for modifying or creating files by applying a “patch” file typically created by the diff program.Approximate build time: 0.1 SBURequired disk space: 1.5 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, and Sed5.24.1. Installation of PatchPrepare Patch for compilation:CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/toolsThe preprocessor flag -D_GNU_SOURCE is only needed on the PowerPC platform. It can be left out on other architectures.Compile the package:makeThis package does not come with a test suite.Install the package:make installDetails on this package are located in Section 6.51.2, “Contents of Patch.”5.25. Tar-1.15.1The Tar package contains an archiving program.Approximate build time: 0.2 SBURequired disk space: 12.7 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, and Sed5.25.1. Installation of TarPrepare Tar for compilation:./configure --prefix=/toolsCompile the package:makeTo test the results, issue: make check.Install the package:make installDetails on this package are located in Section 6.57.2, “Contents of Tar.”5.26. Texinfo-4.8The Texinfo package contains programs for reading, writing, and converting info pages.Approximate build time: 0.2 SBURequired disk space: 14.7 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Ncurses, and Sed5.26.1. Installation of TexinfoPrepare Texinfo for compilation:./configure --prefix=/toolsCompile the package:makeTo test the results, issue: make check.Install the package:make installDetails on this package are located in Section 6.34.2, “Contents of Texinfo.”5.27. Bash-3.0The Bash package contains the Bourne-Again SHell.Approximate build time: 1.2 SBURequired disk space: 20.7 MBInstallation depends on: Binutils, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, Ncurses, and Sed.5.27.1. Installation of BashBash has a problem when compiled against newer versions of Glibc, causing it to hang inappropriately. This patch fixes the problem:patch -Np1 -i ../bash-3.0-avoid_WCONTINUED-1.patchPrepare Bash for compilation:./configure --prefix=/tools --without-bash-mallocThe meaning of the configure options:--without-bash-malloc This options turns off the use of Bash's memory allocation (malloc) function which is known to cause segmentation faults. By turning this option off, Bash will use the malloc functions from Glibc which are more stable.Compile the package:makeTo test the results, issue: make tests.Install the package:make installMake a link for the programs that use sh for a shell:ln -vs bash /tools/bin/shDetails on this package are located in Section 6.37.2, “Contents of Bash.”5.28. M4-1.4.3The M4 package contains a macro processor.Approximate build time: 0.1 SBURequired disk space: 2.8 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Perl, and Sed5.28.1. Installation of M4Prepare M4 for compilation:./configure --prefix=/toolsCompile the package:makeTo test the results, issue: make check.Install the package:make installDetails on this package are located in Section 6.24.2, “Contents of M4.”5.29. Bison-2.0The Bison package contains a parser generator.Approximate build time: 0.6 SBURequired disk space: 10.0 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, M4, Make, and Sed5.29.1. Installation of BisonPrepare Bison for compilation:./configure --prefix=/toolsCompile the package:makeTo test the results, issue: make check.Install the package:make installDetails on this package are located in Section 6.25.2, “Contents of Bison.”5.30. Flex-2.5.31The Flex package contains a utility for generating programs that recognize patterns in text.Approximate build time: 0.6 SBURequired disk space: 22.5 MBInstallation depends on: Bash, Binutils, Bison, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, M4, Make, and Sed5.30.1. Installation of FlexFlex contains several known bugs. These can be fixed with the following patch:patch -Np1 -i ../flex-2.5.31-debian_fixes-3.patchThe GNU autotools will detect that the Flex source code has been modified by the previous patch and tries to update the man page accordingly. This does not work on many systems, and the default page is fine, so make sure it does not get regenerated:touch doc/flex.1Now prepare Flex for compilation:./configure --prefix=/toolsCompile the package:makeTo test the results, issue: make check.Install the package:make installDetails on this package are located in Section 6.29.2, “Contents of Flex.”5.31. Util-linux-2.12qThe Util-linux package contains miscellaneous utility programs. Among them are utilities for handling file systems, consoles, partitions, and messages.Approximate build time: 0.2 SBURequired disk space: 8.9 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Ncurses, Sed, and Zlib5.31.1. Installation of Util-linuxUtil-linux does not use the freshly installed headers and libraries from the /tools directory by default. This is fixed by altering the configure script:sed -i 's@/usr/include@/tools/include@g' configurePrepare Util-linux for compilation:./configureCompile some support routines:make -C libOnly a few of the utilities contained in this package need to be built:make -C mount mount umountmake -C text-utils moreThis package does not come with a test suite.Copy these programs to the temporary tools directory:cp mount/{,u}mount text-utils/more /tools/binDetails on this package are located in Section 6.59.3, “Contents of Util-linux.”5.32. Perl-5.8.7The Perl package contains the Practical Extraction and Report Language.Approximate build time: 0.8 SBURequired disk space: 81.6 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, and Sed5.32.1. Installation of PerlFirst adapt some hard-wired paths to the C library by applying the following patch:patch -Np1 -i ../perl-5.8.7-libc-1.patchPrepare Perl for compilation (make sure to get the 'IO Fcntl POSIX' part of the command correct—they are all letters):./configure.gnu --prefix=/tools -Dstatic_ext='IO Fcntl POSIX'The meaning of the configure options:-Dstatic_ext='IO Fcntl POSIX' This tells Perl to build the minimum set of static extensions needed for installing and testing the Coreutils package in the next chapter.Only a few of the utilities contained in this package need to be built:make perl utilitiesAlthough Perl comes with a test suite, it is not recommended to run it at this point. Only part of Perl was built and running make test now will cause the rest of Perl to be built as well, which is unnecessary at this point. The test suite can be run in the next chapter if desired.Install these tools and their libraries:cp -v perl pod/pod2man /tools/binmkdir -pv /tools/lib/perl5/5.8.7cp -Rv lib/* /tools/lib/perl5/5.8.7Details on this package are located in Section 6.33.2, “Contents of Perl.”5.33. StrippingThe steps in this section are optional, but if the LFS partition is rather small, it is beneficial to learn that unnecessary items can be removed. The executables and libraries built so far contain about 130 MB of unneeded debugging symbols. Remove those symbols with:strip --strip-debug /tools/lib/*strip --strip-unneeded /tools/{,s}bin/*The last of the above commands will skip some twenty files, reporting that it does not recognize their file format. Most of these are scripts instead of binaries.Take care not to use --strip-unneeded on the libraries. The static ones would be destroyed and the toolchain packages would need to be built all over again.To save another 30 MB, remove the documentation:rm -rf /tools/{info,man}There will now be at least 850 MB of free space on the LFS file system that can be used to build and install Glibc in the next phase. If you can build and install Glibc, you can build and install the rest too.Part III. Building the LFS SystemTable of Contents 6. Installing Basic System Software Introduction Mounting Virtual Kernel File Systems Entering the Chroot Environment Changing Ownership Creating Directories Creating Essential Symlinks Creating the passwd, group, and log Files Populating /dev Linux-Libc-Headers-2.6.11.2 Man-pages-2.01 Glibc-2.3.4 Re-adjusting the Toolchain Binutils-2.15.94.0.2.2 GCC-3.4.3 Coreutils-5.2.1 Zlib-1.2.3 Mktemp-1.5 Iana-Etc-1.04 Findutils-4.2.23 Gawk-3.1.4 Ncurses-5.4 Readline-5.0 Vim-6.3 M4-1.4.3 Bison-2.0 Less-382 Groff-1.19.1 Sed-4.1.4 Flex-2.5.31 Gettext-0.14.3 Inetutils-1.4.2 IPRoute2-2.6.11-050330 Perl-5.8.7 Texinfo-4.8 Autoconf-2.59 Automake-1.9.5 Bash-3.0 File-4.13 Libtool-1.5.14 Bzip2-1.0.3 Diffutils-2.8.1 Kbd-1.12 E2fsprogs-1.37 Grep-2.5.1a GRUB-0.96 Gzip-1.3.5 Hotplug-2004_09_23 Man-1.5p Make-3.80 Module-Init-Tools-3.1 Patch-2.5.4 Procps-3.2.5 Psmisc-21.6 Shadow-4.0.9 Sysklogd-1.4.1 Sysvinit-2.86 Tar-1.15.1 Udev-056 Util-linux-2.12q About Debugging Symbols Stripping Again Cleaning Up 7. Setting Up System Bootscripts Introduction LFS-Bootscripts-3.2.1 How Do These Bootscripts Work? Device and Module Handling on an LFS System Configuring the setclock Script Configuring the Linux Console Configuring the sysklogd script Creating the /etc/inputrc File The Bash Shell Startup Files Configuring the localnet Script Creating the /etc/hosts File Configuring the network Script 8. Making the LFS System Bootable Introduction Creating the /etc/fstab File Linux-2.6.11.12 Making the LFS System Bootable 9. The End The End Get Counted Rebooting the System What Now?Chapter 6. Installing Basic System Software6.1. IntroductionIn this chapter, we enter the building site and start constructing the LFS system in earnest. That is, we chroot into the temporary mini Linux system, make a few final preparations, and then begin installing the packages.The installation of this software is straightforward. Although in many cases the installation instructions could be made shorter and more generic, we have opted to provide the full instructions for every package to minimize the possibilities for mistakes. The key to learning what makes a Linux system work is to know what each package is used for and why the user (or the system) needs it.For every installed package, a summary of its contents is given, followed by concise descriptions of each program and library the package installed.If using the compiler optimizations provided in this chapter, please review the optimization hint at http://www.linuxfromscratch.org/hints/downloads/files/optimization.txt. Compiler optimizations can make a program run slightly faster, but they may also cause compilation difficulties and problems when running the program. If a package refuses to compile when using optimization, try tocompile it without optimization and see if that fixes the problem. Even if the package does compile when using optimization, there is the risk it may have been compiled incorrectly because of the complex interactions between the code and build tools. The small potential gains achieved in using compiler optimizations are often outweighed by the risks. First-time builders of LFS areencouraged to build without custom optimizations. The subsequent system will still run very fast and be stable at the same time.The order that packages are installed in this chapter needs to be strictly followed to ensure that no program accidentally acquires a path referring to /tools hard-wired into it. For the same reason, do not compile packages in parallel. Compiling in parallel may save time (especially on dual-CPU machines), but it could result in a program containing a hard-wired path to /tools, whichwill cause the program to stop working when that directory is removed.Before the installation instructions, each installation page provides information about the package, including a concise description of what it contains, approximately how long it will take to build, how much disk space is required during this building process, and any other packages needed to successfully build the package. Following the installation instructions, there is a list ofprograms and libraries (along with brief descriptions of these) that the package installs.To keep track of which package installs particular files, a package manager can be used. For a general overview of different styles of package managers, please refer to http://www.linuxfromscratch.org/blfs/view/svn/introduction/important.html. For a package management method specifically geared towards LFS, we recommendhttp://www.linuxfromscratch.org/hints/downloads/files/more_control_and_pkg_man.txt.NoteThe remainder of this book is to be performed while logged in as user root and no longer as user lfs. Also, double check that $LFS is set.6.2. Mounting Virtual Kernel File SystemsVarious file systems exported by the kernel are used to communicate to and from the kernel itself. These file systems are virtual in that no disk space is used for them. The content of the file systems resides in memory.Begin by creating directories onto which the file systems will be mounted:mkdir -pv $LFS/{proc,sys}Now mount the file systems:mount -vt proc proc $LFS/procmount -vt sysfs sysfs $LFS/sysRemember that if for any reason you stop working on the LFS system and start again later, it is important to check that these file systems are mounted again before entering the chroot environment.Additional file systems will soon be mounted from within the chroot environment. To keep the host up to date, perform a “fake mount” for each of these now:mount -vft tmpfs tmpfs $LFS/devmount -vft tmpfs tmpfs $LFS/dev/shmmount -vft devpts -o gid=4,mode=620 devpts $LFS/dev/pts6.3. Entering the Chroot EnvironmentIt is time to enter the chroot environment to begin building and installing the final LFS system. As user root, run the following command to enter the realm that is, at the moment, populated with only the temporary tools:chroot "$LFS" /tools/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ /tools/bin/bash --login +hThe -i option given to the env command will clear all variables of the chroot environment. After that, only the HOME, TERM, PS1, and PATH variables are set again. The TERM=$TERM construct will set the TERM variable inside chroot to the same value as outside chroot. This variable is needed for programs like vim and less to operate properly. If other variables are needed, such as CFLAGS orCXXFLAGS, this is a good place to set them again.From this point on, there is no need to use the LFS variable anymore, because all work will be restricted to the LFS file system. This is because the Bash shell is told that $LFS is now the root (/) directory.Notice that /tools/bin comes last in the PATH. This means that a temporary tool will no longer be used once its final version is installed. This occurs when the shell does not “remember” the locations of executed binaries—for this reason, hashing is switched off by passing the +h option to bash.It is important that all the commands throughout the remainder of this chapter and the following chapters are run from within the chroot environment. If you leave this environment for any reason (rebooting for example), remember to first mount the proc and devpts file systems (discussed in the previous section) and enter chroot again before continuing with the installations.Note that the bash prompt will say I have no name! This is normal because the /etc/passwd file has not been created yet.6.4. Changing OwnershipCurrently, the /tools directory is owned by the user lfs, a user that exists only on the host system. Although the /tools directory can be deleted once the LFS system has been finished, it can be retained to build additional LFS systems. If the /tools directory is kept as is, the files are owned by a user ID without a corresponding account. This is dangerous because a user accountcreated later could get this same user ID and would own the /tools directory and all the files therein, thus exposing these files to possible malicious manipulation.To avoid this issue, add the lfs user to the new LFS system later when creating the /etc/passwd file, taking care to assign it the same user and group IDs as on the host system. Alternatively, assign the contents of the /tools directory to user root by running the following command:chown -R 0:0 /toolsThe command uses 0:0 instead of root:root, because chown is unable to resolve the name “root” until the password file has been created. This book assumes you ran this chown command.6.5. Creating DirectoriesIt is time to create some structure in the LFS file system. Create a standard directory tree by issuing the following commands:install -dv /{bin,boot,dev,etc/opt,home,lib,mnt}install -dv /{sbin,srv,usr/local,var,opt}install -dv /root -m 0750install -dv /tmp /var/tmp -m 1777install -dv /media/{floppy,cdrom}install -dv /usr/{bin,include,lib,sbin,share,src}ln -sv share/{man,doc,info} /usrinstall -dv /usr/share/{doc,info,locale,man}install -dv /usr/share/{misc,terminfo,zoneinfo}install -dv /usr/share/man/man{1,2,3,4,5,6,7,8}install -dv /usr/local/{bin,etc,include,lib,sbin,share,src}ln -sv share/{man,doc,info} /usr/localinstall -dv /usr/local/share/{doc,info,locale,man}install -dv /usr/local/share/{misc,terminfo,zoneinfo}install -dv /usr/local/share/man/man{1,2,3,4,5,6,7,8}install -dv /var/{lock,log,mail,run,spool}install -dv /var/{opt,cache,lib/{misc,locate},local}install -dv /opt/{bin,doc,include,info}install -dv /opt/{lib,man/man{1,2,3,4,5,6,7,8}}Directories are, by default, created with permission mode 755, but this is not desirable for all directories. In the commands above, two changes are made—one to the home directory of user root, and another to the directories for temporary files.The first mode change ensures that not just anybody can enter the /root directory—the same as a normal user would do with his or her home directory. The second mode change makes sure that any user can write to the /tmp and /var/tmp directories, but cannot remove another user's files from them. The latter is prohibited by the so-called “sticky bit,” the highest bit (1) in the 1777bit mask.6.5.1. FHS Compliance NoteThe directory tree is based on the Filesystem Hierarchy Standard (FHS) (available at http://www.pathname.com/fhs/). In addition to the tree created above, this standard stipulates the existence of /usr/local/games and /usr/share/games. The FHS is not precise as to the structure of the /usr/local/share subdirectory, so we create only the directories that are needed. However, feel free tocreate these directories if you prefer to conform more strictly to the FHS.6.6. Creating Essential SymlinksSome programs use hard-wired paths to programs which do not exist yet. In order to satisfy these programs, create a number of symbolic links which will be replaced by real files throughout the course of this chapter after the software has been installed.ln -sv /tools/bin/{bash,cat,pwd,stty} /binln -sv /tools/bin/perl /usr/binln -sv /tools/lib/libgcc_s.so{,.1} /usr/libln -sv bash /bin/sh6.7. Creating the passwd, group, and log FilesIn order for user root to be able to login and for the name “root” to be recognized, there must be relevant entries in the /etc/passwd and /etc/group files.Create the /etc/passwd file by running the following command:cat > /etc/passwd << "EOF"root:x:0:0:root:/root:/bin/bashEOFThe actual password for root (the “x” used here is just a placeholder) will be set later.Create the /etc/group file by running the following command:cat > /etc/group << "EOF"root:x:0:bin:x:1:sys:x:2:kmem:x:3:tty:x:4:tape:x:5:daemon:x:6:floppy:x:7:disk:x:8:lp:x:9:dialout:x:10:audio:x:11:video:x:12:utmp:x:13:usb:x:14:cdrom:x:15:EOFThe created groups are not part of any standard—they are groups decided on in part by the requirements of the Udev configuration in this chapter, and in part by common convention employed by a number of existing Linux distributions. The Linux Standard Base (LSB, available at http://www.linuxbase.org) recommends only that, besides the group “root” with a Group ID (GID) of 0, a group“bin” with a GID of 1 be present. All other group names and GIDs can be chosen freely by the system administrator since well-written programs do not depend on GID numbers, but rather use the group's name.To remove the “I have no name!” prompt, start a new shell. Since a full Glibc was installed in Chapter 5 and the /etc/passwd and /etc/group files have been created, user name and group name resolution will now work.exec /tools/bin/bash --login +hNote the use of the +h directive. This tells bash not to use its internal path hashing. Without this directive, bash would remember the paths to binaries it has executed. To ensure the use of the newly compiled binaries as soon as they are installed, the +h directive will be used for the duration of this chapter.The login, agetty, and init programs (and others) use a number of log files to record information such as who was logged into the system and when. However, these programs will not write to the log files if they do not already exist. Initialize the log files and give them proper permissions:touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}chgrp -v utmp /var/run/utmp /var/log/lastlogchmod -v 664 /var/run/utmp /var/log/lastlogThe /var/run/utmp file records the users that are currently logged in. The /var/log/wtmp file records all logins and logouts. The /var/log/lastlog file records when each user last logged in. The /var/log/btmp file records the bad login attempts.6.8. Populating /dev6.8.1. Creating Initial Device NodesWhen the kernel boots the system, it requires the presence of a few device nodes, in particular the console and null devices. The device nodes will be created on the hard disk so that they are available before udev has been started, and additionally when Linux is started in single user mode (hence the restrictive permissions on console). Create the devices by running the followingcommands:mknod -m 600 /dev/console c 5 1mknod -m 666 /dev/null c 1 36.8.2. Mounting tmpfs and Populating /devThe recommended method of populating the /dev directory with devices is to mount a virtual filesystem (such as tmpfs) on the /dev directory, and allow the devices to be created dynamically on that virtual filesystem as they are detected or accessed. This is generally done during the boot process. Since this new system has not been booted, it is necessary to do what the LFS-Bootscriptspackage would otherwise do by mounting /dev:mount -nvt tmpfs none /devThe Udev package is what actually creates the devices in the /dev directory. Since it will not be installed until later on in the process, manually create the minimal set of device nodes needed to complete the building of this system:mknod -m 622 /dev/console c 5 1mknod -m 666 /dev/null c 1 3mknod -m 666 /dev/zero c 1 5mknod -m 666 /dev/ptmx c 5 2mknod -m 666 /dev/tty c 5 0mknod -m 444 /dev/random c 1 8mknod -m 444 /dev/urandom c 1 9chown -v root:tty /dev/{console,ptmx,tty}There are some symlinks and directories required by LFS that are created during system startup by the LFS-Bootscripts package. Since this is a chroot environment and not a booted environment, those symlinks and directories need to be created here:ln -sv /proc/self/fd /dev/fdln -sv /proc/self/fd/0 /dev/stdinln -sv /proc/self/fd/1 /dev/stdoutln -sv /proc/self/fd/2 /dev/stderrln -sv /proc/kcore /dev/coremkdir -v /dev/ptsmkdir -v /dev/shmFinally, mount the proper virtual (kernel) file systems on the newly-created directories:mount -vt devpts -o gid=4,mode=620 none /dev/ptsmount -vt tmpfs none /dev/shmThe mount commands executed above may result in the following warning message:can't open /etc/fstab: No such file or directory.This file—/etc/fstab—has not been created yet but is also not required for the file systems to be properly mounted. As such, the warning can be safely ignored.6.9. Linux-Libc-Headers-2.6.11.2The Linux-Libc-Headers package contains the “sanitized” kernel headers.Approximate build time: 0.1 SBURequired disk space: 26.9 MBInstallation depends on: Coreutils6.9.1. Installation of Linux-Libc-HeadersFor years it has been common practice to use “raw” kernel headers (straight from a kernel tarball) in /usr/include, but over the last few years, the kernel developers have taken a strong stance that this should not be done. This gave birth to the Linux-Libc-Headers Project, which was designed to maintain an API stable version of the Linux headers.Install the header files:cp -Rv include/asm-i386 /usr/include/asmcp -Rv include/linux /usr/includeEnsure that all the headers are owned by root:chown -Rv root:root /usr/include/{asm,linux}Make sure the users can read the headers:find /usr/include/{asm,linux} -type d -exec chmod -v 755 {} \;find /usr/include/{asm,linux} -type f -exec chmod -v 644 {} \;6.9.2. Contents of Linux-Libc-HeadersInstalled headers: /usr/include/{asm,linux}/*.hShort Descriptions/usr/include/{asm,linux}/*.h The Linux API headers6.10. Man-pages-2.01The Man-pages package contains over 1,200 man pages.Approximate build time: 0.1 SBURequired disk space: 25.8 MBInstallation depends on: Bash, Coreutils, and Make6.10.1. Installation of Man-pagesInstall Man-pages by running:make install6.10.2. Contents of Man-pagesInstalled files: various man pagesShort Descriptionsman pages Describe the C and C++ functions, important device files, and significant configuration files6.11. Glibc-2.3.4The Glibc package contains the main C library. This library provides the basic routines for allocating memory, searching directories, opening and closing files, reading and writing files, string handling, pattern matching, arithmetic, and so on.Approximate build time: 12.3 SBURequired disk space: 476 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Gettext, Grep, Make, Perl, Sed, and Texinfo6.11.1. Installation of GlibcNoteSome packages outside of LFS suggest installing GNU libiconv in order to translate data from one encoding to another. The project's home page (http://www.gnu.org/software/libiconv/) says “This library provides an iconv() implementation, for use on systems which don't have one, or whose implementation cannot convert from/to Unicode. ” Glibc provides an iconv() implementation and canconvert from/to Unicode, therefore libiconv is not required on an LFS system.This package is known to have issues when its default optimization flags (including the -march and -mcpu options) are changed. If any environment variables that override default optimizations have been defined, such as CFLAGS and CXXFLAGS, unset them when building Glibc.The Glibc build system is self-contained and will install perfectly, even though the compiler specs file and linker are still pointing at /tools. The specs and linker cannot be adjusted before the Glibc install because the Glibc autoconf tests would give false results and defeat the goal of achieving a clean build.The linuxthreads tarball contains the man pages for the threading libraries installed by Glibc. Unpack the tarball from within the Glibc source directory:tar -xjvf ../glibc-linuxthreads-2.3.4.tar.bz2In certain rare circumstances, Glibc can segfault when no standard search directories exist. The following patch prevents this:patch -Np1 -i ../glibc-2.3.4-rtld_search_dirs-1.patchGlibc has two tests which fail when the running kernel is 2.6.11.x The problem has been determined to be with the tests themselves, not with the libc nor the kernel. This patch fixes the problem:patch -Np1 -i ../glibc-2.3.4-fix_test-1.patchApply the following patch to fix a bug in Glibc that can prevent some programs (including OpenOffice.org) from running:patch -Np1 -i ../glibc-2.3.4-tls_assert-1.patchThe Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory:mkdir -v ../glibc-buildcd ../glibc-buildPrepare Glibc for compilation:../glibc-2.3.4/configure --prefix=/usr \ --disable-profile --enable-add-ons \ --enable-kernel=2.6.0 --libexecdir=/usr/lib/glibcThe meaning of the new configure options:--libexecdir=/usr/lib/glibc This changes the location of the pt_chown program from its default of /usr/libexec to /usr/lib/glibc.Compile the package:makeImportantIn this section, the test suite for Glibc is considered critical. Do not skip it under any circumstance.Test the results:make -k check >glibc-check-log 2>&1grep Error glibc-check-logThe Glibc test suite is highly dependent on certain functions of the host system, in particular the kernel. In general, the Glibc test suite is always expected to pass. However, in certain circumstances, some failures are unavoidable. This is a list of the most common issues: The math tests sometimes fail when running on systems where the CPU is not a relatively new genuine Intel or authentic AMD. Certain optimization settings are also known to be a factor here. The gettext test sometimes fails due to host system issues. The exact reasons are not yet clear. If you have mounted the LFS partition with the noatime option, the atime test will fail. As mentioned in Section 2.4, “Mounting the New Partition”, do not use the noatime option while building LFS. When running on older and slower hardware, some tests can fail because of test timeouts being exceeded.Though it is a harmless message, the install stage of Glibc will complain about the absence of /etc/ld.so.conf. Prevent this warning with:touch /etc/ld.so.confInstall the package:make installThe locales that can make the system respond in a different language were not installed by the above command. Install this with:make localedata/install-localesTo save time, an alternative to running the previous command (which generates and installs every locale listed in the glibc-2.3.4/localedata/SUPPORTED file) is to install only those locales that are wanted and needed. This can be achieved by using the localedef command. Information on this command is located in the INSTALL file in the Glibc source. However, there are a number of localesthat are essential in order for the tests of future packages to pass, in particular, the libstdc++ tests from GCC. The following instructions, instead of the install-locales target used above, will install the minimum set of locales necessary for the tests to run successfully:mkdir -pv /usr/lib/localelocaledef -i de_DE -f ISO-8859-1 de_DElocaledef -i de_DE@euro -f ISO-8859-15 de_DE@eurolocaledef -i en_HK -f ISO-8859-1 en_HKlocaledef -i en_PH -f ISO-8859-1 en_PHlocaledef -i en_US -f ISO-8859-1 en_USlocaledef -i es_MX -f ISO-8859-1 es_MXlocaledef -i fa_IR -f UTF-8 fa_IRlocaledef -i fr_FR -f ISO-8859-1 fr_FRlocaledef -i fr_FR@euro -f ISO-8859-15 fr_FR@eurolocaledef -i it_IT -f ISO-8859-1 it_ITlocaledef -i ja_JP -f EUC-JP ja_JPSome locales installed by the make localedata/install-locales command above are not properly supported by some applications that are in the LFS and BLFS books. Because of the various problems that arise due to application programmers making assumptions that break in such locales, LFS should not be used in locales that utilize multibyte character sets (including UTF-8) or right-to-leftwriting order. Numerous unofficial and unstable patches are required to fix these problems, and it has been decided by the LFS developers not to support such complex locales at this time. This applies to the ja_JP and fa_IR locales as well—they have been installed only for GCC and Gettext tests to pass, and the watch program (part of the Procps package) does not work properly in them.Various attempts to circumvent these restrictions are documented in internationalization-related hints.Build the linuxthreads man pages, which are a great reference on the threading API (applicable to NPTL as well):make -C ../glibc-2.3.4/linuxthreads/manInstall these pages:make -C ../glibc-2.3.4/linuxthreads/man install6.11.2. Configuring GlibcThe /etc/nsswitch.conf file needs to be created because, although Glibc provides defaults when this file is missing or corrupt, the Glibc defaults do not work well in a networked environment. The time zone also needs to be configured.Create a new file /etc/nsswitch.conf by running the following:cat > /etc/nsswitch.conf << "EOF"# Begin /etc/nsswitch.confpasswd: filesgroup: filesshadow: fileshosts: files dnsnetworks: filesprotocols: filesservices: filesethers: filesrpc: files# End /etc/nsswitch.confEOFTo determine the local time zone, run the following script:tzselectAfter answering a few questions about the location, the script will output the name of the time zone (e.g., EST5EDT or Canada/Eastern). Then create the /etc/localtime file by running:cp -v --remove-destination /usr/share/zoneinfo/[xxx] \ /etc/localtimeReplace [xxx] with the name of the time zone that tzselect provided (e.g., Canada/Eastern).The meaning of the cp option:--remove-destination This is needed to force removal of the already existing symbolic link. The reason for copying the file instead of using a symlink is to cover the situation where /usr is on a separate partition. This could be important when booted into single user mode.6.11.3. Configuring Dynamic LoaderBy default, the dynamic loader (/lib/ld-linux.so.2) searches through /lib and /usr/lib for dynamic libraries that are needed by programs as they are run. However, if there are libraries in directories other than /lib and /usr/lib, these need to be added to the /etc/ld.so.conf file in order for the dynamic loader to find them. Two directories that are commonly known to contain additionallibraries are /usr/local/lib and /opt/lib, so add those directories to the dynamic loader's search path.Create a new file /etc/ld.so.conf by running the following:cat > /etc/ld.so.conf << "EOF"# Begin /etc/ld.so.conf/usr/local/lib/opt/lib# End /etc/ld.so.confEOF6.11.4. Contents of GlibcInstalled programs: catchsegv, gencat, getconf, getent, iconv, iconvconfig, ldconfig, ldd, lddlibc4, locale, localedef, mtrace, nscd, nscd_nischeck, pcprofiledump, pt_chown, rpcgen, rpcinfo, sln, sprof, tzselect, xtrace, zdump, and zicInstalled libraries: ld.so, libBrokenLocale.[a,so], libSegFault.so, libanl.[a,so], libbsd-compat.a, libc.[a,so], libcrypt.[a,so], libdl.[a,so], libg.a, libieee.a, libm.[a,so], libmcheck.a, libmemusage.so, libnsl.a, libnss_compat.so, libnss_dns.so, libnss_files.so, libnss_hesiod.so, libnss_nis.so, libnss_nisplus.so, libpcprofile.so, libpthread.[a,so], libresolv.[a,so], librpcsvc.a,librt.[a,so], libthread_db.so, and libutil.[a,so]Short Descriptionscatchsegv Can be used to create a stack trace when a program terminates with a segmentation faultgencat Generates message cataloguesgetconf Displays the system configuration values for file system specific variablesgetent Gets entries from an administrative databaseiconv Performs character set conversioniconvconfig Creates fastloading iconv module configuration filesldconfig Configures the dynamic linker runtime bindingsldd Reports which shared libraries are required by each given program or shared librarylddlibc4 Assists ldd with object fileslocale Tells the compiler to enable or disable the use of POSIX locales for built-in operationslocaledef Compiles locale specificationsmtrace Reads and interprets a memory trace file and displays a summary in human-readable formatnscd A daemon that provides a cache for the most common name service requestsnscd_nischeck Checks whether or not secure mode is necessary for NIS+ lookuppcprofiledump Dumps information generated by PC profilingpt_chown A helper program for grantpt to set the owner, group and access permissions of a slave pseudo terminalrpcgen Generates C code to implement the Remote Procecure Call (RPC) protocolrpcinfo Makes an RPC call to an RPC serversln A statically linked ln programsprof Reads and displays shared object profiling datatzselect Asks the user about the location of the system and reports the corresponding time zone descriptionxtrace Traces the execution of a program by printing the currently executed functionzdump The time zone dumperzic The time zone compilerld.so The helper program for shared library executableslibBrokenLocale Used by programs, such as Mozilla, to solve broken localeslibSegFault The segmentation fault signal handlerlibanl An asynchronous name lookup librarylibbsd-compat Provides the portability needed in order to run certain Berkey Software Distribution (BSD) programs under Linuxlibc The main C librarylibcrypt The cryptography librarylibdl The dynamic linking interface librarylibg A runtime library for g++libieee The Institute of Electrical and Electronic Engineers (IEEE) floating point librarylibm The mathematical librarylibmcheck Contains code run at bootlibmemusage Used by memusage to help collect information about the memory usage of a programlibnsl The network services librarylibnss The Name Service Switch libraries, containing functions for resolving host names, user names, group names, aliases, services, protocols, etc.libpcprofile Contains profiling functions used to track the amount of CPU time spent in specific source code lineslibpthread The POSIX threads librarylibresolv Contains functions for creating, sending, and interpreting packets to the Internet domain name serverslibrpcsvc Contains functions providing miscellaneous RPC serviceslibrt Contains functions providing most of the interfaces specified by the POSIX.1b Realtime Extensionlibthread_db Contains functions useful for building debuggers for multi-threaded programslibutil Contains code for “standard” functions used in many different Unix utilities6.12. Re-adjusting the ToolchainNow that the final C libraries have been installed, it is time to adjust the toolchain again. The toolchain will be adjusted so that it will link any newly compiled program against these new libraries. This is the same process used in the “Adjusting” phase in the beginning of Chapter 5, but with the adjustments reversed. In Chapter 5, the chain was guided from the host's /{,usr/}libdirectories to the new /tools/lib directory. Now, the chain will be guided from that same /tools/lib directory to the LFS /{,usr/}lib directories.Start by adjusting the linker. The source and build directories from the second pass of Binutils were retained for this purpose. Install the adjusted linker by running the following command from within the binutils-build directory:make -C ld INSTALL=/tools/bin/install installNoteIf the earlier warning to retain the Binutils source and build directories from the second pass in Chapter 5 was missed, or if they were accidentally deleted or are inaccessible, ignore the above command. The result will be that the next package, Binutils, will link against the C libraries in /tools rather than in /{,usr/}lib. This is not ideal, however, testing has shown that theresulting Binutils program binaries should be identical.From now on, every compiled program will link only against the libraries in /usr/lib and /lib. The extra INSTALL=/tools/bin/install option is needed because the Makefile file created during the second pass still contains the reference to /usr/bin/install, which has not been installed yet. Some host distributions contain a ginstall symbolic link which takes precedence in the Makefile fileand can cause a problem. The above command takes care of this issue.Remove the Binutils source and build directories now.Next, amend the GCC specs file so that it points to the new dynamic linker. A perl command accomplishes this:perl -pi -e 's@ /tools/lib/ld-linux.so.2@ /lib/ld-linux.so.2@g;' \ -e 's@\*startfile_prefix_spec:\n@$_/usr/lib/ @g;' \ `gcc --print-file specs`It is a good idea to visually inspect the specs file to verify the intended change was actually made.ImportantIf working on a platform where the name of the dynamic linker is something other than ld-linux.so.2, substitute “ld-linux.so.2” with the name of the platform's dynamic linker in the above commands. Refer back to Section 5.2, “Toolchain Technical Notes,” if necessary.CautionIt is imperative at this point to stop and ensure that the basic functions (compiling and linking) of the adjusted toolchain are working as expected. To do this, perform a sanity check:echo 'main(){}' > dummy.ccc dummy.creadelf -l a.out | grep ': /lib'If everything is working correctly, there should be no errors, and the output of the last command will be (allowing for platform-specific differences in dynamic linker name):[Requesting program interpreter: /lib/ld-linux.so.2]Note that /lib is now the prefix of our dynamic linker.If the output does not appear as shown above or is not received at all, then something is seriously wrong. Investigate and retrace the steps to find out where the problem is and correct it. The most likely reason is that something went wrong with the specs file amendment above. Any issues will need to be resolved before continuing on with the process.Once everything is working correctly, clean up the test files:rm -v dummy.c a.out6.13. Binutils-2.15.94.0.2.2The Binutils package contains a linker, an assembler, and other tools for handling object files.Approximate build time: 1.3 SBURequired disk space: 158 MBInstallation depends on: Bash, Bison, Coreutils, Diffutils, Flex, GCC, Gettext, Glibc, Grep, M4, Make, Perl, Sed, and Texinfo6.13.1. Installation of BinutilsThis package is known to have issues when its default optimization flags (including the -march and -mcpu options) are changed. If any environment variables that override default optimizations have been defined, such as CFLAGS and CXXFLAGS, unset them when building Binutils.Verify that the PTYs are working properly inside the chroot environment. Check that everything is set up correctly by performing a simple test:expect -c "spawn ls"If the following message shows up, the chroot environment is not set up for proper PTY operation:The system has no more ptys. Ask your system administrator to create more.This issue needs to be resolved before running the test suites for Binutils and GCC.The Binutils documentation recommends building Binutils outside of the source directory in a dedicated build directory:mkdir -v ../binutils-buildcd ../binutils-buildPrepare Binutils for compilation:../binutils-2.15.94.0.2.2/configure --prefix=/usr \ --enable-sharedCompile the package:make tooldir=/usrNormally, the tooldir (the directory where the executables will ultimately be located) is set to $(exec_prefix)/$(target_alias). For example, i686 machines would expand that to /usr/i686-pc-linux-gnu. Because this is a custom system, this target-specific directory in /usr is not required. $(exec_prefix)/$(target_alias) would be used if the system was used to cross-compile (for example,compiling a package on an Intel machine that generates code that can be executed on PowerPC machines).ImportantThe test suite for Binutils in this section is considered critical. Do not skip it under any circumstances.Test the results:make checkInstall the package:make tooldir=/usr installInstall the libiberty header file that is needed by some packages:cp -v ../binutils-2.15.94.0.2.2/include/libiberty.h /usr/include6.13.2. Contents of BinutilsInstalled programs: addr2line, ar, as, c++filt, gprof, ld, nm, objcopy, objdump, ranlib, readelf, size, strings, and stripInstalled libraries: libiberty.a, libbfd.[a,so], and libopcodes.[a,so]Short Descriptionsaddr2line Translates program addresses to file names and line numbers; given an address and the name of an executable, it uses the debugging information in the executable to determine which source file and line number are associated with the addressar Creates, modifies, and extracts from archivesas An assembler that assembles the output of gcc into object filesc++filt Used by the linker to de-mangle C++ and Java symbols and to keep overloaded functions from clashinggprof Displays call graph profile datald A linker that combines a number of object and archive files into a single file, relocating their data and tying up symbol referencesnm Lists the symbols occurring in a given object fileobjcopy Translates one type of object file into anotherobjdump Displays information about the given object file, with options controlling the particular information to display; the information shown is useful to programmers who are working on the compilation toolsranlib Generates an index of the contents of an archive and stores it in the archive; the index lists all of the symbols defined by archive members that are relocatable object filesreadelf Displays information about ELF type binariessize Lists the section sizes and the total size for the given object filesstrings Outputs, for each given file, the sequences of printable characters that are of at least the specified length (defaulting to four); for object files, it prints, by default, only the strings from the initializing and loading sections while for other types of files, it scans the entire filestrip Discards symbols from object fileslibiberty Contains routines used by various GNU programs, including getopt, obstack, strerror, strtol, and strtoullibbfd The Binary File Descriptor librarylibopcodes A library for dealing with opcodes—the “readable text” versions of instructions for the processor; it is used for building utilities like objdump.6.14. GCC-3.4.3The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.Approximate build time: 11.7 SBURequired disk space: 451 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, Findutils, Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, and Texinfo6.14.1. Installation of GCCThis package is known to have issues when its default optimization flags (including the -march and -mcpu options) are changed. If any environment variables that override default optimizations have been defined, such as CFLAGS and CXXFLAGS, unset them when building GCC.Apply only the No-Fixincludes patch (not the Specs patch) also used in the previous chapter:patch -Np1 -i ../gcc-3.4.3-no_fixincludes-1.patchGCC fails to compile some packages outside of a base Linux From Scratch install (e.g., Mozilla and kdegraphics) when used in conjunction with newer versions of Binutils. Apply the following patch to fix this issue:patch -Np1 -i ../gcc-3.4.3-linkonce-1.patchApply a sed substitution that will suppress the installation of libiberty.a. The version of libiberty.a provided by Binutils will be used instead:sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.inThe GCC documentation recommends building GCC outside of the source directory in a dedicated build directory:mkdir -v ../gcc-buildcd ../gcc-buildPrepare GCC for compilation:../gcc-3.4.3/configure --prefix=/usr \ --libexecdir=/usr/lib --enable-shared \ --enable-threads=posix --enable-__cxa_atexit \ --enable-clocale=gnu --enable-languages=c,c++Compile the package:makeImportantIn this section, the test suite for GCC is considered critical. Do not skip it under any circumstance.Test the results, but do not stop at errors:make -k checkSome of the errors are known issues and were noted in the previous chapter. The test suite notes from Section 5.11, “GCC-3.4.3 - Pass 2,” are still relevant here. Be sure to refer back to them as necessary.Install the package:make installSome packages expect the C preprocessor to be installed in the /lib directory. To support those packages, create this symlink:ln -sv ../usr/bin/cpp /libMany packages use the name cc to call the C compiler. To satisfy those packages, create a symlink:ln -sv gcc /usr/bin/ccNoteAt this point, it is strongly recommended to repeat the sanity check performed earlier in this chapter. Refer back to Section 6.12, “Re-adjusting the Toolchain,” and repeat the check. If the results are in error, then the most likely reason is that the GCC Specs patch from Chapter 5 was erroneously applied here.6.14.2. Contents of GCCInstalled programs: c++, cc (link to gcc), cpp, g++, gcc, gccbug, and gcovInstalled libraries: libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so], and libsupc++.aShort Descriptionscc The C compilercpp The C preprocessor; it is used by the compiler to expand the #include, #define, and similar statements in the source filesc++ The C++ compilerg++ The C++ compilergcc The C compilergccbug A shell script used to help create useful bug reportsgcov A coverage testing tool; it is used to analyze programs to determine where optimizations will have the most effectlibgcc Contains run-time support for gcclibstdc++ The standard C++ librarylibsupc++ Provides supporting routines for the C++ programming language6.15. Coreutils-5.2.1The Coreutils package contains utilities for showing and setting the basic system characteristics.Approximate build time: 0.9 SBURequired disk space: 52.8 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Perl, and Sed6.15.1. Installation of CoreutilsA known issue with the uname program from this package is that the -p switch always returns unknown. The following patch fixes this behavior for Intel architectures:patch -Np1 -i ../coreutils-5.2.1-uname-2.patchPrevent Coreutils from installing binaries that will be installed by other packages later:patch -Np1 -i ../coreutils-5.2.1-suppress_uptime_kill_su-1.patchNow prepare Coreutils for compilation:DEFAULT_POSIX2_VERSION=199209 ./configure --prefix=/usrCompile the package:makeThe test suite of Coreutils makes several assumptions about the presence of system users and groups that are not valid within the minimal environment that exists at the moment. Therefore, additional items need to be set up before running the tests. Skip down to “Install the package” if not running the test suite.Create two dummy groups and a dummy user:echo "dummy1:x:1000:" >> /etc/groupecho "dummy2:x:1001:dummy" >> /etc/groupecho "dummy:x:1000:1000:::/bin/bash" >> /etc/passwdNow the test suite is ready to be run. First, run the tests that are meant to be run as user root:make NON_ROOT_USERNAME=dummy check-rootThen run the remainder of the tests as the dummy user:src/su dummy -c "make RUN_EXPENSIVE_TESTS=yes check"When testing is complete, remove the dummy user and groups:sed -i '/dummy/d' /etc/passwd /etc/groupInstall the package:make installMove programs to the locations specified by the FHS:mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /binmv -v /usr/bin/{false,hostname,ln,ls,mkdir,mknod,mv,pwd,rm} /binmv -v /usr/bin/{rmdir,stty,sync,true,uname} /binmv -v /usr/bin/chroot /usr/sbinSome of the scripts in the LFS-Bootscripts package depend on head and sleep. As /usr may not be available during the early stages of booting, those binaries need to be on the root partition:mv -v /usr/bin/{head,sleep} /bin6.15.2. Contents of CoreutilsInstalled programs: basename, cat, chgrp, chmod, chown, chroot, cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors, dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups, head, hostid, hostname, id, install, join, link, ln, logname, ls, md5sum, mkdir, mkfifo, mknod, mv, nice, nl, nohup, od, paste, pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, rm,rmdir, seq, sha1sum, shred, sleep, sort, split, stat, stty, sum, sync, tac, tail, tee, test, touch, tr, true, tsort, tty, uname, unexpand, uniq, unlink, users, vdir, wc, who, whoami, and yesShort Descriptionsbasename Strips any path and a given suffix from a file namecat Concatenates files to standard outputchgrp Changes the group ownership of files and directorieschmod Changes the permissions of each file to the given mode; the mode can be either a symbolic representation of the changes to make or an octal number representing the new permissionschown Changes the user and/or group ownership of files and directorieschroot Runs a command with the specified directory as the / directorycksum Prints the Cyclic Redundancy Check (CRC) checksum and the byte counts of each specified filecomm Compares two sorted files, outputting in three columns the lines that are unique and the lines that are commoncp Copies filescsplit Splits a given file into several new files, separating them according to given patterns or line numbers and outputting the byte count of each new filecut Prints sections of lines, selecting the parts according to given fields or positionsdate Displays the current time in the given format, or sets the system datedd Copies a file using the given block size and count, while optionally performing conversions on itdf Reports the amount of disk space available (and used) on all mounted file systems, or only on the file systems holding the selected filesdir Lists the contents of each given directory (the same as the ls command)dircolors Outputs commands to set the LS_COLOR environment variable to change the color scheme used by lsdirname Strips the non-directory suffix from a file namedu Reports the amount of disk space used by the current directory, by each of the given directories (including all subdirectories) or by each of the given filesecho Displays the given stringsenv Runs a command in a modified environmentexpand Converts tabs to spacesexpr Evaluates expressionsfactor Prints the prime factors of all specified integer numbersfalse Does nothing, unsuccessfully; it always exits with a status code indicating failurefmt Reformats the paragraphs in the given filesfold Wraps the lines in the given filesgroups Reports a user's group membershipshead Prints the first ten lines (or the given number of lines) of each given filehostid Reports the numeric identifier (in hexadecimal) of the hosthostname Reports or sets the name of the hostid Reports the effective user ID, group ID, and group memberships of the current user or specified userinstall Copies files while setting their permission modes and, if possible, their owner and groupjoin Joins the lines that have identical join fields from two separate fileslink Creates a hard link with the given name to a fileln Makes hard links or soft (symbolic) links between fileslogname Reports the current user's login namels Lists the contents of each given directorymd5sum Reports or checks Message Digest 5 (MD5) checksumsmkdir Creates directories with the given namesmkfifo Creates First-In, First-Outs (FIFOs), a “named pipe” in UNIX parlance, with the given namesmknod Creates device nodes with the given names; a device node is a character special file, a block special file, or a FIFOmv Moves or renames files or directoriesnice Runs a program with modified scheduling prioritynl Numbers the lines from the given filesnohup Runs a command immune to hangups, with its output redirected to a log fileod Dumps files in octal and other formatspaste Merges the given files, joining sequentially corresponding lines side by side, separated by tab characterspathchk Checks if file names are valid or portablepinky Is a lightweight finger client; it reports some information about the given userspr Paginates and columnates files for printingprintenv Prints the environmentprintf Prints the given arguments according to the given format, much like the C printf functionptx Produces a permuted index from the contents of the given files, with each keyword in its contextpwd Reports the name of the current working directoryreadlink Reports the value of the given symbolic linkrm Removes files or directoriesrmdir Removes directories if they are emptyseq Prints a sequence of numbers within a given range and with a given incrementsha1sum Prints or checks 160-bit Secure Hash Algorithm 1 (SHA1) checksumsshred Overwrites the given files repeatedly with complex patterns, making it difficult to recover the datasleep Pauses for the given amount of timesort Sorts the lines from the given filessplit Splits the given file into pieces, by size or by number of linesstat Displays file or filesystem statusstty Sets or reports terminal line settingssum Prints checksum and block counts for each given filesync Flushes file system buffers; it forces changed blocks to disk and updates the super blocktac Concatenates the given files in reversetail Prints the last ten lines (or the given number of lines) of each given filetee Reads from standard input while writing both to standard output and to the given filestest Compares values and checks file typestouch Changes file timestamps, setting the access and modification times of the given files to the current time; files that do not exist are created with zero lengthtr Translates, squeezes, and deletes the given characters from standard inputtrue Does nothing, successfully; it always exits with a status code indicating successtsort Performs a topological sort; it writes a completely ordered list according to the partial ordering in a given filetty Reports the file name of the terminal connected to standard inputuname Reports system informationunexpand Converts spaces to tabsuniq Discards all but one of successive identical linesunlink Removes the given fileusers Reports the names of the users currently logged onvdir Is the same as ls -lwc Reports the number of lines, words, and bytes for each given file, as well as a total line when more than one file is givenwho Reports who is logged onwhoami Reports the user name associated with the current effective user IDyes Repeatedly outputs “y” or a given string until killed6.16. Zlib-1.2.3The Zlib package contains compression and decompression routines used by some programs.Approximate build time: 0.1 SBURequired disk space: 3.1 MBInstallation depends on: Binutils, Coreutils, GCC, Glibc, Make, and Sed6.16.1. Installation of ZlibNoteZlib is known to build its shared library incorrectly if CFLAGS is specified in the environment. If using a specified CFLAGS variable, be sure to add the -fPIC directive to the CFLAGS variable for the duration of the configure command below, then remove it afterwards.Prepare Zlib for compilation:./configure --prefix=/usr --shared --libdir=/libCompile the package:makeTo test the results, issue: make check.Install the shared library:make installThe previous command installed a .so file in /lib. We will remove it and relink it into /usr/lib:rm -v /lib/libz.soln -sfv ../../lib/libz.so.1.2.3 /usr/lib/libz.soBuild the static library:make clean./configure --prefix=/usrmakeTo test the results again, issue: make check.Install the static library:make installFix the permissions on the static library:chmod -v 644 /usr/lib/libz.a6.16.2. Contents of ZlibInstalled libraries: libz.[a,so]Short Descriptionslibz Contains compression and decompression functions used by some programs6.17. Mktemp-1.5The Mktemp package contains programs used to create secure temporary files in shell scripts.Approximate build time: 0.1 SBURequired disk space: 436 KBInstallation depends on: Coreutils, Make, and Patch6.17.1. Installation of MktempMany scripts still use the deprecated tempfile program, which has functionality similar to mktemp. Patch Mktemp to include a tempfile wrapper:patch -Np1 -i ../mktemp-1.5-add_tempfile-2.patchPrepare Mktemp for compilation:./configure --prefix=/usr --with-libcThe meaning of the configure options:--with-libc This causes the mktemp program to use the mkstemp and mkdtemp functions from the system C library.Compile the package:makeInstall the package:make installmake install-tempfile6.17.2. Contents of MktempInstalled programs: mktemp and tempfileShort Descriptionsmktemp Creates temporary files in a secure manner; it is used in scriptstempfile Creates temporary files in a less secure manner than mktemp; it is installed for backwards-compatibility6.18. Iana-Etc-1.04The Iana-Etc package provides data for network services and protocols.Approximate build time: 0.1 SBURequired disk space: 1.9 MBInstallation depends on: Make6.18.1. Installation of Iana-EtcThe following command converts the raw data provided by IANA into the correct formats for the /etc/protocols and /etc/services data files:makeInstall the package:make install6.18.2. Contents of Iana-EtcInstalled files: /etc/protocols and /etc/servicesShort Descriptions/etc/protocols Describes the various DARPA Internet protocols that are available from the TCP/IP subsystem/etc/services Provides a mapping between friendly textual names for internet services, and their underlying assigned port numbers and protocol types6.19. Findutils-4.2.23The Findutils package contains programs to find files. These programs are provided to recursively search through a directory tree and to create, maintain, and search a database (often faster than the recursive find, but unreliable if the database has not been recently updated).Approximate build time: 0.1 SBURequired disk space: 9.4 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make and Sed6.19.1. Installation of FindutilsPrepare Findutils for compilation:./configure --prefix=/usr --libexecdir=/usr/lib/locate \ --localstatedir=/var/lib/locateThe meaning of the configure options:--localstatedir This option changes the location of the locate database to be in /var/lib/locate, which is FHS-compliant.Compile the package:makeTo test the results, issue: make check.Install the package:make install6.19.2. Contents of FindutilsInstalled programs: bigram, code, find, frcode, locate, updatedb, and xargsShort Descriptionsbigram Was formerly used to produce locate databasescode Was formerly used to produce locate databases; it is the ancestor of frcode.find Searches given directory trees for files matching the specified criteriafrcode Is called by updatedb to compress the list of file names; it uses front-compression, reducing the database size by a factor of four to five.locate Searches through a database of file names and reports the names that contain a given string or match a given patternupdatedb Updates the locate database; it scans the entire file system (including other file systems that are currently mounted, unless told not to) and puts every file name it finds into the databasexargs Can be used to apply a given command to a list of files6.20. Gawk-3.1.4The Gawk package contains programs for manipulating text files.Approximate build time: 0.2 SBURequired disk space: 16.4 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, and Sed6.20.1. Installation of GawkPrepare Gawk for compilation:./configure --prefix=/usr --libexecdir=/usr/libCompile the package:makeTo test the results, issue: make check.Install the package:make install6.20.2. Contents of GawkInstalled programs: awk (link to gawk), gawk, gawk-3.1.4, grcat, igawk, pgawk, pgawk-3.1.4, and pwcatShort Descriptionsawk A link to gawkgawk A program for manipulating text files; it is the GNU implementation of awkgawk-3.1.4 A hard link to gawkgrcat Dumps the group database /etc/groupigawk Gives gawk the ability to include filespgawk The profiling version of gawkpgawk-3.1.4 Hard link to pgawkpwcat Dumps the password database /etc/passwd6.21. Ncurses-5.4The Ncurses package contains libraries for terminal-independent handling of character screens.Approximate build time: 0.6 SBURequired disk space: 18.6 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, and Sed6.21.1. Installation of NcursesPrepare Ncurses for compilation:./configure --prefix=/usr --with-shared --without-debugCompile the package:makeThis package does not come with a test suite.Install the package:make installGive the Ncurses libraries execute permissions:chmod -v 755 /usr/lib/*.5.4Fix a library that should not be executable:chmod -v 644 /usr/lib/libncurses++.aMove the libraries to the /lib directory, where they are expected to reside:mv -v /usr/lib/libncurses.so.5* /libBecause the libraries have been moved, a few symlinks point to non-existent files. Recreate those symlinks:ln -sfv ../../lib/libncurses.so.5 /usr/lib/libncurses.soln -sfv libncurses.so /usr/lib/libcurses.so6.21.2. Contents of NcursesInstalled programs: captoinfo (link to tic), clear, infocmp, infotocap (link to tic), reset (link to tset), tack, tic, toe, tput, and tsetInstalled libraries: libcurses.[a,so] (link to libncurses.[a,so]), libform.[a,so], libmenu.[a,so], libncurses++.a, libncurses.[a,so], and libpanel.[a,so]Short Descriptionscaptoinfo Converts a termcap description into a terminfo descriptionclear Clears the screen, if possibleinfocmp Compares or prints out terminfo descriptionsinfotocap Converts a terminfo description into a termcap descriptionreset Reinitializes a terminal to its default valuestack The terminfo action checker; it is mainly used to test the accuracy of an entry in the terminfo databasetic The terminfo entry-description compiler that translates a terminfo file from source format into the binary format needed for the ncurses library routines. A terminfo file contains information on the capabilities of a certain terminaltoe Lists all available terminal types, giving the primary name and description for eachtput Makes the values of terminal-dependent capabilities available to the shell; it can also be used to reset or initialize a terminal or report its long nametset Can be used to initialize terminalslibcurses A link to libncurseslibncurses Contains functions to display text in many complex ways on a terminal screen; a good example of the use of these functions is the menu displayed during the kernel's make menuconfiglibform Contains functions to implement formslibmenu Contains functions to implement menuslibpanel Contains functions to implement panels6.22. Readline-5.0The Readline package is a set of libraries that offers command-line editing and history capabilities.Approximate build time: 0.11 SBURequired disk space: 9.1 MBInstallation depends on: Binutils, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, Ncurses, and Sed6.22.1. Installation of ReadlineThe following patch includes a fix for a problem where Readline sometimes only shows 33 characters on a line and then wraps to the next line. It also includes other fixes recommended by the Readline author.patch -Np1 -i ../readline-5.0-fixes-1.patchPrepare Readline for compilation:./configure --prefix=/usr --libdir=/libCompile the package:make SHLIB_XLDFLAGS=-lncursesThe meaning of the make option:SHLIB_XLDFLAGS=-lncurses This option forces Readline to link against the libncurses library.Install the package:make installGive Readline's dynamic libraries more appropriate permissions:chmod -v 755 /lib/lib{readline,history}.so*Now move the static libraries to a more appropriate location:mv -v /lib/lib{readline,history}.a /usr/libNext, remove the .so files in /lib and relink them into /usr/lib.rm -v /lib/lib{readline,history}.soln -sfv ../../lib/libreadline.so.5 /usr/lib/libreadline.soln -sfv ../../lib/libhistory.so.5 /usr/lib/libhistory.so6.22.2. Contents of ReadlineInstalled libraries: libhistory.[a,so], and libreadline.[a,so]Short Descriptionslibhistory Provides a consistent user interface for recalling lines of historylibreadline Aids in the consistency of user interface across discrete programs that need to provide a command line interface6.23. Vim-6.3The Vim package contains a powerful text editor.Approximate build time: 0.4 SBURequired disk space: 38.0 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Ncurses, and SedAlternatives to VimIf you prefer another editor—such as Emacs, Joe, or Nano—please refer to http://www.linuxfromscratch.org/blfs/view/svn/postlfs/editors.html for suggested installation instructions.6.23.1. Installation of VimFirst, unpack both vim-6.3.tar.bz2 and (optionally) vim-6.3-lang.tar.gz archives into the same directory. Then, change the default location of the vimrc configuration file to /etc:echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.hVim has two known security vulnerabilities that have already been addressed upstream. The following patch fixes the problems:patch -Np1 -i ../vim-6.3-security_fix-2.patchNow prepare Vim for compilation:./configure --prefix=/usr --enable-multibyteThe meaning of the configure options:--enable-multibyte This optional but highly recommended switch enables support for editing files in multibyte character encodings. This is needed if using a locale with a multibyte character set. This switch is also helpful to be able to edit text files initially created in Linux distributions like Fedora Core that use UTF-8 as a default character set.Compile the package:makeTo test the results, issue: make test. However, this test suite outputs a lot of binary data to the screen, which can cause issues with the settings of the current terminal. This can be resolved by redirecting the output to a log file.Install the package:make installMany users are used to using vi instead of vim. To allow execution of vim when users habitually enter vi, create a symlink:ln -sv vim /usr/bin/viIf an X Window System is going to be installed on the LFS system, it may be necessary to recompile Vim after installing X. Vim comes with a GUI version of the editor that requires X and some additional libraries to be installed. For more information on this process, refer to the Vim documentation and the Vim installation page in the BLFS book athttp://www.linuxfromscratch.org/blfs/view/svn/postlfs/editors.html#postlfs-editors-vim.6.23.2. Configuring VimBy default, vim runs in vi-incompatible mode. This may be new to users who have used other editors in the past. The “nocompatible” setting is included below to highlight the fact that a new behavior is being used. It also reminds those who would change to “compatible” mode that it should be the first setting in the configuration file. This is necessary because it changes othersettings, and overrides must come after this setting. Create a default vim configuration file by running the following:cat > /etc/vimrc << "EOF"" Begin /etc/vimrcset nocompatibleset backspace=2syntax onif (&term == "iterm") || (&term == "putty") set background=darkendif" End /etc/vimrcEOFThe set nocompatible makes vim behave in a more useful way (the default) than the vi-compatible manner. Remove the “no” to keep the old vi behavior. The set backspace=2 allows backspacing over line breaks, autoindents, and the start of insert. The syntax on enables vim's syntax highlighting. Finally, the if statement with the set background=dark corrects vim's guess about thebackground color of some terminal emulators. This gives the highlighting a better color scheme for use on the black background of these programs.Documentation for other available options can be obtained by running the following command:vim -c ':options'6.23.3. Contents of VimInstalled programs: efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk, pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim), view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh, vimtutor, and xxdShort Descriptionsefm_filter.pl A filter for creating an error file that can be read by vimefm_perl.pl Reformats the error messages of the Perl interpreter for use with the “quickfix” mode of vimex Starts vim in ex modeless.sh A script that starts vim with less.vimmve.awk Processes vim errorspltags.pl Creates a tags file for Perl code for use by vimref Checks the spelling of argumentsrview Is a restricted version of view; no shell commands can be started and view cannot be suspendedrvim Is a restricted version of vim; no shell commands can be started and vim cannot be suspendedshtags.pl Generates a tags file for Perl scriptstcltags Generates a tags file for TCL codeview Starts vim in read-only modevi Is the editorvim Is the editorvim132 Starts vim with the terminal in 132-column modevim2html.pl Converts Vim documentation to HypterText Markup Language (HTML)vimdiff Edits two or three versions of a file with vim and show differencesvimm Enables the DEC locator input model on a remote terminalvimspell.sh Spell checks a file and generates the syntax statements necessary to highlight in vim. This script requires the old Unix spell command, which is provided neither in LFS nor in BLFSvimtutor Teaches the basic keys and commands of vimxxd Creates a hex dump of the given file; it can also do the reverse, so it can be used for binary patching6.24. M4-1.4.3The M4 package contains a macro processor.Approximate build time: 0.1 SBURequired disk space: 2.8 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Perl, and Sed6.24.1. Installation of M4Prepare M4 for compilation:./configure --prefix=/usrCompile the package:makeTo test the results, issue: make check.Install the package:make install6.24.2. Contents of M4Installed program: m4Short Descriptionsm4 copies the given files while expanding the macros that they contain. These macros are either built-in or user-defined and can take any number of arguments. Besides performing macro expansion, m4 has built-in functions for including named files, running Unix commands, performing integer arithmetic, manipulating text, recursion, etc. The m4 program can be used either as a front-end to acompiler or as a macro processor in its own right.6.25. Bison-2.0The Bison package contains a parser generator.Approximate build time: 0.6 SBURequired disk space: 9.9 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, M4, Make, and Sed6.25.1. Installation of BisonPrepare Bison for compilation:./configure --prefix=/usrCompile the package:makeTo test the results, issue: make check.Install the package:make install6.25.2. Contents of BisonInstalled programs: bison and yaccInstalled library: liby.aShort Descriptionsbison Generates, from a series of rules, a program for analyzing the structure of text files; Bison is a replacement for Yacc (Yet Another Compiler Compiler)yacc A wrapper for bison, meant for programs that still call yacc instead of bison; it calls bison with the -y optionliby.a The Yacc library containing implementations of Yacc-compatible yyerror and main functions; this library is normally not very useful, but POSIX requires it6.26. Less-382The Less package contains a text file viewer.Approximate build time: 0.1 SBURequired disk space: 2.3 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Ncurses, and Sed6.26.1. Installation of LessPrepare Less for compilation:./configure --prefix=/usr --bindir=/bin --sysconfdir=/etcThe meaning of the configure options:--sysconfdir=/etc This option tells the programs created by the package to look in /etc for the configuration files.Compile the package:makeInstall the package:make install6.26.2. Contents of LessInstalled programs: less, lessecho, and lesskeyShort Descriptionsless A file viewer or pager; it displays the contents of the given file, letting the user scroll, find strings, and jump to markslessecho Needed to expand meta-characters, such as * and ?, in filenames on Unix systemslesskey Used to specify the key bindings for less6.27. Groff-1.19.1The Groff package contains programs for processing and formatting text.Approximate build time: 0.5 SBURequired disk space: 38.7 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, and Sed6.27.1. Installation of GroffGroff expects the environment variable PAGE to contain the default paper size. For users in the United States, PAGE=letter is appropriate. Elsewhere, PAGE=A4 may be more suitable.Prepare Groff for compilation:PAGE=[paper_size] ./configure --prefix=/usrCompile the package:makeInstall the package:make installSome documentation programs, such as xman, will not work properly without the following symlinks:ln -sv soelim /usr/bin/zsoelimln -sv eqn /usr/bin/geqnln -sv tbl /usr/bin/gtbl6.27.2. Contents of GroffInstalled programs: addftinfo, afmtodit, eqn, eqn2graph, geqn (link to eqn), grn, grodvi, groff, groffer, grog, grolbp, grolj4, grops, grotty, gtbl (link to tbl), hpftodit, indxbib, lkbib, lookbib, mmroff, neqn, nroff, pfbtops, pic, pic2graph, post-grohtml, pre-grohtml, refer, soelim, tbl, tfmtodit, troff, and zsoelim (link to soelim)Short Descriptionsaddftinfo Reads a troff font file and adds some additional font-metric information that is used by the groff systemafmtodit Creates a font file for use with groff and gropseqn Compiles descriptions of equations embedded within troff input files into commands that are understood by troffeqn2graph Converts a troff EQN (equation) into a cropped imagegeqn A link to eqngrn A groff preprocessor for gremlin filesgrodvi A driver for groff that produces TeX dvi formatgroff A front-end to the groff document formatting system; normally, it runs the troff program and a post-processor appropriate for the selected devicegroffer Displays groff files and man pages on X and tty terminalsgrog Reads files and guesses which of the groff options -e, -man, -me, -mm, -ms, -p, -s, and -t are required for printing files, and reports the groff command including those optionsgrolbp Is a groff driver for Canon CAPSL printers (LBP-4 and LBP-8 series laser printers)grolj4 Is a driver for groff that produces output in PCL5 format suitable for an HP LaserJet 4 printergrops Translates the output of GNU troff to PostScriptgrotty Translates the output of GNU troff into a form suitable for typewriter-like devicesgtbl A link to tblhpftodit Creates a font file for use with groff -Tlj4 from an HP-tagged font metric fileindxbib Creates an inverted index for the bibliographic databases with a specified file for use with refer, lookbib, and lkbiblkbib Searches bibliographic databases for references that contain specified keys and reports any references foundlookbib Prints a prompt on the standard error (unless the standard input is not a terminal), reads a line containing a set of keywords from the standard input, searches the bibliographic databases in a specified file for references containing those keywords, prints any references found on the standard output, and repeats this process until the end of inputmmroff A simple preprocessor for groffneqn Formats equations for American Standard Code for Information Interchange (ASCII) outputnroff A script that emulates the nroff command using groffpfbtops Translates a PostScript font in .pfb format to ASCIIpic Compiles descriptions of pictures embedded within troff or TeX input files into commands understood by TeX or troffpic2graph Converts a PIC diagram into a cropped imagepost-grohtml Translates the output of GNU troff to HTMLpre-grohtml Translates the output of GNU troff to HTMLrefer Copies the contents of a file to the standard output, except that lines between .[ and .] are interpreted as citations, and lines between .R1 and .R2 are interpreted as commands for how citations are to be processedsoelim Reads files and replaces lines of the form .so file by the contents of the mentioned filetbl Compiles descriptions of tables embedded within troff input files into commands that are understood by trofftfmtodit Creates a font file for use with groff -Tdvitroff Is highly compatible with Unix troff; it should usually be invoked using the groff command, which will also run preprocessors and post-processors in the appropriate order and with the appropriate optionszsoelim A link to soelim6.28. Sed-4.1.4The Sed package contains a stream editor.Approximate build time: 0.2 SBURequired disk space: 8.4 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, and Texinfo6.28.1. Installation of SedBy default, Sed installs its HTML documentation in /usr/share/doc. Alter this to /usr/share/doc/sed-4.1.4 by applying the following sed:sed -i 's@/doc@&/sed-4.1.4@' doc/Makefile.inPrepare Sed for compilation:./configure --prefix=/usr --bindir=/binCompile the package:makeTo test the results, issue: make check.Install the package:make install6.28.2. Contents of SedInstalled program: sedShort Descriptionssed Filters and transforms text files in a single pass6.29. Flex-2.5.31The Flex package contains a utility for generating programs that recognize patterns in text.Approximate build time: 0.1 SBURequired disk space: 22.5 MBInstallation depends on: Bash, Binutils, Bison, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, M4, Make, and Sed6.29.1. Installation of FlexFlex contains several known bugs. Fix these with the following patch:patch -Np1 -i ../flex-2.5.31-debian_fixes-3.patchThe GNU autotools detects that the Flex source code has been modified by the previous patch and tries to update the man page accordingly. This does not work correctly on many systems, and the default page is fine, so make sure it does not get regenerated:touch doc/flex.1Prepare Flex for compilation:./configure --prefix=/usrCompile the package:makeTo test the results, issue: make check.Install the package:make installThere are some packages that expect to find the lex library in /usr/lib. Create a symlink to account for this:ln -sv libfl.a /usr/lib/libl.aA few programs do not know about flex yet and try to run its predecessor, lex. To support those programs, create a wrapper script named lex that calls flex in lex emulation mode:cat > /usr/bin/lex << "EOF"#!/bin/sh# Begin /usr/bin/lexexec /usr/bin/flex -l "$@"# End /usr/bin/lexEOFchmod -v 755 /usr/bin/lex6.29.2. Contents of FlexInstalled programs: flex and lexInstalled library: libfl.aShort Descriptionsflex A tool for generating programs that recognize patterns in text; it allows for the versatility to specify the rules for pattern-finding, eradicating the need to develop a specialized programlex A script that runs flex in lex emulation modelibfl.a The flex library6.30. Gettext-0.14.3The Gettext package contains utilities for internationalization and localization. These allow programs to be compiled with NLS (Native Language Support), enabling them to output messages in the user's native language.Approximate build time: 1.2 SBURequired disk space: 65.1 MBInstallation depends on: Bash, Binutils, Bison, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, and Sed6.30.1. Installation of GettextPrepare Gettext for compilation:./configure --prefix=/usrCompile the package:makeTo test the results, issue: make check. This takes a very long time, around 7 SBUs.Install the package:make install6.30.2. Contents of GettextInstalled programs: autopoint, config.charset, config.rpath, envsubst, gettext, gettextize, hostname, msgattrib, msgcat, msgcmp, msgcomm, msgconv, msgen, msgexec, msgfilter, msgfmt, msggrep, msginit, msgmerge, msgunfmt, msguniq, ngettext, and xgettextInstalled libraries: libasprintf.[a,so], libgettextlib.so, libgettextpo.[a,so], and libgettextsrc.soShort Descriptionsautopoint Copies standard Gettext infrastructure files into a source packageconfig.charset Outputs a system-dependent table of character encoding aliasesconfig.rpath Outputs a system-dependent set of variables, describing how to set the runtime search path of shared libraries in an executableenvsubst Substitutes environment variables in shell format stringsgettext Translates a natural language message into the user's language by looking up the translation in a message cataloggettextize Copies all standard Gettext files into the given top-level directory of a package to begin internationalizing ithostname Displays a network hostname in various formsmsgattrib Filters the messages of a translation catalog according to their attributes and manipulates the attributesmsgcat Concatenates and merges the given .po filesmsgcmp Compares two .po files to check that both contain the same set of msgid stringsmsgcomm Finds the messages that are common to to the given .po filesmsgconv Converts a translation catalog to a different character encodingmsgen Creates an English translation catalogmsgexec Applies a command to all translations of a translation catalogmsgfilter Applies a filter to all translations of a translation catalogmsgfmt Generates a binary message catalog from a translation catalogmsggrep Extracts all messages of a translation catalog that match a given pattern or belong to some given source filesmsginit Creates a new .po file, initializing the meta information with values from the user's environmentmsgmerge Combines two raw translations into a single filemsgunfmt Decompiles a binary message catalog into raw translation textmsguniq Unifies duplicate translations in a translation catalogngettext Displays native language translations of a textual message whose grammatical form depends on a numberxgettext Extracts the translatable message lines from the given source files to make the first translation templatelibasprintf defines the autosprintf class, which makes C formatted output routines usable in C++ programs, for use with the strings and the streamslibgettextlib a private library containing common routines used by the various Gettext programs; these are not intended for general uselibgettextpo Used to write specialized programs that process .po files; this library is used when the standard applications shipped with Gettext (such as msgcomm, msgcmp, msgattrib, and msgen) will not sufficelibgettextsrc A private library containing common routines used by the various Gettext programs; these are not intended for general use6.31. Inetutils-1.4.2The Inetutils package contains programs for basic networking.Approximate build time: 0.2 SBURequired disk space: 8.7 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Ncurses, and Sed6.31.1. Installation of InetutilsInetutils has issues with the Linux 2.6 kernel series. Fix these issues by applying the following patch:patch -Np1 -i ../inetutils-1.4.2-kernel_headers-1.patchAll programs that come with Inetutils will not be installed. However, the Inetutils build system will insist on installing all the man pages anyway. The following patch will correct this situation:patch -Np1 -i ../inetutils-1.4.2-no_server_man_pages-1.patchPrepare Inetutils for compilation:./configure --prefix=/usr --libexecdir=/usr/sbin \ --sysconfdir=/etc --localstatedir=/var \ --disable-logger --disable-syslogd \ --disable-whois --disable-serversThe meaning of the configure options:--disable-logger This option prevents Inetutils from installing the logger program, which is used by scripts to pass messages to the System Log Daemon. Do not install it because Util-linux installs a better version later.--disable-syslogd This option prevents Inetutils from installing the System Log Daemon, which is installed with the Sysklogd package.--disable-whois This option disables the building of the Inetutils whois client, which is out of date. Instructions for a better whois client are in the BLFS book.--disable-servers This disables the installation of the various network servers included as part of the Inetutils package. These servers are deemed not appropriate in a basic LFS system. Some are insecure by nature and are only considered safe on trusted networks. More information can be found at http://www.linuxfromscratch.org/blfs/view/svn/basicnet/inetutils.html. Note that better replacements areavailable for many of these servers.Compile the package:makeInstall the package:make installMove the ping program to its FHS-compliant place:mv -v /usr/bin/ping /bin6.31.2. Contents of InetutilsInstalled programs: ftp, ping, rcp, rlogin, rsh, talk, telnet, and tftpShort Descriptionsftp Is the file transfer protocol programping Sends echo-request packets and reports how long the replies takercp Performs remote file copyrlogin Performs remote loginrsh Runs a remote shelltalk Is used to chat with another usertelnet An interface to the TELNET protocoltftp A trivial file transfer program6.32. IPRoute2-2.6.11-050330The IPRoute2 package contains programs for basic and advanced IPV4-based networking.Approximate build time: 0.1 SBURequired disk space: 4.3 MBInstallation depends on: GCC, Glibc, Make, Linux-Headers, and Sed6.32.1. Installation of IPRoute2The arpd binary included in this package is dependent on Berkeley DB. Because arpd is not a very common requirement on a base Linux system, remove the dependency on Berkeley DB by applying the sed command below. If the arpd binary is needed, instructions for compiling Berkeley DB can be found in the BLFS Book at http://www.linuxfromscratch.org/blfs/view/svn/server/databases.html#db.sed -i '/^TARGETS/s@arpd@@g' misc/MakefilePrepare IPRoute2 for compilation:./configure Compile the package:make SBINDIR=/sbinThe meaning of the make option:SBINDIR=/sbin This ensures that the IPRoute2 binaries will install into /sbin. This is the correct location according to the FHS, because some of the IPRoute2 binaries are used by the LFS-Bootscripts package.Install the package:make SBINDIR=/sbin install6.32.2. Contents of IPRoute2Installed programs: ctstat (link to lnstat), ifcfg, ifstat, ip, lnstat, nstat, routef, routel, rtacct, rtmon, rtpr, rtstat (link to lnstat), ss, and tc.Short Descriptionsctstat Connection status utilityifcfg A shell script wrapper for the ip commandifstat Shows the interface statistics, including the amount of transmitted and received packets by interfaceip The main executable. It has several different functions:ip link [device] allows users to look at the state of devices and to make changesip addr allows users to look at addresses and their properties, add new addresses, and delete old onesip neighbor allows users to look at neighbor bindings and their properties, add new neighbor entries, and delete old onesip rule allows users to look at the routing policies and change themip route allows users to look at the routing table and change routing table rulesip tunnel allows users to look at the IP tunnels and their properties, and change themip maddr allows users to look at the multicast addresses and their properties, and change themip mroute allows users to set, change, or delete the multicast routingip monitor allows users to continously monitor the state of devices, addresses and routeslnstat Provides Linux network statistics. It is a generalized and more feature-complete replacement for the old rtstat programnstat Shows network statisticsroutef A component of ip route. This is for flushing the routing tablesroutel A component of ip route. This is for listing the routing tablesrtacct Displays the contents of /proc/net/rt_acctrtmon Route monitoring utilityrtpr Converts the output of ip -o back into a readable formrtstat Route status utilityss Similar to the netstat command; shows active connectionstc Traffic Controlling Executable; this is for Quality Of Service (QOS) and Class Of Service (COS) implementationstc qdisc allows users to setup the queueing disciplinetc class allows users to setup classes based on the queuing discipline schedulingtc estimator allows users to estimate the network flow into a networktc filter allows users to setup the QOS/COS packet filteringtc policy allows users to setup the QOS/COS policies6.33. Perl-5.8.7The Perl package contains the Practical Extraction and Report Language.Approximate build time: 4.1 SBURequired disk space: 140 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, and Sed6.33.1. Installation of PerlTo have full control over the way Perl is set up, run the interactive Configure script and hand-pick the way this package is built. If the defaults it auto-detects are suitable, prepare Perl for compilation with:./configure.gnu --prefix=/usr -Dpager="/bin/less -isR"The meaning of the configure options:-Dpager="/bin/less -isR" This corrects an error in the way that perldoc invokes the less program.Compile the package:makeTo run the test suite, first create a basic /etc/hosts file which is needed by a couple of the tests to resolve the network name localhost:echo "127.0.0.1 localhost $(hostname)" > /etc/hostsNow run the tests, if desired:make testInstall the package:make install6.33.2. Contents of PerlInstalled programs: a2p, c2ph, dprofpp, enc2xs, find2perl, h2ph, h2xs, libnetcfg, perl, perl5.8.7 (link to perl), perlbug, perlcc, perldoc, perlivp, piconv, pl2pm, pod2html, pod2latex, pod2man, pod2text, pod2usage, podchecker, podselect, psed (link to s2p), pstruct (link to c2ph), s2p, splain, and xsubppInstalled libraries: Several hundred which cannot all be listed hereShort Descriptionsa2p Translates awk to Perlc2ph Dumps C structures as generated from cc -g -Sdprofpp Displays Perl profile dataen2cxs Builds a Perl extension for the Encode module from either Unicode Character Mappings or Tcl Encoding Filesfind2perl Translates find commands to Perlh2ph Converts .h C header files to .ph Perl header filesh2xs Converts .h C header files to Perl extensionslibnetcfg Can be used to configure the libnetperl Combines some of the best features of C, sed, awk and sh into a single swiss-army languageperl5.8.7 A hard link to perlperlbug Used to generate bug reports about Perl, or the modules that come with it, and mail themperlcc Generates executables from Perl programsperldoc Displays a piece of documentation in pod format that is embedded in the Perl installation tree or in a Perl scriptperlivp The Perl Installation Verification Procedure; it can be used to verify that Perl and its libraries have been installed correctlypiconv A Perl version of the character encoding converter iconvpl2pm A rough tool for converting Perl4 .pl files to Perl5 .pm modulespod2html Converts files from pod format to HTML formatpod2latex Converts files from pod format to LaTeX formatpod2man Converts pod data to formatted *roff inputpod2text Converts pod data to formatted ASCII textpod2usage Prints usage messages from embedded pod docs in filespodchecker Checks the syntax of pod format documentation filespodselect Displays selected sections of pod documentationpsed A Perl version of the stream editor sedpstruct Dumps C structures as generated from cc -g -S stabss2p Translates sed scripts to Perlsplain Is used to force verbose warning diagnostics in Perlxsubpp Converts Perl XS code into C code6.34. Texinfo-4.8The Texinfo package contains programs for reading, writing, and converting info pages.Approximate build time: 0.2 SBURequired disk space: 14.7 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Ncurses, and Sed6.34.1. Installation of TexinfoTexinfo allows local users to overwrite arbitrary files via a symlink attack on temporary files. Apply the following patch to fix this:patch -Np1 -i ../texinfo-4.8-tempfile_fix-1.patchPrepare Texinfo for compilation:./configure --prefix=/usrCompile the package:makeTo test the results, issue: make check.Install the package:make installOptionally, install the components belonging in a TeX installation:make TEXMF=/usr/share/texmf install-texThe meaning of the make parameter:TEXMF=/usr/share/texmf The TEXMF makefile variable holds the location of the root of the TeX tree if, for example, a TeX package will be installed later.The Info documentation system uses a plain text file to hold its list of menu entries. The file is located at /usr/share/info/dir. Unfortunately, due to occasional problems in the Makefiles of various packages, it can sometimes get out of sync with the info pages installed on the system. If the /usr/share/info/dir file ever needs to be recreated, the following optional commands willaccomplish the task:cd /usr/share/inform dirfor f in *do install-info $f dir 2>/dev/nulldone6.34.2. Contents of TexinfoInstalled programs: info, infokey, install-info, makeinfo, texi2dvi, texi2pdf, and texindexShort Descriptionsinfo Used to read info pages which are similar to man pages, but often go much deeper than just explaining all the available command line options. For example, compare man bison and info bison.infokey Compiles a source file containing Info customizations into a binary formatinstall-info Used to install info pages; it updates entries in the info index filemakeinfo Translates the given Texinfo source documents into info pages, plain text, or HTMLtexi2dvi Used to format the given Texinfo document into a device-independent file that can be printedtexi2pdf Used to format the given Texinfo document into a Portable Document Format (PDF) filetexindex Used to sort Texinfo index files6.35. Autoconf-2.59The Autoconf package contains programs for producing shell scripts that can automatically configure source code.Approximate build time: 0.5 SBURequired disk space: 8.5 MBInstallation depends on: Bash, Coreutils, Diffutils, Grep, M4, Make, Perl, and Sed6.35.1. Installation of AutoconfPrepare Autoconf for compilation:./configure --prefix=/usrCompile the package:makeTo test the results, issue: make check. This takes a long time, about 2 SBUs.Install the package:make install6.35.2. Contents of AutoconfInstalled programs: autoconf, autoheader, autom4te, autoreconf, autoscan, autoupdate, and ifnamesShort Descriptionsautoconf Produces shell scripts that automatically configure software source code packages to adapt to many kinds of Unix-like systems. The configuration scripts it produces are independent—running them does not require the autoconf program.autoheader A tool for creating template files of C #define statements for configure to useautom4te A wrapper for the M4 macro processorautoreconf Automatically runs autoconf, autoheader, aclocal, automake, gettextize, and libtoolize in the correct order to save time when changes are made to autoconf and automake template filesautoscan Helps to create a configure.in file for a software package; it examines the source files in a directory tree, searching them for common portability issues, and creates a configure.scan file that serves as as a preliminary configure.in file for the packageautoupdate Modifies a configure.in file that still calls autoconf macros by their old names to use the current macro namesifnames Helps when writing configure.in files for a software package; it prints the identifiers that the package uses in C preprocessor conditionals. If a package has already been set up to have some portability, this program can help determine what configure needs to check for. It can also fill in gaps in a configure.in file generated by autoscan6.36. Automake-1.9.5The Automake package contains programs for generating Makefiles for use with Autoconf.Approximate build time: 0.2 SBURequired disk space: 8.8 MBInstallation depends on: Autoconf, Bash, Coreutils, Diffutils, Grep, M4, Make, Perl, and Sed6.36.1. Installation of AutomakePrepare Automake for compilation:./configure --prefix=/usrCompile the package:makeTo test the results, issue: make check. This takes a long time, about 5 SBUs.Install the package:make install6.36.2. Contents of AutomakeInstalled programs: acinstall, aclocal, aclocal-1.9.5, automake, automake-1.9.5, compile, config.guess, config.sub, depcomp, elisp-comp, install-sh, mdate-sh, missing, mkinstalldirs, py-compile, symlink-tree, and ylwrapShort Descriptionsacinstall A script that installs aclocal-style M4 filesaclocal Generates aclocal.m4 files based on the contents of configure.in filesaclocal-1.9.5 A hard link to aclocalautomake A tool for automatically generating Makefile.in files from Makefile.am files. To create all the Makefile.in files for a package, run this program in the top-level directory. By scanning the configure.in file, it automatically finds each appropriate Makefile.am file and generates the corresponding Makefile.in fileautomake-1.9.5 A hard link to automakecompile A wrapper for compilersconfig.guess A script that attempts to guess the canonical triplet for the given build, host, or target architectureconfig.sub A configuration validation subroutine scriptdepcomp A script for compiling a program so that dependency information is generated in addition to the desired outputelisp-comp Byte-compiles Emacs Lisp codeinstall-sh A script that installs a program, script, or data filemdate-sh A script that prints the modification time of a file or directorymissing A script acting as a common stub for missing GNU programs during an installationmkinstalldirs A script that creates a directory treepy-compile Compiles a Python programsymlink-tree A script to create a symlink tree of a directory treeylwrap A wrapper for lex and yacc6.37. Bash-3.0The Bash package contains the Bourne-Again SHell.Approximate build time: 1.2 SBURequired disk space: 20.6 MBInstallation depends on: Binutils, Coreutils, Diffutils, Gawk, GCC, Glibc, Grep, Make, Ncurses, and Sed.6.37.1. Installation of BashIf you downloaded the Bash documentation tarball and wish to install HTML documentation, issue the following commands:tar -xvf ../bash-doc-3.0.tar.gz &&sed -i "s|htmldir = @htmldir@|htmldir = /usr/share/doc/bash-3.0|" \ Makefile.inThe following patch fixes various issues, including a problem where Bash will sometimes only show 33 characters on a line, then wrap to the next:patch -Np1 -i ../bash-3.0-fixes-3.patchBash also has issues when compiled against newer versions of Glibc. The following patch resolves this problem:patch -Np1 -i ../bash-3.0-avoid_WCONTINUED-1.patchPrepare Bash for compilation:./configure --prefix=/usr --bindir=/bin \ --without-bash-malloc --with-installed-readlineThe meaning of the configure options:--with-installed-readline This option tells Bash to use the readline library that is already installed on the system rather than using its own readline version.Compile the package:makeTo test the results, issue: make tests.Install the package:make installRun the newly compiled bash program (replacing the one that is currently being executed):exec /bin/bash --login +hNoteThe parameters used make the bash process an interactive login shell and continue to disable hashing so that new programs are found as they become available.6.37.2. Contents of BashInstalled programs: bash, bashbug, and sh (link to bash)Short Descriptionsbash A widely-used command interpreter; it performs many types of expansions and substitutions on a given command line before executing it, thus making this interpreter a powerful toolbashbug A shell script to help the user compose and mail standard formatted bug reports concerning bashsh A symlink to the bash program; when invoked as sh, bash tries to mimic the startup behavior of historical versions of sh as closely as possible, while conforming to the POSIX standard as well6.38. File-4.13The File package contains a utility for determining the type of a given file or files.Approximate build time: 0.1 SBURequired disk space: 6.2 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Sed, and Zlib6.38.1. Installation of FilePrepare File for compilation:./configure --prefix=/usrCompile the package:makeInstall the package:make install6.38.2. Contents of FileInstalled programs: fileInstalled library: libmagic.[a,so]Short Descriptionsfile Tries to classify each given file; it does this by performing several tests—file system tests, magic number tests, and language testslibmagic Contains routines for magic number recognition, used by the file program6.39. Libtool-1.5.14The Libtool package contains the GNU generic library support script. It wraps the complexity of using shared libraries in a consistent, portable interface.Approximate build time: 1.5 SBURequired disk space: 19.7 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, and Sed6.39.1. Installation of LibtoolPrepare Libtool for compilation:./configure --prefix=/usrCompile the package:makeTo test the results, issue: make check.Install the package:make install6.39.2. Contents of LibtoolInstalled programs: libtool and libtoolizeInstalled libraries: libltdl.[a,so]Short Descriptionslibtool Provides generalized library-building support serviceslibtoolize Provides a standard way to add libtool support to a packagelibltdl Hides the various difficulties of dlopening libraries6.40. Bzip2-1.0.3The Bzip2 package contains programs for compressing and decompressing files. Compressing text files with bzip2 yields a much better compression percentage than with the traditional gzip.Approximate build time: 0.1 SBURequired disk space: 3.9 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, and Make6.40.1. Installation of Bzip2Apply a patch to install the documentation for this package:patch -Np1 -i ../bzip2-1.0.3-install_docs-1.patchThe bzgrep command does not escape '|' and '&' in filenames passed to it. This allows arbitrary commands to be executed with the privileges of the user running bzgrep. Apply the following to address this:patch -Np1 -i ../bzip2-1.0.3-bzgrep_security-1.patchPrepare Bzip2 for compilation with:make -f Makefile-libbz2_somake cleanThe -f flag will cause Bzip2 to be built using a different Makefile file, in this case the Makefile-libbz2_so file, which creates a dynamic libbz2.so library and links the Bzip2 utilities against it.Compile and test the package:makeIf reinstalling Bzip2, perform rm -vf /usr/bin/bz* first, otherwise the following make install will fail.Install the programs:make installInstall the shared bzip2 binary into the /bin directory, make some necessary symbolic links, and clean up:cp -v bzip2-shared /bin/bzip2cp -av libbz2.so* /libln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.sorm -v /usr/bin/{bunzip2,bzcat,bzip2}ln -sv bzip2 /bin/bunzip2ln -sv bzip2 /bin/bzcat6.40.2. Contents of Bzip2Installed programs: bunzip2 (link to bzip2), bzcat (link to bzip2), bzcmp, bzdiff, bzegrep, bzfgrep, bzgrep, bzip2, bzip2recover, bzless, and bzmoreInstalled libraries: libbz2.[a,so]Short Descriptionsbunzip2 Decompresses bzipped filesbzcat Decompresses to standard outputbzcmp Runs cmp on bzipped filesbzdiff Runs diff on bzipped filesbzgrep Runs grep on bzipped filesbzegrep Runs egrep on bzipped filesbzfgrep Runs fgrep on bzipped filesbzip2 Compresses files using the Burrows-Wheeler block sorting text compression algorithm with Huffman coding; the compression rate is better than that achieved by more conventional compressors using “Lempel-Ziv” algorithms, like gzipbzip2recover Tries to recover data from damaged bzipped filesbzless Runs less on bzipped filesbzmore Runs more on bzipped fileslibbz2* The library implementing lossless, block-sorting data compression, using the Burrows-Wheeler algorithm6.41. Diffutils-2.8.1The Diffutils package contains programs that show the differences between files or directories.Approximate build time: 0.1 SBURequired disk space: 5.6 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, and Sed6.41.1. Installation of DiffutilsPrepare Diffutils for compilation:./configure --prefix=/usrCompile the package:makeThis package does not come with a test suite.Install the package:make install6.41.2. Contents of DiffutilsInstalled programs: cmp, diff, diff3, and sdiffShort Descriptionscmp Compares two files and reports whether or in which bytes they differdiff Compares two files or directories and reports which lines in the files differdiff3 Compares three files line by linesdiff Merges two files and interactively outputs the results6.42. Kbd-1.12The Kbd package contains key-table files and keyboard utilities.Approximate build time: 0.1 SBURequired disk space: 11.8 MBInstallation depends on: Bash, Binutils, Bison, Coreutils, Diffutils, Flex, GCC, Gettext, Glibc, Grep, Gzip, M4, Make, and Sed6.42.1. Installation of KbdPrepare Kbd for compilation:./configureCompile the package:makeInstall the package:make install6.42.2. Contents of KbdInstalled programs: chvt, deallocvt, dumpkeys, fgconsole, getkeycodes, getunimap, kbd_mode, kbdrate, loadkeys, loadunimap, mapscrn, openvt, psfaddtable (link to psfxtable), psfgettable (link to psfxtable), psfstriptable (link to psfxtable), psfxtable, resizecons, setfont, setkeycodes, setleds, setlogcons, setmetamode, setvesablank, showconsolefont, showkey, unicode_start, andunicode_stopShort Descriptionschvt Changes the foreground virtual terminaldeallocvt Deallocates unused virtual terminalsdumpkeys Dumps the keyboard translation tablesfgconsole Prints the number of the active virtual terminalgetkeycodes Prints the kernel scancode-to-keycode mapping tablegetunimap Prints the currently used unicode-to-font mapping tablekbd_mode Reports or sets the keyboard modekbdrate Sets the keyboard repeat and delay ratesloadkeys Loads the keyboard translation tablesloadunimap Loads the kernel unicode-to-font mapping tablemapscrn An obsolete program that used to load a user-defined output character mapping table into the console driver; this is now done by setfontopenvt Starts a program on a new virtual terminal (VT)psfaddtable A link to psfxtablepsfgettable A link to psfxtablepsfstriptable A link to psfxtablepsfxtable Handle Unicode character tables for console fontsresizecons Changes the kernel idea of the console sizesetfont Changes the Enhanced Graphic Adapter (EGA) and Video Graphics Array (VGA) fonts on the consolesetkeycodes Loads kernel scancode-to-keycode mapping table entries; this is useful if there are unusual keys on the keyboardsetleds Sets the keyboard flags and Light Emitting Diodes (LEDs)setlogcons Sends kernel messages to the consolesetmetamode Defines the keyboard meta-key handlingsetvesablank Lets the user adjust the built-in hardware screensaver (a blank screen)showconsolefont Shows the current EGA/VGA console screen fontshowkey Reports the scancodes, keycodes, and ASCII codes of the keys pressed on the keyboardunicode_start Puts the keyboard and console in UNICODE mode. Never use it on LFS, because applications are not configured to support UNICODE.unicode_stop Reverts keyboard and console from UNICODE mode6.43. E2fsprogs-1.37The E2fsprogs package contains the utilities for handling the ext2 file system. It also supports the ext3 journaling file system.Approximate build time: 0.6 SBURequired disk space: 40.0 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, Gawk, GCC, Gettext, Glibc, Grep, Make, Sed, and Texinfo6.43.1. Installation of E2fsprogsFix a compilation error in E2fsprogs' testsuite:sed -i -e 's/-DTEST/$(ALL_CFLAGS) &/' lib/e2p/Makefile.inIt is recommended that E2fsprogs be built in a subdirectory of the source tree:mkdir -v buildcd buildPrepare E2fsprogs for compilation:../configure --prefix=/usr --with-root-prefix="" \ --enable-elf-shlibs --disable-evmsThe meaning of the configure options:--with-root-prefix="" Certain programs (such as the e2fsck program) are considered essential programs. When, for example, /usr is not mounted, these programs still need to be available. They belong in directories like /lib and /sbin. If this option is not passed to E2fsprogs' configure, the programs are installed into the /usr directory.--enable-elf-shlibs This creates the shared libraries which some programs in this package use.--disable-evms This disables the building of the Enterprise Volume Management System (EVMS) plugin. This plugin is not up-to-date with the latest EVMS internal interfaces and EVMS is not installed as part of a base LFS system, so the plugin is not required. See the EVMS website at http://evms.sourceforge.net/ for more information regarding EVMS.Compile the package:makeTo test the results, issue: make check.Install the binaries and documentation:make installInstall the shared libraries:make install-libs6.43.2. Contents of E2fsprogsInstalled programs: badblocks, blkid, chattr, compile_et, debugfs, dumpe2fs, e2fsck, e2image, e2label, findfs, fsck, fsck.ext2, fsck.ext3, logsave, lsattr, mk_cmds, mke2fs, mkfs.ext2, mkfs.ext3, mklost+found, resize2fs, tune2fs, and uuidgen.Installed libraries: libblkid.[a,so], libcom_err.[a,so], libe2p.[a,so], libext2fs.[a,so], libss.[a,so], and libuuid.[a,so]Short Descriptionsbadblocks Searches a device (usually a disk partition) for bad blocksblkid A command line utility to locate and print block device attributeschattr Changes the attributes of files on an ext2 file system; it also changes ext3 file systems, the journaling version of ext2 file systemscompile_et An error table compiler; it converts a table of error-code names and messages into a C source file suitable for use with the com_err librarydebugfs A file system debugger; it can be used to examine and change the state of an ext2 file systemdumpe2fs Prints the super block and blocks group information for the file system present on a given devicee2fsck Is used to check, and optionally repair ext2 file systems and ext3 file systemse2image Is used to save critical ext2 file system data to a filee2label Displays or changes the file system label on the ext2 file system present on a given devicefindfs Finds a file system by label or Universally Unique Identifier (UUID)fsck Is used to check, and optionally repair, file systemsfsck.ext2 By default checks ext2 file systemsfsck.ext3 By default checks ext3 file systemslogsave Saves the output of a command in a log filelsattr Lists the attributes of files on a second extended file systemmk_cmds Converts a table of command names and help messages into a C source file suitable for use with the libss subsystem librarymke2fs Creates an ext2 or ext3 file system on the given devicemkfs.ext2 By default creates ext2 file systemsmkfs.ext3 By default creates ext3 file systemsmklost+found Used to create a lost+found directory on an ext2 file system; it pre-allocates disk blocks to this directory to lighten the task of e2fsckresize2fs Can be used to enlarge or shrink an ext2 file systemtune2fs Adjusts tunable file system parameters on an ext2 file systemuuidgen Creates new UUIDs. Each new UUID can reasonably be considered unique among all UUIDs created, on the local system and on other systems, in the past and in the futurelibblkid Contains routines for device identification and token extractionlibcom_err The common error display routinelibe2p Used by dumpe2fs, chattr, and lsattrlibext2fs Contains routines to enable user-level programs to manipulate an ext2 file systemlibss Used by debugfslibuuid Contains routines for generating unique identifiers for objects that may be accessible beyond the local system6.44. Grep-2.5.1aThe Grep package contains programs for searching through files.Approximate build time: 0.1 SBURequired disk space: 4.5 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Make, Sed, and Texinfo6.44.1. Installation of GrepPrepare Grep for compilation:./configure --prefix=/usr --bindir=/binCompile the package:makeTo test the results, issue: make check.Install the package:make install6.44.2. Contents of GrepInstalled programs: egrep (link to grep), fgrep (link to grep), and grepShort Descriptionsegrep Prints lines matching an extended regular expressionfgrep Prints lines matching a list of fixed stringsgrep Prints lines matching a basic regular expression6.45. GRUB-0.96The GRUB package contains the GRand Unified Bootloader.Approximate build time: 0.2 SBURequired disk space: 10.0 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, Ncurses, and Sed6.45.1. Installation of GRUBThis package is known to have issues when its default optimization flags (including the -march and -mcpu options) are changed. If any environment variables that override default optimizations have been defined, such as CFLAGS and CXXFLAGS, unset them when building GRUB.Prepare GRUB for compilation:./configure --prefix=/usrCompile the package:makeTo test the results, issue: make check.Note that the test results will always show the error “ufs2_stage1_5 is too big.” This is due to a compiler issue, but can be ignored unless you plan to boot from an UFS partition. The partitions are normally only used by Sun workstations.Install the package:make installmkdir -v /boot/grubcp -v /usr/lib/grub/i386-pc/stage{1,2} /boot/grubReplace i386-pc with whatever directory is appropriate for the hardware in use.The i386-pc directory contains a number of *stage1_5 files, different ones for different file systems. Review the files available and copy the appropriate ones to the /boot/grub directory. Most users will copy the e2fs_stage1_5 and/or reiserfs_stage1_5 files.6.45.2. Contents of GRUBInstalled programs: grub, grub-install, grub-md5-crypt, grub-terminfo, and mbchkShort Descriptionsgrub The Grand Unified Bootloader's command shellgrub-install Installs GRUB on the given devicegrub-md5-crypt Encrypts a password in MD5 formatgrub-terminfo Generates a terminfo command from a terminfo name; it can be employed if an unknown terminal is being usedmbchk Checks the format of a multi-boot kernel6.46. Gzip-1.3.5The Gzip package contains programs for compressing and decompressing files.Approximate build time: 0.1 SBURequired disk space: 2.2 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, and Sed6.46.1. Installation of GzipGzip has 2 known security vulnerabilities. The following patch addresses both of them:patch -Np1 -i ../gzip-1.3.5-security_fixes-1.patchPrepare Gzip for compilation:./configure --prefix=/usrThe gzexe script has the location of the gzip binary hard-wired into it. Because the location of the binary is changed later, the following command ensures that the new location gets placed into the script:sed -i 's@"BINDIR"@/bin@g' gzexe.inCompile the package:makeInstall the package:make installMove the gzip program to the /bin directory and create some commonly used symlinks to it:mv -v /usr/bin/gzip /binrm -v /usr/bin/{gunzip,zcat}ln -sv gzip /bin/gunzipln -sv gzip /bin/zcatln -sv gzip /bin/compressln -sv gunzip /bin/uncompress6.46.2. Contents of GzipInstalled programs: compress (link to gzip), gunzip (link to gzip), gzexe, gzip, uncompress (link to gunzip), zcat (link to gzip), zcmp, zdiff, zegrep, zfgrep, zforce, zgrep, zless, zmore, and znewShort Descriptionscompress Compresses and decompresses filesgunzip Decompresses gzipped filesgzexe Creates self-decompressing executable filesgzip Compresses the given files using Lempel-Ziv (LZ77) codinguncompress Decompresses compressed fileszcat Decompresses the given gzipped files to standard outputzcmp Runs cmp on gzipped fileszdiff Runs diff on gzipped fileszegrep Runs egrep on gzipped fileszfgrep Runs fgrep on gzipped fileszforce Forces a .gz extension on all given files that are gzipped files, so that gzip will not compress them again; this can be useful when file names were truncated during a file transferzgrep Runs grep on gzipped fileszless Runs less on gzipped fileszmore Runs more on gzipped filesznew Re-compresses files from compress format to gzip format—.Z to .gz6.47. Hotplug-2004_09_23The Hotplug package contains scripts that react upon hotplug events generated by the kernel. Such events correspond to every change in the kernel state visible in the sysfs filesystem, e.g., the addition and removal of hardware. This package also detects existing hardware during boot and inserts the relevant modules into the running kernel.Approximate build time: 0.01 SBURequired disk space: 460 KBInstallation depends on: Bash, Coreutils, Find, Gawk, and Make6.47.1. Installation of HotplugInstall the Hotplug package:make installCopy a file that the “install” target omits.cp -v etc/hotplug/pnp.distmap /etc/hotplugRemove the init script that Hotplug installs since we are going to be using the script included in the LFS-Bootscripts package:rm -rfv /etc/init.dNetwork device hotplugging is not yet supported by the LFS-Bootscripts package. For that reason, remove the network hotplug agent:rm -fv /etc/hotplug/net.agentCreate a directory for storing firmware that can be loaded by hotplug:mkdir -v /lib/firmware6.47.2. Contents of HotplugInstalled program: hotplugInstalled scripts: /etc/hotplug/*.rc, /etc/hotplug/*.agentInstalled files: /etc/hotplug/hotplug.functions, /etc/hotplug/blacklist, /etc/hotplug/{pci,usb}, /etc/hotplug/usb.usermap, /etc/hotplug.d, and /var/log/hotplug/eventsShort Descriptionshotplug This script is called by default by the Linux kernel when something changes in its internal state (e.g., a new device is added or an existing device is removed)/etc/hotplug/*.rc These scripts are used for cold plugging, i.e., detecting and acting upon hardware already present during system startup. They are called by the hotplug initscript included in the LFS-Bootscripts package. The *.rc scripts try to recover hotplug events that were lost during system boot because, for example, the root filesystem was not mounted by the kernel/etc/hotplug/*.agent These scripts are called by hotplug in response to different types of hotplug events generated by the kernel. Their action is to insert corresponding kernel modules and call any user-provided scripts/etc/hotplug/blacklist This file contains the list of modules that should never be inserted into the kernel by the Hotplug scripts/etc/hotplug/hotplug.functions This file contains common functions used by other scripts in the Hotplug package/etc/hotplug/{pci,usb} These directories contain user-written handlers for hotplug events/etc/hotplug/usb.usermap This file contains rules that determine which user-defined handlers to call for each USB device, based on its vendor ID and other attributes/etc/hotplug.d This directory contains programs (or symlinks to them) that are interested in receiving hotplug events. For example, Udev puts its symlink here during installation/lib/firmware This directory contains the firmware for devices that need to have their firmware loaded before use/var/log/hotplug/events This file contains all the events that hotplug has called since bootup6.48. Man-1.5pThe Man package contains programs for finding and viewing man pages.Approximate build time: 0.1 SBURequired disk space: 2.9 MBInstallation depends on: Bash, Binutils, Coreutils, Gawk, GCC, Glibc, Grep, Make, and Sed6.48.1. Installation of ManTwo adjustments need to be made to the sources of Man.The first is a sed substitution to add the -R switch to the PAGER variable so that escape sequences are properly handled by Less:sed -i 's@-is@&R@g' configureThe second is also a sed substitution to comment out the “MANPATH /usr/man” line in the man.conf file to prevent redundant results when using programs such as whatis:sed -i 's@MANPATH./usr/man@#&@g' src/man.conf.inPrepare Man for compilation:./configure -confdir=/etcThe meaning of the configure options:-confdir=/etc This tells the man program to look for the man.conf configuration file in the /etc directory.Compile the package:makeInstall the package:make installNoteIf you will be working on a terminal that does not support text attributes such as color and bold, you can disable Select Graphic Rendition (SGR) escape sequences by editing the man.conf file and adding the -c option to the NROFF variable. If you use multiple terminal types for one computer it may be better to selectively add the GROFF_NO_SGR environment variable for the terminals thatdo not support SGR.If the character set of the locale uses 8-bit characters, search for the line beginning with “NROFF” in /etc/man.conf, and verify that it matches the following: NROFF /usr/bin/nroff -Tlatin1 -mandocNote that “latin1” should be used even if it is not the character set of the locale. The reason is that, according to the specification, groff has no means of typesetting characters outside International Organization for Standards (ISO) 8859-1 without some strange escape codes. When formatting man pages, groff thinks that they are in the ISO 8859-1 encoding and this -Tlatin1 switchtells groff to use the same encoding for output. Since groff does no recoding of input characters, the formatted result is really in the same encoding as input, and therefore it is usable as the input for a pager.This does not solve the problem of a non-working man2dvi program for localized man pages in non-ISO 8859-1 locales. Also, it does not work with multibyte character sets. The first problem does not currently have a solution. The second issue is not of concern because the LFS installation does not support multibyte character sets.Additional information with regards to the compression of man and info pages can be found in the BLFS book at http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/compressdoc.html.6.48.2. Contents of ManInstalled programs: apropos, makewhatis, man, man2dvi, man2html, and whatisShort Descriptionsapropos Searches the whatis database and displays the short descriptions of system commands that contain a given stringmakewhatis Builds the whatis database; it reads all the man pages in the MANPATH and writes the name and a short description in the whatis database for each pageman Formats and displays the requested on-line man pageman2dvi Converts a man page into dvi formatman2html Converts a man page into HTMLwhatis Searches the whatis database and displays the short descriptions of system commands that contain the given keyword as a separate word6.49. Make-3.80The Make package contains a program for compiling packages.Approximate build time: 0.2 SBURequired disk space: 7.1 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, and Sed6.49.1. Installation of MakePrepare Make for compilation:./configure --prefix=/usrCompile the package:makeTo test the results, issue: make check.Install the package:make install6.49.2. Contents of MakeInstalled program: makeShort Descriptionsmake Automatically determines which pieces of a package need to be (re)compiled and then issues the relevant commands6.50. Module-Init-Tools-3.1The Module-Init-Tools package contains programs for handling kernel modules in Linux kernels greater than or equal to version 2.5.47.Approximate build time: 0.1 SBURequired disk space: 4.9 MBInstallation depends on: Bash, Binutils, Bison, Coreutils, Diffutils, Flex, GCC, Glibc, Grep, M4, Make, and Sed6.50.1. Installation of Module-Init-ToolsModule-Init-Tools attempts to rewrite its modprobe.conf man page during the build process. This is unnecessary and also relies on docbook2man — which is not installed in LFS. Run the following command to avoid this:touch modprobe.conf.5If you wish to run the test suite for Module-Init-Tools, you will need to download the separate testsuite tarball. Issue the following commands to perform the tests (note that the make distclean command is required to clean up the source tree, as the source gets recompiled as part of the testing process):tar -xvf ../module-init-tools-testsuite-3.1.tar.bz2 --strip-path=1 &&./configure &&make check &&make distcleanPrepare Module-Init-Tools for compilation:./configure --prefix="" --enable-zlibThe meaning of the configure options:--enable-zlib This allows the Module-Init-Tools package to handle compressed kernel modules.Compile the package:makeInstall the package:make install6.50.2. Contents of Module-Init-ToolsInstalled programs: depmod, insmod, insmod.static, lsmod (link to insmod), modinfo, modprobe (link to insmod), and rmmod (link to insmod)Short Descriptionsdepmod Creates a dependency file based on the symbols it finds in the existing set of modules; this dependency file is used by modprobe to automatically load the required modulesinsmod Installs a loadable module in the running kernelinsmod.static A statically compiled version of insmodlsmod Lists currently loaded modulesmodinfo Examines an object file associated with a kernel module and displays any information that it can gleanmodprobe Uses a dependency file, created by depmod, to automatically load relevant modulesrmmod Unloads modules from the running kernel6.51. Patch-2.5.4The Patch package contains a program for modifying or creating files by applying a “patch” file typically created by the diff program.Approximate build time: 0.1 SBURequired disk space: 1.5 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Glibc, Grep, Make, and Sed6.51.1. Installation of PatchPrepare Patch for compilation. The preprocessor flag -D_GNU_SOURCE is only needed on the PowerPC platform. It can be left it out on other architectures:CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/usrCompile the package:makeThis package does not come with a test suite.Install the package:make install6.51.2. Contents of PatchInstalled program: patchShort Descriptionspatch Modifies files according to a patch file. A patch file is normally a difference listing created with the diff program. By applying these differences to the original files, patch creates the patched versions.6.52. Procps-3.2.5The Procps package contains programs for monitoring processes.Approximate build time: 0.1 SBURequired disk space: 2.3 MBInstallation depends on: Bash, Binutils, Coreutils, GCC, Glibc, Make, and Ncurses6.52.1. Installation of ProcpsCompile the package:makeInstall the package:make install6.52.2. Contents of ProcpsInstalled programs: free, kill, pgrep, pkill, pmap, ps, skill, snice, sysctl, tload, top, uptime, vmstat, w, and watchInstalled library: libproc.soShort Descriptionsfree Reports the amount of free and used memory (both physical and swap memory) in the systemkill Sends signals to processespgrep Looks up processes based on their name and other attributespkill Signals processes based on their name and other attributespmap Reports the memory map of the given processps Lists the current running processesskill Sends signals to processes matching the given criteriasnice Changes the scheduling priority of processes matching the given criteriasysctl Modifies kernel parameters at run timetload Prints a graph of the current system load averagetop Displays a list of the most CPU intensive processes; it provides an ongoing look at processor activity in real timeuptime Reports how long the system has been running, how many users are logged on, and the system load averagesvmstat Reports virtual memory statistics, giving information about processes, memory, paging, block Input/Output (IO), traps, and CPU activityw Shows which users are currently logged on, where, and since whenwatch Runs a given command repeatedly, displaying the first screen-full of its output; this allows a user to watch the output change over timelibproc Contains the functions used by most programs in this package6.53. Psmisc-21.6The Psmisc package contains programs for displaying information about running processes.Approximate build time: 0.1 SBURequired disk space: 1.7 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Ncurses, and Sed6.53.1. Installation of PsmiscPrepare Psmisc for compilation:./configure --prefix=/usr --exec-prefix=""The meaning of the configure options:--exec-prefix="" This ensures that the Psmisc binaries will install into /bin instead of /usr/bin. This is the correct location according to the FHS, because some of the Psmisc binaries are used by the LFS-Bootscripts package.Compile the package:makeInstall the package:make installThere is no reason for the pstree and pstree.x11 programs to reside in /bin. Therefore, move them to /usr/bin:mv -v /bin/pstree* /usr/binBy default, Psmisc's pidof program is not installed. This usually is not a problem because it is installed later in the Sysvinit package, which provides a better pidof program. If Sysvinit will not be used for a particular system, complete the installation of Psmisc by creating the following symlink:ln -sv killall /bin/pidof6.53.2. Contents of PsmiscInstalled programs: fuser, killall, pstree, and pstree.x11 (link to pstree)Short Descriptionsfuser Reports the Process IDs (PIDs) of processes that use the given files or file systemskillall Kills processes by name; it sends a signal to all processes running any of the given commandspstree Displays running processes as a treepstree.x11 Same as pstree, except that it waits for confirmation before exiting6.54. Shadow-4.0.9The Shadow package contains programs for handling passwords in a secure way.Approximate build time: 0.4 SBURequired disk space: 13.7 MBInstallation depends on: Bash, Binutils, Bison, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, and Sed6.54.1. Installation of ShadowNoteIf you would like to enforce the use of strong passwords, refer to http://www.linuxfromscratch.org/blfs/view/svn/postlfs/cracklib.html for installing Cracklib prior to building Shadow. Then add --with-libcrack to the configure command below.Prepare Shadow for compilation:./configure --libdir=/lib --enable-sharedDisable the installation of the groups program and its man page, as Coreutils provides a better version:sed -i 's/groups$(EXEEXT) //' src/Makefilesed -i '/groups/d' man/MakefileCompile the package:makeInstall the package:make installShadow uses two files to configure authentication settings for the system. Install these two configuration files:cp -v etc/{limits,login.access} /etcInstead of using the default crypt method, use the more secure MD5 method of password encryption, which also allows passwords longer than 8 characters. It is also necessary to change the obsolete /var/spool/mail location for user mailboxes that Shadow uses by default to the /var/mail location used currently. Both of these can be accomplished by changing the relevant configuration filewhile copying it to its destination:NoteIf you built Shadow with Cracklib support, insert the following into the sed given below:-e 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@'sed -e's@#MD5_CRYPT_ENAB.no@MD5_CRYPT_ENAB yes@' \ -e 's@/var/spool/mail@/var/mail@' \ etc/login.defs.linux > /etc/login.defsMove a misplaced program to its proper location:mv -v /usr/bin/passwd /binMove Shadow's libraries to more appropriate locations:mv -v /lib/libshadow.*a /usr/librm -v /lib/libshadow.soln -sfv ../../lib/libshadow.so.0 /usr/lib/libshadow.soThe -D option of the useradd program requires the /etc/default directory for it to work properly:mkdir -v /etc/default6.54.2. Configuring ShadowThis package contains utilities to add, modify, and delete users and groups; set and change their passwords; and perform other administrative tasks. For a full explanation of what password shadowing means, see the doc/HOWTO file within the unpacked source tree. If using Shadow support, keep in mind that programs which need to verify passwords (display managers, FTP programs, pop3daemons, etc.) must be Shadow-compliant. That is, they need to be able to work with shadowed passwords.To enable shadowed passwords, run the following command:pwconvTo enable shadowed group passwords, run:grpconvUnder normal circumstances, passwords will not have been created yet. However, if returning to this section later to enable shadowing, reset any current user passwords with the passwd command or any group passwords with the gpasswd command.6.54.3. Setting the root passwordChoose a password for user root and set it by running:passwd root6.54.4. Contents of ShadowInstalled programs: chage, chfn, chpasswd, chsh, expiry, faillog, gpasswd, groupadd, groupdel, groupmod, grpck, grpconv, grpunconv, lastlog, login, logoutd, mkpasswd, newgrp, newusers, passwd, pwck, pwconv, pwunconv, sg (link to newgrp), useradd, userdel, usermod, vigr (link to vipw), and vipwInstalled libraries: libshadow.[a,so]Short Descriptionschage Used to change the maximum number of days between obligatory password changeschfn Used to change a user's full name and other informationchpasswd Used to update the passwords of an entire series of user accountschsh Used to change a user's default login shellexpiry Checks and enforces the current password expiration policyfaillog Is used to examine the log of login failures, to set a maximum number of failures before an account is blocked, or to reset the failure countgpasswd Is used to add and delete members and administrators to groupsgroupadd Creates a group with the given namegroupdel Deletes the group with the given namegroupmod Is used to modify the given group's name or GIDgrpck Verifies the integrity of the group files /etc/group and /etc/gshadowgrpconv Creates or updates the shadow group file from the normal group filegrpunconv Updates /etc/group from /etc/gshadow and then deletes the latterlastlog Reports the most recent login of all users or of a given userlogin Is used by the system to let users sign onlogoutd Is a daemon used to enforce restrictions on log-on time and portsmkpasswd Generates random passwordsnewgrp Is used to change the current GID during a login sessionnewusers Is used to create or update an entire series of user accountspasswd Is used to change the password for a user or group accountpwck Verifies the integrity of the password files /etc/passwd and /etc/shadowpwconv Creates or updates the shadow password file from the normal password filepwunconv Updates /etc/passwd from /etc/shadow and then deletes the lattersg Executes a given command while the user's GID is set to that of the given groupsu Runs a shell with substitute user and group IDsuseradd Creates a new user with the given name, or updates the default new-user informationuserdel Deletes the given user accountusermod Is used to modify the given user's login name, User Identification (UID), shell, initial group, home directory, etc.vigr Edits the /etc/group or /etc/gshadow filesvipw Edits the /etc/passwd or /etc/shadow fileslibshadow Contains functions used by most programs in this package6.55. Sysklogd-1.4.1The Sysklogd package contains programs for logging system messages, such as those given by the kernel when unusual things happen.Approximate build time: 0.1 SBURequired disk space: 704 KBInstallation depends on: Binutils, Coreutils, GCC, Glibc, Make6.55.1. Installation of SysklogdThe following patch fixes various issues, including a problem building Sysklogd with Linux 2.6 series kernelspatch -Np1 -i ../sysklogd-1.4.1-fixes-1.patchCompile the package:makeInstall the package:make install6.55.2. Configuring SysklogdCreate a new /etc/syslog.conf file by running the following:cat > /etc/syslog.conf << "EOF"# Begin /etc/syslog.confauth,authpriv.* -/var/log/auth.log*.*;auth,authpriv.none -/var/log/sys.logdaemon.* -/var/log/daemon.logkern.* -/var/log/kern.logmail.* -/var/log/mail.loguser.* -/var/log/user.log*.emerg *# log the bootscript output:local2.* -/var/log/boot.log# End /etc/syslog.confEOF6.55.3. Contents of SysklogdInstalled programs: klogd and syslogdShort Descriptionsklogd A system daemon for intercepting and logging kernel messagessyslogd Logs the messages that system programs offer for logging. Every logged message contains at least a date stamp and a hostname, and normally the program's name too, but that depends on how trusting the logging daemon is told to be6.56. Sysvinit-2.86The Sysvinit package contains programs for controlling the startup, running, and shutdown of the system.Approximate build time: 0.1 SBURequired disk space: 1012 KBInstallation depends on: Binutils, Coreutils, GCC, Glibc, and Make6.56.1. Installation of SysvinitWhen run-levels are changed (for example, when halting the system), init sends termination signals to those processes that init itself started and that should not be running in the new run-level. While doing this, init outputs messages like “Sending processes the TERM signal” which seem to imply that it is sending these signals to all currently running processes. To avoid thismisinterpretation, modify the source so that these messages read like “Sending processes started by init the TERM signal” instead:sed -i 's@Sending processes@& started by init@g' \ src/init.cCompile the package:make -C srcInstall the package:make -C src install6.56.2. Configuring SysvinitCreate a new file /etc/inittab by running the following:cat > /etc/inittab << "EOF"# Begin /etc/inittabid:3:initdefault:si::sysinit:/etc/rc.d/init.d/rc sysinitl0:0:wait:/etc/rc.d/init.d/rc 0l1:S1:wait:/etc/rc.d/init.d/rc 1l2:2:wait:/etc/rc.d/init.d/rc 2l3:3:wait:/etc/rc.d/init.d/rc 3l4:4:wait:/etc/rc.d/init.d/rc 4l5:5:wait:/etc/rc.d/init.d/rc 5l6:6:wait:/etc/rc.d/init.d/rc 6ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r nowsu:S016:once:/sbin/sulogin1:2345:respawn:/sbin/agetty -I '\033(K' tty1 96002:2345:respawn:/sbin/agetty -I '\033(K' tty2 96003:2345:respawn:/sbin/agetty -I '\033(K' tty3 96004:2345:respawn:/sbin/agetty -I '\033(K' tty4 96005:2345:respawn:/sbin/agetty -I '\033(K' tty5 96006:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600# End /etc/inittabEOFThe -I '\033(K' option tells agetty to send this escape sequence to the terminal before doing anything else. This escape sequence switches the console character set to a user-defined one, which can be modified by running the setfont program. The console initscript from the LFS-Bootscripts package calls the setfont program during system startup. Sending this escape sequence is necessaryfor people who use non-ISO 8859-1 screen fonts, but it does not affect native English speakers.6.56.3. Contents of SysvinitInstalled programs: halt, init, killall5, last, lastb (link to last), mesg, pidof (link to killall5), poweroff (link to halt), reboot (link to halt), runlevel, shutdown, sulogin, telinit (link to init), utmpdump, and wallShort Descriptionshalt Normally invokes shutdown with the -h option, except when already in run-level 0, then it tells the kernel to halt the system; it notes in the file /var/log/wtmp that the system is being brought downinit The first process to be started when the kernel has initialized the hardware which takes over the boot process and starts all the proceses it is instructed tokillall5 Sends a signal to all processes, except the processes in its own session so it will not kill the shell running the script that called itlast Shows which users last logged in (and out), searching back through the /var/log/wtmp file; it also shows system boots, shutdowns, and run-level changeslastb Shows the failed login attempts, as logged in /var/log/btmpmesg Controls whether other users can send messages to the current user's terminalmountpoint Checks if the directory is a mountpointpidof Reports the PIDs of the given programspoweroff Tells the kernel to halt the system and switch off the computer (see halt)reboot Tells the kernel to reboot the system (see halt)runlevel Reports the previous and the current run-level, as noted in the last run-level record in /var/run/utmpshutdown Brings the system down in a secure way, signaling all processes and notifying all logged-in userssulogin Allows root to log in; it is normally invoked by init when the system goes into single user modetelinit Tells init which run-level to change toutmpdump Displays the content of the given login file in a more user-friendly formatwall Writes a message to all logged-in users6.57. Tar-1.15.1The Tar package contains an archiving program.Approximate build time: 0.2 SBURequired disk space: 12.7 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, and Sed6.57.1. Installation of TarTar has a bug when the -S option is used with files larger than 4 GB. The following patch properly fixes this issue:patch -Np1 -i ../tar-1.15.1-sparse_fix-1.patchPrepare Tar for compilation:./configure --prefix=/usr --bindir=/bin --libexecdir=/usr/sbinCompile the package:makeTo test the results, issue: make check.Install the package:make install6.57.2. Contents of TarInstalled programs: rmt and tarShort Descriptionsrmt Remotely manipulates a magnetic tape drive through an interprocess communication connectiontar Creates, extracts files from, and lists the contents of archives, also known as tarballs6.58. Udev-056The Udev package contains programs for dynamic creation of device nodes.Approximate build time: 0.1 SBURequired disk space: 6.7 MBInstallation depends on: Coreutils and Make6.58.1. Installation of UdevCompile the package:make udevdir=/devudevdir=/dev This tells udev in which directory devices nodes are to be created.To test the results, issue: make test.Install the package:make DESTDIR=/ udevdir=/dev installThe meaning of the make option:DESTDIR=/ This prevents the Udev build process from killing any udevd processes that may be running on the host system.Udev's configuration is far from ideal by default, so install the configuration files here:cp -v ../udev-config-4.rules /etc/udev/rules.d/25-lfs.rulesRun the udevstart program to create our full complement of device nodes./sbin/udevstart6.58.2. Contents of UdevInstalled programs: udev, udevd, udevsend, udevstart, udevinfo, and udevtestInstalled directory: /etc/udevShort Descriptionsudev Creates device nodes in /dev or renames network interfaces (not in LFS) in response to hotplug eventsudevd A daemon that reorders hotplug events before submitting them to udev, thus avoiding various race conditionsudevsend Delivers hotplug events to udevdudevstart Creates device nodes in /dev that correspond to drivers compiled directly into the kernel; it performs that task by simulating hotplug events presumably dropped by the kernel before invocation of this program (e.g., because the root filesystem has not been mounted) and submitting such synthetic hotplug events to udevudevinfo Allows users to query the udev database for information on any device currently present on the system; it also provides a way to query any device in the sysfs tree to help create udev rulesudevtest Simulates a udev run for the given device, and prints out the name of the node the real udev would have created or (not in LFS) the name of the renamed network interface/etc/udev Contains udev configuation files, device permissions, and rules for device naming6.59. Util-linux-2.12qThe Util-linux package contains miscellaneous utility programs. Among them are utilities for handling file systems, consoles, partitions, and messages.Approximate build time: 0.2 SBURequired disk space: 11.6 MBInstallation depends on: Bash, Binutils, Coreutils, Diffutils, GCC, Gettext, Glibc, Grep, Make, Ncurses, Sed, and Zlib6.59.1. FHS compliance notesThe FHS recommends using the /var/lib/hwclock directory instead of the usual /etc directory as the location for the adjtime file. To make the hwclock program FHS-compliant, run the following:sed -i 's@etc/adjtime@var/lib/hwclock/adjtime@g' \ hwclock/hwclock.cmkdir -p /var/lib/hwclock6.59.2. Installation of Util-linuxUtil-linux fails to compile against newer versions of Linux-Libc-Headers. The following patch properly fixes this issue:patch -Np1 -i ../util-linux-2.12q-cramfs-1.patchUtil-linux has a security vulnerability that could allow a user to remount a volume without the nosuid option. The following patch fixes this issue:patch -Np1 -i ../util-linux-2.12q-umount_fix-1.patchPrepare Util-linux for compilation:./configureCompile the package:make HAVE_KILL=yes HAVE_SLN=yesThe meaning of the make parameters:HAVE_KILL=yes This prevents the kill program (already installed by Procps) from being built and installed again.HAVE_SLN=yes This prevents the sln program (a statically linked version of ln already installed by Glibc) from being built and installed again.This package does not come with a test suite.Install the package and move the logger binary to /bin as it is needed by the LFS-Bootscripts package:make HAVE_KILL=yes HAVE_SLN=yes installmv /usr/bin/logger /bin6.59.3. Contents of Util-linuxInstalled programs: agetty, arch, blockdev, cal, cfdisk, chkdupexe, col, colcrt, colrm, column, ctrlaltdel, cytune, ddate, dmesg, elvtune, fdformat, fdisk, fsck.cramfs, fsck.minix, getopt, hexdump, hwclock, ipcrm, ipcs, isosize, line, logger, look, losetup, mcookie, mkfs, mkfs.bfs, mkfs.cramfs, mkfs.minix, mkswap, more, mount, namei, pg, pivot_root, ramsize (link to rdev), raw, rdev,readprofile, rename, renice, rev, rootflags (link to rdev), script, setfdprm, setsid, setterm, sfdisk, swapdev, swapoff (link to swapon), swapon, tunelp, ul, umount, vidmode (link to rdev), whereis, and writeShort Descriptionsagetty Opens a tty port, prompts for a login name, and then invokes the login programarch Reports the machine's architectureblockdev Allows users to call block device ioctls from the command linecal Displays a simple calendarcfdisk Manipulates the partition table of the given devicechkdupexe Finds duplicate executablescol Filters out reverse line feedscolcrt Filters nroff output for terminals that lack some capabilities, such as overstriking and half-linescolrm Filters out the given columnscolumn Formats a given file into multiple columnsctrlaltdel Sets the function of the Ctrl+Alt+Del key combination to a hard or a soft resetcytune Tunes the parameters of the serial line drivers for Cyclades cardsddate Gives the Discordian date or converts the given Gregorian date to a Discordian onedmesg Dumps the kernel boot messageselvtune Tunes the performance and interactivity of a block devicefdformat Low-level formats a floppy diskfdisk Manipulates the partition table of the given devicefsck.cramfs Performs a consistency check on the Cramfs file system on the given devicefsck.minix Performs a consistency check on the Minix file system on the given devicegetopt Parses options in the given command linehexdump Dumps the given file in hexadecimal or in another given formathwclock Reads or sets the system's hardware clock, also called the Real-Time Clock (RTC) or Basic Input-Output System (BIOS) clockipcrm Removes the given Inter-Process Communication (IPC) resourceipcs Provides IPC status informationisosize Reports the size of an iso9660 file systemline Copies a single linelogger Enters the given message into the system loglook Displays lines that begin with the given stringlosetup Sets up and controls loop devicesmcookie Generates magic cookies (128-bit random hexadecimal numbers) for xauthmkfs Builds a file system on a device (usually a hard disk partition)mkfs.bfs Creates a Santa Cruz Operations (SCO) bfs file systemmkfs.cramfs Creates a cramfs file systemmkfs.minix Creates a Minix file systemmkswap Initializes the given device or file to be used as a swap areamore A filter for paging through text one screen at a timemount Attaches the file system on the given device to a specified directory in the file-system treenamei Shows the symbolic links in the given pathnamespg Displays a text file one screen full at a timepivot_root Makes the given file system the new root file system of the current processramsize Sets the size of the RAM disk in a bootable imageraw Used to bind a Linux raw character device to a block devicerdev Queries and sets the root device, among other things, in a bootable imagereadprofile Reads kernel profiling informationrename Renames the given files, replacing a given string with anotherrenice Alters the priority of running processesrev Reverses the lines of a given filerootflags Sets the rootflags in a bootable imagescript Makes a typescript of a terminal sessionsetfdprm Sets user-provided floppy disk parameterssetsid Runs the given program in a new sessionsetterm Sets terminal attributessfdisk A disk partition table manipulatorswapdev Sets the swap device in a bootable imageswapoff Disables devices and files for paging and swappingswapon Enables devices and files for paging and swapping and lists the devices and files currently in usetunelp Tunes the parameters of the line printerul A filter for translating underscores into escape sequences indicating underlining for the terminal in useumount Disconnects a file system from the system's file treevidmode Sets the video mode in a bootable imagewhereis Reports the location of the binary, source, and man page for the given commandwrite Sends a message to the given user if that user has not disabled receipt of such messages6.60. About Debugging SymbolsMost programs and libraries are, by default, compiled with debugging symbols included (with gcc's -g option). This means that when debugging a program or library that was compiled with debugging information included, the debugger can provide not only memory addresses, but also the names of the routines and variables.However, the inclusion of these debugging symbols enlarges a program or library significantly. The following is an example of the amount of space these symbols occupy: a bash binary with debugging symbols: 1200 KB a bash binary without debugging symbols: 480 KB Glibc and GCC files (/lib and /usr/lib) with debugging symbols: 87 MB Glibc and GCC files without debugging symbols: 16 MBSizes may vary depending on which compiler and C library were used, but when comparing programs with and without debugging symbols, the difference will usually be a factor between two and five.Because most users will never use a debugger on their system software, a lot of disk space can be regained by removing these symbols. The next section shows how to strip all debugging symbols from the programs and libraries. Additional information on system optimization can be found at http://www.linuxfromscratch.org/hints/downloads/files/optimization.txt.6.61. Stripping AgainIf the intended user is not a programmer and does not plan to do any debugging on the system software, the system size can be decreased by about 200 MB by removing the debugging symbols from binaries and libraries. This causes no inconvenience other than not being able to debug the software fully anymore.Most people who use the command mentioned below do not experience any difficulties. However, it is easy to make a typo and render the new system unusable, so before running the strip command, it is a good idea to make a backup of the current situation.Before performing the stripping, take special care to ensure that none of the binaries that are about to be stripped are running. If unsure whether the user entered chroot with the command given in Section 6.3, “Entering the Chroot Environment,” first exit from chroot:logoutThen reenter it with:chroot $LFS /tools/bin/env -i \ HOME=/root TERM=$TERM PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /tools/bin/bash --loginNow the binaries and libraries can be safely stripped:/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \ -exec /tools/bin/strip --strip-debug '{}' ';'A large number of files will be reported as having their file format not recognized. These warnings can be safely ignored. These warnings indicate that those files are scripts instead of binaries.If disk space is very tight, the --strip-all option can be used on the binaries in /{,usr/}{bin,sbin} to gain several more megabytes. Do not use this option on libraries—they will be destroyed.6.62. Cleaning UpFrom now on, when reentering the chroot environment after exiting, use the following modified chroot command:chroot "$LFS" /usr/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /bin/bash --loginThe reason for this is that the programs in /tools are no longer needed. Since they are no longer needed you can delete the /tools directory if so desired or tar it up and keep it to build another final system.NoteRemoving /tools will also remove the temporary copies of Tcl, Expect, and DejaGNU which were used for running the toolchain tests. If you need these programs later on, they will need to be recompiled and re-installed. The BLFS book has instructions for this (see http://www.linuxfromscratch.org/blfs/).Chapter 7. Setting Up System Bootscripts7.1. IntroductionThis chapter details how to install and configure the LFS-Bootscripts package. Most of these scripts will work without modification, but a few require additional configuration files because they deal with hardware-dependent information.System-V style init scripts are employed in this book because they are widely used. For additional options, a hint detailing the BSD style init setup is available at http://www.linuxfromscratch.org/hints/downloads/files/bsd-init.txt. Searching the LFS mailing lists for “depinit” will also offer additional choices.If using an alternative style of init scripts, skip this chapter and move on to Chapter 8.7.2. LFS-Bootscripts-3.2.1The LFS-Bootscripts package contains a set of scripts to start/stop the LFS system at bootup/shutdown.Approximate build time: 0.1 SBURequired disk space: 0.3 MBInstallation depends on: Bash and Coreutils7.2.1. Installation of LFS-BootscriptsInstall the package:make install7.2.2. Contents of LFS-BootscriptsInstalled scripts: checkfs, cleanfs, console, functions, halt, hotplug, ifdown, ifup, localnet, mountfs, mountkernfs, network, rc, reboot, sendsignals, setclock, static, swap, sysklogd, template, and udevShort Descriptionscheckfs Checks the integrity of the file systems before they are mounted (with the exception of journal and network based file systems)cleanfs Removes files that should not be preserved between reboots, such as those in /var/run/ and /var/lock/; it re-creates /var/run/utmp and removes the possibly present /etc/nologin, /fastboot, and /forcefsck filesconsole Loads the correct keymap table for the desired keyboard layout; it also sets the screen fontfunctions Contains common functions, such as error and status checking, that are used by several bootscriptshalt Halts the systemhotplug Loads modules for system devicesifdown Assists the network script with stopping network devicesifup Assists the network script with starting network deviceslocalnet Sets up the system's hostname and local loopback devicemountfs Mounts all file systems, except ones that are marked noauto or are network basedmountkernfs Mounts virtual kernel file systems, such as procnetwork Sets up network interfaces, such as network cards, and sets up the default gateway (where applicable)rc The master run-level control script; it is responsible for running all the other bootscripts one-by-one, in a sequence determined by the name of the symbolic links being processedreboot Reboots the systemsendsignals Makes sure every process is terminated before the system reboots or haltssetclock Resets the kernel clock to local time in case the hardware clock is not set to UTC timestatic Provides the functionality needed to assign a static Internet Protocol (IP) address to a network interfaceswap Enables and disables swap files and partitionssysklogd Starts and stops the system and kernel log daemonstemplate A template to create custom bootscripts for other daemonsudev Prepares the /dev directory and starts Udev7.3. How Do These Bootscripts Work?Linux uses a special booting facility named SysVinit that is based on a concept of run-levels. It can be quite different from one system to another, so it cannot be assumed that because things worked in one particular Linux distribution, they should work the same in LFS too. LFS has its own way of doing things, but it respects generally accepted standards.SysVinit (which will be referred to as “init” from now on) works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels (actually, there are more run-levels, but they are for special cases and are generally not used. See init(8) for more details), and each one of those corresponds to the actions the computer is supposed to perform when it starts up. The defaultrun-level is 3. Here are the descriptions of the different run-levels as they are implemented:0: halt the computer1: single-user mode2: multi-user mode without networking3: multi-user mode with networking4: reserved for customization, otherwise does the same as 35: same as 4, it is usually used for GUI login (like X's xdm or KDE's kdm)6: reboot the computerThe command used to change run-levels is init [runlevel], where [runlevel] is the target run-level. For example, to reboot the computer, a user could issue the init 6 command, which is an alias for the reboot command. Likewise, init 0 is an alias for the halt command.There are a number of directories under /etc/rc.d that look like rc?.d (where ? is the number of the run-level) and rcsysinit.d, all containing a number of symbolic links. Some begin with a K, the others begin with an S, and all of them have two numbers following the initial letter. The K means to stop (kill) a service and the S means to start a service. The numbers determine the orderin which the scripts are run, from 00 to 99—the lower the number the earlier it gets executed. When init switches to another run-level, the appropriate services are either started or stopped, depending on the runlevel chosen.The real scripts are in /etc/rc.d/init.d. They do the actual work, and the symlinks all point to them. Killing links and starting links point to the same script in /etc/rc.d/init.d. This is because the scripts can be called with different parameters like start, stop, restart, reload, and status. When a K link is encountered, the appropriate script is run with the stop argument. When an Slink is encountered, the appropriate script is run with the start argument.There is one exception to this explanation. Links that start with an S in the rc0.d and rc6.d directories will not cause anything to be started. They will be called with the parameter stop to stop something. The logic behind this is that when a user is going to reboot or halt the system, nothing needs to be started. The system only needs to be stopped.These are descriptions of what the arguments make the scripts do:start The service is started.stop The service is stopped.restart The service is stopped and then started again.reload The configuration of the service is updated. This is used after the configuration file of a service was modified, when the service does not need to be restarted.status Tells if the service is running and with which PIDs.Feel free to modify the way the boot process works (after all, it is your own LFS system). The files given here are an example of how it can be done.7.4. Device and Module Handling on an LFS SystemIn Chapter 6, we installed the Udev package. Before we go into the details regarding how this works, a brief history of previous methods of handling devices is in order.Linux systems in general traditionally use a static device creation method, whereby a great many device nodes are created under /dev (sometimes literally thousands of nodes), regardless of whether the corresponding hardware devices actually exist. This is typically done via a MAKEDEV script, which contains a number of calls to the mknod program with the relevant major and minor devicenumbers for every possible device that might exist in the world. Using the Udev method, only those devices which are detected by the kernel get device nodes created for them. Because these device nodes will be created each time the system boots, they will be stored on a tmpfs file system (a virtual file system that resides entirely in system memory). Device nodes do not require muchspace, so the memory that is used is negligible.7.4.1. HistoryIn February 2000, a new filesystem called devfs was merged into the 2.3.46 kernel and was made available during the 2.4 series of stable kernels. Although it was present in the kernel source itself, this method of creating devices dynamically never received overwhelming support from the core kernel developers.The main problem with the approach adopted by devfs was the way it handled device detection, creation, and naming. The latter issue, that of device node naming, was perhaps the most critical. It is generally accepted that if device names are allowed to be configurable, then the device naming policy should be up to a system administrator, not imposed on them by any particulardeveloper(s). The devfs file system also suffers from race conditions that are inherent in its design and cannot be fixed without a substantial revision to the kernel. It has also been marked as deprecated due to a lack of recent maintenance.With the development of the unstable 2.5 kernel tree, later released as the 2.6 series of stable kernels, a new virtual filesystem called sysfs came to be. The job of sysfs is to export a view of the system's hardrware configuration to userspace processes. With this userspace-visible representation, the possibility of seeing a userspace replacement for devfs became much more realistic.7.4.2. Udev ImplementationThe sysfs filesystem was mentioned briefly above. One may wonder how sysfs knows about the devices present on a system and what device numbers should be used for them. Drivers that have been compiled into the kernel directly register their objects with sysfs as they are detected by the kernel. For drivers compiled as modules, this registration will happen when the module is loaded. Oncethe sysfs filesystem is mounted (on /sys), data which the built-in drivers registered with sysfs are available to userspace processes and to udev for device node creation.The S10udev initscript takes care of creating these device nodes when Linux is booted. This script starts by registering /sbin/udevsend as a hotplug event handler. Hotplug events (discussed below) are not usually generated during this stage, but udev is registered just in case they do occur. The udevstart program then walks through the /sys filesystem and creates devices under /dev thatmatch the descriptions. For example, /sys/class/tty/vcs/dev contains the string “7:0” This string is used by udevstart to create /dev/vcs with major number 7 and minor 0. The names and permissions of the nodes created under the /dev directory are configured according to the rules specified in the files within the /etc/udev/rules.d/ directory. These are numbered in a similar fashionto the LFS-Bootscripts package. If udev can't find a rule for the device it is creating, it will default permissions to 660 and ownership to root:root.Once the above stage is complete, all devices that were already present and have compiled-in drivers will be available for use. This leads us to the devices that have modular drivers.Earlier, we mentioned the concept of a “hotplug event handler.” When a new device connection is detected by the kernel, the kernel will generate a hotplug event and look at the file /proc/sys/kernel/hotplug to determine the userspace program that handles the device's connection. The udev bootscript registered udevsend as this handler. When these hotplug events are generated, thekernel will tell udev to check the /sys filesystem for the information pertaining to this new device and create the /dev entry for it.This brings us to one problem that exists with udev, and likewise with devfs before it. It is commonly referred to as the “chicken and egg” problem. Most Linux distributions handle loading modules via entries in /etc/modules.conf. Access to a device node causes the appropriate kernel module to load. With udev, this method will not work because the device node does not exist until themodule is loaded. To solve this, the S05modules bootscript was added to the LFS-Bootscripts package, along with the /etc/sysconfig/modules file. By adding module names to the modules file, these modules will be loaded when the computer starts up. This allows udev to detect the devices and create the appropriate device nodes.Note that on slower machines or for drivers that create a lot of device nodes, the process of creating devices may take a few seconds to complete. This means that some device nodes may not be immediately accessible.7.4.3. Handling Hotpluggable/Dynamic DevicesWhen you plug in a device, such as a Universal Serial Bus (USB) MP3 player, the kernel recognizes that the device is now connected and generates a hotplug event. If the driver is already loaded (either because it was compiled into the kernel or because it was loaded via the S05modules bootscript), udev will be called upon to create the relevant device node(s) according to the sysfs dataavailable in /sys.If the driver for the just plugged in device is available as a module but currently unloaded, the Hotplug package will load the appropriate module and make this device available by creating the device node(s) for it.7.4.4. Problems with Creating DevicesThere are a few known problems when it comes to automatically creating device nodes:1) A kernel driver may not export its data to sysfs.This is most common with third party drivers from outside the kernel tree. Udev will be unable to automatically create device nodes for such drivers. Use the /etc/sysconfig/createfiles configuration file to manually create the devices. Consult the devices.txt file inside the kernel documentation or the documentation for that driver to find the proper major/minor numbers.2) A non-hardware device is required. This is most common with the Advanced Linux Sound Architecture (ALSA) project's Open Sound System (OSS) compatibility module. These types of devices can be handled in one of two ways: Adding the module names to /etc/sysconfig/modules Using an “install” line in /etc/modprobe.conf. This tells the modprobe command “when loading this module, also load this other module, at the same time.” For example: install snd-pcm modprobe -i snd-pcm ; modprobe \ snd-pcm-oss ; true This will cause the system to load both the snd-pcm and snd-pcm-oss modules when any request is made to load the driver snd-pcm.7.4.5. Useful ReadingAdditional helpful documentation is available at the following sites: A Userspace Implementation of devfs http://www.kroah.com/linux/talks/ols_2003_udev_paper/Reprint-Kroah-Hartman-OLS2003.pdf udev FAQ http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-FAQ The Linux Kernel Driver Model http://public.planetmirror.com/pub/lca/2003/proceedings/papers/Patrick_Mochel/Patrick_Mochel.pdf7.5. Configuring the setclock ScriptThe setclock script reads the time from the hardware clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor (CMOS) clock. If the hardware clock is set to UTC, this script will convert the hardware clock's time to the local time using the /etc/localtime file (which tells the hwclock program which timezone the user is in). There is no way to detect whether or not thehardware clock is set to UTC, so this needs to be configured manually.If you cannot remember whether or not the hardware clock is set to UTC, find out by running the hwclock --localtime --show command. This will display what the current time is according to the hardware clock. If this time matches whatever your watch says, then the hardware clock is set to local time. If the output from hwclock is not local time, chances are it is set to UTC time. Verifythis by adding or subtracting the proper amount of hours for the timezone to the time shown by hwclock. For example, if you are currently in the MST timezone, which is also known as GMT -0700, add seven hours to the local time.Change the value of the UTC variable below to a value of 0 (zero) if the hardware clock is not set to UTC time.Create a new file /etc/sysconfig/clock by running the following:cat > /etc/sysconfig/clock << "EOF"# Begin /etc/sysconfig/clockUTC=1# End /etc/sysconfig/clockEOFA good hint explaining how to deal with time on LFS is available at http://www.linuxfromscratch.org/hints/downloads/files/time.txt. It explains issues such as time zones, UTC, and the TZ environment variable.7.6. Configuring the Linux ConsoleThis section discusses how to configure the console bootscript that sets up the keyboard map and the console font. If non-ASCII characters (e.g., the British pound sign and Euro character) will not be used and the keyboard is a U.S. one, skip this section. Without the configuration file, the console bootscript will do nothing.The console script reads the /etc/sysconfig/console file for configuration information. Decide which keymap and screen font will be used. Various language-specific HOWTO's can also help with this (see http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html. A pre-made /etc/sysconfig/console file with known settings for several countries was installed with the LFS-Bootscripts package, sothe relevant section can be uncommented if the country is supported. If still in doubt, look in the /usr/share/kbd directory for valid keymaps and screen fonts. Read loadkeys(1) and setfont(8) to determine the correct arguments for these programs. Once decided, create the configuration file with the following command:cat >/etc/sysconfig/console <<"EOF"KEYMAP="[arguments for loadkeys]"FONT="[arguments for setfont]"EOFFor example, for Spanish users who also want to use the Euro character (accessible by pressing AltGr+E), the following settings are correct:cat >/etc/sysconfig/console <<"EOF"KEYMAP="es euro2"FONT="lat9-16 -u iso01"EOFNoteThe FONT line above is correct only for the ISO 8859-15 character set. If using ISO 8859-1 and, therefore, a pound sign instead of Euro, the correct FONT line would be:FONT="lat1-16"If the KEYMAP or FONT variable is not set, the console initscript will not run the corresponding program.In some keymaps, the Backspace and Delete keys send characters different from ones in the default keymap built into the kernel. This confuses some applications. For example, Emacs displays its help (instead of erasing the character before the cursor) when Backspace is pressed. To check if the keymap in use is affected (this works only for i386 keymaps):zgrep '\W14\W' [/path/to/your/keymap]If the keycode 14 is Backspace instead of Delete, create the following keymap snippet to fix this issue:mkdir -pv /etc/kbd && cat > /etc/kbd/bs-sends-del <<"EOF" keycode 14 = Delete Delete Delete Delete alt keycode 14 = Meta_Delete altgr alt keycode 14 = Meta_Delete keycode 111 = Remove altgr control keycode 111 = Boot control alt keycode 111 = Bootaltgr control alt keycode 111 = BootEOFTell the console script to load this snippet after the main keymap:cat >>/etc/sysconfig/console <<"EOF"KEYMAP_CORRECTIONS="/etc/kbd/bs-sends-del"EOFTo compile the keymap directly into the kernel instead of setting it every time from the console bootscript, follow the instructions given in Section 8.3, “Linux-2.6.11.12.” Doing this ensures that the keyboard will always work as expected, even when booting into maintenance mode (by passing init=/bin/sh to the kernel), because the console bootscript will not be run in thatsituation. Additionally, the kernel will not set the screen font automatically. This should not pose many problems because ASCII characters will be handled correctly, and it is unlikely that a user would need to rely on non-ASCII characters while in maintenance mode.Since the kernel will set up the keymap, it is possible to omit the KEYMAP variable from the /etc/sysconfig/console configuration file. It can also be left in place, if desired, without consequence. Keeping it could be beneficial if running several different kernels where it is difficult to ensure that the keymap is compiled into every one of them.7.7. Configuring the sysklogd scriptThe sysklogd script invokes the syslogd program with the -m 0 option. This option turns off the periodic timestamp mark that syslogd writes to the log files every 20 minutes by default. If you want to turn on this periodic timestamp mark, edit the sysklogd script and make the changes accordingly. See man syslogd for more information.7.8. Creating the /etc/inputrc FileThe inputrc file handles keyboard mapping for specific situations. This file is the startup file used by Readline — the input-related library — used by Bash and most other shells.Most people do not need user-specific keyboard mappings so the command below creates a global /etc/inputrc used by everyone who logs in. If you later decide you need to override the defaults on a per-user basis, you can create a .inputrc file in the user's home directory with the modified mappings.For more information on how to edit the inputrc file, see info bash under the Readline Init File section. info readline is also a good source of information.Below is a generic global inputrc along with comments to explain what the various options do. Note that comments cannot be on the same line as commands. Create the file using the following command:cat > /etc/inputrc << "EOF"# Begin /etc/inputrc# Modified by Chris Lynn # Allow the command prompt to wrap to the next lineset horizontal-scroll-mode Off# Enable 8bit inputset meta-flag Onset input-meta On# Turns off 8th bit strippingset convert-meta Off# Keep the 8th bit for displayset output-meta On# none, visible or audibleset bell-style none# All of the following map the escape sequence of the# value contained inside the 1st argument to the# readline specific functions"\eOd": backward-word"\eOc": forward-word# for linux console"\e[1~": beginning-of-line"\e[4~": end-of-line"\e[5~": beginning-of-history"\e[6~": end-of-history"\e[3~": delete-char"\e[2~": quoted-insert# for xterm"\eOH": beginning-of-line"\eOF": end-of-line# for Konsole"\e[H": beginning-of-line"\e[F": end-of-line# End /etc/inputrcEOF7.9. The Bash Shell Startup FilesThe shell program /bin/bash (hereafter referred to as “the shell”) uses a collection of startup files to help create an environment to run in. Each file has a specific use and may affect login and interactive environments differently. The files in the /etc directory provide global settings. If an equivalent file exists in the home directory, it may override the global settings.An interactive login shell is started after a successful login, using /bin/login, by reading the /etc/passwd file. An interactive non-login shell is started at the command-line (e.g., [prompt]$/bin/bash). A non-interactive shell is usually present when a shell script is running. It is non-interactive because it is processing a script and not waiting for user input between commands.For more information, see info bash under the Bash Startup Files and Interactive Shells section.The files /etc/profile and ~/.bash_profile are read when the shell is invoked as an interactive login shell.The base /etc/profile below sets some environment variables necessary for native language support. Setting them properly results in: The output of programs translated into the native language Correct classification of characters into letters, digits and other classes. This is necessary for bash to properly accept non-ASCII characters in command lines in non-English locales The correct alphabetical sorting order for the country Appropriate default paper size Correct formatting of monetary, time, and date valuesThis script also sets the INPUTRC environment variable that makes Bash and Readline use the /etc/inputrc file created earlier.Replace [ll] below with the two-letter code for the desired language (e.g., “en”) and [CC] with the two-letter code for the appropriate country (e.g., “GB”). [charmap] should be replaced with the canonical charmap for your chosen locale.The list of all locales supported by Glibc can be obtained by running the following command:locale -aLocales can have a number of synonyms, e.g. “ISO-8859-1” is also referred to as “iso8859-1” and “iso88591”. Some applications cannot handle the various synonyms correctly, so it is safest to choose the canonical name for a particular locale. To determine the canonical name, run the following command, where [locale name] is the output given by locale -a for your preferredlocale (“en_GB.iso88591” in our example).LC_ALL=[locale name] locale charmapFor the “en_GB.iso88591” locale, the above command will print:ISO-8859-1This results in a final locale setting of “en_GB.ISO-8859-1”. It is important that the locale found using the heuristic above is tested prior to it being added to the Bash startup files:LC_ALL=[locale name] locale countryLC_ALL=[locale name] locale languageLC_ALL=[locale name] locale charmapLC_ALL=[locale name] locale int_curr_symbolLC_ALL=[locale name] locale int_prefixThe above commands should print the country and language names, the character encoding used by the locale, the local currency and the prefix to dial before the telephone number in order to get into the country. If any of the commands above fail with a message similar to the one shown below, this means that your locale was either not installed in Chapter 6 or is not supported by thedefault installation of Glibc.locale: Cannot set LC_* to default locale: No such file or directoryIf this happens, you should either install the desired locale using the localedef command, or consider choosing a different locale. Further instructions assume that there are no such error messages from Glibc.Some packages beyond LFS may also lack support for your chosen locale. One example is the X library (part of the X Window System), which outputs the following error message:Warning: locale not supported by Xlib, locale set to CSometimes it is possible to fix this by removing the charmap part of the locale specification, as long as that does not change the character map that Glibc associates with the locale (this can be checked by running the locale charmap command in both locales). For example, one would have to change "de_DE.ISO-8859-15@euro" to "de_DE@euro" in order to get this locale recognized by Xlib.Other packages can also function incorrectly (but may not necessarily display any error messages) if the locale name does not meet their expectations. In those cases, investigating how other Linux distributions support your locale might provide some useful information.Once the proper locale settings have been determined, create the /etc/profile file:cat > /etc/profile << "EOF"# Begin /etc/profileexport LANG=[ll]_[CC].[charmap]export INPUTRC=/etc/inputrc# End /etc/profileEOFNoteThe “C” (default) and “en_US” (the recommended one for United States English users) locales are different.Setting the keyboard layout, screen font, and locale-related environment variables are the only internationalization steps needed to support locales that use ordinary single-byte encodings and left-to-right writing direction. More complex cases (including UTF-8 based locales) require additional steps and additional patches because many applications tend to not work properly under suchconditions. These steps and patches are not included in the LFS book and such locales are not yet supported by LFS.7.10. Configuring the localnet ScriptPart of the job of the localnet script is setting the system's hostname. This needs to be configured in the /etc/sysconfig/network file.Create the /etc/sysconfig/network file and enter a hostname by running:echo "HOSTNAME=[lfs]" > /etc/sysconfig/network[lfs] needs to be replaced with the name given to the computer. Do not enter the Fully Qualified Domain Name (FQDN) here. That information will be put in the /etc/hosts file in the next section.7.11. Creating the /etc/hosts FileIf a network card is to be configured, decide on the IP address, FQDN, and possible aliases for use in the /etc/hosts file. The syntax is: myhost.example.org aliasesUnless the computer is to be visible to the Internet (i.e., there is a registered domain and a valid block of assigned IP addresses—most users do not have this), make sure that the IP address is in the private network IP address range. Valid ranges are: Class Networks A 10.0.0.0 B 172.16.0.0 through 172.31.0.255 C 192.168.0.0 through 192.168.255.255A valid IP address could be 192.168.1.1. A valid FQDN for this IP could be www.linuxfromscratch.org (not recommended because this is a valid registered domain address and could cause domain name server issues).Even if not using a network card, an FQDN is still required. This is necessary for certain programs to operate correctly.Create the /etc/hosts file by running:cat > /etc/hosts << "EOF"# Begin /etc/hosts (network card version)127.0.0.1 localhost[192.168.1.1] [.example.org] [HOSTNAME]# End /etc/hosts (network card version)EOFThe [192.168.1.1] and [.example.org] values need to be changed for specific users or requirements (if assigned an IP address by a network/system administrator and the machine will be connected to an existing network).If a network card is not going to be configured, create the /etc/hosts file by running:cat > /etc/hosts << "EOF"# Begin /etc/hosts (no network card version)127.0.0.1 [.example.org] [HOSTNAME] localhost# End /etc/hosts (no network card version)EOF7.12. Configuring the network ScriptThis section only applies if a network card is to be configured.If a network card will not be used, there is likely no need to create any configuration files relating to network cards. If that is the case, remove the network symlinks from all run-level directories (/etc/rc.d/rc*.d).7.12.1. Creating Network Interface Configuration FilesWhich interfaces are brought up and down by the network script depends on the files and directories in the /etc/sysconfig/network-devices hierarchy. This directory should contain a sub-directory for each interface to be configured, such as ifconfig.xyz, where “xyz” is a network interface name. Inside this directory would be files defining the attributes to this interface, such as itsIP address(es), subnet masks, and so forth.The following command creates a sample ipv4 file for the eth0 device:cd /etc/sysconfig/network-devices &&mkdir -v ifconfig.eth0 &&cat > ifconfig.eth0/ipv4 << "EOF"ONBOOT=yesSERVICE=ipv4-staticIP=192.168.1.1GATEWAY=192.168.1.2PREFIX=24BROADCAST=192.168.1.255EOFThe values of these variables must be changed in every file to match the proper setup. If the ONBOOT variable is set to “yes” the network script will bring up the Network Interface Card (NIC) during booting of the system. If set to anything but “yes” the NIC will be ignored by the network script and not be brought up.The SERVICE variable defines the method used for obtaining the IP address. The LFS-Bootscripts package has a modular IP assignment format, and creating additional files in the /etc/sysconfig/network-devices/services directory allows other IP assignment methods. This is commonly used for Dynamic Host Configuration Protocol (DHCP), which is addressed in the BLFS book.The GATEWAY variable should contain the default gateway IP address, if one is present. If not, then comment out the variable entirely.The PREFIX variable needs to contain the number of bits used in the subnet. Each octet in an IP address is 8 bits. If the subnet's netmask is 255.255.255.0, then it is using the first three octets (24 bits) to specify the network number. If the netmask is 255.255.255.240, it would be using the first 28 bits. Prefixes longer than 24 bits are commonly used by DSL and cable-based InternetService Providers (ISPs). In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the PREFIX variable according to your specific subnet.7.12.2. Creating the /etc/resolv.conf FileIf the system is going to be connected to the Internet, it will need some means of Domain Name Service (DNS) name resolution to resolve Internet domain names to IP addresses, and vice versa. This is best achieved by placing the IP address of the DNS server, available from the ISP or network administrator, into /etc/resolv.conf. Create the file by running the following:cat > /etc/resolv.conf << "EOF"# Begin /etc/resolv.confdomain {[Your Domain Name]}nameserver [IP address of your primary nameserver]nameserver [IP address of your secondary nameserver]# End /etc/resolv.confEOFReplace [IP address of the nameserver] with the IP address of the DNS most appropriate for the setup. There will often be more than one entry (requirements demand secondary servers for fallback capability). If you only need or want one DNS server, remove the second nameserver line from the file. The IP address may also be a router on the local network.Chapter 8. Making the LFS System Bootable8.1. IntroductionIt is time to make the LFS system bootable. This chapter discusses creating an fstab file, building a kernel for the new LFS system, and installing the GRUB boot loader so that the LFS system can be selected for booting at startup.8.2. Creating the /etc/fstab FileThe /etc/fstab file is used by some programs to determine where file systems are to be mounted by default, in which order, and which must be checked (for integrity errors) prior to mounting. Create a new file systems table like this:cat > /etc/fstab << "EOF"# Begin /etc/fstab# file system mount-point type options dump fsck# order/dev/[xxx] / [fff] defaults 1 1/dev/[yyy] swap swap pri=1 0 0proc /proc proc defaults 0 0sysfs /sys sysfs defaults 0 0devpts /dev/pts devpts gid=4,mode=620 0 0shm /dev/shm tmpfs defaults 0 0# End /etc/fstabEOFReplace [xxx], [yyy], and [fff] with the values appropriate for the system, for example, hda2, hda5, and ext2. For details on the six fields in this file, see man 5 fstab.When using a journalling file system, the 1 1 at the end of the line should be replaced with 0 0 because such a partition does not need to be dumped or checked.The /dev/shm mount point for tmpfs is included to allow enabling POSIX-shared memory. The kernel must have the required support built into it for this to work (more about this is in the next section). Please note that very little software currently uses POSIX-shared memory. Therefore, consider the /dev/shm mount point optional. For more information, seeDocumentation/filesystems/tmpfs.txt in the kernel source tree.There are other lines which may be added to the /etc/fstab file. One example is a line for USB devices: usbfs /proc/bus/usb usbfs devgid=14,devmode=0660 0 0 This option will only work if “Support for Host-side USB” and “USB device filesystem” are configured in the kernel. If “Support for Host-side USB” is compiled as a module, then usbcore must be listed in /etc/sysconfig/modules.8.3. Linux-2.6.11.12The Linux package contains the Linux kernel.Approximate build time: 4.20 SBURequired disk space: 181 MBInstallation depends on: Bash, Binutils, Coreutils, Findutils, GCC, Glibc, Grep, Gzip, Make, Modutils, Perl, and Sed8.3.1. Installation of the kernelBuilding the kernel involves a few steps—configuration, compilation, and installation. Read the README file in the kernel source tree for alternative methods to the way this book configures the kernel.Prepare for compilation by running the following command:make mrproperThis ensures that the kernel tree is absolutely clean. The kernel team recommends that this command be issued prior to each kernel compilation. Do not rely on the source tree being clean after un-tarring.If, in Section 7.6, “Configuring the Linux Console,” it was decided to compile the keymap into the kernel, issue the command below:loadkeys -m /usr/share/kbd/keymaps/[path to keymap] > \ drivers/char/defkeymap.cFor example, if using a Dutch keyboard, use /usr/share/kbd/keymaps/i386/qwerty/nl.map.gz.Configure the kernel via a menu-driven interface. BLFS has some information regarding particular kernel configuration requirements of packages outside of LFS at http://www.linuxfromscratch.org/blfs/view/svn/longindex.html#kernel-config-index:make menuconfigAlternatively, make oldconfig may be more appropriate in some situations. See the README file for more information.If desired, skip kernel configuration by copying the kernel config file, .config, from the host system (assuming it is available) to the unpacked linux-2.6.11.12 directory. However, we do not recommend this option. It is often better to explore all the configuration menus and create the kernel configuration from scratch.NoteNPTL requires the kernel to be compiled with GCC-3.x or later, in this case 3.4.3. It is not recommended to compile the kernel with GCC-2.95.x, as this causes failures in the Glibc test suite. Normally, this wouldn't be mentioned as LFS doesn't build GCC-2.95.x. Unfortunately, the kernel documentation is outdated and still claims GCC-2.95.3 is the recommended compiler.Compile the kernel image and modules:makeIf using kernel modules, an /etc/modprobe.conf file may be needed. Information pertaining to modules and kernel configuration is located in the kernel documentation in the linux-2.6.11.12/Documentation directory. Also, modprobe.conf(5) may be of interest.Be very careful when reading other documentation relating to kernel modules because it usually applies to 2.4.x kernels only. As far as we know, kernel configuration issues specific to Hotplug and Udev are not documented. The problem is that Udev will create a device node only if Hotplug or a user-written script inserts the corresponding module into the kernel, and not all modules aredetectable by Hotplug. Note that statements like the one below in the /etc/modprobe.conf file do not work with Udev:alias char-major-XXX some-moduleBecause of the complications with Hotplug, Udev, and modules, we strongly recommend starting with a completely non-modular kernel configuration, especially if this is the first time using Udev.Install the modules, if the kernel configuration uses them:make modules_installAfter kernel compilation is complete, additional steps are required to complete the installation. Some files need to be copied to the /boot directory.The path to the kernel image may vary depending on the platform being used. The following command assumes an x86 architecture:cp -v arch/i386/boot/bzImage /boot/lfskernel-2.6.11.12System.map is a symbol file for the kernel. It maps the function entry points of every function in the kernel API, as well as the addresses of the kernel data structures for the running kernel. Issue the following command to install the map file:cp -v System.map /boot/System.map-2.6.11.12The kernel configuration file .config produced by the make menuconfig step above contains all the configuration selections for the kernel that was just compiled. It is a good idea to keep this file for future reference:cp -v .config /boot/config-2.6.11.12It is important to note that the files in the kernel source directory are not owned by root. Whenever a package is unpacked as user root (like we did inside chroot), the files have the user and group IDs of whatever they were on the packager's computer. This is usually not a problem for any other package to be installed because the source tree is removed after the installation. However,the Linux source tree is often retained for a long time. Because of this, there is a chance that whatever user ID the packager used will be assigned to somebody on the machine. That person would then have write access to the kernel source.If the kernel source tree is going to be retained, run chown -R 0:0 on the linux-2.6.11.12 directory to ensure all files are owned by user root.WarningSome kernel documentation recommends creating a symlink from /usr/src/linux pointing to the kernel source directory. This is specific to kernels prior to the 2.6 series and must not be created on an LFS system as it can cause problems for packages you may wish to build once your base LFS system is complete.Also, the headers in the system's include directory should always be the ones against which Glibc was compiled, that is, the ones from the Linux-Libc-Headers package, and therefore, should never be replaced by the kernel headers.8.3.2. Contents of LinuxInstalled files: config-2.6.11.12, lfskernel-2.6.11.12, and System.map-2.6.11.12Short Descriptionsconfig-2.6.11.12 Contains all the configuration selections for the kernellfskernel-2.6.11.12 The engine of the Linux system. When turning on the computer, the kernel is the first part of the operating system that gets loaded. It detects and initializes all components of the computer's hardware, then makes these components available as a tree of files to the software and turns a single CPU into a multitasking machine capable of running scores of programs seemingly at the sametimeSystem.map-2.6.11.12 A list of addresses and symbols; it maps the entry points and addresses of all the functions and data structures in the kernel8.4. Making the LFS System BootableYour shiny new LFS system is almost complete. One of the last things to do is to ensure that the system can be properly booted. The instructions below apply only to computers of IA-32 architecture, meaning mainstream PCs. Information on “boot loading” for other architectures should be available in the usual resource-specific locations for those architectures.Boot loading can be a complex area, so a few cautionary words are in order. Be familiar with the current boot loader and any other operating systems present on the hard drive(s) that need to be bootable. Make sure that an emergency boot disk is ready to “rescue” the computer if the computer becomes unusable (un-bootable).Earlier, we compiled and installed the GRUB boot loader software in preparation for this step. The procedure involves writing some special GRUB files to specific locations on the hard drive. We highly recommend creating a GRUB boot floppy diskette as a backup. Insert a blank floppy diskette and run the following commands:dd if=/boot/grub/stage1 of=/dev/fd0 bs=512 count=1dd if=/boot/grub/stage2 of=/dev/fd0 bs=512 seek=1Remove the diskette and store it somewhere safe. Now, run the grub shell:grubGRUB uses its own naming structure for drives and partitions in the form of (hdn,m), where n is the hard drive number and m is the partition number, both starting from zero. For example, partition hda1 is (hd0,0) to GRUB and hdb3 is (hd1,2). In contrast to Linux, GRUB does not consider CD-ROM drives to be hard drives. For example, if using a CD on hdb and a second hard drive on hdc, thatsecond hard drive would still be (hd1).Using the above information, determine the appropriate designator for the root partition (or boot partition, if a separate one is used). For the following example, it is assumed that the root (or separate boot) partition is hda4.Tell GRUB where to search for its stage{1,2} files. The Tab key can be used everywhere to make GRUB show the alternatives:root (hd0,3)WarningThe following command will overwrite the current boot loader. Do not run the command if this is not desired, for example, if using a third party boot manager to manage the Master Boot Record (MBR). In this scenario, it would make more sense to install GRUB into the “boot sector” of the LFS partition. In this case, this next command would become setup (hd0,3).Tell GRUB to install itself into the MBR of hda:setup (hd0)If all went well, GRUB will have reported finding its files in /boot/grub. That's all there is to it. Quit the grub shell:quitCreate a “menu list” file defining GRUB's boot menu:cat > /boot/grub/menu.lst << "EOF"# Begin /boot/grub/menu.lst# By default boot the first menu entry.default 0# Allow 30 seconds before booting the default.timeout 30# Use prettier colors.color green/black light-green/black# The first entry is for LFS.title LFS 6.1.1root (hd0,3)kernel /boot/lfskernel-2.6.11.12 root=/dev/hda4EOFAdd an entry for the host distribution if desired. It might look like this:cat >> /boot/grub/menu.lst << "EOF"title Red Hatroot (hd0,2)kernel /boot/kernel-2.6.5 root=/dev/hda3initrd /boot/initrd-2.6.5EOFIf dual-booting Windows, the following entry will allow booting it:cat >> /boot/grub/menu.lst << "EOF"title Windowsrootnoverify (hd0,0)chainloader +1EOFIf info grub does not provide all necessary material, additional information regarding GRUB is located on its website at: http://www.gnu.org/software/grub/.The FHS stipulates that GRUB's menu.lst file should be symlinked to /etc/grub/menu.lst. To satisfy this requirement, issue the following command:mkdir -v /etc/grub &&ln -sv /boot/grub/menu.lst /etc/grubChapter 9. The End9.1. The EndWell done! The new LFS system is installed! We wish you much success with your shiny new custom-built Linux system.It may be a good idea to create an /etc/lfs-release file. By having this file, it is very easy for you (and for us if you need to ask for help at some point) to find out which LFS version is installed on the system. Create this file by running:echo 6.1.1 > /etc/lfs-release9.2. Get CountedNow that you have finished the book, do you want to be counted as an LFS user? Head over to http://www.linuxfromscratch.org/cgi-bin/lfscounter.cgi and register as an LFS user by entering your name and the first LFS version you have used.Let's reboot into LFS now.9.3. Rebooting the SystemNow that all of the software has been installed, it is time to reboot your computer. However, you should be aware of a few things. The system you have created in this book is quite minimal, and most likely will not have the functionality you would need to be able to continue forward. By installing a few extra packages from the BLFS book while still in our current chroot environment, youcan leave yourself in a much better position to continue on once you reboot into your new LFS installation. Installing a text mode web browser, such as Lynx, you can easily view the BLFS book in one virtual terminal, while building packages in another. The GPM package will also allow you to perform copy/paste actions in your virtual terminals. Lastly, if you are in a situation wherestatic IP configuration does not meet your networking requirements, installing packages such as Dhcpcd or PPP at this point might also be useful.Now that we have said that, lets move on to booting our shiny new LFS installation for the first time! First exit from the chroot environment:logoutThen unmount the virtual files systems:umount -v $LFS/dev/ptsumount -v $LFS/dev/shmumount -v $LFS/devumount -v $LFS/procumount -v $LFS/sysUnmount the LFS file system itself:umount -v $LFSIf multiple partitions were created, unmount the other partitions before unmounting the main one, like this:umount -v $LFS/usrumount -v $LFS/homeumount -v $LFSNow, reboot the system with:shutdown -r nowAssuming the GRUB boot loader was set up as outlined earlier, the menu is set to boot LFS 6.1.1 automatically.When the reboot is complete, the LFS system is ready for use and more software may be added to suit your needs.9.4. What Now?Thank you for reading this LFS book. We hope that you have found this book helpful and have learned more about the system creation process.Now that the LFS system is installed, you may be wondering “What next?” To answer that question, we have compiled a list of resources for you. Maintenance Bugs and security notices are reported regularly for all software. Since an LFS system is compiled from source, it is up to you to keep abreast of such reports. There are several online resources that track such reports, some of which are shown below: Freshmeat.net (http://freshmeat.net/) Freshmeat can notify you (via email) of new versions of packages installed on your system. CERT (Computer Emergency Response Team) CERT has a mailing list that publishes security alerts concerning various operating systems and applications. Subscription information is available at http://www.us-cert.gov/cas/signup.html. Bugtraq Bugtraq is a full-disclosure computer security mailing list. It publishes newly discovered security issues, and occasionally potential fixes for them. Subscription information is available at http://www.securityfocus.com/archive. Beyond Linux From Scratch The Beyond Linux From Scratch book covers installation procedures for a wide range of software beyond the scope of the LFS Book. The BLFS project is located at http://www.linuxfromscratch.org/blfs/. LFS Hints The LFS Hints are a collection of educational documents submitted by volunteers in the LFS community. The hints are available at http://www.linuxfromscratch.org/hints/list.html. Mailing lists There are several LFS mailing lists you may subscribe to if you are in need of help, want to stay current with the latest developments, want to contribute to the project, and more. See Chapter 1 - Mailing Lists for more information. The Linux Documentation Project The goal of The Linux Documentation Project (TLDP) is to collaborate on all of the issues of Linux documentation. The TLDP features a large collection of HOWTOs, guides, and man pages. It is located at http://www.tldp.org/.Part IV. AppendicesTable of Contents A. Acronyms and Terms B. AcknowledgmentsAppendix A. Acronyms and TermsABI Application Binary InterfaceALFS Automated Linux From ScratchALSA Advanced Linux Sound ArchitectureAPI Application Programming InterfaceASCII American Standard Code for Information InterchangeBIOS Basic Input/Output SystemBLFS Beyond Linux From ScratchBSD Berkeley Software Distributionchroot change rootCMOS Complementary Metal Oxide SemiconductorCOS Class Of ServiceCPU Central Processing UnitCRC Cyclic Redundancy CheckCVS Concurrent Versions SystemDHCP Dynamic Host Configuration ProtocolDNS Domain Name ServiceEGA Enhanced Graphics AdapterELF Executable and Linkable FormatEOF End of FileEQN equationEVMS Enterprise Volume Management Systemext2 second extended file systemFAQ Frequently Asked QuestionsFHS Filesystem Hierarchy StandardFIFO First-In, First OutFQDN Fully Qualified Domain NameFTP File Transfer ProtocolGB GibabytesGCC GNU Compiler CollectionGID Group IdentifierGMT Greenwich Mean TimeGPG GNU Privacy GuardHTML Hypertext Markup LanguageIDE Integrated Drive ElectronicsIEEE Institute of Electrical and Electronic EngineersIO Input/OutputIP Internet ProtocolIPC Inter-Process CommunicationIRC Internet Relay ChatISO International Organization for StandardizationISP Internet Service ProviderKB KilobytesLED Light Emitting DiodeLFS Linux From ScratchLSB Linux Standards BaseMB MegabytesMBR Master Boot RecordMD5 Message Digest 5NIC Network Interface CardNLS Native Language SupportNNTP Network News Transport ProtocolNPTL Native POSIX Threading LibraryOSS Open Sound SystemPCH Pre-Compiled HeadersPCRE Perl Compatible Regular ExpressionPID Process IdentifierPLFS Pure Linux From ScratchPTY pseudo terminalQA Quality AssuranceQOS Quality Of ServiceRAM Random Access MemoryRPC Remote Procedure CallRTC Real Time ClockSBU Standard Build UnitSCO The Santa Cruz OperationSGR Select Graphic RenditionSHA1 Secure-Hash Algorithm 1SMP Symmetric Multi-ProcessorTLDP The Linux Documentation ProjectTFTP Trivial File Transfer ProtocolTLS Thread-Local StorageUID User Identifierumask user file-creation maskUSB Universal Serial BusUTC Coordinated Universal TimeUUID Universally Unique IdentifierVC Virtual ConsoleVGA Video Graphics ArrayVT Virtual TerminalAppendix B. AcknowledgmentsWe would like to thank the following people and organizations for their contributions to the Linux From Scratch Project. Gerard Beekmans – LFS Creator, LFS Project Leader Matthew Burgess – LFS Project Leader, LFS Technical Writer/Editor, LFS Release Manager Archaic – LFS Technical Writer/Editor, HLFS Project Leader, BLFS Editor, Hints and Patches Project Maintainer Nathan Coulson – LFS-Bootscripts Maintainer Bruce Dubbs – BLFS Project Leader Manuel Canales Esparcia – LFS/BLFS/HLFS XML and XSL Maintainer Jim Gifford – LFS Technical Writer, Patches Project Leader Jeremy Huntwork – LFS Technical Writer, LFS LiveCD Maintainer, ALFS Project Leader Anderson Lizardo – Website Backend-Scripts Maintainer Ryan Oliver – LFS Toolchain Maintainer James Robertson – Bugzilla Maintainer Tushar Teredesai – BLFS Book Editor, Hints and Patches Project Leader Countless other people on the various LFS and BLFS mailing lists who helped make this book possible by giving their suggestions, testing the book, and submitting bug reports, instructions, and their experiences with installing various packages.Translators Manuel Canales Esparcia – Spanish LFS translation project Johan Lenglet – French LFS translation project Anderson Lizardo – Portuguese LFS translation project Thomas Reitelbach – German LFS translation projectMirror MaintainersNorth American Mirrors Scott Kveton – lfs.oregonstate.edu mirror Mikhail Pastukhov – lfs.130th.net mirror William Astle – ca.linuxfromscratch.org mirror Jeremy Polen – us2.linuxfromscratch.org mirror Tim Jackson – linuxfromscratch.idge.net mirror Jeremy Utley – lfs.linux-phreak.net mirrorSouth American Mirrors Andres Meggiotto – lfs.mesi.com.ar mirror Manuel Canales Esparcia – lfsmirror.lfs-es.info mirror Eduardo B. Fonseca – br.linuxfromscratch.org mirrorEuropean Mirrors Barna Koczka – hu.linuxfromscratch.org mirror UK Mirror Service – linuxfromscratch.mirror.ac.uk mirror Martin Voss – lfs.linux-matrix.net mirror Guido Passet – nl.linuxfromscratch.org mirror Bastiaan Jacques – lfs.pagefault.net mirror Roel Neefs – linuxfromscratch.rave.org mirror Justin Knierim – www.lfs-matrix.de mirror Stephan Brendel – lfs.netservice-neuss.de mirror Antonin Sprinzl – at.linuxfromscratch.org mirror Fredrik Danerklint – se.linuxfromscratch.org mirror Parisian sysadmins – www2.fr.linuxfromscratch.org mirror Alexander Velin – bg.linuxfromscratch.org mirror Dirk Webster – lfs.securewebservices.co.uk mirror Thomas Skyt – dk.linuxfromscratch.org mirror Simon Nicoll – uk.linuxfromscratch.org mirrorAsian Mirrors Pui Yong – sg.linuxfromscratch.org mirror Stuart Harris – lfs.mirror.intermedia.com.sg mirrorAustralian Mirrors Jason Andrade – au.linuxfromscratch.org mirrorFormer Project Team Members Christine Barczak – LFS Book Editor Timothy Bauscher Robert Briggs Ian Chilton Jeroen Coumans – Website Developer, FAQ Maintainer Alex Groenewoud – LFS Technical Writer Marc Heerdink Mark Hymers Seth W. Klein – FAQ maintainer Nicholas Leippe – Wiki Maintainer Simon Perreault Scot Mc Pherson – LFS NNTP Gateway Maintainer Alexander Patrakov – LFS Technical Writer Greg Schafer – LFS Technical Writer Jesse Tie-Ten-Quee – LFS Technical Writer Jeremy Utley – LFS Technical Writer, Bugzilla Maintainer, LFS-Bootscripts Maintainer Zack Winkles – LFS Technical WriterA very special thank you to our donators Dean Benson for several monetary contributions Hagen Herrschaft for donating a 2.2 GHz P4 system, now running under the name of Lorien VA Software who, on behalf of Linux.com, donated a VA Linux 420 (former StartX SP2) workstation Mark Stone for donating Belgarath, the linuxfromscratch.org serverIndexPackages Autoconf: Autoconf-2.59 Automake: Automake-1.9.5 Bash: Bash-3.0 tools: Bash-3.0 Binutils: Binutils-2.15.94.0.2.2 tools, pass 1: Binutils-2.15.94.0.2.2 - Pass 1 tools, pass 2: Binutils-2.15.94.0.2.2 - Pass 2 Bison: Bison-2.0 tools: Bison-2.0 Bootscripts: LFS-Bootscripts-3.2.1 usage: How Do These Bootscripts Work? Bzip2: Bzip2-1.0.3 tools: Bzip2-1.0.3 Coreutils: Coreutils-5.2.1 tools: Coreutils-5.2.1 DejaGNU: DejaGNU-1.4.4 Diffutils: Diffutils-2.8.1 tools: Diffutils-2.8.1 E2fsprogs: E2fsprogs-1.37 Expect: Expect-5.43.0 File: File-4.13 Findutils: Findutils-4.2.23 tools: Findutils-4.2.23 Flex: Flex-2.5.31 tools: Flex-2.5.31 Gawk: Gawk-3.1.4 tools: Gawk-3.1.4 GCC: GCC-3.4.3 tools, pass 1: GCC-3.4.3 - Pass 1 tools, pass 2: GCC-3.4.3 - Pass 2 Gettext: Gettext-0.14.3 tools: Gettext-0.14.3 Glibc: Glibc-2.3.4 tools: Glibc-2.3.4 Grep: Grep-2.5.1a tools: Grep-2.5.1a Groff: Groff-1.19.1 GRUB: GRUB-0.96 configuring: Making the LFS System Bootable Gzip: Gzip-1.3.5 tools: Gzip-1.3.5 Hotplug: Hotplug-2004_09_23 Iana-Etc: Iana-Etc-1.04 Inetutils: Inetutils-1.4.2 IPRoute2: IPRoute2-2.6.11-050330 Kbd: Kbd-1.12 Less: Less-382 Libtool: Libtool-1.5.14 Linux: Linux-2.6.11.12 Linux-Libc-Headers: Linux-Libc-Headers-2.6.11.2 tools, headers: Linux-Libc-Headers-2.6.11.2 M4: M4-1.4.3 tools: M4-1.4.3 Make: Make-3.80 tools: Make-3.80 Man: Man-1.5p Man-pages: Man-pages-2.01 Mktemp: Mktemp-1.5 Module-Init-Tools: Module-Init-Tools-3.1 Ncurses: Ncurses-5.4 tools: Ncurses-5.4 Patch: Patch-2.5.4 tools: Patch-2.5.4 Perl: Perl-5.8.7 tools: Perl-5.8.7 Procps: Procps-3.2.5 Psmisc: Psmisc-21.6 Readline: Readline-5.0 Sed: Sed-4.1.4 tools: Sed-4.1.4 Shadow: Shadow-4.0.9 configuring: Configuring Shadow Sysklogd: Sysklogd-1.4.1 configuring: Configuring Sysklogd Sysvinit: Sysvinit-2.86 configuring: Configuring Sysvinit Tar: Tar-1.15.1 tools: Tar-1.15.1 Tcl: Tcl-8.4.9 Texinfo: Texinfo-4.8 tools: Texinfo-4.8 Udev: Udev-056 usage: Device and Module Handling on an LFS System Util-linux: Util-linux-2.12q tools: Util-linux-2.12q Vim: Vim-6.3 Zlib: Zlib-1.2.3Programs a2p: Perl-5.8.7 -- description acinstall: Automake-1.9.5 -- description aclocal: Automake-1.9.5 -- description aclocal-1.9.5: Automake-1.9.5 -- description addftinfo: Groff-1.19.1 -- description addr2line: Binutils-2.15.94.0.2.2 -- description afmtodit: Groff-1.19.1 -- description agetty: Util-linux-2.12q -- description apropos: Man-1.5p -- description ar: Binutils-2.15.94.0.2.2 -- description arch: Util-linux-2.12q -- description as: Binutils-2.15.94.0.2.2 -- description autoconf: Autoconf-2.59 -- description autoheader: Autoconf-2.59 -- description autom4te: Autoconf-2.59 -- description automake: Automake-1.9.5 -- description automake-1.9.5: Automake-1.9.5 -- description autopoint: Gettext-0.14.3 -- description autoreconf: Autoconf-2.59 -- description autoscan: Autoconf-2.59 -- description autoupdate: Autoconf-2.59 -- description awk: Gawk-3.1.4 -- description badblocks: E2fsprogs-1.37 -- description basename: Coreutils-5.2.1 -- description bash: Bash-3.0 -- description bashbug: Bash-3.0 -- description bigram: Findutils-4.2.23 -- description bison: Bison-2.0 -- description blkid: E2fsprogs-1.37 -- description blockdev: Util-linux-2.12q -- description bunzip2: Bzip2-1.0.3 -- description bzcat: Bzip2-1.0.3 -- description bzcmp: Bzip2-1.0.3 -- description bzdiff: Bzip2-1.0.3 -- description bzegrep: Bzip2-1.0.3 -- description bzfgrep: Bzip2-1.0.3 -- description bzgrep: Bzip2-1.0.3 -- description bzip2: Bzip2-1.0.3 -- description bzip2recover: Bzip2-1.0.3 -- description bzless: Bzip2-1.0.3 -- description bzmore: Bzip2-1.0.3 -- description c++: GCC-3.4.3 -- description c++filt: Binutils-2.15.94.0.2.2 -- description c2ph: Perl-5.8.7 -- description cal: Util-linux-2.12q -- description captoinfo: Ncurses-5.4 -- description cat: Coreutils-5.2.1 -- description catchsegv: Glibc-2.3.4 -- description cc: GCC-3.4.3 -- description cfdisk: Util-linux-2.12q -- description chage: Shadow-4.0.9 -- description chattr: E2fsprogs-1.37 -- description chfn: Shadow-4.0.9 -- description chgrp: Coreutils-5.2.1 -- description chkdupexe: Util-linux-2.12q -- description chmod: Coreutils-5.2.1 -- description chown: Coreutils-5.2.1 -- description chpasswd: Shadow-4.0.9 -- description chroot: Coreutils-5.2.1 -- description chsh: Shadow-4.0.9 -- description chvt: Kbd-1.12 -- description cksum: Coreutils-5.2.1 -- description clear: Ncurses-5.4 -- description cmp: Diffutils-2.8.1 -- description code: Findutils-4.2.23 -- description col: Util-linux-2.12q -- description colcrt: Util-linux-2.12q -- description colrm: Util-linux-2.12q -- description column: Util-linux-2.12q -- description comm: Coreutils-5.2.1 -- description compile: Automake-1.9.5 -- description compile_et: E2fsprogs-1.37 -- description compress: Gzip-1.3.5 -- description config.charset: Gettext-0.14.3 -- description config.guess: Automake-1.9.5 -- description config.rpath: Gettext-0.14.3 -- description config.sub: Automake-1.9.5 -- description cp: Coreutils-5.2.1 -- description cpp: GCC-3.4.3 -- description csplit: Coreutils-5.2.1 -- description ctrlaltdel: Util-linux-2.12q -- description ctstat: IPRoute2-2.6.11-050330 -- description cut: Coreutils-5.2.1 -- description cytune: Util-linux-2.12q -- description date: Coreutils-5.2.1 -- description dd: Coreutils-5.2.1 -- description ddate: Util-linux-2.12q -- description deallocvt: Kbd-1.12 -- description debugfs: E2fsprogs-1.37 -- description depcomp: Automake-1.9.5 -- description depmod: Module-Init-Tools-3.1 -- description df: Coreutils-5.2.1 -- description diff: Diffutils-2.8.1 -- description diff3: Diffutils-2.8.1 -- description dir: Coreutils-5.2.1 -- description dircolors: Coreutils-5.2.1 -- description dirname: Coreutils-5.2.1 -- description dmesg: Util-linux-2.12q -- description dprofpp: Perl-5.8.7 -- description du: Coreutils-5.2.1 -- description dumpe2fs: E2fsprogs-1.37 -- description dumpkeys: Kbd-1.12 -- description e2fsck: E2fsprogs-1.37 -- description e2image: E2fsprogs-1.37 -- description e2label: E2fsprogs-1.37 -- description echo: Coreutils-5.2.1 -- description efm_filter.pl: Vim-6.3 -- description efm_perl.pl: Vim-6.3 -- description egrep: Grep-2.5.1a -- description elisp-comp: Automake-1.9.5 -- description elvtune: Util-linux-2.12q -- description en2cxs: Perl-5.8.7 -- description env: Coreutils-5.2.1 -- description envsubst: Gettext-0.14.3 -- description eqn: Groff-1.19.1 -- description eqn2graph: Groff-1.19.1 -- description ex: Vim-6.3 -- description expand: Coreutils-5.2.1 -- description expect: Expect-5.43.0 -- description expiry: Shadow-4.0.9 -- description expr: Coreutils-5.2.1 -- description factor: Coreutils-5.2.1 -- description faillog: Shadow-4.0.9 -- description false: Coreutils-5.2.1 -- description fdformat: Util-linux-2.12q -- description fdisk: Util-linux-2.12q -- description fgconsole: Kbd-1.12 -- description fgrep: Grep-2.5.1a -- description file: File-4.13 -- description find: Findutils-4.2.23 -- description find2perl: Perl-5.8.7 -- description findfs: E2fsprogs-1.37 -- description flex: Flex-2.5.31 -- description fmt: Coreutils-5.2.1 -- description fold: Coreutils-5.2.1 -- description frcode: Findutils-4.2.23 -- description free: Procps-3.2.5 -- description fsck: E2fsprogs-1.37 -- description fsck.cramfs: Util-linux-2.12q -- description fsck.ext2: E2fsprogs-1.37 -- description fsck.ext3: E2fsprogs-1.37 -- description fsck.minix: Util-linux-2.12q -- description ftp: Inetutils-1.4.2 -- description fuser: Psmisc-21.6 -- description g++: GCC-3.4.3 -- description gawk: Gawk-3.1.4 -- description gawk-3.1.4: Gawk-3.1.4 -- description gcc: GCC-3.4.3 -- description gccbug: GCC-3.4.3 -- description gcov: GCC-3.4.3 -- description gencat: Glibc-2.3.4 -- description geqn: Groff-1.19.1 -- description getconf: Glibc-2.3.4 -- description getent: Glibc-2.3.4 -- description getkeycodes: Kbd-1.12 -- description getopt: Util-linux-2.12q -- description gettext: Gettext-0.14.3 -- description gettextize: Gettext-0.14.3 -- description getunimap: Kbd-1.12 -- description gpasswd: Shadow-4.0.9 -- description gprof: Binutils-2.15.94.0.2.2 -- description grcat: Gawk-3.1.4 -- description grep: Grep-2.5.1a -- description grn: Groff-1.19.1 -- description grodvi: Groff-1.19.1 -- description groff: Groff-1.19.1 -- description groffer: Groff-1.19.1 -- description grog: Groff-1.19.1 -- description grolbp: Groff-1.19.1 -- description grolj4: Groff-1.19.1 -- description grops: Groff-1.19.1 -- description grotty: Groff-1.19.1 -- description groupadd: Shadow-4.0.9 -- description groupdel: Shadow-4.0.9 -- description groupmod: Shadow-4.0.9 -- description groups: Coreutils-5.2.1 -- description grpck: Shadow-4.0.9 -- description grpconv: Shadow-4.0.9 -- description grpunconv: Shadow-4.0.9 -- description grub: GRUB-0.96 -- description grub-install: GRUB-0.96 -- description grub-md5-crypt: GRUB-0.96 -- description grub-terminfo: GRUB-0.96 -- description gtbl: Groff-1.19.1 -- description gunzip: Gzip-1.3.5 -- description gzexe: Gzip-1.3.5 -- description gzip: Gzip-1.3.5 -- description h2ph: Perl-5.8.7 -- description h2xs: Perl-5.8.7 -- description halt: Sysvinit-2.86 -- description head: Coreutils-5.2.1 -- description hexdump: Util-linux-2.12q -- description hostid: Coreutils-5.2.1 -- description hostname: Coreutils-5.2.1 -- description hostname: Gettext-0.14.3 -- description hotplug: Hotplug-2004_09_23 -- description hpftodit: Groff-1.19.1 -- description hwclock: Util-linux-2.12q -- description iconv: Glibc-2.3.4 -- description iconvconfig: Glibc-2.3.4 -- description id: Coreutils-5.2.1 -- description ifcfg: IPRoute2-2.6.11-050330 -- description ifnames: Autoconf-2.59 -- description ifstat: IPRoute2-2.6.11-050330 -- description igawk: Gawk-3.1.4 -- description indxbib: Groff-1.19.1 -- description info: Texinfo-4.8 -- description infocmp: Ncurses-5.4 -- description infokey: Texinfo-4.8 -- description infotocap: Ncurses-5.4 -- description init: Sysvinit-2.86 -- description insmod: Module-Init-Tools-3.1 -- description insmod.static: Module-Init-Tools-3.1 -- description install: Coreutils-5.2.1 -- description install-info: Texinfo-4.8 -- description install-sh: Automake-1.9.5 -- description ip: IPRoute2-2.6.11-050330 -- description ipcrm: Util-linux-2.12q -- description ipcs: Util-linux-2.12q -- description isosize: Util-linux-2.12q -- description join: Coreutils-5.2.1 -- description kbdrate: Kbd-1.12 -- description kbd_mode: Kbd-1.12 -- description kill: Procps-3.2.5 -- description killall: Psmisc-21.6 -- description killall5: Sysvinit-2.86 -- description klogd: Sysklogd-1.4.1 -- description last: Sysvinit-2.86 -- description lastb: Sysvinit-2.86 -- description lastlog: Shadow-4.0.9 -- description ld: Binutils-2.15.94.0.2.2 -- description ldconfig: Glibc-2.3.4 -- description ldd: Glibc-2.3.4 -- description lddlibc4: Glibc-2.3.4 -- description less: Less-382 -- description less.sh: Vim-6.3 -- description lessecho: Less-382 -- description lesskey: Less-382 -- description lex: Flex-2.5.31 -- description lfskernel-2.6.11.12: Linux-2.6.11.12 -- description libnetcfg: Perl-5.8.7 -- description libtool: Libtool-1.5.14 -- description libtoolize: Libtool-1.5.14 -- description line: Util-linux-2.12q -- description link: Coreutils-5.2.1 -- description lkbib: Groff-1.19.1 -- description ln: Coreutils-5.2.1 -- description lnstat: IPRoute2-2.6.11-050330 -- description loadkeys: Kbd-1.12 -- description loadunimap: Kbd-1.12 -- description locale: Glibc-2.3.4 -- description localedef: Glibc-2.3.4 -- description locate: Findutils-4.2.23 -- description logger: Util-linux-2.12q -- description login: Shadow-4.0.9 -- description logname: Coreutils-5.2.1 -- description logoutd: Shadow-4.0.9 -- description logsave: E2fsprogs-1.37 -- description look: Util-linux-2.12q -- description lookbib: Groff-1.19.1 -- description losetup: Util-linux-2.12q -- description ls: Coreutils-5.2.1 -- description lsattr: E2fsprogs-1.37 -- description lsmod: Module-Init-Tools-3.1 -- description m4: M4-1.4.3 -- description make: Make-3.80 -- description makeinfo: Texinfo-4.8 -- description makewhatis: Man-1.5p -- description man: Man-1.5p -- description man2dvi: Man-1.5p -- description man2html: Man-1.5p -- description mapscrn: Kbd-1.12 -- description mbchk: GRUB-0.96 -- description mcookie: Util-linux-2.12q -- description md5sum: Coreutils-5.2.1 -- description mdate-sh: Automake-1.9.5 -- description mesg: Sysvinit-2.86 -- description missing: Automake-1.9.5 -- description mkdir: Coreutils-5.2.1 -- description mke2fs: E2fsprogs-1.37 -- description mkfifo: Coreutils-5.2.1 -- description mkfs: Util-linux-2.12q -- description mkfs.bfs: Util-linux-2.12q -- description mkfs.cramfs: Util-linux-2.12q -- description mkfs.ext2: E2fsprogs-1.37 -- description mkfs.ext3: E2fsprogs-1.37 -- description mkfs.minix: Util-linux-2.12q -- description mkinstalldirs: Automake-1.9.5 -- description mklost+found: E2fsprogs-1.37 -- description mknod: Coreutils-5.2.1 -- description mkpasswd: Shadow-4.0.9 -- description mkswap: Util-linux-2.12q -- description mktemp: Mktemp-1.5 -- description mk_cmds: E2fsprogs-1.37 -- description mmroff: Groff-1.19.1 -- description modinfo: Module-Init-Tools-3.1 -- description modprobe: Module-Init-Tools-3.1 -- description more: Util-linux-2.12q -- description mount: Util-linux-2.12q -- description mountpoint: Sysvinit-2.86 -- description msgattrib: Gettext-0.14.3 -- description msgcat: Gettext-0.14.3 -- description msgcmp: Gettext-0.14.3 -- description msgcomm: Gettext-0.14.3 -- description msgconv: Gettext-0.14.3 -- description msgen: Gettext-0.14.3 -- description msgexec: Gettext-0.14.3 -- description msgfilter: Gettext-0.14.3 -- description msgfmt: Gettext-0.14.3 -- description msggrep: Gettext-0.14.3 -- description msginit: Gettext-0.14.3 -- description msgmerge: Gettext-0.14.3 -- description msgunfmt: Gettext-0.14.3 -- description msguniq: Gettext-0.14.3 -- description mtrace: Glibc-2.3.4 -- description mv: Coreutils-5.2.1 -- description mve.awk: Vim-6.3 -- description namei: Util-linux-2.12q -- description neqn: Groff-1.19.1 -- description newgrp: Shadow-4.0.9 -- description newusers: Shadow-4.0.9 -- description ngettext: Gettext-0.14.3 -- description nice: Coreutils-5.2.1 -- description nl: Coreutils-5.2.1 -- description nm: Binutils-2.15.94.0.2.2 -- description nohup: Coreutils-5.2.1 -- description nroff: Groff-1.19.1 -- description nscd: Glibc-2.3.4 -- description nscd_nischeck: Glibc-2.3.4 -- description nstat: IPRoute2-2.6.11-050330 -- description objcopy: Binutils-2.15.94.0.2.2 -- description objdump: Binutils-2.15.94.0.2.2 -- description od: Coreutils-5.2.1 -- description openvt: Kbd-1.12 -- description passwd: Shadow-4.0.9 -- description paste: Coreutils-5.2.1 -- description patch: Patch-2.5.4 -- description pathchk: Coreutils-5.2.1 -- description pcprofiledump: Glibc-2.3.4 -- description perl: Perl-5.8.7 -- description perl5.8.7: Perl-5.8.7 -- description perlbug: Perl-5.8.7 -- description perlcc: Perl-5.8.7 -- description perldoc: Perl-5.8.7 -- description perlivp: Perl-5.8.7 -- description pfbtops: Groff-1.19.1 -- description pg: Util-linux-2.12q -- description pgawk: Gawk-3.1.4 -- description pgawk-3.1.4: Gawk-3.1.4 -- description pgrep: Procps-3.2.5 -- description pic: Groff-1.19.1 -- description pic2graph: Groff-1.19.1 -- description piconv: Perl-5.8.7 -- description pidof: Sysvinit-2.86 -- description ping: Inetutils-1.4.2 -- description pinky: Coreutils-5.2.1 -- description pivot_root: Util-linux-2.12q -- description pkill: Procps-3.2.5 -- description pl2pm: Perl-5.8.7 -- description pltags.pl: Vim-6.3 -- description pmap: Procps-3.2.5 -- description pod2html: Perl-5.8.7 -- description pod2latex: Perl-5.8.7 -- description pod2man: Perl-5.8.7 -- description pod2text: Perl-5.8.7 -- description pod2usage: Perl-5.8.7 -- description podchecker: Perl-5.8.7 -- description podselect: Perl-5.8.7 -- description post-grohtml: Groff-1.19.1 -- description poweroff: Sysvinit-2.86 -- description pr: Coreutils-5.2.1 -- description pre-grohtml: Groff-1.19.1 -- description printenv: Coreutils-5.2.1 -- description printf: Coreutils-5.2.1 -- description ps: Procps-3.2.5 -- description psed: Perl-5.8.7 -- description psfaddtable: Kbd-1.12 -- description psfgettable: Kbd-1.12 -- description psfstriptable: Kbd-1.12 -- description psfxtable: Kbd-1.12 -- description pstree: Psmisc-21.6 -- description pstree.x11: Psmisc-21.6 -- description pstruct: Perl-5.8.7 -- description ptx: Coreutils-5.2.1 -- description pt_chown: Glibc-2.3.4 -- description pwcat: Gawk-3.1.4 -- description pwck: Shadow-4.0.9 -- description pwconv: Shadow-4.0.9 -- description pwd: Coreutils-5.2.1 -- description pwunconv: Shadow-4.0.9 -- description py-compile: Automake-1.9.5 -- description ramsize: Util-linux-2.12q -- description ranlib: Binutils-2.15.94.0.2.2 -- description raw: Util-linux-2.12q -- description rcp: Inetutils-1.4.2 -- description rdev: Util-linux-2.12q -- description readelf: Binutils-2.15.94.0.2.2 -- description readlink: Coreutils-5.2.1 -- description readprofile: Util-linux-2.12q -- description reboot: Sysvinit-2.86 -- description ref: Vim-6.3 -- description refer: Groff-1.19.1 -- description rename: Util-linux-2.12q -- description renice: Util-linux-2.12q -- description reset: Ncurses-5.4 -- description resize2fs: E2fsprogs-1.37 -- description resizecons: Kbd-1.12 -- description rev: Util-linux-2.12q -- description rlogin: Inetutils-1.4.2 -- description rm: Coreutils-5.2.1 -- description rmdir: Coreutils-5.2.1 -- description rmmod: Module-Init-Tools-3.1 -- description rmt: Tar-1.15.1 -- description rootflags: Util-linux-2.12q -- description routef: IPRoute2-2.6.11-050330 -- description routel: IPRoute2-2.6.11-050330 -- description rpcgen: Glibc-2.3.4 -- description rpcinfo: Glibc-2.3.4 -- description rsh: Inetutils-1.4.2 -- description rtacct: IPRoute2-2.6.11-050330 -- description rtmon: IPRoute2-2.6.11-050330 -- description rtpr: IPRoute2-2.6.11-050330 -- description rtstat: IPRoute2-2.6.11-050330 -- description runlevel: Sysvinit-2.86 -- description runtest: DejaGNU-1.4.4 -- description rview: Vim-6.3 -- description rvim: Vim-6.3 -- description s2p: Perl-5.8.7 -- description script: Util-linux-2.12q -- description sdiff: Diffutils-2.8.1 -- description sed: Sed-4.1.4 -- description seq: Coreutils-5.2.1 -- description setfdprm: Util-linux-2.12q -- description setfont: Kbd-1.12 -- description setkeycodes: Kbd-1.12 -- description setleds: Kbd-1.12 -- description setlogcons: Kbd-1.12 -- description setmetamode: Kbd-1.12 -- description setsid: Util-linux-2.12q -- description setterm: Util-linux-2.12q -- description setvesablank: Kbd-1.12 -- description sfdisk: Util-linux-2.12q -- description sg: Shadow-4.0.9 -- description sh: Bash-3.0 -- description sha1sum: Coreutils-5.2.1 -- description showconsolefont: Kbd-1.12 -- description showkey: Kbd-1.12 -- description shred: Coreutils-5.2.1 -- description shtags.pl: Vim-6.3 -- description shutdown: Sysvinit-2.86 -- description size: Binutils-2.15.94.0.2.2 -- description skill: Procps-3.2.5 -- description sleep: Coreutils-5.2.1 -- description sln: Glibc-2.3.4 -- description snice: Procps-3.2.5 -- description soelim: Groff-1.19.1 -- description sort: Coreutils-5.2.1 -- description splain: Perl-5.8.7 -- description split: Coreutils-5.2.1 -- description sprof: Glibc-2.3.4 -- description ss: IPRoute2-2.6.11-050330 -- description stat: Coreutils-5.2.1 -- description strings: Binutils-2.15.94.0.2.2 -- description strip: Binutils-2.15.94.0.2.2 -- description stty: Coreutils-5.2.1 -- description su: Shadow-4.0.9 -- description sulogin: Sysvinit-2.86 -- description sum: Coreutils-5.2.1 -- description swapdev: Util-linux-2.12q -- description swapoff: Util-linux-2.12q -- description swapon: Util-linux-2.12q -- description symlink-tree: Automake-1.9.5 -- description sync: Coreutils-5.2.1 -- description sysctl: Procps-3.2.5 -- description syslogd: Sysklogd-1.4.1 -- description tac: Coreutils-5.2.1 -- description tack: Ncurses-5.4 -- description tail: Coreutils-5.2.1 -- description talk: Inetutils-1.4.2 -- description tar: Tar-1.15.1 -- description tbl: Groff-1.19.1 -- description tc: IPRoute2-2.6.11-050330 -- description tclsh: Tcl-8.4.9 -- description tclsh8.4: Tcl-8.4.9 -- description tcltags: Vim-6.3 -- description tee: Coreutils-5.2.1 -- description telinit: Sysvinit-2.86 -- description telnet: Inetutils-1.4.2 -- description tempfile: Mktemp-1.5 -- description test: Coreutils-5.2.1 -- description texi2dvi: Texinfo-4.8 -- description texi2pdf: Texinfo-4.8 -- description texindex: Texinfo-4.8 -- description tfmtodit: Groff-1.19.1 -- description tftp: Inetutils-1.4.2 -- description tic: Ncurses-5.4 -- description tload: Procps-3.2.5 -- description toe: Ncurses-5.4 -- description top: Procps-3.2.5 -- description touch: Coreutils-5.2.1 -- description tput: Ncurses-5.4 -- description tr: Coreutils-5.2.1 -- description troff: Groff-1.19.1 -- description true: Coreutils-5.2.1 -- description tset: Ncurses-5.4 -- description tsort: Coreutils-5.2.1 -- description tty: Coreutils-5.2.1 -- description tune2fs: E2fsprogs-1.37 -- description tunelp: Util-linux-2.12q -- description tzselect: Glibc-2.3.4 -- description udev: Udev-056 -- description udevd: Udev-056 -- description udevinfo: Udev-056 -- description udevsend: Udev-056 -- description udevstart: Udev-056 -- description udevtest: Udev-056 -- description ul: Util-linux-2.12q -- description umount: Util-linux-2.12q -- description uname: Coreutils-5.2.1 -- description uncompress: Gzip-1.3.5 -- description unexpand: Coreutils-5.2.1 -- description unicode_start: Kbd-1.12 -- description unicode_stop: Kbd-1.12 -- description uniq: Coreutils-5.2.1 -- description unlink: Coreutils-5.2.1 -- description updatedb: Findutils-4.2.23 -- description uptime: Procps-3.2.5 -- description useradd: Shadow-4.0.9 -- description userdel: Shadow-4.0.9 -- description usermod: Shadow-4.0.9 -- description users: Coreutils-5.2.1 -- description utmpdump: Sysvinit-2.86 -- description uuidgen: E2fsprogs-1.37 -- description vdir: Coreutils-5.2.1 -- description vi: Vim-6.3 -- description vidmode: Util-linux-2.12q -- description view: Vim-6.3 -- description vigr: Shadow-4.0.9 -- description vim: Vim-6.3 -- description vim132: Vim-6.3 -- description vim2html.pl: Vim-6.3 -- description vimdiff: Vim-6.3 -- description vimm: Vim-6.3 -- description vimspell.sh: Vim-6.3 -- description vimtutor: Vim-6.3 -- description vipw: Shadow-4.0.9 -- description vmstat: Procps-3.2.5 -- description w: Procps-3.2.5 -- description wall: Sysvinit-2.86 -- description watch: Procps-3.2.5 -- description wc: Coreutils-5.2.1 -- description whatis: Man-1.5p -- description whereis: Util-linux-2.12q -- description who: Coreutils-5.2.1 -- description whoami: Coreutils-5.2.1 -- description write: Util-linux-2.12q -- description xargs: Findutils-4.2.23 -- description xgettext: Gettext-0.14.3 -- description xsubpp: Perl-5.8.7 -- description xtrace: Glibc-2.3.4 -- description xxd: Vim-6.3 -- description yacc: Bison-2.0 -- description yes: Coreutils-5.2.1 -- description ylwrap: Automake-1.9.5 -- description zcat: Gzip-1.3.5 -- description zcmp: Gzip-1.3.5 -- description zdiff: Gzip-1.3.5 -- description zdump: Glibc-2.3.4 -- description zegrep: Gzip-1.3.5 -- description zfgrep: Gzip-1.3.5 -- description zforce: Gzip-1.3.5 -- description zgrep: Gzip-1.3.5 -- description zic: Glibc-2.3.4 -- description zless: Gzip-1.3.5 -- description zmore: Gzip-1.3.5 -- description znew: Gzip-1.3.5 -- description zsoelim: Groff-1.19.1 -- descriptionLibraries ld.so: Glibc-2.3.4 -- description libanl: Glibc-2.3.4 -- description libasprintf: Gettext-0.14.3 -- description libbfd: Binutils-2.15.94.0.2.2 -- description libblkid: E2fsprogs-1.37 -- description libBrokenLocale: Glibc-2.3.4 -- description libbsd-compat: Glibc-2.3.4 -- description libbz2*: Bzip2-1.0.3 -- description libc: Glibc-2.3.4 -- description libcom_err: E2fsprogs-1.37 -- description libcrypt: Glibc-2.3.4 -- description libcurses: Ncurses-5.4 -- description libdl: Glibc-2.3.4 -- description libe2p: E2fsprogs-1.37 -- description libexpect-5.43: Expect-5.43.0 -- description libext2fs: E2fsprogs-1.37 -- description libfl.a: Flex-2.5.31 -- description libform: Ncurses-5.4 -- description libg: Glibc-2.3.4 -- description libgcc*: GCC-3.4.3 -- description libgettextlib: Gettext-0.14.3 -- description libgettextpo: Gettext-0.14.3 -- description libgettextsrc: Gettext-0.14.3 -- description libhistory: Readline-5.0 -- description libiberty: Binutils-2.15.94.0.2.2 -- description libieee: Glibc-2.3.4 -- description libltdl: Libtool-1.5.14 -- description libm: Glibc-2.3.4 -- description libmagic: File-4.13 -- description libmcheck: Glibc-2.3.4 -- description libmemusage: Glibc-2.3.4 -- description libmenu: Ncurses-5.4 -- description libncurses: Ncurses-5.4 -- description libnsl: Glibc-2.3.4 -- description libnss: Glibc-2.3.4 -- description libopcodes: Binutils-2.15.94.0.2.2 -- description libpanel: Ncurses-5.4 -- description libpcprofile: Glibc-2.3.4 -- description libproc: Procps-3.2.5 -- description libpthread: Glibc-2.3.4 -- description libreadline: Readline-5.0 -- description libresolv: Glibc-2.3.4 -- description librpcsvc: Glibc-2.3.4 -- description librt: Glibc-2.3.4 -- description libSegFault: Glibc-2.3.4 -- description libshadow: Shadow-4.0.9 -- description libss: E2fsprogs-1.37 -- description libstdc++: GCC-3.4.3 -- description libsupc++: GCC-3.4.3 -- description libtcl8.4.so: Tcl-8.4.9 -- description libthread_db: Glibc-2.3.4 -- description libutil: Glibc-2.3.4 -- description libuuid: E2fsprogs-1.37 -- description liby.a: Bison-2.0 -- description libz: Zlib-1.2.3 -- descriptionScripts /etc/hotplug/*.agent: Hotplug-2004_09_23 -- description /etc/hotplug/*.rc: Hotplug-2004_09_23 -- description checkfs: LFS-Bootscripts-3.2.1 -- description cleanfs: LFS-Bootscripts-3.2.1 -- description console: LFS-Bootscripts-3.2.1 -- description configuring: Configuring the Linux Console functions: LFS-Bootscripts-3.2.1 -- description halt: LFS-Bootscripts-3.2.1 -- description hotplug: LFS-Bootscripts-3.2.1 -- description ifdown: LFS-Bootscripts-3.2.1 -- description ifup: LFS-Bootscripts-3.2.1 -- description localnet: LFS-Bootscripts-3.2.1 -- description /etc/hosts: Creating the /etc/hosts File configuring: Configuring the localnet Script mountfs: LFS-Bootscripts-3.2.1 -- description mountkernfs: LFS-Bootscripts-3.2.1 -- description network: LFS-Bootscripts-3.2.1 -- description /etc/hosts: Creating the /etc/hosts File configuring: Configuring the network Script rc: LFS-Bootscripts-3.2.1 -- description reboot: LFS-Bootscripts-3.2.1 -- description sendsignals: LFS-Bootscripts-3.2.1 -- description setclock: LFS-Bootscripts-3.2.1 -- description configuring: Configuring the setclock Script static: LFS-Bootscripts-3.2.1 -- description swap: LFS-Bootscripts-3.2.1 -- description sysklogd: LFS-Bootscripts-3.2.1 -- description configuring: Configuring the sysklogd script template: LFS-Bootscripts-3.2.1 -- description udev: LFS-Bootscripts-3.2.1 -- descriptionOthers /boot/config-2.6.11.12: Linux-2.6.11.12 -- description /boot/System.map-2.6.11.12: Linux-2.6.11.12 -- description /dev/*: Populating /dev /etc/fstab: Creating the /etc/fstab File /etc/group: Creating the passwd, group, and log Files /etc/hosts: Creating the /etc/hosts File /etc/hotplug.d: Hotplug-2004_09_23 -- description /etc/hotplug/blacklist: Hotplug-2004_09_23 -- description /etc/hotplug/hotplug.functions: Hotplug-2004_09_23 -- description /etc/hotplug/usb.usermap: Hotplug-2004_09_23 -- description /etc/hotplug/{pci,usb}: Hotplug-2004_09_23 -- description /etc/inittab: Configuring Sysvinit /etc/inputrc: Creating the /etc/inputrc File /etc/ld.so.conf: Configuring Dynamic Loader /etc/lfs-release: The End /etc/limits: Installation of Shadow /etc/localtime: Configuring Glibc /etc/login.access: Installation of Shadow /etc/login.defs: Installation of Shadow /etc/nsswitch.conf: Configuring Glibc /etc/passwd: Creating the passwd, group, and log Files /etc/profile: The Bash Shell Startup Files /etc/protocols: Iana-Etc-1.04 /etc/resolv.conf: Creating the /etc/resolv.conf File /etc/services: Iana-Etc-1.04 /etc/syslog.conf: Configuring Sysklogd /etc/udev: Udev-056 -- description /etc/vim: Configuring Vim /lib/firmware: Hotplug-2004_09_23 -- description /usr/include/{asm,linux}/*.h: Linux-Libc-Headers-2.6.11.2 -- description /var/log/btmp: Creating the passwd, group, and log Files /var/log/hotplug/events: Hotplug-2004_09_23 -- description /var/log/lastlog: Creating the passwd, group, and log Files /var/log/wtmp: Creating the passwd, group, and log Files /var/run/utmp: Creating the passwd, group, and log Files man pages: Man-pages-2.01 -- description