diff --git a/Makefile b/Makefile index c4025ffcb..628b7c2de 100644 --- a/Makefile +++ b/Makefile @@ -26,7 +26,7 @@ ifeq ($(REV), sysv) BASEDIR ?= ~/lfs-book PDF_OUTPUT ?= LFS-BOOK.pdf NOCHUNKS_OUTPUT ?= LFS-BOOK.html - DUMPDIR ?= ~/lfs-commands + DUMPDIR ?= ~/cross-lfs-commands else BASEDIR ?= ~/lfs-systemd PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf @@ -59,9 +59,6 @@ book: validate profile-html @echo "Copying CSS code and images..." $(Q)mkdir -p $(BASEDIR)/stylesheets $(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets - $(Q)pushd $(BASEDIR)/ > /dev/null; \ -# sed -i -e "s@../stylesheets@stylesheets@g" *.html; \ - popd > /dev/null $(Q)mkdir -p $(BASEDIR)/images $(Q)cp images/*.png $(BASEDIR)/images @@ -175,7 +172,6 @@ $(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \ # $(Q)xsltproc --nonet --xinclude \ # --stringparam profile.revision $(REV) \ -# --stringparam profile.arch $(ARCH) \ # --output $(RENDERTMP)/sysd-wget.xml \ # stylesheets/lfs-xsl/profile.xsl \ # chapter03/chapter03.xml @@ -193,7 +189,7 @@ $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \ $(Q)xsltproc --nonet --xinclude \ --stringparam profile.revision $(REV) \ - --stringparam profile.arch $(ARCH) \ + --stringparam profile.arch $(ARCH) \ --output $(RENDERTMP)/sysv-md5sum.xml \ stylesheets/lfs-xsl/profile.xsl \ chapter03/chapter03.xml @@ -211,7 +207,6 @@ $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \ # $(Q)xsltproc --nonet \ # --output $(RENDERTMP)/lfs-html.xml \ # --stringparam profile.revision $(REV) \ -# --stringparam profile.arch $(ARCH) \ # stylesheets/lfs-xsl/profile.xsl \ # $(RENDERTMP)/lfs-full.xml diff --git a/appendices/dependencies.xml b/appendices/dependencies.xml index ddda9377c..d93438fce 100644 --- a/appendices/dependencies.xml +++ b/appendices/dependencies.xml @@ -828,8 +828,8 @@ - - Gcc + + GCC &dependencies; @@ -1303,8 +1303,8 @@ &dependencies; - Bash, Bison, Coreutils, Flex, GCC, Glibc, Make, - and Linux API Headers + Bash, Bison, Coreutils, Flex, GCC, Glibc, Make, Libcap, + Libelf, and Linux API Headers @@ -1328,7 +1328,7 @@ &external; - None + Berkeley DB and Iptables @@ -1464,7 +1464,7 @@ &before; - Shadow + IProute2 and Shadow @@ -1499,7 +1499,7 @@ &before; - Linux Kernel + IProute2 and Linux Kernel @@ -1948,7 +1948,7 @@ &dependencies; - Binutils, Coreutils, Gcc, and Python + Binutils, Coreutils, GCC, and Python @@ -1983,7 +1983,7 @@ &dependencies; - Binutils, Coreutils, Gcc, Make, and Perl + Binutils, Coreutils, GCC, Make, and Perl diff --git a/chapter01/askforhelp.xml b/chapter01/askforhelp.xml index 79df30db5..8a8ba39a4 100644 --- a/chapter01/askforhelp.xml +++ b/chapter01/askforhelp.xml @@ -38,12 +38,13 @@ - The version of the book being used (in this case + + The version of the book being used (in this case &version; &version;-multilib &versiond; - &versiond;-multilib) - + &versiond;-multilib) + The host distribution and version being used to create LFS @@ -58,7 +59,7 @@ The exact error message or symptom being received - Note whether you have deviated from the book at all + Note whether you have deviated from the book at all diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 850a36f29..c40502c15 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -11,10 +11,10 @@ Changelog This is version - &version; - &version;-multilib - &versiond; - &versiond;-multilib + &version; + &version;-multilib + &versiond; + &versiond;-multilib of the Linux From Scratch book, dated &releasedate;. 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 @@ -44,6 +44,92 @@ or as appropriate for the entry or if needed the entire day's listitem. --> + + + 2020-06-22 + + [renodr] - Fix a segfault in systemd-udevd. + + + + + + + 2020-06-17 + + [bdubbs] - Update to meson-0.54.3. Fixes + #4673. + + + [bdubbs] - Update to man-pages-5.07. Fixes + #4669. + + + [bdubbs] - Update to linux-5.7.2. Fixes + #4662. + + + [bdubbs] - Update to iproute2-5.7.0. Fixes + #4668. + + + [bdubbs] - Update to file-5.39. Fixes + #4671. + + + [bdubbs] - Update to elfutils-0.180. Fixes + #4670. + + + [bdubbs] - Update to bison-3.6.4. Fixes + #4672. + + + + + + 2020-06-16 + + + [bdubbs] - Split Chapter 5 into three separate chapters. + Implement a new method of cross-building the LFS tool chain + and other tools to simplify the method of isolating the + new system from the original host. This will be the start of + LFS-10.0. + + + + + + 2020-06-03 + + + [renodr] - Fix systemd's build with GCC-10 with a patch instead + of CFLAGS. + + + [renodr] - Update to perl-5.30.3 (security update). Fixes + #4664. + + + [renodr] - Update to dbus-1.12.18 (security update). Fixes + #4665. + + + [renodr] - Update to man-db-2.9.2. Fixes + #4663. + + + [renodr] - Update to libcap-2.36. Fixes + #4666. + + + [renodr] - Update to bison-3.6.3. Fixes + #4667. + + + + 2020-05-31 @@ -59,6 +145,17 @@ 2020-05-29 + + [xry111] - Move flex earlier in chapter 6, so that binutils + can use it. + + + [xry111] - Remove bzip2 and flex from chapter 5. + + + [xry111] - Move zstd earlier in chapter 6, so that file and + GCC can use it. + [bdubbs] - Run sed and findutils tests as an unprivileged user. Fixes @@ -176,6 +273,16 @@ + + 2020-05-09 + + + [pierre] - Patch GCC pass 2 to allow cross-compile + (specific to new cross method). + + + + 2020-05-08 diff --git a/chapter01/how.xml b/chapter01/how.xml index 3a8942dba..a690fb595 100644 --- a/chapter01/how.xml +++ b/chapter01/how.xml @@ -44,42 +44,28 @@ discusses the setup of an appropriate working environment. Please read carefully as it explains several important issues you need be aware of before beginning to - work your way through and beyond. + work your way through and beyond. - explains the - installation of a number of packages that will form the basic - development suite (or toolchain) which is used to build the actual - system in . Some of these - packages are needed to resolve circular dependencies—for example, - to compile a compiler, you need a compiler. + , explains the installation of + the initial tool chain, (binutils, gcc, and glibc) using cross compilation + techniques to isolate the new tools from the host system. - also shows you how to - build a first pass of the toolchain, including Binutils and GCC (first pass - basically means these two core packages will be reinstalled). - The next step is to build Glibc, the C library. Glibc will be compiled by - the toolchain programs built in the first pass. Then, a second pass of the - toolchain will be built. This time, the toolchain will be dynamically linked - against the newly built Glibc. The remaining packages are built using this second - pass toolchain. When this is done, the LFS installation process will no - longer depend on the host distribution, with the exception of the running - kernel. + shows you how to + cross-compile basic utilities using the just built cross-toolchain. + + then enters a + "chroot" environment and uses the previously built tools to build + the additional tools needed to build and test the final system. This effort to isolate the new system from the host distribution may - seem excessive. A full technical explanation as to why this is done is provided in - . + seem excessive. A full technical explanation as to why this is done is + provided in . - In , the full LFS system is - built. The chroot (change root) program is used to enter - a virtual environment and start a new shell whose root directory will be - set to the LFS partition. This is very similar to rebooting and instructing - the kernel to mount the LFS partition as the root partition. The system - does not actually reboot, but instead uses chroot because - creating a bootable system requires additional work which is not necessary - just yet. The major advantage is that chrooting allows you - to continue using the host system while LFS is being built. While waiting - for package compilations to complete, you can continue using your computer as - normal. + In , The + full LFS system is built. Another advantage provided by the chroot + environment is that it allows you to continue using the host system + while LFS is being built. While waiting for package compilations to + complete, you can continue using your computer as normal. To finish the installation, the basic system configuration is set up in , and the kernel and boot loader are set diff --git a/chapter01/livecd.xml b/chapter01/livecd.xml deleted file mode 100644 index e4886581c..000000000 --- a/chapter01/livecd.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - %general-entities; -]> - - - - - About the Included CD - - For your convenience, we have included a CD with this book that - contains the source packages needed for creating a Linux From Scratch - system. The CD is bootable and provides a stable working environment - for building LFS. This book refers to this system as the - host system. The CD images are actively maintained and - updated versions can be found at - - - In addition to the tools required to build LFS, the host system - on the CD has a number of other helpful tools installed: - - - - - An HTML version of this book - - - - The X Window System Environment - - - - Web Tools - - - Wget (command line file retriever) - - - Lynx (text web browser) - - - Irssi (console IRC client) - - - Firefox (graphical web browser) - - - Xchat (X-based IRC client) - - - - - - Text Editors - - - Vim - - - Nano - - - - - - Network Tools - - - SSH Server and Client - - - NFS Server and Client - - - Smbmount (mount.cifs) for Windows shares - - - Subversion - - - Dhcpcd (DHCP client) - - - - - - Filesystem Programs - - - Reiserfsprogs - - - Xfsprogs - - - - - - nALFS - A tool for automating LFS builds - - - - - diff --git a/chapter01/whatsnew.xml b/chapter01/whatsnew.xml index 14ea32943..70fb7f29b 100644 --- a/chapter01/whatsnew.xml +++ b/chapter01/whatsnew.xml @@ -11,6 +11,10 @@ What's new since the last release + In this version of LFS, there has been a major reorganization + of the book using techniques that avoid changing the host system + and provides a more straight forward build process. + Below is a list of package updates made since the previous release of the book. @@ -80,9 +84,9 @@ - + @@ -164,9 +168,6 @@ Linux-&linux-version; - - Linux-Firmware-&linux-firmware-version; - diff --git a/chapter02/creatingfilesystem.xml b/chapter02/creatingfilesystem.xml index 4a722efe0..f01b745e9 100644 --- a/chapter02/creatingfilesystem.xml +++ b/chapter02/creatingfilesystem.xml @@ -52,42 +52,9 @@ mkfs -v -t ext4 /dev/<xxx> - If you are using an existing swap partition, there is no need to format it. If a new swap partition was created, diff --git a/chapter02/creatingpartition.xml b/chapter02/creatingpartition.xml index 02d6528b1..672c2efb5 100644 --- a/chapter02/creatingpartition.xml +++ b/chapter02/creatingpartition.xml @@ -15,21 +15,6 @@ is to use an available empty partition or, if you have enough unpartitioned space, to create one. - - A minimal system requires a partition of around 10 gigabytes (GB). This is enough to store all the source tarballs and compile the packages. However, if the LFS system is intended to be the primary Linux system, @@ -77,7 +62,7 @@ Other Partition Issues Requests for advice on system partitioning are often posted on the LFS mailing - lists. This is a highly subjective topic. The default for most distributions + lists. This is a highly subjective topic. The default for most distributions is to use the entire drive with the exception of one small swap partition. This is not optimal for LFS for several reasons. It reduces flexibility, makes sharing of data across multiple distributions or LFS builds more difficult, makes @@ -89,7 +74,7 @@ A root LFS partition (not to be confused with the /root directory) of - ten gigabytes is a good compromise for most systems. It provides enough + twenty gigabytes is a good compromise for most systems. It provides enough space to build LFS and most of BLFS, but is small enough so that multiple partitions can be easily created for experimentation. @@ -102,13 +87,21 @@ hold the swap partition to two gigabytes and monitor the amount of disk swapping. - Swapping is never good. Generally you can tell if a system is - swapping by just listening to disk activity and observing how the system - reacts to commands. The first reaction to swapping should be to check for - an unreasonable command such as trying to edit a five gigabyte file. If - swapping becomes a normal occurrence, the best solution is to purchase more - RAM for your system. - + If you want to use the hibernation feature (suspend-to-disk) of Linux, + it writes out the contents of RAM to the swap partition before turning off + the machine. In this case the size of the swap partition should be at + least as large as the system's installed RAM. + + Swapping is never good. For mechanical hard drives you can generally + tell if a system is swapping by just listening to disk activity and + observing how the system reacts to commands. For an SSD drive you will not + be able to hear swapping but you can tell how much swap space is being used + by the top or free programs. Use of + an SSD drive for a swap partition should be avoided if possible. The first + reaction to swapping should be to check for an unreasonable command such as + trying to edit a five gigabyte file. If swapping becomes a normal + occurrence, the best solution is to purchase more RAM for your + system. The Grub Bios Partition @@ -140,7 +133,7 @@ /boot – Highly recommended. Use this partition to store kernels and other booting information. To minimize potential boot problems with larger disks, make this the first physical partition on - your first disk drive. A partition size of 100 megabytes is quite + your first disk drive. A partition size of 200 megabytes is quite adequate. /home – Highly recommended. Share your home @@ -150,7 +143,7 @@ /usr – A separate /usr partition is generally used if providing a server for a thin client or diskless workstation. It is - normally not needed for LFS. A size of five gigabytes will handle most + normally not needed for LFS. A size of ten gigabytes will handle most installations. /opt – This directory is most useful for diff --git a/chapter02/hostreqs.xml b/chapter02/hostreqs.xml index 1989bdec6..f5b0eabde 100644 --- a/chapter02/hostreqs.xml +++ b/chapter02/hostreqs.xml @@ -244,6 +244,7 @@ or all absent, but not only one or two present. <M> IA32 a.out support [*] x32 ABI for 64-bit mode + The option 'IA32 a.out support' is optional. In case your kernel does not have 'x32 ABI for 64-bit mode' enabled but only 'IA32 Emulation', you can continue to build your @@ -251,7 +252,7 @@ or all absent, but not only one or two present. for building x32 objects. If neither 'IA32 Emulation' nor 'x32 ABI for 64-bit mode' is enabled, you will run in errors latest when building glibc in Chapter 6, - so an upgrade of your host system is required. + so an upgrade of your host system kernel is required. diff --git a/chapter02/stages.xml b/chapter02/stages.xml index 30e820213..23348a885 100644 --- a/chapter02/stages.xml +++ b/chapter02/stages.xml @@ -25,57 +25,63 @@ - Procedures done as the root user after Section 2.4 need to - have the LFS environment variable set FOR THE ROOT - USER. + Procedures done as the root user after Section 2.4 need to + have the LFS environment variable set FOR THE ROOT + USER. - Chapter 5 + Chapter 5–6 - The /mnt/lfs partition must be mounted. + The /mnt/lfs partition must be mounted. - ALL instructions in Chapter 5 - must be done by user lfs. - A su - lfs needs to be done before any - task in Chapter 5. + Threse two chapters must be done as user lfs. + A su - lfs needs to be done before any task in these + chapters. Failing to do that, you are at risk of installing packages to the + host, and potentially rendering it unusable. The procedures in are critical. If there is any doubt about installing a package, ensure any previously expanded - tarballs are removed, re-extract the package files, and complete all + tarballs are removed, then re-extract the package files, and complete all instructions in that section. - Chapters 6–8 + Chapter 7–10 The /mnt/lfs partition must be mounted. + + A few operations, from Changing Ownership to + Entering the Chroot Environment must be done as the + root user, with the LFS envirnment variable set for the root user. + + When entering chroot, the LFS environment variable must be set - for root. The LFS variable is not used otherwise. + for root. The LFS variable is not used afterwards. The virtual file systems must be mounted. This can be done before or after entering chroot by changing to a host virtual terminal and, as root, running the commands in - and - . + and + . diff --git a/chapter03/introduction.xml b/chapter03/introduction.xml index e67e62497..7a7626d92 100644 --- a/chapter03/introduction.xml +++ b/chapter03/introduction.xml @@ -49,9 +49,28 @@ chmod -v a+wt $LFS/sources - An easy way to download all of the packages and patches is by using - wget-list as an input to - wget. For example: + There are several ways to optain all the necessary packages and patches + to build LFS: + + + + The files can be downloaded individually as described in the + next two sections. + + + For stable versions of the book, a tarball of all the needed files + can be downloaded from one of the LFS files mirrors listed at + . + + + The files can be downloaded using wget and + a wget-list as described below. + + + + To download all of the packages and patches by using + wget-list as an input to the + wget command, use: wget --input-file=wget-list --continue --directory-prefix=$LFS/sources @@ -61,7 +80,10 @@ $LFS/sources and run: pushd $LFS/sources -md5sum -c md5sums + md5sum -c md5sums popd + This check can be used after retrieving the needed files with any of the + methods listed above. + diff --git a/chapter03/packages.xml b/chapter03/packages.xml index a3846adbe..48b338451 100644 --- a/chapter03/packages.xml +++ b/chapter03/packages.xml @@ -355,7 +355,7 @@ - + ISL (&isl-version;) - &isl-size;: Home page: @@ -459,15 +459,6 @@ - - Linux Firmware (&linux-firmware-version;) - &linux-firmware-size;: - - Home page: - Download: - MD5 sum: &linux-firmware-md5; - - - M4 (&m4-version;) - &m4-size;: @@ -531,15 +522,6 @@ - - Ninja (&ninja-version;) - &ninja-size;: - - Home page: - Download: - MD5 sum: &ninja-md5; - - - Ncurses (&ncurses-version;) - &ncurses-size;: @@ -549,6 +531,15 @@ + + Ninja (&ninja-version;) - &ninja-size;: + + Home page: + Download: + MD5 sum: &ninja-md5; + + + OpenSSL (&openssl-version;) - &openssl-size;: @@ -711,6 +702,14 @@ + + Tcl Documentation (&tcl-version;) - &tcl-docs-size;: + + Download: + MD5 sum: &tcl-docs-md5; + + + Texinfo (&texinfo-version;) - &texinfo-size;: diff --git a/chapter03/patches.xml b/chapter03/patches.xml index c088f8e4b..c3dda33cf 100644 --- a/chapter03/patches.xml +++ b/chapter03/patches.xml @@ -50,24 +50,7 @@ MD5 sum: &coreutils-i18n-patch-md5; - - + Glibc FHS Patch - &glibc-fhs-patch-size;: @@ -75,15 +58,15 @@ MD5 sum: &glibc-fhs-patch-md5; - + Kbd Backspace/Delete Fix Patch - &kbd-backspace-patch-size;: @@ -91,24 +74,7 @@ MD5 sum: &kbd-backspace-patch-md5; - - + Sysvinit Consolidated Patch - &sysvinit-consolidated-patch-size;: @@ -116,15 +82,15 @@ MD5 sum: &sysvinit-consolidated-patch-md5; - + Total size of these patches: about diff --git a/chapter04/aboutlfs.xml b/chapter04/aboutlfs.xml deleted file mode 100644 index 4c828e6ab..000000000 --- a/chapter04/aboutlfs.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - %general-entities; -]> - - - - - About $LFS - - Throughout this book, the environment variable LFS will - be used. It is paramount that this variable is always defined. - It should be set to the mount point chosen for the LFS partition. - Check that the LFS variable is set up properly with: - -echo $LFS - - Make sure the output shows the path to the LFS partition's mount - point, which is /mnt/lfs if the - provided example was followed. If the output is incorrect, the - variable can be set with: - -export LFS=/mnt/lfs - - Having this variable set is beneficial in that commands such as - mkdir $LFS/tools can be typed literally. The shell - will automatically replace $LFS with - /mnt/lfs (or whatever the variable was set to) when it - processes the command line. - - Do not forget to check that $LFS is set whenever - you leave and reenter the current working environment (as when doing a - su to root - or another user). - - - diff --git a/chapter04/aboutsbus.xml b/chapter04/aboutsbus.xml index 68e25cce2..1928423ea 100644 --- a/chapter04/aboutsbus.xml +++ b/chapter04/aboutsbus.xml @@ -20,16 +20,16 @@ used instead. The SBU measure works as follows. The first package to be compiled - from this book is Binutils in . The + from this book is binutils in . The time it takes to compile this package is what will be referred to as the Standard Build Unit or SBU. All other compile times will be expressed relative to this time. For example, consider a package whose compilation time is 4.5 SBUs. This means that if a system took 10 minutes to compile and - install the first pass of Binutils, it will take + install the first pass of binutils, it will take approximately 45 minutes to build this example package. - Fortunately, most build times are shorter than the one for Binutils. + Fortunately, most build times are shorter than the one for binutils. In general, SBUs are not entirely accurate because they depend on many factors, including the host system's version of GCC. They are provided here @@ -41,13 +41,13 @@ compilation time for a package can be reduced by performing a "parallel make" by either setting an environment variable or telling the make program how many processors are available. For - instance, a Core2Duo can support two simultaneous processes with: + instance, an Intel i5-6500 CPU can support four simultaneous processes with: - export MAKEFLAGS='-j 2' + export MAKEFLAGS='-j4' or just building with: - make -j2 + make -j4 When multiple processors are used in this way, the SBU units in the book will vary even more than they normally would. In some cases, the make diff --git a/chapter04/abouttestsuites.xml b/chapter04/abouttestsuites.xml index 1b2e0d68f..9206f33be 100644 --- a/chapter04/abouttestsuites.xml +++ b/chapter04/abouttestsuites.xml @@ -18,25 +18,20 @@ that the package is totally bug free. Some test suites are more important than others. For example, - the test suites for the core toolchain packages—GCC, Binutils, and - Glibc—are of the utmost importance due to their central role in a - properly functioning system. The test suites for GCC and Glibc can + the test suites for the core toolchain packages—GCC, binutils, and + glibc—are of the utmost importance due to their central role in a + properly functioning system. The test suites for GCC and glibc can take a very long time to complete, especially on slower hardware, but are strongly recommended. - Experience has shown that there is little to be gained from running - the test suites in . There can be - no escaping the fact that the host system always exerts some influence on - the tests in that chapter, often causing inexplicable failures. Because - the tools built in are temporary - and eventually discarded, we do not recommend running the test suites in - for the average reader. The - instructions for running those test suites are provided for the benefit of - testers and developers, but they are strictly optional. + Running the test suites in + and + is impossible, since the programs are compiled with a cross-compiler, + so are not supposed to be able to run on the build host. - A common issue with running the test suites for Binutils and GCC + A common issue with running the test suites for binutils and GCC is running out of pseudo terminals (PTYs). This can result in a high number of failing tests. This may happen for several reasons, but the most likely cause is that the host system does not have the diff --git a/chapter04/addinguser.xml b/chapter04/addinguser.xml index a26aa55a2..32272447a 100644 --- a/chapter04/addinguser.xml +++ b/chapter04/addinguser.xml @@ -11,8 +11,8 @@ Adding the LFS User When logged in as user root, - making a single mistake can damage or destroy a system. Therefore, we - recommend building the packages in the next chapter as an unprivileged user. + making a single mistake can damage or destroy a system. Therefore, + the packages in the next two chapters are built as an unprivileged user. You could use your own user name, but to make it easier to set up a clean working environment, create a new user called lfs as a member of a new group (also named @@ -62,7 +62,7 @@ useradd -s /bin/bash -g lfs -m -k /dev/null lfs lfs - This is the actual name for the created group and user. + This is the actual name for the created user. @@ -77,10 +77,16 @@ useradd -s /bin/bash -g lfs -m -k /dev/null lfs passwd lfs Grant lfs full access to - $LFS/tools by making + all directories under $LFS by making lfs the directory owner: -chown -v lfs $LFS/tools +chown -v lfs $LFS/{usr,lib,var,etc,bin,sbin,tools} +case $(uname -m) in + x86_64) chown -v lfs $LFS/lib64 ;; +esac +chown -v lfs $LFS&lib-m32; +chown -v lfs $LFS&lib-mx32; +chown -v lfs $LFS/{lib32,libx32} If a separate working directory was created as suggested, give user lfs ownership of this @@ -95,7 +101,7 @@ useradd -s /bin/bash -g lfs -m -k /dev/null lfs Next, login as user lfs. This can be done via a virtual console, through a display manager, or with - the following substitute user command: + the following substitute/switch user command: su - lfs diff --git a/chapter04/chapter04.xml b/chapter04/chapter04.xml index 3e44ce94f..5ad2d22db 100644 --- a/chapter04/chapter04.xml +++ b/chapter04/chapter04.xml @@ -13,7 +13,7 @@ - + diff --git a/chapter04/creatingminlayout.xml b/chapter04/creatingminlayout.xml new file mode 100644 index 000000000..ddedff391 --- /dev/null +++ b/chapter04/creatingminlayout.xml @@ -0,0 +1,46 @@ + + + %general-entities; +]> + + + + + Creating the Minimal directory layout in LFS filesystem + + The first task performed in the LFS partition is to create a minimal + directory hierarchy so that programs compiled in may be installed in their final + location. This is needed so that those temporary programs be overwritten + when rebuilding them in . + + Create the required directory layout by running the following as + root: + +mkdir -pv $LFS/{usr,lib,var,etc,bin,sbin} +case $(uname -m) in + x86_64) mkdir -pv $LFS/lib64 ;; +esac +mkdir -pv $LFS&lib-m32; +mkdir -pv $LFS&lib-mx32; +mkdir -pv $LFS/lib{,x}32 + + Programs in will be compiled + with a cross-compiler (more details in section ). In order to separate this + cross-compiler from the other programs, it will be installed in a special + directory. Create this directory with: + +mkdir -pv $LFS/tools + + diff --git a/chapter04/creatingtoolsdir.xml b/chapter04/creatingtoolsdir.xml deleted file mode 100644 index 0a42daa70..000000000 --- a/chapter04/creatingtoolsdir.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - %general-entities; -]> - - - - - Creating the $LFS/tools Directory - - All programs compiled in - will be installed under $LFS/tools - to keep them separate from the programs compiled in . The programs compiled here are - temporary tools and will not be a part of the final LFS system. By keeping - these programs in a separate directory, they can easily be discarded later - after their use. This also prevents these programs from ending up in the - host production directories (easy to do by accident in ). - - Create the required directory by running the following as - root: - -mkdir -v $LFS/tools - - The next step is to create a /tools - symlink on the host system. This will point to the newly-created directory on - the LFS partition. Run this command as root as well: - -ln -sv $LFS/tools / - - - 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 both in Chapter 5 - (when we are still using some tools from the host) and in the next (when - we are chrooted to the LFS partition). - - diff --git a/chapter04/introduction.xml b/chapter04/introduction.xml index f1ac91989..c54c67f8c 100644 --- a/chapter04/introduction.xml +++ b/chapter04/introduction.xml @@ -11,7 +11,7 @@ Introduction In this chapter, we will perform a few additional tasks to prepare - for building the temporary system. We will create a directory in + for building the temporary system. We will create a set of directories in $LFS for the installation of the temporary tools, add an unprivileged user to reduce risk, and create an appropriate build environment for that user. We will also diff --git a/chapter04/settingenviron.xml b/chapter04/settingenviron.xml index 3b3c10718..dfaa2dc9b 100644 --- a/chapter04/settingenviron.xml +++ b/chapter04/settingenviron.xml @@ -43,7 +43,9 @@ umask 022 LFS=/mnt/lfs LC_ALL=POSIX LFS_TGT=$(uname -m)-lfs-linux-gnu -PATH=/tools/bin:/bin:/usr/bin +PATH=/usr/bin +if [ ! -L /bin ]; then PATH=/bin:$PATH; fi +PATH=$LFS/tools/bin:$PATH export LFS LC_ALL LFS_TGT PATH EOF cat > ~/.bashrc << "EOF" @@ -54,12 +56,14 @@ LC_ALL=POSIX LFS_TGT=x86_64-lfs-linux-gnu LFS_TGT32=i686-lfs-linux-gnu LFS_TGTX32=x86_64-lfs-linux-gnux32 -PATH=/tools/bin:/bin:/usr/bin +PATH=/usr/bin +if [ ! -L /bin ]; then PATH=/bin:$PATH; fi +PATH=$LFS/tools/bin:$PATH export LFS LC_ALL LFS_TGT LFS_TGT32 LFS_TGTX32 PATH EOF - The meaning of the command line options in <filename>.bashrc</filename> + The meaning of the settings in <filename>.bashrc</filename> set +h @@ -119,14 +123,36 @@ EOF - PATH=/tools/bin:/bin:/usr/bin + PATH=/usr/bin - By putting /tools/bin ahead of the - standard PATH, all the programs installed in are picked up by the shell immediately after - their installation. This, combined with turning off hashing, limits the risk - that old programs are used from the host when the same programs are available in - the Chapter 5 environment. + Many modern linux distributions have merged /bin and /usr/bin. When this is the case, the standard + PATH variable needs just to be set to /usr/bin/ for the environment. When this is not the + case, the following line adds /bin + to the path. + + + + + if [ ! -L /bin ]; then PATH=/bin:$PATH; fi + + If /bin is not a symbolic + link, then it has to be added to the PATH variable. + + + + + PATH=$LFS/tools/bin:$PATH + + By putting $LFS/tools/bin ahead of the + standard PATH, the cross-compiler installed at the beginning + of is picked up by the shell + immediately after its installation. This, combined with turning off hashing, + limits the risk that the compiler from the host be used instead of the + cross-compiler. @@ -134,12 +160,38 @@ EOF export LFS LC_ALL LFS_TGT PATH While the above commands have set some variables, in order - to make them visible within any sub-shells, we export them + to make them visible within any sub-shells, we export them. + + + Several commercial distributions add a non-documented instantiation + of /etc/bash.bashrc to the initialization of + bash. This file has the potential to modify the + lfs + user's environment in ways that can affect the building of critical LFS + packages. To make sure the lfs + user's envronment is clean, check for the + presence of /etc/bash.bashrc and, if present, move it + out of the way. As the root + user, run: + + [ ! -e /etc/bash.bashrc ] || mv -v /etc/bash.bashrc /etc/bash.bashrc.NOUSE + + After use of the lfs + user is finished at the beginning of , you can restore + /etc/bash.bashrc (if desired). + + Note that the LFS Bash package we will build in + is not configured to load or execute + /etc/bash.bashrc, so this file is useless on a + completed LFS system. + + Finally, to have the environment fully prepared for building the temporary tools, source the just-created user profile: diff --git a/chapter05/bash.xml b/chapter05/bash.xml deleted file mode 100644 index 21df197e7..000000000 --- a/chapter05/bash.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - %general-entities; -]> - - - - - - bash - &bash-version; -
&bash-url;
-
- - Bash-&bash-version; - - - Bash - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/bash.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&bash-ch5-sbu;</seg> - <seg>&bash-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Bash - - Prepare Bash for compilation: - -./configure --prefix=/tools --without-bash-malloc - - - The meaning of the configure options: - - - --without-bash-malloc - - This option turns off the use of Bash's memory allocation - (malloc) function which is known to cause - segmentation faults. By turning this option off, Bash will use - the malloc functions from Glibc which are - more stable. - - - - - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Bash test suite anyway, issue the following command: - - -make tests - - Install the package: - -make install - - Make a link for the programs that use sh for - a shell: - -ln -sv bash /tools/bin/sh - - - - - - - <para>Details on this package are located in - <xref linkend="contents-bash" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/binutils-pass1.xml b/chapter05/binutils-pass1.xml index a07ce920d..f2f54c120 100644 --- a/chapter05/binutils-pass1.xml +++ b/chapter05/binutils-pass1.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/binutils.xml" + href="../chapter08/binutils.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> @@ -33,8 +33,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&binutils-ch5p1-sbu;</seg> - <seg>&binutils-ch5p1-du;</seg> + <seg>&binutils-tmpp1-sbu;</seg> + <seg>&binutils-tmpp1-du;</seg> </seglistitem> </segmentedlist> @@ -43,8 +43,9 @@ <sect2 role="installation"> <title>Installation of Cross Binutils - Go back and re-read the notes in the previous section. - Understanding the notes labeled important will save you a lot + Go back and re-read the notes in the section titled . + Understanding the notes labeled important can save you a lot of problems later. It is important that Binutils be the first package compiled @@ -63,43 +64,33 @@ cd build to be of any use, measure the time it takes to build this package from the configuration, up to and including the first install. To achieve this easily, wrap the commands in a time - command like this: time { ./configure ... && ... + command like this: time { ./configure ... && make && make install; }. - The approximate build SBU values and required disk space - in Chapter 5 does not include test suite data. - Now prepare Binutils for compilation: -../configure --prefix=/tools \ +../configure --prefix=$LFS/tools \ --with-sysroot=$LFS \ - --with-lib-path=/tools/lib \ --target=$LFS_TGT \ --disable-nls \ --disable-werror - - lpath=/tools/lib -lpath="$lpath:/tools/lib32" -lpath="$lpath:/tools/libx32" -../configure --prefix=/tools \ - --with-sysroot=$LFS \ - --with-lib-path=$lpath \ - --target=$LFS_TGT \ - --disable-nls \ - --disable-werror \ - --enable-64-bit-bfd \ +../configure --prefix=$LFS/tools \ + --with-sysroot=$LFS \ + --target=$LFS_TGT \ + --disable-nls \ + --disable-werror \ --enable-multilib The meaning of the configure options: - --prefix=/tools + --prefix=$LFS/tools This tells the configure script to prepare to install the - Binutils programs in the /tools - directory. + binutils programs in the $LFS/tools directory. @@ -111,21 +102,13 @@ cd build - - --with-lib-path=/tools/lib - - This specifies which library path the linker should be - configured to use. - - - --target=$LFS_TGT Because the machine description in the LFS_TGT variable is slightly different than the value returned by the config.guess script, this switch will tell the - configure script to adjust Binutil's build system + configure script to adjust binutil's build system for building a cross linker. @@ -146,31 +129,19 @@ cd build + + --enable-multilib + + Enables multilib support. + + + Continue with compiling the package: make - Compilation is now complete. Ordinarily we would now run the - test suite, but at this early stage the test suite framework (Tcl, - Expect, and DejaGNU) is not yet in place. The benefits of running the - tests at this point are minimal since the programs from this - first pass will soon be replaced by those from the second. - - If building on x86_64, create a symlink to ensure the - sanity of the toolchain: - - Create a symlink to ensure the sanity of - the toolchain: - -case $(uname -m) in - x86_64) mkdir -v /tools/lib && ln -sv lib /tools/lib64 ;; -esac - -mkdir -v /tools/lib && -ln -sv lib /tools/lib64 - Install the package: make install diff --git a/chapter05/binutils-pass2.xml b/chapter05/binutils-pass2.xml deleted file mode 100644 index 86204df45..000000000 --- a/chapter05/binutils-pass2.xml +++ /dev/null @@ -1,208 +0,0 @@ - - - %general-entities; -]> - - - - - - binutils-pass2 - &binutils-version; -
&binutils-url;
-
- - Binutils-&binutils-version; - Pass 2 - - - Binutils - tools, pass 2 - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/binutils.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&binutils-ch5p2-sbu;</seg> - <seg>&binutils-ch5p2-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Binutils - - Create a separate build directory again: - -mkdir -v build -cd build - - Prepare Binutils for compilation: - -CC=$LFS_TGT-gcc \ -AR=$LFS_TGT-ar \ -RANLIB=$LFS_TGT-ranlib \ -../configure \ - --prefix=/tools \ - --disable-nls \ - --disable-werror \ - --with-lib-path=/tools/lib \ - --with-sysroot - -lpath=/tools/lib -lpath="$lpath:/tools/lib32" -lpath="$lpath:/tools/libx32" -CC=$LFS_TGT-gcc \ -AR=$LFS_TGT-ar \ -RANLIB=$LFS_TGT-ranlib \ -../configure \ - --prefix=/tools \ - --disable-nls \ - --disable-werror \ - --with-lib-path=$lpath \ - --with-sysroot \ - --enable-64-bit-bfd \ - --enable-multilib - - - The meaning of the new configure options: - - - CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib - - Because this is really a native build of Binutils, setting these - variables ensures that the build system uses the cross-compiler and - associated tools instead of the ones on the host system. - - - - - --with-lib-path=/tools/lib - - This tells the configure script to specify the library - search path during the compilation of Binutils, resulting in - /tools/lib being passed - to the linker. This prevents the linker from searching through - library directories on the host. - - - - - --with-lib-path=/tools/lib:... - - This tells the configure script to specify the library - search path during the compilation of Binutils, resulting in - /tools/lib, - /tools/lib32 and - /tools/libx32 being passed - to the linker. This prevents the linker from searching through - library directories on the host. - - - - - --with-sysroot - - This defines a default (non-existent) sysroot directory - /tools/$LFS_TGT/sys-root. - It is useful when looking for shared objects which are required by - other shared objects explicitly included on the linker's command - line. Those objects are searched into the directories listed in - <sysroot>/etc/ld.so.conf, and failing - that, into the linker search path, which is right. If this switch - is not given, /etc/ld.so.conf on the host - is used, that is, programs may be linked to libraries on - the host, which we want to avoid. - - - - - --enable-64-bit-bfd - - TODO - - - - - --enable-multilib - - TODO - - - - - - Compile the package: - -make - - Install the package: - -make install - - Now prepare the linker for the Re-adjusting phase in - the next chapter: - -make -C ld clean -make -C ld LIB_PATH=/usr/lib:/lib -cp -v ld/ld-new /tools/bin - -make -C ld clean -make -C ld LIB_PATH=/usr/lib:/lib:/usr/lib32:/lib32:/usr/libx32:/libx32 -cp -v ld/ld-new /tools/bin -make -C ld clean -make -C ld LIB_PATH=/usr/lib:/lib:/usr/lib32:/lib32 -cp -v ld/ld-new /tools/bin -make -C ld clean -make -C ld LIB_PATH=/usr/lib:/lib:/usr/libx32:/libx32 -cp -v ld/ld-new /tools/bin - - - The meaning of the make parameters: - - - -C ld clean - - This tells the make program to remove all compiled - files in the ld - subdirectory. - - - - - -C ld LIB_PATH=/usr/lib:/lib - - This option rebuilds everything in the ld subdirectory. Specifying the - LIB_PATH Makefile variable on the command line - allows us to override the default value of the temporary tools - and point it to the proper final path. The value of this variable - specifies the linker's default library search path. This - preparation is used in the next chapter. - - - - - - - - - - - <para>Details on this package are located in - <xref linkend="contents-binutils" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/bzip2.xml b/chapter05/bzip2.xml deleted file mode 100644 index 4f1e3aab9..000000000 --- a/chapter05/bzip2.xml +++ /dev/null @@ -1,91 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-bzip2" role="wrap"> - <?dbhtml filename="bzip2.html"?> - - <sect1info condition="script"> - <productname>bzip2</productname> - <productnumber>&bzip2-version;</productnumber> - <address>&bzip2-url;</address> - </sect1info> - - <title>Bzip2-&bzip2-version; - - - Bzip2 - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/bzip2.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&bzip2-ch5-sbu;</seg> - <seg>&bzip2-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Bzip2 - - The Bzip2 package does not contain a configure - script. There are two Makefile, one for the shared - library, and the other for the static library. Since we need both, We - do the compilation in two stages. First the shared library: - -make -f Makefile-libbz2_so -make clean - - - The meaning of the make parameter: - - - -f Makefile-libbz2_so - - This will cause Bzip2 to be built using a different - Makefile file, in this case the - Makefile-libbz2_so file, which creates a dynamic - libbz2.so library and links - the Bzip2 utilities against it. - - - - - - Compile and test the package with: - -make - - Install the package: - -make PREFIX=/tools install -cp -v bzip2-shared /tools/bin/bzip2 -cp -av libbz2.so* /tools/lib -ln -sv libbz2.so.1.0 /tools/lib/libbz2.so - - - - - - - <para>Details on this package are located in - <xref linkend="contents-bzip2" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/changingowner.xml b/chapter05/changingowner.xml deleted file mode 100644 index 96a15b027..000000000 --- a/chapter05/changingowner.xml +++ /dev/null @@ -1,53 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-changingowner"> - <?dbhtml filename="changingowner.html"?> - - <title>Changing Ownership - - - The commands in the remainder of this book must be performed while - logged in as user root and no - longer as user lfs. Also, double - check that $LFS is set in root's environment. - - - Currently, the $LFS/tools directory - is owned by the user lfs, a user - that exists only on the host system. If the $LFS/tools directory is kept as is, the files are - owned by a user ID without a corresponding account. This is dangerous because - a user account created later could get this same user ID and would own the - $LFS/tools directory and all the files - therein, thus exposing these files to possible malicious manipulation. - - To avoid this issue, you could add the lfs user to the new LFS system later when - creating the /etc/passwd file, taking care to assign it - the same user and group IDs as on the host system. Better yet, change the - ownership of the $LFS/tools directory to - user root by running the following - command: - -chown -R root:root $LFS/tools - - Although the $LFS/tools directory - can be deleted once the LFS system has been finished, it can be retained to build - additional LFS systems of the same book version. How best - to backup $LFS/tools is a matter of - personal preference. - - - If you intend to keep the temporary tools for use in building future LFS - systems, now is the time to back them up. Subsequent - commands in chapter 6 will alter the tools currently in place, rendering them - useless for future builds. - - -
diff --git a/chapter05/chapter05.xml b/chapter05/chapter05.xml index 105ce05a8..467a02a36 100644 --- a/chapter05/chapter05.xml +++ b/chapter05/chapter05.xml @@ -5,48 +5,17 @@ %general-entities; ]> - + - Constructing a Temporary System + Compiling a Cross-Toolchain - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/chapter05/coreutils.xml b/chapter05/coreutils.xml deleted file mode 100644 index 6f56a4108..000000000 --- a/chapter05/coreutils.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - %general-entities; -]> - - - - - - coreutils - &coreutils-version; -
&coreutils-url;
-
- - Coreutils-&coreutils-version; - - - Coreutils - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/coreutils.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&coreutils-ch5-sbu;</seg> - <seg>&coreutils-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Coreutils - - Prepare Coreutils for compilation: - -./configure --prefix=/tools --enable-install-program=hostname - - - The meaning of the configure options: - - - --enable-install-program=hostname - - This enables the hostname binary to be built - and installed – it is disabled by default but is required by the - Perl test suite. - - - - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Coreutils test suite anyway, issue the following command: - -make RUN_EXPENSIVE_TESTS=yes check - - The RUN_EXPENSIVE_TESTS=yes parameter tells the - test suite to run several additional tests that are considered - relatively expensive (in terms of CPU power and memory usage) on some - platforms, but generally are not a problem on Linux. - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-coreutils" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/diffutils.xml b/chapter05/diffutils.xml deleted file mode 100644 index 62ba35874..000000000 --- a/chapter05/diffutils.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-diffutils" role="wrap"> - <?dbhtml filename="diffutils.html"?> - - <sect1info condition="script"> - <productname>diffutils</productname> - <productnumber>&diffutils-version;</productnumber> - <address>&diffutils-url;</address> - </sect1info> - - <title>Diffutils-&diffutils-version; - - - Diffutils - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/diffutils.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&diffutils-ch5-sbu;</seg> - <seg>&diffutils-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Diffutils - - Prepare Diffutils for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Diffutils test suite anyway, issue the following command: - -make check - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-diffutils" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/file.xml b/chapter05/file.xml deleted file mode 100644 index 9fcfd1e6f..000000000 --- a/chapter05/file.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-file" role="wrap"> - <?dbhtml filename="file.html"?> - - <sect1info condition="script"> - <productname>file</productname> - <productnumber>&file-version;</productnumber> - <address>&file-url;</address> - </sect1info> - - <title>File-&file-version; - - - File - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/file.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&file-ch5-sbu;</seg> - <seg>&file-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of File - - Prepare File for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the File test suite anyway, issue the following command: - -make check - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-file" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/findutils.xml b/chapter05/findutils.xml deleted file mode 100644 index 064a9e848..000000000 --- a/chapter05/findutils.xml +++ /dev/null @@ -1,80 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-findutils" role="wrap"> - <?dbhtml filename="findutils.html"?> - - <sect1info condition="script"> - <productname>findutils</productname> - <productnumber>&findutils-version;</productnumber> - <address>&findutils-url;</address> - </sect1info> - - <title>Findutils-&findutils-version; - - - Findutils - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/findutils.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&findutils-ch5-sbu;</seg> - <seg>&findutils-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Findutils - - Prepare Findutils for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Findutils test suite anyway, issue the following command: - -make check - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-findutils" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/flex.xml b/chapter05/flex.xml deleted file mode 100644 index 5e1afa194..000000000 --- a/chapter05/flex.xml +++ /dev/null @@ -1,72 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-flex" role="wrap"> - <?dbhtml filename="flex.html"?> - - <sect1info condition="script"> - <productname>flex</productname> - <productnumber>&flex-version;</productnumber> - <address>&flex-url;</address> - </sect1info> - - <title>Flex-&flex-version; - - - Flex - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/flex.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&flex-ch5-sbu;</seg> - <seg>&flex-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Flex - - Prepare Flex for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-flex" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/gawk.xml b/chapter05/gawk.xml deleted file mode 100644 index adcd2ea15..000000000 --- a/chapter05/gawk.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-gawk" role="wrap"> - <?dbhtml filename="gawk.html"?> - - <sect1info condition="script"> - <productname>gawk</productname> - <productnumber>&gawk-version;</productnumber> - <address>&gawk-url;</address> - </sect1info> - - <title>Gawk-&gawk-version; - - - Gawk - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/gawk.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&gawk-ch5-sbu;</seg> - <seg>&gawk-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Gawk - - Prepare Gawk for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Gawk test suite anyway, issue the following command: - -make check - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-gawk" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml index 0534ee057..ad2ac0d35 100644 --- a/chapter05/gcc-pass1.xml +++ b/chapter05/gcc-pass1.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/gcc.xml" + href="../chapter08/gcc.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> @@ -33,8 +33,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&gcc-ch5p1-sbu;</seg> - <seg>&gcc-ch5p1-du;</seg> + <seg>&gcc-tmpp1-sbu;</seg> + <seg>&gcc-tmpp1-du;</seg> </seglistitem> </segmentedlist> @@ -43,17 +43,11 @@ <sect2 role="installation"> <title>Installation of Cross GCC - GCC now requires the GMP, MPFR, and MPC packages. As - these packages may not be included in your host distribution, they will be - built with GCC. Unpack each package into the GCC source directory and - rename the resulting directories so the GCC build procedures will - automatically use them: - - GCC now requires the GMP, ISL, MPFR, and MPC packages. - As these packages may not be included in your host distribution, they will - be built with GCC. Unpack each package into the GCC source directory and - rename the resulting directories so the GCC build procedures will - automatically use them: + GCC requires the GMP, MPFR and MPC packages. As these packages may + not be included in your host distribution, they will be built with + GCC. Unpack each package into the GCC source directory and rename the + resulting directories so the GCC build procedures will automatically + use them: There are frequent misunderstandings about this chapter. The procedures are the same as every other chapter as explained earlier ( -tar -xf ../mpfr-&mpfr-version;.tar.xz +tar -xf ../mpfr-&mpfr-version;.tar.xz mv -v mpfr-&mpfr-version; mpfr tar -xf ../gmp-&gmp-version;.tar.xz mv -v gmp-&gmp-version; gmp tar -xf ../mpc-&mpc-version;.tar.gz -mv -v mpc-&mpc-version; mpc -tar -xf ../mpfr-&mpfr-version;.tar.xz -mv -v mpfr-&mpfr-version; mpfr -tar -xf ../gmp-&gmp-version;.tar.xz -mv -v gmp-&gmp-version; gmp -tar -xf ../mpc-&mpc-version;.tar.gz -mv -v mpc-&mpc-version; mpc -tar -xf ../isl-&isl-version;.tar.xz +mv -v mpc-&mpc-version; mpc +tar -xf ../isl-&isl-version;.tar.xz mv -v isl-&isl-version; isl - The following command will change the location of GCC's default - dynamic linker to use the one installed in /tools. It also removes /usr/include from GCC's include search path. - Issue: - -for file in gcc/config/{linux,i386/linux{,64}}.h -do - cp -uv $file{,.orig} - sed -e 's@/lib\(64\)\?\(32\)\?\(x32\)\?/ld@/tools&@g' \ - -e 's@/usr@/tools@g' $file.orig > $file - touch $file.orig -done -sed -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/ s;\".*\";\"/tools/lib/\";" \ - -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_2/ s;\".*\";\"\";" \ - -i gcc/gcc.c - - In case the above seems hard to follow, let's break it down a bit. - First we copy the files gcc/config/linux.h, - gcc/config/i386/linux.h, and - gcc/config/i386/linux64.h to a file of - the same name but with an added suffix of .orig. Then the - first sed expression prepends /tools to every instance of - /lib/ld, /lib64/ld or - /lib32/ld, while the second one replaces hard-coded - instances of /usr. Next, we add our define statements which - alter the default startfile prefix to the end of the file. Note that the - trailing / in /tools/lib/ is required. - Finally, we use touch to update the timestamp on the - copied files. When used in conjunction with cp -u, this - prevents unexpected changes to the original files in case the commands are - inadvertently run twice. - - Finally, on x86_64 hosts, set the default directory - name for 64-bit libraries to lib: + On x86_64 hosts, set the default directory name for + 64-bit libraries to lib: case $(uname -m) in x86_64) @@ -119,33 +74,13 @@ sed -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/ s;\".*\";\"/tools/lib/ ;; esac -sed -e '/m64=/s/lib64/lib/' \ - -e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \ - -i.orig gcc/config/i386/t-linux64 + Change the default directory name for + libraries: - - - - - - - - +sed -e '/m64=/s/lib64/lib/' \ + -e '/m32=/s/m32=.*/m32=..\&lib-m32;$(call if_multiarch,:i386-linux-gnu)/' \ + -i.orig gcc/config/i386/t-linux64 + The GCC documentation recommends building GCC in a dedicated build directory: @@ -155,21 +90,17 @@ cd build Prepare GCC for compilation: -mloptions="--disable-multilib" -mloptions="--enable-multilib --with-multilib-list=m64" -mloptions="$mloptions,m32" -mloptions="$mloptions,mx32" -../configure \ +../configure \ --target=$LFS_TGT \ - --prefix=/tools \ + --prefix=$LFS/tools \ --with-glibc-version=2.11 \ --with-sysroot=$LFS \ --with-newlib \ --without-headers \ - --with-local-prefix=/tools \ - --with-native-system-header-dir=/tools/include \ + --enable-initfini-array \ --disable-nls \ --disable-shared \ + --disable-multilib \ --disable-decimal-float \ --disable-threads \ --disable-libatomic \ @@ -178,8 +109,31 @@ cd build --disable-libssp \ --disable-libvtv \ --disable-libstdcxx \ - --enable-languages=c,c++ \ - $mloptions + --enable-languages=c,c++ +mlist=m64,m32mlist=m64,mx32mlist=m64,m32,mx32 +../configure \ + --target=$LFS_TGT \ + --prefix=$LFS/tools \ + --with-glibc-version=2.11 \ + --with-sysroot=$LFS \ + --with-newlib \ + --without-headers \ + --enable-initfini-array \ + --disable-nls \ + --disable-shared \ + --enable-multilib --with-multilib-list=$mlist \ + --disable-decimal-float \ + --disable-threads \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --disable-libstdcxx \ + --enable-languages=c,c++ The meaning of the configure options: @@ -213,26 +167,11 @@ cd build - --with-local-prefix=/tools + --enable-initfini-array - The local prefix is the location in the system that GCC will search - for locally installed include files. The default is /usr/local. - Setting this to /tools helps keep the host location of - /usr/local out of this GCC's search path. - - - - - --with-native-system-header-dir=/tools/include - - By default, GCC searches /usr/include for - system headers. In conjunction with the sysroot switch, this would - normally translate to $LFS/usr/include. However - the headers that will be installed in the next two sections will go - to $LFS/tools/include. This switch ensures that - gcc will find them correctly. In the second pass of GCC, this same - switch will ensure that no headers from the host system are - found. + This switch forces the use of some internal data structures + that are needed but cannot be detected when building a cross + compiler. @@ -240,39 +179,37 @@ cd build --disable-shared This switch forces GCC to link its internal libraries - statically. We do this to avoid possible issues with the host - system. - - - - - --disable-decimal-float, --disable-threads, - --disable-libatomic, --disable-libgomp, - --disable-libquadmath, --disable-libssp, --disable-libvtv, - --disable-libstdcxx - - These switches disable support for the decimal floating point - extension, threading, libatomic, libgomp, libquadmath, libssp, - libvtv, and the C++ standard library respectively. These features - will fail to compile when building a cross-compiler and are not - necessary for the task of cross-compiling the temporary libc. + statically. We need this because the shared libraries require glibc, + which is not yet installed on the target system. --disable-multilib - On x86_64, LFS does not yet support a multilib configuration. + On x86_64, LFS does not support a multilib configuration. This switch is harmless for x86. - - --enable-multilib, - --with-multilib-list=m32,m64,mx32 + --enable-multilib --with-multilib-list=... - LFS now supports a multilib configuration. Enable it for the - 32bit, the 64-bit, and the mixed mode. + LFS canbe used to support multilib. Which they are is + specified in the multilib list. + + + + + --disable-decimal-float, --disable-threads, + --disable-libatomic, --disable-libgomp, + --disable-libquadmath, --disable-libssp, --disable-libvtv, + --disable-libstdcxx + + These switches disable support for the decimal floating point + extension, threading, libatomic, libgomp, libquadmath, libssp, + libvtv, and the C++ standard library respectively. These features + will fail to compile when building a cross-compiler and are not + necessary for the task of cross-compiling the temporary libc. @@ -290,26 +227,25 @@ cd build make - Compilation is now complete. At this point, the test suite would - normally be run, but, as mentioned before, the test suite framework is - not in place yet. The benefits of running the tests at this point - are minimal since the programs from this first pass will soon be - replaced. - Install the package: -make install - + This build of GCC has installed a couple of internal system + headers. Normally one of them, limits.h, would in turn + include the corresponding system limits.h header, in + this case, $LFS/usr/include/limits.h. However, at the + time of this build of GCC $LFS/usr/include/limits.h + does not exist, so the internal header that has just been installed is a + partial, self-contained file and does not include the extended features of + the system header. This is adequate for building glibc, but the full + internal header will be needed later. Create a full version of the internal + header using a command that is identical to what the GCC build system does + in normal circumstances: + +cd .. +cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ + `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h diff --git a/chapter05/gcc-pass2.xml b/chapter05/gcc-pass2.xml deleted file mode 100644 index 8f3c7c879..000000000 --- a/chapter05/gcc-pass2.xml +++ /dev/null @@ -1,267 +0,0 @@ - - - %general-entities; -]> - - - - - - gcc-pass2 - &gcc-version; -
&gcc-url;
-
- - GCC-&gcc-version; - Pass 2 - - - GCC - tools, pass 2 - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/gcc.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&gcc-ch5p2-sbu;</seg> - <seg>&gcc-ch5p2-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of GCC - - As in the first build of GCC, the GMP, MPFR, and MPC packages are - required. Unpack the tarballs and move them into the required directory - names: - As in the first build of GCC, the GMP, MPFR, MPC and ISL packages are - required. Unpack the tarballs and move them into the required directory - names: - -tar -xf ../mpfr-&mpfr-version;.tar.xz -mv -v mpfr-&mpfr-version; mpfr -tar -xf ../gmp-&gmp-version;.tar.xz -mv -v gmp-&gmp-version; gmp -tar -xf ../mpc-&mpc-version;.tar.gz -mv -v mpc-&mpc-version; mpc -tar -xf ../mpfr-&mpfr-version;.tar.xz -mv -v mpfr-&mpfr-version; mpfr -tar -xf ../gmp-&gmp-version;.tar.xz -mv -v gmp-&gmp-version; gmp -tar -xf ../mpc-&mpc-version;.tar.gz -mv -v mpc-&mpc-version; mpc -tar -xf ../isl-&isl-version;.tar.xz -mv -v isl-&isl-version; isl - - Once again, change the location of GCC's default dynamic linker to - use the one installed in /tools. - -for file in gcc/config/{linux,i386/linux{,64}}.h -do - cp -uv $file{,.orig} - sed -e 's@/lib\(64\)\?\(32\)\?\(x32\)\?/ld@/tools&@g' \ - -e 's@/usr@/tools@g' $file.orig > $file - touch $file.orig -done -sed -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/ s;\".*\";\"/tools/lib/\";" \ - -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_2/ s;\".*\";\"\";" \ - -i gcc/gcc.c - - If building on x86_64, change the default directory - name for 64-bit libraries to lib: - -case $(uname -m) in - x86_64) - sed -e '/m64=/s/lib64/lib/' \ - -i.orig gcc/config/i386/t-linux64 - ;; -esac -sed -e '/m64=/s/lib64/lib/' \ - -e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \ - -i.orig gcc/config/i386/t-linux64 - - Our first build of GCC has installed a couple of internal system - headers. Normally one of them, limits.h, will in turn - include the corresponding system limits.h header, in - this case, /tools/include/limits.h. However, at the - time of the first build of gcc /tools/include/limits.h - did not exist, so the internal header that GCC installed is a partial, - self-contained file and does not include the extended features of the - system header. This was adequate for building the temporary libc, but this - build of GCC now requires the full internal header. Create a full version - of the internal header using a command that is identical to what the GCC - build system does in normal circumstances: - -cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ - `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h - - Create a separate build directory again: - -mkdir -v build -cd build - - Before starting to build GCC, remember to unset any environment - variables that override the default optimization flags. - - Now prepare GCC for compilation: - -mloptions="--disable-multilib" -mloptions="--with-system-zlib --enable-multilib --with-multilib-list=m64" -mloptions="$mloptions,m32" -mloptions="$mloptions,mx32" -CC=$LFS_TGT-gcc \ -CXX=$LFS_TGT-g++ \ -AR=$LFS_TGT-ar \ -RANLIB=$LFS_TGT-ranlib \ -../configure \ - --prefix=/tools \ - --with-local-prefix=/tools \ - --with-native-system-header-dir=/tools/include \ - --enable-languages=c,c++ \ - --disable-libstdcxx-pch \ - --disable-bootstrap \ - --disable-libgomp \ - $mloptions - - - The meaning of the new configure options: - - - --enable-languages=c,c++ - - This option ensures that both the C and C++ compilers are - built. - - - - - --disable-libstdcxx-pch - - Do not build the pre-compiled header (PCH) for - libstdc++. It takes up a - lot of space, and we have no use for it. - - - - - --disable-bootstrap - - For native builds of GCC, the default is to do a "bootstrap" - build. This does not just compile GCC, but compiles it several times. - It uses the programs compiled in a first round to compile itself a - second time, and then again a third time. The second and third - iterations are compared to make sure it can reproduce itself - flawlessly. This also implies that it was compiled correctly. - However, the LFS build method should provide a solid compiler - without the need to bootstrap each time. - - - - - - Compile the package: - -make - - Install the package: - -make install - - As a finishing touch, create a symlink. Many programs and scripts - run cc instead of gcc, which is - used to keep programs generic and therefore usable on all kinds of UNIX - systems where the GNU C compiler is not always installed. Running - cc leaves the system administrator free to decide - which C compiler to install: - -ln -sv gcc /tools/bin/cc - - - At this point, it is imperative to stop and ensure that the basic - functions (compiling and linking) of the new toolchain are working as - expected. To perform a sanity check, run the following commands: - -echo 'int main(){}' > dummy.c -cc dummy.c -readelf -l a.out | grep ': /tools' - - If everything is working correctly, there should be no errors, - and the output of the last command will be of the form: - -[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2] - - - Repeat the test for 32-bit: - -cc -m32 dummy.c -readelf -l a.out | grep ': /tools' - - In this case, the output shoud be: - -[Requesting program interpreter: /tools/lib/ld-linux.so.2] - - Repeat the test for x32-bit: - -cc -mx32 dummy.c -readelf -l a.out | grep ': /tools' - - In this case, the output shoud be: - -[Requesting program interpreter: /tools/libx32/ld-linux-x32.so.2] - - Note that the dynamic linker will be - /tools/lib/ld-linux.so.2 for 32-bit machines. - - If the output is not shown as above or there was no output at all, - then something is wrong. Investigate and retrace the steps to find out - where the problem is and correct it. This issue must be resolved before - continuing on. First, perform the sanity check again, using - gcc instead of cc. If this works, - then the /tools/bin/cc symlink is - missing. Install the symlink as per above. - Next, ensure that the PATH is correct. This - can be checked by running echo $PATH and verifying that - /tools/bin is at the head of the - list. If the PATH is wrong it could mean that you are not - logged in as user lfs or that - something went wrong back in - - Once all is well, clean up the test files: - -rm -v dummy.c a.out - - - - - - - - - <para>Details on this package are located in - <xref linkend="contents-gcc" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index 7cf862545..1918ffb26 100644 --- a/chapter05/glibc.xml +++ b/chapter05/glibc.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/glibc.xml" + href="../chapter08/glibc.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> @@ -33,8 +33,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&glibc-ch5-sbu;</seg> - <seg>&glibc-ch5-du;</seg> + <seg>&glibc-tmp-sbu;</seg> + <seg>&glibc-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -43,6 +43,33 @@ <sect2 role="installation"> <title>Installation of Glibc + First, create a symbolic link for LSB compliance. Additionally, + for x86_64, create a compatibility symbolic link required for proper + operation of the dynamic library loader: + +case $(uname -m) in + i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3 + ;; + x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64 + ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3 + ;; +esac + + First, create symbolic links for LSB compliance + and compatibility symbolic links required for proper + operation of the dynamic library loader: + + +ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64 +ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3 + + Some of the Glibc programs use the non-FHS compliant + /var/db directory to store their + runtime data. Apply the following patch to make such programs store their + runtime data in the FHS-compliant locations: + +patch -Np1 -i ../glibc-&glibc-version;-fhs-1.patch + The Glibc documentation recommends building Glibc in a dedicated build directory: @@ -52,18 +79,22 @@ cd build Next, prepare Glibc for compilation: ../configure \ - --prefix=/tools \ + --prefix=/usr \ --host=$LFS_TGT \ --build=$(../scripts/config.guess) \ --enable-kernel=&min-kernel; \ - --with-headers=/tools/include + --with-headers=$LFS/usr/include \ + libc_cv_slibdir=/lib ../configure \ - --prefix=/tools \ + --prefix=/usr \ --host=$LFS_TGT \ --build=$(../scripts/config.guess) \ --enable-kernel=&min-kernel; \ + --with-headers=$LFS/usr/include \ --enable-multi-arch \ - --with-headers=/tools/include + --libdir=/usr/lib \ + --libexecdir=/usr/lib \ + libc_cv_slibdir=/lib @@ -75,8 +106,8 @@ cd build --host=$LFS_TGT, --build=$(../scripts/config.guess) The combined effect of these switches is that Glibc's build system - configures itself to cross-compile, using the cross-linker and - cross-compiler in /tools. + configures itself to be cross-compiled, using the cross-linker and + cross-compiler in $LFS/tools. @@ -89,51 +120,23 @@ cd build - - --enable-multi-arch + + --with-headers=$LFS/usr/include - Enables glibc for multiarch environments. + This tells Glibc to compile itself against the headers + recently installed to the $LFS/usr/include directory, so that + it knows exactly what features the kernel has and can optimize + itself accordingly. - --with-headers=/tools/include + libc_cv_slibdir=/lib - 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 ensures that the library is installed in /lib instead + of the default /lib64 on 64 bit machines. - - @@ -161,216 +164,217 @@ cd build Install the package: -make install + If LFS is not properly set, and despite the + recommendations, you are building as root, the next command will install + the newly built glibc to your host system, which most likely will render it + unusable. So double check that the environment is correctly set for user + lfs. - - At this point, it is imperative to stop and ensure that the basic - functions (compiling and linking) of the new toolchain are working as - expected. To perform a sanity check, run the following commands: +make DESTDIR=$LFS install + + + The meaning of the <command>make install</command> option: + + + DESTDIR=$LFS + + The DESTDIR make variable is used by almost all + packages to define the location where the package should be + installed. If it is not set, it defaults to the root (/) directory. Here we specify that + the package be installed in $LFS + , which will become the root after . + + + + + + + At this point, it is imperative to stop and ensure that the basic + functions (compiling and linking) of the new toolchain are working as + expected. To perform a sanity check, run the following commands: echo 'int main(){}' > dummy.c $LFS_TGT-gcc dummy.c -readelf -l a.out | grep ': /tools' +readelf -l a.out | grep '/ld-linux' - If everything is working correctly, there should be no errors, - and the output of the last command will be of the form: + If everything is working correctly, there should be no errors, + and the output of the last command will be of the form: -[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2] +[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] - Note that for 32-bit machines, the interpreter name will be - /tools/lib/ld-linux.so.2. + Note that for 32-bit machines, the interpreter name will be + /lib/ld-linux.so.2. - If the output is not shown as above or there was no output at all, - then something is wrong. Investigate and retrace the steps to find out - where the problem is and correct it. This issue must be resolved before - continuing on. + If the output is not shown as above or there was no output at all, + then something is wrong. Investigate and retrace the steps to find out + where the problem is and correct it. This issue must be resolved before + continuing on. - Once all is well, clean up the test files: + Once all is well, clean up the test files: rm -v dummy.c a.out - + - Building Binutils in the section after next will serve as an - additional check that the toolchain has been built properly. If Binutils - fails to build, it is an indication that something has gone wrong with the - previous Binutils, GCC, or Glibc installations. + Building packages in the next chapter will serve as an + additional check that the toolchain has been built properly. If some + package, especially binutils-pass2 or gcc-pass2, fails to build, it is + an indication that something has gone wrong with the + previous Binutils, GCC, or Glibc installations. + + Now that our cross-toolchain is complete, finalize the installation + of the limits.h header. For doing so, run a utility provided by the GCC + developers: + +$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders - - Installation of Glibc 32-bit + + + + + Building Glibc - 32bit - Clean the build directory for redoing glibc for 32-bit: -mkdir ../build32 -cd ../build32 + Now recompile for m32. The extracted source can be + reused but needs to cleaned before installing the m32 + version of Glibc. - Rebuild glibc for 32-bit: -echo slibdir=/tools/lib32 > configparms -BUILD_CC="gcc -m32" \ -CC="${LFS_TGT}-gcc -m32" \ -CXX="${LFS_TGT}-g++ -m32" \ -AR="${LFS_TGT}-ar" \ -RANLIB="${LFS_TGT}-ranlib" \ -../configure --prefix=/tools \ - --build=$(../scripts/config.guess) \ - --host=${LFS_TGT32} \ - --enable-kernel=&min-kernel; \ - --with-headers=/tools/include \ - --with-binutils=/tools/bin \ - --enable-multi-arch \ - --libdir=/tools/lib32 \ - --libexecdir=/tools/lib32 - + Clear the build directory and remove artefacts from + previous build: + +make clean +find .. -name "*.a" -delete - - The meaning of the extra configure options: + Configure Glibc for m32 with the following commands: - - --enable-multi-arch - - Enables glibc for multiarch environments. - - +CC="$LFS_TGT-gcc -m32" \ +CXX="$LFS_TGT-g++ -m32" \ +../configure \ + --prefix=/usr \ + --host=$LFS_TGT32 \ + --build=$(../scripts/config.guess) \ + --enable-kernel=&min-kernel; \ + --with-headers=$LFS/usr/include \ + --enable-multi-arch \ + --libdir=&usr-lib-m32; \ + --libexecdir=&usr-lib-m32; \ + libc_cv_slibdir=&lib-m32; - - --libdir=/tools/lib32, --libexecdir=/tools/lib32 - - Overrides location for installing 32-bit files. - - + Compile the package: - - --with-binutils=/tools/bin - - This tells Glibc to compile itself against the utilities - found within our "tools" heirachy, because otherwise... - - - - - - Now compile the 32-bit version of glibc: make - Install 32-bit version of glibc: -make install_root="${PWD}/DESTDIR" install -install -vdm755 /tools/lib32 -cp -Rv DESTDIR/tools/lib32/* /tools/lib32 -install -vm644 DESTDIR/tools/include/gnu/{lib-names,stubs}-32.h \ - /tools/include/gnu/ -ln -svf /tools/lib32/ld-linux.so.2 /tools/lib/ + Install the package: - +make DESTDIR=$PWD/DESTDIR install +cp -a DESTDIR&lib-m32;/* $LFS&lib-m32;/ +cp -a DESTDIR&usr-lib-m32; $LFS/usr/ +install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \ + $LFS/usr/include/gnu/ +ln -svf ..&lib-m32;/ld-linux.so.2 $LFS/lib/ld-linux.so.2 - - Installation of Glibc x32-bit - - Create a build directory for redoing glibc for x32-bit: -mkdir ../build32x -cd ../build32x - - Rebuild glibc for x32-bit: -echo slibdir=/tools/libx32 > configparms -BUILD_CC="gcc -mx32" \ -CC="${LFS_TGT}-gcc -mx32" \ -CXX="${LFS_TGT}-g++ -mx32" \ -AR="${LFS_TGT}-ar" \ -RANLIB="${LFS_TGT}-ranlib" \ -../configure --prefix=/tools \ - --build=$(../scripts/config.guess) \ - --host=${LFS_TGTX32} \ - --enable-kernel=&min-kernel; \ - --with-headers=/tools/include \ - --with-binutils=/tools/bin \ - --enable-multi-arch \ - --libdir=/tools/libx32 \ - --libexecdir=/tools/libx32 - - - - The meaning of the extra configure options: - - - --enable-multi-arch - - Enables glibc for multiarch environments. - - - - - --libdir=/tools/libx32, --libexecdir=/tools/libx32 - - Overrides location for installing x32-bit files. - - - - - --with-binutils=/tools/bin - - This tells Glibc to compile itself against the utilities - found within our "tools" heirachy, because otherwise... - - - - - - Now compile the x32-bit version of glibc: -make - - Install x32-bit version of glibc: -make install_root="${PWD}/DESTDIR" install -install -vdm755 /tools/libx32 -cp -Rv DESTDIR/tools/libx32/* /tools/libx32 -install -vm644 DESTDIR/tools/include/gnu/lib-names-x32.h \ - /tools/include/gnu/ -[ -e DESTDIR/tools/include/gnu/stubs-x32.h ] \ - && install -vm644 DESTDIR/tools/include/gnu/stubs-x32.h /tools/include/gnu/ \ - || ln -v /tools/include/gnu/stubs-64.h /tools/include/gnu/stubs-x32.h -ln -svf /tools/libx32/ld-linux-x32.so.2 /tools/lib/ - - - - At this point, it is imperative to stop and ensure that the basic - functions (compiling and linking) of the new toolchain are working as - expected. To perform a sanity check, run the following commands: + + At this point, it is imperative to stop and ensure that the basic + functions (compiling and linking) of the new toolchain are working as + expected. To perform a sanity check, run the following commands: echo 'int main(){}' > dummy.c $LFS_TGT-gcc -m32 dummy.c -readelf -l a.out | grep ': /tools' +readelf -l a.out | grep '/ld-linux' - If everything is working correctly, there should be no errors, - and the output of the last command will be of the form: + If everything is working correctly, there should be no errors, + and the output of the last command will be of the form: -[Requesting program interpreter: /tools/lib/ld-linux.so.2] +[Requesting program interpreter: /lib/ld-linux.so.2] - Redo test for x32-ABI: + If the output is not shown as above or there was no output at all, + then something is wrong. Investigate and retrace the steps to find out + where the problem is and correct it. This issue must be resolved before + continuing on. -echo 'int main(){}' > dummy.c -$LFS_TGT-gcc -mx32 dummy.c -readelf -l a.out | grep ': /tools' - - Output should be like: - -[Requesting program interpreter: /tools/libx32/ld-linux-x32.so.2] - - If the output is not shown as above or there was no output at all, - then something is wrong. Investigate and retrace the steps to find out - where the problem is and correct it. This issue must be resolved before - continuing on. - - Once all is well, clean up the test files: + Once all is well, clean up the test files: rm -v dummy.c a.out - - + + + + + + + + + Building Glibc - x32bit + + Now recompile for mx32. The extracted source can be + reused but needs to cleaned before installing the mx32 + version of Glibc. + + Clear the build directory and remove artefacts from + previous build: + +make clean +find .. -name "*.a" -delete + + Configure Glibc for mx32 with the following commands: + +CC="$LFS_TGT-gcc -mx32" \ +CXX="$LFS_TGT-g++ -mx32" \ +../configure \ + --prefix=/usr \ + --host=$LFS_TGTX32 \ + --build=$(../scripts/config.guess) \ + --enable-kernel=&min-kernel; \ + --with-headers=$LFS/usr/include \ + --enable-multi-arch \ + --libdir=&usr-lib-mx32; \ + --libexecdir=&usr-lib-mx32; \ + libc_cv_slibdir=&lib-mx32; + + Compile the package: + +make + + Install the package: + +make DESTDIR=$PWD/DESTDIR install +cp -a DESTDIR&lib-mx32;/* $LFS&lib-mx32;/ +cp -a DESTDIR&usr-lib-mx32; $LFS/usr/ +install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \ + $LFS/usr/include/gnu/ +ln -svf ..&lib-mx32;/ld-linux-x32.so.2 $LFS/lib/ld-linux-x32.so.2 + + + At this point, it is imperative to stop and ensure that the basic + functions (compiling and linking) of the new toolchain are working as + expected. To perform a sanity check, run the following commands: + +echo 'int main(){}' > dummy.c +$LFS_TGT-gcc -mx32 dummy.c +readelf -l a.out | grep '/ld-linux-x32' + + If everything is working correctly, there should be no errors, + and the output of the last command will be of the form: + +[Requesting program interpreter: /lib/ld-linux-x32.so.2] + + If the output is not shown as above or there was no output at all, + then something is wrong. Investigate and retrace the steps to find out + where the problem is and correct it. This issue must be resolved before + continuing on. + + Once all is well, clean up the test files: + +rm -v dummy.c a.out + + + + + diff --git a/chapter05/grep.xml b/chapter05/grep.xml deleted file mode 100644 index 2be213b6f..000000000 --- a/chapter05/grep.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-grep" role="wrap"> - <?dbhtml filename="grep.html"?> - - <sect1info condition="script"> - <productname>grep</productname> - <productnumber>&grep-version;</productnumber> - <address>&grep-url;</address> - </sect1info> - - <title>Grep-&grep-version; - - - Grep - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/grep.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&grep-ch5-sbu;</seg> - <seg>&grep-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Grep - - Prepare Grep for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Grep test suite anyway, issue the following command: - -make check - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-grep" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/gzip.xml b/chapter05/gzip.xml deleted file mode 100644 index 44b25faf7..000000000 --- a/chapter05/gzip.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-gzip" role="wrap"> - <?dbhtml filename="gzip.html"?> - - <sect1info condition="script"> - <productname>gzip</productname> - <productnumber>&gzip-version;</productnumber> - <address>&gzip-url;</address> - </sect1info> - - <title>Gzip-&gzip-version; - - - Gzip - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/gzip.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&gzip-ch5-sbu;</seg> - <seg>&gzip-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Gzip - - Prepare Gzip for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Gzip test suite anyway, issue the following command: - -make check - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-gzip" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/introduction.xml b/chapter05/introduction.xml index 33a566877..0318acf8b 100644 --- a/chapter05/introduction.xml +++ b/chapter05/introduction.xml @@ -10,20 +10,14 @@ <title>Introduction - This chapter shows how to build a minimal Linux system. - This system will contain just enough tools to start constructing the final - LFS system in and allow a working - environment with more user convenience than a minimum environment would. + This chapter shows how to build a cross-compiler and its associated + tools. Although here cross-compilation is faked, the principles are + the same as for a real cross-toolchain. - There are two steps in building this minimal system. The first step - is to build a new and host-independent toolchain (compiler, assembler, - linker, libraries, and a few useful utilities). The second step uses this - toolchain to build the other essential tools. - - The files compiled in this chapter will be installed under the + The programs compiled in this chapter will be installed under the $LFS/tools directory to keep them - separate from the files installed in the next chapter and the host - production directories. Since the packages compiled here are temporary, - we do not want them to pollute the soon-to-be LFS system. + separate from the files installed in the following chapters. The libraries, + on the other hand, are installed into their final place, since they pertain + to the system we want to build.
diff --git a/chapter05/libstdc++.xml b/chapter05/libstdc++.xml index 66128aa8a..f17f9db89 100644 --- a/chapter05/libstdc++.xml +++ b/chapter05/libstdc++.xml @@ -5,8 +5,8 @@ %general-entities; ]> - - + + gcc-libstdc++ @@ -14,11 +14,11 @@
&gcc-url;
- Libstdc++ from GCC-&gcc-version; + Libstdc++ from GCC-&gcc-version;, Pass 1 - + GCC - tools, libstdc++ + tools, libstdc++ pass 1 @@ -28,7 +28,8 @@ to compile C++ code (part of GCC is written in C++), but we had to defer its installation when we built - because it depends on glibc, which was not yet available in /tools. + because it depends on glibc, which was not yet available in the target + directory. @@ -36,8 +37,8 @@ &diskspace; - &libstdcpp-ch5-sbu; - &libstdcpp-ch5-du; + &libstdcpp-tmpp1-sbu; + &libstdcpp-tmpp1-du; @@ -52,19 +53,19 @@ gcc-&gcc-version; directory. - Create a separate build directory for Libstdc++ and enter it: + Create a separate build directory for libstdc++ and enter it: mkdir -v build cd build - Prepare Libstdc++ for compilation: + Prepare libstdc++ for compilation: ../libstdc++-v3/configure \ --host=$LFS_TGT \ - --prefix=/tools \ + --build=$(../config.guess) \ + --prefix=/usr \ --disable-multilib \ - --disable-nls \ + --disable-nls \ --disable-libstdcxx-pch \ --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version; @@ -74,19 +75,21 @@ cd build --host=... - Indicates to use the cross compiler we have just built + Specifies the use the cross compiler we have just built instead of the one in /usr/bin. - + --disable-libstdcxx-pch @@ -98,9 +101,9 @@ cd build --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version; - This is the location where the standard include files are - searched by the C++ compiler. In a normal build, this information - is automatically passed to the Libstdc++ configure + This is the location where the C++ compiler should search for the + standard include files. In a normal build, this information + is automatically passed to the libstdc++ configure options from the top level directory. In our case, this information must be explicitly given. @@ -114,7 +117,7 @@ cd build Install the library: -make install +make DESTDIR=$LFS install diff --git a/chapter05/linux-headers.xml b/chapter05/linux-headers.xml index 7a92b466f..213fe7dc3 100644 --- a/chapter05/linux-headers.xml +++ b/chapter05/linux-headers.xml @@ -24,17 +24,16 @@ - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/linux-headers.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + <para>The Linux API Headers (in linux-&linux-version;.tar.xz) expose the + kernel's API for use by Glibc.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&linux-headers-ch5-sbu;</seg> - <seg>&linux-headers-ch5-du;</seg> + <seg>&linux-headers-tmp-sbu;</seg> + <seg>&linux-headers-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -60,15 +59,148 @@ location.</para> <screen><userinput remap="make">make headers -</userinput><userinput remap="install">cp -rv usr/include/* /tools/include</userinput></screen> +find usr/include -name '.*' -delete +rm usr/include/Makefile +</userinput><userinput remap="install">cp -rv usr/include $LFS/usr</userinput></screen> </sect2> - <sect2 role="content"> - <title/> + <sect2 id="contents-linux-headers" role="content"> + <title>Contents of Linux API Headers - Details on this package are located in - + + Installed headers + Installed directories + + + /usr/include/asm/*.h, /usr/include/asm-generic/*.h, + /usr/include/drm/*.h, /usr/include/linux/*.h, /usr/include/misc/*.h, + /usr/include/mtd/*.h, /usr/include/rdma/*.h, /usr/include/scsi/*.h, + /usr/include/sound/*.h, /usr/include/video/*.h, + and /usr/include/xen/*.h + /usr/include/asm, /usr/include/asm-generic, /usr/include/drm, + /usr/include/linux, /usr/include/misc, /usr/include/mtd, + /usr/include/rdma, /usr/include/scsi, /usr/include/sound, + /usr/include/video, and /usr/include/xen + + + + + Short Descriptions + + + + + /usr/include/asm/*.h + + The Linux API ASM Headers + + /usr/include/asm/*.h + + + + + + /usr/include/asm-generic/*.h + + The Linux API ASM Generic Headers + + /usr/include/asm-generic/*.h + + + + + + /usr/include/drm/*.h + + The Linux API DRM Headers + + /usr/include/drm/*.h + + + + + + /usr/include/linux/*.h + + The Linux API Linux Headers + + /usr/include/linux/*.h + + + + + + /usr/include/misc/*.h + + The Linux API Miscellaneous Headers + + /usr/include/misc/*.h + + + + + + /usr/include/mtd/*.h + + The Linux API MTD Headers + + /usr/include/mtd/*.h + + + + + + /usr/include/rdma/*.h + + The Linux API RDMA Headers + + /usr/include/rdma/*.h + + + + + + /usr/include/scsi/*.h + + The Linux API SCSI Headers + + /usr/include/scsi/*.h + + + + + + /usr/include/sound/*.h + + The Linux API Sound Headers + + /usr/include/sound/*.h + + + + + + /usr/include/video/*.h + + The Linux API Video Headers + + /usr/include/video/*.h + + + + + + /usr/include/xen/*.h + + The Linux API Xen Headers + + /usr/include/xen/*.h + + + + + diff --git a/chapter05/m4.xml b/chapter05/m4.xml deleted file mode 100644 index 0dcc6b774..000000000 --- a/chapter05/m4.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - %general-entities; -]> - - - - - - m4 - &m4-version; -
&m4-url;
-
- - M4-&m4-version; - - - M4 - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/m4.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&m4-ch5-sbu;</seg> - <seg>&m4-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of M4 - - First, make some fixes introduced by glibc-2.28: - -sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c -echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h - - Prepare M4 for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the M4 test suite anyway, issue the following command: - -make check - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-m4" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/ncurses.xml b/chapter05/ncurses.xml deleted file mode 100644 index 9aead2c56..000000000 --- a/chapter05/ncurses.xml +++ /dev/null @@ -1,177 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-ncurses" role="wrap"> - <?dbhtml filename="ncurses.html"?> - - <sect1info condition="script"> - <productname>ncurses</productname> - <productnumber>&ncurses-version;</productnumber> - <address>&ncurses-url;</address> - </sect1info> - - <title>Ncurses-&ncurses-version; - - - Ncurses - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/ncurses.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&ncurses-ch5-sbu;</seg> - <seg>&ncurses-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Ncurses - - First, ensure that gawk is found first during configuration: - -sed -i s/mawk// configure - - Prepare Ncurses for compilation: - -./configure --prefix=/tools \ - --with-shared \ - --without-debug \ - --without-ada \ - --enable-widec \ - --enable-overwrite - - - The meaning of the configure options: - - - --without-ada - - This ensures that Ncurses does not build support for the Ada - compiler which may be present on the host but will not be available - once we enter the chroot environment. - - - - - --enable-overwrite - - This tells Ncurses to install its header files into - /tools/include, instead of - /tools/include/ncurses, to - ensure that other packages can find the Ncurses headers - successfully. - - - - - --enable-widec - - This switch causes wide-character libraries (e.g., libncursesw.so.&ncurses-version;) - to be built instead of normal ones (e.g., libncurses.so.&ncurses-version;). - These wide-character libraries are usable in both multibyte and - traditional 8-bit locales, while normal libraries work properly - only in 8-bit locales. Wide-character and normal libraries are - source-compatible, but not binary-compatible. - - - - - - Compile the package: - -make - - This package has a test suite, but it can only be run after the - package has been installed. The tests reside in the - test/ directory. See the - README file in that directory for further details. - - - Install the package: - -make install -ln -s libncursesw.so /tools/lib/libncurses.so - - - - - Installation of Ncurses - 32 bit - - Prepare Ncurses for compilation: - -make distclean && -CC="${LFS_TGT}-gcc -m32" \ -./configure --prefix=/tools \ - --libdir=/tools/lib32 \ - --with-shared \ - --without-debug \ - --without-ada \ - --enable-widec \ - --enable-overwrite \ - --host="${LFS_TGT32}" - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make DESTDIR=$PWD/DESTDIR_32 install && -cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32 - - - - - Installation of Ncurses - x32 bit - - Repeat for the x32-ABI: - -make distclean && -CC="${LFS_TGT}-gcc -mx32" \ -./configure --prefix=/tools \ - --libdir=/tools/libx32 \ - --with-shared \ - --without-debug \ - --without-ada \ - --enable-widec \ - --enable-overwrite \ - --host="${LFS_TGTX32}" - -make - -make DESTDIR=$PWD/DESTDIR_x32 install && -cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32 - - - - - - - <para>Details on this package are located in - <xref linkend="contents-ncurses" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/patch.xml b/chapter05/patch.xml deleted file mode 100644 index 15049bbe5..000000000 --- a/chapter05/patch.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-patch" role="wrap"> - <?dbhtml filename="patch.html"?> - - <sect1info condition="script"> - <productname>patch</productname> - <productnumber>&patch-version;</productnumber> - <address>&patch-url;</address> - </sect1info> - - <title>Patch-&patch-version; - - - Patch - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/patch.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&patch-ch5-sbu;</seg> - <seg>&patch-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Patch - - Prepare Patch for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Patch test suite anyway, issue the following command: - -make check - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-patch" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/sed.xml b/chapter05/sed.xml deleted file mode 100644 index 9a945e772..000000000 --- a/chapter05/sed.xml +++ /dev/null @@ -1,74 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-sed" role="wrap"> - <?dbhtml filename="sed.html"?> - - <sect1info condition="script"> - <productname>sed</productname> - <productnumber>&sed-version;</productnumber> - <address>&sed-url;</address> - </sect1info> - - <title>Sed-&sed-version; - - - Sed - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/sed.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&sed-ch5-sbu;</seg> - <seg>&sed-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Sed - - Prepare Sed for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Sed test suite anyway, issue the following command: - -make check - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-sed" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/stripping.xml b/chapter05/stripping.xml deleted file mode 100644 index 354426161..000000000 --- a/chapter05/stripping.xml +++ /dev/null @@ -1,57 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-stripping"> - <?dbhtml filename="stripping.html"?> - - <title>Stripping - - The steps in this section are optional, but if the LFS partition is - rather small, it is beneficial to learn that unnecessary items can be removed. - The executables and libraries built so far contain about 70 MB of unneeded - debugging symbols. Remove those symbols with: - -strip --strip-debug /tools/lib/* -/usr/bin/strip --strip-unneeded /tools/{,s}bin/* - -strip --strip-debug /tools/lib{,32}/* -/usr/bin/strip --strip-unneeded /tools/{,s}bin/* -strip --strip-debug /tools/lib{,x32}/* -/usr/bin/strip --strip-unneeded /tools/{,s}bin/* -strip --strip-debug /tools/lib{,{,x}32}/* -/usr/bin/strip --strip-unneeded /tools/{,s}bin/* - - These commands will skip a number of files, reporting that it does not - recognize their file format. Most of these are scripts instead of binaries. - Also use the system strip command to include the strip binary in /tools. - - Take care not to use - --strip-unneeded on the libraries. The static - ones would be destroyed and the toolchain packages would need to be - built all over again. - - To save more, remove the documentation: - -rm -rf /tools/{,share}/{info,man,doc} - - The libtool .la files are only useful when linking with static - libraries. They are unneeded, and potentially harmful, when using dynamic - shared libraries, specially when using also non-autotools build systems. - Remove those files now: - -find /tools/{lib,libexec} -name \*.la -delete - -find /tools/{lib{,32},libexec} -name \*.la -delete -find /tools/{lib{,x32},libexec} -name \*.la -delete -find /tools/{lib{,{,x}32},libexec} -name \*.la -delete - - At this point, you should have at least 3 GB of free space in - $LFS that can be used to build and install Glibc and Gcc in - the next phase. If you can build and install Glibc, you can build and install - the rest too. - -
diff --git a/chapter05/tar.xml b/chapter05/tar.xml deleted file mode 100644 index 002dc228f..000000000 --- a/chapter05/tar.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - %general-entities; -]> - - - - - - tar - &tar-version; -
&tar-url;
-
- - Tar-&tar-version; - - - Tar - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/tar.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&tar-ch5-sbu;</seg> - <seg>&tar-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Tar - - Prepare Tar for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Tar test suite anyway, issue the following command: - -make check - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-tar" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/toolchaintechnotes.xml b/chapter05/toolchaintechnotes.xml deleted file mode 100644 index e0ab899eb..000000000 --- a/chapter05/toolchaintechnotes.xml +++ /dev/null @@ -1,166 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-toolchaintechnotes"> - <?dbhtml filename="toolchaintechnotes.html"?> - - <title>Toolchain Technical Notes - - This section explains some of the rationale and technical details - behind the overall build method. It is not essential to immediately - understand everything in this section. Most of this information will be - clearer after performing an actual build. This section can be referred - to at any time during the process. - - The overall goal of is to - produce a temporary area that contains a known-good set of tools that can be - isolated from the host system. By using chroot, the - commands in the remaining chapters will be contained within that environment, - ensuring a clean, trouble-free build of the target LFS system. The build - process has been designed to minimize the risks for new readers and to provide - the most educational value at the same time. - - - Before continuing, be aware of the name of the working platform, - often referred to as the target triplet. A simple way to determine the - name of the target triplet is to run the config.guess - script that comes with the source for many packages. Unpack the Binutils - sources and run the script: ./config.guess and note - the output. For example, for a 32-bit Intel processor the - output will be i686-pc-linux-gnu. On a 64-bit - system it will be x86_64-pc-linux-gnu. - - Also be aware of the name of the platform's dynamic linker, often - referred to as the dynamic loader (not to be confused with the standard - linker ld that is part of Binutils). The dynamic linker - provided by Glibc finds and loads the shared libraries needed by a program, - prepares the program to run, and then runs it. The name of the dynamic - linker for a 32-bit Intel machine will be ld-linux.so.2 (ld-linux-x86-64.so.2 for 64-bit systems). A - sure-fire way to determine the name of the dynamic linker is to inspect a - random binary from the host system by running: readelf -l - <name of binary> | grep interpreter and noting the - output. The authoritative reference covering all platforms is in the - shlib-versions file in the root of the Glibc source - tree. - - - Some key technical points of how the build method works: - - - - Slightly adjusting the name of the working platform, by changing the - "vendor" field target triplet by way of the - LFS_TGT variable, ensures that the first build of Binutils - and GCC produces a compatible cross-linker and cross-compiler. Instead of - producing binaries for another architecture, the cross-linker and - cross-compiler will produce binaries compatible with the current - hardware. - - - The temporary libraries are cross-compiled. Because a - cross-compiler by its nature cannot rely on anything from its host - system, this method removes potential contamination of the target - system by lessening the chance of headers or libraries from the host - being incorporated into the new tools. Cross-compilation also allows for - the possibility of building both 32-bit and 64-bit libraries on 64-bit - capable hardware. - - - Careful manipulation of the GCC source tells the compiler which target - dynamic linker will be used. - - - - Binutils is installed first because the configure - runs of both GCC and Glibc perform various feature tests on the assembler - and linker to determine which software features to enable or disable. This - is more important than one might first realize. An incorrectly configured - GCC or Glibc can result in a subtly broken toolchain, where the impact of - such breakage might not show up until near the end of the build of an - entire distribution. A test suite failure will usually highlight this error - before too much additional work is performed. - - Binutils installs its assembler and linker in two locations, - /tools/bin and /tools/$LFS_TGT/bin. The tools in one - location are hard linked to the other. An important facet of the linker is - its library search order. Detailed information can be obtained from - ld by passing it the --verbose - flag. For example, an ld --verbose | grep SEARCH - will illustrate the current search paths and their order. It shows which - files are linked by ld by compiling a dummy program and - passing the --verbose switch to the linker. For example, - gcc dummy.c -Wl,--verbose 2>&1 | grep succeeded - will show all the files successfully opened during the linking. - - The next package installed is GCC. An example of what can be - seen during its run of configure is: - -checking what assembler to use... /tools/i686-lfs-linux-gnu/bin/as -checking what linker to use... /tools/i686-lfs-linux-gnu/bin/ld - - This is important for the reasons mentioned above. It also demonstrates - that GCC's configure script does not search the PATH directories to find which - tools to use. However, during the actual operation of gcc - itself, the same search paths are not necessarily used. To find out which - standard linker gcc will use, run: - gcc -print-prog-name=ld. - - Detailed information can be obtained from gcc by - passing it the -v command line option while compiling - a dummy program. For example, gcc -v dummy.c will show - detailed information about the preprocessor, compilation, and assembly stages, - including gcc's included search paths and their order. - - Next installed are sanitized Linux API headers. These allow the standard - C library (Glibc) to interface with features that the Linux kernel will - provide. - - The next package installed is Glibc. The most important considerations - for building Glibc are the compiler, binary tools, and kernel headers. The - compiler is generally not an issue since Glibc will always use the compiler - relating to the --host parameter passed to its - configure script; e.g. in our case, the compiler will be - i686-lfs-linux-gnu-gcc. The binary tools and kernel - headers can be a bit more complicated. Therefore, take no risks and use the - available configure switches to enforce the correct selections. After the run - of configure, check the contents of the - config.make file in the glibc-build directory for all important details. - Note the use of CC="i686-lfs-gnu-gcc" to control which - binary tools are used and the use of the -nostdinc and - -isystem flags to control the compiler's include - search path. These items highlight an important aspect of the Glibc - package—it is very self-sufficient in terms of its build machinery and - generally does not rely on toolchain defaults. - - During the second pass of Binutils, we are able to utilize the - --with-lib-path configure switch to control - ld's library search path. - - For the second pass of GCC, its sources also need to be modified to - tell GCC to use the new dynamic linker. Failure to do so will result in the - GCC programs themselves having the name of the dynamic linker from the host - system's /lib directory embedded into - them, which would defeat the goal of getting away from the host. From this - point onwards, the core toolchain is self-contained and self-hosted. The - remainder of the packages all build - against the new Glibc in /tools. - - Upon entering the chroot environment in , the first major package to be - installed is Glibc, due to its self-sufficient nature mentioned above. - Once this Glibc is installed into /usr, we will perform a quick changeover of the - toolchain defaults, and then proceed in building the rest of the target - LFS system. - -
diff --git a/chapter05/util-linux.xml b/chapter05/util-linux.xml deleted file mode 100644 index 3ba23638f..000000000 --- a/chapter05/util-linux.xml +++ /dev/null @@ -1,180 +0,0 @@ - - - %general-entities; -]> - - - - - - util-linux - &util-linux-version; -
&util-linux-url;
-
- - Util-linux-&util-linux-version; - - - Util-linux - tools - - - - - - <para>The Util-linux package contains miscellaneous utility programs.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&util-linux-ch5-sbu;</seg> - <seg>&util-linux-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Util-linux - - Prepare Util-linux for compilation: - -./configure --prefix=/tools \ - --without-python \ - --disable-makeinstall-chown \ - --without-systemdsystemunitdir \ - --without-ncurses \ - PKG_CONFIG="" - - - The meaning of the configure option: - - - --without-python - - This switch disables using Python - if it is installed on the host system. It avoids trying to build - unneeded bindings. - - - - - --disable-makeinstall-chown - - This switch disables using the chown command - during installation. This is not needed when installing into the - /tools directory and avoids the necessity of installing as - root. - - - - - --without-ncurses - - This switch disables using the ncurses library for - the build process. This is not needed when installing into the - /tools directory and avoids problems on some host distros. - - - - - --without-systemdsystemunitdir - - On systems that use systemd, the package tries to install - a systemd specific file to a non-existent directory in /tools. - This switch disables the unnecessary action. - - - - - PKG_CONFIG="" - - Setting this environment variable prevents adding unneeded - features that may be available on the host. Note that the location - shown for setting this environment variable is different from other - LFS sections where variables are set preceding the command. This - location is shown to demonstrate an alternative way of setting an - environment variable when using configure. - - - - - Compile the package: - -make - - Install the package: - -make install - - - - - - - <para>Details on this package are located in - <xref linkend="contents-utillinux" role="."/></para> - - </sect2> - - <sect2 arch="ml_32,ml_all" role="installation"> - <title>Installation of Util-Linux - 32 bit - - Prepare Util-Linux for compilation: - -make distclean && -CC="${LFS_TGT}-gcc -m32" \ -./configure \ - --prefix=/tools \ - --libdir=/tools/lib32 \ - --without-python \ - --disable-makeinstall-chown \ - --without-systemdsystemunitdir \ - --without-ncurses \ - --host="${LFS_TGT32}" \ - PKG_CONFIG="" - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make DESTDIR=$PWD/DESTDIR_32 install && -cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32 - - - - - Installation of Util-Linux - x32 bit - - Repeat for the x32-ABI: - -make distclean && -CC="${LFS_TGT}-gcc -mx32" \ -./configure \ - --prefix=/tools \ - --libdir=/tools/libx32 \ - --without-python \ - --disable-makeinstall-chown \ - --without-systemdsystemunitdir \ - --without-ncurses \ - --host="${LFS_TGTX32}" \ - PKG_CONFIG="" - -make - -make DESTDIR=$PWD/DESTDIR_x32 install && -cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32 - - - -
diff --git a/chapter05/xz.xml b/chapter05/xz.xml deleted file mode 100644 index 8fac7434a..000000000 --- a/chapter05/xz.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - %general-entities; -]> - - - - - - xz - &xz-version; -
&xz-url;
-
- - Xz-&xz-version; - - - Xz - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/xz.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&xz-ch5-sbu;</seg> - <seg>&xz-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Xz - - Prepare Xz for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Xz test suite anyway, issue the following command: - -make check - - Install the package: - -make install - - - - - Installation of Xz - 32 bit - - Prepare Xz for compilation: - -make distclean && -CC="${LFS_TGT}-gcc -m32" \ -./configure \ - --prefix=/tools \ - --libdir=/tools/lib32 \ - --host="${LFS_TGT32}" - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make DESTDIR=$PWD/DESTDIR_32 install && -cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32 - - - - - Installation of Xz - x32 bit - - Repeat for the x32-ABI: - -make distclean && -CC="${LFS_TGT}-gcc -mx32" \ -./configure \ - --prefix=/tools \ - --libdir=/tools/libx32 \ - --host="${LFS_TGTX32}" - -make - -make DESTDIR=$PWD/DESTDIR_x32 install && -cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32 - - - - - - - <para>Details on this package are located in - <xref linkend="contents-xz" role="."/></para> - - </sect2> - -</sect1> diff --git a/chapter05/zlib.xml b/chapter05/zlib.xml deleted file mode 100644 index 01a6da5d1..000000000 --- a/chapter05/zlib.xml +++ /dev/null @@ -1,101 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 arch="ml_32,ml_x32,ml_all" id="ch-tools-zlib" role="wrap"> - <?dbhtml filename="zlib.html"?> - - <sect1info condition="script"> - <productname>zlib</productname> - <productnumber>&zlib-version;</productnumber> - <address>&zlib-url;</address> - </sect1info> - - <title>Zlib-&zlib-version; - - - Zlib - - - - - - <para>The Zlib package contains compression and decompression routines used by - some programs.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&zlib-ch6-sbu;</seg> - <seg>&zlib-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Zlib - - Prepare Zlib for compilation: - -./configure --prefix=/tools - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make install - - - - - Installation of Zlib - 32 bit - - Prepare Zlib for compilation: - -make distclean && -CC="${LFS_TGT}-gcc -m32" ./configure --prefix=/tools --libdir=/tools/lib32 - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make DESTDIR=$PWD/DESTDIR_32 install && -cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32 - - - - - Installation of Zlib - x32 bit - - Repeat for the x32-ABI: - -make distclean && -CC="${LFS_TGT}-gcc -mx32" ./configure --prefix=/tools --libdir=/tools/libx32 - -make - -make DESTDIR=$PWD/DESTDIR_x32 install && -cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32 - - - -
- diff --git a/chapter06/bash.xml b/chapter06/bash.xml index 4d06fc2a3..6cb1dc728 100644 --- a/chapter06/bash.xml +++ b/chapter06/bash.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,22 +16,25 @@ Bash-&bash-version; - + Bash + tools - <para>The Bash package contains the Bourne-Again SHell.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/bash.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&bash-ch6-sbu;</seg> - <seg>&bash-ch6-du;</seg> + <seg>&bash-tmp-sbu;</seg> + <seg>&bash-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -40,27 +43,24 @@ <sect2 role="installation"> <title>Installation of Bash - Incorporate some upstream fixes: - -patch -Np1 -i ../&bash-fixes-patch; - Prepare Bash for compilation: -./configure --prefix=/usr \ - --docdir=/usr/share/doc/bash-&bash-version; \ - --without-bash-malloc \ - --with-installed-readline +./configure --prefix=/usr \ + --build=$(support/config.guess) \ + --host=$LFS_TGT \ + --without-bash-malloc - The meaning of the new configure option: + The meaning of the configure options: - --with-installed-readline + --without-bash-malloc - This option tells Bash to use the readline library that is already - installed on the system rather than using its own readline - version. + 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. @@ -70,103 +70,26 @@ make - Skip down to Install the - package if not running the test suite. + Install the package: - To prepare the tests, ensure that the tester user can write to the sources tree: +make DESTDIR=$LFS install -chown -Rv tester . + Move the excutable to where it is expected: - Now, run the tests as the tester user: +mv $LFS/usr/bin/bash $LFS/bin/bash -su tester << EOF -PATH=$PATH make tests < $(tty) -EOF + Make a link for the programs that use sh for + a shell: - The tester - user does not have enough permissions for all the tests to pass. This shows - up in some diff output in four test results. Portions of the - run-execscript, run-lastpipe, run-read, and run-test programs - are known to fail in the LFS chroot environment, but pass if the tests - are run in a full system. - - Install the package and move the main executable to - /bin: - -make install -mv -vf /usr/bin/bash /bin - - Run the newly compiled bash program (replacing the one that is - currently being executed): - -exec /bin/bash --login +h - - - The parameters used make the bash - process an interactive login shell and continue to disable hashing so - that new programs are found as they become available. - +ln -sv bash $LFS/bin/sh - - Contents of Bash + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed directory</segtitle> - - <seglistitem> - <seg>bash, bashbug, and sh (link to bash)</seg> - <seg>/usr/include/bash, /usr/lib/bash, and - /usr/share/doc/bash-&bash-version;</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="bash"> - <term><command>bash</command></term> - <listitem> - <para>A widely-used command interpreter; it performs many types of - expansions and substitutions on a given command line before executing - it, thus making this interpreter a powerful tool</para> - <indexterm zone="ch-system-bash bash"> - <primary sortas="b-bash">bash</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="bashbug"> - <term><command>bashbug</command></term> - <listitem> - <para>A shell script to help the user compose and mail standard - formatted bug reports concerning <command>bash</command></para> - <indexterm zone="ch-system-bash bashbug"> - <primary sortas="b-bashbug">bashbug</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sh"> - <term><command>sh</command></term> - <listitem> - <para>A symlink to the <command>bash</command> program; when invoked - as <command>sh</command>, <command>bash</command> tries to mimic the - startup behavior of historical versions of <command>sh</command> as - closely as possible, while conforming to the POSIX standard as - well</para> - <indexterm zone="ch-system-bash sh"> - <primary sortas="b-sh">sh</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-bash" role="."/></para> </sect2> diff --git a/chapter06/binutils-pass2.xml b/chapter06/binutils-pass2.xml new file mode 100644 index 000000000..671931c38 --- /dev/null +++ b/chapter06/binutils-pass2.xml @@ -0,0 +1,118 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-binutils-pass2" role="wrap"> + <?dbhtml filename="binutils-pass2.html"?> + + <sect1info condition="script"> + <productname>binutils-pass2</productname> + <productnumber>&binutils-version;</productnumber> + <address>&binutils-url;</address> + </sect1info> + + <title>Binutils-&binutils-version; - Pass 2 + + + Binutils + tools, pass 2 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/binutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&binutils-tmpp2-sbu;</seg> + <seg>&binutils-tmpp2-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Binutils + + Create a separate build directory again: + +mkdir -v build +cd build + + Prepare Binutils for compilation: + +../configure \ + --prefix=/usr \ + --build=$(../config.guess) \ + --host=$LFS_TGT \ + --disable-nls \ + --enable-shared \ + --disable-werror \ + --enable-64-bit-bfd +../configure \ + --prefix=/usr \ + --build=$(../config.guess) \ + --host=$LFS_TGT \ + --disable-nls \ + --enable-shared \ + --disable-werror \ + --enable-64-bit-bfd \ + --enable-multilib + + + The meaning of the new configure options: + + + --enable-shared + + Builds libbfd as a shared library. + + + + + + --enable-64-bit-bfd + + Enables 64-bit support (on hosts with narrower word sizes). + May not be needed on 64-bit systems, but does no harm. + + + + + --enable-multilib + + Enables multilib support in bintutils. + + + + + + Compile the package: + +make + + Install the package: + +make DESTDIR=$LFS install + + + + + + + <para>Details on this package are located in + <xref linkend="contents-binutils" role="."/></para> + + </sect2> + +</sect1> diff --git a/chapter06/chapter06.xml b/chapter06/chapter06.xml index 388e94ac2..11bc5d499 100644 --- a/chapter06/chapter06.xml +++ b/chapter06/chapter06.xml @@ -5,111 +5,30 @@ %general-entities; ]> -<chapter id="chapter-building-system" xreflabel="Chapter 6"> +<chapter id="chapter-temporary-tools" xreflabel="Chapter 6"> <?dbhtml dir="chapter06"?> <?dbhtml filename="chapter06.html"?> - <title>Installing Basic System Software + Cross Compiling Temporary Tools - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + - - - + - + - - - - - - - - - - - - - - - - - - - - - - - - - + + +
diff --git a/chapter06/coreutils.xml b/chapter06/coreutils.xml index ffef82f84..fe036755e 100644 --- a/chapter06/coreutils.xml +++ b/chapter06/coreutils.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,23 +16,25 @@ Coreutils-&coreutils-version; - + Coreutils + tools - <para>The Coreutils package contains utilities for showing and setting the - basic system characteristics.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/coreutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&coreutils-ch6-sbu;</seg> - <seg>&coreutils-ch6-du;</seg> + <seg>&coreutils-tmp-sbu;</seg> + <seg>&coreutils-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -41,59 +43,23 @@ <sect2 role="installation"> <title>Installation of Coreutils - POSIX requires that programs from Coreutils recognize character - boundaries correctly even in multibyte locales. The following patch fixes - this non-compliance and other internationalization-related bugs. + Prepare Coreutils for compilation: -patch -Np1 -i ../&coreutils-i18n-patch; - - - In the past, many bugs were found in this patch. When reporting new - bugs to Coreutils maintainers, please check first if they are reproducible - without this patch. - - - - Suppress a test which on some machines can loop forever: - -sed -i '/test.lock/s/^/#/' gnulib-tests/gnulib.mk - - Now prepare Coreutils for compilation: - -autoreconf -fiv -FORCE_UNSAFE_CONFIGURE=1 ./configure \ - --prefix=/usr \ +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) \ + --enable-install-program=hostname \ --enable-no-install-program=kill,uptime The meaning of the configure options: - autoreconf + --enable-install-program=hostname - This command updates generated configuration files - consistent with the latest version of automake. - - - - - - FORCE_UNSAFE_CONFIGURE=1 - - This environment variable allows the package to be - built as the root user. - - - - - - --enable-no-install-program=kill,uptime - - The purpose of this switch is to prevent Coreutils from - installing binaries that will be installed by other packages later. - + This enables the hostname binary to be built + and installed – it is disabled by default but is required by the + Perl test suite. @@ -102,1186 +68,37 @@ FORCE_UNSAFE_CONFIGURE=1 ./configure \ make - Skip down to Install the - package if not running the test suite. - - Now the test suite is ready to be run. First, run the tests that are - meant to be run as user root: - -make NON_ROOT_USERNAME=tester check-root - - We're going to run the remainder of the tests as the - tester user. Certain tests, - however, require that the user be a member of more than one group. So that - these tests are not skipped we'll add a temporary group and make the - user tester a part of it: - -echo "dummy:x:102:tester" >> /etc/group - - Fix some of the permissions so that the non-root user can compile and - run the tests: - -chown -Rv tester . - - Now run the tests. Make sure the PATH in the su - environment includes /tools/bin. - -su tester -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check" - - - Remove the temporary group: - -sed -i '/dummy/d' /etc/group Install the package: -make install +make DESTDIR=$LFS install + + Move programs to their final expected locations. Although this is + not necessary in this temporary environment, we must do so because some + programs harcode executable locations: -mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin -mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin -mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin -mv -v /usr/bin/chroot /usr/sbin -mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8 -sed -i s/\"1\"/\"8\"/1 /usr/share/man/man8/chroot.8 - - Some of the scripts in the LFS-Bootscripts package - depend on head, nice, - sleep, and touch. As /usr may not be available during the early and - late stages of booting, those binaries need to be on the root partition to - maintain FHS compliance: - -mv -v /usr/bin/{head,nice,sleep,touch} /bin +mv -v $LFS/usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} $LFS/bin +mv -v $LFS/usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} $LFS/bin +mv -v $LFS/usr/bin/{rmdir,stty,sync,true,uname} $LFS/bin +mv -v $LFS/usr/bin/{head,nice,sleep,touch} $LFS/bin +mv -v $LFS/usr/bin/chroot $LFS/usr/sbin +mkdir -pv $LFS/usr/share/man/man8 +mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8 +sed -i 's/"1"/"8"/' $LFS/usr/share/man/man8/chroot.8 - - Contents of Coreutils + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed library</segtitle> - <segtitle>Installed directory</segtitle> - - <seglistitem> - <seg>[, b2sum, base32, base64, basename, basenc, cat, chcon, chgrp, chmod, chown, - chroot, cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors, - dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups, - head, hostid, id, install, join, link, ln, logname, ls, md5sum, mkdir, - mkfifo, mknod, mktemp, mv, nice, nl, nohup, nproc, numfmt, od, paste, - pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, realpath, rm, - rmdir, runcon, seq, sha1sum, sha224sum, sha256sum, sha384sum, - sha512sum, shred, shuf, sleep, sort, split, stat, stdbuf, stty, sum, - sync, tac, tail, tee, test, timeout, touch, tr, true, truncate, tsort, - tty, uname, unexpand, uniq, unlink, users, vdir, wc, who, whoami, and - yes</seg> - <seg>libstdbuf.so (in /usr/libexec/coreutils)</seg> - <seg>/usr/libexec/coreutils</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="base32"> - <term><command>base32</command></term> - <listitem> - <para>Encodes and decodes data according to the base32 specification - (RFC 4648)</para> - <indexterm zone="ch-system-coreutils base64"> - <primary sortas="b-base64">base64</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="base64"> - <term><command>base64</command></term> - <listitem> - <para>Encodes and decodes data according to the base64 specification - (RFC 4648)</para> - <indexterm zone="ch-system-coreutils base64"> - <primary sortas="b-base64">base64</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="b2sum"> - <term><command>b2sum</command></term> - <listitem> - <para>Prints or checks BLAKE2 (512-bit) checksums</para> - <indexterm zone="ch-system-coreutils b2sum"> - <primary sortas="b-b2sum">b2sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="basename"> - <term><command>basename</command></term> - <listitem> - <para>Strips any path and a given suffix from a file name</para> - <indexterm zone="ch-system-coreutils basename"> - <primary sortas="b-basename">basename</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="basenc"> - <term><command>basenc</command></term> - <listitem> - <para>Encodes or decodes data using various algorithms</para> - <indexterm zone="ch-system-coreutils basenc"> - <primary sortas="b-basenc">basenc</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="cat"> - <term><command>cat</command></term> - <listitem> - <para>Concatenates files to standard output</para> - <indexterm zone="ch-system-coreutils cat"> - <primary sortas="b-cat">cat</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chcon"> - <term><command>chcon</command></term> - <listitem> - <para>Changes security context for files and directories</para> - <indexterm zone="ch-system-coreutils chcon"> - <primary sortas="b-chcon">chcon</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chgrp"> - <term><command>chgrp</command></term> - <listitem> - <para>Changes the group ownership of files and directories</para> - <indexterm zone="ch-system-coreutils chgrp"> - <primary sortas="b-chgrp">chgrp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chmod"> - <term><command>chmod</command></term> - <listitem> - <para>Changes the permissions of each file to the given mode; the mode - can be either a symbolic representation of the changes to make or an - octal number representing the new permissions</para> - <indexterm zone="ch-system-coreutils chmod"> - <primary sortas="b-chmod">chmod</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chown"> - <term><command>chown</command></term> - <listitem> - <para>Changes the user and/or group ownership of files and - directories</para> - <indexterm zone="ch-system-coreutils chown"> - <primary sortas="b-chown">chown</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chroot"> - <term><command>chroot</command></term> - <listitem> - <para>Runs a command with the specified directory as the - <filename class="directory">/</filename> directory</para> - <indexterm zone="ch-system-coreutils chroot"> - <primary sortas="b-chroot">chroot</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="cksum"> - <term><command>cksum</command></term> - <listitem> - <para>Prints the Cyclic Redundancy Check (CRC) checksum and the byte - counts of each specified file</para> - <indexterm zone="ch-system-coreutils cksum"> - <primary sortas="b-cksum">cksum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="comm"> - <term><command>comm</command></term> - <listitem> - <para>Compares two sorted files, outputting in three columns the lines - that are unique and the lines that are common</para> - <indexterm zone="ch-system-coreutils comm"> - <primary sortas="b-comm">comm</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="cp"> - <term><command>cp</command></term> - <listitem> - <para>Copies files</para> - <indexterm zone="ch-system-coreutils cp"> - <primary sortas="b-cp">cp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="csplit"> - <term><command>csplit</command></term> - <listitem> - <para>Splits a given file into several new files, separating them - according to given patterns or line numbers and outputting the byte - count of each new file</para> - <indexterm zone="ch-system-coreutils csplit"> - <primary sortas="b-csplit">csplit</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="cut"> - <term><command>cut</command></term> - <listitem> - <para>Prints sections of lines, selecting the parts according to given - fields or positions</para> - <indexterm zone="ch-system-coreutils cut"> - <primary sortas="b-cut">cut</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="date"> - <term><command>date</command></term> - <listitem> - <para>Displays the current time in the given format, or sets the - system date</para> - <indexterm zone="ch-system-coreutils date"> - <primary sortas="b-date">date</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="dd"> - <term><command>dd</command> </term> - <listitem> - <para>Copies a file using the given block size and count, while - optionally performing conversions on it</para> - <indexterm zone="ch-system-coreutils dd"> - <primary sortas="b-dd">dd</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="df"> - <term><command>df</command></term> - <listitem> - <para>Reports the amount of disk space available (and used) on all - mounted file systems, or only on the file systems holding the selected - files</para> - <indexterm zone="ch-system-coreutils df"> - <primary sortas="b-df">df</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="dir"> - <term><command>dir</command></term> - <listitem> - <para>Lists the contents of each given directory (the same as - the <command>ls</command> command)</para> - <indexterm zone="ch-system-coreutils dir"> - <primary sortas="b-dir">dir</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="dircolors"> - <term><command>dircolors</command></term> - <listitem> - <para>Outputs commands to set the <envar>LS_COLOR</envar> - environment variable to change the color scheme used by - <command>ls</command></para> - <indexterm zone="ch-system-coreutils dircolors"> - <primary sortas="b-dircolors">dircolors</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="dirname"> - <term><command>dirname</command></term> - <listitem> - <para>Strips the non-directory suffix from a file name</para> - <indexterm zone="ch-system-coreutils dirname"> - <primary sortas="b-dirname">dirname</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="du"> - <term><command>du</command></term> - <listitem> - <para>Reports the amount of disk space used by the current directory, - by each of the given directories (including all subdirectories) or by - each of the given files</para> - <indexterm zone="ch-system-coreutils du"> - <primary sortas="b-du">du</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="echo"> - <term><command>echo</command></term> - <listitem> - <para>Displays the given strings</para> - <indexterm zone="ch-system-coreutils echo"> - <primary sortas="b-echo">echo</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="env"> - <term><command>env</command></term> - <listitem> - <para>Runs a command in a modified environment</para> - <indexterm zone="ch-system-coreutils env"> - <primary sortas="b-env">env</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="expand"> - <term><command>expand</command></term> - <listitem> - <para>Converts tabs to spaces</para> - <indexterm zone="ch-system-coreutils expand"> - <primary sortas="b-expand">expand</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="expr"> - <term><command>expr</command></term> - <listitem> - <para>Evaluates expressions</para> - <indexterm zone="ch-system-coreutils expr"> - <primary sortas="b-expr">expr</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="factor"> - <term><command>factor</command></term> - <listitem> - <para>Prints the prime factors of all specified integer numbers</para> - <indexterm zone="ch-system-coreutils factor"> - <primary sortas="b-factor">factor</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="false"> - <term><command>false</command></term> - <listitem> - <para>Does nothing, unsuccessfully; it always exits with a status code - indicating failure</para> - <indexterm zone="ch-system-coreutils false"> - <primary sortas="b-false">false</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fmt"> - <term><command>fmt</command></term> - <listitem> - <para>Reformats the paragraphs in the given files</para> - <indexterm zone="ch-system-coreutils fmt"> - <primary sortas="b-fmt">fmt</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fold"> - <term><command>fold</command></term> - <listitem> - <para>Wraps the lines in the given files</para> - <indexterm zone="ch-system-coreutils fold"> - <primary sortas="b-fold">fold</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="groups"> - <term><command>groups</command></term> - <listitem> - <para>Reports a user's group memberships</para> - <indexterm zone="ch-system-coreutils groups"> - <primary sortas="b-groups">groups</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="head"> - <term><command>head</command></term> - <listitem> - <para>Prints the first ten lines (or the given number of lines) - of each given file</para> - <indexterm zone="ch-system-coreutils head"> - <primary sortas="b-head">head</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="hostid"> - <term><command>hostid</command></term> - <listitem> - <para>Reports the numeric identifier (in hexadecimal) of the host</para> - <indexterm zone="ch-system-coreutils hostid"> - <primary sortas="b-hostid">hostid</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="id"> - <term><command>id</command></term> - <listitem> - <para>Reports the effective user ID, group ID, and group memberships - of the current user or specified user</para> - <indexterm zone="ch-system-coreutils id"> - <primary sortas="b-id">id</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="install"> - <term><command>install</command> </term> - <listitem> - <para>Copies files while setting their permission modes and, if - possible, their owner and group</para> - <indexterm zone="ch-system-coreutils install"> - <primary sortas="b-install">install</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="join"> - <term><command>join</command></term> - <listitem> - <para>Joins the lines that have identical join fields from two - separate files</para> - <indexterm zone="ch-system-coreutils join"> - <primary sortas="b-join">join</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="link"> - <term><command>link</command></term> - <listitem> - <para>Creates a hard link with the given name to a file</para> - <indexterm zone="ch-system-coreutils link"> - <primary sortas="b-link">link</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ln"> - <term><command>ln</command></term> - <listitem> - <para>Makes hard links or soft (symbolic) links between files</para> - <indexterm zone="ch-system-coreutils ln"> - <primary sortas="b-ln">ln</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="logname"> - <term><command>logname</command></term> - <listitem> - <para>Reports the current user's login name</para> - <indexterm zone="ch-system-coreutils logname"> - <primary sortas="b-logname">logname</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ls"> - <term><command>ls</command></term> - <listitem> - <para>Lists the contents of each given directory</para> - <indexterm zone="ch-system-coreutils ls"> - <primary sortas="b-ls">ls</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="md5sum"> - <term><command>md5sum</command></term> - <listitem> - <para>Reports or checks Message Digest 5 (MD5) checksums</para> - <indexterm zone="ch-system-coreutils md5sum"> - <primary sortas="b-md5sum">md5sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mkdir"> - <term><command>mkdir</command></term> - <listitem> - <para>Creates directories with the given names</para> - <indexterm zone="ch-system-coreutils mkdir"> - <primary sortas="b-mkdir">mkdir</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mkfifo"> - <term><command>mkfifo</command></term> - <listitem> - <para>Creates First-In, First-Outs (FIFOs), a "named - pipe" in UNIX parlance, with the given names</para> - <indexterm zone="ch-system-coreutils mkfifo"> - <primary sortas="b-mkfifo">mkfifo</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mknod"> - <term><command>mknod</command></term> - <listitem> - <para>Creates device nodes with the given names; a device node is a - character special file, a block special file, or a FIFO</para> - <indexterm zone="ch-system-coreutils mknod"> - <primary sortas="b-mknod">mknod</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mktemp"> - <term><command>mktemp</command></term> - <listitem> - <para>Creates temporary files in a secure manner; it is used in scripts</para> - <indexterm zone="ch-system-coreutils mktemp"> - <primary sortas="b-mktemp">mktemp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mv"> - <term><command>mv</command></term> - <listitem> - <para>Moves or renames files or directories</para> - <indexterm zone="ch-system-coreutils mv"> - <primary sortas="b-mv">mv</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="nice"> - <term><command>nice</command></term> - <listitem> - <para>Runs a program with modified scheduling priority</para> - <indexterm zone="ch-system-coreutils nice"> - <primary sortas="b-nice">nice</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="nl"> - <term><command>nl</command></term> - <listitem> - <para>Numbers the lines from the given files</para> - <indexterm zone="ch-system-coreutils nl"> - <primary sortas="b-nl">nl</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="nohup"> - <term><command>nohup</command></term> - <listitem> - <para>Runs a command immune to hangups, with its output redirected to - a log file</para> - <indexterm zone="ch-system-coreutils nohup"> - <primary sortas="b-nohup">nohup</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="nproc"> - <term><command>nproc</command></term> - <listitem> - <para>Prints the number of processing units available to a - process</para> - <indexterm zone="ch-system-coreutils nproc"> - <primary sortas="b-nproc">nproc</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="numfmt"> - <term><command>numfmt</command></term> - <listitem> - <para>Converts numbers to or from human-readable strings</para> - <indexterm zone="ch-system-coreutils numfmt"> - <primary sortas="b-numfmt">numfmt</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="od"> - <term><command>od</command></term> - <listitem> - <para>Dumps files in octal and other formats</para> - <indexterm zone="ch-system-coreutils od"> - <primary sortas="b-od">od</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="paste"> - <term><command>paste</command></term> - <listitem> - <para>Merges the given files, joining sequentially corresponding lines - side by side, separated by tab characters</para> - <indexterm zone="ch-system-coreutils paste"> - <primary sortas="b-paste">paste</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pathchk"> - <term><command>pathchk</command></term> - <listitem> - <para>Checks if file names are valid or portable</para> - <indexterm zone="ch-system-coreutils pathchk"> - <primary sortas="b-pathchk">pathchk</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pinky"> - <term><command>pinky</command></term> - <listitem> - <para>Is a lightweight finger client; it reports some information - about the given users</para> - <indexterm zone="ch-system-coreutils pinky"> - <primary sortas="b-pinky">pinky</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pr"> - <term><command>pr</command></term> - <listitem> - <para>Paginates and columnates files for printing</para> - <indexterm zone="ch-system-coreutils pr"> - <primary sortas="b-pr">pr</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="printenv"> - <term><command>printenv</command></term> - <listitem> - <para>Prints the environment</para> - <indexterm zone="ch-system-coreutils printenv"> - <primary sortas="b-printenv">printenv</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="printf"> - <term><command>printf</command></term> - <listitem> - <para>Prints the given arguments according to the given format, much - like the C printf function</para> - <indexterm zone="ch-system-coreutils printf"> - <primary sortas="b-printf">printf</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ptx"> - <term><command>ptx</command></term> - <listitem> - <para>Produces a permuted index from the contents of the given files, - with each keyword in its context</para> - <indexterm zone="ch-system-coreutils ptx"> - <primary sortas="b-ptx">ptx</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pwd"> - <term><command>pwd</command></term> - <listitem> - <para>Reports the name of the current working directory</para> - <indexterm zone="ch-system-coreutils pwd"> - <primary sortas="b-pwd">pwd</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="readlink"> - <term><command>readlink</command></term> - <listitem> - <para>Reports the value of the given symbolic link</para> - <indexterm zone="ch-system-coreutils readlink"> - <primary sortas="b-readlink">readlink</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="realpath"> - <term><command>realpath</command></term> - <listitem> - <para>Prints the resolved path</para> - <indexterm zone="ch-system-coreutils realpath"> - <primary sortas="b-realpath">realpath</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="rm"> - <term><command>rm</command></term> - <listitem> - <para>Removes files or directories</para> - <indexterm zone="ch-system-coreutils rm"> - <primary sortas="b-rm">rm</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="rmdir"> - <term><command>rmdir</command></term> - <listitem> - <para>Removes directories if they are empty</para> - <indexterm zone="ch-system-coreutils rmdir"> - <primary sortas="b-rmdir">rmdir</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="runcon"> - <term><command>runcon</command></term> - <listitem> - <para>Runs a command with specified security context</para> - <indexterm zone="ch-system-coreutils runcon"> - <primary sortas="b-runcon">runcon</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="seq"> - <term><command>seq</command></term> - <listitem> - <para>Prints a sequence of numbers within a given range and with a - given increment</para> - <indexterm zone="ch-system-coreutils seq"> - <primary sortas="b-seq">seq</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sha1sum"> - <term><command>sha1sum</command></term> - <listitem> - <para>Prints or checks 160-bit Secure Hash Algorithm 1 (SHA1) - checksums</para> - <indexterm zone="ch-system-coreutils sha1sum"> - <primary sortas="b-sha1sum">sha1sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sha224sum"> - <term><command>sha224sum</command></term> - <listitem> - <para>Prints or checks 224-bit Secure Hash Algorithm checksums</para> - <indexterm zone="ch-system-coreutils sha224sum"> - <primary sortas="b-sha224sum">sha224sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sha256sum"> - <term><command>sha256sum</command></term> - <listitem> - <para>Prints or checks 256-bit Secure Hash Algorithm checksums</para> - <indexterm zone="ch-system-coreutils sha256sum"> - <primary sortas="b-sha256sum">sha256sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sha384sum"> - <term><command>sha384sum</command></term> - <listitem> - <para>Prints or checks 384-bit Secure Hash Algorithm checksums</para> - <indexterm zone="ch-system-coreutils sha384sum"> - <primary sortas="b-sha384sum">sha384sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sha512sum"> - <term><command>sha512sum</command></term> - <listitem> - <para>Prints or checks 512-bit Secure Hash Algorithm checksums</para> - <indexterm zone="ch-system-coreutils sha512sum"> - <primary sortas="b-sha512sum">sha512sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="shred"> - <term><command>shred</command></term> - <listitem> - <para>Overwrites the given files repeatedly with complex patterns, - making it difficult to recover the data</para> - <indexterm zone="ch-system-coreutils shred"> - <primary sortas="b-shred">shred</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="shuf"> - <term><command>shuf</command></term> - <listitem> - <para>Shuffles lines of text</para> - <indexterm zone="ch-system-coreutils shuf"> - <primary sortas="b-shuf">shuf</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sleep"> - <term><command>sleep</command></term> - <listitem> - <para>Pauses for the given amount of time</para> - <indexterm zone="ch-system-coreutils sleep"> - <primary sortas="b-sleep">sleep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sort"> - <term><command>sort</command></term> - <listitem> - <para>Sorts the lines from the given files</para> - <indexterm zone="ch-system-coreutils sort"> - <primary sortas="b-sort">sort</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="split"> - <term><command>split</command></term> - <listitem> - <para>Splits the given file into pieces, by size or by number of - lines</para> - <indexterm zone="ch-system-coreutils split"> - <primary sortas="b-split">split</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="stat"> - <term><command>stat</command></term> - <listitem> - <para>Displays file or filesystem status</para> - <indexterm zone="ch-system-coreutils stat"> - <primary sortas="b-stat">stat</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="stdbuf"> - <term><command>stdbuf</command></term> - <listitem> - <para>Runs commands with altered buffering operations for its standard - streams</para> - <indexterm zone="ch-system-coreutils stdbuf"> - <primary sortas="b-stdbuf">stdbuf</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="stty"> - <term><command>stty</command></term> - <listitem> - <para>Sets or reports terminal line settings</para> - <indexterm zone="ch-system-coreutils stty"> - <primary sortas="b-stty">stty</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sum"> - <term><command>sum</command></term> - <listitem> - <para>Prints checksum and block counts for each given file</para> - <indexterm zone="ch-system-coreutils sum"> - <primary sortas="b-sum">sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sync"> - <term><command>sync</command></term> - <listitem> - <para>Flushes file system buffers; it forces changed blocks to disk - and updates the super block</para> - <indexterm zone="ch-system-coreutils sync"> - <primary sortas="b-sync">sync</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tac"> - <term><command>tac</command></term> - <listitem> - <para>Concatenates the given files in reverse</para> - <indexterm zone="ch-system-coreutils tac"> - <primary sortas="b-tac">tac</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tail"> - <term><command>tail</command></term> - <listitem> - <para>Prints the last ten lines (or the given number of lines) of each - given file</para> - <indexterm zone="ch-system-coreutils tail"> - <primary sortas="b-tail">tail</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tee"> - <term><command>tee</command></term> - <listitem> - <para>Reads from standard input while writing both to standard output - and to the given files</para> - <indexterm zone="ch-system-coreutils tee"> - <primary sortas="b-tee">tee</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="test"> - <term><command>test</command></term> - <listitem> - <para>Compares values and checks file types</para> - <indexterm zone="ch-system-coreutils test"> - <primary sortas="b-test">test</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="timeout"> - <term><command>timeout</command></term> - <listitem> - <para>Runs a command with a time limit</para> - <indexterm zone="ch-system-coreutils timeout"> - <primary sortas="b-timeout">timeout</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="touch"> - <term><command>touch</command></term> - <listitem> - <para>Changes file timestamps, setting the access and modification - times of the given files to the current time; files that do not exist - are created with zero length</para> - <indexterm zone="ch-system-coreutils touch"> - <primary sortas="b-touch">touch</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tr"> - <term><command>tr</command></term> - <listitem> - <para>Translates, squeezes, and deletes the given characters from - standard input</para> - <indexterm zone="ch-system-coreutils tr"> - <primary sortas="b-tr">tr</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="true"> - <term><command>true</command></term> - <listitem> - <para>Does nothing, successfully; it always exits with a status code - indicating success</para> - <indexterm zone="ch-system-coreutils true"> - <primary sortas="b-true">true</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="truncate"> - <term><command>truncate</command></term> - <listitem> - <para>Shrinks or expands a file to the specified size</para> - <indexterm zone="ch-system-coreutils truncate"> - <primary sortas="b-truncate">truncate</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tsort"> - <term><command>tsort</command></term> - <listitem> - <para>Performs a topological sort; it writes a completely ordered list - according to the partial ordering in a given file</para> - <indexterm zone="ch-system-coreutils tsort"> - <primary sortas="b-tsort">tsort</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tty"> - <term><command>tty</command></term> - <listitem> - <para>Reports the file name of the terminal connected to standard - input</para> - <indexterm zone="ch-system-coreutils tty"> - <primary sortas="b-tty">tty</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="uname"> - <term><command>uname</command></term> - <listitem> - <para>Reports system information</para> - <indexterm zone="ch-system-coreutils uname"> - <primary sortas="b-uname">uname</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="unexpand"> - <term><command>unexpand</command></term> - <listitem> - <para>Converts spaces to tabs</para> - <indexterm zone="ch-system-coreutils unexpand"> - <primary sortas="b-unexpand">unexpand</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="uniq"> - <term><command>uniq</command></term> - <listitem> - <para>Discards all but one of successive identical lines</para> - <indexterm zone="ch-system-coreutils uniq"> - <primary sortas="b-uniq">uniq</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="unlink"> - <term><command>unlink</command></term> - <listitem> - <para>Removes the given file</para> - <indexterm zone="ch-system-coreutils unlink"> - <primary sortas="b-unlink">unlink</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="users"> - <term><command>users</command></term> - <listitem> - <para>Reports the names of the users currently logged on</para> - <indexterm zone="ch-system-coreutils users"> - <primary sortas="b-users">users</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="vdir"> - <term><command>vdir</command></term> - <listitem> - <para>Is the same as <command>ls -l</command></para> - <indexterm zone="ch-system-coreutils vdir"> - <primary sortas="b-vdir">vdir</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="wc"> - <term><command>wc</command></term> - <listitem> - <para>Reports the number of lines, words, and bytes for each given - file, as well as a total line when more than one file is given</para> - <indexterm zone="ch-system-coreutils wc"> - <primary sortas="b-wc">wc</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="who"> - <term><command>who</command></term> - <listitem> - <para>Reports who is logged on</para> - <indexterm zone="ch-system-coreutils who"> - <primary sortas="b-who">who</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="whoami"> - <term><command>whoami</command></term> - <listitem> - <para>Reports the user name associated with the current effective - user ID</para> - <indexterm zone="ch-system-coreutils whoami"> - <primary sortas="b-whoami">whoami</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="yes"> - <term><command>yes</command></term> - <listitem> - <para>Repeatedly outputs <quote>y</quote> or a given string until - killed</para> - <indexterm zone="ch-system-coreutils yes"> - <primary sortas="b-yes">yes</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libstdbuf"> - <term><filename class="libraryfile">libstdbuf</filename></term> - <listitem> - <para>Library used by <command>stdbuf</command></para> - <indexterm zone="ch-system-coreutils libstdbuf"> - <primary sortas="c-libstdbuf">libstdbuf</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-coreutils" role="."/></para> </sect2> diff --git a/chapter06/createfiles.xml b/chapter06/createfiles.xml deleted file mode 100644 index 0fbd114d5..000000000 --- a/chapter06/createfiles.xml +++ /dev/null @@ -1,401 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-system-createfiles"> - <?dbhtml filename="createfiles.html"?> - - <title>Creating Essential Files and Symlinks - - - /etc/passwd - - - - /etc/group - - - - /var/run/utmp - - - - /var/log/btmp - - - - /var/log/lastlog - - - - /var/log/wtmp - - - 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 this chapter after the - software has been installed: - -ln -sv /tools/bin/{bash,cat,chmod,dd,echo,false,ln,ls,mkdir,pwd,rm,stty,touch} /bin -ln -sv /tools/bin/{env,install,perl,printf} /usr/bin -ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib -ln -sv /tools/lib/libstdc++.{a,so{,.6}} /usr/lib - -ln -sv bash /bin/sh -for lib in blkid mount uuid fdisk -do - ln -sv /tools/lib/lib$lib.so* /usr/lib - sed 's|/tools|/usr|' /tools/lib/pkgconfig/${lib}.pc \ - > /usr/lib/pkgconfig/${lib}.pc -done -for incdir in blkid libmount uuid libfdisk -do - ln -svf /tools/include/$incdir /usr/include -done - -mkdir -pv /tools/lib/locale -ln -sv /usr/lib/locale/locale-archive /tools/lib/locale - - 32-bit builds also require these links: - -ln -sv /tools/lib32/libgcc_s.so{,.1} /usr/lib32 -ln -sv /tools/lib32/libstdc++.{a,so{,.6}} /usr/lib32 -for lib in blkid mount uuid fdisk -do - ln -sv /tools/lib32/lib$lib.so* /usr/lib32/ - sed 's|/tools|/usr|' /tools/lib32/pkgconfig/${lib}.pc \ - > /usr/lib32/pkgconfig/${lib}.pc -done - - x32-bit builds also require these links: - -ln -sv /tools/libx32/libgcc_s.so{,.1} /usr/libx32 -ln -sv /tools/libx32/libstdc++.{a,so{,.6}} /usr/libx32 -ln -sv /usr/libx32 / -for lib in blkid mount uuid fdisk -do - ln -sv /tools/libx32/lib$lib.so* /usr/libx32/ - sed 's|/tools|/usr|' /tools/libx32/pkgconfig/${lib}.pc \ - > /usr/libx32/pkgconfig/${lib}.pc -done - - - The purpose of each link: - - - /bin/bash - - Many bash scripts specify - /bin/bash. - - - - - /bin/cat - - This pathname is hard-coded into Glibc's configure script. - - - - - /bin/dd - - The path to dd will be hard-coded into the - /usr/bin/libtool utility. - - - - - /bin/echo - - This is to satisfy one of the tests in Glibc's test suite, which - expects /bin/echo. - - - - - /usr/bin/env - - This pathname is hard-coded into some packages build procedures. - - - - - - /usr/bin/install - - The path to install will be hard-coded into - the /usr/lib/bash/Makefile.inc file. - - - - - /bin/ln - - The path to ln will be hard-coded into the - /usr/lib/perl5/&perl-version;/<target-triplet>/Config_heavy.pl - file. - - - - - /bin/pwd - - Some configure scripts, particularly Glibc's, - have this pathname hard-coded. - - - - - /bin/rm - - The path to rm will be hard-coded into the - /usr/lib/perl5/&perl-version;/<target-triplet>/Config_heavy.pl - file. - - - - - /bin/stty - - This pathname is hard-coded into Expect, therefore it is needed - for Binutils and GCC test suites to pass. - - - - - /usr/bin/perl - - Many Perl scripts hard-code this path to the - perl program. - - - - - /usr/lib/libgcc_s.so{,.1} - - Glibc needs this for the pthreads library to work. - - - - - /usr/lib/libstdc++{,.6} - - This is needed by several tests in Glibc's test suite, as well as - for C++ support in GMP. - - - - - /bin/sh - - Many shell scripts hard-code /bin/sh. - - - - - - - /usr/lib/lib{blkid,fdisk,mount,uuid}.so*, - /usr/include/{blkid,libfdisk,libmount,uuid}, - /usr/lib/pkgconfig/{blkid,fdisk,mount,uuid}.pc - - - - These links and files allow - eudev - systemd to find the - util-linux libraries installed in chapter 5, without creating - wrong references to /tools. The uuid library is also needed for - building a python module. - - - - - - - /tools/lib/locale/locale-archive - - - - Some programs built in chapter 5 look for installed - locale descriptions in this file. The locale descriptions will be - installed in /usr/lib/locale/locale-archive - after building the final glibc. The symlink allows those programs - to use the installed locales. - - - - - - Historically, Linux maintains a list of the mounted file systems in the - file /etc/mtab. Modern kernels maintain this list - internally and exposes it to the user via the /proc filesystem. To satisfy utilities that - expect the presence of /etc/mtab, create the following - symbolic link: - -ln -sv /proc/self/mounts /etc/mtab - - In order for user root to be - able to login and for the name root to be recognized, there - must be relevant entries in the /etc/passwd and - /etc/group files. - - Create the /etc/passwd file by running the following - command: - -cat > /etc/passwd << "EOF" -root:x:0:0:root:/root:/bin/bash -bin:x:1:1:bin:/dev/null:/bin/false -daemon:x:6:6:Daemon User:/dev/null:/bin/false -messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false -nobody:x:99:99:Unprivileged User:/dev/null:/bin/false -EOF - -cat > /etc/passwd << "EOF" -root:x:0:0:root:/root:/bin/bash -bin:x:1:1:bin:/dev/null:/bin/false -daemon:x:6:6:Daemon User:/dev/null:/bin/false -messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false -systemd-bus-proxy:x:72:72:systemd Bus Proxy:/:/bin/false -systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/bin/false -systemd-journal-remote:x:74:74:systemd Journal Remote:/:/bin/false -systemd-journal-upload:x:75:75:systemd Journal Upload:/:/bin/false -systemd-network:x:76:76:systemd Network Management:/:/bin/false -systemd-resolve:x:77:77:systemd Resolver:/:/bin/false -systemd-timesync:x:78:78:systemd Time Synchronization:/:/bin/false -systemd-coredump:x:79:79:systemd Core Dumper:/:/bin/false -nobody:x:99:99:Unprivileged User:/dev/null:/bin/false -EOF - - The actual password for root - (the x used here is just a placeholder) will be set later. - - Create the /etc/group file by running the following - command: - -cat > /etc/group << "EOF" -root:x:0: -bin:x:1:daemon -sys:x:2: -kmem:x:3: -tape:x:4: -tty: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: -adm:x:16: -messagebus:x:18: -input:x:24: -mail:x:34: -kvm:x:61: -wheel:x:97: -nogroup:x:99: -users:x:999: -EOF - -cat > /etc/group << "EOF" -root:x:0: -bin:x:1:daemon -sys:x:2: -kmem:x:3: -tape:x:4: -tty: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: -adm:x:16: -messagebus:x:18: -systemd-journal:x:23: -input:x:24: -mail:x:34: -kvm:x:61: -systemd-bus-proxy:x:72: -systemd-journal-gateway:x:73: -systemd-journal-remote:x:74: -systemd-journal-upload:x:75: -systemd-network:x:76: -systemd-resolve:x:77: -systemd-timesync:x:78: -systemd-coredump:x:79: -wheel:x:97: -nogroup:x:99: -users:x:999: -EOF - - The created groups are not part of any standard—they are groups - decided on in part by the requirements of the Udev configuration in this - chapter, and in part by common convention employed by a number of existing - Linux distributions. In addition, some test suites rely on specific users - or groups. The Linux Standard Base (LSB, available at ) 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. - - Some tests later in the chapter need a regular user. We add this - user here and delete this account at the end of the chapter. - -echo "tester:x:$(ls -n $(tty) | cut -d" " -f3):101::/home/tester:/bin/bash" >> /etc/passwd -echo "tester:x:101:" >> /etc/group -install -o tester -d /home/tester - - To remove the I have no name! prompt, start a new - shell. Since a full Glibc was installed in and the - /etc/passwd and /etc/group - files have been created, user name and group name resolution will now - work: - -exec /tools/bin/bash --login +h - - Note the use of the +h directive. This tells - bash not to use its internal path hashing. Without this - directive, bash would remember the paths to binaries it has - executed. To ensure the use of the newly compiled binaries as soon as they are - installed, the +h directive will be used for the duration - of this chapter. - - The login, agetty, and - init programs (and others) use a number of log - files to record information such as who was logged into the system and - when. However, these programs will not write to the log files if they - do not already exist. Initialize the log files and give them - proper permissions: - -touch /var/log/{btmp,lastlog,faillog,wtmp} -chgrp -v utmp /var/log/lastlog -chmod -v 664 /var/log/lastlog -chmod -v 600 /var/log/btmp - - The /var/log/wtmp file records all logins and - logouts. The /var/log/lastlog file records when each - user last logged in. The /var/log/faillog file records - failed login attempts. The /var/log/btmp file records - the bad login attempts. - - The /run/utmp file records the users that - are currently logged in. This file is created dynamically in the boot - scripts. - - diff --git a/chapter06/diffutils.xml b/chapter06/diffutils.xml index 0d8bd5c77..af4d95429 100644 --- a/chapter06/diffutils.xml +++ b/chapter06/diffutils.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,23 +16,25 @@ Diffutils-&diffutils-version; - + Diffutils + tools - <para>The Diffutils package contains programs that show the differences - between files or directories.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/diffutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&diffutils-ch6-sbu;</seg> - <seg>&diffutils-ch6-du;</seg> + <seg>&diffutils-tmp-sbu;</seg> + <seg>&diffutils-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -43,82 +45,23 @@ <para>Prepare Diffutils for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr --host=$LFS_TGT</userinput></screen> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make check</userinput></screen> - <para>Install the package:</para> -<screen><userinput remap="install">make install</userinput></screen> +<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> </sect2> + <sect2 role="content"> + <title/> - <sect2 id="contents-diffutils" role="content"> - <title>Contents of Diffutils - - - Installed programs - - - cmp, diff, diff3, and sdiff - - - - - Short Descriptions - - - - - cmp - - Compares two files and reports whether or in which bytes they - differ - - cmp - - - - - - diff - - Compares two files or directories and reports which lines in - the files differ - - diff - - - - - - diff3 - - Compares three files line by line - - diff3 - - - - - - sdiff - - Merges two files and interactively outputs the results - - sdiff - - - - - + Details on this package are located in + diff --git a/chapter06/file.xml b/chapter06/file.xml index f33c7d462..035e02f72 100644 --- a/chapter06/file.xml +++ b/chapter06/file.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,23 +16,25 @@ File-&file-version; - + File + tools - <para>The File package contains a utility for determining the type of a given - file or files.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/file.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&file-ch6-sbu;</seg> - <seg>&file-ch6-du;</seg> + <seg>&file-tmp-sbu;</seg> + <seg>&file-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -43,120 +45,26 @@ <para>Prepare File for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> - - <para>Compile the package:</para> - -<screen><userinput remap="make">make</userinput></screen> - - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make check</userinput></screen> - - <para>Install the package:</para> - -<screen><userinput remap="install">make install</userinput></screen> - - </sect2> - - <!-- ~~~~~~~~~~~~~~~~~~~~ ABI 32 ~~~~~~~~~~~~~~~~~~~~ --> - - <sect2 arch="ml_32,ml_all" role="installation"> - <title>Installation of File - 32-bit - - Clean previous build: - -make distclean - - Prepare File for compilation: - -CC="gcc -m32" ./configure \ - --prefix=/usr \ - --libdir=/usr/lib32 \ - --host=i686-pc-linux-gnu +./configure --prefix=/usr --host=$LFS_TGT + Compile the package: make Install the package: -make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 -rm -rf DESTDIR +make DESTDIR=$LFS install - - - - Installation of File - x32-bit - - Clean previous build: - -make distclean - - Prepare File for compilation: - -CC="gcc -mx32" ./configure \ - --prefix=/usr \ - --libdir=/usr/libx32 \ - --host=x86_64-pc-linux-gnux32 - - Compile the package: - -make - - Install the package: - -make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 -rm -rf DESTDIR - - - - - Contents of File - - - Installed programs - Installed library - - - file - libmagic.so - - - - - Short Descriptions - - - - - file - - Tries to classify each given file; it does this by performing - several tests—file system tests, magic number tests, and language - tests - - file - - - - - - libmagic - - Contains routines for magic number recognition, used by the - file program - - libmagic - - - - - + + + <para>Details on this package are located in <xref linkend="contents-file" role="."/></para> </sect2> diff --git a/chapter06/findutils.xml b/chapter06/findutils.xml index 37393f0de..e6a19202b 100644 --- a/chapter06/findutils.xml +++ b/chapter06/findutils.xml @@ -5,7 +5,7 @@ %general-entities; ]> -<sect1 id="ch-system-findutils" role="wrap"> +<sect1 id="ch-tools-findutils" role="wrap"> <?dbhtml filename="findutils.html"?> <sect1info condition="script"> @@ -16,25 +16,25 @@ <title>Findutils-&findutils-version; - + Findutils + tools - <para>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).</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/findutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&findutils-ch6-sbu;</seg> - <seg>&findutils-ch6-du;</seg> + <seg>&findutils-tmp-sbu;</seg> + <seg>&findutils-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -45,116 +45,30 @@ <para>Prepare Findutils for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr --localstatedir=/var/lib/locate</userinput></screen> - - <variablelist> - <title>The meaning of the configure options: - - - --localstatedir - - This option changes the location of the locate - database to be in /var/lib/locate, - which is FHS-compliant. - - - - +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) Compile the package: make - To test the results, issue: - -chown -Rv tester . -su tester -c "PATH=$PATH make check" - Install the package: -make install +make DESTDIR=$LFS install - Some of the scripts in the LFS-Bootscripts package - depend on find. As /usr may not be available during the early - stages of booting, this program needs to be on the root partition. The - updatedb script also needs to be modified to correct an - explicit path: + Move the excutable to its final expected location: - Some packages in BLFS and beyond expect the - find program in /bin, so make sure it's placed there: - -mv -v /usr/bin/find /bin -sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb +mv -v $LFS/usr/bin/find $LFS/bin +sed -i 's|find:=${BINDIR}|find:=/bin|' $LFS/usr/bin/updatedb - - Contents of Findutils + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed directory</segtitle> - - <seglistitem> - <seg>find, locate, updatedb, and xargs</seg> - <seg>/var/lib/locate</seg> - </seglistitem> - - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="find"> - <term><command>find</command></term> - <listitem> - <para>Searches given directory trees for files matching the specified - criteria</para> - <indexterm zone="ch-system-findutils find"> - <primary sortas="b-find">find</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="locate"> - <term><command>locate</command></term> - <listitem> - <para>Searches through a database of file names and reports the names - that contain a given string or match a given pattern</para> - <indexterm zone="ch-system-findutils locate"> - <primary sortas="b-locate">locate</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="updatedb"> - <term><command>updatedb</command></term> - <listitem> - <para>Updates the <command>locate</command> database; it scans the - entire file system (including other file systems that are currently - mounted, unless told not to) and puts every file name it finds into - the database</para> - <indexterm zone="ch-system-findutils updatedb"> - <primary sortas="b-updatedb">updatedb</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="xargs"> - <term><command>xargs</command></term> - <listitem> - <para>Can be used to apply a given command to a list of files</para> - <indexterm zone="ch-system-findutils xargs"> - <primary sortas="b-xargs">xargs</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-findutils" role="."/></para> </sect2> diff --git a/chapter06/gawk.xml b/chapter06/gawk.xml index b112eb10d..efe7b4380 100644 --- a/chapter06/gawk.xml +++ b/chapter06/gawk.xml @@ -5,7 +5,7 @@ %general-entities; ]> -<sect1 id="ch-system-gawk" role="wrap"> +<sect1 id="ch-tools-gawk" role="wrap"> <?dbhtml filename="gawk.html"?> <sect1info condition="script"> @@ -16,22 +16,25 @@ <title>Gawk-&gawk-version; - + Gawk + tools - <para>The Gawk package contains programs for manipulating text files.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/gawk.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&gawk-ch6-sbu;</seg> - <seg>&gawk-ch6-du;</seg> + <seg>&gawk-tmp-sbu;</seg> + <seg>&gawk-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -46,82 +49,25 @@ <para>Prepare Gawk for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(./config.guess)</userinput></screen> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make check</userinput></screen> - <para>Install the package:</para> -<screen><userinput remap="install">make install</userinput></screen> - - <para>If desired, install the documentation:</para> - -<screen><userinput remap="install">mkdir -v /usr/share/doc/gawk-&gawk-version; -cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-&gawk-version;</userinput></screen> +<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> </sect2> - <sect2 id="contents-gawk" role="content"> - <title>Contents of Gawk + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed libraries</segtitle> - <segtitle>Installed directories</segtitle> - - <seglistitem> - <seg>awk (link to gawk), gawk, and awk-&gawk-version;</seg> - <seg>filefuncs.so, fnmatch.so, fork.so, inplace.so, intdiv.so, ordchr.so, - readdir.so, readfile.so, revoutput.so, revtwoway.so, rwarray.so, - and time.so (all in /usr/lib/gawk)</seg> - <seg>/usr/lib/gawk, /usr/libexec/awk, /usr/share/awk, and - /usr/share/doc/gawk-&gawk-version;</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="awk"> - <term><command>awk</command></term> - <listitem> - <para>A link to <command>gawk</command></para> - <indexterm zone="ch-system-gawk awk"> - <primary sortas="b-awk">awk</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="gawk"> - <term><command>gawk</command></term> - <listitem> - <para>A program for manipulating text files; it is the GNU - implementation of <command>awk</command></para> - <indexterm zone="ch-system-gawk gawk"> - <primary sortas="b-gawk">gawk</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="gawk-version"> - <term><command>gawk-&gawk-version;</command></term> - <listitem> - <para>A hard link to <command>gawk</command></para> - <indexterm zone="ch-system-gawk gawk-version"> - <primary sortas="b-gawk-&gawk-version;">gawk-&gawk-version;</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-gawk" role="."/></para> </sect2> diff --git a/chapter06/gcc-pass2.xml b/chapter06/gcc-pass2.xml new file mode 100644 index 000000000..55da9ef9a --- /dev/null +++ b/chapter06/gcc-pass2.xml @@ -0,0 +1,188 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-gcc-pass2" role="wrap" xreflabel="gcc-pass2"> + <?dbhtml filename="gcc-pass2.html"?> + + <sect1info condition="script"> + <productname>gcc-pass2</productname> + <productnumber>&gcc-version;</productnumber> + <address>&gcc-url;</address> + </sect1info> + + <title>GCC-&gcc-version; - Pass 2 + + + GCC + tools, pass 2 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/gcc.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gcc-tmpp2-sbu;</seg> + <seg>&gcc-tmpp2-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of GCC + + As in the first build of GCC, the GMP, MPFR, and MPC packages are + required. Unpack the tarballs and move them into the required directory + names: + +tar -xf ../mpfr-&mpfr-version;.tar.xz +mv -v mpfr-&mpfr-version; mpfr +tar -xf ../gmp-&gmp-version;.tar.xz +mv -v gmp-&gmp-version; gmp +tar -xf ../mpc-&mpc-version;.tar.gz +mv -v mpc-&mpc-version; mpc +tar -xf ../isl-&isl-version;.tar.xz +mv -v isl-&isl-version; isl + + + If building on x86_64, change the default directory name for 64-bit + libraries to lib: + +case $(uname -m) in + x86_64) + sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 + ;; +esac + + Change the default directory name for + libraries: + +sed -e '/m64=/s/lib64/lib/' \ + -e '/m32=/s/m32=.*/m32=..\&lib-m32;$(call if_multiarch,:i386-linux-gnu)/' \ + -i.orig gcc/config/i386/t-linux64 + +patch -Np1 -i ../&gcc-cross-patch; + + Create a separate build directory again: + +mkdir -v build +cd build + + Create a symlink that allows libgcc to be built with posix threads + support: + +mkdir -pv $LFS_TGT/libgcc +ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h + + Before starting to build GCC, remember to unset any environment + variables that override the default optimization flags. + + Now prepare GCC for compilation: + +../configure \ + --build=$(../config.guess) \ + --host=$LFS_TGT \ + --prefix=/usr \ + CC_FOR_TARGET=$LFS_TGT-gcc \ + --with-build-sysroot=$LFS \ + --enable-initfini-array \ + --disable-nls \ + --disable-multilib \ + --disable-decimal-float \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --disable-libstdcxx \ + --enable-languages=c,c++ +mlist=m64,m32mlist=m64,mx32mlist=m64,m32,mx32 +../configure \ + --build=$(../config.guess) \ + --host=$LFS_TGT \ + --prefix=/usr \ + CC_FOR_TARGET=$LFS_TGT-gcc \ + --with-build-sysroot=$LFS \ + --enable-initfini-array \ + --disable-nls \ + --enable-multilib --with-multilib-list=$mlist \ + --disable-decimal-float \ + --disable-libatomic \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --disable-libstdcxx \ + --enable-languages=c,c++ \ + --with-system-zlib + + + The meaning of the new configure options: + + + -with-build-sysroot=$LFS + + Normally, using --host ensures that + a cross-compiler is used for building GCC, and that compiler knows + that it has to look for headers and libraries in $LFS. But the build system of GCC uses + other tools, which are not aware of this location. This switch is + needed to have them find the needed files in $LFS, and not on the host. + + + + + --enable-initfini-array + + This option is automatically enabled when building a native + compiler with a native compiler on x86. But here, we build with + a cross compiler, so we need to explicitely set this option. + + + + + + Compile the package: + +make + + Install the package: + +make DESTDIR=$LFS install + + As a finishing touch, create a utility symlink. Many programs and scripts + run cc instead of gcc, which is + used to keep programs generic and therefore usable on all kinds of UNIX + systems where the GNU C compiler is not always installed. Running + cc leaves the system administrator free to decide + which C compiler to install: + +ln -sv gcc $LFS/usr/bin/cc + + + + + + + <para>Details on this package are located in + <xref linkend="contents-gcc" role="."/></para> + + </sect2> + +</sect1> diff --git a/chapter06/glibc-32.xml b/chapter06/glibc-32.xml deleted file mode 100644 index d16693a0b..000000000 --- a/chapter06/glibc-32.xml +++ /dev/null @@ -1,184 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 arch="ml_32,ml_x32,ml_all" id="ch-system-glibc-32" role="wrap"> - <?dbhtml filename="glibc-32.html"?> - - <sect1info condition="script"> - <productname>glibc-32</productname> - <productnumber>&glibc-version;</productnumber> - <address>&glibc-url;</address> - </sect1info> - - <title>Glibc-&glibc-version; - 32-bit - - - Glibc-32 - - - - Preparation to install of ML-Glibc - -patch -Np1 -i ../&glibc-fhs-patch; - - - Temporarily move a file that would get overwritten by the 32-bit builds: - -mv /usr/include/limits.h{,.backup} - - - - - - - Installation of Glibc - 32-bit - - The Glibc documentation recommends building Glibc - in a dedicated build directory: - -mkdir -v build -cd build - - Prepare Glibc for compilation: - -CC="gcc -m32 -ffile-prefix-map=/tools=/usr" \ -CXX="g++ -m32 -ffile-prefix-map=/tools=/usr" \ -../configure --prefix=/usr \ - --disable-werror \ - --enable-kernel=&min-kernel; \ - --enable-stack-protector=strong \ - --with-headers=/usr/include \ - --enable-multi-arch \ - --libdir=/usr/lib32 \ - --libexecdir=/usr/lib32 \ - libc_cv_slibdir=/usr/lib32 \ - i686-pc-linux-gnu - - Compile the package: - -make - - Install the package: - -sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile -make install_root=$PWD/DESTDIR install -mv -v DESTDIR/usr/lib32/* /usr/lib32/ -install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \ - /usr/include/gnu/ -ln -svf ../usr/lib32/ld-linux.so.2 /lib/ld-linux.so.2 -ln -svf ../usr/lib32/ld-linux.so.2 /lib/ld-lsb.so.3 -ln -svf ../lib/locale /usr/lib32/locale - - Configure the linker cache configuration: - -echo "/usr/lib32" > /etc/ld.so.conf.d/lib32.conf -ldconfig - - Do cleanup: - -cd .. -rm -rf build - - - - - - - - - Glibc - x32-bit - - The Glibc documentation recommends building Glibc - in a dedicated build directory: - -mkdir -v build -cd build - - Prepare Glibc for compilation: - -CC="gcc -mx32 -ffile-prefix-map=/tools=/usr" \ -CXX="g++ -mx32 -ffile-prefix-map=/tools=/usr" \ -../configure --prefix=/usr \ - --disable-werror \ - --enable-kernel=&min-kernel; \ - --enable-stack-protector=strong \ - --with-headers=/usr/include \ - --enable-multi-arch \ - --libdir=/usr/libx32 \ - --libexecdir=/usr/libx32 \ - libc_cv_slibdir=/usr/libx32 \ - x86_64-pc-linux-gnux32 - - Compile the package: - -make - - Install the package: - -sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile -make install_root=$PWD/DESTDIR install -mv -v DESTDIR/usr/libx32/* /usr/libx32/ -install -vm644 DESTDIR/usr/include/gnu/lib-names-x32.h /usr/include/gnu/ -[ -e DESTDIR/usr/include/gnu/stubs-x32.h ] \ - && install -vm644 DESTDIR/usr/include/gnu/stubs-x32.h /usr/include/gnu/ \ - || ln -v /usr/include/gnu/stubs-64.h /usr/include/gnu/stubs-x32.h -ln -svf ../usr/libx32/ld-linux-x32.so.2 /lib/ld-linux-x32.so.2 -ln -svf ../lib/locale /usr/libx32/locale - - - Configure the linker cache configuration: - -echo "/usr/libx32" > /etc/ld.so.conf.d/libx32.conf -ldconfig - - Do cleanup: - -cd .. -rm -rf build - - - - - - - Cleanup - - Restore the file we moved temporarily away: - -mv /usr/include/limits.h{.backup,} - - - - diff --git a/chapter06/grep.xml b/chapter06/grep.xml index 58b0db366..494b8616d 100644 --- a/chapter06/grep.xml +++ b/chapter06/grep.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,22 +16,25 @@ Grep-&grep-version; - + Grep + tools - <para>The Grep package contains programs for searching through files.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/grep.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&grep-ch6-sbu;</seg> - <seg>&grep-ch6-du;</seg> + <seg>&grep-tmp-sbu;</seg> + <seg>&grep-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -42,69 +45,25 @@ <para>Prepare Grep for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr --bindir=/bin</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr \ + --host=$LFS_TGT \ + --bindir=/bin</userinput></screen> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make check</userinput></screen> - <para>Install the package:</para> -<screen><userinput remap="install">make install</userinput></screen> +<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> </sect2> - <sect2 id="contents-grep" role="content"> - <title>Contents of Grep + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - - <seglistitem> - <seg>egrep, fgrep, and grep</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="egrep"> - <term><command>egrep</command></term> - <listitem> - <para>Prints lines matching an extended regular expression</para> - <indexterm zone="ch-system-grep egrep"> - <primary sortas="b-egrep">egrep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fgrep"> - <term><command>fgrep</command></term> - <listitem> - <para>Prints lines matching a list of fixed strings</para> - <indexterm zone="ch-system-grep fgrep"> - <primary sortas="b-fgrep">fgrep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="grep"> - <term><command>grep</command></term> - <listitem> - <para>Prints lines matching a basic regular expression</para> - <indexterm zone="ch-system-grep grep"> - <primary sortas="b-grep">grep</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-grep" role="."/></para> </sect2> diff --git a/chapter06/grub.xml b/chapter06/grub.xml deleted file mode 100644 index 25a61077b..000000000 --- a/chapter06/grub.xml +++ /dev/null @@ -1,374 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-system-grub" role="wrap"> - <?dbhtml filename="grub.html"?> - - <sect1info condition="script"> - <productname>grub</productname> - <productnumber>&grub-version;</productnumber> - <address>&grub-url;</address> - </sect1info> - - <title>GRUB-&grub-version; - - - GRUB - - - - - - <para>The GRUB package contains the GRand Unified Bootloader.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&grub-ch6-sbu;</seg> - <seg>&grub-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of GRUB - - Prepare GRUB for compilation: - -./configure --prefix=/usr \ - --sbindir=/sbin \ - --sysconfdir=/etc \ - --disable-efiemu \ - --disable-werror - - - The meaning of the new configure options: - - - --disable-werror - - This allows the build to complete with warnings introduced - by more recent Flex versions. - - - - - --disable-efiemu - - This option minimizes what is built by disabling a feature and - testing programs not needed for LFS. - - - - - - Compile the package: - -make - - This package does not come with a test suite. - - Install the package: - -make install -mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions - - Using GRUB to make your LFS system bootable will be discussed in - . - - - - - Contents of GRUB - - - Installed programs - Installed directories - - - - grub-bios-setup, grub-editenv, grub-file, grub-fstest, - grub-glue-efi, grub-install, grub-kbdcomp, grub-macbless, - grub-menulst2cfg, grub-mkconfig, - grub-mkimage, grub-mklayout, grub-mknetdir, - grub-mkpasswd-pbkdf2, grub-mkrelpath, grub-mkrescue, grub-mkstandalone, - grub-ofpathname, grub-probe, grub-reboot, grub-render-label, - grub-script-check, - grub-set-default, grub-sparc64-setup, and grub-syslinux2cfg - - /usr/lib/grub, /etc/grub.d, /usr/share/grub, and /boot/grub (when grub-install - is first run) - - - - - Short Descriptions - - - - - grub-bios-setup - - Is a helper program for grub-install - - grub-bios-setup - - - - - - grub-editenv - - A tool to edit the environment block - - grub-editenv - - - - - - grub-file - - Checks if FILE is of the specified type. - - grub-file - - - - - - grub-fstest - - Tool to debug the filesystem driver - - grub-fstest - - - - - - grub-glue-efi - - Processes ia32 and amd64 EFI images and glues them - according to Apple format. - - grub-glue-efi - - - - - - grub-install - - Install GRUB on your drive - - grub-install - - - - - - grub-kbdcomp - - Script that converts an xkb layout into one recognized by - GRUB - - grub-kbdcomp - - - - - - grub-macbless - - Mac-style bless on HFS or HFS+ files - - grub-macbless - - - - - - grub-menulst2cfg - - Converts a GRUB Legacy menu.lst - into a grub.cfg for use with GRUB 2 - - grub-menulst2cfg - - - - - - grub-mkconfig - - Generate a grub config file - - grub-mkconfig - - - - - - grub-mkimage - - Make a bootable image of GRUB - - grub-mkimage - - - - - - grub-mklayout - - Generates a GRUB keyboard layout file - - grub-mklayout - - - - - - grub-mknetdir - - Prepares a GRUB netboot directory - - grub-mknetdir - - - - - - grub-mkpasswd-pbkdf2 - - Generates an encrypted PBKDF2 password for use in the boot - menu - - grub-mkpasswd-pbkdf2 - - - - - - grub-mkrelpath - - Makes a system pathname relative to its root - - grub-mkrelpath - - - - - - grub-mkrescue - - Make a bootable image of GRUB suitable for a floppy disk or CDROM/DVD - - grub-mkrescue - - - - - - grub-mkstandalone - - Generates a standalone image - - grub-mkstandalone - - - - - - grub-ofpathname - - Is a helper program that prints the path of a GRUB device - - grub-ofpathname - - - - - - grub-probe - - Probe device information for a given path or device - - grub-probe - - - - - - grub-reboot - - Sets the default boot entry for GRUB for the next boot only - - grub-reboot - - - - - - grub-render-label - - Render Apple .disk_label for Apple Macs - - grub-render-label - - - - - - grub-script-check - - Checks GRUB configuration script for syntax errors - - grub-script-check - - - - - - grub-set-default - - Sets the default boot entry for GRUB - - grub-set-default - - - - - - grub-sparc64-setup - - Is a helper program for grub-setup - - grub-setup - - - - - - grub-syslinux2cfg - - Transform a syslinux config file into grub.cfg format - - grub-syslinux2cfg - - - - - - - - - diff --git a/chapter06/gzip.xml b/chapter06/gzip.xml index 09eebbdf7..90d554b0d 100644 --- a/chapter06/gzip.xml +++ b/chapter06/gzip.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,23 +16,25 @@ Gzip-&gzip-version; - + Gzip + tools - <para>The Gzip package contains programs for compressing and decompressing - files.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/gzip.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&gzip-ch6-sbu;</seg> - <seg>&gzip-ch6-du;</seg> + <seg>&gzip-tmp-sbu;</seg> + <seg>&gzip-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -43,193 +45,27 @@ <para>Prepare Gzip for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr --host=$LFS_TGT</userinput></screen> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make check</userinput></screen> - - <para>Two tests are known to fail in the LFS environment: - help-version and zmore.</para> - <para>Install the package:</para> -<screen><userinput remap="install">make install</userinput></screen> +<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> - <para>Move a program that needs to be on the root filesystem:</para> + <para>Move the excutable to its final expected location:</para> -<screen><userinput remap="install">mv -v /usr/bin/gzip /bin</userinput></screen> +<screen><userinput remap="install">mv -v $LFS/usr/bin/gzip $LFS/bin</userinput></screen> </sect2> - <sect2 id="contents-gzip" role="content"> - <title>Contents of Gzip + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - - <seglistitem> - <seg>gunzip, gzexe, gzip, uncompress (hard link with gunzip), zcat, zcmp, - zdiff, zegrep, zfgrep, zforce, zgrep, zless, zmore, and znew</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="gunzip"> - <term><command>gunzip</command></term> - <listitem> - <para>Decompresses gzipped files</para> - <indexterm zone="ch-system-gzip gunzip"> - <primary sortas="b-gunzip">gunzip</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="gzexe"> - <term><command>gzexe</command></term> - <listitem> - <para>Creates self-decompressing executable files</para> - <indexterm zone="ch-system-gzip gzexe"> - <primary sortas="b-gzexe">gzexe</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="gzip"> - <term><command>gzip</command></term> - <listitem> - <para>Compresses the given files using Lempel-Ziv (LZ77) coding</para> - <indexterm zone="ch-system-gzip gzip"> - <primary sortas="b-gzip">gzip</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="uncompress"> - <term><command>uncompress</command></term> - <listitem> - <para>Decompresses compressed files</para> - <indexterm zone="ch-system-gzip uncompress"> - <primary sortas="b-uncompress">uncompress</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zcat"> - <term><command>zcat</command></term> - <listitem> - <para>Decompresses the given gzipped files to standard output</para> - <indexterm zone="ch-system-gzip zcat"> - <primary sortas="b-zcat">zcat</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zcmp"> - <term><command>zcmp</command></term> - <listitem> - <para>Runs <command>cmp</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zcmp"> - <primary sortas="b-zcmp">zcmp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zdiff"> - <term><command>zdiff</command></term> - <listitem> - <para>Runs <command>diff</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zdiff"> - <primary sortas="b-zdiff">zdiff</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zegrep"> - <term><command>zegrep</command></term> - <listitem> - <para>Runs <command>egrep</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zegrep"> - <primary sortas="b-zegrep">zegrep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zfgrep"> - <term><command>zfgrep</command></term> - <listitem> - <para>Runs <command>fgrep</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zfgrep"> - <primary sortas="b-zfgrep">zfgrep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zforce"> - <term><command>zforce</command></term> - <listitem> - <para>Forces a <filename class="extension">.gz</filename> extension on - all given files that are gzipped files, so that <command>gzip</command> - will not compress them again; this can be useful when file names were - truncated during a file transfer</para> - <indexterm zone="ch-system-gzip zforce"> - <primary sortas="b-zforce">zforce</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zgrep"> - <term><command>zgrep</command></term> - <listitem> - <para>Runs <command>grep</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zgrep"> - <primary sortas="b-zgrep">zgrep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zless"> - <term><command>zless</command></term> - <listitem> - <para>Runs <command>less</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zless"> - <primary sortas="b-zless">zless</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zmore"> - <term><command>zmore</command></term> - <listitem> - <para>Runs <command>more</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zmore"> - <primary sortas="b-zmore">zmore</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="znew"> - <term><command>znew</command></term> - <listitem> - <para>Re-compresses files from <command>compress</command> format to - <command>gzip</command> format—<filename - class="extension">.Z</filename> to <filename - class="extension">.gz</filename></para> - <indexterm zone="ch-system-gzip znew"> - <primary sortas="b-znew">znew</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-gzip" role="."/></para> </sect2> diff --git a/chapter06/introduction.xml b/chapter06/introduction.xml index 876112796..ed8000fa8 100644 --- a/chapter06/introduction.xml +++ b/chapter06/introduction.xml @@ -5,79 +5,26 @@ %general-entities; ]> -<sect1 id="ch-system-introduction"> +<sect1 id="ch-tools-introduction-cross"> <?dbhtml filename="introduction.html"?> <title>Introduction - In this chapter, we enter the building site and start constructing the - LFS system in earnest. That is, we chroot into the temporary mini Linux system, - make a few final preparations, and then begin installing the packages. + This chapter shows how to cross-compile basic utilities using + the just built cross-toolchain. Those utilities are installed into + their final location, but cannot be used yet. Basic tasks still rely on + the host's tools. Nevertheless, the installed libraries are used when + linking. - The installation of this software is straightforward. Although in many - cases the installation instructions could be made shorter and more generic, - we have opted to provide the full instructions for every package to minimize - the possibilities for mistakes. The key to learning what makes a Linux system - work is to know what each package is used for and why you (or the system) - may need it. + Using the utilities will be possible in next chapter after entering + the chroot environment. But all the packages built in the + present chapter need to be built before we do that. Therefore we cannot be + independent of the host system yet. - We do not recommend using optimizations. They can make - a program run slightly faster, but they may also cause compilation - difficulties and problems when running the program. If a package refuses to - compile when using optimization, try to compile it without optimization and - see if that fixes the problem. Even if the package does compile when using - optimization, there is the risk it may have been compiled incorrectly because - of the complex interactions between the code and build tools. Also note that - the and options using values - not specified in the book have not been tested. This may cause problems with - the toolchain packages (Binutils, GCC and Glibc). The small potential gains - achieved in using compiler optimizations are often outweighed by the risks. - First-time builders of LFS are encouraged to build without custom - optimizations. The subsequent system will still run very fast and be stable - at the same time. - - The order that packages are installed in this chapter needs to be - strictly followed to ensure that no program accidentally acquires a path - referring to /tools hard-wired into - it. For the same reason, do not compile separate packages in parallel. - Compiling in parallel may save time (especially on dual-CPU machines), but it - could result in a program containing a hard-wired path to /tools, which will cause the program to stop - working when that directory is removed. - - Before the installation instructions, each installation page provides - information about the package, including a concise description of what it - contains, approximately how long it will take to build, and how much disk - space is required during this building process. Following the installation - instructions, there is a list of programs and libraries (along with brief - descriptions of these) that the package installs. - - The SBU values and required disk space includes - test suite data for all applicable packages in Chapter 6. - - - About libraries - - In general, the LFS editors discourage building and installing static - libraries. The original purpose for most static libraries has been made - obsolete in a modern Linux system. In addition linking a static library - into a program can be detrimental. If an update to the library is needed - to remove a security problem, all programs that use the static library will - need to be relinked to the new library. Since the use of static libraries - is not always obvious, the relevant programs (and the procedures needed to - do the linking) may not even be known. - - In the procedures in Chapter 6, we remove or disable installation of - most static libraries. Usually this is done by passing a - option to configure. - In other cases, alternate means are needed. In a few cases, especially - glibc and gcc, the use of static libraries remains essential to the general - package building process. - - For a more complete discussion of libraries, see the discussion - - Libraries: Static or shared? in the BLFS book. - - + Once again, let us recall that improper setting of LFS + together with building as root, may render your computer unusable. + This whole chapter must be done as user lfs, with the enviroment as described in + . diff --git a/chapter06/isl.xml b/chapter06/isl.xml deleted file mode 100644 index 8420101af..000000000 --- a/chapter06/isl.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - %general-entities; -]> - - - - - - isl - &isl-version; -
&isl-url;
-
- - ISL-&isl-version; - - - ISL - - - - - - <para>ISL is a thread-safe C library for manipulating sets and relations - of integer points bounded by affine constraints.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&isl-ch6-sbu;</seg> - <seg>&isl-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of ISL - - Prepare ISL for compilation: - -./configure --prefix=/usr \ - --disable-static \ - --docdir=/usr/share/doc/isl-&isl-version; - - - The meaning of the new configure options: - - - --docdir=/usr/share/doc/isl-&isl-version; - - This variable specifies the correct place for the - documentation. - - - - - - Compile the package: - -make - - Install the package and its documentation: - -make install -install -vd /usr/share/doc/isl-&isl-version; -install -m644 doc/{CodingStyle,manual.pdf,SubmittingPatches,user.pod} \ - /usr/share/doc/isl-&isl-version; - - Finally, move a misplaced file: - -mkdir -pv /usr/share/gdb/auto-load/usr/lib -mv -v /usr/lib/libisl*gdb.py /usr/share/gdb/auto-load/usr/lib - - - - - Contents of ISL - - - Installed Libraries - Installed directory - - - libisl.so - /usr/share/doc/isl-&isl-version; - - - - - Short Descriptions - - - - - libisl - - Contains integer set manipulation functions - - libisl - - - - - - - -
- diff --git a/chapter06/linux-firmware.xml b/chapter06/linux-firmware.xml deleted file mode 100644 index 6042cda9e..000000000 --- a/chapter06/linux-firmware.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - %general-entities; -]> - - - - - - - linux-firmware - &linux-firmware-version; -
&linux-firmware-url;
-
- - Linux-Firmware-&linux-firmware-version; - - - Linux-Firmware - - - - - - <para>The Linux-Firmware package contains propietary kernel "blobs" - required for some specific hardware.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&linux-firmware-ch6-sbu;</seg> - <seg>&linux-firmware-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Linux-Firmware - - Install the Linux-Firmware package with the following commands: - -cp -Rv * /lib/firmware - - - -
diff --git a/chapter06/linux-headers.xml b/chapter06/linux-headers.xml deleted file mode 100644 index f1d4cb14e..000000000 --- a/chapter06/linux-headers.xml +++ /dev/null @@ -1,209 +0,0 @@ - - - %general-entities; -]> - - - - - - linux-headers - &linux-version; -
&linux-url;
-
- - Linux-&linux-version; API Headers - - - Linux - API headers - - - - - - <para>The Linux API Headers (in linux-&linux-version;.tar.xz) expose the - kernel's API for use by Glibc.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&linux-headers-ch6-sbu;</seg> - <seg>&linux-headers-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Linux API Headers - - The Linux kernel needs to expose an Application Programming Interface - (API) for the system's C library (Glibc in LFS) to use. This is done - by way of sanitizing various C header files that are shipped in the Linux - kernel source tarball. - - Make sure there are no stale files and dependencies lying around - from previous activity: - -make mrproper - - Now extract the user-visible kernel headers from the source. - The recommended make target headers_install cannot be - used, because it requires rsync, which is - not available in /tools. The - headers are first placed in ./usr, - then some files used by the kernel developers are removed, then - the files are copied to their final location. - -make headers -find usr/include -name '.*' -delete -rm usr/include/Makefile -cp -rv usr/include/* /usr/include - - - - - Contents of Linux API Headers - - - Installed headers - Installed directories - - - /usr/include/asm/*.h, /usr/include/asm-generic/*.h, - /usr/include/drm/*.h, /usr/include/linux/*.h, /usr/include/misc/*.h, - /usr/include/mtd/*.h, /usr/include/rdma/*.h, /usr/include/scsi/*.h, - /usr/include/sound/*.h, /usr/include/video/*.h, - and /usr/include/xen/*.h - /usr/include/asm, /usr/include/asm-generic, /usr/include/drm, - /usr/include/linux, /usr/include/misc, /usr/include/mtd, - /usr/include/rdma, /usr/include/scsi, /usr/include/sound, - /usr/include/video, and /usr/include/xen - - - - - Short Descriptions - - - - - /usr/include/asm/*.h - - The Linux API ASM Headers - - /usr/include/asm/*.h - - - - - - /usr/include/asm-generic/*.h - - The Linux API ASM Generic Headers - - /usr/include/asm-generic/*.h - - - - - - /usr/include/drm/*.h - - The Linux API DRM Headers - - /usr/include/drm/*.h - - - - - - /usr/include/linux/*.h - - The Linux API Linux Headers - - /usr/include/linux/*.h - - - - - - /usr/include/misc/*.h - - The Linux API Miscellaneous Headers - - /usr/include/misc/*.h - - - - - - /usr/include/mtd/*.h - - The Linux API MTD Headers - - /usr/include/mtd/*.h - - - - - - /usr/include/rdma/*.h - - The Linux API RDMA Headers - - /usr/include/rdma/*.h - - - - - - /usr/include/scsi/*.h - - The Linux API SCSI Headers - - /usr/include/scsi/*.h - - - - - - /usr/include/sound/*.h - - The Linux API Sound Headers - - /usr/include/sound/*.h - - - - - - /usr/include/video/*.h - - The Linux API Video Headers - - /usr/include/video/*.h - - - - - - /usr/include/xen/*.h - - The Linux API Xen Headers - - /usr/include/xen/*.h - - - - - - - - -
diff --git a/chapter06/m4.xml b/chapter06/m4.xml index 7fe282ee7..7a28a08cc 100644 --- a/chapter06/m4.xml +++ b/chapter06/m4.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,22 +16,25 @@ M4-&m4-version; - + M4 + tools - <para>The M4 package contains a macro processor.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/m4.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&m4-ch6-sbu;</seg> - <seg>&m4-ch6-du;</seg> + <seg>&m4-tmp-sbu;</seg> + <seg>&m4-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -40,64 +43,31 @@ <sect2 role="installation"> <title>Installation of M4 - First, make some fixes required by glibc-2.28: + First, make some fixes introduced by glibc-2.28: sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h Prepare M4 for compilation: -./configure --prefix=/usr +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) Compile the package: make - To test the results, issue: - -make check - Install the package: -make install +make DESTDIR=$LFS install - - Contents of M4 - - - Installed program - - - m4 - - - - - Short Descriptions - - - - - - m4 - - Copies the given files while expanding the macros that they - contain [These macros are either built-in or user-defined and can - take any number of arguments. Besides performing macro expansion, - m4 has built-in functions for including named - files, running Unix commands, performing integer arithmetic, - manipulating text, recursion, etc. The m4 program - can be used either as a front-end to a compiler or as a macro processor - in its own right.] - - m4 - - - - - + + + <para>Details on this package are located in + <xref linkend="contents-m4" role="."/></para> </sect2> diff --git a/chapter06/make.xml b/chapter06/make.xml index 9c649cdc5..cf0dbce18 100644 --- a/chapter06/make.xml +++ b/chapter06/make.xml @@ -4,8 +4,7 @@ <!ENTITY % general-entities SYSTEM "../general.ent"> %general-entities; ]> - -<sect1 id="ch-system-make" role="wrap"> +<sect1 id="ch-tools-make" role="wrap"> <?dbhtml filename="make.html"?> <sect1info condition="script"> @@ -16,22 +15,25 @@ <title>Make-&make-version; - + Make + tools - <para>The Make package contains a program for compiling packages.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/make.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&make-ch6-sbu;</seg> - <seg>&make-ch6-du;</seg> + <seg>&make-tmp-sbu;</seg> + <seg>&make-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -39,60 +41,42 @@ <sect2 role="installation"> <title>Installation of Make - Prepare Make for compilation: -./configure --prefix=/usr +./configure --prefix=/usr \ + --without-guile \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) + + + The meaning of the new configure option: + + + --without-guile + + Although we are cross-compiling, configure tries to use + guile from the build host if it finds it. This makes compilation + fail, so this switch prevents using it. + + + Compile the package: make - The test suite needs to know where supporting perl files are located. - We use an environment variable to accomplish this. To test the - results, issue: - -make check - Install the package: -make install +make DESTDIR=$LFS install + + - <sect2 id="contents-make" role="content"> - <title>Contents of Make - - - Installed program - - - make - - - - - Short Descriptions - - - - - make - - Automatically determines which pieces of a package need to - be (re)compiled and then issues the relevant commands - - make - - - - - + Details on this package are located in + diff --git a/chapter06/ncurses.xml b/chapter06/ncurses.xml index ba5daaec3..0e3646b87 100644 --- a/chapter06/ncurses.xml +++ b/chapter06/ncurses.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,23 +16,25 @@ Ncurses-&ncurses-version; - + Ncurses + tools - <para>The Ncurses package contains libraries for terminal-independent - handling of character screens.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/ncurses.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&ncurses-ch6-sbu;</seg> - <seg>&ncurses-ch6-du;</seg> + <seg>&ncurses-tmp-sbu;</seg> + <seg>&ncurses-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -41,31 +43,54 @@ <sect2 role="installation"> <title>Installation of Ncurses - Don't install a static library that is not handled by configure: + First, ensure that gawk is found first during configuration: -sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in +sed -i s/mawk// configure + + Then, run the following commands to build the tic + program on the build host: + +mkdir build +pushd build + ../configure + make -C include + make -C progs tic +popd Prepare Ncurses for compilation: -./configure --prefix=/usr \ - --mandir=/usr/share/man \ - --with-shared \ - --without-debug \ - --without-normal \ - --enable-pc-files \ +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(./config.guess) \ + --mandir=/usr/share/man \ + --with-manpage-format=normal \ + --with-shared \ + --without-debug \ + --without-ada \ + --without-normal \ --enable-widec -./configure --prefix=/usr \ - --mandir=/usr/share/man \ - --with-shared \ - --without-debug \ - --without-normal \ - --enable-pc-files \ - --enable-widec \ - --with-pkg-config-libdir=/usr/lib/pkgconfig The meaning of the new configure options: + + --with-manpage-format=normal + + This prevents Ncurses installing compressed manual + pages, which may happen if the host distribution itself + has compressed manual pages. + + + + + --without-ada + + This ensures that Ncurses does not build support for the Ada + compiler which may be present on the host but will not be available + once we enter the chroot environment. + + + --enable-widec @@ -80,14 +105,6 @@ - - --enable-pc-files - - This switch generates and installs .pc files for pkg-config. - - - - --without-normal @@ -96,417 +113,111 @@ - - --with-pkg-config-libdir=/usr/lib/pkgconfig - - This switch forces .pc to be installed in /usr/lib/pkgconfig. If - not set, .pc files gets installed in /usr/lib32 even for 64bit binaries. - - - - Compile the package: make - This package has a test suite, but it can only be run after the - package has been installed. The tests reside in the - test/ directory. See the - README file in that directory for further details. - - Install the package: - -make install + +make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install +ln -s libncursesw.so $LFS/usr/lib/libncurses.so Move the shared libraries to the /lib directory, where they are expected to reside: -mv -v /usr/lib/libncursesw.so.6* /lib +mv -v $LFS/usr/lib/libncursesw.so.6* $LFS/lib Because the libraries have been moved, one symlink points to a non-existent file. Recreate it: -ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so - - Many applications still expect the linker to be able to find - non-wide-character Ncurses libraries. Trick such applications into linking with - wide-character libraries by means of symlinks and linker scripts: - -for lib in ncurses form panel menu ; do - rm -vf /usr/lib/lib${lib}.so - echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so - ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc -done - - Finally, make sure that old applications that look for - -lcurses at build time are still - buildable: - -rm -vf /usr/lib/libcursesw.so -echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so -ln -sfv libncurses.so /usr/lib/libcurses.so - - If desired, install the Ncurses documentation: - -mkdir -v /usr/share/doc/ncurses-&ncurses-version; -cp -v -R doc/* /usr/share/doc/ncurses-&ncurses-version; - - - The instructions above don't create non-wide-character Ncurses - libraries since no package installed by compiling from sources would link - against them at runtime. However, the only known binary-only - applications that link against non-wide-character Ncurses libraries - require version 5. If you must have such libraries because of some binary-only - application or to be compliant with LSB, build the package again with the - following commands: - -make distclean -./configure --prefix=/usr \ - --with-shared \ - --without-normal \ - --without-debug \ - --without-cxx-binding \ - --with-abi-version=5 -make sources libs -cp -av lib/lib*.so.5* /usr/lib - - +ln -sfv ../../lib/$(readlink $LFS/usr/lib/libncursesw.so) $LFS/usr/lib/libncursesw.so - - - - Installation of Ncurses - 32-bit + + + + + Building Ncurses - 32bit Clean previous build: make distclean - Prepare Ncurses for compilation: + Prepare Ncurses for compilation: -CC="gcc -m32" CXX="g++ -m32" \ - ./configure --prefix=/usr \ - --libdir=/usr/lib32 \ - --mandir=/usr/share/man \ - --with-shared \ - --without-debug \ - --without-normal \ - --enable-pc-files \ - --enable-widec \ - --host=i686-pc-linux-gnu \ - --with-pkg-config-libdir=/usr/lib32/pkgconfig +CC="$LFS_TGT-gcc -m32" \ +CXX="$LFS_TGT-g++ -m32" \ +./configure --prefix=/usr \ + --host=$LFS_TGT32 \ + --libdir=&usr-lib-m32; \ + --mandir=/usr/share/man \ + --with-shared \ + --without-debug \ + --without-normal \ + --enable-pc-files \ + --enable-widec \ + --with-pkg-config-libdir=&usr-lib-m32;/pkgconfig Compile the package: -make -j1 +make Install the package: -make DESTDIR=$PWD/DESTDIR install -for lib in ncurses form panel menu ; do - rm -vf DESTDIR/usr/lib32/lib${lib}.so - echo "INPUT(-l${lib}w)" > DESTDIR/usr/lib32/lib${lib}.so - ln -svf ${lib}w.pc DESTDIR/usr/lib32/pkgconfig/$lib.pc -done -rm -vf DESTDIR/usr/lib32/libcursesw.so -echo "INPUT(-lncursesw)" > DESTDIR/usr/lib32/libcursesw.so -ln -sfv libncurses.so DESTDIR/usr/lib32/libcurses.so -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +make DESTDIR=$PWD/DESTDIR TIC_PATH=$(pwd)/build/progs/tic install +ln -s libncursesw.so DESTDIR&usr-lib-m32;/libcursesw.so +cp -Rv DESTDIR&usr-lib-m32;/* $LFS&usr-lib-m32; rm -rf DESTDIR - If desired, make the version 5 libraries in 32bit as well: + -make distclean -CC="gcc -m32" CXX="g++ -m32" \ - ./configure --prefix=/usr \ - --with-shared \ - --without-normal \ - --without-debug \ - --without-cxx-binding \ - --with-abi-version=5 \ - --host=i686-pc-linux-gnu -make -j1 sources libs -cp -av lib/lib*.so.5* /usr/lib32 - - - - - - - Installation of Ncurses - x32-bit + + + + + Building Ncurses - x32bit Clean previous build: make distclean - Prepare Ncurses for compilation: + Prepare Ncurses for compilation: -CC="gcc -mx32" CXX="g++ -mx32" \ - ./configure --prefix=/usr \ - --libdir=/usr/libx32 \ - --mandir=/usr/share/man \ - --with-shared \ - --without-debug \ - --without-normal \ - --enable-pc-files \ - --enable-widec \ - --host=x86_64-pc-linux-gnux32 \ - --with-pkg-config-libdir=/usr/libx32/pkgconfig +CC="$LFS_TGT-gcc -mx32" \ +CXX="$LFS_TGT-g++ -mx32" \ +./configure --prefix=/usr \ + --host=$LFS_TGTX32 \ + --libdir=&usr-lib-mx32; \ + --mandir=/usr/share/man \ + --with-shared \ + --without-debug \ + --without-normal \ + --enable-pc-files \ + --enable-widec \ + --with-pkg-config-libdir=&usr-lib-mx32;/pkgconfig Compile the package: -make -j1 +make Install the package: -make DESTDIR=$PWD/DESTDIR install -for lib in ncurses form panel menu ; do - rm -vf DESTDIR/usr/libx32/lib${lib}.so - echo "INPUT(-l${lib}w)" > DESTDIR/usr/libx32/lib${lib}.so - ln -svf ${lib}w.pc DESTDIR/usr/libx32/pkgconfig/$lib.pc -done -rm -vf DESTDIR/usr/libx32/libcursesw.so -echo "INPUT(-lncursesw)" > DESTDIR/usr/libx32/libcursesw.so -ln -sfv libncurses.so DESTDIR/usr/libx32/libcurses.so -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +make DESTDIR=$PWD/DESTDIR TIC_PATH=$(pwd)/build/progs/tic install +ln -s libncursesw.so DESTDIR&usr-lib-mx32;/libcursesw.so +cp -Rv DESTDIR&usr-lib-mx32;/* $LFS&usr-lib-mx32; rm -rf DESTDIR - - If desired, make the version 5 libraries in x32bit as well: + + -<screen><userinput remap="install">make distclean -CC="gcc -mx32" CXX="g++ -mx32" \ - ./configure - -prefix=/usr \ - - -with-shared \ - - -without-normal \ - - -without-debug \ - - -without-cxx-binding \ - - -with-abi-version=5 -make -j1 sources libs -cp -av lib/lib*.so.5* /usr/libx32</userinput></screen> ---> - </sect2> - - <sect2 id="contents-ncurses" role="content"> - <title>Contents of Ncurses - - - Installed programs - Installed libraries - Installed directories - - - - captoinfo (link to tic), - clear, - infocmp, - infotocap (link to tic), - ncursesw6-config, - reset (link to tset), - tabs, - tic, - toe, - tput, and - tset - - - libcursesw.so (symlink and linker script to libncursesw.so), - libformw.so, - libmenuw.so, - libncursesw.so, - libncurses++w.a, - libpanelw.so, and their non-wide-character counterparts without "w" - in the library names. - - /usr/share/tabset, - /usr/share/terminfo, and - /usr/share/doc/ncurses-&ncurses-version; - - - - - - Short Descriptions - - - - - captoinfo - - Converts a termcap description into a terminfo description - - captoinfo - - - - - - clear - - Clears the screen, if possible - - clear - - - - - - infocmp - - Compares or prints out terminfo descriptions - - infocmp - - - - - - infotocap - - Converts a terminfo description into a termcap description - - infotocap - - - - - - ncursesw6-config - - Provides configuration information for ncurses - - ncursesw6-config - - - - - - reset - - Reinitializes a terminal to its default values - - reset - - - - - - tabs - - Clears and sets tab stops on a terminal - - tabs - - - - - - tic - - The terminfo entry-description compiler that translates a - terminfo file from source format into the binary format needed for the - ncurses library routines [A terminfo file contains information on the - capabilities of a certain terminal.] - - tic - - - - - - toe - - Lists all available terminal types, giving the primary name and - description for each - - toe - - - - - - tput - - Makes the values of terminal-dependent capabilities available to - the shell; it can also be used to reset or initialize a terminal or - report its long name - - tput - - - - - - tset - - Can be used to initialize terminals - - tset - - - - - - libcursesw - - A link to libncursesw - - libcursesw - - - - - - libncursesw - - Contains functions to display text in many complex ways on a - terminal screen; a good example of the use of these functions is the - menu displayed during the kernel's make - menuconfig - - libncursesw - - - - - - libformw - - Contains functions to implement forms - - libformw - - - - - - libmenuw - - Contains functions to implement menus - - libmenuw - - - - - - libpanelw - - Contains functions to implement panels - - libpanelw - - - - - + Details on this package are located in + diff --git a/chapter06/patch.xml b/chapter06/patch.xml index 6c6c6852b..7032d6eea 100644 --- a/chapter06/patch.xml +++ b/chapter06/patch.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,24 +16,25 @@ Patch-&patch-version; - + Patch + tools - <para>The Patch package contains a program for modifying or creating files - by applying a <quote>patch</quote> file typically created by the - <command>diff</command> program.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/patch.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&patch-ch6-sbu;</seg> - <seg>&patch-ch6-du;</seg> + <seg>&patch-tmp-sbu;</seg> + <seg>&patch-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -44,52 +45,25 @@ <para>Prepare Patch for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess)</userinput></screen> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make check</userinput></screen> - <para>Install the package:</para> -<screen><userinput remap="install">make install</userinput></screen> +<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> </sect2> - <sect2 id="contents-patch" role="content"> - <title>Contents of Patch + + - <segmentedlist> - <segtitle>Installed program</segtitle> - - <seglistitem> - <seg>patch</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="patch"> - <term><command>patch</command></term> - <listitem> - <para>Modifies files according to a patch file [A patch file is - normally a difference listing created with the <command>diff</command> - program. By applying these differences to the original files, - <command>patch</command> creates the patched versions.]</para> - <indexterm zone="ch-system-patch patch"> - <primary sortas="b-patch">patch</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-patch" role="."/></para> </sect2> diff --git a/chapter06/sed.xml b/chapter06/sed.xml index 71bfc245f..d079f836d 100644 --- a/chapter06/sed.xml +++ b/chapter06/sed.xml @@ -5,7 +5,7 @@ %general-entities; ]> -<sect1 id="ch-system-sed" role="wrap"> +<sect1 id="ch-tools-sed" role="wrap"> <?dbhtml filename="sed.html"?> <sect1info condition="script"> @@ -16,22 +16,25 @@ <title>Sed-&sed-version; - + Sed + tools - <para>The Sed package contains a stream editor.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/sed.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> - <segtitle>&buildtime;</segtitle> + <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&sed-ch6-sbu;</seg> - <seg>&sed-ch6-du;</seg> + <seg>&sed-tmp-sbu;</seg> + <seg>&sed-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -40,61 +43,27 @@ <sect2 role="installation"> <title>Installation of Sed - First fix an issue in the LFS environment: - -sed -i 's/usr/tools/' build-aux/help2man - Prepare Sed for compilation: -./configure --prefix=/usr --bindir=/bin +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --bindir=/bin - Compile the package and generate the HTML documentation: + Compile the package: -make -make html +make - To test the results, issue: + Install the package: -chown -Rv tester . -su tester -c "PATH=$PATH make check" - - Install the package and its documentation: - -make install -install -d -m755 /usr/share/doc/sed-&sed-version; -install -m644 doc/sed.html /usr/share/doc/sed-&sed-version; +make DESTDIR=$LFS install - - Contents of Sed + + - <segmentedlist> - <segtitle>Installed program</segtitle> - <segtitle>Installed directory</segtitle> - - <seglistitem> - <seg>sed</seg> - <seg>/usr/share/doc/sed-&sed-version;</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="sed"> - <term><command>sed</command></term> - <listitem> - <para>Filters and transforms text files in a single pass</para> - <indexterm zone="ch-system-sed sed"> - <primary sortas="b-sed">sed</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-sed" role="."/></para> </sect2> diff --git a/chapter06/tar.xml b/chapter06/tar.xml index d148c4695..8a82cff5c 100644 --- a/chapter06/tar.xml +++ b/chapter06/tar.xml @@ -5,7 +5,7 @@ %general-entities; ]> -<sect1 id="ch-system-tar" role="wrap"> +<sect1 id="ch-tools-tar" role="wrap"> <?dbhtml filename="tar.html"?> <sect1info condition="script"> @@ -16,22 +16,25 @@ <title>Tar-&tar-version; - + Tar + tools - <para>The Tar package contains an archiving program.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/tar.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&tar-ch6-sbu;</seg> - <seg>&tar-ch6-du;</seg> + <seg>&tar-tmp-sbu;</seg> + <seg>&tar-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -42,74 +45,25 @@ <para>Prepare Tar for compilation:</para> -<screen><userinput remap="configure">FORCE_UNSAFE_CONFIGURE=1 \ -./configure --prefix=/usr \ +<screen><userinput remap="configure">./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) \ --bindir=/bin</userinput></screen> - <variablelist> - <title>The meaning of the configure options: - - - FORCE_UNSAFE_CONFIGURE=1 - - This forces the test for mknod to be run - as root. It is generally considered dangerous to run this test as - the root user, but as it is being run on a system that has only been - partially built, overriding it is OK. - - - - Compile the package: make - To test the results (about 3 SBU), issue: - -make check - - - Install the package: -make install -make -C doc install-html docdir=/usr/share/doc/tar-&tar-version; +make DESTDIR=$LFS install + + - <sect2 id="contents-tar" role="content"> - <title>Contents of Tar - - - Installed programs - Installed directory - - - tar - /usr/share/doc/tar-&tar-version; - - - - - Short Descriptions - - - - - tar - - Creates, extracts files from, and lists the contents of archives, - also known as tarballs - - tar - - - - - + Details on this package are located in diff --git a/chapter06/xz.xml b/chapter06/xz.xml index 79081bbb1..f8d397d1b 100644 --- a/chapter06/xz.xml +++ b/chapter06/xz.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,26 +16,25 @@ Xz-&xz-version; - + Xz + tools - <para>The Xz package contains programs for compressing and decompressing - files. It provides capabilities for the lzma and the newer xz compression - formats. Compressing text files with <command>xz</command> yields a better - compression percentage than with the traditional <command>gzip</command> or - <command>bzip2</command> commands.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/xz.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&xz-ch6-sbu;</seg> - <seg>&xz-ch6-du;</seg> + <seg>&xz-tmp-sbu;</seg> + <seg>&xz-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -44,378 +43,33 @@ <sect2 role="installation"> <title>Installation of Xz - Prepare Xz for compilation with: + Prepare Xz for compilation: -./configure --prefix=/usr \ - --disable-static \ +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) \ + --disable-static \ --docdir=/usr/share/doc/xz-&xz-version; - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package and make sure that all essential files are in the - correct directory: - -make install -mv -v /usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} /bin -mv -v /usr/lib/liblzma.so.* /lib -ln -svf ../../lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.so - - - - - - - Installation of Xz - 32-bit - - Clean previous build: - -make distclean - - Prepare Xz for compilation: - -CC="gcc -m32" ./configure \ - --prefix=/usr \ - --disable-static \ - --libdir=/usr/lib32 \ - --host=i686-pc-linux-gnu - - Compile the package: + Compile the package: make Install the package: -make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 -rm -rf DESTDIR +make DESTDIR=$LFS install + + Make sure that all essential files are in the correct directory: + +mv -v $LFS/usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} $LFS/bin +mv -v $LFS/usr/lib/liblzma.so.* $LFS/lib +ln -svf ../../lib/$(readlink $LFS/usr/lib/liblzma.so) $LFS/usr/lib/liblzma.so - - - - Installation of Xz - x32-bit - - Clean previous build: - -make distclean - - Prepare Xz for compilation: - -CC="gcc -mx32" ./configure \ - --prefix=/usr \ - --disable-static \ - --libdir=/usr/libx32 \ - --host=x86_64-pc-linux-gnux32 - - Compile the package: - -make - - Install the package: - -make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 -rm -rf DESTDIR - - - - - Contents of Xz - - - Installed programs - Installed libraries - Installed directories - - - - lzcat (link to xz), - lzcmp (link to xzdiff), - lzdiff (link to xzdiff), - lzegrep (link to xzgrep), - lzfgrep (link to xzgrep), - lzgrep (link to xzgrep), - lzless (link to xzless), - lzma (link to xz), - lzmadec, - lzmainfo, - lzmore (link to xzmore), - unlzma (link to xz), - unxz (link to xz), - xz, - xzcat (link to xz), - xzcmp (link to xzdiff), - xzdec, - xzdiff, - xzegrep (link to xzgrep), - xzfgrep (link to xzgrep), - xzgrep, - xzless, and - xzmore - - liblzma.so - - - /usr/include/lzma and - /usr/share/doc/xz-&xz-version; - - - - - - Short Descriptions - - - - - lzcat - - Decompresses to standard output - - lzcat - - - - - - lzcmp - - Runs cmp on LZMA compressed files - - lzcmp - - - - - - lzdiff - - Runs diff on LZMA compressed files - - lzdiff - - - - - - lzegrep - - Runs egrep on LZMA compressed files - - lzegrep - - - - - - lzfgrep - - Runs fgrep on LZMA compressed files - - lzfgrep - - - - - - lzgrep - - Runs grep on LZMA compressed files - - lzgrep - - - - - - lzless - - Runs less on LZMA compressed files - - lzless - - - - - - lzma - - Compresses or decompresses files using the LZMA format - - lzma - - - - - - lzmadec - - A small and fast decoder for LZMA compressed files - - lzmadec - - - - - - lzmainfo - - Shows information stored in the LZMA compressed file header - - lzmainfo - - - - - - lzmore - - Runs more on LZMA compressed files - - lzmore - - - - - - unlzma - - Decompresses files using the LZMA format - - unlzma - - - - - - unxz - - Decompresses files using the XZ format - - unxz - - - - - - xz - - Compresses or decompresses files using the XZ format - - xz - - - - - - xzcat - - Decompresses to standard output - - xzcat - - - - - - xzcmp - - Runs cmp on XZ compressed files - - xzcmp - - - - - - xzdec - - A small and fast decoder for XZ compressed files - - xzdec - - - - - - xzdiff - - Runs diff on XZ compressed files - - xzdiff - - - - - - xzegrep - - Runs egrep on XZ compressed files - - xzegrep - - - - - - xzfgrep - - Runs fgrep on XZ compressed files - - xzfgrep - - - - - - xzgrep - - Runs grep on XZ compressed files - - xzgrep - - - - - - xzless - - Runs less on XZ compressed files - - xzless - - - - - - xzmore - - Runs more on XZ compressed files - - xzmore - - - - - - liblzma - - The library implementing lossless, block-sorting data - compression, using the Lempel-Ziv-Markov chain algorithm - - liblzma - - - - - + + + <para>Details on this package are located in <xref linkend="contents-xz" role="."/></para> </sect2> diff --git a/chapter05/bison.xml b/chapter07/bison.xml similarity index 69% rename from chapter05/bison.xml rename to chapter07/bison.xml index 98c8cdc35..a3718bf19 100644 --- a/chapter05/bison.xml +++ b/chapter07/bison.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/bison.xml" + href="../chapter08/bison.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> @@ -33,8 +33,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&bison-ch5-sbu;</seg> - <seg>&bison-ch5-du;</seg> + <seg>&bison-tmp-sbu;</seg> + <seg>&bison-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -45,16 +45,26 @@ <para>Prepare Bison for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr \ + --docdir=/usr/share/doc/bison-&bison-version;</userinput></screen> + + <variablelist> + <title>The meaning of the new configure option: + + + --docdir=/usr/share/doc/bison-&bison-version; + + This tells the build system to install bison documentation + into a versioned directory. + + + + Compile the package: make - To test the results, issue: - -make check - Install the package: make install diff --git a/chapter07/changingowner.xml b/chapter07/changingowner.xml new file mode 100644 index 000000000..78a987722 --- /dev/null +++ b/chapter07/changingowner.xml @@ -0,0 +1,46 @@ + + + %general-entities; +]> + + + + + Changing Ownership + + + The commands in the remainder of this book must be performed while + logged in as user root and no + longer as user lfs. Also, double + check that $LFS is set in root's environment. + + + Currently, the whole directory hierarchy in $LFS + is owned by the user lfs, a user + that exists only on the host system. If the directories and files under $LFS are kept as they are, they will be + owned by a user ID without a corresponding account. This is dangerous because + a user account created later could get this same user ID and would own all + the files under $LFS, thus exposing + these files to possible malicious manipulation. + + To address this issue, change the + ownership of the $LFS/* directories to + user root by running the following + command: + +chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,tools} +case $(uname -m) in + x86_64) chown -R root:root $LFS/lib64 ;; +esac + + Some more directories exists for + multilib support. Change their ownership, too: +chown -R root:root $LFS&lib-m32; +chown -R root:root $LFS&lib-mx32; + + diff --git a/chapter07/chapter07.xml b/chapter07/chapter07.xml index b745594da..aba235220 100644 --- a/chapter07/chapter07.xml +++ b/chapter07/chapter07.xml @@ -5,39 +5,32 @@ %general-entities; ]> - + - System Configuration + Entering Chroot and Building Additional Temporary Tools - - + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + diff --git a/chapter06/chroot.xml b/chapter07/chroot.xml similarity index 68% rename from chapter06/chroot.xml rename to chapter07/chroot.xml index c4a66bf00..7f85a73e8 100644 --- a/chapter06/chroot.xml +++ b/chapter07/chroot.xml @@ -5,22 +5,25 @@ %general-entities; ]> - + Entering the Chroot Environment - It is time to enter the chroot environment to begin building and - installing the final LFS system. As user Now that all the packages which are required to build the rest of the + needed tools are on the system, it is time to enter the chroot environment to + finish installing the remaining temporary tools. This environment will be in + use also for installing the final system. As user root, run the following command to enter the - realm that is, at the moment, populated with only the temporary tools: + environment that is, at the moment, populated with only the temporary + tools: -chroot "$LFS" /tools/bin/env -i \ +chroot "$LFS" /usr/bin/env -i \ HOME=/root \ TERM="$TERM" \ PS1='(lfs chroot) \u:\w\$ ' \ - PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ - /tools/bin/bash --login +h + PATH=/bin:/usr/bin:/sbin:/usr/sbin \ + /bin/bash --login +h The -i option given to the env command will clear all variables of the chroot environment. After that, only @@ -29,19 +32,19 @@ TERM=$TERM construct will set the TERM variable inside chroot to the same value as outside chroot. This variable is needed for programs like vim and less - to operate properly. If other variables are needed, such as + to operate properly. If other variables are desired, such as CFLAGS or CXXFLAGS, this is a good place to set them again. From this point on, there is no need to use the - LFS variable anymore, because all work will be restricted + LFS variable anymore because all work will be restricted to the LFS file system. This is because the Bash shell is told that $LFS is now the root (/) directory. - Notice that /tools/bin comes last - in the PATH. This means that a temporary tool will no longer be - used once its final version is installed. This occurs when the shell does not + Notice that /tools/bin is not + in the PATH. This means that the cross toolchain will no longer be + used in the chroot environment. This occurs when the shell does not remember the locations of executed binaries—for this reason, hashing is switched off by passing the +h option to bash. @@ -55,8 +58,8 @@ chapter and the following chapters are run from within the chroot environment. If you leave this environment for any reason (rebooting for example), ensure that the virtual kernel filesystems are mounted as - explained in and and enter chroot again before continuing + explained in and and enter chroot again before continuing with the installation. diff --git a/chapter07/createfiles.xml b/chapter07/createfiles.xml new file mode 100644 index 000000000..c81ec9b1c --- /dev/null +++ b/chapter07/createfiles.xml @@ -0,0 +1,210 @@ + + + %general-entities; +]> + + + + + Creating Essential Files and Symlinks + + + /etc/passwd + + + + /etc/group + + + + /var/run/utmp + + + + /var/log/btmp + + + + /var/log/lastlog + + + + /var/log/wtmp + + + Historically, Linux maintains a list of the mounted file systems in the + file /etc/mtab. Modern kernels maintain this list + internally and exposes it to the user via the /proc filesystem. To satisfy utilities that + expect the presence of /etc/mtab, create the following + symbolic link: + +ln -sv /proc/self/mounts /etc/mtab + + Create a basic /etc/hosts file to be + referenced in some test suites, and in one of Perl's configuration files + as well: + +echo "127.0.0.1 localhost $(hostname)" > /etc/hosts + + In order for user root to be + able to login and for the name root to be recognized, there + must be relevant entries in the /etc/passwd and + /etc/group files. + + Create the /etc/passwd file by running the following + command: + +cat > /etc/passwd << "EOF" +root:x:0:0:root:/root:/bin/bash +bin:x:1:1:bin:/dev/null:/bin/false +daemon:x:6:6:Daemon User:/dev/null:/bin/false +messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false +nobody:x:99:99:Unprivileged User:/dev/null:/bin/false +EOF + +cat > /etc/passwd << "EOF" +root:x:0:0:root:/root:/bin/bash +bin:x:1:1:bin:/dev/null:/bin/false +daemon:x:6:6:Daemon User:/dev/null:/bin/false +messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false +systemd-bus-proxy:x:72:72:systemd Bus Proxy:/:/bin/false +systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/bin/false +systemd-journal-remote:x:74:74:systemd Journal Remote:/:/bin/false +systemd-journal-upload:x:75:75:systemd Journal Upload:/:/bin/false +systemd-network:x:76:76:systemd Network Management:/:/bin/false +systemd-resolve:x:77:77:systemd Resolver:/:/bin/false +systemd-timesync:x:78:78:systemd Time Synchronization:/:/bin/false +systemd-coredump:x:79:79:systemd Core Dumper:/:/bin/false +nobody:x:99:99:Unprivileged User:/dev/null:/bin/false +EOF + + The actual password for root + will be set later. + + Create the /etc/group file by running the following + command: + +cat > /etc/group << "EOF" +root:x:0: +bin:x:1:daemon +sys:x:2: +kmem:x:3: +tape:x:4: +tty: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: +adm:x:16: +messagebus:x:18: +input:x:24: +mail:x:34: +kvm:x:61: +wheel:x:97: +nogroup:x:99: +users:x:999: +EOF + +cat > /etc/group << "EOF" +root:x:0: +bin:x:1:daemon +sys:x:2: +kmem:x:3: +tape:x:4: +tty: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: +adm:x:16: +messagebus:x:18: +systemd-journal:x:23: +input:x:24: +mail:x:34: +kvm:x:61: +systemd-bus-proxy:x:72: +systemd-journal-gateway:x:73: +systemd-journal-remote:x:74: +systemd-journal-upload:x:75: +systemd-network:x:76: +systemd-resolve:x:77: +systemd-timesync:x:78: +systemd-coredump:x:79: +wheel:x:97: +nogroup:x:99: +users:x:999: +EOF + + The created groups are not part of any standard—they are groups + decided on in part by the requirements of the Udev configuration in Chapter + 9, and in part by common convention employed by a number of existing Linux + distributions. In addition, some test suites rely on specific users or + groups. The Linux Standard Base (LSB, available at ) only recommends 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. + + Some tests in need a regular + user. We add this user here and delete this account at the end of that + chapter. + +echo "tester:x:$(ls -n $(tty) | cut -d" " -f3):101::/home/tester:/bin/bash" >> /etc/passwd +echo "tester:x:101:" >> /etc/group +install -o tester -d /home/tester + + To remove the I have no name! prompt, start a new + shell. Since the + /etc/passwd and /etc/group + files have been created, user name and group name resolution will now + work: + +exec /bin/bash --login +h + + Note the use of the +h directive. This tells + bash not to use its internal path hashing. Without this + directive, bash would remember the paths to binaries it has + executed. To ensure the use of the newly compiled binaries as soon as they are + installed, the +h directive will be used for the duration + of this and the next chapter. + + The login, agetty, and + init programs (and others) use a number of log + files to record information such as who was logged into the system and + when. However, these programs will not write to the log files if they + do not already exist. Initialize the log files and give them + proper permissions: + +touch /var/log/{btmp,lastlog,faillog,wtmp} +chgrp -v utmp /var/log/lastlog +chmod -v 664 /var/log/lastlog +chmod -v 600 /var/log/btmp + + The /var/log/wtmp file records all logins and + logouts. The /var/log/lastlog file records when each + user last logged in. The /var/log/faillog file records + failed login attempts. The /var/log/btmp file records + the bad login attempts. + + The /run/utmp file records the users that + are currently logged in. This file is created dynamically in the boot + scripts. + + diff --git a/chapter06/creatingdirs.xml b/chapter07/creatingdirs.xml similarity index 77% rename from chapter06/creatingdirs.xml rename to chapter07/creatingdirs.xml index 5dc9c5e80..7e843aeff 100644 --- a/chapter06/creatingdirs.xml +++ b/chapter07/creatingdirs.xml @@ -5,37 +5,30 @@ %general-entities; ]> - + Creating Directories - It is time to create some structure in the LFS file system. Create a - standard directory tree by issuing the following commands: + It is time to create the full structure in the LFS file system. Create + a standard directory tree by issuing the following commands: mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt} -mkdir -pv /{media/{floppy,cdrom},sbin,srv,var} -install -dv -m 0750 /root -install -dv -m 1777 /tmp /var/tmp +mkdir -pv /{media/{floppy,cdrom},srv,var} mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src} mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man} -mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo} -mkdir -v /usr/libexec +mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo} mkdir -pv /usr/{,local/}share/man/man{1..8} -mkdir -v /usr/lib/pkgconfig - -case $(uname -m) in - x86_64) mkdir -v /lib64 ;; -esac +install -dv -m 1777 /tmp /var/tmp +install -dv -m 0750 /root mkdir -v /var/{log,mail,spool} ln -sv /run /var/run ln -sv /run/lock /var/lock mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local} -mkdir -pv /usr/lib32 -install -vdm755 /usr/lib32/pkgconfig -mkdir -pv /usr/libx32 -install -vdm755 /usr/libx32/pkgconfig + + Required directories for multilib + support has already been created while previous installation steps. Directories are, by default, created with permission mode 755, but this is not desirable for all directories. In the commands above, two diff --git a/chapter05/gettext.xml b/chapter07/gettext.xml similarity index 74% rename from chapter05/gettext.xml rename to chapter07/gettext.xml index ff064cb7e..12a8b5cfd 100644 --- a/chapter05/gettext.xml +++ b/chapter07/gettext.xml @@ -25,7 +25,7 @@ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/gettext.xml" + href="../chapter08/gettext.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> @@ -33,8 +33,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&gettext-ch5-sbu;</seg> - <seg>&gettext-ch5-du;</seg> + <seg>&gettext-tmp-sbu;</seg> + <seg>&gettext-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -52,16 +52,7 @@ <variablelist> <title>The meaning of the configure option: - + --disable-shared @@ -76,22 +67,17 @@ make - - Due to the limited environment, running the test suite at this stage - is not recommended. - - Install the msgfmt, msgmerge and + Install the msgfmt, msgmerge, and xgettext programs: -cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /tools/bin +cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin - <para>Details on this package are located in - <xref linkend="contents-gettext" role="."/></para> + <para>Details on this package are located in <xref linkend="contents-gettext" role="."/></para> </sect2> diff --git a/chapter07/introduction.xml b/chapter07/introduction.xml index cbc197a7b..1d53f6987 100644 --- a/chapter07/introduction.xml +++ b/chapter07/introduction.xml @@ -5,221 +5,29 @@ %general-entities; ]> -<sect1 id="ch-config-introduction" revision="sysv"> +<sect1 id="ch-tools-introduction-chroot"> <?dbhtml filename="introduction.html"?> <title>Introduction - Booting a Linux system involves several tasks. The process must - mount both virtual and real file systems, initialize devices, activate swap, - check file systems for integrity, mount any swap partitions or files, set - the system clock, bring up networking, start any daemons required by the - system, and accomplish any other custom tasks needed by the user. This - process must be organized to ensure the tasks are performed in the correct - order but, at the same time, be executed as fast as possible. + This chapter shows how to build the last missing bits of the temporary + system: first, the tools needed by the build machinery of various packages, + then three packages needed to run tests. Now that all circular dependencies + have been resolved, we can use a chroot environment, + completely isolated the host operating system used for the build, except + for the running kernel. - + For proper operation of the isolated environment, some communication + with the running kernel must be established. This is done through the + so-called Virtual Kernel File Systems, which must be + mounted when entering the chroot environment. You may want to check + that they are mounted by issuing findmnt. - - System V + Until , the commands must be + run as root, with the + LFS variable set. After entering chroot, all commands + are run as root, fortunately without access to the OS of the computer + you built LFS on. Be careful anyway, as it is easy to destroy the whole + LFS system with badly formed commands. - System V is the classic boot process that has been used in Unix and - Unix-like systems such as Linux since about 1983. It consists of a small - program, init, that sets up basic programs such as - login (via getty) and runs a script. This script, - usually named rc, controls the execution of a set of - additional scripts that perform the tasks required to initialize the - system. - - The init program is controlled by the - /etc/inittab file and is organized into run levels that - can be run by the user: - - -0 — halt -1 — Single user mode -2 — Multiuser, without networking -3 — Full multiuser mode -4 — User definable -5 — Full multiuser mode with display manager -6 — reboot - - - The usual default run level is 3 or 5. - - Advantages - - - - Established, well understood system. - - - - Easy to customize. - - - - - - Disadvantages - - - - Slower to boot. A medium speed base LFS system - takes 8-12 seconds where the boot time is measured from the - first kernel message to the login prompt. Network - connectivity is typically established about 2 seconds - after the login prompt. - - - - Serial processing of boot tasks. This is related to the previous - point. A delay in any process such as a file system check, will - delay the entire boot process. - - - - Does not directly support advanced features like - control groups (cgroups), and per-user fair share scheduling. - - - - Adding scripts requires manual, static sequencing decisions. - - - - - - - diff --git a/chapter06/kernfs.xml b/chapter07/kernfs.xml similarity index 92% rename from chapter06/kernfs.xml rename to chapter07/kernfs.xml index 8d9091c73..a23b7e195 100644 --- a/chapter06/kernfs.xml +++ b/chapter07/kernfs.xml @@ -5,12 +5,12 @@ %general-entities; ]> - + Preparing Virtual Kernel File Systems - + /dev/* @@ -30,9 +30,10 @@ When the kernel boots the system, it requires the presence of a few device nodes, in particular the console and null devices. The device nodes must be created - on the hard disk so that they are available before udevd - has been started, and additionally when Linux is started with + class="devicefile">null devices. The device nodes must be + created on the hard disk so that they are available before the kernel + populates /dev), and + additionally when Linux is started with init=/bin/bash. Create the devices by running the following commands: @@ -41,7 +42,7 @@ mknod -m 666 $LFS/dev/null c 1 3 - + Mounting and Populating /dev The recommended method of populating the - + Mounting Virtual Kernel File Systems Now mount the remaining virtual kernel filesystems: @@ -72,7 +73,7 @@ mknod -m 666 $LFS/dev/null c 1 3 mount -vt proc proc $LFS/proc mount -vt sysfs sysfs $LFS/sys mount -vt tmpfs tmpfs $LFS/run - + In some host systems, /dev/shm is a symbolic link to /run/shm. The /run tmpfs was mounted above so in this case only a diff --git a/chapter07/libstdc++-pass2.xml b/chapter07/libstdc++-pass2.xml new file mode 100644 index 000000000..16a256b63 --- /dev/null +++ b/chapter07/libstdc++-pass2.xml @@ -0,0 +1,136 @@ + + + %general-entities; +]> + + + + + + gcc-libstdc++ + &gcc-version; +
&gcc-url;
+
+ + Libstdc++ from GCC-&gcc-version;, Pass 2 + + + GCC + tools, libstdc++ pass 2 + + + + + + <para>When building <xref linkend="ch-tools-gcc-pass2"/> we had to defer + the installation of the C++ standard library because no suitable compiler + was available to compile it. We could not use the compiler built in that + section because it is a native compiler and should not be used outside of + chroot and risks polluting the libraries with some host components.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&libstdcpp-tmpp2-sbu;</seg> + <seg>&libstdcpp-tmpp2-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Target Libstdc++ + + + Libstdc++ is part of the GCC sources. + You should first unpack the GCC tarball and change to the + gcc-&gcc-version; directory. + + + Create a link which exists when building libstdc++ in the gcc tree: + +ln -s gthr-posix.h libgcc/gthr-default.h + + Create a separate build directory for libstdc++ and enter it: + +mkdir -v build +cd build + + Prepare libstdc++ for compilation: + +../libstdc++-v3/configure \ + CXXFLAGS="-g -O2 -D_GNU_SOURCE" \ + --prefix=/usr \ + --disable-multilib \ + --disable-nls \ + --disable-libstdcxx-pch +../libstdc++-v3/configure \ + CXXFLAGS="-g -O2 -D_GNU_SOURCE" \ + --prefix=/usr \ + --enable-multilib \ + --disable-nls \ + --disable-libstdcxx-pch \ + --host=x86_64-lfs-linux-gnu + + + The meaning of the configure options: + + + CXXFLAGS="-g -O2 -D_GNU_SOURCE" + + These flags are passed by the top level Makefile when doing + a full build of GCC. + + + + + --disable-libstdcxx-pch + + This switch prevents the installation of precompiled + include files, which are not needed at this stage. + + + + + --enable-multilib + + This switch is set by default but it is added here + explicitly for documentary purpose. The libstdc++ libraries + will be built for every arch (m64, m32, mx32) which are + made available in . + + + + + --host=x86_64-pc-linux-gnu + + Since up to now, the cross-compile tools are used. This + switch is set to place headers used for multilib to locations + where the final system can pick them up correctly. + + + + + + Compile libstdc++ by running: + +make + + Install the library: + +make install + + + + + + + <para>Details on this package are located in <xref linkend="contents-gcc" role="."/></para> + + </sect2> + +</sect1> diff --git a/chapter05/perl.xml b/chapter07/perl.xml similarity index 58% rename from chapter05/perl.xml rename to chapter07/perl.xml index 2bb15453b..7921cf3d9 100644 --- a/chapter05/perl.xml +++ b/chapter07/perl.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/perl.xml" + href="../chapter08/perl.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> @@ -33,8 +33,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&perl-ch5-sbu;</seg> - <seg>&perl-ch5-du;</seg> + <seg>&perl-tmp-sbu;</seg> + <seg>&perl-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -45,11 +45,10 @@ <para>Prepare Perl for compilation:</para> -<screen><userinput remap="configure">sh Configure -des -Dprefix=/tools -Dlibs=-lm -Uloclibpth -Ulocincpth</userinput></screen> +<screen><userinput remap="configure">sh Configure -des -Dprefix=/usr</userinput></screen> <variablelist> - <title>The meaning of the Configure options: - + The meaning of the new Configure options: -des @@ -59,44 +58,22 @@ - - - -Uloclibpth and - -Ulocincpth - - - These entries undefine variables that cause the configuration - to search for locally installed components that may exist on the - host system. - - - - - - - Build the package: + Compile the package: make - Although Perl comes with a test suite, it would be better to wait - until it is installed in the next chapter. + Install the package: - Only a few of the utilities and libraries need to be installed at this - time: - -cp -v perl cpan/podlators/scripts/pod2man /tools/bin -mkdir -pv /tools/lib/perl5/&perl-version; -cp -Rv lib/* /tools/lib/perl5/&perl-version; +make install - <para>Details on this package are located in - <xref linkend="contents-perl" role="."/></para> + <para>Details on this package are located in <xref linkend="contents-perl" role="."/></para> </sect2> diff --git a/chapter05/python.xml b/chapter07/python.xml similarity index 67% rename from chapter05/python.xml rename to chapter07/python.xml index fcca9c92c..a3b9239cf 100644 --- a/chapter05/python.xml +++ b/chapter07/python.xml @@ -18,14 +18,14 @@ <indexterm zone="ch-tools-Python"> <primary sortas="a-Python">Python</primary> - <secondary>tools</secondary> + <secondary>temporary</secondary> </indexterm> <sect2 role="package"> <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/python.xml" + href="../chapter08/python.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> @@ -33,8 +33,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&python-ch5-sbu;</seg> - <seg>&python-ch5-du;</seg> + <seg>&python-tmp-sbu;</seg> + <seg>&python-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -50,18 +50,9 @@ uppercase first letter).</para> </note> - <para>This package first builds the Python interpreter, then some - standard Python modules. The main script for building modules is - written in Python, and uses hard-coded paths to the host <filename - class="directory">/usr/include</filename> and <filename - class="directory">/usr/lib</filename> directories. To prevent them - from being used, issue:</para> - -<screen><userinput remap="pre">sed -i '/def add_multiarch_paths/a \ return' setup.py</userinput></screen> - <para>Prepare Python for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/tools --without-ensurepip</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr --without-ensurepip</userinput></screen> <variablelist> <title>The meaning of the configure option: @@ -80,10 +71,6 @@ make - Compilation is now complete. The test suite requires TK and - and X Windows and cannot be run at this time. - - Install the package: make install @@ -93,8 +80,7 @@ - <para>Details on this package are located in - <xref linkend="contents-python" role="."/></para> + <para>Details on this package are located in <xref linkend="contents-python" role="."/></para> </sect2> diff --git a/chapter07/stripping.xml b/chapter07/stripping.xml new file mode 100644 index 000000000..da0bd3991 --- /dev/null +++ b/chapter07/stripping.xml @@ -0,0 +1,191 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-stripping"> + <?dbhtml filename="stripping.html"?> + + <title>Cleaning up and Saving the Temporary System + + The libtool .la files are only useful when linking with static + libraries. They are unneeded, and potentially harmful, when using dynamic + shared libraries, specially when using non-autotools build systems. + While still in chroot, remove those files now: + +find /usr/{lib,libexec} -name \*.la -delete + + + All the remaining steps in this section are optional. Nevertheless, + as soon as you begin installing packages in , the temporary tools will be + overwritten. So it may be a good idea to do a backup of the temporary + tools as described below. The other steps are only needed if you are + really short on disk space. + + + + The following steps are performed from outside the chroot + environment. That means, you have to leave the chroot environment + first before continuing. The reason for that is to: + + + + make sure that objects are not in use while they are + manipulated. + + + + + get access to file system locations outside of the chroot + environment to store/read the backup archive which should + not be placed within the + $LFS hierarchy for + safety reasons. + + + + + + + Leave the chroot environment and unmount the kernel virtual file + systems: + + + + All of the following instructions are executed by + root. Take extra + care about the commands you're going to run as mistakes + here can modify your host system. Be aware that the + environment variable LFS is set for user + lfs by default + but it might not be set for + root. Whenever + commands are to be executed by root, + make sure you have set LFS accordingly. + This has been discussed in . + + + +exit +umount $LFS/dev{/pts,} +umount $LFS/{sys,proc,run} + + + Stripping + + If the LFS partition is rather small, it is good to + know that unnecessary items can be removed. The executables and + libraries built so far contain a little over 90 MB of unneeded debugging + symbols. + + Strip off debugging symbols from binaries: +strip --strip-debug $LFS/usr/lib/* +strip --strip-unneeded $LFS/usr/{,s}bin/* +strip --strip-unneeded $LFS/tools/bin/* + + These commands will skip a number of files reporting that it does not + recognize their file format. Most of these are scripts instead of binaries. + + + Take care NOT to use + --strip-unneeded on the libraries. The static + ones would be destroyed and the toolchain packages would need to be + built all over again. + + To save more space (slightly more than 35 MB), remove the documentation: + +rm -rf $LFS/usr/share/{info,man,doc} + + At this point, you should have at least 5 GB of free space on the + chroot partition that can be used to build and install Glibc and GCC in + the next phase. If you can build and install Glibc, you can build and install + the rest too. You can check the free disk space with the command + df -h $LFS. + + + + + Backup + + + Now that the essential tools have been created, its time to think about + a backup. When every check has passed successfully in the previously + built packages, your temporary tools are in a good state and might be + backed up for later reuse. In case of fatal failures in the subsequent + chapters, it often turns out that removing everything and starting over + (more carefully) is the best option to recover. Unfortunately, all the + temporary tools will be removed, too. To avoid spending extra time to + redo something which has been built successfully, prepare a backup. + + + + Make sure you have at least 600 MB free disk space (the source tarballs + will be included in the backup archive) in the home directory of user + root. + + + + Create the backup archive by running the following command: + + +cd $LFS && +tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz . + +cd $LFS && +tar -cJpf $HOME/lfs-temp-tools-&versiond;.tar.xz . + + + Replace $HOME by a directory of your choice if you + do not want to have the backup stored in root's home directory. + + + + + Restore + + + In case some mistakes have been made and you need to start over, you can + use this backup to restore the temporary tools and save some recovery time. + Since the sources are located under + $LFS, they are included in the + backup archive as well, so they do not need to be downloaded again. After + checking that $LFS is set properly, + restore the backup by executing the following commands: + + + + +cd $LFS && +rm -rf ./* && +tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz + +cd $LFS && +rm -rf ./* && +tar -xpf $HOME/lfs-temp-tools-&versiond;.tar.xz + + + Again, double check that the environment has been setup properly + and continue building the rest of the system. + + + + + If you left the chroot environment either to strip off debug + symbols, create a backup, or restart building using a restore, + remember to mount the kernel virtual filesystems now again as + described in and re-enter + the chroot environment (see ) + again before continuing. + + + + + +
diff --git a/chapter05/texinfo.xml b/chapter07/texinfo.xml similarity index 71% rename from chapter05/texinfo.xml rename to chapter07/texinfo.xml index 3e5ecfaef..af7d5ab30 100644 --- a/chapter05/texinfo.xml +++ b/chapter07/texinfo.xml @@ -18,14 +18,14 @@ Texinfo - tools + temporary <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/texinfo.xml" + href="../chapter08/texinfo.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> @@ -33,8 +33,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&texinfo-ch5-sbu;</seg> - <seg>&texinfo-ch5-du;</seg> + <seg>&texinfo-tmp-sbu;</seg> + <seg>&texinfo-tmp-du;</seg> </seglistitem> </segmentedlist> @@ -45,7 +45,7 @@ <para>Prepare Texinfo for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> <note> <para>As part of the configure process, a test is made that indicates an @@ -57,12 +57,6 @@ <screen><userinput remap="make">make</userinput></screen> - <para>Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Texinfo test suite anyway, issue the following command:</para> - -<screen><userinput remap="test">make check</userinput></screen> - <para>Install the package:</para> <screen><userinput remap="install">make install</userinput></screen> @@ -72,8 +66,7 @@ <sect2 role="content"> <title/> - <para>Details on this package are located in - <xref linkend="contents-texinfo" role="."/></para> + <para>Details on this package are located in <xref linkend="contents-texinfo" role="."/></para> </sect2> diff --git a/chapter07/util-linux.xml b/chapter07/util-linux.xml new file mode 100644 index 000000000..5df23f37a --- /dev/null +++ b/chapter07/util-linux.xml @@ -0,0 +1,192 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-util-linux" role="wrap"> + <?dbhtml filename="util-linux.html"?> + + <sect1info condition="script"> + <productname>util-linux</productname> + <productnumber>&util-linux-version;</productnumber> + <address>&util-linux-url;</address> + </sect1info> + + <title>Util-linux-&util-linux-version; + + + Util-linux + tools + + + + + + <para>The Util-linux package contains miscellaneous utility programs.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&util-linux-tmp-sbu;</seg> + <seg>&util-linux-tmp-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Util-linux + + First create a directory + to enable storage for the hwclock program: + +mkdir -pv /var/lib/hwclock + + Prepare Util-linux for compilation: + +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --docdir=/usr/share/doc/util-linux-&util-linux-version; \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python + + + The meaning of the configure options: + + + ADJTIME_PATH=/var/lib/hwclock/adjtime + + This sets the location of the file recording information about + the hardware clock in accordance to the FHS. This is not stricly + needed for this temporary tool, but it prevents creating a file + at another location, which would not be overwritten or removed + when building the final util-linux package. + + + + + --disable-* + + These switches prevent warnings about building components + that require packages not in LFS or not installed yet. + + + + + --without-python + + This switch disables using Python. + It avoids trying to build unneeded bindings. + + + + + + Compile the package: + +make + + Install the package: + +make install + + + + + + + + + Installation of Util-linux - 32-bit + + Clean previous build: + +make distclean + + Prepare Util-linux for compilation: + +CC="gcc -m32" \ +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --docdir=/usr/share/doc/util-linux-&util-linux-version; \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python \ + --libdir=&usr-lib-m32; \ + --host=i686-pc-linux-gnu + + Compile the package: + +make + + Install the package: + +make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; +rm -rf DESTDIR + + + + + + + + + Installation of Util-linux - x32-bit + + Clean previous build: + +make distclean + + Prepare Util-linux for compilation: + +CC="gcc -mx32" \ +./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ + --docdir=/usr/share/doc/util-linux-&util-linux-version; \ + --disable-chfn-chsh \ + --disable-login \ + --disable-nologin \ + --disable-su \ + --disable-setpriv \ + --disable-runuser \ + --disable-pylibmount \ + --disable-static \ + --without-python \ + --libdir=&usr-lib-mx32; \ + --host=x86_64-pc-linux-gnux32 + + Compile the package: + +make + + Install the package: + +make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; +rm -rf DESTDIR + + + + + + + <para>Details on this package are located in <xref linkend="contents-utillinux" role="."/></para> + + </sect2> + +</sect1> diff --git a/chapter06/aboutdebug.xml b/chapter08/aboutdebug.xml similarity index 96% rename from chapter06/aboutdebug.xml rename to chapter08/aboutdebug.xml index f49618c83..d646b797e 100644 --- a/chapter06/aboutdebug.xml +++ b/chapter08/aboutdebug.xml @@ -13,8 +13,8 @@ <para>Most programs and libraries are, by default, compiled with debugging symbols included (with <command>gcc</command>'s <parameter>-g</parameter> option). This means that when debugging a - program or library that was compiled with debugging information - included, the debugger can provide not only memory addresses, but also + program or library that was compiled with debugging information, + the debugger can provide not only memory addresses, but also the names of the routines and variables.</para> <para>However, the inclusion of these debugging symbols enlarges a diff --git a/chapter06/acl.xml b/chapter08/acl.xml similarity index 84% rename from chapter06/acl.xml rename to chapter08/acl.xml index 8b2846dac..00d219885 100644 --- a/chapter06/acl.xml +++ b/chapter08/acl.xml @@ -32,8 +32,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&acl-ch6-sbu;</seg> - <seg>&acl-ch6-du;</seg> + <seg>&acl-fin-sbu;</seg> + <seg>&acl-fin-du;</seg> </seglistitem> </segmentedlist> @@ -79,20 +79,24 @@ ln -sfv ../../lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so</userinput>< </sect2> - <!-- ~~~~~~~~~~~~~~~~~~~~ ABI 32 ~~~~~~~~~~~~~~~~~~~~ --> + <!-- - - - - - - - - - --> + <!-- Multilib - 32bit --> + <!-- - - - - - - - - - --> <sect2 arch="ml_32,ml_all" role="installation"> - <title>Installation of Acl - 32-bit + Installation of Acl - 32bit Clean previous build: make distclean - Prepare Acl for compilation: + Prepare Xz for compilation: -CC="gcc -m32" ./configure \ - --prefix=/usr --libdir=/usr/lib32 \ - --disable-static --libexecdir=/usr/lib32 \ +CC="gcc -m32" ./configure \ + --prefix=/usr \ + --disable-static \ + --libdir=&usr-lib-m32; \ + --libexecdir=&usr-lib-m32; \ --host=i686-pc-linux-gnu Compile the package: @@ -101,26 +105,30 @@ ln -sfv ../../lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so< Install the package: -make DESTDIR=$(pwd)/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR - + - + + + - Installation of Acl - x32-bit + Installation of Acl - x32bit Clean previous build: make distclean - Prepare Acl for compilation: + Prepare Xz for compilation: -CC="gcc -mx32" ./configure \ - --prefix=/usr --libdir=/usr/libx32 \ - --disable-static --libexecdir=/usr/libx32 \ +CC="gcc -mx32" ./configure \ + --prefix=/usr \ + --disable-static \ + --libdir=&usr-lib-mx32; \ + --libexecdir=&usr-lib-mx32; \ --host=x86_64-pc-linux-gnux32 Compile the package: @@ -129,11 +137,11 @@ rm -rf DESTDIR Install the package: -make DESTDIR=$(pwd)/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; rm -rf DESTDIR - +
Contents of Acl diff --git a/chapter06/adjusting.xml b/chapter08/adjusting.xml similarity index 95% rename from chapter06/adjusting.xml rename to chapter08/adjusting.xml index 3e6b49e19..4bd8a85cc 100644 --- a/chapter06/adjusting.xml +++ b/chapter08/adjusting.xml @@ -50,7 +50,7 @@ readelf -l a.out | grep ': /lib' There should be no errors, and the output of the last command will be (allowing for - platform-specific differences in dynamic linker name): + platform-specific differences in the dynamic linker name): [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] @@ -104,7 +104,7 @@ SEARCH_DIR("/lib") attempt to open /lib/libc.so.6 succeeded - Lastly, make sure GCC is using the correct dynamic linker: + Make sure GCC is using the correct dynamic linker: grep found dummy.log @@ -115,8 +115,8 @@ SEARCH_DIR("/lib") If the output does not appear as shown above or is not received at all, then something is seriously wrong. Investigate and retrace the - steps to find out where the problem is and correct it. The most likely - reason is that something went wrong with the specs file adjustment. Any + steps to find out where the problem is and correct it. Any issues will need to be resolved before continuing with the process. Once everything is working correctly, clean up the test files: diff --git a/chapter06/attr.xml b/chapter08/attr.xml similarity index 87% rename from chapter06/attr.xml rename to chapter08/attr.xml index 69b62bde9..dcc416cd9 100644 --- a/chapter06/attr.xml +++ b/chapter08/attr.xml @@ -31,8 +31,8 @@ &diskspace; - &attr-ch6-sbu; - &attr-ch6-du; + &attr-fin-sbu; + &attr-fin-du; @@ -78,21 +78,23 @@ ln -sfv ../../lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.so - + + + - Installation of Attr - 32-bit + Installation of Attr - 32bit Clean previous build: make distclean - Prepare Attr for compilation: + Prepare Xz for compilation: CC="gcc -m32" ./configure \ --prefix=/usr \ --disable-static \ - --libdir=/usr/lib32 \ + --libdir=&usr-lib-m32; \ --host=i686-pc-linux-gnu Compile the package: @@ -101,27 +103,29 @@ ln -sfv ../../lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.soInstall the package: -make DESTDIR=$(pwd)/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR - + - + + + - Installation of Attr - x32-bit + Installation of Attr - x32bit Clean previous build: make distclean - Prepare Attr for compilation: + Prepare Xz for compilation: CC="gcc -mx32" ./configure \ --prefix=/usr \ --disable-static \ - --libdir=/usr/libx32 \ + --libdir=&usr-lib-mx32; \ --host=x86_64-pc-linux-gnux32 Compile the package: @@ -130,11 +134,11 @@ rm -rf DESTDIR Install the package: -make DESTDIR=$(pwd)/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; rm -rf DESTDIR - +
Contents of Attr diff --git a/chapter06/autoconf.xml b/chapter08/autoconf.xml similarity index 97% rename from chapter06/autoconf.xml rename to chapter08/autoconf.xml index 6652747fd..53d97070b 100644 --- a/chapter06/autoconf.xml +++ b/chapter08/autoconf.xml @@ -31,8 +31,8 @@ &diskspace; - &autoconf-ch6-sbu; - &autoconf-ch6-du; + &autoconf-fin-sbu; + &autoconf-fin-du; @@ -43,7 +43,7 @@ First, fix a bug generated by Perl 5.28. -sed '361 s/{/\\{/' -i bin/autoscan.in +sed -i '361 s/{/\\{/' bin/autoscan.in Prepare Autoconf for compilation: @@ -59,7 +59,7 @@ make check - Using the -j4 make option speeds up the tests, even on systems with only one processor, due to internal delays in individual tests. To test the results, issue: - - make -j4 check - - One test is known to fail in the LFS environment: - tags-lisp-space.sh. - Install the package: make install diff --git a/chapter08/bash.xml b/chapter08/bash.xml new file mode 100644 index 000000000..b8dd5fe40 --- /dev/null +++ b/chapter08/bash.xml @@ -0,0 +1,166 @@ + + + %general-entities; +]> + + + + + + bash + &bash-version; +
&bash-url;
+
+ + Bash-&bash-version; + + + Bash + + + + + + <para>The Bash package contains the Bourne-Again SHell.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&bash-fin-sbu;</seg> + <seg>&bash-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Bash + + Incorporate some upstream fixes: + +patch -Np1 -i ../&bash-fixes-patch; + + Prepare Bash for compilation: + +./configure --prefix=/usr \ + --docdir=/usr/share/doc/bash-&bash-version; \ + --without-bash-malloc \ + --with-installed-readline + + + The meaning of the new configure option: + + + --with-installed-readline + + This option tells Bash to use the readline library that is already + installed on the system rather than using its own readline + version. + + + + + + Compile the package: + +make + + Skip down to Install the + package if not running the test suite. + + To prepare the tests, ensure that the tester user can write to the sources tree: + +chown -Rv tester . + + Now, run the tests as the tester user: + +su tester << EOF +PATH=$PATH make tests < $(tty) +EOF + + Install the package and move the main executable to + /bin: + +make install +mv -vf /usr/bin/bash /bin + + Run the newly compiled bash program (replacing the one that is + currently being executed): + +exec /bin/bash --login +h + + + The parameters used make the bash + process an interactive login shell and continues to disable hashing so + that new programs are found as they become available. + + + + + + Contents of Bash + + + Installed programs + Installed directory + + + bash, bashbug, and sh (link to bash) + /usr/include/bash, /usr/lib/bash, and + /usr/share/doc/bash-&bash-version; + + + + + Short Descriptions + + + + + bash + + A widely-used command interpreter; it performs many types of + expansions and substitutions on a given command line before executing + it, thus making this interpreter a powerful tool + + bash + + + + + + bashbug + + A shell script to help the user compose and mail standard + formatted bug reports concerning bash + + bashbug + + + + + + sh + + A symlink to the bash program; when invoked + as sh, bash tries to mimic the + startup behavior of historical versions of sh as + closely as possible, while conforming to the POSIX standard as + well + + sh + + + + + + + + +
diff --git a/chapter06/bc.xml b/chapter08/bc.xml similarity index 59% rename from chapter06/bc.xml rename to chapter08/bc.xml index f78bd270e..a499937e3 100644 --- a/chapter06/bc.xml +++ b/chapter08/bc.xml @@ -31,8 +31,8 @@ &diskspace; - &bc-ch6-sbu; - &bc-ch6-du; + &bc-fin-sbu; + &bc-fin-du; @@ -40,62 +40,18 @@ Installation of Bc - Prepare Bc for compilation: - + PREFIX=/usr CC=gcc CFLAGS="-std=c99" ./configure.sh -G -O3 The meaning of the configure options: - + CC=gcc CFLAGS="-std=c99" - These parameters specify the compiler and C standard to use. + These parameters specify the compiler and the C standard to use. @@ -118,14 +74,6 @@ ln -sfv libncursesw.so.6 /usr/lib/libncurses.so Compile the package: make - To test bc, run: diff --git a/chapter06/binutils.xml b/chapter08/binutils.xml similarity index 95% rename from chapter06/binutils.xml rename to chapter08/binutils.xml index 04dbd199c..33f756f92 100644 --- a/chapter06/binutils.xml +++ b/chapter08/binutils.xml @@ -31,8 +31,8 @@ &diskspace; - &binutils-ch6-sbu; - &binutils-ch6-du; + &binutils-fin-sbu; + &binutils-fin-du; @@ -72,7 +72,7 @@ cd build Prepare Binutils for compilation: -../configure --prefix=/usr \ +../configure --prefix=/usr \ --enable-gold \ --enable-ld=default \ --enable-plugins \ @@ -80,6 +80,16 @@ cd build --disable-werror \ --enable-64-bit-bfd \ --with-system-zlib +../configure --prefix=/usr \ + --enable-gold \ + --enable-ld=default \ + --enable-plugins \ + --enable-shared \ + --disable-werror \ + --enable-64-bit-bfd \ + --with-system-zlib \ + --enable-multilib + The meaning of the configure parameters: @@ -114,6 +124,13 @@ cd build + + --enable-multilib + + Enables multilib support in bintutils. + + + --with-system-zlib diff --git a/chapter06/bison.xml b/chapter08/bison.xml similarity index 78% rename from chapter06/bison.xml rename to chapter08/bison.xml index 23b6f0a95..1727660d8 100644 --- a/chapter06/bison.xml +++ b/chapter08/bison.xml @@ -30,8 +30,8 @@ &diskspace; - &bison-ch6-sbu; - &bison-ch6-du; + &bison-fin-sbu; + &bison-fin-du; @@ -39,38 +39,19 @@ Installation of Bison - Prepare Bison for compilation: ./configure --prefix=/usr --docdir=/usr/share/doc/bison-&bison-version; - - Compile the package: make - To test the results (about 5.5 SBU), issue: + The tests are known to fail using multiple processors. + To test the results (about 5.5 SBU), issue: -make check - - Fourteen tests fail in the "Diagnostics" section, probably because of - missing locales. - - +make -j1 check Install the package: diff --git a/chapter06/bzip2.xml b/chapter08/bzip2.xml similarity index 90% rename from chapter06/bzip2.xml rename to chapter08/bzip2.xml index d742086a8..d00cbd664 100644 --- a/chapter06/bzip2.xml +++ b/chapter08/bzip2.xml @@ -33,8 +33,8 @@ &diskspace; - &bzip2-ch6-sbu; - &bzip2-ch6-du; + &bzip2-fin-sbu; + &bzip2-fin-du; @@ -97,10 +97,12 @@ ln -sv bzip2 /bin/bzcat - + + + - Installation of Bzip2 - 32-bit + Installation of Bzip2 - 32bit Clean previous build: @@ -108,25 +110,26 @@ ln -sv bzip2 /bin/bzcat Compile the package: -sed -e "s/^CC=.*/CC=gcc -m32/" \ - -i Makefile{,-libbz2_so} +sed -e "s/^CC=.*/CC=gcc -m32/" -i Makefile{,-libbz2_so} make -f Makefile-libbz2_so make libbz2.a Install the package: -install -Dm755 libbz2.so.1.0.8 /usr/lib32/libbz2.so.1.0.8 -ln -sf libbz2.so.1.0.8 /usr/lib32/libbz2.so -ln -sf libbz2.so.1.0.8 /usr/lib32/libbz2.so.1 -ln -sf libbz2.so.1.0.8 /usr/lib32/libbz2.so.1.0 -install -Dm644 libbz2.a /usr/lib32/libbz2.a +install -Dm755 libbz2.so.1.0.8 &usr-lib-m32;/libbz2.so.1.0.8 +ln -sf libbz2.so.1.0.8 &usr-lib-m32;/libbz2.so +ln -sf libbz2.so.1.0.8 &usr-lib-m32;/libbz2.so.1 +ln -sf libbz2.so.1.0.8 &usr-lib-m32;/libbz2.so.1.0 +install -Dm644 libbz2.a &usr-lib-m32;/libbz2.a - + - + + + - Installation of Bzip2 - x32-bit + Installation of Bzip2 - x32bit Clean previous build: @@ -134,20 +137,19 @@ install -Dm644 libbz2.a /usr/lib32/libbz2.a Compile the package: -sed -e "s/^CC=.*/CC=gcc -mx32/" \ - -i Makefile{,-libbz2_so} +sed -e "s/^CC=.*/CC=gcc -mx32/" -i Makefile{,-libbz2_so} make -f Makefile-libbz2_so make libbz2.a Install the package: -install -Dm755 libbz2.so.1.0.8 /usr/libx32/libbz2.so.1.0.8 -ln -sf libbz2.so.1.0.8 /usr/libx32/libbz2.so -ln -sf libbz2.so.1.0.8 /usr/libx32/libbz2.so.1 -ln -sf libbz2.so.1.0.8 /usr/libx32/libbz2.so.1.0 -install -Dm644 libbz2.a /usr/libx32/libbz2.a +install -Dm755 libbz2.so.1.0.8 &usr-lib-mx32;/libbz2.so.1.0.8 +ln -sf libbz2.so.1.0.8 &usr-lib-mx32;/libbz2.so +ln -sf libbz2.so.1.0.8 &usr-lib-mx32;/libbz2.so.1 +ln -sf libbz2.so.1.0.8 &usr-lib-mx32;/libbz2.so.1.0 +install -Dm644 libbz2.a &usr-lib-mx32;/libbz2.a - +
Contents of Bzip2 diff --git a/chapter08/chapter08.xml b/chapter08/chapter08.xml index 32112e37a..70ab37feb 100644 --- a/chapter08/chapter08.xml +++ b/chapter08/chapter08.xml @@ -5,15 +5,105 @@ %general-entities; ]> - + - Making the LFS System Bootable + Installing Basic System Software - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/chapter06/check.xml b/chapter08/check.xml similarity index 90% rename from chapter06/check.xml rename to chapter08/check.xml index e7936f6b2..fc28a9113 100644 --- a/chapter06/check.xml +++ b/chapter08/check.xml @@ -30,8 +30,8 @@ &diskspace; - &check-ch5-sbu; - &check-ch5-du; + &check-fin-sbu; + &check-fin-du; @@ -56,11 +56,9 @@ Note that the Check test suite may take a relatively long (up to 4 SBU) time. - Install the package and fix a script: + Install the package: - make docdir=/usr/share/doc/check-&check-version; install && -sed -i '1 s/tools/usr/' /usr/bin/checkmk - + make docdir=/usr/share/doc/check-&check-version; install diff --git a/chapter08/coreutils.xml b/chapter08/coreutils.xml new file mode 100644 index 000000000..fcf10b1dc --- /dev/null +++ b/chapter08/coreutils.xml @@ -0,0 +1,1292 @@ + + + %general-entities; +]> + + + + + + coreutils + &coreutils-version; +
&coreutils-url;
+
+ + Coreutils-&coreutils-version; + + + Coreutils + + + + + + <para>The Coreutils package contains utilities for showing and setting the + basic system characteristics.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&coreutils-fin-sbu;</seg> + <seg>&coreutils-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Coreutils + + POSIX requires that programs from Coreutils recognize character + boundaries correctly even in multibyte locales. The following patch fixes + this non-compliance and other internationalization-related bugs. + +patch -Np1 -i ../&coreutils-i18n-patch; + + + In the past, many bugs were found in this patch. When reporting new + bugs to Coreutils maintainers, please check first if they are reproducible + without this patch. + + + + Suppress a test which on some machines can loop forever: + +sed -i '/test.lock/s/^/#/' gnulib-tests/gnulib.mk + + Now prepare Coreutils for compilation: + +autoreconf -fiv +FORCE_UNSAFE_CONFIGURE=1 ./configure \ + --prefix=/usr \ + --enable-no-install-program=kill,uptime + + + The meaning of the configure options: + + + autoreconf + + This command updates generated configuration files + consistent with the latest version of automake. + + + + + + FORCE_UNSAFE_CONFIGURE=1 + + This environment variable allows the package to be + built as the root user. + + + + + + --enable-no-install-program=kill,uptime + + The purpose of this switch is to prevent Coreutils from + installing binaries that will be installed by other packages later. + + + + + + Compile the package: + +make + + Skip down to Install the + package if not running the test suite. + + Now the test suite is ready to be run. First, run the tests that are + meant to be run as user root: + +make NON_ROOT_USERNAME=tester check-root + + We're going to run the remainder of the tests as the + tester user. Certain tests + require that the user be a member of more than one group. So that + these tests are not skipped, add a temporary group and make the + user tester a part of it: + +echo "dummy:x:102:tester" >> /etc/group + + Fix some of the permissions so that the non-root user can compile and + run the tests: + +chown -Rv tester . + + Now run the tests: + +su tester -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check" + + Remove the temporary group: + +sed -i '/dummy/d' /etc/group + Install the package: + +make install + + Move programs to the locations specified by the FHS: + +mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin +mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin +mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin +mv -v /usr/bin/chroot /usr/sbin +mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8 +sed -i 's/"1"/"8"/' /usr/share/man/man8/chroot.8 + + Some of the scripts in the LFS-Bootscripts package + depend on head, nice, + sleep, and touch. As /usr may not be available during the early and + late stages of booting, those binaries need to be on the root partition to + maintain FHS compliance: + +mv -v /usr/bin/{head,nice,sleep,touch} /bin + + + + + Contents of Coreutils + + + Installed programs + Installed library + Installed directory + + + [, b2sum, base32, base64, basename, basenc, cat, chcon, chgrp, chmod, chown, + chroot, cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors, + dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups, + head, hostid, id, install, join, link, ln, logname, ls, md5sum, mkdir, + mkfifo, mknod, mktemp, mv, nice, nl, nohup, nproc, numfmt, od, paste, + pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, realpath, rm, + rmdir, runcon, seq, sha1sum, sha224sum, sha256sum, sha384sum, + sha512sum, shred, shuf, sleep, sort, split, stat, stdbuf, stty, sum, + sync, tac, tail, tee, test, timeout, touch, tr, true, truncate, tsort, + tty, uname, unexpand, uniq, unlink, users, vdir, wc, who, whoami, and + yes + libstdbuf.so (in /usr/libexec/coreutils) + /usr/libexec/coreutils + + + + + Short Descriptions + + + + + [ + + Is an actual command, /usr/bin/[, that is a synonym + for the test command. + + [ + + + + + + base32 + + Encodes and decodes data according to the base32 specification + (RFC 4648) + + base64 + + + + + + base64 + + Encodes and decodes data according to the base64 specification + (RFC 4648) + + base64 + + + + + + b2sum + + Prints or checks BLAKE2 (512-bit) checksums + + b2sum + + + + + + basename + + Strips any path and a given suffix from a file name + + basename + + + + + + basenc + + Encodes or decodes data using various algorithms + + basenc + + + + + + cat + + Concatenates files to standard output + + cat + + + + + + chcon + + Changes security context for files and directories + + chcon + + + + + + chgrp + + Changes the group ownership of files and directories + + chgrp + + + + + + chmod + + Changes the permissions of each file to the given mode; the mode + can be either a symbolic representation of the changes to make or an + octal number representing the new permissions + + chmod + + + + + + chown + + Changes the user and/or group ownership of files and + directories + + chown + + + + + + chroot + + Runs a command with the specified directory as the + / directory + + chroot + + + + + + cksum + + Prints the Cyclic Redundancy Check (CRC) checksum and the byte + counts of each specified file + + cksum + + + + + + comm + + Compares two sorted files, outputting in three columns the lines + that are unique and the lines that are common + + comm + + + + + + cp + + Copies files + + cp + + + + + + csplit + + Splits a given file into several new files, separating them + according to given patterns or line numbers and outputting the byte + count of each new file + + csplit + + + + + + cut + + Prints sections of lines, selecting the parts according to given + fields or positions + + cut + + + + + + date + + Displays the current time in the given format, or sets the + system date + + date + + + + + + dd + + Copies a file using the given block size and count, while + optionally performing conversions on it + + dd + + + + + + df + + Reports the amount of disk space available (and used) on all + mounted file systems, or only on the file systems holding the selected + files + + df + + + + + + dir + + Lists the contents of each given directory (the same as + the ls command) + + dir + + + + + + dircolors + + Outputs commands to set the LS_COLOR + environment variable to change the color scheme used by + ls + + dircolors + + + + + + dirname + + Strips the non-directory suffix from a file name + + dirname + + + + + + du + + Reports the amount of disk space used by the current directory, + by each of the given directories (including all subdirectories) or by + each of the given files + + du + + + + + + echo + + Displays the given strings + + echo + + + + + + env + + Runs a command in a modified environment + + env + + + + + + expand + + Converts tabs to spaces + + expand + + + + + + expr + + Evaluates expressions + + expr + + + + + + factor + + Prints the prime factors of all specified integer numbers + + factor + + + + + + false + + Does nothing, unsuccessfully; it always exits with a status code + indicating failure + + false + + + + + + fmt + + Reformats the paragraphs in the given files + + fmt + + + + + + fold + + Wraps the lines in the given files + + fold + + + + + + groups + + Reports a user's group memberships + + groups + + + + + + head + + Prints the first ten lines (or the given number of lines) + of each given file + + head + + + + + + hostid + + Reports the numeric identifier (in hexadecimal) of the host + + hostid + + + + + + id + + Reports the effective user ID, group ID, and group memberships + of the current user or specified user + + id + + + + + + install + + Copies files while setting their permission modes and, if + possible, their owner and group + + install + + + + + + join + + Joins the lines that have identical join fields from two + separate files + + join + + + + + + link + + Creates a hard link with the given name to a file + + link + + + + + + ln + + Makes hard links or soft (symbolic) links between files + + ln + + + + + + logname + + Reports the current user's login name + + logname + + + + + + ls + + Lists the contents of each given directory + + ls + + + + + + md5sum + + Reports or checks Message Digest 5 (MD5) checksums + + md5sum + + + + + + mkdir + + Creates directories with the given names + + mkdir + + + + + + mkfifo + + Creates First-In, First-Outs (FIFOs), a "named + pipe" in UNIX parlance, with the given names + + mkfifo + + + + + + mknod + + Creates device nodes with the given names; a device node is a + character special file, a block special file, or a FIFO + + mknod + + + + + + mktemp + + Creates temporary files in a secure manner; it is used in scripts + + mktemp + + + + + + mv + + Moves or renames files or directories + + mv + + + + + + nice + + Runs a program with modified scheduling priority + + nice + + + + + + nl + + Numbers the lines from the given files + + nl + + + + + + nohup + + Runs a command immune to hangups, with its output redirected to + a log file + + nohup + + + + + + nproc + + Prints the number of processing units available to a + process + + nproc + + + + + + numfmt + + Converts numbers to or from human-readable strings + + numfmt + + + + + + od + + Dumps files in octal and other formats + + od + + + + + + paste + + Merges the given files, joining sequentially corresponding lines + side by side, separated by tab characters + + paste + + + + + + pathchk + + Checks if file names are valid or portable + + pathchk + + + + + + pinky + + Is a lightweight finger client; it reports some information + about the given users + + pinky + + + + + + pr + + Paginates and columnates files for printing + + pr + + + + + + printenv + + Prints the environment + + printenv + + + + + + printf + + Prints the given arguments according to the given format, much + like the C printf function + + printf + + + + + + ptx + + Produces a permuted index from the contents of the given files, + with each keyword in its context + + ptx + + + + + + pwd + + Reports the name of the current working directory + + pwd + + + + + + readlink + + Reports the value of the given symbolic link + + readlink + + + + + + realpath + + Prints the resolved path + + realpath + + + + + + rm + + Removes files or directories + + rm + + + + + + rmdir + + Removes directories if they are empty + + rmdir + + + + + + runcon + + Runs a command with specified security context + + runcon + + + + + + seq + + Prints a sequence of numbers within a given range and with a + given increment + + seq + + + + + + sha1sum + + Prints or checks 160-bit Secure Hash Algorithm 1 (SHA1) + checksums + + sha1sum + + + + + + sha224sum + + Prints or checks 224-bit Secure Hash Algorithm checksums + + sha224sum + + + + + + sha256sum + + Prints or checks 256-bit Secure Hash Algorithm checksums + + sha256sum + + + + + + sha384sum + + Prints or checks 384-bit Secure Hash Algorithm checksums + + sha384sum + + + + + + sha512sum + + Prints or checks 512-bit Secure Hash Algorithm checksums + + sha512sum + + + + + + shred + + Overwrites the given files repeatedly with complex patterns, + making it difficult to recover the data + + shred + + + + + + shuf + + Shuffles lines of text + + shuf + + + + + + sleep + + Pauses for the given amount of time + + sleep + + + + + + sort + + Sorts the lines from the given files + + sort + + + + + + split + + Splits the given file into pieces, by size or by number of + lines + + split + + + + + + stat + + Displays file or filesystem status + + stat + + + + + + stdbuf + + Runs commands with altered buffering operations for its standard + streams + + stdbuf + + + + + + stty + + Sets or reports terminal line settings + + stty + + + + + + sum + + Prints checksum and block counts for each given file + + sum + + + + + + sync + + Flushes file system buffers; it forces changed blocks to disk + and updates the super block + + sync + + + + + + tac + + Concatenates the given files in reverse + + tac + + + + + + tail + + Prints the last ten lines (or the given number of lines) of each + given file + + tail + + + + + + tee + + Reads from standard input while writing both to standard output + and to the given files + + tee + + + + + + test + + Compares values and checks file types + + test + + + + + + timeout + + Runs a command with a time limit + + timeout + + + + + + touch + + Changes file timestamps, setting the access and modification + times of the given files to the current time; files that do not exist + are created with zero length + + touch + + + + + + tr + + Translates, squeezes, and deletes the given characters from + standard input + + tr + + + + + + true + + Does nothing, successfully; it always exits with a status code + indicating success + + true + + + + + + truncate + + Shrinks or expands a file to the specified size + + truncate + + + + + + tsort + + Performs a topological sort; it writes a completely ordered list + according to the partial ordering in a given file + + tsort + + + + + + tty + + Reports the file name of the terminal connected to standard + input + + tty + + + + + + uname + + Reports system information + + uname + + + + + + unexpand + + Converts spaces to tabs + + unexpand + + + + + + uniq + + Discards all but one of successive identical lines + + uniq + + + + + + unlink + + Removes the given file + + unlink + + + + + + users + + Reports the names of the users currently logged on + + users + + + + + + vdir + + Is the same as ls -l + + vdir + + + + + + wc + + Reports the number of lines, words, and bytes for each given + file, as well as a total line when more than one file is given + + wc + + + + + + who + + Reports who is logged on + + who + + + + + + whoami + + Reports the user name associated with the current effective + user ID + + whoami + + + + + + yes + + Repeatedly outputs y or a given string until + killed + + yes + + + + + + libstdbuf + + Library used by stdbuf + + libstdbuf + + + + + + + + +
diff --git a/chapter06/dbus.xml b/chapter08/dbus.xml similarity index 96% rename from chapter06/dbus.xml rename to chapter08/dbus.xml index bb4bffc76..211399207 100644 --- a/chapter06/dbus.xml +++ b/chapter08/dbus.xml @@ -36,8 +36,8 @@ &diskspace; - &dbus-ch6-sbu; - &dbus-ch6-du; + &dbus-fin-sbu; + &dbus-fin-du; @@ -63,7 +63,7 @@ --with-console-auth-dir=/run/console - This specifies the location of the ConsoleKit auth + This specifies the location of the ConsoleKit authorization directory. @@ -91,7 +91,7 @@ mv -v /usr/lib/libdbus-1.so.* /lib ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so - Create a symlink, so that D-Bus and systemd can use the same + Create a symlink so that D-Bus and systemd can use the same machine-id file: ln -sfv /etc/machine-id /var/lib/dbus @@ -130,7 +130,7 @@ ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so dbus-cleanup-sockets - Used to clean up leftover sockets in a directory + is used to remove leftover sockets in a directory dbus-cleanup-sockets @@ -140,7 +140,7 @@ ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so dbus-daemon - The D-Bus message bus daemon + Is the D-Bus message bus daemon dbus-daemon @@ -193,7 +193,7 @@ ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so dbus-test-tool - A tool to help packages test + Is a tool to help packages test D-Bus dbus-test-tool diff --git a/chapter05/dejagnu.xml b/chapter08/dejagnu.xml similarity index 82% rename from chapter05/dejagnu.xml rename to chapter08/dejagnu.xml index a821e9bba..da6a44aa9 100644 --- a/chapter05/dejagnu.xml +++ b/chapter08/dejagnu.xml @@ -32,8 +32,8 @@ &diskspace; - &dejagnu-ch5-sbu; - &dejagnu-ch5-du; + &dejagnu-tmp-sbu; + &dejagnu-tmp-du; @@ -44,11 +44,15 @@ Prepare DejaGNU for compilation: -./configure --prefix=/tools +./configure --prefix=/usr +makeinfo --html --no-split -o doc/dejagnu.html doc/dejagnu.texi +makeinfo --plaintext -o doc/dejagnu.txt doc/dejagnu.texi Build and install the package: -make install +make install +install -v -dm755 /usr/share/doc/dejagnu-&dejagnu-version; +install -v -m644 doc/dejagnu.{html,txt} /usr/share/doc/dejagnu-&dejagnu-version; To test the results, issue: diff --git a/chapter08/diffutils.xml b/chapter08/diffutils.xml new file mode 100644 index 000000000..8889077d5 --- /dev/null +++ b/chapter08/diffutils.xml @@ -0,0 +1,125 @@ + + + %general-entities; +]> + + + + + + diffutils + &diffutils-version; +
&diffutils-url;
+
+ + Diffutils-&diffutils-version; + + + Diffutils + + + + + + <para>The Diffutils package contains programs that show the differences + between files or directories.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&diffutils-fin-sbu;</seg> + <seg>&diffutils-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Diffutils + + Prepare Diffutils for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + + Contents of Diffutils + + + Installed programs + + + cmp, diff, diff3, and sdiff + + + + + Short Descriptions + + + + + cmp + + Compares two files and reports whether or in which bytes they + differ + + cmp + + + + + + diff + + Compares two files or directories and reports which lines in + the files differ + + diff + + + + + + diff3 + + Compares three files line by line + + diff3 + + + + + + sdiff + + Merges two files and interactively outputs the results + + sdiff + + + + + + + + +
diff --git a/chapter06/e2fsprogs.xml b/chapter08/e2fsprogs.xml similarity index 93% rename from chapter06/e2fsprogs.xml rename to chapter08/e2fsprogs.xml index 529324061..65d8604cd 100644 --- a/chapter06/e2fsprogs.xml +++ b/chapter08/e2fsprogs.xml @@ -23,7 +23,7 @@ - <para>The E2fsprogs package contains the utilities for handling the + <para>The e2fsprogs package contains the utilities for handling the <systemitem class="filesystem">ext2</systemitem> file system. It also supports the <systemitem class="filesystem">ext3</systemitem> and <systemitem class="filesystem">ext4</systemitem> journaling @@ -34,8 +34,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&e2fsprogs-ch6-sbu;</seg> - <seg>&e2fsprogs-ch6-du;</seg> + <seg>&e2fsprogs-fin-sbu;</seg> + <seg>&e2fsprogs-fin-du;</seg> </seglistitem> </segmentedlist> @@ -44,19 +44,14 @@ <sect2 role="installation"> <title>Installation of E2fsprogs - The E2fsprogs documentation recommends that the package be built in + The e2fsprogs documentation recommends that the package be built in a subdirectory of the source tree: mkdir -v build cd build - Prepare E2fsprogs for compilation: + Prepare e2fsprogs for compilation: - ../configure --prefix=/usr \ --bindir=/bin \ --with-root-prefix="" \ @@ -67,16 +62,8 @@ PKG_CONFIG_PATH=/tools/lib/pkgconfig \ --disable-fsck - The meaning of the environment variable and configure options: - + The meaning of the configure options: + --with-root-prefix="" and --bindir=/bin @@ -87,7 +74,7 @@ PKG_CONFIG_PATH=/tools/lib/pkgconfig \ programs still need to be available. They belong in directories like /lib and /sbin. If this option is not passed - to E2fsprogs' configure, the programs are installed into the + to configure, the programs are installed into the /usr directory.
@@ -103,11 +90,11 @@ PKG_CONFIG_PATH=/tools/lib/pkgconfig \ --disable-* - This prevents E2fsprogs from building and installing the + This prevents e2fsprogs from building and installing the libuuid and libblkid libraries, the uuidd daemon, and the - fsck wrapper, as Util-Linux installs more + fsck wrapper, as util-linux installs more recent versions. @@ -117,25 +104,20 @@ PKG_CONFIG_PATH=/tools/lib/pkgconfig \ Compile the package: make - To run the tests, issue: make check - - - - One of the E2fsprogs tests will attempt to allocate 256 MB of memory. + + On a spinning disk, the tests take a little more than 4 SBUs. They + can be much shorter on an SSD (down to about 1.5 SBUs). Install the package: make install diff --git a/chapter06/eudev.xml b/chapter08/eudev.xml similarity index 87% rename from chapter06/eudev.xml rename to chapter08/eudev.xml index b3ba1f568..c8e17e3d5 100644 --- a/chapter06/eudev.xml +++ b/chapter08/eudev.xml @@ -31,8 +31,8 @@ &diskspace; - &eudev-ch6-sbu; - &eudev-ch6-du; + &eudev-fin-sbu; + &eudev-fin-du;
@@ -89,10 +89,12 @@ make -f &udev-lfs-version;/Makefile.lfs install
- + + + - Installation of Eudev - 32-bit + Installation of Eudev - 32bit Clean previous build: @@ -105,11 +107,11 @@ make -f &udev-lfs-version;/Makefile.lfs install --prefix=/usr \ --bindir=/sbin \ --sbindir=/sbin \ - --libdir=/usr/lib32 \ + --libdir=&usr-lib-m32; \ --sysconfdir=/etc \ - --libexecdir=/lib32 \ + --libexecdir=&lib-m32; \ --with-rootprefix= \ - --with-rootlibdir=/usr/lib32 \ + --with-rootlibdir=&usr-lib-m32; \ --disable-manpages \ --disable-static \ --config-cache @@ -121,15 +123,17 @@ make -f &udev-lfs-version;/Makefile.lfs install Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR - - - +
+ + + + - Installation of Eudev - x32-bit + Installation of Eudev - x32bit Clean previous build: @@ -138,16 +142,16 @@ rm -rf DESTDIR Prepare Eudev for compilation: CC="gcc -mx32" \ -./configure --prefix=/usr \ - --bindir=/sbin \ - --sbindir=/sbin \ - --libdir=/usr/libx32 \ - --sysconfdir=/etc \ - --libexecdir=/libx32 \ - --with-rootprefix= \ - --with-rootlibdir=/usr/libx32 \ - --disable-manpages \ - --disable-static \ +./configure --prefix=/usr \ + --bindir=/sbin \ + --sbindir=/sbin \ + --libdir=&usr-lib-mx32; \ + --sysconfdir=/etc \ + --libexecdir=&lib-mx32; \ + --with-rootprefix= \ + --with-rootlibdir=&usr-lib-mx32; \ + --disable-manpages \ + --disable-static \ --config-cache Compile the package: @@ -157,11 +161,11 @@ rm -rf DESTDIR Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; rm -rf DESTDIR - - +
+ Configuring Eudev diff --git a/chapter06/expat.xml b/chapter08/expat.xml similarity index 86% rename from chapter06/expat.xml rename to chapter08/expat.xml index dc84d65c1..dae9016fe 100644 --- a/chapter06/expat.xml +++ b/chapter08/expat.xml @@ -31,8 +31,8 @@ &diskspace; - &expat-ch6-sbu; - &expat-ch6-du; + &expat-fin-sbu; + &expat-fin-du; @@ -41,10 +41,6 @@ Installation of Expat - First fix a problem with the regression tests in the LFS environment: - -sed -i 's|usr/bin/env |bin/|' run.sh.in - Prepare Expat for compilation: ./configure --prefix=/usr \ @@ -69,10 +65,12 @@ - + + + - Installation of Expat - 32-bit + Installation of Expat - 32bit Clean previous build but keep precompiled doc because it cannot be rebuilt in this stage of the system: @@ -84,7 +82,7 @@ make clean CC="gcc -m32" ./configure \ --prefix=/usr \ - --libdir=/usr/lib32 \ + --libdir=&usr-lib-m32; \ --host=i686-pc-linux-gnu Compile the package: @@ -94,17 +92,20 @@ make clean Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR - + - + + + - Installation of Expat - x32-bit + Installation of Expat - x32bit - Clean previous build: + Clean previous build but keep precompiled doc because it + cannot be rebuilt in this stage of the system: sed -e "/^am__append_1/ s/doc//" -i Makefile make clean @@ -112,8 +113,8 @@ make clean Prepare Expat for compilation: CC="gcc -mx32" ./configure \ - --prefix=/usr \ - --libdir=/usr/libx32 \ + --prefix=/usr \ + --libdir=&usr-lib-mx32; \ --host=x86_64-pc-linux-gnux32 Compile the package: @@ -123,10 +124,10 @@ make clean Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; rm -rf DESTDIR - +
Contents of Expat diff --git a/chapter05/expect.xml b/chapter08/expect.xml similarity index 62% rename from chapter05/expect.xml rename to chapter08/expect.xml index a2cc67d0e..da374bd9d 100644 --- a/chapter05/expect.xml +++ b/chapter08/expect.xml @@ -38,8 +38,8 @@ &diskspace; - &expect-ch5-sbu; - &expect-ch5-du; + &expect-tmp-sbu; + &expect-tmp-du; @@ -48,39 +48,31 @@ Installation of Expect - First, force Expect's configure script to use /bin/stty - instead of a /usr/local/bin/stty it may find on the host system. - This will ensure that our test suite tools remain sane for the final builds of our - toolchain: + Prepare Expect for compilation: -cp -v configure{,.orig} -sed 's:/usr/local/bin:/bin:' configure.orig > configure - - Now prepare Expect for compilation: - -./configure --prefix=/tools \ - --with-tcl=/tools/lib \ - --with-tclinclude=/tools/include +./configure --prefix=/usr \ + --with-tcl=/usr/lib \ + --enable-shared \ + --mandir=/usr/share/man \ + --with-tclinclude=/usr/include The meaning of the configure options: - --with-tcl=/tools/lib + --with-tcl=/usr/lib - This ensures that the configure script finds the Tcl - installation in the temporary tools location instead of possibly - locating an existing one on the host system. + This parameter is needed to tell + configure where the + tclConfig.sh script is located. - --with-tclinclude=/tools/include + --with-tclinclude=/usr/include This explicitly tells Expect where to find Tcl's internal - headers. Using this option avoids conditions where - configure fails because it cannot automatically - discover the location of Tcl's headers. + headers. @@ -90,33 +82,14 @@ sed 's:/usr/local/bin:/bin:' configure.orig > configure make - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Expect test suite anyway, issue the following command: + To test the results, issue: make test - Note that the Expect test suite is known to experience failures under - certain host conditions that are not within our control. Therefore, - test suite failures here are not surprising and are not considered - critical. - Install the package: -make SCRIPTS="" install - - - The meaning of the make parameter: - - - SCRIPTS="" - - This prevents installation of the supplementary Expect - scripts, which are not needed. - - - - +make install +ln -svf expect&expect-version;/libexpect&expect-version;.so /usr/lib diff --git a/chapter08/file.xml b/chapter08/file.xml new file mode 100644 index 000000000..b444fdad2 --- /dev/null +++ b/chapter08/file.xml @@ -0,0 +1,167 @@ + + + %general-entities; +]> + + + + + + file + &file-version; +
&file-url;
+
+ + File-&file-version; + + + File + + + + + + <para>The File package contains a utility for determining the type of a given + file or files.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&file-fin-sbu;</seg> + <seg>&file-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of File + + Prepare File for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + + + + + Installation of File - 32bit + + Clean previous build: + +make distclean + + Prepare File for compilation: + +CC="gcc -m32" ./configure \ + --prefix=/usr \ + --libdir=&usr-lib-m32; \ + --host=i686-pc-linux-gnu + + Compile the package: + +make + + Install the package: + +make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; +rm -rf DESTDIR + + + + + + + + + Installation of File - x32bit + + Clean previous build: + +make distclean + + Prepare File for compilation: + +CC="gcc -mx32" ./configure \ + --prefix=/usr \ + --libdir=&usr-lib-mx32; \ + --host=x86_64-pc-linux-gnux32 + + Compile the package: + +make + + Install the package: + +make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; +rm -rf DESTDIR + + + + + Contents of File + + + Installed programs + Installed library + + + file + libmagic.so + + + + + Short Descriptions + + + + + file + + Tries to classify each given file; it does this by performing + several tests—file system tests, magic number tests, and language + tests + + file + + + + + + libmagic + + Contains routines for magic number recognition, used by the + file program + + libmagic + + + + + + + + +
diff --git a/chapter08/findutils.xml b/chapter08/findutils.xml new file mode 100644 index 000000000..f55e5cbb1 --- /dev/null +++ b/chapter08/findutils.xml @@ -0,0 +1,161 @@ + + + %general-entities; +]> + + + + + + findutils + &findutils-version; +
&findutils-url;
+
+ + Findutils-&findutils-version; + + + Findutils + + + + + + <para>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 is unreliable if the database has not been recently updated).</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&findutils-fin-sbu;</seg> + <seg>&findutils-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Findutils + + Prepare Findutils for compilation: + +./configure --prefix=/usr --localstatedir=/var/lib/locate + + + The meaning of the configure options: + + + --localstatedir + + This option changes the location of the locate + database to be in /var/lib/locate, + which is FHS-compliant. + + + + + + Compile the package: + +make + + To test the results, issue: + +chown -Rv tester . +su tester -c "PATH=$PATH make check" + + Install the package: + +make install + + Some of the scripts in the LFS-Bootscripts package + depend on find. As /usr may not be available during the early + stages of booting, this program needs to be on the root partition. The + updatedb script also needs to be modified to correct an + explicit path: + + Some packages in BLFS and beyond expect the + find program in /bin, so make sure it's placed there: + +mv -v /usr/bin/find /bin +sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb + + + + + Contents of Findutils + + + Installed programs + Installed directory + + + find, locate, updatedb, and xargs + /var/lib/locate + + + + + + Short Descriptions + + + + + find + + Searches given directory trees for files matching the specified + criteria + + find + + + + + + locate + + Searches through a database of file names and reports the names + that contain a given string or match a given pattern + + locate + + + + + + updatedb + + Updates the locate database; it scans the + entire file system (including other file systems that are currently + mounted, unless told not to) and puts every file name it finds into + the database + + updatedb + + + + + + xargs + + Can be used to apply a given command to a list of files + + xargs + + + + + + + + +
diff --git a/chapter06/flex.xml b/chapter08/flex.xml similarity index 98% rename from chapter06/flex.xml rename to chapter08/flex.xml index bd4bd545f..fc8574c1d 100644 --- a/chapter06/flex.xml +++ b/chapter08/flex.xml @@ -31,8 +31,8 @@ &diskspace; - &flex-ch6-sbu; - &flex-ch6-du; + &flex-fin-sbu; + &flex-fin-du; diff --git a/chapter08/gawk.xml b/chapter08/gawk.xml new file mode 100644 index 000000000..940fe3833 --- /dev/null +++ b/chapter08/gawk.xml @@ -0,0 +1,128 @@ + + + %general-entities; +]> + + + + + + gawk + &gawk-version; +
&gawk-url;
+
+ + Gawk-&gawk-version; + + + Gawk + + + + + + <para>The Gawk package contains programs for manipulating text files.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gawk-fin-sbu;</seg> + <seg>&gawk-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Gawk + + First, ensure some unneeded files are not installed: + +sed -i 's/extras//' Makefile.in + + Prepare Gawk for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + If desired, install the documentation: + +mkdir -v /usr/share/doc/gawk-&gawk-version; +cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-&gawk-version; + + + + + Contents of Gawk + + + Installed programs + Installed libraries + Installed directories + + + awk (link to gawk), gawk, and awk-&gawk-version; + filefuncs.so, fnmatch.so, fork.so, inplace.so, intdiv.so, ordchr.so, + readdir.so, readfile.so, revoutput.so, revtwoway.so, rwarray.so, + and time.so (all in /usr/lib/gawk) + /usr/lib/gawk, /usr/libexec/awk, /usr/share/awk, and + /usr/share/doc/gawk-&gawk-version; + + + + + Short Descriptions + + + + + awk + + A link to gawk + + awk + + + + + + gawk + + A program for manipulating text files; it is the GNU + implementation of awk + + gawk + + + + + + gawk-&gawk-version; + + A hard link to gawk + + gawk-&gawk-version; + + + + + + + + +
diff --git a/chapter06/gcc.xml b/chapter08/gcc.xml similarity index 89% rename from chapter06/gcc.xml rename to chapter08/gcc.xml index 5eabb9ce5..c811b714d 100644 --- a/chapter06/gcc.xml +++ b/chapter08/gcc.xml @@ -31,8 +31,8 @@ &diskspace; - &gcc-ch6-sbu; - &gcc-ch6-du; + &gcc-fin-sbu; + &gcc-fin-du; @@ -41,8 +41,8 @@ Installation of GCC - If building on x86_64, change the default directory - name for 64-bit libraries to lib: + If building on x86_64, change the default directory name for 64-bit + libraries to lib: case $(uname -m) in x86_64) @@ -54,8 +54,8 @@ esac Change the default directory name for 64-bit libraries to lib: -sed -e '/m64=/s/lib64/lib/' \ - -e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \ +sed -e '/m64=/s/lib64/lib/' \ + -e '/m32=/s/m32=.*/m32=..\&lib-m32;$(call if_multiarch,:i386-linux-gnu)/' \ -i.orig gcc/config/i386/t-linux64 The GCC documentation recommends building GCC in a dedicated build directory: @@ -65,47 +65,46 @@ cd build Prepare GCC for compilation: -mloptions="--disable-multilib" -mloptions="--enable-multilib --with-multilib-list=m64" -mloptions="$mloptions,m32" -mloptions="$mloptions,mx32" -SED=sed \ -../configure --prefix=/usr \ +../configure --prefix=/usr \ + LD=ld \ --enable-languages=c,c++ \ + --disable-multilib \ --disable-bootstrap \ - --with-system-zlib \ - $mloptions + --with-system-zlib +mlist=m64,m32mlist=m64,mx32mlist=m64,m32,mx32 +../configure --prefix=/usr \ + LD=ld \ + --enable-languages=c,c++ \ + --enable-multilib \ + --with-multilib-list=$mlist \ + --disable-bootstrap \ + --with-system-zlib - Note that for other languages, there are some prerequisites that + Note that for other programming languages there are some prerequisites that are not yet available. See the - BLFS Book + BLFS Book GCC page for instructions on how to build all of GCC's supported languages. The meaning of the new configure parameters: - SED=sed + LD=ld - Setting this environment variable prevents a hard-coded - path to /tools/bin/sed. + This parameter makes the configure script use the ld installed + by the binutils built earlier in this chapter, rather than + the cross-built version which would otherwise be used. - + --with-system-zlib This switch tells GCC to link to the system installed copy of - the Zlib library, rather than its own internal copy. + the zlib library, rather than its own internal copy. @@ -119,8 +118,8 @@ cd build critical. Do not skip it under any circumstance. - One set of tests in the GCC test suite is known to exhaust the stack, - so increase the stack size prior to running the tests: + One set of tests in the GCC test suite is known to exhaust the default + stack, so increase the stack size prior to running the tests: ulimit -s 32768 @@ -143,10 +142,11 @@ su tester -c "PATH=$PATH make -k check" Six tests related to get_time are known to fail. These are apparently related to the en_HK locale. + A few unexpected failures cannot always be avoided. The GCC developers are usually aware of these issues, but have not resolved them yet. Unless the test results are vastly different from those at the above URL, @@ -172,19 +172,19 @@ rm -rf /usr/lib/gcc/$(gcc -dumpmachine)/&gcc-version;/include-fixed/bits/root user and group: chown -v -R root:root \ - /usr/lib/gcc/$(gcc -dumpmachine)/&gcc-version;/include{,-fixed} + /usr/lib/gcc/*linux-gnu/&gcc-version;/include{,-fixed} Create a symlink required by the FHS for "historical" reasons. ln -sv ../usr/bin/cpp /lib - + Add a compatibility symlink to enable building programs with Link Time Optimization (LTO): @@ -194,7 +194,7 @@ ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/&gcc-version;/liblto_plugin.so \ Now that our final toolchain is in place, it is important to again ensure that compiling and linking will work as expected. We do this by performing - the same sanity checks as we did earlier in the chapter: + some sanity checks: - Depending on your machine architecture, the above may differ slightly, - the difference usually being the name of the directory + Depending on your machine architecture, the above may differ slightly. + The difference will be the name of the directory after /usr/lib/gcc. The important thing to look for here is that gcc has found all three crt*.o files under the @@ -247,16 +247,8 @@ ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/&gcc-version;/liblto_plugin.so \ /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include-fixed /usr/include - Again, note that the directory named after your target triplet may be - different than the above, depending on your architecture. - - + Again, the directory named after your target triplet may be + different than the above, depending on your system architecture. - A 32-bit system may see a few different directories. - For example, here is the output from an i686 machine: + A 32-bit system may see a few different directories. For example, here + is the output from an i686 machine: + SEARCH_DIR("/usr/i686-pc-linux-gnu/lib32") SEARCH_DIR("/usr/local/lib32") SEARCH_DIR("/lib32") @@ -338,7 +331,7 @@ SEARCH_DIR("/usr/lib"); Finally, move a misplaced file: mkdir -pv /usr/share/gdb/auto-load/usr/lib -mv -v /usr/lib/libstdc++*gdb.py /usr/share/gdb/auto-load/usr/lib +mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib diff --git a/chapter06/gdbm.xml b/chapter08/gdbm.xml similarity index 93% rename from chapter06/gdbm.xml rename to chapter08/gdbm.xml index f953b63f9..df2ab3409 100644 --- a/chapter06/gdbm.xml +++ b/chapter08/gdbm.xml @@ -24,7 +24,7 @@ <para>The GDBM package contains the GNU Database Manager. It is a library - of database functions that use extensible hashing and work similar to the + of database functions that use extensible hashing and works similar to the standard UNIX dbm. The library provides primitives for storing key/data pairs, searching and retrieving the data by its key and deleting a key along with its data. </para> @@ -34,8 +34,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&gdbm-ch6-sbu;</seg> - <seg>&gdbm-ch6-du;</seg> + <seg>&gdbm-fin-sbu;</seg> + <seg>&gdbm-fin-du;</seg> </seglistitem> </segmentedlist> @@ -60,8 +60,8 @@ <varlistentry> <term><envar>--enable-libgdbm-compat</envar></term> <listitem> - <para>This switch enables the libgdbm compatibility library to be - built, as some packages outside of LFS may require the older DBM + <para>This switch enables building the libgdbm compatibility library. + Some packages outside of LFS may require the older DBM routines it provides.</para> </listitem> </varlistentry> diff --git a/chapter06/gettext.xml b/chapter08/gettext.xml similarity index 92% rename from chapter06/gettext.xml rename to chapter08/gettext.xml index 2c4683804..cafe26182 100644 --- a/chapter06/gettext.xml +++ b/chapter08/gettext.xml @@ -33,8 +33,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&gettext-ch6-sbu;</seg> - <seg>&gettext-ch6-du;</seg> + <seg>&gettext-fin-sbu;</seg> + <seg>&gettext-fin-du;</seg> </seglistitem> </segmentedlist> @@ -43,31 +43,6 @@ <sect2 role="installation"> <title>Installation of Gettext - - - - - - Prepare Gettext for compilation: ./configure --prefix=/usr \ @@ -76,8 +51,9 @@ sed -i 's/test-lock..EXEEXT.//' gettext-tools/gnulib-tests/Makefile.inCompile the package: -make BISON_LOCALEDIR=/usr/share/locale - + +make + To test the results (this takes a long time, around 3 SBUs), issue: diff --git a/chapter06/glibc.xml b/chapter08/glibc.xml similarity index 82% rename from chapter06/glibc.xml rename to chapter08/glibc.xml index 75d771919..0886bbefd 100644 --- a/chapter06/glibc.xml +++ b/chapter08/glibc.xml @@ -33,8 +33,8 @@ &diskspace; - &glibc-ch6-sbu; - &glibc-ch6-du; + &glibc-fin-sbu; + &glibc-fin-du; @@ -43,47 +43,13 @@ Installation of Glibc - The Glibc build system is self-contained and will install - perfectly, even though the compiler specs file and linker are still - pointing to /tools. The specs - and linker cannot be adjusted before the Glibc install because the - Glibc autoconf tests would give false results and defeat the goal - of achieving a clean build. - Some of the Glibc programs use the non-FHS compliant /var/db directory to store their runtime data. Apply the following patch to make such programs store their runtime data in the FHS-compliant locations: patch -Np1 -i ../&glibc-fhs-patch; - - - Create a symlink for LSB - compliance. Additionally, for x86_64, create a compatibility symlink - required for the dynamic loader to function correctly: - -case $(uname -m) in - i?86) ln -sfv ld-linux.so.2 /lib/ld-lsb.so.3 - ;; - x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64 - ln -sfv ../lib/ld-linux-x86-64.so.2 /lib64/ld-lsb-x86-64.so.3 - ;; -esac - The Glibc documentation recommends building Glibc in a dedicated build directory: @@ -92,25 +58,22 @@ cd build Prepare Glibc for compilation: -CC="gcc -ffile-prefix-map=/tools=/usr" \ -../configure --prefix=/usr \ - --disable-werror \ - --enable-kernel=&min-kernel; \ - --enable-stack-protector=strong \ - --with-headers=/usr/include \ +../configure --prefix=/usr \ + --disable-werror \ + --enable-kernel=&min-kernel; \ + --enable-stack-protector=strong \ + --with-headers=/usr/include \ + libc_cv_slibdir=/lib +../configure --prefix=/usr \ + --disable-werror \ + --enable-kernel=&min-kernel; \ + --enable-stack-protector=strong \ + --with-headers=/usr/include \ + --enable-multi-arch \ libc_cv_slibdir=/lib - - The meaning of the options and new configure parameters: - - - CC="gcc -ffile-prefix-map=/tools=/usr" - - Make GCC record any references to files in /tools in result - of the compilation as if the files resided in /usr. This avoids - introduction of invalid paths in debugging symbols. - - + + The meaning of the configure options: --disable-werror @@ -120,6 +83,16 @@ cd build + + --enable-kernel=&min-kernel; + + This option tells the build system that this glibc may + be used with kernels as old as &min-kernel;. This means generating + workarounds in case a system call introduced in a later version + cannot be used. + + + --enable-stack-protector=strong @@ -128,13 +101,12 @@ cd build smashing attacks. - + --with-headers=/usr/include This option tells the build system where to find the - kernel API headers. By default, those headers are sought in - /tools/include. + kernel API headers. @@ -182,7 +154,7 @@ esac misc/tst-ttyname is known to fail in the LFS chroot environment. - + The nss/tst-nss-files-hosts-multi test may fail for reasons that have not been determined. @@ -212,18 +184,7 @@ esac systems where the CPU is not a relatively new Intel or AMD processor. - Though it is a harmless message, the install stage of Glibc will @@ -388,7 +349,7 @@ unset ZONEINFO zic -L /dev/null ... - This creates posix time zones, without any leap seconds. It is + This creates posix time zones without any leap seconds. It is conventional to put these in both zoneinfo and zoneinfo/posix. It is @@ -396,7 +357,7 @@ unset ZONEINFO zoneinfo, otherwise various test-suites will report errors. On an embedded system, where space is tight and you do not intend to ever update the time zones, you could save - 1.9MB by not using the posix + 1.9 MB by not using the posix directory, but some applications or test-suites might produce some failures. @@ -476,23 +437,12 @@ unset ZONEINFO EOF - If desired, the dynamic loader can also search a directory and + If desired, the dynamic loader can also search a directory and include the contents of files found there. Generally the files in this include directory are one line specifying the desired library path. To add this capability run the following commands: -cat >> /etc/ld.so.conf << "EOF" -# Add an include directory -include /etc/ld.so.conf.d/*.conf - -EOF -mkdir -pv /etc/ld.so.conf.d - - The dynamic loader can also search a directory and - include the contents of files found there. Generally the files in - this include directory are one line specifying the desired library path. - To add this capability run the following commands: -cat >> /etc/ld.so.conf << "EOF" +cat >> /etc/ld.so.conf << "EOF" # Add an include directory include /etc/ld.so.conf.d/*.conf @@ -502,6 +452,155 @@ mkdir -pv /etc/ld.so.conf.d
+ + + + + Building Glibc - 32bit + + Now recompile for m32. The extracted source can be + reused but needs to cleaned before installing the m32 + version of Glibc. + + Clear the build directory and remove artefacts from + previous build: + +rm -rf ./* +find .. -name "*.a" -delete + + Configure Glibc for m32 with the following commands: + +CC="gcc -m32" CXX="g++ -m32" \ +../configure \ + --prefix=/usr \ + --host=i686-pc-linux-gnu \ + --build=$(../scripts/config.guess) \ + --enable-kernel=&min-kernel; \ + --with-headers=/usr/include \ + --enable-multi-arch \ + --libdir=&usr-lib-m32; \ + --libexecdir=&usr-lib-m32; \ + libc_cv_slibdir=&lib-m32; + + Compile the package: + +make + + Install the package: + +make DESTDIR=$PWD/DESTDIR install +cp -a DESTDIR&lib-m32;/* &lib-m32;/ +cp -a DESTDIR&usr-lib-m32;/* &usr-lib-m32;/ +install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \ + /usr/include/gnu/ +ln -svf ..&lib-m32;/ld-linux.so.2 /lib/ld-linux.so.2 + + Add the library name to the dynamic loader config: + +echo "&usr-lib-m32;" >> /etc/ld.so.conf + + + At this point, it is imperative to stop and ensure that the basic + functions (compiling and linking) of the new toolchain are working as + expected. To perform a sanity check, run the following commands: + +echo 'int main(){}' > dummy.c +gcc -m32 dummy.c +readelf -l a.out | grep '/ld-linux' + + If everything is working correctly, there should be no errors, + and the output of the last command will be of the form: + +[Requesting program interpreter: /lib/ld-linux.so.2] + + If the output is not shown as above or there was no output at all, + then something is wrong. Investigate and retrace the steps to find out + where the problem is and correct it. This issue must be resolved before + continuing on. + + Once all is well, clean up the test files: + +rm -v dummy.c a.out + + + + + + + + + + + Building Glibc - x32bit + + Now recompile for mx32. The extracted source can be + reused but needs to cleaned before installing the mx32 + version of Glibc. + + Clear the build directory and remove artefacts from + previous build: + +rm -rf ./* +find .. -name "*.a" -delete + + Configure Glibc for mx32 with the following commands: + +CC="gcc -mx32" CXX="g++ -mx32" \ +../configure \ + --prefix=/usr \ + --host=x86_64-pc-linux-gnux32 \ + --build=$(../scripts/config.guess) \ + --enable-kernel=&min-kernel; \ + --with-headers=$LFS/usr/include \ + --enable-multi-arch \ + --libdir=&usr-lib-mx32; \ + --libexecdir=&usr-lib-mx32; \ + libc_cv_slibdir=&lib-mx32; + + Compile the package: + +make + + Install the package: + +make DESTDIR=$PWD/DESTDIR install +cp -a DESTDIR&lib-mx32;/* &lib-mx32;/ +cp -a DESTDIR&usr-lib-mx32;/* &usr-lib-mx32;/ +install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \ + /usr/include/gnu/ +ln -svf ..&lib-mx32;/ld-linux-x32.so.2 /lib/ld-linux-x32.so.2 + + Add the library name to the dynamic loader config: + +echo "&usr-lib-mx32;" >> /etc/ld.so.conf + + + At this point, it is imperative to stop and ensure that the basic + functions (compiling and linking) of the new toolchain are working as + expected. To perform a sanity check, run the following commands: + +echo 'int main(){}' > dummy.c +gcc -mx32 dummy.c +readelf -l a.out | grep '/ld-linux-x32' + + If everything is working correctly, there should be no errors, + and the output of the last command will be of the form: + +[Requesting program interpreter: /lib/ld-linux-x32.so.2] + + If the output is not shown as above or there was no output at all, + then something is wrong. Investigate and retrace the steps to find out + where the problem is and correct it. This issue must be resolved before + continuing on. + + Once all is well, clean up the test files: + +rm -v dummy.c a.out + + + + + Contents of Glibc diff --git a/chapter06/gmp.xml b/chapter08/gmp.xml similarity index 80% rename from chapter06/gmp.xml rename to chapter08/gmp.xml index a1a9f5ea1..ddd6babb4 100644 --- a/chapter06/gmp.xml +++ b/chapter08/gmp.xml @@ -31,8 +31,8 @@ &diskspace; - &gmp-ch6-sbu; - &gmp-ch6-du; + &gmp-fin-sbu; + &gmp-fin-du; @@ -120,9 +120,12 @@ make install-html - + + + + - Installation of GMP - 32-bit + Installation of GMP - 32bit Clean previous build: @@ -131,24 +134,40 @@ make install-html Generic libraries can be created by running the following: -cp -v configfsf.guess config.guess +cp -v configfsf.guess config.guess cp -v configfsf.sub config.sub Prepare GMP for compilation: ABI="32" \ -CC="gcc -m32" \ -CXX="g++ -m32" \ +CFLAGS="-m32 -O2 -pedantic -fomit-frame-pointer -mtune=generic -march=i686" \ +CXXFLAGS="$CFLAGS" \ +PKG_CONFIG_PATH="&usr-lib-m32;/pkgconfig" \ ./configure \ --prefix=/usr \ --disable-static \ --enable-cxx \ - --libdir=/usr/lib32 \ - --host=i686-pc-linux-gnu + --libdir=&usr-lib-m32; \ + --includedir=&usr-inc-m32;/gmp + + + The meaning of the new configure options: + + + --includedir=&usr-inc-m32;/gmp + + Some definitions in gmp.h differs for each arch but + has same name. Therefore, the headers must be separated from + each other. + + + + Compile the package: -make +sed -i 's/$(exec_prefix)\/include/$\(includedir\)/' Makefile +make The test suite for GMP in this section is considered critical. @@ -159,7 +178,7 @@ CXX="g++ -m32" \ make check 2>&1 | tee gmp-check-log - Ensure that all 190 tests in the test suite passed. + Ensure that all 197 tests in the test suite passed. Check the results by issuing the following command: awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log @@ -167,12 +186,16 @@ CXX="g++ -m32" \ Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; +cp -Rv DESTDIR&usr-inc-m32;/* &usr-inc-m32;/ rm -rf DESTDIR - - - + + + + + + Installation of GMP - x32-bit @@ -183,24 +206,26 @@ rm -rf DESTDIR Generic libraries can be created by running the following: -cp -v configfsf.guess config.guess +cp -v configfsf.guess config.guess cp -v configfsf.sub config.sub Prepare GMP for compilation: ABI="x32" \ -CC="gcc -mx32" \ -CXX="g++ -mx32" \ +CFLAGS="-mx32 -O2 -pedantic -fomit-frame-pointer -mtune=generic -march=x86-64" \ +CXXFLAGS="$CFLAGS" \ +PKG_CONFIG_PATH="&usr-lib-mx32;/pkgconfig" \ ./configure \ --prefix=/usr \ --disable-static \ --enable-cxx \ - --libdir=/usr/libx32 \ - --host=x86_64-pc-linux-gnux32 + --libdir=&usr-lib-mx32; \ + --includedir=&usr-inc-mx32;/gmp Compile the package: -make +sed -i 's/$(exec_prefix)\/include/$\(includedir\)/' Makefile +make The test suite for GMP in this section is considered critical. @@ -211,7 +236,7 @@ CXX="g++ -mx32" \ make check 2>&1 | tee gmp-check-log - Ensure that all 190 tests in the test suite passed. + Ensure that all 197 tests in the test suite passed. Check the results by issuing the following command: awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log @@ -219,11 +244,12 @@ CXX="g++ -mx32" \ Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; +cp -Rv DESTDIR&usr-inc-mx32;/* &usr-inc-mx32;/ rm -rf DESTDIR - - + + Contents of GMP diff --git a/chapter06/gperf.xml b/chapter08/gperf.xml similarity index 97% rename from chapter06/gperf.xml rename to chapter08/gperf.xml index d8c5b6594..aa42fe18b 100644 --- a/chapter06/gperf.xml +++ b/chapter08/gperf.xml @@ -30,8 +30,8 @@ &diskspace; - &gperf-ch6-sbu; - &gperf-ch6-du; + &gperf-fin-sbu; + &gperf-fin-du; diff --git a/chapter08/grep.xml b/chapter08/grep.xml new file mode 100644 index 000000000..ef6357281 --- /dev/null +++ b/chapter08/grep.xml @@ -0,0 +1,111 @@ + + + %general-entities; +]> + + + + + + grep + &grep-version; +
&grep-url;
+
+ + Grep-&grep-version; + + + Grep + + + + + + <para>The Grep package contains programs for searching through the contents of files.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&grep-fin-sbu;</seg> + <seg>&grep-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Grep + + Prepare Grep for compilation: + +./configure --prefix=/usr --bindir=/bin + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + Contents of Grep + + + Installed programs + + + egrep, fgrep, and grep + + + + + Short Descriptions + + + + + egrep + + Prints lines matching an extended regular expression + + egrep + + + + + + fgrep + + Prints lines matching a list of fixed strings + + fgrep + + + + + + grep + + Prints lines matching a basic regular expression + + grep + + + + + + + + +
diff --git a/chapter06/groff.xml b/chapter08/groff.xml similarity index 99% rename from chapter06/groff.xml rename to chapter08/groff.xml index aad0cbf85..032130217 100644 --- a/chapter06/groff.xml +++ b/chapter08/groff.xml @@ -31,8 +31,8 @@ &diskspace; - &groff-ch6-sbu; - &groff-ch6-du; + &groff-fin-sbu; + &groff-fin-du; diff --git a/chapter08/grub.xml b/chapter08/grub.xml index b6485b94d..51726e87f 100644 --- a/chapter08/grub.xml +++ b/chapter08/grub.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -14,204 +14,361 @@
&grub-url;
- Using GRUB to Set Up the Boot Process + GRUB-&grub-version; - - Introduction + + GRUB + - Configuring GRUB incorrectly can render your system - inoperable without an alternate boot device such as a CD-ROM. This - section is not required to boot your LFS system. You may just - want to modify your current boot loader, e.g. Grub-Legacy, GRUB2, or - LILO. + + + <para>The GRUB package contains the GRand Unified Bootloader.</para> - <para> Ensure that an emergency boot disk is ready to <quote>rescue</quote> - the computer if the computer becomes unusable (un-bootable). If you do not - already have a boot device, you can create one. In order for the procedure - below to work, you need to jump ahead to BLFS and install - <userinput>xorriso</userinput> from the <ulink - url="&blfs-book;multimedia/libisoburn.html"> - libisoburn</ulink> package.</para> + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> -<screen role="nodump"><userinput>cd /tmp -grub-mkrescue --output=grub-img.iso -xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></screen> - - <note> - <para> - To boot LFS on host systems that have UEFI enabled, the kernel needs to - have been built with the CONFIG_EFI_STUB capabality described in the - previous section. However, LFS can be booted using GRUB2 without such - an addition. To do this, the UEFI Mode and Secure Boot capabilities in - the host system's BIOS need to be turned off. For details, see <ulink - url="&hints-root;lfs-uefi.txt"> - the lfs-uefi.txt hint</ulink> at - &hints-root;lfs-uefi.txt. - </para> - </note> + <seglistitem> + <seg>&grub-fin-sbu;</seg> + <seg>&grub-fin-du;</seg> + </seglistitem> + </segmentedlist> </sect2> - <sect2> - <title>GRUB Naming Conventions + + Installation of GRUB - GRUB uses its own naming structure for drives and partitions in - the form of (hdn,m), where n - is the hard drive number and m is the partition - number. The hard drive number starts from zero, but the partition number - starts from one for normal partitions and five for extended partitions. - Note that this is different from earlier versions where - both numbers started from zero. For example, partition sda1 is (hd0,1) to - GRUB and sdb3 is - (hd1,3). In contrast to Linux, GRUB does not - consider CD-ROM drives to be hard drives. For example, if using a CD - on hdb and a second hard drive - on hdc, that second hard drive - would still be (hd1). + Prepare GRUB for compilation: + +./configure --prefix=/usr \ + --sbindir=/sbin \ + --sysconfdir=/etc \ + --disable-efiemu \ + --disable-werror + + + The meaning of the new configure options: + + + --disable-werror + + This allows the build to complete with warnings introduced + by more recent Flex versions. + + + + + --disable-efiemu + + This option minimizes what is built by disabling a feature and + testing programs not needed for LFS. + + + + + + Compile the package: + +make + + This package does not come with a test suite. + + Install the package: + +make install +mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions + + Using GRUB to make your LFS system bootable will be discussed in + . - - Setting Up the Configuration + + Contents of GRUB - GRUB works by writing data to the first physical track of the - hard disk. This area is not part of any file system. The programs - there access GRUB modules in the boot partition. The default location - is /boot/grub/. + + Installed programs + Installed directories - The location of the boot partition is a choice of the user that - affects the configuration. One recommendation is to have a separate small - (suggested size is 100 MB) partition just for boot information. That way - each build, whether LFS or some commercial distro, can access the same boot - files and access can be made from any booted system. If you choose to do - this, you will need to mount the separate partition, move all files in the - current /boot directory (e.g. the - linux kernel you just built in the previous section) to the new partition. - You will then need to unmount the partition and remount it as /boot. If you do this, be sure to update - /etc/fstab. + - Using the current lfs partition will also work, but configuration - for multiple systems is more difficult. + grub-bios-setup, grub-editenv, grub-file, grub-fstest, + grub-glue-efi, grub-install, grub-kbdcomp, grub-macbless, + grub-menulst2cfg, grub-mkconfig, + grub-mkimage, grub-mklayout, grub-mknetdir, + grub-mkpasswd-pbkdf2, grub-mkrelpath, grub-mkrescue, grub-mkstandalone, + grub-ofpathname, grub-probe, grub-reboot, grub-render-label, + grub-script-check, + grub-set-default, grub-sparc64-setup, and grub-syslinux2cfg - Using the above information, determine the appropriate - designator for the root partition (or boot partition, if a separate - one is used). For the following example, it is assumed that the root - (or separate boot) partition is sda2. + /usr/lib/grub, /etc/grub.d, /usr/share/grub, and /boot/grub (when grub-install + is first run) + + - Install the GRUB files into /boot/grub and set up the boot track: + + Short Descriptions + + - - The following command will overwrite the current boot loader. Do not - run the command if this is not desired, for example, if using a third party - boot manager to manage the Master Boot Record (MBR). - + + grub-bios-setup + + Is a helper program for grub-install + + grub-bios-setup + + + -grub-install /dev/sda + + grub-editenv + + A tool to edit the environment block + + grub-editenv + + + - - If the system has been booted using UEFI, - grub-install will try to install files for the - x86_64-efi target, but those files - have not been installed in chapter 6. If this is the case, add - to the command above. - + + grub-file + + Checks if FILE is of the specified type. + + grub-file + + + - - - Creating the GRUB Configuration File - - Generate /boot/grub/grub.cfg: - - cat > /boot/grub/grub.cfg << "EOF" -# Begin /boot/grub/grub.cfg -set default=0 -set timeout=5 - -insmod ext2 -set root=(hd0,2) - -menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;" { - linux /boot/vmlinuz-&linux-version;-lfs-&version; root=/dev/sda2 ro -} -EOF - - cat > /boot/grub/grub.cfg << "EOF" -# Begin /boot/grub/grub.cfg -set default=0 -set timeout=5 - -insmod ext2 -set root=(hd0,2) - -menuentry "GNU/Linux, Linux &linux-version;-lfs-&versiond;" { - linux /boot/vmlinuz-&linux-version;-lfs-&versiond; root=/dev/sda2 ro -} -EOF - - cat > /boot/grub/grub.cfg << "EOF" -# Begin /boot/grub/grub.cfg -set default=0 -set timeout=5 - -insmod ext2 -set root=(hd0,2) - -menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;-multilib" { - linux /boot/vmlinuz-&linux-version;-lfs-&version;-multilib root=/dev/sda2 ro -} -EOF - - cat > /boot/grub/grub.cfg << "EOF" -# Begin /boot/grub/grub.cfg -set default=0 -set timeout=5 - -insmod ext2 -set root=(hd0,2) - -menuentry "GNU/Linux, Linux &linux-version;-lfs-&versiond;-multilib" { - linux /boot/vmlinuz-&linux-version;-lfs-&versiond;-multilib root=/dev/sda2 ro -} -EOF - - - From GRUB's perspective, the - kernel files are relative to the partition used. If you - used a separate /boot partition, remove /boot from the above - linux line. You will also need to change the - set root line to point to the boot partition. - - - GRUB is an extremely powerful program and it provides a tremendous - number of options for booting from a wide variety of devices, operating - systems, and partition types. There are also many options for customization - such as graphical splash screens, playing sounds, mouse input, etc. The - details of these options are beyond the scope of this introduction. - - There is a command, grub-mkconfig, that - can write a configuration file automatically. It uses a set of scripts in - /etc/grub.d/ and will destroy any customizations that you make. These scripts - are designed primarily for non-source distributions and are not recommended for - LFS. If you install a commercial Linux distribution, there is a good chance - that this program will be run. Be sure to back up your grub.cfg file. - - -
diff --git a/chapter08/gzip.xml b/chapter08/gzip.xml new file mode 100644 index 000000000..5040f2e0b --- /dev/null +++ b/chapter08/gzip.xml @@ -0,0 +1,233 @@ + + + %general-entities; +]> + + + + + + gzip + &gzip-version; +
&gzip-url;
+
+ + Gzip-&gzip-version; + + + Gzip + + + + + + <para>The Gzip package contains programs for compressing and decompressing + files.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gzip-fin-sbu;</seg> + <seg>&gzip-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Gzip + + Prepare Gzip for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + Move a program that needs to be on the root filesystem: + +mv -v /usr/bin/gzip /bin + + + + + Contents of Gzip + + + Installed programs + + + gunzip, gzexe, gzip, uncompress (hard link with gunzip), zcat, zcmp, + zdiff, zegrep, zfgrep, zforce, zgrep, zless, zmore, and znew + + + + + Short Descriptions + + + + + gunzip + + Decompresses gzipped files + + gunzip + + + + + + gzexe + + Creates self-decompressing executable files + + gzexe + + + + + + gzip + + Compresses the given files using Lempel-Ziv (LZ77) coding + + gzip + + + + + + uncompress + + Decompresses compressed files + + uncompress + + + + + + zcat + + Decompresses the given gzipped files to standard output + + zcat + + + + + + zcmp + + Runs cmp on gzipped files + + zcmp + + + + + + zdiff + + Runs diff on gzipped files + + zdiff + + + + + + zegrep + + Runs egrep on gzipped files + + zegrep + + + + + + zfgrep + + Runs fgrep on gzipped files + + zfgrep + + + + + + zforce + + Forces a .gz extension on + all given files that are gzipped files, so that gzip + will not compress them again; this can be useful when file names were + truncated during a file transfer + + zforce + + + + + + zgrep + + Runs grep on gzipped files + + zgrep + + + + + + zless + + Runs less on gzipped files + + zless + + + + + + zmore + + Runs more on gzipped files + + zmore + + + + + + znew + + Re-compresses files from compress format to + gzip format—.Z to .gz + + znew + + + + + + + + +
diff --git a/chapter06/iana-etc.xml b/chapter08/iana-etc.xml similarity index 97% rename from chapter06/iana-etc.xml rename to chapter08/iana-etc.xml index 42ab25c34..65530f9d8 100644 --- a/chapter06/iana-etc.xml +++ b/chapter08/iana-etc.xml @@ -31,8 +31,8 @@ &diskspace; - &iana-etc-ch6-sbu; - &iana-etc-ch6-du; + &iana-etc-fin-sbu; + &iana-etc-fin-du; diff --git a/chapter06/inetutils.xml b/chapter08/inetutils.xml similarity index 99% rename from chapter06/inetutils.xml rename to chapter08/inetutils.xml index c8fdd456f..bbdc54955 100644 --- a/chapter06/inetutils.xml +++ b/chapter08/inetutils.xml @@ -30,8 +30,8 @@ &diskspace; - &inetutils-ch6-sbu; - &inetutils-ch6-du; + &inetutils-fin-sbu; + &inetutils-fin-du; diff --git a/chapter06/intltool.xml b/chapter08/intltool.xml similarity index 93% rename from chapter06/intltool.xml rename to chapter08/intltool.xml index 9e9ebad20..d48c93015 100644 --- a/chapter06/intltool.xml +++ b/chapter08/intltool.xml @@ -31,8 +31,8 @@ &diskspace; - &intltool-ch6-sbu; - &intltool-ch6-du; + &intltool-fin-sbu; + &intltool-fin-du; @@ -45,6 +45,10 @@ sed -i 's:\\\${:\\\$\\{:' intltool-update.in + The above regular expression looks unusual because of all the + backslashes. What it does is add a backslash before the right brace + character in the sequence '\${' resulting in '\$\{'. + Prepare Intltool for compilation: ./configure --prefix=/usr diff --git a/chapter08/introduction.xml b/chapter08/introduction.xml index 5cb40b882..b63ce1c3e 100644 --- a/chapter08/introduction.xml +++ b/chapter08/introduction.xml @@ -5,14 +5,71 @@ %general-entities; ]> - + Introduction - It is time to make the LFS system bootable. This chapter - discusses creating an fstab file, building a - kernel for the new LFS system, and installing the GRUB boot loader so - that the LFS system can be selected for booting at startup. + In this chapter, we start constructing the LFS system in earnest. + + + The installation of this software is straightforward. Although in many + cases the installation instructions could be made shorter and more generic, + we have opted to provide the full instructions for every package to minimize + the possibilities for mistakes. The key to learning what makes a Linux system + work is to know what each package is used for and why you (or the system) + may need it. + + We do not recommend using optimizations. They can make + a program run slightly faster, but they may also cause compilation + difficulties and problems when running the program. If a package refuses to + compile when using optimization, try to compile it without optimization and + see if that fixes the problem. Even if the package does compile when using + optimization, there is the risk it may have been compiled incorrectly because + of the complex interactions between the code and build tools. Also note that + the and options using values + not specified in the book have not been tested. This may cause problems with + the toolchain packages (Binutils, GCC and Glibc). The small potential gains + achieved in using compiler optimizations are often outweighed by the risks. + First-time builders of LFS are encouraged to build without custom + optimizations. The subsequent system will still run very fast and be stable + at the same time. + + Before the installation instructions, each installation page provides + information about the package, including a concise description of what it + contains, approximately how long it will take to build, and how much disk + space is required during this building process. Following the installation + instructions, there is a list of programs and libraries (along with brief + descriptions) that the package installs. + + The SBU values and required disk space includes test suite data + for all applicable packages in . SBU + values have been calculated using a single CPU core (-j1) for all + operations. + + + About libraries + + In general, the LFS editors discourage building and installing static + libraries. The original purpose for most static libraries has been made + obsolete in a modern Linux system. In addition, linking a static library + into a program can be detrimental. If an update to the library is needed + to remove a security problem, all programs that use the static library will + need to be relinked to the new library. Since the use of static libraries + is not always obvious, the relevant programs (and the procedures needed to + do the linking) may not even be known. + + In the procedures in this chapter, we remove or disable installation of + most static libraries. Usually this is done by passing a + option to configure. + In other cases, alternate means are needed. In a few cases, especially + glibc and gcc, the use of static libraries remains essential to the general + package building process. + + For a more complete discussion of libraries, see the discussion + + Libraries: Static or shared? in the BLFS book. + + diff --git a/chapter06/iproute2.xml b/chapter08/iproute2.xml similarity index 98% rename from chapter06/iproute2.xml rename to chapter08/iproute2.xml index 8b868df65..9e609e3cf 100644 --- a/chapter06/iproute2.xml +++ b/chapter08/iproute2.xml @@ -31,8 +31,8 @@ &diskspace; - &iproute2-ch6-sbu; - &iproute2-ch6-du; + &iproute2-fin-sbu; + &iproute2-fin-du; @@ -47,14 +47,14 @@ be installed. Prevent this by running the commands below. If the arpd binary is needed, instructions for compiling Berkeley DB can be found in the BLFS Book at - . + . sed -i /ARPD/d Makefile rm -fv man/man8/arpd.8 It is also necessary to disable building two modules that - requires . + require . sed -i 's/.m_ipt.o//' tc/Makefile diff --git a/chapter06/kbd.xml b/chapter08/kbd.xml similarity index 90% rename from chapter06/kbd.xml rename to chapter08/kbd.xml index a72ca29a8..a219102eb 100644 --- a/chapter06/kbd.xml +++ b/chapter08/kbd.xml @@ -31,8 +31,8 @@ &diskspace; - &kbd-ch6-sbu; - &kbd-ch6-du; + &kbd-fin-sbu; + &kbd-fin-du; @@ -41,21 +41,21 @@ Installation of Kbd - The behaviour of the Backspace and Delete keys is not consistent + The behaviour of the backspace and delete keys is not consistent across the keymaps in the Kbd package. The following patch fixes this issue for i386 keymaps: patch -Np1 -i ../&kbd-backspace-patch; - After patching, the Backspace key generates the character with code 127, - and the Delete key generates a well-known escape sequence. + After patching, the backspace key generates the character with code 127, + and the delete key generates a well-known escape sequence. Remove the redundant resizecons program (it requires the defunct svgalib to provide the video mode files - for normal use setfont sizes the console appropriately) together with its manpage. -sed -i 's/\(RESIZECONS_PROGS=\)yes/\1no/g' configure +sed -i '/RESIZECONS_PROGS=/s/yes/no/' configure sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in Prepare Kbd for compilation: @@ -63,21 +63,12 @@ sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in ./configure --prefix=/usr --disable-vlock - The meaning of the configure options: - + The meaning of the configure option: + --disable-vlock - This option prevents the vlock utility from being built, as it + This option prevents the vlock utility from being built because it requires the PAM library, which isn't available in the chroot environment. @@ -104,19 +95,9 @@ sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in such languages have to download working keymaps separately. - If desired, install the documentation: -mkdir -v /usr/share/doc/kbd-&kbd-version; +mkdir -v /usr/share/doc/kbd-&kbd-version; cp -R -v docs/doc/* /usr/share/doc/kbd-&kbd-version; diff --git a/chapter06/kmod.xml b/chapter08/kmod.xml similarity index 84% rename from chapter06/kmod.xml rename to chapter08/kmod.xml index e29660f00..27155e6ed 100644 --- a/chapter06/kmod.xml +++ b/chapter08/kmod.xml @@ -31,8 +31,8 @@ &diskspace; - &kmod-ch6-sbu; - &kmod-ch6-du; + &kmod-fin-sbu; + &kmod-fin-du; @@ -78,12 +78,7 @@ LFS chroot environment. At a minimum the git program is required and several tests will not run outside of a git repository. - - Install the package, and create symlinks for + Install the package and create symlinks for compatibility with Module-Init-Tools (the package that previously handled Linux kernel modules): @@ -97,27 +92,30 @@ ln -sfv kmod /bin/lsmod
- + + + - Installation of Kmod - 32-bit + Installation of Kmod - 32bit - Clean previous build but keep man pages as they cannot be recreated - since xsltproc isn't installed yet: + Clean previous build but keep man pages as they cannot + be recreated since xsltproc isn't installed yet: -sed -e "s/^CLEANFILES =.*/CLEANFILES =/" -i man/Makefile +sed -e "s/^CLEANFILES =.*/CLEANFILES =/" -i man/Makefile make clean Prepare Kmod for compilation: -CC="gcc -m32" ./configure \ - --prefix=/usr \ - --bindir=/bin \ - --libdir=/usr/lib32 \ - --sysconfdir=/etc \ - --with-xz --with-zlib \ - --host=i686-pc-linux-gnu \ - --with-rootlibdir=/usr/lib32 +CC="gcc -m32" ./configure \ + --prefix=/usr \ + --bindir=/bin \ + --libdir=&usr-lib-m32; \ + --sysconfdir=/etc \ + --with-xz \ + --with-zlib \ + --host=i686-pc-linux-gnu \ + --with-rootlibdir=&usr-lib-m32; Compile the package: @@ -126,32 +124,35 @@ make clean Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR - + - + + + - Installation of Kmod - x32-bit + Installation of Kmod - x32bit - Clean previous build: + Clean previous build but keep man pages as they cannot + be recreated since xsltproc isn't installed yet: -sed -e "s/^CLEANFILES =.*/CLEANFILES =/" -i man/Makefile +sed -e "s/^CLEANFILES =.*/CLEANFILES =/" -i man/Makefile make clean Prepare Kmod for compilation: -CC="gcc -mx32" ./configure \ +CC="gcc -mx32" ./configure \ --prefix=/usr \ --bindir=/bin \ - --libdir=/usr/libx32 \ + --libdir=&usr-lib-mx32; \ --sysconfdir=/etc \ --with-xz \ --with-zlib \ --host=x86_64-pc-linux-gnux32 \ - --with-rootlibdir=/usr/libx32 + --with-rootlibdir=&usr-lib-mx32; Compile the package: @@ -160,10 +161,10 @@ make clean Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; rm -rf DESTDIR - + Contents of Kmod diff --git a/chapter06/less.xml b/chapter08/less.xml similarity index 98% rename from chapter06/less.xml rename to chapter08/less.xml index 087b2e6a3..237cf1e15 100644 --- a/chapter06/less.xml +++ b/chapter08/less.xml @@ -30,8 +30,8 @@ &diskspace; - &less-ch6-sbu; - &less-ch6-du; + &less-fin-sbu; + &less-fin-du; diff --git a/chapter06/libcap.xml b/chapter08/libcap.xml similarity index 87% rename from chapter06/libcap.xml rename to chapter08/libcap.xml index 9af65e4c6..210265568 100644 --- a/chapter06/libcap.xml +++ b/chapter08/libcap.xml @@ -33,8 +33,8 @@ &diskspace; - &libcap-ch6-sbu; - &libcap-ch6-du; + &libcap-fin-sbu; + &libcap-fin-du; @@ -79,8 +79,12 @@ ln -sfv ../../lib/libcap.so.2 /usr/lib/libcap.so + + + + - Installation of Libcap - 32-bit + Installation of Libcap - 32bit Clean previous build: @@ -93,14 +97,19 @@ ln -sfv ../../lib/libcap.so.2 /usr/lib/libcap.so Install the package: make lib=lib32 prefix=$PWD/DESTDIR/usr -C libcap install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 -chmod -v 755 /usr/lib32/libcap.so.&libcap-version; +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; +sed -e "s|^libdir=.*|libdir=&usr-lib-m32;|" -i &usr-lib-m32;/pkgconfig/lib{cap,psx}.pc +chmod -v 755 &usr-lib-m32;/libcap.so.&libcap-version; rm -rf DESTDIR - + + + + + - Installation of Libcap - x32-bit + Installation of Libcap - x32bit Clean previous build: @@ -108,16 +117,17 @@ rm -rf DESTDIR Compile the package: -make CC="gcc -mx32" +make CC="gcc -mx32 -march=x86-64" Install the package: make lib=libx32 prefix=$PWD/DESTDIR/usr -C libcap install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 -chmod -v 755 /usr/libx32/libcap.so.&libcap-version; +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; +sed -e "s|^libdir=.*|libdir=&usr-lib-mx32;|" -i &usr-lib-mx32;/pkgconfig/lib{cap,psx}.pc +chmod -v 755 &usr-lib-mx32;/libcap.so.&libcap-version; rm -rf DESTDIR - + Contents of Libcap diff --git a/chapter06/libelf.xml b/chapter08/libelf.xml similarity index 77% rename from chapter06/libelf.xml rename to chapter08/libelf.xml index 65b91d7d2..66a1189aa 100644 --- a/chapter06/libelf.xml +++ b/chapter08/libelf.xml @@ -31,8 +31,8 @@ &diskspace; - &elfutils-ch6-sbu; - &elfutils-ch6-du; + &elfutils-fin-sbu; + &elfutils-fin-du; @@ -56,7 +56,7 @@ make check - One test, run-elfclassify.sh, is known to fail. + Install only Libelf: @@ -66,18 +66,22 @@ rm /usr/lib/libelf.a + + + + - Installation of Libelf - 32-bit + Installation of Libelf - 32bit Clean previous build: make distclean - Prepare Libelf for compilation: + Prepare Libtool for compilation: CC="gcc -m32" ./configure \ - --prefix=/usr \ - --libdir=/usr/lib32 \ + --prefix=/usr \ + --libdir=&usr-lib-m32; \ --host=i686-pc-linux-gnu \ --disable-debuginfod @@ -88,24 +92,28 @@ rm /usr/lib/libelf.a Install the package: make DESTDIR=$PWD/DESTDIR -C libelf install -install -vDm644 config/libelf.pc DESTDIR/usr/lib32/pkgconfig/libelf.pc -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +install -vDm644 config/libelf.pc DESTDIR&usr-lib-m32;/pkgconfig/libelf.pc +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR - + + + + + - Installation of Libelf - x32-bit + Installation of Libelf - x32bit Clean previous build: make distclean - Prepare Libelf for compilation: + Prepare Libtool for compilation: CC="gcc -mx32" ./configure \ - --prefix=/usr \ - --libdir=/usr/libx32 \ + --prefix=/usr \ + --libdir=&usr-lib-m32; \ --host=x86_64-pc-linux-gnux32 \ --disable-debuginfod @@ -116,11 +124,11 @@ rm -rf DESTDIR Install the package: make DESTDIR=$PWD/DESTDIR -C libelf install -install -vDm644 config/libelf.pc DESTDIR/usr/libx32/pkgconfig/libelf.pc -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +install -vDm644 config/libelf.pc DESTDIR&usr-lib-mx32;/pkgconfig/libelf.pc +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; rm -rf DESTDIR - + Contents of Libelf diff --git a/chapter06/libffi.xml b/chapter08/libffi.xml similarity index 78% rename from chapter06/libffi.xml rename to chapter08/libffi.xml index a363187d7..db68f858b 100644 --- a/chapter06/libffi.xml +++ b/chapter08/libffi.xml @@ -32,8 +32,8 @@ &diskspace; - &libffi-ch6-sbu; - &libffi-ch6-du; + &libffi-fin-sbu; + &libffi-fin-du; @@ -49,18 +49,7 @@ If this is not done, all applications that link to libffi will trigger Illegal Operation Errors. - Prepare libffi for compilation: ./configure --prefix=/usr --disable-static --with-gcc-arch=native @@ -71,14 +60,14 @@ sed -e '/^includedir/ s/=.*$/=@includedir@/' \ --with-gcc-arch=native - Ensure gcc optimizes for the current system. If this + Ensure GCC optimizes for the current system. If this is not specified, the system is guessed and the code generated may not be correct for some systems. If the generated code will be copied from the native system to a less capable system, use the less capable system as a parameter. For details about alternative system types, see - the x86 options in the gcc manual. + the x86 options in the GCC manual. @@ -92,18 +81,18 @@ sed -e '/^includedir/ s/=.*$/=@includedir@/' \ make check - Six tests, all related to test-callback.c, are known to fail. - Install the package: make install - + + + - Installation of Libffi - 32-bit + Installation of Libffi - 32bit Clean previous build: @@ -111,11 +100,10 @@ sed -e '/^includedir/ s/=.*$/=@includedir@/' \ Prepare Libffi for compilation: -CC="gcc -m32" CXX="g++ -m32" \ -./configure \ +CC="gcc -m32" CXX="g++ -m32" ./configure \ --prefix=/usr \ --disable-static \ - --libdir=/usr/lib32 \ + --libdir=&usr-lib-m32; \ --with-gcc-arch=i686 \ --host=i686-pc-linux-gnu @@ -130,15 +118,17 @@ sed -e '/^includedir/ s/=.*$/=@includedir@/' \ Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR - + - + + + - Installation of Libffi - x32-bit + Installation of Libtool - x32bit Clean previous build: @@ -146,12 +136,11 @@ rm -rf DESTDIR Prepare Libffi for compilation: -CC="gcc -mx32" CXX="g++ -mx32" \ -./configure \ - --prefix=/usr \ - --disable-static \ - --with-gcc-arch=x86_64 \ - --libdir=/usr/libx32 \ +CC="gcc -mx32" CXX="g++ -mx32" ./configure \ + --prefix=/usr \ + --disable-static \ + --libdir=&usr-lib-mx32; \ + --with-gcc-arch=x86_64 \ --host=x86_64-unknown-linux-gnux32 Compile the package: @@ -165,10 +154,10 @@ rm -rf DESTDIR Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; rm -rf DESTDIR - + Contents of Libffi diff --git a/chapter06/libpipeline.xml b/chapter08/libpipeline.xml similarity index 80% rename from chapter06/libpipeline.xml rename to chapter08/libpipeline.xml index 6496e792d..5d275d381 100644 --- a/chapter06/libpipeline.xml +++ b/chapter08/libpipeline.xml @@ -31,8 +31,8 @@ &diskspace; - &libpipeline-ch6-sbu; - &libpipeline-ch6-du; + &libpipeline-fin-sbu; + &libpipeline-fin-du; @@ -45,22 +45,6 @@ ./configure --prefix=/usr - Compile the package: make diff --git a/chapter06/libtool.xml b/chapter08/libtool.xml similarity index 87% rename from chapter06/libtool.xml rename to chapter08/libtool.xml index 91e11270a..c6f43742a 100644 --- a/chapter06/libtool.xml +++ b/chapter08/libtool.xml @@ -32,8 +32,8 @@ &diskspace; - &libtool-ch6-sbu; - &libtool-ch6-du; + &libtool-fin-sbu; + &libtool-fin-du; @@ -70,10 +70,12 @@ - + + + - Installation of Libtool - 32-bit + Installation of Libtool - 32bit Clean previous build: @@ -83,7 +85,7 @@ CC="gcc -m32" ./configure \ --prefix=/usr \ - --libdir=/usr/lib32 \ + --libdir=&usr-lib-m32; \ --host=i686-pc-linux-gnu Compile the package: @@ -92,16 +94,18 @@ Install the package: -make DESTDIR=$(pwd)/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR - + - + + + - Installation of Libtool - x32-bit + Installation of Libtool - x32bit Clean previous build: @@ -110,8 +114,8 @@ rm -rf DESTDIR Prepare Libtool for compilation: CC="gcc -mx32" ./configure \ - --prefix=/usr \ - --libdir=/usr/libx32 \ + --prefix=/usr \ + --libdir=&usr-lib-mx32; \ --host=x86_64-pc-linux-gnux32 Compile the package: @@ -120,12 +124,11 @@ rm -rf DESTDIR Install the package: -make DESTDIR=$(pwd)/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; rm -rf DESTDIR - - + Contents of Libtool diff --git a/chapter08/m4.xml b/chapter08/m4.xml new file mode 100644 index 000000000..54608bfeb --- /dev/null +++ b/chapter08/m4.xml @@ -0,0 +1,104 @@ + + + %general-entities; +]> + + + + + + m4 + &m4-version; +
&m4-url;
+
+ + M4-&m4-version; + + + M4 + + + + + + <para>The M4 package contains a macro processor.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&m4-fin-sbu;</seg> + <seg>&m4-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of M4 + + First, make some fixes required by glibc-2.28 and later: + +sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c +echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h + + Prepare M4 for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + Contents of M4 + + + Installed program + + + m4 + + + + + Short Descriptions + + + + + + m4 + + Copies the given files while expanding the macros that they + contain. These macros are either built-in or user-defined and can + take any number of arguments. Besides performing macro expansion, + m4 has built-in functions for including named + files, running Unix commands, performing integer arithmetic, + manipulating text, recursion, etc. The m4 program + can be used either as a front-end to a compiler or as a macro processor + in its own right. + + m4 + + + + + + + + +
diff --git a/chapter05/make.xml b/chapter08/make.xml similarity index 53% rename from chapter05/make.xml rename to chapter08/make.xml index 205ae5f15..080ed3989 100644 --- a/chapter05/make.xml +++ b/chapter08/make.xml @@ -4,7 +4,8 @@ %general-entities; ]> - + + @@ -15,25 +16,23 @@ Make-&make-version; - + Make - tools - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/make.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + <para>The Make package contains a program for controlling the generation of + executables and other non-source files of a package from source files.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&make-ch5-sbu;</seg> - <seg>&make-ch5-du;</seg> + <seg>&make-fin-sbu;</seg> + <seg>&make-fin-du;</seg> </seglistitem> </segmentedlist> @@ -42,34 +41,19 @@ <sect2 role="installation"> <title>Installation of Make Prepare Make for compilation: -./configure --prefix=/tools --without-guile - - - The meaning of the configure option: - - - --without-guile - - This ensures that Make-&make-version; won't link against Guile libraries, which - may be present on the host system, but won't be available within the - chroot environment in the next chapter. - - - +./configure --prefix=/usr Compile the package: make - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Make test suite anyway, issue the following command: + To test the results, issue: make check @@ -79,11 +63,35 @@ - - - <para>Details on this package are located in - <xref linkend="contents-make" role="."/></para> + <sect2 id="contents-make" role="content"> + <title>Contents of Make + + + Installed program + + + make + + + + + Short Descriptions + + + + + make + + Automatically determines which pieces of a package need to + be (re)compiled and then issues the relevant commands + + make + + + + + diff --git a/chapter06/man-db.xml b/chapter08/man-db.xml similarity index 95% rename from chapter06/man-db.xml rename to chapter08/man-db.xml index f2f46b891..45b1f4fa2 100644 --- a/chapter06/man-db.xml +++ b/chapter08/man-db.xml @@ -31,8 +31,8 @@ &diskspace; - &man-db-ch6-sbu; - &man-db-ch6-du; + &man-db-fin-sbu; + &man-db-fin-du; @@ -126,21 +126,10 @@ make check - One test, man-missing-locales, is known to fail in the LFS chroot envirnment. - Install the package: make install -
diff --git a/chapter06/man-pages.xml b/chapter08/man-pages.xml similarity index 96% rename from chapter06/man-pages.xml rename to chapter08/man-pages.xml index 3d2c52046..1fe3f4287 100644 --- a/chapter06/man-pages.xml +++ b/chapter08/man-pages.xml @@ -30,8 +30,8 @@ &diskspace; - &man-pages-ch6-sbu; - &man-pages-ch6-du; + &man-pages-fin-sbu; + &man-pages-fin-du; diff --git a/chapter06/meson.xml b/chapter08/meson.xml similarity index 82% rename from chapter06/meson.xml rename to chapter08/meson.xml index 0b49c5441..b3c3224c5 100644 --- a/chapter06/meson.xml +++ b/chapter08/meson.xml @@ -23,27 +23,31 @@ - <para>Meson is an open source build system meant to be both extremely fast, - and, even more importantly, as user friendly as possible.</para> + <para>Meson is an open source build system meant to be both extremely fast + and as user friendly as possible.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&meson-ch6-sbu;</seg> - <seg>&meson-ch6-du;</seg> + <seg>&meson-fin-sbu;</seg> + <seg>&meson-fin-du;</seg> </seglistitem> </segmentedlist> + <tip revision="sysv"> + <para>This section is not strictly required for LFS if not using + systemd. On the other hand, meson/ninja is a powerful build system, + which is expected to be used more and more often. It is required for + several packages in <ulink url="&blfs-book;">the BLFS + book</ulink>.</para> + </tip> + </sect2> <sect2 role="installation"> <title>Installation of Meson - Compile Meson with the following command: python3 setup.py build @@ -64,8 +68,8 @@ cp -rv dest/* / By default python3 setup.py install installs various files (such as man pages) into Python Eggs. With a specified root location, setup.py installs - these files into a standard hierarchy. Then we can just copy - the hierarchy so the files will be in the standard location. + these files into a standard hierarchy. Then the hierarchy + can just be copied to the standard location. diff --git a/chapter06/mpc.xml b/chapter08/mpc.xml similarity index 97% rename from chapter06/mpc.xml rename to chapter08/mpc.xml index 2d518c8c1..ad46b7e43 100644 --- a/chapter06/mpc.xml +++ b/chapter08/mpc.xml @@ -32,8 +32,8 @@ &diskspace; - &mpc-ch6-sbu; - &mpc-ch6-du; + &mpc-fin-sbu; + &mpc-fin-du; diff --git a/chapter06/mpfr.xml b/chapter08/mpfr.xml similarity index 97% rename from chapter06/mpfr.xml rename to chapter08/mpfr.xml index ff8e323b7..f2344facb 100644 --- a/chapter06/mpfr.xml +++ b/chapter08/mpfr.xml @@ -31,8 +31,8 @@ &diskspace; - &mpfr-ch6-sbu; - &mpfr-ch6-du; + &mpfr-fin-sbu; + &mpfr-fin-du; diff --git a/chapter08/ncurses.xml b/chapter08/ncurses.xml new file mode 100644 index 000000000..58c343253 --- /dev/null +++ b/chapter08/ncurses.xml @@ -0,0 +1,470 @@ + + + %general-entities; +]> + + + + + + ncurses + &ncurses-version; +
&ncurses-url;
+
+ + Ncurses-&ncurses-version; + + + Ncurses + + + + + + <para>The Ncurses package contains libraries for terminal-independent + handling of character screens.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&ncurses-fin-sbu;</seg> + <seg>&ncurses-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Ncurses + + Don't install a static library that is not handled by configure: + +sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in + + Prepare Ncurses for compilation: + +./configure --prefix=/usr \ + --mandir=/usr/share/man \ + --with-shared \ + --without-debug \ + --without-normal \ + --enable-pc-files \ + --enable-widec + + + The meaning of the new configure options: + + + --enable-widec + + This switch causes wide-character libraries (e.g., libncursesw.so.&ncurses-version;) + to be built instead of normal ones (e.g., libncurses.so.&ncurses-version;). + These wide-character libraries are usable in both multibyte and + traditional 8-bit locales, while normal libraries work properly + only in 8-bit locales. Wide-character and normal libraries are + source-compatible, but not binary-compatible. + + + + + --enable-pc-files + + This switch generates and installs .pc files for pkg-config. + + + + + + --without-normal + + This switch disables building and installing most static libraries. + + + + + + + Compile the package: + +make + + This package has a test suite, but it can only be run after the + package has been installed. The tests reside in the + test/ directory. See the + README file in that directory for further details. + + + Install the package: + +make install + + Move the shared libraries to the + /lib directory, where they are + expected to reside: + +mv -v /usr/lib/libncursesw.so.6* /lib + + Because the libraries have been moved, one symlink points to + a non-existent file. Recreate it: + +ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so + + Many applications still expect the linker to be able to find + non-wide-character Ncurses libraries. Trick such applications into linking with + wide-character libraries by means of symlinks and linker scripts: + +for lib in ncurses form panel menu ; do + rm -vf /usr/lib/lib${lib}.so + echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so + ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc +done + + Finally, make sure that old applications that look for + -lcurses at build time are still + buildable: + +rm -vf /usr/lib/libcursesw.so +echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so +ln -sfv libncurses.so /usr/lib/libcurses.so + + If desired, install the Ncurses documentation: + +mkdir -v /usr/share/doc/ncurses-&ncurses-version; +cp -v -R doc/* /usr/share/doc/ncurses-&ncurses-version; + + + + The instructions above don't create non-wide-character Ncurses + libraries since no package installed by compiling from sources would link + against them at runtime. However, the only known binary-only + applications that link against non-wide-character Ncurses libraries + require version 5. If you must have such libraries because of some binary-only + application or to be compliant with LSB, build the package again with the + following commands: + +make distclean +./configure --prefix=/usr \ + --with-shared \ + --without-normal \ + --without-debug \ + --without-cxx-binding \ + --with-abi-version=5 +make sources libs +cp -av lib/lib*.so.5* /usr/lib + + + + + + + + + Building Ncurses - 32bit + + Clean previous build: + +make distclean + + Prepare Ncurses for compilation: + +CC="gcc -m32" CXX="g++ -m32" \ +./configure --prefix=/usr \ + --host=i686-pc-linux-gnu \ + --libdir=&usr-lib-m32; \ + --mandir=/usr/share/man \ + --with-shared \ + --without-debug \ + --without-normal \ + --enable-pc-files \ + --enable-widec \ + --with-pkg-config-libdir=&usr-lib-m32;/pkgconfig + + Compile the package: + +make + + Install the package: + +make DESTDIR=$PWD/DESTDIR install +mkdir -p DESTDIR&usr-lib-m32;/pkgconfig +for lib in ncurses form panel menu ; do + rm -vf DESTDIR&usr-lib-m32;/lib${lib}.so + echo "INPUT(-l${lib}w)" > DESTDIR&usr-lib-m32;/lib${lib}.so + ln -svf ${lib}w.pc DESTDIR&usr-lib-m32;/pkgconfig/$lib.pc +done +rm -vf DESTDIR&usr-lib-m32;/libcursesw.so +echo "INPUT(-lncursesw)" > DESTDIR&usr-lib-m32;/libcursesw.so +ln -sfv libncurses.so DESTDIR&usr-lib-m32;/libcurses.so +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; +rm -rf DESTDIR + + + + + + + + Building Ncurses - x32bit + + Clean previous build: + +make distclean + + Prepare Ncurses for compilation: + +CC="gcc -mx32" CXX="g++ -mx32" \ +./configure --prefix=/usr \ + --host=x86_64-pc-linux-gnux32 \ + --libdir=&usr-lib-mx32; \ + --mandir=/usr/share/man \ + --with-shared \ + --without-debug \ + --without-normal \ + --enable-pc-files \ + --enable-widec \ + --with-pkg-config-libdir=&usr-lib-mx32;/pkgconfig + + Compile the package: + +make + + Install the package: + +make DESTDIR=$PWD/DESTDIR install +mkdir -p DESTDIR&usr-lib-mx32;/pkgconfig +for lib in ncurses form panel menu ; do + rm -vf DESTDIR&usr-lib-mx32;/lib${lib}.so + echo "INPUT(-l${lib}w)" > DESTDIR&usr-lib-mx32;/lib${lib}.so + ln -svf ${lib}w.pc DESTDIR&usr-lib-mx32;/pkgconfig/$lib.pc +done +rm -vf DESTDIR&usr-lib-mx32;/libcursesw.so +echo "INPUT(-lncursesw)" > DESTDIR&usr-lib-mx32;/libcursesw.so +ln -sfv libncurses.so DESTDIR&usr-lib-mx32;/libcurses.so +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; +rm -rf DESTDIR + + + + + Contents of Ncurses + + + Installed programs + Installed libraries + Installed directories + + + + captoinfo (link to tic), + clear, + infocmp, + infotocap (link to tic), + ncursesw6-config, + reset (link to tset), + tabs, + tic, + toe, + tput, and + tset + + + libcursesw.so (symlink and linker script to libncursesw.so), + libformw.so, + libmenuw.so, + libncursesw.so, + libncurses++w.a, + libpanelw.so, and their non-wide-character counterparts without "w" + in the library names. + + /usr/share/tabset, + /usr/share/terminfo, and + /usr/share/doc/ncurses-&ncurses-version; + + + + + + Short Descriptions + + + + + captoinfo + + Converts a termcap description into a terminfo description + + captoinfo + + + + + + clear + + Clears the screen, if possible + + clear + + + + + + infocmp + + Compares or prints out terminfo descriptions + + infocmp + + + + + + infotocap + + Converts a terminfo description into a termcap description + + infotocap + + + + + + ncursesw6-config + + Provides configuration information for ncurses + + ncursesw6-config + + + + + + reset + + Reinitializes a terminal to its default values + + reset + + + + + + tabs + + Clears and sets tab stops on a terminal + + tabs + + + + + + tic + + The terminfo entry-description compiler that translates a + terminfo file from source format into the binary format needed for the + ncurses library routines [A terminfo file contains information on the + capabilities of a certain terminal.] + + tic + + + + + + toe + + Lists all available terminal types, giving the primary name and + description for each + + toe + + + + + + tput + + Makes the values of terminal-dependent capabilities available to + the shell; it can also be used to reset or initialize a terminal or + report its long name + + tput + + + + + + tset + + Can be used to initialize terminals + + tset + + + + + + libcursesw + + A link to libncursesw + + libcursesw + + + + + + libncursesw + + Contains functions to display text in many complex ways on a + terminal screen; a good example of the use of these functions is the + menu displayed during the kernel's make + menuconfig + + libncursesw + + + + + + libformw + + Contains functions to implement forms + + libformw + + + + + + libmenuw + + Contains functions to implement menus + + libmenuw + + + + + + libpanelw + + Contains functions to implement panels + + libpanelw + + + + + + + + +
diff --git a/chapter06/ninja.xml b/chapter08/ninja.xml similarity index 89% rename from chapter06/ninja.xml rename to chapter08/ninja.xml index e998c64fb..20613c542 100644 --- a/chapter06/ninja.xml +++ b/chapter08/ninja.xml @@ -30,11 +30,20 @@ &diskspace; - &ninja-ch6-sbu; - &ninja-ch6-du; + &ninja-fin-sbu; + &ninja-fin-du; + + This section is not strictly required for LFS if not using + systemd. On the other hand, ninja associated to meson makes + a powerful build system combination, + which is expected to be used more and more often. It is required for + several packages in the BLFS + book. + +
diff --git a/chapter06/openssl.xml b/chapter08/openssl.xml similarity index 86% rename from chapter06/openssl.xml rename to chapter08/openssl.xml index 41f02651b..50cd2a812 100644 --- a/chapter06/openssl.xml +++ b/chapter08/openssl.xml @@ -25,7 +25,7 @@ The OpenSSL package contains management tools and libraries relating to cryptography. These are useful for providing cryptographic functions - to other packages, such as OpenSSH, email applications and web browsers + to other packages, such as OpenSSH, email applications, and web browsers (for accessing HTTPS sites). @@ -33,8 +33,8 @@ &diskspace; - &openssl-ch6-sbu; - &openssl-ch6-du; + &openssl-fin-sbu; + &openssl-fin-du; @@ -42,12 +42,7 @@ Installation of OpenSSL - Prepare OpenSSL for compilation: ./config --prefix=/usr \ @@ -80,10 +75,12 @@ cp -vfr doc/* /usr/share/doc/openssl-&openssl-version; - + + + - Installation of OpenSSL - 32-bit + Installation of OpenSSL - 32bit Clean previous build: @@ -96,27 +93,30 @@ CC="gcc -m32 -march=i686" \ CXX="g++ -m32 -march=i686" \ ./config \ --prefix=/usr \ - --libdir=/usr/lib32 \ - --openssldir=/etc/ssl \ - --libdir=lib32 \ - shared \ - zlib-dynamic + --libdir=&usr-lib-m32; \ + --openssldir=/etc/ssl \ + --libdir=lib32 \ + shared \ + zlib-dynamic Compile the package: make + Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR - + - + + + - Installation of OpenSSL - x32-bit + Installation of OpenSSL - x32bit Clean previous build: @@ -129,22 +129,23 @@ CC="gcc -mx32" \ CXX="g++ -mx32" \ ./config \ --prefix=/usr \ - --libdir=/usr/libx32 \ - --openssldir=/etc/ssl \ - --libdir=libx32 \ - shared \ - zlib-dynamic + --libdir=&usr-lib-mx32; \ + --openssldir=/etc/ssl \ + --libdir=libx32 \ + shared \ + zlib-dynamic Compile the package: make + Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; rm -rf DESTDIR - +
Contents of OpenSSL diff --git a/chapter08/patch.xml b/chapter08/patch.xml new file mode 100644 index 000000000..870007b98 --- /dev/null +++ b/chapter08/patch.xml @@ -0,0 +1,96 @@ + + + %general-entities; +]> + + + + + + patch + &patch-version; +
&patch-url;
+
+ + Patch-&patch-version; + + + Patch + + + + + + <para>The Patch package contains a program for modifying or creating files + by applying a <quote>patch</quote> file typically created by the + <command>diff</command> program.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&patch-fin-sbu;</seg> + <seg>&patch-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Patch + + Prepare Patch for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + Contents of Patch + + + Installed program + + + patch + + + + + Short Descriptions + + + + + patch + + Modifies files according to a patch file (A patch file is + normally a difference listing created with the diff + program. By applying these differences to the original files, + patch creates the patched versions.) + + patch + + + + + + + + +
diff --git a/chapter06/perl.xml b/chapter08/perl.xml similarity index 98% rename from chapter06/perl.xml rename to chapter08/perl.xml index 284464d87..fd5e07f06 100644 --- a/chapter06/perl.xml +++ b/chapter08/perl.xml @@ -31,8 +31,8 @@ &diskspace; - &perl-ch6-sbu; - &perl-ch6-du; + &perl-fin-sbu; + &perl-fin-du; @@ -41,12 +41,6 @@ Installation of Perl - First create a basic /etc/hosts file to be - referenced in one of Perl's configuration files as well as the optional - test suite: - -echo "127.0.0.1 localhost $(hostname)" > /etc/hosts - This version of Perl now builds the Compress::Raw::Zlib and Compress::Raw::BZip2 modules. By default Perl will use an internal copy of the sources for the build. diff --git a/chapter06/pkgconfig.xml b/chapter08/pkgconfig.xml similarity index 94% rename from chapter06/pkgconfig.xml rename to chapter08/pkgconfig.xml index 3c311e389..b987a7652 100644 --- a/chapter06/pkgconfig.xml +++ b/chapter08/pkgconfig.xml @@ -23,17 +23,17 @@ - <para> The pkg-config package contains a tool for passing the include path - and/or library paths to build tools during the configure and make file - execution.</para> + <para>The pkg-config package contains a tool for passing the include path + and/or library paths to build tools during the configure and make phases + of package installations.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&pkgconfig-ch6-sbu;</seg> - <seg>&pkgconfig-ch6-du;</seg> + <seg>&pkgconfig-fin-sbu;</seg> + <seg>&pkgconfig-fin-du;</seg> </seglistitem> </segmentedlist> diff --git a/chapter06/pkgmgt.xml b/chapter08/pkgmgt.xml similarity index 91% rename from chapter06/pkgmgt.xml rename to chapter08/pkgmgt.xml index d28038467..14e94fdaf 100644 --- a/chapter06/pkgmgt.xml +++ b/chapter08/pkgmgt.xml @@ -45,36 +45,33 @@ <title>Upgrade Issues A Package Manager makes it easy to upgrade to newer versions when they - are released. Generally the instructions in the LFS and BLFS Book can be + are released. Generally the instructions in the LFS and BLFS books can be used to upgrade to the newer versions. Here are some points that you should be aware of when upgrading packages, especially on a running system. If Glibc needs to be upgraded to a newer version, (e.g. from - glibc-2.19 to glibc-2.20), it is safer to rebuild LFS. Though you + glibc-2.31 to glibc-2.32), it is safer to rebuild LFS. Though you may be able to rebuild all the packages in their dependency order, we do not recommend it. - - If a package containing a shared library is updated, and if the - name of the library changes, then all the packages dynamically linked - to the library need to be recompiled to link against the newer library. - (Note that there is no correlation between the package version and the - name of the library.) For example, consider a package foo-1.2.3 that - installs a shared library with name - libfoo.so.1. Say you upgrade - the package to a newer version foo-1.2.4 that installs a shared library - with name libfoo.so.2. In this - case, all packages that are dynamically linked to - libfoo.so.1 need to be - recompiled to link against - libfoo.so.2. Note that you - should not remove the previous libraries until the dependent packages - are recompiled. - - + If a package containing a shared library is updated, and + if the name of the library changes, then any the packages dynamically + linked to the library need to be recompiled in order to link against the + newer library. (Note that there is no correlation between the package + version and the name of the library.) For example, consider a package + foo-1.2.3 that installs a shared library with name libfoo.so.1. If you upgrade the package to + a newer version foo-1.2.4 that installs a shared library with name + libfoo.so.2. In this case, any + packages that are dynamically linked to libfoo.so.1 need to be recompiled to link + against libfoo.so.2 in order to + use the new library version. You should not remove the previous + libraries unless all the dependent packages are recompiled. + diff --git a/chapter06/procps.xml b/chapter08/procps.xml similarity index 98% rename from chapter06/procps.xml rename to chapter08/procps.xml index 59bf0864c..b09f0f69d 100644 --- a/chapter06/procps.xml +++ b/chapter08/procps.xml @@ -30,8 +30,8 @@ &diskspace; - &procps-ng-ch6-sbu; - &procps-ng-ch6-du; + &procps-ng-fin-sbu; + &procps-ng-fin-du; @@ -58,7 +58,7 @@ --with-systemd - The meaning of the configure options: + The meaning of the configure option: --disable-kill diff --git a/chapter06/psmisc.xml b/chapter08/psmisc.xml similarity index 98% rename from chapter06/psmisc.xml rename to chapter08/psmisc.xml index b01303131..febf90748 100644 --- a/chapter06/psmisc.xml +++ b/chapter08/psmisc.xml @@ -31,8 +31,8 @@ &diskspace; - &psmisc-ch6-sbu; - &psmisc-ch6-du; + &psmisc-fin-sbu; + &psmisc-fin-du; diff --git a/chapter06/python.xml b/chapter08/python.xml similarity index 90% rename from chapter06/python.xml rename to chapter08/python.xml index cc440903d..f25b8a691 100644 --- a/chapter06/python.xml +++ b/chapter08/python.xml @@ -17,7 +17,7 @@ Python-&python-version; - python + Python @@ -25,15 +25,15 @@ The Python 3 package contains the Python development environment. It is useful for object-oriented programming, writing scripts, prototyping - large programs or developing entire applications. + large programs, or developing entire applications. &buildtime; &diskspace; - &python-ch6-sbu; - &python-ch6-du; + &python-fin-sbu; + &python-fin-du; @@ -84,7 +84,7 @@ make To test the results, issue make test. - Some tests requiring network connection or additional packages are + Some tests requiring a network connection or additional packages are skipped. The test named test_normalization fails because network configuration is not completed yet. For more comprehensive results, the test can be rerun when Python 3 is reinstalled in BLFS. @@ -170,8 +170,8 @@ tar --strip-components=1 \ is a Python program that reads Python 2.x source code and applies a - series of fixes to transform it into valid - Python 3.x code. + series of fixes to transform it into + valid Python 3.x code. 2to3 @@ -231,20 +231,7 @@ tar --strip-components=1 \ - + diff --git a/chapter06/readline.xml b/chapter08/readline.xml similarity index 84% rename from chapter06/readline.xml rename to chapter08/readline.xml index 8cd3759b5..4077b23b4 100644 --- a/chapter06/readline.xml +++ b/chapter08/readline.xml @@ -31,8 +31,8 @@ &diskspace; - &readline-ch6-sbu; - &readline-ch6-du; + &readline-fin-sbu; + &readline-fin-du; @@ -60,12 +60,12 @@ sed -i '/{OLDSUFF}/c:' support/shlib-install The meaning of the configure option: - --with-curses" + --with-curses This option tells Readline that it can find the termcap - library functions in the curses library, rather than a separate - termcap library. It allows generating a correct - readline.pc file. + library functions in the curses library, rather than a separate + termcap library. It allows generating a correct + readline.pc file. @@ -73,13 +73,13 @@ sed -i '/{OLDSUFF}/c:' support/shlib-install Compile the package: -make SHLIB_LIBS="-L/tools/lib -lncursesw" +make SHLIB_LIBS="-lncursesw" The meaning of the make option: - SHLIB_LIBS="-L/tools/lib -lncursesw" + SHLIB_LIBS="-lncursesw" This option forces Readline to link against the libncursesw library. @@ -92,7 +92,7 @@ sed -i '/{OLDSUFF}/c:' support/shlib-install Install the package: -make SHLIB_LIBS="-L/tools/lib -lncursesw" install +make SHLIB_LIBS="-lncursesw" install Now move the dynamic libraries to a more appropriate location and fix up some permissions and symbolic links: @@ -108,10 +108,12 @@ ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so - + + + - Installation of Readline - 32-bit + Installation of Readline - 32bit Clean previous build: @@ -119,9 +121,9 @@ ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.soPrepare Readline for compilation: -CC="gcc -m32 -march=i686" ./configure \ +CC="gcc -m32" ./configure \ --prefix=/usr \ - --libdir=/usr/lib32 \ + --libdir=&usr-lib-m32; \ --disable-static \ --host=i686-pc-linux-gnu @@ -132,15 +134,17 @@ ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.soInstall the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR - +
- + + + - Installation of Readline - x32-bit + Installation of Readline - x32bit Clean previous build: @@ -150,7 +154,7 @@ rm -rf DESTDIR CC="gcc -mx32" ./configure \ --prefix=/usr \ - --libdir=/usr/libx32 \ + --libdir=&usr-lib-mx32; \ --disable-static \ --host=x86_64-pc-linux-gnux32 @@ -161,10 +165,10 @@ rm -rf DESTDIR Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; rm -rf DESTDIR - + Contents of Readline diff --git a/chapter06/revisedchroot.xml b/chapter08/revisedchroot.xml similarity index 61% rename from chapter06/revisedchroot.xml rename to chapter08/revisedchroot.xml index b80e32115..409baf2f6 100644 --- a/chapter06/revisedchroot.xml +++ b/chapter08/revisedchroot.xml @@ -26,24 +26,15 @@ chroot "$LFS" /usr/bin/env -i \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /bin/bash --login - The reason for this is that the programs in /tools are no longer needed. For this reason - you can delete the /tools - directory if so desired. - - - Removing /tools will also - remove the temporary copies of Tcl, Expect, and DejaGNU which were used - for running the toolchain tests. If you need these programs later on, - they will need to be recompiled and re-installed. The BLFS book has - instructions for this (see ). - + Here the +h option is not used anymore, since + all the previous programs have been replaced: hashing is therefore + possible. If the virtual kernel file systems have been unmounted, either manually or through a reboot, ensure that the virtual kernel file systems are mounted when reentering the chroot. This process was explained in and . + linkend="ch-tools-bindmount"/> and . There were several static libraries that were not suppressed earlier in the chapter in order to satisfy the regression tests in several packages. These @@ -56,7 +47,13 @@ rm -f /usr/lib/libbz2.a rm -f /usr/lib/lib{com_err,e2p,ext2fs,ss}.a rm -f /usr/lib/libltdl.a rm -f /usr/lib/libfl.a -rm -f /usr/lib/libz.a +rm -f /usr/lib/libz.a +rm -f &usr-lib-m32;/libbz2.a +rm -f &usr-lib-m32;/libltdl.a +rm -f &usr-lib-m32;/libz.a +rm -f &usr-lib-mx32;/libbz2.a +rm -f &usr-lib-mx32;/libltdl.a +rm -f &usr-lib-mx32;/libz.a There are also several files installed in the /usr/lib and /usr/libexec directories with a file name extention of .la. These are "libtool archive" @@ -65,18 +62,16 @@ rm -f /usr/lib/libz.a shared libraries, specially when using also non-autotools build systems. To remove them, run: - find /usr/lib /usr/libexec -name \*.la -delete - find /usr/lib{,32} /usr/libexec -name \*.la -delete -find /usr/lib{,x32} /usr/libexec -name \*.la -delete - find /usr/lib{,{,x}32} /usr/libexec -name \*.la -delete +find /usr/lib /usr/libexec -name \*.la -delete +find &usr-lib-m32; -name \*.la -delete +find &usr-lib-mx32; -name \*.la -delete For more information about libtool archive files, see the BLFS section "About Libtool Archive (.la) files". - Finally, remove the temporary 'tester' usr account created at the - beginning of this chapter. + Finally, remove the temporary 'tester' user account created at the + beginning of the previous chapter. -sed -i '/tester/d' /etc/passwd /etc/group -rm -rf /home/tester +userdel -r tester
diff --git a/chapter08/sed.xml b/chapter08/sed.xml new file mode 100644 index 000000000..77d30479b --- /dev/null +++ b/chapter08/sed.xml @@ -0,0 +1,97 @@ + + + %general-entities; +]> + + + + + + sed + &sed-version; +
&sed-url;
+
+ + Sed-&sed-version; + + + Sed + + + + + + <para>The Sed package contains a stream editor.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&sed-fin-sbu;</seg> + <seg>&sed-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Sed + + Prepare Sed for compilation: + +./configure --prefix=/usr --bindir=/bin + + Compile the package and generate the HTML documentation: + +make +make html + + To test the results, issue: + +chown -Rv tester . +su tester -c "PATH=$PATH make check" + + Install the package and its documentation: + +make install +install -d -m755 /usr/share/doc/sed-&sed-version; +install -m644 doc/sed.html /usr/share/doc/sed-&sed-version; + + + + + Contents of Sed + + + Installed program + Installed directory + + + sed + /usr/share/doc/sed-&sed-version; + + + + + Short Descriptions + + + + + sed + + Filters and transforms text files in a single pass + + sed + + + + + + + + +
diff --git a/chapter06/shadow.xml b/chapter08/shadow.xml similarity index 97% rename from chapter06/shadow.xml rename to chapter08/shadow.xml index 7fd621bdb..3ccbfbb58 100644 --- a/chapter06/shadow.xml +++ b/chapter08/shadow.xml @@ -31,8 +31,8 @@ &diskspace; - &shadow-ch6-sbu; - &shadow-ch6-du; + &shadow-fin-sbu; + &shadow-fin-du; @@ -67,13 +67,14 @@ find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;/var/mail location used currently: -sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \ - -e 's@/var/spool/mail@/var/mail@' etc/login.defs +sed -e 's:#ENCRYPT_METHOD DES:ENCRYPT_METHOD SHA512:' \ + -e 's:/var/spool/mail:/var/mail:' \ + -i etc/login.defs If you chose to build Shadow with Cracklib support, run the following: -sed -i 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' etc/login.defs +sed -i 's:DICTPATH.*:DICTPATH\t/lib/cracklib/pw_dict:' etc/login.defs Make a minor change to make the first group number generated @@ -84,7 +85,8 @@ find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \;Prepare Shadow for compilation: touch /usr/bin/passwd -./configure --sysconfdir=/etc --with-group-name-max-length=32 +./configure --sysconfdir=/etc \ + --with-group-name-max-length=32 The meaning of the configure option: diff --git a/chapter06/strippingagain.xml b/chapter08/strippingagain.xml similarity index 52% rename from chapter06/strippingagain.xml rename to chapter08/strippingagain.xml index b7a5cf0cd..f787d7218 100644 --- a/chapter06/strippingagain.xml +++ b/chapter08/strippingagain.xml @@ -13,7 +13,7 @@ This section is optional. If the intended user is not a programmer and does not plan to do any debugging on the system software, the system size can be decreased - by about 90 MB by removing the debugging symbols from binaries and + by about 2 GB by removing the debugging symbols from binaries and libraries. This causes no inconvenience other than not being able to debug the software fully anymore. @@ -30,97 +30,82 @@ url='&blfs-book;/general/gdb.html'>gdb later in BLFS. - + -save_lib="ld-&glibc-version;.so libc-&glibc-version;.so libpthread-&glibc-version;.so libthread_db-&libthread_db-version;.so" +save_lib="ld-&glibc-version;.so libc-&glibc-version;.so libpthread-&glibc-version;.so libthread_db-&libthread_db-version;.so" cd /lib - for LIB in $save_lib; do objcopy --only-keep-debug $LIB $LIB.dbg strip --strip-unneeded $LIB objcopy --add-gnu-debuglink=$LIB.dbg $LIB -done +done + +cd &lib-m32; +for LIB in $save_lib; do + objcopy --only-keep-debug $LIB $LIB.dbg + strip --strip-unneeded $LIB + objcopy --add-gnu-debuglink=$LIB.dbg $LIB +done + +cd &lib-mx32; +for LIB in $save_lib; do + objcopy --only-keep-debug $LIB $LIB.dbg + strip --strip-unneeded $LIB + objcopy --add-gnu-debuglink=$LIB.dbg $LIB +done save_usrlib="libquadmath.so.&libquadmath-version; libstdc++.so.&libstdcpp-version; libitm.so.&libitm-version; libatomic.so.&libatomic-version;" cd /usr/lib - for LIB in $save_usrlib; do objcopy --only-keep-debug $LIB $LIB.dbg strip --strip-unneeded $LIB objcopy --add-gnu-debuglink=$LIB.dbg $LIB -done - -unset LIB save_lib save_usrlib - -save_lib="ld-&glibc-version;.so libc-&glibc-version;.so libpthread-&glibc-version;.so libthread_db-&libthread_db-version;.so" - -cd /lib - -for LIB in $save_lib; do +done + +cd &usr-lib-m32; +for LIB in $save_usrlib; do objcopy --only-keep-debug $LIB $LIB.dbg strip --strip-unneeded $LIB objcopy --add-gnu-debuglink=$LIB.dbg $LIB -done - -save_usrlib="libquadmath.so.&libquadmath-version; libstdc++.so.&libstdcpp-version; - libitm.so.&libitm-version; libatomic.so.&libatomic-version;" - -for libdir in /usr/lib{,{,x}32}; do - cd $libdir - for LIB in $save_usrlib; do - objcopy --only-keep-debug $LIB $LIB.dbg - strip --strip-unneeded $LIB - objcopy --add-gnu-debuglink=$LIB.dbg $LIB - done -done +done + +cd &usr-lib-mx32; +for LIB in $save_usrlib; do + objcopy --only-keep-debug $LIB $LIB.dbg + strip --strip-unneeded $LIB + objcopy --add-gnu-debuglink=$LIB.dbg $LIB +done unset LIB save_lib save_usrlib - Before performing the stripping, take special care to ensure that + - Now the binaries and libraries can be safely stripped: +--> + Now the binaries and libraries can be stripped: +find /usr/lib -type f -name \*.a \ + -exec strip --strip-debug {} ';' +find &usr-lib-m32; -type f -name \*.a \ + -exec strip --strip-debug {} ';' +find &usr-lib-mx32; -type f -name \*.a \ + -exec strip --strip-debug {} ';' -/tools/bin/find /usr/lib -type f -name \*.a \ - -exec /tools/bin/strip --strip-debug {} ';' +find /lib /usr/lib -type f -name \*.so* ! -name \*dbg \ + -exec strip --strip-unneeded {} ';' +find &lib-m32; &usr-lib-m32; -type f -name \*.so* ! -name \*dbg \ + -exec strip --strip-unneeded {} ';' +find &lib-mx32; &usr-lib-mx32; -type f -name \*.so* ! -name \*dbg \ + -exec strip --strip-unneeded {} ';' -/tools/bin/find /lib /usr/lib -type f \( -name \*.so* -a ! -name \*dbg \) \ - -exec /tools/bin/strip --strip-unneeded {} ';' - -/tools/bin/find /{bin,sbin} /usr/{bin,sbin,libexec} -type f \ - -exec /tools/bin/strip --strip-all {} ';' - -/tools/bin/find /usr/lib{,{,x}32} -type f -name \*.a \ - -exec /tools/bin/strip --strip-debug {} ';' - -/tools/bin/find /lib /usr/lib{,{,x}32} -type f \( -name \*.so* -a ! -name \*dbg \) \ - -exec /tools/bin/strip --strip-unneeded {} ';' - -/tools/bin/find /{bin,sbin} /usr/{bin,sbin,libexec} -type f \ - -exec /tools/bin/strip --strip-all {} ';' +find /{bin,sbin} /usr/{bin,sbin,libexec} -type f \ + -exec strip --strip-all {} ';' A large number of files will be reported as having their file format not recognized. These warnings can be safely ignored. These diff --git a/chapter06/sysklogd.xml b/chapter08/sysklogd.xml similarity index 96% rename from chapter06/sysklogd.xml rename to chapter08/sysklogd.xml index e96980cb4..9aec7ba9b 100644 --- a/chapter06/sysklogd.xml +++ b/chapter08/sysklogd.xml @@ -23,7 +23,7 @@ - <para>The Sysklogd package contains programs for logging system messages, + <para>The sysklogd package contains programs for logging system messages, such as those given by the kernel when unusual things happen.</para> <segmentedlist> @@ -31,8 +31,8 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&sysklogd-ch6-sbu;</seg> - <seg>&sysklogd-ch6-du;</seg> + <seg>&sysklogd-fin-sbu;</seg> + <seg>&sysklogd-fin-du;</seg> </seglistitem> </segmentedlist> diff --git a/chapter06/systemd.xml b/chapter08/systemd.xml similarity index 80% rename from chapter06/systemd.xml rename to chapter08/systemd.xml index 1566261c2..88824d17b 100644 --- a/chapter06/systemd.xml +++ b/chapter08/systemd.xml @@ -31,24 +31,22 @@ <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&systemd-ch6-sbu;</seg> - <seg>&systemd-ch6-du;</seg> + <seg>&systemd-fin-sbu;</seg> + <seg>&systemd-fin-du;</seg> </seglistitem> </segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of systemd - + First, apply a patch to fix the build with GCC-10 and fix a segfault: - Create a symlink to work around missing xsltproc: +patch -Np1 -i ../systemd-&systemd-version;-gcc_10-fixes-2.patch -ln -sf /tools/bin/true /usr/bin/xsltproc + Create a symlink to work around the xsltproc command not being installed: + +ln -sf /bin/true /usr/bin/xsltproc Set up the man pages: @@ -73,7 +71,6 @@ LANG=en_US.UTF-8 \ meson --prefix=/usr \ --sysconfdir=/etc \ --localstatedir=/var \ - -Dc_args=-Wno-format-overflow \ -Dblkid=true \ -Dbuildtype=release \ -Ddefault-dnssec=no \ @@ -98,23 +95,11 @@ meson --prefix=/usr \ The meaning of the meson options: - - -Dc_args=-Wno-format-overflow - - The defaults flags passed to gcc contain - -Werror=format-overflow, which generates - an error with GCC 10. Passing this parameter prevents the error - from occuring. - - - -D*-path=* - These switches provide location of binaries needed by - systemd at runtime that have not yet been installed, or who's - pkgconfig files are currently only in - /tools/lib/pkgconfig. + These switches provide the location of binaries needed by + systemd at runtime that have not yet been installed. @@ -156,7 +141,7 @@ meson --prefix=/usr \ -Droot* These switches ensure that core programs and - shared libraries are installed in the subdirectories + shared libraries are installed in subdirectories of the root partition. @@ -202,11 +187,7 @@ meson --prefix=/usr \ Compile the package: LANG=en_US.UTF-8 ninja - Install the package: LANG=en_US.UTF-8 ninja install @@ -234,49 +215,38 @@ meson --prefix=/usr \ Prevent systemd from resetting the maximum PID value which causes some problems with packages and units in BLFS: - rm -f /usr/lib/sysctl.d/50-pid-max.conf - - - + + + + Installation of systemd - 32-bit - If still in the build directory, step out: -cd .. - Clean previous build: -rm -rf build +rm -rf * Create a symlink to work around missing xsltproc: -ln -sf /tools/bin/true /usr/bin/xsltproc + +ln -sf /bin/true /usr/bin/xsltproc + Prepare systemd for compilation: - cd build -PKG_CONFIG_PATH="/usr/lib32/pkgconfig:/tools/lib32/pkgconfig" \ + PKG_CONFIG_PATH="&usr-lib-m32;/pkgconfig" \ CC="gcc -m32 -march=i686" \ CXX="g++ -m32 -march=i686" \ LANG=en_US.UTF-8 \ @@ -293,7 +263,7 @@ meson --prefix=/usr \ -Dldconfig=false \ -Dmount-path=/bin/mount \ -Drootprefix= \ - -Drootlibdir=/usr/lib32 \ + -Drootlibdir=&usr-lib-m32; \ -Dsplit-usr=true \ -Dsulogin-path=/sbin/sulogin \ -Dsysusers=false \ @@ -308,38 +278,26 @@ meson --prefix=/usr \ Install the package: LANG=en_US.UTF-8 DESTDIR=$PWD/DESTDIR ninja install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR rm -f /usr/bin/xsltproc - - - + + + + + Installation of systemd - x32-bit - If still in the build directory, step out: -cd .. - Clean previous build: -rm -rf build +rm -rf * Create a symlink to work around missing xsltproc: -ln -sf /tools/bin/true /usr/bin/xsltproc - - Because we have not yet installed the final version of Util-Linux, - create links to the libraries in the approprite location: - -for file in /tools/libx32/lib{blkid,mount,uuid}*; do - ln -sf $file /usr/libx32/ -done - - Set up the man pages: - -tar -xf ../systemd-man-pages-&systemd-version;.tar.xz +ln -sf /bin/true /usr/bin/xsltproc Fix an issue on x32: @@ -348,8 +306,7 @@ sed '/long drift_freq;/s@long @int64_t @' -i src/timesync/timesyncd-manager.hPrepare systemd for compilation: -cd build -PKG_CONFIG_PATH="/tools/libx32/pkgconfig:/usr/libx32/pkgconfig" \ +PKG_CONFIG_PATH="&usr-lib-mx32;/pkgconfig" \ CC="gcc -mx32" \ CXX="g++ -mx32" \ CFLAGS+="-Wno-error=shift-overflow" \ @@ -368,7 +325,7 @@ meson --prefix=/usr \ -Dldconfig=false \ -Dmount-path=/bin/mount \ -Drootprefix= \ - -Drootlibdir=/usr/libx32 \ + -Drootlibdir=&usr-lib-mx32; \ -Dsplit-usr=true \ -Dsulogin-path=/sbin/sulogin \ -Dsysusers=false \ @@ -383,11 +340,11 @@ meson --prefix=/usr \ Install the package: LANG=en_US.UTF-8 DESTDIR=$PWD/DESTDIR ninja install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR rm -f /usr/bin/xsltproc - + Contents of systemd @@ -435,7 +392,7 @@ rm -f /usr/bin/xsltproc bootctl - Used to query the firmware and boot manager settings + Is used to query the firmware and boot manager settings bootctl @@ -445,7 +402,7 @@ rm -f /usr/bin/xsltproc busctl - Used to introspect and monitor the D-Bus bus + Is used to introspect and monitor the D-Bus bus busctl @@ -455,7 +412,7 @@ rm -f /usr/bin/xsltproc coredumpctl - Used to retrieve coredumps from the systemd journal + Is used to retrieve coredumps from the systemd journal coredumpctl @@ -479,7 +436,7 @@ rm -f /usr/bin/xsltproc hostnamectl - Used to query and change the system hostname and related + Is used to query and change the system hostname and related settings hostnamectl @@ -490,9 +447,10 @@ rm -f /usr/bin/xsltproc init - The first process to be started when the kernel has initialized + Is the first process to be started when the kernel has initialized the hardware which takes over the boot process and starts all - processes according to its configuration files + processes according to its configuration files. In this case, it starts + systemd. init @@ -502,7 +460,7 @@ rm -f /usr/bin/xsltproc journalctl - Used to query the contents of the systemd journal + Is used to query the contents of the systemd journal journalctl @@ -512,8 +470,8 @@ rm -f /usr/bin/xsltproc kernel-install - Used to add and remove kernel and initramfs images to and - from /boot + Is used to add and remove kernel and initramfs images to and + from /boot. In LFS, this is done manually. kernel-install @@ -523,7 +481,7 @@ rm -f /usr/bin/xsltproc localectl - Used to query and change the system locale and keyboard layout + Is used to query and change the system locale and keyboard layout settings localectl @@ -534,7 +492,7 @@ rm -f /usr/bin/xsltproc loginctl - Used to introspect and control the state of the systemd Login + Is used to introspect and control the state of the systemd Login Manager loginctl @@ -545,7 +503,7 @@ rm -f /usr/bin/xsltproc machinectl - Used to introspect and control the state of the systemd Virtual + Is used to introspect and control the state of the systemd Virtual Machine and Container Registration Manager machinectl @@ -556,8 +514,8 @@ rm -f /usr/bin/xsltproc networkctl - Used to introspect the state of the network links as seen by - systemd-networkd + Is used to introspect and configure the state of the network + links configured by systemd-networkd networkctl @@ -567,7 +525,7 @@ rm -f /usr/bin/xsltproc portablectl - Used to attach or detach portable services from the local + Is used to attach or detach portable services from the local system portablectl @@ -578,7 +536,7 @@ rm -f /usr/bin/xsltproc poweroff - Tells the kernel to halt the system and switch off the computer + Instructs the kernel to halt the system and switch off the computer (see halt) poweroff @@ -589,7 +547,7 @@ rm -f /usr/bin/xsltproc reboot - Tells the kernel to reboot the system (see + Instructs the kernel to reboot the system (see halt) reboot @@ -600,7 +558,7 @@ rm -f /usr/bin/xsltproc resolvconf - Register DNS server and domain configuration with + Registers DNS server and domain configuration with systemd-resolved resolvconf @@ -611,8 +569,8 @@ rm -f /usr/bin/xsltproc resolvectl - Send control commands to the network name resolution - manager, or resolve domain names, IPv4 and IPv6 addresses, + Sends control commands to the network name resolution + manager, or resolves domain names, IPv4 and IPv6 addresses, DNS records, and services. resolvectl @@ -623,7 +581,7 @@ rm -f /usr/bin/xsltproc runlevel - Reports the previous and the current run-level, as noted in the + Outputs the previous and the current run-level, as noted in the last run-level record in /var/run/utmp runlevel @@ -634,8 +592,8 @@ rm -f /usr/bin/xsltproc shutdown - Brings the system down in a secure way, signaling all processes - and notifying all logged-in users + Brings the system down in a safe and secure manner, signaling + all processes and notifying all logged-in users shutdown @@ -645,7 +603,7 @@ rm -f /usr/bin/xsltproc systemctl - Used to introspect and control the state of the systemd system + Is used to introspect and control the state of the systemd system and service manager systemctl @@ -656,8 +614,8 @@ rm -f /usr/bin/xsltproc systemd-analyze - Used to determine system boot-up performance of the current - boot + Is used to determine system startup performance of the current + boot, as well as identify troublesome systemd units systemd-analyze @@ -667,7 +625,7 @@ rm -f /usr/bin/xsltproc systemd-ask-password - Used to query a system password or passphrase from the user, + Is used to query a system password or passphrase from the user, using a question message specified on the command line systemd-ask-password @@ -678,7 +636,8 @@ rm -f /usr/bin/xsltproc systemd-cat - Used to connect STDOUT and STDERR of a process with the Journal + Is used to connect the STDOUT and STDERR outputs of a process + with the systemd journal. systemd-cat @@ -711,7 +670,7 @@ rm -f /usr/bin/xsltproc systemd-delta - Used to identify and compare configuration files in + Is used to identify and compare configuration files in /etc that override default counterparts in /usr @@ -723,7 +682,8 @@ rm -f /usr/bin/xsltproc systemd-detect-virt - Detects execution in a virtualized environment + Detects whether the system is being run in a virtual + environment, and adjusts udev accordingly. systemd-detect-virt @@ -733,7 +693,7 @@ rm -f /usr/bin/xsltproc systemd-escape - Used to escape strings for inclusion in systemd unit + Is used to escape strings for inclusion in systemd unit names systemd-escape @@ -744,7 +704,7 @@ rm -f /usr/bin/xsltproc systemd-hwdb - Used to manage hardware database (hwdb) + Is used to manage the hardware database (hwdb) systemd-hwdb @@ -754,7 +714,7 @@ rm -f /usr/bin/xsltproc systemd-id128 - Generate and print id128 strings + Generates and prints id128 strings systemd-id128 @@ -764,8 +724,9 @@ rm -f /usr/bin/xsltproc systemd-inhibit - Used to execute a program with a shutdown, sleep or idle - inhibitor lock taken + Is used to execute a program with a shutdown, sleep or idle + inhibitor lock taken, preventing an action such as a system shutdown + until the process is completed. systemd-inhibit @@ -775,7 +736,7 @@ rm -f /usr/bin/xsltproc systemd-machine-id-setup - Used by system installer tools to initialize the machine ID + Is used by system installer tools to initialize the machine ID stored in /etc/machine-id at install time with a randomly generated ID @@ -787,7 +748,7 @@ rm -f /usr/bin/xsltproc systemd-mount - A tool to temporarily mount or auto-mount a drive. + Is used to temporarily mount or automount disks. systemd-mount @@ -797,7 +758,7 @@ rm -f /usr/bin/xsltproc systemd-notify - Used by daemon scripts to notify the init system about status + Is used by daemon scripts to notify the init system about status changes systemd-notify @@ -808,7 +769,7 @@ rm -f /usr/bin/xsltproc systemd-nspawn - Used to run a command or OS in a light-weight namespace + Is used to run a command or OS in a light-weight namespace container systemd-nspawn @@ -819,7 +780,7 @@ rm -f /usr/bin/xsltproc systemd-path - Used to query system and user paths + Is used to query system and user paths systemd-path @@ -829,7 +790,7 @@ rm -f /usr/bin/xsltproc systemd-repart - Used go grow and add partitions to a partition table when + Is used to grow and add partitions to a partition table when systemd is used in an OS image (e.g. a container). systemd-repart @@ -840,7 +801,7 @@ rm -f /usr/bin/xsltproc systemd-resolve - Used to resolve domain names, IPV4 and IPv6 addresses, DNS + Is used to resolve domain names, IPV4 and IPv6 addresses, DNS resource records, and services systemd-resolve @@ -851,29 +812,20 @@ rm -f /usr/bin/xsltproc systemd-run - Used to create and start a transient .service or a .scope unit - and run the specified command in it + Is used to create and start a transient .service or a .scope + unit and run the specified command in it. This is useful for + validating systemd units. systemd-run - - systemd-socket-activate - A tool to listen on socket devices and launch a process upon - connection. + Is used to listen on socket devices and launch a process upon + a successful connection to the socket. systemd-socket-activate @@ -896,7 +848,7 @@ rm -f /usr/bin/xsltproc systemd-umount - Unmount mount points + Unmounts mount points systemd-umount @@ -906,7 +858,8 @@ rm -f /usr/bin/xsltproc systemd-tty-ask-password-agent - Used to list or process pending systemd password requests + Is used to list and/or process pending systemd password + requests systemd-tty-ask-password-agent @@ -927,7 +880,7 @@ rm -f /usr/bin/xsltproc timedatectl - Used to query and change the system clock and its settings + Is used to query and change the system clock and its settings timedatectl @@ -938,10 +891,10 @@ rm -f /usr/bin/xsltproc udevadm - Generic udev administration tool: controls the udevd daemon, - provides info from the Udev database, monitors uevents, waits for - uevents to finish, tests udev configuration, and triggers uevents - for a given device + Is a generic udev administration tool which controls the udevd + daemon, provides info from the Udev hardware database, monitors + uevents, waits for uevents to finish, tests udev configuration, and + triggers uevents for a given device udevadm @@ -951,7 +904,7 @@ rm -f /usr/bin/xsltproc libsystemd - The main systemd utility library + Is the main systemd utility library libsystemd @@ -961,7 +914,7 @@ rm -f /usr/bin/xsltproc libudev - A library to access Udev device information + Is a library to access Udev device information libudev diff --git a/chapter06/sysvinit.xml b/chapter08/sysvinit.xml similarity index 99% rename from chapter06/sysvinit.xml rename to chapter08/sysvinit.xml index 0c171acf5..4a68cc37b 100644 --- a/chapter06/sysvinit.xml +++ b/chapter08/sysvinit.xml @@ -31,8 +31,8 @@ &diskspace; - &sysvinit-ch6-sbu; - &sysvinit-ch6-du; + &sysvinit-fin-sbu; + &sysvinit-fin-du; diff --git a/chapter08/tar.xml b/chapter08/tar.xml new file mode 100644 index 000000000..50a49d80b --- /dev/null +++ b/chapter08/tar.xml @@ -0,0 +1,119 @@ + + + %general-entities; +]> + + + + + + tar + &tar-version; +
&tar-url;
+
+ + Tar-&tar-version; + + + Tar + + + + + + <para>The Tar package provides the ability to create tar archives as well + as perform various other kinds of archive manipulation. Tar can be used on + previously created archives to extract files, to store additional files, or + to update or list files which were already stored. </para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&tar-fin-sbu;</seg> + <seg>&tar-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Tar + + Prepare Tar for compilation: + +FORCE_UNSAFE_CONFIGURE=1 \ +./configure --prefix=/usr \ + --bindir=/bin + + + The meaning of the configure option: + + + FORCE_UNSAFE_CONFIGURE=1 + + This forces the test for mknod to be run + as root. It is generally considered dangerous to run this test as + the root user, but as it is being run on a system that has only been + partially built, overriding it is OK. + + + + + Compile the package: + +make + + To test the results (about 3 SBU), issue: + +make check + + + + Install the package: + +make install +make -C doc install-html docdir=/usr/share/doc/tar-&tar-version; + + + + + + Contents of Tar + + + Installed programs + Installed directory + + + tar + /usr/share/doc/tar-&tar-version; + + + + + Short Descriptions + + + + + tar + + Creates, extracts files from, and lists the contents of archives, + also known as tarballs + + tar + + + + + + + + +
diff --git a/chapter05/tcl.xml b/chapter08/tcl.xml similarity index 57% rename from chapter05/tcl.xml rename to chapter08/tcl.xml index f2265fd8d..1df22b81c 100644 --- a/chapter05/tcl.xml +++ b/chapter08/tcl.xml @@ -3,6 +3,8 @@ "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ %general-entities; + + ]> @@ -32,8 +34,8 @@ &diskspace; - &tcl-ch5-sbu; - &tcl-ch5-du; + &tcl-tmp-sbu; + &tcl-tmp-du; @@ -43,40 +45,74 @@ Installation of Tcl This package and the next two (Expect and DejaGNU) are - installed to support running the test suites for GCC and Binutils and other + installed to support running the test suites for GCC and binutils and other packages. Installing three packages for testing purposes may seem excessive, but it is very reassuring, if not essential, to know that the - most important tools are working properly. Even if the test suites are not - run in this chapter (they are not mandatory), these packages are required - to run the test suites in . + most important tools are working properly. These packages are required + to run the test suites in this chapter.
- Note that the Tcl package used here is a minimal version needed + + + First, unpack the documentation by issuing the following command: + +tar -xf ../tcl8.6.10-html.tar.gz --strip-components=1 Prepare Tcl for compilation: -cd unix -./configure --prefix=/tools +SRCDIR=$(pwd) +cd unix +./configure --prefix=/usr \ + --mandir=/usr/share/man \ + $([ "$(uname -m)" = x86_64 ] && echo --enable-64bit) + + + The meaning of the configure options: + + + $([ "$(uname -m)" = x86_64 ] && echo --enable-64bit) + + The construct $(<shell command>) + is replaced by the output of the shell command. Here this output is + empty if running on a 32 bit machine, and is + --enable-64bit if running on a 64 bit machine. + + + + + Build the package: -make +make - Compilation is now complete. As discussed earlier, running the test - suite is not mandatory for the temporary tools here in this chapter. To run - the Tcl test suite anyway, issue the following command: +sed -e "s|$SRCDIR/unix|/usr/lib|" \ + -e "s|$SRCDIR|/usr/include|" \ + -i tclConfig.sh -TZ=UTC make test +sed -e "s|$SRCDIR/unix/pkgs/tdbc&tdbc-ver;|/usr/lib/tdbc&tdbc-ver;|" \ + -e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;/generic|/usr/include|" \ + -e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;/library|/usr/lib/tcl8.6|" \ + -e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;|/usr/include|" \ + -i pkgs/tdbc&tdbc-ver;/tdbcConfig.sh - The Tcl test suite may experience failures under certain host - conditions that are not fully understood. Therefore, test suite failures - here are not surprising, and are not considered critical. The - TZ=UTC parameter sets the time zone to Coordinated - Universal Time (UTC), but only - for the duration of the test suite run. This ensures that the clock tests - are exercised correctly. Details on the TZ environment - variable are provided in . +sed -e "s|$SRCDIR/unix/pkgs/itcl&itcl-ver;|/usr/lib/itcl&itcl-ver;|" \ + -e "s|$SRCDIR/pkgs/itcl&itcl-ver;/generic|/usr/include|" \ + -e "s|$SRCDIR/pkgs/itcl&itcl-ver;|/usr/include|" \ + -i pkgs/itcl&itcl-ver;/itclConfig.sh + +unset SRCDIR + + The various sed instructions after the + make command removes references to the build directory from + the configuration files and replaces them with the install directory. + This is not mandatory for the remainder of LFS, but may be needed in case a + package built later uses Tcl. + + To test the results, issue: + +make test Install the package: @@ -85,16 +121,15 @@ Make the installed library writable so debugging symbols can be removed later: -chmod -v u+w /tools/lib/libtcl&tcl-major-version;.so +chmod -v u+w /usr/lib/libtcl&tcl-major-version;.so - Install Tcl's headers. The next package, Expect, requires them - to build. + Install Tcl's headers. The next package, Expect, requires them. make install-private-headers Now make a necessary symbolic link: -ln -sv tclsh&tcl-major-version; /tools/bin/tclsh +ln -sfv tclsh&tcl-major-version; /usr/bin/tclsh @@ -106,8 +141,14 @@ Installed library - tclsh (link to tclsh&tcl-major-version;) and tclsh&tcl-major-version; - libtcl&tcl-major-version;.so, libtclstub&tcl-major-version;.a + + tclsh (link to tclsh&tcl-major-version;) and + tclsh&tcl-major-version; + + + libtcl&tcl-major-version;.so and + libtclstub&tcl-major-version;.a + diff --git a/chapter06/texinfo.xml b/chapter08/texinfo.xml similarity index 97% rename from chapter06/texinfo.xml rename to chapter08/texinfo.xml index d61df477b..7257ae5b5 100644 --- a/chapter06/texinfo.xml +++ b/chapter08/texinfo.xml @@ -31,8 +31,8 @@ &diskspace; - &texinfo-ch6-sbu; - &texinfo-ch6-du; + &texinfo-fin-sbu; + &texinfo-fin-du; @@ -46,7 +46,7 @@ ./configure --prefix=/usr --disable-static - The meaning of the configure options: + The meaning of the configure option: --disable-static @@ -101,10 +101,10 @@ recreated, the following optional commands will accomplish the task: pushd /usr/share/info -rm -v dir -for f in * - do install-info $f dir 2>/dev/null -done + rm -v dir + for f in * + do install-info $f dir 2>/dev/null + done popd diff --git a/chapter06/util-linux.xml b/chapter08/util-linux.xml similarity index 98% rename from chapter06/util-linux.xml rename to chapter08/util-linux.xml index 5ee12d1b5..2c94f3b11 100644 --- a/chapter06/util-linux.xml +++ b/chapter08/util-linux.xml @@ -32,8 +32,8 @@ &diskspace; - &util-linux-ch6-sbu; - &util-linux-ch6-du; + &util-linux-fin-sbu; + &util-linux-fin-du; @@ -50,12 +50,6 @@ mkdir -pv /var/lib/hwclock - Remove the earlier created symlinks and files: - -rm -vf /usr/include/{blkid,libfdisk,libmount,uuid} -rm -vf /usr/lib/lib{blkid,fdisk,mount,uuid}.so* -rm -vf /usr/lib/pkgconfig/{blkid,fdisk,mount,uuid}.pc - Prepare Util-linux for compilation: ./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \ @@ -96,7 +90,7 @@ rm -vf /usr/lib/pkgconfig/{blkid,fdisk,mount,uuid}.pc Running the test suite as the root user can be harmful to your system. To run it, the CONFIG_SCSI_DEBUG option for the kernel must - be available in the currently running system, and must be built as a + be available in the currently running system and must be built as a module. Building it into the kernel will prevent booting. For complete coverage, other BLFS packages must be installed. If desired, this test can be run after rebooting into the completed LFS system and running: @@ -113,7 +107,9 @@ su tester -c "make -k check" - + + + Installation of Util-linux - 32-bit @@ -137,7 +133,7 @@ su tester -c "make -k check" --disable-static \ --without-python \ --without-systemd \ - --libdir=/usr/lib32 \ + --libdir=&usr-lib-m32; \ --host=i686-pc-linux-gnu \ --without-systemdsystemunitdir \ --enable-libmount-force-mountinfo @@ -154,7 +150,7 @@ su tester -c "make -k check" --disable-pylibmount \ --disable-static \ --without-python \ - --libdir=/usr/lib32 \ + --libdir=&usr-lib-m32; \ --host=i686-pc-linux-gnu \ --enable-libmount-force-mountinfo @@ -165,12 +161,14 @@ su tester -c "make -k check" Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR - + - + + + Installation of Util-linux - x32-bit @@ -195,7 +193,7 @@ rm -rf DESTDIR --without-python \ --without-systemd \ --without-systemdsystemunitdir \ - --libdir=/usr/libx32 \ + --libdir=&usr-lib-mx32; \ --host=x86_64-pc-linux-gnux32 \ --enable-libmount-force-mountinfo @@ -211,7 +209,7 @@ rm -rf DESTDIR --disable-pylibmount \ --disable-static \ --without-python \ - --libdir=/usr/libx32 \ + --libdir=&usr-lib-mx32; \ --host=x86_64-pc-linux-gnux32 \ --enable-libmount-force-mountinfo @@ -222,10 +220,10 @@ rm -rf DESTDIR Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; rm -rf DESTDIR - + Contents of Util-linux diff --git a/chapter06/vim.xml b/chapter08/vim.xml similarity index 89% rename from chapter06/vim.xml rename to chapter08/vim.xml index 263122bd7..4d06d5a08 100644 --- a/chapter06/vim.xml +++ b/chapter08/vim.xml @@ -30,8 +30,8 @@ &diskspace; - &vim-ch6-sbu; - &vim-ch6-du; + &vim-fin-sbu; + &vim-fin-du; @@ -54,11 +54,7 @@ echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h - - Prepare Vim for compilation: + Prepare vim for compilation: ./configure --prefix=/usr @@ -66,19 +62,17 @@ make - To prepare the tests, ensure that the - tester user can write - to the sources tree: + To prepare the tests, ensure that user + tester can write + to the source tree: chown -Rv tester . - Now run the tests as the tester user: + Now run the tests as user tester: su tester -c "LANG=en_US.UTF-8 make -j1 test" &> vim-test.log - - The test suite outputs a lot of binary data to the screen. This can cause issues with the settings of the current terminal. The problem can be avoided by redirecting the output to a log file as shown above. A @@ -100,7 +94,7 @@ for L in /usr/share/man/{,*/}man1/vim.1; do ln -sv vim.1 $(dirname $L)/vi.1 done - By default, Vim's documentation is installed in By default, vim's documentation is installed in /usr/share/vim. The following symlink allows the documentation to be accessed via /usr/share/doc/vim-&vim-version;, making @@ -109,10 +103,10 @@ done ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version; If an X Window System is going to be installed on the LFS - system, it may be necessary to recompile Vim after installing X. Vim + system, it may be necessary to recompile vim after installing X. Vim comes with a GUI version of the editor that requires X and some additional libraries to be installed. For more information on this - process, refer to the Vim documentation and the Vim installation page + process, refer to the vim documentation and the vim installation page in the BLFS book at . @@ -157,7 +151,7 @@ EOF vi-compatible manner. Remove the no to keep the old vi behavior. The set backspace=2 setting allows backspacing over line breaks, autoindents, and the start of - insert. The syntax on parameter enables vim's syntax + an insert. The syntax on parameter enables vim's syntax highlighting. The set mouse= setting enables proper pasting of text with the mouse when working in chroot or over a remote connection. Finally, the if statement with the @@ -165,18 +159,14 @@ EOF vim's guess about the background color of some terminal emulators. This gives the highlighting a better color scheme for use on the black background of these programs. - + Documentation for other available options can be obtained by running the following command: vim -c ':options' - By default, Vim only installs spell files for the English language. + By default, vim only installs spell files for the English language. To install spell files for your preferred language, download the *.spl and optionally, the *.sug files for your language and character encoding from &diskspace; - &xml-parser-ch6-sbu; - &xml-parser-ch6-du; + &xml-parser-fin-sbu; + &xml-parser-fin-du; diff --git a/chapter08/xz.xml b/chapter08/xz.xml new file mode 100644 index 000000000..add27025e --- /dev/null +++ b/chapter08/xz.xml @@ -0,0 +1,426 @@ + + + %general-entities; +]> + + + + + + xz + &xz-version; +
&xz-url;
+
+ + Xz-&xz-version; + + + Xz + + + + + + <para>The Xz package contains programs for compressing and decompressing + files. It provides capabilities for the lzma and the newer xz compression + formats. Compressing text files with <command>xz</command> yields a better + compression percentage than with the traditional <command>gzip</command> or + <command>bzip2</command> commands.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&xz-fin-sbu;</seg> + <seg>&xz-fin-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Xz + + Prepare Xz for compilation with: + +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/xz-&xz-version; + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package and make sure that all essential files are in the + correct directory: + +make install +mv -v /usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} /bin +mv -v /usr/lib/liblzma.so.* /lib +ln -svf ../../lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.so + + + + + + + + + Installation of Xz - 32bit + + Clean previous build: + +make distclean + + Prepare Xz for compilation: + +CC="gcc -m32" ./configure \ + --prefix=/usr \ + --disable-static \ + --libdir=&usr-lib-m32; \ + --host=i686-pc-linux-gnu + + Compile the package: + +make + + Install the package: + +make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; +rm -rf DESTDIR + + + + + + + + + Installation of Xz - x32bit + + Clean previous build: + +make distclean + + Prepare Xz for compilation: + +CC="gcc -mx32" ./configure \ + --prefix=/usr \ + --disable-static \ + --libdir=&usr-lib-mx32; \ + --host=x86_64-pc-linux-gnux32 + + Compile the package: + +make + + Install the package: + +make DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; +rm -rf DESTDIR + + + + + Contents of Xz + + + Installed programs + Installed libraries + Installed directories + + + + lzcat (link to xz), + lzcmp (link to xzdiff), + lzdiff (link to xzdiff), + lzegrep (link to xzgrep), + lzfgrep (link to xzgrep), + lzgrep (link to xzgrep), + lzless (link to xzless), + lzma (link to xz), + lzmadec, + lzmainfo, + lzmore (link to xzmore), + unlzma (link to xz), + unxz (link to xz), + xz, + xzcat (link to xz), + xzcmp (link to xzdiff), + xzdec, + xzdiff, + xzegrep (link to xzgrep), + xzfgrep (link to xzgrep), + xzgrep, + xzless, and + xzmore + + liblzma.so + + + /usr/include/lzma and + /usr/share/doc/xz-&xz-version; + + + + + + Short Descriptions + + + + + lzcat + + Decompresses to standard output + + lzcat + + + + + + lzcmp + + Runs cmp on LZMA compressed files + + lzcmp + + + + + + lzdiff + + Runs diff on LZMA compressed files + + lzdiff + + + + + + lzegrep + + Runs egrep on LZMA compressed files + + lzegrep + + + + + + lzfgrep + + Runs fgrep on LZMA compressed files + + lzfgrep + + + + + + lzgrep + + Runs grep on LZMA compressed files + + lzgrep + + + + + + lzless + + Runs less on LZMA compressed files + + lzless + + + + + + lzma + + Compresses or decompresses files using the LZMA format + + lzma + + + + + + lzmadec + + A small and fast decoder for LZMA compressed files + + lzmadec + + + + + + lzmainfo + + Shows information stored in the LZMA compressed file header + + lzmainfo + + + + + + lzmore + + Runs more on LZMA compressed files + + lzmore + + + + + + unlzma + + Decompresses files using the LZMA format + + unlzma + + + + + + unxz + + Decompresses files using the XZ format + + unxz + + + + + + xz + + Compresses or decompresses files using the XZ format + + xz + + + + + + xzcat + + Decompresses to standard output + + xzcat + + + + + + xzcmp + + Runs cmp on XZ compressed files + + xzcmp + + + + + + xzdec + + A small and fast decoder for XZ compressed files + + xzdec + + + + + + xzdiff + + Runs diff on XZ compressed files + + xzdiff + + + + + + xzegrep + + Runs egrep on XZ compressed files + + xzegrep + + + + + + xzfgrep + + Runs fgrep on XZ compressed files + + xzfgrep + + + + + + xzgrep + + Runs grep on XZ compressed files + + xzgrep + + + + + + xzless + + Runs less on XZ compressed files + + xzless + + + + + + xzmore + + Runs more on XZ compressed files + + xzmore + + + + + + liblzma + + The library implementing lossless, block-sorting data + compression, using the Lempel-Ziv-Markov chain algorithm + + liblzma + + + + + + + + +
diff --git a/chapter06/zlib.xml b/chapter08/zlib.xml similarity index 85% rename from chapter06/zlib.xml rename to chapter08/zlib.xml index 3f47a3816..16734314b 100644 --- a/chapter06/zlib.xml +++ b/chapter08/zlib.xml @@ -31,8 +31,8 @@ &diskspace; - &zlib-ch6-sbu; - &zlib-ch6-du; + &zlib-fin-sbu; + &zlib-fin-du; @@ -67,10 +67,12 @@ ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so - - + + + + - Installation of Zlib - 32-bit + Installation of Zlib - 32bit Clean previous build: @@ -78,10 +80,9 @@ ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.soPrepare Zlib for compilation:
- -CC="gcc -m32 -march=i686" \ +CC="gcc -m32" \ ./configure --prefix=/usr \ - --libdir=/usr/lib32 + --libdir=&usr-lib-m32; Compile the package: @@ -90,15 +91,17 @@ ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.soInstall the package:
make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/lib32/* /usr/lib32 +cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32; rm -rf DESTDIR -
+ + + + + - - - Installation of Zlib - x32-bit + Installation of Zlib - x32bit make distclean @@ -106,7 +109,7 @@ rm -rf DESTDIR CC="gcc -mx32" \ ./configure --prefix=/usr \ - --libdir=/usr/libx32 + --libdir=&usr-lib-mx32; Compile the package: @@ -115,10 +118,10 @@ rm -rf DESTDIR Install the package: make DESTDIR=$PWD/DESTDIR install -cp -Rv DESTDIR/usr/libx32/* /usr/libx32 +cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32; rm -rf DESTDIR - + Contents of Zlib diff --git a/chapter06/zstd.xml b/chapter08/zstd.xml similarity index 73% rename from chapter06/zstd.xml rename to chapter08/zstd.xml index 71e7794b6..e4fe3637f 100644 --- a/chapter06/zstd.xml +++ b/chapter08/zstd.xml @@ -32,8 +32,8 @@ &diskspace; - &zstd-ch6-sbu; - &zstd-ch6-du; + &zstd-fin-sbu; + &zstd-fin-du; @@ -63,6 +63,52 @@ ln -sfv ../../lib/$(readlink /usr/lib/libzstd.so) /usr/lib/libzstd.so + + + + + + Installation of Zstd - 32bit + + Clean previous build: + +make clean + + Compile the package: + +CC="gcc -m32" make + + Install the package: + +CC="gcc -m32" make prefix=/usr DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/lib/* &usr-lib-m32;/ +sed -e "/^libdir/s/lib$&lib-m32;/" -i &usr-lib-m32;/pkgconfig/libzstd.pc + + + + + + + + + Installation of Zstd - x32bit + + Clean previous build: + +make clean + + Compile the package: + +CC="gcc -mx32" make + + Install the package: + +CC="gcc -mx32" make prefix=/usr DESTDIR=$PWD/DESTDIR install +cp -Rv DESTDIR/usr/lib/* &usr-lib-mx32;/ +sed -e "/^libdir/s/lib$&lib-mx32;/" -i &usr-lib-mx32;/pkgconfig/libzstd.pc + + + Contents of Zstd diff --git a/chapter07/bootscripts.xml b/chapter09/bootscripts.xml similarity index 99% rename from chapter07/bootscripts.xml rename to chapter09/bootscripts.xml index 5c2b28d7c..009590d64 100644 --- a/chapter07/bootscripts.xml +++ b/chapter09/bootscripts.xml @@ -33,8 +33,8 @@ &diskspace; - &lfs-bootscripts-ch7-sbu; - &lfs-bootscripts-ch7-du; + &lfs-bootscripts-cfg-sbu; + &lfs-bootscripts-cfg-du; diff --git a/chapter09/chapter09.xml b/chapter09/chapter09.xml index c8deeb388..499e66a6f 100644 --- a/chapter09/chapter09.xml +++ b/chapter09/chapter09.xml @@ -5,15 +5,39 @@ %general-entities; ]> - + - The End + System Configuration - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/chapter07/clock.xml b/chapter09/clock.xml similarity index 95% rename from chapter07/clock.xml rename to chapter09/clock.xml index 872ba677c..585017e35 100644 --- a/chapter07/clock.xml +++ b/chapter09/clock.xml @@ -16,7 +16,7 @@ This section discusses how to configure the systemd-timedated system service, which configures - system clock and timezone. + the system clock and timezone.
If you cannot remember whether or not the hardware clock is set to UTC, find out by running the hwclock --localtime --show @@ -30,7 +30,7 @@ time. systemd-timedated reads /etc/adjtime, - and depending on the contents of the file, it sets the clock to either UTC or + and depending on the contents of the file, sets the clock to either UTC or local time. Create the /etc/adjtime file with the following contents @@ -59,7 +59,7 @@ EOF timedatectl set-time YYYY-MM-DD HH:MM:SS - Hardware clock will also be updated accordingly. + The hardware clock will also be updated accordingly. To change your current time zone, issue: diff --git a/chapter07/consoled.xml b/chapter09/consoled.xml similarity index 90% rename from chapter07/consoled.xml rename to chapter09/consoled.xml index bf1fdc8e0..76d304d44 100644 --- a/chapter07/consoled.xml +++ b/chapter09/consoled.xml @@ -24,8 +24,8 @@ information. Decide which keymap and screen font will be used. Various language-specific HOWTOs can also help with this, see . - Examine localectl list-keymaps output for a list of - valid console keymaps. Look in + Examine the output of localectl list-keymaps for a list of + valid console keymaps. Look in the /usr/share/consolefonts directory for valid screen fonts. @@ -106,34 +106,34 @@ EOF list-x11-keymap-models - Show known X11 keyboard mapping models. + Shows known X11 keyboard mapping models. list-x11-keymap-layouts - Show known X11 keyboard mapping layouts. + Shows known X11 keyboard mapping layouts. list-x11-keymap-variants - Show known X11 keyboard mapping variants. + Shows known X11 keyboard mapping variants. list-x11-keymap-options - Show known X11 keyboard mapping options. + Shows known X11 keyboard mapping options.
Using any of the parameters listed above requires the - XKeyboard Config package from BLFS. + XKeyboard-Config package from BLFS. diff --git a/chapter07/etcshells.xml b/chapter09/etcshells.xml similarity index 85% rename from chapter07/etcshells.xml rename to chapter09/etcshells.xml index 30961c80c..bc2ef933a 100644 --- a/chapter07/etcshells.xml +++ b/chapter09/etcshells.xml @@ -10,8 +10,8 @@ Creating the /etc/shells File @@ -23,13 +23,13 @@ The shells file contains a list of login shells on the system. Applications use this file to determine whether a shell is valid. For each shell a single line should be - present, consisting of the shell's path, relative to the root of the + present, consisting of the shell's path relative to the root of the directory structure (/). For example, this file is consulted by chsh to determine whether an unprivileged user may change the login shell for her - own account. If the command name is not listed, the user will be denied of - change. + own account. If the command name is not listed, the user will be denied the + ability to change shells. It is a requirement for applications such as GDM which does not populate the diff --git a/chapter07/inputrc.xml b/chapter09/inputrc.xml similarity index 94% rename from chapter07/inputrc.xml rename to chapter09/inputrc.xml index 00d36877f..de5401d2c 100644 --- a/chapter07/inputrc.xml +++ b/chapter09/inputrc.xml @@ -15,14 +15,14 @@ The inputrc file is the configuration file for - the Readline library, which provides editing capabilities while the user is + the readline library, which provides editing capabilities while the user is entering a line from the terminal. It works by translating keyboard inputs - into specific actions. Readline is used by Bash and most other shells as + into specific actions. Readline is used by bash and most other shells as well as many other applications. Most people do not need user-specific functionality so the command below creates a global /etc/inputrc used by everyone who - logs in. If you later decide you need to override the defaults on a per-user + logs in. If you later decide you need to override the defaults on a per user basis, you can create a .inputrc file in the user's home directory with the modified mappings. diff --git a/chapter09/introduction.xml b/chapter09/introduction.xml new file mode 100644 index 000000000..875003f14 --- /dev/null +++ b/chapter09/introduction.xml @@ -0,0 +1,91 @@ + + + %general-entities; +]> + + + + + Introduction + + Booting a Linux system involves several tasks. The process must + mount both virtual and real file systems, initialize devices, activate swap, + check file systems for integrity, mount any swap partitions or files, set + the system clock, bring up networking, start any daemons required by the + system, and accomplish any other custom tasks needed by the user. This + process must be organized to ensure the tasks are performed in the correct + order but, at the same time, be executed as fast as possible. + + + System V + + System V is the classic boot process that has been used in Unix and + Unix-like systems such as Linux since about 1983. It consists of a small + program, init, that sets up basic programs such as + login (via getty) and runs a script. This script, + usually named rc, controls the execution of a set of + additional scripts that perform the tasks required to initialize the + system. + + The init program is controlled by the + /etc/inittab file and is organized into run levels that + can be run by the user: + +0 — halt +1 — Single user mode +2 — Multiuser, without networking +3 — Full multiuser mode +4 — User definable +5 — Full multiuser mode with display manager +6 — reboot + + The usual default run level is 3 or 5. + + Advantages + + + + Established, well understood system. + + + + Easy to customize. + + + + + + Disadvantages + + + + May be slower to boot. A medium speed base LFS system + takes 8-12 seconds where the boot time is measured from the + first kernel message to the login prompt. Network + connectivity is typically established about 2 seconds + after the login prompt. + + + + Serial processing of boot tasks. This is related to the previous + point. A delay in any process such as a file system check, will + delay the entire boot process. + + + + Does not directly support advanced features like + control groups (cgroups), and per-user fair share scheduling. + + + + Adding scripts requires manual, static sequencing decisions. + + + + + + + + diff --git a/chapter07/introductiond.xml b/chapter09/introductiond.xml similarity index 89% rename from chapter07/introductiond.xml rename to chapter09/introductiond.xml index fa2403edb..f0be70cec 100644 --- a/chapter07/introductiond.xml +++ b/chapter09/introductiond.xml @@ -38,7 +38,7 @@ - Third, configuring the system clock and keyboard layout. + Third, configuring the system clock and keyboard layout is shown. @@ -49,9 +49,8 @@ - Fourth, a brief introduction to the scripts and configuration - files used when the user logs into the system. + files used when the user logs into the system is presented. @@ -62,7 +61,7 @@ - And finally, configuring the systemd behavior. + And finally, configuring the behavior of systemd is discussed. diff --git a/chapter07/locale.xml b/chapter09/locale.xml similarity index 90% rename from chapter07/locale.xml rename to chapter09/locale.xml index 5f473ac72..23442a513 100644 --- a/chapter07/locale.xml +++ b/chapter09/locale.xml @@ -14,16 +14,16 @@ /etc/locale.conf - The /etc/locale.conf below sets some + The /etc/locale.conf file below sets some environment variables necessary for native language support. Setting them properly results in: - The output of programs translated into the native language + The output of programs being translated into your native language - Correct classification of characters into letters, digits and other + The correct classification of characters into letters, digits and other classes. This is necessary for bash to properly accept non-ASCII characters in command lines in non-English locales @@ -31,15 +31,15 @@ The correct alphabetical sorting order for the country - Appropriate default paper size + The appropriate default paper size - Correct formatting of monetary, time, and date values + The correct formatting of monetary, time, and date values Replace <ll> below with the two-letter code - for the desired language (e.g., en) and + for your desired language (e.g., en) and <CC> with the two-letter code for the appropriate country (e.g., GB). <charmap> should be replaced with the canonical charmap for your chosen locale. Optional @@ -54,7 +54,7 @@ is also referred to as iso8859-1 and iso88591. Some applications cannot handle the various synonyms correctly (e.g., require that UTF-8 is written as UTF-8, not - utf8), so it is safest in most + utf8), so it is the safest in most cases to choose the canonical name for a particular locale. To determine the canonical name, run the following command, where <locale name> is the output given by locale -a for @@ -80,8 +80,8 @@ LC_ALL=<locale name> locale int_prefix encoding used by the locale, the local currency, and the prefix to dial before the telephone number in order to get into the country. If any of the commands above fail with a message similar to the one shown below, this means - that your locale was either not installed in Chapter 6 or is not supported by - the default installation of Glibc. + that your locale was either not installed in Chapter 6 or is not + supported by the default installation of Glibc. locale: Cannot set LC_* to default locale: No such file or directory @@ -90,7 +90,7 @@ LC_ALL=<locale name> locale int_prefix Further instructions assume that there are no such error messages from Glibc. - + Some packages beyond LFS may also lack support for your chosen locale. One example is the X library (part of the X Window System), which outputs the following error message if the locale does not exactly match one of the character @@ -142,11 +142,13 @@ EOF substitutes them with question marks in that locale. Also, an attempt to send mail with such characters from Mutt or Pine results in non-RFC-conforming messages being sent (the charset in the outgoing mail is indicated as unknown - 8-bit). So you can use the C locale only if you are sure that - you will never need 8-bit characters. + 8-bit). It's suggested that you use the C locale only + if you are certain that you will never need 8-bit characters. + diff --git a/chapter07/network.xml b/chapter09/network.xml similarity index 94% rename from chapter07/network.xml rename to chapter09/network.xml index 2a86df669..45cd1d438 100644 --- a/chapter07/network.xml +++ b/chapter09/network.xml @@ -13,17 +13,7 @@ network configuring - Creating Network Interface Configuration Files @@ -37,7 +27,7 @@ address(es), subnet masks, and so forth. It is necessary that the stem of the filename be ifconfig. - If the procedure in the previous section was not used, Udev + If the procedure in the previous section was not used, udev will assign network card interface names based on system physical characteristics such as enp2s1. If you are not sure what your interface name is, you can always run ip link or ls @@ -64,7 +54,7 @@ EOF If the ONBOOT variable is set to yes the System V network script will bring up the Network Interface Card (NIC) during - booting of the system. If set to anything but yes the NIC + the system boot process. If set to anything but yes the NIC will be ignored by the network script and not be automatically brought up. The interface can be manually started or stopped with the ifup and ifdown commands. @@ -208,7 +198,7 @@ EOF cat > /etc/hosts << "EOF" # Begin /etc/hosts -127.0.0.1 localhost +127.0.0.1 localhost.localdomain localhost 127.0.1.1 <FQDN> <HOSTNAME> <192.168.1.1> <FQDN> <HOSTNAME> [alias1] [alias2 ...] ::1 localhost ip6-localhost ip6-loopback diff --git a/chapter07/networkd.xml b/chapter09/networkd.xml similarity index 88% rename from chapter07/networkd.xml rename to chapter09/networkd.xml index b95d9b390..229b313b1 100644 --- a/chapter07/networkd.xml +++ b/chapter09/networkd.xml @@ -48,7 +48,7 @@ Udev normally assigns network card interface names based - on system physical characteristics such as enp2s1. If you are + on physical system characteristics such as enp2s1. If you are not sure what your interface name is, you can always run ip link after you have booted your system. @@ -76,10 +76,9 @@ Create a manual naming scheme, for example by naming the interfaces something like "internet0", "dmz0", or "lan0". - For that, create .link - files in /etc/systemd/network/, that choose an explicit name or a - better naming scheme for one, some, or all of your interfaces. - For example: + To do that, create .link files in /etc/systemd/network/ that + select an explicit name or a better naming scheme for your + network interfaces. For example: cat > /etc/systemd/network/10-ether0.link << "EOF" @@ -170,9 +169,9 @@ EOF If using another means to configure your network interfaces (ex: ppp, network-manager, etc.), or if using any type of - local resolver (ex: bind, dnsmasq, etc.), or any other software that - generates an /etc/resolv.conf (ex: resolvconf), the - systemd-resolved service should not be + local resolver (ex: bind, dnsmasq, unbound, etc.), or any other software + that generates an /etc/resolv.conf (ex: resolvconf), + the systemd-resolved service should not be used. When using systemd-resolved for DNS @@ -206,11 +205,13 @@ EOF Replace <IP address of the nameserver> - with the IP address of the DNS most appropriate for the setup. There will - often be more than one entry (requirements demand secondary servers for - fallback capability). If you only need or want one DNS server, remove the - second nameserver line from the file. The IP address - may also be a router on the local network. + with the IP address of the DNS server most appropriate for your setup. + There will often be more than one entry (requirements demand secondary + servers for fallback capability). If you only need or want one DNS server, + remove the second nameserver line from the file. + The IP address may also be a router on the local network. Another option + is to use the Google Public DNS service using the IP addresses below as + nameservers. The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4 @@ -262,7 +263,7 @@ EOF Decide on a fully-qualified domain name (FQDN), and possible aliases - for use in the /etc/hosts file. If using static + for use in the /etc/hosts file. If using static IP addresses, you'll also need to decide on an IP address. The syntax for a hosts file entry is: @@ -285,16 +286,15 @@ EOF this IP could be lfs.example.org. Even if not using a network card, a valid FQDN is still required. - This is necessary for certain programs to operate correctly. + This is necessary for certain programs, such as MTAs, to operate properly. - If using DHCP, DHCPv6, IPv6 Autoconfiguration, or if a network card - is not going to be configured, create the /etc/hosts - file by running the following command: + - The ::1 entry is the IPv6 counterpart of 127.0.0.1 and represents - the IPv6 loopback interface. 127.0.1.1 is a loopback entry reserved - specifically for the FQDN. - - If using a static address, create the /etc/hosts - file by running this command instead: + Create the /etc/hosts file using the following + command: cat > /etc/hosts << "EOF" # Begin /etc/hosts -127.0.0.1 localhost +127.0.0.1 localhost.localdomain localhost 127.0.1.1 <FQDN> <HOSTNAME> <192.168.0.2> <FQDN> <HOSTNAME> [alias1] [alias2] ... ::1 localhost ip6-localhost ip6-loopback @@ -328,8 +325,14 @@ EOF <HOSTNAME> values need to be changed for specific uses or requirements (if assigned an IP address by a network/system administrator and the machine will be connected to an - existing network). The optional alias name(s) can be omitted. - + existing network). The optional alias name(s) can be omitted, and the + <192.168.0.2 line can be omitted if you + are using a connection configured with DHCP or IPv6 Autoconfiguration. + + The ::1 entry is the IPv6 counterpart of 127.0.0.1 and represents + the IPv6 loopback interface. 127.0.1.1 is a loopback entry reserved + specifically for the FQDN. + diff --git a/chapter07/profile.xml b/chapter09/profile.xml similarity index 95% rename from chapter07/profile.xml rename to chapter09/profile.xml index 226dd9fac..ec39d3a30 100644 --- a/chapter07/profile.xml +++ b/chapter09/profile.xml @@ -103,8 +103,8 @@ LC_ALL=<locale name> locale int_prefix encoding used by the locale, the local currency, and the prefix to dial before the telephone number in order to get into the country. If any of the commands above fail with a message similar to the one shown below, this means - that your locale was either not installed in Chapter 6 or is not supported by - the default installation of Glibc. + that your locale was either not installed in + or is not supported by the default installation of Glibc. locale: Cannot set LC_* to default locale: No such file or directory @@ -114,7 +114,7 @@ LC_ALL=<locale name> locale int_prefix Glibc. - Some packages beyond LFS may also lack support for your chosen locale. One + Other packages can also function incorrectly (but may not necessarily display any error messages) if the locale name does not meet their expectations. In those cases, investigating how other Linux distributions support your locale @@ -145,7 +145,7 @@ export LANG=<ll>_<CC>.<charmap><@modifiers> # End /etc/profile EOF - The C (default) and en_US (the recommended + The C (default) and en_US.utf8 (the recommended one for United States English users) locales are different. C uses the US-ASCII 7-bit character set, and treats bytes with the high bit set as invalid characters. That's why, e.g., the ls command diff --git a/chapter07/symlinks.xml b/chapter09/symlinks.xml similarity index 91% rename from chapter07/symlinks.xml rename to chapter09/symlinks.xml index 951e6976d..3b46a67b0 100644 --- a/chapter07/symlinks.xml +++ b/chapter09/symlinks.xml @@ -21,7 +21,7 @@ discovered. For example, on a computer having two network cards made by Intel and Realtek, the network card manufactured by Intel may become eth0 and the Realtek card becomes eth1. In some cases, after a reboot the cards - get renumbered the other way around. + could get renumbered the other way around. In the new naming scheme, typical network device names would then be something like enp5s0 or wlp3s0. If this naming convention is not @@ -44,7 +44,7 @@ Creating Custom Udev Rules - The naming scheme can be customized by creating custom Udev + The naming scheme can be customized by creating custom udev rules. A script has been included that generates the initial rules. Generate these rules by running: @@ -68,24 +68,24 @@ along with its driver in parentheses, if the driver can be found. Neither the hardware ID nor the driver is used to determine which name to give an interface; this information is only for reference. The second line is the - Udev rule that matches this NIC and actually assigns it a name. + udev rule that matches this NIC and actually assigns it a name. - All Udev rules are made up of several keys, separated by commas and + All udev rules are made up of several keys, separated by commas and optional whitespace. This rule's keys and an explanation of each of them are as follows: - SUBSYSTEM=="net" - This tells Udev to ignore + SUBSYSTEM=="net" - This tells udev to ignore devices that are not network cards. - ACTION=="add" - This tells Udev to ignore this + ACTION=="add" - This tells udev to ignore this rule for a uevent that isn't an add ("remove" and "change" uevents also happen, but don't need to rename network interfaces). - DRIVERS=="?*" - This exists so that Udev will + DRIVERS=="?*" - This exists so that udev will ignore VLAN or bridge sub-interfaces (because these sub-interfaces do not have drivers). These sub-interfaces are skipped because the name that would be assigned would collide with their parent devices. @@ -96,14 +96,14 @@ ATTR{type}=="1" - This ensures the rule only - matches the primary interface in the case of certain wireless drivers, + matches the primary interface in the case of certain wireless drivers which create multiple virtual interfaces. The secondary interfaces are skipped for the same reason that VLAN and bridge sub-interfaces are skipped: there would be a name collision otherwise. NAME - The value of this key is the name that - Udev will assign to this interface. + udev will assign to this interface. @@ -133,8 +133,8 @@ default for USB and FireWire devices), where the rules it creates depend on the physical path to the CD or DVD device. Second, it can operate in by-id mode (default for IDE and SCSI devices), where the - rules it creates depend on identification strings stored in the CD or DVD - device itself. The path is determined by Udev's path_id + rules it creates depend on identification strings stored on the CD or DVD + device itself. The path is determined by udev's path_id script, and the identification strings are read from the hardware by its ata_id or scsi_id programs, depending on which type of device you have. @@ -159,11 +159,11 @@ External devices (for example, a USB-connected CD drive) should not use by-path persistence, because each time the device is plugged into a new external port, its physical path will change. All - externally-connected devices will have this problem if you write Udev rules + externally-connected devices will have this problem if you write udev rules to recognize them by their physical path; the problem is not limited to CD and DVD drives. - If you wish to see the values that the Udev scripts will use, then + If you wish to see the values that the udev scripts will use, then for the appropriate CD-ROM device, find the corresponding directory under /sys (e.g., this can be /sys/block/hdd) and @@ -182,18 +182,18 @@ as follows (where mode is one of by-id or by-path): -sed -i -e 's/"write_cd_rules"/"write_cd_rules mode"/' \ - /etc/udev/rules.d/83-cdrom-symlinks.rules +sed -e 's/"write_cd_rules"/"write_cd_rules mode"/' \ + -i /etc/udev/rules.d/83-cdrom-symlinks.rules Note that it is not necessary to create the rules files or symlinks - at this time, because you have bind-mounted the host's - /dev directory into the LFS system, + at this time because you have bind-mounted the host's + /dev directory into the LFS system and we assume the symlinks exist on the host. The rules and symlinks will be created the first time you boot your LFS system. However, if you have multiple CD-ROM devices, then the symlinks generated at that time may point to different devices than they point to on - your host, because devices are not discovered in a predictable order. The + your host because devices are not discovered in a predictable order. The assignments created when you first boot the LFS system will be stable, so this is only an issue if you need the symlinks on both systems to point to the same device. If you need that, then inspect (and possibly edit) the @@ -212,9 +212,9 @@ E.g., if you have a USB web camera and a TV tuner, sometimes /dev/video0 refers to the camera and /dev/video1 refers to the tuner, and sometimes - after a reboot the order changes to the opposite one. + after a reboot the order changes. For all classes of hardware except sound cards and network cards, this is - fixable by creating Udev rules for custom persistent symlinks. + fixable by creating udev rules for custom persistent symlinks. The case of network cards is covered separately in , and sound card configuration can be found in BLFS. @@ -237,10 +237,8 @@ cat > /etc/udev/rules.d/83-duplicate_devs.rules << "EOF" # Persistent symlinks for webcam and tuner -KERNEL=="video*", ATTRS{idProduct}=="1910", ATTRS{idVendor}=="0d81", \ - SYMLINK+="webcam" -KERNEL=="video*", ATTRS{device}=="0x036f", ATTRS{vendor}=="0x109e", \ - SYMLINK+="tvtuner" +KERNEL=="video*", ATTRS{idProduct}=="1910", ATTRS{idVendor}=="0d81", SYMLINK+="webcam" +KERNEL=="video*", ATTRS{device}=="0x036f", ATTRS{vendor}=="0x109e", SYMLINK+="tvtuner" EOF diff --git a/chapter07/systemd-custom.xml b/chapter09/systemd-custom.xml similarity index 91% rename from chapter07/systemd-custom.xml rename to chapter09/systemd-custom.xml index 787fd4572..809c1a273 100644 --- a/chapter07/systemd-custom.xml +++ b/chapter09/systemd-custom.xml @@ -49,13 +49,14 @@ EOF Disabling tmpfs for /tmp By default, /tmp is created as - a tmpfs. If this is not desired, it can be overridden by the following: + a tmpfs. If this is not desired, it can be overridden by executing the + following command: ln -sfv /dev/null /etc/systemd/system/tmp.mount Alternatively, if a a separate partition for /tmp is desired, specify that - partition in an /etc/fstab entry. + partition in a /etc/fstab entry. @@ -87,7 +88,7 @@ EOF /etc/tmpfiles.d override files with the same name in /usr/lib/tmpfiles.d. See - tmpfiles.d(5) manual page for file format + tmpfiles.d(5) manual page for file format details. @@ -103,7 +104,7 @@ EOF is really only applicable to btrfs filesystems. It references type v which in turn references type d (directory). This then creates the specified directory if is is not present and adjusts the permissions - and ownership as specified. Contents of the directory will be + and ownership as specified. Contents of the directory will be subject to time based cleanup if the age argument is specified. @@ -121,7 +122,7 @@ cp /usr/lib/tmpfiles.d/tmp.conf /etc/tmpfiles.d Overriding Default Services Behavior - The parameter of a unit can be overriden by creating a directory + The parameters of a unit can be overriden by creating a directory and a configuration file in /etc/systemd/system. For example: @@ -180,7 +181,7 @@ EOF Logging on a system booted with systemd is handled with systemd-journald (by default), rather than a typical unix syslog daemon. - You can also add a normal syslog daemon and have both work side by + You can also add a normal syslog daemon and have both operate side by side if desired. The systemd-journald program stores journal entries in a binary format rather than a plain text log file. To assist with parsing the file, the command journalctl is provided. @@ -202,7 +203,7 @@ EOF chronological order. - journalctl -f: povides functionality similar + journalctl -f: provides functionality similar to tail -f (follow). @@ -215,23 +216,23 @@ EOF Core dumps are useful to debug crashed programs, especially when a daemon process crashes. On systemd booted systems the core dumping is handled by systemd-coredump. It will - log the core dump into the journal and store the core dump itself in + log the core dump in the journal and store the core dump itself in /var/lib/systemd/coredump. - To retrieve and process core dumps, coredumpctl + To retrieve and process core dumps, the coredumpctl tool is provided. Here are some examples of frequently used commands: coredumpctl -r: lists all core dumps in - reversed chronological order. + reverse chronological order. - coredumpctl -1 info: show the information - of the last core dump. + coredumpctl -1 info: shows the information + from the last core dump. - coredumpctl -1 debug: load the last core + coredumpctl -1 debug: loads the last core dump into GDB. @@ -249,7 +250,7 @@ cat > /etc/systemd/coredump.conf.d/maxuse.conf << EOF MaxUse=5G EOF - See systemd-coredump(8), + See the systemd-coredump(8), coredumpctl(1), and coredump.conf.d(5) manual pages for more information. @@ -284,7 +285,7 @@ EOF advantage of explicitly allowing and disallowing processes to run after the user session has ended, but breaks backwards compatibility with tools like nohup and utilities that use - deamon(). + daemon(). @@ -298,7 +299,7 @@ EOF - Disable at build-time: You can enable + Disable at build-time: You can disable lingering by default while building systemd by adding the switch -Ddefault-kill-user-processes=false to the meson command for systemd. This completely diff --git a/chapter07/udev.xml b/chapter09/udev.xml similarity index 93% rename from chapter07/udev.xml rename to chapter09/udev.xml index 6060849be..a3a7c0cf9 100644 --- a/chapter07/udev.xml +++ b/chapter09/udev.xml @@ -15,7 +15,7 @@ usage - In , we installed the Udev + In , we installed the udev package when eudev systemd was built. Before we go into the details regarding how this works, a brief history of previous methods of @@ -30,7 +30,7 @@ major and minor device numbers for every possible device that might exist in the world. - Using the Udev method, only those devices which are detected by the + Using the udev method, only those devices which are detected by the kernel get device nodes created for them. Because these device nodes will be created each time the system boots, they will be stored on a devtmpfs file system (a virtual file system @@ -135,7 +135,7 @@ /sys/bus/pci/devices/0000:00:0d.0/modalias file might contain the string pci:v00001319d00000801sv00001319sd00001319bc04sc01i00. - The default rules provided with Udev will cause udevd + The default rules provided with udev will cause udevd to call out to /sbin/modprobe with the contents of the MODALIAS uevent environment variable (which should be the same as the contents of the modalias file in sysfs), @@ -149,7 +149,7 @@ be prevented. The kernel itself is also able to load modules for network - protocols, filesystems and NLS support on demand. + protocols, filesystems, and NLS support on demand. @@ -177,12 +177,12 @@ Udev will only load a module if it has a bus-specific alias and the bus driver properly exports the necessary aliases to sysfs. In other cases, one should - arrange module loading by other means. With Linux-&linux-version;, Udev is + arrange module loading by other means. With Linux-&linux-version;, udev is known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI, SERIO, and FireWire devices. To determine if the device driver you require has the necessary - support for Udev, run modinfo with the module name as + support for udev, run modinfo with the module name as the argument. Now try locating the device directory under /sys/bus and check whether there is a modalias file there. @@ -190,7 +190,7 @@ If the modalias file exists in sysfs, the driver supports the device and can talk to it directly, but doesn't have the alias, it is a bug in the - driver. Load the driver without the help from Udev and expect the issue + driver. Load the driver without the help from udev and expect the issue to be fixed later. If there is no modalias file in the relevant @@ -206,7 +206,7 @@ - A kernel module is not loaded automatically, and Udev is not + <title>A kernel module is not loaded automatically, and udev is not intended to load it If the wrapper module only enhances the @@ -214,7 +214,7 @@ snd-pcm-oss enhances the functionality of snd-pcm by making the sound cards available to OSS applications), configure modprobe to load the wrapper - after Udev loads the wrapped module. To do this, add a + after udev loads the wrapped module. To do this, add a softdep line to the corresponding /etc/modprobe.d/<filename>.conf file. For example: @@ -223,13 +223,13 @@ Note that the softdep command also allows pre: dependencies, or a mixture of both - pre: and post:. See the - modprobe.d(5) manual page for more information + pre: and post: dependencies. See + the modprobe.d(5) manual page for more information on softdep syntax and capabilities. - If the module in question is not a wrapper and is useful by itself, - configure the modules bootscript to load this - module on system boot. To do this, add the module name to the + If the module in question is not a wrapper and is + useful by itself, configure the modules bootscript to + load this module on system boot. To do this, add the module name to the /etc/sysconfig/modules file on a separate line. This works for wrapper modules too, but is suboptimal in that case. @@ -279,7 +279,7 @@ Further text assumes that the driver is built statically into the kernel or already loaded as a module, and that you have already checked - that Udev doesn't create a misnamed device. + that udev doesn't create a misnamed device. Udev has no information needed to create a device node if a kernel driver does not export its data to @@ -297,12 +297,12 @@ Device naming order changes randomly after rebooting - This is due to the fact that Udev, by design, handles uevents and + This is due to the fact that udev, by design, handles uevents and loads modules in parallel, and thus in an unpredictable order. This will never be fixed. You should not rely upon the kernel device names being stable. Instead, create your own rules that make symlinks with stable names based on some stable attributes of the device, such as a - serial number or the output of various *_id utilities installed by Udev. + serial number or the output of various *_id utilities installed by udev. See and for examples. diff --git a/chapter07/usage.xml b/chapter09/usage.xml similarity index 90% rename from chapter07/usage.xml rename to chapter09/usage.xml index 2d68f38fd..d59b38b29 100644 --- a/chapter07/usage.xml +++ b/chapter09/usage.xml @@ -235,50 +235,6 @@ EOF For information on kernel module loading and udev, see . - @@ -293,11 +249,11 @@ EOF (CMOS) clock. If the hardware clock is set to UTC, this script will convert the hardware clock's time to the local time using the /etc/localtime file (which tells the - hwclock program which timezone the user is in). There is no + hwclock program which timezone to use). There is no way to detect whether or not the hardware clock is set to UTC, so this needs to be configured manually. - The setclock is run via + The setclock program is run via udev when the kernel detects the hardware capability upon boot. It can also be run manually with the stop parameter to store the system time to the CMOS clock. @@ -315,7 +271,7 @@ EOF Change the value of the UTC variable below to a value of 0 (zero) if the hardware clock - is not set to UTC time. + is NOT set to UTC time. Create a new file /etc/sysconfig/clock by running the following: @@ -336,7 +292,7 @@ EOF at . It explains issues such as time zones, UTC, and the TZ environment variable. - The CLOCKPARAMS and UTC paramaters may be alternatively set + The CLOCKPARAMS and UTC paramaters may also be set in the /etc/sysconfig/rc.site file. @@ -352,7 +308,7 @@ EOF This section discusses how to configure the console - bootscript that sets up the keyboard map, console font and console kernel log + bootscript that sets up the keyboard map, console font, and console kernel log level. If non-ASCII characters (e.g., the copyright sign, the British pound sign and Euro symbol) will not be used and the keyboard is a U.S. one, much of this section can be skipped. Without the configuration file, (or @@ -378,7 +334,7 @@ EOF LOGLEVEL This variable specifies the log level for kernel messages sent - to the console as set by dmesg. Valid levels are + to the console as set by dmesg -n. Valid levels are from "1" (no messages) to "8". The default level is "7". @@ -505,7 +461,7 @@ EOF Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous example, bright colors are no longer available on the Linux console unless - a framebuffer is used. If one wants to have bright colors without + a framebuffer is used. If one wants to have bright colors without a framebuffer and can live without characters not belonging to his language, it is still possible to use a language-specific 256-glyph font, as illustrated below: @@ -548,7 +504,7 @@ EOF are not multibyte. This deficiency doesn't affect keymaps for European languages, because there accents are added to unaccented ASCII characters, or two ASCII characters are composed together. However, in - UTF-8 mode it is a problem, e.g., for the Greek language, where one + UTF-8 mode it is a problem; e.g., for the Greek language, where one sometimes needs to put an accent on the letter alpha. The solution is either to avoid the use of UTF-8, or to install the X window system that doesn't have this limitation in its input @@ -556,11 +512,11 @@ EOF - For Chinese, Japanese, Korean and some other languages, the Linux + For Chinese, Japanese, Korean, and some other languages, the Linux console cannot be configured to display the needed characters. Users who need such languages should install the X Window System, fonts that cover the necessary character ranges, and the proper input method (e.g., - SCIM, it supports a wide variety of languages). + SCIM, supports a wide variety of languages). @@ -571,7 +527,7 @@ EOF The /etc/sysconfig/console file only controls the Linux text console localization. It has nothing to do with setting the proper keyboard layout and terminal fonts in the X Window System, with - ssh sessions or with a serial console. In such situations, limitations + ssh sessions, or with a serial console. In such situations, limitations mentioned in the last two list items above do not apply. @@ -585,9 +541,9 @@ EOF configuring - At times, it is desired to create files at boot time. For instance, + At times, it is desirable to create files at boot time. For instance, the /tmp/.ICE-unix directory - may be desired. This can be done by creating an entry in the + is often needed. This can be done by creating an entry in the /etc/sysconfig/createfiles configuration script. The format of this file is embedded in the comments of the default configuration file. diff --git a/chapter10/chapter10.xml b/chapter10/chapter10.xml new file mode 100644 index 000000000..d7236b21c --- /dev/null +++ b/chapter10/chapter10.xml @@ -0,0 +1,19 @@ + + + %general-entities; +]> + + + + + + Making the LFS System Bootable + + + + + + + diff --git a/chapter08/fstab.xml b/chapter10/fstab.xml similarity index 100% rename from chapter08/fstab.xml rename to chapter10/fstab.xml diff --git a/chapter10/grub.xml b/chapter10/grub.xml new file mode 100644 index 000000000..fbc1eef9f --- /dev/null +++ b/chapter10/grub.xml @@ -0,0 +1,190 @@ + + + %general-entities; +]> + + + + + + grub + &grub-version; +
&grub-url;
+
+ + Using GRUB to Set Up the Boot Process + + + Introduction + + Configuring GRUB incorrectly can render your system + inoperable without an alternate boot device such as a CD-ROM or bootable + USB drive. This section is not required to boot your LFS system. You may + just want to modify your current boot loader, e.g. Grub-Legacy, GRUB2, or + LILO. + + Ensure that an emergency boot disk is ready to rescue + the computer if the computer becomes unusable (un-bootable). If you do not + already have a boot device, you can create one. In order for the procedure + below to work, you need to jump ahead to BLFS and install + xorriso from the + libisoburn package. + +cd /tmp +grub-mkrescue --output=grub-img.iso +xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso + + + + To boot LFS on host systems that have UEFI enabled, the kernel needs to + have been built with the CONFIG_EFI_STUB capabality described in the + previous section. However, LFS can be booted using GRUB2 without such + an addition. To do this, the UEFI Mode and Secure Boot capabilities in + the host system's BIOS need to be turned off. For details, see + the lfs-uefi.txt hint at + &hints-root;lfs-uefi.txt. + + + + + + + GRUB Naming Conventions + + GRUB uses its own naming structure for drives and partitions in + the form of (hdn,m), where n + is the hard drive number and m is the partition + number. The hard drive number starts from zero, but the partition number + starts from one for normal partitions and five for extended partitions. + Note that this is different from earlier versions where + both numbers started from zero. For example, partition sda1 is (hd0,1) to + GRUB and sdb3 is + (hd1,3). In contrast to Linux, GRUB does not + consider CD-ROM drives to be hard drives. For example, if using a CD + on hdb and a second hard drive + on hdc, that second hard drive + would still be (hd1). + + + + + Setting Up the Configuration + + GRUB works by writing data to the first physical track of the + hard disk. This area is not part of any file system. The programs + there access GRUB modules in the boot partition. The default location + is /boot/grub/. + + The location of the boot partition is a choice of the user that + affects the configuration. One recommendation is to have a separate small + (suggested size is 200 MB) partition just for boot information. That way + each build, whether LFS or some commercial distro, can access the same boot + files and access can be made from any booted system. If you choose to do + this, you will need to mount the separate partition, move all files in the + current /boot directory (e.g. the + linux kernel you just built in the previous section) to the new partition. + You will then need to unmount the partition and remount it as /boot. If you do this, be sure to update + /etc/fstab. + + Using the current lfs partition will also work, but configuration + for multiple systems is more difficult. + + Using the above information, determine the appropriate + designator for the root partition (or boot partition, if a separate + one is used). For the following example, it is assumed that the root + (or separate boot) partition is sda2. + + Install the GRUB files into /boot/grub and set up the boot track: + + + The following command will overwrite the current boot loader. Do not + run the command if this is not desired, for example, if using a third party + boot manager to manage the Master Boot Record (MBR). + + +grub-install /dev/sda + + + If the system has been booted using UEFI, + grub-install will try to install files for the + x86_64-efi target, but those files + have not been installed in chapter 6. If this is the case, add + to the command above. + + + + + + + Creating the GRUB Configuration File + + Generate /boot/grub/grub.cfg: + + cat > /boot/grub/grub.cfg << "EOF" +# Begin /boot/grub/grub.cfg +set default=0 +set timeout=5 + +insmod ext2 +set root=(hd0,2) + +menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;" { + linux /boot/vmlinuz-&linux-version;-lfs-&version; root=/dev/sda2 ro +} +EOF + + cat > /boot/grub/grub.cfg << "EOF" +# Begin /boot/grub/grub.cfg +set default=0 +set timeout=5 + +insmod ext2 +set root=(hd0,2) + +menuentry "GNU/Linux, Linux &linux-version;-lfs-&versiond;" { + linux /boot/vmlinuz-&linux-version;-lfs-&versiond; root=/dev/sda2 ro +} +EOF + + + From GRUB's perspective, the + kernel files are relative to the partition used. If you + used a separate /boot partition, remove /boot from the above + linux line. You will also need to change the + set root line to point to the boot partition. + + + GRUB is an extremely powerful program and it provides a tremendous + number of options for booting from a wide variety of devices, operating + systems, and partition types. There are also many options for customization + such as graphical splash screens, playing sounds, mouse input, etc. The + details of these options are beyond the scope of this introduction. + + There is a command, grub-mkconfig, that + can write a configuration file automatically. It uses a set of scripts in + /etc/grub.d/ and will destroy any customizations that you make. These scripts + are designed primarily for non-source distributions and are not recommended for + LFS. If you install a commercial Linux distribution, there is a good chance + that this program will be run. Be sure to back up your grub.cfg file. + + + +
diff --git a/chapter10/introduction.xml b/chapter10/introduction.xml new file mode 100644 index 000000000..2b233ec08 --- /dev/null +++ b/chapter10/introduction.xml @@ -0,0 +1,18 @@ + + + %general-entities; +]> + + + + + Introduction + + It is time to make the LFS system bootable. This chapter + discusses creating the /etc/fstab file, building a + kernel for the new LFS system, and installing the GRUB boot loader so + that the LFS system can be selected for booting at startup. + + diff --git a/chapter08/kernel.xml b/chapter10/kernel.xml similarity index 93% rename from chapter08/kernel.xml rename to chapter10/kernel.xml index 94f050b4e..a724bd078 100644 --- a/chapter08/kernel.xml +++ b/chapter10/kernel.xml @@ -30,8 +30,8 @@ &diskspace; - &linux-ch8-sbu; - &linux-ch8-du; + &linux-knl-sbu; + &linux-knl-du; @@ -110,7 +110,6 @@ File systems ---> Pseudo filesystems ---> [*] Tmpfs POSIX Access Control Lists [CONFIG_TMPFS_POSIX_ACL] [*] Tmpfs extended attributes [CONFIG_TMPFS_XATTR] - @@ -257,14 +256,9 @@ File systems ---> the automatic setup of the boot process described in the next section. The following command assumes an x86 architecture:
-cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&version; - -cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&version;-multilib - -cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&versiond; - -cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&versiond;-multilib +cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&version; +cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&versiond; System.map is a symbol file for the kernel. It maps the function entry points of every function in the kernel API, @@ -326,7 +320,7 @@ cp -r Documentation/* /usr/share/doc/linux-&linux-version; class="directory">/usr/include) should always be the ones against which Glibc was compiled, that is, the sanitised headers installed in . Therefore, they should + linkend="ch-tools-linux-headers"/>. Therefore, they should never be replaced by either the raw kernel headers or any other kernel sanitized headers.
@@ -373,10 +367,8 @@ EOF config-&linux-version;, - vmlinuz-&linux-version;-lfs-&version;, - vmlinuz-&linux-version;-lfs-&versiond;, - vmlinuz-&linux-version;-lfs-&version;-multilib, - vmlinuz-&linux-version;-lfs-&versiond;-multilib, + vmlinuz-&linux-version;-lfs-&version;, + vmlinuz-&linux-version;-lfs-&versiond;, and System.map-&linux-version; /lib/modules, /usr/share/doc/linux-&linux-version; diff --git a/chapter11/chapter11.xml b/chapter11/chapter11.xml new file mode 100644 index 000000000..8b4c53a1d --- /dev/null +++ b/chapter11/chapter11.xml @@ -0,0 +1,19 @@ + + + %general-entities; +]> + + + + + + The End + + + + + + + diff --git a/chapter09/getcounted.xml b/chapter11/getcounted.xml similarity index 100% rename from chapter09/getcounted.xml rename to chapter11/getcounted.xml diff --git a/chapter09/reboot.xml b/chapter11/reboot.xml similarity index 100% rename from chapter09/reboot.xml rename to chapter11/reboot.xml index c6a857dbd..1822e6165 100644 --- a/chapter09/reboot.xml +++ b/chapter11/reboot.xml @@ -89,10 +89,6 @@ umount -v $LFS/run umount -v $LFS/proc umount -v $LFS/sys - Unmount the LFS file system itself: - -umount -v $LFS - If multiple partitions were created, unmount the other partitions before unmounting the main one, like this: @@ -100,6 +96,10 @@ umount -v $LFS/sys umount -v $LFS/home umount -v $LFS + Unmount the LFS file system itself: + +umount -v $LFS + Now, reboot the system with: shutdown -r now diff --git a/chapter09/theend.xml b/chapter11/theend.xml similarity index 97% rename from chapter09/theend.xml rename to chapter11/theend.xml index 9f2ca17cc..6a5f8ad7a 100644 --- a/chapter09/theend.xml +++ b/chapter11/theend.xml @@ -36,7 +36,7 @@ echo &versiond; > /etc/lfs-release Two files describing the installed system may be used by packages - that will be installed on the system, either in binary form or by building + that can be installed on the system later, either in binary form or by building them. The first one shows the status of your diff --git a/chapter09/whatnow.xml b/chapter11/whatnow.xml similarity index 96% rename from chapter09/whatnow.xml rename to chapter11/whatnow.xml index 273eb7740..9e6062cf7 100644 --- a/chapter09/whatnow.xml +++ b/chapter11/whatnow.xml @@ -57,7 +57,7 @@ The Beyond Linux From Scratch book covers installation procedures for a wide range of software beyond the scope of the LFS - Book. The BLFS project is located at . + Book. The BLFS project is located at . @@ -65,7 +65,7 @@ The LFS Hints are a collection of educational documents submitted by volunteers in the LFS community. The hints are available - at . + at . diff --git a/general.ent b/general.ent index 47c54b421..c2f4da343 100644 --- a/general.ent +++ b/general.ent @@ -1,13 +1,13 @@ - + - + - + @@ -54,3 +54,11 @@ %patches-entities; + + + + + + + + diff --git a/index.xml b/index.xml index d20257f57..79f6535b7 100644 --- a/index.xml +++ b/index.xml @@ -23,21 +23,29 @@ - -Building the LFS System +Building the LFS Cross Toolchain and Temporary Tools + + - - -Appendices +Building the LFS System + + + + + + + +Appendices + diff --git a/packages.ent b/packages.ent index 5bfa2f4ce..715917ba7 100644 --- a/packages.ent +++ b/packages.ent @@ -4,32 +4,39 @@ For empty *-home entities use " " not "" Packages sizes allways in KB Allowed deviation in SBUs : 10% - Allowed deviation in disk usage : 2% --> + Allowed deviation in disk usage : 2% + + Suffixes: + *-tmp-* Package info for Temporary Tools + *-fin-* Package info for Final System + *-cfg-* Package info for System Configuration + *-knl-* Package info for Kernel stuff +--> - - + + - - + + - - - + + + @@ -37,58 +44,61 @@ - - + + - - - - + + + + - - - + + + - - - - - - + + + + + + - - + + - + - - - - + + + + + - - - - + + + + - - + + - - - - + + + + - + - + - - + + - - + + - - - - + + + + - - + + - - + + - + - - + + - - + + - - + + @@ -181,60 +191,61 @@ - - + + - - + + - + - - - - + + + + - - - - + + + + - - - - + + + - - - - + + + + - - - - - - + + + + + + @@ -243,36 +254,38 @@ - - + + + + - - + + - - - - + + + + - - - - + + + + @@ -280,316 +293,307 @@ - - + + - - + + - - - - + + + + - - + + - - + + - - - - + + + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - + - + - - + + - - - - - - - - - - - - - - + + + - - - - + + + + - - - - + + + + - - + + - + - - + + - - + + - + - - + + - + - + - - + + - - + + - - + + - - - - + + + + - - + + - - + + - - - - + + + + - - + + - + - - - - + + + + - - + + - - + + - - + + @@ -600,10 +604,10 @@ - - - - + + + + @@ -613,34 +617,34 @@ - - + + - - - - + + + + - - + + - - + + @@ -655,26 +659,26 @@ - - + + - - + + - - - - + + + + @@ -682,18 +686,21 @@ - - + + + + + - - - - + + + + @@ -713,10 +720,10 @@ - - - - + + + + @@ -726,40 +733,40 @@ - - + + - - + + - - - - + + + + - - + + - - + + diff --git a/chapter05/generalinstructions.xml b/part3intro/generalinstructions.xml similarity index 88% rename from chapter05/generalinstructions.xml rename to part3intro/generalinstructions.xml index bf1ec6112..a441b17ef 100644 --- a/chapter05/generalinstructions.xml +++ b/part3intro/generalinstructions.xml @@ -5,7 +5,8 @@ %general-entities; ]> - + General Compilation Instructions @@ -18,7 +19,7 @@ Several of the packages are patched before compilation, but only when the patch is needed to circumvent a problem. A patch is often needed in - both this and the next chapter, but sometimes in only one or the other. + both this and the following chapters, but sometimes in only one location. 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 @@ -81,9 +82,9 @@ Place all the sources and patches in a directory that will be accessible from the chroot environment such as - /mnt/lfs/sources/. Do + /mnt/lfs/sources/. Change to the sources directory. @@ -93,8 +94,9 @@ Using the tar program, extract the package - to be built. In Chapter 5, ensure you are the lfs - user when extracting the package. + to be built. In and + , ensure you are + the lfs user when extracting the package. Change to the directory created when the package was diff --git a/part3intro/introduction.xml b/part3intro/introduction.xml new file mode 100644 index 000000000..6d30ffe49 --- /dev/null +++ b/part3intro/introduction.xml @@ -0,0 +1,34 @@ + + + %general-entities; +]> + + + + + Introduction + + This part is divided into three stages: first building a cross + compiler and its associated libraries; second, use this cross toolchain + to build several utilities in a way that isolates them from the host + distribution; third, enter the chroot environment, which further improves + host isolation, and build the remaining tools needed to build the final + system. + + With this part begins the real work of building a new + system. It requires much care in ensuring that the instructions are + followed exactly as the book shows them. You should try to understand + what they do, and whatever your eagerness to finish your build, you should + refrain from blindly type them as shown, but rather read documentation when + there is something you do not understand. Also, keep track of your typing + and of the output of commands, by sending them to a file, using the + tee utility. This allows for better diagnosing + if something gets wrong. + + The next section gives a technical introduction to the build process, + while the following one contains very + important general instructions. + + diff --git a/part3intro/part3intro.xml b/part3intro/part3intro.xml new file mode 100644 index 000000000..a4d8eecda --- /dev/null +++ b/part3intro/part3intro.xml @@ -0,0 +1,18 @@ + + + %general-entities; +]> + + + + + + Important Preliminary Material + + + + + + diff --git a/part3intro/toolchaintechnotes.xml b/part3intro/toolchaintechnotes.xml new file mode 100644 index 000000000..42dc19ac2 --- /dev/null +++ b/part3intro/toolchaintechnotes.xml @@ -0,0 +1,340 @@ + + + %general-entities; +]> + + + + + Toolchain Technical Notes + + This section explains some of the rationale and technical details + behind the overall build method. It is not essential to immediately + understand everything in this section. Most of this information will be + clearer after performing an actual build. This section can be referred + to at any time during the process. + + The overall goal of and is to produce a temporary area that + contains a known-good set of tools that can be isolated from the host system. + By using chroot, the commands in the remaining chapters + will be contained within that environment, ensuring a clean, trouble-free + build of the target LFS system. The build process has been designed to + minimize the risks for new readers and to provide the most educational value + at the same time. + + The build process is based on the process of + cross-compilation. Cross-compilation is normally used + for building a compiler and its toolchain for a machine different from + the one that is used for the build. This is not strictly needed for LFS, + since the machine where the new system will run is the same as the one + used for the build. But cross-compilation has the great advantage that + anything that is cross-compiled cannot depend on the host environment. + + + + About Cross-Compilation + + Cross-compilation involves some concepts that deserve a section on + their own. Although this section may be omitted in a first reading, it + is strongly suggested to come back to it later in order to get a full + grasp of the build process. + + Let us first define some terms used in this context: + + + build + is the machine where we build programs. Note that this machine + is referred to as the host in other + sections. + + + host + is the machine/system where the built programs will run. Note + that this use of host is not the same as in other + sections. + + + target + is only used for compilers. It is the machine the compiler + produces code for. It may be different from both build and + host. + + + + + As an example, let us imagine the following scenario (sometimes + referred to as Canadian Cross): we may have a + compiler on a slow machine only, let's call the machine A, and the compiler + ccA. We may have also a fast machine (B), but with no compiler, and we may + want to produce code for another slow machine (C). To build a + compiler for machine C, we would have three stages: + + + + + + + + + + StageBuildHost + TargetAction + + + + 1AAB + build cross-compiler cc1 using ccA on machine A + + + 2ABC + build cross-compiler cc2 using cc1 on machine A + + + 3BCC + build compiler ccC using cc2 on machine B + + + + + + Then, all the other programs needed by machine C can be compiled + using cc2 on the fast machine B. Note that unless B can run programs + produced for C, there is no way to test the built programs until machine + C itself is running. For example, for testing ccC, we may want to add a + fourth stage: + + + + + + + + + + StageBuildHost + TargetAction + + + + 4CCC + rebuild and test ccC using itself on machine C + + + + + + In the example above, only cc1 and cc2 are cross-compilers, that is, + they produce code for a machine different from the one they are run on. + The other compilers ccA and ccC produce code for the machine they are run + on. Such compilers are called native compilers. + + + + + Implementation of Cross-Compilation for LFS + + + Almost all the build systems use names of the form + cpu-vendor-kernel-os referred to as the machine triplet. An astute + reader may wonder why a triplet refers to a four component + name. The reason is history: initially, three component names were enough + to designate unambiguously a machine, but with new machines and systems + appearing, that proved insufficient. The word triplet + remained. A simple way to determine your machine triplet is to run + the config.guess + script that comes with the source for many packages. Unpack the binutils + sources and run the script: ./config.guess and note + the output. For example, for a 32-bit Intel processor the + output will be i686-pc-linux-gnu. On a 64-bit + system it will be x86_64-pc-linux-gnu. + + Also be aware of the name of the platform's dynamic linker, often + referred to as the dynamic loader (not to be confused with the standard + linker ld that is part of binutils). The dynamic linker + provided by Glibc finds and loads the shared libraries needed by a + program, prepares the program to run, and then runs it. The name of the + dynamic linker for a 32-bit Intel machine will be ld-linux.so.2 (ld-linux-x86-64.so.2 for 64-bit systems). A + sure-fire way to determine the name of the dynamic linker is to inspect a + random binary from the host system by running: readelf -l + <name of binary> | grep interpreter and noting the + output. The authoritative reference covering all platforms is in the + shlib-versions file in the root of the Glibc source + tree. + + + In order to fake a cross compilation, the name of the host triplet + is slightly adjusted by changing the "vendor" field in the + LFS_TGT variable. We also use the + --with-sysroot option when building the cross linker and + cross compiler to tell them where to find the needed host files. This + ensures that none of the other programs built in can link to libraries on the build + machine. Only two stages are mandatory, and one more for tests: + + + + + + + + + + StageBuildHost + TargetAction + + + + 1pcpclfs + build cross-compiler cc1 using cc-pc on pc + + + 2pclfslfs + build compiler cc-lfs using cc1 on pc + + + 3lfslfslfs + rebuild and test cc-lfs using itself on lfs + + + + + + In the above table, on pc means the commands are run + on a machine using the already installed distribution. On + lfs means the commands are run in a chrooted environment. + + Now, there is more about cross-compiling: the C language is not + just a compiler, but also defines a standard library. In this book, the + GNU C library, named glibc, is used. This library must + be compiled for the lfs machine, that is, using the cross compiler cc1. + But the compiler itself uses an internal library implementing complex + instructions not available in the assembler instruction set. This + internal library is named libgcc, and must be linked to the glibc + library to be fully functional! Furthermore, the standard library for + C++ (libstdc++) also needs being linked to glibc. The solution to this + chicken and egg problem is to first build a degraded cc1 based libgcc, + lacking some functionalities such as threads and exception handling, then + build glibc using this degraded compiler (glibc itself is not + degraded), then build libstdc++. But this last library will lack the + same functionalities as libgcc. + + This is not the end of the story: the conclusion of the preceding + paragraph is that cc1 is unable to build a fully functional libstdc++, but + this is the only compiler available for building the C/C++ libraries + during stage 2! Of course, the compiler built during stage 2, cc-lfs, + would be able to build those libraries, but (1) the build system of + GCC does not know that it is usable on pc, and (2) using it on pc + would be at risk of linking to the pc libraries, since cc-lfs is a native + compiler. So we have to build libstdc++ later, in chroot. + + + + + + Other procedural details + + The cross-compiler will be installed in a separate $LFS/tools directory, since it will not + be part of the final system. + + Binutils is installed first because the configure + runs of both GCC and Glibc perform various feature tests on the assembler + and linker to determine which software features to enable or disable. This + is more important than one might first realize. An incorrectly configured + GCC or Glibc can result in a subtly broken toolchain, where the impact of + such breakage might not show up until near the end of the build of an + entire distribution. A test suite failure will usually highlight this error + before too much additional work is performed. + + Binutils installs its assembler and linker in two locations, + $LFS/tools/bin and $LFS/tools/$LFS_TGT/bin. The tools in one + location are hard linked to the other. An important facet of the linker is + its library search order. Detailed information can be obtained from + ld by passing it the --verbose + flag. For example, $LFS_TGT-ld --verbose | grep SEARCH + will illustrate the current search paths and their order. It shows which + files are linked by ld by compiling a dummy program and + passing the --verbose switch to the linker. For + example, + $LFS_TGT-gcc dummy.c -Wl,--verbose 2>&1 | grep succeeded + will show all the files successfully opened during the linking. + + The next package installed is GCC. An example of what can be + seen during its run of configure is: + +checking what assembler to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/as +checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ld + + This is important for the reasons mentioned above. It also + demonstrates that GCC's configure script does not search the PATH + directories to find which tools to use. However, during the actual + operation of gcc itself, the same search paths are not + necessarily used. To find out which standard linker gcc + will use, run: $LFS_TGT-gcc -print-prog-name=ld. + + Detailed information can be obtained from gcc by + passing it the -v command line option while compiling + a dummy program. For example, gcc -v dummy.c will show + detailed information about the preprocessor, compilation, and assembly + stages, including gcc's included search paths and their + order. + + Next installed are sanitized Linux API headers. These allow the + standard C library (Glibc) to interface with features that the Linux + kernel will provide. + + The next package installed is Glibc. The most important + considerations for building Glibc are the compiler, binary tools, and + kernel headers. The compiler is generally not an issue since Glibc will + always use the compiler relating to the --host + parameter passed to its configure script; e.g. in our case, the compiler + will be $LFS_TGT-gcc. The binary tools and kernel + headers can be a bit more complicated. Therefore, take no risks and use + the available configure switches to enforce the correct selections. After + the run of configure, check the contents of the + config.make file in the build directory for all important details. + Note the use of CC="$LFS_TGT-gcc" (with + $LFS_TGT expanded) to control which binary tools are used + and the use of the -nostdinc and + -isystem flags to control the compiler's include + search path. These items highlight an important aspect of the Glibc + package—it is very self-sufficient in terms of its build machinery + and generally does not rely on toolchain defaults. + + As said above, the standard C++ library is compiled next, followed in + by all the programs that need + themselves to be built. The install step of all those packages uses the + DESTDIR variable to have the + programs land into the LFS filesystem. + + At the end of the native + lfs compiler is installed. First binutils-pass2 is built, + with the same DESTDIR install as the other programs, + then the second pass of GCC is constructed, omitting libstdc++ + and other non-important libraries. Due to some weird logic in GCC's + configure script, CC_FOR_TARGET ends up as + cc when the host is the same as the target, but is + different from the build system. This is why + CC_FOR_TARGET=$LFS_TGT-gcc is put explicitely into + the configure options. + + Upon entering the chroot environment in , the first task is to install + libstdc++. Then temporary installations of programs needed for the proper + operation of the toolchain are performed. Programs needed for testing + other programs are also built. From this point onwards, the + core toolchain is self-contained and self-hosted. In + , final versions of all the + packages needed for a fully functional system are built, tested and + installed. + + + + diff --git a/patches.ent b/patches.ent index 9ec504dce..f07cb22c0 100644 --- a/patches.ent +++ b/patches.ent @@ -24,6 +24,10 @@ --> + + + + @@ -52,3 +56,7 @@ --> + + + + diff --git a/prologue/architecture.xml b/prologue/architecture.xml index f23d19cab..9916840f5 100644 --- a/prologue/architecture.xml +++ b/prologue/architecture.xml @@ -32,7 +32,7 @@ using 4 cores, the following statistics were measured: As you can see, on the same hardware, the 64-bit build is only 3% faster and is 22% larger than the 32-bit build. If you plan to use LFS as a LAMP server, or a firewall, a 32-bit CPU may be largely sufficient. On the other -hand, several packages in BLFS now need more that 4GB of RAM to be built +hand, several packages in BLFS now need more than 4GB of RAM to be built and/or to run, so that if you plan to use LFS as a desktop, the LFS authors recommend building on a 64-bit system. diff --git a/prologue/organization.xml b/prologue/organization.xml index 4be1ef81c..c2c82b63c 100644 --- a/prologue/organization.xml +++ b/prologue/organization.xml @@ -29,9 +29,16 @@ - Part III - Building the LFS System + Part III - Building the LFS Cross Toolchain and Temporary Tools - Part III guides the reader through the building of the LFS + Part III provides instructions for building the tools + needed for constructing the final LFS system. + + + + Part IV - Building the LFS System + + Part IV guides the reader through the building of the LFS system—compiling and installing all the packages one by one, setting up the boot scripts, and installing the kernel. The resulting Linux system is the foundation on which other software can be built to @@ -40,4 +47,14 @@ important files that have been installed. + + Part V - Appendices + + Part V provides information about the book itself including + acronyms and terms, acknowledgments, package dependencies, + a listing of LFS boot scripts, licenses for the distribution of the + book, and a comprehensive index of packages, programs, libraries, + and scripts. + + diff --git a/prologue/typography.xml b/prologue/typography.xml index 86cbfc6b1..e4c7b5c78 100644 --- a/prologue/typography.xml +++ b/prologue/typography.xml @@ -80,8 +80,8 @@ EOF 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 + need to run man 5 passwd in order to read the page + being specified. Note that most man pages do not have duplicate page names in different sections. Therefore, man <program name> is generally sufficient. diff --git a/prologue/why.xml b/prologue/why.xml index 4b1b263e1..e2b9a55a1 100644 --- a/prologue/why.xml +++ b/prologue/why.xml @@ -118,8 +118,7 @@ DejaGNU - This package contains a framework for testing other programs. - It is only installed in the temporary toolchain. + This package contains a framework for testing other programs. @@ -141,8 +140,9 @@ Eudev - This package is a device manager. It dynamically controls the entries - in the /dev directory as devices are added or removed from the system. + This package is a device manager. It dynamically controls the ownership, + permissions, names, and symbolic links of devices in the /dev directory as + devices are added or removed from the system. @@ -166,7 +166,7 @@ File This package contains a utility for determining the type of a - given file or files. A few packages need it to build. + given file or files. A few packages need it in their build scripts. @@ -194,7 +194,7 @@ - Gcc + GCC This package is the Gnu Compiler Collection. It contains the C and C++ compilers as well as several others not built by LFS. @@ -218,7 +218,7 @@ Glibc - This package contains the main C library. Linux programs would + This package contains the main C library. Linux programs will not run without it. @@ -226,7 +226,7 @@ GMP This package contains math libraries that provide useful functions - for arbitrary precision arithmetic. It is required to build Gcc. + for arbitrary precision arithmetic. It is required to build GCC. @@ -416,14 +416,14 @@ MPC This package contains functions for the arithmetic of complex - numbers. It is required by Gcc. + numbers. It is required by GCC. MPFR This package contains functions for multiple precision - arithmetic. It is required by Gcc. + arithmetic. It is required by GCC. @@ -472,7 +472,7 @@ Pkg-config - This package provides a program to return meta-data about an + This package provides a program that returns meta-data about an installed library or package. @@ -558,8 +558,7 @@ Tcl This package contains the Tool Command Language used - in many test suites in LFS packages. It is only installed in - the temporary toolchain. + in many test suites in LFS packages. diff --git a/stylesheets/lfs-xsl/lfs.css b/stylesheets/lfs-xsl/lfs.css index e57f424c6..63a118c1b 100644 --- a/stylesheets/lfs-xsl/lfs.css +++ b/stylesheets/lfs-xsl/lfs.css @@ -162,6 +162,8 @@ div.navheader, div.navfooter { div.navheader { border-bottom: 1px solid #dbddec; + position: sticky; + top: 0; } div.navfooter { @@ -235,10 +237,14 @@ div.toc { padding-left: 1em; } -li.preface, .part li.appendix { +.book li.preface, .part li.appendix { margin-left: 1em; } +.part li.preface { + margin-left: 0em; +} + div.toc h3 { margin: 1em 0 .3em 0; } @@ -340,7 +346,7 @@ div.important em, div.warning em, div.caution em { margin-bottom: .3em; } -.table table { +.table table, .informaltable { margin-left: auto; margin-right: auto; } @@ -430,18 +436,39 @@ div.materials dd { .segtitle { float: left; + padding-left: 1em; + width: 14.5em; } -.package .segbody, .appendix .segbody { +.content .segtitle { + width: 12em; +} + +.package .segbody { display: block; padding-left: 14em; } -.content .segbody { +.appendix .segbody{ display: block; - padding-left: 12em; + padding-left: 16em; } +.content .segbody { + display: block; + padding-left: 13em; +} + +.content table tr td:first-child +{ + width: 9em; + padding-right: 0px; +} + +.content table tr td:first-child p +{ + padding-right: 0px; +} /* itemizedlist */ ul {