Details on this package are located in Section 10.5.2, “Contents of Linux-Headers.”
Copyright © 2005–2006 Jim Gifford & Ryan Oliver
Based on LFS, Copyright © 1999–2006 Gerard Beekmans
Copyright (c) 2005, Jim Gifford & Ryan Oliver
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 bought 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 Alpha, 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)
Jim Gifford, CLFS Project Co-leader
Ryan Oliver, CLFS Project Co-leader
Joe Ciccone, Justin Knierim, Chris Staub, Matt Darcy, Ken Moffat,
Manuel Canales Esparcia, and Nathan Coulson - 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. 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.linuxhq.com/guides/LUG/guide.html
This guide covers the usage of assorted Linux software.
The Essential Pre-Reading Hint http://www.linuxfromscratch.org/hints/downloads/files/essential_prereading.txt
This is 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.17 are not recommended as they have not been tested)
Bzip2-1.0.2
Coreutils-5.0 (or Sh-Utils-2.0, Textutils-2.0, and Fileutils-4.1)
Diffutils-2.8
Findutils-4.1.20
Gawk-3.0
Gcc-2.95.3 (Versions greater than 4.1.1 are not recommended as they have not been tested)
Glibc-2.2.5 (Versions greater than 2.4 are not recommended as they have not been tested)
Grep-2.5
Gzip-1.2.4
Make-3.79.1
Patch-2.5.4
Sed-3.0.2
Tar-1.14
To see whether your host system has all the appropriate versions, run the following:
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-4 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 /lib/libc.so.6 | head -n1 | cut -d" " -f1-7 grep --version | head -n1 gzip --version | head -n1 make --version | head -n1 patch --version | head -n1 sed --version | head -n1 tar --version | head -n1 EOF bash version-check.sh
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; Appendix B gives acknowledgments to people who have helped work on the CLFS project and website; Appendix C and D have information about package dependencies and the 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/clfs/errata/1.0.0/ 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:
Ryan Oliver - Build Process Developer.
Jim Gifford - Lead Developer.
Jeremy Utley - Release Manager 1.x Series.
Our CLFS Team:
Joe Ciccone - Alpha, MIPS, Sparc builds.
Nathan Coulson - Bootscripts.
Matt Darcy - x86, X86_64, and Sparc builds.
Manuel Canales Esparcia - Book XML.
Karen McGuiness - Proofreader.
Jeremy Huntwork - PowerPC, x86, Sparc builds.
Justin Knierim - Website Architect.
Ken Moffat - PowerPC and X86_64 builds. Developer of Pure 64 Hint.
Alexander E. Patrakov - Udev/Hotplug Integration
Chris Staub - x86 builds. Leader of Quality Control.
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.
William Zhou - Text updates and Typos
Theo Schneider - Testing of the Linux Headers Package
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, Mandriva, SUSE, 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 the Linux From Scratch LiveCD. This CD works well as a host system, providing all the tools you need to successfully follow the instructions in this book. It does also contain source packages and patches for the LFS book, and a copy of the LFS book, but not the needed packages or book for CLFS. You can still use the CD for building CLFS, but you will need to download the packages, patches and book separately. You can also look at http://www.linuxfromscratch.org/hints/downloads/files/lfscd-remastering-howto.txt for infomation on building your own CD, replacing the LFS packages and book with those for CLFS. Once you have the CD, no network connection or additional downloads are necessary. For more information about the LFS LiveCD or to download a copy, visit http://www.linuxfromscratch.org/livecd/.
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. This minimal system will be built using the cross-toolchain in /cross-tools.
In Installing Basic System Software, the full CLFS system is built. Depending on the system you are cross-compiling for, you will either boot the minimal temp-system on the target machine, or chroot into it.
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.
Some systems cannot be built by chrooting so they must be booted instead. Generally, if you building for a different arch than the host system, you must reboot because the kernel will likely not support the target machine. Booting involves installing a few additional packages that are needed for bootup, installing bootscripts, and building a miminal kernel. We also describe some alternative booting methods in Section 7.23, “What to do next”
To finish the installation, the CLFS-Bootscripts are set up in Setting Up System Bootscripts, 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 1.0.0 of the Cross-Compiled Linux From Scratch book, dated September 21, 2006. 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:
September 18, 2006
[Chris] - Removed TeX installation commands from Texinfo instructions.
September 16, 2006
[jim] - Updated Udev-Cross-LFS rules to 1.0-3. Fixes bootup with /lib64/udev.
September 10, 2006
[jim] - Added a patch to fix Inetutils. Telnet on 64 bit systems will fail, it will attempt to connect to 255.255.255.255 instead of the ip address entered. This was due to a change in glibc's handling of inet_addr, was long now is u_int32_t. Bug found by Vladimir Vainer.
[jim] - Add patch to fix gzexe. Used Matts change from LFS, that utilizes Robert's fix. More details at http://wiki.linuxfromscratch.org/lfs/ticket/1876.
[Chris] - Added Host System Requiremets page, and added more info to the "To Boot or Chroot?" page about needing a 2.6.x Linux kernel to chroot.
September 9, 2006
[jim] - Updated Linux to 2.6.17.13 and Linux Headers to 2.6.17.13-09092006.
September 8, 2006
[jim] - Fixed Perl Testsuite Network tests.
September 7, 2006
[jim] - Updated Multilib Tree to follow build standards set in the book.
[jim] - Updated copy commands in Linux Headers, simpler and cleaner.
September 6, 2006
[jim] - UDEV Rules - On multilib builds, change /lib/udev to /lib64/udev, to keep consistency through the system.
[jim] - Removed sed from tcl, not required.
[jim] - Replace Perl FPIC patch with a sed, to make sure fpic is set correctly.
September 5, 2006
[jim] - UDEV - On multilib builds, change /lib/udev to /lib64/udev, to keep consistency through the system.
[jim] - IPRoute2 - On multilib builds, change /usr/lib/tc to /usr/lib64/tc, to keep consistency through the system.
August 28, 2006
[jim] - Renamed Cross-LFS Bootscripts 0.4 to 1.0, for the release. No changes made to the scripts.
[jim] - Renamed Cross-LFS Udev Rules 0.1-07062006 to 1.0, for the release. No changes made to the rules.
August 27, 2006
[jim] - Updated to Cross-LFS Bootscripts 0.4.
August 23, 2006
[jim] - Updated Linux to 2.6.17.11 and Linux Headers to 2.6.17.11-08232006.
[jim] - Updated Linux to 2.6.17.10 and Linux Headers to 2.6.17.10-08232006.
August 21, 2006
[jciccone] - Added a multilib perl setup that has a multilib wrapper. The multilib wrapper checks for the value of PERL_ARCH and executes the cooresponding perl binary.
[ken] - Remove include/net from instructions for headers.
August 20, 2006
[jciccone] - Added the Perl fPIC patch which makes perl build a shared DynaLoader.a.
[Chris] - Removed mention of package users hint from "Package Management" page.
[jim] - Updated Linux to 2.6.17.9 and Linux Headers to 2.6.17.9-08202006.
[jim] - Added Linux Tulip Patch to all Linux 2.6.17.9 builds. Fixes an initialization error.
August 8, 2006
[jim] - Moved man-pages to the beginning of the build. (fixes ticket #82).
[jim] - Updated the wording of Bzip2, changes were made to MIPS but not the other multilib architectures. Updated for all architectures now (fixes ticket #79).
August 7, 2006
[Chris] - Updated udev explanatory text in the book and added "Custom Symlinks" page, taken from LFS. Thanks to Alexander Patrakov for the updated text (fixes ticket #75).
August 3, 2006
[ken] - Fixed the temporary bash to correct a failure in the Glibc testsuite, (fixes ticket #78). Thanks to Go Moko.
July 27, 2006
[jim] - Fixed symlink issue in bootscripts. New Package CLFS-bootscripts 0.3.
July 25, 2006
[jim] - Symlinks /tools/bin/file to /usr/bin/file for the GCC testsuite.
July 24, 2006
[Chris] - Updated commands for building the keymap into the kernel - changed the bootable/kernel page to account for the new keymap files location, and changed the instructions in the "boot" section to reflect that fact that we don't know where the keymap files may be on the host (fixes ticket #56).
July 20, 2006
[jim] - Updated to linux-2.6.17.6 and linux-headers-2.6.17.6-07202006.
[jim] - Updated to Udev 096.
July 17, 2006
[jeremy] - Minor foreword fixups courtesy of Karen.
July 16, 2006
[Chris] - Removed unneeded chown and chmod commands from final-system linux-headers installation.
[Chris] - Added a sed command to fix updatedb due to the new location for the find program.
July 14, 2006
[jeremy] - Updated to new foreword
July 11, 2006
[jim] - Updated to linux-headers-2.6.17.4-07112006.
July 9, 2006
[jim] - Updated to linux-headers-2.6.17.4-07092006.
July 8, 2006
[jim] - Updated to linux-2.6.17.4 and linux-headers-2.6.17.4-07072006.
[Chris] - Removed many "${CLFS}" references from explanatory text in boot section.
July 7, 2006
[Chris] - Modified the "creating directories" sections - changed multilib instructions to be consistent with the new format now used for every other arch, and changed mips instructions to use xincludes.
July 6, 2006
[jim] - Updated Udev rules to 07062006, Fixed cdrom, permissions and groups.
July 5, 2006
[jim] - Fixes a possible issue with bootscripts if the the /usr partition is not mounted during startup. Moved find to /bin and moved some kbd utilities to /bin.
July 4, 2006
[jim] - Updated the Grub patch to fix various issues, see text of patch for more details.
July 2, 2006
[Chris] - Updated passwd and group file creation to only create minimal users and groups and include information on other users/groups.
[jim] - Added file to Testsuite tools, required for gcc tests.
July 1, 2006
[jim] - Updated the build to use CLFS in variables instead of LFS. Also change /mnt/lfs to /mnt/clfs.
June 29, 2006
[jim] - Updated Temp-System and Boot builds to be more consistant. Added --build=${LFS_HOST}, where possible.
[jim] - Updated to Cross-LFS Bootscripts. Added check for for /etc/sysconfig/createfiles.
June 27, 2006
[jim] - Updated to linux-headers-2.6.17.1-06272006.
June 25, 2006
[jciccone] - Updated to linux-headers-2.6.17.1-06252006.
June 24, 2006
[jeremy] - Release of 1.0.0-rc1
June 23, 2006
[jim] - Updated Binutils 2.17.
[jim] - Updated Cross-LFS Specific Packages and Patches links for Release.
June 22, 2006
[jim] - Added mktemp to Linux dependency list. New dependency as of 2.6.17.
[jim] - Updated Vim 7.0 patch.
June 21, 2006
[Chris] - Text updates to the book, including replacing "LFS" with "CLFS".
[jim] - Updated to linux-headers-2.6.17.1-06212006-1.
[jim] - Updated Vim 7.0 patch.
June 20, 2006
[jeremy] - Corrected e2fsprogs installation in the boot section, to take into account the new mke2fs.conf file.
[jciccone] - Updated to linux-2.6.17.1 and linux-headers-2.6.17.1-06202006.
[jim] - Updated to linux-headers-2.6.17.1-06202006-1.
June 19, 2006
[jciccone] - Updated to man-1.6d.
[jciccone] - Added an iconv_fix patch to glibc which fixes an issue that has shown up primarily in samba.
[jciccone] - Updated to linux-2.6.17 and linux-headers-2.6.17-06192006.
June 15, 2006
[jim] - Let Perl use thread support.
June 14, 2006
[jim] - Updated to Binutils 2.16.94.
June 10, 2006
[Chris] - Updates to lists of installed programs for several packages.
[Ken] - Fixed the module-init-tools install in the presence of existing files. Thanks to Manuel for pointing me to the fix in LFS, and to Dan Nicholson for the fix.
June 9, 2006
[jim] - Updates to Shadow 4.0.16 build instructions.
[jim] - Updated to Linux Headers 2.6.16.20 to 06092006.
June 7, 2006
[jim] - Updated to Shadow 4.0.16.
June 6, 2006
[Chris] - Added many more -v switches for verbosity.
June 5, 2006
[jim] - Updated to linux-2.6.16.20, and linux-headers-2.6.16.20.
[jim] - Updated to Bison 2.3.
June 4, 2006
[Chris] - Removed obsolete paragraph about "resetting" passwords when using pwconv from Shadow instructions.
[jim] - Updated to Linux Headers 2.6.16.19 to 06042006.
June 1, 2006
[Chris] - Updated list of installed programs for several packages.
May 31, 2006
[ken] - Removed redundant chown of /usr/share/libtool/libltdl.
[jim] - Updated to linux-2.6.16.19, and linux-headers-2.6.16.19.
May 30, 2006
[jim] - Added a patch to fix a missing declaration of R_OK in util-linux.
[Chris] - Removed the long-gone swapdev program from the list of programs installed by util-linux, and several programs not installed by default from the kbd program list.
[jim] - Updated to E2fsprogs 1.39.
[jim] - Updated to Man-Pages 2.33.
May 29, 2006
[jim] - Updated to Binutils 2.16.93.
[jim] - Updated to UDEV 093.
[jim] - Updated Udev Rules to 0.1-05292006.
[jim] - Updated Linux Headers 2.6.16.18 to 05292006.
May 28, 2006
[jim] - Added a patch to Grub to prevent. Error 24: Attempt to access block outside partition.
May 25, 2006
[jim] - Updated to GCC 4.1.1.
[jim] - Add Vim 7.0 Upstream Patches.
May 22, 2006
[jim] - Updated to Coreutils 5.96.
[jim] - Updated linux-2.6.16.18, and linux-headers-2.6.16.18.
May 21, 2006
[jciccone] - Updated to Bison-2.2, linux-2.6.16.17, and linux-headers-2.6.16.17.
May 17, 2006
[Chris] - Made a number of text updates and grammar fixes and added more dependency info (bootscripts, udev-rules, tree) to Appendix C.
May 16, 2006
[Chris] - Changed the temp-system and final-system package build order and a few package build instructions to account for the changed order (the rest of ticket #26).
[ken] - Change name of coreutils patch to match the patch.
May 15, 2006
[jim] - Updated to Man-Pages 2.32.
May 14, 2006
[jim] - Updated Udev Rules to 0.1-05142006.
[jim] - Updated Linux Headers 2.6.16.16 to 05142006.
May 13, 2006
[jim] - Updated to Coreutils 5.95.
May 12, 2006
[jim] - Add Vim 7.0 Upstream Patches.
May 11, 2006
[jim] - Updated Linux and Linux Headers to 2.6.16.16.
[jim] - Add Vim 7.0 Upstream Patches.
May 10,2006
[Chris] - Added more detailed dependency info and moved it to Appendices C and D. Fixes half of ticket #26.
May 9, 2006
[jim] - Updated to Binutils 2.16.92.
[jim] - Updated to Vim 7.0.
[jciccone] - Updated to Linux 2.6.16.15.
May 7, 2006
[jim] - Updated Linux Headers 2.6.16.14 to 05072006.
May 6, 2006
[jciccone] - Updated Linux Headers 2.6.16.14 to 05062006.
May 4, 2006
[jim] - Updated to Linux-2.6.16.14.
[jim] - Updated Linux Headers 2.6.16.13 to 05042006.
May 3, 2006
[Chris] - Updated to Man-Pages 2.31.
[jim] - Updated to Linux-2.6.16.13.
[jim] - Updated to Iana-Etc 2.10.
May 2, 2006
[jim] - Updated Linux Headers 2.6.16.12 to 05022006.
[jim] - Reverted change to bash. Needed on some architectures.
[jim] - Fixed a coreutils cross-compile issues on some architectures.
May 1, 2006
[Chris] - Updated to Man-Pages 2.30.
[jim] - Updated Linux Headers 2.6.16.11 to 05012006.
[Chris] - Updated to Linux-2.6.16.12.
April 30, 2006
[jim] - Updated Linux Headers 2.6.16.11 to 04302006.
April 29, 2006
[ken] - Add asm-generic to headers which are chowned in non-multilib books.
April 28, 2006
[jim] - Updated Linux Headers 2.6.16.11 to 04282006.
[jim] - Updated Udev Rules to 0.1-04282006.
April 27, 2006
[jim] - Updated to Linux Headers 2.6.16.11 to 04272006.
April 25, 2006
[jim] - Updated to Udev 091.
[jim] - Updated to Linux Headers 2.6.16.11 to 04262006.
April 24, 2006
[ken] - Updated to iproute2-2.6.16-060323.
[jim] - Updated to Linux and Linux Headers 2.6.16.11.
April 22, 2006
[ken] - Add example commands to test if chroot is possible, thanks to William Zhou.
April 21, 2006
[jim] - Updated Linux-Headers to fix x86_64-biarch problem.
April 20, 2006
[jim] - Added missing asm-generic copy to Linux-Headers.
[jim] - Updated Linux-Headers to include nvram.h.
April 19, 2006
[jim] - Updated to Bash Patch -8.
[jim] - Removed Linux-Libc-Headers and replace it with our Linux-Headers package.
[jim] - Updated to Linux 2.6.16.9.
[jim] - Updated to Linux 2.6.16.8.
April 18, 2006
[jim] - Renamed gcc fold_const patch to the PR #.
[jim] - Added GCC 4.1.0 patch PR20425. This allows searching of multilib dirs for the specs file.
April 17, 2006
[Chris] - Removed sed command from temp-system bash - no longer needed for Bash 3.1.
[jim] - Updated to Udev 090.
[jim] - Updated to udev-rules 0.1-04172006.
[jciccone] - Added a gcc patch that fixes an optimaztion error which can result in incorrect code.
[jciccone] - Removed the util-linux and kernel patch that fixes the checksum calculation for sun disklabels.
April 14, 2006
[jciccone] - Added a security patch to tar.
[jciccone] - Added a util-linux and kernel patch to fix a checksum calculation issue for sun disklabels.
April 13, 2006
[jim] - Updated to GCC 4.1.0.
[jim] - Fixed make install-minimal in udev-rules.
[jim] - Updated to Linux 2.6.16.5.
April 12, 2006
[jim] - Updated to Glibc 2.4.
[jim] - Updated to latest bash patch -7.
April 10, 2006
[jim] - Changed numbering of udev-rules to use 0.1-SVNDATE.
April 6, 2006
[jim] - Added install-minimal to udev rules.
[jim] - Updated to Udev 089.
April 1, 2006
[jim] - Updated to Make 3.81.
[jim] - Updated to Man-Pages 2.28.
March 28, 2006
[jim] - Updated to Linux 2.6.16.1.
[jim] - Updated to Man-Pages 2.27.
March 27, 2006
[jciccone] - Updated coreutils suppress_uptime_kill_su patch to -2.
[jciccone] - Updated readline fixes patch to -3.patch.
[jciccone] - Updated bash fixes patch to -6.
March 22, 2006
[jim] - Updated Udev to build floppy helper.
March 21, 2006
[jim] - Updated to Udev 088.
[jim] - Updated to Man-Pages 2.26.
[jim] - Updated to IPRoute2 2.6.15-060110.
March 20, 2006
[jim] - Fixed build issue with Texinfo in temp-system. Added --build.
[jim] - Updated to Linux 2.6.16.
[jim] - Updated to Shadow 4.0.15.
[Chris] - Removed note about GCC 2.95.3 from kernel section, as documentation has been updated in linux-2.6.16 and it now recommends GCC >= 3.2.
March 15, 2006
[jim] - Changed bootscripts to CLFS-bootscripts 0.1.
[jim] - Updated to Psmisc 22.2.
[jim] - Updated to Flex 2.5.33.
March 14, 2006
[jim] - Updated to Linux 2.6.16-rc6.
[jim] - Removal of Hotplug.
[jim] - Updated to Udev 087.
[jim] - Removal of old udev rules.
[jim] - Added Udev-Cross-LFS 0.1.
[jim] - Updated to GCC 4.0.3.
[jim] - Updated to File 4.17.
March 13, 2006
[jciccone] - Removed pure64 bootloader warning from the top page.
March 9, 2006
[Chris] - Simplified IPRoute2 instruction by removing redundant "configure" command.
March 2, 2006
[Chris] - Updated to Man-Pages 2.25.
[Chris] - Reverted to Expect 5.43.0. 5.44.1 depends on Tk.
February 27, 2006
[jim] - Updated Bash fixes patch to -5.
February 26, 2006
[jim] - Updated to Expect 5.44.1.
February 23, 2006
[Chris] - Simplified the "Changing Ownership" page for the boot section, and rewrote some of the text in the final "Reboot" page.
February 21, 2006
[jim] - Removed Dependency of Tempfile from Bzip2.
[jim] - Updated Bash fixes patch to -4.
[jciccone] - Updated to Man-Pages 2.24
February 14, 2006
[jim] - Updated to Coreutils 5.94.
February 11, 2006
[Chris] - Added -v switches to commands that accept it.
February 9, 2006
[jim] - Updated to Man-Pages 2.23.
February 8, 2006
[jim] - Changed x86_64 to use unknown in the target triplet.
February 7, 2006
[Chris] - Removed inetutils from boot section - it will be covered in the "netboot" hint.
[Chris] - Added section on Package Management - moved out of BLFS.
February 6, 2006
[Chris] - Moved the text explaining why binutils should be the first package compiled to a more appopriate location at the first installation of binutils, and changed the wording in temp-system gettext.
[jim] - Updated Readline and Bash patches from Upstream.
February 5, 2006
[jim] - Updated Procps 32bit build in Multilib builds to use lib64=lib. Fixed via Trac Ticket #2.
[jim] - Updated to Man-Pages 2.22.
February 3, 2006
[jim] - Updated to Sed 4.1.5.
February 2, 2006
[jim] - Updated to Perl 5.8.8.
[jhuntwork] - Minor textual fix to GCC.
February 1, 2006
[Chris] - Added a sed substitution to man instructions to fix an error in the makewhatis script.
January 31, 2006
[Chris] - Added -v to commands that accept them, for consistency with LFS.
January 30, 2006
[jim] - Change final-system GCC, to use make bootstrap. Update provided by Ryan Oliver.
January 29, 2006
[jim] - Updated Toolchain adjustment in final-system. Thank you Dan Nicholson.
January 24, 2006
[jim] - Updated to Man 1.6c.
January 23, 2006
[Chris] - Removed unnecessary --with-ncurses switches from temp-system bash and inetutils.
[Chris] - Moved zlib from temp-system to boot as it's not needed if you chroot.
January 19, 2006
[Chris] - Removed patch from shadow instructions.
[Chris] - Added perl sprintf vulnerability patch.
[jim] - Updated to Man-Pages 2.21.
January 13, 2006
[ken] - Moved grep ahead of libtool to avoid /tools being hardcoded into the libtool script for EGREP.
[ken] - Alter bison to build repeatably, from LFS.
[ken] - Alter gccbug to use mktemp, from LFS.
[ken] - Move creation of /etc/hosts within Perl instructions, for repeatability, from LFS.
[Chris] - Moved bootloader setup to right after "Changing Ownership" in Chapter 7, and changed several package installation instructions in that chapter.
January 12, 2006
[Chris] - Moved directory and symlink creation pages to the beginning of Chapter 7.
[jim] - Updated to Psmisc 22.1.
[jim] - Updated to Man-Pages 2.20.
[jim] - Updated Coreutils build instructions to copy more files to /bin. These are changes for bootscripts and the new udev rules.
[jim] - Updated to Linux 2.6.14.6.
[jim] - Numerous complaints about temp-system Perl failing to build. So I moved temp perl to first package in final-system build. The failures we noted on Pure 64 builds.
January 11, 2006
[jim] - Rewrote wrote zlib final instructions to include a patch the will allow build of static and shared libraries at the same time. Thanx for the recommendation Tushar Teredesai.
January 8, 2006
[Chris] - Rewrote much of the description of the build process and test suite information.
January 3, 2006
[jim] - Updated to Shadow 4.0.14.
December 30, 2005
[Chris] - Updated package dependencies, removed explanation of "target alias" and "cross-compiling" from final-system binutils, and removed note about GRUB's testsuite failure.
[ken] - Fix where tree gets installed.
December 29, 2005
[jim] - Added CC="gcc" to temp-system perl build.
December 28, 2005
[ken] - Remove --with-x=no from expect - either we booted, or we are in chroot.
[ken] - Fix a failure to build glibc-headers.
[jim] - Updated to Linux 2.6.14.5.
December 23, 2005
[jim] - Updated Shadow patch to fix linking to outside libraries.
December 22, 2005
[jim] - Bash Maintainer Released Bash-001 patch. This patch fixes the following issue: There are parsing problems with compound assignments in several contexts, including as arguments to builtins like `local', `eval', and `let', and as multiple assignments in a single command.
[jim] - Readline Maintainer Released Readline-001 patch. This patch fixes the following issue: A problem with the readline callback interface can result in segmentation faults when using the delete-char function via a multiple-key sequence. Two consecutive calls to delete-char will crash the application calling readline.
[jim] - Removed halt, sync, and shutdown users. These users work, but offer a potential security threat. Thus the reason for removal.
[jim] - Fixed Vim symlink. Thank you LFS and Jeremy Huntwork.
December 20, 2005
[jim] - Updated to M4 1.4.4.
December 19, 2005
[ken] - Fix for accessing vim's documentation, from LFS.
[jim] - Fixed the Gettext testsuite from failing, by fixing an issue in Gawk. Thank you Greg Schaefer.
December 18, 2005
[jim] - Re-arranged temp-tools. Renamed it to testsuite-tools. Moved perl and texinfo to temp-system. Moved flags from testsuite-tools to chroot and boot sections.
[jim] - Removed 32bit and N32 builds from temp-system, upon testing it was found that these were not needed for building the final system on a multilib capable build.
[jim] - Updated to Libtool 1.5.22.
[jim] - Updated to Man-Pages 2.18.
December 17, 2005
[jim] - Updated to psmisc 21.9.
December 16, 2005
[jim] - Moved Tree to temp-tools, since it's not needed for the final-system.
[jim] - Moved Procps before perl in the final-system build. Fixes test suite issue in perl.
December 15, 2005
[ken] - Minor fix for rendering in temp-tools/texinfo.
[jim] - Added not to temp-system about the WARNING message.
December 14, 2005
[jim] - Change the CLFS_HOST and CLFS_TARGET pages to prevent further build issues.
[jim] - Updated to Man-Pages 2.17.
[jim] - Added Tree 1.5.0. Added for the udev testsuite.
December 13, 2005
[jim] - Removed setvbuf test from Temp-System Bash compile. Thanks to David Fix.
December 12, 2005
[jim] - Removed testsuites from Temp-Tools section.
December 11, 2005
[ken] - Fix Tcl configure, thanks to Greg Schafer.
December 9, 2005
[jim] - Upgraded to Module Init Tools 3.2.2.
[ken] - Bzip2 - clarify what is being tested.
[jim] - Removed installation of sound sanitized headers. They will be removed in the next release of linux-libc-headers.
December 8, 2005
[jim] - Upgraded to Less 394.
[jim] - Upgraded to Bash 3.1.
[jim] - Upgraded to Readline 5.1.
December 7, 2005
[jim] - Upgraded to TCL 8.4.12.
[jim] - Upgraded to IPRoute2 2.6.14-051107.
[jim] - Upgraded to Readline 5.0.5.
[jim] - Upgraded to Bash 3.0.16.
December 6, 2005
[jim] - Upgraded to Glibc 20051107.
[jim] - Sparcv8 now uses the same Glibc as the other architectures.
[jim] - Ported Gettext update from Temp-system LFS to Cross-LFS.
[ken] - Tidying in Gettext to reflect our differences from LFS, and correct the date in changelog.
[jim] - Moved Cross-tools from $HOME to LFS. This provide a easy way for livecd builders to not loose valueable build time, if something goes wrong.
[jim] - Upgraded to Findutils 4.2.27.
December 5, 2005
[Matt Darcy] - Updated the resources page to include reference and base instructions on using the LFS pastebin
[Matt Darcy] - Updated some of the missing text poritions of the book
[Matt Darcy] - Updated creation of $CLFSHOME parameter to a less user error system. This change will will need to be validated by by other devs
[ken] - Moved Mktemp ahead of Module-init-tools so that the latter's testsuite doesn't bail out when testing generate-modprobe.conf.
December 3, 2005
[ken] - Reference a home directory for dummy user when testing coreutils, and correct sed 'man page' to 'HTML documentation', both from LFS.
December 2, 2005
[jim] - Updated to Man-Pages 2.16.
December 1, 2005
[jim] - Updated to Linux 2.6.14.3.
[jim] - Updated to Man-Pages 2.15.
[jim] - Updated to Udev 076.
[jim] - Added support for Sparc v8 and below.
November 30, 2005
[jim] - Text updates to final-system.
[jim] - Text updates to temp-tools.
November 29, 2005
[jim] - Text updates to chroot.
[jim] - Text updates to boot.
November 28, 2005
[jim] - Text updates to glibc in all sections.
[jim] - Text updates to temp-system.
[jim] - Fixed duplicated gcc configure line in gcc. Thank you Dennis Perkins.
November 27, 2005
[jim] - Text updates to gcc in all sections.
[jim] - Updates to Ncurses, added curses file and link. Thank you G. Moko.
November 25, 2005
[jim] - Text updates to binutils in all sections.
November 24, 2005
[Matt Darcy] - Text updates to resources page
[Matt Darcy] - Updated reference to LFS news server to reflect that it no longer exists
November 23, 2005
[jim] - For inetutils to utilize the Ncurses headers in /tools/include.
November 21, 2005
[jim] - Updated to Udev 075.
[jim] - Updated to Module Init Tools 3.2.1.
November 20, 2005
[jim] - Updated to Findutils 4.2.26.
November 18, 2005
[manuel] - Fixed the unpack of the module-init-tools-testsuite package.
November 17, 2005
[jim] - Update to Man-Pages 2.14.
[jim] - Update to Linux 2.6.14.2. This includes changes for the MIPS Architecture. New Patch added.
[jim] - Added change to move /usr/bin/less to /bin/less.
November 13, 2005
[manuel] - Improve the heuristic for determining a locale that is supported by both Glibc and packages outside LFS. Ported from LFS-SVN.
[manuel] - Omit running Bzip2's testsuite as a separate step, as make runs it automatically. Ported from LFS-SVN.
[jim] - Updated TCL build to install headers. Thank you Greg Schafer.
[jim] - Updated Expect to use the newly relocated TCL Headers. Thank you Greg Schafer.
November 10, 2005
[ken] - Added Data/Dumper to temp perl modules, for coreutils testsuite. Ported from LFS-SVN.
[ken] - Removed POSIX VERSION information from coreutils page Thank you G Moko.
[jim] - Added text for multilib kernel build requirements.
November 9, 2005
[manuel] - Stop Udev from killing udevd processes on the system and removed udevdir=/dev. Ported from LFS-SVN.
[manuel] - Install the binaries from Less to /usr/bin instead of /bin. Ported from LFS-SVN.
[manuel] - Removed SBUs and disk usage information.
[jim] - Added missing utmp group. Thank you William Zhou.
November 8, 2005
[jim] - Removed make headers -C bfd from Binutils. Thank you Robert Day.
November 7, 2005
[manuel] - Remove the optimization related warnings from the toolchain packages. Ported from LFS-SVN.
[manuel] - Install Vim's documentation to /usr/share/doc/vim-7.0 instead of /usr/share/vim/vim64/doc. Ported from LFS-SVN.
[manuel] - Correct the instructions for running the Module-Init-Tools' testsuite. Ported from LFS-SVN.
[jim] - Removed unnecessary linking libc sed in gcc-final in cross-tools. Recommendation from Erik-Jan, via cross-lfs list.
November 6, 2005
[jim] - Updated to Coreutils 5.93.
[jim] - Updated to Procps 3.2.6.
[jim] - Updated to Man-Pages 2.13.
November 5, 2005
[jim] - Updated to psmisc 21.8.
November 3, 2005
[jim] - Fixes added to coreutils. Coreutils was install locales to /locale. Added fixes for dircolors and md5sum also.
October 31, 2005
[jim] - Now an official project. Resetting all Changelogs.
Branch Synced from the Release of LFS 6.0 on February 23rd, 2005
Below is a list of changes specifics for this architecture made since the previous release of the book. For general changes see Master Changelog,
Changelog Entries:
August 19, 2006
[ken] - log the results of 'make check' in glibc multilib.
August 15, 2006
[ken] - Fix textrel test for 32-bit glibc.
August 13, 2006
[ken] - Add check to 32-bit bzip2, thanks to Jonathan Davis.
August 6, 2006
[ken] - Fix accidental breakage in the 64-bit libtool text. This fixes ticket #83.
July 29, 2006
[ken] - Get e2fsprogs cross-compiling from a host using long long for 64-bit types.
July 23, 2006
[ken] - Fix the 32-bit libtool testsuite.
July 22, 2006
[ken] - Add binutils patch to fix the ld visibility tests.
July 21, 2006
[ken] - Corrected gcc instructions for final-system to use /usr/lib64 and not disable multilib.
June 18, 2006
[ken] - Use the mktemp_configure patch, originally from mips, instead of updating config.{guess,sub} from installed versions.
[ken] - Fix up the bootable chapter for hfsutils, mktemp, powerpc-utils, and yaboot. This should now work.
June 8, 2006
[ken] - Add an appendix to discuss OF and Mac issues.
May 31, 2006
[ken] - Replace the tests in choose.xml with a ppc64-specific test and explain what it tests for. Fixes ticket 37.
May 22, 2006
[ken] - Add missing CFLAGS in yaboot's make, with yet another important box for it, and log the output from yaboot's install so that we can test it for warning messages from ld which show it is broken.
May 16, 2006
[ken] - Add gcc nof patch I had forgotten was not in the book.
May 10, 2006
[ken] - Make yaboot build in the final system.
May 9, 2006
[ken] - Confirmed powerpc-utils is ok, removed the warning from it.
May 5, 2006
[ken] - Convert the final-system chapter to multilib. Note that powerpc-utils and/or yaboot are broken.
April 30, 2006
[ken] - More multilib versions of pages for chrooting and in testsuite tools.
April 28, 2006
[ken] - Fix the glibc build for new requirements from the version upgrade, and to use headers from kernel 2.6.15 or later which merged asm-ppc and asm-ppc64 to asm-powerpc, plus cosmetic fix to use the multilib version of choose.xml.
April 27, 2006
[ken] - Remove references to /usr/local from yaboot man pages.
April 20, 2006
[jim] - Added asm-ppc to the Linux Headers.
March 29, 2006
[jhuntwork] - Use 'powerpc' as value for ARCH in kernel cross-build.
February 8, 2006
[jhuntwork] - Finalized boot section, minus the bootloader..
February 2, 2006
[jhuntwork] - Fix linux-libc-headers to use multilib patch.
[jhuntwork] - Use multilib binutils.
[jhuntwork] - Finalized cross-tools section.
[jhuntwork] - Finalized temp-system section.
February 1, 2006
[jhuntwork] - Add ppc biarch patch for ppc64 multilib.
[jhuntwork] - Fixed multilib variables.
[jhuntwork] - Added a flags page in cross-tools.
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 it's own News Server, but we do provide access via gmane.org http://gmane.org. If you want to subscribe to the Cross-LFS via a newsreader you can utilize gmane.org. You can find the game 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://www.linuxfromscratch.org/hints/downloads/files/errors.txt.
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 1.0.0)
The host distribution and version being used to create CLFS.
The architecture of the host and target.
The value of the ${CLFS_HOST}, ${CLFS_TARGET}, ${BUILD32}, and ${BUILD64} environment variables.
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.
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 your building for a different architecture you can simply build everything in “/mnt/clfs” and transfer it to your target machine.
A minimal system requires around 1.5 gigabytes (GB). This is enough to store all the source tarballs and compile the packages. However, if the CLFS system is intended to be the primary Linux system, additional software will probably be installed which will require additional space (2-3 GB). 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.
Because there is not always enough Random Access Memory (RAM) available for compilation processes, it is a good idea to use a small disk partition as swap space. This is used by the kernel to store seldom-used data and leave more memory available for active processes. The swap partition for an 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.
Start a disk partitioning program such as cfdisk or fdisk with a command line option naming the hard disk on which the new partition will be created—for example /dev/hda for the primary Integrated Drive Electronics (IDE) disk. Create a Linux native partition and a swap partition, if needed. Please refer to cfdisk(8) or fdisk(8) if you do not yet know how to use the programs.
Remember the designation of the new partition (e.g., hda5). This book will refer to this as the 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://www.linuxfromscratch.org/blfs/view/svn/postlfs/filesystems.html.
To create an ext2 file system on the CLFS partition, run the following:
mke2fs /dev/[xxx]
Replace [xxx] with the name of the CLFS partition (hda5 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:
cd /tmp tar xjf /path/to/sources/e2fsprogs-1.39.tar.bz2 cd e2fsprogs-1.39 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.39
If a swap partition was created, it will need to be initialized for use by issuing the command below. If you are using an existing swap partition, there is no need to format it.
mkswap /dev/[yyy]
Replace [yyy] with the name of the swap partition.
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. For the purposes of this book, it is assumed that the file system is mounted under /mnt/clfs, but the directory choice is up to you.
Choose a mount point and assign it to the CLFS environment variable by running:
export CLFS=/mnt/clfs
Next, create the mount point and mount the CLFS file system by running:
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 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 the mount command without any parameters 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/1.0.0/.
Downloaded packages and patches will need to be stored somewhere that is conveniently available throughout the entire build. A working directory is also required to unpack the sources and build them. ${CLFS}/sources can be used both as the place to store the tarballs and patches and as a working directory. By using this directory, the required elements will be located on the CLFS partition and will be available during all stages of the building process.
To create this directory, execute, as user root, the following command before starting the download session:
mkdir -v ${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 will enable the write and sticky modes:
chmod -v a+wt ${CLFS}/sources
Download or otherwise obtain the following packages:
Home page: http://www.gnu.org/software/autoconf/
Download: http://ftp.gnu.org/gnu/autoconf/autoconf-2.59.tar.bz2
MD5 sum: 1ee40f7a676b3cfdc0e3f7cd81551b5f
Home page: http://www.gnu.org/software/automake/
Download: http://ftp.gnu.org/gnu/automake/automake-1.9.6.tar.bz2
MD5 sum: c11b8100bb311492d8220378fd8bf9e0
Home page: http://www.gnu.org/software/bash/
Download: http://ftp.gnu.org/gnu/bash/bash-3.1.tar.gz
MD5 sum: ef5304c4b22aaa5088972c792ed45d72
Download: http://ftp.gnu.org/gnu/bash/bash-doc-3.1.tar.gz
MD5 sum: a8c517c6a7b21b8b855190399c5935ae
Home page: http://sources.redhat.com/binutils/
Download: http://ftp.gnu.org/gnu/binutils/binutils-2.17.tar.bz2
MD5 sum: e26e2e06b6e4bf3acf1dc8688a94c0d1
Home page: http://www.gnu.org/software/bison/
Download: http://ftp.gnu.org/gnu/bison/bison-2.3.tar.bz2
MD5 sum: c18640c6ec31a169d351e3117ecce3ec
Home page: http://www.bzip.org/
Download: http://www.bzip.org/1.0.3/bzip2-1.0.3.tar.gz
MD5 sum: 8a716bebecb6e647d2e8a29ea5d8447f
Download: http://cross-lfs.org/files/packages/1.0.0/bootscripts-cross-lfs-1.0.tar.bz2
MD5 sum: 79bff3247411589d7de51fdaea9578bd
Home page: http://www.gnu.org/software/coreutils/
Download: http://ftp.gnu.org/gnu/coreutils/coreutils-5.96.tar.bz2
MD5 sum: bf55d069d82128fd754a090ce8b5acff
Home page: http://www.gnu.org/software/dejagnu/
Download: http://ftp.gnu.org/gnu/dejagnu/dejagnu-1.4.4.tar.gz
MD5 sum: 053f18fd5d00873de365413cab17a666
Home page: http://www.gnu.org/software/diffutils/
Download: ftp://alpha.gnu.org/gnu/diffutils/diffutils-2.8.7.tar.gz
MD5 sum: 18d6587cb915e7aa110a5d463d6ed156
Home page: http://e2fsprogs.sourceforge.net/
Download: http://prdownloads.sourceforge.net/e2fsprogs/e2fsprogs-1.39.tar.gz?download
MD5 sum: 06f7806782e357797fad1d34b7ced0c6
Home page: http://expect.nist.gov
Download: http://expect.nist.gov/src/expect-5.43.0.tar.gz
MD5 sum: 43e1dc0e0bc9492cf2e1a6f59f276bc3
Download: ftp://ftp.gw.com/mirrors/pub/unix/file/file-4.17.tar.gz
MD5 sum: 50919c65e0181423d66bb25d7fe7b0fd
File (4.17) 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/1.0.0/.
Home page: http://www.gnu.org/software/findutils/
Download: http://ftp.gnu.org/gnu/findutils/findutils-4.2.27.tar.gz
MD5 sum: f1e0ddf09f28f8102ff3b90f3b5bc920
Home page: http://flex.sourceforge.net
Download: http://prdownloads.sourceforge.net/flex/flex-2.5.33.tar.bz2?download
MD5 sum: 343374a00b38d9e39d1158b71af37150
Home page: http://www.gnu.org/software/gawk/
Download: http://ftp.gnu.org/gnu/gawk/gawk-3.1.5.tar.bz2
MD5 sum: 5703f72d0eea1d463f735aad8222655f
Home page: http://gcc.gnu.org/
Download: http://ftp.gnu.org/gnu/gcc/gcc-4.1.1/gcc-4.1.1.tar.bz2
MD5 sum: ad9f97a4d04982ccf4fd67cb464879f3
Home page: http://www.gnu.org/software/gettext/
Download: http://ftp.gnu.org/gnu/gettext/gettext-0.14.5.tar.gz
MD5 sum: e2f6581626a22a0de66dce1d81d00de3
Home page: http://www.gnu.org/software/libc/
Download: http://ftp.gnu.org/gnu/glibc/glibc-2.4.tar.bz2
MD5 sum: 7e9a88dcd41fbc53801dbe5bdacaf245
Home page: http://www.gnu.org/software/grep/
Download: http://ftp.gnu.org/gnu/grep/grep-2.5.1a.tar.bz2
MD5 sum: 52202fe462770fa6be1bb667bd6cf30c
Home page: http://www.gnu.org/software/groff/
Download: http://ftp.gnu.org/gnu/groff/groff-1.19.2.tar.gz
MD5 sum: f7c9cf2e4b9967d3af167d7c9fadaae4
Home page: http://www.gzip.org/
Download: ftp://alpha.gnu.org/gnu/gzip/gzip-1.3.5.tar.gz
MD5 sum: 3d6c191dfd2bf307014b421c12dc8469
Home page: http://www.sethwklein.net/projects/iana-etc/
Download: http://www.sethwklein.net/projects/iana-etc/downloads/iana-etc-2.10.tar.bz2
MD5 sum: 53dea53262b281322143c744ca60ffbb
Home page: http://www.gnu.org/software/inetutils/
Download: http://ftp.gnu.org/gnu/inetutils/inetutils-1.4.2.tar.gz
MD5 sum: df0909a586ddac2b7a0d62795eea4206
Home page: http://linux-net.osdl.org/index.php/Iproute2
Download: http://developer.osdl.org/dev/iproute2/download/iproute2-2.6.16-060323.tar.gz
MD5 sum: f31d4516b35bbfeaa72c762f5959e97c
Download: http://www.kernel.org/pub/linux/utils/kbd/kbd-1.12.tar.bz2
MD5 sum: 069d1175b4891343b107a8ac2b4a39f6
Home page: http://www.greenwoodsoftware.com/less/
Download: http://www.greenwoodsoftware.com/less/less-394.tar.gz
MD5 sum: a9f072ccefa0d315b325f3e9cdbd4b97
Home page: http://www.gnu.org/software/libtool/
Download: http://ftp.gnu.org/gnu/libtool/libtool-1.5.22.tar.gz
MD5 sum: 8e0ac9797b62ba4dcc8a2fb7936412b0
Home page: http://www.kernel.org/
Download: http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.17.13.tar.bz2
MD5 sum: 834885b3ad9988b966570bee92459572
Home page: http://headers.cross-lfs.org/
Download: http://cross-lfs.org/files/packages/1.0.0/linux-headers-2.6.17.13-09092006.tar.bz2
MD5 sum: bfda0e9440dd76e6e35fdce79c9b0bf6
Home page: http://www.gnu.org/software/m4/
Download: http://ftp.gnu.org/gnu/m4/m4-1.4.4.tar.bz2
MD5 sum: eb93bfbcb12cf00165583302bb31a822
Home page: http://www.gnu.org/software/make/
Download: http://ftp.gnu.org/gnu/make/make-3.81.tar.bz2
MD5 sum: 354853e0b2da90c527e35aabb8d6f1e6
Home page: http://primates.ximian.com/~flucifredi/man/
Download: http://primates.ximian.com/~flucifredi/man/man-1.6d.tar.gz
MD5 sum: 36d3f65bcc10f0754a3234e00d92ad6d
Download: http://www.kernel.org/pub/linux/docs/manpages/man-pages-2.33.tar.bz2
MD5 sum: e9f61ec73b5390c582530da173c12b10
Home page: http://www.mktemp.org/
Download: ftp://ftp.mktemp.org/pub/mktemp/mktemp-1.5.tar.gz
MD5 sum: 9a35c59502a228c6ce2be025fc6e3ff2
Download: http://www.kerneltools.org/pub/downloads/module-init-tools/module-init-tools-3.2.2.tar.bz2
MD5 sum: a1ad0a09d3231673f70d631f3f5040e9
Home page: http://dickey.his.com/ncurses/
Download: ftp://invisible-island.net/ncurses/ncurses-5.5.tar.gz
MD5 sum: e73c1ac10b4bfc46db43b2ddfd6244ef
Home page: http://www.gnu.org/software/patch/
Download: ftp://alpha.gnu.org/gnu/diffutils/patch-2.5.9.tar.gz
MD5 sum: dacfb618082f8d3a2194601193cf8716
Home page: http://www.perl.com/
Download: http://ftp.funet.fi/pub/CPAN/src/perl-5.8.8.tar.bz2
MD5 sum: a377c0c67ab43fd96eeec29ce19e8382
Home page: http://procps.sourceforge.net/
Download: http://procps.sourceforge.net/procps-3.2.6.tar.gz
MD5 sum: 7ce39ea27d7b3da0e8ad74dd41d06783
Home page: http://psmisc.sourceforge.net/
Download: http://prdownloads.sourceforge.net/psmisc/psmisc-22.2.tar.gz?download
MD5 sum: 77737c817a40ef2c160a7194b5b64337
Home page: http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
Download: http://ftp.gnu.org/gnu/readline/readline-5.1.tar.gz
MD5 sum: 7ee5a692db88b30ca48927a13fd60e46
Home page: http://www.gnu.org/software/sed/
Download: http://ftp.gnu.org/gnu/sed/sed-4.1.5.tar.gz
MD5 sum: 7a1cbbbb3341287308e140bd4834c3ba
Download: ftp://ftp.pld.org.pl/software/shadow/shadow-4.0.16.tar.bz2
MD5 sum: 1d91f7479143d1d705b94180c0d4874b
Shadow (4.0.16) 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/1.0.0/.
Home page: http://www.infodrom.org/projects/sysklogd/
Download: http://www.infodrom.org/projects/sysklogd/download/sysklogd-1.4.1.tar.gz
MD5 sum: d214aa40beabf7bdb0c9b3c64432c774
Download: ftp://ftp.cistron.nl/pub/people/miquels/sysvinit/sysvinit-2.86.tar.gz
MD5 sum: 7d5d61c026122ab791ac04c8a84db967
Home page: http://www.gnu.org/software/tar/
Download: http://ftp.gnu.org/gnu/tar/tar-1.15.1.tar.bz2
MD5 sum: 57da3c38f8e06589699548a34d5a5d07
Home page: http://tcl.sourceforge.net/
Download: http://prdownloads.sourceforge.net/tcl/tcl8.4.12-src.tar.gz?download
MD5 sum: 7480432d8730263f267952788eb4839b
Home page: http://www.gnu.org/software/texinfo/
Download: http://ftp.gnu.org/gnu/texinfo/texinfo-4.8.tar.bz2
MD5 sum: 6ba369bbfe4afaa56122e65b3ee3a68c
Download: ftp://mama.indstate.edu/linux/tree/tree-1.5.0.tgz
MD5 sum: e0d090c564e7ea5afa16bac80620c7e0
Home page: http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html
Download: http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev-096.tar.bz2
MD5 sum: f4effef7807ce1dc91ab581686ef197b
Download: http://cross-lfs.org/files/packages/1.0.0/udev-cross-lfs-1.0-3.tar.bz2
MD5 sum: 0c9b9e24a37b9501bcd4889da71cf313
Download: http://www.kernel.org/pub/linux/utils/util-linux/util-linux-2.12r.tar.bz2
MD5 sum: af9d9e03038481fbf79ea3ac33f116f9
Home page: http://www.vim.org
Download: ftp://ftp.vim.org/pub/vim/unix/vim-7.0.tar.bz2
MD5 sum: 4ca69757678272f718b1041c810d82d8
Download: ftp://ftp.vim.org/pub/vim/extra/vim-7.0-lang.tar.gz
MD5 sum: 6d43efaff570b5c86e76b833ea0c6a04
Home page: http://www.zlib.net/
Download: http://www.zlib.net/zlib-1.2.3.tar.gz
MD5 sum: debc62758716a169df9f62e6ab2bc634
Total size of these packages: about 180 MB
Home page: http://www.mars.org/home/rob/proj/hfs/
Download: ftp://ftp.mars.org/pub/hfs/hfsutils-3.2.6.tar.gz
MD5 sum: fa572afd6da969e25c1455f728750ec4
Home page: http://www.gnu.org/software/parted/
Download: http://ftp.gnu.org/gnu//parted/parted-1.6.25.1.tar.gz
MD5 sum: 8ad8b2c8aa865d9d6a43a4ecfe021782
Home page: http://packages.qa.debian.org/p/powerpc-utils.html
Download: http://ftp.debian.org/debian/pool/main/p/powerpc-utils/powerpc-utils_1.1.3.orig.tar.gz
MD5 sum: d879b109bb8f0d726304b60b147bff13
Home page: http://yaboot.ozlabs.org/
Download: http://penguinppc.org/bootloaders/yaboot/yaboot-1.3.13.tar.gz
MD5 sum: f12798d1b2063f21d07e0ae7f602ccaf
Total size of these packages: about 2,030 KB
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/1.0.0/bash-3.1-fixes-8.patch
MD5 sum: bc337045fa4c5839babf0306cc9df6d0
Download: http://patches.cross-lfs.org/1.0.0/binutils-2.17-posix-1.patch
MD5 sum: 7e42a8edc0c59246bbc58c428256113c
Download: http://patches.cross-lfs.org/1.0.0/bzip2-1.0.3-install_docs-1.patch
MD5 sum: 9e5dfbf4814b71ef986b872c9af84488
Download: http://patches.cross-lfs.org/1.0.0/bzip2-1.0.3-remove_tempfile-1.patch
MD5 sum: bcadb0ce282c96af15a86a2ccdac0765
Download: http://patches.cross-lfs.org/1.0.0/bzip2-1.0.3-bzgrep_security-1.patch
MD5 sum: 4eae50e4fd690498f23d3057dfad7066
Download: http://patches.cross-lfs.org/1.0.0/coreutils-5.96-suppress_uptime_kill_su-1.patch
MD5 sum: 227d41a6d0f13c31375153eae91e913d
Download: http://patches.cross-lfs.org/1.0.0/expect-5.43.0-spawn-2.patch
MD5 sum: 7706e1e8238c72eed8dc905d6f3b6aa9
Download: http://patches.cross-lfs.org/1.0.0/gawk-3.1.5-segfault_fix-1.patch
MD5 sum: 7679530d88bf3eb56c42eb6aba342ddb
Download: http://patches.cross-lfs.org/1.0.0/gcc-4.1.1-cross_search_paths-1.patch
MD5 sum: 541fe39d228ddaa0d8396a35ec3a0ada
Download: http://patches.cross-lfs.org/1.0.0/gcc-4.1.1-PR20425-1.patch
MD5 sum: 95535bda8e4d37d30251db0b121b5374
Download: http://patches.cross-lfs.org/1.0.0/gcc-4.1.1-posix-1.patch
MD5 sum: 0d88068740a0e00780891f2cb905b808
Download: http://patches.cross-lfs.org/1.0.0/glibc-2.4-iconv_fix-1.patch
MD5 sum: 9c8e681226ccf7a1f25c6467674f915e
Download: http://patches.cross-lfs.org/1.0.0/glibc-2.4-libgcc_eh-1.patch
MD5 sum: e5122ea7b89a5f22615eaadf8e46b334
Download: http://patches.cross-lfs.org/1.0.0/glibc-2.4-localedef_segfault-1.patch
MD5 sum: 42452abc6196789e0a83afa1ca7e6e4e
Download: http://patches.cross-lfs.org/1.0.0/gzip-1.3.5-security_fixes-1.patch
MD5 sum: f107844f01fc49446654ae4a8f8a0728
Download: http://patches.cross-lfs.org/1.0.0/inetutils-1.4.2-inet_addr_fix-1.patch
MD5 sum: a33267b7a4e0d303a6f8dfeafde7bd8e
Download: http://patches.cross-lfs.org/1.0.0/inetutils-1.4.2-gcc4_fixes-3.patch
MD5 sum: 5204fbc503c9fb6a8e353583818db6b9
Download: http://patches.cross-lfs.org/1.0.0/inetutils-1.4.2-no_server_man_pages-1.patch
MD5 sum: eb477f532bc6d26e7025fcfc4452511d
Download: http://patches.cross-lfs.org/1.0.0/kbd-1.12-gcc4_fixes-1.patch
MD5 sum: 615bc1e381ab646f04d8045751ed1f69
Download: http://patches.cross-lfs.org/1.0.0/linux-2.6.17.13-tulip-1.patch
MD5 sum: 0dd7027a8cb8e59c74c24ff0a8f45f3b
Download: http://patches.cross-lfs.org/1.0.0/mktemp-1.5-add_tempfile-3.patch
MD5 sum: 65d73faabe3f637ad79853b460d30a19
Download: http://patches.cross-lfs.org/1.0.0/perl-5.8.8-libc-2.patch
MD5 sum: 3bf8aef1fb6eb6110405e699e4141f99
Download: http://patches.cross-lfs.org/1.0.0/readline-5.1-fixes-3.patch
MD5 sum: e30963cd5c6f6a11a23344af36cfa38c
Download: http://patches.cross-lfs.org/1.0.0/sysklogd-1.4.1-fixes-1.patch
MD5 sum: 508104f058d1aef26b3bc8059821935f
Download: http://patches.cross-lfs.org/1.0.0/tar-1.15.1-gcc4_fix_tests-1.patch
MD5 sum: 8e286a1394e6bcf2907f13801770a72a
Download: http://patches.cross-lfs.org/1.0.0/tar-1.15.1-security_fixes-1.patch
MD5 sum: 19876e726d9cec9ce1508e3af74dc22e
Download: http://patches.cross-lfs.org/1.0.0/tar-1.15.1-sparse_fix-1.patch
MD5 sum: 9e3623f7c88d8766878ecb27c980d86a
Download: http://patches.cross-lfs.org/1.0.0/texinfo-4.8-tempfile_fix-2.patch
MD5 sum: 559bda136a2ac7777ecb67511227af85
Download: http://patches.cross-lfs.org/1.0.0/util-linux-2.12r-cramfs-1.patch
MD5 sum: 1c3f40b30e12738eb7b66a35b7374572
Download: http://patches.cross-lfs.org/1.0.0/util-linux-2.12r-gcc4_fixes-1.patch
MD5 sum: 6c030921dc9b92daf688f12a4ee6f6e0
Download: http://patches.cross-lfs.org/1.0.0/util-linux-2.12r-missing_header-1.patch
MD5 sum: 33ccc15d2e92caa6189b044f573fdcda
Download: http://patches.cross-lfs.org/1.0.0/vim-7.0-fixes-5.patch
MD5 sum: 6e179cfe811d105de4fd9156a0ef6699
Download: http://patches.cross-lfs.org/1.0.0/zlib-1.2.3-fPIC-1.patch
MD5 sum: 545d60b20bfde6f53023de44438cef59
Total size of these patches: about 214.7 KB
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/1.0.0/ and acquire any additional patches to suit the system needs.
Download: http://patches.cross-lfs.org/1.0.0/binutils-2.17-genscripts_multilib-1.patch
MD5 sum: b1d8d22ab473212abf1b19978415775b
Download: http://patches.cross-lfs.org/1.0.0/binutils-2.17-ppc64_fix_testsuite-1.patch
MD5 sum: ae7b5bd6dcf238dd40a87d970f030af2
Download: http://patches.cross-lfs.org/1.0.0/e2fsprogs-1.39-cross-1.patch
MD5 sum: 7e870161b81ea9da6a3fb780fb5e866b
Download: http://patches.cross-lfs.org/1.0.0/gcc-4.1.1-powerpc64_multilib-1.patch
MD5 sum: 4ab7c7067764737c465201c992aeb339
Download: http://patches.cross-lfs.org/1.0.0/gcc-4.1.1-specs-1.patch
MD5 sum: a17be8ccfb978e73f382be5093dd8abd
Download: http://patches.cross-lfs.org/1.0.0/mktemp-1.5-config_update-1.patch
MD5 sum: 2eab6432dbf4d4447b85435363c6a557
Download: http://patches.cross-lfs.org/1.0.0/iproute2-2.6.16-060323-libdir-1.patch
MD5 sum: ead26f713bb19d73396c332401e864fc
Download: http://patches.cross-lfs.org/1.0.0/perl-5.8.8-Configure_multilib-1.patch
MD5 sum: 1f79780e26bc3493f7891e12841c38ed
Download: http://patches.cross-lfs.org/1.0.0/powerpc-utils_1.1.3-fixes-2.patch
MD5 sum: d2776b1a4977c5711037b8f1402f792a
Download: http://patches.cross-lfs.org/1.0.0/udev-096-lib64-2.patch
MD5 sum: 94069377fa1468dd20290f58fed11c6d
Download: http://patches.cross-lfs.org/1.0.0/yaboot-1.3.13-fix-1.patch
MD5 sum: 2848f7b2a01469f9e302a8890f4daafd
Download: http://patches.cross-lfs.org/1.0.0/yaboot-1.3.13-ofpath_path_prefix-1.patch
MD5 sum: 3faf70e0cb4e4f62a1e8815c3452ab38
Download: http://patches.cross-lfs.org/1.0.0/yaboot-1.3.13-ofpath_sata-1.patch
MD5 sum: bdc55ca22b1cfc774a7b2db732524eb6
Total size of these patches: about 124.3 KB
Throughout this book, the environment variable CLFS will be used several times. It is paramount that this variable is always defined. It should be set to the mount point chosen for the CLFS partition. Check that the CLFS variable is set up properly with:
echo ${CLFS}
Make sure the output shows the path to the CLFS partition's mount point, which is /mnt/clfs if the provided example was followed. If the output is incorrect, the variable can be set with:
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.
If you haven't created the ${CLFS} directory, do so at this time by issuing the following commands:
install -dv ${CLFS}
Do not forget to check that ${CLFS} is set whenever you leave and reenter the current working environment (as when doing a “su” to root or another 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 /
The symlink isn't technically necessary (though the book's instructions do assume its existence), but is there mainly for consistency (because /tools is also symlinked to ${CLFS}/tools) and to simplify the installation of the cross-compile 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 -m -k /dev/null clfs
The meaning of the command line options:
This makes bash the default shell for user clfs.
This option adds user clfs to group clfs.
This creates a home directory for clfs.
This parameter prevents possible copying of files from a skeleton directory (default is /etc/skel) by changing the input location to the special null device.
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
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, give user clfs ownership of this directory:
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.
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 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. If the host system uses a version of Glibc older than 2.2.4, having LC_ALL set to something other than “POSIX” or “C” (during this chapter) may cause issues if you exit the chroot environment and wish to return later. Setting LC_ALL to “POSIX” or “C” (the two are equivalent) ensures that everything will work as expected in the chroot environment.
By putting /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.
Finally, to have the environment fully prepared for building the temporary tools, source the just-created user profile:
source ~/.bash_profile
Most packages provide a test suite. Running the test suite for a newly built package is a good idea because it can provide a “sanity check” indicating that everything compiled correctly. A test suite that passes its set of checks usually proves that the package is functioning as the developer intended. It does not, however, guarantee that the package is totally bug free.
It is not possible to run testsuites when cross-compiling, so package installation instructions do not explain how to run testsuites 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 as user clfs, and a cd into the created directory should be performed. The build instructions assume that the bash shell is in use.
Several of the packages are patched before compilation, but only when the patch is needed to circumvent a problem. A patch is often needed in both this and the next 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.
CFLAGS and CXXFLAGS must not be set during the building of cross-tools.
To disable CFLAGS and CXXFLAGS use the following commands:
unset CFLAGS unset CXXFLAGS
Now add these to ~/.bashrc, just in case you have to exit and restart building later:
echo unset CFLAGS >> ~/.bashrc echo unset CXXFLAGS >> ~/.bashrc
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. You will need to set the CHOST triplet to match your particular needs. To set this information you can issue the following command:
export CLFS_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
Now we will set our Target Triplet:
export CLFS_TARGET="powerpc64-unknown-linux-gnu"
Now we will set our Target Triplet for 32 Bits:
export CLFS_TARGET32="powerpc-unknown-linux-gnu"
Now we will add these to ~/.bashrc, just in case you have to exit and restart building later:
echo export CLFS_HOST=\""${CLFS_HOST}\"" >> ~/.bashrc
echo export CLFS_TARGET=\""${CLFS_TARGET}\"" >> ~/.bashrc
echo export CLFS_TARGET32=\""${CLFS_TARGET32}\"" >> ~/.bashrc
We will need to setup target specific flags for the compiler and linker:
export BUILD32="-m32" export BUILD64="-m64"
Let's add the build flags to ~/.bashrc to prevent issues if we stop and come back later:
echo export BUILD32=\""${BUILD32}\"" >> ~/.bashrc
echo export BUILD64=\""${BUILD64}\"" >> ~/.bashrc
The Linux Headers package contains the “sanitized” kernel headers.
Install the header files that are needed for the base build:
install -dv /tools/include
cp -av include/asm-powerpc /tools/include/asm
cp -av include/{asm-generic,asm-ppc,linux} /tools/include/
Details on this package are located in Section 10.5.2, “Contents of Linux-Headers.”
The Binutils package contains a linker, an assembler, and other tools for handling object files.
It is important that Binutils be the first package compiled because both Glibc and GCC perform various tests on the available linker and assembler to determine which of their own features to enable.
To make sure that the proper syntax is used for a couple of tools, apply the following patch:
patch -Np1 -i ../binutils-2.17-posix-1.patch
The following patch makes Binutils search in both the lib and lib64 directories in a multilib environment:
patch -Np1 -i ../binutils-2.17-genscripts_multilib-1.patch
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.17/configure --prefix=/cross-tools \
--host=${CLFS_HOST} --target=${CLFS_TARGET} --with-lib-path=/tools/lib \
--disable-nls --enable-shared --enable-64-bit-bfd
The meaning of the configure options:
This tells the configure script to prepare to install the package in the /cross-tools directory.
When used with --target, this creates a cross-architecture executable that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST}.
When used with --host, this creates a cross-architecture executable that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST}.
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.
This disables internationalization as i18n is not needed for the cross-compile tools.
Enable the creation of the shared libraries.
This adds 64 bit support to Binutils.
Compile the package:
make configure-host make
The meaning of the make options:
This checks the host environment and makes sure all the necessary tools are available to compile Binutils.
Install the package:
make install
Copy the libiberty.h file to /tools/include directory:
cp -v ../binutils-2.17/include/libiberty.h /tools/include
Details on this package are located in Section 10.10.2, “Contents of Binutils.”
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.
The following sed removes a dependency of gcc 3.4.x from the glibc we are using in cross-lfs. The reason we are changing it is because this only installs the headers, no compiling takes place. In the next Glibc installation, we use the GCC that's built right after this section:
cp -v configure{,.orig}
sed -e 's/3.4/3.[0-9]/g' configure.orig > configure
The Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory:
mkdir -v ../glibc-build cd ../glibc-build
The following lines need to be added to config.cache for Glibc to support NPTL:
echo "libc_cv_forced_unwind=yes" > config.cache echo "libc_cv_c_cleanup=yes" >> config.cache echo "libc_cv_ppc_machine=yes" >> config.cache
We need to persuade configure that the host's compiler has all the necessary modern powerpc64 extensions. It will still pass flags such as -mnew-abi which are likely to trigger error messages on a non-ppc host, but the headers can be built. We do this by adding the following lines to config.cache. Note that one of these has three consecutive underscores.
echo "libc_cv_mlong_double_128ibm=yes" >> config.cache echo "libc_cv_mlong_double_128=yes" >> config.cache echo "libc_cv_powerpc64_tls=yes" >> config.cache echo "libc_cv_initfini_array=yes" >>config.cache echo "libc_cv_gcc___thread=yes" >>config.cache
Prepare Glibc for compilation:
CC=gcc ../glibc-2.4/configure --prefix=/tools \
--host=${CLFS_TARGET} --build=${CLFS_HOST} \
--disable-sanity-checks --enable-kernel=2.6.0 \
--with-headers=/tools/include --cache-file=config.cache \
--with-binutils=/cross-tools/${CLFS_TARGET}/bin
Any error message you see about nptl at this point can safely be ignored.
The meaning of the configure options:
Tells Glibc to use the host's GCC compiler.
This tells the configure script to prepare to install the package in the /tools directory.
When used with --host, this creates a cross-architecture executable that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST}.
When used with --build, this creates a cross-architecture executable that creates files for ${CLFS_TARGET} but runs on ${CLFS_HOST}.
This switch disables any checks that are in place.
This tells Glibc to compile the library with support for 2.6.x Linux kernels.
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.
This tells Glibc to use the Binutils for our specific target architecture.
Now, install the headers:
make install-headers
Some files aren't installed by the above command, so we will copy the additional header files we need.
First we will copy a common file over to /tools/include:
install -dv /tools/include/bits cp -v bits/stdio_lim.h /tools/include/bits
Now we will create a blank stub file:
touch /tools/include/gnu/stubs.h
Another header is needed for NPTL:
cp -v ../glibc-2.4/nptl/sysdeps/unix/sysv/linux/powerpc/bits/pthreadtypes.h /tools/include/bits/
Details on this package are located in Section 10.8.5, “Contents of Glibc.”
The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.
Make a couple of essential adjustments to the specs file to ensure GCC uses our build environment:
patch -Np1 -i ../gcc-4.1.1-specs-1.patch
To make sure that a couple of tools use the proper syntax, apply the following patch:
patch -Np1 -i ../gcc-4.1.1-posix-1.patch
The following patch ensures that gcc does not search the /usr directory for libgcc_s.so when cross-compiling:
patch -Np1 -i ../gcc-4.1.1-cross_search_paths-1.patch
Change the StartFile Spec to point to the correct library location:
echo " #undef STARTFILE_PREFIX_SPEC #define STARTFILE_PREFIX_SPEC \"/tools/lib/\"" >> gcc/config/rs6000/linux.h echo " #undef STARTFILE_PREFIX_SPEC #define STARTFILE_PREFIX_SPEC \"/tools/lib/\"" >> gcc/config/rs6000/linux64.h
Now alter gcc's c preprocessor's default include search path to use /tools only:
cp -v gcc/Makefile.in{,.orig}
sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \
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
Prepare GCC for compilation:
../gcc-4.1.1/configure --prefix=/cross-tools \
--host=${CLFS_HOST} --target=${CLFS_TARGET} \
--with-local-prefix=/tools --disable-nls --disable-shared \
--disable-threads --enable-languages=c
The meaning of the configure options:
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.
Disables the creation of the shared libraries.
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.
This option ensures that only the C compiler is built.
Continue with compiling the package:
make all-gcc
Install the package:
make install-gcc
Details on this package are located in Section 10.11.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.
Disable linking to libgcc_eh:
patch -Np1 -i ../glibc-2.4-libgcc_eh-1.patch
The following patch fixes an issue that can cause localdef to segfault:
patch -Np1 -i ../glibc-2.4-localedef_segfault-1.patch
The following sed fixes a build issue with Glibc. This will prevent nscd from trying to link to libraries that don't exist:
cp -v nscd/Makefile{,.orig}
sed -e "/nscd_stat.o: sysincludes = # nothing/d" nscd/Makefile.orig > \
nscd/Makefile
The kernel's asm-ppc and asm-ppc64 headers were merged into asm-powerpc during 2.6.15. Glibc for powerpc installs a version of procfs.h which looks for the __PPC64_ELF_H symbol to determine if it is running on powerpc64. That symbol disappeared in the merge, its replacement does not indicate if the machine is running as 64 bit. The absence of the original symbol causes the 32-bit definitions to be used, which leads to compilation failure early in 64-bit glibc when an incompatible kernel definition is included. The following sed will correct this, we need to repeat it every time we install either size of glibc.
cp -v sysdeps/unix/sysv/linux/powerpc/sys/procfs.h{,.orig}
sed 's/__PPC64_ELF_H/__powerpc64__/' \
sysdeps/unix/sysv/linux/powerpc/sys/procfs.h.orig \
> sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
The Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory:
mkdir -v ../glibc-build cd ../glibc-build
The following lines need to be added to config.cache for Glibc to support NPTL:
echo "libc_cv_forced_unwind=yes" > config.cache echo "libc_cv_c_cleanup=yes" >> config.cache
Prepare Glibc for compilation:
BUILD_CC="gcc" CC="${CLFS_TARGET}-gcc ${BUILD32}" \
AR="${CLFS_TARGET}-ar" RANLIB="${CLFS_TARGET}-ranlib" \
../glibc-2.4/configure --prefix=/tools \
--host=${CLFS_TARGET32} --build=${CLFS_HOST} \
--disable-profile --enable-add-ons \
--with-tls --enable-kernel=2.6.0 --with-__thread \
--with-binutils=/cross-tools/bin --with-headers=/tools/include \
--cache-file=config.cache
The meaning of the new configure options:
This sets Glibc to use the current compiler on our system. This is used to create the tools Glibc uses during its build.
Forces Glibc to utilize our target architecture GCC utilizing the 32 Bit flags.
This forces Glibc to use the ar utility we made for our target architecture.
This forces Glibc to use the ranlib utility we made for our target architecture.
This builds the libraries without profiling information. Omit this option if profiling on the temporary tools is necessary.
This tells Glibc to utilize all add-ons that are available.
This tells Glibc to use Thread Local Storage.
This tells Glibc to use use the __thread for libc and libpthread builds.
This tells Glibc to use the Binutils that are specific to our target architecture.
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.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.8.5, “Contents of Glibc.”
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.
Disable linking to libgcc_eh:
patch -Np1 -i ../glibc-2.4-libgcc_eh-1.patch
The following patch fixes an issue that can cause localdef to segfault:
patch -Np1 -i ../glibc-2.4-localedef_segfault-1.patch
The following sed fixes a build issue with Glibc. This will prevent nscd from trying to link to libraries that don't exist:
cp -v nscd/Makefile{,.orig}
sed -e "/nscd_stat.o: sysincludes = # nothing/d" nscd/Makefile.orig > \
nscd/Makefile
Repeat the sed to fix procfs.h.
cp -v sysdeps/unix/sysv/linux/powerpc/sys/procfs.h{,.orig}
sed 's/__PPC64_ELF_H/__powerpc64__/' \
sysdeps/unix/sysv/linux/powerpc/sys/procfs.h.orig \
> sysdeps/unix/sysv/linux/powerpc/sys/procfs.h
The Glibc documentation recommends building Glibc outside of the source directory in a dedicated build directory:
mkdir -v ../glibc-build cd ../glibc-build
The following lines need to be added to config.cache for Glibc to support NPTL:
echo "libc_cv_forced_unwind=yes" > config.cache echo "libc_cv_c_cleanup=yes" >> config.cache
Tell Glibc to install its 64-bit libraries into /tools/lib64:
echo "slibdir=/tools/lib64" >> configparms
Prepare Glibc for compilation:
BUILD_CC="gcc" CC="${CLFS_TARGET}-gcc ${BUILD64}" \
AR="${CLFS_TARGET}-ar" RANLIB="${CLFS_TARGET}-ranlib" \
../glibc-2.4/configure --prefix=/tools \
--host=${CLFS_TARGET} --build=${CLFS_HOST} --libdir=/tools/lib64 \
--disable-profile --enable-add-ons \
--with-tls --enable-kernel=2.6.0 --with-__thread \
--with-binutils=/cross-tools/bin --with-headers=/tools/include \
--cache-file=config.cache
The meaning of the new configure options:
Forces Glibc to utilize our target architecture GCC utilizing the 64 Bit flags.
Puts Glibc into /tools/lib64 instead of /tools/lib.
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.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.8.5, “Contents of Glibc.”
The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.
The following patch fixes the searching of multilib dirs for specs file. The patch standardizes the gcc drivers path iteration functions, ensuring multilib directories are searched in the correct order. This fixes various issues, most noticably with libtool on multilib systems:
patch -Np1 -i ../gcc-4.1.1-PR20425-1.patch
Make a couple of essential adjustments to the specs file to ensure GCC uses our build environment:
patch -Np1 -i ../gcc-4.1.1-specs-1.patch
To make sure that a couple of tools use the proper syntax, apply the following patch:
patch -Np1 -i ../gcc-4.1.1-posix-1.patch
The following patch ensures that gcc does not search the /usr directory for libgcc_s.so when cross-compiling:
patch -Np1 -i ../gcc-4.1.1-cross_search_paths-1.patch
Change the StartFile Spec to point to the correct library location:
echo " #undef STARTFILE_PREFIX_SPEC #define STARTFILE_PREFIX_SPEC \"/tools/lib/\"" >> gcc/config/rs6000/linux.h echo " #undef STARTFILE_PREFIX_SPEC #define STARTFILE_PREFIX_SPEC \"/tools/lib/\"" >> gcc/config/rs6000/linux64.h
Now alter gcc's c preprocessor's default include search path to use /tools only:
cp -v gcc/Makefile.in{,.orig}
sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \
gcc/Makefile.in.orig > gcc/Makefile.in
Finally, disable -B in configure so wrong architecture libraries are not picked up, as -B is not expanded by the multilib spec:
cp -v configure{,.orig}
sed -e '/FLAGS_FOR_TARGET.*\/lib\//s@-B[^ ]*/lib/@@g' configure.orig >configure
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:
../gcc-4.1.1/configure --prefix=/cross-tools \
--target=${CLFS_TARGET} --host=${CLFS_HOST} \
--with-local-prefix=/tools --disable-nls --enable-shared \
--enable-languages=c,c++ --enable-__cxa_atexit \
--enable-c99 --enable-long-long --enable-threads=posix
The meaning of the new configure options:
This option ensures that only the C and C++ compilers are built.
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 C99 support for C programs.
Enables long long support in the compiler.
This enables C++ exception handling for multi-threaded code.
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.11.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 one below. It is safe to ignore these messages.
configure: WARNING: If you wanted to set the --build type, don't use --host.
If a cross compiler is detected then cross compile mode will be used.
Setup target-specific variables for the compiler and linkers:
export CC="${CLFS_TARGET}-gcc"
export CXX="${CLFS_TARGET}-g++"
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"
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
The Binutils package contains a linker, an assembler, and other tools for handling object files.
To make sure that the proper syntax is used for a couple of tools, apply the following patch:
patch -Np1 -i ../binutils-2.17-posix-1.patch
The following patch makes Binutils search in both the lib and lib64 directories in a multilib environment:
patch -Np1 -i ../binutils-2.17-genscripts_multilib-1.patch
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="${CC} ${BUILD64}" \
../binutils-2.17/configure --prefix=/tools \
--libdir=/tools/lib64 --with-lib-path=/tools/lib \
--build=${CLFS_HOST} --host=${CLFS_TARGET} --target=${CLFS_TARGET} \
--disable-nls --enable-shared --enable-64-bit-bfd
The meaning of the new configure options:
Tells the compiler to use our 64-bit build flags.
Compile the package:
make configure-host make
Install the package:
make install
Details on this package are located in Section 10.10.2, “Contents of Binutils.”
The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.
The following patch fixes the searching of multilib dirs for specs file. The patch standardizes the gcc drivers path iteration functions, ensuring multilib directories are searched in the correct order. This fixes various issues, most noticably with libtool on multilib systems:
patch -Np1 -i ../gcc-4.1.1-PR20425-1.patch
Make a couple of essential adjustments to the specs file to ensure GCC uses our build environment:
patch -Np1 -i ../gcc-4.1.1-specs-1.patch
To make sure that a couple of tools use the proper syntax, apply the following patch:
patch -Np1 -i ../gcc-4.1.1-posix-1.patch
The following patch ensures that gcc does not search the /usr directory for libgcc_s.so when cross-compiling:
patch -Np1 -i ../gcc-4.1.1-cross_search_paths-1.patch
Now we will change cpp's search path not to look in /usr/include:
cp -v gcc/cppdefault.c{,.orig}
sed -e '/#define STANDARD_INCLUDE_DIR/s@"/usr/include"@0@g' \
gcc/cppdefault.c.orig > gcc/cppdefault.c
Also, we need to set the directory searched by the fixincludes process for system headers, so it won't look at the host's headers:
cp -v gcc/Makefile.in{,.orig}
sed -e 's@\(^NATIVE_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g' \
gcc/Makefile.in.orig > gcc/Makefile.in
When searching for the multilibs, force the build to use the results of --print-multi-lib from our cross-compiler, not the native compiler gcc builds now:
cp -v gcc/Makefile.in{,.orig2}
sed -e "/MULTILIBS/s@\$(GCC_FOR_TARGET)@/cross-tools/bin/${CC}@g" \
gcc/Makefile.in.orig2 > 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:
CC="${CC} ${BUILD64}" CXX="${CXX} ${BUILD64}" \
../gcc-4.1.1/configure --prefix=/tools --libdir=/tools/lib64 \
--build=${CLFS_HOST} --host=${CLFS_TARGET} --target=${CLFS_TARGET} \
--with-local-prefix=/tools --enable-long-long --enable-c99 \
--enable-shared --enable-threads=posix --enable-__cxa_atexit \
--disable-nls --enable-languages=c,c++ --disable-libstdcxx-pch
The meaning of the new configure options:
This forces the C++ compiler to use our 64 Bit flags.
Do not build the pre-compiled header (PCH) for libstdc++. It takes up a lot of space, and we have no use for it.
Compile the package:
make AS_FOR_TARGET="${AS}" \
LD_FOR_TARGET="${LD}"
Install the package:
make install
Many packages use the name cc to call the C compiler. To satisfy those packages, create a symlink:
ln -sv gcc /tools/bin/cc
Details on this package are located in Section 10.11.2, “Contents of GCC.”
The Ncurses package contains libraries for terminal-independent handling of character screens.
Prepare Ncurses for compilation:
CC="${CC} ${BUILD64}" CXX="${CXX} ${BUILD64}" \
./configure --prefix=/tools --with-shared \
--build=${CLFS_HOST} --host=${CLFS_TARGET} \
--without-debug --without-ada \
--enable-overwrite --with-build-cc=gcc \
--libdir=/tools/lib64
The meaning of the configure options:
This tells Ncurses to create a shared library.
This tells Ncurses not to build with debug information.
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.
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.
This tells Ncurses what type of compiler we are using.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.18.2, “Contents of Ncurses.”
The Bash package contains the Bourne-Again SHell.
Remove a test that causes the build to fail:
echo "ac_cv_func_setvbuf_reversed=no" >> config.cache
When bash is cross-compiled, it cannot test for the presence of named pipes. 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. Prevent that by forcing the following definition:
echo "bash_cv_sys_named_pipes=yes" >> config.cache
Prepare Bash for compilation:
CC="${CC} ${BUILD64}" CXX="${CXX} ${BUILD64}" \
./configure --prefix=/tools \
--build=${CLFS_HOST} --host=${CLFS_TARGET} \
--without-bash-malloc --cache-file=config.cache
The meaning of the configure option:
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
Make a link for programs that use sh for a shell:
ln -sv bash /tools/bin/sh
Details on this package are located in Section 10.35.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 testsuite as well. We need to remove the tests since they won't work on a multi-architecture build, and change the default lib path to lib64:
cp -v Makefile{,.orig}
sed -e 's@^\(all:.*\) test@\1@g' \
-e 's@/lib\(/\| \|$\)@/lib64\1@g' Makefile.orig > Makefile
The Bzip2 package does not contain a configure script. Compile it with:
make CC="${CC} ${BUILD64}" AR="${AR}" RANLIB="${RANLIB}"
Install the package:
make PREFIX=/tools install
Details on this package are located in Section 10.37.2, “Contents of Bzip2.”
The Coreutils package contains utilities for showing and setting the basic system characteristics.
Coreutils has some issues when cross-compiling. So we define the items cross-compiling doesn't like:
echo "ac_cv_sys_restartable_syscalls=yes" > config.cache echo "ac_cv_func_setvbuf_reversed=yes" >> config.cache echo "utils_cv_sys_open_max=1024" >> config.cache
Prepare Coreutils for compilation:
CC="${CC} ${BUILD64}" \
./configure --prefix=/tools --cache-file=config.cache \
--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 Coreutils.”
The Diffutils package contains programs that show the differences between files or directories.
Prepare Diffutils for compilation:
CC="${CC} ${BUILD64}" ./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.38.2, “Contents of Diffutils.”
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).
Findutils has an issue with cross-compiling where it can't find getline. Fix it here:
echo "am_cv_func_working_getline=yes" >> config.cache
Prepare Findutils for compilation:
CC="${CC} ${BUILD64}" ./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.43.2, “Contents of Findutils.”
The Gawk package contains programs for manipulating text files.
Prepare Gawk for compilation:
CC="${CC} ${BUILD64}" \
./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.44.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.
Gettext has an issue with cross-compiling where it can't find getline. Fix it here:
cd gettext-tools echo "am_cv_func_working_getline=yes" >> config.cache
Prepare Gettext for compilation:
CC="${CC} ${BUILD64}" CXX="${CXX} ${BUILD64}" \
./configure --prefix=/tools \
--build=${CLFS_HOST} --host=${CLFS_TARGET} --disable-shared \
--cache-file=config.cache
The meaning of the configure options:
This tells Gettext not to create a shared library.
Only one program in the Gettext package needs to be built:
make -C lib make -C src msgfmt
Install the msgfmt binary:
cp -v src/msgfmt /tools/bin
Details on this package are located in Section 10.46.2, “Contents of Gettext.”
The Grep package contains programs for searching through files.
Prepare Grep for compilation:
CC="${CC} ${BUILD64}" ./configure --prefix=/tools \
--build=${CLFS_HOST} --host=${CLFS_TARGET} \
--disable-perl-regexp
The meaning of the configure options:
This ensures that the grep program does not get linked against a Perl Compatible Regular Expression (PCRE) library that may be present on the host but will not be available when building the final system.
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.47.2, “Contents of Grep.”
The Gzip package contains programs for compressing and decompressing files.
Setup configure so it can use cross-compiled tools:
cp -v configure{,.orig}
sed -e "s@nm conftest@${CLFS_TARGET}-&@" configure.orig > configure
Prepare Gzip for compilation:
CC="${CC} ${BUILD64}" ./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.49.2, “Contents of Gzip.”
The Make package contains a program for compiling packages.
Prepare Make for compilation:
CC="${CC} ${BUILD64}" ./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 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:
CC="${CC} ${BUILD64}" ./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.57.2, “Contents of Patch.”
The Sed package contains a stream editor.
Prepare Sed for compilation:
CC="${CC} ${BUILD64}" ./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.21.2, “Contents of Sed.”
The Tar package contains an archiving program.
Tar has an issue with cross-compiling where it can't find getline. Fix it here:
echo "am_cv_func_working_getline=yes" >> config.cache
Prepare Tar for compilation:
CC="${CC} ${BUILD64}" ./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.63.2, “Contents of Tar.”
The Texinfo package contains programs for reading, writing, and converting info pages.
Prepare Texinfo for compilation:
CC="${CC} ${BUILD64}" ./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.64.2, “Contents of Texinfo.”
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 chroot into the temporary system.
The boot method is needed when you are building on a different architecture. For example, if you are building a PowerPC system from an x86, you can't chroot. The chroot method is for when you are building on the same architecture. If you are building on, and for, an x86 system, you can simply chroot. The rule of thumb here is if the architectures match and you are running the same series 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.
Powerpc64 is slightly different from some of the other architectures, because a 64-bit kernel running 32-bit userspace can successfully chroot and execute 64-bit programs. However, if the kernel personality has been set to 32-bit by a utility such as linux32, it will eventually fail when glibc thinks it is building on a 32-bit system and tries to include incompatible assembler code in the 64-bit glibc.
To see if you can successfully chroot to build the final powerpc64 system, enter the following command which tests if you are running a 64-bit Linux 2.6 kernel (with a 64-bit personality):
uname -a | grep '^Linux.*2\.6\..*ppc64' && echo "ok to chroot" || echo "you must boot"
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.
There are a few additional packages that will need to be installed to allow you to boot the minimal system. Some of these packages will be installed onto root or in /usr on the CLFS partition (${CLFS}/bin, ${CLFS}/usr/bin, etc...), rather than /tools, using the "DESTDIR" option with make. This will require the clfs user to have write access to the rest of the CLFS partition, so you will need to temporarily change the ownership of ${CLFS} to the clfs user. Run the following command as root:
chown -v clfs ${CLFS}
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{,64},mnt}
mkdir -pv ${CLFS}/{proc,media/{floppy,cdrom},sbin,srv,sys}
mkdir -pv ${CLFS}/var/{lock,log,mail,run,spool}
mkdir -pv ${CLFS}/var/{opt,cache,lib{,64}/{misc,locate},local}
install -dv ${CLFS}/root -m 0750
install -dv ${CLFS}{/var,}/tmp -m 1777
mkdir -pv ${CLFS}/usr/{,local/}{bin,include,lib{,64},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}
for dir in ${CLFS}/usr{,/local}; do
ln -sv share/{man,doc,info} $dir
done
install -dv ${CLFS}/usr/lib/locale
ln -sv ../lib/locale ${CLFS}/usr/lib64
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 programs which do not exist yet. In order to satisfy these programs, create a number of symbolic links which will be replaced by real files throughout the course of the next chapter after the software has been installed.
ln -sv /tools/bin/{bash,cat,pwd,stty} ${CLFS}/bin
ln -sv /tools/lib/libgcc_s.so{,.1} ${CLFS}/usr/lib
ln -sv /tools/lib64/libgcc_s.so{,.1} ${CLFS}/usr/lib64
ln -sv /tools/lib/libstd* ${CLFS}/usr/lib
ln -sv /tools/lib64/libstd* ${CLFS}/usr/lib64
ln -sv bash ${CLFS}/bin/sh
The Zlib package contains compression and decompression routines used by some programs.
Prepare Zlib for compilation:
CC="${CC} ${BUILD64}" \
./configure --prefix=/tools --shared --libdir=/tools/lib64
Compile the package:
make
Install the package:
make install
Details on this package are located in Section 10.32.2, “Contents of Zlib.”
The E2fsprogs package contains the utilities for handling the ext2 file system. It also supports the ext3 journaling file system.
This package cannot be cross-compiled for ppc64 on some common architectures. The following patch fixes this:
patch -Np1 -i ../e2fsprogs-1.39-cross-1.patch
Make sure the libraries get installed to /tools/lib64:
chmod -v 0755 configure
cp -v configure{,.orig}
sed -e "/libdir=.*\/lib/s@/lib@/lib64@g" configure.orig > configure
The E2fsprogs documentation recommends that the package be built in a subdirectory of the source tree:
mkdir -v build cd build
When cross-compiling configure cannot determine sizes and assumes short=2, int=4, long=4, long long=8. This is not correct for PowerPC64. Adjust the values with:
echo "ac_cv_sizeof_long=8" > config.cache
Prepare E2fsprogs for compilation:
CC="${CC} ${BUILD64}" ../configure --prefix=/tools \
--enable-elf-shlibs --disable-evms \
--build=${CLFS_HOST} --host=${CLFS_TARGET} --cache-file=config.cache
The meaning of the configure options:
This creates the shared libraries which some programs in this package use.
This disables the building of the Enterprise Volume Management System (EVMS) plugin. This plugin is not up-to-date with the latest EVMS internal interfaces and EVMS is not installed as part of a base CLFS system, so the plugin is not required. See the EVMS website at http://evms.sourceforge.net/ for more information regarding EVMS.
make CC="${CC} ${BUILD64}"
Install the binaries and documentation:
make DESTDIR=${CLFS} install
The meaning of the make option:
The Makefile for e2fsprogs hard-codes a path to the mke2fs.conf file, attempting to install it into ${DESTDIR}/etc, causing the installation to fail as it tries to write to /etc. The DESTDIR parameter prevents this.
Install the shared libraries:
make install-libs
Create needed symlinks for a bootable system:
ln -sv /tools/sbin/{fsck.ext2,fsck.ext3,e2fsck} ${CLFS}/sbin
Details on this package are located in Section 10.40.2, “Contents of E2fsprogs.”
The Sysvinit package contains programs for controlling the startup, running, and shutdown of the system.
Make some modifications to allow you to boot into the minimal temp-system:
cp -v src/Makefile src/Makefile.orig
sed -e 's@root@0@g' \
-e "s@/dev/initctl@${CLFS}&@g" \
-e 's@\(mknod \)-m \([0-9]* \)\(.* \)p@\1\3p; chmod \2\3@g' \
-e "s@/usr/lib@/tools/lib@" \
src/Makefile.orig > src/Makefile
Compile the package:
make -C src clobber
make -C src CC="${CC} ${BUILD64}"
Install the package:
make -C src install INSTALL="install" ROOT="${CLFS}"
Create a new file ${CLFS}/etc/inittab by running the following:
cat > ${CLFS}/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
1:2345:respawn:/sbin/agetty -I '\033(K' tty1 9600
2:2345:respawn:/sbin/agetty -I '\033(K' tty2 9600
3:2345:respawn:/sbin/agetty -I '\033(K' tty3 9600
4:2345:respawn:/sbin/agetty -I '\033(K' tty4 9600
5:2345:respawn:/sbin/agetty -I '\033(K' tty5 9600
6:2345:respawn:/sbin/agetty -I '\033(K' tty6 9600
# End /etc/inittab
EOF
Details on this package are located in Section 10.62.3, “Contents of Sysvinit.”
The Module-Init-Tools package contains programs for handling kernel modules in Linux kernels greater than or equal to version 2.5.47.
Prepare Module-Init-Tools for compilation:
CC="${CC} ${BUILD64}" ./configure --prefix=/ \
--build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make DESTDIR="${CLFS}" install
Details on this package are located in Section 10.56.2, “Contents of Module-Init-Tools.”
The Util-linux package contains miscellaneous utility programs. Among them are utilities for handling file systems, consoles, partitions, and messages.
Util-linux fails to compile against newer versions of Linux kernel headers. The following patch properly fixes this issue:
patch -Np1 -i ../util-linux-2.12r-cramfs-1.patch
The following patch fixes build issues with GCC 4.1.1:
patch -Np1 -i ../util-linux-2.12r-gcc4_fixes-1.patch
The following patch fixes swapon.c - it tries to find the variable R_OK, but the header that has R_OK is not included:
patch -Np1 -i ../util-linux-2.12r-missing_header-1.patch
Util-linux does not use the freshly installed headers and libraries from the /tools directory by default. This is fixed by altering the configure script:
cp -v configure{,.orig}
sed -e 's@/usr/include@/tools/include@g' configure.orig > configure
The Util-linux installation uses -o root. The following sed removes that since we don't have users setup yet:
cp -v MCONFIG{,.orig}
sed -e 's|-o root||' MCONFIG.orig > MCONFIG
Prepare Util-linux for compilation:
CC="${CC} ${BUILD64}" ./configure
Compile the package:
make HAVE_KILL=yes HAVE_SLN=yes \
HAVE_SHADOW=no CPUOPT="" ARCH="" \
CPU=""
The meaning of the make parameters:
This prevents the kill program from being built.
This prevents the sln program (a statically linked version of ln already installed by Glibc) from being built and installed again.
This disables linking to shadow .
This disables any compiler optimizations by CPU type.
This disables the detection of the architecture.
This disables the detection of the CPU.
Install the package:
make HAVE_KILL=yes HAVE_SLN=yes HAVE_SHADOW=no \
USE_TTY_GROUP=no CPUOPT="" ARCH="" \
CPU="" DESTDIR=${CLFS} install
Details on this package are located in Section 10.66.3, “Contents of Util-linux.”
The Udev package contains programs for dynamic creation of device nodes.
Compile the package:
make CROSS_COMPILE="${CLFS_TARGET}-" CC="${CC} ${BUILD64}" \
LD="${CC} ${BUILD64}"
Install the package:
make DESTDIR=${CLFS} install
Details on this package are located in Section 10.65.2, “Contents of Udev.”
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
EOF
The actual password for root (the “::” used here is just a placeholder and allow you to login with no password) will be set later.
Additional users you may want to add:
Can be useful for compatibility with legacy applications.
It is often recommended to use an unprivileged User ID/Group ID for daemons to run as, in order to limit their access to the system.
Was used for programs that performed administrative tasks.
Used by programs for printing
Often used by email programs
Often used for network news servers
Often used for Unix-to-Unix Copy of files from one server to the next
Often used to allow system operators to access the system
Generally used as an account that receives all the information of troubles with the mail server
Used by NFS
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:4:
tape:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:
EOF
Additional groups you may want to add
All users in this group are allowed to do administrative tasks
This group has direct access to the console
This group is allowed to use the CDRW drive
Used by MTAs (Mail Transport Agents)
Used by Network News Servers
Used by the Unix-to-Unix copy users
The default GID used by shadow for new users
This is a default group used by some programs that do not require a group
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 Udev 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/run/utmp ${CLFS}/var/log/{btmp,lastlog,wtmp}
chmod -v 664 ${CLFS}/var/run/utmp ${CLFS}/var/log/lastlog
chmod -v 600 ${CLFS}/var/log/btmp
The /var/run/utmp file records the users that are currently logged in. The /var/log/wtmp file records all logins and logouts. The /var/log/lastlog file records when each user last logged in. The /var/log/btmp file records the bad login attempts.
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.
The following patch fixes on intialization issue with the tulip network driver:
patch -Np1 -i ../linux-2.6.17.13-tulip-1.patch
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.
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.
If your keyboard isn't a US one and you have Kbd installed on your host system, you can build the proper keymap for your keyboard layout inside the kernel. If you wish to do this, run the following command (replace [path to keymap] with the keymap location on the host - a common location is in /usr/share/kbd):
loadkeys -m [path to keymap] > \
drivers/char/defkeymap.c
For example, if using a Dutch keyboard, use /usr/share/kbd/keymaps/i386/qwerty/nl.map.gz.
Configure the kernel via a menu-driven interface:
make ARCH=powerpc CROSS_COMPILE=${CLFS_TARGET}- menuconfig
Compile the kernel image and modules:
make ARCH=powerpc CROSS_COMPILE=${CLFS_TARGET}-
If the use of kernel modules can't be avoided, an /etc/modprobe.conf 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. The modprobe.conf man page may also be of interest.
Be very careful when reading other documentation relating to kernel modules because it usually applies to 2.4.x kernels only. As far as we know, kernel configuration issues specific to Hotplug and Udev are not documented. The problem is that Udev will create a device node only if Hotplug or a user-written script inserts the corresponding module into the kernel, and not all modules are detectable by Hotplug. Note that statements like the one below in the /etc/modprobe.conf file do not work with Udev:
alias char-major-XXX some-module
Install the modules, if the kernel configuration uses them:
make ARCH=powerpc CROSS_COMPILE=${CLFS_TARGET}- \
INSTALL_MOD_PATH=${CLFS} modules_install
After kernel compilation is complete, additional steps are required to complete the installation. Some files need to be copied to the ${CLFS}/boot directory.
Issue the following command to install the kernel:
cp -v vmlinux ${CLFS}/boot/clfskernel-2.6.17.13
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 ${CLFS}/boot/System.map-2.6.17.13
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 ${CLFS}/boot/config-2.6.17.13
Details on this package are located in Section 12.3.2, “Contents of Linux.”
The Hfsutils package contains a number of utilities for accessing files on hfs filesystems. It is needed to run ybin.
If you have created, or will create, the ext2 filesystem on your Mac using ext2fsx you can jump ahead to Section 7.15, “Yaboot-1.3.13.”. The next three packages are for people who cannot do that.
Prepare Hfsutils for compilation:
CC="${CC} ${BUILD64}" ./configure --prefix=/tools
Compile the package.
make
Install the package:
make install
Details on this package are located in Section 10.68.2, “Contents of Hfsutils.”
The Mktemp package contains programs used to create secure temporary files in shell scripts.
The configure files in this package do not recognise all of the machines supported by CLFS. This patch updates config.guess and config.sub for other processors:
patch -Np1 -i ../mktemp-1.5-config_update-1.patch
Mktemp will try to pass the -s switch to install to strip the binaries. This will not work when cross compiling, so run the following commands to remove this:
cp -v Makefile.in{,.orig}
sed 's/\(0555 \)-s /\1/' Makefile.in.orig >Makefile.in
Prepare Mktemp for compilation:
CC="${CC} ${BUILD64}" ./configure --prefix=/tools --with-libc\
--build=${CLFS_HOST} --host=${CLFS_TARGET}
Compile the package:
make
Install the package:
make install