From fcc027677da55c41dcaea045f5b9ff8b088e6495 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Sun, 7 Jun 2020 20:16:00 +0000 Subject: [PATCH] Initial commit of alternative cross LFS git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11897 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- Makefile | 4 +- chapter05/binutils-pass1.xml | 2 +- chapter05/chapter05.xml | 38 +- chapter05/gcc-pass1.xml | 2 +- chapter05/glibc.xml | 2 +- chapter06/bash.xml | 137 +- chapter06/binutils-pass1.xml | 156 +++ chapter06/binutils-pass2.xml | 94 ++ chapter06/bison.xml | 110 +- chapter06/bzip2.xml | 202 +-- chapter06/changingowner.xml | 41 + chapter06/chapter06.xml | 93 +- chapter06/chroot.xml | 65 + chapter06/coreutils.xml | 1262 +----------------- chapter06/createfiles.xml | 204 +++ chapter06/creatingdirs.xml | 59 + chapter06/dejagnu.xml | 96 ++ chapter06/diffutils.xml | 85 +- chapter06/expect.xml | 139 ++ chapter06/file.xml | 75 +- chapter06/findutils.xml | 124 +- chapter06/flex.xml | 127 +- chapter06/gawk.xml | 86 +- chapter06/gcc-pass1.xml | 208 +++ chapter06/gcc-pass2.xml | 160 +++ chapter06/generalinstructions.xml | 120 ++ chapter06/gettext.xml | 424 +----- chapter06/glibc.xml | 1018 ++------------ chapter06/grep.xml | 73 +- chapter06/grub.xml | 374 ------ chapter06/gzip.xml | 196 +-- chapter06/introduction.xml | 77 +- chapter06/kernfs.xml | 115 ++ chapter06/libstdc++-pass2.xml | 114 ++ chapter06/libstdc++.xml | 122 ++ chapter06/linux-headers.xml | 207 +++ chapter06/m4.xml | 64 +- chapter06/make.xml | 76 +- chapter06/ncurses.xml | 339 +---- chapter06/patch.xml | 58 +- chapter06/perl.xml | 485 +------ chapter06/python.xml | 231 +--- chapter06/sed.xml | 67 +- chapter06/stripping.xml | 53 + chapter06/tar.xml | 77 +- chapter06/tcl.xml | 191 +++ chapter06/texinfo.xml | 201 +-- chapter06/toolchaintechnotes.xml | 335 +++++ chapter06/util-linux.xml | 1294 +----------------- chapter06/xz.xml | 335 +---- chapter07/bash.xml | 96 ++ chapter07/binutils-pass1.xml | 156 +++ chapter07/binutils-pass2.xml | 94 ++ chapter07/bison.xml | 82 ++ chapter07/bzip2.xml | 112 ++ chapter07/changingowner.xml | 41 + chapter07/chapter07.xml | 46 +- chapter07/chroot.xml | 65 + chapter07/coreutils.xml | 105 ++ chapter07/createfiles.xml | 204 +++ chapter07/creatingdirs.xml | 59 + chapter07/dejagnu.xml | 96 ++ chapter07/diffutils.xml | 68 + chapter07/expect.xml | 139 ++ chapter07/file.xml | 73 + chapter07/findutils.xml | 75 ++ chapter07/flex.xml | 88 ++ chapter07/gawk.xml | 74 ++ chapter07/gcc-pass1.xml | 208 +++ chapter07/gcc-pass2.xml | 160 +++ chapter07/generalinstructions.xml | 120 ++ chapter07/gettext.xml | 85 ++ chapter07/glibc.xml | 230 ++++ chapter07/grep.xml | 70 + chapter07/gzip.xml | 72 + chapter07/introduction.xml | 224 +--- chapter07/kernfs.xml | 115 ++ chapter07/libstdc++-pass2.xml | 114 ++ chapter07/libstdc++.xml | 122 ++ chapter07/linux-headers.xml | 207 +++ chapter07/m4.xml | 74 ++ chapter07/make.xml | 83 ++ chapter07/ncurses.xml | 157 +++ chapter07/patch.xml | 70 + chapter07/perl.xml | 79 ++ chapter07/python.xml | 88 ++ chapter07/sed.xml | 70 + chapter07/stripping.xml | 53 + chapter07/tar.xml | 71 + chapter07/tcl.xml | 191 +++ chapter07/texinfo.xml | 74 ++ chapter07/toolchaintechnotes.xml | 335 +++++ chapter07/util-linux.xml | 113 ++ chapter07/xz.xml | 77 ++ {chapter06 => chapter08}/aboutdebug.xml | 0 {chapter06 => chapter08}/acl.xml | 0 {chapter06 => chapter08}/adjusting.xml | 0 {chapter06 => chapter08}/attr.xml | 0 {chapter06 => chapter08}/autoconf.xml | 0 {chapter06 => chapter08}/automake.xml | 0 chapter08/bash.xml | 173 +++ {chapter06 => chapter08}/bc.xml | 0 {chapter06 => chapter08}/binutils.xml | 0 chapter08/bison.xml | 142 ++ chapter08/bzip2.xml | 250 ++++ chapter08/chapter08.xml | 92 +- {chapter06 => chapter08}/check.xml | 0 chapter08/coreutils.xml | 1287 ++++++++++++++++++ {chapter06 => chapter08}/dbus.xml | 0 chapter08/diffutils.xml | 125 ++ {chapter06 => chapter08}/e2fsprogs.xml | 0 {chapter06 => chapter08}/eudev.xml | 0 {chapter06 => chapter08}/expat.xml | 0 chapter08/file.xml | 108 ++ chapter08/findutils.xml | 161 +++ chapter08/flex.xml | 149 +++ chapter08/gawk.xml | 128 ++ {chapter06 => chapter08}/gcc.xml | 0 {chapter06 => chapter08}/gdbm.xml | 0 chapter08/gettext.xml | 445 +++++++ chapter08/glibc.xml | 970 ++++++++++++++ {chapter06 => chapter08}/gmp.xml | 0 {chapter06 => chapter08}/gperf.xml | 0 chapter08/grep.xml | 111 ++ {chapter06 => chapter08}/groff.xml | 0 chapter08/grub.xml | 483 ++++--- chapter08/gzip.xml | 236 ++++ {chapter06 => chapter08}/iana-etc.xml | 0 {chapter06 => chapter08}/inetutils.xml | 0 {chapter06 => chapter08}/intltool.xml | 0 chapter08/introduction.xml | 66 +- {chapter06 => chapter08}/iproute2.xml | 0 {chapter06 => chapter08}/kbd.xml | 0 {chapter06 => chapter08}/kmod.xml | 0 {chapter06 => chapter08}/less.xml | 0 {chapter06 => chapter08}/libcap.xml | 0 {chapter06 => chapter08}/libelf.xml | 0 {chapter06 => chapter08}/libffi.xml | 0 {chapter06 => chapter08}/libpipeline.xml | 0 {chapter06 => chapter08}/libtool.xml | 0 chapter08/m4.xml | 104 ++ chapter08/make.xml | 99 ++ {chapter06 => chapter08}/man-db.xml | 0 {chapter06 => chapter08}/man-pages.xml | 0 {chapter06 => chapter08}/meson.xml | 0 {chapter06 => chapter08}/mpc.xml | 0 {chapter06 => chapter08}/mpfr.xml | 0 chapter08/ncurses.xml | 380 ++++++ {chapter06 => chapter08}/ninja.xml | 0 {chapter06 => chapter08}/openssl.xml | 0 chapter08/patch.xml | 96 ++ chapter08/perl.xml | 522 ++++++++ {chapter06 => chapter08}/pkgconfig.xml | 0 {chapter06 => chapter08}/pkgmgt.xml | 0 {chapter06 => chapter08}/procps.xml | 0 {chapter06 => chapter08}/psmisc.xml | 0 chapter08/python.xml | 253 ++++ {chapter06 => chapter08}/readline.xml | 0 {chapter06 => chapter08}/revisedchroot.xml | 0 chapter08/sed.xml | 97 ++ {chapter06 => chapter08}/shadow.xml | 0 {chapter06 => chapter08}/strippingagain.xml | 0 {chapter06 => chapter08}/sysklogd.xml | 0 {chapter06 => chapter08}/systemd.xml | 0 {chapter06 => chapter08}/sysvinit.xml | 0 chapter08/tar.xml | 116 ++ chapter08/texinfo.xml | 237 ++++ chapter08/util-linux.xml | 1319 +++++++++++++++++++ {chapter06 => chapter08}/vim.xml | 0 {chapter06 => chapter08}/xml-parser.xml | 0 chapter08/xz.xml | 364 +++++ {chapter06 => chapter08}/zlib.xml | 0 {chapter06 => chapter08}/zstd.xml | 0 {chapter07 => chapter09}/bootscripts.xml | 0 chapter09/chapter09.xml | 36 +- {chapter07 => chapter09}/clock.xml | 0 {chapter07 => chapter09}/consoled.xml | 0 {chapter07 => chapter09}/etcshells.xml | 0 {chapter07 => chapter09}/inputrc.xml | 0 chapter09/introduction.xml | 225 ++++ {chapter07 => chapter09}/introductiond.xml | 0 {chapter07 => chapter09}/locale.xml | 0 {chapter07 => chapter09}/network.xml | 0 {chapter07 => chapter09}/networkd.xml | 0 {chapter07 => chapter09}/profile.xml | 0 {chapter07 => chapter09}/symlinks.xml | 0 {chapter07 => chapter09}/systemd-custom.xml | 0 {chapter07 => chapter09}/udev.xml | 0 {chapter07 => chapter09}/usage.xml | 0 chapter10/chapter10.xml | 19 + {chapter08 => chapter10}/fstab.xml | 0 chapter10/grub.xml | 191 +++ chapter10/introduction.xml | 18 + {chapter08 => chapter10}/kernel.xml | 0 chapter11/chapter11.xml | 19 + {chapter09 => chapter11}/getcounted.xml | 0 {chapter09 => chapter11}/reboot.xml | 0 {chapter09 => chapter11}/theend.xml | 0 {chapter09 => chapter11}/whatnow.xml | 0 general.ent | 6 +- index.xml | 15 +- 201 files changed, 16808 insertions(+), 7386 deletions(-) create mode 100644 chapter06/binutils-pass1.xml create mode 100644 chapter06/binutils-pass2.xml create mode 100644 chapter06/changingowner.xml create mode 100644 chapter06/chroot.xml create mode 100644 chapter06/createfiles.xml create mode 100644 chapter06/creatingdirs.xml create mode 100644 chapter06/dejagnu.xml create mode 100644 chapter06/expect.xml create mode 100644 chapter06/gcc-pass1.xml create mode 100644 chapter06/gcc-pass2.xml create mode 100644 chapter06/generalinstructions.xml delete mode 100644 chapter06/grub.xml create mode 100644 chapter06/kernfs.xml create mode 100644 chapter06/libstdc++-pass2.xml create mode 100644 chapter06/libstdc++.xml create mode 100644 chapter06/linux-headers.xml create mode 100644 chapter06/stripping.xml create mode 100644 chapter06/tcl.xml create mode 100644 chapter06/toolchaintechnotes.xml create mode 100644 chapter07/bash.xml create mode 100644 chapter07/binutils-pass1.xml create mode 100644 chapter07/binutils-pass2.xml create mode 100644 chapter07/bison.xml create mode 100644 chapter07/bzip2.xml create mode 100644 chapter07/changingowner.xml create mode 100644 chapter07/chroot.xml create mode 100644 chapter07/coreutils.xml create mode 100644 chapter07/createfiles.xml create mode 100644 chapter07/creatingdirs.xml create mode 100644 chapter07/dejagnu.xml create mode 100644 chapter07/diffutils.xml create mode 100644 chapter07/expect.xml create mode 100644 chapter07/file.xml create mode 100644 chapter07/findutils.xml create mode 100644 chapter07/flex.xml create mode 100644 chapter07/gawk.xml create mode 100644 chapter07/gcc-pass1.xml create mode 100644 chapter07/gcc-pass2.xml create mode 100644 chapter07/generalinstructions.xml create mode 100644 chapter07/gettext.xml create mode 100644 chapter07/glibc.xml create mode 100644 chapter07/grep.xml create mode 100644 chapter07/gzip.xml create mode 100644 chapter07/kernfs.xml create mode 100644 chapter07/libstdc++-pass2.xml create mode 100644 chapter07/libstdc++.xml create mode 100644 chapter07/linux-headers.xml create mode 100644 chapter07/m4.xml create mode 100644 chapter07/make.xml create mode 100644 chapter07/ncurses.xml create mode 100644 chapter07/patch.xml create mode 100644 chapter07/perl.xml create mode 100644 chapter07/python.xml create mode 100644 chapter07/sed.xml create mode 100644 chapter07/stripping.xml create mode 100644 chapter07/tar.xml create mode 100644 chapter07/tcl.xml create mode 100644 chapter07/texinfo.xml create mode 100644 chapter07/toolchaintechnotes.xml create mode 100644 chapter07/util-linux.xml create mode 100644 chapter07/xz.xml rename {chapter06 => chapter08}/aboutdebug.xml (100%) rename {chapter06 => chapter08}/acl.xml (100%) rename {chapter06 => chapter08}/adjusting.xml (100%) rename {chapter06 => chapter08}/attr.xml (100%) rename {chapter06 => chapter08}/autoconf.xml (100%) rename {chapter06 => chapter08}/automake.xml (100%) create mode 100644 chapter08/bash.xml rename {chapter06 => chapter08}/bc.xml (100%) rename {chapter06 => chapter08}/binutils.xml (100%) create mode 100644 chapter08/bison.xml create mode 100644 chapter08/bzip2.xml rename {chapter06 => chapter08}/check.xml (100%) create mode 100644 chapter08/coreutils.xml rename {chapter06 => chapter08}/dbus.xml (100%) create mode 100644 chapter08/diffutils.xml rename {chapter06 => chapter08}/e2fsprogs.xml (100%) rename {chapter06 => chapter08}/eudev.xml (100%) rename {chapter06 => chapter08}/expat.xml (100%) create mode 100644 chapter08/file.xml create mode 100644 chapter08/findutils.xml create mode 100644 chapter08/flex.xml create mode 100644 chapter08/gawk.xml rename {chapter06 => chapter08}/gcc.xml (100%) rename {chapter06 => chapter08}/gdbm.xml (100%) create mode 100644 chapter08/gettext.xml create mode 100644 chapter08/glibc.xml rename {chapter06 => chapter08}/gmp.xml (100%) rename {chapter06 => chapter08}/gperf.xml (100%) create mode 100644 chapter08/grep.xml rename {chapter06 => chapter08}/groff.xml (100%) create mode 100644 chapter08/gzip.xml rename {chapter06 => chapter08}/iana-etc.xml (100%) rename {chapter06 => chapter08}/inetutils.xml (100%) rename {chapter06 => chapter08}/intltool.xml (100%) rename {chapter06 => chapter08}/iproute2.xml (100%) rename {chapter06 => chapter08}/kbd.xml (100%) rename {chapter06 => chapter08}/kmod.xml (100%) rename {chapter06 => chapter08}/less.xml (100%) rename {chapter06 => chapter08}/libcap.xml (100%) rename {chapter06 => chapter08}/libelf.xml (100%) rename {chapter06 => chapter08}/libffi.xml (100%) rename {chapter06 => chapter08}/libpipeline.xml (100%) rename {chapter06 => chapter08}/libtool.xml (100%) create mode 100644 chapter08/m4.xml create mode 100644 chapter08/make.xml rename {chapter06 => chapter08}/man-db.xml (100%) rename {chapter06 => chapter08}/man-pages.xml (100%) rename {chapter06 => chapter08}/meson.xml (100%) rename {chapter06 => chapter08}/mpc.xml (100%) rename {chapter06 => chapter08}/mpfr.xml (100%) create mode 100644 chapter08/ncurses.xml rename {chapter06 => chapter08}/ninja.xml (100%) rename {chapter06 => chapter08}/openssl.xml (100%) create mode 100644 chapter08/patch.xml create mode 100644 chapter08/perl.xml rename {chapter06 => chapter08}/pkgconfig.xml (100%) rename {chapter06 => chapter08}/pkgmgt.xml (100%) rename {chapter06 => chapter08}/procps.xml (100%) rename {chapter06 => chapter08}/psmisc.xml (100%) create mode 100644 chapter08/python.xml rename {chapter06 => chapter08}/readline.xml (100%) rename {chapter06 => chapter08}/revisedchroot.xml (100%) create mode 100644 chapter08/sed.xml rename {chapter06 => chapter08}/shadow.xml (100%) rename {chapter06 => chapter08}/strippingagain.xml (100%) rename {chapter06 => chapter08}/sysklogd.xml (100%) rename {chapter06 => chapter08}/systemd.xml (100%) rename {chapter06 => chapter08}/sysvinit.xml (100%) create mode 100644 chapter08/tar.xml create mode 100644 chapter08/texinfo.xml create mode 100644 chapter08/util-linux.xml rename {chapter06 => chapter08}/vim.xml (100%) rename {chapter06 => chapter08}/xml-parser.xml (100%) create mode 100644 chapter08/xz.xml rename {chapter06 => chapter08}/zlib.xml (100%) rename {chapter06 => chapter08}/zstd.xml (100%) rename {chapter07 => chapter09}/bootscripts.xml (100%) rename {chapter07 => chapter09}/clock.xml (100%) rename {chapter07 => chapter09}/consoled.xml (100%) rename {chapter07 => chapter09}/etcshells.xml (100%) rename {chapter07 => chapter09}/inputrc.xml (100%) create mode 100644 chapter09/introduction.xml rename {chapter07 => chapter09}/introductiond.xml (100%) rename {chapter07 => chapter09}/locale.xml (100%) rename {chapter07 => chapter09}/network.xml (100%) rename {chapter07 => chapter09}/networkd.xml (100%) rename {chapter07 => chapter09}/profile.xml (100%) rename {chapter07 => chapter09}/symlinks.xml (100%) rename {chapter07 => chapter09}/systemd-custom.xml (100%) rename {chapter07 => chapter09}/udev.xml (100%) rename {chapter07 => chapter09}/usage.xml (100%) create mode 100644 chapter10/chapter10.xml rename {chapter08 => chapter10}/fstab.xml (100%) create mode 100644 chapter10/grub.xml create mode 100644 chapter10/introduction.xml rename {chapter08 => chapter10}/kernel.xml (100%) create mode 100644 chapter11/chapter11.xml rename {chapter09 => chapter11}/getcounted.xml (100%) rename {chapter09 => chapter11}/reboot.xml (100%) rename {chapter09 => chapter11}/theend.xml (100%) rename {chapter09 => chapter11}/whatnow.xml (100%) diff --git a/Makefile b/Makefile index a1fb746b3..d21bb7c0d 100644 --- a/Makefile +++ b/Makefile @@ -23,10 +23,10 @@ ifneq ($(REV), sysv) endif ifeq ($(REV), sysv) - BASEDIR ?= ~/lfs-book + BASEDIR ?= ~/cross2-lfs-book PDF_OUTPUT ?= LFS-BOOK.pdf NOCHUNKS_OUTPUT ?= LFS-BOOK.html - DUMPDIR ?= ~/lfs-commands + DUMPDIR ?= ~/cross-lfs-commands else BASEDIR ?= ~/lfs-systemd PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf diff --git a/chapter05/binutils-pass1.xml b/chapter05/binutils-pass1.xml index 8658cfcfe..e91c64a62 100644 --- a/chapter05/binutils-pass1.xml +++ b/chapter05/binutils-pass1.xml @@ -25,7 +25,7 @@ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/binutils.xml" + href="../chapter08/binutils.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> 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; ]> -<chapter id="chapter-temporary-tools" xreflabel="Chapter 5"> +<chapter id="chapter-cross-tools" xreflabel="Chapter 5"> <?dbhtml dir="chapter05"?> <?dbhtml filename="chapter05.html"?> - <title>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 @@ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/gcc.xml" + href="../chapter08/gcc.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> 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 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/glibc.xml" + href="../chapter08/glibc.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> 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; ]> -<sect1 id="ch-system-bash" role="wrap"> +<sect1 id="ch-tools-bash" role="wrap"> <?dbhtml filename="bash.html"?> <sect1info condition="script"> @@ -16,22 +16,25 @@ <title>Bash-&bash-version; - + Bash + tools - <para>The Bash package contains the Bourne-Again SHell.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/bash.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&bash-ch6-sbu;</seg> - <seg>&bash-ch6-du;</seg> + <seg>&bash-ch5-sbu;</seg> + <seg>&bash-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -40,27 +43,24 @@ <sect2 role="installation"> <title>Installation of Bash - Incorporate some upstream fixes: - -patch -Np1 -i ../&bash-fixes-patch; - Prepare Bash for compilation: -./configure --prefix=/usr \ - --docdir=/usr/share/doc/bash-&bash-version; \ - --without-bash-malloc \ - --with-installed-readline +./configure --prefix=/usr \ + --build=$(support/config.guess) \ + --host=$LFS_TGT \ + --without-bash-malloc - The meaning of the new configure option: + The meaning of the configure options: - --with-installed-readline + --without-bash-malloc - This option tells Bash to use the readline library that is already - installed on the system rather than using its own readline - version. + This option turns off the use of Bash's memory allocation + (malloc) function which is known to cause + segmentation faults. By turning this option off, Bash will use + the malloc functions from Glibc which are + more stable. @@ -70,103 +70,26 @@ make - Skip down to Install the - package if not running the test suite. + Install the package: - To prepare the tests, ensure that the tester user can write to the sources tree: +make DESTDIR=$LFS install -chown -Rv tester . + Move the excutable to where it is expected 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 + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed directory</segtitle> - - <seglistitem> - <seg>bash, bashbug, and sh (link to bash)</seg> - <seg>/usr/include/bash, /usr/lib/bash, and - /usr/share/doc/bash-&bash-version;</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="bash"> - <term><command>bash</command></term> - <listitem> - <para>A widely-used command interpreter; it performs many types of - expansions and substitutions on a given command line before executing - it, thus making this interpreter a powerful tool</para> - <indexterm zone="ch-system-bash bash"> - <primary sortas="b-bash">bash</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="bashbug"> - <term><command>bashbug</command></term> - <listitem> - <para>A shell script to help the user compose and mail standard - formatted bug reports concerning <command>bash</command></para> - <indexterm zone="ch-system-bash bashbug"> - <primary sortas="b-bashbug">bashbug</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sh"> - <term><command>sh</command></term> - <listitem> - <para>A symlink to the <command>bash</command> program; when invoked - as <command>sh</command>, <command>bash</command> tries to mimic the - startup behavior of historical versions of <command>sh</command> as - closely as possible, while conforming to the POSIX standard as - well</para> - <indexterm zone="ch-system-bash sh"> - <primary sortas="b-sh">sh</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-bash" role="."/></para> </sect2> diff --git a/chapter06/binutils-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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-binutils-pass1" role="wrap"> + <?dbhtml filename="binutils-pass1.html"?> + + <sect1info condition="script"> + <productname>binutils-pass1</productname> + <productnumber>&binutils-version;</productnumber> + <address>&binutils-url;</address> + </sect1info> + + <title>Binutils-&binutils-version; - Pass 1 + + + Binutils + tools, pass 1 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/binutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&binutils-ch5p1-sbu;</seg> + <seg>&binutils-ch5p1-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Cross Binutils + + Go back and re-read the notes in the previous section. + Understanding the notes labeled important will save you a lot + 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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-binutils" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-binutils-pass2" role="wrap"> + <?dbhtml filename="binutils-pass2.html"?> + + <sect1info condition="script"> + <productname>binutils-pass2</productname> + <productnumber>&binutils-version;</productnumber> + <address>&binutils-url;</address> + </sect1info> + + <title>Binutils-&binutils-version; - Pass 2 + + + Binutils + tools, pass 2 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/binutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&binutils-ch5p2-sbu;</seg> + <seg>&binutils-ch5p2-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Binutils + + Create a separate build directory again: + +mkdir -v build +cd build + + Prepare Binutils for compilation: + +../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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-binutils" role="."/></para> + + </sect2> + +</sect1> 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; ]> -<sect1 id="ch-system-bison" role="wrap"> +<sect1 id="ch-tools-bison" role="wrap"> <?dbhtml filename="bison.html"?> <sect1info condition="script"> @@ -16,22 +16,25 @@ <title>Bison-&bison-version; - + Bison + tools - <para>The Bison package contains a parser generator.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/bison.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&bison-ch6-sbu;</seg> - <seg>&bison-ch6-du;</seg> + <seg>&bison-ch5-sbu;</seg> + <seg>&bison-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -39,103 +42,40 @@ <sect2 role="installation"> <title>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 + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed library</segtitle> - <segtitle>Installed directory</segtitle> - - <seglistitem> - <seg>bison and yacc</seg> - <seg>liby.a</seg> - <seg>/usr/share/bison</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="bison"> - <term><command>bison</command></term> - <listitem> - <para>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)</para> - <indexterm zone="ch-system-bison bison"> - <primary sortas="b-bison">bison</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="yacc"> - <term><command>yacc</command></term> - <listitem> - <para>A wrapper for <command>bison</command>, meant for programs that - still call <command>yacc</command> instead of <command>bison</command>; - it calls <command>bison</command> with the <parameter>-y</parameter> - option</para> - <indexterm zone="ch-system-bison yacc"> - <primary sortas="b-yacc">yacc</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="liby"> - <term><filename class="libraryfile">liby</filename></term> - <listitem> - <para>The Yacc library containing implementations of Yacc-compatible - <function>yyerror</function> and <function>main</function> functions; - this library is normally not very useful, but POSIX requires it</para> - <indexterm zone="ch-system-bison liby"> - <primary sortas="c-liby">liby</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-bison" role="."/></para> </sect2> 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; ]> -<sect1 id="ch-system-bzip2" role="wrap"> +<sect1 id="ch-tools-bzip2" role="wrap"> <?dbhtml filename="bzip2.html"?> <sect1info condition="script"> @@ -16,25 +16,25 @@ <title>Bzip2-&bzip2-version; - + Bzip2 + tools - <para>The Bzip2 package contains programs for compressing and decompressing - files. Compressing text files with <command>bzip2</command> yields a much - better compression percentage than with the traditional - <command>gzip</command>.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/bzip2.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&bzip2-ch6-sbu;</seg> - <seg>&bzip2-ch6-du;</seg> + <seg>&bzip2-ch5-sbu;</seg> + <seg>&bzip2-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -43,11 +43,13 @@ <sect2 role="installation"> <title>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 install Install 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 - - - - - + + + <para>Details on this package are located in + <xref linkend="contents-bzip2" role="."/></para> </sect2> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-changingowner"> + <?dbhtml filename="changingowner.html"?> + + <title>Changing Ownership + + + The commands in the remainder of this book must be performed while + logged in as user root and no + longer as user lfs. Also, double + check that $LFS is set in root's environment. + + + Currently, the 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 - <para>The Coreutils package contains utilities for showing and setting the - basic system characteristics.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/coreutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&coreutils-ch6-sbu;</seg> - <seg>&coreutils-ch6-du;</seg> + <seg>&coreutils-ch5-sbu;</seg> + <seg>&coreutils-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -41,59 +43,23 @@ <sect2 role="installation"> <title>Installation of Coreutils - POSIX requires that programs from Coreutils recognize character - boundaries correctly even in multibyte locales. The following patch fixes - this non-compliance and other internationalization-related bugs. + Prepare Coreutils for compilation: -patch -Np1 -i ../&coreutils-i18n-patch; - - - In the past, many bugs were found in this patch. When reporting new - bugs to Coreutils maintainers, please check first if they are reproducible - without this patch. - - - - Suppress a test which on some machines can loop forever: - -sed -i '/test.lock/s/^/#/' gnulib-tests/gnulib.mk - - Now prepare Coreutils for compilation: - -autoreconf -fiv -FORCE_UNSAFE_CONFIGURE=1 ./configure \ - --prefix=/usr \ +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) \ + --enable-install-program=hostname \ --enable-no-install-program=kill,uptime The meaning of the configure options: - autoreconf + --enable-install-program=hostname - This command updates generated configuration files - consistent with the latest version of automake. - - - - - - FORCE_UNSAFE_CONFIGURE=1 - - This environment variable allows the package to be - built as the root user. - - - - - - --enable-no-install-program=kill,uptime - - The purpose of this switch is to prevent Coreutils from - installing binaries that will be installed by other packages later. - + This enables the hostname binary to be built + and installed – it is disabled by default but is required by the + Perl test suite. @@ -102,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/group Install the package: -make install +make DESTDIR=$LFS install + + Move programs to their final expected locations. Although this is + not necessary in this temporary environment, we must do so because some + programs harcode executable locations: -mv -v /usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} /bin -mv -v /usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} /bin -mv -v /usr/bin/{rmdir,stty,sync,true,uname} /bin -mv -v /usr/bin/chroot /usr/sbin -mv -v /usr/share/man/man1/chroot.1 /usr/share/man/man8/chroot.8 -sed -i s/\"1\"/\"8\"/1 /usr/share/man/man8/chroot.8 - - Some of the scripts in the LFS-Bootscripts package - depend on head, nice, - sleep, and touch. As /usr may not be available during the early and - late stages of booting, those binaries need to be on the root partition to - maintain FHS compliance: - -mv -v /usr/bin/{head,nice,sleep,touch} /bin +mv -v $LFS/usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} $LFS/bin +mv -v $LFS/usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} $LFS/bin +mv -v $LFS/usr/bin/{rmdir,stty,sync,true,uname} $LFS/bin +mv -v $LFS/usr/bin/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 + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed library</segtitle> - <segtitle>Installed directory</segtitle> - - <seglistitem> - <seg>[, b2sum, base32, base64, basename, basenc, cat, chcon, chgrp, chmod, chown, - chroot, cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors, - dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups, - head, hostid, id, install, join, link, ln, logname, ls, md5sum, mkdir, - mkfifo, mknod, mktemp, mv, nice, nl, nohup, nproc, numfmt, od, paste, - pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, realpath, rm, - rmdir, runcon, seq, sha1sum, sha224sum, sha256sum, sha384sum, - sha512sum, shred, shuf, sleep, sort, split, stat, stdbuf, stty, sum, - sync, tac, tail, tee, test, timeout, touch, tr, true, truncate, tsort, - tty, uname, unexpand, uniq, unlink, users, vdir, wc, who, whoami, and - yes</seg> - <seg>libstdbuf.so (in /usr/libexec/coreutils)</seg> - <seg>/usr/libexec/coreutils</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="base32"> - <term><command>base32</command></term> - <listitem> - <para>Encodes and decodes data according to the base32 specification - (RFC 4648)</para> - <indexterm zone="ch-system-coreutils base64"> - <primary sortas="b-base64">base64</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="base64"> - <term><command>base64</command></term> - <listitem> - <para>Encodes and decodes data according to the base64 specification - (RFC 4648)</para> - <indexterm zone="ch-system-coreutils base64"> - <primary sortas="b-base64">base64</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="b2sum"> - <term><command>b2sum</command></term> - <listitem> - <para>Prints or checks BLAKE2 (512-bit) checksums</para> - <indexterm zone="ch-system-coreutils b2sum"> - <primary sortas="b-b2sum">b2sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="basename"> - <term><command>basename</command></term> - <listitem> - <para>Strips any path and a given suffix from a file name</para> - <indexterm zone="ch-system-coreutils basename"> - <primary sortas="b-basename">basename</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="basenc"> - <term><command>basenc</command></term> - <listitem> - <para>Encodes or decodes data using various algorithms</para> - <indexterm zone="ch-system-coreutils basenc"> - <primary sortas="b-basenc">basenc</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="cat"> - <term><command>cat</command></term> - <listitem> - <para>Concatenates files to standard output</para> - <indexterm zone="ch-system-coreutils cat"> - <primary sortas="b-cat">cat</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chcon"> - <term><command>chcon</command></term> - <listitem> - <para>Changes security context for files and directories</para> - <indexterm zone="ch-system-coreutils chcon"> - <primary sortas="b-chcon">chcon</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chgrp"> - <term><command>chgrp</command></term> - <listitem> - <para>Changes the group ownership of files and directories</para> - <indexterm zone="ch-system-coreutils chgrp"> - <primary sortas="b-chgrp">chgrp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chmod"> - <term><command>chmod</command></term> - <listitem> - <para>Changes the permissions of each file to the given mode; the mode - can be either a symbolic representation of the changes to make or an - octal number representing the new permissions</para> - <indexterm zone="ch-system-coreutils chmod"> - <primary sortas="b-chmod">chmod</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chown"> - <term><command>chown</command></term> - <listitem> - <para>Changes the user and/or group ownership of files and - directories</para> - <indexterm zone="ch-system-coreutils chown"> - <primary sortas="b-chown">chown</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chroot"> - <term><command>chroot</command></term> - <listitem> - <para>Runs a command with the specified directory as the - <filename class="directory">/</filename> directory</para> - <indexterm zone="ch-system-coreutils chroot"> - <primary sortas="b-chroot">chroot</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="cksum"> - <term><command>cksum</command></term> - <listitem> - <para>Prints the Cyclic Redundancy Check (CRC) checksum and the byte - counts of each specified file</para> - <indexterm zone="ch-system-coreutils cksum"> - <primary sortas="b-cksum">cksum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="comm"> - <term><command>comm</command></term> - <listitem> - <para>Compares two sorted files, outputting in three columns the lines - that are unique and the lines that are common</para> - <indexterm zone="ch-system-coreutils comm"> - <primary sortas="b-comm">comm</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="cp"> - <term><command>cp</command></term> - <listitem> - <para>Copies files</para> - <indexterm zone="ch-system-coreutils cp"> - <primary sortas="b-cp">cp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="csplit"> - <term><command>csplit</command></term> - <listitem> - <para>Splits a given file into several new files, separating them - according to given patterns or line numbers and outputting the byte - count of each new file</para> - <indexterm zone="ch-system-coreutils csplit"> - <primary sortas="b-csplit">csplit</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="cut"> - <term><command>cut</command></term> - <listitem> - <para>Prints sections of lines, selecting the parts according to given - fields or positions</para> - <indexterm zone="ch-system-coreutils cut"> - <primary sortas="b-cut">cut</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="date"> - <term><command>date</command></term> - <listitem> - <para>Displays the current time in the given format, or sets the - system date</para> - <indexterm zone="ch-system-coreutils date"> - <primary sortas="b-date">date</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="dd"> - <term><command>dd</command> </term> - <listitem> - <para>Copies a file using the given block size and count, while - optionally performing conversions on it</para> - <indexterm zone="ch-system-coreutils dd"> - <primary sortas="b-dd">dd</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="df"> - <term><command>df</command></term> - <listitem> - <para>Reports the amount of disk space available (and used) on all - mounted file systems, or only on the file systems holding the selected - files</para> - <indexterm zone="ch-system-coreutils df"> - <primary sortas="b-df">df</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="dir"> - <term><command>dir</command></term> - <listitem> - <para>Lists the contents of each given directory (the same as - the <command>ls</command> command)</para> - <indexterm zone="ch-system-coreutils dir"> - <primary sortas="b-dir">dir</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="dircolors"> - <term><command>dircolors</command></term> - <listitem> - <para>Outputs commands to set the <envar>LS_COLOR</envar> - environment variable to change the color scheme used by - <command>ls</command></para> - <indexterm zone="ch-system-coreutils dircolors"> - <primary sortas="b-dircolors">dircolors</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="dirname"> - <term><command>dirname</command></term> - <listitem> - <para>Strips the non-directory suffix from a file name</para> - <indexterm zone="ch-system-coreutils dirname"> - <primary sortas="b-dirname">dirname</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="du"> - <term><command>du</command></term> - <listitem> - <para>Reports the amount of disk space used by the current directory, - by each of the given directories (including all subdirectories) or by - each of the given files</para> - <indexterm zone="ch-system-coreutils du"> - <primary sortas="b-du">du</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="echo"> - <term><command>echo</command></term> - <listitem> - <para>Displays the given strings</para> - <indexterm zone="ch-system-coreutils echo"> - <primary sortas="b-echo">echo</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="env"> - <term><command>env</command></term> - <listitem> - <para>Runs a command in a modified environment</para> - <indexterm zone="ch-system-coreutils env"> - <primary sortas="b-env">env</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="expand"> - <term><command>expand</command></term> - <listitem> - <para>Converts tabs to spaces</para> - <indexterm zone="ch-system-coreutils expand"> - <primary sortas="b-expand">expand</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="expr"> - <term><command>expr</command></term> - <listitem> - <para>Evaluates expressions</para> - <indexterm zone="ch-system-coreutils expr"> - <primary sortas="b-expr">expr</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="factor"> - <term><command>factor</command></term> - <listitem> - <para>Prints the prime factors of all specified integer numbers</para> - <indexterm zone="ch-system-coreutils factor"> - <primary sortas="b-factor">factor</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="false"> - <term><command>false</command></term> - <listitem> - <para>Does nothing, unsuccessfully; it always exits with a status code - indicating failure</para> - <indexterm zone="ch-system-coreutils false"> - <primary sortas="b-false">false</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fmt"> - <term><command>fmt</command></term> - <listitem> - <para>Reformats the paragraphs in the given files</para> - <indexterm zone="ch-system-coreutils fmt"> - <primary sortas="b-fmt">fmt</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fold"> - <term><command>fold</command></term> - <listitem> - <para>Wraps the lines in the given files</para> - <indexterm zone="ch-system-coreutils fold"> - <primary sortas="b-fold">fold</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="groups"> - <term><command>groups</command></term> - <listitem> - <para>Reports a user's group memberships</para> - <indexterm zone="ch-system-coreutils groups"> - <primary sortas="b-groups">groups</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="head"> - <term><command>head</command></term> - <listitem> - <para>Prints the first ten lines (or the given number of lines) - of each given file</para> - <indexterm zone="ch-system-coreutils head"> - <primary sortas="b-head">head</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="hostid"> - <term><command>hostid</command></term> - <listitem> - <para>Reports the numeric identifier (in hexadecimal) of the host</para> - <indexterm zone="ch-system-coreutils hostid"> - <primary sortas="b-hostid">hostid</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="id"> - <term><command>id</command></term> - <listitem> - <para>Reports the effective user ID, group ID, and group memberships - of the current user or specified user</para> - <indexterm zone="ch-system-coreutils id"> - <primary sortas="b-id">id</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="install"> - <term><command>install</command> </term> - <listitem> - <para>Copies files while setting their permission modes and, if - possible, their owner and group</para> - <indexterm zone="ch-system-coreutils install"> - <primary sortas="b-install">install</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="join"> - <term><command>join</command></term> - <listitem> - <para>Joins the lines that have identical join fields from two - separate files</para> - <indexterm zone="ch-system-coreutils join"> - <primary sortas="b-join">join</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="link"> - <term><command>link</command></term> - <listitem> - <para>Creates a hard link with the given name to a file</para> - <indexterm zone="ch-system-coreutils link"> - <primary sortas="b-link">link</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ln"> - <term><command>ln</command></term> - <listitem> - <para>Makes hard links or soft (symbolic) links between files</para> - <indexterm zone="ch-system-coreutils ln"> - <primary sortas="b-ln">ln</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="logname"> - <term><command>logname</command></term> - <listitem> - <para>Reports the current user's login name</para> - <indexterm zone="ch-system-coreutils logname"> - <primary sortas="b-logname">logname</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ls"> - <term><command>ls</command></term> - <listitem> - <para>Lists the contents of each given directory</para> - <indexterm zone="ch-system-coreutils ls"> - <primary sortas="b-ls">ls</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="md5sum"> - <term><command>md5sum</command></term> - <listitem> - <para>Reports or checks Message Digest 5 (MD5) checksums</para> - <indexterm zone="ch-system-coreutils md5sum"> - <primary sortas="b-md5sum">md5sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mkdir"> - <term><command>mkdir</command></term> - <listitem> - <para>Creates directories with the given names</para> - <indexterm zone="ch-system-coreutils mkdir"> - <primary sortas="b-mkdir">mkdir</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mkfifo"> - <term><command>mkfifo</command></term> - <listitem> - <para>Creates First-In, First-Outs (FIFOs), a "named - pipe" in UNIX parlance, with the given names</para> - <indexterm zone="ch-system-coreutils mkfifo"> - <primary sortas="b-mkfifo">mkfifo</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mknod"> - <term><command>mknod</command></term> - <listitem> - <para>Creates device nodes with the given names; a device node is a - character special file, a block special file, or a FIFO</para> - <indexterm zone="ch-system-coreutils mknod"> - <primary sortas="b-mknod">mknod</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mktemp"> - <term><command>mktemp</command></term> - <listitem> - <para>Creates temporary files in a secure manner; it is used in scripts</para> - <indexterm zone="ch-system-coreutils mktemp"> - <primary sortas="b-mktemp">mktemp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mv"> - <term><command>mv</command></term> - <listitem> - <para>Moves or renames files or directories</para> - <indexterm zone="ch-system-coreutils mv"> - <primary sortas="b-mv">mv</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="nice"> - <term><command>nice</command></term> - <listitem> - <para>Runs a program with modified scheduling priority</para> - <indexterm zone="ch-system-coreutils nice"> - <primary sortas="b-nice">nice</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="nl"> - <term><command>nl</command></term> - <listitem> - <para>Numbers the lines from the given files</para> - <indexterm zone="ch-system-coreutils nl"> - <primary sortas="b-nl">nl</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="nohup"> - <term><command>nohup</command></term> - <listitem> - <para>Runs a command immune to hangups, with its output redirected to - a log file</para> - <indexterm zone="ch-system-coreutils nohup"> - <primary sortas="b-nohup">nohup</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="nproc"> - <term><command>nproc</command></term> - <listitem> - <para>Prints the number of processing units available to a - process</para> - <indexterm zone="ch-system-coreutils nproc"> - <primary sortas="b-nproc">nproc</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="numfmt"> - <term><command>numfmt</command></term> - <listitem> - <para>Converts numbers to or from human-readable strings</para> - <indexterm zone="ch-system-coreutils numfmt"> - <primary sortas="b-numfmt">numfmt</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="od"> - <term><command>od</command></term> - <listitem> - <para>Dumps files in octal and other formats</para> - <indexterm zone="ch-system-coreutils od"> - <primary sortas="b-od">od</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="paste"> - <term><command>paste</command></term> - <listitem> - <para>Merges the given files, joining sequentially corresponding lines - side by side, separated by tab characters</para> - <indexterm zone="ch-system-coreutils paste"> - <primary sortas="b-paste">paste</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pathchk"> - <term><command>pathchk</command></term> - <listitem> - <para>Checks if file names are valid or portable</para> - <indexterm zone="ch-system-coreutils pathchk"> - <primary sortas="b-pathchk">pathchk</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pinky"> - <term><command>pinky</command></term> - <listitem> - <para>Is a lightweight finger client; it reports some information - about the given users</para> - <indexterm zone="ch-system-coreutils pinky"> - <primary sortas="b-pinky">pinky</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pr"> - <term><command>pr</command></term> - <listitem> - <para>Paginates and columnates files for printing</para> - <indexterm zone="ch-system-coreutils pr"> - <primary sortas="b-pr">pr</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="printenv"> - <term><command>printenv</command></term> - <listitem> - <para>Prints the environment</para> - <indexterm zone="ch-system-coreutils printenv"> - <primary sortas="b-printenv">printenv</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="printf"> - <term><command>printf</command></term> - <listitem> - <para>Prints the given arguments according to the given format, much - like the C printf function</para> - <indexterm zone="ch-system-coreutils printf"> - <primary sortas="b-printf">printf</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ptx"> - <term><command>ptx</command></term> - <listitem> - <para>Produces a permuted index from the contents of the given files, - with each keyword in its context</para> - <indexterm zone="ch-system-coreutils ptx"> - <primary sortas="b-ptx">ptx</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pwd"> - <term><command>pwd</command></term> - <listitem> - <para>Reports the name of the current working directory</para> - <indexterm zone="ch-system-coreutils pwd"> - <primary sortas="b-pwd">pwd</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="readlink"> - <term><command>readlink</command></term> - <listitem> - <para>Reports the value of the given symbolic link</para> - <indexterm zone="ch-system-coreutils readlink"> - <primary sortas="b-readlink">readlink</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="realpath"> - <term><command>realpath</command></term> - <listitem> - <para>Prints the resolved path</para> - <indexterm zone="ch-system-coreutils realpath"> - <primary sortas="b-realpath">realpath</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="rm"> - <term><command>rm</command></term> - <listitem> - <para>Removes files or directories</para> - <indexterm zone="ch-system-coreutils rm"> - <primary sortas="b-rm">rm</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="rmdir"> - <term><command>rmdir</command></term> - <listitem> - <para>Removes directories if they are empty</para> - <indexterm zone="ch-system-coreutils rmdir"> - <primary sortas="b-rmdir">rmdir</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="runcon"> - <term><command>runcon</command></term> - <listitem> - <para>Runs a command with specified security context</para> - <indexterm zone="ch-system-coreutils runcon"> - <primary sortas="b-runcon">runcon</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="seq"> - <term><command>seq</command></term> - <listitem> - <para>Prints a sequence of numbers within a given range and with a - given increment</para> - <indexterm zone="ch-system-coreutils seq"> - <primary sortas="b-seq">seq</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sha1sum"> - <term><command>sha1sum</command></term> - <listitem> - <para>Prints or checks 160-bit Secure Hash Algorithm 1 (SHA1) - checksums</para> - <indexterm zone="ch-system-coreutils sha1sum"> - <primary sortas="b-sha1sum">sha1sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sha224sum"> - <term><command>sha224sum</command></term> - <listitem> - <para>Prints or checks 224-bit Secure Hash Algorithm checksums</para> - <indexterm zone="ch-system-coreutils sha224sum"> - <primary sortas="b-sha224sum">sha224sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sha256sum"> - <term><command>sha256sum</command></term> - <listitem> - <para>Prints or checks 256-bit Secure Hash Algorithm checksums</para> - <indexterm zone="ch-system-coreutils sha256sum"> - <primary sortas="b-sha256sum">sha256sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sha384sum"> - <term><command>sha384sum</command></term> - <listitem> - <para>Prints or checks 384-bit Secure Hash Algorithm checksums</para> - <indexterm zone="ch-system-coreutils sha384sum"> - <primary sortas="b-sha384sum">sha384sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sha512sum"> - <term><command>sha512sum</command></term> - <listitem> - <para>Prints or checks 512-bit Secure Hash Algorithm checksums</para> - <indexterm zone="ch-system-coreutils sha512sum"> - <primary sortas="b-sha512sum">sha512sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="shred"> - <term><command>shred</command></term> - <listitem> - <para>Overwrites the given files repeatedly with complex patterns, - making it difficult to recover the data</para> - <indexterm zone="ch-system-coreutils shred"> - <primary sortas="b-shred">shred</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="shuf"> - <term><command>shuf</command></term> - <listitem> - <para>Shuffles lines of text</para> - <indexterm zone="ch-system-coreutils shuf"> - <primary sortas="b-shuf">shuf</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sleep"> - <term><command>sleep</command></term> - <listitem> - <para>Pauses for the given amount of time</para> - <indexterm zone="ch-system-coreutils sleep"> - <primary sortas="b-sleep">sleep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sort"> - <term><command>sort</command></term> - <listitem> - <para>Sorts the lines from the given files</para> - <indexterm zone="ch-system-coreutils sort"> - <primary sortas="b-sort">sort</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="split"> - <term><command>split</command></term> - <listitem> - <para>Splits the given file into pieces, by size or by number of - lines</para> - <indexterm zone="ch-system-coreutils split"> - <primary sortas="b-split">split</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="stat"> - <term><command>stat</command></term> - <listitem> - <para>Displays file or filesystem status</para> - <indexterm zone="ch-system-coreutils stat"> - <primary sortas="b-stat">stat</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="stdbuf"> - <term><command>stdbuf</command></term> - <listitem> - <para>Runs commands with altered buffering operations for its standard - streams</para> - <indexterm zone="ch-system-coreutils stdbuf"> - <primary sortas="b-stdbuf">stdbuf</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="stty"> - <term><command>stty</command></term> - <listitem> - <para>Sets or reports terminal line settings</para> - <indexterm zone="ch-system-coreutils stty"> - <primary sortas="b-stty">stty</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sum"> - <term><command>sum</command></term> - <listitem> - <para>Prints checksum and block counts for each given file</para> - <indexterm zone="ch-system-coreutils sum"> - <primary sortas="b-sum">sum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sync"> - <term><command>sync</command></term> - <listitem> - <para>Flushes file system buffers; it forces changed blocks to disk - and updates the super block</para> - <indexterm zone="ch-system-coreutils sync"> - <primary sortas="b-sync">sync</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tac"> - <term><command>tac</command></term> - <listitem> - <para>Concatenates the given files in reverse</para> - <indexterm zone="ch-system-coreutils tac"> - <primary sortas="b-tac">tac</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tail"> - <term><command>tail</command></term> - <listitem> - <para>Prints the last ten lines (or the given number of lines) of each - given file</para> - <indexterm zone="ch-system-coreutils tail"> - <primary sortas="b-tail">tail</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tee"> - <term><command>tee</command></term> - <listitem> - <para>Reads from standard input while writing both to standard output - and to the given files</para> - <indexterm zone="ch-system-coreutils tee"> - <primary sortas="b-tee">tee</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="test"> - <term><command>test</command></term> - <listitem> - <para>Compares values and checks file types</para> - <indexterm zone="ch-system-coreutils test"> - <primary sortas="b-test">test</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="timeout"> - <term><command>timeout</command></term> - <listitem> - <para>Runs a command with a time limit</para> - <indexterm zone="ch-system-coreutils timeout"> - <primary sortas="b-timeout">timeout</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="touch"> - <term><command>touch</command></term> - <listitem> - <para>Changes file timestamps, setting the access and modification - times of the given files to the current time; files that do not exist - are created with zero length</para> - <indexterm zone="ch-system-coreutils touch"> - <primary sortas="b-touch">touch</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tr"> - <term><command>tr</command></term> - <listitem> - <para>Translates, squeezes, and deletes the given characters from - standard input</para> - <indexterm zone="ch-system-coreutils tr"> - <primary sortas="b-tr">tr</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="true"> - <term><command>true</command></term> - <listitem> - <para>Does nothing, successfully; it always exits with a status code - indicating success</para> - <indexterm zone="ch-system-coreutils true"> - <primary sortas="b-true">true</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="truncate"> - <term><command>truncate</command></term> - <listitem> - <para>Shrinks or expands a file to the specified size</para> - <indexterm zone="ch-system-coreutils truncate"> - <primary sortas="b-truncate">truncate</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tsort"> - <term><command>tsort</command></term> - <listitem> - <para>Performs a topological sort; it writes a completely ordered list - according to the partial ordering in a given file</para> - <indexterm zone="ch-system-coreutils tsort"> - <primary sortas="b-tsort">tsort</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tty"> - <term><command>tty</command></term> - <listitem> - <para>Reports the file name of the terminal connected to standard - input</para> - <indexterm zone="ch-system-coreutils tty"> - <primary sortas="b-tty">tty</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="uname"> - <term><command>uname</command></term> - <listitem> - <para>Reports system information</para> - <indexterm zone="ch-system-coreutils uname"> - <primary sortas="b-uname">uname</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="unexpand"> - <term><command>unexpand</command></term> - <listitem> - <para>Converts spaces to tabs</para> - <indexterm zone="ch-system-coreutils unexpand"> - <primary sortas="b-unexpand">unexpand</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="uniq"> - <term><command>uniq</command></term> - <listitem> - <para>Discards all but one of successive identical lines</para> - <indexterm zone="ch-system-coreutils uniq"> - <primary sortas="b-uniq">uniq</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="unlink"> - <term><command>unlink</command></term> - <listitem> - <para>Removes the given file</para> - <indexterm zone="ch-system-coreutils unlink"> - <primary sortas="b-unlink">unlink</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="users"> - <term><command>users</command></term> - <listitem> - <para>Reports the names of the users currently logged on</para> - <indexterm zone="ch-system-coreutils users"> - <primary sortas="b-users">users</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="vdir"> - <term><command>vdir</command></term> - <listitem> - <para>Is the same as <command>ls -l</command></para> - <indexterm zone="ch-system-coreutils vdir"> - <primary sortas="b-vdir">vdir</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="wc"> - <term><command>wc</command></term> - <listitem> - <para>Reports the number of lines, words, and bytes for each given - file, as well as a total line when more than one file is given</para> - <indexterm zone="ch-system-coreutils wc"> - <primary sortas="b-wc">wc</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="who"> - <term><command>who</command></term> - <listitem> - <para>Reports who is logged on</para> - <indexterm zone="ch-system-coreutils who"> - <primary sortas="b-who">who</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="whoami"> - <term><command>whoami</command></term> - <listitem> - <para>Reports the user name associated with the current effective - user ID</para> - <indexterm zone="ch-system-coreutils whoami"> - <primary sortas="b-whoami">whoami</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="yes"> - <term><command>yes</command></term> - <listitem> - <para>Repeatedly outputs <quote>y</quote> or a given string until - killed</para> - <indexterm zone="ch-system-coreutils yes"> - <primary sortas="b-yes">yes</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libstdbuf"> - <term><filename class="libraryfile">libstdbuf</filename></term> - <listitem> - <para>Library used by <command>stdbuf</command></para> - <indexterm zone="ch-system-coreutils libstdbuf"> - <primary sortas="c-libstdbuf">libstdbuf</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-coreutils" role="."/></para> </sect2> diff --git a/chapter06/createfiles.xml b/chapter06/createfiles.xml new file mode 100644 index 000000000..aed8d79da --- /dev/null +++ b/chapter06/createfiles.xml @@ -0,0 +1,204 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-createfiles"> + <?dbhtml filename="createfiles.html"?> + + <title>Creating Essential Files and Symlinks + + + /etc/passwd + + + + /etc/group + + + + /var/run/utmp + + + + /var/log/btmp + + + + /var/log/lastlog + + + + /var/log/wtmp + + + 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 + + + + + + <para>The <application>DejaGnu</application> package contains a framework for running test + suites on GNU tools. It is written in <command>expect</command>, which itself + uses <application>Tcl</application> (Tool Command Language).</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&dejagnu-ch5-sbu;</seg> + <seg>&dejagnu-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 - <para>The Diffutils package contains programs that show the differences - between files or directories.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/diffutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&diffutils-ch6-sbu;</seg> - <seg>&diffutils-ch6-du;</seg> + <seg>&diffutils-ch5-sbu;</seg> + <seg>&diffutils-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -43,82 +45,23 @@ <para>Prepare Diffutils for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr --host=$LFS_TGT</userinput></screen> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make check</userinput></screen> - <para>Install the package:</para> -<screen><userinput remap="install">make install</userinput></screen> +<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> </sect2> + <sect2 role="content"> + <title/> - <sect2 id="contents-diffutils" role="content"> - <title>Contents of Diffutils - - - Installed programs - - - cmp, diff, diff3, and sdiff - - - - - Short Descriptions - - - - - cmp - - Compares two files and reports whether or in which bytes they - differ - - cmp - - - - - - diff - - Compares two files or directories and reports which lines in - the files differ - - diff - - - - - - diff3 - - Compares three files line by line - - diff3 - - - - - - sdiff - - Merges two files and interactively outputs the results - - sdiff - - - - - + Details on this package are located in + diff --git a/chapter06/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 + + + + + + <para>The <application>Expect</application> package contains tools for + automating, via scripted dialogues, interactive applications such as + <command>telnet</command>, <command>ftp</command>, + <command>passwd</command>, <command>fsck</command>, + <command>rlogin</command>, and <command>tip</command>. + <application>Expect</application> is also useful for testing these same + applications as well as easing all sorts of tasks that are prohibitively + difficult with anything else. The <application>DejaGnu</application> + framework is written in <application>Expect</application>.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&expect-ch5-sbu;</seg> + <seg>&expect-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 - <para>The File package contains a utility for determining the type of a given - file or files.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/file.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&file-ch6-sbu;</seg> - <seg>&file-ch6-du;</seg> + <seg>&file-ch5-sbu;</seg> + <seg>&file-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -43,65 +45,28 @@ <para>Prepare File for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr \ + --host=$LFS_TGT</userinput></screen> +<!-- devs: if using - -build here, the build system wants to compile + the signature file with "file" on the build system, but stops if it is not + the same version. One possibility would be to build "file" on the build + system first, but it is simpler to have the system think it is not + cross-compiling, and use the just built "file". --> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make check</userinput></screen> - <para>Install the package:</para> -<screen><userinput remap="install">make install</userinput></screen> +<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> </sect2> - - <sect2 id="contents-file" role="content"> - <title>Contents of File - - - Installed programs - Installed library - - - file - libmagic.so - - - - - Short Descriptions - - - - - file - - Tries to classify each given file; it does this by performing - several tests—file system tests, magic number tests, and language - tests - - file - - - - - - libmagic - - Contains routines for magic number recognition, used by the - file program - - libmagic - - - - - + + + <para>Details on this package are located in<!-- TODO + <xref linkend="contents-file" role="."/> --></para> </sect2> 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; ]> -<sect1 id="ch-system-findutils" role="wrap"> +<sect1 id="ch-tools-findutils" role="wrap"> <?dbhtml filename="findutils.html"?> <sect1info condition="script"> @@ -16,25 +16,25 @@ <title>Findutils-&findutils-version; - + Findutils + tools - <para>The Findutils package contains programs to find files. These programs - are provided to recursively search through a directory tree and to - create, maintain, and search a database (often faster than the recursive - find, but unreliable if the database has not been recently updated).</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/findutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&findutils-ch6-sbu;</seg> - <seg>&findutils-ch6-du;</seg> + <seg>&findutils-ch5-sbu;</seg> + <seg>&findutils-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -45,116 +45,30 @@ <para>Prepare Findutils for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr --localstatedir=/var/lib/locate</userinput></screen> - - <variablelist> - <title>The meaning of the configure options: - - - --localstatedir - - This option changes the location of the locate - database to be in /var/lib/locate, - which is FHS-compliant. - - - - +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) Compile the package: make - To test the results, issue: - -chown -Rv tester . -su tester -c "PATH=$PATH make check" - Install the package: -make install +make DESTDIR=$LFS install - Some of the scripts in the LFS-Bootscripts package - depend on find. As /usr may not be available during the early - stages of booting, this program needs to be on the root partition. The - updatedb script also needs to be modified to correct an - explicit path: + Move the excutable to its final expected location: - Some packages in BLFS and beyond expect the - find program in /bin, so make sure it's placed there: - -mv -v /usr/bin/find /bin -sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb +mv -v $LFS/usr/bin/find $LFS/bin +sed -i 's|find:=${BINDIR}|find:=/bin|' $LFS/usr/bin/updatedb - - Contents of Findutils + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed directory</segtitle> - - <seglistitem> - <seg>find, locate, updatedb, and xargs</seg> - <seg>/var/lib/locate</seg> - </seglistitem> - - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="find"> - <term><command>find</command></term> - <listitem> - <para>Searches given directory trees for files matching the specified - criteria</para> - <indexterm zone="ch-system-findutils find"> - <primary sortas="b-find">find</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="locate"> - <term><command>locate</command></term> - <listitem> - <para>Searches through a database of file names and reports the names - that contain a given string or match a given pattern</para> - <indexterm zone="ch-system-findutils locate"> - <primary sortas="b-locate">locate</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="updatedb"> - <term><command>updatedb</command></term> - <listitem> - <para>Updates the <command>locate</command> database; it scans the - entire file system (including other file systems that are currently - mounted, unless told not to) and puts every file name it finds into - the database</para> - <indexterm zone="ch-system-findutils updatedb"> - <primary sortas="b-updatedb">updatedb</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="xargs"> - <term><command>xargs</command></term> - <listitem> - <para>Can be used to apply a given command to a list of files</para> - <indexterm zone="ch-system-findutils xargs"> - <primary sortas="b-xargs">xargs</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-findutils" role="."/></para> </sect2> diff --git a/chapter06/flex.xml b/chapter06/flex.xml index bd4bd545f..88e263413 100644 --- a/chapter06/flex.xml +++ b/chapter06/flex.xml @@ -5,7 +5,7 @@ %general-entities; ]> -<sect1 id="ch-system-flex" role="wrap"> +<sect1 id="ch-tools-flex" role="wrap"> <?dbhtml filename="flex.html"?> <sect1info condition="script"> @@ -16,23 +16,25 @@ <title>Flex-&flex-version; - + Flex + tools - <para>The Flex package contains a utility for generating programs that - recognize patterns in text.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/flex.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&flex-ch6-sbu;</seg> - <seg>&flex-ch6-du;</seg> + <seg>&flex-ch5-sbu;</seg> + <seg>&flex-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -41,108 +43,45 @@ <sect2 role="installation"> <title>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 + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed libraries</segtitle> - <segtitle>Installed directory</segtitle> - - <seglistitem> - <seg>flex, flex++ (link to flex), and lex (link to flex)</seg> - <seg>libfl.so</seg> - <seg>/usr/share/doc/flex-&flex-version;</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="flex"> - <term><command>flex</command></term> - <listitem> - <para>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</para> - <indexterm zone="ch-system-flex flex"> - <primary sortas="b-flex">flex</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="flexpp"> - <term><command>flex++</command></term> - <listitem> - <para>An extension of flex, is used for generating C++ code - and classes. It is a symbolic link to <command>flex</command></para> - <indexterm zone="ch-system-flex flexpp"> - <primary sortas="b-flex++">flex++</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="lex"> - <term><command>lex</command></term> - <listitem> - <para>A symbolic link that runs <command>flex</command> in - <command>lex</command> emulation mode</para> - <indexterm zone="ch-system-flex lex"> - <primary sortas="b-lex">lex</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libfl"> - <term><filename class="libraryfile">libfl</filename></term> - <listitem> - <para>The <filename class="libraryfile">flex</filename> library</para> - <indexterm zone="ch-system-flex libfl"> - <primary sortas="c-libfl">libfl</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-flex" role="."/></para> </sect2> 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; ]> -<sect1 id="ch-system-gawk" role="wrap"> +<sect1 id="ch-tools-gawk" role="wrap"> <?dbhtml filename="gawk.html"?> <sect1info condition="script"> @@ -16,22 +16,25 @@ <title>Gawk-&gawk-version; - + Gawk + tools - <para>The Gawk package contains programs for manipulating text files.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/gawk.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&gawk-ch6-sbu;</seg> - <seg>&gawk-ch6-du;</seg> + <seg>&gawk-ch5-sbu;</seg> + <seg>&gawk-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -46,82 +49,25 @@ <para>Prepare Gawk for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(./config.guess)</userinput></screen> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make check</userinput></screen> - <para>Install the package:</para> -<screen><userinput remap="install">make install</userinput></screen> - - <para>If desired, install the documentation:</para> - -<screen><userinput remap="install">mkdir -v /usr/share/doc/gawk-&gawk-version; -cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-&gawk-version;</userinput></screen> +<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> </sect2> - <sect2 id="contents-gawk" role="content"> - <title>Contents of Gawk + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed libraries</segtitle> - <segtitle>Installed directories</segtitle> - - <seglistitem> - <seg>awk (link to gawk), gawk, and awk-&gawk-version;</seg> - <seg>filefuncs.so, fnmatch.so, fork.so, inplace.so, intdiv.so, ordchr.so, - readdir.so, readfile.so, revoutput.so, revtwoway.so, rwarray.so, - and time.so (all in /usr/lib/gawk)</seg> - <seg>/usr/lib/gawk, /usr/libexec/awk, /usr/share/awk, and - /usr/share/doc/gawk-&gawk-version;</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="awk"> - <term><command>awk</command></term> - <listitem> - <para>A link to <command>gawk</command></para> - <indexterm zone="ch-system-gawk awk"> - <primary sortas="b-awk">awk</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="gawk"> - <term><command>gawk</command></term> - <listitem> - <para>A program for manipulating text files; it is the GNU - implementation of <command>awk</command></para> - <indexterm zone="ch-system-gawk gawk"> - <primary sortas="b-gawk">gawk</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="gawk-version"> - <term><command>gawk-&gawk-version;</command></term> - <listitem> - <para>A hard link to <command>gawk</command></para> - <indexterm zone="ch-system-gawk gawk-version"> - <primary sortas="b-gawk-&gawk-version;">gawk-&gawk-version;</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-gawk" role="."/></para> </sect2> diff --git a/chapter06/gcc-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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-gcc-pass1" role="wrap" xreflabel="gcc-pass1"> + <?dbhtml filename="gcc-pass1.html"?> + + <sect1info condition="script"> + <productname>gcc-pass1</productname> + <productnumber>&gcc-version;</productnumber> + <address>&gcc-url;</address> + </sect1info> + + <title>GCC-&gcc-version; - Pass 1 + + + GCC + tools, pass 1 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/gcc.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gcc-ch5p1-sbu;</seg> + <seg>&gcc-ch5p1-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>Details on this package are located in + <xref linkend="contents-gcc" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-gcc-pass2" role="wrap"> + <?dbhtml filename="gcc-pass2.html"?> + + <sect1info condition="script"> + <productname>gcc-pass2</productname> + <productnumber>&gcc-version;</productnumber> + <address>&gcc-url;</address> + </sect1info> + + <title>GCC-&gcc-version; - Pass 2 + + + GCC + tools, pass 2 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/gcc.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gcc-ch5p2-sbu;</seg> + <seg>&gcc-ch5p2-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of GCC + + As in the first build of GCC, the GMP, MPFR, and MPC packages are + required. Unpack the tarballs and move them into the required directory + names: + +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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-gcc" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-generalinstructions"> + <?dbhtml filename="generalinstructions.html"?> + + <title>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 - <para>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.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/gettext.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&gettext-ch6-sbu;</seg> - <seg>&gettext-ch6-du;</seg> + <seg>&gettext-ch5-sbu;</seg> + <seg>&gettext-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -43,402 +43,42 @@ <sect2 role="installation"> <title>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 + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed libraries</segtitle> - <segtitle>Installed directories</segtitle> - - <seglistitem> - <seg>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</seg> - <seg>libasprintf.so, libgettextlib.so, libgettextpo.so, - libgettextsrc.so, libtextstyle.so, and preloadable_libintl.so</seg> - <seg>/usr/lib/gettext, /usr/share/doc/gettext-&gettext-version;, - /usr/share/gettext, and /usr/share/gettext-0.19.8</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="autopoint"> - <term><command>autopoint</command></term> - <listitem> - <para>Copies standard Gettext infrastructure files into a source - package</para> - <indexterm zone="ch-system-gettext autopoint"> - <primary sortas="b-autopoint">autopoint</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="envsubst"> - <term><command>envsubst</command></term> - <listitem> - <para>Substitutes environment variables in shell format strings</para> - <indexterm zone="ch-system-gettext envsubst"> - <primary sortas="b-envsubst">envsubst</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="gettext"> - <term><command>gettext</command></term> - <listitem> - <para>Translates a natural language message into the user's language - by looking up the translation in a message catalog</para> - <indexterm zone="ch-system-gettext gettext"> - <primary sortas="b-gettext">gettext</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="gettext.sh"> - <term><command>gettext.sh</command></term> - <listitem> - <para>Primarily serves as a shell function library for gettext</para> - <indexterm zone="ch-system-gettext gettext.sh"> - <primary sortas="b-gettext.sh">gettext.sh</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="gettextize"> - <term><command>gettextize</command></term> - <listitem> - <para>Copies all standard Gettext files into the given top-level - directory of a package to begin internationalizing it</para> - <indexterm zone="ch-system-gettext gettextize"> - <primary sortas="b-gettextize">gettextize</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msgattrib"> - <term><command>msgattrib</command></term> - <listitem> - <para>Filters the messages of a translation catalog according to their - attributes and manipulates the attributes</para> - <indexterm zone="ch-system-gettext msgattrib"> - <primary sortas="b-msgattrib">msgattrib</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msgcat"> - <term><command>msgcat</command></term> - <listitem> - <para>Concatenates and merges the given - <filename class="extension">.po</filename> files</para> - <indexterm zone="ch-system-gettext msgcat"> - <primary sortas="b-msgcat">msgcat</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msgcmp"> - <term><command>msgcmp</command></term> - <listitem> - <para>Compares two <filename class="extension">.po</filename> - files to check that both contain the same set of msgid strings</para> - <indexterm zone="ch-system-gettext msgcmp"> - <primary sortas="b-msgcmp">msgcmp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msgcomm"> - <term><command>msgcomm</command></term> - <listitem> - <para>Finds the messages that are common to the given - <filename class="extension">.po</filename> files</para> - <indexterm zone="ch-system-gettext msgcomm"> - <primary sortas="b-msgcomm">msgcomm</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msgconv"> - <term><command>msgconv</command></term> - <listitem> - <para>Converts a translation catalog to a different character - encoding</para> - <indexterm zone="ch-system-gettext msgconv"> - <primary sortas="b-msgconv">msgconv</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msgen"> - <term><command>msgen</command></term> - <listitem> - <para>Creates an English translation catalog</para> - <indexterm zone="ch-system-gettext msgen"> - <primary sortas="b-msgen">msgen</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msgexec"> - <term><command>msgexec</command></term> - <listitem> - <para>Applies a command to all translations of a translation - catalog</para> - <indexterm zone="ch-system-gettext msgexec"> - <primary sortas="b-msgexec">msgexec</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msgfilter"> - <term><command>msgfilter</command></term> - <listitem> - <para>Applies a filter to all translations of a translation - catalog</para> - <indexterm zone="ch-system-gettext msgfilter"> - <primary sortas="b-msgfilter">msgfilter</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msgfmt"> - <term><command>msgfmt</command></term> - <listitem> - <para>Generates a binary message catalog from a translation - catalog</para> - <indexterm zone="ch-system-gettext msgfmt"> - <primary sortas="b-msgfmt">msgfmt</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msggrep"> - <term><command>msggrep</command></term> - <listitem> - <para>Extracts all messages of a translation catalog that match a - given pattern or belong to some given source files</para> - <indexterm zone="ch-system-gettext msggrep"> - <primary sortas="b-msggrep">msggrep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msginit"> - <term><command>msginit</command></term> - <listitem> - <para>Creates a new <filename class="extension">.po</filename> file, - initializing the meta information with values from the user's - environment</para> - <indexterm zone="ch-system-gettext msginit"> - <primary sortas="b-msginit">msginit</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msgmerge"> - <term><command>msgmerge</command></term> - <listitem> - <para>Combines two raw translations into a single file</para> - <indexterm zone="ch-system-gettext msgmerge"> - <primary sortas="b-msgmerge">msgmerge</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msgunfmt"> - <term><command>msgunfmt</command></term> - <listitem> - <para>Decompiles a binary message catalog into raw translation - text</para> - <indexterm zone="ch-system-gettext msgunfmt"> - <primary sortas="b-msgunfmt">msgunfmt</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="msguniq"> - <term><command>msguniq</command></term> - <listitem> - <para>Unifies duplicate translations in a translation catalog</para> - <indexterm zone="ch-system-gettext msguniq"> - <primary sortas="b-msguniq">msguniq</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ngettext"> - <term><command>ngettext</command></term> - <listitem> - <para>Displays native language translations of a textual message whose - grammatical form depends on a number</para> - <indexterm zone="ch-system-gettext ngettext"> - <primary sortas="b-ngettext">ngettext</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="recode-sr-latin"> - <term><command>recode-sr-latin</command></term> - <listitem> - <para>Recodes Serbian text from Cyrillic to Latin script</para> - <indexterm zone="ch-system-gettext recode-sr-latin"> - <primary sortas="b-recode-sr-latin">recode-sr-latin</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="xgettext"> - <term><command>xgettext</command></term> - <listitem> - <para>Extracts the translatable message lines from the given source - files to make the first translation template</para> - <indexterm zone="ch-system-gettext xgettext"> - <primary sortas="b-xgettext">xgettext</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libasprintf"> - <term><filename class="libraryfile">libasprintf</filename></term> - <listitem> - <para>defines the <emphasis>autosprintf</emphasis> class, which makes - C formatted output routines usable in C++ programs, for use with the - <emphasis><string></emphasis> strings and the - <emphasis><iostream></emphasis> streams</para> - <indexterm zone="ch-system-gettext libasprintf"> - <primary sortas="c-libasprintf">libasprintf</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libgettextlib"> - <term><filename class="libraryfile">libgettextlib</filename></term> - <listitem> - <para>a private library containing common routines used by the - various Gettext programs; these are not intended for general use</para> - <indexterm zone="ch-system-gettext libgettextlib"> - <primary sortas="c-libgettextlib">libgettextlib</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libgettextpo"> - <term><filename class="libraryfile">libgettextpo</filename></term> - <listitem> - <para>Used to write specialized programs that process - <filename class="extension">.po</filename> files; this library is - used when the standard applications shipped with Gettext (such as - <command>msgcomm</command>, <command>msgcmp</command>, - <command>msgattrib</command>, and <command>msgen</command>) will - not suffice</para> - <indexterm zone="ch-system-gettext libgettextpo"> - <primary sortas="c-libgettextpo">libgettextpo</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libgettextsrc"> - <term><filename class="libraryfile">libgettextsrc</filename></term> - <listitem> - <para>A private library containing common routines used by the - various Gettext programs; these are not intended for general use</para> - <indexterm zone="ch-system-gettext libgettextsrc"> - <primary sortas="c-libgettextsrc">libgettextsrc</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libtextstyle"> - <term><filename class="libraryfile">libtextstyle</filename></term> - <listitem> - <para>Text styling library</para> - <indexterm zone="ch-system-gettext libtextstyle"> - <primary sortas="c-libtextstyle">libtextstyle</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="preloadable_libintl"> - <term><filename class="libraryfile">preloadable_libintl</filename></term> - <listitem> - <para>A library, intended to be used by LD_PRELOAD that assists - <filename class="libraryfile">libintl</filename> in logging - untranslated messages</para> - <indexterm zone="ch-system-gettext preloadable_libintl"> - <primary sortas="c-preloadable_libintl">preloadable_libintl</primary> - </indexterm> - </listitem> - </varlistentry> - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-gettext" role="."/></para> </sect2> 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; ]> -<sect1 id="ch-system-glibc" role="wrap"> +<sect1 id="ch-tools-glibc" role="wrap"> <?dbhtml filename="glibc.html"?> <sect1info condition="script"> @@ -16,25 +16,25 @@ <title>Glibc-&glibc-version; - + Glibc + tools - <para>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.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/glibc.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&glibc-ch6-sbu;</seg> - <seg>&glibc-ch6-du;</seg> + <seg>&glibc-ch5-sbu;</seg> + <seg>&glibc-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -43,928 +43,188 @@ <sect2 role="installation"> <title>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 <command>make install</command> 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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-glibc" role="."/></para> + </sect2> </sect1> 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; ]> -<sect1 id="ch-system-grep" role="wrap"> +<sect1 id="ch-tools-grep" role="wrap"> <?dbhtml filename="grep.html"?> <sect1info condition="script"> @@ -16,22 +16,25 @@ <title>Grep-&grep-version; - + Grep + tools - <para>The Grep package contains programs for searching through files.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/grep.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&grep-ch6-sbu;</seg> - <seg>&grep-ch6-du;</seg> + <seg>&grep-ch5-sbu;</seg> + <seg>&grep-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -42,69 +45,25 @@ <para>Prepare Grep for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr --bindir=/bin</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr \ + --host=$LFS_TGT \ + --bindir=/bin</userinput></screen> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make check</userinput></screen> - <para>Install the package:</para> -<screen><userinput remap="install">make install</userinput></screen> +<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> </sect2> - <sect2 id="contents-grep" role="content"> - <title>Contents of Grep + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - - <seglistitem> - <seg>egrep, fgrep, and grep</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="egrep"> - <term><command>egrep</command></term> - <listitem> - <para>Prints lines matching an extended regular expression</para> - <indexterm zone="ch-system-grep egrep"> - <primary sortas="b-egrep">egrep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fgrep"> - <term><command>fgrep</command></term> - <listitem> - <para>Prints lines matching a list of fixed strings</para> - <indexterm zone="ch-system-grep fgrep"> - <primary sortas="b-fgrep">fgrep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="grep"> - <term><command>grep</command></term> - <listitem> - <para>Prints lines matching a basic regular expression</para> - <indexterm zone="ch-system-grep grep"> - <primary sortas="b-grep">grep</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-grep" role="."/></para> </sect2> diff --git a/chapter06/grub.xml b/chapter06/grub.xml deleted file mode 100644 index 25a61077b..000000000 --- a/chapter06/grub.xml +++ /dev/null @@ -1,374 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-system-grub" role="wrap"> - <?dbhtml filename="grub.html"?> - - <sect1info condition="script"> - <productname>grub</productname> - <productnumber>&grub-version;</productnumber> - <address>&grub-url;</address> - </sect1info> - - <title>GRUB-&grub-version; - - - GRUB - - - - - - <para>The GRUB package contains the GRand Unified Bootloader.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&grub-ch6-sbu;</seg> - <seg>&grub-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of GRUB - - Prepare GRUB for compilation: - -./configure --prefix=/usr \ - --sbindir=/sbin \ - --sysconfdir=/etc \ - --disable-efiemu \ - --disable-werror - - - The meaning of the new configure options: - - - --disable-werror - - This allows the build to complete with warnings introduced - by more recent Flex versions. - - - - - --disable-efiemu - - This option minimizes what is built by disabling a feature and - testing programs not needed for LFS. - - - - - - Compile the package: - -make - - This package does not come with a test suite. - - Install the package: - -make install -mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions - - Using GRUB to make your LFS system bootable will be discussed in - . - - - - - Contents of GRUB - - - Installed programs - Installed directories - - - - grub-bios-setup, grub-editenv, grub-file, grub-fstest, - grub-glue-efi, grub-install, grub-kbdcomp, grub-macbless, - grub-menulst2cfg, grub-mkconfig, - grub-mkimage, grub-mklayout, grub-mknetdir, - grub-mkpasswd-pbkdf2, grub-mkrelpath, grub-mkrescue, grub-mkstandalone, - grub-ofpathname, grub-probe, grub-reboot, grub-render-label, - grub-script-check, - grub-set-default, grub-sparc64-setup, and grub-syslinux2cfg - - /usr/lib/grub, /etc/grub.d, /usr/share/grub, and /boot/grub (when grub-install - is first run) - - - - - Short Descriptions - - - - - grub-bios-setup - - Is a helper program for grub-install - - grub-bios-setup - - - - - - grub-editenv - - A tool to edit the environment block - - grub-editenv - - - - - - grub-file - - Checks if FILE is of the specified type. - - grub-file - - - - - - grub-fstest - - Tool to debug the filesystem driver - - grub-fstest - - - - - - grub-glue-efi - - Processes ia32 and amd64 EFI images and glues them - according to Apple format. - - grub-glue-efi - - - - - - grub-install - - Install GRUB on your drive - - grub-install - - - - - - grub-kbdcomp - - Script that converts an xkb layout into one recognized by - GRUB - - grub-kbdcomp - - - - - - grub-macbless - - Mac-style bless on HFS or HFS+ files - - grub-macbless - - - - - - grub-menulst2cfg - - Converts a GRUB Legacy menu.lst - into a grub.cfg for use with GRUB 2 - - grub-menulst2cfg - - - - - - grub-mkconfig - - Generate a grub config file - - grub-mkconfig - - - - - - grub-mkimage - - Make a bootable image of GRUB - - grub-mkimage - - - - - - grub-mklayout - - Generates a GRUB keyboard layout file - - grub-mklayout - - - - - - grub-mknetdir - - Prepares a GRUB netboot directory - - grub-mknetdir - - - - - - grub-mkpasswd-pbkdf2 - - Generates an encrypted PBKDF2 password for use in the boot - menu - - grub-mkpasswd-pbkdf2 - - - - - - grub-mkrelpath - - Makes a system pathname relative to its root - - grub-mkrelpath - - - - - - grub-mkrescue - - Make a bootable image of GRUB suitable for a floppy disk or CDROM/DVD - - grub-mkrescue - - - - - - grub-mkstandalone - - Generates a standalone image - - grub-mkstandalone - - - - - - grub-ofpathname - - Is a helper program that prints the path of a GRUB device - - grub-ofpathname - - - - - - grub-probe - - Probe device information for a given path or device - - grub-probe - - - - - - grub-reboot - - Sets the default boot entry for GRUB for the next boot only - - grub-reboot - - - - - - grub-render-label - - Render Apple .disk_label for Apple Macs - - grub-render-label - - - - - - grub-script-check - - Checks GRUB configuration script for syntax errors - - grub-script-check - - - - - - grub-set-default - - Sets the default boot entry for GRUB - - grub-set-default - - - - - - grub-sparc64-setup - - Is a helper program for grub-setup - - grub-setup - - - - - - grub-syslinux2cfg - - Transform a syslinux config file into grub.cfg format - - grub-syslinux2cfg - - - - - - - - -
diff --git a/chapter06/gzip.xml b/chapter06/gzip.xml index 09eebbdf7..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 - <para>The Gzip package contains programs for compressing and decompressing - files.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/gzip.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&gzip-ch6-sbu;</seg> - <seg>&gzip-ch6-du;</seg> + <seg>&gzip-ch5-sbu;</seg> + <seg>&gzip-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -43,193 +45,27 @@ <para>Prepare Gzip for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr --host=$LFS_TGT</userinput></screen> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make check</userinput></screen> - - <para>Two tests are known to fail in the LFS environment: - help-version and zmore.</para> - <para>Install the package:</para> -<screen><userinput remap="install">make install</userinput></screen> +<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> - <para>Move a program that needs to be on the root filesystem:</para> + <para>Move the excutable to its final expected location:</para> -<screen><userinput remap="install">mv -v /usr/bin/gzip /bin</userinput></screen> +<screen><userinput remap="install">mv -v $LFS/usr/bin/gzip $LFS/bin</userinput></screen> </sect2> - <sect2 id="contents-gzip" role="content"> - <title>Contents of Gzip + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - - <seglistitem> - <seg>gunzip, gzexe, gzip, uncompress (hard link with gunzip), zcat, zcmp, - zdiff, zegrep, zfgrep, zforce, zgrep, zless, zmore, and znew</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="gunzip"> - <term><command>gunzip</command></term> - <listitem> - <para>Decompresses gzipped files</para> - <indexterm zone="ch-system-gzip gunzip"> - <primary sortas="b-gunzip">gunzip</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="gzexe"> - <term><command>gzexe</command></term> - <listitem> - <para>Creates self-decompressing executable files</para> - <indexterm zone="ch-system-gzip gzexe"> - <primary sortas="b-gzexe">gzexe</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="gzip"> - <term><command>gzip</command></term> - <listitem> - <para>Compresses the given files using Lempel-Ziv (LZ77) coding</para> - <indexterm zone="ch-system-gzip gzip"> - <primary sortas="b-gzip">gzip</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="uncompress"> - <term><command>uncompress</command></term> - <listitem> - <para>Decompresses compressed files</para> - <indexterm zone="ch-system-gzip uncompress"> - <primary sortas="b-uncompress">uncompress</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zcat"> - <term><command>zcat</command></term> - <listitem> - <para>Decompresses the given gzipped files to standard output</para> - <indexterm zone="ch-system-gzip zcat"> - <primary sortas="b-zcat">zcat</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zcmp"> - <term><command>zcmp</command></term> - <listitem> - <para>Runs <command>cmp</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zcmp"> - <primary sortas="b-zcmp">zcmp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zdiff"> - <term><command>zdiff</command></term> - <listitem> - <para>Runs <command>diff</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zdiff"> - <primary sortas="b-zdiff">zdiff</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zegrep"> - <term><command>zegrep</command></term> - <listitem> - <para>Runs <command>egrep</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zegrep"> - <primary sortas="b-zegrep">zegrep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zfgrep"> - <term><command>zfgrep</command></term> - <listitem> - <para>Runs <command>fgrep</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zfgrep"> - <primary sortas="b-zfgrep">zfgrep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zforce"> - <term><command>zforce</command></term> - <listitem> - <para>Forces a <filename class="extension">.gz</filename> extension on - all given files that are gzipped files, so that <command>gzip</command> - will not compress them again; this can be useful when file names were - truncated during a file transfer</para> - <indexterm zone="ch-system-gzip zforce"> - <primary sortas="b-zforce">zforce</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zgrep"> - <term><command>zgrep</command></term> - <listitem> - <para>Runs <command>grep</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zgrep"> - <primary sortas="b-zgrep">zgrep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zless"> - <term><command>zless</command></term> - <listitem> - <para>Runs <command>less</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zless"> - <primary sortas="b-zless">zless</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zmore"> - <term><command>zmore</command></term> - <listitem> - <para>Runs <command>more</command> on gzipped files</para> - <indexterm zone="ch-system-gzip zmore"> - <primary sortas="b-zmore">zmore</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="znew"> - <term><command>znew</command></term> - <listitem> - <para>Re-compresses files from <command>compress</command> format to - <command>gzip</command> format—<filename - class="extension">.Z</filename> to <filename - class="extension">.gz</filename></para> - <indexterm zone="ch-system-gzip znew"> - <primary sortas="b-znew">znew</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-gzip" role="."/></para> </sect2> diff --git a/chapter06/introduction.xml b/chapter06/introduction.xml index c8ccb3908..5614270b2 100644 --- a/chapter06/introduction.xml +++ b/chapter06/introduction.xml @@ -5,70 +5,25 @@ %general-entities; ]> -<sect1 id="ch-system-introduction"> +<sect1 id="ch-tools-introduction"> <?dbhtml filename="introduction.html"?> <title>Introduction - In this chapter, we enter the building site and start constructing the - LFS system in earnest. That is, we chroot into the temporary mini Linux system, - make a few final preparations, and then begin installing the packages. - - 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 + + + + + + <para>Again, when building <xref linkend="ch-tools-gcc-pass2"/>, we had to + defer the installation of the C++ standard library, because no suitable + compiler was available to compile it: we could not use the compiler + 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.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <!-- TODO --> + <seglistitem> + <seg>&libstdcpp-ch5-sbu;</seg> + <seg>&libstdcpp-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Target Libstdc++ + + + Libstdc++ is part of the GCC sources. + You should first unpack the GCC tarball and change to the + gcc-&gcc-version; directory. + + + Create a link which exists when building Libstdc++ in the gcc + tree: + +ln -s gthr-posix.h libgcc/gthr-default.h + + Create a separate build directory for Libstdc++ and enter it: + +mkdir -v build +cd build + + Prepare Libstdc++ for compilation: + +../libstdc++-v3/configure \ + CXXFLAGS="-g -O2 -D_GNU_SOURCE" \ + --prefix=/usr \ + --disable-multilib \ + --disable-nls \ + --disable-libstdcxx-pch + + + 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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-gcc" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-libstdcpp-pass1" role="wrap"> + <?dbhtml filename="gcc-libstdc++-pass1.html"?> + + <sect1info condition="script"> + <productname>gcc-libstdc++</productname> + <productnumber>&gcc-version;</productnumber> + <address>&gcc-url;</address> + </sect1info> + + <title>Libstdc++ from GCC-&gcc-version;, Pass 1 + + + GCC + tools, libstdc++ pass 1 + + + + + + <para>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 <xref linkend="ch-tools-gcc-pass1"/> + because it depends on glibc, which was not yet available in the target + directory. + </para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&libstdcpp-ch5-sbu;</seg> + <seg>&libstdcpp-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Target Libstdc++ + + + Libstdc++ is part of the GCC sources. + You should first unpack the GCC tarball and change to the + gcc-&gcc-version; directory. + + + Create a 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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-gcc" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-linux-headers" role="wrap"> + <?dbhtml filename="linux-headers.html"?> + + <sect1info condition="script"> + <productname>linux-headers</productname> + <productnumber>&linux-version;</productnumber> + <address>&linux-url;</address> + </sect1info> + + <title>Linux-&linux-version; API Headers + + + Linux + tools, API headers + + + + + + <para>The Linux API Headers (in linux-&linux-version;.tar.xz) expose the + kernel's API for use by Glibc.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&linux-headers-ch5-sbu;</seg> + <seg>&linux-headers-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Linux API Headers + + The Linux kernel needs to expose an Application Programming Interface + (API) for the system's C library (Glibc in LFS) to use. This is done + by way of sanitizing various C header files that are shipped in the Linux + kernel source tarball. + + Make sure there are no stale files 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 - <para>The M4 package contains a macro processor.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/m4.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&m4-ch6-sbu;</seg> - <seg>&m4-ch6-du;</seg> + <seg>&m4-ch5-sbu;</seg> + <seg>&m4-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -40,64 +43,31 @@ <sect2 role="installation"> <title>Installation of M4 - First, make some fixes required by glibc-2.28: + First, make some fixes introduced by glibc-2.28: sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h Prepare M4 for compilation: -./configure --prefix=/usr +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) Compile the package: make - To test the results, issue: - -make check - Install the package: -make install +make DESTDIR=$LFS install - - Contents of M4 - - - Installed program - - - m4 - - - - - Short Descriptions - - - - - - m4 - - Copies the given files while expanding the macros that they - contain [These macros are either built-in or user-defined and can - take any number of arguments. Besides performing macro expansion, - m4 has built-in functions for including named - files, running Unix commands, performing integer arithmetic, - manipulating text, recursion, etc. The m4 program - can be used either as a front-end to a compiler or as a macro processor - in its own right.] - - m4 - - - - - + + + <para>Details on this package are located in + <xref linkend="contents-m4" role="."/></para> </sect2> diff --git a/chapter06/make.xml b/chapter06/make.xml index 9c649cdc5..fef5555aa 100644 --- a/chapter06/make.xml +++ b/chapter06/make.xml @@ -4,8 +4,7 @@ <!ENTITY % general-entities SYSTEM "../general.ent"> %general-entities; ]> - -<sect1 id="ch-system-make" role="wrap"> +<sect1 id="ch-tools-make" role="wrap"> <?dbhtml filename="make.html"?> <sect1info condition="script"> @@ -16,22 +15,25 @@ <title>Make-&make-version; - + Make + tools - <para>The Make package contains a program for compiling packages.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/make.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&make-ch6-sbu;</seg> - <seg>&make-ch6-du;</seg> + <seg>&make-ch5-sbu;</seg> + <seg>&make-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -39,60 +41,42 @@ <sect2 role="installation"> <title>Installation of Make - Prepare Make for compilation: -./configure --prefix=/usr +./configure --prefix=/usr \ + --without-guile \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) + + + The meaning of the new configure option: + + + --without-guile + + Although we are cross-compiling, configure tries to use + guile from the build host if it finds it. This makes compilation + fail, so this switch prevents using it. + + + Compile the package: make - The test suite needs to know where supporting perl files are located. - We use an environment variable to accomplish this. To test the - results, issue: - -make check - Install the package: -make install +make DESTDIR=$LFS install + + - <sect2 id="contents-make" role="content"> - <title>Contents of Make - - - Installed program - - - make - - - - - Short Descriptions - - - - - make - - Automatically determines which pieces of a package need to - be (re)compiled and then issues the relevant commands - - make - - - - - + Details on this package are located in + diff --git a/chapter06/ncurses.xml b/chapter06/ncurses.xml index 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 - <para>The Ncurses package contains libraries for terminal-independent - handling of character screens.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/ncurses.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&ncurses-ch6-sbu;</seg> - <seg>&ncurses-ch6-du;</seg> + <seg>&ncurses-ch5-sbu;</seg> + <seg>&ncurses-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -41,23 +43,45 @@ <sect2 role="installation"> <title>Installation of Ncurses - Don't install a static library that is not handled by configure: + First, ensure that gawk is found first during configuration: -sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in +sed -i s/mawk// configure + + Then, run the following commands to build the tic + program on the build host: + +mkdir build +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-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 @@ -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.so Move the shared libraries to the /lib directory, where they are expected to reside: -mv -v /usr/lib/libncursesw.so.6* /lib +mv -v $LFS/usr/lib/libncursesw.so.6* $LFS/lib Because the libraries have been moved, one symlink points to a non-existent file. Recreate it: -ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so +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 + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed libraries</segtitle> - <segtitle>Installed directories</segtitle> - - <seglistitem> - <seg> - captoinfo (link to tic), - clear, - infocmp, - infotocap (link to tic), - ncursesw6-config, - reset (link to tset), - tabs, - tic, - toe, - tput, and - tset - </seg> - <seg> - 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.</seg> - <seg> - /usr/share/tabset, - /usr/share/terminfo, and - /usr/share/doc/ncurses-&ncurses-version; - </seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="captoinfo"> - <term><command>captoinfo</command></term> - <listitem> - <para>Converts a termcap description into a terminfo description</para> - <indexterm zone="ch-system-ncurses captoinfo"> - <primary sortas="b-captoinfo">captoinfo</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="clear"> - <term><command>clear</command></term> - <listitem> - <para>Clears the screen, if possible</para> - <indexterm zone="ch-system-ncurses clear"> - <primary sortas="b-clear">clear</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="infocmp"> - <term><command>infocmp</command></term> - <listitem> - <para>Compares or prints out terminfo descriptions</para> - <indexterm zone="ch-system-ncurses infocmp"> - <primary sortas="b-infocmp">infocmp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="infotocap"> - <term><command>infotocap</command></term> - <listitem> - <para>Converts a terminfo description into a termcap description</para> - <indexterm zone="ch-system-ncurses infotocap"> - <primary sortas="b-infotocap">infotocap</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ncursesw6-config"> - <term><command>ncursesw6-config</command></term> - <listitem> - <para>Provides configuration information for ncurses</para> - <indexterm zone="ch-system-ncurses ncursesw6-config"> - <primary sortas="b-ncursesw6-config">ncursesw6-config</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="reset"> - <term><command>reset</command></term> - <listitem> - <para>Reinitializes a terminal to its default values</para> - <indexterm zone="ch-system-ncurses reset"> - <primary sortas="b-reset">reset</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tabs"> - <term><command>tabs</command></term> - <listitem> - <para>Clears and sets tab stops on a terminal</para> - <indexterm zone="ch-system-ncurses tabs"> - <primary sortas="b-tabs">tabs</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tic"> - <term><command>tic</command></term> - <listitem> - <para>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.]</para> - <indexterm zone="ch-system-ncurses tic"> - <primary sortas="b-tic">tic</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="toe"> - <term><command>toe</command></term> - <listitem> - <para>Lists all available terminal types, giving the primary name and - description for each</para> - <indexterm zone="ch-system-ncurses toe"> - <primary sortas="b-toe">toe</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tput"> - <term><command>tput</command></term> - <listitem> - <para>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</para> - <indexterm zone="ch-system-ncurses tput"> - <primary sortas="b-tput">tput</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tset"> - <term><command>tset</command></term> - <listitem> - <para>Can be used to initialize terminals</para> - <indexterm zone="ch-system-ncurses tset"> - <primary sortas="b-tset">tset</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libcursesw"> - <term><filename class="libraryfile">libcursesw</filename></term> - <listitem> - <para>A link to <filename>libncursesw</filename></para> - <indexterm zone="ch-system-ncurses libcursesw"> - <primary sortas="c-libcursesw">libcursesw</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libncursesw"> - <term><filename class="libraryfile">libncursesw</filename></term> - <listitem> - <para>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 <command>make - menuconfig</command></para> - <indexterm zone="ch-system-ncurses libncursesw"> - <primary sortas="c-libncursesw">libncursesw</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libformw"> - <term><filename class="libraryfile">libformw</filename></term> - <listitem> - <para>Contains functions to implement forms</para> - <indexterm zone="ch-system-ncurses libformw"> - <primary sortas="c-libformw">libformw</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libmenuw"> - <term><filename class="libraryfile">libmenuw</filename></term> - <listitem> - <para>Contains functions to implement menus</para> - <indexterm zone="ch-system-ncurses libmenuw"> - <primary sortas="c-libmenuw">libmenuw</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libpanelw"> - <term><filename class="libraryfile">libpanelw</filename></term> - <listitem> - <para>Contains functions to implement panels</para> - <indexterm zone="ch-system-ncurses libpanelw"> - <primary sortas="c-libpanelw">libpanelw</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-ncurses" role="."/></para> </sect2> 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; ]> -<sect1 id="ch-system-patch" role="wrap"> +<sect1 id="ch-tools-patch" role="wrap"> <?dbhtml filename="patch.html"?> <sect1info condition="script"> @@ -16,24 +16,25 @@ <title>Patch-&patch-version; - + Patch + tools - <para>The Patch package contains a program for modifying or creating files - by applying a <quote>patch</quote> file typically created by the - <command>diff</command> program.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/patch.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&patch-ch6-sbu;</seg> - <seg>&patch-ch6-du;</seg> + <seg>&patch-ch5-sbu;</seg> + <seg>&patch-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -44,52 +45,25 @@ <para>Prepare Patch for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess)</userinput></screen> <para>Compile the package:</para> <screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> - -<screen><userinput remap="test">make check</userinput></screen> - <para>Install the package:</para> -<screen><userinput remap="install">make install</userinput></screen> +<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> </sect2> - <sect2 id="contents-patch" role="content"> - <title>Contents of Patch + + - <segmentedlist> - <segtitle>Installed program</segtitle> - - <seglistitem> - <seg>patch</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="patch"> - <term><command>patch</command></term> - <listitem> - <para>Modifies files according to a patch file [A patch file is - normally a difference listing created with the <command>diff</command> - program. By applying these differences to the original files, - <command>patch</command> creates the patched versions.]</para> - <indexterm zone="ch-system-patch patch"> - <primary sortas="b-patch">patch</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-patch" role="."/></para> </sect2> diff --git a/chapter06/perl.xml b/chapter06/perl.xml index 284464d87..663d3dbc2 100644 --- a/chapter06/perl.xml +++ b/chapter06/perl.xml @@ -5,7 +5,7 @@ %general-entities; ]> -<sect1 id="ch-system-perl" role="wrap"> +<sect1 id="ch-tools-perl" role="wrap"> <?dbhtml filename="perl.html"?> <sect1info condition="script"> @@ -16,23 +16,25 @@ <title>Perl-&perl-version; - + Perl + tools - <para>The Perl package contains the Practical Extraction and Report - Language.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/perl.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&perl-ch6-sbu;</seg> - <seg>&perl-ch6-du;</seg> + <seg>&perl-ch5-sbu;</seg> + <seg>&perl-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -41,481 +43,36 @@ <sect2 role="installation"> <title>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 + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed libraries</segtitle> - <segtitle>Installed directory</segtitle> - - <seglistitem> - <seg>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</seg> - <seg>Many which cannot all be listed here</seg> - <seg>/usr/lib/perl5</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> -<!-- - <varlistentry id="c2ph"> - <term><command>c2ph</command></term> - <listitem> - <para>Dumps C structures as generated from - <command>cc -g -S</command></para> - <indexterm zone="ch-system-perl c2ph"> - <primary sortas="b-c2ph">c2ph</primary> - </indexterm> - </listitem> - </varlistentry> ---> - <varlistentry id="corelist"> - <term><command>corelist</command></term> - <listitem> - <para>A commandline frontend to Module::CoreList</para> - <indexterm zone="ch-system-perl corelist"> - <primary sortas="b-corelist">corelist</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="cpan"> - <term><command>cpan</command></term> - <listitem> - <para>Interact with the Comprehensive Perl Archive Network (CPAN) - from the command line</para> - <indexterm zone="ch-system-perl cpan"> - <primary sortas="b-cpan">cpan</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="enc2xs"> - <term><command>enc2xs</command></term> - <listitem> - <para>Builds a Perl extension for the Encode module from either - Unicode Character Mappings or Tcl Encoding Files</para> - <indexterm zone="ch-system-perl enc2xs"> - <primary sortas="b-enc2xs">enc2xs</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="encguess"> - <term><command>encguess</command></term> - <listitem> - <para>Guess the encoding type of one or several files</para> - <indexterm zone="ch-system-perl encguess"> - <primary sortas="b-encguess">encguess</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="h2ph"> - <term><command>h2ph</command></term> - <listitem> - <para>Converts <filename class="extension">.h</filename> C header - files to <filename class="extension">.ph</filename> Perl header - files</para> - <indexterm zone="ch-system-perl h2ph"> - <primary sortas="b-h2ph">h2ph</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="h2xs"> - <term><command>h2xs</command></term> - <listitem> - <para>Converts <filename class="extension">.h</filename> C header - files to Perl extensions</para> - <indexterm zone="ch-system-perl h2xs"> - <primary sortas="b-h2xs">h2xs</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="instmodsh"> - <term><command>instmodsh</command></term> - <listitem> - <para>Shell script for examining installed Perl modules, - and can create a tarball from an installed module</para> - <indexterm zone="ch-system-perl instmodsh"> - <primary sortas="b-instmodsh">instmodsh</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="json_pp"> - <term><command>json_pp</command></term> - <listitem> - <para>Converts data between certain input and output formats</para> - <indexterm zone="ch-system-perl json_pp"> - <primary sortas="b-json_pp">json_pp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libnetcfg"> - <term><command>libnetcfg</command></term> - <listitem> - <para>Can be used to configure the - <filename class="libraryfile">libnet</filename> Perl module</para> - <indexterm zone="ch-system-perl libnetcfg"> - <primary sortas="b-libnetcfg">libnetcfg</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="perl"> - <term><command>perl</command></term> - <listitem> - <para>Combines some of the best features of C, <command>sed</command>, - <command>awk</command> and <command>sh</command> into a single - swiss-army language</para> - <indexterm zone="ch-system-perl perl"> - <primary sortas="b-perl">perl</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="perl-version"> - <term><command>perl&perl-version;</command></term> - <listitem> - <para>A hard link to <command>perl</command></para> - <indexterm zone="ch-system-perl perl-version"> - <primary sortas="b-perl&perl-version;">perl&perl-version;</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="perlbug"> - <term><command>perlbug</command></term> - <listitem> - <para>Used to generate bug reports about Perl, or the modules that come - with it, and mail them</para> - <indexterm zone="ch-system-perl perlbug"> - <primary sortas="b-perlbug">perlbug</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="perldoc"> - <term><command>perldoc</command></term> - <listitem> - <para>Displays a piece of documentation in pod format that is embedded - in the Perl installation tree or in a Perl script</para> - <indexterm zone="ch-system-perl perldoc"> - <primary sortas="b-perldoc">perldoc</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="perlivp"> - <term><command>perlivp</command></term> - <listitem> - <para>The Perl Installation Verification Procedure; it can be used to - verify that Perl and its libraries have been installed - correctly</para> - <indexterm zone="ch-system-perl perlivp"> - <primary sortas="b-perlivp">perlivp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="perlthanks"> - <term><command>perlthanks</command></term> - <listitem> - <para>Used to generate thank you messages to mail to the Perl - developers</para> - <indexterm zone="ch-system-perl perlthanks"> - <primary sortas="b-perlthanks">perlthanks</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="piconv"> - <term><command>piconv</command></term> - <listitem> - <para>A Perl version of the character encoding converter - <command>iconv</command></para> - <indexterm zone="ch-system-perl piconv"> - <primary sortas="b-piconv">piconv</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pl2pm"> - <term><command>pl2pm</command></term> - <listitem> - <para>A rough tool for converting Perl4 - <filename class="extension">.pl</filename> files to Perl5 - <filename class="extension">.pm</filename> modules</para> - <indexterm zone="ch-system-perl pl2pm"> - <primary sortas="b-pl2pm">pl2pm</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pod2html"> - <term><command>pod2html</command></term> - <listitem> - <para>Converts files from pod format to HTML format</para> - <indexterm zone="ch-system-perl pod2html"> - <primary sortas="b-pod2html">pod2html</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pod2man"> - <term><command>pod2man</command></term> - <listitem> - <para>Converts pod data to formatted *roff input</para> - <indexterm zone="ch-system-perl pod2man"> - <primary sortas="b-pod2man">pod2man</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pod2text"> - <term><command>pod2text</command></term> - <listitem> - <para>Converts pod data to formatted ASCII text</para> - <indexterm zone="ch-system-perl pod2text"> - <primary sortas="b-pod2text">pod2text</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pod2usage"> - <term><command>pod2usage</command></term> - <listitem> - <para>Prints usage messages from embedded pod docs in files</para> - <indexterm zone="ch-system-perl pod2usage"> - <primary sortas="b-pod2usage">pod2usage</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="podchecker"> - <term><command>podchecker</command></term> - <listitem> - <para>Checks the syntax of pod format documentation files</para> - <indexterm zone="ch-system-perl podchecker"> - <primary sortas="b-podchecker">podchecker</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="podselect"> - <term><command>podselect</command></term> - <listitem> - <para>Displays selected sections of pod documentation</para> - <indexterm zone="ch-system-perl podselect"> - <primary sortas="b-podselect">podselect</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="prove"> - <term><command>prove</command></term> - <listitem> - <para>Command line tool for running tests against the Test::Harness - module</para> - <indexterm zone="ch-system-perl prove"> - <primary sortas="b-prove">prove</primary> - </indexterm> - </listitem> - </varlistentry> -<!-- - <varlistentry id="pstruct"> - <term><command>pstruct</command></term> - <listitem> - <para>Dumps C structures as generated from <command>cc -g -S</command> - stabs</para> - <indexterm zone="ch-system-perl pstruct"> - <primary sortas="b-pstruct">pstruct</primary> - </indexterm> - </listitem> - </varlistentry> ---> - <varlistentry id="ptar"> - <term><command>ptar</command></term> - <listitem> - <para>A <command>tar</command>-like program written in Perl</para> - <indexterm zone="ch-system-perl ptar"> - <primary sortas="b-ptar">ptar</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ptardiff"> - <term><command>ptardiff</command></term> - <listitem> - <para>A Perl program that compares an extracted archive with an - unextracted one</para> - <indexterm zone="ch-system-perl ptardiff"> - <primary sortas="b-ptardiff">ptardiff</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ptargrep"> - <term><command>ptargrep</command></term> - <listitem> - <para>A Perl program that applies pattern matching to the contents - of files in a tar archive</para> - <indexterm zone="ch-system-perl ptargrep"> - <primary sortas="b-ptargrep">ptargrep</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="shasum"> - <term><command>shasum</command></term> - <listitem> - <para>Prints or checks SHA checksums</para> - <indexterm zone="ch-system-perl shasum"> - <primary sortas="b-shasum">shasum</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="splain"> - <term><command>splain</command></term> - <listitem> - <para>Is used to force verbose warning diagnostics in Perl</para> - <indexterm zone="ch-system-perl splain"> - <primary sortas="b-splain">splain</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="xsubpp"> - <term><command>xsubpp</command></term> - <listitem> - <para>Converts Perl XS code into C code</para> - <indexterm zone="ch-system-perl xsubpp"> - <primary sortas="b-xsubpp">xsubpp</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zipdetails"> - <term><command>zipdetails</command></term> - <listitem> - <para>Displays details about the internal structure of a Zip file</para> - <indexterm zone="ch-system-perl zipdetails"> - <primary sortas="b-zipdetails">zipdetails</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-perl" role="."/></para> </sect2> 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; ]> -<sect1 id="ch-system-Python" role="wrap"> - <?dbhtml filename="Python.html"?> +<sect1 id="ch-system-Python-temp" role="wrap"> + <?dbhtml filename="Python-temp.html"?> <sect1info condition="script"> <productname>Python</productname> @@ -16,66 +16,54 @@ <title>Python-&python-version; - - python + + Python + temporary - <para>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.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/python.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> - <segtitle>&buildtime;</segtitle> + <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&python-ch6-sbu;</seg> - <seg>&python-ch6-du;</seg> + <seg>&python-ch5-sbu;</seg> + <seg>&python-ch5-du;</seg> </seglistitem> </segmentedlist> </sect2> <sect2 role="installation"> - <title>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 + + - <segmentedlist> - <segtitle>Installed Programs</segtitle> - <segtitle>Installed Library</segtitle> - <segtitle>Installed Directories</segtitle> - - <seglistitem> - <seg> - 2to3, idle3, pip3, pydoc3, python3, and python3-config - </seg> - <seg> - libpython&python-minor;.so and libpython3.so - </seg> - <seg> - /usr/include/python&python-minor;, - /usr/lib/python3, and - /usr/share/doc/python-&python-version; - </seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="python-2to3"> - <term><command>2to3</command></term> - <listitem> - <para> - is a <application>Python</application> program that reads - <application>Python 2.x</application> source code and applies a - series of fixes to transform it into valid - <application>Python 3.x</application> code. - </para> - <indexterm zone="ch-system-Python"> - <primary sortas="b-2to3">2to3</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="idle3"> - <term><command>idle3</command></term> - <listitem> - <para> - is a wrapper script that opens a <application>Python</application> - aware GUI editor. For this script to run, you must have installed - <application>Tk</application> before Python so that the Tkinter - Python module is built. - </para> - <indexterm zone="ch-system-Python"> - <primary sortas="b-idle3">idle3</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pip3"> - <term><command>pip3</command></term> - <listitem> - <para> - The package installer for Python. You can use pip to install - packages from Python Package Index and other indexes. - </para> - <indexterm zone="ch-system-Python"> - <primary sortas="b-pip3">pip3</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pydoc3"> - <term><command>pydoc3</command></term> - <listitem> - <para> - is the <application>Python</application> documentation tool. - </para> - <indexterm zone="ch-system-Python"> - <primary sortas="b-pydoc3">pydoc3</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="python3"> - <term><command>python3</command></term> - <listitem> - <para> - is an interpreted, interactive, object-oriented programming - language. - </para> - <indexterm zone="ch-system-Python"> - <primary sortas="b-python3">python3</primary> - </indexterm> - </listitem> - </varlistentry> -<!-- - <varlistentry id="pyvenv"> - <term><command>pyvenv</command></term> - <listitem> - <para> - creates virtual <application>Python</application> environments in - one or more target directories. - </para> - <indexterm zone="ch-system-Python"> - <primary sortas="b-pyvenv">pyvenv</primary> - </indexterm> - </listitem> - </varlistentry> ---> - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-python" role="."/></para> </sect2> </sect1> - 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; ]> -<sect1 id="ch-system-sed" role="wrap"> +<sect1 id="ch-tools-sed" role="wrap"> <?dbhtml filename="sed.html"?> <sect1info condition="script"> @@ -16,22 +16,25 @@ <title>Sed-&sed-version; - + Sed + tools - <para>The Sed package contains a stream editor.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/sed.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> - <segtitle>&buildtime;</segtitle> + <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&sed-ch6-sbu;</seg> - <seg>&sed-ch6-du;</seg> + <seg>&sed-ch5-sbu;</seg> + <seg>&sed-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -42,55 +45,25 @@ <para>Prepare Sed for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr --bindir=/bin</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr \ + --host=$LFS_TGT \ + --bindir=/bin</userinput></screen> - <para>Compile the package and generate the HTML documentation:</para> + <para>Compile the package:</para> -<screen><userinput remap="make">make -make html</userinput></screen> +<screen><userinput remap="make">make</userinput></screen> - <para>To test the results, issue:</para> + <para>Install the package:</para> -<screen><userinput remap="test">chown -Rv tester . -su tester -c "PATH=$PATH make check"</userinput></screen> - - <para>Install the package and its documentation:</para> - -<screen><userinput remap="install">make install -install -d -m755 /usr/share/doc/sed-&sed-version; -install -m644 doc/sed.html /usr/share/doc/sed-&sed-version;</userinput></screen> +<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen> </sect2> - <sect2 id="contents-sed" role="content"> - <title>Contents of Sed + + - <segmentedlist> - <segtitle>Installed program</segtitle> - <segtitle>Installed directory</segtitle> - - <seglistitem> - <seg>sed</seg> - <seg>/usr/share/doc/sed-&sed-version;</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="sed"> - <term><command>sed</command></term> - <listitem> - <para>Filters and transforms text files in a single pass</para> - <indexterm zone="ch-system-sed sed"> - <primary sortas="b-sed">sed</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-sed" role="."/></para> </sect2> diff --git a/chapter06/stripping.xml b/chapter06/stripping.xml new file mode 100644 index 000000000..7c054b6b2 --- /dev/null +++ b/chapter06/stripping.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-stripping"> + <?dbhtml filename="stripping.html"?> + + <title>Stripping + + The steps in this section are optional, but if the LFS partition is + rather small, it is beneficial to learn that unnecessary items can be removed. + The executables and libraries built so far contain about 70 MB of unneeded + debugging symbols. Remove those symbols with: + +$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 - <para>The Tar package contains an archiving program.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/tar.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&tar-ch6-sbu;</seg> - <seg>&tar-ch6-du;</seg> + <seg>&tar-ch5-sbu;</seg> + <seg>&tar-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -42,74 +45,26 @@ <para>Prepare Tar for compilation:</para> -<screen><userinput remap="configure">FORCE_UNSAFE_CONFIGURE=1 \ -./configure --prefix=/usr \ +<screen><userinput remap="configure">./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) \ --bindir=/bin</userinput></screen> - <variablelist> - <title>The meaning of the configure options: - - - FORCE_UNSAFE_CONFIGURE=1 - - This forces the test for mknod to be run - as root. It is generally considered dangerous to run this test as - the root user, but as it is being run on a system that has only been - partially built, overriding it is OK. - - - - Compile the package: make - To test the results (about 3 SBU), issue: - -make check - - - Install the package: -make install -make -C doc install-html docdir=/usr/share/doc/tar-&tar-version; +make DESTDIR=$LFS install + + - <sect2 id="contents-tar" role="content"> - <title>Contents of Tar - - - Installed programs - Installed directory - - - tar - /usr/share/doc/tar-&tar-version; - - - - - Short Descriptions - - - - - tar - - Creates, extracts files from, and lists the contents of archives, - also known as tarballs - - tar - - - - - + Details on this package are located in + diff --git a/chapter06/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 + + + + + + <para>The <application>Tcl</application> package contains the Tool Command Language, + a robust general-purpose scripting language. The <application>Expect</application> package + is written in the <application>Tcl</application> language.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&tcl-ch5-sbu;</seg> + <seg>&tcl-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 - <para>The Texinfo package contains programs for reading, writing, and - converting info pages.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/texinfo.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&texinfo-ch6-sbu;</seg> - <seg>&texinfo-ch6-du;</seg> + <seg>&texinfo-ch5-sbu;</seg> + <seg>&texinfo-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -43,194 +45,29 @@ <para>Prepare Texinfo for compilation:</para> -<screen><userinput remap="configure">./configure --prefix=/usr --disable-static</userinput></screen> +<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen> - <variablelist> - <title>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 + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed library</segtitle> - <segtitle>Installed directories</segtitle> - - <seglistitem> - <seg>info, install-info, makeinfo (link to texi2any), - pdftexi2dvi, pod2texi, texi2any, texi2dvi, texi2pdf, and texindex</seg> - <seg>MiscXS.so, Parsetexi.so, and XSParagraph.so - (all in /usr/lib/texinfo)</seg> - <seg>/usr/share/texinfo and /usr/lib/texinfo</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="info"> - <term><command>info</command></term> - <listitem> - <para>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 <command>man bison</command> and - <command>info bison</command>.]</para> - <indexterm zone="ch-system-texinfo info"> - <primary sortas="b-info">info</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="install-info"> - <term><command>install-info</command></term> - <listitem> - <para>Used to install info pages; it updates entries in the - <command>info</command> index file</para> - <indexterm zone="ch-system-texinfo install-info"> - <primary sortas="b-install-info">install-info</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="makeinfo"> - <term><command>makeinfo</command></term> - <listitem> - <para>Translates the given Texinfo source documents into - info pages, plain text, or HTML</para> - <indexterm zone="ch-system-texinfo makeinfo"> - <primary sortas="b-makeinfo">makeinfo</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pdftexi2dvi"> - <term><command>pdftexi2dvi</command></term> - <listitem> - <para>Used to format the given Texinfo document into a - Portable Document Format (PDF) file</para> - <indexterm zone="ch-system-texinfo pdftexi2dvi"> - <primary sortas="b-pdftexi2dvi">pdftexi2dvi</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pod2texi"> - <term><command>pod2texi</command></term> - <listitem> - <para>Converts Pod to Texinfo format</para> - <indexterm zone="ch-system-texinfo pod2texi"> - <primary sortas="b-pod2texi">pod2texi</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="texi2any"> - <term><command>texi2any</command></term> - <listitem> - <para>Translate Texinfo source documentation to - various other formats</para> - <indexterm zone="ch-system-texinfo texi2any"> - <primary sortas="b-texiany">texi2any</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="texi2dvi"> - <term><command>texi2dvi</command></term> - <listitem> - <para>Used to format the given Texinfo document into a - device-independent file that can be printed</para> - <indexterm zone="ch-system-texinfo texi2dvi"> - <primary sortas="b-texi2dvi">texi2dvi</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="texi2pdf"> - <term><command>texi2pdf</command></term> - <listitem> - <para>Used to format the given Texinfo document into a - Portable Document Format (PDF) file</para> - <indexterm zone="ch-system-texinfo texi2pdf"> - <primary sortas="b-texi2pdf">texi2pdf</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="texindex"> - <term><command>texindex</command></term> - <listitem> - <para>Used to sort Texinfo index files</para> - <indexterm zone="ch-system-texinfo texindex"> - <primary sortas="b-texindex">texindex</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-texinfo" role="."/></para> </sect2> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-toolchaintechnotes"> + <?dbhtml filename="toolchaintechnotes.html"?> + + <title>Toolchain Technical Notes + + This section explains some of the rationale and technical details + behind the overall build method. It is not essential to immediately + understand everything in this section. Most of this information will be + clearer after performing an actual build. This section can be referred + to at any time during the process. + + The overall goal of is to + produce a temporary area that contains a known-good set of tools that can be + isolated from the host system. By using chroot, the + commands in the remaining chapters will be contained within that environment, + ensuring a clean, trouble-free build of the target LFS system. The build + process has been designed to minimize the risks for new readers and to provide + the most educational value at the same time. + + 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 - <para>The Util-linux package contains miscellaneous utility programs. - Among them are utilities for handling file systems, consoles, partitions, - and messages.</para> + <para>The Util-linux package contains miscellaneous utility programs.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&util-linux-ch6-sbu;</seg> - <seg>&util-linux-ch6-du;</seg> + <seg>&util-linux-ch5-sbu;</seg> + <seg>&util-linux-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -42,31 +41,14 @@ <sect2 role="installation"> <title>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/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 \ +./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 + + - <segmentedlist> - <segtitle>Installed programs</segtitle> - <segtitle>Installed libraries</segtitle> - <segtitle>Installed directories</segtitle> - - <seglistitem> - <seg>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</seg> - <seg>libblkid.so, libfdisk.so, libmount.so, - libsmartcols.so, and libuuid.so</seg> - <seg>/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</seg> - </seglistitem> - </segmentedlist> - - <variablelist> - <bridgehead renderas="sect3">Short Descriptions</bridgehead> - <?dbfo list-presentation="list"?> - <?dbhtml list-presentation="table"?> - - <varlistentry id="addpart"> - <term><command>addpart</command></term> - <listitem> - <para>Informs the Linux kernel of new partitions</para> - <indexterm zone="ch-system-util-linux addpart"> - <primary sortas="b-addpart">addpart</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="agetty"> - <term><command>agetty</command></term> - <listitem> - <para>Opens a tty port, prompts for a login name, - and then invokes the <command>login</command> program</para> - <indexterm zone="ch-system-util-linux agetty"> - <primary sortas="b-agetty">agetty</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="blkdiscard"> - <term><command>blkdiscard</command></term> - <listitem> - <para>Discards sectors on a device</para> - <indexterm zone="ch-system-util-linux blkdiscard"> - <primary sortas="b-blkdiscard">blkdiscard</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="blkid"> - <term><command>blkid</command></term> - <listitem> - <para>A command line utility to locate and print block device - attributes</para> - <indexterm zone="ch-system-util-linux blkid"> - <primary sortas="b-blkid">blkid</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="blkzone"> - <term><command>blkzone</command></term> - <listitem> - <para>Runs zone command on the given block device</para> - <indexterm zone="ch-system-util-linux blkzone"> - <primary sortas="b-blkzone">blkzone</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="blockdev"> - <term><command>blockdev</command></term> - <listitem> - <para>Allows users to call block device ioctls from the command - line</para> - <indexterm zone="ch-system-util-linux blockdev"> - <primary sortas="b-blockdev">blockdev</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="cal"> - <term><command>cal</command></term> - <listitem> - <para>Displays a simple calendar</para> - <indexterm zone="ch-system-util-linux cal"> - <primary sortas="b-cal">cal</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="cfdisk"> - <term><command>cfdisk</command></term> - <listitem> - <para>Manipulates the partition table of the given device</para> - <indexterm zone="ch-system-util-linux cfdisk"> - <primary sortas="b-cfdisk">cfdisk</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chcpu"> - <term><command>chcpu</command></term> - <listitem> - <para>Modifies the state of CPUs</para> - <indexterm zone="ch-system-util-linux chcpu"> - <primary sortas="b-chcpu">chcpu</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chmem"> - <term><command>chmem</command></term> - <listitem> - <para>Configures memory</para> - <indexterm zone="ch-system-util-linux chmem"> - <primary sortas="b-chmem">chmem</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="choom"> - <term><command>choom</command></term> - <listitem> - <para>Displays and adjusts OOM-killer score</para> - <indexterm zone="ch-system-util-linux choom"> - <primary sortas="b-choom">choom</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="chrt"> - <term><command>chrt</command></term> - <listitem> - <para>Manipulates real-time attributes of a process</para> - <indexterm zone="ch-system-util-linux chrt"> - <primary sortas="b-chrt">chrt</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="col"> - <term><command>col</command></term> - <listitem> - <para>Filters out reverse line feeds</para> - <indexterm zone="ch-system-util-linux col"> - <primary sortas="b-col">col</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="colcrt"> - <term><command>colcrt</command></term> - <listitem> - <para>Filters <command>nroff</command> output for terminals - that lack some capabilities, such as overstriking and half-lines</para> - <indexterm zone="ch-system-util-linux colcrt"> - <primary sortas="b-colcrt">colcrt</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="colrm"> - <term><command>colrm</command></term> - <listitem> - <para>Filters out the given columns</para> - <indexterm zone="ch-system-util-linux colrm"> - <primary sortas="b-colrm">colrm</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="column"> - <term><command>column</command></term> - <listitem> - <para>Formats a given file into multiple columns</para> - <indexterm zone="ch-system-util-linux column"> - <primary sortas="b-column">column</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ctrlaltdel"> - <term><command>ctrlaltdel</command></term> - <listitem> - <para>Sets the function of the Ctrl+Alt+Del key combination to a - hard or a soft reset</para> - <indexterm zone="ch-system-util-linux ctrlaltdel"> - <primary sortas="b-ctrlaltdel">ctrlaltdel</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="delpart"> - <term><command>delpart</command></term> - <listitem> - <para>Asks the Linux kernel to remove a partition</para> - <indexterm zone="ch-system-util-linux delpart"> - <primary sortas="b-delpart">delpart</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="dmesg"> - <term><command>dmesg</command></term> - <listitem> - <para>Dumps the kernel boot messages</para> - <indexterm zone="ch-system-util-linux dmesg"> - <primary sortas="b-dmesg">dmesg</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="eject"> - <term><command>eject</command></term> - <listitem> - <para>Ejects removable media</para> - <indexterm zone="ch-system-util-linux eject"> - <primary sortas="b-eject">eject</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fallocate"> - <term><command>fallocate</command></term> - <listitem> - <para>Preallocates space to a file</para> - <indexterm zone="ch-system-util-linux fallocate"> - <primary sortas="b-fallocate">fallocate</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fdformat"> - <term><command>fdformat</command></term> - <listitem> - <para>Low-level formats a floppy disk</para> - <indexterm zone="ch-system-util-linux fdformat"> - <primary sortas="b-fdformat">fdformat</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fdisk"> - <term><command>fdisk</command></term> - <listitem> - <para>Manipulates the partition table of the given device</para> - <indexterm zone="ch-system-util-linux fdisk"> - <primary sortas="b-fdisk">fdisk</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fincore"> - <term><command>fincore</command></term> - <listitem> - <para>Counts pages of file contents in core</para> - <indexterm zone="ch-system-util-linux fincore"> - <primary sortas="b-fincore">fincore</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="findfs"> - <term><command>findfs</command></term> - <listitem> - <para>Finds a file system by label or Universally Unique Identifier - (UUID)</para> - <indexterm zone="ch-system-util-linux findfs"> - <primary sortas="b-findfs">findfs</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="findmnt"> - <term><command>findmnt</command></term> - <listitem> - <para>Is a command line interface to the libmount library - for work with mountinfo, fstab and mtab files</para> - <indexterm zone="ch-system-util-linux findmnt"> - <primary sortas="b-findmnt">findmnt</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="flock"> - <term><command>flock</command></term> - <listitem> - <para>Acquires a file lock and then executes a command with the lock - held</para> - <indexterm zone="ch-system-util-linux flock"> - <primary sortas="b-flock">flock</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fsck"> - <term><command>fsck</command></term> - <listitem> - <para>Is used to check, and optionally repair, file systems</para> - <indexterm zone="ch-system-util-linux fsck"> - <primary sortas="b-fsck">fsck</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fsck.cramfs"> - <term><command>fsck.cramfs</command></term> - <listitem> - <para>Performs a consistency check on the Cramfs file system on the - given device</para> - <indexterm zone="ch-system-util-linux fsck.cramfs"> - <primary sortas="b-fsck.cramfs">fsck.cramfs</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fsck.minix"> - <term><command>fsck.minix</command></term> - <listitem> - <para>Performs a consistency check on the Minix file system on the - given device</para> - <indexterm zone="ch-system-util-linux fsck.minix"> - <primary sortas="b-fsck.minix">fsck.minix</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fsfreeze"> - <term><command>fsfreeze</command></term> - <listitem> - <para>Is a very simple wrapper around FIFREEZE/FITHAW ioctl - kernel driver operations</para> - <indexterm zone="ch-system-util-linux fsfreeze"> - <primary sortas="b-fsfreeze">fsfreeze</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="fstrim"> - <term><command>fstrim</command></term> - <listitem> - <para>Discards unused blocks on a mounted filesystem</para> - <indexterm zone="ch-system-util-linux fstrim"> - <primary sortas="b-fstrim">fstrim</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="getopt"> - <term><command>getopt</command></term> - <listitem> - <para>Parses options in the given command line</para> - <indexterm zone="ch-system-util-linux getopt"> - <primary sortas="b-getopt">getopt</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="hexdump"> - <term><command>hexdump</command></term> - <listitem> - <para>Dumps the given file in hexadecimal or in another given - format</para> - <indexterm zone="ch-system-util-linux hexdump"> - <primary sortas="b-hexdump">hexdump</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="hwclock"> - <term><command>hwclock</command></term> - <listitem> - <para>Reads or sets the system's hardware clock, also called - the Real-Time Clock (RTC) or Basic Input-Output System (BIOS) - clock</para> - <indexterm zone="ch-system-util-linux hwclock"> - <primary sortas="b-hwclock">hwclock</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="i386"> - <term><command>i386</command></term> - <listitem> - <para>A symbolic link to setarch</para> - <indexterm zone="ch-system-util-linux i386"> - <primary sortas="b-i386">i386</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ionice"> - <term><command>ionice</command></term> - <listitem> - <para>Gets or sets the io scheduling class and priority for a program</para> - <indexterm zone="ch-system-util-linux ionice"> - <primary sortas="b-ionice">ionice</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ipcmk"> - <term><command>ipcmk</command></term> - <listitem> - <para>Creates various IPC resources</para> - <indexterm zone="ch-system-util-linux ipcmk"> - <primary sortas="b-ipcmk">ipcmk</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ipcrm"> - <term><command>ipcrm</command></term> - <listitem> - <para>Removes the given Inter-Process Communication (IPC) resource</para> - <indexterm zone="ch-system-util-linux ipcrm"> - <primary sortas="b-ipcrm">ipcrm</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ipcs"> - <term><command>ipcs</command></term> - <listitem> - <para>Provides IPC status information</para> - <indexterm zone="ch-system-util-linux ipcs"> - <primary sortas="b-ipcs">ipcs</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="isosize"> - <term><command>isosize</command></term> - <listitem> - <para>Reports the size of an iso9660 file system</para> - <indexterm zone="ch-system-util-linux isosize"> - <primary sortas="b-isosize">isosize</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="kill"> - <term><command>kill</command></term> - <listitem> - <para>Sends signals to processes</para> - <indexterm zone="ch-system-util-linux kill"> - <primary sortas="b-kill">kill</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="last"> - <term><command>last</command></term> - <listitem> - <para>Shows which users last logged in (and out), searching back - through the <filename>/var/log/wtmp</filename> file; it also shows - system boots, shutdowns, and run-level changes</para> - <indexterm zone="ch-system-util-linux last"> - <primary sortas="b-last">last</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="lastb"> - <term><command>lastb</command></term> - <listitem> - <para>Shows the failed login attempts, as logged in - <filename>/var/log/btmp</filename></para> - <indexterm zone="ch-system-util-linux lastb"> - <primary sortas="b-lastb">lastb</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ldattach"> - <term><command>ldattach</command></term> - <listitem> - <para>Attaches a line discipline to a serial line</para> - <indexterm zone="ch-system-util-linux ldattach"> - <primary sortas="b-ldattach">ldattach</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="linux32"> - <term><command>linux32</command></term> - <listitem> - <para>A symbolic link to setarch</para> - <indexterm zone="ch-system-util-linux linux32"> - <primary sortas="b-linux32">linux32</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="linux64"> - <term><command>linux64</command></term> - <listitem> - <para>A symbolic link to setarch</para> - <indexterm zone="ch-system-util-linux linux64"> - <primary sortas="b-linux64">linux64</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="logger"> - <term><command>logger</command></term> - <listitem> - <para>Enters the given message into the system log</para> - <indexterm zone="ch-system-util-linux logger"> - <primary sortas="b-logger">logger</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="look"> - <term><command>look</command></term> - <listitem> - <para>Displays lines that begin with the given string</para> - <indexterm zone="ch-system-util-linux look"> - <primary sortas="b-look">look</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="losetup"> - <term><command>losetup</command></term> - <listitem> - <para>Sets up and controls loop devices</para> - <indexterm zone="ch-system-util-linux losetup"> - <primary sortas="b-losetup">losetup</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="lsblk"> - <term><command>lsblk</command></term> - <listitem> - <para>Lists information about all or selected block devices in - a tree-like format</para> - <indexterm zone="ch-system-util-linux lsblk"> - <primary sortas="b-lsblk">lsblk</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="lscpu"> - <term><command>lscpu</command></term> - <listitem> - <para>Prints CPU architecture information</para> - <indexterm zone="ch-system-util-linux lscpu"> - <primary sortas="b-lscpu">lscpu</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="lsipc"> - <term><command>lsipc</command></term> - <listitem> - <para>Prints information on IPC facilities currently employed - in the system</para> - <indexterm zone="ch-system-util-linux lsipc"> - <primary sortas="b-lsipc">lsipc</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="lslocks"> - <term><command>lslocks</command></term> - <listitem> - <para>Lists local system locks</para> - <indexterm zone="ch-system-util-linux lslocks"> - <primary sortas="b-lslocks">lslocks</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="lslogins"> - <term><command>lslogins</command></term> - <listitem> - <para>Lists information about users, groups and system accounts</para> - <indexterm zone="ch-system-util-linux lslogins"> - <primary sortas="b-lslogins">lslogins</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="lsmem"> - <term><command>lsmem</command></term> - <listitem> - <para>Lists the ranges of available memory with their online - status</para> - <indexterm zone="ch-system-util-linux lsmem"> - <primary sortas="b-lsmem">lsmem</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="lsns"> - <term><command>lsns</command></term> - <listitem> - <para>Lists namespaces</para> - <indexterm zone="ch-system-util-linux lsns"> - <primary sortas="b-lsns">lsns</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mcookie"> - <term><command>mcookie</command></term> - <listitem> - <para>Generates magic cookies (128-bit random hexadecimal numbers) for - <command>xauth</command></para> - <indexterm zone="ch-system-util-linux mcookie"> - <primary sortas="b-mcookie">mcookie</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mesg"> - <term><command>mesg</command></term> - <listitem> - <para>Controls whether other users can send messages to the current - user's terminal</para> - <indexterm zone="ch-system-util-linux mesg"> - <primary sortas="b-mesg">mesg</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mkfs"> - <term><command>mkfs</command></term> - <listitem> - <para>Builds a file system on a device (usually a hard disk - partition)</para> - <indexterm zone="ch-system-util-linux mkfs"> - <primary sortas="b-mkfs">mkfs</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mkfs.bfs"> - <term><command>mkfs.bfs</command></term> - <listitem> - <para>Creates a Santa Cruz Operations (SCO) bfs file system</para> - <indexterm zone="ch-system-util-linux mkfs.bfs"> - <primary sortas="b-mkfs.bfs">mkfs.bfs</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mkfs.cramfs"> - <term><command>mkfs.cramfs</command></term> - <listitem> - <para>Creates a cramfs file system</para> - <indexterm zone="ch-system-util-linux mkfs.cramfs"> - <primary sortas="b-mkfs.cramfs">mkfs.cramfs</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mkfs.minix"> - <term><command>mkfs.minix</command></term> - <listitem> - <para>Creates a Minix file system</para> - <indexterm zone="ch-system-util-linux mkfs.minix"> - <primary sortas="b-mkfs.minix">mkfs.minix</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mkswap"> - <term><command>mkswap</command></term> - <listitem> - <para>Initializes the given device or file to be used as a swap - area</para> - <indexterm zone="ch-system-util-linux mkswap"> - <primary sortas="b-mkswap">mkswap</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="more"> - <term><command>more</command></term> - <listitem> - <para>A filter for paging through text one screen at a time</para> - <indexterm zone="ch-system-util-linux more"> - <primary sortas="b-more">more</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mount"> - <term><command>mount</command></term> - <listitem> - <para>Attaches the file system on the given device to a specified - directory in the file-system tree</para> - <indexterm zone="ch-system-util-linux mount"> - <primary sortas="b-mount">mount</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="mountpoint"> - <term><command>mountpoint</command></term> - <listitem> - <para>Checks if the directory is a mountpoint</para> - <indexterm zone="ch-system-util-linux mountpoint"> - <primary sortas="b-mountpoint">mountpoint</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="namei"> - <term><command>namei</command></term> - <listitem> - <para>Shows the symbolic links in the given pathnames</para> - <indexterm zone="ch-system-util-linux namei"> - <primary sortas="b-namei">namei</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="nsenter"> - <term><command>nsenter</command></term> - <listitem> - <para>Runs a program with namespaces of other processes</para> - <indexterm zone="ch-system-util-linux nsenter"> - <primary sortas="b-nsenter">nsenter</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="partx"> - <term><command>partx</command></term> - <listitem> - <para>Tells the kernel about the presence and numbering of on-disk - partitions</para> - <indexterm zone="ch-system-util-linux partx"> - <primary sortas="b-partx">partx</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="pivot_root"> - <term><command>pivot_root</command></term> - <listitem> - <para>Makes the given file system the new root file system of the - current process</para> - <indexterm zone="ch-system-util-linux pivot_root"> - <primary sortas="b-pivot_root">pivot_root</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="prlimit"> - <term><command>prlimit</command></term> - <listitem> - <para>Get and set a process' resource limits</para> - <indexterm zone="ch-system-util-linux prlimit"> - <primary sortas="b-prlimit">prlimit</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="raw"> - <term><command>raw</command></term> - <listitem> - <para>Bind a Linux raw character device to a block device</para> - <indexterm zone="ch-system-util-linux raw"> - <primary sortas="b-raw">raw</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="readprofile"> - <term><command>readprofile</command></term> - <listitem> - <para>Reads kernel profiling information</para> - <indexterm zone="ch-system-util-linux readprofile"> - <primary sortas="b-readprofile">readprofile</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="rename"> - <term><command>rename</command></term> - <listitem> - <para>Renames the given files, replacing a given string with - another</para> - <indexterm zone="ch-system-util-linux rename"> - <primary sortas="b-rename">rename</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="renice"> - <term><command>renice</command></term> - <listitem> - <para>Alters the priority of running processes</para> - <indexterm zone="ch-system-util-linux renice"> - <primary sortas="b-renice">renice</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="resizepart"> - <term><command>resizepart</command></term> - <listitem> - <para>Asks the Linux kernel to resize a partition</para> - <indexterm zone="ch-system-util-linux resizepart"> - <primary sortas="b-resizepart">resizepart</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="rev"> - <term><command>rev</command></term> - <listitem> - <para>Reverses the lines of a given file</para> - <indexterm zone="ch-system-util-linux rev"> - <primary sortas="b-rev">rev</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="rkfill"> - <term><command>rkfill</command></term> - <listitem> - <para>Tool for enabling and disabling wireless devices</para> - <indexterm zone="ch-system-util-linux rkfill"> - <primary sortas="b-rkfill">rkfill</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="rtcwake"> - <term><command>rtcwake</command></term> - <listitem> - <para>Used to enter a system sleep state until specified wakeup - time</para> - <indexterm zone="ch-system-util-linux rtcwake"> - <primary sortas="b-rtcwake">rtcwake</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="script"> - <term><command>script</command></term> - <listitem> - <para>Makes a typescript of a terminal session</para> - <indexterm zone="ch-system-util-linux script"> - <primary sortas="b-script">script</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="scriptreplay"> - <term><command>scriptreplay</command></term> - <listitem> - <para>Plays back typescripts using timing information</para> - <indexterm zone="ch-system-util-linux scriptreplay"> - <primary sortas="b-scriptreplay">scriptreplay</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="setarch"> - <term><command>setarch</command></term> - <listitem> - <para>Changes reported architecture in a new program environment and - sets personality flags</para> - <indexterm zone="ch-system-util-linux setarch"> - <primary sortas="b-setarch">setarch</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="setsid"> - <term><command>setsid</command></term> - <listitem> - <para>Runs the given program in a new session</para> - <indexterm zone="ch-system-util-linux setsid"> - <primary sortas="b-setsid">setsid</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="setterm"> - <term><command>setterm</command></term> - <listitem> - <para>Sets terminal attributes</para> - <indexterm zone="ch-system-util-linux setterm"> - <primary sortas="b-setterm">setterm</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sfdisk"> - <term><command>sfdisk</command></term> - <listitem> - <para>A disk partition table manipulator</para> - <indexterm zone="ch-system-util-linux sfdisk"> - <primary sortas="b-sfdisk">sfdisk</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="sulogin"> - <term><command>sulogin</command></term> - <listitem> - <para>Allows <systemitem class="username">root</systemitem> to log in; - it is normally invoked by <command>init</command> when the system goes - into single user mode</para> - <indexterm zone="ch-system-util-linux sulogin"> - <primary sortas="b-sulogin">sulogin</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="swaplabel"> - <term><command>swaplabel</command></term> - <listitem> - <para>Allows to change swaparea UUID and label</para> - <indexterm zone="ch-system-util-linux swaplabel"> - <primary sortas="b-swaplabel">swaplabel</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="swapoff"> - <term><command>swapoff</command></term> - <listitem> - <para>Disables devices and files for paging and swapping</para> - <indexterm zone="ch-system-util-linux swapoff"> - <primary sortas="b-swapoff">swapoff</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="swapon"> - <term><command>swapon</command></term> - <listitem> - <para>Enables devices and files for paging and swapping and - lists the devices and files currently in use</para> - <indexterm zone="ch-system-util-linux swapon"> - <primary sortas="b-swapon">swapon</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="switch_root"> - <term><command>switch_root</command></term> - <listitem> - <para>Switches to another filesystem as the root of the mount tree</para> - <indexterm zone="ch-system-util-linux switch_root"> - <primary sortas="b-switch_root">switch_root</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="tailf"> - <term><command>tailf</command></term> - <listitem> - <para>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</para> - <indexterm zone="ch-system-util-linux tailf"> - <primary sortas="b-tailf">tailf</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="taskset"> - <term><command>taskset</command></term> - <listitem> - <para>Retrieves or sets a process' CPU affinity</para> - <indexterm zone="ch-system-util-linux taskset"> - <primary sortas="b-taskset">taskset</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="ul"> - <term><command>ul</command></term> - <listitem> - <para>A filter for translating underscores into escape sequences - indicating underlining for the terminal in use</para> - <indexterm zone="ch-system-util-linux ul"> - <primary sortas="b-ul">ul</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="umount"> - <term><command>umount</command></term> - <listitem> - <para>Disconnects a file system from the system's file tree</para> - <indexterm zone="ch-system-util-linux umount"> - <primary sortas="b-umount">umount</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="uname26"> - <term><command>uname26</command></term> - <listitem> - <para>A symbolic link to setarch</para> - <indexterm zone="ch-system-util-linux uname26"> - <primary sortas="b-uname26">uname26</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="unshare"> - <term><command>unshare</command></term> - <listitem> - <para>Runs a program with some namespaces unshared from parent</para> - <indexterm zone="ch-system-util-linux unshare"> - <primary sortas="b-unshare">unshare</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="utmpdump"> - <term><command>utmpdump</command></term> - <listitem> - <para>Displays the content of the given login file in a more - user-friendly format</para> - <indexterm zone="ch-system-util-linux utmpdump"> - <primary sortas="b-utmpdump">utmpdump</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="uuidd"> - <term><command>uuidd</command></term> - <listitem> - <para>A daemon used by the UUID library to generate time-based - UUIDs in a secure and guaranteed-unique fashion</para> - <indexterm zone="ch-system-util-linux uuidd"> - <primary sortas="b-uuidd">uuidd</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="uuidgen"> - <term><command>uuidgen</command></term> - <listitem> - <para>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</para> - <indexterm zone="ch-system-util-linux uuidgen"> - <primary sortas="b-uuidgen">uuidgen</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="uuidparse"> - <term><command>uuidparse</command></term> - <listitem> - <para>An utility to parse unique identifiers</para> - <indexterm zone="ch-system-util-linux uuidparse"> - <primary sortas="b-uuidparse">uuidparse</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="wall"> - <term><command>wall</command></term> - <listitem> - <para>Displays the contents of a file or, by default, its standard - input, on the terminals of all currently logged in users</para> - <indexterm zone="ch-system-util-linux wall"> - <primary sortas="b-wall">wall</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="wdctl"> - <term><command>wdctl</command></term> - <listitem> - <para>Shows hardware watchdog status</para> - <indexterm zone="ch-system-util-linux wdctl"> - <primary sortas="b-wdctl">wdctl</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="whereis"> - <term><command>whereis</command></term> - <listitem> - <para>Reports the location of the binary, source, and man page - for the given command</para> - <indexterm zone="ch-system-util-linux whereis"> - <primary sortas="b-whereis">whereis</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="wipefs"> - <term><command>wipefs</command></term> - <listitem> - <para>Wipes a filesystem signature from a device</para> - <indexterm zone="ch-system-util-linux wipefs"> - <primary sortas="b-wipefs">wipefs</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="x86_64"> - <term><command>x86_64</command></term> - <listitem> - <para>A symbolic link to setarch</para> - <indexterm zone="ch-system-util-linux x86_64"> - <primary sortas="b-x86_64">x86_64</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="zramctl"> - <term><command>zramctl</command></term> - <listitem> - <para>A program to set up and control zram (compressed ram disk) - devices</para> - <indexterm zone="ch-system-util-linux zramctl"> - <primary sortas="b-zramctl">zramctl</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libblkid"> - <term><filename class="libraryfile">libblkid</filename></term> - <listitem> - <para>Contains routines for device identification and token - extraction</para> - <indexterm zone="ch-system-util-linux libblkid"> - <primary sortas="c-libblkid">libblkid</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libfdisk"> - <term><filename class="libraryfile">libfdisk</filename></term> - <listitem> - <para>Contains routines for manipulating partition tables</para> - <indexterm zone="ch-system-util-linux libfdisk"> - <primary sortas="c-libfdisk">libfdisk</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libmount"> - <term><filename class="libraryfile">libmount</filename></term> - <listitem> - <para>Contains routines for block device mounting and - unmounting</para> - <indexterm zone="ch-system-util-linux libmount"> - <primary sortas="c-libmount">libmount</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libsmartcols"> - <term><filename class="libraryfile">libsmartcols</filename></term> - <listitem> - <para>Contains routines for aiding screen output in tabular form</para> - <indexterm zone="ch-system-util-linux libsmartcols"> - <primary sortas="c-libsmartcols">libsmartcols</primary> - </indexterm> - </listitem> - </varlistentry> - - <varlistentry id="libuuid"> - <term><filename class="libraryfile">libuuid</filename></term> - <listitem> - <para>Contains routines for generating unique identifiers for objects - that may be accessible beyond the local system</para> - <indexterm zone="ch-system-util-linux libuuid"> - <primary sortas="c-libuuid">libuuid</primary> - </indexterm> - </listitem> - </varlistentry> - - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-utillinux" role="."/></para> </sect2> 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; ]> -<sect1 id="ch-system-xz" role="wrap"> +<sect1 id="ch-tools-xz" role="wrap"> <?dbhtml filename="xz.html"?> <sect1info condition="script"> @@ -16,26 +16,25 @@ <title>Xz-&xz-version; - + Xz + tools - <para>The Xz package contains programs for compressing and decompressing - files. It provides capabilities for the lzma and the newer xz compression - formats. Compressing text files with <command>xz</command> yields a better - compression percentage than with the traditional <command>gzip</command> or - <command>bzip2</command> commands.</para> + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/xz.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> <seglistitem> - <seg>&xz-ch6-sbu;</seg> - <seg>&xz-ch6-du;</seg> + <seg>&xz-ch5-sbu;</seg> + <seg>&xz-ch5-du;</seg> </seglistitem> </segmentedlist> @@ -44,320 +43,34 @@ <sect2 role="installation"> <title>Installation of Xz - Prepare Xz for compilation with: + Prepare Xz for compilation: -./configure --prefix=/usr \ - --disable-static \ +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) \ + --disable-static \ --docdir=/usr/share/doc/xz-&xz-version; - Compile the package: + 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 - - - - - + + + <para>Details on this package are located in<!-- TODO + <xref linkend="contents-xz" role="."/> --></para> </sect2> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-bash" role="wrap"> + <?dbhtml filename="bash.html"?> + + <sect1info condition="script"> + <productname>bash</productname> + <productnumber>&bash-version;</productnumber> + <address>&bash-url;</address> + </sect1info> + + <title>Bash-&bash-version; + + + Bash + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/bash.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&bash-ch5-sbu;</seg> + <seg>&bash-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Bash + + Prepare Bash for compilation: + +./configure --prefix=/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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-bash" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-binutils-pass1" role="wrap"> + <?dbhtml filename="binutils-pass1.html"?> + + <sect1info condition="script"> + <productname>binutils-pass1</productname> + <productnumber>&binutils-version;</productnumber> + <address>&binutils-url;</address> + </sect1info> + + <title>Binutils-&binutils-version; - Pass 1 + + + Binutils + tools, pass 1 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/binutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&binutils-ch5p1-sbu;</seg> + <seg>&binutils-ch5p1-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Cross Binutils + + Go back and re-read the notes in the previous section. + Understanding the notes labeled important will save you a lot + 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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-binutils" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-binutils-pass2" role="wrap"> + <?dbhtml filename="binutils-pass2.html"?> + + <sect1info condition="script"> + <productname>binutils-pass2</productname> + <productnumber>&binutils-version;</productnumber> + <address>&binutils-url;</address> + </sect1info> + + <title>Binutils-&binutils-version; - Pass 2 + + + Binutils + tools, pass 2 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/binutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&binutils-ch5p2-sbu;</seg> + <seg>&binutils-ch5p2-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Binutils + + Create a separate build directory again: + +mkdir -v build +cd build + + Prepare Binutils for compilation: + +../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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-binutils" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-bison" role="wrap"> + <?dbhtml filename="bison.html"?> + + <sect1info condition="script"> + <productname>bison</productname> + <productnumber>&bison-version;</productnumber> + <address>&bison-url;</address> + </sect1info> + + <title>Bison-&bison-version; + + + Bison + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/bison.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&bison-ch5-sbu;</seg> + <seg>&bison-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-bison" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-bzip2" role="wrap"> + <?dbhtml filename="bzip2.html"?> + + <sect1info condition="script"> + <productname>bzip2</productname> + <productnumber>&bzip2-version;</productnumber> + <address>&bzip2-url;</address> + </sect1info> + + <title>Bzip2-&bzip2-version; + + + Bzip2 + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/bzip2.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&bzip2-ch5-sbu;</seg> + <seg>&bzip2-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Bzip2 + + 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 + + + + + + <para>Details on this package are located in + <xref linkend="contents-bzip2" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-changingowner"> + <?dbhtml filename="changingowner.html"?> + + <title>Changing Ownership + + + The commands in the remainder of this book must be performed while + logged in as user root and no + longer as user lfs. Also, double + check that $LFS is set in root's environment. + + + Currently, the 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 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/coreutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&coreutils-ch5-sbu;</seg> + <seg>&coreutils-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Coreutils + + Prepare Coreutils for compilation: + +./configure --prefix=/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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-coreutils" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-createfiles"> + <?dbhtml filename="createfiles.html"?> + + <title>Creating Essential Files and Symlinks + + + /etc/passwd + + + + /etc/group + + + + /var/run/utmp + + + + /var/log/btmp + + + + /var/log/lastlog + + + + /var/log/wtmp + + + 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 + + + + + + <para>The <application>DejaGnu</application> package contains a framework for running test + suites on GNU tools. It is written in <command>expect</command>, which itself + uses <application>Tcl</application> (Tool Command Language).</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&dejagnu-ch5-sbu;</seg> + <seg>&dejagnu-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/diffutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&diffutils-ch5-sbu;</seg> + <seg>&diffutils-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Diffutils + + Prepare Diffutils for compilation: + +./configure --prefix=/usr --host=$LFS_TGT + + Compile the package: + +make + + Install the package: + +make DESTDIR=$LFS install + + + + + + + <para>Details on this package are located in + <xref linkend="contents-diffutils" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-expect" role="wrap"> + <?dbhtml filename="expect.html"?> + + <sect1info condition="script"> + <productname>expect</productname> + <productnumber>&expect-version;</productnumber> + <address>&expect-url;</address> + </sect1info> + + <title>Expect-&expect-version; + + + Expect + + + + + + <para>The <application>Expect</application> package contains tools for + automating, via scripted dialogues, interactive applications such as + <command>telnet</command>, <command>ftp</command>, + <command>passwd</command>, <command>fsck</command>, + <command>rlogin</command>, and <command>tip</command>. + <application>Expect</application> is also useful for testing these same + applications as well as easing all sorts of tasks that are prohibitively + difficult with anything else. The <application>DejaGnu</application> + framework is written in <application>Expect</application>.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&expect-ch5-sbu;</seg> + <seg>&expect-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/file.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&file-ch5-sbu;</seg> + <seg>&file-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of File + + Prepare File for compilation: + +./configure --prefix=/usr \ + --host=$LFS_TGT + + + Compile the package: + +make + + Install the package: + +make DESTDIR=$LFS install + + + + + + <para>Details on this package are located in<!-- TODO + <xref linkend="contents-file" role="."/> --></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-findutils" role="wrap"> + <?dbhtml filename="findutils.html"?> + + <sect1info condition="script"> + <productname>findutils</productname> + <productnumber>&findutils-version;</productnumber> + <address>&findutils-url;</address> + </sect1info> + + <title>Findutils-&findutils-version; + + + Findutils + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/findutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&findutils-ch5-sbu;</seg> + <seg>&findutils-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Findutils + + Prepare Findutils for compilation: + +./configure --prefix=/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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-findutils" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-flex" role="wrap"> + <?dbhtml filename="flex.html"?> + + <sect1info condition="script"> + <productname>flex</productname> + <productnumber>&flex-version;</productnumber> + <address>&flex-url;</address> + </sect1info> + + <title>Flex-&flex-version; + + + Flex + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/flex.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&flex-ch5-sbu;</seg> + <seg>&flex-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Flex + + Prepare Flex for compilation: + +./configure --prefix=/usr \ + --docdir=/usr/share/doc/flex-&flex-version; + + + Compile the package: + +make + + Install the package: + +make install + + + + + + + <para>Details on this package are located in + <xref linkend="contents-flex" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-gawk" role="wrap"> + <?dbhtml filename="gawk.html"?> + + <sect1info condition="script"> + <productname>gawk</productname> + <productnumber>&gawk-version;</productnumber> + <address>&gawk-url;</address> + </sect1info> + + <title>Gawk-&gawk-version; + + + Gawk + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/gawk.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gawk-ch5-sbu;</seg> + <seg>&gawk-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Gawk + + 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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-gawk" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-gcc-pass1" role="wrap" xreflabel="gcc-pass1"> + <?dbhtml filename="gcc-pass1.html"?> + + <sect1info condition="script"> + <productname>gcc-pass1</productname> + <productnumber>&gcc-version;</productnumber> + <address>&gcc-url;</address> + </sect1info> + + <title>GCC-&gcc-version; - Pass 1 + + + GCC + tools, pass 1 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/gcc.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gcc-ch5p1-sbu;</seg> + <seg>&gcc-ch5p1-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>Details on this package are located in + <xref linkend="contents-gcc" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-gcc-pass2" role="wrap"> + <?dbhtml filename="gcc-pass2.html"?> + + <sect1info condition="script"> + <productname>gcc-pass2</productname> + <productnumber>&gcc-version;</productnumber> + <address>&gcc-url;</address> + </sect1info> + + <title>GCC-&gcc-version; - Pass 2 + + + GCC + tools, pass 2 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/gcc.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gcc-ch5p2-sbu;</seg> + <seg>&gcc-ch5p2-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of GCC + + As in the first build of GCC, the GMP, MPFR, and MPC packages are + required. Unpack the tarballs and move them into the required directory + names: + +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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-gcc" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-generalinstructions"> + <?dbhtml filename="generalinstructions.html"?> + + <title>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 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/gettext.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gettext-ch5-sbu;</seg> + <seg>&gettext-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-gettext" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-glibc" role="wrap"> + <?dbhtml filename="glibc.html"?> + + <sect1info condition="script"> + <productname>glibc</productname> + <productnumber>&glibc-version;</productnumber> + <address>&glibc-url;</address> + </sect1info> + + <title>Glibc-&glibc-version; + + + Glibc + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/glibc.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&glibc-ch5-sbu;</seg> + <seg>&glibc-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 <command>make install</command> option: + + + DESTDIR=$LFS + + The DESTDIR make variable is used by almost all + packages to define the location where the package should be + installed. If it is not set, it defaults to the root (/) directory. Here we specify that + the package be installed in $LFS + , which will become the root after . + + + + + + + At this point, it is imperative to stop and ensure that the basic + functions (compiling and linking) of the new toolchain are working as + expected. To perform a sanity check, run the following commands: + +echo 'int main(){}' > dummy.c +$LFS_TGT-gcc dummy.c +readelf -l a.out | grep '/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 + +
+ + + + + <para>Details on this package are located in + <xref linkend="contents-glibc" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-grep" role="wrap"> + <?dbhtml filename="grep.html"?> + + <sect1info condition="script"> + <productname>grep</productname> + <productnumber>&grep-version;</productnumber> + <address>&grep-url;</address> + </sect1info> + + <title>Grep-&grep-version; + + + Grep + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/grep.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&grep-ch5-sbu;</seg> + <seg>&grep-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Grep + + Prepare Grep for compilation: + +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --bindir=/bin + + Compile the package: + +make + + Install the package: + +make DESTDIR=$LFS install + + + + + + + <para>Details on this package are located in + <xref linkend="contents-grep" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-gzip" role="wrap"> + <?dbhtml filename="gzip.html"?> + + <sect1info condition="script"> + <productname>gzip</productname> + <productnumber>&gzip-version;</productnumber> + <address>&gzip-url;</address> + </sect1info> + + <title>Gzip-&gzip-version; + + + Gzip + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/gzip.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gzip-ch5-sbu;</seg> + <seg>&gzip-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Gzip + + Prepare Gzip for compilation: + +./configure --prefix=/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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-gzip" role="."/></para> + + </sect2> + +</sect1> 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; ]> -<sect1 id="ch-config-introduction" revision="sysv"> +<sect1 id="ch-tools-introduction"> <?dbhtml filename="introduction.html"?> <title>Introduction - Booting a Linux system involves several tasks. The process must - mount both virtual and real file systems, initialize devices, activate swap, - check file systems for integrity, mount any swap partitions or files, set - the system clock, bring up networking, start any daemons required by the - system, and accomplish any other custom tasks needed by the user. This - process must be organized to ensure the tasks are performed in the correct - order but, at the same time, be executed as fast as possible. + This chapter shows how to build 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 + + + + + + <para>Again, when building <xref linkend="ch-tools-gcc-pass2"/>, we had to + defer the installation of the C++ standard library, because no suitable + compiler was available to compile it: we could not use the compiler + 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.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <!-- TODO --> + <seglistitem> + <seg>&libstdcpp-ch5-sbu;</seg> + <seg>&libstdcpp-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Target Libstdc++ + + + Libstdc++ is part of the GCC sources. + You should first unpack the GCC tarball and change to the + gcc-&gcc-version; directory. + + + Create a link which exists when building Libstdc++ in the gcc + tree: + +ln -s gthr-posix.h libgcc/gthr-default.h + + Create a separate build directory for Libstdc++ and enter it: + +mkdir -v build +cd build + + Prepare Libstdc++ for compilation: + +../libstdc++-v3/configure \ + CXXFLAGS="-g -O2 -D_GNU_SOURCE" \ + --prefix=/usr \ + --disable-multilib \ + --disable-nls \ + --disable-libstdcxx-pch + + + 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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-gcc" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-libstdcpp-pass1" role="wrap"> + <?dbhtml filename="gcc-libstdc++-pass1.html"?> + + <sect1info condition="script"> + <productname>gcc-libstdc++</productname> + <productnumber>&gcc-version;</productnumber> + <address>&gcc-url;</address> + </sect1info> + + <title>Libstdc++ from GCC-&gcc-version;, Pass 1 + + + GCC + tools, libstdc++ pass 1 + + + + + + <para>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 <xref linkend="ch-tools-gcc-pass1"/> + because it depends on glibc, which was not yet available in the target + directory. + </para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&libstdcpp-ch5-sbu;</seg> + <seg>&libstdcpp-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Target Libstdc++ + + + Libstdc++ is part of the GCC sources. + You should first unpack the GCC tarball and change to the + gcc-&gcc-version; directory. + + + Create a 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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-gcc" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-linux-headers" role="wrap"> + <?dbhtml filename="linux-headers.html"?> + + <sect1info condition="script"> + <productname>linux-headers</productname> + <productnumber>&linux-version;</productnumber> + <address>&linux-url;</address> + </sect1info> + + <title>Linux-&linux-version; API Headers + + + Linux + tools, API headers + + + + + + <para>The Linux API Headers (in linux-&linux-version;.tar.xz) expose the + kernel's API for use by Glibc.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&linux-headers-ch5-sbu;</seg> + <seg>&linux-headers-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Linux API Headers + + The Linux kernel needs to expose an Application Programming Interface + (API) for the system's C library (Glibc in LFS) to use. This is done + by way of sanitizing various C header files that are shipped in the Linux + kernel source tarball. + + Make sure there are no stale files 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 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/m4.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&m4-ch5-sbu;</seg> + <seg>&m4-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of M4 + + First, make some fixes introduced by glibc-2.28: + +sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c +echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h + + Prepare M4 for compilation: + +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) + + Compile the package: + +make + + Install the package: + +make DESTDIR=$LFS install + + + + + + <para>Details on this package are located in + <xref linkend="contents-m4" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> +<sect1 id="ch-tools-make" role="wrap"> + <?dbhtml filename="make.html"?> + + <sect1info condition="script"> + <productname>make</productname> + <productnumber>&make-version;</productnumber> + <address>&make-url;</address> + </sect1info> + + <title>Make-&make-version; + + + Make + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/make.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&make-ch5-sbu;</seg> + <seg>&make-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-make" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-ncurses" role="wrap"> + <?dbhtml filename="ncurses.html"?> + + <sect1info condition="script"> + <productname>ncurses</productname> + <productnumber>&ncurses-version;</productnumber> + <address>&ncurses-url;</address> + </sect1info> + + <title>Ncurses-&ncurses-version; + + + Ncurses + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/ncurses.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&ncurses-ch5-sbu;</seg> + <seg>&ncurses-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Ncurses + + First, ensure that gawk is found first during configuration: + +sed -i s/mawk// configure + + 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 + + + + + + + + <para>Details on this package are located in + <xref linkend="contents-ncurses" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-patch" role="wrap"> + <?dbhtml filename="patch.html"?> + + <sect1info condition="script"> + <productname>patch</productname> + <productnumber>&patch-version;</productnumber> + <address>&patch-url;</address> + </sect1info> + + <title>Patch-&patch-version; + + + Patch + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/patch.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&patch-ch5-sbu;</seg> + <seg>&patch-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Patch + + Prepare Patch for compilation: + +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) + + Compile the package: + +make + + Install the package: + +make DESTDIR=$LFS install + + + + + + + <para>Details on this package are located in + <xref linkend="contents-patch" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-perl" role="wrap"> + <?dbhtml filename="perl.html"?> + + <sect1info condition="script"> + <productname>perl</productname> + <productnumber>&perl-version;</productnumber> + <address>&perl-url;</address> + </sect1info> + + <title>Perl-&perl-version; + + + Perl + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter08/perl.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&perl-ch5-sbu;</seg> + <seg>&perl-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-perl" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-system-Python-temp" role="wrap"> + <?dbhtml filename="Python-temp.html"?> + + <sect1info condition="script"> + <productname>Python</productname> + <productnumber>&python-version;</productnumber> + <address>&python-url;</address> + </sect1info> + + <title>Python-&python-version; + + + Python + temporary + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/python.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&python-ch5-sbu;</seg> + <seg>&python-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-python" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-sed" role="wrap"> + <?dbhtml filename="sed.html"?> + + <sect1info condition="script"> + <productname>sed</productname> + <productnumber>&sed-version;</productnumber> + <address>&sed-url;</address> + </sect1info> + + <title>Sed-&sed-version; + + + Sed + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/sed.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&sed-ch5-sbu;</seg> + <seg>&sed-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Sed + + Prepare Sed for compilation: + +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --bindir=/bin + + Compile the package: + +make + + Install the package: + +make DESTDIR=$LFS install + + + + + + + <para>Details on this package are located in + <xref linkend="contents-sed" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-stripping"> + <?dbhtml filename="stripping.html"?> + + <title>Stripping + + The steps in this section are optional, but if the LFS partition is + rather small, it is beneficial to learn that unnecessary items can be removed. + The executables and libraries built so far contain about 70 MB of unneeded + debugging symbols. Remove those symbols with: + +$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 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/tar.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&tar-ch5-sbu;</seg> + <seg>&tar-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Tar + + Prepare Tar for compilation: + +./configure --prefix=/usr \ + --host=$LFS_TGT \ + --build=$(build-aux/config.guess) \ + --bindir=/bin + + Compile the package: + +make + + Install the package: + +make DESTDIR=$LFS install + + + + + + + <para>Details on this package are located in + <xref linkend="contents-tar" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; + <!ENTITY tdbc-ver "1.1.1"> + <!ENTITY itcl-ver "4.2.0"> +]> + +<sect1 id="ch-tools-tcl" role="wrap"> + <?dbhtml filename="tcl.html"?> + + <sect1info condition="script"> + <productname>tcl</productname> + <productnumber>&tcl-version;</productnumber> + <address>&tcl-url;</address> + </sect1info> + + <title>Tcl-&tcl-version; + + + Tcl + + + + + + <para>The <application>Tcl</application> package contains the Tool Command Language, + a robust general-purpose scripting language. The <application>Expect</application> package + is written in the <application>Tcl</application> language.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&tcl-ch5-sbu;</seg> + <seg>&tcl-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/texinfo.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&texinfo-ch5-sbu;</seg> + <seg>&texinfo-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-texinfo" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-toolchaintechnotes"> + <?dbhtml filename="toolchaintechnotes.html"?> + + <title>Toolchain Technical Notes + + This section explains some of the rationale and technical details + behind the overall build method. It is not essential to immediately + understand everything in this section. Most of this information will be + clearer after performing an actual build. This section can be referred + to at any time during the process. + + The overall goal of is to + produce a temporary area that contains a known-good set of tools that can be + isolated from the host system. By using chroot, the + commands in the remaining chapters will be contained within that environment, + ensuring a clean, trouble-free build of the target LFS system. The build + process has been designed to minimize the risks for new readers and to provide + the most educational value at the same time. + + 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 + + + + + + <para>The Util-linux package contains miscellaneous utility programs.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&util-linux-ch5-sbu;</seg> + <seg>&util-linux-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Util-linux + + 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 + + + + + + + <para>Details on this package are located in + <xref linkend="contents-utillinux" role="."/></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-tools-xz" role="wrap"> + <?dbhtml filename="xz.html"?> + + <sect1info condition="script"> + <productname>xz</productname> + <productnumber>&xz-version;</productnumber> + <address>&xz-url;</address> + </sect1info> + + <title>Xz-&xz-version; + + + Xz + tools + + + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="../chapter06/xz.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&xz-ch5-sbu;</seg> + <seg>&xz-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Xz + + Prepare Xz for compilation: + +./configure --prefix=/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 + + + + + + <para>Details on this package are located in<!-- TODO + <xref linkend="contents-xz" role="."/> --></para> + + </sect2> + +</sect1> 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 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ + <!ENTITY % general-entities SYSTEM "../general.ent"> + %general-entities; +]> + +<sect1 id="ch-system-bash" role="wrap"> + <?dbhtml filename="bash.html"?> + + <sect1info condition="script"> + <productname>bash</productname> + <productnumber>&bash-version;</productnumber> + <address>&bash-url;</address> + </sect1info> + + <title>Bash-&bash-version; + + + Bash + + + + + + <para>The Bash package contains the Bourne-Again SHell.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&bash-ch6-sbu;</seg> + <seg>&bash-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Bash + + Incorporate some upstream fixes: + +patch -Np1 -i ../&bash-fixes-patch; + + Prepare Bash for compilation: + +./configure --prefix=/usr \ + --docdir=/usr/share/doc/bash-&bash-version; \ + --without-bash-malloc \ + --with-installed-readline + + + The meaning of the new configure option: + + + --with-installed-readline + + This option tells Bash to use the readline library that is already + installed on the system rather than using its own readline + version. + + + + + + Compile the package: + +make + + Skip down to Install the + package if not running the test suite. + + To prepare the tests, ensure that the tester user can write to the sources tree: + +chown -Rv tester . + + Now, run the tests as the tester user: + +su tester << EOF +PATH=$PATH make tests < $(tty) +EOF + + Install the package and move the main executable to + /bin: + +make install +mv -vf /usr/bin/bash /bin + + Run the newly compiled bash program (replacing the one that is + currently being executed): + +exec /bin/bash --login +h + + + The parameters used make the bash + process an interactive login shell and 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 + + + + + + <para>The Bison package contains a parser generator.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&bison-ch6-sbu;</seg> + <seg>&bison-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>The Bzip2 package contains programs for compressing and decompressing + files. Compressing text files with <command>bzip2</command> yields a much + better compression percentage than with the traditional + <command>gzip</command>.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&bzip2-ch6-sbu;</seg> + <seg>&bzip2-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>The Coreutils package contains utilities for showing and setting the + basic system characteristics.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&coreutils-ch6-sbu;</seg> + <seg>&coreutils-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Coreutils + + POSIX requires that programs from Coreutils recognize character + boundaries correctly even in multibyte locales. The following patch fixes + this non-compliance and other internationalization-related bugs. + +patch -Np1 -i ../&coreutils-i18n-patch; + + + In the past, many bugs were found in this patch. When reporting new + bugs to Coreutils maintainers, please check first if they are reproducible + without this patch. + + + + Suppress a test which on some machines can loop forever: + +sed -i '/test.lock/s/^/#/' gnulib-tests/gnulib.mk + + Now prepare Coreutils for compilation: + +autoreconf -fiv +FORCE_UNSAFE_CONFIGURE=1 ./configure \ + --prefix=/usr \ + --enable-no-install-program=kill,uptime + + + The meaning of the configure options: + + + autoreconf + + This command updates generated configuration files + consistent with the latest version of automake. + + + + + + FORCE_UNSAFE_CONFIGURE=1 + + This environment variable allows the package to be + built as the root user. + + + + + + --enable-no-install-program=kill,uptime + + The purpose of this switch is to prevent Coreutils from + installing binaries that will be installed by other packages later. + + + + + + Compile the package: + +make + + Skip down to Install the + package if not running the test suite. + + Now the test suite is ready to be run. First, run the tests that are + meant to be run as user root: + +make NON_ROOT_USERNAME=tester check-root + + We're going to run the remainder of the tests as the + tester user. Certain tests, + 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 + + + + + + <para>The Diffutils package contains programs that show the differences + between files or directories.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&diffutils-ch6-sbu;</seg> + <seg>&diffutils-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Diffutils + + Prepare Diffutils for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + + Contents of Diffutils + + + Installed programs + + + cmp, diff, diff3, and sdiff + + + + + Short Descriptions + + + + + cmp + + Compares two files and reports whether or in which bytes they + differ + + cmp + + + + + + diff + + Compares two files or directories and reports which lines in + the files differ + + diff + + + + + + diff3 + + Compares three files line by line + + diff3 + + + + + + sdiff + + Merges two files and interactively outputs the results + + sdiff + + + + + + + + +
diff --git a/chapter06/e2fsprogs.xml b/chapter08/e2fsprogs.xml similarity index 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 + + + + + + <para>The File package contains a utility for determining the type of a given + file or files.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&file-ch6-sbu;</seg> + <seg>&file-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of File + + Prepare File for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + + 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 + + + + + + <para>The Findutils package contains programs to find files. These programs + are provided to recursively search through a directory tree and to + create, maintain, and search a database (often faster than the recursive + find, but unreliable if the database has not been recently updated).</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&findutils-ch6-sbu;</seg> + <seg>&findutils-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Findutils + + Prepare Findutils for compilation: + +./configure --prefix=/usr --localstatedir=/var/lib/locate + + + The meaning of the configure options: + + + --localstatedir + + This option changes the location of the locate + database to be in /var/lib/locate, + which is FHS-compliant. + + + + + + Compile the package: + +make + + To test the results, issue: + +chown -Rv tester . +su tester -c "PATH=$PATH make check" + + Install the package: + +make install + + Some of the scripts in the LFS-Bootscripts package + depend on find. As /usr may not be available during the early + stages of booting, this program needs to be on the root partition. The + updatedb script also needs to be modified to correct an + explicit path: + + Some packages in BLFS and beyond expect the + find program in /bin, so make sure it's placed there: + +mv -v /usr/bin/find /bin +sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb + + + + + Contents of Findutils + + + Installed programs + Installed directory + + + find, locate, updatedb, and xargs + /var/lib/locate + + + + + + Short Descriptions + + + + + find + + Searches given directory trees for files matching the specified + criteria + + find + + + + + + locate + + Searches through a database of file names and reports the names + that contain a given string or match a given pattern + + locate + + + + + + updatedb + + Updates the locate database; it scans the + entire file system (including other file systems that are currently + mounted, unless told not to) and puts every file name it finds into + the database + + updatedb + + + + + + xargs + + Can be used to apply a given command to a list of files + + xargs + + + + + + + + +
diff --git a/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 + + + + + + <para>The Flex package contains a utility for generating programs that + recognize patterns in text.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&flex-ch6-sbu;</seg> + <seg>&flex-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>The Gawk package contains programs for manipulating text files.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gawk-ch6-sbu;</seg> + <seg>&gawk-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Gawk + + First, ensure some unneeded files are not installed: + +sed -i 's/extras//' Makefile.in + + Prepare Gawk for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + If desired, install the documentation: + +mkdir -v /usr/share/doc/gawk-&gawk-version; +cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-&gawk-version; + + + + + Contents of Gawk + + + Installed programs + Installed libraries + Installed directories + + + awk (link to gawk), gawk, and awk-&gawk-version; + filefuncs.so, fnmatch.so, fork.so, inplace.so, intdiv.so, ordchr.so, + readdir.so, readfile.so, revoutput.so, revtwoway.so, rwarray.so, + and time.so (all in /usr/lib/gawk) + /usr/lib/gawk, /usr/libexec/awk, /usr/share/awk, and + /usr/share/doc/gawk-&gawk-version; + + + + + Short Descriptions + + + + + awk + + A link to gawk + + awk + + + + + + gawk + + A program for manipulating text files; it is the GNU + implementation of awk + + gawk + + + + + + gawk-&gawk-version; + + A hard link to gawk + + gawk-&gawk-version; + + + + + + + + +
diff --git a/chapter06/gcc.xml b/chapter08/gcc.xml similarity index 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 + + + + + + <para>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.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gettext-ch6-sbu;</seg> + <seg>&gettext-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>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.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&glibc-ch6-sbu;</seg> + <seg>&glibc-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>The Grep package contains programs for searching through files.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&grep-ch6-sbu;</seg> + <seg>&grep-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Grep + + Prepare Grep for compilation: + +./configure --prefix=/usr --bindir=/bin + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + Contents of Grep + + + Installed programs + + + egrep, fgrep, and grep + + + + + Short Descriptions + + + + + egrep + + Prints lines matching an extended regular expression + + egrep + + + + + + fgrep + + Prints lines matching a list of fixed strings + + fgrep + + + + + + grep + + Prints lines matching a basic regular expression + + grep + + + + + + + + +
diff --git a/chapter06/groff.xml b/chapter08/groff.xml similarity index 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. + + + <para>The GRUB package contains the GRand Unified Bootloader.</para> - <para> Ensure that an emergency boot disk is ready to <quote>rescue</quote> - the computer if the computer becomes unusable (un-bootable). If you do not - already have a boot device, you can create one. In order for the procedure - below to work, you need to jump ahead to BLFS and install - <userinput>xorriso</userinput> from the <ulink - url="&blfs-book;multimedia/libisoburn.html"> - libisoburn</ulink> package.</para> + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> -<screen role="nodump"><userinput>cd /tmp -grub-mkrescue --output=grub-img.iso -xorriso -as cdrecord -v dev=/dev/cdrw blank=as_needed grub-img.iso</userinput></screen> - - <note> - <para> - To boot LFS on host systems that have UEFI enabled, the kernel needs to - have been built with the CONFIG_EFI_STUB capabality described in the - previous section. However, LFS can be booted using GRUB2 without such - an addition. To do this, the UEFI Mode and Secure Boot capabilities in - the host system's BIOS need to be turned off. For details, see <ulink - url="&hints-root;lfs-uefi.txt"> - the lfs-uefi.txt hint</ulink> at - &hints-root;lfs-uefi.txt. - </para> - </note> + <seglistitem> + <seg>&grub-ch6-sbu;</seg> + <seg>&grub-ch6-du;</seg> + </seglistitem> + </segmentedlist> </sect2> - <sect2> - <title>GRUB Naming Conventions + + Installation of GRUB - GRUB uses its own naming structure for drives and partitions in - the form of (hdn,m), where n - is the hard drive number and m is the partition - number. The hard drive number starts from zero, but the partition number - starts from one for normal partitions and five for extended partitions. - Note that this is different from earlier versions where - both numbers started from zero. For example, partition sda1 is (hd0,1) to - GRUB and sdb3 is - (hd1,3). In contrast to Linux, GRUB does not - consider CD-ROM drives to be hard drives. For example, if using a CD - on hdb and a second hard drive - on hdc, that second hard drive - would still be (hd1). + Prepare GRUB for compilation: + +./configure --prefix=/usr \ + --sbindir=/sbin \ + --sysconfdir=/etc \ + --disable-efiemu \ + --disable-werror + + + The meaning of the new configure options: + + + --disable-werror + + This allows the build to complete with warnings introduced + by more recent Flex versions. + + + + + --disable-efiemu + + This option minimizes what is built by disabling a feature and + testing programs not needed for LFS. + + + + + + Compile the package: + +make + + This package does not come with a test suite. + + Install the package: + +make install +mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions + + Using GRUB to make your LFS system bootable will be discussed in + . - - Setting Up the Configuration + + Contents of GRUB - GRUB works by writing data to the first physical track of the - hard disk. This area is not part of any file system. The programs - there access GRUB modules in the boot partition. The default location - is /boot/grub/. + + Installed programs + Installed directories - The location of the boot partition is a choice of the user that - affects the configuration. One recommendation is to have a separate small - (suggested size is 100 MB) partition just for boot information. That way - each build, whether LFS or some commercial distro, can access the same boot - files and access can be made from any booted system. If you choose to do - this, you will need to mount the separate partition, move all files in the - current /boot directory (e.g. the - linux kernel you just built in the previous section) to the new partition. - You will then need to unmount the partition and remount it as /boot. If you do this, be sure to update - /etc/fstab. + - Using the current lfs partition will also work, but configuration - for multiple systems is more difficult. + grub-bios-setup, grub-editenv, grub-file, grub-fstest, + grub-glue-efi, grub-install, grub-kbdcomp, grub-macbless, + grub-menulst2cfg, grub-mkconfig, + grub-mkimage, grub-mklayout, grub-mknetdir, + grub-mkpasswd-pbkdf2, grub-mkrelpath, grub-mkrescue, grub-mkstandalone, + grub-ofpathname, grub-probe, grub-reboot, grub-render-label, + grub-script-check, + grub-set-default, grub-sparc64-setup, and grub-syslinux2cfg - Using the above information, determine the appropriate - designator for the root partition (or boot partition, if a separate - one is used). For the following example, it is assumed that the root - (or separate boot) partition is sda2. + /usr/lib/grub, /etc/grub.d, /usr/share/grub, and /boot/grub (when grub-install + is first run) + + - Install the GRUB files into /boot/grub and set up the boot track: + + Short Descriptions + + - - The following command will overwrite the current boot loader. Do not - run the command if this is not desired, for example, if using a third party - boot manager to manage the Master Boot Record (MBR). - + + grub-bios-setup + + Is a helper program for grub-install + + grub-bios-setup + + + -grub-install /dev/sda + + grub-editenv + + A tool to edit the environment block + + grub-editenv + + + - - If the system has been booted using UEFI, - grub-install will try to install files for the - x86_64-efi target, but those files - have not been installed in chapter 6. If this is the case, add - to the command above. - + + grub-file + + Checks if FILE is of the specified type. + + grub-file + + + - - - Creating the GRUB Configuration File - - Generate /boot/grub/grub.cfg: - - cat > /boot/grub/grub.cfg << "EOF" -# Begin /boot/grub/grub.cfg -set default=0 -set timeout=5 - -insmod ext2 -set root=(hd0,2) - -menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;" { - linux /boot/vmlinuz-&linux-version;-lfs-&version; root=/dev/sda2 ro -} -EOF - - cat > /boot/grub/grub.cfg << "EOF" -# Begin /boot/grub/grub.cfg -set default=0 -set timeout=5 - -insmod ext2 -set root=(hd0,2) - -menuentry "GNU/Linux, Linux &linux-version;-lfs-&versiond;" { - linux /boot/vmlinuz-&linux-version;-lfs-&versiond; root=/dev/sda2 ro -} -EOF - - - 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 + + + + + + <para>The Gzip package contains programs for compressing and decompressing + files.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gzip-ch6-sbu;</seg> + <seg>&gzip-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Gzip + + Prepare Gzip for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + 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 + + + + + + <para>The M4 package contains a macro processor.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&m4-ch6-sbu;</seg> + <seg>&m4-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>The Make package contains a program for compiling packages.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&make-ch6-sbu;</seg> + <seg>&make-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>The Ncurses package contains libraries for terminal-independent + handling of character screens.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&ncurses-ch6-sbu;</seg> + <seg>&ncurses-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Ncurses + + Don't install a static library that is not handled by configure: + +sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in + + Prepare Ncurses for compilation: + +./configure --prefix=/usr \ + --mandir=/usr/share/man \ + --with-shared \ + --without-debug \ + --without-normal \ + --enable-pc-files \ + --enable-widec + + + The meaning of the new configure options: + + + --enable-widec + + This switch causes wide-character libraries (e.g., libncursesw.so.&ncurses-version;) + to be built instead of normal ones (e.g., libncurses.so.&ncurses-version;). + These wide-character libraries are usable in both multibyte and + traditional 8-bit locales, while normal libraries work properly + only in 8-bit locales. Wide-character and normal libraries are + source-compatible, but not binary-compatible. + + + + + --enable-pc-files + + This switch generates and installs .pc files for pkg-config. + + + + + + --without-normal + + This switch disables building and installing most static libraries. + + + + + + + Compile the package: + +make + + This package has a test suite, but it can only be run after the + package has been installed. The tests reside in the + test/ directory. See the + README file in that directory for further details. + + + Install the package: + +make install + + Move the shared libraries to the + /lib directory, where they are + expected to reside: + +mv -v /usr/lib/libncursesw.so.6* /lib + + Because the libraries have been moved, one symlink points to + a non-existent file. Recreate it: + +ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so + + Many applications still expect the linker to be able to find + non-wide-character Ncurses libraries. Trick such applications into linking with + wide-character libraries by means of symlinks and linker scripts: + +for lib in ncurses form panel menu ; do + rm -vf /usr/lib/lib${lib}.so + echo "INPUT(-l${lib}w)" > /usr/lib/lib${lib}.so + ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc +done + + Finally, make sure that old applications that look for + -lcurses at build time are still + buildable: + +rm -vf /usr/lib/libcursesw.so +echo "INPUT(-lncursesw)" > /usr/lib/libcursesw.so +ln -sfv libncurses.so /usr/lib/libcurses.so + + If desired, install the Ncurses documentation: + +mkdir -v /usr/share/doc/ncurses-&ncurses-version; +cp -v -R doc/* /usr/share/doc/ncurses-&ncurses-version; + + + + The instructions above don't create non-wide-character Ncurses + libraries since no package installed by compiling from sources would link + against them at runtime. However, the only known binary-only + applications that link against non-wide-character Ncurses libraries + require version 5. If you must have such libraries because of some binary-only + application or to be compliant with LSB, build the package again with the + following commands: + +make distclean +./configure --prefix=/usr \ + --with-shared \ + --without-normal \ + --without-debug \ + --without-cxx-binding \ + --with-abi-version=5 +make sources libs +cp -av lib/lib*.so.5* /usr/lib + + + + + + 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 + + + + + + <para>The Patch package contains a program for modifying or creating files + by applying a <quote>patch</quote> file typically created by the + <command>diff</command> program.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&patch-ch6-sbu;</seg> + <seg>&patch-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Patch + + Prepare Patch for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + Contents of Patch + + + Installed program + + + patch + + + + + Short Descriptions + + + + + patch + + Modifies files according to a patch file [A patch file is + normally a difference listing created with the diff + program. By applying these differences to the original files, + patch creates the patched versions.] + + patch + + + + + + + + +
diff --git a/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 + + + + + + <para>The Perl package contains the Practical Extraction and Report + Language.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&perl-ch6-sbu;</seg> + <seg>&perl-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>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.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&python-ch6-sbu;</seg> + <seg>&python-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>The Sed package contains a stream editor.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&sed-ch6-sbu;</seg> + <seg>&sed-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Sed + + Prepare Sed for compilation: + +./configure --prefix=/usr --bindir=/bin + + Compile the package and generate the HTML documentation: + +make +make html + + To test the results, issue: + +chown -Rv tester . +su tester -c "PATH=$PATH make check" + + Install the package and its documentation: + +make install +install -d -m755 /usr/share/doc/sed-&sed-version; +install -m644 doc/sed.html /usr/share/doc/sed-&sed-version; + + + + + Contents of Sed + + + Installed program + Installed directory + + + sed + /usr/share/doc/sed-&sed-version; + + + + + Short Descriptions + + + + + sed + + Filters and transforms text files in a single pass + + sed + + + + + + + + +
diff --git a/chapter06/shadow.xml b/chapter08/shadow.xml similarity index 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 + + + + + + <para>The Tar package contains an archiving program.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&tar-ch6-sbu;</seg> + <seg>&tar-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Tar + + Prepare Tar for compilation: + +FORCE_UNSAFE_CONFIGURE=1 \ +./configure --prefix=/usr \ + --bindir=/bin + + + The meaning of the configure 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 + + + + + + <para>The Texinfo package contains programs for reading, writing, and + converting info pages.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&texinfo-ch6-sbu;</seg> + <seg>&texinfo-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>The Util-linux package contains miscellaneous utility programs. + Among them are utilities for handling file systems, consoles, partitions, + and messages.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&util-linux-ch6-sbu;</seg> + <seg>&util-linux-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>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 + + + + + + <para>The Xz package contains programs for compressing and decompressing + files. It provides capabilities for the lzma and the newer xz compression + formats. Compressing text files with <command>xz</command> yields a better + compression percentage than with the traditional <command>gzip</command> or + <command>bzip2</command> commands.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&xz-ch6-sbu;</seg> + <seg>&xz-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Xz + + Prepare Xz for compilation with: + +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/xz-&xz-version; + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package and make sure that all essential files are in the + correct directory: + +make install +mv -v /usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} /bin +mv -v /usr/lib/liblzma.so.* /lib +ln -svf ../../lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.so + + + + + 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