Details on this package are located in Section 10.40.2, “Contents of File.”
Copyright © 2005–2014 Joe Ciccone, Jim Gifford & Ryan Oliver
Copyright © 2005-2014, Joe Ciccone, Jim Gifford, & Ryan Oliver
All rights reserved.
This material may be distributed only subject to the terms and conditions set forth in the Open Publication License v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/).
Linux® is a registered trademark of Linus Torvalds.
This book is based on the "Linux From Scratch" book, that was released under the following license:
Copyright © 1999–2014, Gerard Beekmans
All 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” project
THIS 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.
The Linux From Scratch Project has seen many changes in the few years of its existence. I personally became involved with the project in 1999, around the time of the 2.x releases. At that time, the build process was to create static binaries with the host system, then chroot and build the final binaries on top of the static ones.
Later came the use of the /static directory to hold the initial static builds, keeping them separated from the final system, then the PureLFS process developed by Ryan Oliver and Greg Schafer, introducing a new toolchain build process that divorces even our initial builds from the host. Finally, LFS 6 brought Linux Kernel 2.6, the udev dynamic device structure, sanitized kernel headers, and other improvements to the Linux From Scratch system.
The one "flaw" in LFS is that it has always been based on an x86 class processor. With the advent of the Athlon 64 and Intel EM64T processors, the x86-only LFS is no longer ideal. Throughout this time, Ryan Oliver developed and documented a process by which you could build Linux for any system and from any system, by use of cross-compilation techniques. Thus, the Cross-Compiled LFS (CLFS) was born.
CLFS follows the same guiding principles the LFS project has always followed, e.g., knowing your system inside and out by virtue of having built the system yourself. Additionally, during a CLFS build, you will learn advanced techniques such as cross-build toolchains, multilib support (32 & 64-bit libraries side-by-side), alternative architectures such as Sparc, MIPS, and much more.
We hope you enjoy building your own CLFS system, and the benefits that come from a system tailored to your needs.
--
Jeremy Utley, CLFS 1.x Release Manager (Page Author)
Jonathan Norman, Release Manager
Jim Gifford, CLFS Project Co-leader
Ryan Oliver, CLFS Project Co-leader
Joe Ciccone, CLFS Project Co-leader
Jonathan Norman, Justin Knierim, Chris Staub, Matt Darcy, Ken Moffat,
Manuel Canales Esparcia, Nathan Coulson and William Harrington - CLFS Developers
There 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 the existence of CLFS is to help people understand how a Linux system works. Building an CLFS system helps demonstrate what makes Linux tick, and how things work together and depend on each other. One of the best things this learning experience provides is the ability to customize Linux to your own tastes and needs.
A key benefit of CLFS is that it allows users to have more control over their system without any reliance on a Linux implementation designed by someone else. With CLFS, 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 CLFS 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 CPU cycles. It is not difficult to build an CLFS system of less than 100 megabytes (MB), which is substantially smaller than the majority of existing installations. Does this still sound like a lot of space? A few of us have been working on creating a very small embedded CLFS 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 benefits of 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. CLFS, on the other hand, does not give you a hamburger. Rather, CLFS 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 of the 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 CLFS with a finished house. CLFS provides the skeletal plan of a house, but it is up to you to build it. CLFS maintains the freedom to adjust plans throughout the process, customizing it to the needs and preferences of the user.
Security is an additional advantage of a custom built Linux system. 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 the new binary package was built correctly and adequately fixes the problem.
The goal of Cross 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 The Linux 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 and learn along the way, this book is your best choice.
There are too many good reasons to build your own CLFS system to list them all here. This section is only the tip of the iceberg. As you continue in your CLFS experience, you will find the power that information and knowledge truly bring.
Building a CLFS 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, and change the current directory. It is also expected that the reader has a reasonable knowledge of using and installing Linux software. A basic knowledge of the architectures being used in the Cross LFS process and the host operating systems in use is also required.
Because the CLFS book assumes at least this basic level of skill, the various CLFS support forums are unlikely to be able to provide you with much assistance in these areas. Your questions regarding such basic knowledge will likely go unanswered, or you will be referred to the CLFS essential pre-reading list.
Before building a CLFS 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.tldp.org/pub/Linux/docs/ldp-archived/users-guide/
This guide covers the usage of assorted Linux software.
The Essential Pre-Reading Hint http://hints.cross-lfs.org/index.php/Essential_Prereading
This is a 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 CLFS should have an understanding of many of the topics in this hint.
You should be able to build a CLFS system from just about any Unix-type operating system. Your host system should have the following software with the minimum versions indicated. Also note that many distributions will place software headers into separate packages, often in the form of “[package-name]-devel” or “[package-name]-dev”. Be sure to install those if your distribution provides them.
Bash-2.05a
Binutils-2.12 (Versions greater than 2.24 are not recommended as they have not been tested)
Bison-1.875
Bzip2-1.0.2
Coreutils-5.0
Diffutils-2.8
Findutils-4.1.20
Gawk-3.1.5
GCC-4.1.2 and the C++ compiler, g++ (Versions greater than 4.8.3 are not recommended as they have not been tested)
Glibc-2.2.5 (Versions greater than 2.19 are not recommended as they have not been tested)
Grep-2.5
Gzip-1.2.4
Make-3.80
Ncurses-5.3
Patch-2.5.4
Sed-3.0.2
Tar-1.22
Texinfo-4.7
XZ Utils-4.999.8beta
To see whether your host system has all the appropriate versions, create and run the following script. Read the output carefully for any errors, and make sure to install any packages that are reported as not found.
cat > version-check.sh << "EOF"
#!/bin/bash
# Simple script to list version numbers of critical development tools
bash --version | head -n1 | cut -d" " -f2-4
echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
bison --version | head -n1
bzip2 --version 2>&1 < /dev/null | head -n1 | cut -d" " -f1,6-
echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
diff --version | head -n1
find --version | head -n1
gawk --version | head -n1
gcc --version | head -n1
g++ --version | head -n1
ldd $(which ${SHELL}) | grep libc.so | cut -d ' ' -f 3 | ${SHELL} | head -n 1 | cut -d ' ' -f 1-7
grep --version | head -n1
gzip --version | head -n1
make --version | head -n1
tic -V
patch --version | head -n1
sed --version | head -n1
tar --version | head -n1
makeinfo --version | head -n1
xz --version | head -n1
echo 'main(){}' | gcc -v -o /dev/null -x c - > dummy.log 2>&1
if ! grep -q ' error' dummy.log; then
echo "Compilation successful" && rm dummy.log
else
echo 1>&2 "Compilation FAILED - more development packages may need to be \
installed. If you like, you can also view dummy.log for more details."
fi
EOF
bash version-check.sh 2>errors.log &&
[ -s errors.log ] && echo -e "\nThe following packages could not be found:\n$(cat errors.log)"
To 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 Cross-Compiled Linux From Scratch.
./configure --prefix=/usr
This 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/clfs/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
.
Emphasis
This form of text is used for several purposes in the book. Its main purpose is to emphasize important points or items.
This format is used for hyperlinks, both within the CLFS community and to external pages. It includes HOWTOs, download locations, and websites.
cat > ${CLFS}/etc/group << "EOF"
root:x:0:
bin:x:1:
......
EOF
This format is used when creating configuration files. The first
command tells the system to create the file ${CLFS}/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
CLFS 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 different information 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 have
duplicate page names in different sections. Therefore,
man [program name]
is
generally sufficient.
This book is divided into the following parts.
Part I explains a few important notes on how to proceed with the Cross-LFS installation. This section also provides meta-information about the book.
Part II describes how to prepare for the building process—making a partition and downloading the packages.
Part III shows you how to make a set of Cross-Compiler tools. These tools can run on your host system but allow you to build packages that will run on your target system.
Part IV explains how to build a tool chain designed to operate on your target system. These are the tools that will allow you to build a working system on your target computer.
Part V guides the reader through the building of the CLFS 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.
The appendices contain information that doesn't really fit anywhere else in the book. Appendix A contains definitions of acronyms and terms used in the book; Appendices B and C have information about package dependencies and the build order. Some architectures may have additional appendices for arch-specific issues.
The software used to create a CLFS system is constantly being updated and enhanced. Security warnings and bug fixes may become available after the CLFS book has been released. Some host systems may also have problems building CLFS. To check whether the package versions or instructions in this release of CLFS need any modifications to accommodate security vulnerabilities, other bug fixes, or host-specific issues, please visit http://trac.cross-lfs.org/wiki/errata 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 CLFS system.
The CLFS team would like to acknowledge people who have assisted in making the book what it is today.
Our Leaders:
William Harrington - Lead Developer.
Jonathan Norman - x86, x86_64, PowerPC & UltraSPARC builds, Release Manager 2.x Series
Chris Staub - x86 and x86_64 builds. Leader of Quality Control.
Our CLFS Team:
Matt Darcy - x86, X86_64, and Sparc builds.
Manuel Canales Esparcia - Book XML.
Justin Knierim - Website Architect.
Ken Moffat - PowerPC and X86_64 builds. Developer of Pure 64 Hint.
Outside the Development Team
Jürg Billeter - Testing and assisting in the development of the Linux Headers Package
Richard Downing - Testing, typo, and content fixes.
Peter Ennis - Typo and content fixes.
Tony Morgan - Typo and content fixes.
The CLFS team would also like to acknowledge contributions of people from clfs-dev@lists.cross-lfs.org and associated mailing lists who have provided valuable technical and editorial corrections while testing the Cross-LFS book.
G. Moko - Text updates and Typos
Maxim Osipov - MIPS Testing.
Doug Ronne - Various x86_64 fixes.
Theo Schneider - Testing of the Linux Headers Package
Martin Ward - Recommendations for Systemd and the Boot method, among other contributions
William Zhou - Text updates and Typos
Former Team Members
Joe Ciccone - Lead Developer.
Nathan Coulson - Bootscripts.
Jim Gifford - Lead Developer.
Jeremy Huntwork - PowerPC, x86, Sparc builds.
Karen McGuiness - Proofreader.
Ryan Oliver - Build Process Developer.
Alexander E. Patrakov - Udev/Hotplug Integration
Jeremy Utley - Release Manager 1.x Series.
Zack Winkles - Unstable book work.
The Linux From Scratch Project
Gerard Beekmans <gerard AT linuxfromscratch D0T org> – Creator of Linux From Scratch, on which Cross-LFS is based
Thank you all for your support.
The CLFS system will be built by using a previously installed Unix system or Linux distribution (such as Debian, Fedora, openSUSE, or Ubuntu). This existing 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 access these tools.
As an alternative to installing an entire separate distribution onto your machine, you may wish to use a livecd. Most distributions provide a livecd, which provides an environment to which you can add the required tools onto, allowing you to successfully follow the instructions in this book. Remember that if you reboot the livecd you will need to reconfigure the host environment before continuing with your build.
Preparing a New Partition of this book describes how to create a new Linux native partition and file system, the place where the new CLFS system will be compiled and installed. Packages and Patches explains which packages and patches need to be downloaded to build a CLFS system and how to store them on the new file system. Final Preparations discusses the setup for an appropriate working environment. Please read Final Preparations carefully as it explains several important issues the developer should be aware of before beginning to work through Constructing Cross-Compile Tools and beyond.
Constructing Cross-Compile Tools explains the installation of cross-compile tools which will be built on the host but be able to compile programs that run on the target machine. These cross-compile tools will be used to create a temporary, minimal system that will be the basis for building the final CLFS system. Some of these packages are needed to resolve circular dependencies—for example, to compile a compiler, you need a compiler.
The process of building cross-compile tools first involves building and installing all the necessary tools to create a build system for the target machine. With these cross-compiled tools, we eliminate any dependencies on the toolchain from our host distro.
After we build our “Cross-Tools”, we start building a very
minimal working system in /tools
,
using the cross-toolchain in /cross-tools
. Once the temporary system is
finished, we perform a few additional tasks to prepare to enter
this temporary build environment, either by booting or
chrooting into it. For more details about the difference
between these methods, see Section 6.31, “To
Boot or to Chroot?”.
In Installing Basic System Software, after having booted or chrooted into the temporary build environment, the full CLFS system is built.
To finish the installation, several configuration files are created in System Configuration, and the kernel and boot loader are set up in Making the CLFS System Bootable. The End contains information on furthering the CLFS experience beyond this book. After the steps in this book have been implemented, the computer will be ready to reboot into the new CLFS 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 CLFS adventure.
This is version 3.0.0-SYSVINIT of the Cross-Compiled Linux From Scratch book, dated October 18, 2014. 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://trac.cross-lfs.org/.
Below is a list of detailed changes made since the previous release of the book.
Changelog Entries:
18 October 2014
[William Harrington] - CLFS 3.0.0 SYSVINIT released.
26 September 2014
[William Harrington] - Update Bash 4.3 branch update to patch level 30.
[William Harrington] - Update Vim 7.4 branch update to patch level 473.
09 October 2014
[William Harrington] - Update Linux Kernel to 3.14.21.
08 October 2014
[William Harrington] - Update Shadow to 4.2.1.
03 October 2014
[William Harrington] - Add Util-linux Pass 2.
26 September 2014
[William Harrington] - Update Bash 4.3 branch update to patch level 26.
[William Harrington] - Update Readline 6.3 branch update to patch level 8.
[William Harrington] - Update Linux sublevel patch to 3.14.19.
[William Harrington] - Update Vim 7.4 branch update patch to level 460.
18 August 2014
[Chris] - Removed obsolete --with-tls and --with-__thread options from Cross-Tools Glibc builds - those options have long since been removed from Glibc.
17 August 2014
[Chris] - Combined Makefile modification commands in Boot section Shadow install into one command.
[Chris] - Removed redundant command explanation from Less installation page.
14 August 2014
[Chris] - Removed obsolete command to disable test lib in Glibc instructions.
10 August 2014
[Chris] - Removed several switches from GCC builds for options that are enabled by default.
[Chris] - Removed --enable-multibyte switch from Vim pages, since multibyte support is enabled by default.
[Chris] - Removed --enable-shared switch from CLooG pages; shared libraries are built by default.
09 August 2014
[Chris] - Redo top index to list by arch, then 32/64/multilib within each arch.
[Chris] - Removed "M4=m4" from final-system Bison and Flex pages, since m4 is now installed before them.
07 August 2014
[Chris] - Updated Linux sublevel patch to 3.14.16.
05 August 2014
[Chris] - Reversed change to Vim's docs location, so that Vim can find its help files.
01 August 2014
[Chris] - Updated Linux sublevel to 3.14.15.
[Chris] - Build Pkg-config-lite before Ncurses in the final system, so that Ncurses will install .pc files.
[Chris] - Move Bzip2 before Perl and modify Perl instructions to use system-install Bzip2. Solution borrowed from LFS.
28 July 2014
[Chris] - Removed unneeded notes about the importance of the testuites for GMP, MPFR, MPC, ISL, and CLooG.
24 July 2014
[Chris] - Added config flag descriptions to kernel config pages. Thanks to Hazel Russman for the idea.
[Chris] - Removed commands to recreate /usr/share/info to reduce possible user confusion.
21 July 2014
[William Harrington] - Update MPFR 3.1.2 fixes patch for patch level 10 update.
[William Harrington] - Update VIM 7.4 Branch Update patch to patch level 373.
[William Harrington] - Update Linux to 3.14.13.
18 July 2014
[Chris] - Changed title on Linux Headers installation pages to reduce potential confusion with previous Linux-Headers package.
14 July 2014
[Chris] - Modified instructions for mounting file systems for chroot so that they are all mounted before entering chroot, and added a tmpfs on /run. Took solution for /dev/shm symlink from LFS. Fixes ticket #971.
[Chris] - Updated Linux sublevel to 3.14.12.
10 July 2014
[Chris] - Removed creation of /var/run/utmp - it's created on boot in the bootscripts.
[Chris] - Removed creation of pidof from Sysvinit installation, to use pidof from Procps-ng instead.
02 July 2014
[William Harrington] - Update Linux subelevel patch to 3.14.10.
30 June 2014
[Chris] - Added documentation installation instructions for Zlib.
27 June 2014
[William Harrington] - Updated KMOD to 18. Fixes ticket #965.
20 June 2014
[William Harrington] - Remove make -C man install from final-system KMOD as man pages are installed during make install.
[William Harrington] - Add Linux sublevel patch.
[Chris] - Changed GMP documentation installation instructions to use the Makefile to install docs instead of doing so manually.
17 June 2014
[William Harrington] - Use --with-isl=system for temp-system CLooG.
17 June 2014
[William Harrington] - Move Man-DB right after Libpipeline.
15 June 2014
[Chris] - Added commands to create and install HTML documentation for MPC.
13 June 2014
[Chris] - Text updates to kernel installation page.
[William Harrington - Update File to 5.19.
11 June 2014
[Chris] - Placed file before findutils in temp-system.
10 June 2014
[William Harrington] - Upgraded Gettext to 0.19.1.
04 June 2014
[Chris] - Added Introduction page to final-preps.
03 June 2014
[Chris] - Moved installation of /tools/include/libiberty.h from Cross-Tools to Temp-System.
[Chris] - Moved creation of /var/run symlink to a more appropriate location in the Creating Directories page.
02 June 2014
[William Harrington] - Upgraded Gettext to 0.19.
01 June 2014
[Chris] - Upgraded GCC to 4.8.3.
[William Harrington] - Upgraded Eudev to 1.7.
31 May 2014
[William Harrington] - Update Check to 0.9.13.
[William Harrington] - Update Linux to 3.14.5.
[William Harrington] - Update Vim 7.4 branch update patch to level 316.
30 May 2014
[William Harrington] - Add --host=${CLFS_TARGET} during cross-tools Pkg-config configure.
29 May 2014
[William Harrington] - Update Perl to 5.20.0.
[Chris] - Edited "how" page - removed details about booting/chrooting and moved them to the "choose" page for temp-system.
28 May 2014
[William Harrington] - Upgrade TZData to 2014d.
[William Harrington] - Upgrade Man-pages to 3.68.
25 May 2014
[William Harrington] - Upgrade Grep to 2.19.
24 May 2014
[Chris] - Moved Bc from Cross-Tools to Boot section, as it's only needed to compile the kernel.
[Chris] - Moved "About ${CLFS}" page from final-preps to partitioning - best to have the page explaining ${CLFS} before it's actually used.
[Chris] - Added creation of log files with passwd and group.
22 May 2014
[Chris] - Removed xgettext and msgmerge from temp-system Gettext - those are only needed for ACL/Attr.
[Chris] - Swapped build order of Linux-headers and File in Cross-Tools - no particular reason for File to be after Linux-headers, so just make them alphabetical.
21 May 2014
[Chris] - Renamed Bootscripts chapter back to System Configuration - half that section doesn't involve bootscripts, and this allows for more consistency between different books .
[Chris] - Rewrote Eudev page in system-config section.
[William Harrington] - Update Man-pages to 3.67.
[Chris] - Moved creation of /etc/fstab to system-config.
19 May 2014
[Chris] - Added commands to unset CFLAGS and CXXFLAGS to the clfs user's default .bashrc, and removed the separate page where this was done.
[Chris] - Removed separate "Build flags" pages and moved that info to "Build Variables" pages, and moved those from cross-tools to final-preps.
18 May 2014
[Chris] - Added Pkg-config-lite to Cross-Tools and removed PKG_CONFIG parameters from temp-system and boot packages.
17 May 2014
[William Harrington] - Upgrade TZData to 2014c.
[William Harrington] - Add --disable-werror to cross-tools Bintuils instructions.
[William Harrington] - Move logger to
/bin
for
CLFS-Bootscripts requirement.
[Chris] - Changed "systemd" reference on Kbd page to CLFS Bootscripts, and added dumpkeys and kbd_mode to list of programs moved to /bin as they're used in the bootscripts.
14 May 2014
[Chris] - Created Sysvinit branch - removed Attr, ACL, D-Bus, Expat, Gperf, Intltool, Libcap, Systemd, XML::Parser, and added Libee, Libestr, Rsyslog.
11 May 2014
[Chris] - Added explanations for Essential Symlinks.
08 May 2014
[William Harrington] - Update Man-pages to 3.66.
[William Harrington] - Add GDBM 1.11 to the books.
[William Harrington] - Add Libpipeline 1.3.0 to the books.
[William Harrington] - Add Man-DB 2.6.7.1 to the books.
[William Harrington] - Remove Man-1.6g from the books.
[William Harrington] - Remove zsoelim link from Groff.
06 May 2014
[Chris] - Removed unneeded configure switches specifying GMP/MPFR/MPC/ISL/CLOOG in /tools.
[Chris] - Removed unneeded --libexecdir switches from temp-system GCC.
02 May 2014
[Chris] - Removed command to copy gconv-modules in Glibc instructions, as it is no longer needed.
30 April 2014
[Chris] - Added "PKG_CONFIG=" to boot section kmod commands, otherwise it will use pkg-config to find the "bash-completion" package and install stuff to that prefix if found. Thanks to boloco in IRC for finding this.
[William Harrington] - Uprade DBus to 1.8.2.
28 April 2014
[Chris] - Remove all mentions of Alpha architecture, as it has not been tested for a long time.
27 April 2014
[William Harrington] - Update IPRoute2 to 3.14.0.
27 April 2014
[Chris] - Updated Acknowledgements page.
[William Harrington] - Update Linux to 3.14.2.
26 April 2014
[Chris] - Renamed bootscripts package to boot-scripts (thanks to William Harrington for the suggestion) and removed the patch as it is not needed for the new package.
[Chris] - Renamed bootscripts chapter to "System Configuration".
[William Harrington] - Update Util-linux to 2.24.2.
[Chris] - Added new page about how to view the book from inside the temporary boot environment.
[Chris] - Don't move binaries from Findutils or Psmisc to /bin, as they're no longer needed there.
[William Harrington] - Update Vim 7.4 branch update patch to level 265.
24 April 2014
[William Harrington] - Update Eudev to 1.6.
[William Harrington] - Update Man-pages to 3.65.
[William Harrington] - Update Bash branch update patch to level 11.
[William Harrington] - Update Readline branch update patch to level 5.
22 April 2014
[Chris] - Removed several virtual filesystems from ${CLFS}/fstab for the boot method, as they're already mounted by the bootscript.
[Chris] - Removed creation of gtbl and geqn symlinks, as they are no longer needed.
21 April 2014
[Chris] - Re-added manual creation of /usr/bin/perl symlink, as it is not created automatically under some circumstances.
20 April 2014
[Chris] - Reorganized "boot" section to allow everything to be installed into /tools, remove the need to chown ${CLFS} to the clfs user, and generally make the chapter's instructions flow better.
18 April 2014
[Chris] - Added --disable-makeinstall-setuid to temp-system Util-linux, as nothing there needs to be suid.
16 April 2014
[Chris] - Removed creation of /usr/bin/perl symlink, as Perl creates a link itself when installed.
13 April 2014
[Chris] - Updated most packages in the Boot section to install into /tools instead of $CLFS. Thanks to Martin Ward and William Harrington for assistance.
12 April 2014
[Chris] - Modified sysvinit installation to allow it to use /tools/etc/inittab and /tools/sbin/agetty.
[Chris] - Moved Util-linux installation out of boot/chroot sections into the temp-system, as it can be installed the same way with either method.
11 April 2014
[Chris] - Updated MPC to 1.0.2.
[Chris] - Removed unneeded --disable-login and --disable-su switches from Util-linux configure in boot/chroot sections.
09 April 2014
[William Harrington] - Update Eudev to 1.5.3.
09 April 2014
[Chris] - Remove obsolete --enable-cloog-backend parameter from GCC configure.
[William Harrington] - Remove unneeded --disable-isl-version-check parameter from GCC configure.
[William Harrington] - Update Gawk to 4.1.1.
08 April 2014
[William Harrington] - Add versioned doc directories for Automake, DBus, Flex, Gawk, Gettext, GMP, IPRoute2, KBD, MPFR, Readline, Sed, Tar, Util-linux and XZ.
06 April 2014
[William Harrington] - Update KMOD to 17.
[William Harrington] - Update Man-pages to 3.64.
05 April 2014
[William Harrington] - Move Flex before Bison in final system and remove bison and flex from temp system.
[William Harrington] - Add M4=m4 before configure command in final-system Bison and Flex.
[William Harrington] - Remove Bison and Flex from temp system.
[William Harrington] - Move M4 before GMP in final-system and remove M4 from temp system.
02 April 2014
[William Harrington] - Add test commands to Attr and Acl.
30 March 2014
[Chris] - Modified network section to split systemd/sysconfig network configurations.
[Chris] - Removed instructions to install systemd manpages - they are now automatically installed by default.
[Chris] - Updated installed program lists for several packages.
[William Harrington] - Remove link of libl to libfl during Flex installation.
[William Harrington] - Update DHCPCD to 6.3.2.
[William Harrington] - Update VIM 7.4 patch to level 229.
[William Harrington] - Update Bash 4.3 patch to level 8.
[William Harrington] - Update Readline 6.3 patch to level 3.
[William Harrington] - Update GCC 4.8.2 branch update patch to revision 208943.
23 March 2014
[William Harrington] - Update Man-pages to 3.63.
28 March 2014
[William Harrington] - Update File to 5.18.
[William Harrington] - Update Flex to 2.5.39.
[William Harrington] - Update Linux to 3.12.15.
[William Harrington] - Update Systemd to 212.
[William Harrington] - Update Tzdata to 2014b.
[William Harrington] - Update GMP to 6.0.0a.
[William Harrington] - Move Bison and Flex before Binutils.
17 March 2014
[William Harrington] - Remove libdbus and Update Systemd to 211.
[William Harrington] - Add Systemd compat patch to install pkg-config files.
12 March 2014
[Chris] - Updated documentation installation instructions for Readline and Bash.
[Chris] - Deleted --remove-destination parameter when creating /etc/localtime - it's no longer needed.
[William Harrington] - Update Man-pages to 3.62.
10 March 2014
[William Harrington] - Update TZData to 2014a.
[William Harrington] - Update MPFR fixes patch to patch level 5.
09 March 2014
[William Harrington] - Add configure command descriptions and testsuite commands to Systemd.
[William Harrington] - Update testsuite description for D-BUS.
[William Harrington] - Add note to final-system Util-Linux regarding extra functionality with libudev.
[William Harrington] - Add commands and
descriptions for /etc/adjtime
.
02 March 2014
[William Harrington] - Update DHCPCD to 6.3.1.
27 February 2014
[William Harrington] - Update Grep to 2.18.
[William Harrington] - Update DHCPCD to 6.3.0.
[William Harrington] - Update Man-pages to 3.61.
[William Harrington] - Update Readline to 6.3.
[William Harrington] - Update Bash to 4.3.
24 February 2014
[William Harrington] - Remove installation of nscd tmpfile and unit service file in clfs-network-scripts.
23 February 2014
[William Harrington] - Add commands for nscd config, runtime, and Systemd unit files installation to GLIBC.
18 February 2014
[William Harrington] - Migrate EGLIBC to GLIBC and upgrade to version 2.19.
[William Harrington] - Update D-Bus to stable version 1.8.0.
[William Harrington] - Update File to version 5.17.
[William Harrington] - Update Grep to version 2.17.
[William Harrington] - Update Linux to version 3.12.11.
[William Harrington] - Update Man-pages to version 3.60.
[William Harrington] - Update Psmisc to version 22.21.
13 February 2014
[William Harrington] - Correct nobody gid to use nogroup gid.
03 February 2014
[William Harrington] - Add configure options to systemd so loadkeys and setfont is searched in /bin instead of /usr/bin.
02 February 2014
[William Harrington] - Remove note in Iana-etc page and update iana-etc update numbers patch for proper operation with current iana-etc format.
29 January 2014
[William Harrington] - Add PKG_CONFIG= to temp-system make configure command.
27 January 2014
[William Harrington] - Add PERL=/usr/bin/perl to temp-system Texinfo build.
26 January 2014
[William Harrington] - Update LESS to 462.
25 January 2014
[William Harrington] - Create a link from /proc/self/mounts to /etc/mtab in boot and chroot createfiles section.
23 January 2014
[William Harrington] - Update text and redo some commands regarding Systemd in the System and Network configuration chapters.
[William Harrington] - Add a clock configuration script to system configuration chapter with regards to systemd.
[William Harrington] - Add CLFS-Network-Scripts and add commands to install them in the network configuration chapter.
[William Harrington] - Update Util-linux to 2.24.1.
[William Harrington] - Update Check to 0.9.12.
21 January 2014
[William Harrington] - Add D-Bus libraries before Systemd in final-system for a circular dependency issue.
19 January 2014
[William Harrington] - Update DHCPCD to 6.2.1.
[William Harrington] - Use readlink when creating links for dynamic libraries for zlib, xz, ncurses, and readline.
13 January 2014
[William Harrington] - Update ISL to 0.12.2.
[William Harrington] - Update Man-pages to 3.56.
10 January 2014
[William Harrington] - Migrate Procps to Procps-ng.
09 January 2014
[Chris] - Updated Linux to 3.12.7.
[Chris] - Updated Perl to 5.18.2.
[Chris] - Updated Gettext to 0.18.3.2.
[Chris] - Updated Libcap to 2.24.
[Chris] - Removed unneeded command to create a /usr/lib/terminfo symlink from Ncurses instructions.
[Chris] - Removed /usr/{doc,info,man} symlinks and edited instructions for packages to ensure all documentation is installed to /usr/share.
[Chris] - Moved libcap so it's built just before iputils, which can use libcap.
08 January 2014
[Chris] - Removed commands to create files in /var/run and /var/log - systemd now used its journal for all logs.
[Chris] - Removed obsolete sed command from temp-system Coreutils.
[Chris] - Removed unneeded command to rename stubs-64.h.
[Chris] - Removed unneeded "make configure-host" commands from Binutils.
[Chris] - Moved Attr and ACL to just after GCC in the final system.
07 January 2014
[Chris] - Added command, from LFS, to modify /tools/lib/libstdc++.la to prevent a /tools reference in the final system.
[Chris] - Use libiberty from GCC, since Binutils no longer installs it by default.
06 January 2014
[Chris] - Added msgmerge and xgettext to /tools Gettext installation - needed for attr.
[William Harrington] - Update DHCPCD to 6.2.0.
[William Harrington] - Update Grep to 2.16.
05 January 2014
[Chris] - Removed rsyslog and its depedencies, libee and libestr.
[Chris] - Updated Expat to 2.1.0.
[Chris] - Updated Attr to 2.4.47.
[Chris] - Updated D-Bus to 1.6.18.
[Chris] - Updated Libcap to 2.23.
04 January 2014
[Chris] - Updated Systemd to 208.
[Chris] - Added Gperf, XML::Parser, Intltool, and ACL - needed by systemd.
01 January 2014
[Chris] - Added command to EGLIBC instructions to remove extraneous '.x' files from /usr/include/rpcsvc.
23 December 2013
[William Harrington] - Update E2fsprogs to 1.42.9.
[William Harrington] - Update Automake to 1.14.1.
21 December 2013
[William Harrington] - Update CLooG to 0.18.2.
[William Harrington] - Update Tzdata to 2013i.
[William Harrington] - Update EGLIBC 2.18 to revision 24829.
[William Harrington] - Update Linux to 3.12.6.
14 December 2013
[William Harrington] - Update Coreutils to 8.22.
[William Harrington] - Update Man-pages to 3.55.
08 December 2013
[William Harrington] - Update Bison to 3.0.2.
06 December 2013
[Chris] - Modified XZ instructions so that it won't install liblzma.{a,la} in /lib.
04 December 2013
[William Harrington] - Updated Binutils to version 2.24.
[William Harrington] - Updated File to version 5.16.
26 November 2013
[Chris] - Updated installed program lists for several packages.
[Chris] - Removed redundant --disable-su and --disable-login switches from Util-linux - they aren't built anyway if PAM isn't found.
25 November 2013
[William Harrington] - Update Iproute2 to 3.12.0.
[William Harrington] - Update Tar to 1.27.1.
23 November 2013
[Chris] - Use nologin from Util-linux instead of Shadow.
22 November 2013
[Chris] - Util-linux now installs last and mesg by default, so use those instead of the versions in Sysvinit.
18 November 2013
[William Harrington] - Move creation of dummy groups and user to final-system Util-linux.
[William Harrington] - Remove SUBDIRS variable from final-system Coreutils test command.
[William Harrington] - Adjust Util-linux test commands.
13 November 2013
[William Harrington] - Adjust Util-linux check commands.
[William Harrington] - Move Shadow before Util-Linux in final-system.
[William Harrington] - Update Bison to 3.0.1.
[William Harrington] - Remove Bison 3.0 eof patch.
11 November 2013
[William Harrington] - Update TZDATA to 2013h.
[William Harrington] - Add MPFR 3.1.2 Fixes patch.
[William Harrington] - Update Grep to 2.15.
[William Harrington] - Update Linux to 3.12.
[William Harrington] - Add a sed for Texinfo 5.x to all sections of Binutils.
[William Harrington] - Update Texinfo to 5.2.
[William Harrington] - Update KBD to 2.0.1.
[William Harrington] - Update Check to 0.9.11.
[William Harrington] - Update Automake to 1.14.
[William Harrington] - Update Make to 4.0.
[William Harrington] - Add a Sed command to EGLIBC for Make-4.x.
[William Harrington] - Move Check to temp-system.
09 November 2013
[William Harrington] - Add PKG_CONFIG= in front of configure line for chroot and boot Util-linux for hosts with pkg-config installed.
25 October 2013
[William Harrington] - Updated Util-Linux to 2.24.
[William Harrington] - Updated Tar to 1.27.
[William Harrington] - Updated Linux to 3.10.17.
[William Harrington] - Updated GCC to 4.8.2.
[William Harrington] - Updated CLooG to 0.18.1.
[William Harrington] - Changelog restarted, see the 2.1.0 book for the old changelog.
Below is a list of changes specific for this architecture made since the previous release of the book. For general changes see Master Changelog,
Changelog Entries:
25 May 2014
[Chris] - Added ${BUILD64} to variables.xml in temp-system, and removed CC="${CC} ${BUILD64}" from temp-system and boot packages.
27 April 2014
[Chris] - Removed obsolete CFLAGS from x86 Glibc configure commands.
24 October 2013
[William Harrington] - Changelog restarted, see the 2.1.0 book for the old changelog.
If during the building of the CLFS 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://trac.cross-lfs.org/wiki/faq.
The cross-lfs.org
server hosts a
number of mailing lists used for the development of the CLFS
project. These lists include the main development and support
lists, among others. If the FAQ does not contain your answer,
you can search the CLFS lists via The Mail Archive http://www.mail-archive.com.
You can find the mail lists with the following link:
http://www.mail-archive.com/index.php?hunt=clfs
For information on the different lists, how to subscribe, archive locations, and additional information, visit http://trac.cross-lfs.org/wiki/lists.
Cross-LFS does not maintain its own News Server, but we do
provide access via gmane.org
http://gmane.org. If you want to
subscribe to the Cross-LFS lists via a newsreader you can
utilize gmane.org
. You can find the
gmane search for CLFS with the following link:
Several members of the CLFS 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 CLFS FAQ or the mailing list
archives. You can find the IRC network at chat.freenode.net
. The support channel for
cross-lfs is named #cross-lfs. If you need to show people the
output of your problems, please use http://pastebin.cross-lfs.org
and reference the pastebin URL when asking your questions.
The CLFS project has a number of world-wide mirrors to make accessing the website and downloading the required packages more convenient. Please visit the CLFS website at http://trac.cross-lfs.org/wiki/mirrors for mirrors of CLFS.
If an issue or a question is encountered while working through this book, check the FAQ page at http://trac.cross-lfs.org/wiki/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://hints.cross-lfs.org/index.php/Errors.
We also have a wonderful CLFS community that is willing to offer assistance through the mailing lists and IRC (see the Section 1.5, “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 do some research on your own first. This 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.
Apart 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 3.0.0-SYSVINIT)
The host distribution and version being used to create CLFS.
The architecture of the host and target.
The value of the ${CLFS_HOST} and ${CLFS_TARGET} environment variables, and if applicable, ${BUILD32}, ${BUILD64}, ${BUILDN32}, and ${GCCTARGET}.
The package or section in which the problem was encountered.
The exact error message or symptom received. See Section 1.6.3, “Compilation Problems” below for an example.
Note whether you have deviated from the book at all. A package version change or even a minor change to any command is considered deviation.
Deviating from this book does not mean that we will not help you. After all, the CLFS project is about personal preference. Be upfront about any changes to the established procedure—this helps us evaluate and determine possible causes of your problem.
If something goes wrong while running the configure script, review
the config.log
file. This file
may contain the errors you encountered during configure. It often logs
errors that may have not been printed to the screen. Include
only the relevant
lines if you need to ask for help.
Both 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/clfs/usr/share/locale:.\"
-DLOCALEDIR=\"/mnt/clfs/usr/share/locale\"
-DLIBDIR=\"/mnt/clfs/usr/lib\"
-DINCLUDEDIR=\"/mnt/clfs/usr/include\" -DHAVE_CONFIG_H -I. -I.
-g -O2 -c getopt1.c
gcc -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':
/clfs/tmp/make-3.79.1/job.c:1565: undefined reference
to `getloadavg'
collect2: ld returned 1 exit status
make[2]: *** [make] Error 1
make[2]: Leaving directory `/clfs/tmp/make-3.79.1'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/clfs/tmp/make-3.79.1'
make: *** [all-recursive-am] Error 2
In this case, many people would just include the bottom section:
make [2]: *** [make] Error 1
This 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.
In this chapter, the partition which will host the CLFS system is prepared. We will create the partition itself, create a file system on it, and mount it.
Throughout this book, the environment variable CLFS
will be used several times. You should
ensure that this variable is always defined throughout the CLFS
build process. It should be set to the name of the directory
where you will be building your CLFS system - we will use
/mnt/clfs
as an example, but the
directory choice is up to you. If you are building CLFS on a
separate partition, this directory will be the mount point for
the partition. Choose a directory location and set the variable
with the following command:
export CLFS=[/mnt/clfs]
Having this variable set is beneficial in that commands such as install -dv ${CLFS}/tools can be typed literally. The shell will automatically replace “${CLFS}” with “/mnt/clfs” (or whatever the variable was set to) when it processes the command line.
Do not forget to check that ${CLFS}
is set whenever you leave and reenter the current working
environment (such as when doing a su to root
or another user). Check that the
CLFS
variable is set up properly
with:
echo ${CLFS}
Make sure the output shows the path to your CLFS system's build
location, which is /mnt/clfs
if
the provided example was followed. If the output is incorrect,
use the command given earlier on this page to set ${CLFS}
to the correct directory name.
Like most other operating systems, CLFS is usually installed on a dedicated partition. The recommended approach to building a CLFS system is to use an available empty partition or, if you have enough unpartitioned space, to create one. However, if you're building for a different architecture you can simply build everything in “/mnt/clfs” (or whatever directory you want to use) and transfer it to your target machine. If you do not plan to use a separate partition for building CLFS, you can skip the rest of this chapter and continue on to Packages and Patches.
A minimal system requires around 6 gigabytes (GB). This is enough to store all the source tarballs and compile the packages. The CLFS system itself will not take up this much room. A large portion of this requirement 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. If the CLFS system is intended to be the primary Linux system, additional software will probably be installed which will require additional space (2-10 GB).
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 a CLFS system can be the same as the one used by the host system, in which case it is not necessary to create another one.
As the root
user, 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/sda
for the primary Integrated Drive
Electronics (IDE) or Serial ATA (SATA) 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.,
sda5
). This book will refer to
this as the CLFS partition. Also, remember the designation of
the swap partition. These names will be needed later for the
/etc/fstab
file.
Now 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. Instructions for other
file systems can be found at http://cblfs.cross-lfs.org/index.php?section=6#File_System.
To create an ext2
file system
on the CLFS partition, run the following as root
:
mke2fs /dev/[xxx]
Replace [xxx]
with
the name of the CLFS partition (sda5
in our previous example).
Some host distributions use custom features in their
filesystem creation tools (E2fsprogs). This can cause
problems when booting into your new CLFS system, as those
features will not be supported by the CLFS-installed
E2fsprogs; you will get an error similar to unsupported filesystem features, upgrade
your e2fsprogs
. To check if your host system uses
custom enhancements, run the 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 CLFS partition. To do this, run the
following commands as root
:
cd /tmp
tar xjf /path/to/sources/e2fsprogs-1.42.9.tar.bz2
cd e2fsprogs-1.42.9
mkdir build
cd build
../configure
make #note that we intentionally don't 'make install' here!
./misc/mke2fs /dev/[xxx]
cd /tmp
rm -rf e2fsprogs-1.42.9
If you created a swap partition, you will need to initialize it
for use by issuing the command below as root
:
mkswap /dev/[yyy]
Replace [yyy]
with
the name of the swap partition. If you are using an existing
swap partition, there is no need to format it.
Now 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.
As the root
user, ensure the
CLFS
variable is set, if you haven't
already:
export CLFS=[/mnt/clfs]
Next, create the mount point and mount the CLFS file system by
running the following commands as root
:
mkdir -pv ${CLFS}
mount -v /dev/[xxx]
${CLFS}
Replace [xxx]
with
the designation of the CLFS partition.
If using multiple partitions for CLFS (e.g., one for
/
and another for /usr
), mount them as root
using:
mkdir -pv ${CLFS} mount -v /dev/[xxx]
${CLFS} mkdir -v ${CLFS}/usr mount -v /dev/[yyy]
${CLFS}/usr
Replace [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 mount | grep ${CLFS} to see
what options are set for the mounted CLFS 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.
This 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 also have 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://cross-lfs.org/files/packages/3.0.0/SYSVINIT/.
Create a directory called ${CLFS}/sources
and use it to store your
sources and patches. All packages should be compiled there as
well. Using any other location for compiling may have
unexpected results.
To create this directory, execute, as user root
, the following command before starting
the download session:
mkdir -v ${CLFS}/sources
Make this directory writable and sticky. When a directory is
marked “sticky”, that
means that even if multiple users have write permission on that
directory, any file within that directory can only be deleted
or modified by its owner. The following command, run as
root
, will enable the write and
sticky modes:
chmod -v a+wt ${CLFS}/sources
You can download all needed packages and patches into this directory either by using the links on the following pages in this section, or by passing the download list to wget:
wget -i dl.list -P ${CLFS}/sources
Verification of downloaded packages can be done by downloading the following MD5 or SHA1 checksum lists:
pushd ${CLFS}/sources md5sum -c MD5SUMS popd
pushd ${CLFS}/sources sha1sum -c SHA1SUMS popd
Download or otherwise obtain the following packages:
Home page: http://www.gnu.org/software/autoconf
Download: http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz
MD5 sum: 50f97f4159805e374639a73e2636f22e
Home page: http://www.gnu.org/software/automake
Download: http://ftp.gnu.org/gnu/automake/automake-1.14.1.tar.xz
MD5 sum: 7fc29854c520f56b07aa232a0f880292
Home page: http://www.gnu.org/software/bash
Download: http://ftp.gnu.org/gnu/bash/bash-4.3.tar.gz
MD5 sum: 81348932d5da294953e15d4814c74dd1
Home page: http://www.gnu.org/software/bc/
Download: ftp://alpha.gnu.org/gnu/bc/bc-1.06.95.tar.bz2
MD5 sum: 5126a721b73f97d715bb72c13c889035
Home page: http://sources.redhat.com/binutils
Download: http://ftp.gnu.org/gnu/binutils/binutils-2.24.tar.bz2
MD5 sum: e0f71a7b2ddab0f8612336ac81d9636b
Home page: http://www.gnu.org/software/bison
Download: http://ftp.gnu.org/gnu/bison/bison-3.0.2.tar.xz
MD5 sum: 146be9ff9fbd27497f0bf2286a5a2082
MD5 sum: ebe69a3adc1da12bfcdfab3e094eeb1a
Home page: http://www.bzip.org/
Download: http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz
MD5 sum: 00b516f4704d4a7cb50a1d97e6e8e15b
Home page: http://check.sourceforge.net/
Download: http://sourceforge.net/projects/check/files/check/0.9.13/check-0.9.13.tar.gz
MD5 sum: 95530868f81a9496b2518fd2b713008a
Home page: http://cloog.org
Download: http://www.bastoul.net/cloog/pages/download/cloog-0.18.2.tar.gz
MD5 sum: 69116aa6cd5e73f6b688d871875e1292
Home page: http://www.gnu.org/software/coreutils
Download: http://ftp.gnu.org/gnu/coreutils/coreutils-8.22.tar.xz
MD5 sum: 8fb0ae2267aa6e728958adc38f8163a2
Home page: http://www.gnu.org/software/dejagnu
Download: http://ftp.gnu.org/gnu/dejagnu/dejagnu-1.5.1.tar.gz
MD5 sum: 8386e04e362345f50ad169f052f4c4ab
Home page: http://roy.marples.name/projects/dhcpcd
Download: http://roy.marples.name/downloads/dhcpcd/dhcpcd-6.3.2.tar.bz2
MD5 sum: bb7d8e8533161fbe0eee3b8830fdbdf4
Home page: http://www.gnu.org/software/diffutils
Download: http://ftp.gnu.org/gnu/diffutils/diffutils-3.3.tar.xz
MD5 sum: 99180208ec2a82ce71f55b0d7389f1b3
Home page: http://e2fsprogs.sourceforge.net
Download: http://www.kernel.org/pub/linux/kernel/people/tytso/e2fsprogs/v1.42.9/e2fsprogs-1.42.9.tar.xz
MD5 sum: 55cc59c587a7199fd9d93b2843842236
Home page: http://www.gentoo.org/proj/en/eudev/
Download: http://dev.gentoo.org/~blueness/eudev/eudev-1.7.tar.gz
MD5 sum: 80649a0350ff9620fc2da9562d9f2a6a
Home page: http://expect.sourceforge.net
Download: http://downloads.sourceforge.net/project/expect/Expect/5.45/expect5.45.tar.gz
MD5 sum: 44e1a4f4c877e9ddc5a542dfa7ecc92b
Home page: http://www.darwinsys.com/file
Download: ftp://ftp.astron.com/pub/file/file-5.19.tar.gz
MD5 sum: e3526f59023f3f7d1ffa4d541335edab
File (5.19) 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 is http://cross-lfs.org/files/packages/3.0.0/SYSVINIT/.
Home page: http://www.gnu.org/software/findutils
Download: http://ftp.gnu.org/gnu/findutils/findutils-4.4.2.tar.gz
MD5 sum: 351cc4adb07d54877fa15f75fb77d39f
Home page: http://flex.sourceforge.net
Download: http://downloads.sourceforge.net/flex/flex-2.5.39.tar.bz2
MD5 sum: 77d44c6bb8c0705e0017ab9a84a1502b
Home page: http://www.gnu.org/software/gawk
Download: http://ftp.gnu.org/gnu/gawk/gawk-4.1.1.tar.xz
MD5 sum: a2a26543ce410eb74bc4a508349ed09a
Home page: http://gcc.gnu.org
Download: ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.8.3/gcc-4.8.3.tar.bz2
MD5 sum: 7c60f24fab389f77af203d2516ee110f
Home page: http://www.gnu.org/software/gdbm
Download: http://ftp.gnu.org/gnu/gdbm/gdbm-1.11.tar.gz
MD5 sum: 72c832680cf0999caedbe5b265c8c1bd
Home page: http://www.gnu.org/software/gettext
Download: http://ftp.gnu.org/gnu/gettext/gettext-0.19.1.tar.gz
MD5 sum: 8949a57e82abe88274a93174ade515e4
Home page: http://www.gnu.org/software/libc/
Download: http://ftp.gnu.org/gnu/glibc/glibc-2.19.tar.xz
MD5 sum: e26b8cc666b162f999404b03970f14e4
Home page: http://gmplib.org/
Download: http://ftp.gnu.org/gnu/gmp/gmp-6.0.0a.tar.xz
MD5 sum: 1e6da4e434553d2811437aa42c7f7c76
Home page: http://www.gnu.org/software/grep
Download: http://ftp.gnu.org/gnu/grep/grep-2.19.tar.xz
MD5 sum: ac732142227d9fe9567d71301e127979
Home page: http://www.gnu.org/software/groff
Download: http://ftp.gnu.org/gnu/groff/groff-1.22.2.tar.gz
MD5 sum: 9f4cd592a5efc7e36481d8d8d8af6d16
Home page: http://www.gnu.org/software/gzip/gzip.html
Download: http://ftp.gnu.org/gnu/gzip/gzip-1.6.tar.xz
MD5 sum: da981f86677d58a106496e68de6f8995
Home page: http://www.archlinux.org/packages/core/any/iana-etc/
Download: http://ftp.cross-lfs.org/pub/clfs/conglomeration/iana-etc/iana-etc-2.30.tar.bz2
MD5 sum: 3ba3afb1d1b261383d247f46cb135ee8
Home page: http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2
Download: http://www.kernel.org/pub/linux/utils/net/iproute2/iproute2-3.14.0.tar.xz
MD5 sum: bd9d7567bbb987c88120669f5e1a1092
Home page: http://www.linuxfoundation.org/en/Net:Iputils
Download: http://www.skbuff.net/iputils/iputils-s20121221.tar.bz2
MD5 sum: 6072aef64205720dd1893b375e184171
Home page: http://freecode.com/projects/isl
Download: http://isl.gforge.inria.fr/isl-0.12.2.tar.lzma
MD5 sum: b7d59eb79d3884e14b9788cc396f7687
Home page: http://kbd-project.org/
Download: http://kbd-project.org/download/kbd-2.0.1.tar.xz
MD5 sum: 55453cb09d90370005e696949092b8f6
Home page: http://git.kernel.org/?p=utils/kernel/kmod/kmod.git;a=summary
Download: http://www.kernel.org/pub/linux/utils/kernel/kmod/kmod-18.tar.xz
MD5 sum: 82835c7f01983634e06ca72b4ee30cc6
Home page: http://www.greenwoodsoftware.com/less
Download: http://www.greenwoodsoftware.com/less/less-462.tar.gz
MD5 sum: 55a001838501ed8a129682de047960df
Home page: http://www.libee.org/
Download: http://www.libee.org/download/files/download/libee-0.4.1.tar.gz
MD5 sum: 7bbf4160876c12db6193c06e2badedb2
Home page: http://libestr.adiscon.com/
Download: http://libestr.adiscon.com/files/download/libestr-0.1.5.tar.gz
MD5 sum: f180c0cdc82883d161eba3f2e8a34eb4
Home page: http://libpipeline.nongnu.org/
Download: http://download.savannah.gnu.org/releases/libpipeline/libpipeline-1.3.0.tar.gz
MD5 sum: 242428c01dca255cdcb2195073a9c6ed
Home page: http://www.gnu.org/software/libtool
Download: http://ftp.gnu.org/gnu/libtool/libtool-2.4.2.tar.xz
MD5 sum: 2ec8997e0c07249eb4cbd072417d70fe
Home page: http://www.kernel.org
Download: http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.14.tar.xz
MD5 sum: b621207b3f6ecbb67db18b13258f8ea8
Home page: http://www.gnu.org/software/m4
Download: http://ftp.gnu.org/gnu/m4/m4-1.4.17.tar.xz
MD5 sum: 12a3c829301a4fd6586a57d3fcf196dc
Home page: http://www.gnu.org/software/make
Download: http://ftp.gnu.org/gnu/make/make-4.0.tar.bz2
MD5 sum: 571d470a7647b455e3af3f92d79f1c18
Download: http://cross-lfs.org/files/packages/3.0.0/SYSVINIT/man-db-2.6.7.1.tar.xz
MD5 sum: ce7b697f8e8016a085d9f5975ae6c4fb
Home page: http://www.win.tue.nl/~aeb/linux/man
Download: http://www.kernel.org/pub/linux/docs/man-pages/man-pages-3.68.tar.xz
MD5 sum: 43965ed65b34aeff75767b162f97eb01
Home page: http://www.multiprecision.org/
Download: http://www.multiprecision.org/mpc/download/mpc-1.0.2.tar.gz
MD5 sum: 68fadff3358fb3e7976c7a398a0af4c3
Home page: http://www.mpfr.org/
Download: http://www.mpfr.org/mpfr-3.1.2/mpfr-3.1.2.tar.xz
MD5 sum: e3d203d188b8fe60bb6578dd3152e05c
Home page: http://www.gnu.org/software/ncurses
Download: http://ftp.gnu.org/gnu/ncurses/ncurses-5.9.tar.gz
MD5 sum: 8cb9c412e5f2d96bc6f459aa8c6282a1
Home page: http://savannah.gnu.org/projects/patch
Download: http://ftp.gnu.org/gnu/patch/patch-2.7.1.tar.xz
MD5 sum: e9ae5393426d3ad783a300a338c09b72
Home page: http://www.perl.org
Download: http://www.cpan.org/src/5.0/perl-5.20.0.tar.bz2
MD5 sum: 20cbecd4e9e880ee7a50a136c8b1484e
Home page: http://sourceforge.net/projects/pkgconfiglite
Download: http://sourceforge.net/projects/pkgconfiglite/files/0.28-1/pkg-config-lite-0.28-1.tar.gz
MD5 sum: 61f05feb6bab0a6bbfab4b6e3b2f44b6
Home page: http://sourceforge.net/projects/procps-ng
Download: http://sourceforge.net/projects/procps-ng/files/Production/procps-ng-3.3.9.tar.xz
MD5 sum: 0980646fa25e0be58f7afb6b98f79d74
Home page: http://psmisc.sourceforge.net
Download: http://downloads.sourceforge.net/psmisc/psmisc-22.21.tar.gz
MD5 sum: 935c0fd6eb208288262b385fa656f1bf
Home page: http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
Download: http://ftp.gnu.org/gnu/readline/readline-6.3.tar.gz
MD5 sum: 33c8fb279e981274f485fd91da77e94a
Home page: http://www.rsyslog.com/
Download: http://www.rsyslog.com/files/download/rsyslog/rsyslog-6.4.2.tar.gz
MD5 sum: 7de0124ec7d67ce2bfda0009ab1263ee
Home page: http://www.gnu.org/software/sed
Download: http://ftp.gnu.org/gnu/sed/sed-4.2.2.tar.bz2
MD5 sum: 7ffe1c7cdc3233e1e0c4b502df253974
Home page: http://pkg-shadow.alioth.debian.org
Download: http://pkg-shadow.alioth.debian.org/releases/shadow-4.2.1.tar.xz
MD5 sum: 2bfafe7d4962682d31b5eba65dba4fc8
Home page: http://savannah.nongnu.org/projects/sysvinit
Download: http://download.savannah.gnu.org/releases/sysvinit/sysvinit-2.88dsf.tar.bz2
MD5 sum: 6eda8a97b86e0a6f59dabbf25202aa6f
Home page: http://www.gnu.org/software/tar
Download: http://ftp.gnu.org/gnu/tar/tar-1.27.1.tar.xz
MD5 sum: e0382a4064e09a4943f3adeff1435978
Home page: http://www.tcl.tk
Download: http://downloads.sourceforge.net/tcl/tcl8.6.1-src.tar.gz
MD5 sum: aae4b701ee527c6e4e1a6f9c7399882e
Home page: http://www.gnu.org/software/texinfo
Download: http://ftp.gnu.org/gnu/texinfo/texinfo-5.2.tar.xz
MD5 sum: cb489df8a7ee9d10a236197aefdb32c5
Home page: http://www.iana.org/time-zones
Download: http://www.iana.org/time-zones/repository/releases/tzdata2014d.tar.gz
MD5 sum: 299b86c0368ecfb321f15d5c408a1d9b
Download: http://www.kernel.org/pub/linux/utils/util-linux/v2.24/util-linux-2.24.2.tar.xz
MD5 sum: 3f191727a0d28f7204b755cf1b6ea0aa
Home page: http://www.vim.org
Download: ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2
MD5 sum: 607e135c559be642f210094ad023dc65
Home page: http://tukaani.org/xz/
Download: http://tukaani.org/xz/xz-5.0.5.tar.xz
MD5 sum: aa17280f4521dbeebed0fbd11cd7fa30
Home page: http://www.zlib.net
Download: http://zlib.net/zlib-1.2.8.tar.xz
MD5 sum: 28f1205d8dd2001f26fec1e8c2cebe37
Zlib (1.2.8) 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 is http://cross-lfs.org/files/packages/3.0.0/SYSVINIT/.
Total size of these packages: about 322 MB
Home page: http://www.gnu.org/software/grub
Download: http://ftp.gnu.org/gnu/grub/grub-2.00.tar.xz
MD5 sum: a1043102fbc7bcedbf53e7ee3d17ab91
Total size of these packages: about 5 MB
In 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 a CLFS system:
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/bash-4.3-branch_update-5.patch
MD5 sum: 712a693471a88bcece45fa566f8b6c57
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/bootscripts-cross-lfs-3.0-20140710-tools_updates-2.patch
MD5 sum: 460b0a4710dd74edea76b5398fd24b47
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/coreutils-8.22-uname-1.patch
MD5 sum: 6eeba217c88ec83b807e305e594fe13d
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/coreutils-8.22-noman-1.patch
MD5 sum: 6ed8f515391580e51f170a32af6fc7b9
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/gcc-4.8.3-branch_update-1.patch
MD5 sum: ba8abbb0696f8e0d75eb26ae7c9ad219
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/iana-etc-2.30-numbers_update-20140202-2.patch.xz
MD5 sum: b0e7051fef0b3ba064209a5f3d23bd2a
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/iputils-s20121221-fixes-2.patch
MD5 sum: c2344acdd81607685886f617da7d66e0
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/patch-3.14.21.xz
MD5 sum: 25debf3b5652cdd94df176cd4e36a9ed
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/mpfr-3.1.2-fixes-4.patch
MD5 sum: b6c1c0dcbf7661298037eeb346a8669c
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/ncurses-5.9-bash_fix-1.patch
MD5 sum: c6f7f2ab0ebaf7721ebeb266641352db
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/ncurses-5.9-branch_update-4.patch
MD5 sum: c2b2dc2d31b02c218359e6218f12a72c
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/readline-6.3-branch_update-4.patch
MD5 sum: bb8d37fd00abc74a81563ebfcf64af4c
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/sysvinit-2.88dsf-tools_updates-1.patch
MD5 sum: c3f6981c46868b68bfd58921570ea51f
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/tar-1.27.1-manpage-1.patch
MD5 sum: 68c86c67e67a5c074872a293818f361d
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/vim-7.4-branch_update-7.patch
MD5 sum: 3c250be2ca0cf3e539a8f18c46c36eac
Total size of these patches: about 7 MB
In addition to the above required patches, there exist a number of optional patches created by the CLFS 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://patches.cross-lfs.org/3.0.0/SYSVINIT/ and acquire any additional patches to suit the system needs.
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/gcc-4.8.3-pure64-1.patch
MD5 sum: 96b7f0b29cfb3dd665be12269cde1139
Download: http://patches.cross-lfs.org/3.0.0/SYSVINIT/gcc-4.8.3-pure64_specs-1.patch
MD5 sum: b950e79ec42d64fee0f823ce5c8a2ba4
Total size of these patches: about 32.7 KB
In this chapter, we will perform a few additional tasks to
prepare for building the cross-compile tools. We will create
directories in ${CLFS}
for the
installation of the cross-toolchain and temporary system, add
an unprivileged user to reduce risk, and create an appropriate
build environment for that user.
All programs compiled in Constructing
a Temporary System will be installed under ${CLFS}/tools
to keep them separate from the
programs compiled in Installing
Basic System Software. The programs compiled here are
temporary tools and will not be a part of the final CLFS
system. By keeping these programs in a separate directory, they
can easily be discarded later after their use. This also
prevents these programs from ending up in the host production
directories (easy to do by accident in Constructing
a Temporary System).
Create the required directory by running the following as
root
:
install -dv ${CLFS}/tools
The next step is to create a /tools
symlink on the host system. This will
point to the newly-created directory on the CLFS partition. Run
this command as root
as well:
ln -sv ${CLFS}/tools /
The 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.
This will provide a common place for our temporary tools
system.
The cross-binutils and cross-compiler built in Constructing
Cross-Compile Tools will be installed under ${CLFS}/cross-tools
to keep them separate
from the host programs. The programs compiled here are
cross-tools and will not be a part of the final CLFS system or
the temp-system. By keeping these programs in a separate
directory, they can easily be discarded later after their use.
Create the required directory by running the following as
root
:
install -dv ${CLFS}/cross-tools
The next step is to create a /cross-tools
symlink on the host system. This
will point to the newly-created directory on the CLFS
partition. Run this command as root
as well:
ln -sv ${CLFS}/cross-tools /
When logged in as user root
,
making a single mistake can damage or destroy a system.
Therefore, we recommend building the packages as an
unprivileged user. You could use your own user name, but to
make it easier to set up a clean work environment, create a new
user called clfs
as a member of
a new group (also named clfs
)
and use this user during the installation process. As
root
, issue the following
commands to add the new user:
groupadd clfs useradd -s /bin/bash -g clfs -d /home/clfs clfs mkdir -pv /home/clfs chown -v clfs:clfs /home/clfs
The meaning of the command line options:
-s
/bin/bash
This makes bash the default shell
for user clfs
.
The build instructions assume that the bash shell is in use.
-g
clfs
This option adds the new user to the clfs
group.
-d
/home/clfs
This option sets the user's home directory, but does not
create it. We could have used -m
to tell useradd to create the
directory as well, but this would also copy the contents
of the host system's /etc/skel
directory into the new user's
home. We would prefer to have a clean user environment,
so we just create an empty directory after adding the
user.
clfs
This is the actual name for the created group and user.
To log in as clfs
(as opposed
to switching to user clfs
when
logged in as root
, which does
not require the clfs
user to
have a password), give clfs
a
password:
passwd clfs
As root
, grant clfs
full access to ${CLFS}/cross-tools
and ${CLFS}/tools
by making clfs
the directorys' owner:
chown -v clfs ${CLFS}/tools chown -v clfs ${CLFS}/cross-tools
If a separate working directory was created as suggested, run
the following command as root
to give user clfs
ownership of
this directory as well:
chown -v clfs ${CLFS}/sources
Next, login as user clfs
. This
can be done via a virtual console, through a display manager,
or with the following substitute user command:
su - clfs
The “-
” 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.
Until specified otherwise, all commands from this point on
should be done as the clfs
user.
Set up a good working environment by creating two new startup
files for the bash shell. While logged in
as user clfs
, 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/bash
EOF
When logged on as user clfs
,
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. This ensures 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 +h
umask 022
CLFS=/mnt/clfs
LC_ALL=POSIX
PATH=/cross-tools/bin:/bin:/usr/bin
export CLFS LC_ALL PATH
unset CFLAGS CXXFLAGS
EOF
The 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 program is to be run. As such, the shell will find the
newly compiled tools in /cross-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 CLFS
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. Setting LC_ALL
to “POSIX” or “C” (the two are equivalent) ensures that
everything will work as expected in the temporary build
environment.
By putting /cross-tools/bin
at
the beginning of the PATH
, the
cross-compiler built in Constructing
Cross-Compile Tools will be picked up by the build process
for the temp-system packages before anything that may be
installed on the host. This, combined with turning off hashing,
helps to ensure that you will be using the cross-compile tools
to build the temp-system in /tools.
The CFLAGS
and CXXFLAGS
variables should not be set while
building the temporary system, so we unset them.
Finally, to have the environment fully prepared for building the temporary tools, source the just-created user profile:
source ~/.bash_profile
During the building of the cross-compile tools you will need to
set a few variables that will be dependent on your particular
needs. The first variable will be the triplet of the host
machine, which will be put into the CLFS_HOST
variable. To account for the
possibility that the host and target are the same arch, as
cross-compiling won't work when host and target are the same,
part of the triplet needs to be changed slightly - in our case,
we will change part of the triplet to "cross". Set CLFS_HOST
using the following command:
export CLFS_HOST=$(echo ${MACHTYPE} | sed -e 's/-[^-]*/-cross/')
Now you will need to set the triplet for the target architecture. Set the target variable using the following command:
export CLFS_TARGET="x86_64-unknown-linux-gnu"
We will need to setup target-specific flags for the compiler and linker:
export BUILD64="-m64"
Now add the host and target variables, and compiler and linker
flags, to ~/.bashrc
, just in case
you have to exit and restart building later:
cat >> ~/.bashrc << EOF export CLFS_HOST="${CLFS_HOST}" export CLFS_TARGET="${CLFS_TARGET}" export BUILD64="${BUILD64}" EOF
Most packages provide a test suite, usually a script or make target, which tests the just-compiled programs or libraries by executing or linking to them. Test suites are often useful for verifying that a package compiled correctly. However, they cannot be run while cross-compiling so we will not mention test suite commands for any packages until Installing Basic System Software.
This chapter shows you how to create cross platform tools.
If for some reason you have to stop and come back later, remember to use the su - clfs command, and it will setup the build environment that you left.
Before issuing the build instructions for a package, the package should be unpacked, and a cd into the created directory should be performed.
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 chapters, 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.
After installing each package, both in this and the next chapters, delete its source and build directories, unless specifically instructed otherwise. Deleting the sources prevents mis-configuration when the same package is reinstalled later.
The File package contains a utility for determining the type of a given file or files.
One method that file uses for identifying a
given file is to run “magic
tests”, where it compares the file's contents to
data in “magic files”,
which contain information about a number of standard file
formats. When File is compiled, it will run file -C to combine the
information from the magic files in its source tree into a
single magic.mgc
file, which it
will use after it is installed. When we build File in
Constructing
a Temporary System, it will be cross-compiled, so it will
not be able to run the file program that it just
built, which means that we need one that will run on the host
system.
Prepare File for compilation:
./configure --prefix=/cross-tools --disable-static
The meaning of the configure options:
--prefix=/cross-tools
This tells the configure script to prepare to install
the package in the /cross-tools
directory.
--disable-static
This tells the File package not to compile or install static libraries, which are not needed for the Cross-Tools
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.40.2, “Contents of File.”
The Linux Kernel contains a make target that installs “sanitized” kernel headers.
For this step you will need to unpack the kernel tarball
(linux-3.14.tar.xz
) and
cd into its
source directory before entering the commands on this page.
Apply the latest Linux sublevel patch:
xzcat ../patch-3.14.21.xz | patch -Np1 -i -
Install the kernel header files:
make mrproper make ARCH=x86_64 headers_check make ARCH=x86_64 INSTALL_HDR_PATH=/tools headers_install
The meaning of the make commands:
make
mrproper
Ensures that the kernel source dir is clean.
make
ARCH=x86_64 headers_check
Sanitizes the raw kernel headers so that they can be used by userspace programs.
make
ARCH=x86_64 INSTALL_HDR_PATH=/tools
headers_install
This will install the kernel headers into /tools/include
.
Details on this package are located in Section 10.5.2, “Contents of Linux Headers.”
The M4 package contains a macro processor.
M4 is required to build GMP. We will compile and install an
m4 program into
/cross-tools
, so that we have a
known-good version which can be used to build GMP, both in
Cross-Tools and the Temporary System.
Prepare M4 for compilation:
./configure --prefix=/cross-tools
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.9.2, “Contents of M4.”
The Ncurses package contains libraries for terminal-independent handling of character screens.
When Ncurses is compiled, it executes tic to create a terminfo
database in ${prefix}/share/terminfo
. If possible, the
Makefile
will use the
tic binary that
was just compiled in its source tree, but this does not work
when Ncurses is cross-compiled. To allow the Ncurses build in
Constructing
a Temporary System to succeed, we will build and install
a tic program
that can be run on the host system.
The following patch fixes an issue with some Bash versions:
patch -Np1 -i ../ncurses-5.9-bash_fix-1.patch
Prepare Ncurses for compilation:
./configure --prefix=/cross-tools \ --without-debug --without-shared
The meaning of the new configure options:
--without-debug
Tells Ncurses to build without debugging information.
--without-shared
This prevents Ncurses from building its shared libraries, which are not needed at this time.
Only one binary is needed for the Cross-Tools. Build the headers and then build tic:
make -C include make -C progs tic
Install tic with the following command:
install -v -m755 progs/tic /cross-tools/bin
Details on this package are located in Section 10.22.2, “Contents of Ncurses.”
Pkg-config-lite is a tool to help you insert the correct compiler options on the command line when compiling applications and libraries.
Several packages in the temporary system will use
pkg-config to
find various required and optional dependencies.
Unfortunately, this could result in those packages finding
libraries on the host system and trying to link against them,
which will not work. To avoid this problem, we will install a
pkg-config
binary in /cross-tools
and
configure it so that it will look for Pkg-config files only
in /tools
.
Prepare Pkg-config-lite for compilation:
./configure --prefix=/cross-tools --host=${CLFS_TARGET}\ --with-pc-path=/tools/lib/pkgconfig:/tools/share/pkgconfig
The meaning of the new configure option:
--host=${CLFS_TARGET}
Several packages that we will cross-compile later will
try to search for ${CLFS_TARGET}-pkg-config.
Setting this option ensures that Pkg-config-lite will
create a hard link in /cross-tools/bin
with this name, so
that it will be used instead of any similarly-named
program that might exist on the host.
--with-pc-path
This sets the default PKG_CONFIG_PATH to /tools/lib/pkgconfig
and /tools/share/pkgconfig
.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.21.2, “Contents of Pkg-config-lite.”
GMP is a library for arithmetic on arbitrary precision integers, rational numbers, and floating-point numbers.
This package and the next two - MPFR and MPC - will be
installed into /cross-tools
because GCC requires them to build.
If you are building with a host which has 32-bit user-space with a 64-bit capable CPU, cross-tools GMP will attempt to link with 64-bit libraries. Add the following variable during configure to force GMP's ABI: ./configure ABI=32
Prepare GMP for compilation:
./configure --prefix=/cross-tools --enable-cxx \ --disable-static
The meaning of the new configure option:
--enable-cxx
This tells GMP to enable C++ support.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.10.2, “Contents of GMP.”
The MPFR library is a C library for multiple-precision floating-point computations with correct rounding.
Apply a patch with upstream fixes:
patch -Np1 -i ../mpfr-3.1.2-fixes-4.patch
Prepare MPFR for compilation:
LDFLAGS="-Wl,-rpath,/cross-tools/lib" \ ./configure --prefix=/cross-tools \ --disable-static --with-gmp=/cross-tools
The meaning of the new configure options:
LDFLAGS="-Wl,-rpath,/cross-tools/lib"
This tells configure to search
in /cross-tools
for
libraries.
--with-gmp=/cross-tools
This tells configure where to find GMP.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.11.2, “Contents of MPFR.”
MPC is a C library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result.
Prepare MPC for compilation:
LDFLAGS="-Wl,-rpath,/cross-tools/lib" \ ./configure --prefix=/cross-tools --disable-static \ --with-gmp=/cross-tools --with-mpfr=/cross-tools
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.12.2, “Contents of MPC.”
ISL is a library for manipulating sets and relations of integer points bounded by linear constraints.
We will install ISL and CLooG to enable extra functionality for GCC. They are not strictly required, but GCC can link to them to enable its new loop generation feature called Graphite.
Prepare ISL for compilation:
LDFLAGS="-Wl,-rpath,/cross-tools/lib" \ ./configure --prefix=/cross-tools --disable-static \ --with-gmp-prefix=/cross-tools
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.13.2, “Contents of ISL.”
CLooG is a library to generate code for scanning Z-polyhedra. In other words, it finds code that reaches each integral point of one or more parameterized polyhedra. GCC links with this library in order to enable the new loop generation code known as Graphite.
Prepare CLooG for compilation:
LDFLAGS="-Wl,-rpath,/cross-tools/lib" \ ./configure --prefix=/cross-tools --disable-static \ --with-gmp-prefix=/cross-tools --with-isl-prefix=/cross-tools
Apply a sed which prevents the attempted installation of an invalid file:
cp -v Makefile{,.orig} sed '/cmake/d' Makefile.orig > Makefile
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.14.2, “Contents of CLooG.”
The Binutils package contains a linker, an assembler, and other tools for handling object files.
It is important that Binutils be compiled before Glibc and GCC because both Glibc and GCC perform various tests on the available linker and assembler to determine which of their own features to enable.
The Binutils documentation recommends building Binutils outside of the source directory in a dedicated build directory:
mkdir -v ../binutils-build cd ../binutils-build
Prepare Binutils for compilation:
AR=ar AS=as ../binutils-2.24/configure \ --prefix=/cross-tools --host=${CLFS_HOST} --target=${CLFS_TARGET} \ --with-sysroot=${CLFS} --with-lib-path=/tools/lib --disable-nls \ --disable-static --enable-64-bit-bfd --disable-multilib --disable-werror
The meaning of the new configure options:
AR=ar
AS=as
This prevents Binutils from compiling with ${CLFS_HOST}-ar and ${CLFS_HOST}-as as they are provided by this package and therefore not installed yet.
--host=${CLFS_HOST}
When used with --target, this creates a cross-architecture executable that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST}.
--target=${CLFS_TARGET}
When used with --host, this creates a cross-architecture executable that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST}.
--with-sysroot=${CLFS}
Tells configure to build a linker that uses ${CLFS} as its root directory for its search paths.
--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.
--disable-nls
This disables internationalization as i18n is not needed for the cross-compile tools.
--disable-multilib
This option disables the building of a multilib capable Binutils.
--enable-64-bit-bfd
This adds 64 bit support to Binutils.
--disable-werror
This prevents the build from stopping in the event that there are warnings from the host's compiler.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.18.2, “Contents of Binutils.”
The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.
Here we will compile GCC, as a cross-compiler that will
create executables for our target architecture, statically so
that it will not need to look for Glibc's startfiles, which
do not yet exist in /tools
. We
will use this cross-compiler, plus the cross-linker we have
just installed with Binutils, to compile Glibc. After Glibc
is installed into /tools
, we
can rebuild GCC so that it will then be able to build
executables that link against the libraries in /tools
.
The following patch contains a number of updates to the 4.8.3 branch by the GCC developers:
patch -Np1 -i ../gcc-4.8.3-branch_update-1.patch
Make a couple of essential adjustments to GCC's specs to ensure GCC uses our build environment:
patch -Np1 -i ../gcc-4.8.3-pure64_specs-1.patch
Change the StartFile Spec so that GCC looks in /tools
:
echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/linux.h echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h
We will create a dummy limits.h
so the build will not use the one provided by the host
distro:
touch /tools/include/limits.h
The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory:
mkdir -v ../gcc-build cd ../gcc-build
Prepare GCC for compilation:
AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \ ../gcc-4.8.3/configure --prefix=/cross-tools \ --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \ --with-sysroot=${CLFS} --with-local-prefix=/tools \ --with-native-system-header-dir=/tools/include --disable-nls \ --disable-shared --with-mpfr=/cross-tools --with-gmp=/cross-tools \ --with-isl=/cross-tools --with-cloog=/cross-tools --with-mpc=/cross-tools \ --without-headers --with-newlib --disable-decimal-float --disable-libgomp \ --disable-libmudflap --disable-libssp --disable-libatomic --disable-libitm \ --disable-libsanitizer --disable-libquadmath --disable-threads \ --disable-multilib --disable-target-zlib --with-system-zlib \ --enable-languages=c --enable-checking=release
The meaning of the new configure options:
--build=${CLFS_HOST}
This specifies the system on which the cross-compiler is being built.
--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.
--with-native-system-headers-dir=/tools/include
This switch ensures that GCC will search for the system
headers in /tools/include
and that host system headers will not be searched.
--disable-shared
This tells GCC not to create a shared library.
--without-headers
Disables GCC from using the target's Libc when cross compiling.
--with-newlib
This causes GCC to enable the inhibit_libc
flag, which prevents
libgcc
from building code
that uses libc support.
--disable-decimal-float
Disables support for the C decimal floating point extension.
--disable-lib*
These options prevent GCC from building a number of libraries that are not needed at this time.
--disable-threads
This will prevent GCC from looking for the multi-thread include files, since they haven't been created for this architecture yet. GCC will be able to find the multi-thread information after the Glibc headers are created.
--disable-target-zlib
This tells GCC not to build the copy of Zlib in its source tree.
--with-system-zlib
This tells GCC to link to the system-installed zlib instead of the one in its source tree.
--enable-languages=c
This option ensures that only the C compiler is built.
--enable-checking=release
This option selects the complexity of the internal consistency checks and adds error checking within the compiler.
Continue with compiling the package:
make all-gcc all-target-libgcc
The meaning of the new make options:
all-gcc
all-target-libgcc
Compiles only the parts of GCC that are needed at this time, rather than the full package.
Install the package:
make install-gcc install-target-libgcc
Details on this package are located in Section 10.19.2, “Contents of GCC.”
The 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.
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.
Apply the following sed so the tzselect script works properly:
cp -v timezone/Makefile{,.orig} sed 's/\\$$(pwd)/`pwd`/' timezone/Makefile.orig > timezone/Makefile
The Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory:
mkdir -v ../glibc-build cd ../glibc-build
Add the following to config.cache
to disable ssp when building
Glibc:
echo "libc_cv_ssp=no" > config.cache
Prepare Glibc for compilation:
BUILD_CC="gcc" CC="${CLFS_TARGET}-gcc ${BUILD64}" \ AR="${CLFS_TARGET}-ar" RANLIB="${CLFS_TARGET}-ranlib" \ ../glibc-2.19/configure --prefix=/tools \ --host=${CLFS_TARGET} --build=${CLFS_HOST} \ --disable-profile --enable-kernel=2.6.32 \ --with-binutils=/cross-tools/bin --with-headers=/tools/include \ --enable-obsolete-rpc --cache-file=config.cache
The meaning of the new configure options:
BUILD_CC="gcc"
This sets Glibc to use the current compiler on our system. This is used to create the tools Glibc uses during its build.
CC="${CLFS_TARGET}-gcc
${BUILD64}"
Forces Glibc to build using our target architecture GCC utilizing the 64 Bit flags.
AR="${CLFS_TARGET}-ar"
This forces Glibc to use the ar utility we made for our target architecture.
RANLIB="${CLFS_TARGET}-ranlib"
This forces Glibc to use the ranlib utility we made for our target architecture.
--disable-profile
This builds the libraries without profiling information. Omit this option if profiling on the temporary tools is necessary.
--enable-kernel=2.6.32
This tells Glibc to compile the library with support for 2.6.32 and later Linux kernels.
--with-binutils=/cross-tools/bin
This tells Glibc to use the Binutils that are specific to our target architecture.
--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.
--enable-obsolete-rpc
This tells Glibc to install rpc headers that are not installed by default but may be needed by other packages.
--cache-file=config.cache
This tells Glibc to utilize a premade cache file.
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. This msgfmt program is part of the Gettext package which the host distribution should provide. You might also see a similar (also harmless) message about missing autoconf.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.7.5, “Contents of Glibc.”
The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.
The following patch contains a number of updates to the 4.8.3 branch by the GCC developers:
patch -Np1 -i ../gcc-4.8.3-branch_update-1.patch
Make a couple of essential adjustments to GCC's specs to ensure GCC uses our build environment:
patch -Np1 -i ../gcc-4.8.3-pure64_specs-1.patch
Change the StartFile Spec so that GCC looks in /tools
:
echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/linux.h echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h
The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory:
mkdir -v ../gcc-build cd ../gcc-build
Prepare GCC for compilation:
AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \ ../gcc-4.8.3/configure --prefix=/cross-tools \ --build=${CLFS_HOST} --target=${CLFS_TARGET} --host=${CLFS_HOST} \ --with-sysroot=${CLFS} --with-local-prefix=/tools \ --with-native-system-header-dir=/tools/include --disable-nls \ --disable-static --enable-languages=c,c++ --enable-__cxa_atexit \ --enable-threads=posix --disable-multilib \ --with-mpc=/cross-tools --with-mpfr=/cross-tools --with-gmp=/cross-tools \ --with-cloog=/cross-tools --with-isl=/cross-tools --with-system-zlib \ --enable-checking=release --enable-libstdcxx-time
The meaning of the new configure options:
--enable-languages=c,c++
This option ensures that only the C and C++ compilers are built.
--enable-__cxa_atexit
This option allows use of __cxa_atexit, rather than atexit, to register C++ destructors for local statics and global objects and 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-threads=posix
This enables C++ exception handling for multi-threaded code.
--enable-libstdcxx-time
This enables link-time checks for the availability of clock_gettime clocks, and nanosleep and sched_yield functions, in the C library.
Continue with compiling the package:
make AS_FOR_TARGET="${CLFS_TARGET}-as" \ LD_FOR_TARGET="${CLFS_TARGET}-ld"
Install the package:
make install
Details on this package are located in Section 10.19.2, “Contents of GCC.”
This chapter shows how to compile and install a minimal Linux system. This system will contain just enough tools to start constructing the final CLFS system in Installing Basic System Software and allow a working environment with more user convenience than a minimum environment would.
The tools in this chapter are cross-compiled using the
toolchain in /cross-tools
and
will be installed under the ${CLFS}/tools
directory to keep them separate
from the files installed in Installing
Basic System Software and the host production directories.
Since the packages compiled here are temporary, we do not want
them to pollute the soon-to-be CLFS system.
Check one last time that the CLFS
environment variable is set up properly:
echo ${CLFS}
Make sure the output shows the path to the CLFS partition's
mount point, which is /mnt/clfs
,
using our example.
During this section of the build you will see several WARNING messages like the ones below. It is safe to ignore these messages.
configure: WARNING: result yes guessed because of cross compilation
configure: WARNING: cannot check WCONTINUED if cross compiling -- defaulting to no
Setup target-specific variables for the compiler and linkers:
export CC="${CLFS_TARGET}-gcc ${BUILD64}" export CXX="${CLFS_TARGET}-g++ ${BUILD64}" export AR="${CLFS_TARGET}-ar" export AS="${CLFS_TARGET}-as" export RANLIB="${CLFS_TARGET}-ranlib" export LD="${CLFS_TARGET}-ld" export STRIP="${CLFS_TARGET}-strip"
The meaning of the new configure options:
CXX="${CXX}
${BUILD64}"
This forces the C++ compiler to use our 64 Bit flags.
Then add the build variables to ~/.bashrc
to prevent issues if you stop and
come back later:
echo export CC=\""${CC}\"" >> ~/.bashrc echo export CXX=\""${CXX}\"" >> ~/.bashrc echo export AR=\""${AR}\"" >> ~/.bashrc echo export AS=\""${AS}\"" >> ~/.bashrc echo export RANLIB=\""${RANLIB}\"" >> ~/.bashrc echo export LD=\""${LD}\"" >> ~/.bashrc echo export STRIP=\""${STRIP}\"" >> ~/.bashrc
GMP is a library for arithmetic on arbitrary precision integers, rational numbers, and floating-point numbers.
As with the Cross-Tools, we will compile GMP, MPFR, MPC, ISL,
and CLooG so that GCC can use them, though this time we will
cross-compile them into /tools
.
Prepare GMP for compilation:
CC_FOR_BUILD=gcc ./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --enable-cxx
The meaning of the new configure option:
CC_FOR_BUILD=gcc
Tells configure to use the host's gcc instead of our cross-compiler to build native tools it needs while compiling.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.10.2, “Contents of GMP.”
The MPFR library is a C library for multiple-precision floating-point computations with correct rounding.
Apply a patch with upstream fixes:
patch -Np1 -i ../mpfr-3.1.2-fixes-4.patch
Prepare MPFR for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.11.2, “Contents of MPFR.”
MPC is a C library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result.
Prepare MPC for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.12.2, “Contents of MPC.”
ISL is a library for manipulating sets and relations of integer points bounded by linear constraints.
Prepare ISL for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.13.2, “Contents of ISL.”
CLooG is a library to generate code for scanning Z-polyhedra. In other words, it finds code that reaches each integral point of one or more parameterized polyhedra. GCC links with this library in order to enable the new loop generation code known as Graphite.
Prepare CLooG for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --with-isl=system
The meaning of the new configure option:
--with-isl=system
This ensures that CLooG will use the version of Isl
that was just installed into /tools
, rather than the copy in its
own source tree.
Apply a sed which prevents the attempted installation of an invalid file:
cp -v Makefile{,.orig} sed '/cmake/d' Makefile.orig > Makefile
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.14.2, “Contents of CLooG.”
The Zlib package contains compression and decompression routines used by some programs.
Several packages in the temporary system use Zlib, including
Binutils, GCC, and Util-linux, so we will add it to
/tools
.
Prepare Zlib for compilation:
./configure --prefix=/tools
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.15.2, “Contents of Zlib.”
The Binutils package contains a linker, an assembler, and other tools for handling object files.
The Binutils documentation recommends building Binutils outside of the source directory in a dedicated build directory:
mkdir -v ../binutils-build cd ../binutils-build
Prepare Binutils for compilation:
../binutils-2.24/configure \ --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --target=${CLFS_TARGET} --with-lib-path=/tools/lib --disable-nls \ --enable-shared --enable-64-bit-bfd --disable-multilib
The meaning of the new configure option:
--enable-shared
When this is specified, Binutils will create a shared
libbfd
and link its
programs to it.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.18.2, “Contents of Binutils.”
The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.
The following patch contains a number of updates to the 4.8.3 branch by the GCC developers:
patch -Np1 -i ../gcc-4.8.3-branch_update-1.patch
Make a couple of essential adjustments to GCC's specs to ensure GCC uses our build environment:
patch -Np1 -i ../gcc-4.8.3-pure64_specs-1.patch
Change the StartFile Spec so that GCC looks in /tools
:
echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/linux.h echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h
Apply a sed substitution that will suppress the execution of the fixincludes script:
cp -v gcc/Makefile.in{,.orig} sed 's@\./fixinc\.sh@-c true@' gcc/Makefile.in.orig > gcc/Makefile.in
The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory:
mkdir -v ../gcc-build cd ../gcc-build
Before starting to build GCC, remember to unset any environment variables that override the default optimization flags.
Prepare GCC for compilation:
../gcc-4.8.3/configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} --target=${CLFS_TARGET} \ --with-local-prefix=/tools --disable-multilib --disable-nls \ --enable-languages=c,c++ --disable-libstdcxx-pch --with-system-zlib \ --with-native-system-header-dir=/tools/include --disable-libssp \ --enable-checking=release --enable-libstdcxx-time
The meaning of the new configure option:
--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.
The following will prevent GCC from looking in the wrong directories for headers and libraries:
cp -v Makefile{,.orig} sed "/^HOST_\(GMP\|ISL\|CLOOG\)\(LIBS\|INC\)/s:/tools:/cross-tools:g" \ Makefile.orig > Makefile
Compile the package:
make AS_FOR_TARGET="${AS}" \ LD_FOR_TARGET="${LD}"
Install the package:
make install
Install the libiberty
header
file that is needed by some packages:
cp -v ../gcc-4.8.3/include/libiberty.h /tools/include
Details on this package are located in Section 10.19.2, “Contents of GCC.”
The Ncurses package contains libraries for terminal-independent handling of character screens.
We will need Ncurses for several other packages in the temporary environment, including Bash, Util-linux, and Vim.
The following patch fixes an issue with some Bash versions:
patch -Np1 -i ../ncurses-5.9-bash_fix-1.patch
Prepare Ncurses for compilation:
./configure --prefix=/tools --with-shared \ --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --without-debug --without-ada \ --enable-overwrite --with-build-cc=gcc
The meaning of the new configure options:
--with-shared
This tells Ncurses to create a shared library.
--without-debug
This tells Ncurses not to build with debug information.
--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 when building the final system.
--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.
--with-build-cc=gcc
This tells Ncurses which compiler to use to build native tools when cross-compiling.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.22.2, “Contents of Ncurses.”
The Bash package contains the Bourne-Again SHell.
The following patch contains updates from the maintainer. The maintainer of Bash only releases these patches to fix serious issues:
patch -Np1 -i ../bash-4.3-branch_update-5.patch
When Bash is cross-compiled, it cannot test for the presence
of named pipes, among other things. If you used su to become an
unprivileged user, this combination will cause Bash to build
without process
substitution, which will break one of the C++
test scripts in glibc
. The
following prevents future problems by skipping the check for
named pipes, as well as other tests that can not run while
cross-compiling or that do not run properly:
cat > config.cache << "EOF" ac_cv_func_mmap_fixed_mapped=yes ac_cv_func_strcoll_works=yes ac_cv_func_working_mktime=yes bash_cv_func_sigsetjmp=present bash_cv_getcwd_malloc=yes bash_cv_job_control_missing=present bash_cv_printf_a_format=yes bash_cv_sys_named_pipes=present bash_cv_ulimit_maxfds=yes bash_cv_under_sys_siglist=yes bash_cv_unusable_rtsigs=no gt_cv_int_divbyzero_sigfpe=yes EOF
Prepare Bash for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --without-bash-malloc --cache-file=config.cache
The meaning of the new configure option:
--without-bash-malloc
This option 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:
make
Install the package:
make install
Details on this package are located in Section 10.37.2, “Contents of Bash.”
The 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.
Bzip2's default Makefile
target
automatically runs the test suite as well. Disable the tests
since they won't work on a multi-architecture build:
cp -v Makefile{,.orig} sed -e 's@^\(all:.*\) test@\1@g' Makefile.orig > Makefile
The Bzip2 package does not contain a configure script. Compile it with:
make CC="${CC}" AR="${AR}" RANLIB="${RANLIB}"
Install the package:
make PREFIX=/tools install
Details on this package are located in Section 10.31.2, “Contents of Bzip2.”
The Check package is a unit testing framework for C.
We will install Check into /tools
to satisfy a dependency on it for
Kbd and Libpipeline in the final system.
Prepare Check for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
Build the package:
make
Install the package:
make install
The Coreutils package contains utilities for showing and setting the basic system characteristics.
Configure can not properly determine how to get free space
when cross-compiling - as a result, the df program will not be
built. Add the following entries to config.cache
to correct this, and fix
various cross-compiling issues:
cat > config.cache << EOF fu_cv_sys_stat_statfs2_bsize=yes gl_cv_func_working_mkstemp=yes EOF
Apply a patch to prevent Coreutils from generating manpages :
patch -Np1 -i ../coreutils-8.22-noman-1.patch
Prepare Coreutils for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --enable-install-program=hostname --cache-file=config.cache
The meaning of the new configure option:
--enable-install-program=hostname
Tells Coreutils to install hostname, which is needed for the Perl test suite.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.27.2, “Contents of Coreutils.”
The Diffutils package contains programs that show the differences between files or directories.
Prepare Diffutils for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.39.2, “Contents of Diffutils.”
The File package contains a utility for determining the type of a given file or files.
Prepare File for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.40.2, “Contents of File.”
The 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).
The following cache entries set the values for tests that do not run while cross-compiling:
echo "gl_cv_func_wcwidth_works=yes" > config.cache echo "ac_cv_func_fnmatch_gnu=yes" >> config.cache
Prepare Findutils for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --cache-file=config.cache
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.42.2, “Contents of Findutils.”
The Gawk package contains programs for manipulating text files.
Prepare Gawk for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.41.2, “Contents of Gawk.”
The 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.
Many packages' installation procedures use the msgfmt program for i18n
support, so we will compile and install it into /tools
.
Only the programs in the gettext-tools
directory need to be
installed for the temp-system:
cd gettext-tools
When cross-compiling, the Gettext configure script assumes we don't have a working wcwidth even when we do. The following will fix possible compilation errors because of this assumption:
echo "gl_cv_func_wcwidth_works=yes" > config.cache
Prepare Gettext for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --disable-shared --cache-file=config.cache
Compile the required program and support library:
make -C gnulib-lib make -C src msgfmt
Install the msgfmt binary:
cp -v src/msgfmt /tools/bin
Details on this package are located in Section 10.43.2, “Contents of Gettext.”
The Grep package contains programs for searching through files.
Prepare Grep for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --without-included-regex
The meaning of the new configure option:
--without-included-regex
When cross-compiling, Grep's configure assumes
there is no usable regex.h
installed and instead uses
the one included with Grep. This switch forces the use
of the regex functions from Glibc.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.44.2, “Contents of Grep.”
The Gzip package contains programs for compressing and decompressing files.
Prepare Gzip for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.47.2, “Contents of Gzip.”
The Make package contains a program for compiling packages.
Prepare Make for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.52.2, “Contents of Make.”
The Patch package contains a program for modifying or creating files by applying a “patch” file typically created by the diff program.
Prepare Patch for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.55.2, “Contents of Patch.”
The Sed package contains a stream editor.
Prepare Sed for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.20.2, “Contents of Sed.”
The Tar package contains an archiving program.
Configure can not properly determine the results of a few tests. Set them manually:
cat > config.cache << EOF gl_cv_func_wcwidth_works=yes gl_cv_func_btowc_eof=yes ac_cv_func_malloc_0_nonnull=yes gl_cv_func_mbrtowc_incomplete_state=yes gl_cv_func_mbrtowc_nul_retval=yes gl_cv_func_mbrtowc_null_arg1=yes gl_cv_func_mbrtowc_null_arg2=yes gl_cv_func_mbrtowc_retval=yes gl_cv_func_wcrtomb_retval=yes EOF
Prepare Tar for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --cache-file=config.cache
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.61.2, “Contents of Tar.”
The Texinfo package contains programs for reading, writing, and converting info pages.
Prepare Texinfo for compilation:
PERL=/usr/bin/perl ./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
The meaning of the new configure option:
PERL=/usr/bin/perl
This forces Texinfo to use /usr/bin
as the location of
perl, as
some host systems may have it in /bin
.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.62.2, “Contents of Texinfo.”
The Util-linux package contains miscellaneous utility programs. Among them are utilities for handling file systems, consoles, partitions, and messages.
Prepare Util-linux for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --disable-makeinstall-chown --disable-makeinstall-setuid
The meaning of the new configure option:
--disable-makeinstall-chown
This prevents Util-linux from trying to perform any chown commands when it is installed.
--disable-makeinstall-setuid
This prevents Util-linux from enabling the setuid bit on any of its installed programs.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.24.3, “Contents of Util-linux.”
The Vim package contains a powerful text editor.
We will cross-compile Vim so that we can have a text editor
in /tools
. Vim is not
technically necessary in the temporary system, in that it is
not there to satisfy any package dependencies in the final
system, but we believe that a text editor is an extremely
useful tool to have there.
The following patch merges all updates from the 7.4 Branch from the Vim developers:
patch -Np1 -i ../vim-7.4-branch_update-7.patch
The configure script is full of logic that aborts at the first sign of cross compiling. Work around this by setting the cached values of several tests with the following command:
cat > src/auto/config.cache << "EOF" vim_cv_getcwd_broken=no vim_cv_memmove_handles_overlap=yes vim_cv_stat_ignores_slash=no vim_cv_terminfo=yes vim_cv_toupper_broken=no vim_cv_tty_group=world EOF
Change the default location of the vimrc
configuration file to /tools/etc
:
echo '#define SYS_VIMRC_FILE "/tools/etc/vimrc"' >> src/feature.h
Prepare Vim for compilation:
./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --prefix=/tools --enable-gui=no --disable-gtktest --disable-xim \ --disable-gpm --without-x --disable-netbeans --with-tlib=ncurses
The meaning of the new configure options:
--enable-gui=no --disable-gtktest
--disable-xim --disable-gpm --without-x
--disable-netbeans
These options prevent Vim from trying to link to libraries that might be on the host but won't exist inside the temporary build environment.
--with-tlib=ncurses
Tells Vim to use Ncurses as its terminal library.
Compile the package:
make
Install the package:
make install
Many users are accustomed to using vi instead of vim. Some programs, such as vigr and vipw, also use vi. Create a symlink to permit execution of vim when users habitually enter vi and allow programs that use vi to work:
ln -sv vim /tools/bin/vi
Create a temporary vimrc to make it function more the way you may expect it to. This is explained more in the final system:
cat > /tools/etc/vimrc << "EOF"
" Begin /tools/etc/vimrc
set nocompatible
set backspace=2
set ruler
syntax on
" End /tools/etc/vimrc
EOF
Details on this package are located in Section 10.64.3, “Contents of Vim.”
The XZ Utils package contains programs for compressing and decompressing files. Compressing text files with XZ Utils yields a much better compression percentage than with the traditional gzip.
Prepare XZ Utils for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.53.2, “Contents of XZ Utils.”
There are two different ways you can proceed from this point to build the final system. You can build a kernel, a bootloader, and a few other utilities, boot into the temporary system, and build the rest there. Alternatively, you can mount a few virtual filesystems and chroot into the temporary system.
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 CLFS partition. This is very similar to rebooting and instructing the kernel to mount the CLFS partition as the root partition. The major advantage is that “chrooting” allows the builder to continue using the host while CLFS 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.
The main downside to chrooting is that you are more limited in when you can use it - booting will always work for any CLFS build, but the chroot method can only be used when you are building on the same architecture. For example, if you are building on, and for, an x86 system, you can simply chroot. Booting is required when you are compiling for a different architecture, such as building a PowerPC system from an x86. The rule of thumb here is that if the architectures match and you are running the same series kernel (specifically, a 2.6.32 or newer Linux kernel) you can just chroot. If you aren't running the same series kernel, or are wanting to run a different ABI, you will need to use the boot option.
If you are in any doubt about this, you can try the following commands to see if you can chroot:
/tools/lib/libc.so.6 /tools/bin/gcc -v
If either of these commands fail, you will have to follow the boot method.
For the boot method, follow If You Are Going to Boot.
For the chroot method, follow If You Are Going to Chroot.
This chapter shows how to complete the build of temporary tools to create a minimal system that will be used to boot the target machine and to build the final system packages.
The Bc package contains an arbitrary precision numeric processing language.
We will install a bc program that can run on the host system, as this is needed to compile the kernel.
Prepare Bc for compilation:
CC=gcc ./configure --prefix=/cross-tools
The meaning of the configure option:
CC=gcc
This ensures that we use the host's compiler to build Bc, since we need it to run on the host system.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.38.2, “Contents of Bc.”
The Bootscripts package contains a set of scripts to start/stop the CLFS system at bootup/shutdown.
Apply a patch which modifies the scripts for use in
/tools
:
patch -Np1 -i ../bootscripts-cross-lfs-3.0-20140710-tools_updates-2.patch
Install the package:
make DESTDIR=/tools install-minimal
The 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 /tools/etc/sysconfig/clock
file (which
tells the hwclock program which
timezone the user is in). There is no way to detect whether
or not the hardware clock is set to UTC, so this needs to be
configured manually.
If you do not know whether or not the hardware clock is set
to UTC, you can find out after you have booted the new
machine by running the hwclock --localtime --show
command, and if necessary editing the /tools/etc/sysconfig/clock
file. The worst
that will happen if you make a wrong guess here is that the
time displayed will be wrong.
Change the value of the UTC
variable below to a value of 0
(zero) if the hardware clock is not set to UTC time.
cat > /tools/etc/sysconfig/clock << "EOF"
# Begin /tools/etc/sysconfig/clock
UTC=1
# End /tools/etc/sysconfig/clock
EOF
Details on this package are located in Section 11.2.2, “Contents of Bootscripts.”
The E2fsprogs package contains the utilities for handling the
ext2
file system. It also
supports the ext3
and
ext4
journaling file systems.
The E2fsprogs documentation recommends that the package be built in a subdirectory of the source tree:
mkdir -v build cd build
Prepare E2fsprogs for compilation:
../configure --prefix=/tools \ --enable-elf-shlibs --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --disable-libblkid --disable-libuuid --disable-fsck \ --disable-uuidd
The meaning of the configure options:
--enable-elf-shlibs
This creates the shared libraries which some programs in this package use.
--disable-*
This prevents E2fsprogs from building and installing
the libuuid
and
libblkid
libraries, the
uuidd
daemon, and the
fsck
wrapper, as Util-Linux installed all of them earlier.
Compile the package:
make
Install the binaries, documentation and shared libraries:
make install
Install the static libraries and headers:
make install-libs
Details on this package are located in Section 10.26.2, “Contents of E2fsprogs.”
The Kmod package contains programs for loading, inserting and removing kernel modules for Linux. Kmod replaces the Module-Init-tools package.
The following sed changes Kmod's default
module search location to /tools/lib/modules
:
cp -v libkmod/libkmod.c{,.orig} sed '/dirname_default_prefix /s@/lib/modules@/tools&@' \ libkmod/libkmod.c.orig > libkmod/libkmod.c
Prepare Kmod for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} --with-xz --with-zlib
The meaning of the new configure options:
--with-zlib
--with-xz
These allow the Kmod package to handle zlib and XZ compressed kernel modules.
Compile the package:
make
Install the package:
make install
Create symbolic links for programs that expect Module-Init-Tools:
ln -sfv kmod /tools/bin/lsmod for tool in depmod insmod modprobe modinfo rmmod; do ln -sv ../bin/kmod /tools/sbin/${tool} done
Details on this package are located in Section 10.54.2, “Contents of Kmod.”
The Shadow package contains programs for handling passwords in a secure way.
Run the following sed command to disable the installation of the groups and nologin programs, as better versions of these programs are provided by other packages, and prevent Shadow from setting the suid bit on its installed programs:
cp -v src/Makefile.in{,.orig} sed -e 's/groups$(EXEEXT) //' \ -e 's/= nologin$(EXEEXT)/= /' \ -e 's/\(^suidu*bins = \).*/\1/' \ src/Makefile.in.orig > src/Makefile.in
Tell Shadow to use passwd in /tools/bin
:
cat > config.cache << "EOF" shadow_cv_passwd_dir=/tools/bin EOF
Prepare Shadow for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} --cache-file=config.cache \ --enable-subordinate-ids=no
The meaning of the configure options:
--enable-subordinate-ids=no
Disable subordinate ids option during cross-compile.
Append to config.h
since a test
program will not be ran when cross-compiling:
echo "#define ENABLE_SUBUIDS 1" >> config.h
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.23.4, “Contents of Shadow.”
The Sysvinit package contains programs for controlling the startup, running, and shutdown of the system.
Apply a patch to prevent installation of unneeded programs,
and allow Sysvinit to be installed in /tools
:
patch -Np1 -i ../sysvinit-2.88dsf-tools_updates-1.patch
Compile the package:
make -C src clobber make -C src CC="${CC}"
Install the package:
make -C src ROOT=/tools install
Create a new file /tools/etc/inittab
by running the
following:
cat > /tools/etc/inittab << "EOF"
# Begin /tools/etc/inittab
id:3:initdefault:
si::sysinit:/tools/etc/rc.d/init.d/rc sysinit
l0:0:wait:/tools/etc/rc.d/init.d/rc 0
l1:S1:wait:/tools/etc/rc.d/init.d/rc 1
l2:2:wait:/tools/etc/rc.d/init.d/rc 2
l3:3:wait:/tools/etc/rc.d/init.d/rc 3
l4:4:wait:/tools/etc/rc.d/init.d/rc 4
l5:5:wait:/tools/etc/rc.d/init.d/rc 5
l6:6:wait:/tools/etc/rc.d/init.d/rc 6
ca:12345:ctrlaltdel:/tools/sbin/shutdown -t1 -a -r now
su:S016:once:/tools/sbin/sulogin
EOF
The following command adds the standard virtual terminals to
/tools/etc/inittab
. If your
system only has a serial console skip the following command:
cat >> /tools/etc/inittab << "EOF"
1:2345:respawn:/tools/sbin/agetty --noclear -I '\033(K' tty1 9600
2:2345:respawn:/tools/sbin/agetty --noclear -I '\033(K' tty2 9600
3:2345:respawn:/tools/sbin/agetty --noclear -I '\033(K' tty3 9600
4:2345:respawn:/tools/sbin/agetty --noclear -I '\033(K' tty4 9600
5:2345:respawn:/tools/sbin/agetty --noclear -I '\033(K' tty5 9600
6:2345:respawn:/tools/sbin/agetty --noclear -I '\033(K' tty6 9600
EOF
If your system has a serial console, run the following
command to add the entry to /tools/etc/inittab
.
cat >> /tools/etc/inittab << "EOF"
c0:12345:respawn:/tools/sbin/agetty --noclear 115200 ttyS0 vt100
EOF
Finally, add the end line to /tools/etc/inittab
.
cat >> /tools/etc/inittab << "EOF"
# End /tools/etc/inittab
EOF
The -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. Sending this escape sequence is necessary for people
who use non-ISO 8859-1 screen fonts, but it does not affect
native English speakers.
Details on this package are located in Section 10.60.3, “Contents of Sysvinit.”
The Eudev package contains programs for dynamic creation of device nodes.
Prepare Eudev for compilation:
./configure --prefix=/tools --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --disable-introspection --disable-gtk-doc-html \ --disable-gudev --disable-keymap --with-firmware-path=/tools/lib/firmware \ --enable-libkmod
The meaning of the new configure options:
--disable-introspection
--disable-gtk-doc-html --disable-gudev
--disable-keymap
These switches disable several features which are not needed for the temporary system and have additional dependencies.
--with-firmware-path=/tools/lib/firmware
This allows Eudev to load firmware from /tools/lib/firmware
instead of the
default location of /lib/firmware
.
--enable-libkmod
Allows Eudev to load modules by using libkmod
directly.
Compile the package:
make
Install the package:
make install
Create a directory for storing firmware that can be loaded by udev:
install -dv /tools/lib/firmware
Create a dummy rule so that Eudev will name ethernet devices properly for the system.
echo "# dummy, so that network is once again on eth*" > \ /tools/etc/udev/rules.d/80-net-name-slot.rules
Details on this package are located in Section 10.63.2, “Contents of Eudev.”
The Linux package contains the Linux kernel.
Here a temporary cross-compiled kernel will be built. When configuring it, select the minimal amount of options required to boot the target machine and build the final system. I.e., no support for sound, printers, etc. will be needed.
Also, try to avoid the use of modules if possible, and don't use the resulting kernel image for production systems.
Building 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.
To ensure that your system boots and you can properly run both 32 bit and 64 bit binaries, please make sure that you enable support for ELF and emulations for 32bit ELF into the kernel.
Apply the latest Linux sublevel patch:
xzcat ../patch-3.14.21.xz | patch -Np1 -i -
Prepare for compilation by running the following command:
make mrproper
This 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.
Configure the kernel via a menu-driven interface:
make ARCH=x86_64 CROSS_COMPILE=${CLFS_TARGET}- menuconfig
Compile the kernel image and modules:
make ARCH=x86_64 CROSS_COMPILE=${CLFS_TARGET}-
If the use of kernel modules can't be avoided, a file in
/etc/modprobe.d
may be needed.
Information pertaining to modules and kernel configuration is
located in the kernel documentation in the Documentation
directory of the kernel
sources tree. The modprobe.d
man page may also be of interest.
Install the modules, if the kernel configuration uses them:
make ARCH=x86_64 CROSS_COMPILE=${CLFS_TARGET}- \ INSTALL_MOD_PATH=/tools modules_install
Install the firmware, if the kernel configuration uses them:
make ARCH=x86_64 CROSS_COMPILE=${CLFS_TARGET}- \ INSTALL_MOD_PATH=/tools firmware_install
After kernel compilation is complete, additional steps are
required to complete the installation. Some files need to be
copied to the /tools/boot
directory.
Issue the following commands to install the kernel:
mkdir -pv /tools/boot cp -v arch/x86_64/boot/bzImage /tools/boot/vmlinuz-clfs-3.14.21
System.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 /tools/boot/System.map-3.14.21
The 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 /tools/boot/config-3.14.21
Details on this package are located in Section 13.2.2, “Contents of Linux.”
The GRUB package contains the GRand Unified Bootloader.
If you would like use a different bootloader than this one you can go to the following link for alternative bootloaders and the instructions to use them. http://trac.cross-lfs.org/wiki/bootloaders
Glibc-2.19 does not declare gets():
cp -v grub-core/gnulib/stdio.in.h{,.orig} sed -e '/gets is a/d' grub-core/gnulib/stdio.in.h.orig > grub-core/gnulib/stdio.in.h
Prepare GRUB for compilation:
./configure --prefix=/tools \ --build=${CLFS_HOST} --host=${CLFS_TARGET} \ --disable-werror --enable-grub-mkfont=no --with-bootdir=tools/boot
The meaning of the new configure option:
--enable-grub-mkfont=no
Prevents GRUB from trying to build grub-mkfont, which requires Freetype.
--with-bootdir=tools/boot
This modifies GRUB's default location where it searches for kernel images and installs its bootloader files.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.65.3, “Contents of GRUB.”
The commands in the remainder of the book should be run as
the root
user. Check that
${CLFS} is set in the root
user’s environment before proceeding.
It is time to create some structure in the CLFS file system. Create a standard directory tree by issuing the following commands:
mkdir -pv ${CLFS}/{bin,boot,dev,{etc/,}opt,home,lib/firmware,mnt} mkdir -pv ${CLFS}/{proc,media/{floppy,cdrom},run/{,shm},sbin,srv,sys} mkdir -pv ${CLFS}/var/{lock,log,mail,spool} mkdir -pv ${CLFS}/var/{opt,cache,lib/{misc,locate},local} install -dv -m 0750 ${CLFS}/root install -dv -m 1777 ${CLFS}{/var,}/tmp ln -sv ../run ${CLFS}/var/run mkdir -pv ${CLFS}/usr/{,local/}{bin,include,lib,sbin,src} mkdir -pv ${CLFS}/usr/{,local/}share/{doc,info,locale,man} mkdir -pv ${CLFS}/usr/{,local/}share/{misc,terminfo,zoneinfo} mkdir -pv ${CLFS}/usr/{,local/}share/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 1777 bit mask.
The 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 to
create these directories if you prefer to conform more
strictly to the FHS.
Some programs use hard-wired paths to files 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 the next chapter after the software has been installed.
ln -sv /tools/bin/{bash,cat,echo,grep,login,pwd,stty} ${CLFS}/bin ln -sv /tools/bin/file ${CLFS}/usr/bin ln -sv /tools/lib/libgcc_s.so{,.1} ${CLFS}/usr/lib ln -sv /tools/lib/libstdc++.so{.6,} ${CLFS}/usr/lib sed -e 's/tools/usr/' /tools/lib/libstdc++.la > ${CLFS}/usr/lib/libstdc++.la ln -sv bash ${CLFS}/bin/sh ln -sv /tools/sbin/init ${CLFS}/sbin ln -sv /tools/etc/{login.{access,defs},limits} ${CLFS}/etc
The purpose of each link:
/bin/bash
Many bash
scripts specify /bin/bash
.
/bin/cat
This pathname is hard-coded into Glibc's configure script.
/bin/echo
This is to satisfy one of the tests in Glibc's test
suite, which expects /bin/echo
.
/bin/grep
This to avoid a hard-coded /tools
reference in Libtool.
/bin/login
The agetty
program expects to find login in /bin
.
/bin/pwd
Some configure scripts, particularly Glibc's, have this pathname hard-coded.
/bin/stty
This pathname is hard-coded into Expect, therefore it is needed for Binutils and GCC test suites to pass.
/usr/bin/file
Binutils' configure scripts specify this command location.
/usr/lib/libgcc_s.so{,.1}
Glibc needs this for the pthreads library to work.
/usr/lib/libstdc++{,.6}
This is needed by several tests in Glibc's test suite, as well as for C++ support in GMP.
/usr/lib/libstdc++.la
This prevents a /tools
reference that would otherwise be in /usr/lib/libstdc++.la
after GCC is
installed.
/bin/sh
Many shell scripts hard-code /bin/sh
.
/sbin/init
This is where the kernel expects to find init.
/etc/{login.{access,defs},limits}
These are configuration files used by Shadow and are
expected to be found in /etc
, for programs such as login and su to work.
To enable some C++ tests in the Glibc and Binutils test suites to link, create a directory and make some symbolic links:
mkdir -pv ${CLFS}/usr/lib64 ln -sv /tools/lib/libstdc++.so{.6,} ${CLFS}/usr/lib64
Historically, Linux maintains a list of the mounted file
systems in the file /etc/mtab
.
Modern kernels maintain this list internally and expose it to
the user via the /proc
filesystem. To satisfy utilities that expect the presence of
/etc/mtab
, create the following
symbolic link:
ln -sv /proc/self/mounts ${CLFS}/etc/mtab
When 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 these by running the
following commands:
mknod -m 0600 ${CLFS}/dev/console c 5 1 mknod -m 0666 ${CLFS}/dev/null c 1 3
In 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 ${CLFS}/etc/passwd
file by running the following command:
cat > ${CLFS}/etc/passwd << "EOF"root::0:0:root:/root:/bin/bash
bin:x:1:1:/bin:/bin/false
daemon:x:2:6:/sbin:/bin/false
nobody:x:65534:65533:Unprivileged User:/dev/null:/bin/false
EOF
The actual password for root
(the “::” used here is
just a placeholder and allows you to login with no password)
will be set later.
Additional users you may want to add if not already included:
adm:x:3:16:adm:/var/adm:/bin/false
Was used for programs that performed administrative tasks.
lp:x:10:9:lp:/var/spool/lp:/bin/false
Used by programs for printing
mail:x:30:30:mail:/var/mail:/bin/false
Often used by email programs
messagebus:x:27:27:D-Bus Message Daemon
User:/dev/null:/bin/false
User for D-Bus
news:x:31:31:news:/var/spool/news:/bin/false
Often used for network news servers
operator:x:50:0:operator:/root:/bin/bash
Often used to allow system operators to access the system
postmaster:x:51:30:postmaster:/var/spool/mail:/bin/false
Generally used as an account that receives all the information of troubles with the mail server
Create the ${CLFS}/etc/group
file
by running the following command:
cat > ${CLFS}/etc/group << "EOF"
root:x:0:
bin:x:1:
sys:x:2:
kmem:x:3:
tty:x:5:
tape:x:4:
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:
adm:x:16:
mail:x:30:
wheel:x:39:
nogroup:x:65533:
EOF
Additional groups you may want to add if not already included:
console:x:17:
This group has direct access to the console
cdrw:x:18:
This group is allowed to use the CDRW drive
messagebus:x:27:
User for D-Bus
news:x:31:news
Used by Network News Servers
users:x:1000:
The default GID used by shadow for new users
nobody:x:65533:
This is used by NFS
The created groups are not part of any standard—they are groups decided on in part by the requirements of the Systemd configuration in the final system, 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.
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 ${CLFS}/var/log/{btmp,lastlog,wtmp} chgrp -v 13 ${CLFS}/var/log/lastlog chmod -v 664 ${CLFS}/var/log/lastlog chmod -v 600 ${CLFS}/var/log/btmp
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.
The /etc/fstab
file is used by
some programs to determine where file systems are to be mounted
by default, which must be checked, and in which order. Create a
new file systems table like this:
cat > ${CLFS}/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 0
devpts /dev/pts devpts gid=5,mode=620 0 0
shm /dev/shm tmpfs defaults 0 0
# End /etc/fstab
EOF
Replace [xxx]
,
[yyy]
, and [fff]
with the values
appropriate for the system, for example, sda2
, sda5
, and
ext2
. For details on the six
fields in this file, see man 5
fstab.
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, see Documentation/filesystems/tmpfs.txt
in the
kernel source tree.
The new instance of the shell that will start when the system
is booted is a login
shell, which will read the .bash_profile
file. Create .bash_profile
now:
cat > ${CLFS}/root/.bash_profile << "EOF"
set +h
PS1='\u:\w\$ '
LC_ALL=POSIX
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin:/tools/sbin
export LC_ALL PATH PS1
EOF
The LC_ALL
variable controls the
localization of certain programs, making their messages follow
the conventions of a specified country. Setting LC_ALL
to “POSIX” or “C” (the two are equivalent) ensures that
everything will work as expected on your temporary system.
By putting /tools/bin
and
/tools/sbin
at the end of the
standard PATH
, all the programs
installed in Constructing
a Temporary System are only picked up by the shell if they
have not yet been built on the target system. This
configuration forces use of the final system binaries as they
are built over the temp-system, minimising the chance of final
system programs being built against the temp-system.
We will need to copy our build variables into our new system:
echo export BUILD64=\""${BUILD64}\"" >> ${CLFS}/root/.bash_profile
Currently, the /tools
and
/cross-tools
directories are
owned by the user clfs,
a user that exists only on the host system. Although
/tools
and /cross-tools
can be deleted once the CLFS
system has been finished, they can be retained to build
additional CLFS systems. If the /tools
and /cross-tools
directories are kept as is, the
files are owned by a user ID without a corresponding account.
This is dangerous because a user account created later could
get this same user ID and would own these directories and all
the files therein, thus exposing those files to possible
malicious manipulation.
One possible fix for this issue might be to add the
clfs
user to the new CLFS
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
and /cross-tools
directories to user root
by running the following commands:
chown -Rv 0:0 ${CLFS}/tools chown -Rv 0:0 ${CLFS}/cross-tools
Most likely, you have been using a web browser or PDF viewer to
read the CLFS book so far. However, the temporary system in
/tools
does not have any of
these, so you will need to find a way to continue following the
book after booting into the temporary build environment.
Possible solutions include:
Simply have the book open on another computer, or even read a printed copy, though one downside to this is that you cannot copy-and-paste commands.
Convert the CLFS book into plain text, thus allowing it to be viewed with more or view, by using a command such as the following:
lynx -dump /path/to/clfs/book.html > ${CLFS}/root/CLFS-book.txt
Cross-compile and install additional programs before booting, such as Lynx or Links to view the book, or Dropbear to allow remote login. See the CLFS Hints website at http://hints.cross-lfs.org/index.php/ for more suggestions by other users.
This chapter shows how to prepare a chroot jail to build the final system packages into.
The commands in the remainder of the book should be run as
the root
user. Check that
${CLFS} is set in the root
user’s environment before proceeding.
Various 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 ${CLFS}/{dev,proc,run,sys}
Two device nodes, /dev/console
and /dev/null
, are required to be
present on the file system. These are needed by the kernel even
before starting Udev early in the boot process, so we create
them here:
mknod -m 600 ${CLFS}/dev/console c 5 1 mknod -m 666 ${CLFS}/dev/null c 1 3
Once the system is complete and booting, the rest of our device
nodes will be created by the kernel's devtmpfs
file system. For now though, we
will just use the “bind”
option in the mount command to make our host system's
/dev
structure appear in the new
CLFS file system:
mount -v -o bind /dev ${CLFS}/dev
Now mount the remaining file systems:
mount -vt devpts -o gid=5,mode=620 devpts ${CLFS}/dev/pts mount -vt proc proc ${CLFS}/proc mount -vt tmpfs tmpfs ${CLFS}/run mount -vt sysfs sysfs ${CLFS}/sys
On some host systems, /dev/shm
is
a symbolic link to /run/shm
. If
it is, create a directory in /run
:
[ -h ${CLFS}/dev/shm ] && mkdir -pv ${CLFS}/$(readlink ${CLFS}/dev/shm)
Remember that if for any reason you stop working on the CLFS system and start again later, it is important to check that these file systems are mounted again before entering the chroot environment.
It is time to enter the chroot environment to begin building
and installing the final CLFS system. As user root
, run the following command to enter
the realm that is, at the moment, populated with only the
temporary tools:
chroot "${CLFS}" /tools/bin/env -i \ HOME=/root TERM="${TERM}" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ /tools/bin/bash --login +h
The -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
or CXXFLAGS
,
this is a good place to set them again.
From this point on, there is no need to use the CLFS
variable anymore, because all work will be
restricted to the CLFS file system. This is because the Bash
shell is told that ${CLFS}
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.
Currently, the /tools
and
/cross-tools
directories are
owned by the user clfs,
a user that exists only on the host system. Although
/tools
and /cross-tools
can be deleted once the CLFS
system has been finished, they can be retained to build
additional CLFS systems. If the /tools
and /cross-tools
directories are kept as is, the
files are owned by a user ID without a corresponding account.
This is dangerous because a user account created later could
get this same user ID and would own these directories and all
the files therein, thus exposing those files to possible
malicious manipulation.
One possible fix for this issue might be to add the
clfs
user to the new CLFS
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
and /cross-tools
directories to user root
by running the following commands:
chown -Rv 0:0 /tools chown -Rv 0:0 /cross-tools
The commands use 0:0
instead of root:root
,
because chown is
unable to resolve the name “root” until the passwd
file has been created.
It is time to create some structure in the CLFS file system. Create a standard directory tree by issuing the following commands:
mkdir -pv /{bin,boot,dev,{etc/,}opt,home,lib,mnt} mkdir -pv /{proc,media/{floppy,cdrom},run/shm,sbin,srv,sys} mkdir -pv /var/{lock,log,mail,spool} mkdir -pv /var/{opt,cache,lib/{misc,locate},local} install -dv -m 0750 /root install -dv -m 1777 {/var,}/tmp ln -sv ../run /var/run mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src} mkdir -pv /usr/{,local/}share/{doc,info,locale,man} mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo} mkdir -pv /usr/{,local/}share/man/man{1..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 1777 bit mask.
The 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 to
create these directories if you prefer to conform more
strictly to the FHS.
Some programs use hard-wired paths to files 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 the next chapter after the software has been installed.
ln -sv /tools/bin/{bash,cat,echo,grep,pwd,stty} /bin ln -sv /tools/bin/file /usr/bin ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib ln -sv /tools/lib/libstdc++.so{.6,} /usr/lib sed -e 's/tools/usr/' /tools/lib/libstdc++.la > /usr/lib/libstdc++.la ln -sv bash /bin/sh
The purpose of each link:
/bin/bash
Many bash
scripts specify /bin/bash
.
/bin/cat
This pathname is hard-coded into Glibc's configure script.
/bin/echo
This is to satisfy one of the tests in Glibc's test
suite, which expects /bin/echo
.
/bin/grep
This to avoid a hard-coded /tools
reference in Libtool.
/bin/login
The agetty
program expects to find login in /bin
.
/bin/pwd
Some configure scripts, particularly Glibc's, have this pathname hard-coded.
/bin/stty
This pathname is hard-coded into Expect, therefore it is needed for Binutils and GCC test suites to pass.
/usr/bin/file
Binutils' configure scripts specify this command location.
/usr/lib/libgcc_s.so{,.1}
Glibc needs this for the pthreads library to work.
/usr/lib/libstdc++{,.6}
This is needed by several tests in Glibc's test suite, as well as for C++ support in GMP.
/usr/lib/libstdc++.la
This prevents a /tools
reference that would otherwise be in /usr/lib/libstdc++.la
after GCC is
installed.
/bin/sh
Many shell scripts hard-code /bin/sh
.
/sbin/init
This is where the kernel expects to find init.
/etc/{login.{access,defs},limits}
These are configuration files used by Shadow and are
expected to be found in /etc
, for programs such as login and su to work.
To enable some C++ tests in the Glibc and Binutils test suites to link, create a directory and make some symbolic links:
mkdir -pv /usr/lib64 ln -sv /tools/lib/libstdc++.so{.6,} /usr/lib64
Historically, Linux maintains a list of the mounted file
systems in the file /etc/mtab
.
Modern kernels maintain this list internally and expose it to
the user via the /proc
filesystem. To satisfy utilities that expect the presence of
/etc/mtab
, create the following
symbolic link:
ln -sv /proc/self/mounts /etc/mtab
We will need to setup target specific flags for the compiler and linkers.
export BUILD64="-m64"
To prevent errors when you come back to your build, we will export these variables to prevent any build issues in the future:
echo export BUILD64=\""${BUILD64}\"" >> ~/.bash_profile
In 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/bash
bin:x:1:1:/bin:/bin/false
daemon:x:2:6:/sbin:/bin/false
messagebus:x:27:27:D-Bus Message Daemon User:/dev/null:/bin/false
nobody:x:65534:65533:Unprivileged User:/dev/null:/bin/false
EOF
The actual password for root
(the “x” used here is
just a placeholder) will be set later.
Additional users you may want to add if not already included:
adm:x:3:16:adm:/var/adm:/bin/false
Was used for programs that performed administrative tasks.
lp:x:10:9:lp:/var/spool/lp:/bin/false
Used by programs for printing
mail:x:30:30:mail:/var/mail:/bin/false
Often used by email programs
messagebus:x:27:27:D-Bus Message Daemon
User:/dev/null:/bin/false
User for D-Bus
news:x:31:31:news:/var/spool/news:/bin/false
Often used for network news servers
operator:x:50:0:operator:/root:/bin/bash
Often used to allow system operators to access the system
postmaster:x:51:30:postmaster:/var/spool/mail:/bin/false
Generally used as an account that receives all the information of troubles with the mail server
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:5:
tape:x:4:
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:
adm:x:16:
messagebus:x:27:
mail:x:30:
wheel:x:39:
nogroup:x:65533:
EOF
Additional groups you may want to add if not already included:
console:x:17:
This group has direct access to the console
cdrw:x:18:
This group is allowed to use the CDRW drive
messagebus:x:27:
User for D-Bus
news:x:31:news
Used by Network News Servers
users:x:1000:
The default GID used by shadow for new users
nobody:x:65533:
This is used by NFS
The created groups are not part of any standard—they are groups decided on in part by the requirements of the Systemd configuration in the final system, 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.
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/log/{btmp,lastlog,wtmp} chgrp -v utmp /var/log/lastlog chmod -v 664 /var/log/lastlog chmod -v 600 /var/log/btmp
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.
To remove the “I have no
name!” prompt, start a new shell. Since a full
Glibc was installed in Constructing
Cross-Compile Tools 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 +h
Note 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 the next chapters.
This chapter builds the tools needed by some packages to run the tests that they have. I.e., make check. Tcl, Expect, and DejaGNU are needed for the GCC, Binutils, and Findutils test suites. 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.
The Tcl package contains the Tool Command Language.
Increase memory size for regular expressions where required.
sed -i s/500/5000/ generic/regc_nfa.c
Prepare Tcl for compilation:
cd unix ./configure --prefix=/tools
Build the package:
make
Install the package:
make install
Tcl's private header files are needed for the next package, Expect. Install them into /tools:
make install-private-headers
Now make a necessary symbolic link:
ln -sv tclsh8.6 /tools/bin/tclsh
The Expect package contains a program for carrying out scripted dialogues with other interactive programs.
Now prepare Expect for compilation:
./configure --prefix=/tools --with-tcl=/tools/lib \ --with-tclinclude=/tools/include
The meaning of the configure options:
--with-tcl=/tools/lib
This ensures that the configure script finds the Tcl installation in the temporary testsuite-tools location.
--with-tclinclude=/tools/include
This explicitly tells Expect where to find Tcl's internal headers. Using this option avoids conditions where configure fails because it cannot automatically discover the location of the Tcl source directory.
Build the package:
make
Install the package:
make SCRIPTS="" install
The meaning of the make parameter:
SCRIPTS=""
This prevents installation of the supplementary expect scripts, which are not needed.
The DejaGNU package contains a framework for testing other programs.
Prepare DejaGNU for compilation:
./configure --prefix=/tools
Build and install the package:
make install
In this chapter, we enter the building site and start constructing the CLFS system in earnest. 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 compiler optimizations, please review the optimization
hint at http://hints.cross-lfs.org/index.php/Optimization.
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 to compile 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. Also note that the
-march
and -mtune
options may cause problems with the
toolchain packages (Binutils, GCC and Glibc). The small
potential gains achieved in using compiler optimizations are
often outweighed by the risks. First-time builders of CLFS are
encouraged 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
, which will cause the
program to stop working when that directory is removed.
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 take a look at the next page.
Package Management is an often-requested addition to the CLFS Book. A Package Manager allows tracking the installation of files making it easy to remove and upgrade packages. Before you begin to wonder, NO—this section will not talk about nor recommend any particular package manager. What it provides is a roundup of the more popular techniques and how they work. The perfect package manager for you may be among these techniques or may be a combination of two or more of these techniques. This section briefly mentions issues that may arise when upgrading packages.
Some reasons why no specific package manager is recommended in CLFS or CBLFS include:
Dealing with package management takes the focus away from the goals of these books—teaching how a Linux system is built.
There are multiple solutions for package management, each having its strengths and drawbacks. Including one that satisfies all audiences is difficult.
There are some hints written on the topic of package management. Visit the Hints subproject and see if one of them fits your need.
A Package Manager makes it easy to upgrade to newer versions when they are released. Generally the instructions in CLFS and CBLFS can be used to upgrade to the newer versions. Here are some points that you should be aware of when upgrading packages, especially on a running system.
If one of the toolchain packages (Glibc, GCC or Binutils) needs to be upgraded to a newer minor version, it is safer to rebuild CLFS. Though you may be able to get by rebuilding all the packages in their dependency order, we do not recommend it. For example, if glibc-2.2.x needs to be updated to glibc-2.3.x, it is safer to rebuild. For micro version updates, a simple reinstallation usually works, but is not guaranteed. For example, upgrading from glibc-2.3.4 to glibc-2.3.5 will not usually cause any problems.
If a package containing a shared library is updated,
and if the name of the library changes, then all the
packages dynamically linked to the library need to be
recompiled to link against the newer library. (Note
that there is no correlation between the package
version and the name of the library.) For example,
consider a package foo-1.2.3 that installs a shared
library with name libfoo.so.1
. Say you upgrade the
package to a newer version foo-1.2.4 that installs a
shared library with name libfoo.so.2
. In this case, all
packages that are dynamically linked to libfoo.so.1
need to be recompiled to
link against libfoo.so.2
.
Note that you should not remove the previous libraries
until the dependent packages are recompiled.
If you are upgrading a running system, be on the lookout for packages that use cp instead of install to install files. The latter command is usually safer if the executable or library is already loaded in memory.
The following are some common package management techniques. Before making a decision on a package manager, do some research on the various techniques, particularly the drawbacks of the particular scheme.
Yes, this is a package management technique. Some folks do not find the need for a package manager because they know the packages intimately and know what files are installed by each package. Some users also do not need any package management because they plan on rebuilding the entire system when a package is changed.
This is a simplistic package management that does not need
any extra package to manage the installations. Each package
is installed in a separate directory. For example, package
foo-1.1 is installed in /usr/pkg/foo-1.1
and a symlink is made
from /usr/pkg/foo
to
/usr/pkg/foo-1.1
. When
installing a new version foo-1.2, it is installed in
/usr/pkg/foo-1.2
and the
previous symlink is replaced by a symlink to the new
version.
Environment variables such as PATH
, LD_LIBRARY_PATH
, MANPATH
, INFOPATH
and CPPFLAGS
need to be expanded
to include /usr/pkg/foo
. For
more than a few packages, this scheme becomes unmanageable.
This is a variation of the previous package management
technique. Each package is installed similar to the
previous scheme. But instead of making the symlink, each
file is symlinked into the /usr
hierarchy. This removes the need to
expand the environment variables. Though the symlinks can
be created by the user to automate the creation, many
package managers have been written using this approach. A
few of the popular ones include Stow, Epkg, Graft, and
Depot.
The installation needs to be faked, so that the package
thinks that it is installed in /usr
though in reality it is installed in
the /usr/pkg
hierarchy.
Installing in this manner is not usually a trivial task.
For example, consider that you are installing a package
libfoo-1.1. The following instructions may not install the
package properly:
./configure --prefix=/usr/pkg/libfoo/1.1 make make install
The installation will work, but the dependent packages may
not link to libfoo as you would expect. If you compile a
package that links against libfoo, you may notice that it
is linked to /usr/pkg/libfoo/1.1/lib/libfoo.so.1
instead of /usr/lib/libfoo.so.1
as you would expect.
The correct approach is to use the DESTDIR
strategy to fake installation of the
package. This approach works as follows:
./configure --prefix=/usr make make DESTDIR=/usr/pkg/libfoo/1.1 install
Most packages support this approach, but there are some
which do not. For the non-compliant packages, you may
either need to manually install the package, or you may
find that it is easier to install some problematic packages
into /opt
.
In this technique, a file is timestamped before the installation of the package. After the installation, a simple use of the find command with the appropriate options can generate a log of all the files installed after the timestamp file was created. A package manager written with this approach is install-log.
Though this scheme has the advantage of being simple, it has two drawbacks. If, during installation, the files are installed with any timestamp other than the current time, those files will not be tracked by the package manager. Also, this scheme can only be used when one package is installed at a time. The logs are not reliable if two packages are being installed on two different consoles.
In this approach, a library is preloaded before installation. During installation, this library tracks the packages that are being installed by attaching itself to various executables such as cp, install, mv and tracking the system calls that modify the filesystem. For this approach to work, all the executables need to be dynamically linked without the suid or sgid bit. Preloading the library may cause some unwanted side-effects during installation. Therefore, it is advised that one performs some tests to ensure that the package manager does not break anything and logs all the appropriate files.
In this scheme, the package installation is faked into a separate tree as described in the Symlink style package management. After the installation, a package archive is created using the installed files. This archive is then used to install the package either on the local machine or can even be used to install the package on other machines.
This approach is used by most of the package managers found in the commercial distributions. Examples of package managers that follow this approach are RPM (which, incidentally, is required by the Linux Standard Base Specification), pkg-utils, Debian's apt, and Gentoo's Portage system. A hint describing how to adopt this style of package management for CLFS systems is located at http://hints.cross-lfs.org/index.php/Fakeroot.
In the final-system build, you are no longer cross-compiling so it is possible to run package test suites. 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.
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 (if you chrooted) is that
the host system does not have the devpts
file system set up correctly. This
issue is discussed in greater detail at http://trac.cross-lfs.org/wiki/faq#no-ptys.
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://cross-lfs.org/testsuite-logs// to verify whether or not these failures are expected. This site is valid for all tests throughout this book.
The Perl package contains the Practical Extraction and Report Language.
In this section, we will add Perl to the temporary system
in /tools
. This package
installation should technically be part of Constructing
a Temporary System, but Perl has often had problems
with cross-compiling, so we will compile and install it
while in the final build environment.
Change a hardcoded path from /usr/include
to /tools/include
:
sed -i 's@/usr/include@/tools/include@g' ext/Errno/Errno_pm.PL
Prepare Temporary Perl for compilation:
./configure.gnu --prefix=/tools -Dcc="gcc"
The meaning of the configure option:
-Dcc="gcc"
Tells Perl to use gcc instead of the default cc.
Compile the package:
make
Although Perl comes with a test suite, it is not recommended to run it at this point, as this Perl installation is only temporary. The test suite can be run later in this chapter if desired.
Install the package:
make install
Finally, create a necessary symlink:
ln -sfv /tools/bin/perl /usr/bin
Details on this package are located in Section 10.33.2, “Contents of Perl.”
The Linux Kernel contains a make target that installs “sanitized” kernel headers.
For this step you will need to unpack the kernel tarball
(linux-3.14.tar.xz
) and
cd into its
source directory before entering the commands on this page.
Apply the latest Linux sublevel patch:
xzcat ../patch-3.14.21.xz | patch -Np1 -i -
Install the kernel header files:
make mrproper make headers_check make INSTALL_HDR_PATH=/usr headers_install find /usr/include -name .install -or -name ..install.cmd | xargs rm -fv
The meaning of the make commands:
make
mrproper
Ensures that the kernel source dir is clean.
make
headers_check
Sanitizes the raw kernel headers so that they can be used by userspace programs.
make
INSTALL_HDR_PATH=/usr headers_install
This will install the kernel headers into /usr/include
.
find
/usr/include -name .install -or -name ..install.cmd |
xargs rm -fv
Removes a number of unneeded debugging files that were installed.
The Man-pages package contains over 2,200 man pages.
Install Man-pages by running:
make install
This package contains man pages that describe the following: POSIX headers (section 0p), POSIX utilities (section 1p), POSIX functions (section 3p), user commands (section 1), system calls (section 2), libc calls (section 3), device information (section 4), file formats (section 5), games (section 6), conventions and macro packages (section 7), system administration (section 8), and kernel (section 9). |
The 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.
Some packages outside of CLFS 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 can convert
from/to Unicode, therefore libiconv is not required on a
CLFS system.
At the end of the installation, the build system will run a
sanity test to make sure everything installed properly. This
script performs its tests by attempting to compile test
programs against certain libraries. However it does not
specify the path to ld.so
, and
our toolchain is still configured to use the one in
/tools
. The following set of
commands will force the script to use the complete path of
the new ld.so
that was just
installed:
LINKER=$(readelf -l /tools/bin/bash | sed -n 's@.*interpret.*/tools\(.*\)]$@\1@p') sed -i "s|libs -o|libs -L/usr/lib -Wl,-dynamic-linker=${LINKER} -o|" \ scripts/test-installation.pl unset LINKER
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.
Apply the following sed so the tzselect script works properly:
sed -i 's/\\$$(pwd)/`pwd`/' timezone/Makefile
The Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory:
mkdir -v ../glibc-build cd ../glibc-build
Tell Glibc to install its libraries into /lib
:
echo "slibdir=/lib" >> configparms
Prepare Glibc for compilation:
../glibc-2.19/configure --prefix=/usr \ --disable-profile --enable-kernel=2.6.32 \ --libexecdir=/usr/lib/glibc --libdir=/usr/lib \ --enable-obsolete-rpc
The meaning of the new configure option:
--libexecdir=/usr/lib/glibc
This changes the location of the getconf utility from
its default of /usr/libexec
to /usr/lib/glibc
.
Compile the package:
make
Due to Glibc's critical role in a properly functioning system, the CLFS developers strongly recommend running the testsuite.
Use the following commands to run the test suite and output any test failures:
make -k check 2>&1 | tee glibc-check-log; grep Error glibc-check-log
The Glibc test suite is highly dependent on certain functions
of the host system, in particular the kernel. The
posix/annexc and
conform/run-conformtest tests
normally fail and you should see Error
1 (ignored)
in the output. Apart from this, the Glibc
test suite is always expected to pass. However, in certain
circumstances, some failures are unavoidable. If a test fails
because of a missing program (or missing symbolic link), or a
segfault, you will see an error code greater than 127 and the
details will be in the log. More commonly, tests will fail
with Error 2
- for these, the
contents of the corresponding .out
file, e.g. posix/annexc.out
may be informative. Here
is a list of the most common issues:
The nptl/tst-clock2, nptl/tst-attr3, tst/tst-cputimer1, and rt/tst-cpuclock2 tests have been known to fail. The reason is not completely understood, but indications are that minor timing issues can trigger these failures.
The math tests sometimes fail. Certain optimization settings are known to be a factor here.
If you have mounted the CLFS partition with the
noatime
option,
the atime test
will fail. As mentioned in Section 2.5,
“Mounting the New Partition”, do not
use the noatime
option while building CLFS.
When running on older and slower hardware, some tests can fail because of test timeouts being exceeded. Modifying the make check command to set a TIMEOUTFACTOR is reported to help eliminate these errors (e.g. TIMEOUTFACTOR=16 make -k check).
posix/tst-getaddrinfo4 will always fail due to not having a network connection when the test is run.
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.conf
The install will finish by checking that everything is correctly installed. Unfortunately, it will test for a multilib installation. On x86_64 Pure64 this means it will try to test the non-existent 32-bit loader which has a different name from the 64-bit loader (unlike on other 64-bit architectures). We fool it by creating a symlink to the real loader.
ln -sv ld-2.19.so /lib/ld-linux.so.2
Install the package, and remove unneeded files from
/usr/include/rpcsvc
:
make install && rm -v /usr/include/rpcsvc/*.x
Now we can remove this symlink. We also need to correct the /usr/bin/ldd script - if you look at this, you will see it references not only the 32-bit linker, but also /lib64 where it thinks the 64-bit linker is. The following sed will correct this:
rm -v /lib/ld-linux.so.2 sed -i.bak '/RTLDLIST/s%/ld-linux.so.2 /lib64%%' /usr/bin/ldd
Check the script to make sure the sed worked correctly, then delete the backup.
rm -v /usr/bin/ldd.bak
Install the configuration file and runtime directory for nscd:
cp -v ../glibc-2.19/nscd/nscd.conf /etc/nscd.conf mkdir -pv /var/cache/nscd
The locales that can make the system respond in a different language were not installed by the above command. Install them with:
make localedata/install-locales
To save time, an alternative to running the previous command
(which generates and installs every locale listed in the
glibc-2.19/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 locales that 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/locale localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8 localedef -i de_DE -f ISO-8859-1 de_DE localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro localedef -i en_HK -f ISO-8859-1 en_HK localedef -i en_PH -f ISO-8859-1 en_PH localedef -i en_US -f ISO-8859-1 en_US localedef -i es_MX -f ISO-8859-1 es_MX localedef -i fa_IR -f UTF-8 fa_IR localedef -i fr_FR -f ISO-8859-1 fr_FR localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro localedef -i it_IT -f ISO-8859-1 it_IT localedef -i ja_JP -f EUC-JP ja_JP
Some locales installed by the make localedata/install-locales command above are not properly supported by some applications that are in CLFS and CBLFS. Because of the various problems that arise due to application programmers making assumptions that break in such locales, CLFS should not be used in locales that utilize multibyte character sets (including UTF-8) or right-to-left writing order. Numerous unofficial and unstable patches are required to fix these problems, and it has been decided by the CLFS 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-ng package) does not work properly in them. Various attempts to circumvent these restrictions are documented in internationalization-related hints.
The /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.conf
passwd: files
group: files
shadow: files
hosts: files dns
networks: files
protocols: files
services: files
ethers: files
rpc: files
# End /etc/nsswitch.conf
EOF
Install timezone data:
tar -xf ../tzdata2014d.tar.gz ZONEINFO=/usr/share/zoneinfo mkdir -pv $ZONEINFO/{posix,right} for tz in etcetera southamerica northamerica europe africa antarctica \ asia australasia backward pacificnew \ systemv; do zic -L /dev/null -d $ZONEINFO -y "sh yearistype.sh" ${tz} zic -L /dev/null -d $ZONEINFO/posix -y "sh yearistype.sh" ${tz} zic -L leapseconds -d $ZONEINFO/right -y "sh yearistype.sh" ${tz} done cp -v zone.tab iso3166.tab $ZONEINFO zic -d $ZONEINFO -p America/New_York unset ZONEINFO
The meaning of the zic commands:
zic -L
/dev/null ...
This creates posix timezones, without any leap seconds.
It is conventional to put these in both zoneinfo
and zoneinfo/posix
. It is necessary to
put the POSIX timezones in zoneinfo
, otherwise various
test-suites will report errors. On an embedded system,
where space is tight and you do not intend to ever
update the timezones, you could save 1.9MB by not using
the posix
directory, but
some applications or test-suites might give less good
results
zic -L
leapseconds ...
This creates right timezones, including leap seconds.
On an embedded system, where space is tight and you do
not intend to ever update the timezones, or care about
the correct time, you could save 1.9MB by omitting the
right
directory.
zic ... -p
...
This creates the posixrules
file. We use New York
because POSIX requires the daylight savings time rules
to be in accordance with US rules.
To determine the local time zone, run the following script:
tzselect
After 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 /usr/share/zoneinfo/[xxx]
\
/etc/localtime
Replace [xxx]
with
the name of the time zone that tzselect provided (e.g.,
Canada/Eastern).
By default, the dynamic loader (/lib/ld-linux-x86-64.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 additional libraries 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.conf
EOF
Can be used to create a stack trace when a program terminates with a segmentation fault |
|
Generates message catalogues |
|
Displays the system configuration values for file system specific variables |
|
Gets entries from an administrative database |
|
Performs character set conversion |
|
Creates fastloading iconv module configuration files |
|
Configures the dynamic linker runtime bindings |
|
Reports which shared libraries are required by each given program or shared library |
|
Assists ldd with object files |
|
Tells the compiler to enable or disable the use of POSIX locales for built-in operations |
|
Compiles locale specifications |
|
Creates a simple database from textual input |
|
Reads and interprets a memory trace file and displays a summary in human-readable format |
|
A daemon that provides a cache for the most common name service requests |
|
Dumps information generated by PC profiling |
|
Lists dynamic shared objects used by running processes |
|
Generates C code to implement the Remote Procecure Call (RPC) protocol |
|
A statically linked program that creates symbolic links |
|
Traces shared library procedure calls of a specified command |
|
Reads and displays shared object profiling data |
|
Asks the user about the location of the system and reports the corresponding time zone description |
|
Traces the execution of a program by printing the currently executed function |
|
The time zone dumper |
|
The time zone compiler |
|
The helper program for shared library executables |
|
Used by programs, such as Mozilla, to solve broken locales |
|
The segmentation fault signal handler |
|
An asynchronous name lookup library |
|
The main C library |
|
Used internally by Glibc for handling
internationalized domain names in the |
|
The cryptography library |
|
The dynamic linking interface library |
|
A runtime library for g++ |
|
The Institute of Electrical and Electronic Engineers (IEEE) floating point library |
|
The mathematical library |
|
Contains code run at boot |
|
Used by memusage (included in Glibc, but not built in a base CLFS system as it has additional dependencies) to help collect information about the memory usage of a program |
|
The network services library |
|
The Name Service Switch libraries, containing functions for resolving host names, user names, group names, aliases, services, protocols, etc. |
|
Contains profiling functions used to track the amount of CPU time spent in specific source code lines |
|
The POSIX threads library |
|
Contains functions for creating, sending, and interpreting packets to the Internet domain name servers |
|
Contains functions providing miscellaneous RPC services |
|
Contains functions providing most of the interfaces specified by the POSIX.1b Realtime Extension |
|
Contains functions useful for building debuggers for multi-threaded programs |
|
Contains code for “standard” functions used in many different Unix utilities |
Now we adjust GCC's specs so that they point to the new dynamic linker. A perl command accomplishes this:
gcc -dumpspecs | \ perl -p -e 's@/tools/lib/ld@/lib/ld@g;' \ -e 's@\*startfile_prefix_spec:\n@$_/usr/lib/ @g;' > \ $(dirname $(gcc --print-libgcc-file-name))/specs
The perl command
above makes 2 modifications to GCC's specs: it removes
“/tools” from the
pathname to the dynamic linker, and adds “/usr/lib/” to the startfile_prefix_spec.
It is a good idea to visually inspect the specs
file, and compare with the output of
gcc -dumpspecs,
to verify that the intended changes were actually made.
It 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.c gcc dummy.c readelf -l a.out | grep ': /lib'
If everything is working correctly, there should be no errors, and the output of the last command will be:
[Requesting program interpreter: /lib/ld-linux-x86-64.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.out
The M4 package contains a macro processor.
Prepare M4 for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
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 a compiler or as a macro processor in its own right. |
GMP is a library for arithmetic on arbitrary precision integers, rational numbers, and floating-point numbers.
If you are compiling this package on a different CPU than
you plan to run the CLFS system on, you must replace GMP's
config.guess
and config.sub
wrappers with the originals.
This will prevent GMP from optimizing for the wrong CPU.
You can make this change with the following command:
mv -v config{fsf,}.guess mv -v config{fsf,}.sub
Prepare GMP for compilation:
CC="gcc -isystem /usr/include" \ CXX="g++ -isystem /usr/include" \ LDFLAGS="-Wl,-rpath-link,/usr/lib:/lib" \ ./configure --prefix=/usr --enable-cxx \ --docdir=/usr/share/doc/gmp-6.0.0
Compile the package:
make
Build the HTML documentation:
make html
Test the results:
make check
Install the package:
make install
Install the documentation:
make install-html
The MPFR library is a C library for multiple-precision floating-point computations with correct rounding.
Apply a patch with upstream fixes:
patch -Np1 -i ../mpfr-3.1.2-fixes-4.patch
Prepare MPFR for compilation:
CC="gcc -isystem /usr/include" \ LDFLAGS="-Wl,-rpath-link,/usr/lib:/lib" \ ./configure --prefix=/usr --with-gmp=/usr \ --docdir=/usr/share/doc/mpfr-3.1.2
Compile the package:
make
Test the results:
make check
Install the package:
make install
MPC is a C library for the arithmetic of complex numbers with arbitrarily high precision and correct rounding of the result.
Prepare MPC for compilation:
CC="gcc -isystem /usr/include" \ LDFLAGS="-Wl,-rpath-link,/usr/lib:/lib" \ ./configure --prefix=/usr --docdir=/usr/share/doc/mpc-1.0.2
Compile the package:
make
Build the HTML documentation:
make html
Test the results:
make check
Install the package:
make install
Install the HTML documentation:
make install-html
ISL is a library for manipulating sets and relations of integer points bounded by linear constraints.
Prepare ISL for compilation:
CC="gcc -isystem /usr/include" \ LDFLAGS="-Wl,-rpath-link,/usr/lib:/lib" \ ./configure --prefix=/usr
Compile the package:
make
Test the results:
make check
Install the package:
make install
Finally, move a misplaced file:
mkdir -pv /usr/share/gdb/auto-load/usr/lib mv -v /usr/lib/libisl*gdb.py /usr/share/gdb/auto-load/usr/lib
CLooG is a library to generate code for scanning Z-polyhedra. In other words, it finds code that reaches each integral point of one or more parameterized polyhedra. GCC links with this library in order to enable the new loop generation code known as Graphite.
Prepare CLooG for compilation:
CC="gcc -isystem /usr/include" \ LDFLAGS="-Wl,-rpath-link,/usr/lib:/lib" \ ./configure --prefix=/usr --with-isl=system
Apply a sed which prevents the attempted installation of an invalid file:
sed -i '/cmake/d' Makefile
Compile the package:
make
Test the results:
make check
Install the package:
make install
The Zlib package contains compression and decompression routines used by some programs.
Prepare Zlib for compilation:
CC="gcc -isystem /usr/include" \ CXX="g++ -isystem /usr/include" \ LDFLAGS="-Wl,-rpath-link,/usr/lib:/lib" \ ./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The previous command installed two .so
files into /usr/lib
. We will move them into
/lib
and then recreate a link
in /usr/lib
:
mv -v /usr/lib/libz.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so
Install the documentation:
mkdir -pv /usr/share/doc/zlib-1.2.8 cp -rv doc/* examples /usr/share/doc/zlib-1.2.8
The Flex package contains a utility for generating programs that recognize patterns in text.
Prepare Flex for compilation:
./configure --prefix=/usr --docdir=/usr/share/doc/flex-2.5.39
Compile the package:
make
To test the results, issue:
make check
The test suite will report 3 failures for tests that use bison, which is not installed yet. For full test coverage, you can run Flex's test suite again after Bison is installed.
Install the package:
make install
A 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/lex
exec /usr/bin/flex -l "$@"
# End /usr/bin/lex
EOF
chmod -v 755 /usr/bin/lex
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 program |
|
Link to flex which makes it generate C++ scanner classes |
|
A script that runs flex in lex emulation mode |
|
The |
|
The |
The Bison package contains a parser generator.
Prepare Bison for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
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) |
|
A wrapper for bison, meant for
programs that still call yacc instead of
bison; it calls
bison
with the |
|
The Yacc library containing implementations of Yacc-compatible yyerror and main functions; this library is normally not very useful, but POSIX requires it |
The Binutils package contains a linker, an assembler, and other tools for handling object files.
Verify that the PTYs are working properly inside the build environment. Check that everything is set up correctly by performing a simple test:
expect -c "spawn ls"
This command should give the following output:
spawn ls
If, instead, it gives a message saying to create more ptys, then the environment is not set up for proper PTY operation. 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-build cd ../binutils-build
Prepare Binutils for compilation:
CC="gcc -isystem /usr/include" \ LDFLAGS="-Wl,-rpath-link,/usr/lib:/lib" \ ../binutils-2.24/configure --prefix=/usr \ --libdir=/usr/lib --enable-shared \ --disable-multilib --enable-64-bit-bfd
Compile the package:
make tooldir=/usr
The meaning of the make parameter:
tooldir=/usr
Normally, the tooldir (the directory where the
executables will ultimately be located) is set to
$(exec_prefix)/$(target_alias)
.
Because this is a custom system, this target-specific
directory in /usr
is not
required.
Due to Binutils' critical role in a properly functioning system, the CLFS developers strongly recommend running the testsuite.
The ld test
suite accesses /lib64/ld-linux-x86-64.so
in some of the
tests. The following symbolic link will allow this:
ln -sv /lib /lib64
Test the results:
make check
Now remove the temporary symlink:
rm -v /lib64
Now that the tests have completed, remove the symlinks in
/usr/lib64
- they should be the
only things in that directory, so we can remove it without
force:
rm -v /usr/lib64/libstd*so* rmdir -v /usr/lib64
Install the package:
make tooldir=/usr install
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 address |
|
Creates, modifies, and extracts from archives |
|
An assembler that assembles the output of gcc into object files |
|
Used by the linker to de-mangle C++ and Java symbols and to keep overloaded functions from clashing |
|
Updates the ELF header of ELF files |
|
Displays call graph profile data |
|
A linker that combines a number of object and archive files into a single file, relocating their data and tying up symbol references |
|
Hard link to ld |
|
Lists the symbols occurring in a given object file |
|
Translates one type of object file into another |
|
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 tools |
|
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 files |
|
Displays information about ELF type binaries |
|
Lists the section sizes and the total size for the given object files |
|
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 file |
|
Discards symbols from object files |
|
The Binary File Descriptor library |
|
A library for dealing with opcodes—the “readable text” versions of instructions for the processor; it is used for building utilities like objdump. |
The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.
The following patch contains a number of updates to the 4.8.3 branch by the GCC developers:
patch -Np1 -i ../gcc-4.8.3-branch_update-1.patch
Apply the following patch so that GCC links to /lib
instead of /lib64
:
patch -Np1 -i ../gcc-4.8.3-pure64-1.patch
Apply a sed substitution that will suppress the execution of the fixincludes script:
sed -i 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
The GCC documentation recommends building GCC outside of the source directory in a dedicated build directory:
mkdir -v ../gcc-build cd ../gcc-build
Prepare GCC for compilation:
SED=sed CC="gcc -isystem /usr/include" \ CXX="g++ -isystem /usr/include" \ LDFLAGS="-Wl,-rpath-link,/usr/lib:/lib" \ ../gcc-4.8.3/configure --prefix=/usr \ --libexecdir=/usr/lib --enable-threads=posix \ --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ \ --disable-multilib --disable-libstdcxx-pch \ --with-system-zlib --enable-checking=release --enable-libstdcxx-time
The meaning of the new configure option:
SED=sed
This prevents a hard-coded path to /tools/bin/sed
in the fixincl program.
Compile the package:
make
Due to GCC's critical role in a properly functioning system, the CLFS developers strongly recommend running the testsuite.
Increase the stack size prior to running the tests:
ulimit -s 32768
Test the results, but do not stop at errors:
make -k check
The -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-4.8.3/contrib/test_summary
For only the summaries, pipe the output through
grep -A7
Summ
.
A few unexpected failures cannot always be avoided. The GCC developers are usually aware of these issues, but have not resolved them yet.
Install the package:
make install
Install the libiberty
header
file that is needed by some packages:
cp -v ../gcc-4.8.3/include/libiberty.h /usr/include
Some packages expect the C preprocessor to be installed in
the /lib
directory. To support
those packages, create this symlink:
ln -sv ../usr/bin/cpp /lib
Many packages use the name cc to call the C compiler. To satisfy those packages, create a symlink:
ln -sv gcc /usr/bin/cc
Finally, move a misplaced file:
mv -v /usr/lib/libstdc++*gdb.py /usr/share/gdb/auto-load/usr/lib
The C compiler |
|
The C preprocessor; it is used by the compiler to expand the #include, #define, and similar statements in the source files |
|
The C++ compiler |
|
The C++ compiler |
|
The C compiler |
|
A coverage testing tool; it is used to analyze programs to determine where optimizations will have the most effect |
|
The Address Sanitizer runtime library |
|
A GCC support runtime library for atomic operations not supported by hardware |
|
Contains run-time support for gcc |
|
Library that is linked into a program when gcc is instructed to enable profiling |
|
GNU implementation of the OpenMP API for multi-platform shared-memory parallel programming in C/C++ and Fortran |
|
Contains routines used by various GNU programs, including getopt, obstack, strerror, strtol, and strtoul |
|
The GNU Transactional Memory Library, which provides transaction support for accesses to a process's memory |
|
Runtime library for GCC's link-time optimization plugin |
|
The libmudflap libraries are used by GCC for instrumenting pointer and array dereferencing operations. |
|
The GCC Quad-Precision Math Libarary API |
|
Contains routines supporting GCC's stack-smashing protection functionality |
|
The standard C++ library |
|
Provides supporting routines for the C++ programming language |
|
The Thread Sanitizer runtime library |
The Sed package contains a stream editor.
Prepare Sed for compilation:
./configure --prefix=/usr --bindir=/bin \ --docdir=/usr/share/doc/sed-4.2.2
Compile the package:
make
Build the HTML documentation:
make html
To test the results, issue:
make check
Install the package:
make install
Install the HTML documentation:
make -C doc install-html
Pkg-config-lite is a tool to help you insert the correct compiler options on the command line when compiling applications and libraries.
Prepare Pkg-config-lite for compilation:
./configure --prefix=/usr --docdir=/usr/share/doc/pkg-config-0.28-1
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The Ncurses package contains libraries for terminal-independent handling of character screens.
The following patch contains updates from the 5.9 branch by the Ncurses developers:
patch -Np1 -i ../ncurses-5.9-branch_update-4.patch
Prepare Ncurses for compilation:
./configure --prefix=/usr --libdir=/lib \ --with-shared --without-debug --enable-widec \ --with-manpage-format=normal --enable-pc-files \ --with-default-terminfo-dir=/usr/share/terminfo
The meaning of the new configure option:
--with-manpage-format=normal
This tells Ncurses not to compress its installed manpages.
--enable-pc-files
This tells Ncurses to generate and install .pc files for pkg-config.
Compile the package:
make
This package has a test suite, but it can only be run after
the package is installed. The tests are in the test/
directory. See the README
file in that directory for details.
Install the package:
make install
Move the Ncurses static libraries to the proper location:
mv -v /lib/lib{panelw,menuw,formw,ncursesw,ncurses++w}.a /usr/lib
Create symlinks in /usr/lib:
ln -svf ../../lib/$(readlink /lib/libncursesw.so) /usr/lib/libncursesw.so ln -svf ../../lib/$(readlink /lib/libmenuw.so) /usr/lib/libmenuw.so ln -svf ../../lib/$(readlink /lib/libpanelw.so) /usr/lib/libpanelw.so ln -svf ../../lib/$(readlink /lib/libformw.so) /usr/lib/libformw.so rm -v /lib/lib{ncursesw,menuw,panelw,formw}.so
Many packages that use Ncurses will compile just fine against the widechar libraries, but won't know to look for them. Create linker scripts and symbolic links to allow older and non-widec compatible programs to build properly:
for lib in curses ncurses form panel menu ; do echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so ln -sfv lib${lib}w.a /usr/lib/lib${lib}.a done ln -sfv libncursesw.so /usr/lib/libcursesw.so ln -sfv libncursesw.a /usr/lib/libcursesw.a ln -sfv libncurses++w.a /usr/lib/libncurses++.a ln -sfv ncursesw5-config /usr/bin/ncurses5-config
Converts a termcap description into a terminfo description |
|
Clears the screen, if possible |
|
Compares or prints out terminfo descriptions |
|
Converts a terminfo description into a termcap description |
|
Provides configuration information for ncurses |
|
Reinitializes a terminal to its default values |
|
Sets and clears tab stops on a terminal |
|
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 terminal |
|
Lists all available terminal types, giving the primary name and description for each |
|
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 name |
|
Can be used to initialize terminals |
|
A link to |
|
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 menuconfig |
|
Contains functions to implement forms |
|
Contains functions to implement menus |
|
Contains functions to implement panels |
The Shadow package contains programs for handling passwords in a secure way.
If you would like to enforce the use of strong passwords, refer to http://cblfs.cross-lfs.org/index.php/Cracklib for installing Cracklib prior to building Shadow. After Cracklib is installed, execute this sed in Shadow's source directory to correct the path to the Cracklib dictionary:
sed -i 's@\(DICTPATH.\).*@\1/lib/cracklib/pw_dict@' etc/login.defs
Finally, add --with-libcrack
to the
configure
command below.
Disable the installation of the groups and nologin programs and their man pages, as better versions of these programs are provided by Coreutils and Util-linux:
sed -i src/Makefile.in \ -e 's/groups$(EXEEXT) //' -e 's/= nologin$(EXEEXT)/= /' find man -name Makefile.in -exec sed -i \ -e 's/man1\/groups\.1 //' -e 's/man8\/nologin\.8 //' '{}' \;
Prepare Shadow for compilation:
./configure --sysconfdir=/etc
The meaning of the new configure option:
--sysconfdir=/etc
Tells Shadow to install its configuration files into
/etc
, rather than
/usr/etc
.
Compile the package:
make
This package does not come with a test suite.
Install the package:
make install
Instead of using the default
DES method, use the
more secure SHA512
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. Use the following sed command to make these
changes to the appropriate configuration file:
sed -i /etc/login.defs \ -e 's@#\(ENCRYPT_METHOD \).*@\1SHA512@' \ -e 's@/var/spool/mail@/var/mail@'
Move a misplaced program to its proper location:
mv -v /usr/bin/passwd /bin
This 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, pop3 daemons, 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:
pwconv
To enable shadowed group passwords, run:
grpconv
To view or change the default settings for new user accounts
that you create, you can edit /etc/default/useradd
. See man useradd or
http://cblfs.cross-lfs.org/index.php/Configuring_for_Adding_Users
for more information.
Choose a password for user root
and set it by running:
passwd root
Used to change the maximum number of days between obligatory password changes |
|
Used to change a user's full name and other information |
|
Used to update group passwords in batch mode |
|
Used to update the passwords of an entire series of user accounts |
|
Used to change a user's default login shell |
|
Checks and enforces the current password expiration policy |
|
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 count |
|
Is used to add and delete members and administrators to groups |
|
Creates a group with the given name |
|
Deletes the group with the given name |
|
Allows a user to administer his/her own group membership list without the requirement of superuser privileges |
|
Is used to modify the given group's name or GID |
|
Verifies the integrity of the group files
|
|
Creates or updates the shadow group file from the normal group file |
|
Updates |
|
Reports the most recent login of all users or of a given user |
|
Is used by the system to let users sign on |
|
Is a daemon used to enforce restrictions on log-on time and ports |
|
Is used to change the current GID during a login session |
|
Is used to create or update an entire series of user accounts |
|
Is used to change the password for a user or group account |
|
Verifies the integrity of the password files
|
|
Creates or updates the shadow password file from the normal password file |
|
Updates |
|
Executes a given command while the user's GID is set to that of the given group |
|
Runs a shell with substitute user and group IDs |
|
Creates a new user with the given name, or updates the default new-user information |
|
Deletes the given user account |
|
Is used to modify the given user's login name, User Identification (UID), shell, initial group, home directory, etc. |
|
Edits the |
|
Edits the |
The Util-linux package contains miscellaneous utility programs. Among them are utilities for handling file systems, consoles, partitions, and messages.
The 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 -e 's@etc/adjtime@var/lib/hwclock/adjtime@g' \ $(grep -rl '/etc/adjtime' .) mkdir -pv /var/lib/hwclock
findmnt and
lsblk can
utilize libudev
for WWN and
serial number information. If this is desired, rebuild
Util-linux after Section 10.63,
“Eudev-1.7”
Prepare Util-linux for compilation:
./configure --enable-write --docdir=/usr/share/doc/util-linux-2.24.2
The meaning of the configure options:
--enable-write
This option allows the write program to be installed.
Compile the package:
make
To test the results, issue:
chown -Rv nobody . && su nobody -s /bin/bash -c "PATH=$PATH make -k check"
Install the package:
make install
Move the logger
binary to /bin
as it is needed
by the CLFS Bootscripts package:
mv -v /usr/bin/logger /bin
Informs the kernel of a new partition |
|
Opens a tty port, prompts for a login name, and then invokes the login program |
|
Discards sectors on a device |
|
A command line utility to locate and print block device attributes |
|
Allows users to call block device ioctls from the command line |
|
Displays a simple calendar |
|
Manipulates the partition table of the given device |
|
Utility to configure CPUs |
|
Manipulates real-time attributes of a process |
|
Filters out reverse line feeds |
|
Filters nroff output for terminals that lack some capabilities, such as overstriking and half-lines |
|
Filters out the given columns |
|
Formats a given file into multiple columns |
|
Sets the function of the Ctrl+Alt+Del key combination to a hard or a soft reset |
|
Tunes the parameters of the serial line drivers for Cyclades cards |
|
Asks the kernel to remove a partition |
|
Dumps the kernel boot messages |
|
Eject removable media |
|
Preallocates space to a file |
|
Low-level formats a floppy disk |
|
Manipulates the partition table of the given device |
|
Finds a file system by label or Universally Unique Identifier (UUID) |
|
Lists mounted filesystems or searches for a filesystem |
|
Acquires a file lock and then executes a command with the lock held |
|
Is used to check, and optionally repair, file systems |
|
Performs a consistency check on the Cramfs file system on the given device |
|
Performs a consistency check on the Minix file system on the given device |
|
Suspends and resumes access to a filesystem |
|
Discards unused blocks on a mounted filesystem |
|
Parses options in the given command line |
|
Dumps the given file in hexadecimal or in another given format |
|
Reads or sets the system's hardware clock, also called the Real-Time Clock (RTC) or Basic Input-Output System (BIOS) clock |
|
Gives and sets program I/O scheduling class and priority |
|
Creates various IPC resources |
|
Removes the given Inter-Process Communication (IPC) resource |
|
Provides IPC status information |
|
Reports the size of an iso9660 file system |
|
Send a signal to a process |
|
Shows which users last logged in (and out),
searching back through the |
|
Shows the failed login attempts, as logged in
|
|
Attaches a line discipline to a serial line |
|
Enters the given message into the system log |
|
Displays lines that begin with the given string |
|
Sets up and controls loop devices |
|
Prints information about block devices |
|
Prints CPU architecture information |
|
Lists local system locks |
|
Generates magic cookies (128-bit random hexadecimal numbers) for xauth |
|
Controls whether other users can send messages to the current user's terminal |
|
Builds a file system on a device (usually a hard disk partition) |
|
Creates a Santa Cruz Operations (SCO) bfs file system |
|
Creates a cramfs file system |
|
Creates a Minix file system |
|
Initializes the given device or file to be used as a swap area |
|
A filter for paging through text one screen at a time |
|
Attaches the file system on the given device to a specified directory in the file-system tree |
|
Tells you whether or not a directory is a mount point. |
|
Shows the symbolic links in the given pathnames |
|
Displays a message that an account is not available. Designed to be used as the default shell for accounts that have been disabled |
|
Runs a program with namespaces of other processes |
|
Tells the kernel about the presence and numbering of on-disk partitions |
|
Displays a text file one screen full at a time |
|
Makes the given file system the new root file system of the current process |
|
Gets and sets a process' resource limits |
|
Binds a Linux raw character device to a block device |
|
Reads kernel profiling information |
|
Renames the given files, replacing a given string with another |
|
Alters the priority of running processes |
|
Asks the Linux kernel to resize a partition |
|
Reverses the lines of a given file |
|
Enters a system sleep state until a specified wakeup time |
|
Makes a typescript of a terminal session |
|
Plays back typescripts created by script |
|
Changes reported architecture in new program environment and sets personality flags |
|
Runs the given program in a new session |
|
Sets terminal attributes |
|
A disk partition table manipulator |
|
Allows root to log in; it is normally invoked by init when the system goes into single user mode |
|
Prints or changes the label or UUID of a swap area |
|
Disables devices and files for paging and swapping |
|
Enables devices and files for paging and swapping and lists the devices and files currently in use |
|
Switches to another filesystem as the root of the mount tree |
|
Tracks the growth of a log file. Displays the last 10 lines of a log file, then continues displaying any new entries in the log file as they are created |
|
Retrieves or sets a process's CPU affinity |
|
A filter for translating underscores into escape sequences indicating underlining for the terminal in use |
|
Disconnects a file system from the system's file tree |
|
Runs a program with some namespaces unshared from parent |
|
Displays the content of the given login file in a more user-friendly format |
|
A daemon used by the UUID library to generate time-based UUIDs in a secure and guranteed-unique fashion. |
|
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 future |
|
Writes a message to all logged-in users |
|
Show hardware watchdog status |
|
Reports the location of the binary, source, and man page for the given command |
|
Wipes a filesystem signature from a device |
|
Sends a message to the given user if that user has not disabled receipt of such messages |
|
Contains routines for device identification and token extraction |
|
Contains routines for parsing the |
|
Contains routines for generating unique identifiers for objects that may be accessible beyond the local system |
The Procps-ng package contains programs for monitoring processes.
Prepare procps-ng for compilation:
./configure --prefix=/usr --exec-prefix= \ --libdir=/usr/lib --docdir=/usr/share/doc/procps-ng-3.3.9 \ --disable-kill
The meaning of the configure options:
--disable-kill
This switch disables building the kill program - a better version was installed by the Util-linux package.
Compile the package:
make
When using the boot method, two tests will fail if the hostname is not set. If you have booted the temporary system, and want to run the test suite, run the following command:
hostname clfs
If running the testsuite, first disable a test which fails when scripting does not use a tty device:
sed -i -r 's|(pmap_initname)\\\$|\1|' testsuite/pmap.test/pmap.exp make check
Install the package:
make install
Move essential files to a location that can be found if
/usr
is not mounted:
mv -v /usr/bin/pidof /bin mv -v /usr/lib/libprocps.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libprocps.so) /usr/lib/libprocps.so
Reports the amount of free and used memory (both physical and swap memory) in the system |
|
Looks up processes based on their name and other attributes |
|
Reports the PIDs of the given programs |
|
Signals processes based on their name and other attributes |
|
Reports the memory map of the given process |
|
Lists the current running processes |
|
Reports the current working directory of a process |
|
Displays detailed kernel slab cache information in real time |
|
Modifies kernel parameters at run time |
|
Prints a graph of the current system load average |
|
Displays a list of the most CPU intensive processes; it provides an ongoing look at processor activity in real time |
|
Reports how long the system has been running, how many users are logged on, and the system load averages |
|
Reports virtual memory statistics, giving information about processes, memory, paging, block Input/Output (IO), traps, and CPU activity |
|
Shows which users are currently logged on, where, and since when |
|
Runs a given command repeatedly, displaying the first screen-full of its output; this allows a user to watch the output change over time |
|
Contains the functions used by most programs in this package |
The E2fsprogs package contains the utilities for handling the
ext2
file system. It also
supports the ext3
and
ext4
journaling file systems.
The E2fsprogs documentation recommends that the package be built in a subdirectory of the source tree:
mkdir -v build cd build
Prepare E2fsprogs for compilation:
../configure --prefix=/usr --with-root-prefix="" \ --enable-elf-shlibs --disable-libblkid \ --disable-libuuid --disable-fsck \ --disable-uuidd
The 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-*
This prevents E2fsprogs from building and installing
the libuuid
and
libblkid
libraries, the
uuidd
daemon, and the
fsck
wrapper, as Util-Linux installed all of them earlier.
Compile the package:
make
To test the results, issue:
make check
Install the binaries, documentation and shared libraries:
make install
Install the static libraries and headers:
make install-libs
Searches a device (usually a disk partition) for bad blocks |
|
Changes the attributes on a Linux file system |
|
An error table compiler; it converts a table of
error-code names and messages into a C source file
suitable for use with the |
|
A file system debugger; it can be used to examine
and change the state of an |
|
Prints the super block and blocks group information for the file system present on a given device |
|
Reports free space fragmentation information |
|
Is used to check, and optionally repair
|
|
Is used to save critical |
|
Prints the FS type of a given filesystem, given either a device name or label |
|
Displays or changes the file system label on the
|
|
Replays an undo log for an ext2/ext3/ext4 filesystem |
|
Online defragmenter for ext4 filesystems |
|
Reports on how badly fragmented a particular file might be |
|
By default checks |
|
By default checks |
|
By default checks |
|
By default checks |
|
Saves the output of a command in a log file |
|
Lists the attributes of files on a second extended file system |
|
Converts a table of command names and help messages
into a C source file suitable for use with the
|
|
Creates an |
|
By default creates |
|
By default creates |
|
By default creates |
|
By default creates |
|
Used to create a |
|
Can be used to enlarge or shrink an |
|
Adjusts tunable file system parameters on an
|
|
The common error display routine |
|
Used by dumpe2fs, chattr, and lsattr |
|
Contains routines to enable user-level programs to
manipulate an |
|
Provides an interface for creating and updating quota files and ext4 superblock fields |
|
Used by debugfs |
The Coreutils package contains utilities for showing and setting the basic system characteristics.
A known issue with the uname program from this
package is that the -p
switch
always returns unknown
.
The following patch fixes this behavior for all
architectures:
patch -Np1 -i ../coreutils-8.22-uname-1.patch
Now prepare Coreutils for compilation:
FORCE_UNSAFE_CONFIGURE=1 \ ./configure --prefix=/usr \ --enable-no-install-program=kill,uptime \ --enable-install-program=hostname --libexecdir=/usr/lib
The meaning of the configure options:
FORCE_UNSAFE_CONFIGURE=1
Forces Coreutils to compile when using the root user.
Compile the package:
make
Now 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=nobody check-root
The test suite will now be run as the nobody
user. Some tests require that the
user be a member of more than one group. Add a temporary
group and make the user nobody
a part of it so that the tests are
not skipped:
echo "dummy:x:1000:nobody" >> /etc/group
Fix permissions of some files so the non-root user can compile and run the tests:
chown -Rv nobody .
Then run the remainder of the tests as the nobody
user:
su nobody -s /bin/bash \ -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes -k check || true"
Remove the temporary group:
sed -i '/dummy/d' /etc/group
Install the package:
make install
Move programs to the locations specified by the FHS:
mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date} /bin mv -v /usr/bin/{dd,df,echo,false,hostname,ln,ls,mkdir,mknod} /bin mv -v /usr/bin/{mv,pwd,rm,rmdir,stty,true,uname} /bin mv -v /usr/bin/chroot /usr/sbin
Base64 encode/decode data and print to standard output |
|
Strips any path and a given suffix from a file name |
|
Concatenates files to standard output |
|
Changes security context for files and directories |
|
Changes the group ownership of files and directories |
|
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 permissions |
|
Changes the user and/or group ownership of files and directories |
|
Runs a command with the specified directory as the
|
|
Prints the Cyclic Redundancy Check (CRC) checksum and the byte counts of each specified file |
|
Compares two sorted files, outputting in three columns the lines that are unique and the lines that are common |
|
Copies files |
|
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 file |
|
Prints sections of lines, selecting the parts according to given fields or positions |
|
Displays the current time in the given format, or sets the system date |
|
Copies a file using the given block size and count, while optionally performing conversions on it |
|
Reports the amount of disk space available (and used) on all mounted file systems, or only on the file systems holding the selected files |
|
Lists the contents of each given directory (the same as the ls command) |
|
Outputs commands to set the |
|
Strips the non-directory suffix from a file name |
|
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 files |
|
Displays the given strings |
|
Runs a command in a modified environment |
|
Converts tabs to spaces |
|
Evaluates expressions |
|
Prints the prime factors of all specified integer numbers |
|
Does nothing, unsuccessfully; it always exits with a status code indicating failure |
|
Reformats the paragraphs in the given files |
|
Wraps the lines in the given files |
|
Reports a user's group memberships |
|
Prints the first ten lines (or the given number of lines) of each given file |
|
Reports the numeric identifier (in hexadecimal) of the host |
|
Reports or sets the name of the host |
|
Reports the effective user ID, group ID, and group memberships of the current user or specified user |
|
Copies files while setting their permission modes and, if possible, their owner and group |
|
Joins the lines that have identical join fields from two separate files |
|
Creates a hard link with the given name to a file |
|
Makes hard links or soft (symbolic) links between files |
|
Reports the current user's login name |
|
Lists the contents of each given directory |
|
Reports or checks Message Digest 5 (MD5) checksums |
|
Creates directories with the given names |
|
Creates First-In, First-Outs (FIFOs), a “named pipe” in UNIX parlance, with the given names |
|
Creates device nodes with the given names; a device node is a character special file, a block special file, or a FIFO |
|
Creates temporary files in a secure manner; it is used in scripts |
|
Moves or renames files or directories |
|
Runs a program with modified scheduling priority |
|
Numbers the lines from the given files |
|
Runs a command immune to hangups, with its output redirected to a log file |
|
Prints the number of processing units available to the current process |
|
Converts numbers to or from human-readable strings |
|
Dumps files in octal and other formats |
|
Merges the given files, joining sequentially corresponding lines side by side, separated by tab characters |
|
Checks if file names are valid or portable |
|
Is a lightweight finger client; it reports some information about the given users |
|
Paginates and columnates files for printing |
|
Prints the environment |
|
Prints the given arguments according to the given format, much like the C printf function |
|
Produces a permuted index from the contents of the given files, with each keyword in its context |
|
Reports the name of the current working directory |
|
Reports the value of the given symbolic link |
|
Prints the resolved path |
|
Removes files or directories |
|
Removes directories if they are empty |
|
Runs a command with specified security context |
|
Prints a sequence of numbers within a given range and with a given increment |
|
Prints or checks 160-bit Secure Hash Algorithm 1 (SHA1) checksums |
|
Prints or checks SHA224 checksums |
|
Prints or checks SHA256 checksums |
|
Prints or checks SHA384 checksums |
|
Prints or checks SHA512 checksums |
|
Overwrites the given files repeatedly with complex patterns, making it difficult to recover the data |
|
Write a random permutation of the input lines to standard output or a file |
|
Pauses for the given amount of time |
|
Sorts the lines from the given files |
|
Splits the given file into pieces, by size or by number of lines |
|
Displays file or filesystem status |
|
Runs a command with modified buffering operations for its standard streams |
|
Sets or reports terminal line settings |
|
Prints checksum and block counts for each given file |
|
Flushes file system buffers; it forces changed blocks to disk and updates the super block |
|
Concatenates the given files in reverse |
|
Prints the last ten lines (or the given number of lines) of each given file |
|
Reads from standard input while writing both to standard output and to the given files |
|
Compares values and checks file types |
|
Runs a command with a time limit |
|
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 length |
|
Translates, squeezes, and deletes the given characters from standard input |
|
Does nothing, successfully; it always exits with a status code indicating success |
|
Shrinks or expands a file to the specified size |
|
Performs a topological sort; it writes a completely ordered list according to the partial ordering in a given file |
|
Reports the file name of the terminal connected to standard input |
|
Reports system information |
|
Converts spaces to tabs |
|
Discards all but one of successive identical lines |
|
Removes the given file |
|
Reports the names of the users currently logged on |
|
Is the same as ls -l |
|
Reports the number of lines, words, and bytes for each given file, as well as a total line when more than one file is given |
|
Reports who is logged on |
|
Reports the user name associated with the current effective user ID |
|
Repeatedly outputs “y” or a given string until killed |
|
Library used by stdbuf |
The Iana-Etc package provides data for network services and protocols.
The following patch contains xml files which provide updates to the services and protocol files:
xzcat ../iana-etc-2.30-numbers_update-20140202-2.patch.xz | patch -Np1 -i -
The following command converts the raw data provided by IANA
into the correct formats for the /etc/protocols
and /etc/services
data files:
make
This package does not come with a test suite.
Install the package:
make install
The Libtool package contains the GNU generic library support script. It wraps the complexity of using shared libraries in a consistent, portable interface.
Prepare Libtool for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The IPRoute2 package contains programs for basic and advanced IPV4-based networking.
By default, this package builds the arpd program, which 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 using the commands below. If the arpd binary is needed, instructions for compiling Berkeley DB can be found in CBLFS at http://cblfs.cross-lfs.org/index.php/Berkeley_DB.
sed -i '/^TARGETS/s@arpd@@g' misc/Makefile sed -i '/ARPD/d' Makefile sed -i 's/arpd.8//' man/man8/Makefile
Compile the package:
make
This package does not come with a test suite.
Install the package:
make DOCDIR=/usr/share/doc/iproute2-3.14.0 install
Configures network bridges |
|
Connection status utility |
|
Needs description |
|
A shell script wrapper for the ip command |
|
Shows the interface statistics, including the amount of transmitted and received packets by interface |
|
The main executable. It has several different functions:
ip link ip addr allows users to look at addresses and their properties, add new addresses, and delete old ones ip neighbor allows users to look at neighbor bindings and their properties, add new neighbor entries, and delete old ones ip rule allows users to look at the routing policies and change them ip route allows users to look at the routing table and change routing table rules ip tunnel allows users to look at the IP tunnels and their properties, and change them ip maddr allows users to look at the multicast addresses and their properties, and change them ip mroute allows users to set, change, or delete the multicast routing ip monitor allows users to continuously monitor the state of devices, addresses and routes |
|
Provides Linux network statistics. It is a generalized and more feature-complete replacement for the old rtstat program |
|
Shows network statistics |
|
A component of ip route. This is for flushing the routing tables |
|
A component of ip route. This is for listing the routing tables |
|
Displays the contents of |
|
Route monitoring utility |
|
Converts the output of ip -o back into a readable form |
|
Route status utility |
|
Similar to the netstat command; shows active connections |
|
Traffic Controlling Executable; this is for Quality Of Service (QOS) and Class Of Service (COS) implementations tc qdisc allows users to setup the queueing discipline tc class allows users to setup classes based on the queuing discipline scheduling tc estimator allows users to estimate the network flow into a network tc filter allows users to setup the QOS/COS packet filtering tc policy allows users to setup the QOS/COS policies |
The 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.
By default Bzip2 creates some symlinks that use absolute pathnames. The following sed will cause them to be created with relative paths instead:
sed -i -e 's:ln -s -f $(PREFIX)/bin/:ln -s :' Makefile
Make Bzip2 install its manpages in /usr/share/man
instead of /usr/man
:
sed -i 's@X)/man@X)/share/man@g' ./Makefile
The Bzip2 package does not contain a configure script. Compile it with:
make -f Makefile-libbz2_so make clean
The -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.
Recompile the package using a non-shared library and test it:
make
Install the programs:
make PREFIX=/usr install
Install the shared bzip2 binary into the
/bin
directory, make some
necessary symbolic links, and clean up:
cp -v bzip2-shared /bin/bzip2 cp -av libbz2.so* /lib ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so rm -v /usr/bin/{bunzip2,bzcat,bzip2} ln -sv bzip2 /bin/bunzip2 ln -sv bzip2 /bin/bzcat
Decompresses bzipped files |
|
Decompresses to standard output |
|
Runs cmp on bzipped files |
|
Runs diff on bzipped files |
|
Runs egrep on bzipped files |
|
Runs fgrep on bzipped files |
|
Runs grep on bzipped files |
|
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 gzip |
|
Tries to recover data from damaged bzipped files |
|
Runs less on bzipped files |
|
Runs more on bzipped files |
|
The library implementing lossless, block-sorting data compression, using the Burrows-Wheeler algorithm |
The GDBM package contains the GNU Database Manager. This is a disk file format database which stores key/data-pairs in single files. The actual data of any record being stored is indexed by a unique key, which can be retrieved in less time than if it was stored in a text file.
Prepare GDBM for compilation:
./configure --prefix=/usr --enable-libgdbm-compat
The meaning of the configure option:
--enable-libgdbm-compat
This switch enables the libgdbm compatibility library to be built, as some packages outside of CLFS may require the older DBM routines it provides.
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The Perl package contains the Practical Extraction and Report Language.
By default, Perl's Compress::Raw::Zlib and Compress::Raw::Bzip2 modules build and link against internal copies of Zlib and Bzip2. The following command will make Perl use the system-installed copies of these libraries:
export BUILD_ZLIB=False export BUILD_BZIP2=0
If you are following the boot method you will need to enable the loopback device:
ip link set lo up
Before starting to configure, create a basic /etc/hosts
file which will be referenced by
one of Perl's configuration files as well as used by the test
suite:
echo "127.0.0.1 localhost $(hostname)" > /etc/hosts
To have full control over the way Perl is set up, you can run the interactive Configure script and hand-pick the way this package is built. If you prefer instead to use the defaults that Perl auto-detects, prepare Perl for compilation with:
./configure.gnu --prefix=/usr \ -Dvendorprefix=/usr \ -Dman1dir=/usr/share/man/man1 \ -Dman3dir=/usr/share/man/man3 \ -Dpager="/bin/less -isR" \ -Dusethreads -Duseshrplib
The meaning of the configure option:
-Dman1dir=/usr/share/man/man1
-Dman3dir=/usr/share/man/man3
Since Groff is not installed yet, configure.gnu thinks that we do not want man pages for Perl. Issuing these parameters overrides this decision.
-Dpager="/bin/less
-isR"
Less has not yet been installed, so by default perldoc will invoke the more program for viewing documentation. This option ensures that it will use less instead.
-Dusethreads
This tells Perl to use threads.
-Duseshrplib
This tells Perl to build a shared libperl.
Compile the package:
make
To test the results, issue:
make test
Install the package and remove the variables set previously:
make install unset BUILD_ZLIB BUILD_BZIP2
Translates awk to Perl |
|
Dumps C structures as generated from cc -g -S |
|
Queries or changes configuration of Perl modules |
|
A commandline frontend to Module::CoreList |
|
Shell script that provides a command interface to CPAN.pm |
|
The CPANPLUS distribution creator |
|
The CPANPLUS launcher |
|
Perl script that (description needed) |
|
Builds a Perl extension for the Encode module from either Unicode Character Mappings or Tcl Encoding Files |
|
Translates find commands to Perl |
|
Converts |
|
Converts |
|
A shell script for examining installed Perl modules, and can even create a tarball from an installed module |
|
Converts data between certain input and output formats |
|
Can be used to configure the |
|
Combines some of the best features of C, sed, awk and sh into a single swiss-army-knife language |
|
A hard link to perl |
|
Used to generate bug reports about Perl, or the modules that come with it, and mail them |
|
Displays a piece of documentation in pod format that is embedded in the Perl installation tree or in a Perl script |
|
The Perl Installation Verification Procedure; it can be used to verify that Perl and its libraries have been installed correctly |
|
Used to generate thank you messages to mail to the Perl developers |
|
A Perl version of the character encoding converter iconv |
|
A rough tool for converting Perl4 |
|
Converts files from pod format to HTML format |
|
Converts files from pod format to LaTeX format |
|
Converts pod data to formatted *roff input |
|
Converts pod data to formatted ASCII text |
|
Prints usage messages from embedded pod docs in files |
|
Checks the syntax of pod format documentation files |
|
Displays selected sections of pod documentation |
|
A command-line tool for running tests against Test::Harness |
|
A Perl version of the stream editor sed |
|
Dumps C structures as generated from cc -g -S stabs |
|
A tar-like program written in Perl |
|
A Perl program that compares an extracted archive with an unextracted one |
|
A Perl program that applies pattern matching to the contents of files in a tar archive |
|
Translates sed to Perl |
|
Prints or checks SHA checksums |
|
Is used to force verbose warning diagnostics in Perl |
|
Converts Perl XS code into C code |
|
Displays details about the internal structure of a Zip file |
The Readline package is a set of libraries that offers command-line editing and history capabilities.
The following patch contains updates from the maintainer. The maintainer of Readline only releases these patches to fix serious issues:
patch -Np1 -i ../readline-6.3-branch_update-4.patch
Prepare Readline for compilation:
./configure --prefix=/usr --libdir=/lib \ --docdir=/usr/share/doc/readline-6.3
Compile the package:
make SHLIB_LIBS=-lncurses
This package does not come with a test suite.
Install the package:
make SHLIB_LIBS=-lncurses htmldir=/usr/share/doc/readline-6.3 install
Now move the static libraries to a more appropriate location:
mv -v /lib/lib{readline,history}.a /usr/lib
Next, relink the dynamic libraries into /usr/lib
and remove the .so
files in /lib
.
ln -svf ../../lib/$(readlink /lib/libreadline.so) /usr/lib/libreadline.so ln -svf ../../lib/$(readlink /lib/libhistory.so) /usr/lib/libhistory.so rm -v /lib/lib{readline,history}.so
The Autoconf package contains programs for producing shell scripts that can automatically configure source code.
Prepare Autoconf for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check VERBOSE=yes
17 tests are skipped that use Automake and different GCC languages. For full test coverage, Autoconf can be re-tested after Automake has been installed.
Install the package:
make install
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. |
|
A tool for creating template files of C #define statements for configure to use |
|
A wrapper for the M4 macro processor |
|
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 files |
|
Helps to create a |
|
Modifies a |
|
Helps when writing |
The Automake package contains programs for generating Makefiles for use with Autoconf.
Prepare Automake for compilation:
./configure --prefix=/usr --docdir=/usr/share/doc/automake-1.14.1
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Generates |
|
A hard link to aclocal |
|
A tool for automatically generating |
|
A hard link to automake |
|
A wrapper for compilers |
|
A script that attempts to guess the canonical triplet for the given build, host, or target architecture |
|
A configuration validation subroutine script |
|
A script for compiling a program so that dependency information is generated in addition to the desired output |
|
A script that installs a program, script, or data file |
|
A script that prints the modification time of a file or directory |
|
A script acting as a common stub for missing GNU programs during an installation |
|
A script that creates a directory tree |
|
Compiles a Python program |
|
A script to create a symlink tree of a directory tree |
|
A wrapper for lex and yacc |
The Bash package contains the Bourne-Again SHell.
The following patch contains updates from the maintainer. The maintainer of Bash only releases these patches to fix serious issues:
patch -Np1 -i ../bash-4.3-branch_update-5.patch
Prepare Bash for compilation:
./configure --prefix=/usr --bindir=/bin \ --without-bash-malloc --with-installed-readline \ --docdir=/usr/share/doc/bash-4.3
The meaning of the new configure option:
--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:
make
To test the results, issue:
make tests
Install the package:
make install
Run the newly compiled bash program (replacing the one that is currently being executed):
exec /bin/bash --login +h
The 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.
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 tool |
|
A shell script to help the user compose and mail standard formatted bug reports concerning bash |
|
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 well |
The Bc package contains an arbitrary precision numeric processing language.
Prepare Bc for compilation:
./configure --prefix=/usr --with-readline \ --mandir=/usr/share/man --infodir=/usr/share/info
Compile the package:
make
To test the results, issue:
echo "quit" | ./bc/bc -l Test/checklib.b
Install the package:
make install
The Diffutils package contains programs that show the differences between files or directories.
Fix a bug that prevents locale files from being installed:
sed -i 's:= @mkdir_p@:= /bin/mkdir -p:' po/Makefile.in.in
Prepare Diffutils for compilation:
./configure --prefix=/usr
Diffutils wants ed as the default editor for sdiff. The following sed will change the default to vi:
sed -i 's@\(^#define DEFAULT_EDITOR_PROGRAM \).*@\1"vi"@' lib/config.h
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The File package contains a utility for determining the type of a given file or files.
Prepare File for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The Gawk package contains programs for manipulating text files.
Prepare Gawk for compilation:
./configure --prefix=/usr --libexecdir=/usr/lib
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Install the documentation:
mkdir -v /usr/share/doc/gawk-4.1.1 cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-4.1.1
The 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).
Prepare Findutils for compilation:
./configure --prefix=/usr --libexecdir=/usr/lib/locate \ --localstatedir=/var/lib/locate
The 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:
make
To test the results, issue:
make check
Install the package:
make install
Was formerly used to produce locate databases |
|
Was formerly used to produce locate databases; it is the ancestor of frcode. |
|
Searches given directory trees for files matching the specified criteria |
|
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. |
|
Searches through a database of file names and reports the names that contain a given string or match a given pattern |
|
Older version of find, using a different algorithm |
|
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 database |
|
Can be used to apply a given command to a list of files |
The 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.
Prepare Gettext for compilation:
./configure --prefix=/usr --docdir=/usr/share/doc/gettext-0.19.1
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Copies standard Gettext infrastructure files into a source package |
|
Outputs a system-dependent table of character encoding aliases |
|
Outputs a system-dependent set of variables, describing how to set the runtime search path of shared libraries in an executable |
|
Substitutes environment variables in shell format strings |
|
Translates a natural language message into the user's language by looking up the translation in a message catalog |
|
Primarily serves as a shell function library for gettext |
|
Copies all standard Gettext files into the given top-level directory of a package to begin internationalizing it |
|
Displays a network hostname in various forms |
|
Filters the messages of a translation catalog according to their attributes and manipulates the attributes |
|
Concatenates and merges the given |
|
Compares two |
|
Finds the messages that are common to to the given
|
|
Converts a translation catalog to a different character encoding |
|
Creates an English translation catalog |
|
Applies a command to all translations of a translation catalog |
|
Applies a filter to all translations of a translation catalog |
|
Generates a binary message catalog from a translation catalog |
|
Extracts all messages of a translation catalog that match a given pattern or belong to some given source files |
|
Creates a new |
|
Combines two raw translations into a single file |
|
Decompiles a binary message catalog into raw translation text |
|
Unifies duplicate translations in a translation catalog |
|
Displays native language translations of a textual message whose grammatical form depends on a number |
|
Recode Serbian text from Cyrillic to Latin script. |
|
Extracts the translatable message lines from the given source files to make the first translation template |
|
defines the autosprintf class, which makes C formatted output routines usable in C++ programs, for use with the <string> strings and the <iostream> streams |
|
a private library containing common routines used by the various Gettext programs; these are not intended for general use |
|
Used to write specialized programs that process
|
|
A private library containing common routines used by the various Gettext programs; these are not intended for general use |
|
A library, intended to be used by LD_PRELOAD, that
assists |
The Grep package contains programs for searching through files.
Prepare Grep for compilation:
./configure --prefix=/usr --bindir=/bin
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The Groff package contains programs for processing and formatting text.
Groff 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=/usr
Compile the package:
make
This package does not come with a test suite.
Install the package:
make install
Reads a troff font file and adds some additional font-metric information that is used by the groff system |
|
Creates a font file for use with groff and grops |
|
Groff preprocessor for producing chemical structure diagrams |
|
Compiles descriptions of equations embedded within troff input files into commands that are understood by troff |
|
Converts a troff EQN (equation) into a cropped image |
|
Marks differences between groff/nroff/troff files |
|
Converts a grap diagram into a cropped bitmap image |
|
A groff preprocessor for gremlin files |
|
A driver for groff that produces TeX dvi format |
|
A front-end to the groff document formatting system; normally, it runs the troff program and a post-processor appropriate for the selected device |
|
Displays groff files and man pages on X and tty terminals |
|
Reads files and guesses which of the groff options
|
|
Is a groff driver for Canon CAPSL printers (LBP-4 and LBP-8 series laser printers) |
|
Is a driver for groff that produces output in PCL5 format suitable for an HP LaserJet 4 printer |
|
Translates the output of GNU troff to PostScript |
|
Translates the output of GNU troff into a form suitable for typewriter-like devices |
|
Creates a font file for use with groff -Tlj4 from an HP-tagged font metric file |
|
Creates an inverted index for the bibliographic databases with a specified file for use with refer, lookbib, and lkbib |
|
Searches bibliographic databases for references that contain specified keys and reports any references found |
|
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 input |
|
A simple preprocessor for groff |
|
Formats equations for American Standard Code for Information Interchange (ASCII) output |
|
A script that emulates the nroff command using groff |
|
Creates pdf documents using groff |
|
Translates a PostScript font in |
|
Compiles descriptions of pictures embedded within troff or TeX input files into commands understood by TeX or troff |
|
Converts a PIC diagram into a cropped image |
|
Translates the output of GNU troff to HTML |
|
Translates the output of GNU troff to HTML |
|
Converts encoding of input files to something GNU troff understands |
|
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 processed |
|
Transforms roff files into other formats |
|
Transforms roff files into other formats |
|
Transforms roff files into other formats |
|
Transforms roff files into other formats |
|
Transforms roff files into other formats |
|
Transforms roff files into other formats |
|
Reads files and replaces lines of the form .so file by the contents of the mentioned file |
|
Compiles descriptions of tables embedded within troff input files into commands that are understood by troff |
|
Creates a font file for use with groff -Tdvi |
|
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 options |
The Less package contains a text file viewer.
Prepare Less for compilation:
./configure --prefix=/usr --sysconfdir=/etc
Compile the package:
make
This package does not come with a test suite.
Install the package:
make install
Move less to
/bin
:
mv -v /usr/bin/less /bin
The Gzip package contains programs for compressing and decompressing files.
Prepare Gzip for compilation:
./configure --prefix=/usr --bindir=/bin
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Now we will move some of the utilities to /usr/bin
to meet FHS compliance:
mv -v /bin/z{egrep,cmp,diff,fgrep,force,grep,less,more,new} /usr/bin
Decompresses gzipped files |
|
Creates self-decompressing executable files |
|
Compresses the given files using Lempel-Ziv (LZ77) coding |
|
Decompresses compressed files |
|
Decompresses the given gzipped files to standard output |
|
Runs cmp on gzipped files |
|
Runs diff on gzipped files |
|
Runs egrep on gzipped files |
|
Runs fgrep on gzipped files |
|
Forces a |
|
Runs grep on gzipped files |
|
Runs less on gzipped files |
|
Runs more on gzipped files |
|
Re-compresses files from compress format
to gzip
format— |
The IPutils package contains programs for basic networking.
IPutils has various issues addressed by the following patch:
patch -Np1 -i ../iputils-s20121221-fixes-2.patch
Compile the package:
make USE_CAP=no \ IPV4_TARGETS="tracepath ping clockdiff rdisc" \ IPV6_TARGETS="tracepath6 traceroute6"
This package does not come with a test suite.
Install the package:
install -v -m755 ping /bin install -v -m755 clockdiff /usr/bin install -v -m755 rdisc /usr/bin install -v -m755 tracepath /usr/bin install -v -m755 trace{path,route}6 /usr/bin install -v -m644 doc/*.8 /usr/share/man/man8
Measures the clock difference between hosts |
|
Sends echo-request packets and reports how long the replies take. This is the IPV4 version |
|
Network router discovery daemon |
|
Traces the path to a network host discovering MTU along the path. This is the IPV4 version. |
|
Traces the path to a network host discovering MTU along the path. This is the IPV6 version. |
|
Traces the path to a network host on an IPV6 network |
The Kbd package contains key-table files and keyboard utilities.
Prepare Kbd for compilation:
PKG_CONFIG_PATH="/tools/lib/pkgconfig" \ ./configure --prefix=/usr --disable-vlock --enable-optional-progs
The meaning of the new configure options:
PKG_CONFIG_PATH
Use pkg-config to obtain the location of the test library metadata built in Section 6.14, “Check-0.9.13”.
--disable-vlock
Prevents Kbd from trying to build the vlock program, which requires Linux-PAM.
--enable-optional-progs
Installs several additional programs.
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Some of the programs from Kbd are used by the CLFS Bootscripts to initialize the system, so those binaries need to be on the root partition:
mv -v /usr/bin/{dumpkeys,kbd_mode,loadkeys,setfont} /bin
Install the documentation:
mkdir -v /usr/share/doc/kbd-2.0.1 cp -R -v docs/doc/* /usr/share/doc/kbd-2.0.1
Changes the foreground virtual terminal |
|
Deallocates unused virtual terminals |
|
Dumps the keyboard translation tables |
|
Prints the number of the active virtual terminal |
|
Prints the kernel scancode-to-keycode mapping table |
|
Obtains information about the console |
|
Reports or sets the keyboard mode |
|
Sets the keyboard repeat and delay rates |
|
Loads the keyboard translation tables |
|
Loads the kernel unicode-to-font mapping table |
|
An obsolete program that used to load a user-defined output character mapping table into the console driver; this is now done by setfont |
|
Starts a program on a new virtual terminal (VT) |
|
Adds a Unicode character table to a console font |
|
Extracts the embedded Unicode character table from a console font |
|
Removes the embedded Unicode character table from a console font |
|
Handle Unicode character tables for console fonts |
|
Changes the kernel idea of the console size |
|
Changes the Enhanced Graphic Adapter (EGA) and Video Graphics Array (VGA) fonts on the console |
|
Loads kernel scancode-to-keycode mapping table entries; this is useful if there are unusual keys on the keyboard |
|
Sets the keyboard flags and Light Emitting Diodes (LEDs) |
|
Defines the keyboard meta-key handling |
|
Sets the virtal terminal RGB colors |
|
Shows the current EGA/VGA console screen font |
|
Reports the scancodes, keycodes, and ASCII codes of the keys pressed on the keyboard |
|
Puts the keyboard and console in UNICODE mode. Never use it on CLFS, because applications are not configured to support UNICODE. |
|
Reverts keyboard and console from UNICODE mode |
The Libpipeline package contains a library for manipulating pipelines of subprocesses in a flexible and convenient way.
Prepare Libpipeline for compilation:
PKG_CONFIG_PATH=/tools/lib/pkgconfig ./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The Man-DB package contains programs for finding and viewing man pages.
Prepare Man-DB for compilation:
./configure --prefix=/usr --libexecdir=/usr/lib \ --docdir=/usr/share/doc/man-db-2.6.7.1 --sysconfdir=/etc \ --disable-setuid --with-browser=/usr/bin/lynx \ --with-vgrind=/usr/bin/vgrind --with-grap=/usr/bin/grap
The meaning of the configure options:
--disable-setuid
This disables making the man program setuid to
user man
.
--with-...
These three parameters are used to set some default programs. lynx is a text-based web browser (see CBLFS for installation instructions), vgrind converts program sources to Groff input, and grap is useful for typesetting graphs in Groff documents. The vgrind and grap programs are not normally needed for viewing manual pages. They are not part of CLFS or CBLFS, but you should be able to install them yourself after finishing CLFS if you wish to do so.
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The following table shows the character set that Man-DB
assumes manual pages installed under /usr/share/man/<ll>
will be encoded
with. In addition to this, Man-DB correctly determines if
manual pages installed in that directory are UTF-8 encoded.
Table 10.1. Expected character encoding of legacy 8-bit manual pages
Language (code) | Encoding | Language (code) | Encoding |
---|---|---|---|
Danish (da) | ISO-8859-1 | Croatian (hr) | ISO-8859-2 |
German (de) | ISO-8859-1 | Hungarian (hu) | ISO-8859-2 |
English (en) | ISO-8859-1 | Japanese (ja) | EUC-JP |
Spanish (es) | ISO-8859-1 | Korean (ko) | EUC-KR |
Estonian (et) | ISO-8859-1 | Lithuanian (lt) | ISO-8859-13 |
Finnish (fi) | ISO-8859-1 | Latvian (lv) | ISO-8859-13 |
French (fr) | ISO-8859-1 | Macedonian (mk) | ISO-8859-5 |
Irish (ga) | ISO-8859-1 | Polish (pl) | ISO-8859-2 |
Galician (gl) | ISO-8859-1 | Romanian (ro) | ISO-8859-2 |
Indonesian (id) | ISO-8859-1 | Russian (ru) | KOI8-R |
Icelandic (is) | ISO-8859-1 | Slovak (sk) | ISO-8859-2 |
Italian (it) | ISO-8859-1 | Slovenian (sl) | ISO-8859-2 |
Norwegian Bokmal (nb) | ISO-8859-1 | Serbian Latin (sr@latin) | ISO-8859-2 |
Dutch (nl) | ISO-8859-1 | Serbian (sr) | ISO-8859-5 |
Norwegian Nynorsk (nn) | ISO-8859-1 | Turkish (tr) | ISO-8859-9 |
Norwegian (no) | ISO-8859-1 | Ukrainian (uk) | KOI8-U |
Portuguese (pt) | ISO-8859-1 | Vietnamese (vi) | TCVN5712-1 |
Swedish (sv) | ISO-8859-1 | Simplified Chinese (zh_CN) | GBK |
Belarusian (be) | CP1251 | Simplified Chinese, Singapore (zh_SG) | GBK |
Bulgarian (bg) | CP1251 | Traditional Chinese, Hong Kong (zh_HK) | BIG5HKSCS |
Czech (cs) | ISO-8859-2 | Traditional Chinese (zh_TW) | BIG5 |
Greek (el) | ISO-8859-7 |
Manual pages in languages not in the list are not supported.
Dumps the whatis database contents in human-readable form |
|
Searches the whatis database and displays the short descriptions of system commands that contain a given string |
|
Creates or updates the pre-formatted manual pages |
|
Displays one-line summary information about a given manual page |
|
Formats and displays the requested manual page |
|
Creates or updates the whatis database |
|
Displays the contents of $MANPATH or (if $MANPATH is not set) a suitable search path based on the settings in man.conf and the user's environment |
|
Searches the whatis database and displays the short descriptions of system commands that contain the given keyword as a separate word |
|
Reads files and replaces lines of the form .so file by the contents of the mentioned file |
|
Contains run-time support for man |
|
Contains run-time support for man |
The Make package contains a program for compiling packages.
Prepare Make for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The XZ Utils package contains programs for compressing and decompressing files. Compressing text files with XZ Utils yields a much better compression percentage than with the traditional gzip.
Prepare XZ Utils for compilation:
./configure --prefix=/usr --docdir=/usr/share/doc/xz-5.0.5
Compile the package:
make
To test the results, issue:
make check
Install the programs:
make install
Move the xz
binary, and several
symlinks that point to it, into the /bin directory:
mv -v /usr/bin/{xz,lzma,lzcat,unlzma,unxz,xzcat} /bin
Finally, move the shared library to a more appropriate location, and recreate the symlink pointing to it:
mv -v /usr/lib/liblzma.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.so
Decompresses LZMA and xz files |
|
Compares lzma compressed files |
|
Compares lzma compressed files |
|
Runs egrep on lzma compressed files |
|
Runs fgrep on lzma compressed files |
|
Runs grep on lzma compressed files |
|
Runs less on lzma files |
|
Compresses lzma files |
|
Decompresses lzma files |
|
Displays information stored in an .lzma file header |
|
Runs more on lzma files |
|
Uncompresses lzma files |
|
Uncompresses xz files |
|
Creates xz compressed files |
|
Decompresses xz files |
|
Compares xz compressed files |
|
Decompresses to standard output |
|
Compares xz compressed files |
|
Runs egrep on xz compressed files |
|
Runs fgrep on xz compressed files |
|
Runs grep on xz compressed files |
|
Runs less on xz files |
|
Runs more on xz files |
|
The LZMA library |
The Kmod package contains programs for loading, inserting and removing kernel modules for Linux. Kmod replaces the Module-Init-tools package.
Prepare Kmod for compilation:
./configure --prefix=/usr \ --bindir=/bin --sysconfdir=/etc \ --with-rootlibdir=/lib \ --with-zlib --with-xz
The meaning of the configure option:
--with-rootlibdir=/lib
Install location for shared libraries.
--with-zlib
--with-xz
This allows the Kmod package to handle zlib and XZ compressed kernel modules.
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Create symbolic links for programs that expect Module-Init-Tools:
ln -sfv kmod /bin/lsmod for tool in depmod insmod modinfo modprobe rmmod; do ln -sfv ../bin/kmod /sbin/${tool} done
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 modules |
|
Installs a loadable module in the running kernel |
|
Loads and unloads kernel modules |
|
Lists currently loaded modules |
|
Examines an object file associated with a kernel module and displays any information that it can glean |
|
Uses a dependency file, created by depmod, to automatically load relevant modules |
|
Unloads modules from the running kernel |
The Patch package contains a program for modifying or creating files by applying a “patch” file typically created by the diff program.
Prepare Patch for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
The Psmisc package contains programs for displaying information about running processes.
Prepare Psmisc for compilation:
./configure --prefix=/usr
Compile the package:
make
This package does not come with a test suite.
Install the package:
make install
Reports the Process IDs (PIDs) of processes that use the given files or file systems |
|
Kills processes by name; it sends a signal to all processes running any of the given commands |
|
Peeks at file descriptors of running processes |
|
Prints information about a process |
|
Displays running processes as a tree |
|
Same as pstree, except that it waits for confirmation before exiting |
The Libestr package is a library for some string essentials.
Prepare Libestr for compilation:
./configure --prefix=/usr
Compile the package:
make
This package does not come with a test suite.
Install the package:
make install
The Libee is an event expression library.
Prepare Libee for compilation:
./configure --prefix=/usr
Compile the package:
Libee will fail to compile if using multiple jobs with make. Append "-j 1" to the following make command:
make
This package does not come with a test suite.
Install the package:
make install
The rsyslog package contains programs for logging system messages, such as those given by the kernel when unusual things happen.
Prepare Rsyslog for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Create a directory for expansion snippets:
install -dv /etc/rsyslog.d
Create a new /etc/rsyslog.conf
file by running the following:
cat > /etc/rsyslog.conf << "EOF"
# Begin /etc/rsyslog.conf
# CLFS configuration of rsyslog. For more info use man rsyslog.conf
#######################################################################
# Rsyslog Modules
# Support for Local System Logging
$ModLoad imuxsock.so
# Support for Kernel Logging
$ModLoad imklog.so
#######################################################################
# Global Options
# Use traditional timestamp format.
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
# Set the default permissions for all log files.
$FileOwner root
$FileGroup root
$FileCreateMode 0640
$DirCreateMode 0755
# Provides UDP reception
$ModLoad imudp
$UDPServerRun 514
# Disable Repeating of Entries
$RepeatedMsgReduction on
#######################################################################
# Include Rsyslog Config Snippets
$IncludeConfig /etc/rsyslog.d/*.conf
#######################################################################
# Standard Log Files
auth,authpriv.* /var/log/auth.log
*.*;auth,authpriv.none -/var/log/syslog
daemon.* -/var/log/daemon.log
kern.* -/var/log/kern.log
lpr.* -/var/log/lpr.log
mail.* -/var/log/mail.log
user.* -/var/log/user.log
# Catch All Logs
*.=debug;\
auth,authpriv.none;\
news.none;mail.none -/var/log/debug
*.=info;*.=notice;*.=warn;\
auth,authpriv.none;\
cron,daemon.none;\
mail,news.none -/var/log/messages
# Emergencies are shown to everyone
*.emerg *
# End /etc/rsyslog.conf
EOF
The Sysvinit package contains programs for controlling the startup, running, and shutdown of the system.
Apply a sed to disable several programs from being built and installed as better versions are provided by other packages:
sed -i -e 's/\ sulogin[^ ]*//' -e 's/pidof\.8//' -e '/ln .*pidof/d' \ -e '/utmpdump/d' -e '/mountpoint/d' -e '/mesg/d' src/Makefile
Compile the package:
make -C src clobber make -C src
Install the package:
make -C src install
Create a new file /etc/inittab
by running the following:
cat > /etc/inittab << "EOF"
# Begin /etc/inittab
id:3:initdefault:
si::sysinit:/etc/rc.d/init.d/rc sysinit
l0:0:wait:/etc/rc.d/init.d/rc 0
l1:S1:wait:/etc/rc.d/init.d/rc 1
l2:2:wait:/etc/rc.d/init.d/rc 2
l3:3:wait:/etc/rc.d/init.d/rc 3
l4:4:wait:/etc/rc.d/init.d/rc 4
l5:5:wait:/etc/rc.d/init.d/rc 5
l6:6:wait:/etc/rc.d/init.d/rc 6
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
su:S016:once:/sbin/sulogin
EOF
The following command adds the standard virtual terminals to
/etc/inittab
. If your system
only has a serial console skip the following command:
cat >> /etc/inittab << "EOF"
1:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty1 9600
2:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty2 9600
3:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty3 9600
4:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty4 9600
5:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty5 9600
6:2345:respawn:/sbin/agetty --noclear -I '\033(K' tty6 9600
EOF
If your system has a serial console run the following command
to add the entry to /etc/inittab
:
cat >> /etc/inittab << "EOF"
c0:12345:respawn:/sbin/agetty --noclear 115200 ttyS0 vt100
EOF
Finally, add the end line to /etc/inittab
:
cat >> /etc/inittab << "EOF"
# End /etc/inittab
EOF
The -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 i18n initscript from the
CLFS-Bootscripts package calls the setfont program during
system startup. Sending this escape sequence is necessary for
people who use non-ISO 8859-1 screen fonts, but it does not
affect native English speakers.
Logs boot messages to a log file |
|
Runs a command with fstab-encoded arguments |
|
Normally invokes shutdown with the
|
|
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 to |
|
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 it |
|
Tells the kernel to halt the system and switch off the computer (see halt) |
|
Tells the kernel to reboot the system (see halt) |
|
Reports the previous and the current run-level, as
noted in the last run-level record in |
|
Brings the system down in a secure way, signaling all processes and notifying all logged-in users |
|
Tells init which run-level to change to |
The Tar package contains an archiving program.
The following patch adds a man page for tar:
patch -Np1 -i ../tar-1.27.1-manpage-1.patch
Prepare Tar for compilation:
FORCE_UNSAFE_CONFIGURE=1 ./configure --prefix=/usr \ --bindir=/bin --libexecdir=/usr/sbin
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Generate the man page and place it in the proper location:
perl tarman > /usr/share/man/man1/tar.1
Install the documentation:
make -C doc install-html docdir=/usr/share/doc/tar-1.27.1
The Texinfo package contains programs for reading, writing, and converting info pages.
Prepare Texinfo for compilation:
./configure --prefix=/usr
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Used to read info pages which are similar to man pages, but often go much deeper than just explaining all the command line options. For example, compare man bison and info bison. |
|
Compiles a source file containing Info customizations into a binary format |
|
Used to install info pages; it updates entries in the info index file |
|
Translates the given Texinfo source documents into info pages, plain text, or HTML |
|
Shell script that run texi2dvi --pdf |
|
Used to format the given Texinfo document into a device-independent file that can be printed |
|
Used to format the given Texinfo document into a Portable Document Format (PDF) file |
|
Used to sort Texinfo index files |
The Eudev package contains programs for dynamic creation of device nodes.
Prepare Eudev for compilation:
./configure --prefix=/usr --sysconfdir=/etc \ --with-rootprefix="" --libexecdir=/lib --enable-split-usr \ --libdir=/usr/lib --with-rootlibdir=/lib --sbindir=/sbin --bindir=/sbin \ --enable-rule_generator --disable-introspection --disable-keymap \ --disable-gudev --disable-gtk-doc-html --with-firmware-path=/lib/firmware \ --enable-libkmod
Compile the package:
make
To test the results, issue:
make check
Install the package:
make install
Create a directory for storing firmware that can be loaded by udev:
install -dv /lib/firmware
Create a dummy rule so that Eudev will name ethernet devices properly for the system.
echo "# dummy, so that network is once again on eth*" \ > /etc/udev/rules.d/80-net-name-slot.rules
Controls the runtime behavior of Eudev, requests kernel events, manages the event queue, and provides simple debugging. |
|
A daemon that reorders hotplug events before submitting them to udev, thus avoiding various race conditions |
|
Provides Eudev with a unique string and additional information (uuid, label) for an ATA drive |
|
Prints the capabilities of a CDROM or DVDROM drive. |
|
Given an ID for the current uevent and a list of IDs (for all target uevents), registers the current ID and indicates whether all target IDs have been registered. |
|
Creates all possible floppy devices based on the CMOS type |
|
Identifies x86 disk drives from Enhanced Disk Drive calls |
|
Script to load firmware for a device |
|
Finds an entry in |
|
Provides the shortest possible unique hardware path to a device |
|
Retrieves or generates a unique SCSI identifier. |
|
Identifies a USB block device. |
|
Determines V4L capabilities for a given device. |
|
A script which generates Eudev rules to provide stable names for network interfaces. |
|
A script which generates Eudev rules to provide stable names for network interfaces. |
|
A library interface to eudev device information. |
|
Contains udev configuration files, device permissions, and rules for device naming |
|
Contains udev helper programs and static devices which get copied to /dev when booted. |
The Vim package contains a powerful text editor.
If you prefer another editor—such as Emacs, Joe, or Nano—please refer to http://cblfs.cross-lfs.org/index.php/Category:Text_Editors for suggested installation instructions.
The following patch merges all updates from the 7.4 Branch from the Vim developers:
patch -Np1 -i ../vim-7.4-branch_update-7.patch
Change the default location of the vimrc
configuration file to /etc
:
echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h
Prepare Vim for compilation:
./configure --prefix=/usr
Compile the package:
make
To 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 install
Many users are accustomed to using vi instead of vim. Some programs, such as vigr and vipw, also use vi. Create a symlink to permit execution of vim when users habitually enter vi and allow programs that use vi to work:
ln -sv vim /usr/bin/vi
By default, Vim's documentation is installed in /usr/share/vim
. The following symlink
allows the documentation to be accessed via /usr/share/doc/vim-7.4
, making it
consistent with the location of documentation for other
packages:
ln -sv ../vim/vim74/doc /usr/share/doc/vim-7.4
If an X Window System is going to be installed on the CLFS system, you may want 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, refer to the Vim documentation and the Vim installation page in CBLFS at http://cblfs.cross-lfs.org/index.php/Vim.
By 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 other settings, and overrides must come after this setting. Create a default vim configuration file by running the following:
cat > /etc/vimrc << "EOF"
" Begin /etc/vimrc
set nocompatible
set backspace=2
set ruler
syntax on
if (&term == "iterm") || (&term == "putty")
set background=dark
endif
" End /etc/vimrc
EOF
The 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 the background 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'
A filter for creating an error file that can be read by vim |
|
Reformats the error messages of the Perl interpreter for use with the “quickfix” mode of vim |
|
Starts vim in ex mode |
|
A script that starts vim with less.vim |
|
Processes vim errors |
|
Creates a tags file for Perl code for use by vim |
|
Checks the spelling of arguments |
|
Is a restricted version of view; no shell commands can be started and view cannot be suspended |
|
Is a restricted version of vim; no shell commands can be started and vim cannot be suspended |
|
Generates a tags file for Perl scripts |
|
Generates a tags file for TCL code |
|
Starts vim in read-only mode |
|
Link to vim |
|
Is the editor |
|
Starts vim with the terminal in 132-column mode |
|
Converts Vim documentation to HypterText Markup Language (HTML) |
|
Edits two or three versions of a file with vim and show differences |
|
Enables the DEC locator input model on a remote terminal |
|
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 CLFS nor in CBLFS |
|
Teaches the basic keys and commands of vim |
|
Creates a hex dump of the given file; it can also do the reverse, so it can be used for binary patching |
The GRUB package contains the GRand Unified Bootloader.
If you would like use a different bootloader than this one you can go to the following link for alternative bootloaders and the instructions to use them. http://trac.cross-lfs.org/wiki/bootloaders
This package is known to have issues when its default
optimization flags (including the -march
and -mtune
options) are changed. If any
environment variables that override default optimizations
have been defined, such as CFLAGS
and CXXFLAGS
, unset them when building GRUB.
Glibc-2.19 does not declare gets():
sed -i -e '/gets is a/d' grub-core/gnulib/stdio.in.h
Prepare GRUB for compilation:
./configure --prefix=/usr \ --sysconfdir=/etc --disable-werror
Compile the package:
make
To test GRUB you must have QEMU installed and then, issue:
make check
Install the package:
make install
Now that grub is installed, we need to configure the defaults that will be used to generate the configuration after we install the kernel. Create this file with the following:
install -m755 -dv /etc/default
cat > /etc/default/grub << "EOF"
# Begin /etc/default/grub
GRUB_DEFAULT=0
#GRUB_SAVEDEFAULT=true
GRUB_HIDDEN_TIMEOUT=
GRUB_HIDDEN_TIMEOUT_QUIET=false
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=Cross-LFS
GRUB_CMDLINE_LINUX=""
GRUB_CMDLINE_LINUX_DEFAULT=""
#GRUB_TERMINAL=console
#GRUB_GFXMODE=640x480
#GRUB_GFXPAYLOAD_LINUX=keep
#GRUB_DISABLE_LINUX_UUID=true
#GRUB_DISABLE_LINUX_RECOVERY=true
#GRUB_INIT_TUNE="480 440 1"
#GRUB_DISABLE_OS_PROBER=true
# End /etc/default/grub
EOF
The meaning of the above options and possible alternate values:
GRUB_DEFAULT=
Write Me
GRUB_SAVEDEFAULT=
Write Me
GRUB_HIDDEN_TIMEOUT=
Write Me
GRUB_HIDDEN_TIMEOUT_QUIET=
Write Me
GRUB_TIMEOUT=
Write Me
GRUB_DISTRIBUTOR=
Write Me
GRUB_CMDLINE_LINUX=
Write Me
GRUB_CMDLINE_LINUX_DEFAULT=
Write Me
GRUB_TERMINAL=
Write Me
GRUB_GFXMODE=
Write Me
GRUB_GFXPAYLOAD_LINUX=
Write Me
GRUB_DEFAULT=
Write Me
GRUB_DISABLE_LINUX_UUID=
Write Me
GRUB_DISABLE_LINUX_RECOVERY=
Write Me
GRUB_INIT_TUNE=
Write Me
GRUB_DISABLE_OS_PROBER=
Write Me
The Grand Unified Bootloader's command shell |
|
Installs GRUB on the given device |
|
Encrypts a password in MD5 format |
|
Sets the default boot entry for GRUB |
|
Generates a terminfo command from a terminfo name; it can be employed if an unknown terminal is being used |
|
Checks the format of a multi-boot kernel |
Most 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 MB
Sizes 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.
If 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 If You Are Going to Chroot first exit from chroot:
logout
Then reenter it with:
chroot ${CLFS} /tools/bin/env -i \ HOME=/root TERM=${TERM} PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /tools/bin/bash --login
Now 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.
This chapter details how to install and configure the CLFS-Bootscripts package and customize other configuration files on the system. Most of the Bootscripts 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://hints.cross-lfs.org/index.php/BSD-Init. 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 Making the CLFS System Bootable.
The Bootscripts package contains a set of scripts to start/stop the CLFS system at bootup/shutdown.
Install the bootscripts:
make install-bootscripts
If you are going to use a network card, run the following command to install scripts for starting and configuring the network interface:
make install-network
Checks the integrity of the file systems before they are mounted (with the exception of journal and network based file systems) |
|
Removes files that should not be preserved between
reboots, such as those in |
|
Loads the correct keymap table for the desired keyboard layout; it also sets the screen font |
|
Contains common functions, such as error and status checking, that are used by several bootscripts |
|
Halts the system |
|
Assists the network script with stopping network devices |
|
Assists the network script with starting network devices |
|
Sets up the system's hostname and local loopback device |
|
Mounts all file systems, except ones that are marked noauto or are network based |
|
Mounts virtual kernel file systems, such as
|
|
Sets up network interfaces, such as network cards, and sets up the default gateway (where applicable) |
|
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 processed |
|
Reboots the system |
|
Makes sure every process is terminated before the system reboots or halts |
|
Resets the kernel clock to local time in case the hardware clock is not set to UTC time |
|
Provides the functionality needed to assign a static Internet Protocol (IP) address to a network interface |
|
Enables and disables swap files and partitions |
|
Starts and stops the system and kernel log daemons |
|
A template to create custom bootscripts for other daemons |
|
Starts and stops the Eudev daemon |
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 CLFS too. CLFS 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 default run-level is 3. Here are
the descriptions of the different run-levels as they are
implemented:
0: halt the computer
1: single-user mode
2: multi-user mode without networking
3: multi-user mode with networking
4: reserved for customization, otherwise does the same as 3
5: same as 4, it is usually used for GUI login (like X's xdm or KDE's kdm)
6: reboot the computer
The 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 order in 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 S
link 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 CLFS system). The files given here are an example of how it can be done.
The 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 the hardware 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. Verify this 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/clock
UTC=1
# End /etc/sysconfig/clock
EOF
A good hint explaining how to deal with time on CLFS is
available at http://hints.cross-lfs.org/index.php/time.txt.
It explains issues such as time zones, UTC, and the
TZ
environment variable.
This section discusses how to configure the i18n 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 i18n bootscript will do nothing.
The i18n script
reads the /etc/sysconfig/i18n
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/i18n
file with known settings for several countries was installed
with the CLFS-Bootscripts package, so the relevant section can
be uncommented if the country is supported. If still in doubt,
look in the /usr/share/consolefonts
for valid screen
fonts and /usr/share/keymaps
for
valid keymaps.
The default /etc/sysconfig/i18n
is set up for UTF-8 using the us keymap. You will need to edit
the file to your specific needs. The /etc/sysconfig/i18n
file has additional
information in it to help you to assist in configuring.
In Installing Basic System Software, we installed the Eudev 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 device numbers for every possible
device that might exist in the world.
In February 2000, a new filesystem called devfs
, which dynamically created device
nodes as devices were found by the kernel, 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
particular developer(s). The devfs
file system also suffered from
race conditions that were inherent in its design and could
not be fixed without a substantial revision to the kernel.
It was marked deprecated with the release of the 2.6 kernel
series, and was removed entirely as of version 2.6.18.
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 hardware configuration to userspace processes.
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. Once the
sysfs
filesystem is mounted
(on /sys
), data which the
built-in drivers registered with sysfs
are available to userspace
processes. With this userspace-visible representation, the
possibility of seeing a userspace replacement for
devfs
became much more
realistic.
Shortly after the introduction of sysfs
, work began on a program called
Udev to advantage of it. The udev daemon made calls to
mknod()
to create device
nodes in /dev
dynamically,
based on the information from sysfs
, in /sys
. For example, /sys/class/tty/vcs/dev
contains the
string “7:0”. This
string was used by udev to create a device
node with major number 7 and minor number 0.
Linux kernel version 2.6.32 introduced a new virtual file
system called devtmpfs
, an
improved replacement for devfs
. This allows device nodes to once
again be dynamically created by the kernel, without many of
the problems of devfs
. As
of version 176, Udev no longer creates device nodes itself,
instead relying on devtmpfs
to do so.
In 2010, development began on systemd, an alternate init implementation. Starting with Udev 183, Udev's source tree was merged with systemd. Several Gentoo developers who disagreed with this merge announced a project fork called Eudev in December 2012, created by extracting the Udev code from systemd. One of the goals of Eudev is to allow for easier installation and usage of udevd without the need for the rest of systemd.
By default, device nodes created by the kernel in a
devtmpfs
are owned by
root:root and have
600 permissions.
udevd can
modify ownership and permissions of the nodes under the
/dev
directory, and can also
create additional symlinks, based on rules specified in the
files within the /etc/udev/rules.d
, /lib/udev/rules.d
, and /run/udev/rules.d
directories. The names
for these files start with a number, to indicate the order in
which they are run, and they have a .rules
extension (udevd will ignore files
with any other extension). All of the rules files from these
directories are combined into a single list, sorted by
filename, and run in that order. In the event of a conflict,
where a rules file with the same name exists in two or more
of these directories, the rules in /etc
take the highest priority, followed by
rules files in /run
, and
finally /lib
. Any device for
which a rule cannot be found will just be ignored by
udevd and be
left at the defaults defined by the kernel, as described
above.
Device drivers compiled as modules may have aliases built
into them. Aliases are visible in the output of the
modinfo program
and are usually related to the bus-specific identifiers of
devices supported by a module. For example, the snd-fm801 driver supports PCI
devices with vendor ID 0x1319 and device ID 0x0801, and has
an alias of “pci:v00001319d00000801sv*sd*bc04sc01i*”.
For most devices, the bus driver exports the alias of the
driver that would handle the device via sysfs
. E.g., the /sys/bus/pci/devices/0000:00:0d.0/modalias
file might contain the string “pci:v00001319d00000801sv00001319sd00001319bc04sc01i00”.
The default rules provided by Eudev will cause udevd to call out to
/sbin/modprobe
with the contents of the MODALIAS
uevent environment variable (that should be the same as the
contents of the modalias
file
in sysfs), thus loading all modules whose aliases match this
string after wildcard expansion.
In this example, this means that, in addition to snd-fm801, the obsolete (and unwanted) forte driver will be loaded if it is available. See below for ways in which the loading of unwanted drivers can be prevented.
The kernel itself is also able to load modules for network protocols, filesystems and NLS support on demand.
There are a few possible problems when it comes to automatically creating device nodes.
Eudev will only load a module if it has a bus-specific
alias and the bus driver properly exports the necessary
aliases to sysfs
. In other
cases, one should arrange module loading by other means.
With Linux-3.14.21, Eudev is known to load properly-written
drivers for INPUT, IDE, PCI, USB, SCSI, SERIO and FireWire
devices.
To determine if the device driver you require has the
necessary support for Eudev, run modinfo with the module
name as the argument. Now try locating the device directory
under /sys/bus
and check
whether there is a modalias
file there.
If the modalias
file exists
in sysfs
, the driver
supports the device and can talk to it directly, but
doesn't have the alias, it is a bug in the driver. Load the
driver without the help from Eudev and expect the issue to
be fixed later.
If there is no modalias
file
in the relevant directory under /sys/bus
, this means that the kernel
developers have not yet added modalias support to this bus
type. With Linux-3.14.21, this is the case with ISA busses.
Expect this issue to be fixed in later kernel versions.
Eudev is not intended to load “wrapper” drivers such as snd-pcm-oss and non-hardware drivers such as loop at all.
If the “wrapper”
module only enhances the functionality provided by some
other module (e.g., snd-pcm-oss enhances the
functionality of snd-pcm by making the sound
cards available to OSS applications), configure
modprobe to
load the wrapper after Eudev loads the wrapped module. To
do this, add an “install” line to a file in
/etc/modprobe.d
. For example:
install snd-pcm /sbin/modprobe -i snd-pcm ; \
/sbin/modprobe snd-pcm-oss ; true
If the module in question is not a wrapper and is useful by
itself, configure the S05modules bootscript to
load this module on system boot. To do this, add the module
name to the /etc/sysconfig/modules
file on a separate
line. This works for wrapper modules too, but is suboptimal
in that case.
Either don't build the module, or blacklist it in
/etc/modprobe.d
file as done
with the forte
module in the example below:
blacklist forte
Blacklisted modules can still be loaded manually with the explicit modprobe command.
This usually happens if a rule unexpectedly matches a device. For example, a poorly-written rule can match both a SCSI disk (as desired) and the corresponding SCSI generic device (incorrectly) by vendor. Find the offending rule and make it more specific, with the help of udevadm info.
This may be another manifestation of the previous problem.
If not, and your rule uses sysfs
attributes, it may be a kernel
timing issue, to be fixed in later kernels. For now, you
can work around it by creating a rule that waits for the
used sysfs
attribute and
appending it to the /etc/udev/rules.d/10-wait_for_sysfs.rules
file. Please notify the CLFS Development list if you do so
and it helps.
This is due to the fact that Eudev, by design, handles uevents and loads modules in parallel, and thus in an unpredictable order. This will never be “fixed”. You should not rely upon the kernel device names being stable. Instead, create your own rules that make symlinks with stable names based on some stable attributes of the device, such as a serial number or the output of various *_id utilities installed by Eudev. See Section 11.7, “Creating custom symlinks to devices” and Networking Configuration for examples.
Additional 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
The sysfs
Filesystem
http://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf
Some software that you may want to install later (e.g.,
various media players) expect the /dev/cdrom and /dev/dvd
symlinks to exist. Also, it may be convenient to put
references to those symlinks into /etc/fstab
. For each of your CD-ROM
devices, find the corresponding directory under /sys
(e.g., this can be /sys/block/hdd
) and run a command similar
to the following:
udevadm test /sys/block/hdd
Look at the lines containing the output of various *_id programs.
There are two approaches to creating symlinks. The first one is to use the model name and the serial number, the second one is based on the location of the device on the bus. If you are going to use the first approach, create a file similar to the following:
cat >/etc/udev/rules.d/82-cdrom.rules << EOF
# Custom CD-ROM symlinks
SUBSYSTEM=="block", ENV{ID_MODEL}=="SAMSUNG_CD-ROM_SC-148F", \
ENV{ID_REVISION}=="PS05", SYMLINK+="cdrom"
SUBSYSTEM=="block", ENV{ID_MODEL}=="PHILIPS_CDD5301", \
ENV{ID_SERIAL}=="5VO1306DM00190", SYMLINK+="cdrom1 dvd"
EOF
Although the examples in this book work properly, be aware that Eudev does not recognize the backslash for line continuation. If modifying Eudev rules with an editor, be sure to leave each rule on one physical line.
This way, the symlinks will stay correct even if you move the
drives to different positions on the IDE bus, but the
/dev/cdrom
symlink won't be
created if you replace the old SAMSUNG CD-ROM with a new
drive.
The SUBSYSTEM=="block" key is needed in order to avoid
matching SCSI generic devices. Without it, in the case with
SCSI CD-ROMs, the symlinks will sometimes point to the
correct /dev/srX
devices, and
sometimes to /dev/sgX
, which is
wrong.
The second approach yields:
cat >/etc/udev/rules.d/82-cdrom.rules << EOF
# Custom CD-ROM symlinks
SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", \
ENV{ID_PATH}=="pci-0000:00:07.1-ide-0:1", SYMLINK+="cdrom"
SUBSYSTEM=="block", ENV{ID_TYPE}=="cd", \
ENV{ID_PATH}=="pci-0000:00:07.1-ide-1:1", SYMLINK+="cdrom1 dvd"
EOF
This way, the symlinks will stay correct even if you replace drives with different models, but place them to the old positions on the IDE bus. The ENV{ID_TYPE}=="cd" key makes sure that the symlink disappears if you put something other than a CD-ROM in that position on the bus.
Of course, it is possible to mix the two approaches.
As explained in
Section 11.6, “Device and Module Handling on a
CLFS System”, the order in which devices with the
same function appear in /dev
is
essentially random. E.g., if you have a USB web camera and a
TV tuner, sometimes /dev/video0
refers to the camera and /dev/video1
refers to the tuner, and
sometimes after a reboot the order changes to the opposite
one. For all classes of hardware except sound cards and
network cards, this is fixable by creating udev rules for
custom persistent symlinks. The case of network cards is
covered separately in Networking
Configuration, and sound card configuration can be found
in CBLFS.
For each of your devices that is likely to have this problem
(even if the problem doesn't exist in your current Linux
distribution), find the corresponding directory under
/sys/class
or /sys/block
. For video devices, this may be
/sys/class/video4linux/video
. Figure out the
attributes that identify the device uniquely (usually, vendor
and product IDs and/or serial numbers work):
X
udevadm info -a -p /sys/class/video4linux/video0
Then write rules that create the symlinks, e.g.:
cat >/etc/udev/rules.d/83-duplicate_devs.rules << EOF
# Persistent symlinks for webcam and tuner
KERNEL=="video*", SYSFS{idProduct}=="1910", SYSFS{idVendor}=="0d81", \
SYMLINK+="webcam"
KERNEL=="video*", SYSFS{device}=="0x036f", SYSFS{vendor}=="0x109e", \
SYMLINK+="tvtuner"
EOF
The result is that /dev/video0
and /dev/video1
devices still
refer randomly to the tuner and the web camera (and thus
should never be used directly), but there are symlinks
/dev/tvtuner
and /dev/webcam
that always point to the
correct device.
More information on writing Eudev rules can be found in
/usr/share/doc/udev/writing_udev_rules/index.html
.
The 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, and Bash Startup Files in CBLFS.
The files /etc/profile
and
~/.bash_profile
are read when the
shell is invoked as an interactive login shell. Create a base
/etc/profile
that will load any
Bash auto completion files that may be on the system, and set
the INPUTRC
environment variable
that makes Bash and Readline use /etc/inputrc
:
cat > /etc/profile << "EOF"
# Begin /etc/profile
for f in /etc/bash_completion.d/*
do
if [ -e ${f} ]; then source ${f}; fi
done
unset f
export INPUTRC=/etc/inputrc
EOF
The instructions below explain how to add some environment
variables necessary for native language support to the base
/etc/profile
created in the
previous section. Setting these variables 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 values
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 -a
Locales 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 preferred
locale (“en_US.utf8” in
our example).
LC_ALL=[locale name]
locale charmap
For the “en_US.utf8” locale, the above command will print:
UTF-8
This results in a final locale setting of “en_US.UTF-8”. 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 territory LC_ALL=[locale name] locale language LC_ALL=[locale name] locale charmap LC_ALL=[locale name] locale int_curr_symbol LC_ALL=[locale name] locale int_prefix
The above commands should print the language name, 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 10 or is not supported by the default installation of Glibc.
locale: Cannot set LC_* to default locale: No such file or directory
If 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 CLFS 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 C
Sometimes 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, add them
to the /etc/profile
file:
cat >> /etc/profile << "EOF"
export LANG=[ll]
_[CC]
.[charmap]
# End /etc/profile
EOF
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. UTF-8 has been tested on the English, French, German, Italian, and Spanish locales. All other locales are untested. If you discover issues with any other locale please open a ticket in our Trac system.
Some locales need additional programs and support. CLFS will not be supporting these locales in the book. We welcome the support for these other locales via http://cblfs.cross-lfs.org/.
The /etc/inputrc
file deals with
mapping the keyboard for specific situations. This file is the
start-up 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 <roryo@roryo.dynup.net>
# Allow the command prompt to wrap to the next line
set horizontal-scroll-mode Off
# Enable 8bit input
set meta-flag On
set input-meta On
# Turns off 8th bit stripping
set convert-meta Off
# Keep the 8th bit for display
set output-meta On
# none, visible or audible
set 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/inputrc
EOF
The /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 0
devpts /dev/pts devpts gid=5,mode=620 0 0
shm /dev/shm tmpfs defaults 0 0
# End /etc/fstab
EOF
Replace [xxx]
,
[yyy]
, and [fff]
with the values
appropriate for the system, for example, sda2
, sda5
, and
ext2
. For details on the six
fields in this file, see man 5
fstab.
Part 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=[clfs]
" > /etc/sysconfig/network
[clfs]
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.
If a network card is to be configured, decide on the IP
address, fully-qualified domain name (FQDN), and possible
aliases for use in the /etc/hosts
file. The syntax is:
<IP address> myhost.example.org aliases
Unless 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:
Private Network Address Range Normal Prefix
10.0.0.1 - 10.255.255.254 8
172.x.0.1 - 172.x.255.254 16
192.168.y.1 - 192.168.y.254 24
x can be any number in the range 16-31. y can be any number in the range 0-255.
A valid IP address could be 192.168.1.1. A valid FQDN for this
IP could be www.cross-lfs.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, a valid 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]
[<HOSTNAME>.example.org]
[HOSTNAME]
[alias ...]
# End /etc/hosts (network card version)
EOF
The [192.168.1.1]
and
[<HOSTNAME>.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). The
optional alias name(s) can be omitted.
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 [<HOSTNAME>.example.org]
[HOSTNAME]
localhost
# End /etc/hosts (no network card version)
EOF
If 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
. If at least one
of your network interfaces is going to be configured by DHCP
then you may not need to create this file. By default DHCPCD
will overwrite this file when it gets a new lease from the DHCP
server. If you wish to manually configure your network
interfaces or manually set your DNS using DHCP then create the
file by running the following:
cat > /etc/resolv.conf << "EOF"
# Begin /etc/resolv.conf
domain [Your Domain Name]
nameserver [IP address of your primary nameserver]
nameserver [IP address of your secondary nameserver]
# End /etc/resolv.conf
EOF
The domain
statement
can be omitted or replaced with a search
statement. See the man
page for resolv.conf for more details.
Replace [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.
This section only applies if a network card is to be configured. If you do not need to configure a network interface you can skip on to Making the CLFS System Bootable.
There are two different ways you can proceed from this point to configure your network. Dynamic will allow you to take advantage of a DHCP server to get all your configuration information. Static you become responsible for setting up your options.
To configure a Static Interface, Follow Section 12.5, “Static Networking Configuration”.
To configure a DHCP Interface, Follow Section 12.6, “DHCPCD-6.3.2”.
Which 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 its IP 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="yes"
SERVICE="ipv4-static"
IP="192.168.1.1"
GATEWAY="192.168.1.2"
PREFIX="24"
BROADCAST="192.168.1.255"
EOF
The 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
CLFS-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.
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 Internet Service Providers (ISPs). In this
example (PREFIX=24), the netmask is 255.255.255.0. Adjust the
PREFIX
variable according to your
specific subnet.
To configure another DHCP Interface, Follow Section 12.6.2, “Creating the DHCP Network Interface Configuration Files”.
The DHCPCD package provides a DHCP Client for network configuration.
If you wish to configure your network to connect to a DHCP server, you will first need to install a DHCP client. CLFS uses the DHCPCD package for this.
Prepare DHCPCD for compilation:
./configure --prefix=/usr --sbindir=/sbin \ --sysconfdir=/etc --dbdir=/var/lib/dhcpcd --libexecdir=/usr/lib/dhcpcd
Compile the package:
make
This package does not come with a test suite.
Install the package:
make install
First install the service from the CLFS Bootscripts package:
tar -xvf bootscripts-cross-lfs-3.0-20140710.tar.xz cd bootscripts-cross-lfs-3.0-20140710 make install-service-dhcpcd
Finally, create the /etc/sysconfig/network-devices/ifconfig.eth0/dhcpcd
configuration file using the following commands. Adjust
appropriately for additional interfaces:
cd /etc/sysconfig/network-devices &&
mkdir -v ifconfig.eth0 &&
cat > ifconfig.eth0/dhcpcd << "EOF"
ONBOOT="yes"
SERVICE="dhcpcd"
# Start Command for DHCPCD
DHCP_START="-q"
# Stop Command for DHCPCD
DHCP_STOP="-k"
EOF
The 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
CLFS-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.
The DHCP_START
and DHCP_STOP
variables arguments that are passed
onto dhcpcd
when starting and
stoppping the service. More information about what can be
passed can be found in the dhcpcd(8)
man page.
To configure another Static Interface, Follow Section 12.5, “Static Networking Configuration”.
It is time to make the CLFS system bootable. This chapter discusses building a kernel for the new CLFS system and installing the boot loader so that the CLFS system can be selected for booting at startup.
The Linux package contains the Linux kernel.
Building 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.
Apply the latest Linux sublevel patch:
xzcat ../patch-3.14.21.xz | patch -Np1 -i -
Prepare for compilation by running the following command:
make mrproper
This 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.
A good starting place for setting up the kernel configuration is to run make defconfig. This will set the base configuration to a good state that takes your current system architecture into account.
Be sure to configure the following options as shown, or the system might not work correctly or boot at all:
Device Drivers ---> Generic Driver Options ---> () path to uevent helper (CONFIG_UEVENT_HELPER_PATH) [*] Maintain a devtmpfs filesystem to mount at /dev (CONFIG_DEVTMPFS) [ ] Fallback user-helper invocation for firmware loading (CONFIG_FW_LOADER_USER_HELPER)
"EFI Variable support" and "EFI GUID Partition support" are for UEFI systems.
Configure the kernel via a menu-driven interface. CBLFS has some information regarding particular kernel configuration requirements of packages outside of CLFS at http://cblfs.cross-lfs.org/:
make menuconfig
Alternatively, 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 root directory
of the unpacked kernel sources. However, we do not recommend
this option. It is often better to explore all the
configuration menus and create the kernel configuration from
scratch.
Compile the kernel image and modules:
make
If using kernel modules, a configuration file in /etc/modprobe.d
file may be needed.
Information pertaining to modules and kernel configuration is
located in the kernel documentation in the Documentation
directory of the kernel
sources tree. Also, modprobe.d(5)
may be of interest.
Install the modules, if the kernel configuration uses them:
make modules_install
Install the firmware, if the kernel configuration uses them:
make firmware_install
After kernel compilation is complete, additional steps are
required to complete the installation. Some files need to be
copied to the /boot
directory.
Issue the following command to install the kernel:
cp -v arch/x86_64/boot/bzImage /boot/vmlinuz-clfs-3.14.21
System.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-3.14.21
The 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-3.14.21
It 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 do inside
the final-system build environment), 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 retained, run
chown -R 0:0 on
the linux-3.14
directory to
ensure all files are owned by user root
.
Some 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 a CLFS system as it can cause
problems for packages you may wish to build once your base
CLFS system is complete.
Also, the headers in the system's include
directory should always be the ones against which
Glibc was compiled and should never be replaced by headers
from a different kernel version.
Contains all the configuration selections for the kernel |
|
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 same time. |
|
A list of addresses and symbols; it maps the entry points and addresses of all the functions and data structures in the kernel |
Your shiny new CLFS 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 x86 and x86_64 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).
The 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 CLFS partition. In this case,
this next command would become grub-install /dev/sda2
.
Instruct GRUB to install itself into the MBR of sda
:
grub-install /dev/sda
Next, we need to generate a configuration for GRUB. In previous
versions of grub we could create the configuration manually
here, but with GRUB2 we can generate grub.cfg
automatically. You can do this with
the following command:
grub-mkconfig -o /boot/grub/grub.cfg
Well done! The new CLFS 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/clfs-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 CLFS version is installed on
the system. Create this file by running:
echo 3.0.0-SYSVINIT > /etc/clfs-release
The final system build does not install an FTP or HTTP client for downloading files.
Some suggested clients include:
LFTP http://lftp.yar.ru/
NcFTP Client http://cblfs.cross-lfs.org/index.php/Ncftp
BASH - A user can use net redirections (if not disabled when building bash in the final system) to download wget or another program.
cat > download.sh << "EOF" #!/bin/bash WGET_VERSION='1.14' WGET_HOSTNAME='ftp.gnu.org' exec {HTTP_FD}<>/dev/tcp/${WGET_HOSTNAME}/80 echo -ne "GET /gnu/wget/wget-${WGET_VERSION}.tar.xz HTTP/1.1\r\nHost: "\ ${WGET_HOSTNAME}'\r\nUser-Agent: '\ 'bash/'${BASH_VERSION}'\r\n\r\n' >&${HTTP_FD} sed -e '1,/^.$/d' <&${HTTP_FD} >wget-${WGET_VERSION}.tar.xz EOF
GAWK
cat > gawkdl.sh << "EOF" #!/bin/bash gawk 'BEGIN { NetService = "/inet/tcp/0/mirror.anl.gov/80" print "GET /pub/gnu/wget/wget-1.14.tar.xz" |& NetService while ((NetService |& getline) > 0) print $0 close(NetService) }' > binary gawk '{q=p;p=$0}NR>1{print q}END{ORS = ""; print p}' binary > wget-1.14.tar.xz rm binary EOF
PERL with HTTP::Tiny (Included with final system PERL install).
cat > download.pl << "EOF" #!/usr/bin/perl use HTTP::Tiny; my $http = HTTP::Tiny->new; my $response; $response = $http->mirror('http://ftp.gnu.org/gnu/wget/wget-1.14.tar.xz', 'wget-1.14.tar.xz'); die "Failed!\n" unless $response->{success}; print "Unchanged!\n" if $response->{status} eq '304'; EOF
Or use this:
perl -MHTTP::Tiny -E 'say HTTP::Tiny->new->get(shift)->{content}' "http://ftp.gnu.org/gnu/wget/wget-1.14.tar.xz" > binary perl -e 'local $/; $_ = <>; s/\n$//; print' binary > wget-1.14.tar.xz rm binary
PERL with LWP: Run cpan and manually configure the client. Run install LWP while in the CPAN shell.
Refer to http://www.bioinfo-user.org.uk/dokuwiki/doku.php/projects/wgetpl for wgetpl.
If you built your final system using the boot method, just run shutdown -r now to reboot again, using your newly-built kernel instead of the miminal one currently in use. If you chrooted, there are a few more steps.
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 CBLFS while still in our current chroot environment, you can leave yourself in a much better position to continue on once you reboot into your new CLFS installation. Installing a text mode web browser, such as Lynx, you can easily view the CBLFS website 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 where static 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 CLFS installation for the first time! First exit from the chroot environment:
logout
Then unmount the virtual file systems:
umount ${CLFS}/dev/pts if [ -h ${CLFS}/dev/shm ]; then link=$(readlink ${CLFS}/dev/shm) umount -v ${CLFS}/$link unset link else umount -v ${CLFS}/dev/shm fi umount ${CLFS}/dev umount ${CLFS}/proc umount ${CLFS}/sys umount ${CLFS}/run
Unmount the CLFS file system itself:
umount ${CLFS}
If multiple partitions were created, unmount the other partitions before unmounting the main one, like this:
umount ${CLFS}/usr umount ${CLFS}/home umount ${CLFS}
Now, reboot the system with:
shutdown -r now
Assuming the boot loader was set up as outlined earlier, CLFS 3.0.0-SYSVINIT will boot automatically.
When the reboot is complete, the CLFS system is ready for use and more software may be added to suit your needs.
Thank you for reading this CLFS book. We hope that you have found this book helpful and have learned more about the system creation process.
Now that the CLFS 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 a CLFS 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:
Freecode (http://freecode.com/)
Freecode 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.
Community Driven Beyond Linux From Scratch
The Community Driven Beyond Linux From Scratch wiki covers installation procedures for a wide range of software beyond the scope of the CLFS Book. CBLFS is designed specifically to work with the CLFS book, and has all the necessary information to continue the builds in the same manner that CLFS uses. This is a community driven project, which means anyone can contribute and provide updates. The CBLFS project is located at http://cblfs.cross-lfs.org/.
CLFS Hints
The CLFS Hints are a collection of educational documents submitted by volunteers in the CLFS community. The hints are available at http://hints.cross-lfs.org/index.php/.
Mailing lists
There are several CLFS 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/.
ABI |
Application Binary Interface |
API |
Application Programming Interface |
ASCII |
American Standard Code for Information Interchange |
ATA |
Advanced Technology Attachment (see IDE) |
BIOS |
Basic Input/Output System |
bless |
manipulate a filesystem so that OF will boot from it |
BSD |
Berkeley Software Distribution |
CBLFS |
Community Driven Beyond Linux From Scratch |
chroot |
change root |
CLFS |
Cross-Compiled Linux From Scratch |
CMOS |
Complementary Metal Oxide Semiconductor |
COS |
Class Of Service |
CPU |
Central Processing Unit |
CRC |
Cyclic Redundancy Check |
DHCP |
Dynamic Host Configuration Protocol |
DNS |
Domain Name Service |
EGA |
Enhanced Graphics Adapter |
ELF |
Executable and Linkable Format |
EOF |
End of File |
EQN |
equation |
ext2 |
second extended file system |
ext3 |
third extended file system |
ext4 |
fourth extended file system |
FAQ |
Frequently Asked Questions |
FHS |
Filesystem Hierarchy Standard |
FIFO |
First-In, First Out |
FQDN |
Fully Qualified Domain Name |
FTP |
File Transfer Protocol |
GB |
Gigabytes |
GCC |
GNU Compiler Collection |
GID |
Group Identifier |
GMT |
Greenwich Mean Time |
HTML |
Hypertext Markup Language |
IDE |
Integrated Drive Electronics |
IEEE |
Institute of Electrical and Electronic Engineers |
IO |
Input/Output |
IP |
Internet Protocol |
IPC |
Inter-Process Communication |
IRC |
Internet Relay Chat |
ISO |
International Organization for Standardization |
ISP |
Internet Service Provider |
KB |
Kilobytes |
LED |
Light Emitting Diode |
LFS |
Linux From Scratch |
LSB |
Linux Standard Base |
MB |
Megabytes |
MBR |
Master Boot Record |
MD5 |
Message Digest 5 |
NIC |
Network Interface Card |
NLS |
Native Language Support |
NPTL |
Native POSIX Threading Library |
OF |
Open Firmware |
OSS |
Open Sound System |
PCH |
Pre-Compiled Headers |
PID |
Process Identifier |
PTY |
pseudo terminal |
QA |
Quality Assurance |
QOS |
Quality Of Service |
RAM |
Random Access Memory |
RPC |
Remote Procedure Call |
RTC |
Real Time Clock |
SCO |
The Santa Cruz Operation |
SATA |
Serial ATA |
SGR |
Select Graphic Rendition |
SHA1 |
Secure-Hash Algorithm 1 |
TLDP |
The Linux Documentation Project |
TFTP |
Trivial File Transfer Protocol |
TLS |
Thread-Local Storage |
UID |
User Identifier |
umask |
user file-creation mask |
USB |
Universal Serial Bus |
UTC |
Coordinated Universal Time |
UUID |
Universally Unique Identifier |
VC |
Virtual Console |
VGA |
Video Graphics Array |
VT |
Virtual Terminal |
Every package built in CLFS relies on one or more other packages in order to build and install properly. Some packages even participate in circular dependencies, that is, the first package depends on the second which in turn depends on the first. Because of these dependencies, the order in which packages are built in CLFS is very important. The purpose of this page is to document the dependencies of each package built in CLFS.
For each package we build, we have listed three types of dependencies. The first lists what other packages need to be available in order to compile and install the package in question. The second lists what packages, in addition to those on the first list, need to be available in order to run the test suites. The last list of dependencies are packages that require this package to be built and installed in its final location before they are built and installed. In most cases, this is because these packages will hardcode paths to binaries within their scripts. If not built in a certain order, this could result in paths of /tools/bin/[binary] being placed inside scripts installed to the final system. This is obviously not desirable.
This page contains dependency information for packages specific to x86 Pure64.
CLFS includes many packages, a number of which might not necessarily be required for a "minimal" system, but still considered very useful. The purpose of this page is to list the reasoning for each package's inclusion in the book.
Autoconf
The Autoconf package contains programs for producing shell scripts that can automatically configure source code. This is useful for software developers, as well as anyone who wants to install packages that don't come with a configure script, such as some of the packages in CBLFS.
Automake
The Automake package contains programs for generating Makefiles for use with Autoconf. This can be useful to software developers.
Bash
This package contains the Bourne-Again SHell. A shell is an important component of a Linux system, as there must be some way of allowing the users to enter commands.
Bc
This package contains a precision calculator. The Linux kernel uses Bc to render the timeconst header.
Binutils
This package contains programs for handling object files. The programs in this package are needed for compiling most of the packages in CLFS.
Bison
This package contains programs that are required by several packages in CLFS.
Bzip2
The programs in this package are useful for compressing files to reduce size. They are also needed to uncompress tarballs for many CLFS packages.
CLFS-Bootscripts
This package contains a number of scripts that run at boottime, performing essential tasks such as mounting/checking filesystems and starting the network interface.
Check
This package contains a test harness for other programs. It is used for some packages' test suites.
CLooG
This package is used by GCC to enable its Graphite loop generation code.
Coreutils
This package contains many basic command-line file-management tools, required for installation of every package in CLFS.
DejaGNU
This package is needed for the test suites of several packages, especially GCC and Binutils.
DHCPCD
This package allows for automatic configuration of network interfaces from a DHCP server. It (or some other package providing a DHCP client is needed to connect to a DHCP server.
Diffutils
This package contains programs to compare files, and can also be used to create patches. It is required by the installation procedures of many CLFS packages, and used by many packages' test suites.
Eudev
This is a package that allows for dynamic creation of device nodes. It is a fork of Udev, which is now part of Systemd. It is still used for the "Boot" method in the temp-system, as Systemd is not needed there.
Expect
This package is needed for the test suites for several packages.
E2fsprogs
The programs in this package are used for the creation and maintenance of ext2/3/4 filesystems.
File
This package contains a program that determines the type of a given file. It is needed by some CLFS packages.
Findutils
This package contains programs for finding files based on certain criteria, and optionally performing commands on them. These programs are used by the installation procedures of many CLFS packages.
Flex
This package contains a tool for generating text scanners. It is used by multiple packages in CLFS
Gawk
This package contains programs for manipulating text files, using the AWK language. It is used by the installation procedures of many packages in CLFS.
Gcc
This package contains a C compiler, which is required to compile most of the packages in CLFS.
GDBM
This package contains the GNU Database Manager library. Man-DB requires either GDBM or Berkeley DB, though it prefers GDBM.
Gettext
A tool that allows programmers to easily implement i18n (internationalization) in their programs. It is a required dependency for a number of packages
Glibc
Any dynamically-linked C program (nearly every package in CLFS has these) needs a C library to compile and run.
GMP
This package is required by GCC.
Grep
This package contains programs for searching for text in files. These programs are required by many packages in CLFS.
Groff
This package is required by Man-DB.
Gzip
Useful for compressing files to reduce size. It is also needed to uncompress tarballs for many CLFS packages
Iana-Etc
This package provides the /etc/services
and /etc/protocols
files. These files map
port names to port numbers as well as protocol names to
their corresponding numbers. These files are essential for
many network based programs to work properly.
IProute2
This package contains programs for administering network interfaces.
IPutils
This package contains several basic network-management tools.
ISL
This package is required by CLooG.
Kbd
Contains keytable files and keyboard utilities compatible with the Linux kernel. These can be used to change the display font and keyboard layout.
Kmod
This package contains programs that assist in loading an unloading kernel modules.
Less
A program that lets you view text files one page at a time. It is also used by Man-DB for displaying manpages.
Libee
This library is required by Rsyslog.
Libestr
This library is required by Rsyslog.
Libpipeline
The Libpipeline package contains a library for manipulating pipelines of subprocesses in a flexible and convenient way. It is required by the Man-DB package.
Libtool
The Libtool package contains the GNU generic library support script. It is used by some CLFS packages.
Linux Headers
This package consists of santized headers from the Linux Kernel. These headers are required for Glibc to compile.
Linux Kernel
The Linux operating system.
M4
This package contains a macro processor. It is required by several CLFS packages, including Bison.
Make
This is required for installation of most CLFS packages
Man-DB
This package contains programs for finding and viewing man pages, and has superior internationalization capabilities compared to the Man package.
Man-Pages
A number of useful manpages, not supplied by other packages
MPC
This package is required by GCC.
MPFR
This package is required by GCC.
Ncurses
Needed by several packages in CLFS, such as Vim, Bash, and Less
Patch
Used for applying patches in several CLFS packages
Perl
The Perl package contains the Practical Extraction and Report Language. It is required by several CLFS packages.
Pkg-config-lite
Several packages in CLFS, and many others outside of CLFS, use pkg-config to locate dependencies.
Procps-ng
Provides a number of small, useful utilities that give
information about the /proc
filesystem.
Psmisc
Provides more utilties that give information about the
/proc
filesystem.
Readline
The Readline library provides a set of functions for use by applications that allow users to edit command lines as they are typed in. This is essential for input in programs like bash to work properly.
Rsyslog
This package provides a system logging daemon.
Sed
This package contains a stream editor. It is used in the installation procedures of most CLFS packages.
Shadow
This package contains programs that assist in the administration of users and groups, and passwords.
Sysvinit
Sysvinit provides the init daemon for the system.
Tar
Required to unpack the tar archives in which all CLFS packages are distributed
Tcl
Needed for the test suites of several packages
Texinfo
This package contains programs for viewing, installing and converting info pages. It is used in the installation procedures of many CLFS packages.
Util-linux
The Util-linux package contains miscellaneous utility programs. Among them are utilities for handling file systems, consoles, partitions, and messages. It also includes libraries that are required by E2fsprogs.
Vim
The Vim package contains a text editor. Users may substitute Nano, Joe, Emacs, or whatever other editor they prefer.
XZ Utils
Useful for compressing files to reduce size. Also needed to uncompress tarballs for many CLFS packages
Zlib
The Zlib package contains compression and decompression routines used by some programs.
The Open Publication works may be reproduced and distributed in whole or in part, in any medium physical or electronic, provided that the terms of this license are adhered to, and that this license or an incorporation of it by reference (with any options elected by the author(s) and/or publisher) is displayed in the reproduction.
Proper form for an incorporation by reference is as follows:
Copyright © <year> by <author's name or designee>. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, vX.Y or later (the latest version is presently available at http://www.opencontent.org/openpub/).
The reference must be immediately followed with any options elected by the author(s) and/or publisher of the document (see section VI).
Commercial redistribution of Open Publication-licensed material is permitted.
Any publication in standard (paper) book form shall require the citation of the original publisher and author. The publisher and author's names shall appear on all outer surfaces of the book. On all outer surfaces of the book the original publisher's name shall be as large as the bridgehead of the work and cited as possessive with respect to the bridgehead.
The copyright to each Open Publication is owned by its author(s) or designee.
The following license terms apply to all Open Publication works, unless otherwise explicitly stated in the document.
Mere aggregation of Open Publication works or a portion of an Open Publication work with other works or programs on the same media shall not cause this license to apply to those other works. The aggregate work shall contain a notice specifying the inclusion of the Open Publication material and appropriate copyright notice.
SEVERABILITY. If any part of this license is found to be unenforceable in any jurisdiction, the remaining portions of the license remain in force.
NO WARRANTY. Open Publication works are licensed and provided "as is" without warranty of any kind, express or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose or a warranty of non-infringement.
All modified versions of documents covered by this license, including translations, anthologies, compilations and partial documents, must meet the following requirements:
The modified version must be labeled as such.
The person making the modifications must be identified and the modifications dated.
Acknowledgement of the original author and publisher if applicable must be retained according to normal academic citation practices.
The location of the original unmodified document must be identified.
The original author's (or authors') name(s) may not be used to assert or imply endorsement of the resulting document without the original author's (or authors') permission.
In addition to the requirements of this license, it is requested from and strongly recommended of redistributors that:
If you are distributing Open Publication works on hardcopy or CD-ROM, you provide email notification to the authors of your intent to redistribute at least thirty days before your manuscript or media freeze, to give the authors time to provide updated documents. This notification should describe modifications, if any, made to the document.
All substantive modifications (including deletions) be either clearly marked up in the document or else described in an attachment to the document.
Finally, while it is not mandatory under this license, it is considered good form to offer a free copy of any hardcopy and CD-ROM expression of an Open Publication-licensed work to its author(s).
The author(s) and/or publisher of an Open Publication-licensed document may elect certain options by appending language to the reference to or copy of the license. These options are considered part of the license instance and must be included with the license (or its incorporation by reference) in derived works.
A. To prohibit distribution of substantively modified versions without the explicit permission of the author(s). "Substantive modification" is defined as a change to the semantic content of the document, and excludes mere changes in format or typographical corrections.
To accomplish this, add the phrase `Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder.' to the license reference or copy.
B. To prohibit any publication of this work or derivative works in whole or in part in standard (paper) book form for commercial purposes is prohibited unless prior permission is obtained from the copyright holder.
To accomplish this, add the phrase 'Distribution of the work or derivative of the work in any standard (paper) book form is prohibited unless prior permission is obtained from the copyright holder.' to the license reference or copy.
(This is not considered part of the license.)
Open Publication works are available in source format via the Open Publication home page at http://works.opencontent.org/.
Open Publication authors who want to include their own license on Open Publication works may do so, as long as their terms are not more restrictive than the Open Publication license.
If you have questions about the Open Publication License, please contact David Wiley at dw@opencontent.org, and/or the Open Publication Authors' List at opal@opencontent.org, via email.
To subscribe to the Open Publication Authors' List: Send E-mail to opal-request@opencontent.org with the word "subscribe" in the body.
To post to the Open Publication Authors' List: Send E-mail to opal@opencontent.org or simply reply to a previous post.
To unsubscribe from the Open Publication Authors' List: Send E-mail to opal-request@opencontent.org with the word "unsubscribe" in the body.