diff --git a/chapter05/chapter05.xml b/chapter05/chapter05.xml
index ddd652709..8a05daca5 100644
--- a/chapter05/chapter05.xml
+++ b/chapter05/chapter05.xml
@@ -5,11 +5,11 @@
%general-entities;
]>
-
+
- Constructing a Temporary System
+ Cross Compiling a Toolchain
@@ -19,39 +19,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml
index 1bd308f09..7db6408c2 100644
--- a/chapter05/gcc-pass1.xml
+++ b/chapter05/gcc-pass1.xml
@@ -25,7 +25,7 @@
diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml
index 5213c23e5..39aabd12c 100644
--- a/chapter05/glibc.xml
+++ b/chapter05/glibc.xml
@@ -25,7 +25,7 @@
diff --git a/chapter06/bash.xml b/chapter06/bash.xml
index 650c33ade..92627e92c 100644
--- a/chapter06/bash.xml
+++ b/chapter06/bash.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,22 +16,25 @@
Bash-&bash-version;
-
+ Bash
+ tools
- The Bash package contains the Bourne-Again SHell.
+ &buildtime;&diskspace;
- &bash-ch6-sbu;
- &bash-ch6-du;
+ &bash-ch5-sbu;
+ &bash-ch5-du;
@@ -40,27 +43,24 @@
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 to be:
- 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
-
- Install the package and move the main executable to
- /bin:
+ Make a link for the programs that use sh for
+ a shell:
-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
+
+
-
- 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
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/binutils-pass1.xml b/chapter06/binutils-pass1.xml
new file mode 100644
index 000000000..8658cfcfe
--- /dev/null
+++ b/chapter06/binutils-pass1.xml
@@ -0,0 +1,156 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ binutils-pass1
+ &binutils-version;
+ &binutils-url;
+
+
+ Binutils-&binutils-version; - Pass 1
+
+
+ Binutils
+ tools, pass 1
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &binutils-ch5p1-sbu;
+ &binutils-ch5p1-du;
+
+
+
+
+
+
+ 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
+ of problems later.
+
+ It is important that Binutils be the first package compiled
+ because both Glibc and GCC perform various tests on the available
+ linker and assembler to determine which of their own features to
+ enable.
+
+ The Binutils documentation recommends building Binutils
+ in a dedicated build directory:
+
+mkdir -v build
+cd build
+
+
+ In order for the SBU values listed in the rest of the book
+ to be of any use, measure the time it takes to build this package from
+ the configuration, up to and including the first install. To achieve
+ this easily, wrap the commands in a time
+ command like this: time { ./configure ... && ...
+ && make install; }.
+
+
+ Now prepare Binutils for compilation:
+
+../configure --prefix=$LFS/tools \
+ --with-sysroot=$LFS \
+ --target=$LFS_TGT \
+ --disable-nls \
+ --disable-werror
+
+
+ The meaning of the configure options:
+
+
+ --prefix=$LFS/tools
+
+ This tells the configure script to prepare to install the
+ Binutils programs in the $LFS/tools directory.
+
+
+
+
+ --with-sysroot=$LFS
+
+ For cross compilation, this tells the build system to look in
+ $LFS for the target system libraries as needed.
+
+
+
+
+ --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
+ for building a cross linker.
+
+
+
+
+ --disable-nls
+
+ This disables internationalization as i18n is not needed for the
+ temporary tools.
+
+
+
+
+ --disable-werror
+
+ This prevents the build from stopping in the event that there
+ are warnings from the host's compiler.
+
+
+
+
+
+ Continue with compiling the package:
+
+make
+
+ Install the package:
+
+make install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter06/binutils-pass2.xml b/chapter06/binutils-pass2.xml
new file mode 100644
index 000000000..d88bb84e2
--- /dev/null
+++ b/chapter06/binutils-pass2.xml
@@ -0,0 +1,94 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ binutils-pass2
+ &binutils-version;
+ &binutils-url;
+
+
+ Binutils-&binutils-version; - Pass 2
+
+
+ Binutils
+ tools, pass 2
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &binutils-ch5p2-sbu;
+ &binutils-ch5p2-du;
+
+
+
+
+
+
+ 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
+
+
+ The meaning of the new configure options:
+
+
+ --host=$LFS_TGT
+
+ This tells the configure script that we want to build
+ this pass of binutils for the $LFS_TGT machine, using our just
+ built cross-compiler. This prevents the linker from searching
+ through library directories on the host.
+
+
+
+
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter06/bison.xml b/chapter06/bison.xml
index 23b6f0a95..afe84a403 100644
--- a/chapter06/bison.xml
+++ b/chapter06/bison.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,22 +16,25 @@
Bison-&bison-version;
-
+ Bison
+ tools
- The Bison package contains a parser generator.
+ &buildtime;&diskspace;
- &bison-ch6-sbu;
- &bison-ch6-du;
+ &bison-ch5-sbu;
+ &bison-ch5-du;
@@ -39,103 +42,40 @@
Installation of Bison
-
Prepare Bison for compilation:
-./configure --prefix=/usr --docdir=/usr/share/doc/bison-&bison-version;
+./configure --prefix=/usr \
+ --docdir=/usr/share/doc/bison-&bison-version;
-
+
+ --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 (about 5.5 SBU), issue:
-
-make check
-
- Fourteen tests fail in the "Diagnostics" section, probably because of
- missing locales.
-
-
-
Install the package:make install
-
- Contents of Bison
+
+
-
- Installed programs
- Installed library
- Installed directory
-
-
- bison and yacc
- liby.a
- /usr/share/bison
-
-
-
-
- Short Descriptions
-
-
-
-
- bison
-
- Generates, from a series of rules, a program for analyzing the
- structure of text files; Bison is a replacement for Yacc (Yet Another
- Compiler Compiler)
-
- bison
-
-
-
-
-
- yacc
-
- A wrapper for bison, meant for programs that
- still call yacc instead of bison;
- it calls bison with the -y
- option
-
- yacc
-
-
-
-
-
- liby
-
- The Yacc library containing implementations of Yacc-compatible
- yyerror and main functions;
- this library is normally not very useful, but POSIX requires it
-
- liby
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/bzip2.xml b/chapter06/bzip2.xml
index edf2f5bd4..828b7fc0f 100644
--- a/chapter06/bzip2.xml
+++ b/chapter06/bzip2.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,25 +16,25 @@
Bzip2-&bzip2-version;
-
+ Bzip2
+ tools
- The Bzip2 package contains programs for compressing and decompressing
- files. Compressing text files with bzip2 yields a much
- better compression percentage than with the traditional
- gzip.
+ &buildtime;&diskspace;
- &bzip2-ch6-sbu;
- &bzip2-ch6-du;
+ &bzip2-ch5-sbu;
+ &bzip2-ch5-du;
@@ -43,11 +43,13 @@
Installation of Bzip2
- Apply a patch that will install the documentation for this package:
+ Apply a patch that will install the documentation for this
+ package:patch -Np1 -i ../&bzip2-docs-patch;
- The following command ensures installation of symbolic links are relative:
+ The following command ensures installation of symbolic links are
+ relative:sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
@@ -55,9 +57,12 @@
sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
- Prepare Bzip2 for compilation with:
+ 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 CC=$LFS_TGT-gcc -f Makefile-libbz2_so
make clean
@@ -76,174 +81,31 @@ make clean
- Compile and test the package:
+ Compile and test the package with:
-make
+make CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib
- Install the programs:
+ Install the package:
-make PREFIX=/usr install
+make PREFIX=$LFS/usr installInstall the shared bzip2 binary into the
- /bin directory, make
- some necessary symbolic links, and clean up:
+ /bin directory, make some necessary
+ symbolic links, and clean up:
-cp -v bzip2-shared /bin/bzip2
-cp -av libbz2.so* /lib
+cp -v bzip2-shared $LFS/bin/bzip2
+cp -av libbz2.so* $LFS/lib
ln -sv ../../lib/libbz2.so.1.0 $LFS/usr/lib/libbz2.so
-rm -v /usr/bin/{bunzip2,bzcat,bzip2}
-ln -sv bzip2 /bin/bunzip2
-ln -sv bzip2 /bin/bzcat
+rm -v $LFS/usr/bin/{bunzip2,bzcat,bzip2}
+ln -sv bzip2 $LFS/bin/bunzip2
+ln -sv bzip2 $LFS/bin/bzcat
-
- Contents of Bzip2
-
-
- Installed programs
- Installed libraries
- Installed directory
-
-
- bunzip2 (link to bzip2), bzcat (link to bzip2), bzcmp (link to
- bzdiff), bzdiff, bzegrep (link to bzgrep), bzfgrep (link to bzgrep),
- bzgrep, bzip2, bzip2recover, bzless (link to bzmore), and bzmore
- libbz2.{a,so}
- /usr/share/doc/bzip2-&bzip2-version;
-
-
-
-
- Short Descriptions
-
-
-
-
- bunzip2
-
- Decompresses bzipped files
-
- bunzip2
-
-
-
-
-
- bzcat
-
- Decompresses to standard output
-
- bzcat
-
-
-
-
-
- bzcmp
-
- Runs cmp on bzipped files
-
- bzcmp
-
-
-
-
-
- bzdiff
-
- Runs diff on bzipped files
-
- bzdiff
-
-
-
-
-
- bzegrep
-
- Runs egrep on bzipped files
-
- bzegrep
-
-
-
-
-
- bzfgrep
-
- Runs fgrep on bzipped files
-
- bzfgrep
-
-
-
-
-
- bzgrep
-
- Runs grep on bzipped files
-
- bzgrep
-
-
-
-
-
- bzip2
-
- Compresses files using the Burrows-Wheeler block sorting text
- compression algorithm with Huffman coding; the compression rate is
- better than that achieved by more conventional compressors using
- Lempel-Ziv algorithms, like gzip
-
- bzip2
-
-
-
-
-
- bzip2recover
-
- Tries to recover data from damaged bzipped files
-
- bzip2recover
-
-
-
-
-
- bzless
-
- Runs less on bzipped files
-
- bzless
-
-
-
-
-
- bzmore
-
- Runs more on bzipped files
-
- bzmore
-
-
-
-
-
- libbz2
-
- The library implementing lossless, block-sorting data
- compression, using the Burrows-Wheeler algorithm
-
- libbz2
-
-
-
-
-
+
+
+ Details on this package are located in
+
diff --git a/chapter06/changingowner.xml b/chapter06/changingowner.xml
new file mode 100644
index 000000000..43a902821
--- /dev/null
+++ b/chapter06/changingowner.xml
@@ -0,0 +1,41 @@
+
+
+ %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 under $LFS are kept as they are, 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 all
+ the files under $LFS, 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/* directories to
+ user root by running the following
+ command:
+
+chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,lib64,tools}
+
+
diff --git a/chapter06/chapter06.xml b/chapter06/chapter06.xml
index 7fc83b374..eadff3cf7 100644
--- a/chapter06/chapter06.xml
+++ b/chapter06/chapter06.xml
@@ -5,101 +5,30 @@
%general-entities;
]>
-
+
- Installing Basic System Software
+ Cross Compiling Temporary Tools
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
+
+
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/chapter06/chroot.xml b/chapter06/chroot.xml
new file mode 100644
index 000000000..5b6310af7
--- /dev/null
+++ b/chapter06/chroot.xml
@@ -0,0 +1,65 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+ Entering the Chroot Environment
+
+ Now that all the packages which depend on themselves for being built
+ 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:
+
+chroot "$LFS" /usr/bin/env -i \
+ HOME=/root \
+ TERM="$TERM" \
+ PS1='(lfs chroot) \u:\w\$ ' \
+ 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
+ the HOME, TERM, PS1, and
+ PATH variables are set again. The
+ TERM=$TERM construct will set the TERM
+ variable inside chroot to the same value as outside chroot. This variable is
+ needed for programs like vim and less
+ to operate properly. If other variables are needed, such as
+ CFLAGS or CXXFLAGS, this is a good place to set
+ them again.
+
+ From this point on, there is no need to use the
+ 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 is not
+ anymore in the PATH. This means that a temporary tool will no longer be
+ used once its final version is installed. This occurs when the shell does not
+ remember the locations of executed binaries—for this
+ reason, hashing is switched off by passing the +h option
+ to bash.
+
+ Note that the bash prompt will say
+ I have no name! This is normal because the
+ /etc/passwd file has not been created yet.
+
+
+ It is important that all the commands throughout the remainder of this
+ chapter and the following chapters are run from within the chroot
+ environment. If you leave this environment for any reason (rebooting for
+ example), ensure that the virtual kernel filesystems are mounted as
+ explained in and and enter chroot again before continuing
+ with the installation.
+
+
+
diff --git a/chapter06/coreutils.xml b/chapter06/coreutils.xml
index 5a4079d78..378abebff 100644
--- a/chapter06/coreutils.xml
+++ b/chapter06/coreutils.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,23 +16,25 @@
Coreutils-&coreutils-version;
-
+ Coreutils
+ tools
- The Coreutils package contains utilities for showing and setting the
- basic system characteristics.
+ &buildtime;&diskspace;
- &coreutils-ch6-sbu;
- &coreutils-ch6-du;
+ &coreutils-ch5-sbu;
+ &coreutils-ch5-du;
@@ -41,59 +43,23 @@
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,uptimeThe 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,1185 +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:
-
-su tester -c "PATH=$PATH make RUN_EXPENSIVE_TESTS=yes check"
-
-
- Remove the temporary group:
-
-sed -i '/dummy/d' /etc/groupInstall 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/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\"/1 $LFS/usr/share/man/man8/chroot.8
+mv -v $LFS/usr/bin/{head,nice,sleep,touch} $LFS/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
-
-
-
-
- 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
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/createfiles.xml b/chapter06/createfiles.xml
new file mode 100644
index 000000000..aed8d79da
--- /dev/null
+++ b/chapter06/createfiles.xml
@@ -0,0 +1,204 @@
+
+
+ %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
+
+ 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 the next
+ 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 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 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/chapter06/creatingdirs.xml
new file mode 100644
index 000000000..359717ff7
--- /dev/null
+++ b/chapter06/creatingdirs.xml
@@ -0,0 +1,59 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+ Creating Directories
+
+ 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},srv,var}
+install -dv -m 0750 /root
+install -dv -m 1777 /tmp /var/tmp
+mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
+mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
+mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
+mkdir -pv /usr/{,local/}share/man/man{1..8}
+
+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}
+
+ Directories are, by default, created with permission mode 755, but
+ this is not desirable for all directories. In the commands above, two
+ changes are made—one to the home directory of user root, and another to the directories for
+ temporary files.
+
+ The first mode change ensures that not just anybody can enter
+ the /root directory—the
+ same as a normal user would do with his or her home directory. The
+ second mode change makes sure that any user can write to the
+ /tmp and /var/tmp directories, but cannot remove
+ another user's files from them. The latter is prohibited by the so-called
+ sticky bit, the highest bit (1) in the 1777 bit mask.
+
+
+ FHS Compliance Note
+
+ The directory tree is based on the Filesystem Hierarchy Standard
+ (FHS) (available at ). The FHS also specifies
+ the optional existence of some directories such as /usr/local/games and /usr/share/games. We create only the
+ directories that are needed. However, feel free to create these
+ directories.
+
+
+
+
diff --git a/chapter06/dejagnu.xml b/chapter06/dejagnu.xml
new file mode 100644
index 000000000..8f1ab7648
--- /dev/null
+++ b/chapter06/dejagnu.xml
@@ -0,0 +1,96 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ dejagnu
+ &dejagnu-version;
+ &dejagnu-url;
+
+
+ DejaGNU-&dejagnu-version;
+
+
+ DejaGNU
+
+
+
+
+
+ The DejaGnu package contains a framework for running test
+ suites on GNU tools. It is written in expect, which itself
+ uses Tcl (Tool Command Language).
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &dejagnu-ch5-sbu;
+ &dejagnu-ch5-du;
+
+
+
+
+
+
+ Installation of DejaGNU
+
+ Prepare DejaGNU for compilation:
+
+./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
+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:
+
+make check
+
+
+
+
+
+ Contents of DejaGNU
+
+
+ Installed program
+
+
+ runtest
+
+
+
+
+ Short Descriptions
+
+
+
+
+ runtest
+
+ A wrapper script that locates the proper
+ expect shell and then runs DejaGNU
+
+ runtest
+
+
+
+
+
+
+
+
+
diff --git a/chapter06/diffutils.xml b/chapter06/diffutils.xml
index 0d8bd5c77..6594058be 100644
--- a/chapter06/diffutils.xml
+++ b/chapter06/diffutils.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,23 +16,25 @@
Diffutils-&diffutils-version;
-
+ Diffutils
+ tools
- The Diffutils package contains programs that show the differences
- between files or directories.
+ &buildtime;&diskspace;
- &diffutils-ch6-sbu;
- &diffutils-ch6-du;
+ &diffutils-ch5-sbu;
+ &diffutils-ch5-du;
@@ -43,82 +45,23 @@
Prepare Diffutils for compilation:
-./configure --prefix=/usr
+./configure --prefix=/usr --host=$LFS_TGTCompile the package:make
- To test the results, issue:
-
-make check
-
Install the package:
-make install
+make DESTDIR=$LFS 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
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/expect.xml b/chapter06/expect.xml
new file mode 100644
index 000000000..20b227ea5
--- /dev/null
+++ b/chapter06/expect.xml
@@ -0,0 +1,139 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ expect
+ &expect-version;
+ &expect-url;
+
+
+ Expect-&expect-version;
+
+
+ Expect
+
+
+
+
+
+ The Expect package contains tools for
+ automating, via scripted dialogues, interactive applications such as
+ telnet, ftp,
+ passwd, fsck,
+ rlogin, and tip.
+ Expect is also useful for testing these same
+ applications as well as easing all sorts of tasks that are prohibitively
+ difficult with anything else. The DejaGnu
+ framework is written in Expect.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &expect-ch5-sbu;
+ &expect-ch5-du;
+
+
+
+
+
+
+ Installation of Expect
+
+ Prepare Expect for compilation:
+
+
+./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=/usr/lib
+
+ This parameter is needed to tell the
+ configure where the
+ tclConfig.sh is located.
+
+
+
+
+ --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.
+
+
+
+
+
+ Build the package:
+
+make
+
+ Install the package:
+
+make install
+ln -svf expect&expect-version;/libexpect&expect-version;.so /usr/lib
+
+
+
+
+ Contents of Expect
+
+
+ Installed program
+ Installed library
+
+
+ expect
+ libexpect-&expect-lib-version;.so
+
+
+
+
+ Short Descriptions
+
+
+
+
+ expect
+
+ Communicates with other interactive programs according
+ to a script
+
+ expect
+
+
+
+
+
+ libexpect-&expect-lib-version;.so
+
+ Contains functions that allow Expect to be used as a Tcl
+ extension or to be used directly from C or C++ (without Tcl)
+
+ libexpect-&expect-lib-version;
+
+
+
+
+
+
+
+
+
diff --git a/chapter06/file.xml b/chapter06/file.xml
index b5e28f244..83a473b70 100644
--- a/chapter06/file.xml
+++ b/chapter06/file.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,23 +16,25 @@
File-&file-version;
-
+ File
+ tools
- The File package contains a utility for determining the type of a given
- file or files.
+ &buildtime;&diskspace;
- &file-ch6-sbu;
- &file-ch6-du;
+ &file-ch5-sbu;
+ &file-ch5-du;
@@ -43,65 +45,28 @@
Prepare File for compilation:
-./configure --prefix=/usr
+./configure --prefix=/usr \
+ --host=$LFS_TGT
+
Compile the package:make
- To test the results, issue:
-
-make check
-
Install the package:
-make install
+make DESTDIR=$LFS install
-
-
- 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
-
-
-
-
-
+
+
+ Details on this package are located in
diff --git a/chapter06/findutils.xml b/chapter06/findutils.xml
index 37393f0de..bf9f9c62a 100644
--- a/chapter06/findutils.xml
+++ b/chapter06/findutils.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,25 +16,25 @@
Findutils-&findutils-version;
-
+ Findutils
+ tools
- 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).
+ &buildtime;&diskspace;
- &findutils-ch6-sbu;
- &findutils-ch6-du;
+ &findutils-ch5-sbu;
+ &findutils-ch5-du;
@@ -45,116 +45,30 @@
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.
-
-
-
-
+./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
+
+
-
- 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
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/flex.xml b/chapter06/flex.xml
index bd4bd545f..88e263413 100644
--- a/chapter06/flex.xml
+++ b/chapter06/flex.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,23 +16,25 @@
Flex-&flex-version;
-
+ Flex
+ tools
- The Flex package contains a utility for generating programs that
- recognize patterns in text.
+ &buildtime;&diskspace;
- &flex-ch6-sbu;
- &flex-ch6-du;
+ &flex-ch5-sbu;
+ &flex-ch5-du;
@@ -41,108 +43,45 @@
Installation of Flex
-
-
Prepare Flex for compilation:
-
-./configure --prefix=/usr --docdir=/usr/share/doc/flex-&flex-version;
+./configure --prefix=/usr \
+ --docdir=/usr/share/doc/flex-&flex-version;
+
Compile the package:make
- To test the results (about 0.5 SBU), issue:
-
-make check
-
Install the package:make install
- A few programs do not know about flex yet and
- try to run its predecessor, lex. To support those
- programs, create a symbolic link named lex that
- runs flex in lex emulation
- mode:
-
-ln -sv flex /usr/bin/lex
-
-
- Contents of Flex
+
+
-
- Installed programs
- Installed libraries
- Installed directory
-
-
- flex, flex++ (link to flex), and lex (link to flex)
- libfl.so
- /usr/share/doc/flex-&flex-version;
-
-
-
-
- Short Descriptions
-
-
-
-
- flex
-
- A tool for generating programs that recognize patterns in text;
- it allows for the versatility to specify the rules for pattern-finding,
- eradicating the need to develop a specialized program
-
- flex
-
-
-
-
-
- flex++
-
- An extension of flex, is used for generating C++ code
- and classes. It is a symbolic link to flex
-
- flex++
-
-
-
-
-
- lex
-
- A symbolic link that runs flex in
- lex emulation mode
-
- lex
-
-
-
-
-
- libfl
-
- The flex library
-
- libfl
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/gawk.xml b/chapter06/gawk.xml
index b112eb10d..105abdb8e 100644
--- a/chapter06/gawk.xml
+++ b/chapter06/gawk.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,22 +16,25 @@
Gawk-&gawk-version;
-
+ Gawk
+ tools
- The Gawk package contains programs for manipulating text files.
+ &buildtime;&diskspace;
- &gawk-ch6-sbu;
- &gawk-ch6-du;
+ &gawk-ch5-sbu;
+ &gawk-ch5-du;
@@ -46,82 +49,25 @@
Prepare Gawk for compilation:
-./configure --prefix=/usr
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(./config.guess)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;
+make DESTDIR=$LFS install
-
- 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;
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/gcc-pass1.xml b/chapter06/gcc-pass1.xml
new file mode 100644
index 000000000..1bd308f09
--- /dev/null
+++ b/chapter06/gcc-pass1.xml
@@ -0,0 +1,208 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gcc-pass1
+ &gcc-version;
+ &gcc-url;
+
+
+ GCC-&gcc-version; - Pass 1
+
+
+ GCC
+ tools, pass 1
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &gcc-ch5p1-sbu;
+ &gcc-ch5p1-du;
+
+
+
+
+
+
+ Installation of Cross GCC
+
+ 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 (). First extract the gcc tarball from the sources
+ directory and then change to the directory created. Only then should you
+ proceed with the instructions below.
+
+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
+
+ On x86_64 hosts, set 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
+
+ The GCC documentation recommends building GCC
+ in a dedicated build directory:
+
+mkdir -v build
+cd build
+
+ Prepare GCC for compilation:
+
+../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 \
+ --disable-multilib \
+ --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:
+
+
+ --with-glibc-version=2.11
+
+ This option ensures the package will be compatible with the host's
+ version of glibc. It is set to the minimum glibc requirement
+ specified in the .
+
+
+
+
+ --with-newlib
+
+ Since a working C library is not yet available, this ensures
+ that the inhibit_libc constant is defined when building libgcc. This prevents
+ the compiling of any code that requires libc support.
+
+
+
+
+ --without-headers
+
+ When creating a complete cross-compiler, GCC requires
+ standard headers compatible with the target system. For our
+ purposes these headers will not be needed. This switch prevents
+ GCC from looking for them.
+
+
+
+
+ --disable-shared
+
+ This switch forces GCC to link its internal libraries
+ statically. We need this because the shared libraries require glibc,
+ which is not yet installed on the target 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.
+
+
+
+
+ --disable-multilib
+
+ On x86_64, LFS does not yet support a multilib configuration.
+ This switch is harmless for x86.
+
+
+
+
+ --enable-languages=c,c++
+
+ This option ensures that only the C and C++ compilers are built.
+ These are the only languages needed now.
+
+
+
+
+
+ Compile GCC by running:
+
+make
+
+ 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
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter06/gcc-pass2.xml b/chapter06/gcc-pass2.xml
new file mode 100644
index 000000000..7f7d7a021
--- /dev/null
+++ b/chapter06/gcc-pass2.xml
@@ -0,0 +1,160 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gcc-pass2
+ &gcc-version;
+ &gcc-url;
+
+
+ GCC-&gcc-version; - Pass 2
+
+
+ GCC
+ tools, pass 2
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &gcc-ch5p2-sbu;
+ &gcc-ch5p2-du;
+
+
+
+
+
+
+ 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
+
+ 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
+
+ Fix an issue with GCC-10.1 when building with a cross
+ compiler:
+
+patch -Np1 -i ../&gcc-cross-patch;
+
+ Create a separate build directory again:
+
+mkdir -v build
+cd build
+
+ Create a symlink that allos 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++
+
+
+ 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 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
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter06/generalinstructions.xml b/chapter06/generalinstructions.xml
new file mode 100644
index 000000000..05b88b98c
--- /dev/null
+++ b/chapter06/generalinstructions.xml
@@ -0,0 +1,120 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+ General Compilation Instructions
+
+ When building packages there are several assumptions made within
+ the instructions:
+
+
+
+
+ Several of the packages are patched before compilation, but only when
+ the patch is needed to circumvent a problem. A patch is often needed in
+ both this and the next chapter, but sometimes in only one or the other.
+ Therefore, do not be concerned if instructions for a downloaded patch seem
+ to be missing. Warning messages about offset or
+ fuzz may also be encountered when applying a patch. Do
+ not worry about these warnings, as the patch was still successfully
+ applied.
+
+
+
+ During the compilation of most packages, there will be several
+ warnings that scroll by on the screen. These are normal and can safely be
+ ignored. These warnings are as they appear—warnings about
+ deprecated, but not invalid, use of the C or C++ syntax. C standards change
+ fairly often, and some packages still use the older standard. This is not a
+ problem, but does prompt the warning.
+
+
+
+ Check one last time that the LFS environment variable
+ is set up properly:
+
+echo $LFS
+
+ Make sure the output shows the path to the LFS partition's mount
+ point, which is /mnt/lfs, using our
+ example.
+
+
+
+
+ Finally, two important items must be emphasized:
+
+
+
+ The build instructions assume that the , including symbolic links, have
+ been set properly:
+
+
+
+ bash is the shell
+ in use.
+
+ sh is a symbolic
+ link to bash.
+
+ /usr/bin/awk is a
+ symbolic link to gawk.
+
+ /usr/bin/yacc is a
+ symbolic link to bison or a small script that
+ executes bison.
+
+
+
+
+
+ To re-emphasize the build process:
+
+
+
+ Place all the sources and patches in a directory that will be
+ accessible from the chroot environment such as
+ /mnt/lfs/sources/.
+
+
+ Change to the sources directory.
+
+
+ For each package:
+
+
+ Using the tar program, extract the package
+ to be built. In Chapter 5, ensure you are the lfs
+ user when extracting the package.
+
+
+ Change to the directory created when the package was
+ extracted.
+
+
+ Follow the book's instructions for building the package.
+
+
+ Change back to the sources directory.
+
+
+ Delete the extracted source directory unless instructed otherwise.
+
+
+
+
+
+
+
+
+
+
diff --git a/chapter06/gettext.xml b/chapter06/gettext.xml
index 2c4683804..34d0ee32e 100644
--- a/chapter06/gettext.xml
+++ b/chapter06/gettext.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,25 +16,25 @@
Gettext-&gettext-version;
-
+ Gettext
+ tools
- The Gettext package contains utilities for internationalization and
- localization. These allow programs to be compiled with NLS (Native Language
- Support), enabling them to output messages in the user's native
- language.
+ &buildtime;&diskspace;
- &gettext-ch6-sbu;
- &gettext-ch6-du;
+ &gettext-ch5-sbu;
+ &gettext-ch5-du;
@@ -43,402 +43,42 @@
Installation of Gettext
-
-
-
-
-
-
Prepare Gettext for compilation:
-./configure --prefix=/usr \
- --disable-static \
- --docdir=/usr/share/doc/gettext-&gettext-version;
+./configure --disable-shared
+
+
+ The meaning of the configure option:
+
+
+ --disable-shared
+
+ We do not need to install any of the shared Gettext libraries at
+ this time, therefore there is no need to build them.
+
+
+
+ Compile the package:
-make BISON_LOCALEDIR=/usr/share/locale
+make
-
- The meaning of the make parameter:
+ Install the msgfmt, msgmerge and
+ xgettext programs:
-
- BISON_LOCALEDIR=/usr/share/locale
-
- Since bison is not yet installed in /usr, configure hardcodes
- the directory containing translations for the bison program (the
- "locale" directory) as /tools/share/locale. Passing this variable
- to make allows overriding the choice made by configure.
-
-
-
-
-
- To test the results (this takes a long time, around 3 SBUs),
- issue:
-
-make check
-
- Install the package:
-
-make install
-chmod -v 0755 /usr/lib/preloadable_libintl.so
+cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin
-
- Contents of Gettext
+
+
-
- Installed programs
- Installed libraries
- Installed directories
-
-
- autopoint, envsubst, gettext, gettext.sh,
- gettextize, msgattrib, msgcat, msgcmp, msgcomm, msgconv, msgen,
- msgexec, msgfilter, msgfmt, msggrep, msginit, msgmerge, msgunfmt, msguniq,
- ngettext, recode-sr-latin, and xgettext
- libasprintf.so, libgettextlib.so, libgettextpo.so,
- libgettextsrc.so, libtextstyle.so, and preloadable_libintl.so
- /usr/lib/gettext, /usr/share/doc/gettext-&gettext-version;,
- /usr/share/gettext, and /usr/share/gettext-0.19.8
-
-
-
-
- Short Descriptions
-
-
-
-
- autopoint
-
- Copies standard Gettext infrastructure files into a source
- package
-
- autopoint
-
-
-
-
-
- envsubst
-
- Substitutes environment variables in shell format strings
-
- envsubst
-
-
-
-
-
- gettext
-
- Translates a natural language message into the user's language
- by looking up the translation in a message catalog
-
- gettext
-
-
-
-
-
- gettext.sh
-
- Primarily serves as a shell function library for gettext
-
- gettext.sh
-
-
-
-
-
- gettextize
-
- Copies all standard Gettext files into the given top-level
- directory of a package to begin internationalizing it
-
- gettextize
-
-
-
-
-
- msgattrib
-
- Filters the messages of a translation catalog according to their
- attributes and manipulates the attributes
-
- msgattrib
-
-
-
-
-
- msgcat
-
- Concatenates and merges the given
- .po files
-
- msgcat
-
-
-
-
-
- msgcmp
-
- Compares two .po
- files to check that both contain the same set of msgid strings
-
- msgcmp
-
-
-
-
-
- msgcomm
-
- Finds the messages that are common to the given
- .po files
-
- msgcomm
-
-
-
-
-
- msgconv
-
- Converts a translation catalog to a different character
- encoding
-
- msgconv
-
-
-
-
-
- msgen
-
- Creates an English translation catalog
-
- msgen
-
-
-
-
-
- msgexec
-
- Applies a command to all translations of a translation
- catalog
-
- msgexec
-
-
-
-
-
- msgfilter
-
- Applies a filter to all translations of a translation
- catalog
-
- msgfilter
-
-
-
-
-
- msgfmt
-
- Generates a binary message catalog from a translation
- catalog
-
- msgfmt
-
-
-
-
-
- msggrep
-
- Extracts all messages of a translation catalog that match a
- given pattern or belong to some given source files
-
- msggrep
-
-
-
-
-
- msginit
-
- Creates a new .po file,
- initializing the meta information with values from the user's
- environment
-
- msginit
-
-
-
-
-
- msgmerge
-
- Combines two raw translations into a single file
-
- msgmerge
-
-
-
-
-
- msgunfmt
-
- Decompiles a binary message catalog into raw translation
- text
-
- msgunfmt
-
-
-
-
-
- msguniq
-
- Unifies duplicate translations in a translation catalog
-
- msguniq
-
-
-
-
-
- ngettext
-
- Displays native language translations of a textual message whose
- grammatical form depends on a number
-
- ngettext
-
-
-
-
-
- recode-sr-latin
-
- Recodes Serbian text from Cyrillic to Latin script
-
- recode-sr-latin
-
-
-
-
-
- xgettext
-
- Extracts the translatable message lines from the given source
- files to make the first translation template
-
- xgettext
-
-
-
-
-
- libasprintf
-
- defines the autosprintf class, which makes
- C formatted output routines usable in C++ programs, for use with the
- <string> strings and the
- <iostream> streams
-
- libasprintf
-
-
-
-
-
- libgettextlib
-
- a private library containing common routines used by the
- various Gettext programs; these are not intended for general use
-
- libgettextlib
-
-
-
-
-
- libgettextpo
-
- Used to write specialized programs that process
- .po files; this library is
- used when the standard applications shipped with Gettext (such as
- msgcomm, msgcmp,
- msgattrib, and msgen) will
- not suffice
-
- libgettextpo
-
-
-
-
-
- libgettextsrc
-
- A private library containing common routines used by the
- various Gettext programs; these are not intended for general use
-
- libgettextsrc
-
-
-
-
-
- libtextstyle
-
- Text styling library
-
- libtextstyle
-
-
-
-
-
- preloadable_libintl
-
- A library, intended to be used by LD_PRELOAD that assists
- libintl in logging
- untranslated messages
-
- preloadable_libintl
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/glibc.xml b/chapter06/glibc.xml
index a422c8d3c..5213c23e5 100644
--- a/chapter06/glibc.xml
+++ b/chapter06/glibc.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,25 +16,25 @@
Glibc-&glibc-version;
-
+ Glibc
+ tools
- The Glibc package contains the main C library. This library provides
- the basic routines for allocating memory, searching directories, opening and
- closing files, reading and writing files, string handling, pattern matching,
- arithmetic, and so on.
+ &buildtime;&diskspace;
- &glibc-ch6-sbu;
- &glibc-ch6-du;
+ &glibc-ch5-sbu;
+ &glibc-ch5-du;
@@ -43,928 +43,188 @@
Installation of Glibc
+ First, create two symbolic links, which are needed 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:
+ /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;
-
-
The Glibc documentation recommends building Glibc
in a dedicated build directory:mkdir -v build
cd build
- Prepare Glibc for compilation:
+ Next, prepare Glibc for compilation:
+
+../configure \
+ --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(../scripts/config.guess) \
+ --enable-kernel=&min-kernel; \
+ --with-headers=$LFS/usr/include \
+ libc_cv_slibdir=/lib
+
-../configure --prefix=/usr \
- --disable-werror \
- --enable-kernel=&min-kernel; \
- --enable-stack-protector=strong \
- --with-headers=/usr/include \
- libc_cv_slibdir=/lib
-
- The meaning of the options and new configure parameters:
+ The meaning of the configure options:
- CC="gcc -ffile-prefix-map=$LFS_DIR=$DIR"
+ --host=$LFS_TGT, --build=$(../scripts/config.guess)
- Make GCC record any references to files in /usr/lib/gcc/x86_64-lfs-linux-gnu
- in result of the compilation as if the files resided in /usr/lib/gcc/x86_64-pc-linux-gnu.
- This avoids introduction of invalid paths in debugging
- symbols.
+ The combined effect of these switches is that Glibc's build system
+ configures itself to be cross-compiled, using the cross-linker and
+ cross-compiler in /tools.
- --disable-werror
+ --enable-kernel=&min-kernel;
- This option disables the -Werror option passed to
- GCC. This is necessary for running the test suite.
+ This tells Glibc to compile the library with support
+ for &min-kernel; and later Linux kernels. Workarounds for older
+ kernels are not enabled.
- --enable-stack-protector=strong
+ --with-headers=$LFS/usr/include
- This option increases system security by adding
- extra code to check for buffer overflows, such as stack
- smashing attacks.
-
-
-
-
- --with-headers=/usr/include
-
- This option tells the build system where to find the
- kernel API headers.
+ This tells Glibc to compile itself against the headers recently
+ installed to the usr/include directory, so that it knows exactly what
+ features the kernel has and can optimize itself accordingly.libc_cv_slibdir=/lib
- This variable sets the correct library for all
- systems. We do not want lib64 to be used.
+ This ensures that the library is installed in /lib instead
+ of the default /lib64 on 64 bit machines.
+
+
+
+
+ During this stage the following warning might appear:
+
+
+configure: WARNING:
+*** These auxiliary programs are missing or
+*** incompatible versions: msgfmt
+*** some features will be disabled.
+*** Check the INSTALL file for required versions.
+
+
+ The missing or incompatible msgfmt program is
+ generally harmless. This msgfmt program is part of the
+ Gettext package which the host distribution should provide.
+
+ There have been reports that this package may fail when
+ building as a "parallel make". If this occurs, rerun the make command
+ with a "-j1" option.
+
Compile the package:make
-
- In this section, the test suite for Glibc is considered critical.
- Do not skip it under any circumstance.
-
-
- Generally a few tests do not pass. The test failures listed below
- are usually safe to ignore.
-
-
-case $(uname -m) in
- i?86) ln -sfnv $PWD/elf/ld-linux.so.2 /lib ;;
- x86_64) ln -sfnv $PWD/elf/ld-linux-x86-64.so.2 /lib ;;
-esac
-
- The symbolic link above is needed to run the tests at this
- stage of building in the chroot environment. It will be overwritten
- in the install phase below.
-
-make check
-
- You may see some test failures. The Glibc test suite is
- somewhat dependent on the host system. This is a list of the most common
- issues seen for some versions of LFS:
-
-
-
-
- misc/tst-ttyname
- is known to fail in the LFS chroot environment.
-
-
-
- inet/tst-idna_name_classify
- is known to fail in the LFS chroot environment.
-
-
-
- posix/tst-getaddrinfo4 and
- posix/tst-getaddrinfo5
- may fail on some architectures.
-
-
-
- The nss/tst-nss-files-hosts-multi
- test may fail for reasons that have not been determined.
-
-
-
- The rt/tst-cputimer{1,2,3} tests depend on
- the host system kernel. Kernels 4.14.91–4.14.96,
- 4.19.13–4.19.18, and 4.20.0–4.20.5 are known to
- cause these tests to fail.
-
-
-
-
- The math tests sometimes fail when running on
- 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
- complain about the absence of /etc/ld.so.conf.
- Prevent this warning with:
-
-touch /etc/ld.so.conf
-
- Fix the generated Makefile to skip an unneeded sanity check
- that fails in the LFS partial environment:
-
-
-sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
-
Install the package:
-make install
-
- Install the configuration file and runtime directory for
- nscd:
-
-cp -v ../nscd/nscd.conf /etc/nscd.conf
-mkdir -pv /var/cache/nscd
-
- Install the systemd support files for
- nscd:
-
- install -v -Dm644 ../nscd/nscd.tmpfiles /usr/lib/tmpfiles.d/nscd.conf
-install -v -Dm644 ../nscd/nscd.service /lib/systemd/system/nscd.service
-
- Next, install the locales that can make the system respond in a
- different language. None of the locales are required, but if some of them
- are missing, the test suites of future packages would skip important
- testcases.
-
- Individual locales can be installed using the
- localedef program. E.g., the first
- localedef command below combines the
- /usr/share/i18n/locales/cs_CZ
- charset-independent locale definition with the
- /usr/share/i18n/charmaps/UTF-8.gz
- charmap definition and appends the result to the
- /usr/lib/locale/locale-archive file.
- The following instructions will install the minimum set of
- locales necessary for the optimal coverage of tests:
-
-mkdir -pv /usr/lib/locale
-localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true
-localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8
-localedef -i de_DE -f ISO-8859-1 de_DE
-localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
-localedef -i de_DE -f UTF-8 de_DE.UTF-8
-localedef -i el_GR -f ISO-8859-7 el_GR
-localedef -i en_GB -f UTF-8 en_GB.UTF-8
-localedef -i en_HK -f ISO-8859-1 en_HK
-localedef -i en_PH -f ISO-8859-1 en_PH
-localedef -i en_US -f ISO-8859-1 en_US
-localedef -i en_US -f UTF-8 en_US.UTF-8
-localedef -i es_MX -f ISO-8859-1 es_MX
-localedef -i fa_IR -f UTF-8 fa_IR
-localedef -i fr_FR -f ISO-8859-1 fr_FR
-localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
-localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
-localedef -i it_IT -f ISO-8859-1 it_IT
-localedef -i it_IT -f UTF-8 it_IT.UTF-8
-localedef -i ja_JP -f EUC-JP ja_JP
-localedef -i ja_JP -f SHIFT_JIS ja_JP.SIJS 2> /dev/null || true
-localedef -i ja_JP -f UTF-8 ja_JP.UTF-8
-localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R
-localedef -i ru_RU -f UTF-8 ru_RU.UTF-8
-localedef -i tr_TR -f UTF-8 tr_TR.UTF-8
-localedef -i zh_CN -f GB18030 zh_CN.GB18030
-localedef -i zh_HK -f BIG5-HKSCS zh_HK.BIG5-HKSCS
-
- In addition, install the locale for your own country, language and
- character set.
-
- Alternatively, install all locales listed in the
- glibc-&glibc-version;/localedata/SUPPORTED file
- (it includes every locale listed above and many more) at once with the
- following time-consuming command:
-
-make localedata/install-locales
-
- Then use the localedef command to create and
- install locales not listed in the
- glibc-&glibc-version;/localedata/SUPPORTED file
- in the unlikely case you need them.
-
- Glibc now uses libidn2 when resolving internationalized
- domain names. This is a run time dependency. If this capability
- is needed, the instructions for installing libidn2 are in the
- BLFS libidn2 page.
-
-
-
-
-
- Configuring Glibc
-
-
- /etc/nsswitch.conf
-
-
-
- /etc/localtime
-
-
-
- Adding nsswitch.conf
-
- The /etc/nsswitch.conf file needs to be created
- because the Glibc defaults do not work well in a networked environment.
-
-
- Create a new file /etc/nsswitch.conf by running the
- following:
-
-cat > /etc/nsswitch.conf << "EOF"
-# Begin /etc/nsswitch.conf
-
-passwd: files
-group: files
-shadow: files
-
-hosts: files dns
-networks: files
-
-protocols: files
-services: files
-ethers: files
-rpc: files
-
-# End /etc/nsswitch.conf
-EOF
-
-
-
-
- Adding time zone data
-
- Install and set up the time zone data with the following:
-tar -xf ../../tzdata&tzdata-version;.tar.gz
-
-ZONEINFO=/usr/share/zoneinfo
-mkdir -pv $ZONEINFO/{posix,right}
-
-for tz in etcetera southamerica northamerica europe africa antarctica \
- asia australasia backward pacificnew systemv; do
- zic -L /dev/null -d $ZONEINFO ${tz}
- zic -L /dev/null -d $ZONEINFO/posix ${tz}
- zic -L leapseconds -d $ZONEINFO/right ${tz}
-done
-
-cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO
-zic -d $ZONEINFO -p America/New_York
-unset ZONEINFO
+make DESTDIR=$LFS install
- The meaning of the zic commands:
+ The meaning of the make install option:
- zic -L /dev/null ...
+ DESTDIR=$LFS
- This creates posix time zones, without any leap seconds. It is
- conventional to put these in both
- zoneinfo and
- zoneinfo/posix. It is
- necessary to put the POSIX time zones in
- zoneinfo, otherwise various
- test-suites will report errors. On an embedded system, where space is
- tight and you do not intend to ever update the time zones, you could save
- 1.9MB by not using the posix
- directory, but some applications or test-suites might produce some
- failures.
-
-
-
- zic -L leapseconds ...
-
- This creates right time zones, including leap seconds. On an
- embedded system, where space is tight and you do not intend to
- ever update the time zones, or care about the correct time, you could
- save 1.9MB by omitting the right
- directory.
-
-
-
- zic ... -p ...
-
- This creates the posixrules file. We use
- New York because POSIX requires the daylight savings time rules
- to be in accordance with US rules.
-
-
-
-
-
- One way to determine the local time zone is to run the following
- script:
-
-tzselect
-
- After answering a few questions about the location, the script will
- output the name of the time zone (e.g.,
- America/Edmonton). There are also some other possible
- time zones listed in /usr/share/zoneinfo such as
- Canada/Eastern or EST5EDT that
- are not identified by the script but can be used.
-
- Then create the /etc/localtime file by
- running:
-
-ln -sfv /usr/share/zoneinfo/<xxx> /etc/localtime
-
- Replace <xxx> with the name of the
- time zone selected (e.g., Canada/Eastern).
-
-
-
-
- Configuring the Dynamic Loader
-
-
- /etc/ld.so.conf
-
-
- By default, the dynamic loader (/lib/ld-linux.so.2) searches through
- /lib and /usr/lib for dynamic libraries that are
- needed by programs as they are run. However, if there are libraries in
- directories other than /lib and
- /usr/lib, these need to be added
- to the /etc/ld.so.conf file in order for the
- dynamic loader to find them. Two directories that are commonly known
- to contain additional libraries are /usr/local/lib and /opt/lib, so add those directories to the
- dynamic loader's search path.
-
- Create a new file /etc/ld.so.conf by running the
- following:
-
-cat > /etc/ld.so.conf << "EOF"
-# Begin /etc/ld.so.conf
-/usr/local/lib
-/opt/lib
-
-EOF
-
- 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
-
-
-
-
-
- Contents of Glibc
-
-
- Installed programs
- Installed libraries
- Installed directories
-
-
- catchsegv, gencat, getconf, getent, iconv, iconvconfig, ldconfig,
- ldd, lddlibc4, locale, localedef, makedb, mtrace, nscd,
- pcprofiledump, pldd, sln, sotruss, sprof, tzselect, xtrace,
- zdump, and zic
- ld-&glibc-version;.so, libBrokenLocale.{a,so}, libSegFault.so, libanl.{a,so},
- libc.{a,so}, libc_nonshared.a,
- libcrypt.{a,so}, libdl.{a,so}, libg.a, libm.{a,so},
- libmcheck.a, libmemusage.so, libmvec.{a,so}, libnsl.{a,so},
- libnss_compat.so, libnss_dns.so, libnss_files.so, libnss_hesiod.so,
- libpcprofile.so, libpthread.{a,so},
- libpthread_nonshared.a, libresolv.{a,so}, librt.{a,so},
- libthread_db.so, and libutil.{a,so}
- /usr/include/arpa, /usr/include/bits, /usr/include/gnu,
- /usr/include/net, /usr/include/netash, /usr/include/netatalk,
- /usr/include/netax25, /usr/include/neteconet, /usr/include/netinet,
- /usr/include/netipx, /usr/include/netiucv, /usr/include/netpacket,
- /usr/include/netrom, /usr/include/netrose, /usr/include/nfs,
- /usr/include/protocols, /usr/include/rpc,
- /usr/include/sys, /usr/lib/audit, /usr/lib/gconv, /usr/lib/locale,
- /usr/libexec/getconf, /usr/share/i18n, /usr/share/zoneinfo,
- /var/cache/nscd, and /var/lib/nss_db
-
-
-
-
- Short Descriptions
-
-
-
-
- catchsegv
-
- Can be used to create a stack trace when a program
- terminates with a segmentation fault
-
- catchsegv
-
-
-
-
-
- gencat
-
- Generates message catalogues
-
- gencat
-
-
-
-
-
- getconf
-
- Displays the system configuration values for file system
- specific variables
-
- getconf
-
-
-
-
-
- getent
-
- Gets entries from an administrative database
-
- getent
-
-
-
-
-
- iconv
-
- Performs character set conversion
-
- iconv
-
-
-
-
-
- iconvconfig
-
- Creates fastloading iconv module configuration
- files
-
- iconvconfig
-
-
-
-
-
- ldconfig
-
- Configures the dynamic linker runtime bindings
-
- ldconfig
-
-
-
-
-
- ldd
-
- Reports which shared libraries are required
- by each given program or shared library
-
- ldd
-
-
-
-
-
- lddlibc4
-
- Assists ldd with object files
-
- lddlibc4
-
-
-
-
-
- locale
-
- Prints various information about the current locale
-
- locale
-
-
-
-
-
- localedef
-
- Compiles locale specifications
-
- localedef
-
-
-
-
-
- makedb
-
- Creates a simple database from textual input
-
- makedb
-
-
-
-
-
- mtrace
-
- Reads and interprets a memory trace file and displays a summary
- in human-readable format
-
- mtrace
-
-
-
-
-
- nscd
-
- A daemon that provides a cache for the most common name
- service requests
-
- nscd
-
-
-
-
-
- pcprofiledump
-
- Dump information generated by PC profiling
-
- pcprofiledump
-
-
-
-
-
- pldd
-
- Lists dynamic shared objects used by running processes
-
- pldd
-
-
-
-
-
- sln
-
- A statically linked ln program
-
- sln
-
-
-
-
-
- sotruss
-
- Traces shared library procedure calls of a specified command
-
- sotruss
-
-
-
-
-
- sprof
-
- Reads and displays shared object profiling data
-
- sprof
-
-
-
-
-
- tzselect
-
- Asks the user about the location of the system and reports
- the corresponding time zone description
-
- tzselect
-
-
-
-
-
- xtrace
-
- Traces the execution of a program by printing the currently
- executed function
-
- xtrace
-
-
-
-
-
- zdump
-
- The time zone dumper
-
- zdump
-
-
-
-
-
- zic
-
- The time zone compiler
-
- zic
-
-
-
-
-
- ld-&glibc-version;.so
-
- The helper program for shared library executables
-
- ld-&glibc-version;.so
-
-
-
-
-
- libBrokenLocale
-
- Used internally by Glibc as a gross hack to get broken programs
- (e.g., some Motif applications) running. See comments in
- glibc-&glibc-version;/locale/broken_cur_max.c
- for more information
-
- libBrokenLocale
-
-
-
-
-
- libSegFault
-
- The segmentation fault signal handler, used by
- catchsegv
-
- libSegFault
-
-
-
-
-
- libanl
-
- An asynchronous name lookup library
-
- libanl
-
-
-
-
-
- libc
-
- The main C library
-
- libc
-
-
-
-
-
- libcrypt
-
- The cryptography library
-
- libcrypt
-
-
-
-
-
- libdl
-
- The dynamic linking interface library
-
- libdl
-
-
-
-
-
- libg
-
- Dummy library containing no functions. Previously was a runtime
- library for g++
-
- libg
-
-
-
-
-
- libm
-
- The mathematical library
-
- libm
-
-
-
-
-
- libmcheck
-
- Turns on memory allocation checking when linked to
-
- libmcheck
-
-
-
-
-
- libmemusage
-
- Used by memusage to help collect
- information about the memory usage of a program
-
- libmemusage
-
-
-
-
-
- libnsl
-
- The network services library
-
- libnsl
-
-
-
-
-
- libnss
-
- The Name Service Switch libraries, containing functions for
- resolving host names, user names, group names, aliases, services,
- protocols, etc.
-
- libnss
-
-
-
-
-
- libpcprofile
-
- Can be preloaded to PC profile an executable
-
- libpcprofile
-
-
-
-
-
- libpthread
-
- The POSIX threads library
-
- libpthread
-
-
-
-
-
- libresolv
-
- Contains functions for creating, sending, and interpreting
- packets to the Internet domain name servers
-
- libresolv
-
-
-
-
-
- librt
-
- Contains functions providing most of the interfaces specified
- by the POSIX.1b Realtime Extension
-
- librt
-
-
-
-
-
- libthread_db
-
- Contains functions useful for building debuggers for
- multi-threaded programs
-
- libthread_db
-
-
-
-
-
- libutil
-
- Contains code for standard functions used in
- many different Unix utilities
-
- libutil
-
+ 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 '/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: /lib64/ld-linux-x86-64.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.
+
+ Once all is well, clean up the test files:
+
+rm -v dummy.c a.out
+
+
+
+ Building packages in the next sections 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 an utility provided by the GCC
+ developers:
+
+$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders
+
+
+
+
+
+
+ Details on this package are located in
+
+
diff --git a/chapter06/grep.xml b/chapter06/grep.xml
index 58b0db366..6a8ada4b8 100644
--- a/chapter06/grep.xml
+++ b/chapter06/grep.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,22 +16,25 @@
Grep-&grep-version;
-
+ Grep
+ tools
- The Grep package contains programs for searching through files.
+ &buildtime;&diskspace;
- &grep-ch6-sbu;
- &grep-ch6-du;
+ &grep-ch5-sbu;
+ &grep-ch5-du;
@@ -42,69 +45,25 @@
Prepare Grep for compilation:
-./configure --prefix=/usr --bindir=/bin
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --bindir=/binCompile the package:make
- To test the results, issue:
-
-make check
-
Install the package:
-make install
+make DESTDIR=$LFS 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
-
-
-
-
-
+ Details on this package are located in
+
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 @@
-
-
- %general-entities;
-]>
-
-
-
-
-
- grub
- &grub-version;
- &grub-url;
-
-
- GRUB-&grub-version;
-
-
- GRUB
-
-
-
-
-
- The GRUB package contains the GRand Unified Bootloader.
-
-
- &buildtime;
- &diskspace;
-
-
- &grub-ch6-sbu;
- &grub-ch6-du;
-
-
-
-
-
-
- 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..e5b5d0a37 100644
--- a/chapter06/gzip.xml
+++ b/chapter06/gzip.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,23 +16,25 @@
Gzip-&gzip-version;
-
+ Gzip
+ tools
- The Gzip package contains programs for compressing and decompressing
- files.
+ &buildtime;&diskspace;
- &gzip-ch6-sbu;
- &gzip-ch6-du;
+ &gzip-ch5-sbu;
+ &gzip-ch5-du;
@@ -43,193 +45,27 @@
Prepare Gzip for compilation:
-./configure --prefix=/usr
+./configure --prefix=/usr --host=$LFS_TGTCompile the package:make
- To test the results, issue:
-
-make check
-
- Two tests are known to fail in the LFS environment:
- help-version and zmore.
-
Install the package:
-make install
+make DESTDIR=$LFS install
- Move a program that needs to be on the root filesystem:
+ Move the excutable to its final expected location:
-mv -v /usr/bin/gzip /bin
+mv -v $LFS/usr/bin/gzip $LFS/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
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/introduction.xml b/chapter06/introduction.xml
index c8ccb3908..5614270b2 100644
--- a/chapter06/introduction.xml
+++ b/chapter06/introduction.xml
@@ -5,70 +5,25 @@
%general-entities;
]>
-
+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.
-
- 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 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.
-
-
+ 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.
+ 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.
+
diff --git a/chapter06/kernfs.xml b/chapter06/kernfs.xml
new file mode 100644
index 000000000..dd6b8991c
--- /dev/null
+++ b/chapter06/kernfs.xml
@@ -0,0 +1,115 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+ Preparing Virtual Kernel File Systems
+
+
+ /dev/*
+
+
+ Various file systems exported by the kernel are used to communicate to
+ and from the kernel itself. These file systems are virtual in that no disk
+ space is used for them. The content of the file systems resides in
+ memory.
+
+ Begin by creating directories onto which the file systems will be
+ mounted:
+
+mkdir -pv $LFS/{dev,proc,sys,run}
+
+
+ Creating Initial Device Nodes
+
+ 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
+ init=/bin/bash. Create the devices by running the
+ following commands:
+
+mknod -m 600 $LFS/dev/console c 5 1
+mknod -m 666 $LFS/dev/null c 1 3
+
+
+
+
+ Mounting and Populating /dev
+
+ The recommended method of populating the /dev directory with devices is to mount a
+ virtual filesystem (such as tmpfs) on the /dev directory, and allow the devices to be
+ created dynamically on that virtual filesystem as they are detected or
+ accessed. Device creation is generally done during the boot process
+ by Udev. Since this new system does not yet have Udev and has not yet
+ been booted, it is necessary to mount and populate /dev manually. This is accomplished by bind
+ mounting the host system's /dev
+ directory. A bind mount is a special type of mount that allows you to
+ create a mirror of a directory or mount point to some other location. Use
+ the following command to achieve this:
+
+mount -v --bind /dev $LFS/dev
+
+
+
+
+ Mounting Virtual Kernel File Systems
+
+ Now mount the remaining virtual kernel filesystems:
+
+mount -v --bind /dev/pts $LFS/dev/pts
+mount -vt proc proc $LFS/proc
+mount -vt sysfs sysfs $LFS/sys
+mount -vt tmpfs tmpfs $LFS/run
+
+
+ The meaning of the mount options for devpts:
+
+
+ gid=5
+
+ This ensures that all devpts-created device nodes are owned by
+ group ID 5. This is the ID we will use later on for the tty group. We use the group ID instead
+ of a name, since the host system might use a different ID for its
+ tty group.
+
+
+
+
+ mode=0620
+
+ This ensures that all devpts-created device nodes have mode 0620
+ (user readable and writable, group writable). Together with the
+ option above, this ensures that devpts will create device nodes that
+ meet the requirements of grantpt(), meaning the Glibc
+ pt_chown helper binary (which is not installed by
+ default) is not necessary.
+
+
+
+
+
+ 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
+ directory needs to be created.
+
+if [ -h $LFS/dev/shm ]; then
+ mkdir -pv $LFS/$(readlink $LFS/dev/shm)
+fi
+
+
+
+
diff --git a/chapter06/libstdc++-pass2.xml b/chapter06/libstdc++-pass2.xml
new file mode 100644
index 000000000..999a4fa4e
--- /dev/null
+++ b/chapter06/libstdc++-pass2.xml
@@ -0,0 +1,114 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gcc-libstdc++
+ &gcc-version;
+ &gcc-url;
+
+
+ Libstdc++ from GCC-&gcc-version;, Pass 2
+
+
+ GCC
+ tools, libstdc++ pass 2
+
+
+
+
+
+ Again, when building , 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
+ installed, because this compiler is a native
+ compiler, and should not be used outside of chroot without being at
+ risk of polluting the build with some host components.
+
+
+ &buildtime;
+ &diskspace;
+
+
+
+ &libstdcpp-ch5-sbu;
+ &libstdcpp-ch5-du;
+
+
+
+
+
+
+ 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
+
+
+ The meaning of the configure options:
+
+
+ CXXFLAGS="-g -O2 -D_GNU_SOURCE"
+
+ Those 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.
+
+
+
+
+
+ Compile libstdc++ by running:
+
+make
+
+ Install the library:
+
+make install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter06/libstdc++.xml b/chapter06/libstdc++.xml
new file mode 100644
index 000000000..3a1b0f2bf
--- /dev/null
+++ b/chapter06/libstdc++.xml
@@ -0,0 +1,122 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gcc-libstdc++
+ &gcc-version;
+ &gcc-url;
+
+
+ Libstdc++ from GCC-&gcc-version;, Pass 1
+
+
+ GCC
+ tools, libstdc++ pass 1
+
+
+
+
+
+ Libstdc++ is the standard C++ library. It is needed
+ 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 the target
+ directory.
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &libstdcpp-ch5-sbu;
+ &libstdcpp-ch5-du;
+
+
+
+
+
+
+ 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 separate build directory for Libstdc++ and enter it:
+
+mkdir -v build
+cd build
+
+ Prepare Libstdc++ for compilation:
+
+../libstdc++-v3/configure \
+ --host=$LFS_TGT \
+ --build=$(../config.guess) \
+ --prefix=/usr \
+ --disable-multilib \
+ --disable-nls \
+ --disable-libstdcxx-pch \
+ --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;
+
+
+ The meaning of the configure options:
+
+
+ --host=...
+
+ Indicates to use the cross compiler we have just built
+ instead of the one in /usr/bin.
+
+
+
+
+ --disable-libstdcxx-pch
+
+ This switch prevents the installation of precompiled
+ include files, which are not needed at this stage.
+
+
+
+
+ --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
+ options from the top level directory. In our case, this information
+ must be explicitly given.
+
+
+
+
+
+ Compile libstdc++ by running:
+
+make
+
+ Install the library:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter06/linux-headers.xml b/chapter06/linux-headers.xml
new file mode 100644
index 000000000..6c1af3173
--- /dev/null
+++ b/chapter06/linux-headers.xml
@@ -0,0 +1,207 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ linux-headers
+ &linux-version;
+ &linux-url;
+
+
+ Linux-&linux-version; API Headers
+
+
+ Linux
+ tools, API headers
+
+
+
+
+
+ The Linux API Headers (in linux-&linux-version;.tar.xz) expose the
+ kernel's API for use by Glibc.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &linux-headers-ch5-sbu;
+ &linux-headers-ch5-du;
+
+
+
+
+
+
+ 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 embedded in the package:
+
+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 may not
+ be available. The headers are first placed in
+ ./usr, then copied to the needed
+ location.
+
+make headers
+find usr/include -name '.*' -delete
+rm usr/include/Makefile
+cp -rv usr/include $LFS/usr
+
+
+
+
+ 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..79559f6da 100644
--- a/chapter06/m4.xml
+++ b/chapter06/m4.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,22 +16,25 @@
M4-&m4-version;
-
+ M4
+ tools
- The M4 package contains a macro processor.
+ &buildtime;&diskspace;
- &m4-ch6-sbu;
- &m4-ch6-du;
+ &m4-ch5-sbu;
+ &m4-ch5-du;
@@ -40,64 +43,31 @@
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.hPrepare 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
-
-
-
-
-
+
+
+ Details on this package are located in
+
diff --git a/chapter06/make.xml b/chapter06/make.xml
index 9c649cdc5..fef5555aa 100644
--- a/chapter06/make.xml
+++ b/chapter06/make.xml
@@ -4,8 +4,7 @@
%general-entities;
]>
-
-
+
@@ -16,22 +15,25 @@
Make-&make-version;
-
+ Make
+ tools
- The Make package contains a program for compiling packages.
+ &buildtime;&diskspace;
- &make-ch6-sbu;
- &make-ch6-du;
+ &make-ch5-sbu;
+ &make-ch5-du;
@@ -39,60 +41,42 @@
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
+
+
-
- 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 b37f1f69c..93cf85263 100644
--- a/chapter06/ncurses.xml
+++ b/chapter06/ncurses.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,23 +16,25 @@
Ncurses-&ncurses-version;
-
+ Ncurses
+ tools
- The Ncurses package contains libraries for terminal-independent
- handling of character screens.
+ &buildtime;&diskspace;
- &ncurses-ch6-sbu;
- &ncurses-ch6-du;
+ &ncurses-ch5-sbu;
+ &ncurses-ch5-du;
@@ -41,23 +43,45 @@
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
+cd build
+../configure
+make -C include
+make -C progs tic
+cd ..Prepare Ncurses for compilation:
-./configure --prefix=/usr \
- --mandir=/usr/share/man \
- --with-shared \
- --without-debug \
- --without-normal \
- --enable-pc-files \
- --enable-widec
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(./config.guess) \
+ --mandir=/usr/share/man \
+ --with-shared \
+ --without-debug \
+ --without-ada \
+ --without-normal \
+ --enable-widec \
+ --enable-pc-filesThe meaning of the new 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-widec
@@ -87,293 +111,46 @@
-
+
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.soMove 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/libBecause 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
+ln -sfv ../../lib/$(readlink $LFS/usr/lib/libncursesw.so) $LFS/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
-
-
- 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..ecd5b2c47 100644
--- a/chapter06/patch.xml
+++ b/chapter06/patch.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,24 +16,25 @@
Patch-&patch-version;
-
+ Patch
+ tools
- The Patch package contains a program for modifying or creating files
- by applying a patch file typically created by the
- diff program.
+ &buildtime;&diskspace;
- &patch-ch6-sbu;
- &patch-ch6-du;
+ &patch-ch5-sbu;
+ &patch-ch5-du;
@@ -44,52 +45,25 @@
Prepare Patch 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 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
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/perl.xml b/chapter06/perl.xml
index 284464d87..663d3dbc2 100644
--- a/chapter06/perl.xml
+++ b/chapter06/perl.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,23 +16,25 @@
Perl-&perl-version;
-
+ Perl
+ tools
- The Perl package contains the Practical Extraction and Report
- Language.
+ &buildtime;&diskspace;
- &perl-ch6-sbu;
- &perl-ch6-du;
+ &perl-ch5-sbu;
+ &perl-ch5-du;
@@ -41,481 +43,36 @@
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:
+ Prepare Perl for compilation:
-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.
- Issue the following command so that Perl will use the libraries
- installed on the system:
-
-export BUILD_ZLIB=False
-export BUILD_BZIP2=0
-
-
- To have full control over the way Perl is set up, you can remove the
- -des options from the following command and hand-pick the way
- this package is built. Alternatively, use the command exactly as below to
- use the defaults that Perl auto-detects:
-
-sh Configure -des -Dprefix=/usr \
- -Dvendorprefix=/usr \
- -Dman1dir=/usr/share/man/man1 \
- -Dman3dir=/usr/share/man/man3 \
- -Dpager="/usr/bin/less -isR" \
- -Duseshrplib \
- -Dusethreads
+sh Configure -des -Dprefix=/usr
- The meaning of the configure options:
-
+ The meaning of the new Configure options:
- -Dvendorprefix=/usr
+ -des
- This ensures perl knows how to
- tell packages where they should install their perl modules.
-
-
-
-
- -Dpager="/usr/bin/less -isR"
-
- This ensures that less is used instead
- of more.
-
-
-
-
- -Dman1dir=/usr/share/man/man1
- -Dman3dir=/usr/share/man/man3
-
- Since Groff is not installed yet, Configure
- thinks that we do not want man pages for Perl. Issuing these
- parameters overrides this decision.
-
-
-
-
- -Duseshrplib
-
- Build a shared libperl needed by some perl modules.
-
-
-
-
- -Dusethreads
-
- Build perl with support for threads.
+ This is a combination of three options: -d uses defaults for
+ all items; -e ensures completion of all tasks; -s silences
+ non-essential output.
- Compile the package:
+ Build the package:make
- To test the results (approximately 11 SBU), issue:
-
-make test
-
-
-
- Install the package and clean up:
-
-make install
-unset BUILD_ZLIB BUILD_BZIP2
+make install
-
- Contents of Perl
+
+
-
- Installed programs
- Installed libraries
- Installed directory
-
-
- corelist, cpan, enc2xs, encguess, h2ph, h2xs, instmodsh,
- json_pp, libnetcfg, perl, perl&perl-version; (hard link to perl),
- perlbug, perldoc, perlivp, perlthanks (hard link to perlbug), piconv,
- pl2pm, pod2html, pod2man, pod2text, pod2usage, podchecker, podselect,
- prove, ptar, ptardiff, ptargrep, shasum,
- splain, xsubpp, and zipdetails
- Many which cannot all be listed here
- /usr/lib/perl5
-
-
-
-
- Short Descriptions
-
-
-
-
- corelist
-
- A commandline frontend to Module::CoreList
-
- corelist
-
-
-
-
-
- cpan
-
- Interact with the Comprehensive Perl Archive Network (CPAN)
- from the command line
-
- cpan
-
-
-
-
-
- enc2xs
-
- Builds a Perl extension for the Encode module from either
- Unicode Character Mappings or Tcl Encoding Files
-
- enc2xs
-
-
-
-
-
- encguess
-
- Guess the encoding type of one or several files
-
- encguess
-
-
-
-
-
- h2ph
-
- Converts .h C header
- files to .ph Perl header
- files
-
- h2ph
-
-
-
-
-
- h2xs
-
- Converts .h C header
- files to Perl extensions
-
- h2xs
-
-
-
-
-
- instmodsh
-
- Shell script for examining installed Perl modules,
- and can create a tarball from an installed module
-
- instmodsh
-
-
-
-
-
- json_pp
-
- Converts data between certain input and output formats
-
- json_pp
-
-
-
-
-
- libnetcfg
-
- Can be used to configure the
- libnet Perl module
-
- libnetcfg
-
-
-
-
-
- perl
-
- Combines some of the best features of C, sed,
- awk and sh into a single
- swiss-army language
-
- perl
-
-
-
-
-
- perl&perl-version;
-
- A hard link to perl
-
- perl&perl-version;
-
-
-
-
-
- perlbug
-
- Used to generate bug reports about Perl, or the modules that come
- with it, and mail them
-
- perlbug
-
-
-
-
-
- perldoc
-
- Displays a piece of documentation in pod format that is embedded
- in the Perl installation tree or in a Perl script
-
- perldoc
-
-
-
-
-
- perlivp
-
- The Perl Installation Verification Procedure; it can be used to
- verify that Perl and its libraries have been installed
- correctly
-
- perlivp
-
-
-
-
-
- perlthanks
-
- Used to generate thank you messages to mail to the Perl
- developers
-
- perlthanks
-
-
-
-
-
- piconv
-
- A Perl version of the character encoding converter
- iconv
-
- piconv
-
-
-
-
-
- pl2pm
-
- A rough tool for converting Perl4
- .pl files to Perl5
- .pm modules
-
- pl2pm
-
-
-
-
-
- pod2html
-
- Converts files from pod format to HTML format
-
- pod2html
-
-
-
-
-
- pod2man
-
- Converts pod data to formatted *roff input
-
- pod2man
-
-
-
-
-
- pod2text
-
- Converts pod data to formatted ASCII text
-
- pod2text
-
-
-
-
-
- pod2usage
-
- Prints usage messages from embedded pod docs in files
-
- pod2usage
-
-
-
-
-
- podchecker
-
- Checks the syntax of pod format documentation files
-
- podchecker
-
-
-
-
-
- podselect
-
- Displays selected sections of pod documentation
-
- podselect
-
-
-
-
-
- prove
-
- Command line tool for running tests against the Test::Harness
- module
-
- prove
-
-
-
-
-
- ptar
-
- A tar-like program written in Perl
-
- ptar
-
-
-
-
-
- ptardiff
-
- A Perl program that compares an extracted archive with an
- unextracted one
-
- ptardiff
-
-
-
-
-
- ptargrep
-
- A Perl program that applies pattern matching to the contents
- of files in a tar archive
-
- ptargrep
-
-
-
-
-
- shasum
-
- Prints or checks SHA checksums
-
- shasum
-
-
-
-
-
- splain
-
- Is used to force verbose warning diagnostics in Perl
-
- splain
-
-
-
-
-
- xsubpp
-
- Converts Perl XS code into C code
-
- xsubpp
-
-
-
-
-
- zipdetails
-
- Displays details about the internal structure of a Zip file
-
- zipdetails
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/python.xml b/chapter06/python.xml
index cc440903d..52c070ab3 100644
--- a/chapter06/python.xml
+++ b/chapter06/python.xml
@@ -5,8 +5,8 @@
%general-entities;
]>
-
-
+
+
Python
@@ -16,66 +16,54 @@
Python-&python-version;
-
- python
+
+ Python
+ temporary
- 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.
+
- &buildtime;
+ &buildtime;&diskspace;
- &python-ch6-sbu;
- &python-ch6-du;
+ &python-ch5-sbu;
+ &python-ch5-du;
- Installation of Python 3
+ Installation of Python
+
+
+ There are two package files whose name starts with
+ python. The one to extract from is
+ Python-&python-version;.tar.xz (notice the
+ uppercase first letter).
+ Prepare Python for compilation:
-./configure --prefix=/usr \
- --enable-shared \
- --with-system-expat \
- --with-system-ffi \
- --with-ensurepip=yes
+./configure --prefix=/usr --without-ensurepip
- The meaning of the configure options:
+ The meaning of the configure option:
-
- --with-system-expat
-
- This switch enables linking against system version of
- Expat.
-
-
-
-
- --with-system-ffi
-
- This switch enables linking against system version of
- libffi.
-
-
-
-
- --with-ensurepip=yes
-
- This switch enables building pip and
- setuptools packaging programs.
-
-
+
+ --without-ensurepip
+
+ This switch disables the Python package installer, which is not
+ needed at this stage.
+
+
@@ -83,171 +71,18 @@
make
- To test the results, issue make test.
- Some tests requiring 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.
-
Install the package:
-make install
-chmod -v 755 /usr/lib/libpython&python-minor;.so
-chmod -v 755 /usr/lib/libpython3.so
-ln -sfv pip&python-minor; /usr/bin/pip3
-
-
- The meaning of the install commands:
-
-
- chmod -v 755 /usr/lib/libpython3.{8.,}so
-
- Fix permissions for libraries to be consistent with other
- libraries.
-
-
-
-
-
- If desired, install the preformatted documentation:
-
-install -v -dm755 /usr/share/doc/python-&python-version;/html
-
-tar --strip-components=1 \
- --no-same-owner \
- --no-same-permissions \
- -C /usr/share/doc/python-&python-version;/html \
- -xvf ../python-&python-version;-docs-html.tar.bz2
-
-
- The meaning of the documentation install commands:
-
-
- and
-
- Ensure the installed files have the correct ownership and
- permissions. Without these options, using tar
- will install the package files with the upstream creator's values.
-
-
-
-
-
+make install
-
- Contents of Python 3
+
+
-
- Installed Programs
- Installed Library
- Installed Directories
-
-
-
- 2to3, idle3, pip3, pydoc3, python3, and python3-config
-
-
- libpython&python-minor;.so and libpython3.so
-
-
- /usr/include/python&python-minor;,
- /usr/lib/python3, and
- /usr/share/doc/python-&python-version;
-
-
-
-
-
- Short Descriptions
-
-
-
-
- 2to3
-
-
- 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.
-
-
- 2to3
-
-
-
-
-
- idle3
-
-
- is a wrapper script that opens a Python
- aware GUI editor. For this script to run, you must have installed
- Tk before Python so that the Tkinter
- Python module is built.
-
-
- idle3
-
-
-
-
-
- pip3
-
-
- The package installer for Python. You can use pip to install
- packages from Python Package Index and other indexes.
-
-
- pip3
-
-
-
-
-
- pydoc3
-
-
- is the Python documentation tool.
-
-
- pydoc3
-
-
-
-
-
- python3
-
-
- is an interpreted, interactive, object-oriented programming
- language.
-
-
- python3
-
-
-
-
-
+ Details on this package are located in
+
-
diff --git a/chapter06/sed.xml b/chapter06/sed.xml
index 030e77a0b..f146b5102 100644
--- a/chapter06/sed.xml
+++ b/chapter06/sed.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,22 +16,25 @@
Sed-&sed-version;
-
+ Sed
+ tools
- The Sed package contains a stream editor.
+
- &buildtime;
+ &buildtime;&diskspace;
- &sed-ch6-sbu;
- &sed-ch6-du;
+ &sed-ch5-sbu;
+ &sed-ch5-du;
@@ -42,55 +45,25 @@
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
+
+
-
- Installed program
- Installed directory
-
-
- sed
- /usr/share/doc/sed-&sed-version;
-
-
-
-
- Short Descriptions
-
-
-
-
- sed
-
- Filters and transforms text files in a single pass
-
- sed
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/stripping.xml b/chapter06/stripping.xml
new file mode 100644
index 000000000..7c054b6b2
--- /dev/null
+++ b/chapter06/stripping.xml
@@ -0,0 +1,53 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+ 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:
+
+$LFS_TGT-strip --strip-debug $LFS/usr/lib/*
+$LFS_TGT-strip --strip-unneeded $LFS/usr/{,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.
+ Note that we use the strip program built in
+ Binutils pass 1, since it is the one that knows how to strip
+ our cross-compiled programs.
+
+
+ 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 $LFS/usr/{,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 $LFS/usr/{lib,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/chapter06/tar.xml b/chapter06/tar.xml
index d148c4695..ff2008e28 100644
--- a/chapter06/tar.xml
+++ b/chapter06/tar.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,22 +16,25 @@
Tar-&tar-version;
-
+ Tar
+ tools
- The Tar package contains an archiving program.
+ &buildtime;&diskspace;
- &tar-ch6-sbu;
- &tar-ch6-du;
+ &tar-ch5-sbu;
+ &tar-ch5-du;
@@ -42,74 +45,26 @@
Prepare Tar for compilation:
-FORCE_UNSAFE_CONFIGURE=1 \
-./configure --prefix=/usr \
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess) \
--bindir=/bin
-
- 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
+
+
-
- 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/tcl.xml b/chapter06/tcl.xml
new file mode 100644
index 000000000..bd17a91a8
--- /dev/null
+++ b/chapter06/tcl.xml
@@ -0,0 +1,191 @@
+
+
+ %general-entities;
+
+
+]>
+
+
+
+
+
+ tcl
+ &tcl-version;
+ &tcl-url;
+
+
+ Tcl-&tcl-version;
+
+
+ Tcl
+
+
+
+
+
+ The Tcl package contains the Tool Command Language,
+ a robust general-purpose scripting language. The Expect package
+ is written in the Tcl language.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &tcl-ch5-sbu;
+ &tcl-ch5-du;
+
+
+
+
+
+
+ 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
+ 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. These packages are required
+ to run the test suites in .
+
+ Note that the Tcl package used here is a minimal version needed
+ to run the LFS tests. For the full package, see the
+ BLFS Tcl procedures.
+
+ Prepare Tcl for compilation:
+
+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 chell 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
+
+sed -e "s|$SRCDIR/unix|/usr/lib|" \
+ -e "s|$SRCDIR|/usr/include|" \
+ -i tclConfig.sh
+
+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
+
+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 after the make command
+ remove references to the build directory from various configuration files,
+ and replaces them with the install directory. This is not mandatory
+ for the remaining of LFS, but may be needed in case a package built later
+ uses Tcl.
+
+ Install the package:
+
+make install
+
+ Make the installed library writable so debugging symbols can
+ be removed later:
+
+chmod -v u+w /usr/lib/libtcl&tcl-major-version;.so
+
+ Install Tcl's headers. The next package, Expect, requires them
+ to build.
+
+make install-private-headers
+
+ Now make a necessary symbolic link:
+
+ln -sfv tclsh&tcl-major-version; /usr/bin/tclsh
+
+
+
+
+ Contents of Tcl
+
+
+ Installed programs
+ Installed library
+
+
+ tclsh (link to tclsh&tcl-major-version;) and tclsh&tcl-major-version;
+ libtcl&tcl-major-version;.so, libtclstub&tcl-major-version;.a
+
+
+
+
+ Short Descriptions
+
+
+
+
+ tclsh&tcl-major-version;
+
+ The Tcl command shell
+
+ tclsh&tcl-major-version;
+
+
+
+
+
+ tclsh
+
+ A link to tclsh&tcl-major-version;
+
+ tclsh
+
+
+
+
+
+ libtcl&tcl-major-version;.so
+
+ The Tcl library
+
+ libtcl&tcl-major-version;.so
+
+
+
+
+
+ libtclstub&tcl-major-version;.a
+
+ The Tcl Stub library
+
+ libtclstub&tcl-major-version;.a
+
+
+
+
+
+
+
+
+
diff --git a/chapter06/texinfo.xml b/chapter06/texinfo.xml
index d61df477b..8434c7112 100644
--- a/chapter06/texinfo.xml
+++ b/chapter06/texinfo.xml
@@ -5,8 +5,8 @@
%general-entities;
]>
-
-
+
+
texinfo
@@ -16,23 +16,25 @@
Texinfo-&texinfo-version;
-
+ Texinfo
+ temporary
- The Texinfo package contains programs for reading, writing, and
- converting info pages.
+ &buildtime;&diskspace;
- &texinfo-ch6-sbu;
- &texinfo-ch6-du;
+ &texinfo-ch5-sbu;
+ &texinfo-ch5-du;
@@ -43,194 +45,29 @@
Prepare Texinfo for compilation:
-./configure --prefix=/usr --disable-static
+./configure --prefix=/usr
-
- The meaning of the configure options:
-
-
- --disable-static
-
- In this case, the top-level configure script will complain that
- this is an unrecognized option, but the configure script for
- XSParagraph recognizes it and uses it to disable installing a static
- XSParagraph.a to /usr/lib/texinfo.
-
-
-
-
+
+ As part of the configure process, a test is made that indicates an
+ error for TestXS_la-TestXS.lo. This is not relevant for LFS and should be
+ ignored.
+ Compile the package:make
- To test the results, issue:
-
-make check
-
Install the package:make install
- Optionally, install the components belonging in a TeX
- installation:
-
-
-make TEXMF=/usr/share/texmf install-tex
-
-
- The meaning of the make parameter:
-
-
- TEXMF=/usr/share/texmf
-
- The TEXMF makefile variable holds the location
- of the root of the TeX tree if, for example, a TeX package will be
- installed later.
-
-
-
-
-
- The Info documentation system uses a plain text file to hold its list of
- menu entries. The file is located at /usr/share/info/dir.
- Unfortunately, due to occasional problems in the Makefiles of various packages,
- it can sometimes get out of sync with the info pages installed on the system.
- If the /usr/share/info/dir file ever needs to be
- recreated, the following optional commands will accomplish the task:
-
-pushd /usr/share/info
-rm -v dir
-for f in *
- do install-info $f dir 2>/dev/null
-done
-popd
-
-
- Contents of Texinfo
+
+
-
- Installed programs
- Installed library
- Installed directories
-
-
- info, install-info, makeinfo (link to texi2any),
- pdftexi2dvi, pod2texi, texi2any, texi2dvi, texi2pdf, and texindex
- MiscXS.so, Parsetexi.so, and XSParagraph.so
- (all in /usr/lib/texinfo)
- /usr/share/texinfo and /usr/lib/texinfo
-
-
-
-
- Short Descriptions
-
-
-
-
- info
-
- Used to read info pages which are similar to man pages, but
- often go much deeper than just explaining all the available command
- line options [For example, compare man bison and
- info bison.]
-
- info
-
-
-
-
-
- install-info
-
- Used to install info pages; it updates entries in the
- info index file
-
- install-info
-
-
-
-
-
- makeinfo
-
- Translates the given Texinfo source documents into
- info pages, plain text, or HTML
-
- makeinfo
-
-
-
-
-
- pdftexi2dvi
-
- Used to format the given Texinfo document into a
- Portable Document Format (PDF) file
-
- pdftexi2dvi
-
-
-
-
-
- pod2texi
-
- Converts Pod to Texinfo format
-
- pod2texi
-
-
-
-
-
- texi2any
-
- Translate Texinfo source documentation to
- various other formats
-
- texi2any
-
-
-
-
-
- texi2dvi
-
- Used to format the given Texinfo document into a
- device-independent file that can be printed
-
- texi2dvi
-
-
-
-
-
- texi2pdf
-
- Used to format the given Texinfo document into a
- Portable Document Format (PDF) file
-
- texi2pdf
-
-
-
-
-
- texindex
-
- Used to sort Texinfo index files
-
- texindex
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/toolchaintechnotes.xml b/chapter06/toolchaintechnotes.xml
new file mode 100644
index 000000000..63c9210e5
--- /dev/null
+++ b/chapter06/toolchaintechnotes.xml
@@ -0,0 +1,335 @@
+
+
+ %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 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: 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 a another slow machine (C). Then, to build a
+ compiler for machine C, we would have three stages:
+
+
+
+
+
+
+
+
+
+ StageBuildHost
+ TargetAction
+
+
+
+ 1AAB
+ build cross-compiler cc1 using ccA on machine A
+
+
+ 2ABB
+ 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 when building the cross linker and
+ cross compiler, to tell them where to find the needed host files. This
+ ensures 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+libgcc,
+ lacking some fuctionalities 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 (i) the build system of
+ gcc does not know that it is usable on pc, and (ii) 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
+ by all the programs that need themselves to be built. The install step
+ uses the DESTDIR variable to have the programs land into
+ the LFS filesystem.
+
+ Then the native lfs compiler is built. First Binutils Pass 2, with
+ the same DESTDIR install as the other programs, then the
+ second pass of GCC, 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 host
+ is the same as target, but is different from build. 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 the remainder of
+ the , final versions of all the
+ packages needed for a fully functional system are built, tested and
+ installed.
+
+
+
+
diff --git a/chapter06/util-linux.xml b/chapter06/util-linux.xml
index 519c3b171..6aebad7a1 100644
--- a/chapter06/util-linux.xml
+++ b/chapter06/util-linux.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,24 +16,23 @@
Util-linux-&util-linux-version;
-
+ Util-linux
+ tools
- The Util-linux package contains miscellaneous utility programs.
- Among them are utilities for handling file systems, consoles, partitions,
- and messages.
+ The Util-linux package contains miscellaneous utility programs.&buildtime;&diskspace;
- &util-linux-ch6-sbu;
- &util-linux-ch6-du;
+ &util-linux-ch5-sbu;
+ &util-linux-ch5-du;
@@ -42,31 +41,14 @@
Installation of Util-linux
- The FHS recommends using the /var/lib/hwclock directory instead of the
- usual /etc directory as the
- location for the adjtime file. Create this directory
- with:
+ First create a directory
+ to enable storage for the hwclock program:mkdir -pv /var/lib/hwclockPrepare 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 \
- --without-systemd \
- --without-systemdsystemunitdir
-
-./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
+./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
--docdir=/usr/share/doc/util-linux-&util-linux-version; \
--disable-chfn-chsh \
--disable-login \
@@ -78,1241 +60,53 @@
--disable-static \
--without-python
- The --disable and --without options prevent warnings about
- building components that require packages not in LFS or are
- inconsistent with programs installed by other packages.
+
+ 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 fot his temporary tool, but it prevent creating a file
+ at another location, which would not be overwritten or removed
+ when building the final util-linux.
+
+
+
+
+ --disable-*
+
+ Those 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
- If desired, run the test suite as a non-root user:
-
- 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
- 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:
-
-bash tests/run.sh --srcdir=$PWD --builddir=$PWD
-
-
-chown -Rv tester .
-su tester -c "make -k check"
-
Install the package:make install
-
- Contents of Util-linux
+
+
-
- Installed programs
- Installed libraries
- Installed directories
-
-
- addpart, agetty, blkdiscard, blkid, blkzone, blockdev, cal, cfdisk, chcpu,
- chmem, choom, chrt, col, colcrt, colrm, column, ctrlaltdel, delpart, dmesg,
- eject, fallocate, fdformat, fdisk, fincore, findfs, findmnt, flock, fsck,
- fsck.cramfs, fsck.minix, fsfreeze, fstrim, getopt, hexdump, hwclock,
- i386, ionice, ipcmk, ipcrm, ipcs, isosize, kill, last, lastb (link to
- last), ldattach, linux32, linux64, logger, look, losetup, lsblk, lscpu,
- lsipc, lslocks, lslogins, lsmem, lsns, mcookie, mesg, mkfs, mkfs.bfs, mkfs.cramfs, mkfs.minix, mkswap,
- more, mount, mountpoint, namei, nsenter, partx, pivot_root, prlimit, raw,
- readprofile, rename, renice, resizepart, rev, rfkill, rtcwake, script,
- scriptreplay, setarch, setsid, setterm, sfdisk, sulogin, swaplabel,
- swapoff (link to swapon), swapon, switch_root, taskset, ul,
- umount, uname26, unshare, utmpdump, uuidd, uuidgen, uuidparse, wall, wdctl, whereis,
- wipefs, x86_64, and zramctl
- libblkid.so, libfdisk.so, libmount.so,
- libsmartcols.so, and libuuid.so
- /usr/include/blkid,
- /usr/include/libfdisk,
- /usr/include/libmount,
- /usr/include/libsmartcols,
- /usr/include/uuid,
- /usr/share/doc/util-linux-&util-linux-version;,
- and /var/lib/hwclock
-
-
-
-
- Short Descriptions
-
-
-
-
- addpart
-
- Informs the Linux kernel of new partitions
-
- addpart
-
-
-
-
-
- agetty
-
- Opens a tty port, prompts for a login name,
- and then invokes the login program
-
- agetty
-
-
-
-
-
- blkdiscard
-
- Discards sectors on a device
-
- blkdiscard
-
-
-
-
-
- blkid
-
- A command line utility to locate and print block device
- attributes
-
- blkid
-
-
-
-
-
- blkzone
-
- Runs zone command on the given block device
-
- blkzone
-
-
-
-
-
- blockdev
-
- Allows users to call block device ioctls from the command
- line
-
- blockdev
-
-
-
-
-
- cal
-
- Displays a simple calendar
-
- cal
-
-
-
-
-
- cfdisk
-
- Manipulates the partition table of the given device
-
- cfdisk
-
-
-
-
-
- chcpu
-
- Modifies the state of CPUs
-
- chcpu
-
-
-
-
-
- chmem
-
- Configures memory
-
- chmem
-
-
-
-
-
- choom
-
- Displays and adjusts OOM-killer score
-
- choom
-
-
-
-
-
- chrt
-
- Manipulates real-time attributes of a process
-
- chrt
-
-
-
-
-
- col
-
- Filters out reverse line feeds
-
- col
-
-
-
-
-
- colcrt
-
- Filters nroff output for terminals
- that lack some capabilities, such as overstriking and half-lines
-
- colcrt
-
-
-
-
-
- colrm
-
- Filters out the given columns
-
- colrm
-
-
-
-
-
- column
-
- Formats a given file into multiple columns
-
- column
-
-
-
-
-
- ctrlaltdel
-
- Sets the function of the Ctrl+Alt+Del key combination to a
- hard or a soft reset
-
- ctrlaltdel
-
-
-
-
-
- delpart
-
- Asks the Linux kernel to remove a partition
-
- delpart
-
-
-
-
-
- dmesg
-
- Dumps the kernel boot messages
-
- dmesg
-
-
-
-
-
- eject
-
- Ejects removable media
-
- eject
-
-
-
-
-
- fallocate
-
- Preallocates space to a file
-
- fallocate
-
-
-
-
-
- fdformat
-
- Low-level formats a floppy disk
-
- fdformat
-
-
-
-
-
- fdisk
-
- Manipulates the partition table of the given device
-
- fdisk
-
-
-
-
-
- fincore
-
- Counts pages of file contents in core
-
- fincore
-
-
-
-
-
- findfs
-
- Finds a file system by label or Universally Unique Identifier
- (UUID)
-
- findfs
-
-
-
-
-
- findmnt
-
- Is a command line interface to the libmount library
- for work with mountinfo, fstab and mtab files
-
- findmnt
-
-
-
-
-
- flock
-
- Acquires a file lock and then executes a command with the lock
- held
-
- flock
-
-
-
-
-
- fsck
-
- Is used to check, and optionally repair, file systems
-
- fsck
-
-
-
-
-
- fsck.cramfs
-
- Performs a consistency check on the Cramfs file system on the
- given device
-
- fsck.cramfs
-
-
-
-
-
- fsck.minix
-
- Performs a consistency check on the Minix file system on the
- given device
-
- fsck.minix
-
-
-
-
-
- fsfreeze
-
- Is a very simple wrapper around FIFREEZE/FITHAW ioctl
- kernel driver operations
-
- fsfreeze
-
-
-
-
-
- fstrim
-
- Discards unused blocks on a mounted filesystem
-
- fstrim
-
-
-
-
-
- getopt
-
- Parses options in the given command line
-
- getopt
-
-
-
-
-
- hexdump
-
- Dumps the given file in hexadecimal or in another given
- format
-
- hexdump
-
-
-
-
-
- hwclock
-
- Reads or sets the system's hardware clock, also called
- the Real-Time Clock (RTC) or Basic Input-Output System (BIOS)
- clock
-
- hwclock
-
-
-
-
-
- i386
-
- A symbolic link to setarch
-
- i386
-
-
-
-
-
- ionice
-
- Gets or sets the io scheduling class and priority for a program
-
- ionice
-
-
-
-
-
- ipcmk
-
- Creates various IPC resources
-
- ipcmk
-
-
-
-
-
- ipcrm
-
- Removes the given Inter-Process Communication (IPC) resource
-
- ipcrm
-
-
-
-
-
- ipcs
-
- Provides IPC status information
-
- ipcs
-
-
-
-
-
- isosize
-
- Reports the size of an iso9660 file system
-
- isosize
-
-
-
-
-
- kill
-
- Sends signals to processes
-
- kill
-
-
-
-
-
- last
-
- Shows which users last logged in (and out), searching back
- through the /var/log/wtmp file; it also shows
- system boots, shutdowns, and run-level changes
-
- last
-
-
-
-
-
- lastb
-
- Shows the failed login attempts, as logged in
- /var/log/btmp
-
- lastb
-
-
-
-
-
- ldattach
-
- Attaches a line discipline to a serial line
-
- ldattach
-
-
-
-
-
- linux32
-
- A symbolic link to setarch
-
- linux32
-
-
-
-
-
- linux64
-
- A symbolic link to setarch
-
- linux64
-
-
-
-
-
- logger
-
- Enters the given message into the system log
-
- logger
-
-
-
-
-
- look
-
- Displays lines that begin with the given string
-
- look
-
-
-
-
-
- losetup
-
- Sets up and controls loop devices
-
- losetup
-
-
-
-
-
- lsblk
-
- Lists information about all or selected block devices in
- a tree-like format
-
- lsblk
-
-
-
-
-
- lscpu
-
- Prints CPU architecture information
-
- lscpu
-
-
-
-
-
- lsipc
-
- Prints information on IPC facilities currently employed
- in the system
-
- lsipc
-
-
-
-
-
- lslocks
-
- Lists local system locks
-
- lslocks
-
-
-
-
-
- lslogins
-
- Lists information about users, groups and system accounts
-
- lslogins
-
-
-
-
-
- lsmem
-
- Lists the ranges of available memory with their online
- status
-
- lsmem
-
-
-
-
-
- lsns
-
- Lists namespaces
-
- lsns
-
-
-
-
-
- mcookie
-
- Generates magic cookies (128-bit random hexadecimal numbers) for
- xauth
-
- mcookie
-
-
-
-
-
- mesg
-
- Controls whether other users can send messages to the current
- user's terminal
-
- mesg
-
-
-
-
-
- mkfs
-
- Builds a file system on a device (usually a hard disk
- partition)
-
- mkfs
-
-
-
-
-
- mkfs.bfs
-
- Creates a Santa Cruz Operations (SCO) bfs file system
-
- mkfs.bfs
-
-
-
-
-
- mkfs.cramfs
-
- Creates a cramfs file system
-
- mkfs.cramfs
-
-
-
-
-
- mkfs.minix
-
- Creates a Minix file system
-
- mkfs.minix
-
-
-
-
-
- mkswap
-
- Initializes the given device or file to be used as a swap
- area
-
- mkswap
-
-
-
-
-
- more
-
- A filter for paging through text one screen at a time
-
- more
-
-
-
-
-
- mount
-
- Attaches the file system on the given device to a specified
- directory in the file-system tree
-
- mount
-
-
-
-
-
- mountpoint
-
- Checks if the directory is a mountpoint
-
- mountpoint
-
-
-
-
-
- namei
-
- Shows the symbolic links in the given pathnames
-
- namei
-
-
-
-
-
- nsenter
-
- Runs a program with namespaces of other processes
-
- nsenter
-
-
-
-
-
- partx
-
- Tells the kernel about the presence and numbering of on-disk
- partitions
-
- partx
-
-
-
-
-
- pivot_root
-
- Makes the given file system the new root file system of the
- current process
-
- pivot_root
-
-
-
-
-
- prlimit
-
- Get and set a process' resource limits
-
- prlimit
-
-
-
-
-
- raw
-
- Bind a Linux raw character device to a block device
-
- raw
-
-
-
-
-
- readprofile
-
- Reads kernel profiling information
-
- readprofile
-
-
-
-
-
- rename
-
- Renames the given files, replacing a given string with
- another
-
- rename
-
-
-
-
-
- renice
-
- Alters the priority of running processes
-
- renice
-
-
-
-
-
- resizepart
-
- Asks the Linux kernel to resize a partition
-
- resizepart
-
-
-
-
-
- rev
-
- Reverses the lines of a given file
-
- rev
-
-
-
-
-
- rkfill
-
- Tool for enabling and disabling wireless devices
-
- rkfill
-
-
-
-
-
- rtcwake
-
- Used to enter a system sleep state until specified wakeup
- time
-
- rtcwake
-
-
-
-
-
- script
-
- Makes a typescript of a terminal session
-
- script
-
-
-
-
-
- scriptreplay
-
- Plays back typescripts using timing information
-
- scriptreplay
-
-
-
-
-
- setarch
-
- Changes reported architecture in a new program environment and
- sets personality flags
-
- setarch
-
-
-
-
-
- setsid
-
- Runs the given program in a new session
-
- setsid
-
-
-
-
-
- setterm
-
- Sets terminal attributes
-
- setterm
-
-
-
-
-
- sfdisk
-
- A disk partition table manipulator
-
- sfdisk
-
-
-
-
-
- sulogin
-
- Allows root to log in;
- it is normally invoked by init when the system goes
- into single user mode
-
- sulogin
-
-
-
-
-
- swaplabel
-
- Allows to change swaparea UUID and label
-
- swaplabel
-
-
-
-
-
- swapoff
-
- Disables devices and files for paging and swapping
-
- swapoff
-
-
-
-
-
- swapon
-
- Enables devices and files for paging and swapping and
- lists the devices and files currently in use
-
- swapon
-
-
-
-
-
- switch_root
-
- Switches to another filesystem as the root of the mount tree
-
- switch_root
-
-
-
-
-
- tailf
-
- Tracks the growth of a log file; displays the last 10 lines
- of a log file, then continues displaying any new entries in the
- log file as they are created
-
- tailf
-
-
-
-
-
- taskset
-
- Retrieves or sets a process' CPU affinity
-
- taskset
-
-
-
-
-
- ul
-
- A filter for translating underscores into escape sequences
- indicating underlining for the terminal in use
-
- ul
-
-
-
-
-
- umount
-
- Disconnects a file system from the system's file tree
-
- umount
-
-
-
-
-
- uname26
-
- A symbolic link to setarch
-
- uname26
-
-
-
-
-
- unshare
-
- Runs a program with some namespaces unshared from parent
-
- unshare
-
-
-
-
-
- utmpdump
-
- Displays the content of the given login file in a more
- user-friendly format
-
- utmpdump
-
-
-
-
-
- uuidd
-
- A daemon used by the UUID library to generate time-based
- UUIDs in a secure and guaranteed-unique fashion
-
- uuidd
-
-
-
-
-
- uuidgen
-
- Creates new UUIDs. Each new UUID can reasonably be considered
- unique among all UUIDs created, on the local system and on other
- systems, in the past and in the future
-
- uuidgen
-
-
-
-
-
- uuidparse
-
- An utility to parse unique identifiers
-
- uuidparse
-
-
-
-
-
- wall
-
- Displays the contents of a file or, by default, its standard
- input, on the terminals of all currently logged in users
-
- wall
-
-
-
-
-
- wdctl
-
- Shows hardware watchdog status
-
- wdctl
-
-
-
-
-
- whereis
-
- Reports the location of the binary, source, and man page
- for the given command
-
- whereis
-
-
-
-
-
- wipefs
-
- Wipes a filesystem signature from a device
-
- wipefs
-
-
-
-
-
- x86_64
-
- A symbolic link to setarch
-
- x86_64
-
-
-
-
-
- zramctl
-
- A program to set up and control zram (compressed ram disk)
- devices
-
- zramctl
-
-
-
-
-
- libblkid
-
- Contains routines for device identification and token
- extraction
-
- libblkid
-
-
-
-
-
- libfdisk
-
- Contains routines for manipulating partition tables
-
- libfdisk
-
-
-
-
-
- libmount
-
- Contains routines for block device mounting and
- unmounting
-
- libmount
-
-
-
-
-
- libsmartcols
-
- Contains routines for aiding screen output in tabular form
-
- libsmartcols
-
-
-
-
-
- libuuid
-
- Contains routines for generating unique identifiers for objects
- that may be accessible beyond the local system
-
- libuuid
-
-
-
-
-
+ Details on this package are located in
+
diff --git a/chapter06/xz.xml b/chapter06/xz.xml
index 5a342b2ff..9e2d0da4b 100644
--- a/chapter06/xz.xml
+++ b/chapter06/xz.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -16,26 +16,25 @@
Xz-&xz-version;
-
+ Xz
+ tools
- 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 xz yields a better
- compression percentage than with the traditional gzip or
- bzip2 commands.
+ &buildtime;&diskspace;
- &xz-ch6-sbu;
- &xz-ch6-du;
+ &xz-ch5-sbu;
+ &xz-ch5-du;
@@ -44,320 +43,34 @@
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:
+ Compile the package:make
- To test the results, issue:
+ Install the package:
-make check
+make DESTDIR=$LFS install
- Install the package and make sure that all essential files are in the
- correct directory:
+ 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
+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
-
- 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
-
-
-
-
-
+
+
+ Details on this package are located in
diff --git a/chapter07/bash.xml b/chapter07/bash.xml
new file mode 100644
index 000000000..ee1fb574e
--- /dev/null
+++ b/chapter07/bash.xml
@@ -0,0 +1,96 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ bash
+ &bash-version;
+ &bash-url;
+
+
+ Bash-&bash-version;
+
+
+ Bash
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &bash-ch5-sbu;
+ &bash-ch5-du;
+
+
+
+
+
+
+ Installation of Bash
+
+ Prepare Bash for compilation:
+
+./configure --prefix=/usr \
+ --build=$(support/config.guess) \
+ --host=$LFS_TGT \
+ --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
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+ Move the excutable to where it is expected to be:
+
+mv $LFS/usr/bin/bash $LFS/bin/bash
+
+ Make a link for the programs that use sh for
+ a shell:
+
+ln -sv bash $LFS/bin/sh
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/binutils-pass1.xml b/chapter07/binutils-pass1.xml
new file mode 100644
index 000000000..8658cfcfe
--- /dev/null
+++ b/chapter07/binutils-pass1.xml
@@ -0,0 +1,156 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ binutils-pass1
+ &binutils-version;
+ &binutils-url;
+
+
+ Binutils-&binutils-version; - Pass 1
+
+
+ Binutils
+ tools, pass 1
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &binutils-ch5p1-sbu;
+ &binutils-ch5p1-du;
+
+
+
+
+
+
+ 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
+ of problems later.
+
+ It is important that Binutils be the first package compiled
+ because both Glibc and GCC perform various tests on the available
+ linker and assembler to determine which of their own features to
+ enable.
+
+ The Binutils documentation recommends building Binutils
+ in a dedicated build directory:
+
+mkdir -v build
+cd build
+
+
+ In order for the SBU values listed in the rest of the book
+ to be of any use, measure the time it takes to build this package from
+ the configuration, up to and including the first install. To achieve
+ this easily, wrap the commands in a time
+ command like this: time { ./configure ... && ...
+ && make install; }.
+
+
+ Now prepare Binutils for compilation:
+
+../configure --prefix=$LFS/tools \
+ --with-sysroot=$LFS \
+ --target=$LFS_TGT \
+ --disable-nls \
+ --disable-werror
+
+
+ The meaning of the configure options:
+
+
+ --prefix=$LFS/tools
+
+ This tells the configure script to prepare to install the
+ Binutils programs in the $LFS/tools directory.
+
+
+
+
+ --with-sysroot=$LFS
+
+ For cross compilation, this tells the build system to look in
+ $LFS for the target system libraries as needed.
+
+
+
+
+ --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
+ for building a cross linker.
+
+
+
+
+ --disable-nls
+
+ This disables internationalization as i18n is not needed for the
+ temporary tools.
+
+
+
+
+ --disable-werror
+
+ This prevents the build from stopping in the event that there
+ are warnings from the host's compiler.
+
+
+
+
+
+ Continue with compiling the package:
+
+make
+
+ Install the package:
+
+make install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/binutils-pass2.xml b/chapter07/binutils-pass2.xml
new file mode 100644
index 000000000..5d0fd7e6d
--- /dev/null
+++ b/chapter07/binutils-pass2.xml
@@ -0,0 +1,94 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ binutils-pass2
+ &binutils-version;
+ &binutils-url;
+
+
+ Binutils-&binutils-version; - Pass 2
+
+
+ Binutils
+ tools, pass 2
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &binutils-ch5p2-sbu;
+ &binutils-ch5p2-du;
+
+
+
+
+
+
+ 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
+
+
+ The meaning of the new configure options:
+
+
+ --host=$LFS_TGT
+
+ This tells the configure script that we want to build
+ this pass of binutils for the $LFS_TGT machine, using our just
+ built cross-compiler. This prevents the linker from searching
+ through library directories on the host.
+
+
+
+
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/bison.xml b/chapter07/bison.xml
new file mode 100644
index 000000000..3ed86713a
--- /dev/null
+++ b/chapter07/bison.xml
@@ -0,0 +1,82 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ bison
+ &bison-version;
+ &bison-url;
+
+
+ Bison-&bison-version;
+
+
+ Bison
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &bison-ch5-sbu;
+ &bison-ch5-du;
+
+
+
+
+
+
+ Installation of Bison
+
+ Prepare Bison for compilation:
+
+./configure --prefix=/usr \
+ --docdir=/usr/share/doc/bison-&bison-version;
+
+
+ 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
+
+ Install the package:
+
+make install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/bzip2.xml b/chapter07/bzip2.xml
new file mode 100644
index 000000000..828b7fc0f
--- /dev/null
+++ b/chapter07/bzip2.xml
@@ -0,0 +1,112 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ bzip2
+ &bzip2-version;
+ &bzip2-url;
+
+
+ Bzip2-&bzip2-version;
+
+
+ Bzip2
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &bzip2-ch5-sbu;
+ &bzip2-ch5-du;
+
+
+
+
+
+
+ Installation of Bzip2
+
+ Apply a patch that will install the documentation for this
+ package:
+
+patch -Np1 -i ../&bzip2-docs-patch;
+
+ The following command ensures installation of symbolic links are
+ relative:
+
+sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
+
+ Ensure the man pages are installed into the correct location:
+
+sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
+
+ 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 CC=$LFS_TGT-gcc -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 CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib
+
+ Install the package:
+
+make PREFIX=$LFS/usr install
+
+ Install the shared bzip2 binary into the
+ /bin directory, make some necessary
+ symbolic links, and clean up:
+
+cp -v bzip2-shared $LFS/bin/bzip2
+cp -av libbz2.so* $LFS/lib
+ln -sv ../../lib/libbz2.so.1.0 $LFS/usr/lib/libbz2.so
+rm -v $LFS/usr/bin/{bunzip2,bzcat,bzip2}
+ln -sv bzip2 $LFS/bin/bunzip2
+ln -sv bzip2 $LFS/bin/bzcat
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/changingowner.xml b/chapter07/changingowner.xml
new file mode 100644
index 000000000..43a902821
--- /dev/null
+++ b/chapter07/changingowner.xml
@@ -0,0 +1,41 @@
+
+
+ %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 under $LFS are kept as they are, 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 all
+ the files under $LFS, 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/* directories to
+ user root by running the following
+ command:
+
+chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,lib64,tools}
+
+
diff --git a/chapter07/chapter07.xml b/chapter07/chapter07.xml
index b745594da..df740eaa5 100644
--- a/chapter07/chapter07.xml
+++ b/chapter07/chapter07.xml
@@ -5,39 +5,25 @@
%general-entities;
]>
-
+
- System Configuration
+ Entering Chroot and Building Additional Tools
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chapter07/chroot.xml b/chapter07/chroot.xml
new file mode 100644
index 000000000..5b6310af7
--- /dev/null
+++ b/chapter07/chroot.xml
@@ -0,0 +1,65 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+ Entering the Chroot Environment
+
+ Now that all the packages which depend on themselves for being built
+ 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:
+
+chroot "$LFS" /usr/bin/env -i \
+ HOME=/root \
+ TERM="$TERM" \
+ PS1='(lfs chroot) \u:\w\$ ' \
+ 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
+ the HOME, TERM, PS1, and
+ PATH variables are set again. The
+ TERM=$TERM construct will set the TERM
+ variable inside chroot to the same value as outside chroot. This variable is
+ needed for programs like vim and less
+ to operate properly. If other variables are needed, such as
+ CFLAGS or CXXFLAGS, this is a good place to set
+ them again.
+
+ From this point on, there is no need to use the
+ 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 is not
+ anymore in the PATH. This means that a temporary tool will no longer be
+ used once its final version is installed. This occurs when the shell does not
+ remember the locations of executed binaries—for this
+ reason, hashing is switched off by passing the +h option
+ to bash.
+
+ Note that the bash prompt will say
+ I have no name! This is normal because the
+ /etc/passwd file has not been created yet.
+
+
+ It is important that all the commands throughout the remainder of this
+ chapter and the following chapters are run from within the chroot
+ environment. If you leave this environment for any reason (rebooting for
+ example), ensure that the virtual kernel filesystems are mounted as
+ explained in and and enter chroot again before continuing
+ with the installation.
+
+
+
diff --git a/chapter07/coreutils.xml b/chapter07/coreutils.xml
new file mode 100644
index 000000000..f1e380f7e
--- /dev/null
+++ b/chapter07/coreutils.xml
@@ -0,0 +1,105 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ coreutils
+ &coreutils-version;
+ &coreutils-url;
+
+
+ Coreutils-&coreutils-version;
+
+
+ Coreutils
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &coreutils-ch5-sbu;
+ &coreutils-ch5-du;
+
+
+
+
+
+
+ Installation of Coreutils
+
+ Prepare Coreutils for compilation:
+
+./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:
+
+
+ --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
+
+ Install the package:
+
+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 $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/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\"/1 $LFS/usr/share/man/man8/chroot.8
+mv -v $LFS/usr/bin/{head,nice,sleep,touch} $LFS/bin
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/createfiles.xml b/chapter07/createfiles.xml
new file mode 100644
index 000000000..aed8d79da
--- /dev/null
+++ b/chapter07/createfiles.xml
@@ -0,0 +1,204 @@
+
+
+ %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
+
+ 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 the next
+ 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 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 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/chapter07/creatingdirs.xml b/chapter07/creatingdirs.xml
new file mode 100644
index 000000000..359717ff7
--- /dev/null
+++ b/chapter07/creatingdirs.xml
@@ -0,0 +1,59 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+ Creating Directories
+
+ 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},srv,var}
+install -dv -m 0750 /root
+install -dv -m 1777 /tmp /var/tmp
+mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
+mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
+mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
+mkdir -pv /usr/{,local/}share/man/man{1..8}
+
+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}
+
+ Directories are, by default, created with permission mode 755, but
+ this is not desirable for all directories. In the commands above, two
+ changes are made—one to the home directory of user root, and another to the directories for
+ temporary files.
+
+ The first mode change ensures that not just anybody can enter
+ the /root directory—the
+ same as a normal user would do with his or her home directory. The
+ second mode change makes sure that any user can write to the
+ /tmp and /var/tmp directories, but cannot remove
+ another user's files from them. The latter is prohibited by the so-called
+ sticky bit, the highest bit (1) in the 1777 bit mask.
+
+
+ FHS Compliance Note
+
+ The directory tree is based on the Filesystem Hierarchy Standard
+ (FHS) (available at ). The FHS also specifies
+ the optional existence of some directories such as /usr/local/games and /usr/share/games. We create only the
+ directories that are needed. However, feel free to create these
+ directories.
+
+
+
+
diff --git a/chapter07/dejagnu.xml b/chapter07/dejagnu.xml
new file mode 100644
index 000000000..8f1ab7648
--- /dev/null
+++ b/chapter07/dejagnu.xml
@@ -0,0 +1,96 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ dejagnu
+ &dejagnu-version;
+ &dejagnu-url;
+
+
+ DejaGNU-&dejagnu-version;
+
+
+ DejaGNU
+
+
+
+
+
+ The DejaGnu package contains a framework for running test
+ suites on GNU tools. It is written in expect, which itself
+ uses Tcl (Tool Command Language).
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &dejagnu-ch5-sbu;
+ &dejagnu-ch5-du;
+
+
+
+
+
+
+ Installation of DejaGNU
+
+ Prepare DejaGNU for compilation:
+
+./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
+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:
+
+make check
+
+
+
+
+
+ Contents of DejaGNU
+
+
+ Installed program
+
+
+ runtest
+
+
+
+
+ Short Descriptions
+
+
+
+
+ runtest
+
+ A wrapper script that locates the proper
+ expect shell and then runs DejaGNU
+
+ runtest
+
+
+
+
+
+
+
+
+
diff --git a/chapter07/diffutils.xml b/chapter07/diffutils.xml
new file mode 100644
index 000000000..194fe4607
--- /dev/null
+++ b/chapter07/diffutils.xml
@@ -0,0 +1,68 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ diffutils
+ &diffutils-version;
+ &diffutils-url;
+
+
+ Diffutils-&diffutils-version;
+
+
+ Diffutils
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &diffutils-ch5-sbu;
+ &diffutils-ch5-du;
+
+
+
+
+
+
+ Installation of Diffutils
+
+ Prepare Diffutils for compilation:
+
+./configure --prefix=/usr --host=$LFS_TGT
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/expect.xml b/chapter07/expect.xml
new file mode 100644
index 000000000..20b227ea5
--- /dev/null
+++ b/chapter07/expect.xml
@@ -0,0 +1,139 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ expect
+ &expect-version;
+ &expect-url;
+
+
+ Expect-&expect-version;
+
+
+ Expect
+
+
+
+
+
+ The Expect package contains tools for
+ automating, via scripted dialogues, interactive applications such as
+ telnet, ftp,
+ passwd, fsck,
+ rlogin, and tip.
+ Expect is also useful for testing these same
+ applications as well as easing all sorts of tasks that are prohibitively
+ difficult with anything else. The DejaGnu
+ framework is written in Expect.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &expect-ch5-sbu;
+ &expect-ch5-du;
+
+
+
+
+
+
+ Installation of Expect
+
+ Prepare Expect for compilation:
+
+
+./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=/usr/lib
+
+ This parameter is needed to tell the
+ configure where the
+ tclConfig.sh is located.
+
+
+
+
+ --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.
+
+
+
+
+
+ Build the package:
+
+make
+
+ Install the package:
+
+make install
+ln -svf expect&expect-version;/libexpect&expect-version;.so /usr/lib
+
+
+
+
+ Contents of Expect
+
+
+ Installed program
+ Installed library
+
+
+ expect
+ libexpect-&expect-lib-version;.so
+
+
+
+
+ Short Descriptions
+
+
+
+
+ expect
+
+ Communicates with other interactive programs according
+ to a script
+
+ expect
+
+
+
+
+
+ libexpect-&expect-lib-version;.so
+
+ Contains functions that allow Expect to be used as a Tcl
+ extension or to be used directly from C or C++ (without Tcl)
+
+ libexpect-&expect-lib-version;
+
+
+
+
+
+
+
+
+
diff --git a/chapter07/file.xml b/chapter07/file.xml
new file mode 100644
index 000000000..5a821d180
--- /dev/null
+++ b/chapter07/file.xml
@@ -0,0 +1,73 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ file
+ &file-version;
+ &file-url;
+
+
+ File-&file-version;
+
+
+ File
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &file-ch5-sbu;
+ &file-ch5-du;
+
+
+
+
+
+
+ Installation of File
+
+ Prepare File for compilation:
+
+./configure --prefix=/usr \
+ --host=$LFS_TGT
+
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
diff --git a/chapter07/findutils.xml b/chapter07/findutils.xml
new file mode 100644
index 000000000..073c1640c
--- /dev/null
+++ b/chapter07/findutils.xml
@@ -0,0 +1,75 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ findutils
+ &findutils-version;
+ &findutils-url;
+
+
+ Findutils-&findutils-version;
+
+
+ Findutils
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &findutils-ch5-sbu;
+ &findutils-ch5-du;
+
+
+
+
+
+
+ Installation of Findutils
+
+ Prepare Findutils for compilation:
+
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess)
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+ Move the excutable to its final expected location:
+
+mv -v $LFS/usr/bin/find $LFS/bin
+sed -i 's|find:=${BINDIR}|find:=/bin|' $LFS/usr/bin/updatedb
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/flex.xml b/chapter07/flex.xml
new file mode 100644
index 000000000..88e263413
--- /dev/null
+++ b/chapter07/flex.xml
@@ -0,0 +1,88 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ flex
+ &flex-version;
+ &flex-url;
+
+
+ Flex-&flex-version;
+
+
+ Flex
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &flex-ch5-sbu;
+ &flex-ch5-du;
+
+
+
+
+
+
+ Installation of Flex
+
+ Prepare Flex for compilation:
+
+./configure --prefix=/usr \
+ --docdir=/usr/share/doc/flex-&flex-version;
+
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/gawk.xml b/chapter07/gawk.xml
new file mode 100644
index 000000000..d5b5d6d8d
--- /dev/null
+++ b/chapter07/gawk.xml
@@ -0,0 +1,74 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gawk
+ &gawk-version;
+ &gawk-url;
+
+
+ Gawk-&gawk-version;
+
+
+ Gawk
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &gawk-ch5-sbu;
+ &gawk-ch5-du;
+
+
+
+
+
+
+ Installation of Gawk
+
+ First, ensure some unneeded files are not installed:
+
+sed -i 's/extras//' Makefile.in
+
+ Prepare Gawk for compilation:
+
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(./config.guess)
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/gcc-pass1.xml b/chapter07/gcc-pass1.xml
new file mode 100644
index 000000000..1bd308f09
--- /dev/null
+++ b/chapter07/gcc-pass1.xml
@@ -0,0 +1,208 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gcc-pass1
+ &gcc-version;
+ &gcc-url;
+
+
+ GCC-&gcc-version; - Pass 1
+
+
+ GCC
+ tools, pass 1
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &gcc-ch5p1-sbu;
+ &gcc-ch5p1-du;
+
+
+
+
+
+
+ Installation of Cross GCC
+
+ 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 (). First extract the gcc tarball from the sources
+ directory and then change to the directory created. Only then should you
+ proceed with the instructions below.
+
+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
+
+ On x86_64 hosts, set 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
+
+ The GCC documentation recommends building GCC
+ in a dedicated build directory:
+
+mkdir -v build
+cd build
+
+ Prepare GCC for compilation:
+
+../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 \
+ --disable-multilib \
+ --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:
+
+
+ --with-glibc-version=2.11
+
+ This option ensures the package will be compatible with the host's
+ version of glibc. It is set to the minimum glibc requirement
+ specified in the .
+
+
+
+
+ --with-newlib
+
+ Since a working C library is not yet available, this ensures
+ that the inhibit_libc constant is defined when building libgcc. This prevents
+ the compiling of any code that requires libc support.
+
+
+
+
+ --without-headers
+
+ When creating a complete cross-compiler, GCC requires
+ standard headers compatible with the target system. For our
+ purposes these headers will not be needed. This switch prevents
+ GCC from looking for them.
+
+
+
+
+ --disable-shared
+
+ This switch forces GCC to link its internal libraries
+ statically. We need this because the shared libraries require glibc,
+ which is not yet installed on the target 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.
+
+
+
+
+ --disable-multilib
+
+ On x86_64, LFS does not yet support a multilib configuration.
+ This switch is harmless for x86.
+
+
+
+
+ --enable-languages=c,c++
+
+ This option ensures that only the C and C++ compilers are built.
+ These are the only languages needed now.
+
+
+
+
+
+ Compile GCC by running:
+
+make
+
+ 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
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/gcc-pass2.xml b/chapter07/gcc-pass2.xml
new file mode 100644
index 000000000..5f6864d02
--- /dev/null
+++ b/chapter07/gcc-pass2.xml
@@ -0,0 +1,160 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gcc-pass2
+ &gcc-version;
+ &gcc-url;
+
+
+ GCC-&gcc-version; - Pass 2
+
+
+ GCC
+ tools, pass 2
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &gcc-ch5p2-sbu;
+ &gcc-ch5p2-du;
+
+
+
+
+
+
+ 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
+
+ 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
+
+ Fix an issue with GCC-10.1 when building with a cross
+ compiler:
+
+patch -Np1 -i ../&gcc-cross-patch;
+
+ Create a separate build directory again:
+
+mkdir -v build
+cd build
+
+ Create a symlink that allos 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++
+
+
+ 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 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
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/generalinstructions.xml b/chapter07/generalinstructions.xml
new file mode 100644
index 000000000..05b88b98c
--- /dev/null
+++ b/chapter07/generalinstructions.xml
@@ -0,0 +1,120 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+ General Compilation Instructions
+
+ When building packages there are several assumptions made within
+ the instructions:
+
+
+
+
+ Several of the packages are patched before compilation, but only when
+ the patch is needed to circumvent a problem. A patch is often needed in
+ both this and the next chapter, but sometimes in only one or the other.
+ Therefore, do not be concerned if instructions for a downloaded patch seem
+ to be missing. Warning messages about offset or
+ fuzz may also be encountered when applying a patch. Do
+ not worry about these warnings, as the patch was still successfully
+ applied.
+
+
+
+ During the compilation of most packages, there will be several
+ warnings that scroll by on the screen. These are normal and can safely be
+ ignored. These warnings are as they appear—warnings about
+ deprecated, but not invalid, use of the C or C++ syntax. C standards change
+ fairly often, and some packages still use the older standard. This is not a
+ problem, but does prompt the warning.
+
+
+
+ Check one last time that the LFS environment variable
+ is set up properly:
+
+echo $LFS
+
+ Make sure the output shows the path to the LFS partition's mount
+ point, which is /mnt/lfs, using our
+ example.
+
+
+
+
+ Finally, two important items must be emphasized:
+
+
+
+ The build instructions assume that the , including symbolic links, have
+ been set properly:
+
+
+
+ bash is the shell
+ in use.
+
+ sh is a symbolic
+ link to bash.
+
+ /usr/bin/awk is a
+ symbolic link to gawk.
+
+ /usr/bin/yacc is a
+ symbolic link to bison or a small script that
+ executes bison.
+
+
+
+
+
+ To re-emphasize the build process:
+
+
+
+ Place all the sources and patches in a directory that will be
+ accessible from the chroot environment such as
+ /mnt/lfs/sources/.
+
+
+ Change to the sources directory.
+
+
+ For each package:
+
+
+ Using the tar program, extract the package
+ to be built. In Chapter 5, ensure you are the lfs
+ user when extracting the package.
+
+
+ Change to the directory created when the package was
+ extracted.
+
+
+ Follow the book's instructions for building the package.
+
+
+ Change back to the sources directory.
+
+
+ Delete the extracted source directory unless instructed otherwise.
+
+
+
+
+
+
+
+
+
+
diff --git a/chapter07/gettext.xml b/chapter07/gettext.xml
new file mode 100644
index 000000000..a3baed723
--- /dev/null
+++ b/chapter07/gettext.xml
@@ -0,0 +1,85 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gettext
+ &gettext-version;
+ &gettext-url;
+
+
+ Gettext-&gettext-version;
+
+
+ Gettext
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &gettext-ch5-sbu;
+ &gettext-ch5-du;
+
+
+
+
+
+
+ Installation of Gettext
+
+ For our temporary set of tools, we only need to install
+ three programs from Gettext.
+
+ Prepare Gettext for compilation:
+
+./configure --disable-shared
+
+
+ The meaning of the configure option:
+
+
+ --disable-shared
+
+ We do not need to install any of the shared Gettext libraries at
+ this time, therefore there is no need to build them.
+
+
+
+
+
+ Compile the package:
+
+make
+
+ Install the msgfmt, msgmerge and
+ xgettext programs:
+
+cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/glibc.xml b/chapter07/glibc.xml
new file mode 100644
index 000000000..5213c23e5
--- /dev/null
+++ b/chapter07/glibc.xml
@@ -0,0 +1,230 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ glibc
+ &glibc-version;
+ &glibc-url;
+
+
+ Glibc-&glibc-version;
+
+
+ Glibc
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &glibc-ch5-sbu;
+ &glibc-ch5-du;
+
+
+
+
+
+
+ Installation of Glibc
+
+ First, create two symbolic links, which are needed 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:
+
+mkdir -v build
+cd build
+
+ Next, prepare Glibc for compilation:
+
+../configure \
+ --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(../scripts/config.guess) \
+ --enable-kernel=&min-kernel; \
+ --with-headers=$LFS/usr/include \
+ libc_cv_slibdir=/lib
+
+
+
+ The meaning of the configure options:
+
+
+ --host=$LFS_TGT, --build=$(../scripts/config.guess)
+
+ The combined effect of these switches is that Glibc's build system
+ configures itself to be cross-compiled, using the cross-linker and
+ cross-compiler in /tools.
+
+
+
+
+ --enable-kernel=&min-kernel;
+
+ This tells Glibc to compile the library with support
+ for &min-kernel; and later Linux kernels. Workarounds for older
+ kernels are not enabled.
+
+
+
+
+ --with-headers=$LFS/usr/include
+
+ This tells Glibc to compile itself against the headers recently
+ installed to the usr/include directory, so that it knows exactly what
+ features the kernel has and can optimize itself accordingly.
+
+
+
+
+ libc_cv_slibdir=/lib
+
+ This ensures that the library is installed in /lib instead
+ of the default /lib64 on 64 bit machines.
+
+
+
+
+
+
+ During this stage the following warning might appear:
+
+
+configure: WARNING:
+*** These auxiliary programs are missing or
+*** incompatible versions: msgfmt
+*** some features will be disabled.
+*** Check the INSTALL file for required versions.
+
+
+ The missing or incompatible msgfmt program is
+ generally harmless. This msgfmt program is part of the
+ Gettext package which the host distribution should provide.
+
+ There have been reports that this package may fail when
+ building as a "parallel make". If this occurs, rerun the make command
+ with a "-j1" option.
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+
+ The meaning of the make install 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 '/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: /lib64/ld-linux-x86-64.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.
+
+ Once all is well, clean up the test files:
+
+rm -v dummy.c a.out
+
+
+
+ Building packages in the next sections 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 an utility provided by the GCC
+ developers:
+
+$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/grep.xml b/chapter07/grep.xml
new file mode 100644
index 000000000..bac311f2f
--- /dev/null
+++ b/chapter07/grep.xml
@@ -0,0 +1,70 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ grep
+ &grep-version;
+ &grep-url;
+
+
+ Grep-&grep-version;
+
+
+ Grep
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &grep-ch5-sbu;
+ &grep-ch5-du;
+
+
+
+
+
+
+ Installation of Grep
+
+ Prepare Grep for compilation:
+
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --bindir=/bin
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/gzip.xml b/chapter07/gzip.xml
new file mode 100644
index 000000000..e9bdd3bd8
--- /dev/null
+++ b/chapter07/gzip.xml
@@ -0,0 +1,72 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gzip
+ &gzip-version;
+ &gzip-url;
+
+
+ Gzip-&gzip-version;
+
+
+ Gzip
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &gzip-ch5-sbu;
+ &gzip-ch5-du;
+
+
+
+
+
+
+ Installation of Gzip
+
+ Prepare Gzip for compilation:
+
+./configure --prefix=/usr --host=$LFS_TGT
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+ Move the excutable to its final expected location:
+
+mv -v $LFS/usr/bin/gzip $LFS/bin
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/introduction.xml b/chapter07/introduction.xml
index cbc197a7b..5614270b2 100644
--- a/chapter07/introduction.xml
+++ b/chapter07/introduction.xml
@@ -5,221 +5,25 @@
%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.
+ 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.
-
-
-
- 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
-
-
-
- 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.
-
-
-
-
-
+ 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.
-
diff --git a/chapter07/kernfs.xml b/chapter07/kernfs.xml
new file mode 100644
index 000000000..dd6b8991c
--- /dev/null
+++ b/chapter07/kernfs.xml
@@ -0,0 +1,115 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+ Preparing Virtual Kernel File Systems
+
+
+ /dev/*
+
+
+ Various file systems exported by the kernel are used to communicate to
+ and from the kernel itself. These file systems are virtual in that no disk
+ space is used for them. The content of the file systems resides in
+ memory.
+
+ Begin by creating directories onto which the file systems will be
+ mounted:
+
+mkdir -pv $LFS/{dev,proc,sys,run}
+
+
+ Creating Initial Device Nodes
+
+ 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
+ init=/bin/bash. Create the devices by running the
+ following commands:
+
+mknod -m 600 $LFS/dev/console c 5 1
+mknod -m 666 $LFS/dev/null c 1 3
+
+
+
+
+ Mounting and Populating /dev
+
+ The recommended method of populating the /dev directory with devices is to mount a
+ virtual filesystem (such as tmpfs) on the /dev directory, and allow the devices to be
+ created dynamically on that virtual filesystem as they are detected or
+ accessed. Device creation is generally done during the boot process
+ by Udev. Since this new system does not yet have Udev and has not yet
+ been booted, it is necessary to mount and populate /dev manually. This is accomplished by bind
+ mounting the host system's /dev
+ directory. A bind mount is a special type of mount that allows you to
+ create a mirror of a directory or mount point to some other location. Use
+ the following command to achieve this:
+
+mount -v --bind /dev $LFS/dev
+
+
+
+
+ Mounting Virtual Kernel File Systems
+
+ Now mount the remaining virtual kernel filesystems:
+
+mount -v --bind /dev/pts $LFS/dev/pts
+mount -vt proc proc $LFS/proc
+mount -vt sysfs sysfs $LFS/sys
+mount -vt tmpfs tmpfs $LFS/run
+
+
+ The meaning of the mount options for devpts:
+
+
+ gid=5
+
+ This ensures that all devpts-created device nodes are owned by
+ group ID 5. This is the ID we will use later on for the tty group. We use the group ID instead
+ of a name, since the host system might use a different ID for its
+ tty group.
+
+
+
+
+ mode=0620
+
+ This ensures that all devpts-created device nodes have mode 0620
+ (user readable and writable, group writable). Together with the
+ option above, this ensures that devpts will create device nodes that
+ meet the requirements of grantpt(), meaning the Glibc
+ pt_chown helper binary (which is not installed by
+ default) is not necessary.
+
+
+
+
+
+ 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
+ directory needs to be created.
+
+if [ -h $LFS/dev/shm ]; then
+ mkdir -pv $LFS/$(readlink $LFS/dev/shm)
+fi
+
+
+
+
diff --git a/chapter07/libstdc++-pass2.xml b/chapter07/libstdc++-pass2.xml
new file mode 100644
index 000000000..999a4fa4e
--- /dev/null
+++ b/chapter07/libstdc++-pass2.xml
@@ -0,0 +1,114 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gcc-libstdc++
+ &gcc-version;
+ &gcc-url;
+
+
+ Libstdc++ from GCC-&gcc-version;, Pass 2
+
+
+ GCC
+ tools, libstdc++ pass 2
+
+
+
+
+
+ Again, when building , 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
+ installed, because this compiler is a native
+ compiler, and should not be used outside of chroot without being at
+ risk of polluting the build with some host components.
+
+
+ &buildtime;
+ &diskspace;
+
+
+
+ &libstdcpp-ch5-sbu;
+ &libstdcpp-ch5-du;
+
+
+
+
+
+
+ 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
+
+
+ The meaning of the configure options:
+
+
+ CXXFLAGS="-g -O2 -D_GNU_SOURCE"
+
+ Those 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.
+
+
+
+
+
+ Compile libstdc++ by running:
+
+make
+
+ Install the library:
+
+make install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/libstdc++.xml b/chapter07/libstdc++.xml
new file mode 100644
index 000000000..3a1b0f2bf
--- /dev/null
+++ b/chapter07/libstdc++.xml
@@ -0,0 +1,122 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gcc-libstdc++
+ &gcc-version;
+ &gcc-url;
+
+
+ Libstdc++ from GCC-&gcc-version;, Pass 1
+
+
+ GCC
+ tools, libstdc++ pass 1
+
+
+
+
+
+ Libstdc++ is the standard C++ library. It is needed
+ 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 the target
+ directory.
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &libstdcpp-ch5-sbu;
+ &libstdcpp-ch5-du;
+
+
+
+
+
+
+ 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 separate build directory for Libstdc++ and enter it:
+
+mkdir -v build
+cd build
+
+ Prepare Libstdc++ for compilation:
+
+../libstdc++-v3/configure \
+ --host=$LFS_TGT \
+ --build=$(../config.guess) \
+ --prefix=/usr \
+ --disable-multilib \
+ --disable-nls \
+ --disable-libstdcxx-pch \
+ --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;
+
+
+ The meaning of the configure options:
+
+
+ --host=...
+
+ Indicates to use the cross compiler we have just built
+ instead of the one in /usr/bin.
+
+
+
+
+ --disable-libstdcxx-pch
+
+ This switch prevents the installation of precompiled
+ include files, which are not needed at this stage.
+
+
+
+
+ --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
+ options from the top level directory. In our case, this information
+ must be explicitly given.
+
+
+
+
+
+ Compile libstdc++ by running:
+
+make
+
+ Install the library:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/linux-headers.xml b/chapter07/linux-headers.xml
new file mode 100644
index 000000000..6c1af3173
--- /dev/null
+++ b/chapter07/linux-headers.xml
@@ -0,0 +1,207 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ linux-headers
+ &linux-version;
+ &linux-url;
+
+
+ Linux-&linux-version; API Headers
+
+
+ Linux
+ tools, API headers
+
+
+
+
+
+ The Linux API Headers (in linux-&linux-version;.tar.xz) expose the
+ kernel's API for use by Glibc.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &linux-headers-ch5-sbu;
+ &linux-headers-ch5-du;
+
+
+
+
+
+
+ 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 embedded in the package:
+
+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 may not
+ be available. The headers are first placed in
+ ./usr, then copied to the needed
+ location.
+
+make headers
+find usr/include -name '.*' -delete
+rm usr/include/Makefile
+cp -rv usr/include $LFS/usr
+
+
+
+
+ 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/chapter07/m4.xml b/chapter07/m4.xml
new file mode 100644
index 000000000..3f51c11d1
--- /dev/null
+++ b/chapter07/m4.xml
@@ -0,0 +1,74 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ m4
+ &m4-version;
+ &m4-url;
+
+
+ M4-&m4-version;
+
+
+ M4
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &m4-ch5-sbu;
+ &m4-ch5-du;
+
+
+
+
+
+
+ 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=/usr \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess)
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/make.xml b/chapter07/make.xml
new file mode 100644
index 000000000..2d054dd9e
--- /dev/null
+++ b/chapter07/make.xml
@@ -0,0 +1,83 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+ make
+ &make-version;
+ &make-url;
+
+
+ Make-&make-version;
+
+
+ Make
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &make-ch5-sbu;
+ &make-ch5-du;
+
+
+
+
+
+
+ Installation of Make
+
+ Prepare Make for compilation:
+
+./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
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/ncurses.xml b/chapter07/ncurses.xml
new file mode 100644
index 000000000..e2455eb7a
--- /dev/null
+++ b/chapter07/ncurses.xml
@@ -0,0 +1,157 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ ncurses
+ &ncurses-version;
+ &ncurses-url;
+
+
+ Ncurses-&ncurses-version;
+
+
+ Ncurses
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &ncurses-ch5-sbu;
+ &ncurses-ch5-du;
+
+
+
+
+
+
+ Installation of Ncurses
+
+ First, ensure that gawk is found first during configuration:
+
+sed -i s/mawk// configure
+
+ Then, run the following commands to build the tic
+ program on the build host:
+
+mkdir build
+cd build
+../configure
+make -C include
+make -C progs tic
+cd ..
+
+ Prepare Ncurses for compilation:
+
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(./config.guess) \
+ --mandir=/usr/share/man \
+ --with-shared \
+ --without-debug \
+ --without-ada \
+ --without-normal \
+ --enable-widec \
+ --enable-pc-files
+
+
+ The meaning of the new 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-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
+
+ Install the package:
+
+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 $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 $LFS/usr/lib/libncursesw.so) $LFS/usr/lib/libncursesw.so
+
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/patch.xml b/chapter07/patch.xml
new file mode 100644
index 000000000..08bad5c56
--- /dev/null
+++ b/chapter07/patch.xml
@@ -0,0 +1,70 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ patch
+ &patch-version;
+ &patch-url;
+
+
+ Patch-&patch-version;
+
+
+ Patch
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &patch-ch5-sbu;
+ &patch-ch5-du;
+
+
+
+
+
+
+ Installation of Patch
+
+ Prepare Patch for compilation:
+
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess)
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/perl.xml b/chapter07/perl.xml
new file mode 100644
index 000000000..2e2bfd6bd
--- /dev/null
+++ b/chapter07/perl.xml
@@ -0,0 +1,79 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ perl
+ &perl-version;
+ &perl-url;
+
+
+ Perl-&perl-version;
+
+
+ Perl
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &perl-ch5-sbu;
+ &perl-ch5-du;
+
+
+
+
+
+
+ Installation of Perl
+
+ Prepare Perl for compilation:
+
+sh Configure -des -Dprefix=/usr
+
+
+ The meaning of the new Configure options:
+
+ -des
+
+ This is a combination of three options: -d uses defaults for
+ all items; -e ensures completion of all tasks; -s silences
+ non-essential output.
+
+
+
+
+
+ Build the package:
+
+make
+
+make install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/python.xml b/chapter07/python.xml
new file mode 100644
index 000000000..8e7afaf03
--- /dev/null
+++ b/chapter07/python.xml
@@ -0,0 +1,88 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ Python
+ &python-version;
+ &python-url;
+
+
+ Python-&python-version;
+
+
+ Python
+ temporary
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &python-ch5-sbu;
+ &python-ch5-du;
+
+
+
+
+
+
+ Installation of Python
+
+
+ There are two package files whose name starts with
+ python. The one to extract from is
+ Python-&python-version;.tar.xz (notice the
+ uppercase first letter).
+
+
+ Prepare Python for compilation:
+
+./configure --prefix=/usr --without-ensurepip
+
+
+ The meaning of the configure option:
+
+
+ --without-ensurepip
+
+ This switch disables the Python package installer, which is not
+ needed at this stage.
+
+
+
+
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/sed.xml b/chapter07/sed.xml
new file mode 100644
index 000000000..5daaf6b7e
--- /dev/null
+++ b/chapter07/sed.xml
@@ -0,0 +1,70 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ sed
+ &sed-version;
+ &sed-url;
+
+
+ Sed-&sed-version;
+
+
+ Sed
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &sed-ch5-sbu;
+ &sed-ch5-du;
+
+
+
+
+
+
+ Installation of Sed
+
+ Prepare Sed for compilation:
+
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --bindir=/bin
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/stripping.xml b/chapter07/stripping.xml
new file mode 100644
index 000000000..7c054b6b2
--- /dev/null
+++ b/chapter07/stripping.xml
@@ -0,0 +1,53 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+ 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:
+
+$LFS_TGT-strip --strip-debug $LFS/usr/lib/*
+$LFS_TGT-strip --strip-unneeded $LFS/usr/{,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.
+ Note that we use the strip program built in
+ Binutils pass 1, since it is the one that knows how to strip
+ our cross-compiled programs.
+
+
+ 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 $LFS/usr/{,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 $LFS/usr/{lib,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/chapter07/tar.xml b/chapter07/tar.xml
new file mode 100644
index 000000000..26f676121
--- /dev/null
+++ b/chapter07/tar.xml
@@ -0,0 +1,71 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ tar
+ &tar-version;
+ &tar-url;
+
+
+ Tar-&tar-version;
+
+
+ Tar
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &tar-ch5-sbu;
+ &tar-ch5-du;
+
+
+
+
+
+
+ Installation of Tar
+
+ Prepare Tar for compilation:
+
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess) \
+ --bindir=/bin
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make DESTDIR=$LFS install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/tcl.xml b/chapter07/tcl.xml
new file mode 100644
index 000000000..bd17a91a8
--- /dev/null
+++ b/chapter07/tcl.xml
@@ -0,0 +1,191 @@
+
+
+ %general-entities;
+
+
+]>
+
+
+
+
+
+ tcl
+ &tcl-version;
+ &tcl-url;
+
+
+ Tcl-&tcl-version;
+
+
+ Tcl
+
+
+
+
+
+ The Tcl package contains the Tool Command Language,
+ a robust general-purpose scripting language. The Expect package
+ is written in the Tcl language.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &tcl-ch5-sbu;
+ &tcl-ch5-du;
+
+
+
+
+
+
+ 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
+ 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. These packages are required
+ to run the test suites in .
+
+ Note that the Tcl package used here is a minimal version needed
+ to run the LFS tests. For the full package, see the
+ BLFS Tcl procedures.
+
+ Prepare Tcl for compilation:
+
+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 chell 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
+
+sed -e "s|$SRCDIR/unix|/usr/lib|" \
+ -e "s|$SRCDIR|/usr/include|" \
+ -i tclConfig.sh
+
+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
+
+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 after the make command
+ remove references to the build directory from various configuration files,
+ and replaces them with the install directory. This is not mandatory
+ for the remaining of LFS, but may be needed in case a package built later
+ uses Tcl.
+
+ Install the package:
+
+make install
+
+ Make the installed library writable so debugging symbols can
+ be removed later:
+
+chmod -v u+w /usr/lib/libtcl&tcl-major-version;.so
+
+ Install Tcl's headers. The next package, Expect, requires them
+ to build.
+
+make install-private-headers
+
+ Now make a necessary symbolic link:
+
+ln -sfv tclsh&tcl-major-version; /usr/bin/tclsh
+
+
+
+
+ Contents of Tcl
+
+
+ Installed programs
+ Installed library
+
+
+ tclsh (link to tclsh&tcl-major-version;) and tclsh&tcl-major-version;
+ libtcl&tcl-major-version;.so, libtclstub&tcl-major-version;.a
+
+
+
+
+ Short Descriptions
+
+
+
+
+ tclsh&tcl-major-version;
+
+ The Tcl command shell
+
+ tclsh&tcl-major-version;
+
+
+
+
+
+ tclsh
+
+ A link to tclsh&tcl-major-version;
+
+ tclsh
+
+
+
+
+
+ libtcl&tcl-major-version;.so
+
+ The Tcl library
+
+ libtcl&tcl-major-version;.so
+
+
+
+
+
+ libtclstub&tcl-major-version;.a
+
+ The Tcl Stub library
+
+ libtclstub&tcl-major-version;.a
+
+
+
+
+
+
+
+
+
diff --git a/chapter07/texinfo.xml b/chapter07/texinfo.xml
new file mode 100644
index 000000000..2cb7764cb
--- /dev/null
+++ b/chapter07/texinfo.xml
@@ -0,0 +1,74 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ texinfo
+ &texinfo-version;
+ &texinfo-url;
+
+
+ Texinfo-&texinfo-version;
+
+
+ Texinfo
+ temporary
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &texinfo-ch5-sbu;
+ &texinfo-ch5-du;
+
+
+
+
+
+
+ Installation of Texinfo
+
+ Prepare Texinfo for compilation:
+
+./configure --prefix=/usr
+
+
+ As part of the configure process, a test is made that indicates an
+ error for TestXS_la-TestXS.lo. This is not relevant for LFS and should be
+ ignored.
+
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+make install
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/toolchaintechnotes.xml b/chapter07/toolchaintechnotes.xml
new file mode 100644
index 000000000..63c9210e5
--- /dev/null
+++ b/chapter07/toolchaintechnotes.xml
@@ -0,0 +1,335 @@
+
+
+ %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 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: 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 a another slow machine (C). Then, to build a
+ compiler for machine C, we would have three stages:
+
+
+
+
+
+
+
+
+
+ StageBuildHost
+ TargetAction
+
+
+
+ 1AAB
+ build cross-compiler cc1 using ccA on machine A
+
+
+ 2ABB
+ 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 when building the cross linker and
+ cross compiler, to tell them where to find the needed host files. This
+ ensures 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+libgcc,
+ lacking some fuctionalities 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 (i) the build system of
+ gcc does not know that it is usable on pc, and (ii) 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
+ by all the programs that need themselves to be built. The install step
+ uses the DESTDIR variable to have the programs land into
+ the LFS filesystem.
+
+ Then the native lfs compiler is built. First Binutils Pass 2, with
+ the same DESTDIR install as the other programs, then the
+ second pass of GCC, 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 host
+ is the same as target, but is different from build. 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 the remainder of
+ the , final versions of all the
+ packages needed for a fully functional system are built, tested and
+ installed.
+
+
+
+
diff --git a/chapter07/util-linux.xml b/chapter07/util-linux.xml
new file mode 100644
index 000000000..6aebad7a1
--- /dev/null
+++ b/chapter07/util-linux.xml
@@ -0,0 +1,113 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ util-linux
+ &util-linux-version;
+ &util-linux-url;
+
+
+ Util-linux-&util-linux-version;
+
+
+ Util-linux
+ tools
+
+
+
+
+
+ The Util-linux package contains miscellaneous utility programs.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &util-linux-ch5-sbu;
+ &util-linux-ch5-du;
+
+
+
+
+
+
+ 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 fot his temporary tool, but it prevent creating a file
+ at another location, which would not be overwritten or removed
+ when building the final util-linux.
+
+
+
+
+ --disable-*
+
+ Those 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
+
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
+
diff --git a/chapter07/xz.xml b/chapter07/xz.xml
new file mode 100644
index 000000000..83e4a96d6
--- /dev/null
+++ b/chapter07/xz.xml
@@ -0,0 +1,77 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ xz
+ &xz-version;
+ &xz-url;
+
+
+ Xz-&xz-version;
+
+
+ Xz
+ tools
+
+
+
+
+
+
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &xz-ch5-sbu;
+ &xz-ch5-du;
+
+
+
+
+
+
+ Installation of Xz
+
+ Prepare Xz for compilation:
+
+./configure --prefix=/usr \
+ --host=$LFS_TGT \
+ --build=$(build-aux/config.guess) \
+ --disable-static \
+ --docdir=/usr/share/doc/xz-&xz-version;
+
+ Compile the package:
+
+make
+
+ Install the package:
+
+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
+
+
+
+
+
+ Details on this package are located in
+
+
+
+
diff --git a/chapter06/aboutdebug.xml b/chapter08/aboutdebug.xml
similarity index 100%
rename from chapter06/aboutdebug.xml
rename to chapter08/aboutdebug.xml
diff --git a/chapter06/acl.xml b/chapter08/acl.xml
similarity index 100%
rename from chapter06/acl.xml
rename to chapter08/acl.xml
diff --git a/chapter06/adjusting.xml b/chapter08/adjusting.xml
similarity index 100%
rename from chapter06/adjusting.xml
rename to chapter08/adjusting.xml
diff --git a/chapter06/attr.xml b/chapter08/attr.xml
similarity index 100%
rename from chapter06/attr.xml
rename to chapter08/attr.xml
diff --git a/chapter06/autoconf.xml b/chapter08/autoconf.xml
similarity index 100%
rename from chapter06/autoconf.xml
rename to chapter08/autoconf.xml
diff --git a/chapter06/automake.xml b/chapter08/automake.xml
similarity index 100%
rename from chapter06/automake.xml
rename to chapter08/automake.xml
diff --git a/chapter08/bash.xml b/chapter08/bash.xml
new file mode 100644
index 000000000..650c33ade
--- /dev/null
+++ b/chapter08/bash.xml
@@ -0,0 +1,173 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ bash
+ &bash-version;
+ &bash-url;
+
+
+ Bash-&bash-version;
+
+
+ Bash
+
+
+
+
+
+ The Bash package contains the Bourne-Again SHell.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &bash-ch6-sbu;
+ &bash-ch6-du;
+
+
+
+
+
+
+ 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 continue 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 100%
rename from chapter06/bc.xml
rename to chapter08/bc.xml
diff --git a/chapter06/binutils.xml b/chapter08/binutils.xml
similarity index 100%
rename from chapter06/binutils.xml
rename to chapter08/binutils.xml
diff --git a/chapter08/bison.xml b/chapter08/bison.xml
new file mode 100644
index 000000000..23b6f0a95
--- /dev/null
+++ b/chapter08/bison.xml
@@ -0,0 +1,142 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ bison
+ &bison-version;
+ &bison-url;
+
+
+ Bison-&bison-version;
+
+
+ Bison
+
+
+
+
+
+ The Bison package contains a parser generator.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &bison-ch6-sbu;
+ &bison-ch6-du;
+
+
+
+
+
+
+ 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:
+
+make check
+
+ Fourteen tests fail in the "Diagnostics" section, probably because of
+ missing locales.
+
+
+
+ Install the package:
+
+make install
+
+
+
+
+ Contents of Bison
+
+
+ Installed programs
+ Installed library
+ Installed directory
+
+
+ bison and yacc
+ liby.a
+ /usr/share/bison
+
+
+
+
+ Short Descriptions
+
+
+
+
+ bison
+
+ Generates, from a series of rules, a program for analyzing the
+ structure of text files; Bison is a replacement for Yacc (Yet Another
+ Compiler Compiler)
+
+ bison
+
+
+
+
+
+ yacc
+
+ A wrapper for bison, meant for programs that
+ still call yacc instead of bison;
+ it calls bison with the -y
+ option
+
+ yacc
+
+
+
+
+
+ liby
+
+ The Yacc library containing implementations of Yacc-compatible
+ yyerror and main functions;
+ this library is normally not very useful, but POSIX requires it
+
+ liby
+
+
+
+
+
+
+
+
+
diff --git a/chapter08/bzip2.xml b/chapter08/bzip2.xml
new file mode 100644
index 000000000..edf2f5bd4
--- /dev/null
+++ b/chapter08/bzip2.xml
@@ -0,0 +1,250 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ bzip2
+ &bzip2-version;
+ &bzip2-url;
+
+
+ Bzip2-&bzip2-version;
+
+
+ Bzip2
+
+
+
+
+
+ The Bzip2 package contains programs for compressing and decompressing
+ files. Compressing text files with bzip2 yields a much
+ better compression percentage than with the traditional
+ gzip.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &bzip2-ch6-sbu;
+ &bzip2-ch6-du;
+
+
+
+
+
+
+ Installation of Bzip2
+
+ Apply a patch that will install the documentation for this package:
+
+patch -Np1 -i ../&bzip2-docs-patch;
+
+ The following command ensures installation of symbolic links are relative:
+
+sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile
+
+ Ensure the man pages are installed into the correct location:
+
+sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile
+
+ Prepare Bzip2 for compilation with:
+
+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:
+
+make
+
+ Install the programs:
+
+make PREFIX=/usr install
+
+ Install the shared bzip2 binary into the
+ /bin directory, make
+ some necessary symbolic links, and clean up:
+
+cp -v bzip2-shared /bin/bzip2
+cp -av libbz2.so* /lib
+ln -sv ../../lib/libbz2.so.1.0 $LFS/usr/lib/libbz2.so
+rm -v /usr/bin/{bunzip2,bzcat,bzip2}
+ln -sv bzip2 /bin/bunzip2
+ln -sv bzip2 /bin/bzcat
+
+
+
+
+ Contents of Bzip2
+
+
+ Installed programs
+ Installed libraries
+ Installed directory
+
+
+ bunzip2 (link to bzip2), bzcat (link to bzip2), bzcmp (link to
+ bzdiff), bzdiff, bzegrep (link to bzgrep), bzfgrep (link to bzgrep),
+ bzgrep, bzip2, bzip2recover, bzless (link to bzmore), and bzmore
+ libbz2.{a,so}
+ /usr/share/doc/bzip2-&bzip2-version;
+
+
+
+
+ Short Descriptions
+
+
+
+
+ bunzip2
+
+ Decompresses bzipped files
+
+ bunzip2
+
+
+
+
+
+ bzcat
+
+ Decompresses to standard output
+
+ bzcat
+
+
+
+
+
+ bzcmp
+
+ Runs cmp on bzipped files
+
+ bzcmp
+
+
+
+
+
+ bzdiff
+
+ Runs diff on bzipped files
+
+ bzdiff
+
+
+
+
+
+ bzegrep
+
+ Runs egrep on bzipped files
+
+ bzegrep
+
+
+
+
+
+ bzfgrep
+
+ Runs fgrep on bzipped files
+
+ bzfgrep
+
+
+
+
+
+ bzgrep
+
+ Runs grep on bzipped files
+
+ bzgrep
+
+
+
+
+
+ bzip2
+
+ Compresses files using the Burrows-Wheeler block sorting text
+ compression algorithm with Huffman coding; the compression rate is
+ better than that achieved by more conventional compressors using
+ Lempel-Ziv algorithms, like gzip
+
+ bzip2
+
+
+
+
+
+ bzip2recover
+
+ Tries to recover data from damaged bzipped files
+
+ bzip2recover
+
+
+
+
+
+ bzless
+
+ Runs less on bzipped files
+
+ bzless
+
+
+
+
+
+ bzmore
+
+ Runs more on bzipped files
+
+ bzmore
+
+
+
+
+
+ libbz2
+
+ The library implementing lossless, block-sorting data
+ compression, using the Burrows-Wheeler algorithm
+
+ libbz2
+
+
+
+
+
+
+
+
+
diff --git a/chapter08/chapter08.xml b/chapter08/chapter08.xml
index 32112e37a..cbdb39963 100644
--- a/chapter08/chapter08.xml
+++ b/chapter08/chapter08.xml
@@ -5,15 +5,99 @@
%general-entities;
]>
-
+
- Making the LFS System Bootable
+ Installing Basic System Software
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chapter06/check.xml b/chapter08/check.xml
similarity index 100%
rename from chapter06/check.xml
rename to chapter08/check.xml
diff --git a/chapter08/coreutils.xml b/chapter08/coreutils.xml
new file mode 100644
index 000000000..5a4079d78
--- /dev/null
+++ b/chapter08/coreutils.xml
@@ -0,0 +1,1287 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ coreutils
+ &coreutils-version;
+ &coreutils-url;
+
+
+ Coreutils-&coreutils-version;
+
+
+ Coreutils
+
+
+
+
+
+ The Coreutils package contains utilities for showing and setting the
+ basic system characteristics.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &coreutils-ch6-sbu;
+ &coreutils-ch6-du;
+
+
+
+
+
+
+ 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,
+ 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:
+
+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\"/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
+
+
+
+
+ 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
+
+
+
+
+ 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 100%
rename from chapter06/dbus.xml
rename to chapter08/dbus.xml
diff --git a/chapter08/diffutils.xml b/chapter08/diffutils.xml
new file mode 100644
index 000000000..0d8bd5c77
--- /dev/null
+++ b/chapter08/diffutils.xml
@@ -0,0 +1,125 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ diffutils
+ &diffutils-version;
+ &diffutils-url;
+
+
+ Diffutils-&diffutils-version;
+
+
+ Diffutils
+
+
+
+
+
+ The Diffutils package contains programs that show the differences
+ between files or directories.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &diffutils-ch6-sbu;
+ &diffutils-ch6-du;
+
+
+
+
+
+
+ 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 100%
rename from chapter06/e2fsprogs.xml
rename to chapter08/e2fsprogs.xml
diff --git a/chapter06/eudev.xml b/chapter08/eudev.xml
similarity index 100%
rename from chapter06/eudev.xml
rename to chapter08/eudev.xml
diff --git a/chapter06/expat.xml b/chapter08/expat.xml
similarity index 100%
rename from chapter06/expat.xml
rename to chapter08/expat.xml
diff --git a/chapter08/file.xml b/chapter08/file.xml
new file mode 100644
index 000000000..b5e28f244
--- /dev/null
+++ b/chapter08/file.xml
@@ -0,0 +1,108 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ file
+ &file-version;
+ &file-url;
+
+
+ File-&file-version;
+
+
+ File
+
+
+
+
+
+ The File package contains a utility for determining the type of a given
+ file or files.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &file-ch6-sbu;
+ &file-ch6-du;
+
+
+
+
+
+
+ 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
+
+
+
+
+
+ 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..37393f0de
--- /dev/null
+++ b/chapter08/findutils.xml
@@ -0,0 +1,161 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ findutils
+ &findutils-version;
+ &findutils-url;
+
+
+ Findutils-&findutils-version;
+
+
+ Findutils
+
+
+
+
+
+ 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).
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &findutils-ch6-sbu;
+ &findutils-ch6-du;
+
+
+
+
+
+
+ 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/chapter08/flex.xml b/chapter08/flex.xml
new file mode 100644
index 000000000..bd4bd545f
--- /dev/null
+++ b/chapter08/flex.xml
@@ -0,0 +1,149 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ flex
+ &flex-version;
+ &flex-url;
+
+
+ Flex-&flex-version;
+
+
+ Flex
+
+
+
+
+
+ The Flex package contains a utility for generating programs that
+ recognize patterns in text.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &flex-ch6-sbu;
+ &flex-ch6-du;
+
+
+
+
+
+
+ Installation of Flex
+
+
+
+ Prepare Flex for compilation:
+
+
+./configure --prefix=/usr --docdir=/usr/share/doc/flex-&flex-version;
+
+ Compile the package:
+
+make
+
+ To test the results (about 0.5 SBU), issue:
+
+make check
+
+ Install the package:
+
+make install
+
+ A few programs do not know about flex yet and
+ try to run its predecessor, lex. To support those
+ programs, create a symbolic link named lex that
+ runs flex in lex emulation
+ mode:
+
+ln -sv flex /usr/bin/lex
+
+
+
+
+ Contents of Flex
+
+
+ Installed programs
+ Installed libraries
+ Installed directory
+
+
+ flex, flex++ (link to flex), and lex (link to flex)
+ libfl.so
+ /usr/share/doc/flex-&flex-version;
+
+
+
+
+ Short Descriptions
+
+
+
+
+ flex
+
+ A tool for generating programs that recognize patterns in text;
+ it allows for the versatility to specify the rules for pattern-finding,
+ eradicating the need to develop a specialized program
+
+ flex
+
+
+
+
+
+ flex++
+
+ An extension of flex, is used for generating C++ code
+ and classes. It is a symbolic link to flex
+
+ flex++
+
+
+
+
+
+ lex
+
+ A symbolic link that runs flex in
+ lex emulation mode
+
+ lex
+
+
+
+
+
+ libfl
+
+ The flex library
+
+ libfl
+
+
+
+
+
+
+
+
+
diff --git a/chapter08/gawk.xml b/chapter08/gawk.xml
new file mode 100644
index 000000000..b112eb10d
--- /dev/null
+++ b/chapter08/gawk.xml
@@ -0,0 +1,128 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gawk
+ &gawk-version;
+ &gawk-url;
+
+
+ Gawk-&gawk-version;
+
+
+ Gawk
+
+
+
+
+
+ The Gawk package contains programs for manipulating text files.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &gawk-ch6-sbu;
+ &gawk-ch6-du;
+
+
+
+
+
+
+ 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 100%
rename from chapter06/gcc.xml
rename to chapter08/gcc.xml
diff --git a/chapter06/gdbm.xml b/chapter08/gdbm.xml
similarity index 100%
rename from chapter06/gdbm.xml
rename to chapter08/gdbm.xml
diff --git a/chapter08/gettext.xml b/chapter08/gettext.xml
new file mode 100644
index 000000000..2c4683804
--- /dev/null
+++ b/chapter08/gettext.xml
@@ -0,0 +1,445 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gettext
+ &gettext-version;
+ &gettext-url;
+
+
+ Gettext-&gettext-version;
+
+
+ Gettext
+
+
+
+
+
+ The Gettext package contains utilities for internationalization and
+ localization. These allow programs to be compiled with NLS (Native Language
+ Support), enabling them to output messages in the user's native
+ language.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &gettext-ch6-sbu;
+ &gettext-ch6-du;
+
+
+
+
+
+
+ Installation of Gettext
+
+
+
+
+
+
+
+ Prepare Gettext for compilation:
+
+./configure --prefix=/usr \
+ --disable-static \
+ --docdir=/usr/share/doc/gettext-&gettext-version;
+
+ Compile the package:
+
+make BISON_LOCALEDIR=/usr/share/locale
+
+
+ The meaning of the make parameter:
+
+
+ BISON_LOCALEDIR=/usr/share/locale
+
+ Since bison is not yet installed in /usr, configure hardcodes
+ the directory containing translations for the bison program (the
+ "locale" directory) as /tools/share/locale. Passing this variable
+ to make allows overriding the choice made by configure.
+
+
+
+
+
+ To test the results (this takes a long time, around 3 SBUs),
+ issue:
+
+make check
+
+ Install the package:
+
+make install
+chmod -v 0755 /usr/lib/preloadable_libintl.so
+
+
+
+
+ Contents of Gettext
+
+
+ Installed programs
+ Installed libraries
+ Installed directories
+
+
+ autopoint, envsubst, gettext, gettext.sh,
+ gettextize, msgattrib, msgcat, msgcmp, msgcomm, msgconv, msgen,
+ msgexec, msgfilter, msgfmt, msggrep, msginit, msgmerge, msgunfmt, msguniq,
+ ngettext, recode-sr-latin, and xgettext
+ libasprintf.so, libgettextlib.so, libgettextpo.so,
+ libgettextsrc.so, libtextstyle.so, and preloadable_libintl.so
+ /usr/lib/gettext, /usr/share/doc/gettext-&gettext-version;,
+ /usr/share/gettext, and /usr/share/gettext-0.19.8
+
+
+
+
+ Short Descriptions
+
+
+
+
+ autopoint
+
+ Copies standard Gettext infrastructure files into a source
+ package
+
+ autopoint
+
+
+
+
+
+ envsubst
+
+ Substitutes environment variables in shell format strings
+
+ envsubst
+
+
+
+
+
+ gettext
+
+ Translates a natural language message into the user's language
+ by looking up the translation in a message catalog
+
+ gettext
+
+
+
+
+
+ gettext.sh
+
+ Primarily serves as a shell function library for gettext
+
+ gettext.sh
+
+
+
+
+
+ gettextize
+
+ Copies all standard Gettext files into the given top-level
+ directory of a package to begin internationalizing it
+
+ gettextize
+
+
+
+
+
+ msgattrib
+
+ Filters the messages of a translation catalog according to their
+ attributes and manipulates the attributes
+
+ msgattrib
+
+
+
+
+
+ msgcat
+
+ Concatenates and merges the given
+ .po files
+
+ msgcat
+
+
+
+
+
+ msgcmp
+
+ Compares two .po
+ files to check that both contain the same set of msgid strings
+
+ msgcmp
+
+
+
+
+
+ msgcomm
+
+ Finds the messages that are common to the given
+ .po files
+
+ msgcomm
+
+
+
+
+
+ msgconv
+
+ Converts a translation catalog to a different character
+ encoding
+
+ msgconv
+
+
+
+
+
+ msgen
+
+ Creates an English translation catalog
+
+ msgen
+
+
+
+
+
+ msgexec
+
+ Applies a command to all translations of a translation
+ catalog
+
+ msgexec
+
+
+
+
+
+ msgfilter
+
+ Applies a filter to all translations of a translation
+ catalog
+
+ msgfilter
+
+
+
+
+
+ msgfmt
+
+ Generates a binary message catalog from a translation
+ catalog
+
+ msgfmt
+
+
+
+
+
+ msggrep
+
+ Extracts all messages of a translation catalog that match a
+ given pattern or belong to some given source files
+
+ msggrep
+
+
+
+
+
+ msginit
+
+ Creates a new .po file,
+ initializing the meta information with values from the user's
+ environment
+
+ msginit
+
+
+
+
+
+ msgmerge
+
+ Combines two raw translations into a single file
+
+ msgmerge
+
+
+
+
+
+ msgunfmt
+
+ Decompiles a binary message catalog into raw translation
+ text
+
+ msgunfmt
+
+
+
+
+
+ msguniq
+
+ Unifies duplicate translations in a translation catalog
+
+ msguniq
+
+
+
+
+
+ ngettext
+
+ Displays native language translations of a textual message whose
+ grammatical form depends on a number
+
+ ngettext
+
+
+
+
+
+ recode-sr-latin
+
+ Recodes Serbian text from Cyrillic to Latin script
+
+ recode-sr-latin
+
+
+
+
+
+ xgettext
+
+ Extracts the translatable message lines from the given source
+ files to make the first translation template
+
+ xgettext
+
+
+
+
+
+ libasprintf
+
+ defines the autosprintf class, which makes
+ C formatted output routines usable in C++ programs, for use with the
+ <string> strings and the
+ <iostream> streams
+
+ libasprintf
+
+
+
+
+
+ libgettextlib
+
+ a private library containing common routines used by the
+ various Gettext programs; these are not intended for general use
+
+ libgettextlib
+
+
+
+
+
+ libgettextpo
+
+ Used to write specialized programs that process
+ .po files; this library is
+ used when the standard applications shipped with Gettext (such as
+ msgcomm, msgcmp,
+ msgattrib, and msgen) will
+ not suffice
+
+ libgettextpo
+
+
+
+
+
+ libgettextsrc
+
+ A private library containing common routines used by the
+ various Gettext programs; these are not intended for general use
+
+ libgettextsrc
+
+
+
+
+
+ libtextstyle
+
+ Text styling library
+
+ libtextstyle
+
+
+
+
+
+ preloadable_libintl
+
+ A library, intended to be used by LD_PRELOAD that assists
+ libintl in logging
+ untranslated messages
+
+ preloadable_libintl
+
+
+
+
+
+
+
+
diff --git a/chapter08/glibc.xml b/chapter08/glibc.xml
new file mode 100644
index 000000000..a422c8d3c
--- /dev/null
+++ b/chapter08/glibc.xml
@@ -0,0 +1,970 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ glibc
+ &glibc-version;
+ &glibc-url;
+
+
+ Glibc-&glibc-version;
+
+
+ Glibc
+
+
+
+
+
+ The Glibc package contains the main C library. This library provides
+ the basic routines for allocating memory, searching directories, opening and
+ closing files, reading and writing files, string handling, pattern matching,
+ arithmetic, and so on.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &glibc-ch6-sbu;
+ &glibc-ch6-du;
+
+
+
+
+
+
+ Installation of Glibc
+
+ 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;
+
+
+ The Glibc documentation recommends building Glibc
+ in a dedicated build directory:
+
+mkdir -v build
+cd build
+
+ Prepare Glibc for compilation:
+
+../configure --prefix=/usr \
+ --disable-werror \
+ --enable-kernel=&min-kernel; \
+ --enable-stack-protector=strong \
+ --with-headers=/usr/include \
+ libc_cv_slibdir=/lib
+
+
+ The meaning of the options and new configure parameters:
+
+
+ CC="gcc -ffile-prefix-map=$LFS_DIR=$DIR"
+
+ Make GCC record any references to files in /usr/lib/gcc/x86_64-lfs-linux-gnu
+ in result of the compilation as if the files resided in /usr/lib/gcc/x86_64-pc-linux-gnu.
+ This avoids introduction of invalid paths in debugging
+ symbols.
+
+
+
+
+ --disable-werror
+
+ This option disables the -Werror option passed to
+ GCC. This is necessary for running the test suite.
+
+
+
+
+ --enable-stack-protector=strong
+
+ This option increases system security by adding
+ extra code to check for buffer overflows, such as stack
+ smashing attacks.
+
+
+
+
+ --with-headers=/usr/include
+
+ This option tells the build system where to find the
+ kernel API headers.
+
+
+
+
+ libc_cv_slibdir=/lib
+
+ This variable sets the correct library for all
+ systems. We do not want lib64 to be used.
+
+
+
+
+
+ Compile the package:
+
+make
+
+
+ In this section, the test suite for Glibc is considered critical.
+ Do not skip it under any circumstance.
+
+
+ Generally a few tests do not pass. The test failures listed below
+ are usually safe to ignore.
+
+
+case $(uname -m) in
+ i?86) ln -sfnv $PWD/elf/ld-linux.so.2 /lib ;;
+ x86_64) ln -sfnv $PWD/elf/ld-linux-x86-64.so.2 /lib ;;
+esac
+
+ The symbolic link above is needed to run the tests at this
+ stage of building in the chroot environment. It will be overwritten
+ in the install phase below.
+
+make check
+
+ You may see some test failures. The Glibc test suite is
+ somewhat dependent on the host system. This is a list of the most common
+ issues seen for some versions of LFS:
+
+
+
+
+ misc/tst-ttyname
+ is known to fail in the LFS chroot environment.
+
+
+
+ inet/tst-idna_name_classify
+ is known to fail in the LFS chroot environment.
+
+
+
+ posix/tst-getaddrinfo4 and
+ posix/tst-getaddrinfo5
+ may fail on some architectures.
+
+
+
+ The nss/tst-nss-files-hosts-multi
+ test may fail for reasons that have not been determined.
+
+
+
+ The rt/tst-cputimer{1,2,3} tests depend on
+ the host system kernel. Kernels 4.14.91–4.14.96,
+ 4.19.13–4.19.18, and 4.20.0–4.20.5 are known to
+ cause these tests to fail.
+
+
+
+
+ The math tests sometimes fail when running on
+ 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
+ complain about the absence of /etc/ld.so.conf.
+ Prevent this warning with:
+
+touch /etc/ld.so.conf
+
+ Fix the generated Makefile to skip an unneeded sanity check
+ that fails in the LFS partial environment:
+
+
+sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
+
+ Install the package:
+
+make install
+
+ Install the configuration file and runtime directory for
+ nscd:
+
+cp -v ../nscd/nscd.conf /etc/nscd.conf
+mkdir -pv /var/cache/nscd
+
+ Install the systemd support files for
+ nscd:
+
+ install -v -Dm644 ../nscd/nscd.tmpfiles /usr/lib/tmpfiles.d/nscd.conf
+install -v -Dm644 ../nscd/nscd.service /lib/systemd/system/nscd.service
+
+ Next, install the locales that can make the system respond in a
+ different language. None of the locales are required, but if some of them
+ are missing, the test suites of future packages would skip important
+ testcases.
+
+ Individual locales can be installed using the
+ localedef program. E.g., the first
+ localedef command below combines the
+ /usr/share/i18n/locales/cs_CZ
+ charset-independent locale definition with the
+ /usr/share/i18n/charmaps/UTF-8.gz
+ charmap definition and appends the result to the
+ /usr/lib/locale/locale-archive file.
+ The following instructions will install the minimum set of
+ locales necessary for the optimal coverage of tests:
+
+mkdir -pv /usr/lib/locale
+localedef -i POSIX -f UTF-8 C.UTF-8 2> /dev/null || true
+localedef -i cs_CZ -f UTF-8 cs_CZ.UTF-8
+localedef -i de_DE -f ISO-8859-1 de_DE
+localedef -i de_DE@euro -f ISO-8859-15 de_DE@euro
+localedef -i de_DE -f UTF-8 de_DE.UTF-8
+localedef -i el_GR -f ISO-8859-7 el_GR
+localedef -i en_GB -f UTF-8 en_GB.UTF-8
+localedef -i en_HK -f ISO-8859-1 en_HK
+localedef -i en_PH -f ISO-8859-1 en_PH
+localedef -i en_US -f ISO-8859-1 en_US
+localedef -i en_US -f UTF-8 en_US.UTF-8
+localedef -i es_MX -f ISO-8859-1 es_MX
+localedef -i fa_IR -f UTF-8 fa_IR
+localedef -i fr_FR -f ISO-8859-1 fr_FR
+localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro
+localedef -i fr_FR -f UTF-8 fr_FR.UTF-8
+localedef -i it_IT -f ISO-8859-1 it_IT
+localedef -i it_IT -f UTF-8 it_IT.UTF-8
+localedef -i ja_JP -f EUC-JP ja_JP
+localedef -i ja_JP -f SHIFT_JIS ja_JP.SIJS 2> /dev/null || true
+localedef -i ja_JP -f UTF-8 ja_JP.UTF-8
+localedef -i ru_RU -f KOI8-R ru_RU.KOI8-R
+localedef -i ru_RU -f UTF-8 ru_RU.UTF-8
+localedef -i tr_TR -f UTF-8 tr_TR.UTF-8
+localedef -i zh_CN -f GB18030 zh_CN.GB18030
+localedef -i zh_HK -f BIG5-HKSCS zh_HK.BIG5-HKSCS
+
+ In addition, install the locale for your own country, language and
+ character set.
+
+ Alternatively, install all locales listed in the
+ glibc-&glibc-version;/localedata/SUPPORTED file
+ (it includes every locale listed above and many more) at once with the
+ following time-consuming command:
+
+make localedata/install-locales
+
+ Then use the localedef command to create and
+ install locales not listed in the
+ glibc-&glibc-version;/localedata/SUPPORTED file
+ in the unlikely case you need them.
+
+ Glibc now uses libidn2 when resolving internationalized
+ domain names. This is a run time dependency. If this capability
+ is needed, the instructions for installing libidn2 are in the
+ BLFS libidn2 page.
+
+
+
+
+
+ Configuring Glibc
+
+
+ /etc/nsswitch.conf
+
+
+
+ /etc/localtime
+
+
+
+ Adding nsswitch.conf
+
+ The /etc/nsswitch.conf file needs to be created
+ because the Glibc defaults do not work well in a networked environment.
+
+
+ Create a new file /etc/nsswitch.conf by running the
+ following:
+
+cat > /etc/nsswitch.conf << "EOF"
+# Begin /etc/nsswitch.conf
+
+passwd: files
+group: files
+shadow: files
+
+hosts: files dns
+networks: files
+
+protocols: files
+services: files
+ethers: files
+rpc: files
+
+# End /etc/nsswitch.conf
+EOF
+
+
+
+
+ Adding time zone data
+
+ Install and set up the time zone data with the following:
+tar -xf ../../tzdata&tzdata-version;.tar.gz
+
+ZONEINFO=/usr/share/zoneinfo
+mkdir -pv $ZONEINFO/{posix,right}
+
+for tz in etcetera southamerica northamerica europe africa antarctica \
+ asia australasia backward pacificnew systemv; do
+ zic -L /dev/null -d $ZONEINFO ${tz}
+ zic -L /dev/null -d $ZONEINFO/posix ${tz}
+ zic -L leapseconds -d $ZONEINFO/right ${tz}
+done
+
+cp -v zone.tab zone1970.tab iso3166.tab $ZONEINFO
+zic -d $ZONEINFO -p America/New_York
+unset ZONEINFO
+
+
+ The meaning of the zic commands:
+
+
+ zic -L /dev/null ...
+
+ This creates posix time zones, without any leap seconds. It is
+ conventional to put these in both
+ zoneinfo and
+ zoneinfo/posix. It is
+ necessary to put the POSIX time zones in
+ zoneinfo, otherwise various
+ test-suites will report errors. On an embedded system, where space is
+ tight and you do not intend to ever update the time zones, you could save
+ 1.9MB by not using the posix
+ directory, but some applications or test-suites might produce some
+ failures.
+
+
+
+ zic -L leapseconds ...
+
+ This creates right time zones, including leap seconds. On an
+ embedded system, where space is tight and you do not intend to
+ ever update the time zones, or care about the correct time, you could
+ save 1.9MB by omitting the right
+ directory.
+
+
+
+ zic ... -p ...
+
+ This creates the posixrules file. We use
+ New York because POSIX requires the daylight savings time rules
+ to be in accordance with US rules.
+
+
+
+
+
+ One way to determine the local time zone is to run the following
+ script:
+
+tzselect
+
+ After answering a few questions about the location, the script will
+ output the name of the time zone (e.g.,
+ America/Edmonton). There are also some other possible
+ time zones listed in /usr/share/zoneinfo such as
+ Canada/Eastern or EST5EDT that
+ are not identified by the script but can be used.
+
+ Then create the /etc/localtime file by
+ running:
+
+ln -sfv /usr/share/zoneinfo/<xxx> /etc/localtime
+
+ Replace <xxx> with the name of the
+ time zone selected (e.g., Canada/Eastern).
+
+
+
+
+ Configuring the Dynamic Loader
+
+
+ /etc/ld.so.conf
+
+
+ By default, the dynamic loader (/lib/ld-linux.so.2) searches through
+ /lib and /usr/lib for dynamic libraries that are
+ needed by programs as they are run. However, if there are libraries in
+ directories other than /lib and
+ /usr/lib, these need to be added
+ to the /etc/ld.so.conf file in order for the
+ dynamic loader to find them. Two directories that are commonly known
+ to contain additional libraries are /usr/local/lib and /opt/lib, so add those directories to the
+ dynamic loader's search path.
+
+ Create a new file /etc/ld.so.conf by running the
+ following:
+
+cat > /etc/ld.so.conf << "EOF"
+# Begin /etc/ld.so.conf
+/usr/local/lib
+/opt/lib
+
+EOF
+
+ 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
+
+
+
+
+
+ Contents of Glibc
+
+
+ Installed programs
+ Installed libraries
+ Installed directories
+
+
+ catchsegv, gencat, getconf, getent, iconv, iconvconfig, ldconfig,
+ ldd, lddlibc4, locale, localedef, makedb, mtrace, nscd,
+ pcprofiledump, pldd, sln, sotruss, sprof, tzselect, xtrace,
+ zdump, and zic
+ ld-&glibc-version;.so, libBrokenLocale.{a,so}, libSegFault.so, libanl.{a,so},
+ libc.{a,so}, libc_nonshared.a,
+ libcrypt.{a,so}, libdl.{a,so}, libg.a, libm.{a,so},
+ libmcheck.a, libmemusage.so, libmvec.{a,so}, libnsl.{a,so},
+ libnss_compat.so, libnss_dns.so, libnss_files.so, libnss_hesiod.so,
+ libpcprofile.so, libpthread.{a,so},
+ libpthread_nonshared.a, libresolv.{a,so}, librt.{a,so},
+ libthread_db.so, and libutil.{a,so}
+ /usr/include/arpa, /usr/include/bits, /usr/include/gnu,
+ /usr/include/net, /usr/include/netash, /usr/include/netatalk,
+ /usr/include/netax25, /usr/include/neteconet, /usr/include/netinet,
+ /usr/include/netipx, /usr/include/netiucv, /usr/include/netpacket,
+ /usr/include/netrom, /usr/include/netrose, /usr/include/nfs,
+ /usr/include/protocols, /usr/include/rpc,
+ /usr/include/sys, /usr/lib/audit, /usr/lib/gconv, /usr/lib/locale,
+ /usr/libexec/getconf, /usr/share/i18n, /usr/share/zoneinfo,
+ /var/cache/nscd, and /var/lib/nss_db
+
+
+
+
+ Short Descriptions
+
+
+
+
+ catchsegv
+
+ Can be used to create a stack trace when a program
+ terminates with a segmentation fault
+
+ catchsegv
+
+
+
+
+
+ gencat
+
+ Generates message catalogues
+
+ gencat
+
+
+
+
+
+ getconf
+
+ Displays the system configuration values for file system
+ specific variables
+
+ getconf
+
+
+
+
+
+ getent
+
+ Gets entries from an administrative database
+
+ getent
+
+
+
+
+
+ iconv
+
+ Performs character set conversion
+
+ iconv
+
+
+
+
+
+ iconvconfig
+
+ Creates fastloading iconv module configuration
+ files
+
+ iconvconfig
+
+
+
+
+
+ ldconfig
+
+ Configures the dynamic linker runtime bindings
+
+ ldconfig
+
+
+
+
+
+ ldd
+
+ Reports which shared libraries are required
+ by each given program or shared library
+
+ ldd
+
+
+
+
+
+ lddlibc4
+
+ Assists ldd with object files
+
+ lddlibc4
+
+
+
+
+
+ locale
+
+ Prints various information about the current locale
+
+ locale
+
+
+
+
+
+ localedef
+
+ Compiles locale specifications
+
+ localedef
+
+
+
+
+
+ makedb
+
+ Creates a simple database from textual input
+
+ makedb
+
+
+
+
+
+ mtrace
+
+ Reads and interprets a memory trace file and displays a summary
+ in human-readable format
+
+ mtrace
+
+
+
+
+
+ nscd
+
+ A daemon that provides a cache for the most common name
+ service requests
+
+ nscd
+
+
+
+
+
+ pcprofiledump
+
+ Dump information generated by PC profiling
+
+ pcprofiledump
+
+
+
+
+
+ pldd
+
+ Lists dynamic shared objects used by running processes
+
+ pldd
+
+
+
+
+
+ sln
+
+ A statically linked ln program
+
+ sln
+
+
+
+
+
+ sotruss
+
+ Traces shared library procedure calls of a specified command
+
+ sotruss
+
+
+
+
+
+ sprof
+
+ Reads and displays shared object profiling data
+
+ sprof
+
+
+
+
+
+ tzselect
+
+ Asks the user about the location of the system and reports
+ the corresponding time zone description
+
+ tzselect
+
+
+
+
+
+ xtrace
+
+ Traces the execution of a program by printing the currently
+ executed function
+
+ xtrace
+
+
+
+
+
+ zdump
+
+ The time zone dumper
+
+ zdump
+
+
+
+
+
+ zic
+
+ The time zone compiler
+
+ zic
+
+
+
+
+
+ ld-&glibc-version;.so
+
+ The helper program for shared library executables
+
+ ld-&glibc-version;.so
+
+
+
+
+
+ libBrokenLocale
+
+ Used internally by Glibc as a gross hack to get broken programs
+ (e.g., some Motif applications) running. See comments in
+ glibc-&glibc-version;/locale/broken_cur_max.c
+ for more information
+
+ libBrokenLocale
+
+
+
+
+
+ libSegFault
+
+ The segmentation fault signal handler, used by
+ catchsegv
+
+ libSegFault
+
+
+
+
+
+ libanl
+
+ An asynchronous name lookup library
+
+ libanl
+
+
+
+
+
+ libc
+
+ The main C library
+
+ libc
+
+
+
+
+
+ libcrypt
+
+ The cryptography library
+
+ libcrypt
+
+
+
+
+
+ libdl
+
+ The dynamic linking interface library
+
+ libdl
+
+
+
+
+
+ libg
+
+ Dummy library containing no functions. Previously was a runtime
+ library for g++
+
+ libg
+
+
+
+
+
+ libm
+
+ The mathematical library
+
+ libm
+
+
+
+
+
+ libmcheck
+
+ Turns on memory allocation checking when linked to
+
+ libmcheck
+
+
+
+
+
+ libmemusage
+
+ Used by memusage to help collect
+ information about the memory usage of a program
+
+ libmemusage
+
+
+
+
+
+ libnsl
+
+ The network services library
+
+ libnsl
+
+
+
+
+
+ libnss
+
+ The Name Service Switch libraries, containing functions for
+ resolving host names, user names, group names, aliases, services,
+ protocols, etc.
+
+ libnss
+
+
+
+
+
+ libpcprofile
+
+ Can be preloaded to PC profile an executable
+
+ libpcprofile
+
+
+
+
+
+ libpthread
+
+ The POSIX threads library
+
+ libpthread
+
+
+
+
+
+ libresolv
+
+ Contains functions for creating, sending, and interpreting
+ packets to the Internet domain name servers
+
+ libresolv
+
+
+
+
+
+ librt
+
+ Contains functions providing most of the interfaces specified
+ by the POSIX.1b Realtime Extension
+
+ librt
+
+
+
+
+
+ libthread_db
+
+ Contains functions useful for building debuggers for
+ multi-threaded programs
+
+ libthread_db
+
+
+
+
+
+ libutil
+
+ Contains code for standard functions used in
+ many different Unix utilities
+
+ libutil
+
+
+
+
+
+
+
+
+
diff --git a/chapter06/gmp.xml b/chapter08/gmp.xml
similarity index 100%
rename from chapter06/gmp.xml
rename to chapter08/gmp.xml
diff --git a/chapter06/gperf.xml b/chapter08/gperf.xml
similarity index 100%
rename from chapter06/gperf.xml
rename to chapter08/gperf.xml
diff --git a/chapter08/grep.xml b/chapter08/grep.xml
new file mode 100644
index 000000000..58b0db366
--- /dev/null
+++ b/chapter08/grep.xml
@@ -0,0 +1,111 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ grep
+ &grep-version;
+ &grep-url;
+
+
+ Grep-&grep-version;
+
+
+ Grep
+
+
+
+
+
+ The Grep package contains programs for searching through files.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &grep-ch6-sbu;
+ &grep-ch6-du;
+
+
+
+
+
+
+ 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 100%
rename from chapter06/groff.xml
rename to chapter08/groff.xml
diff --git a/chapter08/grub.xml b/chapter08/grub.xml
index d6897d5e5..25a61077b 100644
--- a/chapter08/grub.xml
+++ b/chapter08/grub.xml
@@ -5,7 +5,7 @@
%general-entities;
]>
-
+
@@ -14,178 +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.
+
+
+ The GRUB package contains the GRand Unified Bootloader.
- 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.
+
+ &buildtime;
+ &diskspace;
-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-ch6-sbu;
+ &grub-ch6-du;
+
+
-
- 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
-
-
- 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..09eebbdf7
--- /dev/null
+++ b/chapter08/gzip.xml
@@ -0,0 +1,236 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ gzip
+ &gzip-version;
+ &gzip-url;
+
+
+ Gzip-&gzip-version;
+
+
+ Gzip
+
+
+
+
+
+ The Gzip package contains programs for compressing and decompressing
+ files.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &gzip-ch6-sbu;
+ &gzip-ch6-du;
+
+
+
+
+
+
+ Installation of Gzip
+
+ Prepare Gzip for compilation:
+
+./configure --prefix=/usr
+
+ Compile the package:
+
+make
+
+ To test the results, issue:
+
+make check
+
+ Two tests are known to fail in the LFS environment:
+ help-version and zmore.
+
+ 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 100%
rename from chapter06/iana-etc.xml
rename to chapter08/iana-etc.xml
diff --git a/chapter06/inetutils.xml b/chapter08/inetutils.xml
similarity index 100%
rename from chapter06/inetutils.xml
rename to chapter08/inetutils.xml
diff --git a/chapter06/intltool.xml b/chapter08/intltool.xml
similarity index 100%
rename from chapter06/intltool.xml
rename to chapter08/intltool.xml
diff --git a/chapter08/introduction.xml b/chapter08/introduction.xml
index 5cb40b882..c8ccb3908 100644
--- a/chapter08/introduction.xml
+++ b/chapter08/introduction.xml
@@ -5,14 +5,70 @@
%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 enter the building site and start constructing the
+ LFS system in earnest. That is, we chroot into the temporary mini Linux system,
+ make a few final preparations, and then begin installing the packages.
+
+ The installation of this software is straightforward. Although in many
+ cases the installation instructions could be made shorter and more generic,
+ we have opted to provide the full instructions for every package to minimize
+ the possibilities for mistakes. The key to learning what makes a Linux system
+ work is to know what each package is used for and why 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 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.
+
+
diff --git a/chapter06/iproute2.xml b/chapter08/iproute2.xml
similarity index 100%
rename from chapter06/iproute2.xml
rename to chapter08/iproute2.xml
diff --git a/chapter06/kbd.xml b/chapter08/kbd.xml
similarity index 100%
rename from chapter06/kbd.xml
rename to chapter08/kbd.xml
diff --git a/chapter06/kmod.xml b/chapter08/kmod.xml
similarity index 100%
rename from chapter06/kmod.xml
rename to chapter08/kmod.xml
diff --git a/chapter06/less.xml b/chapter08/less.xml
similarity index 100%
rename from chapter06/less.xml
rename to chapter08/less.xml
diff --git a/chapter06/libcap.xml b/chapter08/libcap.xml
similarity index 100%
rename from chapter06/libcap.xml
rename to chapter08/libcap.xml
diff --git a/chapter06/libelf.xml b/chapter08/libelf.xml
similarity index 100%
rename from chapter06/libelf.xml
rename to chapter08/libelf.xml
diff --git a/chapter06/libffi.xml b/chapter08/libffi.xml
similarity index 100%
rename from chapter06/libffi.xml
rename to chapter08/libffi.xml
diff --git a/chapter06/libpipeline.xml b/chapter08/libpipeline.xml
similarity index 100%
rename from chapter06/libpipeline.xml
rename to chapter08/libpipeline.xml
diff --git a/chapter06/libtool.xml b/chapter08/libtool.xml
similarity index 100%
rename from chapter06/libtool.xml
rename to chapter08/libtool.xml
diff --git a/chapter08/m4.xml b/chapter08/m4.xml
new file mode 100644
index 000000000..7fe282ee7
--- /dev/null
+++ b/chapter08/m4.xml
@@ -0,0 +1,104 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ m4
+ &m4-version;
+ &m4-url;
+
+
+ M4-&m4-version;
+
+
+ M4
+
+
+
+
+
+ The M4 package contains a macro processor.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &m4-ch6-sbu;
+ &m4-ch6-du;
+
+
+
+
+
+
+ Installation of M4
+
+ First, make some fixes required 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
+
+ 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/chapter08/make.xml b/chapter08/make.xml
new file mode 100644
index 000000000..9c649cdc5
--- /dev/null
+++ b/chapter08/make.xml
@@ -0,0 +1,99 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ make
+ &make-version;
+ &make-url;
+
+
+ Make-&make-version;
+
+
+ Make
+
+
+
+
+
+ The Make package contains a program for compiling packages.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &make-ch6-sbu;
+ &make-ch6-du;
+
+
+
+
+
+
+ Installation of Make
+
+ Prepare Make for compilation:
+
+./configure --prefix=/usr
+
+ 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
+
+
+
+
+
+ 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 100%
rename from chapter06/man-db.xml
rename to chapter08/man-db.xml
diff --git a/chapter06/man-pages.xml b/chapter08/man-pages.xml
similarity index 100%
rename from chapter06/man-pages.xml
rename to chapter08/man-pages.xml
diff --git a/chapter06/meson.xml b/chapter08/meson.xml
similarity index 100%
rename from chapter06/meson.xml
rename to chapter08/meson.xml
diff --git a/chapter06/mpc.xml b/chapter08/mpc.xml
similarity index 100%
rename from chapter06/mpc.xml
rename to chapter08/mpc.xml
diff --git a/chapter06/mpfr.xml b/chapter08/mpfr.xml
similarity index 100%
rename from chapter06/mpfr.xml
rename to chapter08/mpfr.xml
diff --git a/chapter08/ncurses.xml b/chapter08/ncurses.xml
new file mode 100644
index 000000000..b37f1f69c
--- /dev/null
+++ b/chapter08/ncurses.xml
@@ -0,0 +1,380 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ ncurses
+ &ncurses-version;
+ &ncurses-url;
+
+
+ Ncurses-&ncurses-version;
+
+
+ Ncurses
+
+
+
+
+
+ The Ncurses package contains libraries for terminal-independent
+ handling of character screens.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &ncurses-ch6-sbu;
+ &ncurses-ch6-du;
+
+
+
+
+
+
+ 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
+
+
+
+
+
+ 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 100%
rename from chapter06/ninja.xml
rename to chapter08/ninja.xml
diff --git a/chapter06/openssl.xml b/chapter08/openssl.xml
similarity index 100%
rename from chapter06/openssl.xml
rename to chapter08/openssl.xml
diff --git a/chapter08/patch.xml b/chapter08/patch.xml
new file mode 100644
index 000000000..6c6c6852b
--- /dev/null
+++ b/chapter08/patch.xml
@@ -0,0 +1,96 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ patch
+ &patch-version;
+ &patch-url;
+
+
+ Patch-&patch-version;
+
+
+ Patch
+
+
+
+
+
+ The Patch package contains a program for modifying or creating files
+ by applying a patch file typically created by the
+ diff program.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &patch-ch6-sbu;
+ &patch-ch6-du;
+
+
+
+
+
+
+ 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/chapter08/perl.xml b/chapter08/perl.xml
new file mode 100644
index 000000000..284464d87
--- /dev/null
+++ b/chapter08/perl.xml
@@ -0,0 +1,522 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ perl
+ &perl-version;
+ &perl-url;
+
+
+ Perl-&perl-version;
+
+
+ Perl
+
+
+
+
+
+ The Perl package contains the Practical Extraction and Report
+ Language.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &perl-ch6-sbu;
+ &perl-ch6-du;
+
+
+
+
+
+
+ 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.
+ Issue the following command so that Perl will use the libraries
+ installed on the system:
+
+export BUILD_ZLIB=False
+export BUILD_BZIP2=0
+
+
+ To have full control over the way Perl is set up, you can remove the
+ -des options from the following command and hand-pick the way
+ this package is built. Alternatively, use the command exactly as below to
+ use the defaults that Perl auto-detects:
+
+sh Configure -des -Dprefix=/usr \
+ -Dvendorprefix=/usr \
+ -Dman1dir=/usr/share/man/man1 \
+ -Dman3dir=/usr/share/man/man3 \
+ -Dpager="/usr/bin/less -isR" \
+ -Duseshrplib \
+ -Dusethreads
+
+
+ The meaning of the configure options:
+
+
+ -Dvendorprefix=/usr
+
+ This ensures perl knows how to
+ tell packages where they should install their perl modules.
+
+
+
+
+ -Dpager="/usr/bin/less -isR"
+
+ This ensures that less is used instead
+ of more.
+
+
+
+
+ -Dman1dir=/usr/share/man/man1
+ -Dman3dir=/usr/share/man/man3
+
+ Since Groff is not installed yet, Configure
+ thinks that we do not want man pages for Perl. Issuing these
+ parameters overrides this decision.
+
+
+
+
+ -Duseshrplib
+
+ Build a shared libperl needed by some perl modules.
+
+
+
+
+ -Dusethreads
+
+ Build perl with support for threads.
+
+
+
+
+
+ Compile the package:
+
+make
+
+ To test the results (approximately 11 SBU), issue:
+
+make test
+
+
+
+ Install the package and clean up:
+
+make install
+unset BUILD_ZLIB BUILD_BZIP2
+
+
+
+
+ Contents of Perl
+
+
+ Installed programs
+ Installed libraries
+ Installed directory
+
+
+ corelist, cpan, enc2xs, encguess, h2ph, h2xs, instmodsh,
+ json_pp, libnetcfg, perl, perl&perl-version; (hard link to perl),
+ perlbug, perldoc, perlivp, perlthanks (hard link to perlbug), piconv,
+ pl2pm, pod2html, pod2man, pod2text, pod2usage, podchecker, podselect,
+ prove, ptar, ptardiff, ptargrep, shasum,
+ splain, xsubpp, and zipdetails
+ Many which cannot all be listed here
+ /usr/lib/perl5
+
+
+
+
+ Short Descriptions
+
+
+
+
+ corelist
+
+ A commandline frontend to Module::CoreList
+
+ corelist
+
+
+
+
+
+ cpan
+
+ Interact with the Comprehensive Perl Archive Network (CPAN)
+ from the command line
+
+ cpan
+
+
+
+
+
+ enc2xs
+
+ Builds a Perl extension for the Encode module from either
+ Unicode Character Mappings or Tcl Encoding Files
+
+ enc2xs
+
+
+
+
+
+ encguess
+
+ Guess the encoding type of one or several files
+
+ encguess
+
+
+
+
+
+ h2ph
+
+ Converts .h C header
+ files to .ph Perl header
+ files
+
+ h2ph
+
+
+
+
+
+ h2xs
+
+ Converts .h C header
+ files to Perl extensions
+
+ h2xs
+
+
+
+
+
+ instmodsh
+
+ Shell script for examining installed Perl modules,
+ and can create a tarball from an installed module
+
+ instmodsh
+
+
+
+
+
+ json_pp
+
+ Converts data between certain input and output formats
+
+ json_pp
+
+
+
+
+
+ libnetcfg
+
+ Can be used to configure the
+ libnet Perl module
+
+ libnetcfg
+
+
+
+
+
+ perl
+
+ Combines some of the best features of C, sed,
+ awk and sh into a single
+ swiss-army language
+
+ perl
+
+
+
+
+
+ perl&perl-version;
+
+ A hard link to perl
+
+ perl&perl-version;
+
+
+
+
+
+ perlbug
+
+ Used to generate bug reports about Perl, or the modules that come
+ with it, and mail them
+
+ perlbug
+
+
+
+
+
+ perldoc
+
+ Displays a piece of documentation in pod format that is embedded
+ in the Perl installation tree or in a Perl script
+
+ perldoc
+
+
+
+
+
+ perlivp
+
+ The Perl Installation Verification Procedure; it can be used to
+ verify that Perl and its libraries have been installed
+ correctly
+
+ perlivp
+
+
+
+
+
+ perlthanks
+
+ Used to generate thank you messages to mail to the Perl
+ developers
+
+ perlthanks
+
+
+
+
+
+ piconv
+
+ A Perl version of the character encoding converter
+ iconv
+
+ piconv
+
+
+
+
+
+ pl2pm
+
+ A rough tool for converting Perl4
+ .pl files to Perl5
+ .pm modules
+
+ pl2pm
+
+
+
+
+
+ pod2html
+
+ Converts files from pod format to HTML format
+
+ pod2html
+
+
+
+
+
+ pod2man
+
+ Converts pod data to formatted *roff input
+
+ pod2man
+
+
+
+
+
+ pod2text
+
+ Converts pod data to formatted ASCII text
+
+ pod2text
+
+
+
+
+
+ pod2usage
+
+ Prints usage messages from embedded pod docs in files
+
+ pod2usage
+
+
+
+
+
+ podchecker
+
+ Checks the syntax of pod format documentation files
+
+ podchecker
+
+
+
+
+
+ podselect
+
+ Displays selected sections of pod documentation
+
+ podselect
+
+
+
+
+
+ prove
+
+ Command line tool for running tests against the Test::Harness
+ module
+
+ prove
+
+
+
+
+
+ ptar
+
+ A tar-like program written in Perl
+
+ ptar
+
+
+
+
+
+ ptardiff
+
+ A Perl program that compares an extracted archive with an
+ unextracted one
+
+ ptardiff
+
+
+
+
+
+ ptargrep
+
+ A Perl program that applies pattern matching to the contents
+ of files in a tar archive
+
+ ptargrep
+
+
+
+
+
+ shasum
+
+ Prints or checks SHA checksums
+
+ shasum
+
+
+
+
+
+ splain
+
+ Is used to force verbose warning diagnostics in Perl
+
+ splain
+
+
+
+
+
+ xsubpp
+
+ Converts Perl XS code into C code
+
+ xsubpp
+
+
+
+
+
+ zipdetails
+
+ Displays details about the internal structure of a Zip file
+
+ zipdetails
+
+
+
+
+
+
+
+
+
diff --git a/chapter06/pkgconfig.xml b/chapter08/pkgconfig.xml
similarity index 100%
rename from chapter06/pkgconfig.xml
rename to chapter08/pkgconfig.xml
diff --git a/chapter06/pkgmgt.xml b/chapter08/pkgmgt.xml
similarity index 100%
rename from chapter06/pkgmgt.xml
rename to chapter08/pkgmgt.xml
diff --git a/chapter06/procps.xml b/chapter08/procps.xml
similarity index 100%
rename from chapter06/procps.xml
rename to chapter08/procps.xml
diff --git a/chapter06/psmisc.xml b/chapter08/psmisc.xml
similarity index 100%
rename from chapter06/psmisc.xml
rename to chapter08/psmisc.xml
diff --git a/chapter08/python.xml b/chapter08/python.xml
new file mode 100644
index 000000000..cc440903d
--- /dev/null
+++ b/chapter08/python.xml
@@ -0,0 +1,253 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ Python
+ &python-version;
+ &python-url;
+
+
+ Python-&python-version;
+
+
+ python
+
+
+
+
+
+ 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.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &python-ch6-sbu;
+ &python-ch6-du;
+
+
+
+
+
+
+ Installation of Python 3
+
+ Prepare Python for compilation:
+
+./configure --prefix=/usr \
+ --enable-shared \
+ --with-system-expat \
+ --with-system-ffi \
+ --with-ensurepip=yes
+
+
+ The meaning of the configure options:
+
+
+ --with-system-expat
+
+ This switch enables linking against system version of
+ Expat.
+
+
+
+
+ --with-system-ffi
+
+ This switch enables linking against system version of
+ libffi.
+
+
+
+
+ --with-ensurepip=yes
+
+ This switch enables building pip and
+ setuptools packaging programs.
+
+
+
+
+
+ Compile the package:
+
+make
+
+ To test the results, issue make test.
+ Some tests requiring 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.
+
+ Install the package:
+
+make install
+chmod -v 755 /usr/lib/libpython&python-minor;.so
+chmod -v 755 /usr/lib/libpython3.so
+ln -sfv pip&python-minor; /usr/bin/pip3
+
+
+ The meaning of the install commands:
+
+
+ chmod -v 755 /usr/lib/libpython3.{8.,}so
+
+ Fix permissions for libraries to be consistent with other
+ libraries.
+
+
+
+
+
+ If desired, install the preformatted documentation:
+
+install -v -dm755 /usr/share/doc/python-&python-version;/html
+
+tar --strip-components=1 \
+ --no-same-owner \
+ --no-same-permissions \
+ -C /usr/share/doc/python-&python-version;/html \
+ -xvf ../python-&python-version;-docs-html.tar.bz2
+
+
+ The meaning of the documentation install commands:
+
+
+ and
+
+ Ensure the installed files have the correct ownership and
+ permissions. Without these options, using tar
+ will install the package files with the upstream creator's values.
+
+
+
+
+
+
+
+
+
+ Contents of Python 3
+
+
+ Installed Programs
+ Installed Library
+ Installed Directories
+
+
+
+ 2to3, idle3, pip3, pydoc3, python3, and python3-config
+
+
+ libpython&python-minor;.so and libpython3.so
+
+
+ /usr/include/python&python-minor;,
+ /usr/lib/python3, and
+ /usr/share/doc/python-&python-version;
+
+
+
+
+
+ Short Descriptions
+
+
+
+
+ 2to3
+
+
+ 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.
+
+
+ 2to3
+
+
+
+
+
+ idle3
+
+
+ is a wrapper script that opens a Python
+ aware GUI editor. For this script to run, you must have installed
+ Tk before Python so that the Tkinter
+ Python module is built.
+
+
+ idle3
+
+
+
+
+
+ pip3
+
+
+ The package installer for Python. You can use pip to install
+ packages from Python Package Index and other indexes.
+
+
+ pip3
+
+
+
+
+
+ pydoc3
+
+
+ is the Python documentation tool.
+
+
+ pydoc3
+
+
+
+
+
+ python3
+
+
+ is an interpreted, interactive, object-oriented programming
+ language.
+
+
+ python3
+
+
+
+
+
+
+
+
+
+
diff --git a/chapter06/readline.xml b/chapter08/readline.xml
similarity index 100%
rename from chapter06/readline.xml
rename to chapter08/readline.xml
diff --git a/chapter06/revisedchroot.xml b/chapter08/revisedchroot.xml
similarity index 100%
rename from chapter06/revisedchroot.xml
rename to chapter08/revisedchroot.xml
diff --git a/chapter08/sed.xml b/chapter08/sed.xml
new file mode 100644
index 000000000..030e77a0b
--- /dev/null
+++ b/chapter08/sed.xml
@@ -0,0 +1,97 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ sed
+ &sed-version;
+ &sed-url;
+
+
+ Sed-&sed-version;
+
+
+ Sed
+
+
+
+
+
+ The Sed package contains a stream editor.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &sed-ch6-sbu;
+ &sed-ch6-du;
+
+
+
+
+
+
+ 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 100%
rename from chapter06/shadow.xml
rename to chapter08/shadow.xml
diff --git a/chapter06/strippingagain.xml b/chapter08/strippingagain.xml
similarity index 100%
rename from chapter06/strippingagain.xml
rename to chapter08/strippingagain.xml
diff --git a/chapter06/sysklogd.xml b/chapter08/sysklogd.xml
similarity index 100%
rename from chapter06/sysklogd.xml
rename to chapter08/sysklogd.xml
diff --git a/chapter06/systemd.xml b/chapter08/systemd.xml
similarity index 100%
rename from chapter06/systemd.xml
rename to chapter08/systemd.xml
diff --git a/chapter06/sysvinit.xml b/chapter08/sysvinit.xml
similarity index 100%
rename from chapter06/sysvinit.xml
rename to chapter08/sysvinit.xml
diff --git a/chapter08/tar.xml b/chapter08/tar.xml
new file mode 100644
index 000000000..d148c4695
--- /dev/null
+++ b/chapter08/tar.xml
@@ -0,0 +1,116 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ tar
+ &tar-version;
+ &tar-url;
+
+
+ Tar-&tar-version;
+
+
+ Tar
+
+
+
+
+
+ The Tar package contains an archiving program.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &tar-ch6-sbu;
+ &tar-ch6-du;
+
+
+
+
+
+
+ Installation of Tar
+
+ Prepare Tar for compilation:
+
+FORCE_UNSAFE_CONFIGURE=1 \
+./configure --prefix=/usr \
+ --bindir=/bin
+
+
+ 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;
+
+
+
+
+
+ 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/chapter08/texinfo.xml b/chapter08/texinfo.xml
new file mode 100644
index 000000000..d61df477b
--- /dev/null
+++ b/chapter08/texinfo.xml
@@ -0,0 +1,237 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ texinfo
+ &texinfo-version;
+ &texinfo-url;
+
+
+ Texinfo-&texinfo-version;
+
+
+ Texinfo
+
+
+
+
+
+ The Texinfo package contains programs for reading, writing, and
+ converting info pages.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &texinfo-ch6-sbu;
+ &texinfo-ch6-du;
+
+
+
+
+
+
+ Installation of Texinfo
+
+ Prepare Texinfo for compilation:
+
+./configure --prefix=/usr --disable-static
+
+
+ The meaning of the configure options:
+
+
+ --disable-static
+
+ In this case, the top-level configure script will complain that
+ this is an unrecognized option, but the configure script for
+ XSParagraph recognizes it and uses it to disable installing a static
+ XSParagraph.a to /usr/lib/texinfo.
+
+
+
+
+
+ Compile the package:
+
+make
+
+ To test the results, issue:
+
+make check
+
+ Install the package:
+
+make install
+
+ Optionally, install the components belonging in a TeX
+ installation:
+
+
+make TEXMF=/usr/share/texmf install-tex
+
+
+ The meaning of the make parameter:
+
+
+ TEXMF=/usr/share/texmf
+
+ The TEXMF makefile variable holds the location
+ of the root of the TeX tree if, for example, a TeX package will be
+ installed later.
+
+
+
+
+
+ The Info documentation system uses a plain text file to hold its list of
+ menu entries. The file is located at /usr/share/info/dir.
+ Unfortunately, due to occasional problems in the Makefiles of various packages,
+ it can sometimes get out of sync with the info pages installed on the system.
+ If the /usr/share/info/dir file ever needs to be
+ recreated, the following optional commands will accomplish the task:
+
+pushd /usr/share/info
+rm -v dir
+for f in *
+ do install-info $f dir 2>/dev/null
+done
+popd
+
+
+
+
+ Contents of Texinfo
+
+
+ Installed programs
+ Installed library
+ Installed directories
+
+
+ info, install-info, makeinfo (link to texi2any),
+ pdftexi2dvi, pod2texi, texi2any, texi2dvi, texi2pdf, and texindex
+ MiscXS.so, Parsetexi.so, and XSParagraph.so
+ (all in /usr/lib/texinfo)
+ /usr/share/texinfo and /usr/lib/texinfo
+
+
+
+
+ Short Descriptions
+
+
+
+
+ info
+
+ Used to read info pages which are similar to man pages, but
+ often go much deeper than just explaining all the available command
+ line options [For example, compare man bison and
+ info bison.]
+
+ info
+
+
+
+
+
+ install-info
+
+ Used to install info pages; it updates entries in the
+ info index file
+
+ install-info
+
+
+
+
+
+ makeinfo
+
+ Translates the given Texinfo source documents into
+ info pages, plain text, or HTML
+
+ makeinfo
+
+
+
+
+
+ pdftexi2dvi
+
+ Used to format the given Texinfo document into a
+ Portable Document Format (PDF) file
+
+ pdftexi2dvi
+
+
+
+
+
+ pod2texi
+
+ Converts Pod to Texinfo format
+
+ pod2texi
+
+
+
+
+
+ texi2any
+
+ Translate Texinfo source documentation to
+ various other formats
+
+ texi2any
+
+
+
+
+
+ texi2dvi
+
+ Used to format the given Texinfo document into a
+ device-independent file that can be printed
+
+ texi2dvi
+
+
+
+
+
+ texi2pdf
+
+ Used to format the given Texinfo document into a
+ Portable Document Format (PDF) file
+
+ texi2pdf
+
+
+
+
+
+ texindex
+
+ Used to sort Texinfo index files
+
+ texindex
+
+
+
+
+
+
+
+
+
diff --git a/chapter08/util-linux.xml b/chapter08/util-linux.xml
new file mode 100644
index 000000000..519c3b171
--- /dev/null
+++ b/chapter08/util-linux.xml
@@ -0,0 +1,1319 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ util-linux
+ &util-linux-version;
+ &util-linux-url;
+
+
+ Util-linux-&util-linux-version;
+
+
+ Util-linux
+
+
+
+
+
+ The Util-linux package contains miscellaneous utility programs.
+ Among them are utilities for handling file systems, consoles, partitions,
+ and messages.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &util-linux-ch6-sbu;
+ &util-linux-ch6-du;
+
+
+
+
+
+
+ Installation of Util-linux
+
+ The FHS recommends using the /var/lib/hwclock directory instead of the
+ usual /etc directory as the
+ location for the adjtime file. Create this directory
+ with:
+
+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 \
+ --without-systemd \
+ --without-systemdsystemunitdir
+
+./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 --disable and --without options prevent warnings about
+ building components that require packages not in LFS or are
+ inconsistent with programs installed by other packages.
+
+ Compile the package:
+
+make
+
+ If desired, run the test suite as a non-root user:
+
+ 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
+ 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:
+
+bash tests/run.sh --srcdir=$PWD --builddir=$PWD
+
+
+chown -Rv tester .
+su tester -c "make -k check"
+
+ Install the package:
+
+make install
+
+
+
+
+ Contents of Util-linux
+
+
+ Installed programs
+ Installed libraries
+ Installed directories
+
+
+ addpart, agetty, blkdiscard, blkid, blkzone, blockdev, cal, cfdisk, chcpu,
+ chmem, choom, chrt, col, colcrt, colrm, column, ctrlaltdel, delpart, dmesg,
+ eject, fallocate, fdformat, fdisk, fincore, findfs, findmnt, flock, fsck,
+ fsck.cramfs, fsck.minix, fsfreeze, fstrim, getopt, hexdump, hwclock,
+ i386, ionice, ipcmk, ipcrm, ipcs, isosize, kill, last, lastb (link to
+ last), ldattach, linux32, linux64, logger, look, losetup, lsblk, lscpu,
+ lsipc, lslocks, lslogins, lsmem, lsns, mcookie, mesg, mkfs, mkfs.bfs, mkfs.cramfs, mkfs.minix, mkswap,
+ more, mount, mountpoint, namei, nsenter, partx, pivot_root, prlimit, raw,
+ readprofile, rename, renice, resizepart, rev, rfkill, rtcwake, script,
+ scriptreplay, setarch, setsid, setterm, sfdisk, sulogin, swaplabel,
+ swapoff (link to swapon), swapon, switch_root, taskset, ul,
+ umount, uname26, unshare, utmpdump, uuidd, uuidgen, uuidparse, wall, wdctl, whereis,
+ wipefs, x86_64, and zramctl
+ libblkid.so, libfdisk.so, libmount.so,
+ libsmartcols.so, and libuuid.so
+ /usr/include/blkid,
+ /usr/include/libfdisk,
+ /usr/include/libmount,
+ /usr/include/libsmartcols,
+ /usr/include/uuid,
+ /usr/share/doc/util-linux-&util-linux-version;,
+ and /var/lib/hwclock
+
+
+
+
+ Short Descriptions
+
+
+
+
+ addpart
+
+ Informs the Linux kernel of new partitions
+
+ addpart
+
+
+
+
+
+ agetty
+
+ Opens a tty port, prompts for a login name,
+ and then invokes the login program
+
+ agetty
+
+
+
+
+
+ blkdiscard
+
+ Discards sectors on a device
+
+ blkdiscard
+
+
+
+
+
+ blkid
+
+ A command line utility to locate and print block device
+ attributes
+
+ blkid
+
+
+
+
+
+ blkzone
+
+ Runs zone command on the given block device
+
+ blkzone
+
+
+
+
+
+ blockdev
+
+ Allows users to call block device ioctls from the command
+ line
+
+ blockdev
+
+
+
+
+
+ cal
+
+ Displays a simple calendar
+
+ cal
+
+
+
+
+
+ cfdisk
+
+ Manipulates the partition table of the given device
+
+ cfdisk
+
+
+
+
+
+ chcpu
+
+ Modifies the state of CPUs
+
+ chcpu
+
+
+
+
+
+ chmem
+
+ Configures memory
+
+ chmem
+
+
+
+
+
+ choom
+
+ Displays and adjusts OOM-killer score
+
+ choom
+
+
+
+
+
+ chrt
+
+ Manipulates real-time attributes of a process
+
+ chrt
+
+
+
+
+
+ col
+
+ Filters out reverse line feeds
+
+ col
+
+
+
+
+
+ colcrt
+
+ Filters nroff output for terminals
+ that lack some capabilities, such as overstriking and half-lines
+
+ colcrt
+
+
+
+
+
+ colrm
+
+ Filters out the given columns
+
+ colrm
+
+
+
+
+
+ column
+
+ Formats a given file into multiple columns
+
+ column
+
+
+
+
+
+ ctrlaltdel
+
+ Sets the function of the Ctrl+Alt+Del key combination to a
+ hard or a soft reset
+
+ ctrlaltdel
+
+
+
+
+
+ delpart
+
+ Asks the Linux kernel to remove a partition
+
+ delpart
+
+
+
+
+
+ dmesg
+
+ Dumps the kernel boot messages
+
+ dmesg
+
+
+
+
+
+ eject
+
+ Ejects removable media
+
+ eject
+
+
+
+
+
+ fallocate
+
+ Preallocates space to a file
+
+ fallocate
+
+
+
+
+
+ fdformat
+
+ Low-level formats a floppy disk
+
+ fdformat
+
+
+
+
+
+ fdisk
+
+ Manipulates the partition table of the given device
+
+ fdisk
+
+
+
+
+
+ fincore
+
+ Counts pages of file contents in core
+
+ fincore
+
+
+
+
+
+ findfs
+
+ Finds a file system by label or Universally Unique Identifier
+ (UUID)
+
+ findfs
+
+
+
+
+
+ findmnt
+
+ Is a command line interface to the libmount library
+ for work with mountinfo, fstab and mtab files
+
+ findmnt
+
+
+
+
+
+ flock
+
+ Acquires a file lock and then executes a command with the lock
+ held
+
+ flock
+
+
+
+
+
+ fsck
+
+ Is used to check, and optionally repair, file systems
+
+ fsck
+
+
+
+
+
+ fsck.cramfs
+
+ Performs a consistency check on the Cramfs file system on the
+ given device
+
+ fsck.cramfs
+
+
+
+
+
+ fsck.minix
+
+ Performs a consistency check on the Minix file system on the
+ given device
+
+ fsck.minix
+
+
+
+
+
+ fsfreeze
+
+ Is a very simple wrapper around FIFREEZE/FITHAW ioctl
+ kernel driver operations
+
+ fsfreeze
+
+
+
+
+
+ fstrim
+
+ Discards unused blocks on a mounted filesystem
+
+ fstrim
+
+
+
+
+
+ getopt
+
+ Parses options in the given command line
+
+ getopt
+
+
+
+
+
+ hexdump
+
+ Dumps the given file in hexadecimal or in another given
+ format
+
+ hexdump
+
+
+
+
+
+ hwclock
+
+ Reads or sets the system's hardware clock, also called
+ the Real-Time Clock (RTC) or Basic Input-Output System (BIOS)
+ clock
+
+ hwclock
+
+
+
+
+
+ i386
+
+ A symbolic link to setarch
+
+ i386
+
+
+
+
+
+ ionice
+
+ Gets or sets the io scheduling class and priority for a program
+
+ ionice
+
+
+
+
+
+ ipcmk
+
+ Creates various IPC resources
+
+ ipcmk
+
+
+
+
+
+ ipcrm
+
+ Removes the given Inter-Process Communication (IPC) resource
+
+ ipcrm
+
+
+
+
+
+ ipcs
+
+ Provides IPC status information
+
+ ipcs
+
+
+
+
+
+ isosize
+
+ Reports the size of an iso9660 file system
+
+ isosize
+
+
+
+
+
+ kill
+
+ Sends signals to processes
+
+ kill
+
+
+
+
+
+ last
+
+ Shows which users last logged in (and out), searching back
+ through the /var/log/wtmp file; it also shows
+ system boots, shutdowns, and run-level changes
+
+ last
+
+
+
+
+
+ lastb
+
+ Shows the failed login attempts, as logged in
+ /var/log/btmp
+
+ lastb
+
+
+
+
+
+ ldattach
+
+ Attaches a line discipline to a serial line
+
+ ldattach
+
+
+
+
+
+ linux32
+
+ A symbolic link to setarch
+
+ linux32
+
+
+
+
+
+ linux64
+
+ A symbolic link to setarch
+
+ linux64
+
+
+
+
+
+ logger
+
+ Enters the given message into the system log
+
+ logger
+
+
+
+
+
+ look
+
+ Displays lines that begin with the given string
+
+ look
+
+
+
+
+
+ losetup
+
+ Sets up and controls loop devices
+
+ losetup
+
+
+
+
+
+ lsblk
+
+ Lists information about all or selected block devices in
+ a tree-like format
+
+ lsblk
+
+
+
+
+
+ lscpu
+
+ Prints CPU architecture information
+
+ lscpu
+
+
+
+
+
+ lsipc
+
+ Prints information on IPC facilities currently employed
+ in the system
+
+ lsipc
+
+
+
+
+
+ lslocks
+
+ Lists local system locks
+
+ lslocks
+
+
+
+
+
+ lslogins
+
+ Lists information about users, groups and system accounts
+
+ lslogins
+
+
+
+
+
+ lsmem
+
+ Lists the ranges of available memory with their online
+ status
+
+ lsmem
+
+
+
+
+
+ lsns
+
+ Lists namespaces
+
+ lsns
+
+
+
+
+
+ mcookie
+
+ Generates magic cookies (128-bit random hexadecimal numbers) for
+ xauth
+
+ mcookie
+
+
+
+
+
+ mesg
+
+ Controls whether other users can send messages to the current
+ user's terminal
+
+ mesg
+
+
+
+
+
+ mkfs
+
+ Builds a file system on a device (usually a hard disk
+ partition)
+
+ mkfs
+
+
+
+
+
+ mkfs.bfs
+
+ Creates a Santa Cruz Operations (SCO) bfs file system
+
+ mkfs.bfs
+
+
+
+
+
+ mkfs.cramfs
+
+ Creates a cramfs file system
+
+ mkfs.cramfs
+
+
+
+
+
+ mkfs.minix
+
+ Creates a Minix file system
+
+ mkfs.minix
+
+
+
+
+
+ mkswap
+
+ Initializes the given device or file to be used as a swap
+ area
+
+ mkswap
+
+
+
+
+
+ more
+
+ A filter for paging through text one screen at a time
+
+ more
+
+
+
+
+
+ mount
+
+ Attaches the file system on the given device to a specified
+ directory in the file-system tree
+
+ mount
+
+
+
+
+
+ mountpoint
+
+ Checks if the directory is a mountpoint
+
+ mountpoint
+
+
+
+
+
+ namei
+
+ Shows the symbolic links in the given pathnames
+
+ namei
+
+
+
+
+
+ nsenter
+
+ Runs a program with namespaces of other processes
+
+ nsenter
+
+
+
+
+
+ partx
+
+ Tells the kernel about the presence and numbering of on-disk
+ partitions
+
+ partx
+
+
+
+
+
+ pivot_root
+
+ Makes the given file system the new root file system of the
+ current process
+
+ pivot_root
+
+
+
+
+
+ prlimit
+
+ Get and set a process' resource limits
+
+ prlimit
+
+
+
+
+
+ raw
+
+ Bind a Linux raw character device to a block device
+
+ raw
+
+
+
+
+
+ readprofile
+
+ Reads kernel profiling information
+
+ readprofile
+
+
+
+
+
+ rename
+
+ Renames the given files, replacing a given string with
+ another
+
+ rename
+
+
+
+
+
+ renice
+
+ Alters the priority of running processes
+
+ renice
+
+
+
+
+
+ resizepart
+
+ Asks the Linux kernel to resize a partition
+
+ resizepart
+
+
+
+
+
+ rev
+
+ Reverses the lines of a given file
+
+ rev
+
+
+
+
+
+ rkfill
+
+ Tool for enabling and disabling wireless devices
+
+ rkfill
+
+
+
+
+
+ rtcwake
+
+ Used to enter a system sleep state until specified wakeup
+ time
+
+ rtcwake
+
+
+
+
+
+ script
+
+ Makes a typescript of a terminal session
+
+ script
+
+
+
+
+
+ scriptreplay
+
+ Plays back typescripts using timing information
+
+ scriptreplay
+
+
+
+
+
+ setarch
+
+ Changes reported architecture in a new program environment and
+ sets personality flags
+
+ setarch
+
+
+
+
+
+ setsid
+
+ Runs the given program in a new session
+
+ setsid
+
+
+
+
+
+ setterm
+
+ Sets terminal attributes
+
+ setterm
+
+
+
+
+
+ sfdisk
+
+ A disk partition table manipulator
+
+ sfdisk
+
+
+
+
+
+ sulogin
+
+ Allows root to log in;
+ it is normally invoked by init when the system goes
+ into single user mode
+
+ sulogin
+
+
+
+
+
+ swaplabel
+
+ Allows to change swaparea UUID and label
+
+ swaplabel
+
+
+
+
+
+ swapoff
+
+ Disables devices and files for paging and swapping
+
+ swapoff
+
+
+
+
+
+ swapon
+
+ Enables devices and files for paging and swapping and
+ lists the devices and files currently in use
+
+ swapon
+
+
+
+
+
+ switch_root
+
+ Switches to another filesystem as the root of the mount tree
+
+ switch_root
+
+
+
+
+
+ tailf
+
+ Tracks the growth of a log file; displays the last 10 lines
+ of a log file, then continues displaying any new entries in the
+ log file as they are created
+
+ tailf
+
+
+
+
+
+ taskset
+
+ Retrieves or sets a process' CPU affinity
+
+ taskset
+
+
+
+
+
+ ul
+
+ A filter for translating underscores into escape sequences
+ indicating underlining for the terminal in use
+
+ ul
+
+
+
+
+
+ umount
+
+ Disconnects a file system from the system's file tree
+
+ umount
+
+
+
+
+
+ uname26
+
+ A symbolic link to setarch
+
+ uname26
+
+
+
+
+
+ unshare
+
+ Runs a program with some namespaces unshared from parent
+
+ unshare
+
+
+
+
+
+ utmpdump
+
+ Displays the content of the given login file in a more
+ user-friendly format
+
+ utmpdump
+
+
+
+
+
+ uuidd
+
+ A daemon used by the UUID library to generate time-based
+ UUIDs in a secure and guaranteed-unique fashion
+
+ uuidd
+
+
+
+
+
+ uuidgen
+
+ Creates new UUIDs. Each new UUID can reasonably be considered
+ unique among all UUIDs created, on the local system and on other
+ systems, in the past and in the future
+
+ uuidgen
+
+
+
+
+
+ uuidparse
+
+ An utility to parse unique identifiers
+
+ uuidparse
+
+
+
+
+
+ wall
+
+ Displays the contents of a file or, by default, its standard
+ input, on the terminals of all currently logged in users
+
+ wall
+
+
+
+
+
+ wdctl
+
+ Shows hardware watchdog status
+
+ wdctl
+
+
+
+
+
+ whereis
+
+ Reports the location of the binary, source, and man page
+ for the given command
+
+ whereis
+
+
+
+
+
+ wipefs
+
+ Wipes a filesystem signature from a device
+
+ wipefs
+
+
+
+
+
+ x86_64
+
+ A symbolic link to setarch
+
+ x86_64
+
+
+
+
+
+ zramctl
+
+ A program to set up and control zram (compressed ram disk)
+ devices
+
+ zramctl
+
+
+
+
+
+ libblkid
+
+ Contains routines for device identification and token
+ extraction
+
+ libblkid
+
+
+
+
+
+ libfdisk
+
+ Contains routines for manipulating partition tables
+
+ libfdisk
+
+
+
+
+
+ libmount
+
+ Contains routines for block device mounting and
+ unmounting
+
+ libmount
+
+
+
+
+
+ libsmartcols
+
+ Contains routines for aiding screen output in tabular form
+
+ libsmartcols
+
+
+
+
+
+ libuuid
+
+ Contains routines for generating unique identifiers for objects
+ that may be accessible beyond the local system
+
+ libuuid
+
+
+
+
+
+
+
+
+
diff --git a/chapter06/vim.xml b/chapter08/vim.xml
similarity index 100%
rename from chapter06/vim.xml
rename to chapter08/vim.xml
diff --git a/chapter06/xml-parser.xml b/chapter08/xml-parser.xml
similarity index 100%
rename from chapter06/xml-parser.xml
rename to chapter08/xml-parser.xml
diff --git a/chapter08/xz.xml b/chapter08/xz.xml
new file mode 100644
index 000000000..5a342b2ff
--- /dev/null
+++ b/chapter08/xz.xml
@@ -0,0 +1,364 @@
+
+
+ %general-entities;
+]>
+
+
+
+
+
+ xz
+ &xz-version;
+ &xz-url;
+
+
+ Xz-&xz-version;
+
+
+ Xz
+
+
+
+
+
+ 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 xz yields a better
+ compression percentage than with the traditional gzip or
+ bzip2 commands.
+
+
+ &buildtime;
+ &diskspace;
+
+
+ &xz-ch6-sbu;
+ &xz-ch6-du;
+
+
+
+
+
+
+ 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
+
+
+
+
+ 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 100%
rename from chapter06/zlib.xml
rename to chapter08/zlib.xml
diff --git a/chapter06/zstd.xml b/chapter08/zstd.xml
similarity index 100%
rename from chapter06/zstd.xml
rename to chapter08/zstd.xml
diff --git a/chapter07/bootscripts.xml b/chapter09/bootscripts.xml
similarity index 100%
rename from chapter07/bootscripts.xml
rename to chapter09/bootscripts.xml
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 100%
rename from chapter07/clock.xml
rename to chapter09/clock.xml
diff --git a/chapter07/consoled.xml b/chapter09/consoled.xml
similarity index 100%
rename from chapter07/consoled.xml
rename to chapter09/consoled.xml
diff --git a/chapter07/etcshells.xml b/chapter09/etcshells.xml
similarity index 100%
rename from chapter07/etcshells.xml
rename to chapter09/etcshells.xml
diff --git a/chapter07/inputrc.xml b/chapter09/inputrc.xml
similarity index 100%
rename from chapter07/inputrc.xml
rename to chapter09/inputrc.xml
diff --git a/chapter09/introduction.xml b/chapter09/introduction.xml
new file mode 100644
index 000000000..cbc197a7b
--- /dev/null
+++ b/chapter09/introduction.xml
@@ -0,0 +1,225 @@
+
+
+ %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
+
+
+
+ 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 100%
rename from chapter07/introductiond.xml
rename to chapter09/introductiond.xml
diff --git a/chapter07/locale.xml b/chapter09/locale.xml
similarity index 100%
rename from chapter07/locale.xml
rename to chapter09/locale.xml
diff --git a/chapter07/network.xml b/chapter09/network.xml
similarity index 100%
rename from chapter07/network.xml
rename to chapter09/network.xml
diff --git a/chapter07/networkd.xml b/chapter09/networkd.xml
similarity index 100%
rename from chapter07/networkd.xml
rename to chapter09/networkd.xml
diff --git a/chapter07/profile.xml b/chapter09/profile.xml
similarity index 100%
rename from chapter07/profile.xml
rename to chapter09/profile.xml
diff --git a/chapter07/symlinks.xml b/chapter09/symlinks.xml
similarity index 100%
rename from chapter07/symlinks.xml
rename to chapter09/symlinks.xml
diff --git a/chapter07/systemd-custom.xml b/chapter09/systemd-custom.xml
similarity index 100%
rename from chapter07/systemd-custom.xml
rename to chapter09/systemd-custom.xml
diff --git a/chapter07/udev.xml b/chapter09/udev.xml
similarity index 100%
rename from chapter07/udev.xml
rename to chapter09/udev.xml
diff --git a/chapter07/usage.xml b/chapter09/usage.xml
similarity index 100%
rename from chapter07/usage.xml
rename to chapter09/usage.xml
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..d6897d5e5
--- /dev/null
+++ b/chapter10/grub.xml
@@ -0,0 +1,191 @@
+
+
+ %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. 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 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.
+
+ 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..5cb40b882
--- /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 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.
+
+
diff --git a/chapter08/kernel.xml b/chapter10/kernel.xml
similarity index 100%
rename from chapter08/kernel.xml
rename to chapter10/kernel.xml
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
diff --git a/chapter09/theend.xml b/chapter11/theend.xml
similarity index 100%
rename from chapter09/theend.xml
rename to chapter11/theend.xml
diff --git a/chapter09/whatnow.xml b/chapter11/whatnow.xml
similarity index 100%
rename from chapter09/whatnow.xml
rename to chapter11/whatnow.xml
diff --git a/general.ent b/general.ent
index 0ce471efc..a0a3cd90f 100644
--- a/general.ent
+++ b/general.ent
@@ -1,13 +1,13 @@
-
+
-
+
-
+
diff --git a/index.xml b/index.xml
index d20257f57..e22079d1b 100644
--- a/index.xml
+++ b/index.xml
@@ -23,19 +23,26 @@
-
-Building the LFS System
+Building the LFS Cross Toolchain and Temporary Tools
+
-
-
+Building the LFS System
+
+
+
+
+
+
+
+Appendices