From efcb3933433838b71f3a4a53ec1ac6d899aaec0b Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Sun, 3 May 2020 21:02:51 +0000 Subject: Make the new book git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross-chap5@11831 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter06/linux-headers.xml | 209 -------------------------------------------- 1 file changed, 209 deletions(-) delete mode 100644 chapter06/linux-headers.xml (limited to 'chapter06/linux-headers.xml') diff --git a/chapter06/linux-headers.xml b/chapter06/linux-headers.xml deleted file mode 100644 index f1d4cb14e..000000000 --- a/chapter06/linux-headers.xml +++ /dev/null @@ -1,209 +0,0 @@ - - - %general-entities; -]> - - - - - - linux-headers - &linux-version; -
&linux-url;
-
- - Linux-&linux-version; API Headers - - - Linux - API headers - - - - - - <para>The Linux API Headers (in linux-&linux-version;.tar.xz) expose the - kernel's API for use by Glibc.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&linux-headers-ch6-sbu;</seg> - <seg>&linux-headers-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Linux API Headers - - The Linux kernel needs to expose an Application Programming Interface - (API) for the system's C library (Glibc in LFS) to use. This is done - by way of sanitizing various C header files that are shipped in the Linux - kernel source tarball. - - Make sure there are no stale files and dependencies lying around - from previous activity: - -make mrproper - - Now extract the user-visible kernel headers from the source. - The recommended make target headers_install cannot be - used, because it requires rsync, which is - not available in /tools. The - headers are first placed in ./usr, - then some files used by the kernel developers are removed, then - the files are copied to their final location. - -make headers -find usr/include -name '.*' -delete -rm usr/include/Makefile -cp -rv usr/include/* /usr/include - - - - - Contents of Linux API Headers - - - Installed headers - Installed directories - - - /usr/include/asm/*.h, /usr/include/asm-generic/*.h, - /usr/include/drm/*.h, /usr/include/linux/*.h, /usr/include/misc/*.h, - /usr/include/mtd/*.h, /usr/include/rdma/*.h, /usr/include/scsi/*.h, - /usr/include/sound/*.h, /usr/include/video/*.h, - and /usr/include/xen/*.h - /usr/include/asm, /usr/include/asm-generic, /usr/include/drm, - /usr/include/linux, /usr/include/misc, /usr/include/mtd, - /usr/include/rdma, /usr/include/scsi, /usr/include/sound, - /usr/include/video, and /usr/include/xen - - - - - Short Descriptions - - - - - /usr/include/asm/*.h - - The Linux API ASM Headers - - /usr/include/asm/*.h - - - - - - /usr/include/asm-generic/*.h - - The Linux API ASM Generic Headers - - /usr/include/asm-generic/*.h - - - - - - /usr/include/drm/*.h - - The Linux API DRM Headers - - /usr/include/drm/*.h - - - - - - /usr/include/linux/*.h - - The Linux API Linux Headers - - /usr/include/linux/*.h - - - - - - /usr/include/misc/*.h - - The Linux API Miscellaneous Headers - - /usr/include/misc/*.h - - - - - - /usr/include/mtd/*.h - - The Linux API MTD Headers - - /usr/include/mtd/*.h - - - - - - /usr/include/rdma/*.h - - The Linux API RDMA Headers - - /usr/include/rdma/*.h - - - - - - /usr/include/scsi/*.h - - The Linux API SCSI Headers - - /usr/include/scsi/*.h - - - - - - /usr/include/sound/*.h - - The Linux API Sound Headers - - /usr/include/sound/*.h - - - - - - /usr/include/video/*.h - - The Linux API Video Headers - - /usr/include/video/*.h - - - - - - /usr/include/xen/*.h - - The Linux API Xen Headers - - /usr/include/xen/*.h - - - - - - - - -
-- cgit v1.2.3-54-g00ecf From fcc027677da55c41dcaea045f5b9ff8b088e6495 Mon Sep 17 00:00:00 2001 From: Bruce Dubbs Date: Sun, 7 Jun 2020 20:16:00 +0000 Subject: 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/aboutdebug.xml | 52 -- chapter06/acl.xml | 148 ----- chapter06/adjusting.xml | 126 ---- chapter06/attr.xml | 147 ----- chapter06/autoconf.xml | 194 ------ chapter06/automake.xml | 155 ----- chapter06/bash.xml | 137 +--- chapter06/bc.xml | 129 ---- chapter06/binutils-pass1.xml | 156 +++++ chapter06/binutils-pass2.xml | 94 +++ chapter06/binutils.xml | 436 ------------ chapter06/bison.xml | 110 +--- chapter06/bzip2.xml | 202 +----- chapter06/changingowner.xml | 41 ++ chapter06/chapter06.xml | 93 +-- chapter06/check.xml | 109 --- chapter06/chroot.xml | 65 ++ chapter06/coreutils.xml | 1264 ++--------------------------------- chapter06/createfiles.xml | 204 ++++++ chapter06/creatingdirs.xml | 59 ++ chapter06/dbus.xml | 241 ------- chapter06/dejagnu.xml | 96 +++ chapter06/diffutils.xml | 85 +-- chapter06/e2fsprogs.xml | 541 --------------- chapter06/eudev.xml | 191 ------ chapter06/expat.xml | 117 ---- 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/gcc.xml | 626 ------------------ chapter06/gdbm.xml | 156 ----- chapter06/generalinstructions.xml | 120 ++++ chapter06/gettext.xml | 410 +----------- chapter06/glibc.xml | 980 ++++----------------------- chapter06/gmp.xml | 164 ----- chapter06/gperf.xml | 95 --- chapter06/grep.xml | 73 +- chapter06/groff.xml | 607 ----------------- chapter06/grub.xml | 374 ----------- chapter06/gzip.xml | 196 +----- chapter06/iana-etc.xml | 93 --- chapter06/inetutils.xml | 249 ------- chapter06/intltool.xml | 141 ---- chapter06/introduction.xml | 79 +-- chapter06/iproute2.xml | 322 --------- chapter06/kbd.xml | 392 ----------- chapter06/kernfs.xml | 115 ++++ chapter06/kmod.xml | 211 ------ chapter06/less.xml | 125 ---- chapter06/libcap.xml | 166 ----- chapter06/libelf.xml | 88 --- chapter06/libffi.xml | 133 ---- chapter06/libpipeline.xml | 92 --- chapter06/libstdc++-pass2.xml | 114 ++++ chapter06/libstdc++.xml | 122 ++++ chapter06/libtool.xml | 129 ---- chapter06/linux-headers.xml | 207 ++++++ chapter06/m4.xml | 64 +- chapter06/make.xml | 76 +-- chapter06/man-db.xml | 456 ------------- chapter06/man-pages.xml | 80 --- chapter06/meson.xml | 109 --- chapter06/mpc.xml | 100 --- chapter06/mpfr.xml | 105 --- chapter06/ncurses.xml | 339 ++-------- chapter06/ninja.xml | 132 ---- chapter06/openssl.xml | 176 ----- chapter06/patch.xml | 58 +- chapter06/perl.xml | 485 +------------- chapter06/pkgconfig.xml | 121 ---- chapter06/pkgmgt.xml | 291 -------- chapter06/procps.xml | 292 -------- chapter06/psmisc.xml | 160 ----- chapter06/python.xml | 233 +------ chapter06/readline.xml | 156 ----- chapter06/revisedchroot.xml | 70 -- chapter06/sed.xml | 67 +- chapter06/shadow.xml | 608 ----------------- chapter06/stripping.xml | 53 ++ chapter06/strippingagain.xml | 81 --- chapter06/sysklogd.xml | 136 ---- chapter06/systemd.xml | 830 ----------------------- chapter06/sysvinit.xml | 220 ------- chapter06/tar.xml | 77 +-- chapter06/tcl.xml | 191 ++++++ chapter06/texinfo.xml | 201 +----- chapter06/toolchaintechnotes.xml | 335 ++++++++++ chapter06/util-linux.xml | 1278 +---------------------------------- chapter06/vim.xml | 319 --------- chapter06/xml-parser.xml | 92 --- chapter06/xz.xml | 335 +--------- chapter06/zlib.xml | 101 --- chapter06/zstd.xml | 136 ---- chapter07/bash.xml | 96 +++ chapter07/binutils-pass1.xml | 156 +++++ chapter07/binutils-pass2.xml | 94 +++ chapter07/bison.xml | 82 +++ chapter07/bootscripts.xml | 331 ---------- chapter07/bzip2.xml | 112 ++++ chapter07/changingowner.xml | 41 ++ chapter07/chapter07.xml | 48 +- chapter07/chroot.xml | 65 ++ chapter07/clock.xml | 104 --- chapter07/consoled.xml | 139 ---- chapter07/coreutils.xml | 105 +++ chapter07/createfiles.xml | 204 ++++++ chapter07/creatingdirs.xml | 59 ++ chapter07/dejagnu.xml | 96 +++ chapter07/diffutils.xml | 68 ++ chapter07/etcshells.xml | 49 -- 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/inputrc.xml | 82 --- chapter07/introduction.xml | 224 +------ chapter07/introductiond.xml | 73 -- chapter07/kernfs.xml | 115 ++++ chapter07/libstdc++-pass2.xml | 114 ++++ chapter07/libstdc++.xml | 122 ++++ chapter07/linux-headers.xml | 207 ++++++ chapter07/locale.xml | 152 ----- chapter07/m4.xml | 74 +++ chapter07/make.xml | 83 +++ chapter07/ncurses.xml | 157 +++++ chapter07/network.xml | 247 ------- chapter07/networkd.xml | 335 ---------- chapter07/patch.xml | 70 ++ chapter07/perl.xml | 79 +++ chapter07/profile.xml | 162 ----- chapter07/python.xml | 88 +++ chapter07/sed.xml | 70 ++ chapter07/stripping.xml | 53 ++ chapter07/symlinks.xml | 256 ------- chapter07/systemd-custom.xml | 313 --------- chapter07/tar.xml | 71 ++ chapter07/tcl.xml | 191 ++++++ chapter07/texinfo.xml | 74 +++ chapter07/toolchaintechnotes.xml | 335 ++++++++++ chapter07/udev.xml | 342 ---------- chapter07/usage.xml | 710 -------------------- chapter07/util-linux.xml | 113 ++++ chapter07/xz.xml | 77 +++ chapter08/aboutdebug.xml | 52 ++ chapter08/acl.xml | 148 +++++ chapter08/adjusting.xml | 126 ++++ chapter08/attr.xml | 147 +++++ chapter08/autoconf.xml | 194 ++++++ chapter08/automake.xml | 155 +++++ chapter08/bash.xml | 173 +++++ chapter08/bc.xml | 129 ++++ chapter08/binutils.xml | 436 ++++++++++++ chapter08/bison.xml | 142 ++++ chapter08/bzip2.xml | 250 +++++++ chapter08/chapter08.xml | 92 ++- chapter08/check.xml | 109 +++ chapter08/coreutils.xml | 1287 ++++++++++++++++++++++++++++++++++++ chapter08/dbus.xml | 241 +++++++ chapter08/diffutils.xml | 125 ++++ chapter08/e2fsprogs.xml | 541 +++++++++++++++ chapter08/eudev.xml | 191 ++++++ chapter08/expat.xml | 117 ++++ chapter08/file.xml | 108 +++ chapter08/findutils.xml | 161 +++++ chapter08/flex.xml | 149 +++++ chapter08/fstab.xml | 125 ---- chapter08/gawk.xml | 128 ++++ chapter08/gcc.xml | 626 ++++++++++++++++++ chapter08/gdbm.xml | 156 +++++ chapter08/gettext.xml | 445 +++++++++++++ chapter08/glibc.xml | 970 +++++++++++++++++++++++++++ chapter08/gmp.xml | 164 +++++ chapter08/gperf.xml | 95 +++ chapter08/grep.xml | 111 ++++ chapter08/groff.xml | 607 +++++++++++++++++ chapter08/grub.xml | 495 +++++++++----- chapter08/gzip.xml | 236 +++++++ chapter08/iana-etc.xml | 93 +++ chapter08/inetutils.xml | 249 +++++++ chapter08/intltool.xml | 141 ++++ chapter08/introduction.xml | 66 +- chapter08/iproute2.xml | 322 +++++++++ chapter08/kbd.xml | 392 +++++++++++ chapter08/kernel.xml | 403 ----------- chapter08/kmod.xml | 211 ++++++ chapter08/less.xml | 125 ++++ chapter08/libcap.xml | 166 +++++ chapter08/libelf.xml | 88 +++ chapter08/libffi.xml | 133 ++++ chapter08/libpipeline.xml | 92 +++ chapter08/libtool.xml | 129 ++++ chapter08/m4.xml | 104 +++ chapter08/make.xml | 99 +++ chapter08/man-db.xml | 456 +++++++++++++ chapter08/man-pages.xml | 80 +++ chapter08/meson.xml | 109 +++ chapter08/mpc.xml | 100 +++ chapter08/mpfr.xml | 105 +++ chapter08/ncurses.xml | 380 +++++++++++ chapter08/ninja.xml | 132 ++++ chapter08/openssl.xml | 176 +++++ chapter08/patch.xml | 96 +++ chapter08/perl.xml | 522 +++++++++++++++ chapter08/pkgconfig.xml | 121 ++++ chapter08/pkgmgt.xml | 291 ++++++++ chapter08/procps.xml | 292 ++++++++ chapter08/psmisc.xml | 160 +++++ chapter08/python.xml | 253 +++++++ chapter08/readline.xml | 156 +++++ chapter08/revisedchroot.xml | 70 ++ chapter08/sed.xml | 97 +++ chapter08/shadow.xml | 608 +++++++++++++++++ chapter08/strippingagain.xml | 81 +++ chapter08/sysklogd.xml | 136 ++++ chapter08/systemd.xml | 830 +++++++++++++++++++++++ chapter08/sysvinit.xml | 220 +++++++ chapter08/tar.xml | 116 ++++ chapter08/texinfo.xml | 237 +++++++ chapter08/util-linux.xml | 1319 +++++++++++++++++++++++++++++++++++++ chapter08/vim.xml | 319 +++++++++ chapter08/xml-parser.xml | 92 +++ chapter08/xz.xml | 364 ++++++++++ chapter08/zlib.xml | 101 +++ chapter08/zstd.xml | 136 ++++ chapter09/bootscripts.xml | 331 ++++++++++ chapter09/chapter09.xml | 36 +- chapter09/clock.xml | 104 +++ chapter09/consoled.xml | 139 ++++ chapter09/etcshells.xml | 49 ++ chapter09/getcounted.xml | 20 - chapter09/inputrc.xml | 82 +++ chapter09/introduction.xml | 225 +++++++ chapter09/introductiond.xml | 73 ++ chapter09/locale.xml | 152 +++++ chapter09/network.xml | 247 +++++++ chapter09/networkd.xml | 335 ++++++++++ chapter09/profile.xml | 162 +++++ chapter09/reboot.xml | 113 ---- chapter09/symlinks.xml | 256 +++++++ chapter09/systemd-custom.xml | 313 +++++++++ chapter09/theend.xml | 84 --- chapter09/udev.xml | 342 ++++++++++ chapter09/usage.xml | 710 ++++++++++++++++++++ chapter09/whatnow.xml | 92 --- chapter10/chapter10.xml | 19 + chapter10/fstab.xml | 125 ++++ chapter10/grub.xml | 191 ++++++ chapter10/introduction.xml | 18 + chapter10/kernel.xml | 403 +++++++++++ chapter11/chapter11.xml | 19 + chapter11/getcounted.xml | 20 + chapter11/reboot.xml | 113 ++++ chapter11/theend.xml | 84 +++ chapter11/whatnow.xml | 92 +++ general.ent | 6 +- index.xml | 13 +- 273 files changed, 32061 insertions(+), 22639 deletions(-) delete mode 100644 chapter06/aboutdebug.xml delete mode 100644 chapter06/acl.xml delete mode 100644 chapter06/adjusting.xml delete mode 100644 chapter06/attr.xml delete mode 100644 chapter06/autoconf.xml delete mode 100644 chapter06/automake.xml delete mode 100644 chapter06/bc.xml create mode 100644 chapter06/binutils-pass1.xml create mode 100644 chapter06/binutils-pass2.xml delete mode 100644 chapter06/binutils.xml create mode 100644 chapter06/changingowner.xml delete mode 100644 chapter06/check.xml create mode 100644 chapter06/chroot.xml create mode 100644 chapter06/createfiles.xml create mode 100644 chapter06/creatingdirs.xml delete mode 100644 chapter06/dbus.xml create mode 100644 chapter06/dejagnu.xml delete mode 100644 chapter06/e2fsprogs.xml delete mode 100644 chapter06/eudev.xml delete mode 100644 chapter06/expat.xml create mode 100644 chapter06/expect.xml create mode 100644 chapter06/gcc-pass1.xml create mode 100644 chapter06/gcc-pass2.xml delete mode 100644 chapter06/gcc.xml delete mode 100644 chapter06/gdbm.xml create mode 100644 chapter06/generalinstructions.xml delete mode 100644 chapter06/gmp.xml delete mode 100644 chapter06/gperf.xml delete mode 100644 chapter06/groff.xml delete mode 100644 chapter06/grub.xml delete mode 100644 chapter06/iana-etc.xml delete mode 100644 chapter06/inetutils.xml delete mode 100644 chapter06/intltool.xml delete mode 100644 chapter06/iproute2.xml delete mode 100644 chapter06/kbd.xml create mode 100644 chapter06/kernfs.xml delete mode 100644 chapter06/kmod.xml delete mode 100644 chapter06/less.xml delete mode 100644 chapter06/libcap.xml delete mode 100644 chapter06/libelf.xml delete mode 100644 chapter06/libffi.xml delete mode 100644 chapter06/libpipeline.xml create mode 100644 chapter06/libstdc++-pass2.xml create mode 100644 chapter06/libstdc++.xml delete mode 100644 chapter06/libtool.xml create mode 100644 chapter06/linux-headers.xml delete mode 100644 chapter06/man-db.xml delete mode 100644 chapter06/man-pages.xml delete mode 100644 chapter06/meson.xml delete mode 100644 chapter06/mpc.xml delete mode 100644 chapter06/mpfr.xml delete mode 100644 chapter06/ninja.xml delete mode 100644 chapter06/openssl.xml delete mode 100644 chapter06/pkgconfig.xml delete mode 100644 chapter06/pkgmgt.xml delete mode 100644 chapter06/procps.xml delete mode 100644 chapter06/psmisc.xml delete mode 100644 chapter06/readline.xml delete mode 100644 chapter06/revisedchroot.xml delete mode 100644 chapter06/shadow.xml create mode 100644 chapter06/stripping.xml delete mode 100644 chapter06/strippingagain.xml delete mode 100644 chapter06/sysklogd.xml delete mode 100644 chapter06/systemd.xml delete mode 100644 chapter06/sysvinit.xml create mode 100644 chapter06/tcl.xml create mode 100644 chapter06/toolchaintechnotes.xml delete mode 100644 chapter06/vim.xml delete mode 100644 chapter06/xml-parser.xml delete mode 100644 chapter06/zlib.xml delete mode 100644 chapter06/zstd.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 delete mode 100644 chapter07/bootscripts.xml create mode 100644 chapter07/bzip2.xml create mode 100644 chapter07/changingowner.xml create mode 100644 chapter07/chroot.xml delete mode 100644 chapter07/clock.xml delete mode 100644 chapter07/consoled.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 delete mode 100644 chapter07/etcshells.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 delete mode 100644 chapter07/inputrc.xml delete mode 100644 chapter07/introductiond.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 delete mode 100644 chapter07/locale.xml create mode 100644 chapter07/m4.xml create mode 100644 chapter07/make.xml create mode 100644 chapter07/ncurses.xml delete mode 100644 chapter07/network.xml delete mode 100644 chapter07/networkd.xml create mode 100644 chapter07/patch.xml create mode 100644 chapter07/perl.xml delete mode 100644 chapter07/profile.xml create mode 100644 chapter07/python.xml create mode 100644 chapter07/sed.xml create mode 100644 chapter07/stripping.xml delete mode 100644 chapter07/symlinks.xml delete mode 100644 chapter07/systemd-custom.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 delete mode 100644 chapter07/udev.xml delete mode 100644 chapter07/usage.xml create mode 100644 chapter07/util-linux.xml create mode 100644 chapter07/xz.xml create mode 100644 chapter08/aboutdebug.xml create mode 100644 chapter08/acl.xml create mode 100644 chapter08/adjusting.xml create mode 100644 chapter08/attr.xml create mode 100644 chapter08/autoconf.xml create mode 100644 chapter08/automake.xml create mode 100644 chapter08/bash.xml create mode 100644 chapter08/bc.xml create mode 100644 chapter08/binutils.xml create mode 100644 chapter08/bison.xml create mode 100644 chapter08/bzip2.xml create mode 100644 chapter08/check.xml create mode 100644 chapter08/coreutils.xml create mode 100644 chapter08/dbus.xml create mode 100644 chapter08/diffutils.xml create mode 100644 chapter08/e2fsprogs.xml create mode 100644 chapter08/eudev.xml create mode 100644 chapter08/expat.xml create mode 100644 chapter08/file.xml create mode 100644 chapter08/findutils.xml create mode 100644 chapter08/flex.xml delete mode 100644 chapter08/fstab.xml create mode 100644 chapter08/gawk.xml create mode 100644 chapter08/gcc.xml create mode 100644 chapter08/gdbm.xml create mode 100644 chapter08/gettext.xml create mode 100644 chapter08/glibc.xml create mode 100644 chapter08/gmp.xml create mode 100644 chapter08/gperf.xml create mode 100644 chapter08/grep.xml create mode 100644 chapter08/groff.xml create mode 100644 chapter08/gzip.xml create mode 100644 chapter08/iana-etc.xml create mode 100644 chapter08/inetutils.xml create mode 100644 chapter08/intltool.xml create mode 100644 chapter08/iproute2.xml create mode 100644 chapter08/kbd.xml delete mode 100644 chapter08/kernel.xml create mode 100644 chapter08/kmod.xml create mode 100644 chapter08/less.xml create mode 100644 chapter08/libcap.xml create mode 100644 chapter08/libelf.xml create mode 100644 chapter08/libffi.xml create mode 100644 chapter08/libpipeline.xml create mode 100644 chapter08/libtool.xml create mode 100644 chapter08/m4.xml create mode 100644 chapter08/make.xml create mode 100644 chapter08/man-db.xml create mode 100644 chapter08/man-pages.xml create mode 100644 chapter08/meson.xml create mode 100644 chapter08/mpc.xml create mode 100644 chapter08/mpfr.xml create mode 100644 chapter08/ncurses.xml create mode 100644 chapter08/ninja.xml create mode 100644 chapter08/openssl.xml create mode 100644 chapter08/patch.xml create mode 100644 chapter08/perl.xml create mode 100644 chapter08/pkgconfig.xml create mode 100644 chapter08/pkgmgt.xml create mode 100644 chapter08/procps.xml create mode 100644 chapter08/psmisc.xml create mode 100644 chapter08/python.xml create mode 100644 chapter08/readline.xml create mode 100644 chapter08/revisedchroot.xml create mode 100644 chapter08/sed.xml create mode 100644 chapter08/shadow.xml create mode 100644 chapter08/strippingagain.xml create mode 100644 chapter08/sysklogd.xml create mode 100644 chapter08/systemd.xml create mode 100644 chapter08/sysvinit.xml create mode 100644 chapter08/tar.xml create mode 100644 chapter08/texinfo.xml create mode 100644 chapter08/util-linux.xml create mode 100644 chapter08/vim.xml create mode 100644 chapter08/xml-parser.xml create mode 100644 chapter08/xz.xml create mode 100644 chapter08/zlib.xml create mode 100644 chapter08/zstd.xml create mode 100644 chapter09/bootscripts.xml create mode 100644 chapter09/clock.xml create mode 100644 chapter09/consoled.xml create mode 100644 chapter09/etcshells.xml delete mode 100644 chapter09/getcounted.xml create mode 100644 chapter09/inputrc.xml create mode 100644 chapter09/introduction.xml create mode 100644 chapter09/introductiond.xml create mode 100644 chapter09/locale.xml create mode 100644 chapter09/network.xml create mode 100644 chapter09/networkd.xml create mode 100644 chapter09/profile.xml delete mode 100644 chapter09/reboot.xml create mode 100644 chapter09/symlinks.xml create mode 100644 chapter09/systemd-custom.xml delete mode 100644 chapter09/theend.xml create mode 100644 chapter09/udev.xml create mode 100644 chapter09/usage.xml delete mode 100644 chapter09/whatnow.xml create mode 100644 chapter10/chapter10.xml create mode 100644 chapter10/fstab.xml create mode 100644 chapter10/grub.xml create mode 100644 chapter10/introduction.xml create mode 100644 chapter10/kernel.xml create mode 100644 chapter11/chapter11.xml create mode 100644 chapter11/getcounted.xml create mode 100644 chapter11/reboot.xml create mode 100644 chapter11/theend.xml create mode 100644 chapter11/whatnow.xml (limited to 'chapter06/linux-headers.xml') 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/aboutdebug.xml b/chapter06/aboutdebug.xml deleted file mode 100644 index f49618c83..000000000 --- a/chapter06/aboutdebug.xml +++ /dev/null @@ -1,52 +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-aboutdebug"> - <?dbhtml filename="aboutdebug.html"?> - - <title>About Debugging Symbols - - Most programs and libraries are, by default, compiled with - debugging symbols included (with gcc's - -g option). This means that when debugging a - program or library that was compiled with debugging information - included, the debugger can provide not only memory addresses, but also - the names of the routines and variables. - - However, the inclusion of these debugging symbols enlarges a - program or library significantly. The following is an example of the - amount of space these symbols occupy: - - - - A bash binary with debugging symbols: - 1200 KB - - - A bash binary without debugging symbols: - 480 KB - - - Glibc and GCC files (/lib - and /usr/lib) with debugging - symbols: 87 MB - - - Glibc and GCC files without debugging symbols: 16 MB - - - - Sizes may vary depending on which compiler and C library were used, - but when comparing programs with and without debugging symbols, the - difference will usually be a factor between two and five. - - Because most users will never use a debugger on their system software, - a lot of disk space can be regained by removing these symbols. The next - section shows how to strip all debugging symbols from the programs and - libraries. - - diff --git a/chapter06/acl.xml b/chapter06/acl.xml deleted file mode 100644 index f9f2eddbe..000000000 --- a/chapter06/acl.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - %general-entities; -]> - - - - - - acl - &acl-version; -
&acl-url;
-
- - Acl-&acl-version; - - - Acl - - - - - - <para>The Acl package contains utilities to administer Access Control Lists, - which are used to define more fine-grained discretionary access rights for - files and directories.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&acl-ch6-sbu;</seg> - <seg>&acl-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Acl - - Prepare Acl for compilation: - -./configure --prefix=/usr \ - --bindir=/bin \ - --disable-static \ - --libexecdir=/usr/lib \ - --docdir=/usr/share/doc/acl-&acl-version; - - -./configure --prefix=/usr \ - --disable-static \ - --libexecdir=/usr/lib \ - --docdir=/usr/share/doc/acl-&acl-version; - - Compile the package: - -make - - The Acl tests need to be run on a filesystem that supports access - controls after Coreutils has been built with the - Acl libraries. If desired, return to this package and run make - check after Coreutils has been built - later in this chapter. - - Install the package: - -make install - - The shared library needs to be moved to - /lib, and as a result the - .so file in - /usr/lib will need to be recreated: - -mv -v /usr/lib/libacl.so.* /lib -ln -sfv ../../lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so - - - - - Contents of Acl - - - Installed programs - Installed library - Installed directories - - - chacl, getfacl, and setfacl - libacl.so - /usr/include/acl and /usr/share/doc/acl-&acl-version; - - - - - Short Descriptions - - - - - chacl - - Changes the access control list of a file - or directory - - chacl - - - - - - getfacl - - Gets file access control lists - - getfacl - - - - - - setfacl - - Sets file access control lists - - setfacl - - - - - - libacl - - Contains the library functions for manipulating Access Control Lists - - libacl - - - - - - - - -
diff --git a/chapter06/adjusting.xml b/chapter06/adjusting.xml deleted file mode 100644 index 3e6b49e19..000000000 --- a/chapter06/adjusting.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - %general-entities; -]> - - - - - Adjusting the Toolchain - - Now that the final C libraries have been installed, it is time to adjust - the toolchain so that it will link any - newly compiled program against these new libraries. - - First, backup the /tools linker, - and replace it with the adjusted linker we made in chapter 5. We'll also create - a link to its counterpart in - /tools/$(uname -m)-pc-linux-gnu/bin: - -mv -v /tools/bin/{ld,ld-old} -mv -v /tools/$(uname -m)-pc-linux-gnu/bin/{ld,ld-old} -mv -v /tools/bin/{ld-new,ld} -ln -sv /tools/bin/ld /tools/$(uname -m)-pc-linux-gnu/bin/ld - - the next command amends the GCC specs file to achieve three goals: - first point GCC to the new dynamic linker. Simply deleting all instances of - /tools should leave us with the correct path to the dynamic - linker. Second, let GCC know where to find the Glibc start files. Third, - add the /usr/include directory at the end of the default search path, so - that header files added in chapter 6 are found. - A sed command accomplishes this: - -gcc -dumpspecs | sed -e 's@/tools@@g' \ - -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \ - -e '/\*cpp:/{n;s@$@ -idirafter /usr/include@}' > \ - `dirname $(gcc --print-libgcc-file-name)`/specs - - It is a good idea to visually inspect the specs file to verify the - intended change was actually made. - - It is imperative at this point to ensure that the basic - functions (compiling and linking) of the adjusted toolchain are working - as expected. To do this, perform the following sanity checks: - -echo 'int main(){}' > dummy.c -cc dummy.c -v -Wl,--verbose &> dummy.log -readelf -l a.out | grep ': /lib' - - There should be no errors, - and the output of the last command will be (allowing for - platform-specific differences in dynamic linker name): - -[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] - - Note that on 64-bit systems /lib is - the location of our dynamic linker, but is accessed via a symbolic link - in /lib64. - - On 32-bit systems the interpreter should be - /lib/ld-linux.so.2. - - Now make sure that we're setup to use the correct start files: - -grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log - - The output of the last command should be: - -/usr/lib/../lib/crt1.o succeeded -/usr/lib/../lib/crti.o succeeded -/usr/lib/../lib/crtn.o succeeded - - Verify that the compiler is searching for the correct header - files: - -grep -B4 '^ /usr/include' dummy.log - - This command should return the following output: - -#include <...> search starts here: - /tools/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include - /tools/include - /tools/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include-fixed - /usr/include - - On a 32 bit system, x86_64 is replaced with i686. - - Next, verify that the new linker is being used with the correct search paths: - -grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' - - References to paths that have components with '-linux-gnu' should - be ignored, but otherwise the output of the last command should be: - -SEARCH_DIR("/usr/lib") -SEARCH_DIR("/lib") - - Next make sure that we're using the correct libc: - -grep "/lib.*/libc.so.6 " dummy.log - - The output of the last command should be: - -attempt to open /lib/libc.so.6 succeeded - - Lastly, make sure GCC is using the correct dynamic linker: - -grep found dummy.log - - The output of the last command should be (allowing for - platform-specific differences in dynamic linker name): - -found ld-linux-x86-64.so.2 at /lib/ld-linux-x86-64.so.2 - - If the output does not appear as shown above or is not received - at all, then something is seriously wrong. Investigate and retrace the - steps to find out where the problem is and correct it. The most likely - reason is that something went wrong with the specs file adjustment. Any - issues will need to be resolved before continuing with the process. - - Once everything is working correctly, clean up the test files: - -rm -v dummy.c a.out dummy.log - - diff --git a/chapter06/attr.xml b/chapter06/attr.xml deleted file mode 100644 index 10c6eec53..000000000 --- a/chapter06/attr.xml +++ /dev/null @@ -1,147 +0,0 @@ - - - %general-entities; -]> - - - - - - attr - &attr-version; -
&attr-url;
-
- - Attr-&attr-version; - - - Attr - - - - - - <para>The attr package contains utilities to administer the extended - attributes on filesystem objects.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&attr-ch6-sbu;</seg> - <seg>&attr-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Attr - - Prepare Attr for compilation: - - -./configure --prefix=/usr \ - --bindir=/bin \ - --disable-static \ - --sysconfdir=/etc \ - --docdir=/usr/share/doc/attr-&attr-version; - - -./configure --prefix=/usr \ - --disable-static \ - --sysconfdir=/etc \ - --docdir=/usr/share/doc/attr-&attr-version; - - Compile the package: - -make - - The tests need to be run on a filesystem that supports extended - attributes such as the ext2, ext3, or ext4 filesystems. - To test the results, issue: - -make check - - Install the package: - -make install - - The shared library needs to be moved to - /lib, and as a result the - .so file in - /usr/lib will need to be recreated: - -mv -v /usr/lib/libattr.so.* /lib -ln -sfv ../../lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.so - - - - - Contents of Attr - - - Installed programs - Installed library - Installed directories - - - attr, getfattr, and setfattr - libattr.so - /usr/include/attr and /usr/share/doc/attr-&attr-version; - - - - - Short Descriptions - - - - - attr - - Extends attributes on filesystem objects - - attr - - - - - - getfattr - - Gets the extended attributes of filesystem objects - - getfattr - - - - - - setfattr - - Sets the extended attributes of filesystem objects - - setfattr - - - - - - libattr - - Contains the library functions for manipulating extended attributes - - libattr - - - - - - - - -
diff --git a/chapter06/autoconf.xml b/chapter06/autoconf.xml deleted file mode 100644 index 6652747fd..000000000 --- a/chapter06/autoconf.xml +++ /dev/null @@ -1,194 +0,0 @@ - - - %general-entities; -]> - - - - - - autoconf - &autoconf-version; -
&autoconf-url;
-
- - Autoconf-&autoconf-version; - - - Autoconf - - - - - - <para>The Autoconf package contains programs for producing shell scripts that - can automatically configure source code.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&autoconf-ch6-sbu;</seg> - <seg>&autoconf-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Autoconf - - First, fix a bug generated by Perl 5.28. - -sed '361 s/{/\\{/' -i bin/autoscan.in - - Prepare Autoconf for compilation: - -./configure --prefix=/usr - - Compile the package: - -make - - The test suite is currently broken by bash-5 and libtool-2.4.3. - To run the tests anyway, issue: - -make check - - Install the package: - -make install - - - - - Contents of Autoconf - - - Installed programs - Installed directory - - - autoconf, autoheader, autom4te, autoreconf, autoscan, autoupdate, - and ifnames - /usr/share/autoconf - - - - - Short Descriptions - - - - - autoconf - - Produces shell scripts that automatically configure software - source code packages to adapt to many kinds of Unix-like systems; - the configuration scripts it produces are independent—running - them does not require the autoconf program - - autoconf - - - - - - autoheader - - A tool for creating template files of C - #define statements for configure to use - - autoheader - - - - - - autom4te - - A wrapper for the M4 macro processor - - autom4te - - - - - - autoreconf - - Automatically runs autoconf, - autoheader, aclocal, - automake, gettextize, and - libtoolize in the correct order to save time - when changes are made to autoconf and - automake template files - - autoreconf - - - - - - autoscan - - Helps to create a configure.in file for a - software package; it examines the source files in a directory tree, - searching them for common portability issues, and creates a - configure.scan file that serves as as a - preliminary configure.in file for the - package - - autoscan - - - - - - autoupdate - - Modifies a configure.in file that still - calls autoconf macros by their old names to use the - current macro names - - autoupdate - - - - - - ifnames - - Helps when writing configure.in files - for a software package; it prints the identifiers that the package - uses in C preprocessor conditionals [If a package has already been set - up to have some portability, this program can help determine what - configure needs to check for. It can also fill in - gaps in a configure.in file generated by - autoscan.] - - ifnames - - - - - - - - -
diff --git a/chapter06/automake.xml b/chapter06/automake.xml deleted file mode 100644 index 11dccfad3..000000000 --- a/chapter06/automake.xml +++ /dev/null @@ -1,155 +0,0 @@ - - - %general-entities; -]> - - - - - - automake - &automake-version; -
&automake-url;
-
- - Automake-&automake-version; - - - Automake - - - - - - <para>The Automake package contains programs for generating Makefiles for use - with Autoconf.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&automake-ch6-sbu;</seg> - <seg>&automake-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Automake - - Fix a failing test: - -sed -i "s/''/etags/" t/tags-lisp-space.sh - - Prepare Automake for compilation: - -./configure --prefix=/usr --docdir=/usr/share/doc/automake-&automake-version; - - Compile the package: - -make - - - - Using the -j4 make option speeds up the tests, even on systems with - only one processor, due to internal delays in individual tests. To test - the results, issue: - - - -make -j4 check - - - One test is known to fail in the LFS environment: - tags-lisp-space.sh. - - Install the package: - -make install - - - - - - Contents of Automake - - - Installed programs - Installed directories - - - aclocal, aclocal-&am-minor-version; (hard linked with aclocal), automake, and - automake-&am-minor-version; (hard linked with automake) - /usr/share/aclocal-&am-minor-version;, /usr/share/automake-&am-minor-version;, and - /usr/share/doc/automake-&automake-version; - - - - - Short Descriptions - - - - - aclocal - - Generates aclocal.m4 files based on the - contents of configure.in files - - aclocal - - - - - - aclocal-&am-minor-version; - - A hard link to aclocal - - aclocal-&am-minor-version; - - - - - - automake - - A tool for automatically generating - Makefile.in files from - Makefile.am files [To create all the - Makefile.in files for a package, run this program - in the top-level directory. By scanning the - configure.in file, it automatically finds each - appropriate Makefile.am file and generates the - corresponding Makefile.in file.] - - automake - - - - - - automake-&am-minor-version; - - A hard link to automake - - automake-&am-minor-version; - - - - - - - - -
diff --git a/chapter06/bash.xml b/chapter06/bash.xml index 650c33ade..92627e92c 100644 --- a/chapter06/bash.xml +++ b/chapter06/bash.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,22 +16,25 @@ Bash-&bash-version; - + Bash + tools - <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. - - To prepare the tests, ensure that the tester user can write to the sources tree: - -chown -Rv tester . + Install the package: - Now, run the tests as the tester user: +make DESTDIR=$LFS install -su tester << EOF -PATH=$PATH make tests < $(tty) -EOF - - Install the package and move the main executable to - /bin: + Move the excutable to where it is expected to be: -make install -mv -vf /usr/bin/bash /bin +mv $LFS/usr/bin/bash $LFS/bin/bash - Run the newly compiled bash program (replacing the one that is - currently being executed): + Make a link for the programs that use sh for + a shell: -exec /bin/bash --login +h - - - The parameters used make the bash - process an interactive login shell and continue to disable hashing so - that new programs are found as they become available. - +ln -sv bash $LFS/bin/sh - - Contents of Bash - - - Installed programs - Installed directory - - - bash, bashbug, and sh (link to bash) - /usr/include/bash, /usr/lib/bash, and - /usr/share/doc/bash-&bash-version; - - - - - Short Descriptions - - - - - bash - - A widely-used command interpreter; it performs many types of - expansions and substitutions on a given command line before executing - it, thus making this interpreter a powerful tool - - bash - - - - - - bashbug - - A shell script to help the user compose and mail standard - formatted bug reports concerning bash - - bashbug - - - - - - sh - - A symlink to the bash program; when invoked - as sh, bash tries to mimic the - startup behavior of historical versions of sh as - closely as possible, while conforming to the POSIX standard as - well - - sh - - - + + - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-bash" role="."/></para> </sect2> diff --git a/chapter06/bc.xml b/chapter06/bc.xml deleted file mode 100644 index d848ad365..000000000 --- a/chapter06/bc.xml +++ /dev/null @@ -1,129 +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-bc" role="wrap"> - <?dbhtml filename="bc.html"?> - - <sect1info condition="script"> - <productname>bc</productname> - <productnumber>&bc-version;</productnumber> - <address>&bc-url;</address> - </sect1info> - - <title>Bc-&bc-version; - - - Bc - - - - - - <para>The Bc package contains an arbitrary precision numeric processing - language.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&bc-ch6-sbu;</seg> - <seg>&bc-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Bc - - Prepare Bc for compilation: - -PREFIX=/usr CC=gcc CFLAGS="-std=c99" ./configure.sh -G -O3 - - - The meaning of the configure options: - - - CC=gcc CFLAGS="-std=c99" - - These parameters specify the compiler and the C standard to use. - - - - - -O3 - - Specify the optimization to use. - - - - - -G - - Omit parts of the test suite that won't work - without a GNU bc present. - - - - - Compile the package: - -make - - To test bc, run: - -make test - - - Install the package: - -make install - - - - - Contents of Bc - - - Installed programs - - - bc and dc - - - - - Short Descriptions - - - - - bc - - A command line calculator - - bc - - - - - - dc - - A reverse-polish command line calculator - - dc - - - - - - - - - diff --git a/chapter06/binutils-pass1.xml b/chapter06/binutils-pass1.xml new file mode 100644 index 000000000..8658cfcfe --- /dev/null +++ b/chapter06/binutils-pass1.xml @@ -0,0 +1,156 @@ + + + %general-entities; +]> + + + + + + binutils-pass1 + &binutils-version; +
&binutils-url;
+
+ + Binutils-&binutils-version; - Pass 1 + + + Binutils + tools, pass 1 + + + + + + <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/binutils.xml b/chapter06/binutils.xml deleted file mode 100644 index 04dbd199c..000000000 --- a/chapter06/binutils.xml +++ /dev/null @@ -1,436 +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-binutils" role="wrap"> - <?dbhtml filename="binutils.html"?> - - <sect1info condition="script"> - <productname>binutils</productname> - <productnumber>&binutils-version;</productnumber> - <address>&binutils-url;</address> - </sect1info> - - <title>Binutils-&binutils-version; - - - Binutils - - - - - - <para>The Binutils package contains a linker, an assembler, and other - tools for handling object files.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&binutils-ch6-sbu;</seg> - <seg>&binutils-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Binutils - - Verify that the PTYs are working properly inside the chroot - environment by performing a simple test: - -expect -c "spawn ls" - - This command should output the following: - -spawn ls - - If, instead, the output includes the message below, then the environment - is not set up for proper PTY operation. This issue needs to be resolved before - running the test suites for Binutils and GCC: - -The system has no more ptys. -Ask your system administrator to create more. - - Now remove one test that prevents the tests from running - to completion, and fix other tests in the gold test suite, which - need to be adjusted for GCC 10: - -sed -i '/@\tincremental_copy/d' gold/testsuite/Makefile.in -patch -Np1 -i ../binutils-&binutils-version;-gcc10_gold_test_fix-1.patch - - The Binutils documentation recommends building Binutils - in a dedicated build directory: - -mkdir -v build -cd build - - Prepare Binutils for compilation: - -../configure --prefix=/usr \ - --enable-gold \ - --enable-ld=default \ - --enable-plugins \ - --enable-shared \ - --disable-werror \ - --enable-64-bit-bfd \ - --with-system-zlib - - The meaning of the configure parameters: - - - --enable-gold - - Build the gold linker and install it as ld.gold (along side the - default linker). - - - - - --enable-ld=default - - Build the original bfd linker and install it as both ld (the - default linker) and ld.bfd. - - - - - --enable-plugins - - Enables plugin support for the linker. - - - - - --enable-64-bit-bfd - - Enables 64-bit support (on hosts with narrower word sizes). - May not be needed on 64-bit systems, but does no harm. - - - - - --with-system-zlib - - Use the installed zlib library rather than building the - included version. - - - - - - Compile the package: - -make tooldir=/usr - - - The meaning of the make parameter: - - - tooldir=/usr - - Normally, the tooldir (the directory where the executables will - ultimately be located) is set to $(exec_prefix)/$(target_alias). For - example, x86_64 machines would expand that to /usr/x86_64-unknown-linux-gnu. Because this is - a custom system, this target-specific directory in /usr is not required. $(exec_prefix)/$(target_alias) would be - used if the system was used to cross-compile (for example, compiling a - package on an Intel machine that generates code that can be executed - on PowerPC machines). - - - - - - - The test suite for Binutils in this section is considered critical. - Do not skip it under any circumstances. - - - Test the results: - -make -k check - - - - Install the package: - -make tooldir=/usr install - - - - - Contents of Binutils - - - Installed programs - Installed libraries - Installed directory - - - addr2line, ar, as, c++filt, dwp, elfedit, gprof, ld, ld.bfd, ld.gold, nm, - objcopy, objdump, ranlib, readelf, size, strings, and strip - libbfd.{a,so} and libopcodes.{a,so} - /usr/lib/ldscripts - - - - - Short Descriptions - - - - - addr2line - - Translates program addresses to file names and line numbers; - given an address and the name of an executable, it uses the debugging - information in the executable to determine which source file and line - number are associated with the address - - addr2line - - - - - - ar - - Creates, modifies, and extracts from archives - - ar - - - - - - as - - An assembler that assembles the output of gcc - into object files - - as - - - - - - c++filt - - Used by the linker to de-mangle C++ and Java symbols and to keep - overloaded functions from clashing - - c++filt - - - - - - dwp - - The DWARF packaging utility - - dwp - - - - - - elfedit - - Updates the ELF header of ELF files - - elfedit - - - - - - gprof - - Displays call graph profile data - - gprof - - - - - - ld - - A linker that combines a number of object and archive files - into a single file, relocating their data and tying up symbol - references - - ld - - - - - - ld.gold - - A cut down version of ld that only supports the - elf object file format - - ld.gold - - - - - - ld.bfd - - Hard link to ld - - ld.bfd - - - - - - nm - - Lists the symbols occurring in a given object file - - nm - - - - - - objcopy - - Translates one type of object file into another - - objcopy - - - - - - objdump - - Displays information about the given object file, with options - controlling the particular information to display; the information - shown is useful to programmers who are working on the compilation - tools - - objdump - - - - - - ranlib - - Generates an index of the contents of an archive and stores it - in the archive; the index lists all of the symbols defined by archive - members that are relocatable object files - - ranlib - - - - - - readelf - - Displays information about ELF type binaries - - readelf - - - - - - size - - Lists the section sizes and the total size for the given - object files - - size - - - - - - strings - - Outputs, for each given file, the sequences of printable - characters that are of at least the specified length (defaulting to - four); for object files, it prints, by default, only the strings from - the initializing and loading sections while for other types of files, it - scans the entire file - - strings - - - - - - strip - - Discards symbols from object files - - strip - - - - - - libbfd - - The Binary File Descriptor library - - libbfd - - - - - - libctf - - The Compat ANSI-C Type Format debugging support library - - libctf - - - - - - libctf-nobfd - - A libctf variant which does not use libbfd functionality - - libctf-nobfd - - - - - - libopcodes - - A library for dealing with opcodes—the readable - text versions of instructions for the processor; - it is used for building utilities like - objdump - - libopcodes - - - - - - - - -
diff --git a/chapter06/bison.xml b/chapter06/bison.xml index 23b6f0a95..afe84a403 100644 --- a/chapter06/bison.xml +++ b/chapter06/bison.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,22 +16,25 @@ Bison-&bison-version; - + Bison + tools - <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; - + 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 - - - + + - </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/check.xml b/chapter06/check.xml deleted file mode 100644 index bd4306b28..000000000 --- a/chapter06/check.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - %general-entities; -]> - - - - - - check - &check-version; -
&check-url;
-
- - Check-&check-version; - - - Check - - - - - - <para>Check is a unit testing framework for C.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&check-ch5-sbu;</seg> - <seg>&check-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Check - - Prepare Check for compilation: - -./configure --prefix=/usr - - Build the package: - -make - - Compilation is now complete. To run the Check test suite, issue the - following command: - -make check - - Note that the Check test suite may take a relatively long - (up to 4 SBU) time. - - Install the package: - - make docdir=/usr/share/doc/check-&check-version; install - - - - - Contents of Check - - - Installed program - Installed library - - - checkmk - libcheck.{a,so} - - - - - Short Descriptions - - - - - checkmk - - Awk script for generating C unit tests for use with the Check - unit testing framework - - checkmk - - - - - - libcheck.{a,so} - - Contains functions that allow Check to be called from a test - program - - libcheck - - - - - - - - -
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 - - 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 + --enable-install-program=hostname - 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 - - 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: +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 - - 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 - - - + + - </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/dbus.xml b/chapter06/dbus.xml deleted file mode 100644 index bb4bffc76..000000000 --- a/chapter06/dbus.xml +++ /dev/null @@ -1,241 +0,0 @@ - - - %general-entities; -]> - - - - - - dbus - &dbus-version; -
&dbus-url;
-
- - D-Bus-&dbus-version; - - - D-Bus - - - - - - <para>D-Bus is a message bus system, a simple way for applications to talk - to one another. D-Bus supplies both a system daemon (for events such as - "new hardware device added" or "printer queue changed") and a - per-user-login-session daemon (for general IPC needs among user - applications). Also, the message bus is built on top of a general one-to-one - message passing framework, which can be used by any two applications to - communicate directly (without going through the message bus daemon).</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&dbus-ch6-sbu;</seg> - <seg>&dbus-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of D-Bus - - Prepare D-Bus for compilation: - -./configure --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - --disable-static \ - --disable-doxygen-docs \ - --disable-xml-docs \ - --docdir=/usr/share/doc/dbus-&dbus-version; \ - --with-console-auth-dir=/run/console - - - The meaning of the configure options: - - - --with-console-auth-dir=/run/console - - This specifies the location of the ConsoleKit auth - directory. - - - - - - Compile the package: - -make - - This package does come with a test suite, but it requires several - packages that are not included in LFS. Instructions for running the - test suite can be found in the BLFS book at - . - - Install the package: - -make install - - The shared library needs to be moved to - /lib, and as a result the - .so file in - /usr/lib will need to be recreated: - -mv -v /usr/lib/libdbus-1.so.* /lib -ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so - - Create a symlink, so that D-Bus and systemd can use the same - machine-id file: - -ln -sfv /etc/machine-id /var/lib/dbus - - Move the socket file to /run instead of the deprecated - /var/run: - - sed -i 's:/var/run:/run:' /lib/systemd/system/dbus.socket - - - - - Contents of D-Bus - - - Installed programs - Installed libraries - Installed directories - - - dbus-cleanup-sockets, dbus-daemon, dbus-launch, dbus-monitor, - dbus-run-session, dbus-send, dbus-test-tool, - dbus-update-activation-environment, and dbus-uuidgen - libdbus-1.{a,so} - /etc/dbus-1, /usr/include/dbus-1.0, /usr/lib/dbus-1.0, - /usr/share/dbus-1, /usr/share/doc/dbus-&dbus-version;, - and /var/lib/dbus - - - - - Short Descriptions - - - - - dbus-cleanup-sockets - - Used to clean up leftover sockets in a directory - - dbus-cleanup-sockets - - - - - - dbus-daemon - - The D-Bus message bus daemon - - dbus-daemon - - - - - - dbus-launch - - Starts dbus-daemon from a shell - script - - dbus-launch - - - - - - dbus-monitor - - Monitors messages passing through a D-Bus message bus - - dbus-monitor - - - - - - dbus-run-session - - Starts a session bus instance of dbus-daemon - from a shell script and starts a specified program in that - session - - dbus-run-session - - - - - - dbus-send - - Sends a message to a D-Bus message bus - - dbus-send - - - - - - dbus-test-tool - - A tool to help packages test - D-Bus - - dbus-test-tool - - - - - - - dbus-update-activation-environment - - Updates environment variables that will be set for - D-Bus session services - - dbus-update-activation-environment - - - - - - dbus-uuidgen - - Generates a universally unique ID - - dbus-uuidgen - - - - - - libdbus-1 - - Contains API functions used to communicate with the D-Bus - message bus - - libdbus-1 - - - - - - - - -
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/e2fsprogs.xml b/chapter06/e2fsprogs.xml deleted file mode 100644 index 984ba6db9..000000000 --- a/chapter06/e2fsprogs.xml +++ /dev/null @@ -1,541 +0,0 @@ - - - %general-entities; -]> - - - - - - e2fsprogs - &e2fsprogs-version; -
&e2fsprogs-url;
-
- - E2fsprogs-&e2fsprogs-version; - - - E2fsprogs - - - - - - <para>The E2fsprogs package contains the utilities for handling the - <systemitem class="filesystem">ext2</systemitem> file system. It also - supports the <systemitem class="filesystem">ext3</systemitem> and - <systemitem class="filesystem">ext4</systemitem> journaling - file systems.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&e2fsprogs-ch6-sbu;</seg> - <seg>&e2fsprogs-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of E2fsprogs - - The E2fsprogs documentation recommends that the package be built in - a subdirectory of the source tree: - -mkdir -v build -cd build - - Prepare E2fsprogs for compilation: - -../configure --prefix=/usr \ - --bindir=/bin \ - --with-root-prefix="" \ - --enable-elf-shlibs \ - --disable-libblkid \ - --disable-libuuid \ - --disable-uuidd \ - --disable-fsck - - - The meaning of the environment variable and configure options: - - - --with-root-prefix="" and - --bindir=/bin - - Certain programs (such as the e2fsck - program) are considered essential programs. When, for example, - /usr is not mounted, these - programs still need to be available. They belong in directories - like /lib and /sbin. If this option is not passed - to E2fsprogs' configure, the programs are installed into the - /usr directory. - - - - - --enable-elf-shlibs - - This creates the shared libraries which some programs - in this package use. - - - - - --disable-* - - This prevents E2fsprogs from building and installing the - libuuid and - libblkid libraries, the - uuidd daemon, and the - fsck wrapper, as Util-Linux installs more - recent versions. - - - - - - Compile the package: - -make - - To run the tests, issue: - -make check - - One of the E2fsprogs tests will attempt to allocate 256 MB of memory. - If you do not have significantly more RAM than this, be sure to enable - sufficient swap space for the test. See and - for details on creating and enabling swap space. - - Install the package: - -make install - - Make the installed static libraries writable so debugging symbols can - be removed later: - -chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a - - This package installs a gzipped - .info file but doesn't update the - system-wide dir file. Unzip this file and then update - the system dir file using the following - commands: - -gunzip -v /usr/share/info/libext2fs.info.gz -install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info - - If desired, create and install some additional documentation by - issuing the following commands: - -makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo -install -v -m644 doc/com_err.info /usr/share/info -install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info - - - - Contents of E2fsprogs - - - Installed programs - Installed libraries - Installed directories - - - badblocks, chattr, compile_et, debugfs, dumpe2fs, e2freefrag, - e2fsck, e2image, e2label, e2mmpstatus, e2scrub, e2scrub_all, e2undo, - e4crypt, e4defrag, filefrag, fsck.ext2, - fsck.ext3, fsck.ext4, logsave, lsattr, mk_cmds, mke2fs, - mkfs.ext2, mkfs.ext3, mkfs.ext4, mklost+found, - resize2fs, and tune2fs - libcom_err.so, libe2p.so, libext2fs.so, and libss.so - /usr/include/e2p, /usr/include/et, /usr/include/ext2fs, - /usr/include/ss, /usr/lib/e2fsprogs, /usr/share/et, and - /usr/share/ss - - - - - Short Descriptions - - - - - badblocks - - Searches a device (usually a disk partition) for bad - blocks - - badblocks - - - - - - chattr - - Changes the attributes of files on an ext2 file system; it also - changes ext3 - file systems, the journaling version of ext2 file systems - - chattr - - - - - - compile_et - - An error table compiler; it converts a table of error-code - names and messages into a C source file suitable for use with the - com_err library - - compile_et - - - - - - debugfs - - A file system debugger; it can be used to examine and change - the state of an ext2 - file system - - debugfs - - - - - - dumpe2fs - - Prints the super block and blocks group information for the - file system present on a given device - - dumpe2fs - - - - - - e2freefrag - - Reports free space fragmentation information - - e2freefrag - - - - - - e2fsck - - Is used to check, and optionally repair ext2 file systems and ext3 file systems - - e2fsck - - - - - - e2image - - Is used to save critical ext2 file system data to a file - - e2image - - - - - - e2label - - Displays or changes the file system label on the ext2 file system present on a given - device - - e2label - - - - - - e2mmpstatus - - Checks MMP status of an ext4 filesystem - - e2mmpstatus - - - - - - e2scrub - - Checks the contents of a mounted ext[234] filesystem - - e2scrub - - - - - - e2scrub_all - - Checks all mounted ext[234] filesystems for errors - - e2scrub_all - - - - - - e2undo - - Replays the undo log undo_log for an ext2/ext3/ext4 filesystem - found on a device [This can be used to undo a failed operation by an - e2fsprogs program.] - - e2undo - - - - - - e4crypt - - Ext4 filesystem encryption utility - - e4crypt - - - - - - e4defrag - - Online defragmenter for ext4 filesystems - - e4defrag - - - - - - filefrag - - Reports on how badly fragmented a particular file might be - - filefrag - - - - - - fsck.ext2 - - By default checks ext2 - file systems and is a hard link to e2fsck - - fsck.ext2 - - - - - - fsck.ext3 - - By default checks ext3 - file systems and is a hard link to e2fsck - - fsck.ext3 - - - - - - fsck.ext4 - - By default checks ext4 - file systems and is a hard link to e2fsck - - fsck.ext4 - - - - - - logsave - - Saves the output of a command in a log file - - logsave - - - - - - lsattr - - Lists the attributes of files on a second extended file - system - - lsattr - - - - - - mk_cmds - - Converts a table of command names and help messages into a C - source file suitable for use with the libss subsystem library - - mk_cmds - - - - - - mke2fs - - Creates an ext2 - or ext3 file system on - the given device - - mke2fs - - - - - - mkfs.ext2 - - By default creates ext2 - file systems and is a hard link to mke2fs - - mkfs.ext2 - - - - - - mkfs.ext3 - - By default creates ext3 - file systems and is a hard link to mke2fs - - mkfs.ext3 - - - - - - mkfs.ext4 - - By default creates ext4 - file systems and is a hard link to mke2fs - - mkfs.ext4 - - - - - - mklost+found - - Used to create a lost+found - directory on an ext2 file - system; it pre-allocates disk blocks to this directory to lighten the - task of e2fsck - - mklost+found - - - - - - resize2fs - - Can be used to enlarge or shrink an ext2 file system - - resize2fs - - - - - - tune2fs - - Adjusts tunable file system parameters on an ext2 file system - - tune2fs - - - - - - libcom_err - - The common error display routine - - libcom_err - - - - - - libe2p - - Used by dumpe2fs, chattr, - and lsattr - - libe2p - - - - - - libext2fs - - Contains routines to enable user-level programs to manipulate an - ext2 file system - - libext2fs - - - - - - libss - - Used by debugfs - - libss - - - - - - - - -
diff --git a/chapter06/eudev.xml b/chapter06/eudev.xml deleted file mode 100644 index 71511c3e7..000000000 --- a/chapter06/eudev.xml +++ /dev/null @@ -1,191 +0,0 @@ - - - %general-entities; -]> - - - - - - eudev - &eudev-version; -
&eudev-url;
-
- - Eudev-&eudev-version; - - - Eudev - - - - - - <para>The Eudev package contains programs for dynamic creation of device - nodes.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&eudev-ch6-sbu;</seg> - <seg>&eudev-ch6-du;</seg> - </seglistitem> - </segmentedlist> - </sect2> - - <sect2 role="installation"> - <title>Installation of Eudev - - - - Prepare Eudev for compilation: - -./configure --prefix=/usr \ - --bindir=/sbin \ - --sbindir=/sbin \ - --libdir=/usr/lib \ - --sysconfdir=/etc \ - --libexecdir=/lib \ - --with-rootprefix= \ - --with-rootlibdir=/lib \ - --enable-manpages \ - --disable-static - - Compile the package: - -make - - Create some directories now that are needed for tests, but - will also be used as a part of installation: - -mkdir -pv /lib/udev/rules.d -mkdir -pv /etc/udev/rules.d - - To test the results, issue: - -make check - - Install the package: - -make install - - Install some custom rules and support files useful in an LFS - environment: - -tar -xvf ../&udev-lfs-version;.tar.xz -make -f &udev-lfs-version;/Makefile.lfs install - - - - - Configuring Eudev - - - Eudev - configuring - - - - /etc/udev/hwdb.bin - - - Information about hardware devices is maintained in the - /etc/udev/hwdb.d and - /lib/udev/hwdb.d directories. - Eudev needs that information to be compiled - into a binary database /etc/udev/hwdb.bin. Create the - initial database: - -udevadm hwdb --update - - This command needs to be run each time the hardware information is - updated. - - - - - Contents of Eudev - - - Installed programs - Installed libraries - Installed directories - - - udevadm and udevd - - libudev.so - - /etc/udev, /lib/udev, and /usr/share/doc/udev-&udev-lfs-version; - - - - - Short Descriptions - - - - udevadm - - Generic udev administration tool: controls the udevd daemon, - provides info from the Udev database, monitors uevents, waits for - uevents to finish, tests Udev configuration, and triggers uevents - for a given device - - udevadm - - - - - - udevd - - A daemon that listens for uevents on the netlink socket, - creates devices and runs the configured external programs in - response to these uevents - - udevd - - - - - - libudev - - A library interface to udev device information - - libudev - - - - - - /etc/udev - - Contains Udev configuration files, - device permissions, and rules for device naming - - /etc/udev - - - - - - - - -
diff --git a/chapter06/expat.xml b/chapter06/expat.xml deleted file mode 100644 index df9f709c9..000000000 --- a/chapter06/expat.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - %general-entities; -]> - - - - - - expat - &expat-version; -
&expat-url;
-
- - Expat-&expat-version; - - - Expat - - - - - - <para>The Expat package contains a stream oriented C library for - parsing XML.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&expat-ch6-sbu;</seg> - <seg>&expat-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Expat - - First fix a problem with the regression tests in the LFS environment: - -sed -i 's|usr/bin/env |bin/|' run.sh.in - - Prepare Expat for compilation: - -./configure --prefix=/usr \ - --disable-static \ - --docdir=/usr/share/doc/expat-&expat-version; - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make install - - If desired, install the documentation: - -install -v -m644 doc/*.{html,png,css} /usr/share/doc/expat-&expat-version; - - - - - Contents of Expat - - - Installed program - Installed libraries - Installed directory - - - xmlwf - libexpat.so - /usr/share/doc/expat-&expat-version; - - - - - Short Descriptions - - - - - xmlwf - - Is a non-validating utility to check whether or not - XML documents are well formed - - xmlwf - - - - - - libexpat - - Contains API functions for parsing XML - - libexpat - - - - - - - - -
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 - - 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: +make DESTDIR=$LFS install - Some packages in BLFS and beyond expect the - find program in /bin, so make sure it's placed there: + Move the excutable to its final expected location: -mv -v /usr/bin/find /bin -sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb +mv -v $LFS/usr/bin/find $LFS/bin +sed -i 's|find:=${BINDIR}|find:=/bin|' $LFS/usr/bin/updatedb - - Contents of Findutils - - - Installed programs - Installed directory - - - find, locate, updatedb, and xargs - /var/lib/locate - - - + + - <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 - - - 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 - - - + + - </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 - - - 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; - - + + - <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/gcc.xml b/chapter06/gcc.xml deleted file mode 100644 index 9e4c53ec5..000000000 --- a/chapter06/gcc.xml +++ /dev/null @@ -1,626 +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-gcc" role="wrap"> - <?dbhtml filename="gcc.html"?> - - <sect1info condition="script"> - <productname>gcc</productname> - <productnumber>&gcc-version;</productnumber> - <address>&gcc-url;</address> - </sect1info> - - <title>GCC-&gcc-version; - - - GCC - - - - - - <para>The GCC package contains the GNU compiler collection, which includes - the C and C++ compilers.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&gcc-ch6-sbu;</seg> - <seg>&gcc-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of GCC - - 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 - - The GCC documentation recommends building GCC in a dedicated build directory: - -mkdir -v build -cd build - - Prepare GCC for compilation: - -../configure --prefix=/usr \ - LD=ld \ - --enable-languages=c,c++ \ - --disable-multilib \ - --disable-bootstrap \ - --with-system-zlib - - Note that for other languages, there are some prerequisites that - are not yet available. See the - BLFS Book - for instructions on how to build all of GCC's supported languages. - - - The meaning of the new configure parameter: - - - --with-system-zlib - - This switch tells GCC to link to the system installed copy of - the Zlib library, rather than its own internal copy. - - - - - Compile the package: - -make - - - In this section, the test suite for GCC is considered - critical. Do not skip it under any circumstance. - - - One set of tests in the GCC test suite is known to exhaust the stack, - so increase the stack size prior to running the tests: - -ulimit -s 32768 - - Test the results as a non-privileged user, but do not stop at errors: - -chown -Rv tester . -su tester -c "PATH=$PATH make -k check" - - To receive a summary of the test suite results, run: - -../contrib/test_summary - - For only the summaries, pipe the output through - grep -A7 Summ. - - Results can be compared with those located at and - . - - Six tests related to get_time are known to fail. These are - apparently related to the en_HK locale. - - Two tests named lookup.cc and reverse.cc in experimental/net - are known to fail in LFS chroot environment because they require - /etc/hosts and iana-etc. - - A few unexpected failures cannot always be avoided. The GCC developers - are usually aware of these issues, but have not resolved them yet. - Unless the test results are vastly different from those at the above URL, - it is safe to continue. - - - - Install the package and remove an unneeded directory: - -make install -rm -rf /usr/lib/gcc/$(gcc -dumpmachine)/&gcc-version;/include-fixed/bits/ - - The GCC build directory is owned by - tester now and the ownership of the installed header - directory (and its content) will be incorrect. Change the ownership to - root user and group: - -chown -v -R root:root \ - /usr/lib/gcc/*linux-gnu/&gcc-version;/include{,-fixed} - - Create a symlink required by the FHS - for "historical" reasons. - -ln -sv ../usr/bin/cpp /lib - - Add a compatibility symlink to enable building programs with - Link Time Optimization (LTO): - -install -v -dm755 /usr/lib/bfd-plugins -ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/&gcc-version;/liblto_plugin.so \ - /usr/lib/bfd-plugins/ - - Now that our final toolchain is in place, it is important to again ensure - that compiling and linking will work as expected. We do this by performing - the same sanity checks as we did earlier in the chapter: - - - - - - - - - - - - - -/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crt1.o succeeded -/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crti.o succeeded -/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crtn.o succeeded - - Depending on your machine architecture, the above may differ slightly, - the difference usually being the name of the directory - after /usr/lib/gcc. The important - thing to look for here is that gcc has found all three - crt*.o files under the - /usr/lib directory. - - - -grep -B4 '^ /usr/include' dummy.log - - - -#include <...> search starts here: - /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include - /usr/local/include - /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include-fixed - /usr/include - - Again, note that the directory named after your target triplet may be - different than the above, depending on your architecture. - - - - - - - - - -SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib64") -SEARCH_DIR("/usr/local/lib64") -SEARCH_DIR("/lib64") -SEARCH_DIR("/usr/lib64") -SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib") -SEARCH_DIR("/usr/local/lib") -SEARCH_DIR("/lib") -SEARCH_DIR("/usr/lib"); - - A 32-bit system may see a few different directories. For example, here - is the output from an i686 machine: - -SEARCH_DIR("/usr/i686-pc-linux-gnu/lib32") -SEARCH_DIR("/usr/local/lib32") -SEARCH_DIR("/lib32") -SEARCH_DIR("/usr/lib32") -SEARCH_DIR("/usr/i686-pc-linux-gnu/lib") -SEARCH_DIR("/usr/local/lib") -SEARCH_DIR("/lib") -SEARCH_DIR("/usr/lib"); - - - - - - - - - - - - - - - - - - - - - - - - Finally, move a misplaced file: - -mkdir -pv /usr/share/gdb/auto-load/usr/lib -mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib - - - - - Contents of GCC - - - Installed programs - Installed libraries - Installed directories - - - c++, cc (link to gcc), cpp, g++, gcc, - gcc-ar, gcc-nm, gcc-ranlib, gcov, gcov-dump, and gcov-tool - - libasan.{a,so}, libatomic.{a,so}, libcc1.so, libgcc.a, libgcc_eh.a, - libgcc_s.so, libgcov.a, libgomp.{a,so}, libitm.{a,so}, - liblsan.{a,so}, liblto_plugin.so, - libquadmath.{a,so}, libssp.{a,so}, libssp_nonshared.a, - libstdc++.{a,so}, libstdc++fs.a, libsupc++.a, libtsan.{a,so}, - and libubsan.{a,so} - - /usr/include/c++, /usr/lib/gcc, /usr/libexec/gcc, and - /usr/share/gcc-&gcc-version; - - - - - Short Descriptions - - - - - c++ - - The C++ compiler - - c++ - - - - - - cc - - The C compiler - - cc - - - - - - cpp - - The C preprocessor; it is used by the compiler to expand the - #include, #define, and similar statements in the source files - - cpp - - - - - - g++ - - The C++ compiler - - g++ - - - - - - gcc - - The C compiler - - gcc - - - - - - gcc-ar - - A wrapper around ar that adds a - plugin to the command line. This program is only used - to add "link time optimization" and is not useful with the - default build options - - gc-ar - - - - - - gcc-nm - - A wrapper around nm that adds a - plugin to the command line. This program is only used - to add "link time optimization" and is not useful with the - default build options - - gc-nm - - - - - - gcc-ranlib - - A wrapper around ranlib that adds a - plugin to the command line. This program is only used - to add "link time optimization" and is not useful with the - default build options - - gc-ranlib - - - - - - gcov - - A coverage testing tool; it is used to analyze programs to - determine where optimizations will have the most effect - - gcov - - - - - - gcov-dump - - Offline gcda and gcno profile dump tool - - gcov-dump - - - - - - gcov-tool - - Offline gcda profile processing tool - - gcov-tool - - - - - - libasan - - The Address Sanitizer runtime library - - libasan - - - - - - libatomic - - GCC atomic built-in runtime library - - libatomic - - - - - - libcc1 - - The C preprocessing library - - libcc1 - - - - - - libgcc - - Contains run-time support for gcc - - libgcc - - - - - - libgcov - - This library is linked in to a program when GCC is instructed - to enable profiling - - libgcov - - - - - - libgomp - - GNU implementation of the OpenMP API for multi-platform - shared-memory parallel programming in C/C++ and Fortran - - libgomp - - - - - - liblsan - - The Leak Sanitizer runtime library - - liblsan - - - - - - liblto_plugin - - GCC's Link Time Optimization (LTO) plugin allows GCC to perform - optimizations across compilation units - - liblto_plugin - - - - - - libquadmath - - GCC Quad Precision Math Library API - - libquadmath - - - - - - libssp - - Contains routines supporting GCC's stack-smashing protection - functionality - - libssp - - - - - - libstdc++ - - The standard C++ library - - libstdc++ - - - - - - libstdc++fs - - ISO/IEC TS 18822:2015 Filesystem library - - libstdc++fs - - - - - - libsupc++ - - Provides supporting routines for the C++ programming - language - - libsupc++ - - - - - - libtsan - - The Thread Sanitizer runtime library - - libtsan - - - - - - libubsan - - The Undefined Behavior Sanitizer runtime library - - libubsan - - - - - - - - - diff --git a/chapter06/gdbm.xml b/chapter06/gdbm.xml deleted file mode 100644 index f953b63f9..000000000 --- a/chapter06/gdbm.xml +++ /dev/null @@ -1,156 +0,0 @@ - - - %general-entities; -]> - - - - - - gdbm - &gdbm-version; -
&gdbm-url;
-
- - GDBM-&gdbm-version; - - - GDBM - - - - - - <para>The GDBM package contains the GNU Database Manager. It is a library - of database functions that use extensible hashing and work similar to the - standard UNIX dbm. The library provides primitives for storing key/data - pairs, searching and retrieving the data by its key and deleting a key - along with its data. </para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&gdbm-ch6-sbu;</seg> - <seg>&gdbm-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of GDBM - - First, fix an issue first identified by gcc-10: - -sed -r -i '/^char.*parseopt_program_(doc|args)/d' src/parseopt.c - - Prepare GDBM for compilation: - -./configure --prefix=/usr \ - --disable-static \ - --enable-libgdbm-compat - - - The meaning of the configure option: - - - --enable-libgdbm-compat - - This switch enables the libgdbm compatibility library to be - built, as some packages outside of LFS may require the older DBM - routines it provides. - - - - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make install - - - - - Contents of GDBM - - - Installed programs - Installed libraries - - - gdbm_dump, gdbm_load, and gdbmtool - libgdbm.so and libgdbm_compat.so - - - - - Short Descriptions - - - - - gdbm_dump - - Dumps a GDBM database to a file - - gdbm_dump - - - - - - gdbm_load - - Recreates a GDBM database from a dump file - - gdbm_load - - - - - - gdbmtool - - Tests and modifies a GDBM database - - gdbmtool - - - - - - libgdbm - - Contains functions to manipulate a hashed database - - libgdbm - - - - - - libgdbm_compat - - Compatibility library containing older DBM functions - - libgdbm_compat - - - - - - - - -
diff --git a/chapter06/generalinstructions.xml b/chapter06/generalinstructions.xml new file mode 100644 index 000000000..05b88b98c --- /dev/null +++ b/chapter06/generalinstructions.xml @@ -0,0 +1,120 @@ + + + %general-entities; +]> + + + + + General Compilation Instructions + + When building packages there are several assumptions made within + the instructions: + + + + + Several of the packages are patched before compilation, but only when + the patch is needed to circumvent a problem. A patch is often needed in + both this and the next chapter, but sometimes in only one or the other. + Therefore, do not be concerned if instructions for a downloaded patch seem + to be missing. Warning messages about offset or + fuzz may also be encountered when applying a patch. Do + not worry about these warnings, as the patch was still successfully + applied. + + + + During the compilation of most packages, there will be several + warnings that scroll by on the screen. These are normal and can safely be + ignored. These warnings are as they appear—warnings about + deprecated, but not invalid, use of the C or C++ syntax. C standards change + fairly often, and some packages still use the older standard. This is not a + problem, but does prompt the warning. + + + + Check one last time that the LFS environment variable + is set up properly: + +echo $LFS + + Make sure the output shows the path to the LFS partition's mount + point, which is /mnt/lfs, using our + example. + + + + + Finally, two important items must be emphasized: + + + + The build instructions assume that the , including symbolic links, have + been set properly: + + + + bash is the shell + in use. + + sh is a symbolic + link to bash. + + /usr/bin/awk is a + symbolic link to gawk. + + /usr/bin/yacc is a + symbolic link to bison or a small script that + executes bison. + + + + + + To re-emphasize the build process: + + + + Place all the sources and patches in a directory that will be + accessible from the chroot environment such as + /mnt/lfs/sources/. + + + Change to the sources directory. + + + For each package: + + + Using the tar program, extract the package + to be built. In Chapter 5, ensure you are the lfs + user when extracting the package. + + + Change to the directory created when the package was + extracted. + + + Follow the book's instructions for building the package. + + + Change back to the sources directory. + + + Delete the extracted source directory unless instructed otherwise. + + + + + + + + + + diff --git a/chapter06/gettext.xml b/chapter06/gettext.xml index 2c4683804..34d0ee32e 100644 --- a/chapter06/gettext.xml +++ b/chapter06/gettext.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,25 +16,25 @@ Gettext-&gettext-version; - + Gettext + tools - <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 - Compile the package: - -make BISON_LOCALEDIR=/usr/share/locale - - - The meaning of the make parameter: + + The meaning of the configure option: - BISON_LOCALEDIR=/usr/share/locale + --disable-shared - 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. + We do not need to install any of the shared Gettext libraries at + this time, therefore there is no need to build them. - To test the results (this takes a long time, around 3 SBUs), - issue: + Compile the package: -make check +make - Install the package: + Install the msgfmt, msgmerge and + xgettext programs: -make install -chmod -v 0755 /usr/lib/preloadable_libintl.so +cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin - - Contents of Gettext - - - Installed programs - Installed libraries - Installed directories - - - autopoint, envsubst, gettext, gettext.sh, - gettextize, msgattrib, msgcat, msgcmp, msgcomm, msgconv, msgen, - msgexec, msgfilter, msgfmt, msggrep, msginit, msgmerge, msgunfmt, msguniq, - ngettext, recode-sr-latin, and xgettext - libasprintf.so, libgettextlib.so, libgettextpo.so, - libgettextsrc.so, libtextstyle.so, and preloadable_libintl.so - /usr/lib/gettext, /usr/share/doc/gettext-&gettext-version;, - /usr/share/gettext, and /usr/share/gettext-0.19.8 - - - - - Short Descriptions - - - - - autopoint - - Copies standard Gettext infrastructure files into a source - package - - autopoint - - - - - - envsubst - - Substitutes environment variables in shell format strings - - envsubst - - - - - - gettext - - Translates a natural language message into the user's language - by looking up the translation in a message catalog - - gettext - - - - - - gettext.sh - - Primarily serves as a shell function library for gettext - - gettext.sh - - - - - - gettextize - - Copies all standard Gettext files into the given top-level - directory of a package to begin internationalizing it - - gettextize - - - - - - msgattrib - - Filters the messages of a translation catalog according to their - attributes and manipulates the attributes - - msgattrib - - - - - - msgcat - - Concatenates and merges the given - .po files - - msgcat - - - - - - msgcmp - - Compares two .po - files to check that both contain the same set of msgid strings - - msgcmp - - - - - - msgcomm - - Finds the messages that are common to the given - .po files - - msgcomm - - - - - - msgconv - - Converts a translation catalog to a different character - encoding - - msgconv - - - - - - msgen - - Creates an English translation catalog - - msgen - - - - - - msgexec - - Applies a command to all translations of a translation - catalog - - msgexec - - - - - - msgfilter - - Applies a filter to all translations of a translation - catalog - - msgfilter - - - - - - msgfmt - - Generates a binary message catalog from a translation - catalog - - msgfmt - - - - - - msggrep - - Extracts all messages of a translation catalog that match a - given pattern or belong to some given source files - - msggrep - - - - - - msginit - - Creates a new .po file, - initializing the meta information with values from the user's - environment - - msginit - - - - - - msgmerge - - Combines two raw translations into a single file - - msgmerge - - - - - - msgunfmt - - Decompiles a binary message catalog into raw translation - text - - msgunfmt - - - - - - msguniq - - Unifies duplicate translations in a translation catalog - - msguniq - - - - - - ngettext - - Displays native language translations of a textual message whose - grammatical form depends on a number - - ngettext - - - - - - recode-sr-latin - - Recodes Serbian text from Cyrillic to Latin script - - recode-sr-latin - - - - - - xgettext - - Extracts the translatable message lines from the given source - files to make the first translation template - - xgettext - - - - - - libasprintf - - defines the autosprintf class, which makes - C formatted output routines usable in C++ programs, for use with the - <string> strings and the - <iostream> streams - - libasprintf - - - - - - libgettextlib - - a private library containing common routines used by the - various Gettext programs; these are not intended for general use - - libgettextlib - - - - - - libgettextpo - - Used to write specialized programs that process - .po files; this library is - used when the standard applications shipped with Gettext (such as - msgcomm, msgcmp, - msgattrib, and msgen) will - not suffice - - libgettextpo - - - - - - libgettextsrc - - A private library containing common routines used by the - various Gettext programs; these are not intended for general use - - libgettextsrc - - - - - - libtextstyle - - Text styling library - - libtextstyle - - - + + - <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,927 +43,187 @@ <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-&glibc-version;-fhs-1.patch -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 - - This option increases system security by adding - extra code to check for buffer overflows, such as stack - smashing attacks. - - - - - --with-headers=/usr/include + --with-headers=$LFS/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. - - - - 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 + libc_cv_c_cleanup=yes - Prints various information about the current locale - - locale - + Similarly, we pass libc_cv_c_cleanup=yes through to the + configure script so that the test is skipped and C + cleanup handling support is configured. - - 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 + + libc_cv_ctors_header=yes - Dump information generated by PC profiling - - pcprofiledump - + Similarly, we pass libc_cv_ctors_header=yes through to the + configure script so that the test is skipped and + gcc constructor support is configured. - + --> - - 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 - - - + During this stage the following warning might appear: - - sprof - - Reads and displays shared object profiling data - - sprof - - - +
+configure: WARNING: +*** These auxiliary programs are missing or +*** incompatible versions: msgfmt +*** some features will be disabled. +*** Check the INSTALL file for required versions. +
- - tzselect - - Asks the user about the location of the system and reports - the corresponding time zone description - - tzselect - - - + The missing or incompatible msgfmt program is + generally harmless. This msgfmt program is part of the + Gettext package which the host distribution should provide. - - xtrace - - Traces the execution of a program by printing the currently - executed function - - xtrace - - - + 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. - - zdump - - The time zone dumper - - zdump - - - + Compile the package: - - zic - - The time zone compiler - - zic - - - +make - - ld-&glibc-version;.so - - The helper program for shared library executables - - ld-&glibc-version;.so - - - + Install the package: - - 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 - - - +make DESTDIR=$LFS install - - libSegFault - - The segmentation fault signal handler, used by - catchsegv - - libSegFault - - - + + The meaning of the <command>make install</command> option: - - libanl + + DESTDIR=$LFS - An asynchronous name lookup library - - libanl - + 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 . - - libc - - The main C library - - libc - - - + - - libcrypt - - The cryptography library - - libcrypt - - - + + 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: - - libdl - - The dynamic linking interface library - - libdl - - - +echo 'int main(){}' > dummy.c +$LFS_TGT-gcc dummy.c +readelf -l a.out | grep '/ld-linux' - - libg - - Dummy library containing no functions. Previously was a runtime - library for g++ - - libg - - - + If everything is working correctly, there should be no errors, + and the output of the last command will be of the form: - - libm - - The mathematical library - - libm - - - +[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] - - libmcheck - - Turns on memory allocation checking when linked to - - libmcheck - - - + Note that for 32-bit machines, the interpreter name will be + /lib/ld-linux.so.2. - - libmemusage - - Used by memusage to help collect - information about the memory usage of a program - - libmemusage - - - + 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. - - libnsl - - The network services library - - libnsl - - - + Once all is well, clean up the test files: - - libnss - - The Name Service Switch libraries, containing functions for - resolving host names, user names, group names, aliases, services, - protocols, etc. - - libnss - - - +rm -v dummy.c a.out - - libpcprofile - - Can be preloaded to PC profile an executable - - libpcprofile - - - + - - libpthread - - The POSIX threads library - - libpthread - - - + 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. - - libresolv - - Contains functions for creating, sending, and interpreting - packets to the Internet domain name servers - - libresolv - - - + 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: - - librt - - Contains functions providing most of the interfaces specified - by the POSIX.1b Realtime Extension - - librt - - - +$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders - - 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 - - - + + - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-glibc" role="."/></para> </sect2> diff --git a/chapter06/gmp.xml b/chapter06/gmp.xml deleted file mode 100644 index 4bc361a56..000000000 --- a/chapter06/gmp.xml +++ /dev/null @@ -1,164 +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-gmp" role="wrap"> - <?dbhtml filename="gmp.html"?> - - <sect1info condition="script"> - <productname>gmp</productname> - <productnumber>&gmp-version;</productnumber> - <address>&gmp-url;</address> - </sect1info> - - <title>GMP-&gmp-version; - - - GMP - - - - - - <para>The GMP package contains math libraries. These have useful functions - for arbitrary precision arithmetic.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&gmp-ch6-sbu;</seg> - <seg>&gmp-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of GMP - - - If you are building for 32-bit x86, but you have a CPU which is - capable of running 64-bit code and you have specified - CFLAGS in the environment, the configure script will - attempt to configure for 64-bits and fail. - Avoid this by invoking the configure command below with -ABI=32 ./configure ... - - - - The default settings of GMP produce libraries optimized for - the host processor. If libraries suitable for processors less - capable than the host's CPU are desired, generic libraries can be - created by running the following: - -cp -v configfsf.guess config.guess -cp -v configfsf.sub config.sub - - - Prepare GMP for compilation: - -./configure --prefix=/usr \ - --enable-cxx \ - --disable-static \ - --docdir=/usr/share/doc/gmp-&gmp-version; - - - The meaning of the new configure options: - - - --enable-cxx - - This parameter enables C++ support - - - - - --docdir=/usr/share/doc/gmp-&gmp-version; - - This variable specifies the correct place for the - documentation. - - - - - - Compile the package and generate the HTML documentation: - -make -make html - - - The test suite for GMP in this section is considered critical. - Do not skip it under any circumstances. - - - Test the results: - -make check 2>&1 | tee gmp-check-log - - The code in gmp is highly optimized for the processor where - it is built. Occasionally, the code that detects the processor misidentifies - the system capabilities and there will be errors in the tests or other - applications using the gmp libraries with the message "Illegal - instruction". In this case, gmp should be reconfigured with the option - --build=x86_64-unknown-linux-gnu and rebuilt. - - Ensure that all 197 tests in the test suite passed. - Check the results by issuing the following command: - -awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log - - Install the package and its documentation: - -make install -make install-html - - - - - Contents of GMP - - - Installed Libraries - Installed directory - - - libgmp.so and libgmpxx.so - /usr/share/doc/gmp-&gmp-version; - - - - - Short Descriptions - - - - - libgmp - - Contains precision math functions - - libgmp - - - - - - libgmpxx - - Contains C++ precision math functions - - libgmpxx - - - - - - - -
diff --git a/chapter06/gperf.xml b/chapter06/gperf.xml deleted file mode 100644 index d8c5b6594..000000000 --- a/chapter06/gperf.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - %general-entities; -]> - - - - - - gperf - &gperf-version; -
&gperf-url;
-
- - Gperf-&gperf-version; - - - Gperf - - - - - - <para>Gperf generates a perfect hash function from a key set.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&gperf-ch6-sbu;</seg> - <seg>&gperf-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Gperf - - Prepare Gperf for compilation: - -./configure --prefix=/usr --docdir=/usr/share/doc/gperf-&gperf-version; - - Compile the package: - -make - - The tests are known to fail if running multiple - simultaneous tests (-j option greater than 1). To test - the results, issue: - -make -j1 check - - Install the package: - -make install - - - - - Contents of Gperf - - - Installed program - Installed directory - - - gperf - /usr/share/doc/gperf-&gperf-version; - - - - - Short Descriptions - - - - - gperf - - Generates a perfect hash from a key set - - gperf - - - - - - - - -
diff --git a/chapter06/grep.xml b/chapter06/grep.xml index 58b0db366..6a8ada4b8 100644 --- a/chapter06/grep.xml +++ b/chapter06/grep.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,22 +16,25 @@ Grep-&grep-version; - + Grep + tools - <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 - - - Installed programs - - - egrep, fgrep, and grep - - + + - <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/groff.xml b/chapter06/groff.xml deleted file mode 100644 index aad0cbf85..000000000 --- a/chapter06/groff.xml +++ /dev/null @@ -1,607 +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-groff" role="wrap"> - <?dbhtml filename="groff.html"?> - - <sect1info condition="script"> - <productname>groff</productname> - <productnumber>&groff-version;</productnumber> - <address>&groff-url;</address> - </sect1info> - - <title>Groff-&groff-version; - - - Groff - - - - - - <para>The Groff package contains programs for processing and formatting - text.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&groff-ch6-sbu;</seg> - <seg>&groff-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Groff - - Groff expects the environment variable PAGE to - contain the default paper size. For users in the United States, - PAGE=letter is appropriate. Elsewhere, - PAGE=A4 may be more suitable. While the default - paper size is configured during compilation, it can be overridden later - by echoing either A4 or letter to the - /etc/papersize file. - - Prepare Groff for compilation: - -PAGE=<paper_size> ./configure --prefix=/usr - - This package does not support parallel build. Compile the package: - -make -j1 - - This package does not come with a test suite. - - Install the package: - -make install - - - - - Contents of Groff - - - Installed programs - Installed directories - - - addftinfo, afmtodit, chem, eqn, eqn2graph, gdiffmk, glilypond, - gperl, gpinyin, grap2graph, grn, grodvi, groff, groffer, grog, grolbp, - grolj4, gropdf, grops, grotty, hpftodit, indxbib, lkbib, lookbib, - mmroff, neqn, nroff, pdfmom, pdfroff, pfbtops, pic, pic2graph, - post-grohtml, preconv, pre-grohtml, refer, roff2dvi, roff2html, - roff2pdf, roff2ps, roff2text, roff2x, soelim, tbl, tfmtodit, and - troff - /usr/lib/groff and /usr/share/doc/groff-&groff-version;, - /usr/share/groff - - - - - Short Descriptions - - - - - addftinfo - - Reads a troff font file and adds some additional font-metric - information that is used by the groff system - - addftinfo - - - - - - afmtodit - - Creates a font file for use with groff and - grops - - afmtodit - - - - - - chem - - Groff preprocessor for producing chemical structure diagrams - - chem - - - - - - eqn - - Compiles descriptions of equations embedded within troff - input files into commands that are understood by - troff - - eqn - - - - - - eqn2graph - - Converts a troff EQN (equation) into a cropped image - - eqn2graph - - - - - - gdiffmk - - Marks differences between groff/nroff/troff files - - gdiffmk - - - - - - glilypond - - Transforms sheet music written in the lilypond language into - the groff language - - glilypond - - - - - - gperl - - Preprocesor for groff, allowing addition of perl code - into groff files - - gperl - - - - - - gpinyin - - Preprocesor for groff, allowing addition of Chinese - European-like language Pinyin into groff files. - - gpinyin - - - - - - grap2graph - - Converts a grap diagram into a cropped bitmap image - - grap2graph - - - - - - grn - - A groff preprocessor for gremlin files - - grn - - - - - - grodvi - - A driver for groff that produces TeX dvi - format - - grodvi - - - - - - groff - - A front-end to the groff document formatting system; normally, it - runs the troff program and a post-processor - appropriate for the selected device - - groff - - - - - - groffer - - Displays groff files and man pages on X and tty terminals - - groffer - - - - - - grog - - Reads files and guesses which of the groff - options , , , - , , , - , and are required for printing - files, and reports the groff command including those - options - - grog - - - - - - grolbp - - Is a groff driver for Canon CAPSL printers - (LBP-4 and LBP-8 series laser printers) - - grolbp - - - - - - grolj4 - - Is a driver for groff that produces output - in PCL5 format suitable for an HP LaserJet 4 printer - - grolj4 - - - - - - gropdf - - Translates the output of GNU troff to - PDF - - gropdf - - - - - - grops - - Translates the output of GNU troff to - PostScript - - grops - - - - - - grotty - - Translates the output of GNU troff into - a form suitable for typewriter-like devices - - grotty - - - - - - hpftodit - - Creates a font file for use with groff -Tlj4 - from an HP-tagged font metric file - - hpftodit - - - - - - indxbib - - Creates an inverted index for the bibliographic databases with a - specified file for use with refer, - lookbib, and lkbib - - indxbib - - - - - - lkbib - - Searches bibliographic databases for references that contain - specified keys and reports any references found - - lkbib - - - - - - lookbib - - Prints a prompt on the standard error (unless the standard input - is not a terminal), reads a line containing a set of keywords from the - standard input, searches the bibliographic databases in a specified file - for references containing those keywords, prints any references found - on the standard output, and repeats this process until the end of - input - - lookbib - - - - - - mmroff - - A simple preprocessor for groff - - mmroff - - - - - - neqn - - Formats equations for American Standard Code for Information - Interchange (ASCII) output - - neqn - - - - - - nroff - - A script that emulates the nroff command - using groff - - nroff - - - - - - pdfmom - - Is a wrapper around groff that facilitates the production of PDF - documents from files formatted with the mom macros. - - pdfmom - - - - - - pdfroff - - Creates pdf documents using groff - - pdfroff - - - - - - pfbtops - - Translates a PostScript font in .pfb format to ASCII - - pfbtops - - - - - - pic - - Compiles descriptions of pictures embedded within troff or - TeX input files into commands understood by TeX or - troff - - pic - - - - - - pic2graph - - Converts a PIC diagram into a cropped image - - pic2graph - - - - - - post-grohtml - - Translates the output of GNU troff to - HTML - - post-grohtml - - - - - - preconv - - Converts encoding of input files to something GNU - troff understands - - preconv - - - - - - pre-grohtml - - Translates the output of GNU troff to - HTML - - pre-grohtml - - - - - - refer - - Copies the contents of a file to the standard output, except - that lines between .[ and .] - are interpreted as citations, and lines between .R1 - and .R2 are interpreted as commands for how - citations are to be processed - - refer - - - - - - roff2dvi - - Transforms roff files into DVI format - - roff2dvi - - - - - - roff2html - - Transforms roff files into HTML format - - roff2html - - - - - - roff2pdf - - Transforms roff files into PDFs - - roff2pdf - - - - - - roff2ps - - Transforms roff files into ps files - - roff2ps - - - - - - roff2text - - Transforms roff files into text files - - roff2text - - - - - - roff2x - - Transforms roff files into other formats - - roff2x - - - - - - soelim - - Reads files and replaces lines of the form .so - file by the contents of the mentioned - file - - soelim - - - - - - tbl - - Compiles descriptions of tables embedded within troff input - files into commands that are understood by - troff - - tbl - - - - - - tfmtodit - - Creates a font file for use with groff - -Tdvi - - tfmtodit - - - - - - troff - - Is highly compatible with Unix troff; it - should usually be invoked using the groff command, - which will also run preprocessors and post-processors in the - appropriate order and with the appropriate options - - troff - - - - - - - - - diff --git a/chapter06/grub.xml b/chapter06/grub.xml deleted file mode 100644 index 25a61077b..000000000 --- a/chapter06/grub.xml +++ /dev/null @@ -1,374 +0,0 @@ - - - %general-entities; -]> - - - - - - grub - &grub-version; -
&grub-url;
-
- - GRUB-&grub-version; - - - GRUB - - - - - - <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 - - - Installed programs - - - gunzip, gzexe, gzip, uncompress (hard link with gunzip), zcat, zcmp, - zdiff, zegrep, zfgrep, zforce, zgrep, zless, zmore, and znew - - + + - <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/iana-etc.xml b/chapter06/iana-etc.xml deleted file mode 100644 index 42ab25c34..000000000 --- a/chapter06/iana-etc.xml +++ /dev/null @@ -1,93 +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-iana-etc" role="wrap"> - <?dbhtml filename="iana-etc.html"?> - - <sect1info condition="script"> - <productname>iana-etc</productname> - <productnumber>&iana-etc-version;</productnumber> - <address>&iana-etc-url;</address> - </sect1info> - - <title>Iana-Etc-&iana-etc-version; - - - Iana-Etc - - - - - - <para>The Iana-Etc package provides data for network services and - protocols.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&iana-etc-ch6-sbu;</seg> - <seg>&iana-etc-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Iana-Etc - - For this package, we only need to copy the files into place: - -cp services protocols /etc - - - - - Contents of Iana-Etc - - - Installed files - - - /etc/protocols and /etc/services - - - - - Short Descriptions - - - - - /etc/protocols - - Describes the various DARPA Internet protocols that are - available from the TCP/IP subsystem - - /etc/protocols - - - - - - /etc/services - - Provides a mapping between friendly textual names for internet - services, and their underlying assigned port numbers and protocol - types - - /etc/services - - - - - - - - - diff --git a/chapter06/inetutils.xml b/chapter06/inetutils.xml deleted file mode 100644 index c8fdd456f..000000000 --- a/chapter06/inetutils.xml +++ /dev/null @@ -1,249 +0,0 @@ - - - %general-entities; -]> - - - - - - inetutils - &inetutils-version; -
&inetutils-url;
-
- - Inetutils-&inetutils-version; - - - Inetutils - - - - - - <para>The Inetutils package contains programs for basic networking.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&inetutils-ch6-sbu;</seg> - <seg>&inetutils-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Inetutils - - Prepare Inetutils for compilation: - -./configure --prefix=/usr \ - --localstatedir=/var \ - --disable-logger \ - --disable-whois \ - --disable-rcp \ - --disable-rexec \ - --disable-rlogin \ - --disable-rsh \ - --disable-servers - - - The meaning of the configure options: - - - --disable-logger - - This option prevents Inetutils from installing the - logger program, which is used by scripts to - pass messages to the System Log Daemon. Do not install it because - Util-linux installs a more recent version. - - - - - --disable-whois - - This option disables the building of the Inetutils - whois client, which is out of date. Instructions for - a better whois client are in the BLFS book. - - - - - --disable-r* - - These parameters disable building obsolete programs that should not - be used due to security issues. The functions provided by these - programs can be provided by the openssh - package in the BLFS book. - - - - - --disable-servers - - This disables the installation of the various network servers - included as part of the Inetutils package. These servers are deemed not - appropriate in a basic LFS system. Some are insecure by nature and are - only considered safe on trusted networks. Note that - better replacements are available for many of these servers. - - - - - - Compile the package: - -make - - To test the results, issue: - -make check - - One test, libls.sh, may fail in the initial chroot - environment but will pass if the test is rerun after the LFS system - is complete. One test, ping-localhost.sh, will fail if the host - system does not have ipv6 capability. - - Install the package: - -make install - - Move some programs so they are available if /usr is not accessible: - -mv -v /usr/bin/{hostname,ping,ping6,traceroute} /bin -mv -v /usr/bin/ifconfig /sbin - - - - - Contents of Inetutils - - - Installed programs - - - dnsdomainname, ftp, ifconfig, hostname, ping, ping6, - talk, telnet, tftp, and traceroute - - - - - Short Descriptions - - - - - dnsdomainname - - Show the system's DNS domain name - - dnsdomainname - - - - - - ftp - - Is the file transfer protocol program - - ftp - - - - - - hostname - - Reports or sets the name of the host - - hostname - - - - - - ifconfig - - Manages network interfaces - - ifconfig - - - - - - ping - - Sends echo-request packets and reports how long the replies - take - - ping - - - - - - ping6 - - A version of ping for IPv6 networks - - ping6 - - - - - - talk - - Is used to chat with another user - - talk - - - - - - telnet - - An interface to the TELNET protocol - - telnet - - - - - - tftp - - A trivial file transfer program - - tftp - - - - - - traceroute - - Traces the route your packets take from the host you are - working on to another host on a network, showing all the intermediate - hops (gateways) along the way - - traceroute - - - - - - - - -
diff --git a/chapter06/intltool.xml b/chapter06/intltool.xml deleted file mode 100644 index 9e9ebad20..000000000 --- a/chapter06/intltool.xml +++ /dev/null @@ -1,141 +0,0 @@ - - - %general-entities; -]> - - - - - - intltool - &intltool-version; -
&intltool-url;
-
- - Intltool-&intltool-version; - - - Intltool - - - - - - <para>The Intltool is an internationalization tool used for extracting - translatable strings from source files.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&intltool-ch6-sbu;</seg> - <seg>&intltool-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Intltool - - First fix a warning that is caused by perl-5.22 and later: - -sed -i 's:\\\${:\\\$\\{:' intltool-update.in - - Prepare Intltool for compilation: - -./configure --prefix=/usr - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make install -install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-&intltool-version;/I18N-HOWTO - - - - - Contents of Intltool - - - Installed programs - Installed directories - - - intltool-extract, intltool-merge, intltool-prepare, - intltool-update, and intltoolize - /usr/share/doc/intltool-&intltool-version; and - /usr/share/intltool - - - - - Short Descriptions - - - - - intltoolize - - Prepares a package to use intltool - - intltoolize - - - - - - intltool-extract - - Generates header files that can be read by gettext - - intltool-extract - - - - - - intltool-merge - - Merges translated strings into various file types - - intltool-merge - - - - - - intltool-prepare - - Updates pot files and merges them with translation files - - intltool-prepare - - - - - - intltool-update - - Updates the po template files and merges them with the translations - - intltool-update - - - - - - - - -
diff --git a/chapter06/introduction.xml b/chapter06/introduction.xml index c8ccb3908..5614270b2 100644 --- a/chapter06/introduction.xml +++ b/chapter06/introduction.xml @@ -5,70 +5,25 @@ %general-entities; ]> - + Introduction - In this chapter, we enter the building site and start constructing the - LFS system in earnest. That is, we chroot into the temporary mini Linux system, - make a few final preparations, and then begin installing the packages. - - The installation of this software is straightforward. Although in many - cases the installation instructions could be made shorter and more generic, - we have opted to provide the full instructions for every package to minimize - the possibilities for mistakes. The key to learning what makes a Linux system - work is to know what each package is used for and why you (or the system) - may need it. - - We do not recommend using optimizations. They can make - a program run slightly faster, but they may also cause compilation - difficulties and problems when running the program. If a package refuses to - compile when using optimization, try to compile it without optimization and - see if that fixes the problem. Even if the package does compile when using - optimization, there is the risk it may have been compiled incorrectly because - of the complex interactions between the code and build tools. Also note that - the and options using values - not specified in the book have not been tested. This may cause problems with - the toolchain packages (Binutils, GCC and Glibc). The small potential gains - achieved in using compiler optimizations are often outweighed by the risks. - First-time builders of LFS are encouraged to build without custom - optimizations. The subsequent system will still run very fast and be stable - at the same time. - - Before the installation instructions, each installation page provides - information about the package, including a concise description of what it - contains, approximately how long it will take to build, and how much disk - space is required during this building process. Following the installation - instructions, there is a list of programs and libraries (along with brief - descriptions of these) that the package installs. - - The SBU values and required disk space includes - test suite data for all applicable packages in Chapter 6. - - - About libraries - - In general, the LFS editors discourage building and installing static - libraries. The original purpose for most static libraries has been made - obsolete in a modern Linux system. In addition linking a static library - into a program can be detrimental. If an update to the library is needed - to remove a security problem, all programs that use the static library will - need to be relinked to the new library. Since the use of static libraries - is not always obvious, the relevant programs (and the procedures needed to - do the linking) may not even be known. - - In the procedures in Chapter 6, we remove or disable installation of - most static libraries. Usually this is done by passing a - option to configure. - In other cases, alternate means are needed. In a few cases, especially - glibc and gcc, the use of static libraries remains essential to the general - package building process. - - For a more complete discussion of libraries, see the discussion - - Libraries: Static or shared? in the BLFS book. - - - + This chapter shows how to build a minimal Linux system. + This system will contain just enough tools to start constructing the final + LFS system in and allow a working + environment with more user convenience than a minimum environment would. + + There are two steps in building this minimal system. The first step + is to build a new and host-independent toolchain (compiler, assembler, + linker, libraries, and a few useful utilities). The second step uses this + toolchain to build the other essential tools. + diff --git a/chapter06/iproute2.xml b/chapter06/iproute2.xml deleted file mode 100644 index 8b868df65..000000000 --- a/chapter06/iproute2.xml +++ /dev/null @@ -1,322 +0,0 @@ - - - %general-entities; -]> - - - - - - iproute2 - &iproute2-version; -
&iproute2-url;
-
- - IPRoute2-&iproute2-version; - - - IPRoute2 - - - - - - <para>The IPRoute2 package contains programs for basic and advanced IPV4-based - networking.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&iproute2-ch6-sbu;</seg> - <seg>&iproute2-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of IPRoute2 - - The arpd program included in this package will not - be built since it is dependent on Berkeley DB, which is not installed in - LFS. However, a directory for arpd and a man page will still - be installed. Prevent this by running the commands below. - If the arpd binary is needed, - instructions for compiling Berkeley DB can be found in the BLFS Book at - . - - -sed -i /ARPD/d Makefile -rm -fv man/man8/arpd.8 - - It is also necessary to disable building two modules that - requires . - -sed -i 's/.m_ipt.o//' tc/Makefile - - Compile the package: - -make - - This package does not have a working test suite. - - - Install the package: - -make DOCDIR=/usr/share/doc/iproute2-&iproute2-version; install - - - - - Contents of IPRoute2 - - - Installed programs - Installed directories - - - bridge, ctstat (link to lnstat), genl, ifcfg, ifstat, ip, lnstat, - nstat, routef, routel, rtacct, rtmon, rtpr, rtstat (link to lnstat), ss, - and tc - /etc/iproute2, /usr/lib/tc, and /usr/share/doc/iproute2-&iproute2-version;, - - - - - - Short Descriptions - - - - - bridge - - Configures network bridges - - bridge - - - - - - ctstat - - Connection status utility - - ctstat - - - - - - genl - - Generic netlink utility frontend - - genl - - - - - - ifcfg - - A shell script wrapper for the ip command - [Note that it requires the arping and - rdisk programs from the - iputils package found at .] - - ifcfg - - - - - - ifstat - - Shows the interface statistics, including the amount of - transmitted and received packets by interface - - ifstat - - - - - - ip - - The main executable. It has several different functions: - - ip link <device> - allows users to look at the state of devices and to make changes - - ip addr allows users to look at addresses and - their properties, add new addresses, and delete old ones - - ip neighbor allows users to look at neighbor - bindings and their properties, add new neighbor entries, and delete - old ones - - ip rule allows users to look at the routing - policies and change them - - ip route allows users to look at the routing - table and change routing table rules - - ip tunnel allows users to look at the IP - tunnels and their properties, and change them - - ip maddr allows users to look at the multicast - addresses and their properties, and change them - - ip mroute allows users to set, change, or - delete the multicast routing - - ip monitor allows users to continuously monitor - the state of devices, addresses and routes - - ip - - - - - - lnstat - - Provides Linux network statistics; it is a generalized and more - feature-complete replacement for the old rtstat - program - - lnstat - - - - - - nstat - - Shows network statistics - - nstat - - - - - - routef - - A component of ip route. This is for flushing - the routing tables - - routef - - - - - - routel - - A component of ip route. This is for listing - the routing tables - - routel - - - - - - rtacct - - Displays the contents of - /proc/net/rt_acct - - rtacct - - - - - - rtmon - - Route monitoring utility - - rtmon - - - - - - rtpr - - Converts the output of ip -o back into a - readable form - - rtpr - - - - - - rtstat - - Route status utility - - rtstat - - - - - - ss - - Similar to the netstat command; shows active - connections - - ss - - - - - - tc - - Traffic Controlling Executable; this is for Quality Of Service - (QOS) and Class Of Service (COS) implementations - - tc qdisc allows users to setup the queueing - discipline - - tc class allows users to setup classes based - on the queuing discipline scheduling - - tc estimator allows users to estimate the - network flow into a network - - tc filter allows users to setup the QOS/COS - packet filtering - - tc policy allows users to setup the QOS/COS - policies - - tc - - - - - - - - -
diff --git a/chapter06/kbd.xml b/chapter06/kbd.xml deleted file mode 100644 index 2f9cfd3f1..000000000 --- a/chapter06/kbd.xml +++ /dev/null @@ -1,392 +0,0 @@ - - - %general-entities; -]> - - - - - - kbd - &kbd-version; -
&kbd-url;
-
- - Kbd-&kbd-version; - - - Kbd - - - - - - <para>The Kbd package contains key-table files, console fonts, and keyboard - utilities.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&kbd-ch6-sbu;</seg> - <seg>&kbd-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Kbd - - The behaviour of the Backspace and Delete keys is not consistent - across the keymaps in the Kbd package. The following patch fixes this - issue for i386 keymaps: - -patch -Np1 -i ../&kbd-backspace-patch; - - After patching, the Backspace key generates the character with code 127, - and the Delete key generates a well-known escape sequence. - - Remove the redundant resizecons program (it requires - the defunct svgalib to provide the video mode files - for normal use - setfont sizes the console appropriately) together with its - manpage. - -sed -i 's/\(RESIZECONS_PROGS=\)yes/\1no/g' configure -sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in - - Prepare Kbd for compilation: - -./configure --prefix=/usr --disable-vlock - - - The meaning of the configure options: - - - --disable-vlock - - This option prevents the vlock utility from being built, as it - requires the PAM library, which isn't available in the chroot - environment. - - - - - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make install - - - For some languages (e.g., Belarusian) the Kbd package doesn't - provide a useful keymap where the stock by keymap assumes - the ISO-8859-5 encoding, and the CP1251 keymap is normally used. Users of - such languages have to download working keymaps separately. - - - If desired, install the documentation: - -mkdir -v /usr/share/doc/kbd-&kbd-version; -cp -R -v docs/doc/* /usr/share/doc/kbd-&kbd-version; - - - - - Contents of Kbd - - - Installed programs - Installed directories - - - chvt, deallocvt, dumpkeys, fgconsole, getkeycodes, kbdinfo, - kbd_mode, kbdrate, loadkeys, loadunimap, - mapscrn, openvt, psfaddtable (link to psfxtable), psfgettable (link to - psfxtable), psfstriptable (link to psfxtable), psfxtable, - setfont, setkeycodes, setleds, setmetamode, setvtrgb, - showconsolefont, showkey, unicode_start, and unicode_stop - /usr/share/consolefonts, /usr/share/consoletrans, /usr/share/keymaps, - /usr/share/doc/kbd-&kbd-version;, and /usr/share/unimaps - - - - - Short Descriptions - - - - - chvt - - Changes the foreground virtual terminal - - chvt - - - - - - deallocvt - - Deallocates unused virtual terminals - - deallocvt - - - - - - dumpkeys - - Dumps the keyboard translation tables - - dumpkeys - - - - - - fgconsole - - Prints the number of the active virtual terminal - - fgconsole - - - - - - getkeycodes - - Prints the kernel scancode-to-keycode mapping table - - getkeycodes - - - - - - kbdinfo - - Obtains information about the status of a console - - kbdinfo - - - - - - kbd_mode - - Reports or sets the keyboard mode - - kbd_mode - - - - - - kbdrate - - Sets the keyboard repeat and delay rates - - kbdrate - - - - - - loadkeys - - Loads the keyboard translation tables - - loadkeys - - - - - - loadunimap - - Loads the kernel unicode-to-font mapping table - - loadunimap - - - - - - mapscrn - - An obsolete program that used to load a user-defined output - character mapping table into the console driver; this is now done - by setfont - - mapscrn - - - - - - openvt - - Starts a program on a new virtual terminal (VT) - - openvt - - - - - - psfaddtable - - Adds a Unicode character table to a console font - - psfaddtable - - - - - - psfgettable - - Extracts the embedded Unicode character table from a console - font - - psfgettable - - - - - - psfstriptable - - Removes the embedded Unicode character table from a console - font - - psfstriptable - - - - - - psfxtable - - Handles Unicode character tables for console fonts - - psfxtable - - - - - - setfont - - Changes the Enhanced Graphic Adapter (EGA) and Video Graphics - Array (VGA) fonts on the console - - setfont - - - - - - setkeycodes - - Loads kernel scancode-to-keycode mapping table entries; this is - useful if there are unusual keys on the keyboard - - setkeycodes - - - - - - setleds - - Sets the keyboard flags and Light Emitting Diodes (LEDs) - - setleds - - - - - - setmetamode - - Defines the keyboard meta-key handling - - setmetamode - - - - - - setvtrgb - - Sets the console color map in all virtual terminals - - setvtrgb - - - - - - showconsolefont - - Shows the current EGA/VGA console screen font - - showconsolefont - - - - - - showkey - - Reports the scancodes, keycodes, and ASCII codes of the keys - pressed on the keyboard - - showkey - - - - - - unicode_start - - Puts the keyboard and console in UNICODE mode [Don't use this - program unless your keymap file is in the ISO-8859-1 encoding. For - other encodings, this utility produces incorrect results.] - - unicode_start - - - - - - unicode_stop - - Reverts keyboard and console from UNICODE mode - - unicode_stop - - - - - - - - -
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/kmod.xml b/chapter06/kmod.xml deleted file mode 100644 index 6cc3eb168..000000000 --- a/chapter06/kmod.xml +++ /dev/null @@ -1,211 +0,0 @@ - - - %general-entities; -]> - - - - - - kmod - &kmod-version; -
&kmod-url;
-
- - Kmod-&kmod-version; - - - Kmod - - - - - - <para>The Kmod package contains libraries and utilities for loading kernel - modules</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&kmod-ch6-sbu;</seg> - <seg>&kmod-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Kmod - - Prepare Kmod for compilation: - -./configure --prefix=/usr \ - --bindir=/bin \ - --sysconfdir=/etc \ - --with-rootlibdir=/lib \ - --with-xz \ - --with-zlib - - - The meaning of the configure options: - - - --with-xz, --with-zlib - - These options enable Kmod to handle compressed kernel modules. - - - - - --with-rootlibdir=/lib - - This option ensures different library related files are placed - in the correct directories. - - - - - - Compile the package: - -make - - This package does not come with a test suite that can be run in the - LFS chroot environment. At a minimum the git program is required and - several tests will not run outside of a git repository. - - - Install the package, and create symlinks for - compatibility with Module-Init-Tools (the package that previously handled - Linux kernel modules): - -make install - -for target in depmod insmod lsmod modinfo modprobe rmmod; do - ln -sfv ../bin/kmod /sbin/$target -done - -ln -sfv kmod /bin/lsmod - - - - - Contents of Kmod - - - Installed programs - Installed library - - - depmod (link to kmod), insmod (link to kmod), kmod, - lsmod (link to kmod), modinfo (link to kmod), modprobe (link to kmod), - and rmmod (link to kmod) - libkmod.so - - - - - Short Descriptions - - - - - depmod - - Creates a dependency file based on the symbols it finds in the - existing set of modules; this dependency file is used by - modprobe to automatically load the required - modules - - depmod - - - - - - insmod - - Installs a loadable module in the running kernel - - insmod - - - - - - kmod - - Loads and unloads kernel modules - - kmod - - - - - - lsmod - - Lists currently loaded modules - - lsmod - - - - - - modinfo - - Examines an object file associated with a kernel module and - displays any information that it can glean - - modinfo - - - - - - modprobe - - Uses a dependency file, created by - depmod, to automatically load relevant modules - - modprobe - - - - - - rmmod - - Unloads modules from the running kernel - - rmmod - - - - - - libkmod - - This library is used by other programs to load and unload kernel - modules - - libkmod - - - - - - - - -
- diff --git a/chapter06/less.xml b/chapter06/less.xml deleted file mode 100644 index 087b2e6a3..000000000 --- a/chapter06/less.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - %general-entities; -]> - - - - - - less - &less-version; -
&less-url;
-
- - Less-&less-version; - - - Less - - - - - - <para>The Less package contains a text file viewer.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&less-ch6-sbu;</seg> - <seg>&less-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Less - - Prepare Less for compilation: - -./configure --prefix=/usr --sysconfdir=/etc - - - The meaning of the configure options: - - - --sysconfdir=/etc - - This option tells the programs created by the package to look - in /etc for the configuration - files. - - - - - - Compile the package: - -make - - This package does not come with a test suite. - - Install the package: - -make install - - - - - Contents of Less - - - Installed programs - - - less, lessecho, and lesskey - - - - - Short Descriptions - - - - - less - - A file viewer or pager; it displays the contents of the given - file, letting the user scroll, find strings, and jump to marks - - less - - - - - - lessecho - - Needed to expand meta-characters, such as * - and ?, in filenames on Unix systems - - lessecho - - - - - - lesskey - - Used to specify the key bindings for less - - lesskey - - - - - - - - -
diff --git a/chapter06/libcap.xml b/chapter06/libcap.xml deleted file mode 100644 index 8126dfaae..000000000 --- a/chapter06/libcap.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - %general-entities; -]> - - - - - - libcap - &libcap-version; -
&libcap-url;
-
- - Libcap-&libcap-version; - - - Libcap - - - - - - <para>The Libcap package implements the user-space interfaces to the POSIX - 1003.1e capabilities available in Linux kernels. These capabilities are a - partitioning of the all powerful root privilege into a set of distinct - privileges.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&libcap-ch6-sbu;</seg> - <seg>&libcap-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Libcap - - Prevent a static library from being installed: - -sed -i '/install.*STACAPLIBNAME/d' libcap/Makefile - - Compile the package: - -make lib=lib - - - The meaning of the make option: - - - lib=lib - - This parameter sets the library directory to - /lib rather than - /lib64 on x86_64. It has no effect on - x86. - - - - - To test the results, issue: - -make test - - Install the package and do some cleanup: - -make lib=lib PKGCONFIGDIR=/usr/lib/pkgconfig install -chmod -v 755 /lib/libcap.so.&libcap-version; -mv -v /lib/libpsx.a /usr/lib -rm -v /lib/libcap.so -ln -sfv ../../lib/libcap.so.2 /usr/lib/libcap.so - - - - - Contents of Libcap - - - Installed programs - Installed library - - - capsh, getcap, getpcaps, and setcap - libcap.so and libpsx.a - - - - - Short Descriptions - - - - - capsh - - A shell wrapper to explore and constrain capability support - - capsh - - - - - - getcap - - Examines file capabilities - - getcap - - - - - - getpcaps - - Displays the capabilities on the queried process(es) - - getpcaps - - - - - - setcap - - Sets file capabilities - - setcap - - - - - - libcap - - Contains the library functions for manipulating POSIX 1003.1e - capabilities - - libcap - - - - - - libpsx - - Contains functions to support POSIX semantics for syscalls - associated with the pthread library - - libpsx - - - - - - - - -
diff --git a/chapter06/libelf.xml b/chapter06/libelf.xml deleted file mode 100644 index b559e6aa2..000000000 --- a/chapter06/libelf.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - %general-entities; -]> - - - - - - libelf - &elfutils-version; -
&elfutils-url;
-
- - Libelf from Elfutils-&elfutils-version; - - - Libelf - - - - - - <para>Libelf is a library for handling ELF (Executable and Linkable Format) - files.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&elfutils-ch6-sbu;</seg> - <seg>&elfutils-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Libelf - - Libelf is part of elfutils-&elfutils-version; package. Use - the elfutils-&elfutils-version;.tar.bz2 as the source tarball. - - Prepare Libelf for compilation: - -./configure --prefix=/usr --disable-debuginfod - - Compile the package: - -make - - To test the results, issue: - -make check - - - - Install only Libelf: - -make -C libelf install -install -vm644 config/libelf.pc /usr/lib/pkgconfig -rm /usr/lib/libelf.a - - - - - Contents of Libelf - - - Installed Library - Installed Directory - - - - libelf.so - - - /usr/include/elfutils - - - - - - -
diff --git a/chapter06/libffi.xml b/chapter06/libffi.xml deleted file mode 100644 index 6a6f8a458..000000000 --- a/chapter06/libffi.xml +++ /dev/null @@ -1,133 +0,0 @@ - - - %general-entities; -]> - - - - - - libffi - &libffi-version; -
&libffi-url;
-
- - Libffi-&libffi-version; - - - libffi - - - - - - <para>The Libffi library provides a portable, high level programming - interface to various calling conventions. This allows a programmer to call - any function specified by a call interface description at run time.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&libffi-ch6-sbu;</seg> - <seg>&libffi-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Libffi - - - Similar to GMP, libffi builds with optimizations specific - to the proccesor in use. If building for another system, export - CFLAGS and CXXFLAGS to specify a generic build for your architecture. - If this is not done, all applications that link to libffi will trigger - Illegal Operation Errors. - - - Prepare libffi for compilation: - -./configure --prefix=/usr --disable-static --with-gcc-arch=native - - - The meaning of the configure option: - - - --with-gcc-arch=native - - Ensure gcc optimizes for the current system. If this - is not specified, the system is guessed and the code generated - may not be correct for some systems. If the generated code - will be copied from the native system to a less capable - system, use the less capable system as a parameter. For details - about alternative system types, see - the x86 options in the gcc manual. - - - - - - Compile the package: - -make - - To test the results, issue: - -make check - - Six tests, all related to test-callback.c, are known to fail. - - Install the package: - -make install - - - - - Contents of Libffi - - - Installed library - - - libffi.so - - - - - Short Descriptions - - - - - libffi - - contains the libffi API functions. - - libffi - - - - - - - -
- diff --git a/chapter06/libpipeline.xml b/chapter06/libpipeline.xml deleted file mode 100644 index eb5a19438..000000000 --- a/chapter06/libpipeline.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - %general-entities; -]> - - - - - - libpipeline - &libpipeline-version; -
&libpipeline-url;
-
- - Libpipeline-&libpipeline-version; - - - Libpipeline - - - - - - <para>The Libpipeline package contains a library for manipulating pipelines - of subprocesses in a flexible and convenient way.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&libpipeline-ch6-sbu;</seg> - <seg>&libpipeline-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Libpipeline - - Prepare Libpipeline for compilation: - -./configure --prefix=/usr - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make install - - - - - Contents of Libpipeline - - - Installed library - - - libpipeline.so - - - - - Short Descriptions - - - - - libpipeline - - This library is used to safely construct pipelines between - subprocesses - - libpipeline - - - - - - - -
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/libtool.xml b/chapter06/libtool.xml deleted file mode 100644 index 3093b4164..000000000 --- a/chapter06/libtool.xml +++ /dev/null @@ -1,129 +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-libtool" role="wrap"> - <?dbhtml filename="libtool.html"?> - - <sect1info condition="script"> - <productname>libtool</productname> - <productnumber>&libtool-version;</productnumber> - <address>&libtool-url;</address> - </sect1info> - - <title>Libtool-&libtool-version; - - - Libtool - - - - - - <para>The Libtool package contains the GNU generic library support script. - It wraps the complexity of using shared libraries in a consistent, portable - interface.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&libtool-ch6-sbu;</seg> - <seg>&libtool-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Libtool - - Prepare Libtool for compilation: - -./configure --prefix=/usr - - Compile the package: - -make - -To test the results, issue: - -make check - - The test time for libtool can be reduced significantly on a - system with multiple cores. To do this, append - TESTSUITEFLAGS=-j<N> to the line above. For - instance, using -j4 can reduce the test time by over 60 - percent. - - Five tests are known to fail in the LFS build environment due - to a circular dependency, but all tests pass if rechecked after - automake is installed. - - Install the package: - -make install - - - - - - Contents of Libtool - - - Installed programs - Installed libraries - Installed directories - - - libtool and libtoolize - libltdl.so - /usr/include/libltdl and /usr/share/libtool - - - - - Short Descriptions - - - - - libtool - - Provides generalized library-building support services - - libtool - - - - - - libtoolize - - Provides a standard way to add libtool - support to a package - - libtoolize - - - - - - libltdl - - Hides the various difficulties of dlopening libraries - - libltdl - - - - - - - - -
diff --git a/chapter06/linux-headers.xml b/chapter06/linux-headers.xml new file mode 100644 index 000000000..6c1af3173 --- /dev/null +++ b/chapter06/linux-headers.xml @@ -0,0 +1,207 @@ + + + %general-entities; +]> + + + + + + linux-headers + &linux-version; +
&linux-url;
+
+ + Linux-&linux-version; API Headers + + + Linux + tools, API headers + + + + + + <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) - Compile the package: + + The meaning of the new configure option: -make + + --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. + + + - 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: + Compile the package: -make check +make 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/man-db.xml b/chapter06/man-db.xml deleted file mode 100644 index f2f46b891..000000000 --- a/chapter06/man-db.xml +++ /dev/null @@ -1,456 +0,0 @@ - - - %general-entities; -]> - - - - - - man-db - &man-db-version; -
&man-db-url;
-
- - Man-DB-&man-db-version; - - - Man-DB - - - - - - <para>The Man-DB package contains programs for finding and viewing man - pages.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&man-db-ch6-sbu;</seg> - <seg>&man-db-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Man-DB - - Prepare Man-DB for compilation: - -sed -i '/find/s@/usr@@' init/systemd/man-db.service.in - -./configure --prefix=/usr \ - --docdir=/usr/share/doc/man-db-&man-db-version; \ - --sysconfdir=/etc \ - --disable-setuid \ - --enable-cache-owner=bin \ - --with-browser=/usr/bin/lynx \ - --with-vgrind=/usr/bin/vgrind \ - --with-grap=/usr/bin/grap - -./configure --prefix=/usr \ - --docdir=/usr/share/doc/man-db-&man-db-version; \ - --sysconfdir=/etc \ - --disable-setuid \ - --enable-cache-owner=bin \ - --with-browser=/usr/bin/lynx \ - --with-vgrind=/usr/bin/vgrind \ - --with-grap=/usr/bin/grap \ - --with-systemdtmpfilesdir= \ - --with-systemdsystemunitdir= - - - The meaning of the configure options: - - - sed -i '/find/s@/usr@@' init/systemd/man-db.service.in - - This changes a harcoded path to the find - utility, which we install in - /bin. - - - - - --disable-setuid - - This disables making the man program setuid - to user man. - - - - - --enable-cache-owner=bin - - This makes the system-wide cache files be owned by user - bin. - - - - - --with-... - - These three parameters are used to set some default programs. - lynx is a text-based web browser (see - BLFS for installation instructions), vgrind - converts program sources to Groff input, and grap - is useful for typesetting graphs in Groff documents. The - vgrind and grap programs are - not normally needed for viewing manual pages. They are not part of - LFS or BLFS, but you should be able to install them yourself after - finishing LFS if you wish to do so. - - - - - --with-systemd... - - These parameters prevent installing unneeded systemd - directories and files. - - - - - - Compile the package: - -make - - To test the results, issue: - -make check - - One test, man-missing-locales, is known to fail in the LFS chroot envirnment. - - Install the package: - -make install - - - - - Non-English Manual Pages in LFS - - The following table shows the character set that Man-DB assumes - manual pages installed under - /usr/share/man/<ll> will be - encoded with. In addition to this, Man-DB correctly determines if manual - pages installed in that directory are UTF-8 encoded. - - - -Expected character encoding of legacy 8-bit manual pages - - - - - - - - - - - - Language (code) - Encoding - Language (code) - Encoding - - - - - - Danish (da) - ISO-8859-1 - Croatian (hr) - ISO-8859-2 - - - German (de) - ISO-8859-1 - Hungarian (hu) - ISO-8859-2 - - - English (en) - ISO-8859-1 - Japanese (ja) - EUC-JP - - - Spanish (es) - ISO-8859-1 - Korean (ko) - EUC-KR - - - Estonian (et) - ISO-8859-1 - Lithuanian (lt) - ISO-8859-13 - - - Finnish (fi) - ISO-8859-1 - Latvian (lv) - ISO-8859-13 - - - French (fr) - ISO-8859-1 - Macedonian (mk) - ISO-8859-5 - - - Irish (ga) - ISO-8859-1 - Polish (pl) - ISO-8859-2 - - - Galician (gl) - ISO-8859-1 - Romanian (ro) - ISO-8859-2 - - - Indonesian (id) - ISO-8859-1 - Russian (ru) - KOI8-R - - - Icelandic (is) - ISO-8859-1 - Slovak (sk) - ISO-8859-2 - - - Italian (it) - ISO-8859-1 - Slovenian (sl) - ISO-8859-2 - - - Norwegian Bokmal (nb) - ISO-8859-1 - Serbian Latin (sr@latin) - ISO-8859-2 - - - Dutch (nl) - ISO-8859-1 - Serbian (sr) - ISO-8859-5 - - - Norwegian Nynorsk (nn) - ISO-8859-1 - Turkish (tr) - ISO-8859-9 - - - Norwegian (no) - ISO-8859-1 - Ukrainian (uk) - KOI8-U - - - Portuguese (pt) - ISO-8859-1 - Vietnamese (vi) - TCVN5712-1 - - - Swedish (sv) - ISO-8859-1 - Simplified Chinese (zh_CN) - GBK - - - Belarusian (be) - CP1251 - Simplified Chinese, Singapore (zh_SG) - GBK - - - Bulgarian (bg) - CP1251 - Traditional Chinese, Hong Kong (zh_HK) - BIG5HKSCS - - - Czech (cs) - ISO-8859-2 - Traditional Chinese (zh_TW) - BIG5 - - - Greek (el) - ISO-8859-7 - - - - - - - - -
- - - Manual pages in languages not in the list are not supported. - - -
- - - Contents of Man-DB - - - Installed programs - Installed libraries - Installed directories - - - accessdb, apropos (link to whatis), catman, lexgrog, man, mandb, - manpath, and whatis - libman.so and libmandb.so (both in /usr/lib/man-db) - /usr/lib/man-db, /usr/libexec/man-db, - and /usr/share/doc/man-db-&man-db-version; - - - - - Short Descriptions - - - - - accessdb - - Dumps the whatis database contents in - human-readable form - - accessdb - - - - - - apropos - - Searches the whatis database and displays - the short descriptions of system commands that contain a given - string - - apropos - - - - - - catman - - Creates or updates the pre-formatted manual pages - - catman - - - - - - lexgrog - - Displays one-line summary information about a given manual - page - - lexgrog - - - - - - man - - Formats and displays the requested manual page - - man - - - - - - mandb - - Creates or updates the whatis database - - mandb - - - - - - manpath - - Displays the contents of $MANPATH or (if $MANPATH is not set) - a suitable search path based on the settings in man.conf and the - user's environment - - manpath - - - - - - whatis - - Searches the whatis database and displays - the short descriptions of system commands that contain the given - keyword as a separate word - - whatis - - - - - - libman - - Contains run-time support for man - - libman - - - - - - libmandb - - Contains run-time support for man - - libmandb - - - - - - - - -
diff --git a/chapter06/man-pages.xml b/chapter06/man-pages.xml deleted file mode 100644 index 3d2c52046..000000000 --- a/chapter06/man-pages.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - %general-entities; -]> - - - - - - man-pages - &man-pages-version; -
&man-pages-url;
-
- - Man-pages-&man-pages-version; - - - Man-pages - - - - - - <para>The Man-pages package contains over 2,200 man pages.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&man-pages-ch6-sbu;</seg> - <seg>&man-pages-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Man-pages - - Install Man-pages by running: - -make install - - - - - Contents of Man-pages - - - Installed files - - - various man pages - - - - - Short Descriptions - - - - - man pages - - Describe C programming language functions, important - device files, and significant configuration files - - man pages - - - - - - - - -
diff --git a/chapter06/meson.xml b/chapter06/meson.xml deleted file mode 100644 index 0b49c5441..000000000 --- a/chapter06/meson.xml +++ /dev/null @@ -1,109 +0,0 @@ - - - %general-entities; -]> - - - - - - meson - &meson-version; -
&meson-url;
-
- - Meson-&meson-version; - - - Meson - - - - - - <para>Meson is an open source build system meant to be both extremely fast, - and, even more importantly, as user friendly as possible.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - <seglistitem> - <seg>&meson-ch6-sbu;</seg> - <seg>&meson-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Meson - - Compile Meson with the following command: - -python3 setup.py build - - This package does not come with a test suite. - - Install the package: - -python3 setup.py install --root=dest -cp -rv dest/* / - - - The meaning of the install parameters: - - - --root=dest - - By default python3 setup.py install - installs various files (such as man pages) into Python Eggs. - With a specified root location, setup.py installs - these files into a standard hierarchy. Then we can just copy - the hierarchy so the files will be in the standard location. - - - - - - - - - Contents of Meson - - - Installed programs - Installed directory - - - meson - /usr/lib/python&python-minor;/site-packages/meson-&meson-version;-py&python-minor;.egg-info and /usr/lib/python&python-minor;/site-packages/mesonbuild - - - - - Short Descriptions - - - - - meson - - A high productivity build system - - meson - - - - - - - - -
- diff --git a/chapter06/mpc.xml b/chapter06/mpc.xml deleted file mode 100644 index 2d518c8c1..000000000 --- a/chapter06/mpc.xml +++ /dev/null @@ -1,100 +0,0 @@ - - - %general-entities; -]> - - - - - - mpc - &mpc-version; -
&mpc-url;
-
- - MPC-&mpc-version; - - - MPC - - - - - - <para>The MPC package contains a library for the arithmetic of complex - numbers with arbitrarily high precision and correct rounding of the - result.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&mpc-ch6-sbu;</seg> - <seg>&mpc-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of MPC - - Prepare MPC for compilation: - -./configure --prefix=/usr \ - --disable-static \ - --docdir=/usr/share/doc/mpc-&mpc-version; - - Compile the package and generate the HTML documentation: - -make -make html - - To test the results, issue: - -make check - - Install the package and its documentation: - -make install -make install-html - - - - - - Contents of MPC - - - Installed Libraries - Installed Directory - - - libmpc.so - /usr/share/doc/mpc-&mpc-version; - - - - - Short Descriptions - - - - - libmpc - - Contains complex math functions - - libmpc - - - - - - - - -
diff --git a/chapter06/mpfr.xml b/chapter06/mpfr.xml deleted file mode 100644 index ff8e323b7..000000000 --- a/chapter06/mpfr.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - %general-entities; -]> - - - - - - mpfr - &mpfr-version; -
&mpfr-url;
-
- - MPFR-&mpfr-version; - - - MPFR - - - - - - <para>The MPFR package contains functions for multiple precision - math.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&mpfr-ch6-sbu;</seg> - <seg>&mpfr-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of MPFR - - Prepare MPFR for compilation: - -./configure --prefix=/usr \ - --disable-static \ - --enable-thread-safe \ - --docdir=/usr/share/doc/mpfr-&mpfr-version; - - Compile the package and generate the HTML documentation: - -make -make html - - - The test suite for MPFR in this section is considered critical. - Do not skip it under any circumstances. - - - Test the results and ensure that all tests passed: - -make check - - Install the package and its documentation: - -make install -make install-html - - - - - - Contents of MPFR - - - Installed Libraries - Installed directory - - - libmpfr.so - /usr/share/doc/mpfr-&mpfr-version; - - - - - Short Descriptions - - - - - libmpfr - - Contains multiple-precision math functions - - libmpfr - - - - - - - - -
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 - - 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 +ln -sfv ../../lib/$(readlink $LFS/usr/lib/libncursesw.so) $LFS/usr/lib/libncursesw.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 - - - + + - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-ncurses" role="."/></para> </sect2> diff --git a/chapter06/ninja.xml b/chapter06/ninja.xml deleted file mode 100644 index e998c64fb..000000000 --- a/chapter06/ninja.xml +++ /dev/null @@ -1,132 +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-ninja" role="wrap"> - <?dbhtml filename="ninja.html"?> - - <sect1info condition="script"> - <productname>ninja</productname> - <productnumber>&ninja-version;</productnumber> - <address>&ninja-url;</address> - </sect1info> - - <title>Ninja-&ninja-version; - - - Ninja - - - - - - <para>Ninja is a small build system with a focus on speed.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&ninja-ch6-sbu;</seg> - <seg>&ninja-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Ninja - - When run, ninja normally runs a maximum number of processes - in parallel. By default this is the number of cores on the system - plus two. In some cases this can overheat a CPU or run a system out - of memory. If run from the command line, passing a -jN parameter - will limit the number of parallel processes, but some packages - embed the execution of ninja and do not pass a -j parameter. - - Using the optional procedure below allows a user to - limit the number of parallel processes via an environment variable, - NINJAJOBS. For example, setting: - - - - export NINJAJOBS=4 - - will limit ninja to four parallel processes. - - If desired, add the capability to use the environment variable - NINJAJOBS by running: - -sed -i '/int Guess/a \ - int j = 0;\ - char* jobs = getenv( "NINJAJOBS" );\ - if ( jobs != NULL ) j = atoi( jobs );\ - if ( j > 0 ) return j;\ -' src/ninja.cc - - Build Ninja with: - -python3 configure.py --bootstrap - - - The meaning of the build option: - - - --bootstrap - - This parameter forces ninja to rebuild itself for the current - system. - - - - - - To test the results, issue: - -./ninja ninja_test -./ninja_test --gtest_filter=-SubprocessTest.SetWithLots - - Install the package: - -install -vm755 ninja /usr/bin/ -install -vDm644 misc/bash-completion /usr/share/bash-completion/completions/ninja -install -vDm644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja - - - - - Contents of Ninja - - - Installed programs - - - ninja - - - - Short Descriptions - - - - - ninja - - is the Ninja build system. - - ninja - - - - - - - - - - diff --git a/chapter06/openssl.xml b/chapter06/openssl.xml deleted file mode 100644 index f2ff1fa80..000000000 --- a/chapter06/openssl.xml +++ /dev/null @@ -1,176 +0,0 @@ - - - %general-entities; -]> - - - - - - openssl - &openssl-version; -
&openssl-url;
-
- - OpenSSL-&openssl-version; - - - OpenSSL - - - - - - <para>The OpenSSL package contains management tools and libraries relating - to cryptography. These are useful for providing cryptographic functions - to other packages, such as OpenSSH, email applications and web browsers - (for accessing HTTPS sites). </para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&openssl-ch6-sbu;</seg> - <seg>&openssl-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of OpenSSL - - Prepare OpenSSL for compilation: - -./config --prefix=/usr \ - --openssldir=/etc/ssl \ - --libdir=lib \ - shared \ - zlib-dynamic - - Compile the package: - -make - - To test the results, issue: - -make test - - One test 30-test_afalg.t is known to fail on some kernel - configurations (it apparently assumes certain unspecified crypto - options have been selected). - - Install the package: - -sed -i '/INSTALL_LIBS/s/libcrypto.a libssl.a//' Makefile -make MANSUFFIX=ssl install - - If desired, install the documentation: - -mv -v /usr/share/doc/openssl /usr/share/doc/openssl-&openssl-version; -cp -vfr doc/* /usr/share/doc/openssl-&openssl-version; - - - - - Contents of OpenSSL - - - Installed programs - Installed libraries - Installed directories - - - - c_rehash and openssl - - - libcrypto.{so,a} and libssl.{so,a} - - - /etc/ssl, - /usr/include/openssl, - /usr/lib/engines and - /usr/share/doc/openssl-&openssl-version; - - - - - - Short Descriptions - - - - - c_rehash - - - is a Perl script that scans all files in - a directory and adds symbolic links to their hash values. - - - c_rehash - - - - - - openssl - - - is a command-line tool for using the various cryptography functions - of OpenSSL's crypto library from the - shell. It can be used for various functions which are documented in - man 1 openssl. - - - openssl - - - - - - libcrypto.so - - - implements a wide range of cryptographic algorithms used in various - Internet standards. The services provided by this library are used - by the OpenSSL implementations of SSL, - TLS and S/MIME, and they have also been used to implement - OpenSSH, - OpenPGP, and other cryptographic - standards. - - - libcrypto.so - - - - - - libssl.so - - - implements the Transport Layer Security (TLS v1) protocol. - It provides a rich API, documentation - on which can be found by running man 3 ssl. - - - libssl.so - - - - - - - - -
diff --git a/chapter06/patch.xml b/chapter06/patch.xml index 6c6c6852b..ecd5b2c47 100644 --- a/chapter06/patch.xml +++ b/chapter06/patch.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,24 +16,25 @@ Patch-&patch-version; - + Patch + tools - <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 - - - Installed program - - - patch - - + + - <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: - - - -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. - - - + The meaning of the new Configure options: - -Duseshrplib + -des - Build a shared libperl needed by some perl modules. - - - - - -Dusethreads - - Build perl with support for threads. + This is a combination of three options: -d uses defaults for + all items; -e ensures completion of all tasks; -s silences + non-essential output. - Compile the package: + Build the package: make - To test the results (approximately 11 SBU), issue: - -make test - - - - Install the package and clean up: - -make install -unset BUILD_ZLIB BUILD_BZIP2 +make install - - Contents of Perl - - - Installed programs - Installed libraries - Installed directory - - - corelist, cpan, enc2xs, encguess, h2ph, h2xs, instmodsh, - json_pp, libnetcfg, perl, perl&perl-version; (hard link to perl), - perlbug, perldoc, perlivp, perlthanks (hard link to perlbug), piconv, - pl2pm, pod2html, pod2man, pod2text, pod2usage, podchecker, podselect, - prove, ptar, ptardiff, ptargrep, shasum, - splain, xsubpp, and zipdetails - Many which cannot all be listed here - /usr/lib/perl5 - - - - - Short Descriptions - - - - - corelist - - A commandline frontend to Module::CoreList - - corelist - - - - - - cpan - - Interact with the Comprehensive Perl Archive Network (CPAN) - from the command line - - cpan - - - - - - enc2xs - - Builds a Perl extension for the Encode module from either - Unicode Character Mappings or Tcl Encoding Files - - enc2xs - - - - - - encguess - - Guess the encoding type of one or several files - - encguess - - - - - - h2ph - - Converts .h C header - files to .ph Perl header - files - - h2ph - - - - - - h2xs - - Converts .h C header - files to Perl extensions - - h2xs - - - - - - instmodsh - - Shell script for examining installed Perl modules, - and can create a tarball from an installed module - - instmodsh - - - - - - json_pp - - Converts data between certain input and output formats - - json_pp - - - - - - libnetcfg - - Can be used to configure the - libnet Perl module - - libnetcfg - - - - - - perl - - Combines some of the best features of C, sed, - awk and sh into a single - swiss-army language - - perl - - - - - - perl&perl-version; - - A hard link to perl - - perl&perl-version; - - - - - - perlbug - - Used to generate bug reports about Perl, or the modules that come - with it, and mail them - - perlbug - - - - - - perldoc - - Displays a piece of documentation in pod format that is embedded - in the Perl installation tree or in a Perl script - - perldoc - - - - - - perlivp - - The Perl Installation Verification Procedure; it can be used to - verify that Perl and its libraries have been installed - correctly - - perlivp - - - - - - perlthanks - - Used to generate thank you messages to mail to the Perl - developers - - perlthanks - - - - - - piconv - - A Perl version of the character encoding converter - iconv - - piconv - - - - - - pl2pm - - A rough tool for converting Perl4 - .pl files to Perl5 - .pm modules - - pl2pm - - - - - - pod2html - - Converts files from pod format to HTML format - - pod2html - - - - - - pod2man - - Converts pod data to formatted *roff input - - pod2man - - - - - - pod2text - - Converts pod data to formatted ASCII text - - pod2text - - - - - - pod2usage - - Prints usage messages from embedded pod docs in files - - pod2usage - - - - - - podchecker - - Checks the syntax of pod format documentation files - - podchecker - - - - - - podselect - - Displays selected sections of pod documentation - - podselect - - - - - - prove - - Command line tool for running tests against the Test::Harness - module - - prove - - - - - - ptar - - A tar-like program written in Perl - - ptar - - - - - - ptardiff - - A Perl program that compares an extracted archive with an - unextracted one - - ptardiff - - - - - - ptargrep - - A Perl program that applies pattern matching to the contents - of files in a tar archive - - ptargrep - - - - - - shasum - - Prints or checks SHA checksums - - shasum - - - - - - splain - - Is used to force verbose warning diagnostics in Perl - - splain - - - - - - xsubpp - - Converts Perl XS code into C code - - xsubpp - - - - - - zipdetails - - Displays details about the internal structure of a Zip file - - zipdetails - - - + + - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-perl" role="."/></para> </sect2> diff --git a/chapter06/pkgconfig.xml b/chapter06/pkgconfig.xml deleted file mode 100644 index 3c311e389..000000000 --- a/chapter06/pkgconfig.xml +++ /dev/null @@ -1,121 +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-pkgconfig" role="wrap"> - <?dbhtml filename="pkg-config.html"?> - - <sect1info condition="script"> - <productname>pkg-config</productname> - <productnumber>&pkgconfig-version;</productnumber> - <address>&pkgconfig-url;</address> - </sect1info> - - <title>Pkg-config-&pkgconfig-version; - - - Pkgconfig - - - - - - <para> The pkg-config package contains a tool for passing the include path - and/or library paths to build tools during the configure and make file - execution.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&pkgconfig-ch6-sbu;</seg> - <seg>&pkgconfig-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Pkg-config - - Prepare Pkg-config for compilation: - -./configure --prefix=/usr \ - --with-internal-glib \ - --disable-host-tool \ - --docdir=/usr/share/doc/pkg-config-&pkgconfig-version; - - - The meaning of the new configure options: - - - --with-internal-glib - - This will allow pkg-config to use its internal version of - Glib because an external version is not available in LFS. - - - - - --disable-host-tool - - This option disables the creation of an undesired hard link - to the pkg-config program. - - - - - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make install - - - - - Contents of Pkg-config - - - Installed program - Installed directory - - - pkg-config - /usr/share/doc/pkg-config-&pkgconfig-version; - - - - - Short Descriptions - - - - - - pkg-config - - Returns meta information for the specified library or package - - - pkg-config - - - - - - - - - diff --git a/chapter06/pkgmgt.xml b/chapter06/pkgmgt.xml deleted file mode 100644 index d28038467..000000000 --- a/chapter06/pkgmgt.xml +++ /dev/null @@ -1,291 +0,0 @@ - - - %general-entities; -]> - - - - - Package Management - - Package Management is an often requested addition to the LFS Book. A - Package Manager allows tracking the installation of files making it easy to - remove and upgrade packages. As well as the binary and library files, a - package manager will handle the installation of configuration files. Before - you begin to wonder, NO—this section will not talk about nor recommend - any particular package manager. What it provides is a roundup of the more - popular techniques and how they work. The perfect package manager for you may - be among these techniques or may be a combination of two or more of these - techniques. This section briefly mentions issues that may arise when upgrading - packages. - - Some reasons why no package manager is mentioned in LFS or BLFS - include: - - - - Dealing with package management takes the focus away from the goals - of these books—teaching how a Linux system is built. - - - - There are multiple solutions for package management, each having - its strengths and drawbacks. Including one that satisfies all audiences - is difficult. - - - - There are some hints written on the topic of package management. Visit - the Hints Project and see if one of them - fits your need. - - - Upgrade Issues - - A Package Manager makes it easy to upgrade to newer versions when they - are released. Generally the instructions in the LFS and BLFS Book can be - used to upgrade to the newer versions. Here are some points that you should - be aware of when upgrading packages, especially on a running system. - - - - If Glibc needs to be upgraded to a newer version, (e.g. from - glibc-2.19 to glibc-2.20), it is safer to rebuild LFS. Though you - may be able to rebuild all the packages in their - dependency order, we do not recommend it. - - - - If a package containing a shared library is updated, and if the - name of the library changes, then all the packages dynamically linked - to the library need to be recompiled to link against the newer library. - (Note that there is no correlation between the package version and the - name of the library.) For example, consider a package foo-1.2.3 that - installs a shared library with name - libfoo.so.1. Say you upgrade - the package to a newer version foo-1.2.4 that installs a shared library - with name libfoo.so.2. In this - case, all packages that are dynamically linked to - libfoo.so.1 need to be - recompiled to link against - libfoo.so.2. Note that you - should not remove the previous libraries until the dependent packages - are recompiled. - - - - - - - Package Management Techniques - - The following are some common package management techniques. Before - making a decision on a package manager, do some research on the various - techniques, particularly the drawbacks of the particular scheme. - - - It is All in My Head! - - Yes, this is a package management technique. Some folks do not find - the need for a package manager because they know the packages intimately - and know what files are installed by each package. Some users also do not - need any package management because they plan on rebuilding the entire - system when a package is changed. - - - - - Install in Separate Directories - - This is a simplistic package management that does not need any extra - package to manage the installations. Each package is installed in a - separate directory. For example, package foo-1.1 is installed in - /usr/pkg/foo-1.1 - and a symlink is made from /usr/pkg/foo to - /usr/pkg/foo-1.1. When installing - a new version foo-1.2, it is installed in - /usr/pkg/foo-1.2 and the previous - symlink is replaced by a symlink to the new version. - - Environment variables such as PATH, - LD_LIBRARY_PATH, MANPATH, - INFOPATH and CPPFLAGS need to be expanded to - include /usr/pkg/foo. For more than a few packages, - this scheme becomes unmanageable. - - - - - Symlink Style Package Management - - This is a variation of the previous package management technique. - Each package is installed similar to the previous scheme. But instead of - making the symlink, each file is symlinked into the - /usr hierarchy. This removes the - need to expand the environment variables. Though the symlinks can be - created by the user to automate the creation, many package managers have - been written using this approach. A few of the popular ones include Stow, - Epkg, Graft, and Depot. - - The installation needs to be faked, so that the package thinks that - it is installed in /usr though in - reality it is installed in the - /usr/pkg hierarchy. Installing in - this manner is not usually a trivial task. For example, consider that you - are installing a package libfoo-1.1. The following instructions may - not install the package properly: - -./configure --prefix=/usr/pkg/libfoo/1.1 -make -make install - - The installation will work, but the dependent packages may not link - to libfoo as you would expect. If you compile a package that links against - libfoo, you may notice that it is linked to - /usr/pkg/libfoo/1.1/lib/libfoo.so.1 - instead of /usr/lib/libfoo.so.1 - as you would expect. The correct approach is to use the - DESTDIR strategy to fake installation of the package. This - approach works as follows: - -./configure --prefix=/usr -make -make DESTDIR=/usr/pkg/libfoo/1.1 install - - Most packages support this approach, but there are some which do not. - For the non-compliant packages, you may either need to manually install the - package, or you may find that it is easier to install some problematic - packages into /opt. - - - - - Timestamp Based - - In this technique, a file is timestamped before the installation of - the package. After the installation, a simple use of the - find command with the appropriate options can generate - a log of all the files installed after the timestamp file was created. A - package manager written with this approach is install-log. - - Though this scheme has the advantage of being simple, it has two - drawbacks. If, during installation, the files are installed with any - timestamp other than the current time, those files will not be tracked by - the package manager. Also, this scheme can only be used when one package - is installed at a time. The logs are not reliable if two packages are - being installed on two different consoles. - - - - - Tracing Installation Scripts - - In this approach, the commands that the installation scripts perform - are recorded. There are two techniques that one can use: - - The LD_PRELOAD environment variable can be set to - point to a library to be preloaded before installation. During - installation, this library tracks the packages that are being installed by - attaching itself to various executables such as cp, - install, mv and tracking the system - calls that modify the filesystem. For this approach to work, all the - executables need to be dynamically linked without the suid or sgid bit. - Preloading the library may cause some unwanted side-effects during - installation. Therefore, it is advised that one performs some tests to - ensure that the package manager does not break anything and logs all the - appropriate files. - - The second technique is to use strace, which - logs all system calls made during the execution of the installation - scripts. - - - - Creating Package Archives - - In this scheme, the package installation is faked into a separate - tree as described in the Symlink style package management. After the - installation, a package archive is created using the installed files. - This archive is then used to install the package either on the local - machine or can even be used to install the package on other machines. - - This approach is used by most of the package managers found in the - commercial distributions. Examples of package managers that follow this - approach are RPM (which, incidentally, is required by the Linux - Standard Base Specification), pkg-utils, Debian's apt, and - Gentoo's Portage system. A hint describing how to adopt this style of - package management for LFS systems is located at . - - Creation of package files that include dependency information is - complex and is beyond the scope of LFS. - - Slackware uses a tar based system for package - archives. This system purposely does not handle package dependencies - as more complex package managers do. For details of Slackware package - management, see . - - - - User Based Management - - This scheme, unique to LFS, was devised by Matthias Benkmann, and is - available from the Hints Project. In - this scheme, each package is installed as a separate user into the - standard locations. Files belonging to a package are easily identified by - checking the user ID. The features and shortcomings of this approach are - too complex to describe in this section. For the details please see the - hint at . - - - - - - - Deploying LFS on Multiple Systems - - One of the advantages of an LFS system is that there are no files that - depend on the position of files on a disk system. Cloning an LFS build to - another computer with the same architecture as the base system is as - simple as using tar on the LFS partition that contains - the root directory (about 250MB uncompressed for a base LFS build), copying - that file via network transfer or CD-ROM to the new system and expanding - it. From that point, a few configuration files will have to be changed. - Configuration files that may need to be updated include: - /etc/hosts, - /etc/fstab, - /etc/passwd, - /etc/group, - - /etc/shadow, and - /etc/ld.so.conf. - - - /etc/shadow, - /etc/ld.so.conf, - /etc/sysconfig/rc.site, - /etc/sysconfig/network, and - /etc/sysconfig/ifconfig.eth0. - - - - A custom kernel may need to be built for the new system depending on - differences in system hardware and the original kernel - configuration. - - There have been some reports of issues when copying between - similar but not identical architectures. For instance, the instruction set - for an Intel system is not identical with an AMD processor and later - versions of some processors may have instructions that are unavailable in - earlier versions. - - Finally the new system has to be made bootable via . - - - - diff --git a/chapter06/procps.xml b/chapter06/procps.xml deleted file mode 100644 index 59bf0864c..000000000 --- a/chapter06/procps.xml +++ /dev/null @@ -1,292 +0,0 @@ - - - %general-entities; -]> - - - - - - procps-ng - &procps-ng-version; -
&procps-ng-url;
-
- - Procps-ng-&procps-ng-version; - - - Procps-ng - - - - - - <para>The Procps-ng package contains programs for monitoring processes.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&procps-ng-ch6-sbu;</seg> - <seg>&procps-ng-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Procps-ng - - Prepare procps-ng for compilation: - -./configure --prefix=/usr \ - --exec-prefix= \ - --libdir=/usr/lib \ - --docdir=/usr/share/doc/procps-ng-&procps-ng-version; \ - --disable-static \ - --disable-kill - -./configure --prefix=/usr \ - --exec-prefix= \ - --libdir=/usr/lib \ - --docdir=/usr/share/doc/procps-ng-&procps-ng-version; \ - --disable-static \ - --disable-kill \ - --with-systemd - - - The meaning of the configure options: - - - --disable-kill - - This switch disables building the kill - command that will be installed by the Util-linux package. - - - - - Compile the package: - -make - - The test suite needs some custom modifications for LFS. - Remove a test that fails when scripting does not use a tty device and - fix two others. - To run the test suite, run the following commands: - -sed -i -r 's|(pmap_initname)\\\$|\1|' testsuite/pmap.test/pmap.exp -sed -i '/set tty/d' testsuite/pkill.test/pkill.exp -rm testsuite/pgrep.test/pgrep.exp -make check - - Install the package: - -make install - -Finally, move essential libraries to a location that can be found if -/usr is not mounted. - -mv -v /usr/lib/libprocps.so.* /lib -ln -sfv ../../lib/$(readlink /usr/lib/libprocps.so) /usr/lib/libprocps.so - - - - - Contents of Procps-ng - - - Installed programs - Installed library - Installed directories - - - free, pgrep, pidof, pkill, pmap, ps, pwdx, slabtop, - sysctl, tload, top, uptime, vmstat, w, and watch - libprocps.so - /usr/include/proc and /usr/share/doc/procps-ng-&procps-ng-version; - - - - - Short Descriptions - - - - - free - - Reports the amount of free and used memory (both physical and - swap memory) in the system - - free - - - - - - pgrep - - Looks up processes based on their name and other attributes - - pgrep - - - - - - pidof - - Reports the PIDs of the given programs - - pidof - - - - - - pkill - - Signals processes based on their name and other attributes - - pkill - - - - - - pmap - - Reports the memory map of the given process - - pmap - - - - - - ps - - Lists the current running processes - - ps - - - - - - pwdx - - Reports the current working directory of a process - - pwdx - - - - - - slabtop - - Displays detailed kernel slab cache information in real time - - slabtop - - - - - - sysctl - - Modifies kernel parameters at run time - - sysctl - - - - - - tload - - Prints a graph of the current system load average - - tload - - - - - - top - - Displays a list of the most CPU intensive processes; it - provides an ongoing look at processor activity in real time - - top - - - - - - uptime - - Reports how long the system has been running, how many users are - logged on, and the system load averages - - uptime - - - - - - vmstat - - Reports virtual memory statistics, giving information about - processes, memory, paging, block Input/Output (IO), traps, and CPU - activity - - vmstat - - - - - - w - - Shows which users are currently logged on, where, and since - when - - w - - - - - - watch - - Runs a given command repeatedly, displaying the first - screen-full of its output; this allows a user to watch the output - change over time - - watch - - - - - - libprocps - - Contains the functions used by most programs in this - package - - libprocps - - - - - - - - -
diff --git a/chapter06/psmisc.xml b/chapter06/psmisc.xml deleted file mode 100644 index b01303131..000000000 --- a/chapter06/psmisc.xml +++ /dev/null @@ -1,160 +0,0 @@ - - - %general-entities; -]> - - - - - - psmisc - &psmisc-version; -
&psmisc-url;
-
- - Psmisc-&psmisc-version; - - - Psmisc - - - - - - <para>The Psmisc package contains programs for displaying information about - running processes.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&psmisc-ch6-sbu;</seg> - <seg>&psmisc-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Psmisc - - Prepare Psmisc for compilation: - -./configure --prefix=/usr - - Compile the package: - -make - - This package does not come with a test suite. - - Install the package: - -make install - - Finally, move the killall and fuser - programs to the location specified by the FHS: - -mv -v /usr/bin/fuser /bin -mv -v /usr/bin/killall /bin - - - - - Contents of Psmisc - - - Installed programs - - - fuser, killall, peekfd, prtstat, pslog, pstree, and pstree.x11 (link to pstree) - - - - - Short Descriptions - - - - - fuser - - Reports the Process IDs (PIDs) of processes that use the given - files or file systems - - fuser - - - - - - killall - - Kills processes by name; it sends a signal to all processes - running any of the given commands - - killall - - - - - - peekfd - - Peek at file descriptors of a running process, given its - PID - - peekfd - - - - - - prtstat - - Prints information about a process - - prtstat - - - - - - pslog - - Reports current logs path of a process - - pslog - - - - - - pstree - - Displays running processes as a tree - - pstree - - - - - - pstree.x11 - - Same as pstree, except that it waits for - confirmation before exiting - - pstree.x11 - - - - - - - - -
diff --git a/chapter06/python.xml b/chapter06/python.xml index cc440903d..52c070ab3 100644 --- a/chapter06/python.xml +++ b/chapter06/python.xml @@ -5,8 +5,8 @@ %general-entities; ]> - - + + Python @@ -16,66 +16,54 @@ Python-&python-version; - - python + + Python + temporary - <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: - - - --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. - - + The meaning of the configure option: + + + --without-ensurepip + + This switch disables the Python package installer, which is not + needed at this stage. + + @@ -83,171 +71,18 @@ make - To test the results, issue make test. - Some tests requiring network connection or additional packages are - skipped. The test named test_normalization fails because network - configuration is not completed yet. For more comprehensive results, - the test can be rerun when Python 3 is reinstalled in BLFS. - Install the package: -make install -chmod -v 755 /usr/lib/libpython&python-minor;.so -chmod -v 755 /usr/lib/libpython3.so -ln -sfv pip&python-minor; /usr/bin/pip3 - - - The meaning of the install commands: - - - chmod -v 755 /usr/lib/libpython3.{8.,}so - - Fix permissions for libraries to be consistent with other - libraries. - - - - - - If desired, install the preformatted documentation: - -install -v -dm755 /usr/share/doc/python-&python-version;/html - -tar --strip-components=1 \ - --no-same-owner \ - --no-same-permissions \ - -C /usr/share/doc/python-&python-version;/html \ - -xvf ../python-&python-version;-docs-html.tar.bz2 - - - The meaning of the documentation install commands: - - - and - - Ensure the installed files have the correct ownership and - permissions. Without these options, using tar - will install the package files with the upstream creator's values. - - - - - +make install - - Contents of Python 3 - - - Installed Programs - Installed Library - Installed Directories - - - - 2to3, idle3, pip3, pydoc3, python3, and python3-config - - - libpython&python-minor;.so and libpython3.so - - - /usr/include/python&python-minor;, - /usr/lib/python3, and - /usr/share/doc/python-&python-version; - - - - - - Short Descriptions - - - - - 2to3 - - - is a Python program that reads - Python 2.x source code and applies a - series of fixes to transform it into valid - Python 3.x code. - - - 2to3 - - - - - - idle3 - - - is a wrapper script that opens a Python - aware GUI editor. For this script to run, you must have installed - Tk before Python so that the Tkinter - Python module is built. - - - idle3 - - - - - - pip3 - - - The package installer for Python. You can use pip to install - packages from Python Package Index and other indexes. - - - pip3 - - - - - - pydoc3 - - - is the Python documentation tool. - - - pydoc3 - - - + + - <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/readline.xml b/chapter06/readline.xml deleted file mode 100644 index 87571ea9d..000000000 --- a/chapter06/readline.xml +++ /dev/null @@ -1,156 +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-readline" role="wrap"> - <?dbhtml filename="readline.html"?> - - <sect1info condition="script"> - <productname>readline</productname> - <productnumber>&readline-version;</productnumber> - <address>&readline-url;</address> - </sect1info> - - <title>Readline-&readline-version; - - - Readline - - - - - - <para>The Readline package is a set of libraries that offers command-line - editing and history capabilities.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&readline-ch6-sbu;</seg> - <seg>&readline-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Readline - - Reinstalling Readline will cause the old libraries to be moved to - <libraryname>.old. While this is normally not a problem, in some cases - it can trigger a linking bug in ldconfig. This can be - avoided by issuing the following two seds: - -sed -i '/MV.*old/d' Makefile.in -sed -i '/{OLDSUFF}/c:' support/shlib-install - - Prepare Readline for compilation: - -./configure --prefix=/usr \ - --disable-static \ - --with-curses \ - --docdir=/usr/share/doc/readline-&readline-version; - - - The meaning of the configure option: - - - --with-curses" - - This option tells Readline that it can find the termcap - library functions in the curses library, rather than a separate - termcap library. It allows generating a correct - readline.pc file. - - - - - - Compile the package: - -make SHLIB_LIBS="-lncursesw" - - - The meaning of the make option: - - - SHLIB_LIBS="-lncursesw" - - This option forces Readline to link against the - libncursesw library. - - - - - - This package does not come with a test suite. - - Install the package: - -make SHLIB_LIBS="-lncursesw" install - - Now move the dynamic libraries to a more appropriate location - and fix up some permissions and symbolic links: - -mv -v /usr/lib/lib{readline,history}.so.* /lib -chmod -v u+w /lib/lib{readline,history}.so.* -ln -sfv ../../lib/$(readlink /usr/lib/libreadline.so) /usr/lib/libreadline.so -ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so - - If desired, install the documentation: - -install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-&readline-version; - - - - - Contents of Readline - - - Installed libraries - Installed directories - - - libhistory.so and libreadline.so - /usr/include/readline and - /usr/share/doc/readline-&readline-version; - - - - - Short Descriptions - - - - - libhistory - - Provides a consistent user interface for recalling lines - of history - - libhistory - - - - - - libreadline - - Provides a set of commands for manipulating text entered in an - interactive session of a program. - - libreadline - - - - - - - - - diff --git a/chapter06/revisedchroot.xml b/chapter06/revisedchroot.xml deleted file mode 100644 index 0e836d661..000000000 --- a/chapter06/revisedchroot.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - %general-entities; -]> - - - - - Cleaning Up - - Finally, clean up some extra files left around from running tests: - -rm -rf /tmp/* - - Now log out and reenter the chroot environment with an updated - chroot command. From now on, use this updated chroot command any time - you need to reenter the chroot environment after exiting: - -logout - -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 - - Here the +h option is not used anymore, since - all the previous programs have been replaced: hashing is therefore - possible. - - If the virtual kernel file systems have been unmounted, either manually - or through a reboot, ensure that the virtual kernel file systems are mounted - when reentering the chroot. This process was explained in and . - - There were several static libraries that were not suppressed earlier - in the chapter in order to satisfy the regression tests in several packages. These - libraries are from binutils, bzip2, e2fsprogs, flex, libtool, and zlib. If desired, - remove them now: - -rm -f /usr/lib/lib{bfd,opcodes}.a -rm -f /usr/lib/libctf{,-nobfd}.a -rm -f /usr/lib/libbz2.a -rm -f /usr/lib/lib{com_err,e2p,ext2fs,ss}.a -rm -f /usr/lib/libltdl.a -rm -f /usr/lib/libfl.a -rm -f /usr/lib/libz.a - - There are also several files installed in the /usr/lib and /usr/libexec - directories with a file name extention of .la. These are "libtool archive" - files. As already said, they 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. - To remove them, run: - -find /usr/lib /usr/libexec -name \*.la -delete - - For more information about libtool archive files, see the BLFS section "About Libtool - Archive (.la) files". - - Finally, remove the temporary 'tester' usr account created at the - beginning of this chapter. - -sed -i '/tester/d' /etc/passwd /etc/group -rm -rf /home/tester - diff --git a/chapter06/sed.xml b/chapter06/sed.xml index 030e77a0b..f146b5102 100644 --- a/chapter06/sed.xml +++ b/chapter06/sed.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,22 +16,25 @@ Sed-&sed-version; - + Sed + tools - <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 - - - Installed program - Installed directory - - - sed - /usr/share/doc/sed-&sed-version; - - + + - <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/shadow.xml b/chapter06/shadow.xml deleted file mode 100644 index 425112cbd..000000000 --- a/chapter06/shadow.xml +++ /dev/null @@ -1,608 +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-shadow" role="wrap"> - <?dbhtml filename="shadow.html"?> - - <sect1info condition="script"> - <productname>shadow</productname> - <productnumber>&shadow-version;</productnumber> - <address>&shadow-url;</address> - </sect1info> - - <title>Shadow-&shadow-version; - - - Shadow - - - - - - <para>The Shadow package contains programs for handling passwords in a secure - way.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&shadow-ch6-sbu;</seg> - <seg>&shadow-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Shadow - - - If you would like to enforce the use of strong passwords, refer to - for installing - CrackLib prior to building Shadow. Then add - --with-libcrack to the configure - command below. - - - Disable the installation of the groups program - and its man pages, as Coreutils provides a better version. Also, - prevent the installation of manual pages that were already installed in - : - -sed -i 's/groups$(EXEEXT) //' src/Makefile.in -find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; -find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; -find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; - - Instead of using the default - crypt method, use the more secure - SHA-512 method of password encryption, which also - allows passwords longer than 8 characters. It is also necessary to change - the obsolete /var/spool/mail location - for user mailboxes that Shadow uses by default to the /var/mail location used currently: - -sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \ - -e 's@/var/spool/mail@/var/mail@' etc/login.defs - - - If you chose to build Shadow with Cracklib support, run the following: - -sed -i 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' etc/login.defs - - - Make a minor change to make the first group number generated - by useradd 1000: - -sed -i 's/1000/999/' etc/useradd - - Prepare Shadow for compilation: - -touch /usr/bin/passwd -./configure --sysconfdir=/etc \ - --with-group-name-max-length=32 - - - The meaning of the configure option: - - - touch /usr/bin/passwd - - The file /usr/bin/passwd needs - to exist because its location is harcoded in some programs, and - the default location if it does not exist is not right. - - - - --with-group-name-max-length=32 - - The maximum user name is 32 characters. Make the maximum - group name the same. - - - - - - Compile the package: - -make - - This package does not come with a test suite. - - Install the package: - -make install - - - - - - - - Configuring Shadow - - - Shadow - configuring - - - This package contains utilities to add, modify, and delete users and - groups; set and change their passwords; and perform other administrative - tasks. For a full explanation of what password shadowing - means, see the doc/HOWTO file within the unpacked - source tree. If using Shadow support, keep in mind that programs which need - to verify passwords (display managers, FTP programs, pop3 daemons, etc.) - must be Shadow-compliant. That is, they need to be able to work with - shadowed passwords. - - To enable shadowed passwords, run the following command: - -pwconv - - To enable shadowed group passwords, run: - -grpconv - - Shadow's stock configuration for the useradd - utility has a few caveats that need some explanation. First, the default - action for the useradd utility is to create the user and - a group of the same name as the user. By default the user ID (UID) and - group ID (GID) numbers will begin with 1000. This means if you don't pass - parameters to useradd, each user will be a member of a - unique group on the system. If this behavior is undesirable, you'll need - to pass the -g parameter to - useradd. The default parameters are stored in the - /etc/default/useradd file. You may need to modify two - parameters in this file to suit your particular needs. - - - <filename>/etc/default/useradd</filename> Parameter Explanations - - - GROUP=1000 - - This parameter sets the beginning of the group numbers used in - the /etc/group file. You can modify it to anything you desire. Note - that useradd will never reuse a UID or GID. If the - number identified in this parameter is used, it will use the next - available number after this. Note also that if you don't have a group - 1000 on your system the first time you use useradd - without the -g parameter, you'll get a message - displayed on the terminal that says: - useradd: unknown GID 1000. You may - disregard this message and group number 1000 will be used. - - - - CREATE_MAIL_SPOOL=yes - - This parameter causes useradd to create a - mailbox file for the newly created user. useradd - will make the group ownership of this file to the - mail group with 0660 - permissions. If you would prefer that these mailbox files are not - created by useradd, issue the following - command: - -sed -i 's/yes/no/' /etc/default/useradd - - - - - - - - - - Setting the root password - - Choose a password for user root and set it - by running: - -passwd root - - - - - Contents of Shadow - - - Installed programs - Installed directory - - - chage, chfn, chgpasswd, chpasswd, chsh, expiry, faillog, gpasswd, - groupadd, groupdel, groupmems, groupmod, grpck, grpconv, grpunconv, - lastlog, login, logoutd, newgidmap, newgrp, newuidmap, newusers, - nologin, passwd, pwck, pwconv, pwunconv, sg (link to newgrp), su, - useradd, userdel, usermod, vigr (link to vipw), and vipw - /etc/default - - - - - Short Descriptions - - - - - chage - - Used to change the maximum number of days between obligatory - password changes - - chage - - - - - - chfn - - Used to change a user's full name and other information - - chfn - - - - - - chgpasswd - - Used to update group passwords in batch mode - - chgpasswd - - - - - - chpasswd - - Used to update user passwords in batch mode - - chpasswd - - - - - - chsh - - Used to change a user's default login shell - - chsh - - - - - - expiry - - Checks and enforces the current password expiration policy - - expiry - - - - - - faillog - - Is used to examine the log of login failures, to set a maximum - number of failures before an account is blocked, or to reset the - failure count - - faillog - - - - - - gpasswd - - Is used to add and delete members and administrators to - groups - - gpasswd - - - - - - groupadd - - Creates a group with the given name - - groupadd - - - - - - groupdel - - Deletes the group with the given name - - groupdel - - - - - - groupmems - - Allows a user to administer his/her own group membership list - without the requirement of super user privileges. - - groupmems - - - - - - groupmod - - Is used to modify the given group's name or GID - - groupmod - - - - - - grpck - - Verifies the integrity of the group files - /etc/group and - /etc/gshadow - - grpck - - - - - - grpconv - - Creates or updates the shadow group file from the normal - group file - - grpconv - - - - - - grpunconv - - Updates /etc/group from - /etc/gshadow and then deletes the latter - - grpunconv - - - - - - lastlog - - Reports the most recent login of all users or of a - given user - - lastlog - - - - - - login - - Is used by the system to let users sign on - - login - - - - - - logoutd - - Is a daemon used to enforce restrictions on log-on time - and ports - - logoutd - - - - - - newgidmap - - Is used to set the gid mapping of a user namespace - - newgidmap - - - - - - newgrp - - Is used to change the current GID during a login session - - newgrp - - - - - - newuidmap - - Is used to set the uid mapping of a user namespace - - newuidmap - - - - - - newusers - - Is used to create or update an entire series of user - accounts - - newusers - - - - - - nologin - - Displays a message that an account is not available; it is designed - to be used as the default shell for accounts that have been - disabled - - nologin - - - - - - passwd - - Is used to change the password for a user or group account - - passwd - - - - - - pwck - - Verifies the integrity of the password files - /etc/passwd and - /etc/shadow - - pwck - - - - - - pwconv - - Creates or updates the shadow password file from the normal - password file - - pwconv - - - - - - pwunconv - - Updates /etc/passwd from - /etc/shadow and then deletes the latter - - pwunconv - - - - - - sg - - Executes a given command while the user's GID - is set to that of the given group - - sg - - - - - - su - - Runs a shell with substitute user and group IDs - - su - - - - - - useradd - - Creates a new user with the given name, or updates the default - new-user information - - useradd - - - - - - userdel - - Deletes the given user account - - userdel - - - - - - usermod - - Is used to modify the given user's login name, User - Identification (UID), shell, initial group, home directory, etc. - - usermod - - - - - - vigr - - Edits the /etc/group or - /etc/gshadow files - - vigr - - - - - - vipw - - Edits the /etc/passwd or - /etc/shadow files - - vipw - - - - - - - - - diff --git a/chapter06/stripping.xml b/chapter06/stripping.xml new file mode 100644 index 000000000..7c054b6b2 --- /dev/null +++ b/chapter06/stripping.xml @@ -0,0 +1,53 @@ + + + %general-entities; +]> + + + + + Stripping + + The steps in this section are optional, but if the LFS partition is + rather small, it is beneficial to learn that unnecessary items can be removed. + The executables and libraries built so far contain about 70 MB of unneeded + debugging symbols. Remove those symbols with: + +$LFS_TGT-strip --strip-debug $LFS/usr/lib/* +$LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/* + + These commands will skip a number of files, reporting that it does not + recognize their file format. Most of these are scripts instead of binaries. + Note that we use the strip program built in + Binutils pass 1, since it is the one that knows how to strip + our cross-compiled programs. + + + Take care not to use + --strip-unneeded on the libraries. The static + ones would be destroyed and the toolchain packages would need to be + built all over again. + + To save more, remove the documentation: + +rm -rf $LFS/usr/{,share}/{info,man,doc} + + The libtool .la files are only useful when linking with static + libraries. They are unneeded, and potentially harmful, when using dynamic + shared libraries, specially when using also non-autotools build systems. + Remove those files now: + +find $LFS/usr/{lib,libexec} -name \*.la -delete + + At this point, you should have at least 3 GB of free space in + $LFS that can be used to build and install Glibc and Gcc in + the next phase. If you can build and install Glibc, you can build and install + the rest too. + + diff --git a/chapter06/strippingagain.xml b/chapter06/strippingagain.xml deleted file mode 100644 index fb2a1b55f..000000000 --- a/chapter06/strippingagain.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - %general-entities; -]> - - - - - Stripping Again - - This section is optional. If the intended user is not a - programmer and does not plan to do - any debugging on the system software, the system size can be decreased - by about 90 MB by removing the debugging symbols from binaries and - libraries. This causes no inconvenience other than not being able to - debug the software fully anymore. - - Most people who use the commands mentioned below do not - experience any difficulties. However, it is easy to make a typo and - render the new system unusable, so before running the - strip commands, it is a good idea to make a - backup of the LFS system in its current state. - - First place the debugging symbols for selected libraries - in separate files. This debugging information is needed if running - regression tests that use valgrind or gdb later in BLFS. - - - - - -save_lib="ld-&glibc-version;.so libc-&glibc-version;.so libpthread-&glibc-version;.so libthread_db-&libthread_db-version;.so" - -cd /lib - -for LIB in $save_lib; do - objcopy --only-keep-debug $LIB $LIB.dbg - strip --strip-unneeded $LIB - objcopy --add-gnu-debuglink=$LIB.dbg $LIB -done - -save_usrlib="libquadmath.so.&libquadmath-version; libstdc++.so.&libstdcpp-version; - libitm.so.&libitm-version; libatomic.so.&libatomic-version;" - -cd /usr/lib - -for LIB in $save_usrlib; do - objcopy --only-keep-debug $LIB $LIB.dbg - strip --strip-unneeded $LIB - objcopy --add-gnu-debuglink=$LIB.dbg $LIB -done - -unset LIB save_lib save_usrlib - - - Now the binaries and libraries can be stripped: -find /usr/lib -type f -name \*.a \ - -exec strip --strip-debug {} ';' - -find /lib /usr/lib -type f -name \*.so* ! -name \*dbg \ - -exec strip --strip-unneeded {} ';' - -find /{bin,sbin} /usr/{bin,sbin,libexec} -type f \ - -exec strip --strip-all {} ';' - - A large number of files will be reported as having their file - format not recognized. These warnings can be safely ignored. These - warnings indicate that those files are scripts instead of - binaries. - - diff --git a/chapter06/sysklogd.xml b/chapter06/sysklogd.xml deleted file mode 100644 index e96980cb4..000000000 --- a/chapter06/sysklogd.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - %general-entities; -]> - - - - - - sysklogd - &sysklogd-version; -
&sysklogd-url;
-
- - Sysklogd-&sysklogd-version; - - - Sysklogd - - - - - - <para>The Sysklogd package contains programs for logging system messages, - such as those given by the kernel when unusual things happen.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&sysklogd-ch6-sbu;</seg> - <seg>&sysklogd-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Sysklogd - - First, fix problems that causes a segmentation fault under - some conditions in klogd and fix an obsolete program construct: - -sed -i '/Error loading kernel symbols/{n;n;d}' ksym_mod.c -sed -i 's/union wait/int/' syslogd.c - - Compile the package: - -make - - This package does not come with a test suite. - - Install the package: - -make BINDIR=/sbin install - - - - - Configuring Sysklogd - - - Sysklogd - configuring - - - - /etc/syslog.conf - - - Create a new /etc/syslog.conf file by running the - following: - -cat > /etc/syslog.conf << "EOF" -# Begin /etc/syslog.conf - -auth,authpriv.* -/var/log/auth.log -*.*;auth,authpriv.none -/var/log/sys.log -daemon.* -/var/log/daemon.log -kern.* -/var/log/kern.log -mail.* -/var/log/mail.log -user.* -/var/log/user.log -*.emerg * - -# End /etc/syslog.conf -EOF - - - - - Contents of Sysklogd - - - Installed programs - - - klogd and syslogd - - - - - Short Descriptions - - - - - klogd - - A system daemon for intercepting and logging kernel messages - - klogd - - - - - - syslogd - - Logs the messages that system programs offer for logging [Every - logged message contains at least a date stamp and a hostname, and - normally the program's name too, but that depends on how trusting the - logging daemon is told to be.] - - syslogd - - - - - - - - -
diff --git a/chapter06/systemd.xml b/chapter06/systemd.xml deleted file mode 100644 index 2cf2d1d1b..000000000 --- a/chapter06/systemd.xml +++ /dev/null @@ -1,830 +0,0 @@ - - - %general-entities; -]> - - - - - - systemd - &systemd-version; -
&systemd-url;
-
- - Systemd-&systemd-version; - - - systemd - - - - - - <para>The systemd package contains programs for controlling the startup, - running, and shutdown of the system.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&systemd-ch6-sbu;</seg> - <seg>&systemd-ch6-du;</seg> - </seglistitem> - </segmentedlist> - </sect2> - - <sect2 role="installation"> - <title>Installation of systemd - - First, apply a patch to fix the build with GCC-10: - -patch -Np1 -i ../systemd-&systemd-version;-gcc_10-fixes-1.patch - - - Create a symlink to work around missing xsltproc: - -ln -sf /bin/true /usr/bin/xsltproc - - Set up the man pages: - -tar -xf ../systemd-man-pages-&systemd-version;.tar.xz - - Remove tests that cannot be built in chroot: - -sed '179,$ d' -i src/resolve/meson.build - - Remove an unneeded group, - render, from the default udev - rules: - -sed -i 's/GROUP="render", //' rules.d/50-udev-default.rules.in - - Prepare systemd for compilation: - -mkdir -p build -cd build - -LANG=en_US.UTF-8 \ -meson --prefix=/usr \ - --sysconfdir=/etc \ - --localstatedir=/var \ - -Dblkid=true \ - -Dbuildtype=release \ - -Ddefault-dnssec=no \ - -Dfirstboot=false \ - -Dinstall-tests=false \ - -Dkmod-path=/bin/kmod \ - -Dldconfig=false \ - -Dmount-path=/bin/mount \ - -Drootprefix= \ - -Drootlibdir=/lib \ - -Dsplit-usr=true \ - -Dsulogin-path=/sbin/sulogin \ - -Dsysusers=false \ - -Dumount-path=/bin/umount \ - -Db_lto=false \ - -Drpmmacrosdir=no \ - -Dhomed=false \ - -Duserdb=false \ - -Dman=true \ - .. - - - The meaning of the meson options: - - - - - -D*-path=* - - These switches provide location of binaries needed by - systemd at runtime that have not yet been installed. - - - - - -Ddefault-dnssec=no - - This switch turns off the experimental DNSSEC support. - - - - - -Dfirstboot=false - - This switch prevents installation of systemd - services responsible for setting up the system for - the first time. They are not useful for LFS because - everything is done manually. - - - - - -Dinstall-tests=false - - This switch prevents installation of the compiled tests. - - - - - -Dldconfig=false - - This switch prevents installation of a systemd unit that runs - ldconfig at boot, which is not useful for source - distributions such as LFS and makes the boot time longer. Remove it - if the described feature is desired. - - - - - -Droot* - - These switches ensure that core programs and - shared libraries are installed in the subdirectories - of the root partition. - - - - - -Dsplit-usr=true - - This switch ensures that systemd will work on - systems where /bin, /lib and /sbin directories are not - symlinks to their /usr counterparts. - - - - - -Dsysusers=false - - This switch prevents installation of systemd - services responsible for setting up the - /etc/group and - /etc/passwd files. Both files - were created earlier in this chapter. - - - - - -Drpmmacrosdir=no - - This switch disables installation of RPM Macros - for use with systemd because LFS does not support RPM. - - - - - -D{userdb,homed}=false - - Remove two daemons that have dependencies that do not fit - the scope of LFS. - - - - - - Compile the package: - -LANG=en_US.UTF-8 ninja - - Install the package: - -LANG=en_US.UTF-8 ninja install - - Remove an unnecessary symbolic link: - -rm -f /usr/bin/xsltproc - - Create the /etc/machine-id file needed by - systemd-journald: - -systemd-machine-id-setup - - Setup the basic target structure: - -systemctl preset-all - - Disable a service that is known to cause problems with systems that - use a network configuration other than what is provided by - systemd-networkd: - - -systemctl disable systemd-time-wait-sync.service - - Prevent systemd from resetting the maximum PID value which causes - some problems with packages and units in BLFS: - - -rm -f /usr/lib/sysctl.d/50-pid-max.conf - - - - - - Contents of systemd - - - Installed programs - Installed libraries - Installed directories - - - bootctl, busctl, coredumpctl, halt (symlink to systemctl), - hostnamectl, init, journalctl, kernel-install, localectl, loginctl, - machinectl, networkctl, portablectl, poweroff (symlink to - systemctl), reboot (symlink to systemctl), resolvconf (symlink to - resolvectl), resolvectl, runlevel (symlink to systemctl), shutdown - (symlink to systemctl), systemctl, systemd-analyze, - systemd-ask-password, systemd-cat, systemd-cgls, systemd-cgtop, - systemd-delta, systemd-detect-virt, systemd-escape, systemd-hwdb, - systemd-id128, systemd-inhibit, systemd-machine-id-setup, - systemd-mount, systemd-notify, systemd-nspawn, systemd-path, - systemd-repart, systemd-resolve (symlink to resolvectl), systemd-run, - systemd-socket-activate, systemd-stdio-bridge, systemd-tmpfiles, - systemd-tty-ask-password-agent, systemd-umount (symlink to - systemd-mount), telinit (symlink to systemctl), timedatectl, and - udevadm - libnss_myhostname.so.2, libnss_mymachines.so.2, - libnss_resolve.so.2, libnss_systemd.so.2, - libsystemd.so, libsystemd-shared-&systemd-version;.so (in /lib/systemd), - and libudev.so - /etc/binfmt.d, /etc/init.d, /etc/kernel, /etc/modules-load.d, - /etc/sysctl.d, /etc/systemd, /etc/tmpfiles.d, /etc/udev, - /etc/xdg/systemd, /lib/systemd, /lib/udev, /usr/include/systemd, - /usr/lib/binfmt.d, /usr/lib/kernel, /usr/lib/modules-load.d, - /usr/lib/sysctl.d, /usr/lib/systemd, /usr/lib/tmpfiles.d, - /usr/share/doc/systemd-&systemd-version;, /usr/share/factory, - /usr/share/systemd, /var/lib/systemd, and /var/log/journal - - - - - Short Descriptions - - - - - bootctl - - Used to query the firmware and boot manager settings - - bootctl - - - - - - busctl - - Used to introspect and monitor the D-Bus bus - - busctl - - - - - - coredumpctl - - Used to retrieve coredumps from the systemd journal - - coredumpctl - - - - - - halt - - Normally invokes shutdown with the - -h option, except when already in run-level 0, - then it tells the kernel to halt the system; it notes in the - file /var/log/wtmp that the system is being - brought down - - halt - - - - - - hostnamectl - - Used to query and change the system hostname and related - settings - - hostnamectl - - - - - - init - - The first process to be started when the kernel has initialized - the hardware which takes over the boot process and starts all - processes according to its configuration files - - init - - - - - - journalctl - - Used to query the contents of the systemd journal - - journalctl - - - - - - kernel-install - - Used to add and remove kernel and initramfs images to and - from /boot - - kernel-install - - - - - - localectl - - Used to query and change the system locale and keyboard layout - settings - - localectl - - - - - - loginctl - - Used to introspect and control the state of the systemd Login - Manager - - loginctl - - - - - - machinectl - - Used to introspect and control the state of the systemd Virtual - Machine and Container Registration Manager - - machinectl - - - - - - networkctl - - Used to introspect the state of the network links as seen by - systemd-networkd - - networkctl - - - - - - portablectl - - Used to attach or detach portable services from the local - system - - portablectl - - - - - - poweroff - - Tells the kernel to halt the system and switch off the computer - (see halt) - - poweroff - - - - - - reboot - - Tells the kernel to reboot the system (see - halt) - - reboot - - - - - - resolvconf - - Register DNS server and domain configuration with - systemd-resolved - - resolvconf - - - - - - resolvectl - - Send control commands to the network name resolution - manager, or resolve domain names, IPv4 and IPv6 addresses, - DNS records, and services. - - resolvectl - - - - - - runlevel - - Reports the previous and the current run-level, as noted in the - last run-level record in /var/run/utmp - - runlevel - - - - - - shutdown - - Brings the system down in a secure way, signaling all processes - and notifying all logged-in users - - shutdown - - - - - - systemctl - - Used to introspect and control the state of the systemd system - and service manager - - systemctl - - - - - - systemd-analyze - - Used to determine system boot-up performance of the current - boot - - systemd-analyze - - - - - - systemd-ask-password - - Used to query a system password or passphrase from the user, - using a question message specified on the command line - - systemd-ask-password - - - - - - systemd-cat - - Used to connect STDOUT and STDERR of a process with the Journal - - - systemd-cat - - - - - - systemd-cgls - - Recursively shows the contents of the selected Linux control - group hierarchy in a tree - - systemd-cgls - - - - - - systemd-cgtop - - Shows the top control groups of the local Linux control group - hierarchy, ordered by their CPU, memory and disk I/O load - - systemd-cgtop - - - - - - systemd-delta - - Used to identify and compare configuration files in - /etc that override default - counterparts in /usr - - systemd-delta - - - - - - systemd-detect-virt - - Detects execution in a virtualized environment - - systemd-detect-virt - - - - - - systemd-escape - - Used to escape strings for inclusion in systemd unit - names - - systemd-escape - - - - - - systemd-hwdb - - Used to manage hardware database (hwdb) - - systemd-hwdb - - - - - - systemd-id128 - - Generate and print id128 strings - - systemd-id128 - - - - - - systemd-inhibit - - Used to execute a program with a shutdown, sleep or idle - inhibitor lock taken - - systemd-inhibit - - - - - - systemd-machine-id-setup - - Used by system installer tools to initialize the machine ID - stored in /etc/machine-id at install time with a - randomly generated ID - - systemd-machine-id-setup - - - - - - systemd-mount - - A tool to temporarily mount or auto-mount a drive. - - systemd-mount - - - - - - systemd-notify - - Used by daemon scripts to notify the init system about status - changes - - systemd-notify - - - - - - systemd-nspawn - - Used to run a command or OS in a light-weight namespace - container - - systemd-nspawn - - - - - - systemd-path - - Used to query system and user paths - - systemd-path - - - - - - systemd-repart - - Used go grow and add partitions to a partition table when - systemd is used in an OS image (e.g. a container). - - systemd-repart - - - - - - systemd-resolve - - Used to resolve domain names, IPV4 and IPv6 addresses, DNS - resource records, and services - - systemd-resolve - - - - - - systemd-run - - Used to create and start a transient .service or a .scope unit - and run the specified command in it - - systemd-run - - - - - - - - systemd-socket-activate - - A tool to listen on socket devices and launch a process upon - connection. - - systemd-socket-activate - - - - - - systemd-tmpfiles - - Creates, deletes and cleans up volatile and temporary files and - directories, based on the configuration file format and location - specified in - tmpfiles.d directories - - systemd-tmpfiles - - - - - - systemd-umount - - Unmount mount points - - systemd-umount - - - - - - systemd-tty-ask-password-agent - - Used to list or process pending systemd password requests - - systemd-tty-ask-password-agent - - - - - - telinit - - Tells init which run-level to change - to - - telinit - - - - - - timedatectl - - Used to query and change the system clock and its settings - - - timedatectl - - - - - - udevadm - - Generic udev administration tool: controls the udevd daemon, - provides info from the Udev database, monitors uevents, waits for - uevents to finish, tests udev configuration, and triggers uevents - for a given device - - udevadm - - - - - - libsystemd - - The main systemd utility library - - libsystemd - - - - - - libudev - - A library to access Udev device information - - libudev - - - - - - - - -
diff --git a/chapter06/sysvinit.xml b/chapter06/sysvinit.xml deleted file mode 100644 index 0c171acf5..000000000 --- a/chapter06/sysvinit.xml +++ /dev/null @@ -1,220 +0,0 @@ - - - %general-entities; -]> - - - - - - sysvinit - &sysvinit-version; -
&sysvinit-url;
-
- - Sysvinit-&sysvinit-version; - - - Sysvinit - - - - - - <para>The Sysvinit package contains programs for controlling the startup, - running, and shutdown of the system.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&sysvinit-ch6-sbu;</seg> - <seg>&sysvinit-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Sysvinit - - - First, apply a patch that removes several programs installed by other - packages, clarifies a message, and fixes a compiler warning: - -patch -Np1 -i ../&sysvinit-consolidated-patch; - - Compile the package: - -make - - This package does not come with a test suite. - - Install the package: - -make install - - - - - Contents of Sysvinit - - - Installed programs - - - bootlogd, fstab-decode, halt, init, killall5, - poweroff (link to halt), reboot (link to halt), runlevel, - shutdown, and telinit (link to init) - - - - - Short Descriptions - - - - - bootlogd - - Logs boot messages to a log file - - bootlogd - - - - - - fstab-decode - - Run a command with fstab-encoded arguments - - fstab-decode - - - - - - halt - - Normally invokes shutdown with the - -h option, except when already in run-level 0, - then it tells the kernel to halt the system; it notes in the - file /var/log/wtmp that the system is being - brought down - - halt - - - - - - init - - The first process to be started when the kernel has initialized - the hardware which takes over the boot process and starts all the - proceses specified in its configuration file - - init - - - - - - killall5 - - Sends a signal to all processes, except the processes in its own - session so it will not kill its parent shell - - killall5 - - - - - - poweroff - - Tells the kernel to halt the system and switch off the computer - (see halt) - - poweroff - - - - - - reboot - - Tells the kernel to reboot the system (see - halt) - - reboot - - - - - - runlevel - - Reports the previous and the current run-level, as noted in the - last run-level record in /var/run/utmp - - runlevel - - - - - - shutdown - - Brings the system down in a secure way, signaling all processes - and notifying all logged-in users - - shutdown - - - - - - telinit - - Tells init which run-level to change to - - telinit - - - - - - - - -
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 - - - 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 - - + + - <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. - - 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 + The meaning of the configure options: + + + ADJTIME_PATH=/var/lib/hwclock/adjtime - Sets terminal attributes - - setterm - + 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. - - sfdisk + + --disable-* - A disk partition table manipulator - - sfdisk - + Those switches prevent warnings about building components + that require packages not in LFS or not installed yet. - - sulogin + + --without-python - Allows root to log in; - it is normally invoked by init when the system goes - into single user mode - - sulogin - + This switch disables using Python. + It avoids trying to build unneeded bindings. - - 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 - - - + Compile the package: - - libblkid - - Contains routines for device identification and token - extraction - - libblkid - - - +make - - libfdisk - - Contains routines for manipulating partition tables - - libfdisk - - - + Install the package: - - libmount - - Contains routines for block device mounting and - unmounting - - libmount - - - +make install - - 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 - - - + + - </variablelist> + <para>Details on this package are located in + <xref linkend="contents-utillinux" role="."/></para> </sect2> diff --git a/chapter06/vim.xml b/chapter06/vim.xml deleted file mode 100644 index 263122bd7..000000000 --- a/chapter06/vim.xml +++ /dev/null @@ -1,319 +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-vim" role="wrap"> - <?dbhtml filename="vim.html"?> - - <sect1info condition="script"> - <productname>vim</productname> - <productnumber>&vim-version;</productnumber> - <address>&vim-url;</address> - </sect1info> - - <title>Vim-&vim-version; - - - Vim - - - - - - <para>The Vim package contains a powerful text editor.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&vim-ch6-sbu;</seg> - <seg>&vim-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - <tip> - <title>Alternatives to Vim - - If you prefer another editor—such as Emacs, Joe, or - Nano—please refer to for suggested - installation instructions. - - - - - - Installation of Vim - - First, change the default location of the vimrc - configuration file to /etc: - -echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h - - - Prepare Vim for compilation: - -./configure --prefix=/usr - - Compile the package: - -make - - To 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 -c "LANG=en_US.UTF-8 make -j1 test" &> vim-test.log - - - - The test suite outputs a lot of binary data to the screen. This can - cause issues with the settings of the current terminal. The problem can be - avoided by redirecting the output to a log file as shown above. A - successful test will result in the words "ALL DONE" in the log file - at completion. - - Install the package: - -make install - - Many users are used to using vi instead of - vim. To allow execution of vim - when users habitually enter vi, create a - symlink for both the binary and the man page in the provided - languages: - -ln -sv vim /usr/bin/vi -for L in /usr/share/man/{,*/}man1/vim.1; do - ln -sv vim.1 $(dirname $L)/vi.1 -done - - By default, Vim's documentation is installed in /usr/share/vim. The following symlink - allows the documentation to be accessed via /usr/share/doc/vim-&vim-version;, making - it consistent with the location of documentation for other packages: - -ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version; - - If an X Window System is going to be installed on the LFS - system, it may be necessary to recompile Vim after installing X. Vim - comes with a GUI version of the editor that requires X and some - additional libraries to be installed. For more information on this - process, refer to the Vim documentation and the Vim installation page - in the BLFS book at . - - - - - Configuring Vim - - - /etc/vimrc - - - By default, vim runs in vi-incompatible mode. - This may be new to users who have used other editors in the past. The - nocompatible setting is included below to highlight the - fact that a new behavior is being used. It also reminds those who would - change to compatible mode that it should be the first - setting in the configuration file. This is necessary because it changes - other settings, and overrides must come after this setting. Create a default - vim configuration file by running the following: - -cat > /etc/vimrc << "EOF" -" Begin /etc/vimrc - -" Ensure defaults are set before customizing settings, not after -source $VIMRUNTIME/defaults.vim -let skip_defaults_vim=1 - -set nocompatible -set backspace=2 -set mouse= -syntax on -if (&term == "xterm") || (&term == "putty") - set background=dark -endif - -" End /etc/vimrc -EOF - - The set nocompatible setting makes - vim behave in a more useful way (the default) than the - vi-compatible manner. Remove the no to keep the old - vi behavior. The set backspace=2 - setting allows backspacing over line breaks, autoindents, and the start of - insert. The syntax on parameter enables vim's syntax - highlighting. The set mouse= setting enables - proper pasting of text with the mouse when working in chroot or over a - remote connection. Finally, the if statement with the - set background=dark setting corrects - vim's guess about the background color of some terminal - emulators. This gives the highlighting a better color scheme for use on the - black background of these programs. - - Documentation for other available options can be obtained by - running the following command: - -vim -c ':options' - - - By default, Vim only installs spell files for the English language. - To install spell files for your preferred language, download the - *.spl and optionally, the *.sug - files for your language and character encoding from and save them to - /usr/share/&vim-docdir;/spell/. - - To use these spell files, some configuration in - /etc/vimrc is needed, e.g.: - -set spelllang=en,ru -set spell - - For more information, see the appropriate README file located - at the URL above. - - - - - - Contents of Vim - - - Installed programs - Installed directory - - - ex (link to vim), rview (link to vim), rvim (link to vim), vi - (link to vim), view (link to vim), vim, vimdiff (link to vim), vimtutor, - and xxd - /usr/share/vim - - - - - Short Descriptions - - - - - ex - - Starts vim in ex mode - - ex - - - - - - rview - - Is a restricted version of view; no shell - commands can be started and view cannot be - suspended - - rview - - - - - - rvim - - Is a restricted version of vim; no shell - commands can be started and vim cannot be - suspended - - rvim - - - - - - vi - - Link to vim - - vi - - - - - - view - - Starts vim in read-only mode - - view - - - - - - vim - - Is the editor - - vim - - - - - - vimdiff - - Edits two or three versions of a file with vim - and shows differences - - vimdiff - - - - - - vimtutor - - Teaches the basic keys and commands of - vim - - vimtutor - - - - - - xxd - - Creates a hex dump of the given file; it can - also do the reverse, so it can be used for binary patching - - xxd - - - - - - - - - diff --git a/chapter06/xml-parser.xml b/chapter06/xml-parser.xml deleted file mode 100644 index 54d5bcb35..000000000 --- a/chapter06/xml-parser.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - %general-entities; -]> - - - - - - xml-parser - &xml-parser-version; -
&xml-parser-url;
-
- - XML::Parser-&xml-parser-version; - - - XML::Parser - - - - - - <para>The XML::Parser module is a Perl interface to James Clark's - XML parser, Expat.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&xml-parser-ch6-sbu;</seg> - <seg>&xml-parser-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of XML::Parser - - Prepare XML::Parser for compilation: - -perl Makefile.PL - - Compile the package: - -make - - To test the results, issue: - -make test - - Install the package: - -make install - - - - - Contents of XML::Parser - - - Installed module - - - Expat.so - - - - - Short Descriptions - - - - - Expat - - provides the Perl Expat interface - - Expat - - - - - - - - -
diff --git a/chapter06/xz.xml b/chapter06/xz.xml index 5a342b2ff..9e2d0da4b 100644 --- a/chapter06/xz.xml +++ b/chapter06/xz.xml @@ -5,7 +5,7 @@ %general-entities; ]> - + @@ -16,26 +16,25 @@ Xz-&xz-version; - + Xz + tools - <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/chapter06/zlib.xml b/chapter06/zlib.xml deleted file mode 100644 index 2dcc49413..000000000 --- a/chapter06/zlib.xml +++ /dev/null @@ -1,101 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-system-zlib" role="wrap"> - <?dbhtml filename="zlib.html"?> - - <sect1info condition="script"> - <productname>zlib</productname> - <productnumber>&zlib-version;</productnumber> - <address>&zlib-url;</address> - </sect1info> - - <title>Zlib-&zlib-version; - - - Zlib - - - - - - <para>The Zlib package contains compression and decompression routines used by - some programs.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&zlib-ch6-sbu;</seg> - <seg>&zlib-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Zlib - - Prepare Zlib for compilation: - -./configure --prefix=/usr - - Compile the package: - -make - - To test the results, issue: - -make check - - Install the package: - -make install - - The shared library needs to be moved to - /lib, and as a result the - .so file in - /usr/lib will need to be recreated: - -mv -v /usr/lib/libz.so.* /lib -ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so - - - - - Contents of Zlib - - - Installed libraries - - - libz.{a,so} - - - - - Short Descriptions - - - - - libz - - Contains compression and decompression functions used by - some programs - - libz - - - - - - - - - diff --git a/chapter06/zstd.xml b/chapter06/zstd.xml deleted file mode 100644 index 71e7794b6..000000000 --- a/chapter06/zstd.xml +++ /dev/null @@ -1,136 +0,0 @@ - - - %general-entities; -]> - - - - - - zstd - &zstd-version; -
&zstd-url;
-
- - Zstd-&zstd-version; - - - zstd - - - - - - <para>Zstandard is a real-time compression algorithm, providing high - compression ratios. It offers a very wide range of compression / speed - trade-offs, while being backed by a very fast decoder.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&zstd-ch6-sbu;</seg> - <seg>&zstd-ch6-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Zstd - - Compile the package: - -make - - This package does not come with a test suite. - - Install the package: - -make prefix=/usr install - - Remove the static library and move the shared library to - /lib. Also, the - .so file in - /usr/lib will need to be recreated: - -rm -v /usr/lib/libzstd.a -mv -v /usr/lib/libzstd.so.* /lib -ln -sfv ../../lib/$(readlink /usr/lib/libzstd.so) /usr/lib/libzstd.so - - - - - Contents of Zstd - - - Installed programs - Installed library - - - zstd, - zstdcat (link to zstd), - zstdgrep, - zstdless, - zstdmt (link to zstd), and - unzstd (link to zstd) - - - libzstd.so - - - - - Short Descriptions - - - - - zstd - - Compresses or decompresses files using the ZSTD format - - zstd - - - - - - zstdgrep - - Runs grep on ZSTD compressed files - - zstdgrep - - - - - - zstdless - - Runs less on ZSTD compressed files - - zstdless - - - - - - libzstd - - The library implementing lossless data - compression, using the ZSTD algorithm - - libzstd - - - - - - - - -
diff --git a/chapter07/bash.xml b/chapter07/bash.xml new file mode 100644 index 000000000..ee1fb574e --- /dev/null +++ b/chapter07/bash.xml @@ -0,0 +1,96 @@ + + + %general-entities; +]> + + + + + + bash + &bash-version; +
&bash-url;
+
+ + Bash-&bash-version; + + + Bash + tools + + + + + + <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/bootscripts.xml b/chapter07/bootscripts.xml deleted file mode 100644 index 5c2b28d7c..000000000 --- a/chapter07/bootscripts.xml +++ /dev/null @@ -1,331 +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-config-bootscripts" role="wrap" revision="sysv"> - <?dbhtml filename="bootscripts.html"?> - - <sect1info condition="script"> - <productname>bootscripts</productname> - <productnumber>&lfs-bootscripts-version;</productnumber> - <address>&lfs-bootscripts-url;</address> - </sect1info> - - <title>LFS-Bootscripts-&lfs-bootscripts-version; - - - Bootscripts - - - - - - <para>The LFS-Bootscripts package contains a set of scripts to start/stop - the LFS system at bootup/shutdown. - The configuration files and procedures needed to - customize the boot process are described in the following sections.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&lfs-bootscripts-ch7-sbu;</seg> - <seg>&lfs-bootscripts-ch7-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of LFS-Bootscripts - - Install the package: - -make install - - - - - Contents of LFS-Bootscripts - - Installed scripts - Installed directories - - - checkfs, cleanfs, console, functions, halt, ifdown, - ifup, localnet, modules, mountfs, mountvirtfs, network, rc, reboot, - sendsignals, setclock, ipv4-static, swap, sysctl, sysklogd, template, - udev, and udev_retry - /etc/rc.d, /etc/init.d (symbolic link), /etc/sysconfig, - /lib/services, /lib/lsb (symbolic link) - - - - - Short Descriptions - - - - - checkfs - - Checks the integrity of the file systems before they are mounted - (with the exception of journal and network based file systems) - - checkfs - - - - - - cleanfs - - Removes files that should not be preserved between reboots, such - as those in /var/run/ and - /var/lock/; it re-creates - /var/run/utmp and removes the possibly present - /etc/nologin, /fastboot, and - /forcefsck files - - cleanfs - - - - - - console - - Loads the correct keymap table for the desired keyboard layout; - it also sets the screen font - - console - - - - - - functions - - Contains common functions, such as error and status checking, - that are used by several bootscripts - - functions - - - - - - halt - - Halts the system - - halt - - - - - - ifdown - - Stops a network device - - ifdown - - - - - - ifup - - Initializes a network device - - ifup - - - - - - localnet - - Sets up the system's hostname and local loopback device - - localnet - - - - - - modules - - Loads kernel modules listed in - /etc/sysconfig/modules, using arguments - that are also given there - - modules - - - - - - mountfs - - Mounts all file systems, except ones that are marked - noauto or are network based - - mountfs - - - - - - mountvirtfs - - Mounts virtual kernel file systems, such as proc - - mountvirtfs - - - - - - network - - Sets up network interfaces, such as network cards, and sets up - the default gateway (where applicable) - - network - - - - - - rc - - The master run-level control script; it is responsible for - running all the other bootscripts one-by-one, in a sequence determined - by the name of the symbolic links being processed - - rc - - - - - - reboot - - Reboots the system - - reboot - - - - - - sendsignals - - Makes sure every process is terminated before the system reboots - or halts - - sendsignals - - - - - - setclock - - Resets the kernel clock to local time in case the hardware clock - is not set to UTC time - - setclock - - - - - - ipv4-static - - Provides the functionality needed to assign a static Internet - Protocol (IP) address to a network interface - - ipv4-static - - - - - - swap - - Enables and disables swap files and partitions - - swap - - - - - - sysctl - - Loads system configuration values from - /etc/sysctl.conf, if that file exists, - into the running kernel - - sysctl - - - - - - sysklogd - - Starts and stops the system and kernel log daemons - - sysklogd - - - - - - template - - A template to create custom bootscripts for other - daemons - - template - - - - - - udev - - Prepares the /dev - directory and starts Udev - - udev - - - - - - udev_retry - - Retries failed udev uevents, and copies generated rules - files from /run/udev to - /etc/udev/rules.d if required - - udev_retry - - - - - - - - -
diff --git a/chapter07/bzip2.xml b/chapter07/bzip2.xml new file mode 100644 index 000000000..828b7fc0f --- /dev/null +++ b/chapter07/bzip2.xml @@ -0,0 +1,112 @@ + + + %general-entities; +]> + + + + + + bzip2 + &bzip2-version; +
&bzip2-url;
+
+ + Bzip2-&bzip2-version; + + + Bzip2 + tools + + + + + + <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/clock.xml b/chapter07/clock.xml deleted file mode 100644 index 872ba677c..000000000 --- a/chapter07/clock.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - %general-entities; -]> - - - - - Configuring the system clock - - - clock - configuring - - This section discusses how to configure the - systemd-timedated system service, which configures - system clock and timezone. - - If you cannot remember whether or not the hardware clock is set to UTC, - find out by running the hwclock --localtime --show - command. This will display what the current time is according to the hardware - clock. If this time matches whatever your watch says, then the hardware clock is - set to local time. If the output from hwclock is not local - time, chances are it is set to UTC time. Verify this by adding or subtracting - the proper amount of hours for the timezone to the time shown by - hwclock. For example, if you are currently in the MST - timezone, which is also known as GMT -0700, add seven hours to the local - time. - - systemd-timedated reads /etc/adjtime, - and depending on the contents of the file, it sets the clock to either UTC or - local time. - - Create the /etc/adjtime file with the following contents - if your hardware clock is set to local time: - -cat > /etc/adjtime << "EOF" -0.0 0 0.0 -0 -LOCAL -EOF - - If /etc/adjtime isn't present at first boot, - systemd-timedated will assume that hardware clock is - set to UTC and adjust the file according to that. - - You can also use the timedatectl utility to tell - systemd-timedated if your hardware clock is set to - UTC or local time: - -timedatectl set-local-rtc 1 - - timedatectl can also be used to change system time and - time zone. - - To change your current system time, issue: - -timedatectl set-time YYYY-MM-DD HH:MM:SS - - Hardware clock will also be updated accordingly. - - To change your current time zone, issue: - -timedatectl set-timezone TIMEZONE - - You can get a list of available time zones by running: - -timedatectl list-timezones - - Please note that the timedatectl command can - be used only on a system booted with systemd. - - - Network Time Synchronization - - Starting with version 213, systemd ships a daemon called - systemd-timesyncd which can be used to - synchronize the system time with remote NTP servers. - - The daemon is not intended as a replacement for the well - established NTP daemon, but as a client only implementation - of the SNTP protocol which can be used for less advanced - tasks and on resource limited systems. - - Starting with systemd version 216, the - systemd-timesyncd daemon is enabled by - default. If you want to disable it, issue the following - command: - -systemctl disable systemd-timesyncd - - The /etc/systemd/timesyncd.conf file - can be used to change the NTP servers that - systemd-timesyncd synchronizes with. - - Please note that when system clock is set to Local Time, - systemd-timesyncd won't update hardware - clock. - - - - diff --git a/chapter07/consoled.xml b/chapter07/consoled.xml deleted file mode 100644 index bf1fdc8e0..000000000 --- a/chapter07/consoled.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - %general-entities; -]> - - - - - Configuring the Linux Console - - - console - configuring - - - This section discusses how to configure the - systemd-vconsole-setup system service, which configures - the virtual console font and console keymap. - - The systemd-vconsole-setup service reads the - /etc/vconsole.conf file for configuration - information. Decide which keymap and screen font will be used. Various - language-specific HOWTOs can also help with this, see . - Examine localectl list-keymaps output for a list of - valid console keymaps. Look in - /usr/share/consolefonts - directory for valid screen fonts. - - The /etc/vconsole.conf file should contain lines - of the form: VARIABLE="value". The following variables are recognized: - - - - - KEYMAP - - This variable specifies the key mapping table for the keyboard. If - unset, it defaults to us. - - - - - KEYMAP_TOGGLE - - This variable can be used to configure a second toggle keymap and - is unset by default. - - - - - FONT - - This variable specifies the font used by the virtual - console. - - - - - FONT_MAP - - This variable specifies the console map to be used. - - - - - FONT_UNIMAP - - This variable specifies the Unicode font map. - - - - - - An example for a German keyboard and console is given below: - -cat > /etc/vconsole.conf << "EOF" -KEYMAP=de-latin1 -FONT=Lat2-Terminus16 -EOF - - You can change KEYMAP value at runtime by using the - localectl utility: - -localectl set-keymap MAP - - Please note that the localectl command can - be used only on a system booted with systemd. - - You can also use localectl utility with the - corresponding parameters to change X11 keyboard layout, model, variant - and options: - -localectl set-x11-keymap LAYOUT [MODEL] [VARIANT] [OPTIONS] - - To list possible values for localectl set-x11-keymap - parameters, run localectl with parameters listed below: - - - - - - list-x11-keymap-models - - Show known X11 keyboard mapping models. - - - - - list-x11-keymap-layouts - - Show known X11 keyboard mapping layouts. - - - - - list-x11-keymap-variants - - Show known X11 keyboard mapping variants. - - - - - list-x11-keymap-options - - Show known X11 keyboard mapping options. - - - - - - Using any of the parameters listed above requires the - XKeyboard Config package from BLFS. - - 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/etcshells.xml b/chapter07/etcshells.xml deleted file mode 100644 index 30961c80c..000000000 --- a/chapter07/etcshells.xml +++ /dev/null @@ -1,49 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE part 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-config-shells" xreflabel="Creating the /etc/shells File"> - <?dbhtml filename="etcshells.html"?> - -<!-- - <sect1info> - <othername>$LastChangedBy$</othername> - <date>$Date$</date> - </sect1info> ---> - <title>Creating the /etc/shells File - - - /etc/shells - - - The shells file contains a list of - login shells on the system. Applications use this file to determine - whether a shell is valid. For each shell a single line should be - present, consisting of the shell's path, relative to the root of the - directory structure (/). - - For example, this file is consulted by chsh - to determine whether an unprivileged user may change the login shell for her - own account. If the command name is not listed, the user will be denied of - change. - - It is a requirement for applications such as - GDM which does not populate the - face browser if it can't find /etc/shells, or - FTP daemons which traditionally disallow access to users - with shells not included in this file. - -cat > /etc/shells << "EOF" -# Begin /etc/shells - -/bin/sh -/bin/bash - -# End /etc/shells -EOF - -
diff --git a/chapter07/expect.xml b/chapter07/expect.xml new file mode 100644 index 000000000..20b227ea5 --- /dev/null +++ b/chapter07/expect.xml @@ -0,0 +1,139 @@ + + + %general-entities; +]> + + + + + + expect + &expect-version; +
&expect-url;
+
+ + Expect-&expect-version; + + + Expect + + + + + + <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/inputrc.xml b/chapter07/inputrc.xml deleted file mode 100644 index 00d36877f..000000000 --- a/chapter07/inputrc.xml +++ /dev/null @@ -1,82 +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-config-inputrc"> - <?dbhtml filename="inputrc.html"?> - - <title>Creating the /etc/inputrc File - - - /etc/inputrc - - - The inputrc file is the configuration file for - the Readline library, which provides editing capabilities while the user is - entering a line from the terminal. It works by translating keyboard inputs - into specific actions. Readline is used by Bash and most other shells as - well as many other applications. - - Most people do not need user-specific functionality so the command - below creates a global /etc/inputrc used by everyone who - logs in. If you later decide you need to override the defaults on a per-user - basis, you can create a .inputrc file in the user's home - directory with the modified mappings. - - For more information on how to edit the inputrc - file, see info bash under the Readline Init - File section. info readline is also a good - source of information. - - Below is a generic global inputrc along with comments - to explain what the various options do. Note that comments cannot be on the same - line as commands. Create the file using the following command: - -cat > /etc/inputrc << "EOF" -# Begin /etc/inputrc -# Modified by Chris Lynn <roryo@roryo.dynup.net> - -# Allow the command prompt to wrap to the next line -set horizontal-scroll-mode Off - -# Enable 8bit input -set meta-flag On -set input-meta On - -# Turns off 8th bit stripping -set convert-meta Off - -# Keep the 8th bit for display -set output-meta On - -# none, visible or audible -set bell-style none - -# All of the following map the escape sequence of the value -# contained in the 1st argument to the readline specific functions -"\eOd": backward-word -"\eOc": forward-word - -# for linux console -"\e[1~": beginning-of-line -"\e[4~": end-of-line -"\e[5~": beginning-of-history -"\e[6~": end-of-history -"\e[3~": delete-char -"\e[2~": quoted-insert - -# for xterm -"\eOH": beginning-of-line -"\eOF": end-of-line - -# for Konsole -"\e[H": beginning-of-line -"\e[F": end-of-line - -# End /etc/inputrc -EOF - -
diff --git a/chapter07/introduction.xml b/chapter07/introduction.xml index cbc197a7b..5614270b2 100644 --- a/chapter07/introduction.xml +++ b/chapter07/introduction.xml @@ -5,221 +5,25 @@ %general-entities; ]> - + Introduction - Booting a Linux system involves several tasks. The process must - mount both virtual and real file systems, initialize devices, activate swap, - check file systems for integrity, mount any swap partitions or files, set - the system clock, bring up networking, start any daemons required by the - system, and accomplish any other custom tasks needed by the user. This - process must be organized to ensure the tasks are performed in the correct - order but, at the same time, be executed as fast as possible. + This chapter shows how to build a minimal Linux system. + This system will contain just enough tools to start constructing the final + LFS system in and allow a working + environment with more user convenience than a minimum environment would. - - - - System V - - System V is the classic boot process that has been used in Unix and - Unix-like systems such as Linux since about 1983. It consists of a small - program, init, that sets up basic programs such as - login (via getty) and runs a script. This script, - usually named rc, controls the execution of a set of - additional scripts that perform the tasks required to initialize the - system. - - The init program is controlled by the - /etc/inittab file and is organized into run levels that - can be run by the user: - - -0 — halt -1 — Single user mode -2 — Multiuser, without networking -3 — Full multiuser mode -4 — User definable -5 — Full multiuser mode with display manager -6 — reboot - - - The usual default run level is 3 or 5. - - Advantages - - - - Established, well understood system. - - - - Easy to customize. - - - - - - Disadvantages - - - - Slower to boot. A medium speed base LFS system - takes 8-12 seconds where the boot time is measured from the - first kernel message to the login prompt. Network - connectivity is typically established about 2 seconds - after the login prompt. - - - - Serial processing of boot tasks. This is related to the previous - point. A delay in any process such as a file system check, will - delay the entire boot process. - - - - Does not directly support advanced features like - control groups (cgroups), and per-user fair share scheduling. - - - - Adding scripts requires manual, static sequencing decisions. - - - - - - + There are two steps in building this minimal system. The first step + is to build a new and host-independent toolchain (compiler, assembler, + linker, libraries, and a few useful utilities). The second step uses this + toolchain to build the other essential tools. diff --git a/chapter07/introductiond.xml b/chapter07/introductiond.xml deleted file mode 100644 index fa2403edb..000000000 --- a/chapter07/introductiond.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - %general-entities; -]> - - - - - Introduction - - This chapter discusses configuration files and systemd services. - First, the general configuration files needed to set up networking are - presented. - - - - - - - - - - - - - - Second, issues that affect the proper setup of devices are - discussed. - - - - - - - - - - - Third, configuring the system clock and keyboard layout. - - - - - - - - - - - - Fourth, a brief introduction to the scripts and configuration - files used when the user logs into the system. - - - - - - - - - - - And finally, configuring the systemd behavior. - - - - - - - - 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/locale.xml b/chapter07/locale.xml deleted file mode 100644 index 5f473ac72..000000000 --- a/chapter07/locale.xml +++ /dev/null @@ -1,152 +0,0 @@ - - - %general-entities; -]> - - - - - Configuring the System Locale - - - /etc/locale.conf - - - The /etc/locale.conf below sets some - environment variables necessary for native language support. Setting - them properly results in: - - - - The output of programs translated into the native language - - - Correct classification of characters into letters, digits and other - classes. This is necessary for bash to properly accept - non-ASCII characters in command lines in non-English locales - - - The correct alphabetical sorting order for the country - - - Appropriate default paper size - - - Correct formatting of monetary, time, and date values - - - - Replace <ll> below with the two-letter code - for the desired language (e.g., en) and - <CC> with the two-letter code for the appropriate - country (e.g., GB). <charmap> should - be replaced with the canonical charmap for your chosen locale. Optional - modifiers such as @euro may also be present. - - The list of all locales supported by Glibc can be obtained by running - the following command: - -locale -a - - Charmaps can have a number of aliases, e.g., ISO-8859-1 - is also referred to as iso8859-1 and iso88591. - Some applications cannot handle the various synonyms correctly (e.g., require - that UTF-8 is written as UTF-8, not - utf8), so it is safest in most - cases to choose the canonical name for a particular locale. To determine - the canonical name, run the following command, where <locale - name> is the output given by locale -a for - your preferred locale (en_GB.iso88591 in our example). - -LC_ALL=<locale name> locale charmap - - For the en_GB.iso88591 locale, the above command - will print: - -ISO-8859-1 - - This results in a final locale setting of en_GB.ISO-8859-1. - It is important that the locale found using the heuristic above is tested prior - to it being added to the Bash startup files: - -LC_ALL=<locale name> locale language -LC_ALL=<locale name> locale charmap -LC_ALL=<locale name> locale int_curr_symbol -LC_ALL=<locale name> locale int_prefix - - The above commands should print the language name, the character - encoding used by the locale, the local currency, and the prefix to dial - before the telephone number in order to get into the country. If any of the - commands above fail with a message similar to the one shown below, this means - that your locale was either not installed in Chapter 6 or is not supported by - the default installation of Glibc. - -locale: Cannot set LC_* to default locale: No such file or directory - - If this happens, you should either install the desired locale using the - localedef command, or consider choosing a different locale. - Further instructions assume that there are no such error messages from - Glibc. - - - Some packages beyond LFS may also lack support for your chosen locale. One - example is the X library (part of the X Window System), which outputs the - following error message if the locale does not exactly match one of the character - map names in its internal files: - -Warning: locale not supported by Xlib, locale set to C - - In several cases Xlib expects that the character map will be listed in - uppercase notation with canonical dashes. For instance, "ISO-8859-1" rather - than "iso88591". It is also possible to find an appropriate specification by - removing the charmap part of the locale specification. This can be checked - by running the locale charmap command in both locales. - For example, one would have to change "de_DE.ISO-8859-15@euro" to - "de_DE@euro" in order to get this locale recognized by Xlib. - - Other packages can also function incorrectly (but may not necessarily - display any error messages) if the locale name does not meet their expectations. - In those cases, investigating how other Linux distributions support your locale - might provide some useful information. - - Once the proper locale settings have been determined, create the - /etc/locale.conf file: - -cat > /etc/locale.conf << "EOF" -LANG=<ll>_<CC>.<charmap><@modifiers> -EOF - - Note that you can modify /etc/locale.conf with the - systemd localectl utility. To use - localectl for the example above, run: - -localectl set-locale LANG="<ll>_<CC>.<charmap><@modifiers>" - - You can also specify other language specific environment variables such - as LANG, LC_CTYPE, LC_NUMERIC or - any other environment variable from locale output. Just - separate them with a space. An example where LANG is set as - en_US.UTF-8 but LC_CTYPE is set as just en_US is: - -localectl set-locale LANG="en_US.UTF-8" LC_CTYPE="en_US" - - Please note that the localectl command can - be used only on a system booted with systemd. - - The C (default) and en_US (the recommended - one for United States English users) locales are different. C - uses the US-ASCII 7-bit character set, and treats bytes with the high bit set - as invalid characters. That's why, e.g., the ls command - substitutes them with question marks in that locale. Also, an attempt to send - mail with such characters from Mutt or Pine results in non-RFC-conforming - messages being sent (the charset in the outgoing mail is indicated as unknown - 8-bit). So you can use the C locale only if you are sure that - you will never need 8-bit characters. - - UTF-8 based locales are not supported well by many programs. - Work is in progress to document and, if possible, fix such problems, see - . - - 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/network.xml b/chapter07/network.xml deleted file mode 100644 index b527258ee..000000000 --- a/chapter07/network.xml +++ /dev/null @@ -1,247 +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-config-network" revision="sysv"> - <?dbhtml filename="network.html"?> - - <title>General Network Configuration - - - network - configuring - - - Creating Network Interface Configuration Files - - Which interfaces are brought up and down by the network script - usually depends on the files in /etc/sysconfig/. This directory should - contain a file for each interface to be configured, such as - ifconfig.xyz, where xyz should describe - the network card. The interface name (e.g. eth0) is usually appropriate. - Inside this file are attributes to this interface, such as its IP - address(es), subnet masks, and so forth. It is necessary that the stem of - the filename be ifconfig. - - If the procedure in the previous section was not used, Udev - will assign network card interface names based on system physical - characteristics such as enp2s1. If you are not sure what your interface - name is, you can always run ip link or ls - /sys/class/net after you have booted your system. - - - The following command creates a sample file for the - eth0 device with a static IP address: - -cd /etc/sysconfig/ -cat > ifconfig.eth0 << "EOF" -ONBOOT=yes -IFACE=eth0 -SERVICE=ipv4-static -IP=192.168.1.2 -GATEWAY=192.168.1.1 -PREFIX=24 -BROADCAST=192.168.1.255 -EOF - - The values in italics must be changed in every file to match - the proper setup. - - If the ONBOOT variable is set to yes the - System V network script will bring up the Network Interface Card (NIC) during - booting of the system. If set to anything but yes the NIC - will be ignored by the network script and not be automatically brought up. - The interface can be manually started or stopped with the - ifup and ifdown commands. - - The IFACE variable defines the interface name, - for example, eth0. It is required for all network device configuration - files. The filename extension must match this value. - - The SERVICE variable defines the method used for - obtaining the IP address. The LFS-Bootscripts package has a modular IP - assignment format, and creating additional files in the /lib/services/ directory allows other IP - assignment methods. This is commonly used for Dynamic Host Configuration - Protocol (DHCP), which is addressed in the BLFS book. - - The GATEWAY variable should contain the default - gateway IP address, if one is present. If not, then comment out the - variable entirely. - - The PREFIX variable contains the number of - bits used in the subnet. Each octet in an IP address is 8 bits. If the - subnet's netmask is 255.255.255.0, then it is using the first three octets - (24 bits) to specify the network number. If the netmask is 255.255.255.240, - it would be using the first 28 bits. Prefixes longer than 24 bits are - commonly used by DSL and cable-based Internet Service Providers (ISPs). - In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the - PREFIX variable according to your specific subnet. - If omitted, the PREFIX defaults to 24. - - For more information see the ifup man page. - - - - Creating the /etc/resolv.conf File - - - /etc/resolv.conf - - - The system will need some means of obtaining Domain Name Service - (DNS) name resolution to resolve Internet domain names to IP addresses, and - vice versa. This is best achieved by placing the IP address of the DNS - server, available from the ISP or network administrator, into - /etc/resolv.conf. Create the file by running the - following: - -cat > /etc/resolv.conf << "EOF" -# Begin /etc/resolv.conf - -domain <Your Domain Name> -nameserver <IP address of your primary nameserver> -nameserver <IP address of your secondary nameserver> - -# End /etc/resolv.conf -EOF - - The domain statement can be omitted - or replaced with a search statement. See the man page for - resolv.conf for more details. - - Replace <IP address of the nameserver> - with the IP address of the DNS most appropriate for the setup. There will - often be more than one entry (requirements demand secondary servers for - fallback capability). If you only need or want one DNS server, remove the - second nameserver line from the file. The IP address - may also be a router on the local network. - - - The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4. - - - - - - Configuring the system hostname - - - hostname - configuring - - - During the boot process, the file /etc/hostname - is used for establishing the system's hostname. - - Create the /etc/hostname file and enter a - hostname by running: - -echo "<lfs>" > /etc/hostname - - <lfs> needs to be replaced with the - name given to the computer. Do not enter the Fully Qualified Domain Name - (FQDN) here. That information is put in the - /etc/hosts file. - - - - - Customizing the /etc/hosts File - - - /etc/hosts - - - - localnet - /etc/hosts - - - - network - /etc/hosts - - - Decide on the IP address, fully-qualified domain name (FQDN), and - possible aliases for use in the /etc/hosts file. The - syntax is: - -IP_address myhost.example.org aliases - - Unless the computer is to be visible to the Internet (i.e., there is - a registered domain and a valid block of assigned IP addresses—most - users do not have this), make sure that the IP address is in the private - network IP address range. Valid ranges are: - -Private Network Address Range Normal Prefix -10.0.0.1 - 10.255.255.254 8 -172.x.0.1 - 172.x.255.254 16 -192.168.y.1 - 192.168.y.254 24 - - x can be any number in the range 16-31. y can be any number in the - range 0-255. - - A valid private IP address could be 192.168.1.1. A valid FQDN for - this IP could be lfs.example.org. - - Even if not using a network card, a valid FQDN is still required. - This is necessary for certain programs to operate correctly. - - Create the /etc/hosts file by running: - -cat > /etc/hosts << "EOF" -# Begin /etc/hosts - -127.0.0.1 localhost.localdomain localhost -127.0.1.1 <FQDN> <HOSTNAME> -<192.168.1.1> <FQDN> <HOSTNAME> [alias1] [alias2 ...] -::1 localhost ip6-localhost ip6-loopback -ff02::1 ip6-allnodes -ff02::2 ip6-allrouters - -# End /etc/hosts -EOF - - The <192.168.1.1>, - <FQDN>, and - <HOSTNAME> values need to be - changed for specific uses or requirements (if assigned an IP address by a - network/system administrator and the machine will be connected to an - existing network). The optional alias name(s) can be omitted. - - - - - -
diff --git a/chapter07/networkd.xml b/chapter07/networkd.xml deleted file mode 100644 index 688c315aa..000000000 --- a/chapter07/networkd.xml +++ /dev/null @@ -1,335 +0,0 @@ - - - %general-entities; -]> - - - - - General Network Configuration - - - network - configuring - - This section only applies if a network card is to be - configured. - - - Network Interface Configuration Files - - Starting with version 209, systemd ships a network configuration - daemon called systemd-networkd which can be used for - basic network configuration. Additionally, since version 213, DNS name - resolution can be handled by systemd-resolved in place - of a static /etc/resolv.conf file. Both services are - enabled by default. - - Configuration files for systemd-networkd (and - systemd-resolved) can be placed in - /usr/lib/systemd/network - or /etc/systemd/network. Files in - /etc/systemd/network have a - higher priority than the ones in - /usr/lib/systemd/network. - There are three types of configuration files: - .link, - .netdev and - .network files. For detailed - descriptions and example contents of these configuration files, consult - the systemd-link(5), - systemd-netdev(5) and - systemd-network(5) manual pages. - - - Network Device Naming - - - Udev normally assigns network card interface names based - on system physical characteristics such as enp2s1. If you are - not sure what your interface name is, you can always run - ip link after you have booted your system. - - - - For most systems, there is only one network interface for - each type of connection. For example, the classic interface - name for a wired connection is eth0. A wireless connection - will usually have the name wifi0 or wlan0. - - - - If you prefer to use the classic or customized network interface names, - there are three alternative ways to do that: - - - - - Mask udev's .link file for the default policy: -ln -s /dev/null /etc/systemd/network/99-default.link - - - - - - Create a manual naming scheme, for example by naming the - interfaces something like "internet0", "dmz0", or "lan0". - For that, create .link - files in /etc/systemd/network/, that choose an explicit name or a - better naming scheme for one, some, or all of your interfaces. - For example: - - -cat > /etc/systemd/network/10-ether0.link << "EOF" -[Match] -# Change the MAC address as appropriate for your network device -MACAddress=12:34:45:78:90:AB - -[Link] -Name=ether0 -EOF - - - See the man page systemd.link(5) for more information. - - - - - - In /boot/grub/grub.cfg, pass the option net.ifnames=0 on the - kernel command line. - - - - - - - Static IP Configuration - - The command below creates a basic configuration file for a - Static IP setup (using both systemd-networkd and - systemd-resolved): - -cat > /etc/systemd/network/10-eth-static.network << "EOF" -[Match] -Name=<network-device-name> - -[Network] -Address=192.168.0.2/24 -Gateway=192.168.0.1 -DNS=192.168.0.1 -Domains=<Your Domain Name> -EOF - - Multiple DNS entries can be added if you have more than one DNS - server. Do not include DNS or Domains entries if you intend to use a - static /etc/resolv.conf file. - - - - - DHCP Configuration - - The command below creates a basic configuration file for an IPv4 - DHCP setup: - -cat > /etc/systemd/network/10-eth-dhcp.network << "EOF" -[Match] -Name=<network-device-name> - -[Network] -DHCP=ipv4 - -[DHCP] -UseDomains=true -EOF - - - - - - - Creating the /etc/resolv.conf File - - - /etc/resolv.conf - - - If the system is going to be connected to the Internet, it will - need some means of Domain Name Service (DNS) name resolution to - resolve Internet domain names to IP addresses, and vice versa. This is - best achieved by placing the IP address of the DNS server, available - from the ISP or network administrator, into - /etc/resolv.conf. - - - systemd-resolved Configuration - - If using another means to configure your network - interfaces (ex: ppp, network-manager, etc.), or if using any type of - local resolver (ex: bind, dnsmasq, etc.), or any other software that - generates an /etc/resolv.conf (ex: resolvconf), the - systemd-resolved service should not be - used. - - When using systemd-resolved for DNS - configuration, it creates the file - /run/systemd/resolve/resolv.conf. Create a - symlink in /etc to use the generated file: - -ln -sfv /run/systemd/resolve/resolv.conf /etc/resolv.conf - - - - - Static resolv.conf Configuration - - If a static /etc/resolv.conf is desired, - create it by running the following command: - -cat > /etc/resolv.conf << "EOF" -# Begin /etc/resolv.conf - -domain <Your Domain Name> -nameserver <IP address of your primary nameserver> -nameserver <IP address of your secondary nameserver> - -# End /etc/resolv.conf -EOF - - The domain statement can be omitted - or replaced with a search statement. See the man page - for resolv.conf for more details. - - Replace - <IP address of the nameserver> - with the IP address of the DNS most appropriate for the setup. There will - often be more than one entry (requirements demand secondary servers for - fallback capability). If you only need or want one DNS server, remove the - second nameserver line from the file. The IP address - may also be a router on the local network. - - The Google Public IPv4 DNS addresses are - 8.8.8.8 and 8.8.4.4 - for IPv4, and 2001:4860:4860::8888 and - 2001:4860:4860::8844 for IPv6. - - - - - - - Configuring the system hostname - - - hostname - configuring - - - During the boot process, the file /etc/hostname - is used for establishing the system's hostname. - - Create the /etc/hostname file and enter a - hostname by running: - -echo "<lfs>" > /etc/hostname - - <lfs> needs to be replaced with the - name given to the computer. Do not enter the Fully Qualified Domain Name - (FQDN) here. That information is put in the - /etc/hosts file. - - - - - Customizing the /etc/hosts File - - - /etc/hosts - - - - localnet - /etc/hosts - - - - network - /etc/hosts - - - Decide on a fully-qualified domain name (FQDN), and possible aliases - for use in the /etc/hosts file. If using static - addresses, you'll also need to decide on an IP address. The syntax - for a hosts file entry is: - -IP_address myhost.example.org aliases - - Unless the computer is to be visible to the Internet (i.e., there is - a registered domain and a valid block of assigned IP addresses—most - users do not have this), make sure that the IP address is in the private - network IP address range. Valid ranges are: - -Private Network Address Range Normal Prefix -10.0.0.1 - 10.255.255.254 8 -172.x.0.1 - 172.x.255.254 16 -192.168.y.1 - 192.168.y.254 24 - - x can be any number in the range 16-31. y can be any number in the - range 0-255. - - A valid private IP address could be 192.168.1.1. A valid FQDN for - this IP could be lfs.example.org. - - Even if not using a network card, a valid FQDN is still required. - This is necessary for certain programs to operate correctly. - - If using DHCP, DHCPv6, IPv6 Autoconfiguration, or if a network card - is not going to be configured, create the /etc/hosts - file by running the following command: - -cat > /etc/hosts << "EOF" -# Begin /etc/hosts - -127.0.0.1 localhost.localdomain localhost -127.0.1.1 <FQDN> <HOSTNAME> -::1 localhost ip6-localhost ip6-loopback -ff02::1 ip6-allnodes -ff02::2 ip6-allrouters - -# End /etc/hosts -EOF - - The ::1 entry is the IPv6 counterpart of 127.0.0.1 and represents - the IPv6 loopback interface. 127.0.1.1 is a loopback entry reserved - specifically for the FQDN. - - If using a static address, create the /etc/hosts - file by running this command instead: - -cat > /etc/hosts << "EOF" -# Begin /etc/hosts - -127.0.0.1 localhost -127.0.1.1 <FQDN> <HOSTNAME> -<192.168.0.2> <FQDN> <HOSTNAME> [alias1] [alias2] ... -::1 localhost ip6-localhost ip6-loopback -ff02::1 ip6-allnodes -ff02::2 ip6-allrouters - -# End /etc/hosts -EOF - - The <192.168.0.2>, - <FQDN>, and - <HOSTNAME> values need to be - changed for specific uses or requirements (if assigned an IP address by a - network/system administrator and the machine will be connected to an - existing network). The optional alias name(s) can be omitted. - - - - diff --git a/chapter07/patch.xml b/chapter07/patch.xml new file mode 100644 index 000000000..08bad5c56 --- /dev/null +++ b/chapter07/patch.xml @@ -0,0 +1,70 @@ + + + %general-entities; +]> + + + + + + patch + &patch-version; +
&patch-url;
+
+ + Patch-&patch-version; + + + Patch + tools + + + + + + <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/profile.xml b/chapter07/profile.xml deleted file mode 100644 index 226dd9fac..000000000 --- a/chapter07/profile.xml +++ /dev/null @@ -1,162 +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-config-profile" revision="sysv"> - <?dbhtml filename="profile.html"?> - - <title>The Bash Shell Startup Files - - - /etc/profile - - - The shell program /bin/bash (hereafter referred to - as the shell) uses a collection of startup files to help - create an environment to run in. Each file has a specific use and may affect - login and interactive environments differently. The files in the /etc directory provide global settings. If an - equivalent file exists in the home directory, it may override the global - settings. - - An interactive login shell is started after a successful login, using - /bin/login, by reading the /etc/passwd - file. An interactive non-login shell is started at the command-line (e.g., - [prompt]$/bin/bash). A non-interactive - shell is usually present when a shell script is running. It is non-interactive - because it is processing a script and not waiting for user input between - commands. - - For more information, see info bash under the - Bash Startup Files and Interactive Shells section. - - The files /etc/profile and - ~/.bash_profile are read when the shell is - invoked as an interactive login shell. - - The base /etc/profile below sets some - environment variables necessary for native language support. Setting - them properly results in: - - - - The output of programs translated into the native language - - - Correct classification of characters into letters, digits and other - classes. This is necessary for bash to properly accept - non-ASCII characters in command lines in non-English locales - - - The correct alphabetical sorting order for the country - - - Appropriate default paper size - - - Correct formatting of monetary, time, and date values - - - - Replace <ll> below with the two-letter code - for the desired language (e.g., en) and - <CC> with the two-letter code for the appropriate - country (e.g., GB). <charmap> should - be replaced with the canonical charmap for your chosen locale. Optional - modifiers such as @euro may also be present. - - The list of all locales supported by Glibc can be obtained by running - the following command: - -locale -a - - Charmaps can have a number of aliases, e.g., ISO-8859-1 - is also referred to as iso8859-1 and iso88591. - Some applications cannot handle the various synonyms correctly (e.g., require - that UTF-8 is written as UTF-8, not - utf8), so it is safest in most - cases to choose the canonical name for a particular locale. To determine - the canonical name, run the following command, where <locale - name> is the output given by locale -a for - your preferred locale (en_GB.iso88591 in our example). - -LC_ALL=<locale name> locale charmap - - For the en_GB.iso88591 locale, the above command - will print: - -ISO-8859-1 - - This results in a final locale setting of en_GB.ISO-8859-1. - It is important that the locale found using the heuristic above is tested prior - to it being added to the Bash startup files: - -LC_ALL=<locale name> locale language -LC_ALL=<locale name> locale charmap -LC_ALL=<locale name> locale int_curr_symbol -LC_ALL=<locale name> locale int_prefix - - The above commands should print the language name, the character - encoding used by the locale, the local currency, and the prefix to dial - before the telephone number in order to get into the country. If any of the - commands above fail with a message similar to the one shown below, this means - that your locale was either not installed in Chapter 6 or is not supported by - the default installation of Glibc. - -locale: Cannot set LC_* to default locale: No such file or directory - - If this happens, you should either install the desired locale using the - localedef command, or consider choosing a different locale. - Further instructions assume that there are no such error messages from - Glibc. - - - Some packages beyond LFS may also lack support for your chosen locale. One - example is the X library (part of the X Window System), which outputs the - following error message if the locale does not exactly match one of the character - map names in its internal files: - -Warning: locale not supported by Xlib, locale set to C - - In several cases Xlib expects that the character map will be listed in - uppercase notation with canonical dashes. For instance, "ISO-8859-1" rather - than "iso88591". It is also possible to find an appropriate specification by - removing the charmap part of the locale specification. This can be checked - by running the locale charmap command in both locales. - For example, one would have to change "de_DE.ISO-8859-15@euro" to - "de_DE@euro" in order to get this locale recognized by Xlib. - - Other packages can also function incorrectly (but may not necessarily - display any error messages) if the locale name does not meet their expectations. - In those cases, investigating how other Linux distributions support your locale - might provide some useful information. - - Once the proper locale settings have been determined, create the - /etc/profile file: - -cat > /etc/profile << "EOF" -# Begin /etc/profile - -export LANG=<ll>_<CC>.<charmap><@modifiers> - -# End /etc/profile -EOF - - The C (default) and en_US (the recommended - one for United States English users) locales are different. C - uses the US-ASCII 7-bit character set, and treats bytes with the high bit set - as invalid characters. That's why, e.g., the ls command - substitutes them with question marks in that locale. Also, an attempt to send - mail with such characters from Mutt or Pine results in non-RFC-conforming - messages being sent (the charset in the outgoing mail is indicated as unknown - 8-bit). So you can use the C locale only if you are sure that - you will never need 8-bit characters. - - UTF-8 based locales are not supported well by some programs. - Work is in progress to document and, if possible, fix such problems, see - . - -
diff --git a/chapter07/python.xml b/chapter07/python.xml new file mode 100644 index 000000000..8e7afaf03 --- /dev/null +++ b/chapter07/python.xml @@ -0,0 +1,88 @@ + + + %general-entities; +]> + + + + + + Python + &python-version; +
&python-url;
+
+ + Python-&python-version; + + + Python + temporary + + + + + + <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/symlinks.xml b/chapter07/symlinks.xml deleted file mode 100644 index 951e6976d..000000000 --- a/chapter07/symlinks.xml +++ /dev/null @@ -1,256 +0,0 @@ - - - %general-entities; -]> - - - - - Managing Devices - - - - Network Devices - - Udev, by default, names network devices according to Firmware/BIOS - data or physical characteristics like the bus, slot, or MAC address. The - purpose of this naming convention is to ensure that network devices are - named consistently and not based on the time the network card was - discovered. For example, on a computer having two network cards made by - Intel and Realtek, the network card manufactured by Intel may become eth0 - and the Realtek card becomes eth1. In some cases, after a reboot the cards - get renumbered the other way around. - - In the new naming scheme, typical network device names would then - be something like enp5s0 or wlp3s0. If this naming convention is not - desired, the traditional naming scheme or a custom scheme can be - implemented. - - - Disabling Persistent Naming on the Kernel Command Line - - The traditional naming scheme using eth0, eth1, etc can be - restored by adding net.ifnames=0 on the - kernel command line. This is most appropriate for those systems - that have only one ethernet device of the same type. Laptops - often have multiple ethernet connections that are named eth0 and - wlan0 and are also candidates for this method. The command line - is passed in the GRUB configuration file. - See . - - - - Creating Custom Udev Rules - - The naming scheme can be customized by creating custom Udev - rules. A script has been included that generates the initial rules. - Generate these rules by running: - -bash /lib/udev/init-net-rules.sh - - Now, inspect the - /etc/udev/rules.d/70-persistent-net.rules file, to - find out which name was assigned to which network device: - -cat /etc/udev/rules.d/70-persistent-net.rules - - In some cases such as when MAC addresses have been assigned to - a network card manually or in a virtual environment such as Qemu or Xen, - the network rules file may not have been generated because addresses - are not consistently assigned. In these cases, this method cannot - be used. - - The file begins with a comment block followed by two lines for each - NIC. The first line for each NIC is a commented description showing its - hardware IDs (e.g. its PCI vendor and device IDs, if it's a PCI card), - along with its driver in parentheses, if the driver can be found. Neither - the hardware ID nor the driver is used to determine which name to give an - interface; this information is only for reference. The second line is the - Udev rule that matches this NIC and actually assigns it a name. - - All Udev rules are made up of several keys, separated by commas and - optional whitespace. This rule's keys and an explanation of each of them - are as follows: - - - - SUBSYSTEM=="net" - This tells Udev to ignore - devices that are not network cards. - - - ACTION=="add" - This tells Udev to ignore this - rule for a uevent that isn't an add ("remove" and "change" uevents also - happen, but don't need to rename network interfaces). - - - DRIVERS=="?*" - This exists so that Udev will - ignore VLAN or bridge sub-interfaces (because these sub-interfaces do - not have drivers). These sub-interfaces are skipped because the name - that would be assigned would collide with their parent devices. - - - ATTR{address} - The value of this key is the - NIC's MAC address. - - - ATTR{type}=="1" - This ensures the rule only - matches the primary interface in the case of certain wireless drivers, - which create multiple virtual interfaces. The secondary interfaces are - skipped for the same reason that VLAN and bridge sub-interfaces are - skipped: there would be a name collision otherwise. - - - NAME - The value of this key is the name that - Udev will assign to this interface. - - - - The value of NAME is the important part. Make sure - you know which name has been assigned to each of your network cards before - proceeding, and be sure to use that NAME value when - creating your configuration files below. - - - - - - - - CD-ROM symlinks - - Some software that you may want to install later (e.g., various - media players) expect the /dev/cdrom - and /dev/dvd symlinks to exist, and - to point to a CD-ROM or DVD-ROM device. Also, it may be convenient to put - references to those symlinks into /etc/fstab. Udev - comes with a script that will generate rules files to create these symlinks - for you, depending on the capabilities of each device, but you need to - decide which of two modes of operation you wish to have the script use. - - First, the script can operate in by-path mode (used by - default for USB and FireWire devices), where the rules it creates depend on - the physical path to the CD or DVD device. Second, it can operate in - by-id mode (default for IDE and SCSI devices), where the - rules it creates depend on identification strings stored in the CD or DVD - device itself. The path is determined by Udev's path_id - script, and the identification strings are read from the hardware by its - ata_id or scsi_id programs, depending - on which type of device you have. - - There are advantages to each approach; the correct approach to use - will depend on what kinds of device changes may happen. If you expect the - physical path to the device (that is, the ports and/or slots that it plugs - into) to change, for example because you plan on moving the drive to a - different IDE port or a different USB connector, then you should use the - by-id mode. On the other hand, if you expect the device's - identification to change, for example because it may die, and you would - replace it with a different device with the same capabilities and which - is plugged into the same connectors, then you should use the - by-path mode. - - If either type of change is possible with your drive, then choose a - mode based on the type of change you expect to happen more often. - - - - External devices (for example, a USB-connected CD drive) - should not use by-path persistence, because each time the device is plugged - into a new external port, its physical path will change. All - externally-connected devices will have this problem if you write Udev rules - to recognize them by their physical path; the problem is not limited to CD - and DVD drives. - - If you wish to see the values that the Udev scripts will use, then - for the appropriate CD-ROM device, find the corresponding directory under - /sys (e.g., this can be - /sys/block/hdd) and - run a command similar to the following: - -udevadm test /sys/block/hdd - - Look at the lines containing the output of various *_id programs. - The by-id mode will use the ID_SERIAL value if it exists and - is not empty, otherwise it will use a combination of ID_MODEL and - ID_REVISION. The by-path mode will use the ID_PATH value. - - If the default mode is not suitable for your situation, then the - following modification can be made to the - /etc/udev/rules.d/83-cdrom-symlinks.rules file, - as follows (where mode is one of - by-id or by-path): - -sed -i -e 's/"write_cd_rules"/"write_cd_rules mode"/' \ - /etc/udev/rules.d/83-cdrom-symlinks.rules - - Note that it is not necessary to create the rules files or symlinks - at this time, because you have bind-mounted the host's - /dev directory into the LFS system, - and we assume the symlinks exist on the host. The rules and symlinks will - be created the first time you boot your LFS system. - - However, if you have multiple CD-ROM devices, then the symlinks - generated at that time may point to different devices than they point to on - your host, because devices are not discovered in a predictable order. The - assignments created when you first boot the LFS system will be stable, so - this is only an issue if you need the symlinks on both systems to point to - the same device. If you need that, then inspect (and possibly edit) the - generated /etc/udev/rules.d/70-persistent-cd.rules - file after booting, to make sure the assigned symlinks match what you need. - - - - - - Dealing with duplicate devices - - As explained in , the order in - which devices with the same function appear in - /dev is essentially random. - E.g., if you have a USB web camera and a TV tuner, sometimes - /dev/video0 refers to the camera and - /dev/video1 refers to the tuner, and sometimes - after a reboot the order changes to the opposite one. - For all classes of hardware except sound cards and network cards, this is - fixable by creating Udev rules for custom persistent symlinks. - The case of network cards is covered separately in - , and sound card configuration can - be found in BLFS. - - For each of your devices that is likely to have this problem - (even if the problem doesn't exist in your current Linux distribution), - find the corresponding directory under - /sys/class or - /sys/block. - For video devices, this may be - /sys/class/video4linux/videoX. - Figure out the attributes that identify the device uniquely (usually, - vendor and product IDs and/or serial numbers work): - -udevadm info -a -p /sys/class/video4linux/video0 - - Then write rules that create the symlinks, e.g.: - -cat > /etc/udev/rules.d/83-duplicate_devs.rules << "EOF" - -# Persistent symlinks for webcam and tuner -KERNEL=="video*", ATTRS{idProduct}=="1910", ATTRS{idVendor}=="0d81", \ - SYMLINK+="webcam" -KERNEL=="video*", ATTRS{device}=="0x036f", ATTRS{vendor}=="0x109e", \ - SYMLINK+="tvtuner" - -EOF - - The result is that /dev/video0 and - /dev/video1 devices still refer randomly to the tuner - and the web camera (and thus should never be used directly), but there are - symlinks /dev/tvtuner and - /dev/webcam that always point to the correct - device. - - - - diff --git a/chapter07/systemd-custom.xml b/chapter07/systemd-custom.xml deleted file mode 100644 index 787fd4572..000000000 --- a/chapter07/systemd-custom.xml +++ /dev/null @@ -1,313 +0,0 @@ - - - %general-entities; -]> - - - - - Systemd Usage and Configuration - - - Systemd Customization - - - - Basic Configuration - - The /etc/systemd/system.conf file contains a set - of options to control basic systemd operations. The default file has all - entries commented out with the default settings indicated. This file is - where the log level may be changed as well as some basic logging settings. - See the systemd-system.conf(5) manual page for details - on each configuration option. - - - - - Disabling Screen Clearing at Boot Time - - The normal behavior for systemd is to clear the screen at - the end of the boot sequence. If desired, this behavior may be - changed by running the following command: - -mkdir -pv /etc/systemd/system/getty@tty1.service.d - -cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf << EOF -[Service] -TTYVTDisallocate=no -EOF - - The boot messages can always be reviewed by using the - journalctl -b command as the root user. - - - - - Disabling tmpfs for /tmp - - By default, /tmp is created as - a tmpfs. If this is not desired, it can be overridden by the following: - -ln -sfv /dev/null /etc/systemd/system/tmp.mount - - Alternatively, if a a separate partition for - /tmp is desired, specify that - partition in an /etc/fstab entry. - - - - Do not create the symbolic link above if a separate partition is used - for /tmp. This will prevent the - root file system (/) from being remounted r/w and make the system - unusable when booted. - - - - - - - Configuring Automatic File Creation and Deletion - - There are several services that create or delete files or - directories: - - - systemd-tmpfiles-clean.service - systemd-tmpfiles-setup-dev.service - systemd-tmpfiles-setup.service - - - The system location for the configuration files is - /usr/lib/tmpfiles.d/*.conf. The local - configuration files are in - /etc/tmpfiles.d. Files in - /etc/tmpfiles.d override - files with the same name in - /usr/lib/tmpfiles.d. See - tmpfiles.d(5) manual page for file format - details. - - - Note that the syntax for the - /usr/lib/tmpfiles.d/*.conf files can be - confusing. For example, the default deletion of files in the /tmp directory - is located in /usr/lib/tmpfiles.d/tmp.conf with - the line: - -q /tmp 1777 root root 10d - - The type field, q, discusses creating a subvolume with quotas which - is really only applicable to btrfs filesystems. It references type v - which in turn references type d (directory). This then creates the - specified directory if is is not present and adjusts the permissions - and ownership as specified. Contents of the directory will be - subject to time based cleanup if the age argument is specified. - - - - If the default parameters are not desired, then the file should - be copied to /etc/tmpfiles.d - and edited as desired. For example: - -mkdir -p /etc/tmpfiles.d -cp /usr/lib/tmpfiles.d/tmp.conf /etc/tmpfiles.d - - - - - - Overriding Default Services Behavior - - The parameter of a unit can be overriden by creating a directory - and a configuration file in /etc/systemd/system. For example: - -mkdir -pv /etc/systemd/system/foobar.service.d - -cat > /etc/systemd/system/foobar.service.d/foobar.conf << EOF -[Service] -Restart=always -RestartSec=30 -EOF - - See systemd.unit(5) manual page for more - information. After creating the configuration file, run - systemctl daemon-reload and systemctl - restart foobar to activate the changes to a service. - - - - - Debugging the Boot Sequence - - Rather than plain shell scripts used in SysVinit or BSD style init - systems, systemd uses a unified format for different types of startup - files (or units). The command systemctl is used to - enable, disable, control state, and obtain status of unit files. Here - are some examples of frequently used commands: - - - - systemctl list-units -t <service> [--all]: - lists loaded unit files of type service. - - - systemctl list-units -t <target> [--all]: - lists loaded unit files of type target. - - - systemctl show -p Wants <multi-user.target>: - shows all units that depend on the multi-user target. Targets are - special unit files that are anogalous to runlevels under - SysVinit. - - - systemctl status <servicename.service>: - shows the status of the servicename service. The .service extension - can be omitted if there are no other unit files with the same name, - such as .socket files (which create a listening socket that provides - similar functionality to inetd/xinetd). - - - - - - - Working with the Systemd Journal - - Logging on a system booted with systemd is handled with - systemd-journald (by default), rather than a typical unix syslog daemon. - You can also add a normal syslog daemon and have both work side by - side if desired. The systemd-journald program stores journal entries in a - binary format rather than a plain text log file. To assist with - parsing the file, the command journalctl is provided. - Here are some examples of frequently used commands: - - - - journalctl -r: shows all contents of the - journal in reverse chronological order. - - - journalctl -u UNIT: - shows the journal entries associated with the specified UNIT - file. - - - journalctl -b[=ID] -r: shows the journal - entries since last successful boot (or for boot ID) in reverse - chronological order. - - - journalctl -f: povides functionality similar - to tail -f (follow). - - - - - - - Working with Core Dumps - - Core dumps are useful to debug crashed programs, especially - when a daemon process crashes. On systemd booted systems the core - dumping is handled by systemd-coredump. It will - log the core dump into the journal and store the core dump itself in - /var/lib/systemd/coredump. - To retrieve and process core dumps, coredumpctl - tool is provided. Here are some examples of frequently used commands: - - - - - coredumpctl -r: lists all core dumps in - reversed chronological order. - - - coredumpctl -1 info: show the information - of the last core dump. - - - coredumpctl -1 debug: load the last core - dump into GDB. - - - - - Core dumps may use a lot of disk space. The maximum disk space - used by core dumps can be limited by creating a configuration file in - /etc/systemd/coredump.conf.d. - For example: - -mkdir -pv /etc/systemd/coredump.conf.d - -cat > /etc/systemd/coredump.conf.d/maxuse.conf << EOF -[Coredump] -MaxUse=5G -EOF - - See systemd-coredump(8), - coredumpctl(1), and - coredump.conf.d(5) manual pages for more - information. - - - - Long Running Processes - - Beginning with systemd-230, all user processes are killed when a user - session is ended, even if nohup is used, or the process uses the - daemon() or setsid() functions. - This is a deliberate change from a historically permissive environment to a - more restrictive one. The new behavior may cause issues if you depend on - long running programs (e.g., screen or - tmux) to remain active after ending your user session. - There are three ways to enable lingering processes to remain after a user - session is ended. - - - - - Enable process lingering for only selected users: - Normal users have permission to enable process lingering - with the command loginctl enable-linger for their - own user. System administrators can use the same command with a - user argument to enable for a user. That user - can then use the systemd-run command to start - long running processes. For example: systemd-run --scope - --user /usr/bin/screen. If you enable lingering for your - user, the user@.service will remain even after all login sessions are - closed, and will automatically start at system boot. This has the - advantage of explicitly allowing and disallowing processes to run - after the user session has ended, but breaks backwards compatibility - with tools like nohup and utilities that use - deamon(). - - - - - Enable system-wide process lingering: - You can set KillUserProcesses=no in - /etc/systemd/logind.conf to enable process lingering - globally for all users. This has the benefit of leaving the old - method available to all users at the expense of explicit control. - - - - - Disable at build-time: You can enable - lingering by default while building systemd by adding the switch - -Ddefault-kill-user-processes=false to the - meson command for systemd. This completely - disables the ability of systemd to kill user processes at session - end. - - - - - - - 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/udev.xml b/chapter07/udev.xml deleted file mode 100644 index 6060849be..000000000 --- a/chapter07/udev.xml +++ /dev/null @@ -1,342 +0,0 @@ - - - %general-entities; -]> - - - - - Overview of Device and Module Handling - - - Udev - usage - - - In , we installed the Udev - package when eudev - systemd was built. Before we go into the - details regarding how this works, a brief history of previous methods of - handling devices is in order. - - Linux systems in general traditionally used a static device creation - method, whereby a great many device nodes were created under /dev (sometimes literally thousands of nodes), - regardless of whether the corresponding hardware devices actually existed. This - was typically done via a MAKEDEV script, which contains a - number of calls to the mknod program with the relevant - major and minor device numbers for every possible device that might exist in - the world. - - Using the Udev method, only those devices which are detected by the - kernel get device nodes created for them. Because these device nodes will be - created each time the system boots, they will be stored on a devtmpfs file system (a virtual file system - that resides entirely in system memory). Device nodes do not require much - space, so the memory that is used is negligible. - - - History - - In February 2000, a new filesystem called devfs was merged into the 2.3.46 kernel - and was made available during the 2.4 series of stable kernels. Although - it was present in the kernel source itself, this method of creating devices - dynamically never received overwhelming support from the core kernel - developers. - - The main problem with the approach adopted by devfs was the way it handled device - detection, creation, and naming. The latter issue, that of device node - naming, was perhaps the most critical. It is generally accepted that if - device names are allowed to be configurable, then the device naming policy - should be up to a system administrator, not imposed on them by any - particular developer(s). The devfs file system also suffered from race - conditions that were inherent in its design and could not be fixed without a - substantial revision to the kernel. It was marked as deprecated for a long - period – due to a lack of maintenance – and was finally removed - from the kernel in June, 2006. - - With the development of the unstable 2.5 kernel tree, later released - as the 2.6 series of stable kernels, a new virtual filesystem called - sysfs came to be. The job of - sysfs is to export a view of - the system's hardware configuration to userspace processes. With this - userspace-visible representation, the possibility of developing a userspace - replacement for devfs became - much more realistic. - - - - - Udev Implementation - - - Sysfs - - The sysfs filesystem - was mentioned briefly above. One may wonder how sysfs knows about the devices present on - a system and what device numbers should be used for them. Drivers that - have been compiled into the kernel directly register their objects with a - sysfs (devtmpfs internally) - as they are detected by the kernel. For drivers compiled as modules, this - registration will happen when the module is loaded. Once the sysfs filesystem is mounted (on /sys), - data which the drivers register with sysfs are available to userspace - processes and to udevd for processing (including modifications to device - nodes). - - - - - Device Node Creation - - Device files are created by the kernel by the devtmpfs filesystem. Any driver that - wishes to register a device node will go through the devtmpfs (via the driver core) to do it. - When a devtmpfs instance is - mounted on /dev, the device node - will initially be created with a fixed name, permissions, and - owner. - - A short time later, the kernel will send a uevent to - udevd. Based on the rules specified in the files within the - /etc/udev/rules.d, /lib/udev/rules.d, and /run/udev/rules.d directories, - udevd will create additional symlinks to the device node, or - change its permissions, owner, or group, or modify the internal - udevd database entry (name) for that object. - - The rules in these three directories are numbered and all three - directories are merged together. If udevd can't find a - rule for the device it is creating, it will leave the permissions and - ownership at whatever devtmpfs used initially. - - - Module Loading - - Device drivers compiled as modules may have aliases built into them. - Aliases are visible in the output of the modinfo - program and are usually related to the bus-specific identifiers of devices - supported by a module. For example, the snd-fm801 - driver supports PCI devices with vendor ID 0x1319 and device ID 0x0801, - and has an alias of pci:v00001319d00000801sv*sd*bc04sc01i*. - For most devices, the bus driver exports the alias of the driver that - would handle the device via sysfs. E.g., the - /sys/bus/pci/devices/0000:00:0d.0/modalias file - might contain the string - pci:v00001319d00000801sv00001319sd00001319bc04sc01i00. - The default rules provided with Udev will cause udevd - to call out to /sbin/modprobe with the contents of the - MODALIAS uevent environment variable (which should be the - same as the contents of the modalias file in sysfs), - thus loading all modules whose aliases match this string after wildcard - expansion. - - In this example, this means that, in addition to - snd-fm801, the obsolete (and unwanted) - forte driver will be loaded if it is - available. See below for ways in which the loading of unwanted drivers can - be prevented. - - The kernel itself is also able to load modules for network - protocols, filesystems and NLS support on demand. - - - - - Handling Hotpluggable/Dynamic Devices - - When you plug in a device, such as a Universal Serial Bus (USB) MP3 - player, the kernel recognizes that the device is now connected and - generates a uevent. This uevent is then handled by - udevd as described above. - - - - - - - Problems with Loading Modules and Creating Devices - - There are a few possible problems when it comes to automatically - creating device nodes. - - - A kernel module is not loaded automatically - - Udev will only load a module if it has a bus-specific alias and the - bus driver properly exports the necessary aliases to sysfs. In other cases, one should - arrange module loading by other means. With Linux-&linux-version;, Udev is - known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI, - SERIO, and FireWire devices. - - To determine if the device driver you require has the necessary - support for Udev, run modinfo with the module name as - the argument. Now try locating the device directory under - /sys/bus and check whether there is - a modalias file there. - - If the modalias file exists in sysfs, the driver supports the device and - can talk to it directly, but doesn't have the alias, it is a bug in the - driver. Load the driver without the help from Udev and expect the issue - to be fixed later. - - If there is no modalias file in the relevant - directory under /sys/bus, this - means that the kernel developers have not yet added modalias support to - this bus type. With Linux-&linux-version;, this is the case with ISA - busses. Expect this issue to be fixed in later kernel versions. - - Udev is not intended to load wrapper drivers such as - snd-pcm-oss and non-hardware drivers such as - loop at all. - - - - - A kernel module is not loaded automatically, and Udev is not - intended to load it - - If the wrapper module only enhances the - functionality provided by some other module (e.g., - snd-pcm-oss enhances the functionality of - snd-pcm by making the sound cards available to OSS - applications), configure modprobe to load the wrapper - after Udev loads the wrapped module. To do this, add a - softdep line to the corresponding - /etc/modprobe.d/<filename>.conf - file. For example: - -softdep snd-pcm post: snd-pcm-oss - - Note that the softdep command also allows - pre: dependencies, or a mixture of both - pre: and post:. See the - modprobe.d(5) manual page for more information - on softdep syntax and capabilities. - - If the module in question is not a wrapper and is useful by itself, - configure the modules bootscript to load this - module on system boot. To do this, add the module name to the - /etc/sysconfig/modules file on a separate line. - This works for wrapper modules too, but is suboptimal in that case. - - - - - Udev loads some unwanted module - - Either don't build the module, or blacklist it in a - /etc/modprobe.d/blacklist.conf file as done with the - forte module in the example below: - -blacklist forte - - Blacklisted modules can still be loaded manually with the - explicit modprobe command. - - - - - Udev creates a device incorrectly, or makes a wrong symlink - - This usually happens if a rule unexpectedly matches a device. For - example, a poorly-written rule can match both a SCSI disk (as desired) - and the corresponding SCSI generic device (incorrectly) by vendor. - Find the offending rule and make it more specific, with the help of the - udevadm info command. - - - - - Udev rule works unreliably - - This may be another manifestation of the previous problem. If not, - and your rule uses sysfs - attributes, it may be a kernel timing issue, to be fixed in later kernels. - For now, you can work around it by creating a rule that waits for the used - sysfs attribute and appending - it to the /etc/udev/rules.d/10-wait_for_sysfs.rules - file (create this file if it does not exist). Please notify the LFS - Development list if you do so and it helps. - - - - - Udev does not create a device - - Further text assumes that the driver is built statically into the - kernel or already loaded as a module, and that you have already checked - that Udev doesn't create a misnamed device. - - Udev has no information needed to create a device node if a kernel - driver does not export its data to - sysfs. This is most common - with third party drivers from outside the kernel tree. Create a static - device node in /lib/udev/devices with the - appropriate major/minor numbers (see the file - devices.txt inside the kernel documentation or the - documentation provided by the third party driver vendor). The static - device node will be copied to /dev - by udev. - - - - - Device naming order changes randomly after rebooting - - This is due to the fact that Udev, by design, handles uevents and - loads modules in parallel, and thus in an unpredictable order. This will - never be fixed. You should not rely upon the kernel device - names being stable. Instead, create your own rules that make symlinks with - stable names based on some stable attributes of the device, such as a - serial number or the output of various *_id utilities installed by Udev. - See and - for examples. - - - - - - - Useful Reading - - Additional helpful documentation is available at the following - sites: - - - - - A Userspace Implementation of devfs - - - - - The sysfs Filesystem - - - - - - - - - diff --git a/chapter07/usage.xml b/chapter07/usage.xml deleted file mode 100644 index 4a4cf6c36..000000000 --- a/chapter07/usage.xml +++ /dev/null @@ -1,710 +0,0 @@ - - - - %general-entities; -]> - - - - - System V Bootscript Usage and Configuration - - - Bootscripts - usage - - - - How Do the System V Bootscripts Work? - - Linux uses a special booting facility named SysVinit that is based on a - concept of run-levels. It can be quite different from one - system to another, so it cannot be assumed that because things worked in one - particular Linux distribution, they should work the same in LFS too. LFS has its - own way of doing things, but it respects generally accepted standards. - - SysVinit (which will be referred to as init from now on) - works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels - (actually, there are more run-levels, but they are for special cases and are - generally not used. See init(8) for more details), and - each one of those corresponds to the actions the computer is supposed to - perform when it starts up. The default run-level is 3. Here are the - descriptions of the different run-levels as they are implemented: - -0: halt the computer -1: single-user mode -2: multi-user mode without networking -3: multi-user mode with networking -4: reserved for customization, otherwise does the same as 3 -5: same as 4, it is usually used for GUI login (like X's xdm or KDE's kdm) -6: reboot the computer - - - - - Configuring Sysvinit - - - Sysvinit - configuring - - - - /etc/inittab - - - During the kernel initialization, the first program that is run - is either specified on the command line or, by default - init. This program reads the initialization file - /etc/inittab. Create this file with: - -cat > /etc/inittab << "EOF" -# Begin /etc/inittab - -id:3:initdefault: - -si::sysinit:/etc/rc.d/init.d/rc S - -l0:0:wait:/etc/rc.d/init.d/rc 0 -l1:S1:wait:/etc/rc.d/init.d/rc 1 -l2:2:wait:/etc/rc.d/init.d/rc 2 -l3:3:wait:/etc/rc.d/init.d/rc 3 -l4:4:wait:/etc/rc.d/init.d/rc 4 -l5:5:wait:/etc/rc.d/init.d/rc 5 -l6:6:wait:/etc/rc.d/init.d/rc 6 - -ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now - -su:S016:once:/sbin/sulogin - -1:2345:respawn:/sbin/agetty --noclear tty1 9600 -2:2345:respawn:/sbin/agetty tty2 9600 -3:2345:respawn:/sbin/agetty tty3 9600 -4:2345:respawn:/sbin/agetty tty4 9600 -5:2345:respawn:/sbin/agetty tty5 9600 -6:2345:respawn:/sbin/agetty tty6 9600 - -# End /etc/inittab -EOF - - An explanation of this initialization file is in the man page for - inittab. For LFS, the key command that is run is - rc. The initialization file above will instruct - rc to run all the scripts starting with an S in the - /etc/rc.d/rcS.d directory - followed by all the scripts starting with an S in the /etc/rc.d/rc?.d directory where the question - mark is specified by the initdefault value. - - As a convenience, the rc script reads a library of - functions in /lib/lsb/init-functions. - This library also reads an optional configuration file, - /etc/sysconfig/rc.site. Any of the system - configuration file parameters described in subsequent sections can be - alternatively placed in this file allowing consolidation of all system - parameters in this one file. - - As a debugging convenience, the functions script also logs all output - to /run/var/bootlog. Since the /run directory is a tmpfs, this file is not - persistent across boots, however it is appended to the more permanent file - /var/log/boot.log at the end of the boot process. - - - Changing Run Levels - - Changing run-levels is done with init - <runlevel>, where - <runlevel> is the target run-level. For example, to - reboot the computer, a user could issue the init 6 command, - which is an alias for the reboot command. Likewise, - init 0 is an alias for the halt - command. - - There are a number of directories under /etc/rc.d that look like rc?.d (where ? is the number of the run-level) and - rcsysinit.d, all containing a number of - symbolic links. Some begin with a K, the others begin with - an S, and all of them have two numbers following the - initial letter. The K means to stop (kill) a service and the S means to start a - service. The numbers determine the order in which the scripts are run, from 00 - to 99—the lower the number the earlier it gets executed. When - init switches to another run-level, the appropriate services - are either started or stopped, depending on the runlevel chosen. - - The real scripts are in /etc/rc.d/init.d. They do the actual work, and - the symlinks all point to them. K links and S links point to - the same script in /etc/rc.d/init.d. - This is because the scripts can be called with different parameters like - start, stop, - restart, reload, and - status. When a K link is encountered, the appropriate - script is run with the stop argument. When an S link - is encountered, the appropriate script is run with the - start argument. - - There is one exception to this explanation. Links that start - with an S in the rc0.d and rc6.d directories will not cause anything - to be started. They will be called with the parameter - stop to stop something. The logic behind this - is that when a user is going to reboot or halt the system, nothing - needs to be started. The system only needs to be stopped. - - These are descriptions of what the arguments make the scripts - do: - - - - - start - - The service is started. - - - - - stop - - The service is stopped. - - - - - restart - - The service is stopped and then started again. - - - - - reload - - The configuration of the service is updated. - This is used after the configuration file of a service was modified, when - the service does not need to be restarted. - - - - - status - - Tells if the service is running and with which PIDs. - - - - - - Feel free to modify the way the boot process works (after all, - it is your own LFS system). The files given here are an example of how - it can be done. - - - - - - Udev Bootscripts - - The /etc/rc.d/init.d/udev initscript starts - udevd, triggers any "coldplug" devices that have - already been created by the kernel and waits for any rules to complete. - The script also unsets the uevent handler from the default of - /sbin/hotplug . This is done because the kernel no - longer needs to call out to an external binary. Instead - udevd will listen on a netlink socket for uevents that - the kernel raises. - - The /etc/rc.d/init.d/udev_retry initscript takes - care of re-triggering events for subsystems whose rules may rely on - filesystems that are not mounted until the mountfs - script is run (in particular, /usr - and /var may cause this). This - script runs after the mountfs script, so those rules - (if re-triggered) should succeed the second time around. It is - configured from the /etc/sysconfig/udev_retry file; - any words in this file other than comments are considered subsystem names - to trigger at retry time. To find the subsystem of a device, use - udevadm info --attribute-walk <device> where - <device> is an absolute path in /dev or /sys such as /dev/sr0 or - /sys/class/rtc. - - For information on kernel module loading and udev, see - . - - - - - Configuring the System Clock - - - setclock - configuring - - The setclock script reads the time from the hardware - clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor - (CMOS) clock. If the hardware clock is set to UTC, this script will convert the - hardware clock's time to the local time using the - /etc/localtime file (which tells the - hwclock program which timezone the user is in). There is no - way to detect whether or not the hardware clock is set to UTC, so this - needs to be configured manually. - - The setclock is run via - udev when the kernel detects the hardware - capability upon boot. It can also be run manually with the stop parameter to - store the system time to the CMOS clock. - - If you cannot remember whether or not the hardware clock is set to UTC, - find out by running the hwclock --localtime --show - command. This will display what the current time is according to the hardware - clock. If this time matches whatever your watch says, then the hardware clock is - set to local time. If the output from hwclock is not local - time, chances are it is set to UTC time. Verify this by adding or subtracting - the proper amount of hours for the timezone to the time shown by - hwclock. For example, if you are currently in the MST - timezone, which is also known as GMT -0700, add seven hours to the local - time. - - Change the value of the UTC variable below - to a value of 0 (zero) if the hardware clock - is not set to UTC time. - - Create a new file /etc/sysconfig/clock by running - the following: - -cat > /etc/sysconfig/clock << "EOF" -# Begin /etc/sysconfig/clock - -UTC=1 - -# Set this to any options you might need to give to hwclock, -# such as machine hardware clock type for Alphas. -CLOCKPARAMS= - -# End /etc/sysconfig/clock -EOF - - A good hint explaining how to deal with time on LFS is available - at . It explains issues such as - time zones, UTC, and the TZ environment variable. - - The CLOCKPARAMS and UTC paramaters may be alternatively set - in the /etc/sysconfig/rc.site file. - - - - - - - Configuring the Linux Console - - - console - configuring - - - This section discusses how to configure the console - bootscript that sets up the keyboard map, console font and console kernel log - level. If non-ASCII characters (e.g., the copyright sign, the British pound - sign and Euro symbol) will not be used and the keyboard is a U.S. one, much - of this section can be skipped. Without the configuration file, (or - equivalent settings in rc.site), the - console bootscript will do nothing. - - The console script reads the - /etc/sysconfig/console file for configuration - information. Decide which keymap and screen font will be used. Various - language-specific HOWTOs can also help with this, see . If still in - doubt, look in the /usr/share/keymaps - and /usr/share/consolefonts directories - for valid keymaps and screen fonts. Read loadkeys(1) and - setfont(8) manual pages to determine the correct - arguments for these programs. - - The /etc/sysconfig/console file should contain lines - of the form: VARIABLE="value". The following variables are recognized: - - - - LOGLEVEL - - This variable specifies the log level for kernel messages sent - to the console as set by dmesg -n. Valid levels are - from "1" (no messages) to "8". The default level is "7". - - - - - KEYMAP - - This variable specifies the arguments for the - loadkeys program, typically, the name of keymap - to load, e.g., it. If this variable is not set, the - bootscript will not run the loadkeys program, - and the default kernel keymap will be used. Note that a few keymaps - have multiple versions with the same name (cz and its variants in - qwerty/ and qwertz/, es in olpc/ and qwerty/, and trf in fgGIod/ and - qwerty/). In these cases the parent directory should also be specified - (e.g. qwerty/es) to ensure the proper keymap is loaded. - - - - - - KEYMAP_CORRECTIONS - - This (rarely used) variable - specifies the arguments for the second call to the - loadkeys program. This is useful if the stock keymap - is not completely satisfactory and a small adjustment has to be made. E.g., - to include the Euro sign into a keymap that normally doesn't have it, - set this variable to euro2. - - - - - FONT - - This variable specifies the arguments for the - setfont program. Typically, this includes the font - name, -m, and the name of the application character - map to load. E.g., in order to load the lat1-16 font - together with the 8859-1 application character map - (as it is appropriate in the USA), - - set this variable to lat1-16 -m 8859-1. - In UTF-8 mode, the kernel uses the application character map for - conversion of composed 8-bit key codes in the keymap to UTF-8, and thus - the argument of the "-m" parameter should be set to the encoding of the - composed key codes in the keymap. - - - - - - UNICODE - - Set this variable to 1, yes or - true in order to put the - console into UTF-8 mode. This is useful in UTF-8 based locales and - harmful otherwise. - - - - - LEGACY_CHARSET - - For many keyboard layouts, there is no stock Unicode keymap in - the Kbd package. The console bootscript will - convert an available keymap to UTF-8 on the fly if this variable is - set to the encoding of the available non-UTF-8 keymap. - - - - - - Some examples: - - - - - For a non-Unicode setup, only the KEYMAP and FONT variables are - generally needed. E.g., for a Polish setup, one would use: -cat > /etc/sysconfig/console << "EOF" -# Begin /etc/sysconfig/console - -KEYMAP="pl2" -FONT="lat2a-16 -m 8859-2" - -# End /etc/sysconfig/console -EOF - - - - As mentioned above, it is sometimes necessary to adjust a - stock keymap slightly. The following example adds the Euro symbol to the - German keymap: - -cat > /etc/sysconfig/console << "EOF" -# Begin /etc/sysconfig/console - -KEYMAP="de-latin1" -KEYMAP_CORRECTIONS="euro2" -FONT="lat0-16 -m 8859-15" -UNICODE="1" - -# End /etc/sysconfig/console -EOF - - - - The following is a Unicode-enabled example for Bulgarian, where a - stock UTF-8 keymap exists: - -cat > /etc/sysconfig/console << "EOF" -# Begin /etc/sysconfig/console - -UNICODE="1" -KEYMAP="bg_bds-utf8" -FONT="LatArCyrHeb-16" - -# End /etc/sysconfig/console -EOF - - - - Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous - example, bright colors are no longer available on the Linux console unless - a framebuffer is used. If one wants to have bright colors without - framebuffer and can live without characters not belonging to his language, - it is still possible to use a language-specific 256-glyph font, as - illustrated below: - -cat > /etc/sysconfig/console << "EOF" -# Begin /etc/sysconfig/console - -UNICODE="1" -KEYMAP="bg_bds-utf8" -FONT="cyr-sun16" - -# End /etc/sysconfig/console -EOF - - - - The following example illustrates keymap autoconversion from - ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode: - -cat > /etc/sysconfig/console << "EOF" -# Begin /etc/sysconfig/console - -UNICODE="1" -KEYMAP="de-latin1" -KEYMAP_CORRECTIONS="euro2" -LEGACY_CHARSET="iso-8859-15" -FONT="LatArCyrHeb-16 -m 8859-15" - -# End /etc/sysconfig/console -EOF - - - - Some keymaps have dead keys (i.e., keys that don't produce a - character by themselves, but put an accent on the character produced - by the next key) or define composition rules (such as: press - Ctrl+. A E to get Æ in the default keymap). - Linux-&linux-version; interprets dead keys and composition rules in the - keymap correctly only when the source characters to be composed together - are not multibyte. This deficiency doesn't affect keymaps for European - languages, because there accents are added to unaccented ASCII - characters, or two ASCII characters are composed together. However, in - UTF-8 mode it is a problem, e.g., for the Greek language, where one - sometimes needs to put an accent on the letter alpha. - The solution is either to avoid the use of UTF-8, or to install the - X window system that doesn't have this limitation in its input - handling. - - - - For Chinese, Japanese, Korean and some other languages, the Linux - console cannot be configured to display the needed characters. Users - who need such languages should install the X Window System, fonts that - cover the necessary character ranges, and the proper input method (e.g., - SCIM, it supports a wide variety of languages). - - - - - - - The /etc/sysconfig/console file only controls - the Linux text console localization. It has nothing to do with setting - the proper keyboard layout and terminal fonts in the X Window System, with - ssh sessions or with a serial console. In such situations, limitations - mentioned in the last two list items above do not apply. - - - - - - Creating Files at Boot - - - File creation at boot - configuring - - - At times, it is desired to create files at boot time. For instance, - the /tmp/.ICE-unix directory - may be desired. This can be done by creating an entry in the - /etc/sysconfig/createfiles configuration script. - The format of this file is embedded in the comments of the default - configuration file. - - - - Configuring the sysklogd Script - - - sysklogd - configuring - - - The sysklogd script invokes the - syslogd program as a part of System V initialization. The - -m 0 option turns off the periodic timestamp mark that - syslogd writes to the log files every 20 minutes by - default. If you want to turn on this periodic timestamp mark, edit - /etc/sysconfig/rc.site and define the variable - SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters, - set the variable to a null value: - -SYSKLOGD_PARMS= - - See man syslogd for more options. - - - - - The rc.site File - - - rc.site - - - The optional /etc/sysconfig/rc.site file contains - settings that are automatically set for each SystemV boot script. It can - alternatively set the values specified in the hostname, - console, and clock files in the - /etc/sysconfig/ directory. If the - associated variables are present in both these separate files and - rc.site, the values in the script specific files have - precedence. - - rc.site also contains parameters that can - customize other aspects of the boot process. Setting the IPROMPT variable - will enable selective running of bootscripts. Other options are described - in the file comments. The default version of the file is as follows: - - - &site; - - - Customizing the Boot and Shutdown Scripts - - The LFS boot scripts boot and shut down a system in a fairly - efficient manner, but there are a few tweaks that you can make in the - rc.site file to improve speed even more and to adjust messages according - to your preferences. To do this, adjust the settings in - the /etc/sysconfig/rc.site file above. - - - - During the boot script udev, there is - a call to udev settle that requires some time to - complete. This time may or may not be required depending on devices present - in the system. If you only have simple partitions and a single ethernet - card, the boot process will probably not need to wait for this command. To - skip it, set the variable OMIT_UDEV_SETTLE=y. - - The boot script udev_retry also runs - udev settle by default. This command is only needed by - default if the /var directory is - separately mounted. This is because the clock needs the file - /var/lib/hwclock/adjtime. Other customizations may - also need to wait for udev to complete, but in many installations it is not - needed. Skip the command by setting the variable OMIT_UDEV_RETRY_SETTLE=y. - - - By default, the file system checks are silent. This can - appear to be a delay during the bootup process. To turn on the - fsck output, set the variable VERBOSE_FSCK=y. - - - When rebooting, you may want to skip the filesystem check, - fsck, completely. To do this, either create the file - /fastboot or reboot the system with the command - /sbin/shutdown -f -r now. On the other hand, you can - force all file systems to be checked by creating - /forcefsck or running shutdown with - the -F parameter instead of -f. - - - Setting the variable FASTBOOT=y will disable fsck - during the boot process until it is removed. This is not recommended - on a permanent basis. - - Normally, all files in the /tmp directory are deleted at boot time. - Depending on the number of files or directories present, this can cause a - noticeable delay in the boot process. To skip removing these files set the - variable SKIPTMPCLEAN=y. - - During shutdown, the init program sends - a TERM signal to each program it has started (e.g. agetty), waits for a set - time (default 3 seconds), and sends each process a KILL signal and waits - again. This process is repeated in the sendsignals - script for any processes that are not shut down by their own scripts. The - delay for init can be set by passing a parameter. For - example to remove the delay in init, pass the -t0 - parameter when shutting down or rebooting (e.g. /sbin/shutdown - -t0 -r now). The delay for the sendsignals - script can be skipped by setting the parameter - KILLDELAY=0. - - - - - - 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/chapter08/aboutdebug.xml b/chapter08/aboutdebug.xml new file mode 100644 index 000000000..f49618c83 --- /dev/null +++ b/chapter08/aboutdebug.xml @@ -0,0 +1,52 @@ +<?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-aboutdebug"> + <?dbhtml filename="aboutdebug.html"?> + + <title>About Debugging Symbols + + Most programs and libraries are, by default, compiled with + debugging symbols included (with gcc's + -g option). This means that when debugging a + program or library that was compiled with debugging information + included, the debugger can provide not only memory addresses, but also + the names of the routines and variables. + + However, the inclusion of these debugging symbols enlarges a + program or library significantly. The following is an example of the + amount of space these symbols occupy: + + + + A bash binary with debugging symbols: + 1200 KB + + + A bash binary without debugging symbols: + 480 KB + + + Glibc and GCC files (/lib + and /usr/lib) with debugging + symbols: 87 MB + + + Glibc and GCC files without debugging symbols: 16 MB + + + + Sizes may vary depending on which compiler and C library were used, + but when comparing programs with and without debugging symbols, the + difference will usually be a factor between two and five. + + Because most users will never use a debugger on their system software, + a lot of disk space can be regained by removing these symbols. The next + section shows how to strip all debugging symbols from the programs and + libraries. + +
diff --git a/chapter08/acl.xml b/chapter08/acl.xml new file mode 100644 index 000000000..f9f2eddbe --- /dev/null +++ b/chapter08/acl.xml @@ -0,0 +1,148 @@ + + + %general-entities; +]> + + + + + + acl + &acl-version; +
&acl-url;
+
+ + Acl-&acl-version; + + + Acl + + + + + + <para>The Acl package contains utilities to administer Access Control Lists, + which are used to define more fine-grained discretionary access rights for + files and directories.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&acl-ch6-sbu;</seg> + <seg>&acl-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Acl + + Prepare Acl for compilation: + +./configure --prefix=/usr \ + --bindir=/bin \ + --disable-static \ + --libexecdir=/usr/lib \ + --docdir=/usr/share/doc/acl-&acl-version; + + +./configure --prefix=/usr \ + --disable-static \ + --libexecdir=/usr/lib \ + --docdir=/usr/share/doc/acl-&acl-version; + + Compile the package: + +make + + The Acl tests need to be run on a filesystem that supports access + controls after Coreutils has been built with the + Acl libraries. If desired, return to this package and run make + check after Coreutils has been built + later in this chapter. + + Install the package: + +make install + + The shared library needs to be moved to + /lib, and as a result the + .so file in + /usr/lib will need to be recreated: + +mv -v /usr/lib/libacl.so.* /lib +ln -sfv ../../lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so + + + + + Contents of Acl + + + Installed programs + Installed library + Installed directories + + + chacl, getfacl, and setfacl + libacl.so + /usr/include/acl and /usr/share/doc/acl-&acl-version; + + + + + Short Descriptions + + + + + chacl + + Changes the access control list of a file + or directory + + chacl + + + + + + getfacl + + Gets file access control lists + + getfacl + + + + + + setfacl + + Sets file access control lists + + setfacl + + + + + + libacl + + Contains the library functions for manipulating Access Control Lists + + libacl + + + + + + + + +
diff --git a/chapter08/adjusting.xml b/chapter08/adjusting.xml new file mode 100644 index 000000000..3e6b49e19 --- /dev/null +++ b/chapter08/adjusting.xml @@ -0,0 +1,126 @@ + + + %general-entities; +]> + + + + + Adjusting the Toolchain + + Now that the final C libraries have been installed, it is time to adjust + the toolchain so that it will link any + newly compiled program against these new libraries. + + First, backup the /tools linker, + and replace it with the adjusted linker we made in chapter 5. We'll also create + a link to its counterpart in + /tools/$(uname -m)-pc-linux-gnu/bin: + +mv -v /tools/bin/{ld,ld-old} +mv -v /tools/$(uname -m)-pc-linux-gnu/bin/{ld,ld-old} +mv -v /tools/bin/{ld-new,ld} +ln -sv /tools/bin/ld /tools/$(uname -m)-pc-linux-gnu/bin/ld + + the next command amends the GCC specs file to achieve three goals: + first point GCC to the new dynamic linker. Simply deleting all instances of + /tools should leave us with the correct path to the dynamic + linker. Second, let GCC know where to find the Glibc start files. Third, + add the /usr/include directory at the end of the default search path, so + that header files added in chapter 6 are found. + A sed command accomplishes this: + +gcc -dumpspecs | sed -e 's@/tools@@g' \ + -e '/\*startfile_prefix_spec:/{n;s@.*@/usr/lib/ @}' \ + -e '/\*cpp:/{n;s@$@ -idirafter /usr/include@}' > \ + `dirname $(gcc --print-libgcc-file-name)`/specs + + It is a good idea to visually inspect the specs file to verify the + intended change was actually made. + + It is imperative at this point to ensure that the basic + functions (compiling and linking) of the adjusted toolchain are working + as expected. To do this, perform the following sanity checks: + +echo 'int main(){}' > dummy.c +cc dummy.c -v -Wl,--verbose &> dummy.log +readelf -l a.out | grep ': /lib' + + There should be no errors, + and the output of the last command will be (allowing for + platform-specific differences in dynamic linker name): + +[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2] + + Note that on 64-bit systems /lib is + the location of our dynamic linker, but is accessed via a symbolic link + in /lib64. + + On 32-bit systems the interpreter should be + /lib/ld-linux.so.2. + + Now make sure that we're setup to use the correct start files: + +grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log + + The output of the last command should be: + +/usr/lib/../lib/crt1.o succeeded +/usr/lib/../lib/crti.o succeeded +/usr/lib/../lib/crtn.o succeeded + + Verify that the compiler is searching for the correct header + files: + +grep -B4 '^ /usr/include' dummy.log + + This command should return the following output: + +#include <...> search starts here: + /tools/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include + /tools/include + /tools/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include-fixed + /usr/include + + On a 32 bit system, x86_64 is replaced with i686. + + Next, verify that the new linker is being used with the correct search paths: + +grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' + + References to paths that have components with '-linux-gnu' should + be ignored, but otherwise the output of the last command should be: + +SEARCH_DIR("/usr/lib") +SEARCH_DIR("/lib") + + Next make sure that we're using the correct libc: + +grep "/lib.*/libc.so.6 " dummy.log + + The output of the last command should be: + +attempt to open /lib/libc.so.6 succeeded + + Lastly, make sure GCC is using the correct dynamic linker: + +grep found dummy.log + + The output of the last command should be (allowing for + platform-specific differences in dynamic linker name): + +found ld-linux-x86-64.so.2 at /lib/ld-linux-x86-64.so.2 + + If the output does not appear as shown above or is not received + at all, then something is seriously wrong. Investigate and retrace the + steps to find out where the problem is and correct it. The most likely + reason is that something went wrong with the specs file adjustment. Any + issues will need to be resolved before continuing with the process. + + Once everything is working correctly, clean up the test files: + +rm -v dummy.c a.out dummy.log + + diff --git a/chapter08/attr.xml b/chapter08/attr.xml new file mode 100644 index 000000000..10c6eec53 --- /dev/null +++ b/chapter08/attr.xml @@ -0,0 +1,147 @@ + + + %general-entities; +]> + + + + + + attr + &attr-version; +
&attr-url;
+
+ + Attr-&attr-version; + + + Attr + + + + + + <para>The attr package contains utilities to administer the extended + attributes on filesystem objects.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&attr-ch6-sbu;</seg> + <seg>&attr-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Attr + + Prepare Attr for compilation: + + +./configure --prefix=/usr \ + --bindir=/bin \ + --disable-static \ + --sysconfdir=/etc \ + --docdir=/usr/share/doc/attr-&attr-version; + + +./configure --prefix=/usr \ + --disable-static \ + --sysconfdir=/etc \ + --docdir=/usr/share/doc/attr-&attr-version; + + Compile the package: + +make + + The tests need to be run on a filesystem that supports extended + attributes such as the ext2, ext3, or ext4 filesystems. + To test the results, issue: + +make check + + Install the package: + +make install + + The shared library needs to be moved to + /lib, and as a result the + .so file in + /usr/lib will need to be recreated: + +mv -v /usr/lib/libattr.so.* /lib +ln -sfv ../../lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.so + + + + + Contents of Attr + + + Installed programs + Installed library + Installed directories + + + attr, getfattr, and setfattr + libattr.so + /usr/include/attr and /usr/share/doc/attr-&attr-version; + + + + + Short Descriptions + + + + + attr + + Extends attributes on filesystem objects + + attr + + + + + + getfattr + + Gets the extended attributes of filesystem objects + + getfattr + + + + + + setfattr + + Sets the extended attributes of filesystem objects + + setfattr + + + + + + libattr + + Contains the library functions for manipulating extended attributes + + libattr + + + + + + + + +
diff --git a/chapter08/autoconf.xml b/chapter08/autoconf.xml new file mode 100644 index 000000000..6652747fd --- /dev/null +++ b/chapter08/autoconf.xml @@ -0,0 +1,194 @@ + + + %general-entities; +]> + + + + + + autoconf + &autoconf-version; +
&autoconf-url;
+
+ + Autoconf-&autoconf-version; + + + Autoconf + + + + + + <para>The Autoconf package contains programs for producing shell scripts that + can automatically configure source code.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&autoconf-ch6-sbu;</seg> + <seg>&autoconf-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Autoconf + + First, fix a bug generated by Perl 5.28. + +sed '361 s/{/\\{/' -i bin/autoscan.in + + Prepare Autoconf for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + The test suite is currently broken by bash-5 and libtool-2.4.3. + To run the tests anyway, issue: + +make check + + Install the package: + +make install + + + + + Contents of Autoconf + + + Installed programs + Installed directory + + + autoconf, autoheader, autom4te, autoreconf, autoscan, autoupdate, + and ifnames + /usr/share/autoconf + + + + + Short Descriptions + + + + + autoconf + + Produces shell scripts that automatically configure software + source code packages to adapt to many kinds of Unix-like systems; + the configuration scripts it produces are independent—running + them does not require the autoconf program + + autoconf + + + + + + autoheader + + A tool for creating template files of C + #define statements for configure to use + + autoheader + + + + + + autom4te + + A wrapper for the M4 macro processor + + autom4te + + + + + + autoreconf + + Automatically runs autoconf, + autoheader, aclocal, + automake, gettextize, and + libtoolize in the correct order to save time + when changes are made to autoconf and + automake template files + + autoreconf + + + + + + autoscan + + Helps to create a configure.in file for a + software package; it examines the source files in a directory tree, + searching them for common portability issues, and creates a + configure.scan file that serves as as a + preliminary configure.in file for the + package + + autoscan + + + + + + autoupdate + + Modifies a configure.in file that still + calls autoconf macros by their old names to use the + current macro names + + autoupdate + + + + + + ifnames + + Helps when writing configure.in files + for a software package; it prints the identifiers that the package + uses in C preprocessor conditionals [If a package has already been set + up to have some portability, this program can help determine what + configure needs to check for. It can also fill in + gaps in a configure.in file generated by + autoscan.] + + ifnames + + + + + + + + +
diff --git a/chapter08/automake.xml b/chapter08/automake.xml new file mode 100644 index 000000000..11dccfad3 --- /dev/null +++ b/chapter08/automake.xml @@ -0,0 +1,155 @@ + + + %general-entities; +]> + + + + + + automake + &automake-version; +
&automake-url;
+
+ + Automake-&automake-version; + + + Automake + + + + + + <para>The Automake package contains programs for generating Makefiles for use + with Autoconf.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&automake-ch6-sbu;</seg> + <seg>&automake-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Automake + + Fix a failing test: + +sed -i "s/''/etags/" t/tags-lisp-space.sh + + Prepare Automake for compilation: + +./configure --prefix=/usr --docdir=/usr/share/doc/automake-&automake-version; + + Compile the package: + +make + + + + Using the -j4 make option speeds up the tests, even on systems with + only one processor, due to internal delays in individual tests. To test + the results, issue: + + + +make -j4 check + + + One test is known to fail in the LFS environment: + tags-lisp-space.sh. + + Install the package: + +make install + + + + + + Contents of Automake + + + Installed programs + Installed directories + + + aclocal, aclocal-&am-minor-version; (hard linked with aclocal), automake, and + automake-&am-minor-version; (hard linked with automake) + /usr/share/aclocal-&am-minor-version;, /usr/share/automake-&am-minor-version;, and + /usr/share/doc/automake-&automake-version; + + + + + Short Descriptions + + + + + aclocal + + Generates aclocal.m4 files based on the + contents of configure.in files + + aclocal + + + + + + aclocal-&am-minor-version; + + A hard link to aclocal + + aclocal-&am-minor-version; + + + + + + automake + + A tool for automatically generating + Makefile.in files from + Makefile.am files [To create all the + Makefile.in files for a package, run this program + in the top-level directory. By scanning the + configure.in file, it automatically finds each + appropriate Makefile.am file and generates the + corresponding Makefile.in file.] + + automake + + + + + + automake-&am-minor-version; + + A hard link to automake + + automake-&am-minor-version; + + + + + + + + +
diff --git a/chapter08/bash.xml b/chapter08/bash.xml new file mode 100644 index 000000000..650c33ade --- /dev/null +++ b/chapter08/bash.xml @@ -0,0 +1,173 @@ + + + %general-entities; +]> + + + + + + bash + &bash-version; +
&bash-url;
+
+ + Bash-&bash-version; + + + Bash + + + + + + <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/chapter08/bc.xml b/chapter08/bc.xml new file mode 100644 index 000000000..d848ad365 --- /dev/null +++ b/chapter08/bc.xml @@ -0,0 +1,129 @@ + + + %general-entities; +]> + + + + + + bc + &bc-version; +
&bc-url;
+
+ + Bc-&bc-version; + + + Bc + + + + + + <para>The Bc package contains an arbitrary precision numeric processing + language.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&bc-ch6-sbu;</seg> + <seg>&bc-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Bc + + Prepare Bc for compilation: + +PREFIX=/usr CC=gcc CFLAGS="-std=c99" ./configure.sh -G -O3 + + + The meaning of the configure options: + + + CC=gcc CFLAGS="-std=c99" + + These parameters specify the compiler and the C standard to use. + + + + + -O3 + + Specify the optimization to use. + + + + + -G + + Omit parts of the test suite that won't work + without a GNU bc present. + + + + + Compile the package: + +make + + To test bc, run: + +make test + + + Install the package: + +make install + + + + + Contents of Bc + + + Installed programs + + + bc and dc + + + + + Short Descriptions + + + + + bc + + A command line calculator + + bc + + + + + + dc + + A reverse-polish command line calculator + + dc + + + + + + + + +
diff --git a/chapter08/binutils.xml b/chapter08/binutils.xml new file mode 100644 index 000000000..04dbd199c --- /dev/null +++ b/chapter08/binutils.xml @@ -0,0 +1,436 @@ + + + %general-entities; +]> + + + + + + binutils + &binutils-version; +
&binutils-url;
+
+ + Binutils-&binutils-version; + + + Binutils + + + + + + <para>The Binutils package contains a linker, an assembler, and other + tools for handling object files.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&binutils-ch6-sbu;</seg> + <seg>&binutils-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Binutils + + Verify that the PTYs are working properly inside the chroot + environment by performing a simple test: + +expect -c "spawn ls" + + This command should output the following: + +spawn ls + + If, instead, the output includes the message below, then the environment + is not set up for proper PTY operation. This issue needs to be resolved before + running the test suites for Binutils and GCC: + +The system has no more ptys. +Ask your system administrator to create more. + + Now remove one test that prevents the tests from running + to completion, and fix other tests in the gold test suite, which + need to be adjusted for GCC 10: + +sed -i '/@\tincremental_copy/d' gold/testsuite/Makefile.in +patch -Np1 -i ../binutils-&binutils-version;-gcc10_gold_test_fix-1.patch + + The Binutils documentation recommends building Binutils + in a dedicated build directory: + +mkdir -v build +cd build + + Prepare Binutils for compilation: + +../configure --prefix=/usr \ + --enable-gold \ + --enable-ld=default \ + --enable-plugins \ + --enable-shared \ + --disable-werror \ + --enable-64-bit-bfd \ + --with-system-zlib + + The meaning of the configure parameters: + + + --enable-gold + + Build the gold linker and install it as ld.gold (along side the + default linker). + + + + + --enable-ld=default + + Build the original bfd linker and install it as both ld (the + default linker) and ld.bfd. + + + + + --enable-plugins + + Enables plugin support for the linker. + + + + + --enable-64-bit-bfd + + Enables 64-bit support (on hosts with narrower word sizes). + May not be needed on 64-bit systems, but does no harm. + + + + + --with-system-zlib + + Use the installed zlib library rather than building the + included version. + + + + + + Compile the package: + +make tooldir=/usr + + + The meaning of the make parameter: + + + tooldir=/usr + + Normally, the tooldir (the directory where the executables will + ultimately be located) is set to $(exec_prefix)/$(target_alias). For + example, x86_64 machines would expand that to /usr/x86_64-unknown-linux-gnu. Because this is + a custom system, this target-specific directory in /usr is not required. $(exec_prefix)/$(target_alias) would be + used if the system was used to cross-compile (for example, compiling a + package on an Intel machine that generates code that can be executed + on PowerPC machines). + + + + + + + The test suite for Binutils in this section is considered critical. + Do not skip it under any circumstances. + + + Test the results: + +make -k check + + + + Install the package: + +make tooldir=/usr install + + + + + Contents of Binutils + + + Installed programs + Installed libraries + Installed directory + + + addr2line, ar, as, c++filt, dwp, elfedit, gprof, ld, ld.bfd, ld.gold, nm, + objcopy, objdump, ranlib, readelf, size, strings, and strip + libbfd.{a,so} and libopcodes.{a,so} + /usr/lib/ldscripts + + + + + Short Descriptions + + + + + addr2line + + Translates program addresses to file names and line numbers; + given an address and the name of an executable, it uses the debugging + information in the executable to determine which source file and line + number are associated with the address + + addr2line + + + + + + ar + + Creates, modifies, and extracts from archives + + ar + + + + + + as + + An assembler that assembles the output of gcc + into object files + + as + + + + + + c++filt + + Used by the linker to de-mangle C++ and Java symbols and to keep + overloaded functions from clashing + + c++filt + + + + + + dwp + + The DWARF packaging utility + + dwp + + + + + + elfedit + + Updates the ELF header of ELF files + + elfedit + + + + + + gprof + + Displays call graph profile data + + gprof + + + + + + ld + + A linker that combines a number of object and archive files + into a single file, relocating their data and tying up symbol + references + + ld + + + + + + ld.gold + + A cut down version of ld that only supports the + elf object file format + + ld.gold + + + + + + ld.bfd + + Hard link to ld + + ld.bfd + + + + + + nm + + Lists the symbols occurring in a given object file + + nm + + + + + + objcopy + + Translates one type of object file into another + + objcopy + + + + + + objdump + + Displays information about the given object file, with options + controlling the particular information to display; the information + shown is useful to programmers who are working on the compilation + tools + + objdump + + + + + + ranlib + + Generates an index of the contents of an archive and stores it + in the archive; the index lists all of the symbols defined by archive + members that are relocatable object files + + ranlib + + + + + + readelf + + Displays information about ELF type binaries + + readelf + + + + + + size + + Lists the section sizes and the total size for the given + object files + + size + + + + + + strings + + Outputs, for each given file, the sequences of printable + characters that are of at least the specified length (defaulting to + four); for object files, it prints, by default, only the strings from + the initializing and loading sections while for other types of files, it + scans the entire file + + strings + + + + + + strip + + Discards symbols from object files + + strip + + + + + + libbfd + + The Binary File Descriptor library + + libbfd + + + + + + libctf + + The Compat ANSI-C Type Format debugging support library + + libctf + + + + + + libctf-nobfd + + A libctf variant which does not use libbfd functionality + + libctf-nobfd + + + + + + libopcodes + + A library for dealing with opcodes—the readable + text versions of instructions for the processor; + it is used for building utilities like + objdump + + libopcodes + + + + + + + + +
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/chapter08/check.xml b/chapter08/check.xml new file mode 100644 index 000000000..bd4306b28 --- /dev/null +++ b/chapter08/check.xml @@ -0,0 +1,109 @@ + + + %general-entities; +]> + + + + + + check + &check-version; +
&check-url;
+
+ + Check-&check-version; + + + Check + + + + + + <para>Check is a unit testing framework for C.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&check-ch5-sbu;</seg> + <seg>&check-ch5-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Check + + Prepare Check for compilation: + +./configure --prefix=/usr + + Build the package: + +make + + Compilation is now complete. To run the Check test suite, issue the + following command: + +make check + + Note that the Check test suite may take a relatively long + (up to 4 SBU) time. + + Install the package: + + make docdir=/usr/share/doc/check-&check-version; install + + + + + Contents of Check + + + Installed program + Installed library + + + checkmk + libcheck.{a,so} + + + + + Short Descriptions + + + + + checkmk + + Awk script for generating C unit tests for use with the Check + unit testing framework + + checkmk + + + + + + libcheck.{a,so} + + Contains functions that allow Check to be called from a test + program + + libcheck + + + + + + + + +
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/chapter08/dbus.xml b/chapter08/dbus.xml new file mode 100644 index 000000000..bb4bffc76 --- /dev/null +++ b/chapter08/dbus.xml @@ -0,0 +1,241 @@ + + + %general-entities; +]> + + + + + + dbus + &dbus-version; +
&dbus-url;
+
+ + D-Bus-&dbus-version; + + + D-Bus + + + + + + <para>D-Bus is a message bus system, a simple way for applications to talk + to one another. D-Bus supplies both a system daemon (for events such as + "new hardware device added" or "printer queue changed") and a + per-user-login-session daemon (for general IPC needs among user + applications). Also, the message bus is built on top of a general one-to-one + message passing framework, which can be used by any two applications to + communicate directly (without going through the message bus daemon).</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&dbus-ch6-sbu;</seg> + <seg>&dbus-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of D-Bus + + Prepare D-Bus for compilation: + +./configure --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + --disable-static \ + --disable-doxygen-docs \ + --disable-xml-docs \ + --docdir=/usr/share/doc/dbus-&dbus-version; \ + --with-console-auth-dir=/run/console + + + The meaning of the configure options: + + + --with-console-auth-dir=/run/console + + This specifies the location of the ConsoleKit auth + directory. + + + + + + Compile the package: + +make + + This package does come with a test suite, but it requires several + packages that are not included in LFS. Instructions for running the + test suite can be found in the BLFS book at + . + + Install the package: + +make install + + The shared library needs to be moved to + /lib, and as a result the + .so file in + /usr/lib will need to be recreated: + +mv -v /usr/lib/libdbus-1.so.* /lib +ln -sfv ../../lib/$(readlink /usr/lib/libdbus-1.so) /usr/lib/libdbus-1.so + + Create a symlink, so that D-Bus and systemd can use the same + machine-id file: + +ln -sfv /etc/machine-id /var/lib/dbus + + Move the socket file to /run instead of the deprecated + /var/run: + + sed -i 's:/var/run:/run:' /lib/systemd/system/dbus.socket + + + + + Contents of D-Bus + + + Installed programs + Installed libraries + Installed directories + + + dbus-cleanup-sockets, dbus-daemon, dbus-launch, dbus-monitor, + dbus-run-session, dbus-send, dbus-test-tool, + dbus-update-activation-environment, and dbus-uuidgen + libdbus-1.{a,so} + /etc/dbus-1, /usr/include/dbus-1.0, /usr/lib/dbus-1.0, + /usr/share/dbus-1, /usr/share/doc/dbus-&dbus-version;, + and /var/lib/dbus + + + + + Short Descriptions + + + + + dbus-cleanup-sockets + + Used to clean up leftover sockets in a directory + + dbus-cleanup-sockets + + + + + + dbus-daemon + + The D-Bus message bus daemon + + dbus-daemon + + + + + + dbus-launch + + Starts dbus-daemon from a shell + script + + dbus-launch + + + + + + dbus-monitor + + Monitors messages passing through a D-Bus message bus + + dbus-monitor + + + + + + dbus-run-session + + Starts a session bus instance of dbus-daemon + from a shell script and starts a specified program in that + session + + dbus-run-session + + + + + + dbus-send + + Sends a message to a D-Bus message bus + + dbus-send + + + + + + dbus-test-tool + + A tool to help packages test + D-Bus + + dbus-test-tool + + + + + + + dbus-update-activation-environment + + Updates environment variables that will be set for + D-Bus session services + + dbus-update-activation-environment + + + + + + dbus-uuidgen + + Generates a universally unique ID + + dbus-uuidgen + + + + + + libdbus-1 + + Contains API functions used to communicate with the D-Bus + message bus + + libdbus-1 + + + + + + + + +
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/chapter08/e2fsprogs.xml b/chapter08/e2fsprogs.xml new file mode 100644 index 000000000..984ba6db9 --- /dev/null +++ b/chapter08/e2fsprogs.xml @@ -0,0 +1,541 @@ + + + %general-entities; +]> + + + + + + e2fsprogs + &e2fsprogs-version; +
&e2fsprogs-url;
+
+ + E2fsprogs-&e2fsprogs-version; + + + E2fsprogs + + + + + + <para>The E2fsprogs package contains the utilities for handling the + <systemitem class="filesystem">ext2</systemitem> file system. It also + supports the <systemitem class="filesystem">ext3</systemitem> and + <systemitem class="filesystem">ext4</systemitem> journaling + file systems.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&e2fsprogs-ch6-sbu;</seg> + <seg>&e2fsprogs-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of E2fsprogs + + The E2fsprogs documentation recommends that the package be built in + a subdirectory of the source tree: + +mkdir -v build +cd build + + Prepare E2fsprogs for compilation: + +../configure --prefix=/usr \ + --bindir=/bin \ + --with-root-prefix="" \ + --enable-elf-shlibs \ + --disable-libblkid \ + --disable-libuuid \ + --disable-uuidd \ + --disable-fsck + + + The meaning of the environment variable and configure options: + + + --with-root-prefix="" and + --bindir=/bin + + Certain programs (such as the e2fsck + program) are considered essential programs. When, for example, + /usr is not mounted, these + programs still need to be available. They belong in directories + like /lib and /sbin. If this option is not passed + to E2fsprogs' configure, the programs are installed into the + /usr directory. + + + + + --enable-elf-shlibs + + This creates the shared libraries which some programs + in this package use. + + + + + --disable-* + + This prevents E2fsprogs from building and installing the + libuuid and + libblkid libraries, the + uuidd daemon, and the + fsck wrapper, as Util-Linux installs more + recent versions. + + + + + + Compile the package: + +make + + To run the tests, issue: + +make check + + One of the E2fsprogs tests will attempt to allocate 256 MB of memory. + If you do not have significantly more RAM than this, be sure to enable + sufficient swap space for the test. See and + for details on creating and enabling swap space. + + Install the package: + +make install + + Make the installed static libraries writable so debugging symbols can + be removed later: + +chmod -v u+w /usr/lib/{libcom_err,libe2p,libext2fs,libss}.a + + This package installs a gzipped + .info file but doesn't update the + system-wide dir file. Unzip this file and then update + the system dir file using the following + commands: + +gunzip -v /usr/share/info/libext2fs.info.gz +install-info --dir-file=/usr/share/info/dir /usr/share/info/libext2fs.info + + If desired, create and install some additional documentation by + issuing the following commands: + +makeinfo -o doc/com_err.info ../lib/et/com_err.texinfo +install -v -m644 doc/com_err.info /usr/share/info +install-info --dir-file=/usr/share/info/dir /usr/share/info/com_err.info + + + + Contents of E2fsprogs + + + Installed programs + Installed libraries + Installed directories + + + badblocks, chattr, compile_et, debugfs, dumpe2fs, e2freefrag, + e2fsck, e2image, e2label, e2mmpstatus, e2scrub, e2scrub_all, e2undo, + e4crypt, e4defrag, filefrag, fsck.ext2, + fsck.ext3, fsck.ext4, logsave, lsattr, mk_cmds, mke2fs, + mkfs.ext2, mkfs.ext3, mkfs.ext4, mklost+found, + resize2fs, and tune2fs + libcom_err.so, libe2p.so, libext2fs.so, and libss.so + /usr/include/e2p, /usr/include/et, /usr/include/ext2fs, + /usr/include/ss, /usr/lib/e2fsprogs, /usr/share/et, and + /usr/share/ss + + + + + Short Descriptions + + + + + badblocks + + Searches a device (usually a disk partition) for bad + blocks + + badblocks + + + + + + chattr + + Changes the attributes of files on an ext2 file system; it also + changes ext3 + file systems, the journaling version of ext2 file systems + + chattr + + + + + + compile_et + + An error table compiler; it converts a table of error-code + names and messages into a C source file suitable for use with the + com_err library + + compile_et + + + + + + debugfs + + A file system debugger; it can be used to examine and change + the state of an ext2 + file system + + debugfs + + + + + + dumpe2fs + + Prints the super block and blocks group information for the + file system present on a given device + + dumpe2fs + + + + + + e2freefrag + + Reports free space fragmentation information + + e2freefrag + + + + + + e2fsck + + Is used to check, and optionally repair ext2 file systems and ext3 file systems + + e2fsck + + + + + + e2image + + Is used to save critical ext2 file system data to a file + + e2image + + + + + + e2label + + Displays or changes the file system label on the ext2 file system present on a given + device + + e2label + + + + + + e2mmpstatus + + Checks MMP status of an ext4 filesystem + + e2mmpstatus + + + + + + e2scrub + + Checks the contents of a mounted ext[234] filesystem + + e2scrub + + + + + + e2scrub_all + + Checks all mounted ext[234] filesystems for errors + + e2scrub_all + + + + + + e2undo + + Replays the undo log undo_log for an ext2/ext3/ext4 filesystem + found on a device [This can be used to undo a failed operation by an + e2fsprogs program.] + + e2undo + + + + + + e4crypt + + Ext4 filesystem encryption utility + + e4crypt + + + + + + e4defrag + + Online defragmenter for ext4 filesystems + + e4defrag + + + + + + filefrag + + Reports on how badly fragmented a particular file might be + + filefrag + + + + + + fsck.ext2 + + By default checks ext2 + file systems and is a hard link to e2fsck + + fsck.ext2 + + + + + + fsck.ext3 + + By default checks ext3 + file systems and is a hard link to e2fsck + + fsck.ext3 + + + + + + fsck.ext4 + + By default checks ext4 + file systems and is a hard link to e2fsck + + fsck.ext4 + + + + + + logsave + + Saves the output of a command in a log file + + logsave + + + + + + lsattr + + Lists the attributes of files on a second extended file + system + + lsattr + + + + + + mk_cmds + + Converts a table of command names and help messages into a C + source file suitable for use with the libss subsystem library + + mk_cmds + + + + + + mke2fs + + Creates an ext2 + or ext3 file system on + the given device + + mke2fs + + + + + + mkfs.ext2 + + By default creates ext2 + file systems and is a hard link to mke2fs + + mkfs.ext2 + + + + + + mkfs.ext3 + + By default creates ext3 + file systems and is a hard link to mke2fs + + mkfs.ext3 + + + + + + mkfs.ext4 + + By default creates ext4 + file systems and is a hard link to mke2fs + + mkfs.ext4 + + + + + + mklost+found + + Used to create a lost+found + directory on an ext2 file + system; it pre-allocates disk blocks to this directory to lighten the + task of e2fsck + + mklost+found + + + + + + resize2fs + + Can be used to enlarge or shrink an ext2 file system + + resize2fs + + + + + + tune2fs + + Adjusts tunable file system parameters on an ext2 file system + + tune2fs + + + + + + libcom_err + + The common error display routine + + libcom_err + + + + + + libe2p + + Used by dumpe2fs, chattr, + and lsattr + + libe2p + + + + + + libext2fs + + Contains routines to enable user-level programs to manipulate an + ext2 file system + + libext2fs + + + + + + libss + + Used by debugfs + + libss + + + + + + + + +
diff --git a/chapter08/eudev.xml b/chapter08/eudev.xml new file mode 100644 index 000000000..71511c3e7 --- /dev/null +++ b/chapter08/eudev.xml @@ -0,0 +1,191 @@ + + + %general-entities; +]> + + + + + + eudev + &eudev-version; +
&eudev-url;
+
+ + Eudev-&eudev-version; + + + Eudev + + + + + + <para>The Eudev package contains programs for dynamic creation of device + nodes.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&eudev-ch6-sbu;</seg> + <seg>&eudev-ch6-du;</seg> + </seglistitem> + </segmentedlist> + </sect2> + + <sect2 role="installation"> + <title>Installation of Eudev + + + + Prepare Eudev for compilation: + +./configure --prefix=/usr \ + --bindir=/sbin \ + --sbindir=/sbin \ + --libdir=/usr/lib \ + --sysconfdir=/etc \ + --libexecdir=/lib \ + --with-rootprefix= \ + --with-rootlibdir=/lib \ + --enable-manpages \ + --disable-static + + Compile the package: + +make + + Create some directories now that are needed for tests, but + will also be used as a part of installation: + +mkdir -pv /lib/udev/rules.d +mkdir -pv /etc/udev/rules.d + + To test the results, issue: + +make check + + Install the package: + +make install + + Install some custom rules and support files useful in an LFS + environment: + +tar -xvf ../&udev-lfs-version;.tar.xz +make -f &udev-lfs-version;/Makefile.lfs install + + + + + Configuring Eudev + + + Eudev + configuring + + + + /etc/udev/hwdb.bin + + + Information about hardware devices is maintained in the + /etc/udev/hwdb.d and + /lib/udev/hwdb.d directories. + Eudev needs that information to be compiled + into a binary database /etc/udev/hwdb.bin. Create the + initial database: + +udevadm hwdb --update + + This command needs to be run each time the hardware information is + updated. + + + + + Contents of Eudev + + + Installed programs + Installed libraries + Installed directories + + + udevadm and udevd + + libudev.so + + /etc/udev, /lib/udev, and /usr/share/doc/udev-&udev-lfs-version; + + + + + Short Descriptions + + + + udevadm + + Generic udev administration tool: controls the udevd daemon, + provides info from the Udev database, monitors uevents, waits for + uevents to finish, tests Udev configuration, and triggers uevents + for a given device + + udevadm + + + + + + udevd + + A daemon that listens for uevents on the netlink socket, + creates devices and runs the configured external programs in + response to these uevents + + udevd + + + + + + libudev + + A library interface to udev device information + + libudev + + + + + + /etc/udev + + Contains Udev configuration files, + device permissions, and rules for device naming + + /etc/udev + + + + + + + + +
diff --git a/chapter08/expat.xml b/chapter08/expat.xml new file mode 100644 index 000000000..df9f709c9 --- /dev/null +++ b/chapter08/expat.xml @@ -0,0 +1,117 @@ + + + %general-entities; +]> + + + + + + expat + &expat-version; +
&expat-url;
+
+ + Expat-&expat-version; + + + Expat + + + + + + <para>The Expat package contains a stream oriented C library for + parsing XML.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&expat-ch6-sbu;</seg> + <seg>&expat-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Expat + + First fix a problem with the regression tests in the LFS environment: + +sed -i 's|usr/bin/env |bin/|' run.sh.in + + Prepare Expat for compilation: + +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/expat-&expat-version; + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + If desired, install the documentation: + +install -v -m644 doc/*.{html,png,css} /usr/share/doc/expat-&expat-version; + + + + + Contents of Expat + + + Installed program + Installed libraries + Installed directory + + + xmlwf + libexpat.so + /usr/share/doc/expat-&expat-version; + + + + + Short Descriptions + + + + + xmlwf + + Is a non-validating utility to check whether or not + XML documents are well formed + + xmlwf + + + + + + libexpat + + Contains API functions for parsing XML + + libexpat + + + + + + + + +
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/fstab.xml b/chapter08/fstab.xml deleted file mode 100644 index ebfae3aaf..000000000 --- a/chapter08/fstab.xml +++ /dev/null @@ -1,125 +0,0 @@ - - - %general-entities; -]> - - - - - Creating the /etc/fstab File - - - /etc/fstab - - - The /etc/fstab file is used by some programs to - determine where file systems are to be mounted by default, in which order, and - which must be checked (for integrity errors) prior to mounting. Create a new - file systems table like this: - -cat > /etc/fstab << "EOF" -# Begin /etc/fstab - -# file system mount-point type options dump fsck -# order - -/dev/<xxx> / <fff> defaults 1 1 -/dev/<yyy> swap swap pri=1 0 0 -proc /proc proc nosuid,noexec,nodev 0 0 -sysfs /sys sysfs nosuid,noexec,nodev 0 0 -devpts /dev/pts devpts gid=5,mode=620 0 0 -tmpfs /run tmpfs defaults 0 0 -devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 - -# End /etc/fstab -EOF - -cat > /etc/fstab << "EOF" -# Begin /etc/fstab - -# file system mount-point type options dump fsck -# order - -/dev/<xxx> / <fff> defaults 1 1 -/dev/<yyy> swap swap pri=1 0 0 - -# End /etc/fstab -EOF - - Replace <xxx>, - <yyy>, and <fff> - with the values appropriate for the system, for example, sda2, sda5, and ext4. For details on the six - fields in this file, see man 5 fstab. - - Filesystems with MS-DOS or Windows origin (i.e. vfat, ntfs, smbfs, - cifs, iso9660, udf) need a special option, utf8, in order for non-ASCII - characters in file names to be interpreted properly. For non-UTF-8 locales, - the value of should be set to be the same as the - character set of the locale, adjusted in such a way that the kernel - understands it. This works if the relevant character set definition (found - under File systems -> Native Language Support when configuring the kernel) - has been compiled into the kernel or built as a module. However, if the - character set of the locale is UTF-8, the corresponding option - would make the file system case sensitive. To - fix this, use the special option instead of - , for UTF-8 locales. The - codepage option is also needed for vfat and smbfs filesystems. - It should be set to the codepage number used under MS-DOS in your country. - For example, in order to mount USB flash drives, a ru_RU.KOI8-R user would - need the following in the options portion of its mount line in - /etc/fstab: - -noauto,user,quiet,showexec,codepage=866,iocharset=koi8r - - The corresponding options fragment for ru_RU.UTF-8 users is: - -noauto,user,quiet,showexec,codepage=866,utf8 - - Note that using is the default for - iso8859-1 (which keeps the file system case - insensitive), and the option tells - the kernel to convert the file names using UTF-8 so they can be - interpreted in the UTF-8 locale. - - - - It is also possible to specify default codepage and iocharset values for - some filesystems during kernel configuration. The relevant parameters - are named - Default NLS Option (, - Default Remote NLS Option (), - Default codepage for FAT (), and - Default iocharset for FAT (). - There is no way to specify these settings for the - ntfs filesystem at kernel compilation time. - - It is possible to make the ext3 filesystem reliable across power - failures for some hard disk types. To do this, add the - mount option to the appropriate entry in - /etc/fstab. To check if the disk drive supports - this option, run - hdparm - on the applicable disk drive. For example, if: - -hdparm -I /dev/sda | grep NCQ - - returns non-empty output, the option is supported. - - Note: Logical Volume Management (LVM) based partitions cannot use the - option. - - 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/chapter08/gcc.xml b/chapter08/gcc.xml new file mode 100644 index 000000000..9e4c53ec5 --- /dev/null +++ b/chapter08/gcc.xml @@ -0,0 +1,626 @@ + + + %general-entities; +]> + + + + + + gcc + &gcc-version; +
&gcc-url;
+
+ + GCC-&gcc-version; + + + GCC + + + + + + <para>The GCC package contains the GNU compiler collection, which includes + the C and C++ compilers.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gcc-ch6-sbu;</seg> + <seg>&gcc-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of GCC + + 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 + + The GCC documentation recommends building GCC in a dedicated build directory: + +mkdir -v build +cd build + + Prepare GCC for compilation: + +../configure --prefix=/usr \ + LD=ld \ + --enable-languages=c,c++ \ + --disable-multilib \ + --disable-bootstrap \ + --with-system-zlib + + Note that for other languages, there are some prerequisites that + are not yet available. See the + BLFS Book + for instructions on how to build all of GCC's supported languages. + + + The meaning of the new configure parameter: + + + --with-system-zlib + + This switch tells GCC to link to the system installed copy of + the Zlib library, rather than its own internal copy. + + + + + Compile the package: + +make + + + In this section, the test suite for GCC is considered + critical. Do not skip it under any circumstance. + + + One set of tests in the GCC test suite is known to exhaust the stack, + so increase the stack size prior to running the tests: + +ulimit -s 32768 + + Test the results as a non-privileged user, but do not stop at errors: + +chown -Rv tester . +su tester -c "PATH=$PATH make -k check" + + To receive a summary of the test suite results, run: + +../contrib/test_summary + + For only the summaries, pipe the output through + grep -A7 Summ. + + Results can be compared with those located at and + . + + Six tests related to get_time are known to fail. These are + apparently related to the en_HK locale. + + Two tests named lookup.cc and reverse.cc in experimental/net + are known to fail in LFS chroot environment because they require + /etc/hosts and iana-etc. + + A few unexpected failures cannot always be avoided. The GCC developers + are usually aware of these issues, but have not resolved them yet. + Unless the test results are vastly different from those at the above URL, + it is safe to continue. + + + + Install the package and remove an unneeded directory: + +make install +rm -rf /usr/lib/gcc/$(gcc -dumpmachine)/&gcc-version;/include-fixed/bits/ + + The GCC build directory is owned by + tester now and the ownership of the installed header + directory (and its content) will be incorrect. Change the ownership to + root user and group: + +chown -v -R root:root \ + /usr/lib/gcc/*linux-gnu/&gcc-version;/include{,-fixed} + + Create a symlink required by the FHS + for "historical" reasons. + +ln -sv ../usr/bin/cpp /lib + + Add a compatibility symlink to enable building programs with + Link Time Optimization (LTO): + +install -v -dm755 /usr/lib/bfd-plugins +ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/&gcc-version;/liblto_plugin.so \ + /usr/lib/bfd-plugins/ + + Now that our final toolchain is in place, it is important to again ensure + that compiling and linking will work as expected. We do this by performing + the same sanity checks as we did earlier in the chapter: + + + + + + + + + + + + + +/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crt1.o succeeded +/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crti.o succeeded +/usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/../../../../lib/crtn.o succeeded + + Depending on your machine architecture, the above may differ slightly, + the difference usually being the name of the directory + after /usr/lib/gcc. The important + thing to look for here is that gcc has found all three + crt*.o files under the + /usr/lib directory. + + + +grep -B4 '^ /usr/include' dummy.log + + + +#include <...> search starts here: + /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include + /usr/local/include + /usr/lib/gcc/x86_64-pc-linux-gnu/&gcc-version;/include-fixed + /usr/include + + Again, note that the directory named after your target triplet may be + different than the above, depending on your architecture. + + + + + + + + + +SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib64") +SEARCH_DIR("/usr/local/lib64") +SEARCH_DIR("/lib64") +SEARCH_DIR("/usr/lib64") +SEARCH_DIR("/usr/x86_64-pc-linux-gnu/lib") +SEARCH_DIR("/usr/local/lib") +SEARCH_DIR("/lib") +SEARCH_DIR("/usr/lib"); + + A 32-bit system may see a few different directories. For example, here + is the output from an i686 machine: + +SEARCH_DIR("/usr/i686-pc-linux-gnu/lib32") +SEARCH_DIR("/usr/local/lib32") +SEARCH_DIR("/lib32") +SEARCH_DIR("/usr/lib32") +SEARCH_DIR("/usr/i686-pc-linux-gnu/lib") +SEARCH_DIR("/usr/local/lib") +SEARCH_DIR("/lib") +SEARCH_DIR("/usr/lib"); + + + + + + + + + + + + + + + + + + + + + + + + Finally, move a misplaced file: + +mkdir -pv /usr/share/gdb/auto-load/usr/lib +mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib + + + + + Contents of GCC + + + Installed programs + Installed libraries + Installed directories + + + c++, cc (link to gcc), cpp, g++, gcc, + gcc-ar, gcc-nm, gcc-ranlib, gcov, gcov-dump, and gcov-tool + + libasan.{a,so}, libatomic.{a,so}, libcc1.so, libgcc.a, libgcc_eh.a, + libgcc_s.so, libgcov.a, libgomp.{a,so}, libitm.{a,so}, + liblsan.{a,so}, liblto_plugin.so, + libquadmath.{a,so}, libssp.{a,so}, libssp_nonshared.a, + libstdc++.{a,so}, libstdc++fs.a, libsupc++.a, libtsan.{a,so}, + and libubsan.{a,so} + + /usr/include/c++, /usr/lib/gcc, /usr/libexec/gcc, and + /usr/share/gcc-&gcc-version; + + + + + Short Descriptions + + + + + c++ + + The C++ compiler + + c++ + + + + + + cc + + The C compiler + + cc + + + + + + cpp + + The C preprocessor; it is used by the compiler to expand the + #include, #define, and similar statements in the source files + + cpp + + + + + + g++ + + The C++ compiler + + g++ + + + + + + gcc + + The C compiler + + gcc + + + + + + gcc-ar + + A wrapper around ar that adds a + plugin to the command line. This program is only used + to add "link time optimization" and is not useful with the + default build options + + gc-ar + + + + + + gcc-nm + + A wrapper around nm that adds a + plugin to the command line. This program is only used + to add "link time optimization" and is not useful with the + default build options + + gc-nm + + + + + + gcc-ranlib + + A wrapper around ranlib that adds a + plugin to the command line. This program is only used + to add "link time optimization" and is not useful with the + default build options + + gc-ranlib + + + + + + gcov + + A coverage testing tool; it is used to analyze programs to + determine where optimizations will have the most effect + + gcov + + + + + + gcov-dump + + Offline gcda and gcno profile dump tool + + gcov-dump + + + + + + gcov-tool + + Offline gcda profile processing tool + + gcov-tool + + + + + + libasan + + The Address Sanitizer runtime library + + libasan + + + + + + libatomic + + GCC atomic built-in runtime library + + libatomic + + + + + + libcc1 + + The C preprocessing library + + libcc1 + + + + + + libgcc + + Contains run-time support for gcc + + libgcc + + + + + + libgcov + + This library is linked in to a program when GCC is instructed + to enable profiling + + libgcov + + + + + + libgomp + + GNU implementation of the OpenMP API for multi-platform + shared-memory parallel programming in C/C++ and Fortran + + libgomp + + + + + + liblsan + + The Leak Sanitizer runtime library + + liblsan + + + + + + liblto_plugin + + GCC's Link Time Optimization (LTO) plugin allows GCC to perform + optimizations across compilation units + + liblto_plugin + + + + + + libquadmath + + GCC Quad Precision Math Library API + + libquadmath + + + + + + libssp + + Contains routines supporting GCC's stack-smashing protection + functionality + + libssp + + + + + + libstdc++ + + The standard C++ library + + libstdc++ + + + + + + libstdc++fs + + ISO/IEC TS 18822:2015 Filesystem library + + libstdc++fs + + + + + + libsupc++ + + Provides supporting routines for the C++ programming + language + + libsupc++ + + + + + + libtsan + + The Thread Sanitizer runtime library + + libtsan + + + + + + libubsan + + The Undefined Behavior Sanitizer runtime library + + libubsan + + + + + + + + +
diff --git a/chapter08/gdbm.xml b/chapter08/gdbm.xml new file mode 100644 index 000000000..f953b63f9 --- /dev/null +++ b/chapter08/gdbm.xml @@ -0,0 +1,156 @@ + + + %general-entities; +]> + + + + + + gdbm + &gdbm-version; +
&gdbm-url;
+
+ + GDBM-&gdbm-version; + + + GDBM + + + + + + <para>The GDBM package contains the GNU Database Manager. It is a library + of database functions that use extensible hashing and work similar to the + standard UNIX dbm. The library provides primitives for storing key/data + pairs, searching and retrieving the data by its key and deleting a key + along with its data. </para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gdbm-ch6-sbu;</seg> + <seg>&gdbm-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of GDBM + + First, fix an issue first identified by gcc-10: + +sed -r -i '/^char.*parseopt_program_(doc|args)/d' src/parseopt.c + + Prepare GDBM for compilation: + +./configure --prefix=/usr \ + --disable-static \ + --enable-libgdbm-compat + + + The meaning of the configure option: + + + --enable-libgdbm-compat + + This switch enables the libgdbm compatibility library to be + built, as some packages outside of LFS may require the older DBM + routines it provides. + + + + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + Contents of GDBM + + + Installed programs + Installed libraries + + + gdbm_dump, gdbm_load, and gdbmtool + libgdbm.so and libgdbm_compat.so + + + + + Short Descriptions + + + + + gdbm_dump + + Dumps a GDBM database to a file + + gdbm_dump + + + + + + gdbm_load + + Recreates a GDBM database from a dump file + + gdbm_load + + + + + + gdbmtool + + Tests and modifies a GDBM database + + gdbmtool + + + + + + libgdbm + + Contains functions to manipulate a hashed database + + libgdbm + + + + + + libgdbm_compat + + Compatibility library containing older DBM functions + + libgdbm_compat + + + + + + + + +
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/chapter08/gmp.xml b/chapter08/gmp.xml new file mode 100644 index 000000000..4bc361a56 --- /dev/null +++ b/chapter08/gmp.xml @@ -0,0 +1,164 @@ + + + %general-entities; +]> + + + + + + gmp + &gmp-version; +
&gmp-url;
+
+ + GMP-&gmp-version; + + + GMP + + + + + + <para>The GMP package contains math libraries. These have useful functions + for arbitrary precision arithmetic.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gmp-ch6-sbu;</seg> + <seg>&gmp-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of GMP + + + If you are building for 32-bit x86, but you have a CPU which is + capable of running 64-bit code and you have specified + CFLAGS in the environment, the configure script will + attempt to configure for 64-bits and fail. + Avoid this by invoking the configure command below with +ABI=32 ./configure ... + + + + The default settings of GMP produce libraries optimized for + the host processor. If libraries suitable for processors less + capable than the host's CPU are desired, generic libraries can be + created by running the following: + +cp -v configfsf.guess config.guess +cp -v configfsf.sub config.sub + + + Prepare GMP for compilation: + +./configure --prefix=/usr \ + --enable-cxx \ + --disable-static \ + --docdir=/usr/share/doc/gmp-&gmp-version; + + + The meaning of the new configure options: + + + --enable-cxx + + This parameter enables C++ support + + + + + --docdir=/usr/share/doc/gmp-&gmp-version; + + This variable specifies the correct place for the + documentation. + + + + + + Compile the package and generate the HTML documentation: + +make +make html + + + The test suite for GMP in this section is considered critical. + Do not skip it under any circumstances. + + + Test the results: + +make check 2>&1 | tee gmp-check-log + + The code in gmp is highly optimized for the processor where + it is built. Occasionally, the code that detects the processor misidentifies + the system capabilities and there will be errors in the tests or other + applications using the gmp libraries with the message "Illegal + instruction". In this case, gmp should be reconfigured with the option + --build=x86_64-unknown-linux-gnu and rebuilt. + + Ensure that all 197 tests in the test suite passed. + Check the results by issuing the following command: + +awk '/# PASS:/{total+=$3} ; END{print total}' gmp-check-log + + Install the package and its documentation: + +make install +make install-html + + + + + Contents of GMP + + + Installed Libraries + Installed directory + + + libgmp.so and libgmpxx.so + /usr/share/doc/gmp-&gmp-version; + + + + + Short Descriptions + + + + + libgmp + + Contains precision math functions + + libgmp + + + + + + libgmpxx + + Contains C++ precision math functions + + libgmpxx + + + + + + + +
diff --git a/chapter08/gperf.xml b/chapter08/gperf.xml new file mode 100644 index 000000000..d8c5b6594 --- /dev/null +++ b/chapter08/gperf.xml @@ -0,0 +1,95 @@ + + + %general-entities; +]> + + + + + + gperf + &gperf-version; +
&gperf-url;
+
+ + Gperf-&gperf-version; + + + Gperf + + + + + + <para>Gperf generates a perfect hash function from a key set.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&gperf-ch6-sbu;</seg> + <seg>&gperf-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Gperf + + Prepare Gperf for compilation: + +./configure --prefix=/usr --docdir=/usr/share/doc/gperf-&gperf-version; + + Compile the package: + +make + + The tests are known to fail if running multiple + simultaneous tests (-j option greater than 1). To test + the results, issue: + +make -j1 check + + Install the package: + +make install + + + + + Contents of Gperf + + + Installed program + Installed directory + + + gperf + /usr/share/doc/gperf-&gperf-version; + + + + + Short Descriptions + + + + + gperf + + Generates a perfect hash from a key set + + gperf + + + + + + + + +
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/chapter08/groff.xml b/chapter08/groff.xml new file mode 100644 index 000000000..aad0cbf85 --- /dev/null +++ b/chapter08/groff.xml @@ -0,0 +1,607 @@ + + + %general-entities; +]> + + + + + + groff + &groff-version; +
&groff-url;
+
+ + Groff-&groff-version; + + + Groff + + + + + + <para>The Groff package contains programs for processing and formatting + text.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&groff-ch6-sbu;</seg> + <seg>&groff-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Groff + + Groff expects the environment variable PAGE to + contain the default paper size. For users in the United States, + PAGE=letter is appropriate. Elsewhere, + PAGE=A4 may be more suitable. While the default + paper size is configured during compilation, it can be overridden later + by echoing either A4 or letter to the + /etc/papersize file. + + Prepare Groff for compilation: + +PAGE=<paper_size> ./configure --prefix=/usr + + This package does not support parallel build. Compile the package: + +make -j1 + + This package does not come with a test suite. + + Install the package: + +make install + + + + + Contents of Groff + + + Installed programs + Installed directories + + + addftinfo, afmtodit, chem, eqn, eqn2graph, gdiffmk, glilypond, + gperl, gpinyin, grap2graph, grn, grodvi, groff, groffer, grog, grolbp, + grolj4, gropdf, grops, grotty, hpftodit, indxbib, lkbib, lookbib, + mmroff, neqn, nroff, pdfmom, pdfroff, pfbtops, pic, pic2graph, + post-grohtml, preconv, pre-grohtml, refer, roff2dvi, roff2html, + roff2pdf, roff2ps, roff2text, roff2x, soelim, tbl, tfmtodit, and + troff + /usr/lib/groff and /usr/share/doc/groff-&groff-version;, + /usr/share/groff + + + + + Short Descriptions + + + + + addftinfo + + Reads a troff font file and adds some additional font-metric + information that is used by the groff system + + addftinfo + + + + + + afmtodit + + Creates a font file for use with groff and + grops + + afmtodit + + + + + + chem + + Groff preprocessor for producing chemical structure diagrams + + chem + + + + + + eqn + + Compiles descriptions of equations embedded within troff + input files into commands that are understood by + troff + + eqn + + + + + + eqn2graph + + Converts a troff EQN (equation) into a cropped image + + eqn2graph + + + + + + gdiffmk + + Marks differences between groff/nroff/troff files + + gdiffmk + + + + + + glilypond + + Transforms sheet music written in the lilypond language into + the groff language + + glilypond + + + + + + gperl + + Preprocesor for groff, allowing addition of perl code + into groff files + + gperl + + + + + + gpinyin + + Preprocesor for groff, allowing addition of Chinese + European-like language Pinyin into groff files. + + gpinyin + + + + + + grap2graph + + Converts a grap diagram into a cropped bitmap image + + grap2graph + + + + + + grn + + A groff preprocessor for gremlin files + + grn + + + + + + grodvi + + A driver for groff that produces TeX dvi + format + + grodvi + + + + + + groff + + A front-end to the groff document formatting system; normally, it + runs the troff program and a post-processor + appropriate for the selected device + + groff + + + + + + groffer + + Displays groff files and man pages on X and tty terminals + + groffer + + + + + + grog + + Reads files and guesses which of the groff + options , , , + , , , + , and are required for printing + files, and reports the groff command including those + options + + grog + + + + + + grolbp + + Is a groff driver for Canon CAPSL printers + (LBP-4 and LBP-8 series laser printers) + + grolbp + + + + + + grolj4 + + Is a driver for groff that produces output + in PCL5 format suitable for an HP LaserJet 4 printer + + grolj4 + + + + + + gropdf + + Translates the output of GNU troff to + PDF + + gropdf + + + + + + grops + + Translates the output of GNU troff to + PostScript + + grops + + + + + + grotty + + Translates the output of GNU troff into + a form suitable for typewriter-like devices + + grotty + + + + + + hpftodit + + Creates a font file for use with groff -Tlj4 + from an HP-tagged font metric file + + hpftodit + + + + + + indxbib + + Creates an inverted index for the bibliographic databases with a + specified file for use with refer, + lookbib, and lkbib + + indxbib + + + + + + lkbib + + Searches bibliographic databases for references that contain + specified keys and reports any references found + + lkbib + + + + + + lookbib + + Prints a prompt on the standard error (unless the standard input + is not a terminal), reads a line containing a set of keywords from the + standard input, searches the bibliographic databases in a specified file + for references containing those keywords, prints any references found + on the standard output, and repeats this process until the end of + input + + lookbib + + + + + + mmroff + + A simple preprocessor for groff + + mmroff + + + + + + neqn + + Formats equations for American Standard Code for Information + Interchange (ASCII) output + + neqn + + + + + + nroff + + A script that emulates the nroff command + using groff + + nroff + + + + + + pdfmom + + Is a wrapper around groff that facilitates the production of PDF + documents from files formatted with the mom macros. + + pdfmom + + + + + + pdfroff + + Creates pdf documents using groff + + pdfroff + + + + + + pfbtops + + Translates a PostScript font in .pfb format to ASCII + + pfbtops + + + + + + pic + + Compiles descriptions of pictures embedded within troff or + TeX input files into commands understood by TeX or + troff + + pic + + + + + + pic2graph + + Converts a PIC diagram into a cropped image + + pic2graph + + + + + + post-grohtml + + Translates the output of GNU troff to + HTML + + post-grohtml + + + + + + preconv + + Converts encoding of input files to something GNU + troff understands + + preconv + + + + + + pre-grohtml + + Translates the output of GNU troff to + HTML + + pre-grohtml + + + + + + refer + + Copies the contents of a file to the standard output, except + that lines between .[ and .] + are interpreted as citations, and lines between .R1 + and .R2 are interpreted as commands for how + citations are to be processed + + refer + + + + + + roff2dvi + + Transforms roff files into DVI format + + roff2dvi + + + + + + roff2html + + Transforms roff files into HTML format + + roff2html + + + + + + roff2pdf + + Transforms roff files into PDFs + + roff2pdf + + + + + + roff2ps + + Transforms roff files into ps files + + roff2ps + + + + + + roff2text + + Transforms roff files into text files + + roff2text + + + + + + roff2x + + Transforms roff files into other formats + + roff2x + + + + + + soelim + + Reads files and replaces lines of the form .so + file by the contents of the mentioned + file + + soelim + + + + + + tbl + + Compiles descriptions of tables embedded within troff input + files into commands that are understood by + troff + + tbl + + + + + + tfmtodit + + Creates a font file for use with groff + -Tdvi + + tfmtodit + + + + + + troff + + Is highly compatible with Unix troff; it + should usually be invoked using the groff command, + which will also run preprocessors and post-processors in the + appropriate order and with the appropriate options + + troff + + + + + + + + +
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 - - - 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-&grub-version; - + + GRUB + - - 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). + + - </sect2> + <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> - <title>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 + + Installation of GRUB + + Prepare GRUB for compilation: - Generate /boot/grub/grub.cfg: +./configure --prefix=/usr \ + --sbindir=/sbin \ + --sysconfdir=/etc \ + --disable-efiemu \ + --disable-werror - cat > /boot/grub/grub.cfg << "EOF" -# Begin /boot/grub/grub.cfg -set default=0 -set timeout=5 + + The meaning of the new configure options: -insmod ext2 -set root=(hd0,2) + + --disable-werror + + This allows the build to complete with warnings introduced + by more recent Flex versions. + + -menuentry "GNU/Linux, Linux &linux-version;-lfs-&version;" { - linux /boot/vmlinuz-&linux-version;-lfs-&version; root=/dev/sda2 ro -} -EOF + + --disable-efiemu + + This option minimizes what is built by disabling a feature and + testing programs not needed for LFS. + + - cat > /boot/grub/grub.cfg << "EOF" -# Begin /boot/grub/grub.cfg -set default=0 -set timeout=5 + -insmod ext2 -set root=(hd0,2) + Compile the package: -menuentry "GNU/Linux, Linux &linux-version;-lfs-&versiond;" { - linux /boot/vmlinuz-&linux-version;-lfs-&versiond; root=/dev/sda2 ro -} -EOF +make + This package does not come with a test suite. - 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. - + Install the package: - 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. +make install +mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions - 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. + 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/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/chapter08/iana-etc.xml b/chapter08/iana-etc.xml new file mode 100644 index 000000000..42ab25c34 --- /dev/null +++ b/chapter08/iana-etc.xml @@ -0,0 +1,93 @@ + + + %general-entities; +]> + + + + + + iana-etc + &iana-etc-version; +
&iana-etc-url;
+
+ + Iana-Etc-&iana-etc-version; + + + Iana-Etc + + + + + + <para>The Iana-Etc package provides data for network services and + protocols.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&iana-etc-ch6-sbu;</seg> + <seg>&iana-etc-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Iana-Etc + + For this package, we only need to copy the files into place: + +cp services protocols /etc + + + + + Contents of Iana-Etc + + + Installed files + + + /etc/protocols and /etc/services + + + + + Short Descriptions + + + + + /etc/protocols + + Describes the various DARPA Internet protocols that are + available from the TCP/IP subsystem + + /etc/protocols + + + + + + /etc/services + + Provides a mapping between friendly textual names for internet + services, and their underlying assigned port numbers and protocol + types + + /etc/services + + + + + + + + +
diff --git a/chapter08/inetutils.xml b/chapter08/inetutils.xml new file mode 100644 index 000000000..c8fdd456f --- /dev/null +++ b/chapter08/inetutils.xml @@ -0,0 +1,249 @@ + + + %general-entities; +]> + + + + + + inetutils + &inetutils-version; +
&inetutils-url;
+
+ + Inetutils-&inetutils-version; + + + Inetutils + + + + + + <para>The Inetutils package contains programs for basic networking.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&inetutils-ch6-sbu;</seg> + <seg>&inetutils-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Inetutils + + Prepare Inetutils for compilation: + +./configure --prefix=/usr \ + --localstatedir=/var \ + --disable-logger \ + --disable-whois \ + --disable-rcp \ + --disable-rexec \ + --disable-rlogin \ + --disable-rsh \ + --disable-servers + + + The meaning of the configure options: + + + --disable-logger + + This option prevents Inetutils from installing the + logger program, which is used by scripts to + pass messages to the System Log Daemon. Do not install it because + Util-linux installs a more recent version. + + + + + --disable-whois + + This option disables the building of the Inetutils + whois client, which is out of date. Instructions for + a better whois client are in the BLFS book. + + + + + --disable-r* + + These parameters disable building obsolete programs that should not + be used due to security issues. The functions provided by these + programs can be provided by the openssh + package in the BLFS book. + + + + + --disable-servers + + This disables the installation of the various network servers + included as part of the Inetutils package. These servers are deemed not + appropriate in a basic LFS system. Some are insecure by nature and are + only considered safe on trusted networks. Note that + better replacements are available for many of these servers. + + + + + + Compile the package: + +make + + To test the results, issue: + +make check + + One test, libls.sh, may fail in the initial chroot + environment but will pass if the test is rerun after the LFS system + is complete. One test, ping-localhost.sh, will fail if the host + system does not have ipv6 capability. + + Install the package: + +make install + + Move some programs so they are available if /usr is not accessible: + +mv -v /usr/bin/{hostname,ping,ping6,traceroute} /bin +mv -v /usr/bin/ifconfig /sbin + + + + + Contents of Inetutils + + + Installed programs + + + dnsdomainname, ftp, ifconfig, hostname, ping, ping6, + talk, telnet, tftp, and traceroute + + + + + Short Descriptions + + + + + dnsdomainname + + Show the system's DNS domain name + + dnsdomainname + + + + + + ftp + + Is the file transfer protocol program + + ftp + + + + + + hostname + + Reports or sets the name of the host + + hostname + + + + + + ifconfig + + Manages network interfaces + + ifconfig + + + + + + ping + + Sends echo-request packets and reports how long the replies + take + + ping + + + + + + ping6 + + A version of ping for IPv6 networks + + ping6 + + + + + + talk + + Is used to chat with another user + + talk + + + + + + telnet + + An interface to the TELNET protocol + + telnet + + + + + + tftp + + A trivial file transfer program + + tftp + + + + + + traceroute + + Traces the route your packets take from the host you are + working on to another host on a network, showing all the intermediate + hops (gateways) along the way + + traceroute + + + + + + + + +
diff --git a/chapter08/intltool.xml b/chapter08/intltool.xml new file mode 100644 index 000000000..9e9ebad20 --- /dev/null +++ b/chapter08/intltool.xml @@ -0,0 +1,141 @@ + + + %general-entities; +]> + + + + + + intltool + &intltool-version; +
&intltool-url;
+
+ + Intltool-&intltool-version; + + + Intltool + + + + + + <para>The Intltool is an internationalization tool used for extracting + translatable strings from source files.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&intltool-ch6-sbu;</seg> + <seg>&intltool-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Intltool + + First fix a warning that is caused by perl-5.22 and later: + +sed -i 's:\\\${:\\\$\\{:' intltool-update.in + + Prepare Intltool for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install +install -v -Dm644 doc/I18N-HOWTO /usr/share/doc/intltool-&intltool-version;/I18N-HOWTO + + + + + Contents of Intltool + + + Installed programs + Installed directories + + + intltool-extract, intltool-merge, intltool-prepare, + intltool-update, and intltoolize + /usr/share/doc/intltool-&intltool-version; and + /usr/share/intltool + + + + + Short Descriptions + + + + + intltoolize + + Prepares a package to use intltool + + intltoolize + + + + + + intltool-extract + + Generates header files that can be read by gettext + + intltool-extract + + + + + + intltool-merge + + Merges translated strings into various file types + + intltool-merge + + + + + + intltool-prepare + + Updates pot files and merges them with translation files + + intltool-prepare + + + + + + intltool-update + + Updates the po template files and merges them with the translations + + intltool-update + + + + + + + + +
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/chapter08/iproute2.xml b/chapter08/iproute2.xml new file mode 100644 index 000000000..8b868df65 --- /dev/null +++ b/chapter08/iproute2.xml @@ -0,0 +1,322 @@ + + + %general-entities; +]> + + + + + + iproute2 + &iproute2-version; +
&iproute2-url;
+
+ + IPRoute2-&iproute2-version; + + + IPRoute2 + + + + + + <para>The IPRoute2 package contains programs for basic and advanced IPV4-based + networking.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&iproute2-ch6-sbu;</seg> + <seg>&iproute2-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of IPRoute2 + + The arpd program included in this package will not + be built since it is dependent on Berkeley DB, which is not installed in + LFS. However, a directory for arpd and a man page will still + be installed. Prevent this by running the commands below. + If the arpd binary is needed, + instructions for compiling Berkeley DB can be found in the BLFS Book at + . + + +sed -i /ARPD/d Makefile +rm -fv man/man8/arpd.8 + + It is also necessary to disable building two modules that + requires . + +sed -i 's/.m_ipt.o//' tc/Makefile + + Compile the package: + +make + + This package does not have a working test suite. + + + Install the package: + +make DOCDIR=/usr/share/doc/iproute2-&iproute2-version; install + + + + + Contents of IPRoute2 + + + Installed programs + Installed directories + + + bridge, ctstat (link to lnstat), genl, ifcfg, ifstat, ip, lnstat, + nstat, routef, routel, rtacct, rtmon, rtpr, rtstat (link to lnstat), ss, + and tc + /etc/iproute2, /usr/lib/tc, and /usr/share/doc/iproute2-&iproute2-version;, + + + + + + Short Descriptions + + + + + bridge + + Configures network bridges + + bridge + + + + + + ctstat + + Connection status utility + + ctstat + + + + + + genl + + Generic netlink utility frontend + + genl + + + + + + ifcfg + + A shell script wrapper for the ip command + [Note that it requires the arping and + rdisk programs from the + iputils package found at .] + + ifcfg + + + + + + ifstat + + Shows the interface statistics, including the amount of + transmitted and received packets by interface + + ifstat + + + + + + ip + + The main executable. It has several different functions: + + ip link <device> + allows users to look at the state of devices and to make changes + + ip addr allows users to look at addresses and + their properties, add new addresses, and delete old ones + + ip neighbor allows users to look at neighbor + bindings and their properties, add new neighbor entries, and delete + old ones + + ip rule allows users to look at the routing + policies and change them + + ip route allows users to look at the routing + table and change routing table rules + + ip tunnel allows users to look at the IP + tunnels and their properties, and change them + + ip maddr allows users to look at the multicast + addresses and their properties, and change them + + ip mroute allows users to set, change, or + delete the multicast routing + + ip monitor allows users to continuously monitor + the state of devices, addresses and routes + + ip + + + + + + lnstat + + Provides Linux network statistics; it is a generalized and more + feature-complete replacement for the old rtstat + program + + lnstat + + + + + + nstat + + Shows network statistics + + nstat + + + + + + routef + + A component of ip route. This is for flushing + the routing tables + + routef + + + + + + routel + + A component of ip route. This is for listing + the routing tables + + routel + + + + + + rtacct + + Displays the contents of + /proc/net/rt_acct + + rtacct + + + + + + rtmon + + Route monitoring utility + + rtmon + + + + + + rtpr + + Converts the output of ip -o back into a + readable form + + rtpr + + + + + + rtstat + + Route status utility + + rtstat + + + + + + ss + + Similar to the netstat command; shows active + connections + + ss + + + + + + tc + + Traffic Controlling Executable; this is for Quality Of Service + (QOS) and Class Of Service (COS) implementations + + tc qdisc allows users to setup the queueing + discipline + + tc class allows users to setup classes based + on the queuing discipline scheduling + + tc estimator allows users to estimate the + network flow into a network + + tc filter allows users to setup the QOS/COS + packet filtering + + tc policy allows users to setup the QOS/COS + policies + + tc + + + + + + + + +
diff --git a/chapter08/kbd.xml b/chapter08/kbd.xml new file mode 100644 index 000000000..2f9cfd3f1 --- /dev/null +++ b/chapter08/kbd.xml @@ -0,0 +1,392 @@ + + + %general-entities; +]> + + + + + + kbd + &kbd-version; +
&kbd-url;
+
+ + Kbd-&kbd-version; + + + Kbd + + + + + + <para>The Kbd package contains key-table files, console fonts, and keyboard + utilities.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&kbd-ch6-sbu;</seg> + <seg>&kbd-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Kbd + + The behaviour of the Backspace and Delete keys is not consistent + across the keymaps in the Kbd package. The following patch fixes this + issue for i386 keymaps: + +patch -Np1 -i ../&kbd-backspace-patch; + + After patching, the Backspace key generates the character with code 127, + and the Delete key generates a well-known escape sequence. + + Remove the redundant resizecons program (it requires + the defunct svgalib to provide the video mode files - for normal use + setfont sizes the console appropriately) together with its + manpage. + +sed -i 's/\(RESIZECONS_PROGS=\)yes/\1no/g' configure +sed -i 's/resizecons.8 //' docs/man/man8/Makefile.in + + Prepare Kbd for compilation: + +./configure --prefix=/usr --disable-vlock + + + The meaning of the configure options: + + + --disable-vlock + + This option prevents the vlock utility from being built, as it + requires the PAM library, which isn't available in the chroot + environment. + + + + + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + For some languages (e.g., Belarusian) the Kbd package doesn't + provide a useful keymap where the stock by keymap assumes + the ISO-8859-5 encoding, and the CP1251 keymap is normally used. Users of + such languages have to download working keymaps separately. + + + If desired, install the documentation: + +mkdir -v /usr/share/doc/kbd-&kbd-version; +cp -R -v docs/doc/* /usr/share/doc/kbd-&kbd-version; + + + + + Contents of Kbd + + + Installed programs + Installed directories + + + chvt, deallocvt, dumpkeys, fgconsole, getkeycodes, kbdinfo, + kbd_mode, kbdrate, loadkeys, loadunimap, + mapscrn, openvt, psfaddtable (link to psfxtable), psfgettable (link to + psfxtable), psfstriptable (link to psfxtable), psfxtable, + setfont, setkeycodes, setleds, setmetamode, setvtrgb, + showconsolefont, showkey, unicode_start, and unicode_stop + /usr/share/consolefonts, /usr/share/consoletrans, /usr/share/keymaps, + /usr/share/doc/kbd-&kbd-version;, and /usr/share/unimaps + + + + + Short Descriptions + + + + + chvt + + Changes the foreground virtual terminal + + chvt + + + + + + deallocvt + + Deallocates unused virtual terminals + + deallocvt + + + + + + dumpkeys + + Dumps the keyboard translation tables + + dumpkeys + + + + + + fgconsole + + Prints the number of the active virtual terminal + + fgconsole + + + + + + getkeycodes + + Prints the kernel scancode-to-keycode mapping table + + getkeycodes + + + + + + kbdinfo + + Obtains information about the status of a console + + kbdinfo + + + + + + kbd_mode + + Reports or sets the keyboard mode + + kbd_mode + + + + + + kbdrate + + Sets the keyboard repeat and delay rates + + kbdrate + + + + + + loadkeys + + Loads the keyboard translation tables + + loadkeys + + + + + + loadunimap + + Loads the kernel unicode-to-font mapping table + + loadunimap + + + + + + mapscrn + + An obsolete program that used to load a user-defined output + character mapping table into the console driver; this is now done + by setfont + + mapscrn + + + + + + openvt + + Starts a program on a new virtual terminal (VT) + + openvt + + + + + + psfaddtable + + Adds a Unicode character table to a console font + + psfaddtable + + + + + + psfgettable + + Extracts the embedded Unicode character table from a console + font + + psfgettable + + + + + + psfstriptable + + Removes the embedded Unicode character table from a console + font + + psfstriptable + + + + + + psfxtable + + Handles Unicode character tables for console fonts + + psfxtable + + + + + + setfont + + Changes the Enhanced Graphic Adapter (EGA) and Video Graphics + Array (VGA) fonts on the console + + setfont + + + + + + setkeycodes + + Loads kernel scancode-to-keycode mapping table entries; this is + useful if there are unusual keys on the keyboard + + setkeycodes + + + + + + setleds + + Sets the keyboard flags and Light Emitting Diodes (LEDs) + + setleds + + + + + + setmetamode + + Defines the keyboard meta-key handling + + setmetamode + + + + + + setvtrgb + + Sets the console color map in all virtual terminals + + setvtrgb + + + + + + showconsolefont + + Shows the current EGA/VGA console screen font + + showconsolefont + + + + + + showkey + + Reports the scancodes, keycodes, and ASCII codes of the keys + pressed on the keyboard + + showkey + + + + + + unicode_start + + Puts the keyboard and console in UNICODE mode [Don't use this + program unless your keymap file is in the ISO-8859-1 encoding. For + other encodings, this utility produces incorrect results.] + + unicode_start + + + + + + unicode_stop + + Reverts keyboard and console from UNICODE mode + + unicode_stop + + + + + + + + +
diff --git a/chapter08/kernel.xml b/chapter08/kernel.xml deleted file mode 100644 index 0033028cf..000000000 --- a/chapter08/kernel.xml +++ /dev/null @@ -1,403 +0,0 @@ - - - %general-entities; -]> - - - - - - kernel - &linux-version; -
&linux-url;
-
- - Linux-&linux-version; - - - Linux - - - - - - <para>The Linux package contains the Linux kernel.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&linux-ch8-sbu;</seg> - <seg>&linux-ch8-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of the kernel - - Building the kernel involves a few steps—configuration, - compilation, and installation. Read the README file - in the kernel source tree for alternative methods to the way this book - configures the kernel. - - Prepare for compilation by running the following command: - -make mrproper - - This ensures that the kernel tree is absolutely clean. The - kernel team recommends that this command be issued prior to each - kernel compilation. Do not rely on the source tree being clean after - un-tarring. - - - - Configure the kernel via a menu-driven interface. For general - information on kernel configuration see . BLFS has some information - regarding particular kernel configuration requirements of packages outside - of LFS at . Additional - information about configuring and building the kernel can be found at - - - - - A good starting place for setting up the kernel configuration is to - run make defconfig. This will set the base - configuration to a good state that takes your current system architecture - into account. - - Be sure to enable/disable/set the following features or the system might - not work correctly or boot at all: - - -Device Drivers ---> - Generic Driver Options ---> - [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] - [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] - -Kernel hacking ---> - Choose kernel unwinder (Frame pointer unwinder) ---> [CONFIG_UNWINDER_FRAME_POINTER] - - -General setup --> - [*] Control Group support [CONFIG_CGROUPS] - [ ] Enable deprecated sysfs features to support old userspace tools [CONFIG_SYSFS_DEPRECATED] - [*] Configure standard kernel features (expert users) [CONFIG_EXPERT] ---> - [*] open by fhandle syscalls [CONFIG_FHANDLE] - [ ] Auditing support [CONFIG_AUDIT] -Processor type and features ---> - [*] Enable seccomp to safely compute untrusted bytecode [CONFIG_SECCOMP] -Firmware Drivers ---> - [*] Export DMI identification via sysfs to userspace [CONFIG_DMIID] -Networking support ---> - Networking options ---> - <*> The IPv6 protocol [CONFIG_IPV6] -Device Drivers ---> - Generic Driver Options ---> - [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] - [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] - Firmware Loader ---> - [ ] Enable the firmware sysfs fallback mechanism [CONFIG_FW_LOADER_USER_HELPER] -File systems ---> - [*] Inotify support for userspace [CONFIG_INOTIFY_USER] - <*> Kernel automounter support (supports v3, v4, and v5) [CONFIG_AUTOFS_FS] - Pseudo filesystems ---> - [*] Tmpfs POSIX Access Control Lists [CONFIG_TMPFS_POSIX_ACL] - [*] Tmpfs extended attributes [CONFIG_TMPFS_XATTR] - - - - While "The IPv6 Protocol" is not strictly - required, it is highly recommended by the systemd developers. - - - There are several other options that may be desired - depending on the requirements for the system. For a list of options needed - for BLFS packages, see the BLFS - Index of Kernel Settings - (&lfs-root;blfs/view/&short-version;/longindex.html#kernel-config-index). - - - If your host hardware is using UEFI, then the 'make defconfig' - above should automatically add in some EFI-related kernel options. - - In order to allow your LFS kernel to be booted from within your - host's UEFI boot environment, your kernel must have this option - selected: - -Processor type and features ---> - [*] EFI stub support [CONFIG_EFI_STUB] - - A fuller description of managing UEFI environments from within LFS - is covered by the lfs-uefi.txt hint at - . - - - - - The rationale for the above configuration items: - - - Support for uevent helper - - Having this option set may interfere with device - management when using Udev/Eudev. - - - - - Maintain a devtmpfs - - This will create automated device nodes which are populated by the - kernel, even without Udev running. Udev then runs on top of this, - managing permissions and adding symlinks. This configuration - item is required for all users of Udev/Eudev. - - - - - -make menuconfig - - - The meaning of optional make environment variables: - - - LANG=<host_LANG_value> LC_ALL= - - This establishes the locale setting to the one used on the - host. This may be needed for a proper menuconfig ncurses interface - line drawing on a UTF-8 linux text console. - - If used, be sure to replace - <host_LANG_value> by the value of - the $LANG variable from your host. You can - alternatively use instead the host's value of $LC_ALL - or $LC_CTYPE. - - - - - - Alternatively, make oldconfig may be more - appropriate in some situations. See the README - file for more information. - - If desired, skip kernel configuration by copying the kernel - config file, .config, from the host system - (assuming it is available) to the unpacked linux-&linux-version; directory. However, - we do not recommend this option. It is often better to explore all the - configuration menus and create the kernel configuration from - scratch. - - Compile the kernel image and modules: - -make - - If using kernel modules, module configuration in /etc/modprobe.d may be required. - Information pertaining to modules and kernel configuration is - located in and in the kernel - documentation in the linux-&linux-version;/Documentation directory. - Also, modprobe.d(5) may be of interest. - - Unless module support has been disabled in the kernel configuration, - install the modules with: - -make modules_install - - After kernel compilation is complete, additional steps are - required to complete the installation. Some files need to be copied to - the /boot directory. - - - If the host system has a separate /boot partition, the files copied - below should go there. The easiest way to do that is to bind /boot on the - host (outside chroot) to /mnt/lfs/boot before proceeding. As the root - user in the host system: - -mount --bind /boot /mnt/lfs/boot - - - The path to the kernel image may vary depending on the platform being - used. The filename below can be changed to suit your taste, but the stem of - the filename should be vmlinuz to be compatible with - the automatic setup of the boot process described in the next section. The - following command assumes an x86 architecture: - -cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&version; - -cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&versiond; - - System.map is a symbol file for the kernel. - It maps the function entry points of every function in the kernel API, - as well as the addresses of the kernel data structures for the running - kernel. It is used as a resource when investigating kernel problems. - Issue the following command to install the map file: - -cp -iv System.map /boot/System.map-&linux-version; - - The kernel configuration file .config - produced by the make menuconfig step - above contains all the configuration selections for the kernel - that was just compiled. It is a good idea to keep this file for future - reference: - -cp -iv .config /boot/config-&linux-version; - - Install the documentation for the Linux kernel: - -install -d /usr/share/doc/linux-&linux-version; -cp -r Documentation/* /usr/share/doc/linux-&linux-version; - - It is important to note that the files in the kernel source - directory are not owned by root. Whenever a - package is unpacked as user root (like we did - inside chroot), the files have the user and group IDs of whatever - they were on the packager's computer. This is usually not a problem - for any other package to be installed because the source tree is - removed after the installation. However, the Linux source tree is - often retained for a long time. Because of this, there is a chance - that whatever user ID the packager used will be assigned to somebody - on the machine. That person would then have write access to the kernel - source. - - - In many cases, the configuration of the kernel will need to be - updated for packages that will be installed later in BLFS. Unlike - other packages, it is not necessary to remove the kernel source tree - after the newly built kernel is installed. - - If the kernel source tree is going to be retained, run - chown -R 0:0 on the linux-&linux-version; directory to ensure - all files are owned by user root. - - - - Some kernel documentation recommends creating a symlink from - /usr/src/linux pointing to the kernel - source directory. This is specific to kernels prior to the 2.6 series and - must not be created on an LFS system as it can cause - problems for packages you may wish to build once your base LFS system is - complete. - - - - The headers in the system's include directory (/usr/include) should - always be the ones against which Glibc was compiled, - that is, the sanitised headers installed in . Therefore, they should - never be replaced by either the raw kernel headers - or any other kernel sanitized headers. - - - - - - Configuring Linux Module Load Order - - - /etc/modprobe.d/usb.conf - - - Most of the time Linux modules are loaded automatically, but - sometimes it needs some specific direction. The program that loads - modules, modprobe or insmod, uses - /etc/modprobe.d/usb.conf for this purpose. This file - needs to be created so that if the USB drivers (ehci_hcd, ohci_hcd and - uhci_hcd) have been built as modules, they will be loaded in the correct - order; ehci_hcd needs to be loaded prior to ohci_hcd and uhci_hcd in order - to avoid a warning being output at boot time. - - Create a new file /etc/modprobe.d/usb.conf by running - the following: - -install -v -m755 -d /etc/modprobe.d -cat > /etc/modprobe.d/usb.conf << "EOF" -# Begin /etc/modprobe.d/usb.conf - -install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true -install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true - -# End /etc/modprobe.d/usb.conf -EOF - - - - - Contents of Linux - - - Installed files - Installed directories - - - config-&linux-version;, - vmlinuz-&linux-version;-lfs-&version;, - vmlinuz-&linux-version;-lfs-&versiond;, - and System.map-&linux-version; - /lib/modules, /usr/share/doc/linux-&linux-version; - - - - - Short Descriptions - - - - - config-&linux-version; - - Contains all the configuration selections for the kernel - - /boot/config-&linux-version; - - - - - - vmlinuz-&linux-version;-lfs-&version; - vmlinuz-&linux-version;-lfs-&versiond; - - The engine of the Linux system. When turning on the computer, - the kernel is the first part of the operating system that gets loaded. - It detects and initializes all components of the computer's hardware, - then makes these components available as a tree of files to the - software and turns a single CPU into a multitasking machine capable - of running scores of programs seemingly at the same time - - lfskernel-&linux-version; - - - - - - System.map-&linux-version; - - A list of addresses and symbols; it maps the entry points and - addresses of all the functions and data structures in the - kernel - - /boot/System.map-&linux-version; - - - - - - - - -
diff --git a/chapter08/kmod.xml b/chapter08/kmod.xml new file mode 100644 index 000000000..6cc3eb168 --- /dev/null +++ b/chapter08/kmod.xml @@ -0,0 +1,211 @@ + + + %general-entities; +]> + + + + + + kmod + &kmod-version; +
&kmod-url;
+
+ + Kmod-&kmod-version; + + + Kmod + + + + + + <para>The Kmod package contains libraries and utilities for loading kernel + modules</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&kmod-ch6-sbu;</seg> + <seg>&kmod-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Kmod + + Prepare Kmod for compilation: + +./configure --prefix=/usr \ + --bindir=/bin \ + --sysconfdir=/etc \ + --with-rootlibdir=/lib \ + --with-xz \ + --with-zlib + + + The meaning of the configure options: + + + --with-xz, --with-zlib + + These options enable Kmod to handle compressed kernel modules. + + + + + --with-rootlibdir=/lib + + This option ensures different library related files are placed + in the correct directories. + + + + + + Compile the package: + +make + + This package does not come with a test suite that can be run in the + LFS chroot environment. At a minimum the git program is required and + several tests will not run outside of a git repository. + + + Install the package, and create symlinks for + compatibility with Module-Init-Tools (the package that previously handled + Linux kernel modules): + +make install + +for target in depmod insmod lsmod modinfo modprobe rmmod; do + ln -sfv ../bin/kmod /sbin/$target +done + +ln -sfv kmod /bin/lsmod + + + + + Contents of Kmod + + + Installed programs + Installed library + + + depmod (link to kmod), insmod (link to kmod), kmod, + lsmod (link to kmod), modinfo (link to kmod), modprobe (link to kmod), + and rmmod (link to kmod) + libkmod.so + + + + + Short Descriptions + + + + + depmod + + Creates a dependency file based on the symbols it finds in the + existing set of modules; this dependency file is used by + modprobe to automatically load the required + modules + + depmod + + + + + + insmod + + Installs a loadable module in the running kernel + + insmod + + + + + + kmod + + Loads and unloads kernel modules + + kmod + + + + + + lsmod + + Lists currently loaded modules + + lsmod + + + + + + modinfo + + Examines an object file associated with a kernel module and + displays any information that it can glean + + modinfo + + + + + + modprobe + + Uses a dependency file, created by + depmod, to automatically load relevant modules + + modprobe + + + + + + rmmod + + Unloads modules from the running kernel + + rmmod + + + + + + libkmod + + This library is used by other programs to load and unload kernel + modules + + libkmod + + + + + + + + +
+ diff --git a/chapter08/less.xml b/chapter08/less.xml new file mode 100644 index 000000000..087b2e6a3 --- /dev/null +++ b/chapter08/less.xml @@ -0,0 +1,125 @@ + + + %general-entities; +]> + + + + + + less + &less-version; +
&less-url;
+
+ + Less-&less-version; + + + Less + + + + + + <para>The Less package contains a text file viewer.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&less-ch6-sbu;</seg> + <seg>&less-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Less + + Prepare Less for compilation: + +./configure --prefix=/usr --sysconfdir=/etc + + + The meaning of the configure options: + + + --sysconfdir=/etc + + This option tells the programs created by the package to look + in /etc for the configuration + files. + + + + + + Compile the package: + +make + + This package does not come with a test suite. + + Install the package: + +make install + + + + + Contents of Less + + + Installed programs + + + less, lessecho, and lesskey + + + + + Short Descriptions + + + + + less + + A file viewer or pager; it displays the contents of the given + file, letting the user scroll, find strings, and jump to marks + + less + + + + + + lessecho + + Needed to expand meta-characters, such as * + and ?, in filenames on Unix systems + + lessecho + + + + + + lesskey + + Used to specify the key bindings for less + + lesskey + + + + + + + + +
diff --git a/chapter08/libcap.xml b/chapter08/libcap.xml new file mode 100644 index 000000000..8126dfaae --- /dev/null +++ b/chapter08/libcap.xml @@ -0,0 +1,166 @@ + + + %general-entities; +]> + + + + + + libcap + &libcap-version; +
&libcap-url;
+
+ + Libcap-&libcap-version; + + + Libcap + + + + + + <para>The Libcap package implements the user-space interfaces to the POSIX + 1003.1e capabilities available in Linux kernels. These capabilities are a + partitioning of the all powerful root privilege into a set of distinct + privileges.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&libcap-ch6-sbu;</seg> + <seg>&libcap-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Libcap + + Prevent a static library from being installed: + +sed -i '/install.*STACAPLIBNAME/d' libcap/Makefile + + Compile the package: + +make lib=lib + + + The meaning of the make option: + + + lib=lib + + This parameter sets the library directory to + /lib rather than + /lib64 on x86_64. It has no effect on + x86. + + + + + To test the results, issue: + +make test + + Install the package and do some cleanup: + +make lib=lib PKGCONFIGDIR=/usr/lib/pkgconfig install +chmod -v 755 /lib/libcap.so.&libcap-version; +mv -v /lib/libpsx.a /usr/lib +rm -v /lib/libcap.so +ln -sfv ../../lib/libcap.so.2 /usr/lib/libcap.so + + + + + Contents of Libcap + + + Installed programs + Installed library + + + capsh, getcap, getpcaps, and setcap + libcap.so and libpsx.a + + + + + Short Descriptions + + + + + capsh + + A shell wrapper to explore and constrain capability support + + capsh + + + + + + getcap + + Examines file capabilities + + getcap + + + + + + getpcaps + + Displays the capabilities on the queried process(es) + + getpcaps + + + + + + setcap + + Sets file capabilities + + setcap + + + + + + libcap + + Contains the library functions for manipulating POSIX 1003.1e + capabilities + + libcap + + + + + + libpsx + + Contains functions to support POSIX semantics for syscalls + associated with the pthread library + + libpsx + + + + + + + + +
diff --git a/chapter08/libelf.xml b/chapter08/libelf.xml new file mode 100644 index 000000000..b559e6aa2 --- /dev/null +++ b/chapter08/libelf.xml @@ -0,0 +1,88 @@ + + + %general-entities; +]> + + + + + + libelf + &elfutils-version; +
&elfutils-url;
+
+ + Libelf from Elfutils-&elfutils-version; + + + Libelf + + + + + + <para>Libelf is a library for handling ELF (Executable and Linkable Format) + files.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&elfutils-ch6-sbu;</seg> + <seg>&elfutils-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Libelf + + Libelf is part of elfutils-&elfutils-version; package. Use + the elfutils-&elfutils-version;.tar.bz2 as the source tarball. + + Prepare Libelf for compilation: + +./configure --prefix=/usr --disable-debuginfod + + Compile the package: + +make + + To test the results, issue: + +make check + + + + Install only Libelf: + +make -C libelf install +install -vm644 config/libelf.pc /usr/lib/pkgconfig +rm /usr/lib/libelf.a + + + + + Contents of Libelf + + + Installed Library + Installed Directory + + + + libelf.so + + + /usr/include/elfutils + + + + + + +
diff --git a/chapter08/libffi.xml b/chapter08/libffi.xml new file mode 100644 index 000000000..6a6f8a458 --- /dev/null +++ b/chapter08/libffi.xml @@ -0,0 +1,133 @@ + + + %general-entities; +]> + + + + + + libffi + &libffi-version; +
&libffi-url;
+
+ + Libffi-&libffi-version; + + + libffi + + + + + + <para>The Libffi library provides a portable, high level programming + interface to various calling conventions. This allows a programmer to call + any function specified by a call interface description at run time.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&libffi-ch6-sbu;</seg> + <seg>&libffi-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Libffi + + + Similar to GMP, libffi builds with optimizations specific + to the proccesor in use. If building for another system, export + CFLAGS and CXXFLAGS to specify a generic build for your architecture. + If this is not done, all applications that link to libffi will trigger + Illegal Operation Errors. + + + Prepare libffi for compilation: + +./configure --prefix=/usr --disable-static --with-gcc-arch=native + + + The meaning of the configure option: + + + --with-gcc-arch=native + + Ensure gcc optimizes for the current system. If this + is not specified, the system is guessed and the code generated + may not be correct for some systems. If the generated code + will be copied from the native system to a less capable + system, use the less capable system as a parameter. For details + about alternative system types, see + the x86 options in the gcc manual. + + + + + + Compile the package: + +make + + To test the results, issue: + +make check + + Six tests, all related to test-callback.c, are known to fail. + + Install the package: + +make install + + + + + Contents of Libffi + + + Installed library + + + libffi.so + + + + + Short Descriptions + + + + + libffi + + contains the libffi API functions. + + libffi + + + + + + + +
+ diff --git a/chapter08/libpipeline.xml b/chapter08/libpipeline.xml new file mode 100644 index 000000000..eb5a19438 --- /dev/null +++ b/chapter08/libpipeline.xml @@ -0,0 +1,92 @@ + + + %general-entities; +]> + + + + + + libpipeline + &libpipeline-version; +
&libpipeline-url;
+
+ + Libpipeline-&libpipeline-version; + + + Libpipeline + + + + + + <para>The Libpipeline package contains a library for manipulating pipelines + of subprocesses in a flexible and convenient way.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&libpipeline-ch6-sbu;</seg> + <seg>&libpipeline-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Libpipeline + + Prepare Libpipeline for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + Contents of Libpipeline + + + Installed library + + + libpipeline.so + + + + + Short Descriptions + + + + + libpipeline + + This library is used to safely construct pipelines between + subprocesses + + libpipeline + + + + + + + +
diff --git a/chapter08/libtool.xml b/chapter08/libtool.xml new file mode 100644 index 000000000..3093b4164 --- /dev/null +++ b/chapter08/libtool.xml @@ -0,0 +1,129 @@ + + + %general-entities; +]> + + + + + + libtool + &libtool-version; +
&libtool-url;
+
+ + Libtool-&libtool-version; + + + Libtool + + + + + + <para>The Libtool package contains the GNU generic library support script. + It wraps the complexity of using shared libraries in a consistent, portable + interface.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&libtool-ch6-sbu;</seg> + <seg>&libtool-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Libtool + + Prepare Libtool for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + +To test the results, issue: + +make check + + The test time for libtool can be reduced significantly on a + system with multiple cores. To do this, append + TESTSUITEFLAGS=-j<N> to the line above. For + instance, using -j4 can reduce the test time by over 60 + percent. + + Five tests are known to fail in the LFS build environment due + to a circular dependency, but all tests pass if rechecked after + automake is installed. + + Install the package: + +make install + + + + + + Contents of Libtool + + + Installed programs + Installed libraries + Installed directories + + + libtool and libtoolize + libltdl.so + /usr/include/libltdl and /usr/share/libtool + + + + + Short Descriptions + + + + + libtool + + Provides generalized library-building support services + + libtool + + + + + + libtoolize + + Provides a standard way to add libtool + support to a package + + libtoolize + + + + + + libltdl + + Hides the various difficulties of dlopening libraries + + libltdl + + + + + + + + +
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/chapter08/man-db.xml b/chapter08/man-db.xml new file mode 100644 index 000000000..f2f46b891 --- /dev/null +++ b/chapter08/man-db.xml @@ -0,0 +1,456 @@ + + + %general-entities; +]> + + + + + + man-db + &man-db-version; +
&man-db-url;
+
+ + Man-DB-&man-db-version; + + + Man-DB + + + + + + <para>The Man-DB package contains programs for finding and viewing man + pages.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&man-db-ch6-sbu;</seg> + <seg>&man-db-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Man-DB + + Prepare Man-DB for compilation: + +sed -i '/find/s@/usr@@' init/systemd/man-db.service.in + +./configure --prefix=/usr \ + --docdir=/usr/share/doc/man-db-&man-db-version; \ + --sysconfdir=/etc \ + --disable-setuid \ + --enable-cache-owner=bin \ + --with-browser=/usr/bin/lynx \ + --with-vgrind=/usr/bin/vgrind \ + --with-grap=/usr/bin/grap + +./configure --prefix=/usr \ + --docdir=/usr/share/doc/man-db-&man-db-version; \ + --sysconfdir=/etc \ + --disable-setuid \ + --enable-cache-owner=bin \ + --with-browser=/usr/bin/lynx \ + --with-vgrind=/usr/bin/vgrind \ + --with-grap=/usr/bin/grap \ + --with-systemdtmpfilesdir= \ + --with-systemdsystemunitdir= + + + The meaning of the configure options: + + + sed -i '/find/s@/usr@@' init/systemd/man-db.service.in + + This changes a harcoded path to the find + utility, which we install in + /bin. + + + + + --disable-setuid + + This disables making the man program setuid + to user man. + + + + + --enable-cache-owner=bin + + This makes the system-wide cache files be owned by user + bin. + + + + + --with-... + + These three parameters are used to set some default programs. + lynx is a text-based web browser (see + BLFS for installation instructions), vgrind + converts program sources to Groff input, and grap + is useful for typesetting graphs in Groff documents. The + vgrind and grap programs are + not normally needed for viewing manual pages. They are not part of + LFS or BLFS, but you should be able to install them yourself after + finishing LFS if you wish to do so. + + + + + --with-systemd... + + These parameters prevent installing unneeded systemd + directories and files. + + + + + + Compile the package: + +make + + To test the results, issue: + +make check + + One test, man-missing-locales, is known to fail in the LFS chroot envirnment. + + Install the package: + +make install + + + + + Non-English Manual Pages in LFS + + The following table shows the character set that Man-DB assumes + manual pages installed under + /usr/share/man/<ll> will be + encoded with. In addition to this, Man-DB correctly determines if manual + pages installed in that directory are UTF-8 encoded. + + + +Expected character encoding of legacy 8-bit manual pages + + + + + + + + + + + + Language (code) + Encoding + Language (code) + Encoding + + + + + + Danish (da) + ISO-8859-1 + Croatian (hr) + ISO-8859-2 + + + German (de) + ISO-8859-1 + Hungarian (hu) + ISO-8859-2 + + + English (en) + ISO-8859-1 + Japanese (ja) + EUC-JP + + + Spanish (es) + ISO-8859-1 + Korean (ko) + EUC-KR + + + Estonian (et) + ISO-8859-1 + Lithuanian (lt) + ISO-8859-13 + + + Finnish (fi) + ISO-8859-1 + Latvian (lv) + ISO-8859-13 + + + French (fr) + ISO-8859-1 + Macedonian (mk) + ISO-8859-5 + + + Irish (ga) + ISO-8859-1 + Polish (pl) + ISO-8859-2 + + + Galician (gl) + ISO-8859-1 + Romanian (ro) + ISO-8859-2 + + + Indonesian (id) + ISO-8859-1 + Russian (ru) + KOI8-R + + + Icelandic (is) + ISO-8859-1 + Slovak (sk) + ISO-8859-2 + + + Italian (it) + ISO-8859-1 + Slovenian (sl) + ISO-8859-2 + + + Norwegian Bokmal (nb) + ISO-8859-1 + Serbian Latin (sr@latin) + ISO-8859-2 + + + Dutch (nl) + ISO-8859-1 + Serbian (sr) + ISO-8859-5 + + + Norwegian Nynorsk (nn) + ISO-8859-1 + Turkish (tr) + ISO-8859-9 + + + Norwegian (no) + ISO-8859-1 + Ukrainian (uk) + KOI8-U + + + Portuguese (pt) + ISO-8859-1 + Vietnamese (vi) + TCVN5712-1 + + + Swedish (sv) + ISO-8859-1 + Simplified Chinese (zh_CN) + GBK + + + Belarusian (be) + CP1251 + Simplified Chinese, Singapore (zh_SG) + GBK + + + Bulgarian (bg) + CP1251 + Traditional Chinese, Hong Kong (zh_HK) + BIG5HKSCS + + + Czech (cs) + ISO-8859-2 + Traditional Chinese (zh_TW) + BIG5 + + + Greek (el) + ISO-8859-7 + + + + + + + + +
+ + + Manual pages in languages not in the list are not supported. + + +
+ + + Contents of Man-DB + + + Installed programs + Installed libraries + Installed directories + + + accessdb, apropos (link to whatis), catman, lexgrog, man, mandb, + manpath, and whatis + libman.so and libmandb.so (both in /usr/lib/man-db) + /usr/lib/man-db, /usr/libexec/man-db, + and /usr/share/doc/man-db-&man-db-version; + + + + + Short Descriptions + + + + + accessdb + + Dumps the whatis database contents in + human-readable form + + accessdb + + + + + + apropos + + Searches the whatis database and displays + the short descriptions of system commands that contain a given + string + + apropos + + + + + + catman + + Creates or updates the pre-formatted manual pages + + catman + + + + + + lexgrog + + Displays one-line summary information about a given manual + page + + lexgrog + + + + + + man + + Formats and displays the requested manual page + + man + + + + + + mandb + + Creates or updates the whatis database + + mandb + + + + + + manpath + + Displays the contents of $MANPATH or (if $MANPATH is not set) + a suitable search path based on the settings in man.conf and the + user's environment + + manpath + + + + + + whatis + + Searches the whatis database and displays + the short descriptions of system commands that contain the given + keyword as a separate word + + whatis + + + + + + libman + + Contains run-time support for man + + libman + + + + + + libmandb + + Contains run-time support for man + + libmandb + + + + + + + + +
diff --git a/chapter08/man-pages.xml b/chapter08/man-pages.xml new file mode 100644 index 000000000..3d2c52046 --- /dev/null +++ b/chapter08/man-pages.xml @@ -0,0 +1,80 @@ + + + %general-entities; +]> + + + + + + man-pages + &man-pages-version; +
&man-pages-url;
+
+ + Man-pages-&man-pages-version; + + + Man-pages + + + + + + <para>The Man-pages package contains over 2,200 man pages.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&man-pages-ch6-sbu;</seg> + <seg>&man-pages-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Man-pages + + Install Man-pages by running: + +make install + + + + + Contents of Man-pages + + + Installed files + + + various man pages + + + + + Short Descriptions + + + + + man pages + + Describe C programming language functions, important + device files, and significant configuration files + + man pages + + + + + + + + +
diff --git a/chapter08/meson.xml b/chapter08/meson.xml new file mode 100644 index 000000000..0b49c5441 --- /dev/null +++ b/chapter08/meson.xml @@ -0,0 +1,109 @@ + + + %general-entities; +]> + + + + + + meson + &meson-version; +
&meson-url;
+
+ + Meson-&meson-version; + + + Meson + + + + + + <para>Meson is an open source build system meant to be both extremely fast, + and, even more importantly, as user friendly as possible.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + <seglistitem> + <seg>&meson-ch6-sbu;</seg> + <seg>&meson-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Meson + + Compile Meson with the following command: + +python3 setup.py build + + This package does not come with a test suite. + + Install the package: + +python3 setup.py install --root=dest +cp -rv dest/* / + + + The meaning of the install parameters: + + + --root=dest + + By default python3 setup.py install + installs various files (such as man pages) into Python Eggs. + With a specified root location, setup.py installs + these files into a standard hierarchy. Then we can just copy + the hierarchy so the files will be in the standard location. + + + + + + + + + Contents of Meson + + + Installed programs + Installed directory + + + meson + /usr/lib/python&python-minor;/site-packages/meson-&meson-version;-py&python-minor;.egg-info and /usr/lib/python&python-minor;/site-packages/mesonbuild + + + + + Short Descriptions + + + + + meson + + A high productivity build system + + meson + + + + + + + + +
+ diff --git a/chapter08/mpc.xml b/chapter08/mpc.xml new file mode 100644 index 000000000..2d518c8c1 --- /dev/null +++ b/chapter08/mpc.xml @@ -0,0 +1,100 @@ + + + %general-entities; +]> + + + + + + mpc + &mpc-version; +
&mpc-url;
+
+ + MPC-&mpc-version; + + + MPC + + + + + + <para>The MPC package contains a library for the arithmetic of complex + numbers with arbitrarily high precision and correct rounding of the + result.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&mpc-ch6-sbu;</seg> + <seg>&mpc-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of MPC + + Prepare MPC for compilation: + +./configure --prefix=/usr \ + --disable-static \ + --docdir=/usr/share/doc/mpc-&mpc-version; + + Compile the package and generate the HTML documentation: + +make +make html + + To test the results, issue: + +make check + + Install the package and its documentation: + +make install +make install-html + + + + + + Contents of MPC + + + Installed Libraries + Installed Directory + + + libmpc.so + /usr/share/doc/mpc-&mpc-version; + + + + + Short Descriptions + + + + + libmpc + + Contains complex math functions + + libmpc + + + + + + + + +
diff --git a/chapter08/mpfr.xml b/chapter08/mpfr.xml new file mode 100644 index 000000000..ff8e323b7 --- /dev/null +++ b/chapter08/mpfr.xml @@ -0,0 +1,105 @@ + + + %general-entities; +]> + + + + + + mpfr + &mpfr-version; +
&mpfr-url;
+
+ + MPFR-&mpfr-version; + + + MPFR + + + + + + <para>The MPFR package contains functions for multiple precision + math.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&mpfr-ch6-sbu;</seg> + <seg>&mpfr-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of MPFR + + Prepare MPFR for compilation: + +./configure --prefix=/usr \ + --disable-static \ + --enable-thread-safe \ + --docdir=/usr/share/doc/mpfr-&mpfr-version; + + Compile the package and generate the HTML documentation: + +make +make html + + + The test suite for MPFR in this section is considered critical. + Do not skip it under any circumstances. + + + Test the results and ensure that all tests passed: + +make check + + Install the package and its documentation: + +make install +make install-html + + + + + + Contents of MPFR + + + Installed Libraries + Installed directory + + + libmpfr.so + /usr/share/doc/mpfr-&mpfr-version; + + + + + Short Descriptions + + + + + libmpfr + + Contains multiple-precision math functions + + libmpfr + + + + + + + + +
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/chapter08/ninja.xml b/chapter08/ninja.xml new file mode 100644 index 000000000..e998c64fb --- /dev/null +++ b/chapter08/ninja.xml @@ -0,0 +1,132 @@ + + + %general-entities; +]> + + + + + + ninja + &ninja-version; +
&ninja-url;
+
+ + Ninja-&ninja-version; + + + Ninja + + + + + + <para>Ninja is a small build system with a focus on speed.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&ninja-ch6-sbu;</seg> + <seg>&ninja-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Ninja + + When run, ninja normally runs a maximum number of processes + in parallel. By default this is the number of cores on the system + plus two. In some cases this can overheat a CPU or run a system out + of memory. If run from the command line, passing a -jN parameter + will limit the number of parallel processes, but some packages + embed the execution of ninja and do not pass a -j parameter. + + Using the optional procedure below allows a user to + limit the number of parallel processes via an environment variable, + NINJAJOBS. For example, setting: + + + + export NINJAJOBS=4 + + will limit ninja to four parallel processes. + + If desired, add the capability to use the environment variable + NINJAJOBS by running: + +sed -i '/int Guess/a \ + int j = 0;\ + char* jobs = getenv( "NINJAJOBS" );\ + if ( jobs != NULL ) j = atoi( jobs );\ + if ( j > 0 ) return j;\ +' src/ninja.cc + + Build Ninja with: + +python3 configure.py --bootstrap + + + The meaning of the build option: + + + --bootstrap + + This parameter forces ninja to rebuild itself for the current + system. + + + + + + To test the results, issue: + +./ninja ninja_test +./ninja_test --gtest_filter=-SubprocessTest.SetWithLots + + Install the package: + +install -vm755 ninja /usr/bin/ +install -vDm644 misc/bash-completion /usr/share/bash-completion/completions/ninja +install -vDm644 misc/zsh-completion /usr/share/zsh/site-functions/_ninja + + + + + Contents of Ninja + + + Installed programs + + + ninja + + + + Short Descriptions + + + + + ninja + + is the Ninja build system. + + ninja + + + + + + + + +
+ diff --git a/chapter08/openssl.xml b/chapter08/openssl.xml new file mode 100644 index 000000000..f2ff1fa80 --- /dev/null +++ b/chapter08/openssl.xml @@ -0,0 +1,176 @@ + + + %general-entities; +]> + + + + + + openssl + &openssl-version; +
&openssl-url;
+
+ + OpenSSL-&openssl-version; + + + OpenSSL + + + + + + <para>The OpenSSL package contains management tools and libraries relating + to cryptography. These are useful for providing cryptographic functions + to other packages, such as OpenSSH, email applications and web browsers + (for accessing HTTPS sites). </para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&openssl-ch6-sbu;</seg> + <seg>&openssl-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of OpenSSL + + Prepare OpenSSL for compilation: + +./config --prefix=/usr \ + --openssldir=/etc/ssl \ + --libdir=lib \ + shared \ + zlib-dynamic + + Compile the package: + +make + + To test the results, issue: + +make test + + One test 30-test_afalg.t is known to fail on some kernel + configurations (it apparently assumes certain unspecified crypto + options have been selected). + + Install the package: + +sed -i '/INSTALL_LIBS/s/libcrypto.a libssl.a//' Makefile +make MANSUFFIX=ssl install + + If desired, install the documentation: + +mv -v /usr/share/doc/openssl /usr/share/doc/openssl-&openssl-version; +cp -vfr doc/* /usr/share/doc/openssl-&openssl-version; + + + + + Contents of OpenSSL + + + Installed programs + Installed libraries + Installed directories + + + + c_rehash and openssl + + + libcrypto.{so,a} and libssl.{so,a} + + + /etc/ssl, + /usr/include/openssl, + /usr/lib/engines and + /usr/share/doc/openssl-&openssl-version; + + + + + + Short Descriptions + + + + + c_rehash + + + is a Perl script that scans all files in + a directory and adds symbolic links to their hash values. + + + c_rehash + + + + + + openssl + + + is a command-line tool for using the various cryptography functions + of OpenSSL's crypto library from the + shell. It can be used for various functions which are documented in + man 1 openssl. + + + openssl + + + + + + libcrypto.so + + + implements a wide range of cryptographic algorithms used in various + Internet standards. The services provided by this library are used + by the OpenSSL implementations of SSL, + TLS and S/MIME, and they have also been used to implement + OpenSSH, + OpenPGP, and other cryptographic + standards. + + + libcrypto.so + + + + + + libssl.so + + + implements the Transport Layer Security (TLS v1) protocol. + It provides a rich API, documentation + on which can be found by running man 3 ssl. + + + libssl.so + + + + + + + + +
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/chapter08/pkgconfig.xml b/chapter08/pkgconfig.xml new file mode 100644 index 000000000..3c311e389 --- /dev/null +++ b/chapter08/pkgconfig.xml @@ -0,0 +1,121 @@ + + + %general-entities; +]> + + + + + + pkg-config + &pkgconfig-version; +
&pkgconfig-url;
+
+ + Pkg-config-&pkgconfig-version; + + + Pkgconfig + + + + + + <para> The pkg-config package contains a tool for passing the include path + and/or library paths to build tools during the configure and make file + execution.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&pkgconfig-ch6-sbu;</seg> + <seg>&pkgconfig-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Pkg-config + + Prepare Pkg-config for compilation: + +./configure --prefix=/usr \ + --with-internal-glib \ + --disable-host-tool \ + --docdir=/usr/share/doc/pkg-config-&pkgconfig-version; + + + The meaning of the new configure options: + + + --with-internal-glib + + This will allow pkg-config to use its internal version of + Glib because an external version is not available in LFS. + + + + + --disable-host-tool + + This option disables the creation of an undesired hard link + to the pkg-config program. + + + + + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + + + + Contents of Pkg-config + + + Installed program + Installed directory + + + pkg-config + /usr/share/doc/pkg-config-&pkgconfig-version; + + + + + Short Descriptions + + + + + + pkg-config + + Returns meta information for the specified library or package + + + pkg-config + + + + + + + + +
diff --git a/chapter08/pkgmgt.xml b/chapter08/pkgmgt.xml new file mode 100644 index 000000000..d28038467 --- /dev/null +++ b/chapter08/pkgmgt.xml @@ -0,0 +1,291 @@ + + + %general-entities; +]> + + + + + Package Management + + Package Management is an often requested addition to the LFS Book. A + Package Manager allows tracking the installation of files making it easy to + remove and upgrade packages. As well as the binary and library files, a + package manager will handle the installation of configuration files. Before + you begin to wonder, NO—this section will not talk about nor recommend + any particular package manager. What it provides is a roundup of the more + popular techniques and how they work. The perfect package manager for you may + be among these techniques or may be a combination of two or more of these + techniques. This section briefly mentions issues that may arise when upgrading + packages. + + Some reasons why no package manager is mentioned in LFS or BLFS + include: + + + + Dealing with package management takes the focus away from the goals + of these books—teaching how a Linux system is built. + + + + There are multiple solutions for package management, each having + its strengths and drawbacks. Including one that satisfies all audiences + is difficult. + + + + There are some hints written on the topic of package management. Visit + the Hints Project and see if one of them + fits your need. + + + Upgrade Issues + + A Package Manager makes it easy to upgrade to newer versions when they + are released. Generally the instructions in the LFS and BLFS Book can be + used to upgrade to the newer versions. Here are some points that you should + be aware of when upgrading packages, especially on a running system. + + + + If Glibc needs to be upgraded to a newer version, (e.g. from + glibc-2.19 to glibc-2.20), it is safer to rebuild LFS. Though you + may be able to rebuild all the packages in their + dependency order, we do not recommend it. + + + + If a package containing a shared library is updated, and if the + name of the library changes, then all the packages dynamically linked + to the library need to be recompiled to link against the newer library. + (Note that there is no correlation between the package version and the + name of the library.) For example, consider a package foo-1.2.3 that + installs a shared library with name + libfoo.so.1. Say you upgrade + the package to a newer version foo-1.2.4 that installs a shared library + with name libfoo.so.2. In this + case, all packages that are dynamically linked to + libfoo.so.1 need to be + recompiled to link against + libfoo.so.2. Note that you + should not remove the previous libraries until the dependent packages + are recompiled. + + + + + + + Package Management Techniques + + The following are some common package management techniques. Before + making a decision on a package manager, do some research on the various + techniques, particularly the drawbacks of the particular scheme. + + + It is All in My Head! + + Yes, this is a package management technique. Some folks do not find + the need for a package manager because they know the packages intimately + and know what files are installed by each package. Some users also do not + need any package management because they plan on rebuilding the entire + system when a package is changed. + + + + + Install in Separate Directories + + This is a simplistic package management that does not need any extra + package to manage the installations. Each package is installed in a + separate directory. For example, package foo-1.1 is installed in + /usr/pkg/foo-1.1 + and a symlink is made from /usr/pkg/foo to + /usr/pkg/foo-1.1. When installing + a new version foo-1.2, it is installed in + /usr/pkg/foo-1.2 and the previous + symlink is replaced by a symlink to the new version. + + Environment variables such as PATH, + LD_LIBRARY_PATH, MANPATH, + INFOPATH and CPPFLAGS need to be expanded to + include /usr/pkg/foo. For more than a few packages, + this scheme becomes unmanageable. + + + + + Symlink Style Package Management + + This is a variation of the previous package management technique. + Each package is installed similar to the previous scheme. But instead of + making the symlink, each file is symlinked into the + /usr hierarchy. This removes the + need to expand the environment variables. Though the symlinks can be + created by the user to automate the creation, many package managers have + been written using this approach. A few of the popular ones include Stow, + Epkg, Graft, and Depot. + + The installation needs to be faked, so that the package thinks that + it is installed in /usr though in + reality it is installed in the + /usr/pkg hierarchy. Installing in + this manner is not usually a trivial task. For example, consider that you + are installing a package libfoo-1.1. The following instructions may + not install the package properly: + +./configure --prefix=/usr/pkg/libfoo/1.1 +make +make install + + The installation will work, but the dependent packages may not link + to libfoo as you would expect. If you compile a package that links against + libfoo, you may notice that it is linked to + /usr/pkg/libfoo/1.1/lib/libfoo.so.1 + instead of /usr/lib/libfoo.so.1 + as you would expect. The correct approach is to use the + DESTDIR strategy to fake installation of the package. This + approach works as follows: + +./configure --prefix=/usr +make +make DESTDIR=/usr/pkg/libfoo/1.1 install + + Most packages support this approach, but there are some which do not. + For the non-compliant packages, you may either need to manually install the + package, or you may find that it is easier to install some problematic + packages into /opt. + + + + + Timestamp Based + + In this technique, a file is timestamped before the installation of + the package. After the installation, a simple use of the + find command with the appropriate options can generate + a log of all the files installed after the timestamp file was created. A + package manager written with this approach is install-log. + + Though this scheme has the advantage of being simple, it has two + drawbacks. If, during installation, the files are installed with any + timestamp other than the current time, those files will not be tracked by + the package manager. Also, this scheme can only be used when one package + is installed at a time. The logs are not reliable if two packages are + being installed on two different consoles. + + + + + Tracing Installation Scripts + + In this approach, the commands that the installation scripts perform + are recorded. There are two techniques that one can use: + + The LD_PRELOAD environment variable can be set to + point to a library to be preloaded before installation. During + installation, this library tracks the packages that are being installed by + attaching itself to various executables such as cp, + install, mv and tracking the system + calls that modify the filesystem. For this approach to work, all the + executables need to be dynamically linked without the suid or sgid bit. + Preloading the library may cause some unwanted side-effects during + installation. Therefore, it is advised that one performs some tests to + ensure that the package manager does not break anything and logs all the + appropriate files. + + The second technique is to use strace, which + logs all system calls made during the execution of the installation + scripts. + + + + Creating Package Archives + + In this scheme, the package installation is faked into a separate + tree as described in the Symlink style package management. After the + installation, a package archive is created using the installed files. + This archive is then used to install the package either on the local + machine or can even be used to install the package on other machines. + + This approach is used by most of the package managers found in the + commercial distributions. Examples of package managers that follow this + approach are RPM (which, incidentally, is required by the Linux + Standard Base Specification), pkg-utils, Debian's apt, and + Gentoo's Portage system. A hint describing how to adopt this style of + package management for LFS systems is located at . + + Creation of package files that include dependency information is + complex and is beyond the scope of LFS. + + Slackware uses a tar based system for package + archives. This system purposely does not handle package dependencies + as more complex package managers do. For details of Slackware package + management, see . + + + + User Based Management + + This scheme, unique to LFS, was devised by Matthias Benkmann, and is + available from the Hints Project. In + this scheme, each package is installed as a separate user into the + standard locations. Files belonging to a package are easily identified by + checking the user ID. The features and shortcomings of this approach are + too complex to describe in this section. For the details please see the + hint at . + + + + + + + Deploying LFS on Multiple Systems + + One of the advantages of an LFS system is that there are no files that + depend on the position of files on a disk system. Cloning an LFS build to + another computer with the same architecture as the base system is as + simple as using tar on the LFS partition that contains + the root directory (about 250MB uncompressed for a base LFS build), copying + that file via network transfer or CD-ROM to the new system and expanding + it. From that point, a few configuration files will have to be changed. + Configuration files that may need to be updated include: + /etc/hosts, + /etc/fstab, + /etc/passwd, + /etc/group, + + /etc/shadow, and + /etc/ld.so.conf. + + + /etc/shadow, + /etc/ld.so.conf, + /etc/sysconfig/rc.site, + /etc/sysconfig/network, and + /etc/sysconfig/ifconfig.eth0. + + + + A custom kernel may need to be built for the new system depending on + differences in system hardware and the original kernel + configuration. + + There have been some reports of issues when copying between + similar but not identical architectures. For instance, the instruction set + for an Intel system is not identical with an AMD processor and later + versions of some processors may have instructions that are unavailable in + earlier versions. + + Finally the new system has to be made bootable via . + + + + diff --git a/chapter08/procps.xml b/chapter08/procps.xml new file mode 100644 index 000000000..59bf0864c --- /dev/null +++ b/chapter08/procps.xml @@ -0,0 +1,292 @@ + + + %general-entities; +]> + + + + + + procps-ng + &procps-ng-version; +
&procps-ng-url;
+
+ + Procps-ng-&procps-ng-version; + + + Procps-ng + + + + + + <para>The Procps-ng package contains programs for monitoring processes.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&procps-ng-ch6-sbu;</seg> + <seg>&procps-ng-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Procps-ng + + Prepare procps-ng for compilation: + +./configure --prefix=/usr \ + --exec-prefix= \ + --libdir=/usr/lib \ + --docdir=/usr/share/doc/procps-ng-&procps-ng-version; \ + --disable-static \ + --disable-kill + +./configure --prefix=/usr \ + --exec-prefix= \ + --libdir=/usr/lib \ + --docdir=/usr/share/doc/procps-ng-&procps-ng-version; \ + --disable-static \ + --disable-kill \ + --with-systemd + + + The meaning of the configure options: + + + --disable-kill + + This switch disables building the kill + command that will be installed by the Util-linux package. + + + + + Compile the package: + +make + + The test suite needs some custom modifications for LFS. + Remove a test that fails when scripting does not use a tty device and + fix two others. + To run the test suite, run the following commands: + +sed -i -r 's|(pmap_initname)\\\$|\1|' testsuite/pmap.test/pmap.exp +sed -i '/set tty/d' testsuite/pkill.test/pkill.exp +rm testsuite/pgrep.test/pgrep.exp +make check + + Install the package: + +make install + +Finally, move essential libraries to a location that can be found if +/usr is not mounted. + +mv -v /usr/lib/libprocps.so.* /lib +ln -sfv ../../lib/$(readlink /usr/lib/libprocps.so) /usr/lib/libprocps.so + + + + + Contents of Procps-ng + + + Installed programs + Installed library + Installed directories + + + free, pgrep, pidof, pkill, pmap, ps, pwdx, slabtop, + sysctl, tload, top, uptime, vmstat, w, and watch + libprocps.so + /usr/include/proc and /usr/share/doc/procps-ng-&procps-ng-version; + + + + + Short Descriptions + + + + + free + + Reports the amount of free and used memory (both physical and + swap memory) in the system + + free + + + + + + pgrep + + Looks up processes based on their name and other attributes + + pgrep + + + + + + pidof + + Reports the PIDs of the given programs + + pidof + + + + + + pkill + + Signals processes based on their name and other attributes + + pkill + + + + + + pmap + + Reports the memory map of the given process + + pmap + + + + + + ps + + Lists the current running processes + + ps + + + + + + pwdx + + Reports the current working directory of a process + + pwdx + + + + + + slabtop + + Displays detailed kernel slab cache information in real time + + slabtop + + + + + + sysctl + + Modifies kernel parameters at run time + + sysctl + + + + + + tload + + Prints a graph of the current system load average + + tload + + + + + + top + + Displays a list of the most CPU intensive processes; it + provides an ongoing look at processor activity in real time + + top + + + + + + uptime + + Reports how long the system has been running, how many users are + logged on, and the system load averages + + uptime + + + + + + vmstat + + Reports virtual memory statistics, giving information about + processes, memory, paging, block Input/Output (IO), traps, and CPU + activity + + vmstat + + + + + + w + + Shows which users are currently logged on, where, and since + when + + w + + + + + + watch + + Runs a given command repeatedly, displaying the first + screen-full of its output; this allows a user to watch the output + change over time + + watch + + + + + + libprocps + + Contains the functions used by most programs in this + package + + libprocps + + + + + + + + +
diff --git a/chapter08/psmisc.xml b/chapter08/psmisc.xml new file mode 100644 index 000000000..b01303131 --- /dev/null +++ b/chapter08/psmisc.xml @@ -0,0 +1,160 @@ + + + %general-entities; +]> + + + + + + psmisc + &psmisc-version; +
&psmisc-url;
+
+ + Psmisc-&psmisc-version; + + + Psmisc + + + + + + <para>The Psmisc package contains programs for displaying information about + running processes.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&psmisc-ch6-sbu;</seg> + <seg>&psmisc-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Psmisc + + Prepare Psmisc for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + This package does not come with a test suite. + + Install the package: + +make install + + Finally, move the killall and fuser + programs to the location specified by the FHS: + +mv -v /usr/bin/fuser /bin +mv -v /usr/bin/killall /bin + + + + + Contents of Psmisc + + + Installed programs + + + fuser, killall, peekfd, prtstat, pslog, pstree, and pstree.x11 (link to pstree) + + + + + Short Descriptions + + + + + fuser + + Reports the Process IDs (PIDs) of processes that use the given + files or file systems + + fuser + + + + + + killall + + Kills processes by name; it sends a signal to all processes + running any of the given commands + + killall + + + + + + peekfd + + Peek at file descriptors of a running process, given its + PID + + peekfd + + + + + + prtstat + + Prints information about a process + + prtstat + + + + + + pslog + + Reports current logs path of a process + + pslog + + + + + + pstree + + Displays running processes as a tree + + pstree + + + + + + pstree.x11 + + Same as pstree, except that it waits for + confirmation before exiting + + pstree.x11 + + + + + + + + +
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/chapter08/readline.xml b/chapter08/readline.xml new file mode 100644 index 000000000..87571ea9d --- /dev/null +++ b/chapter08/readline.xml @@ -0,0 +1,156 @@ + + + %general-entities; +]> + + + + + + readline + &readline-version; +
&readline-url;
+
+ + Readline-&readline-version; + + + Readline + + + + + + <para>The Readline package is a set of libraries that offers command-line + editing and history capabilities.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&readline-ch6-sbu;</seg> + <seg>&readline-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Readline + + Reinstalling Readline will cause the old libraries to be moved to + <libraryname>.old. While this is normally not a problem, in some cases + it can trigger a linking bug in ldconfig. This can be + avoided by issuing the following two seds: + +sed -i '/MV.*old/d' Makefile.in +sed -i '/{OLDSUFF}/c:' support/shlib-install + + Prepare Readline for compilation: + +./configure --prefix=/usr \ + --disable-static \ + --with-curses \ + --docdir=/usr/share/doc/readline-&readline-version; + + + The meaning of the configure option: + + + --with-curses" + + This option tells Readline that it can find the termcap + library functions in the curses library, rather than a separate + termcap library. It allows generating a correct + readline.pc file. + + + + + + Compile the package: + +make SHLIB_LIBS="-lncursesw" + + + The meaning of the make option: + + + SHLIB_LIBS="-lncursesw" + + This option forces Readline to link against the + libncursesw library. + + + + + + This package does not come with a test suite. + + Install the package: + +make SHLIB_LIBS="-lncursesw" install + + Now move the dynamic libraries to a more appropriate location + and fix up some permissions and symbolic links: + +mv -v /usr/lib/lib{readline,history}.so.* /lib +chmod -v u+w /lib/lib{readline,history}.so.* +ln -sfv ../../lib/$(readlink /usr/lib/libreadline.so) /usr/lib/libreadline.so +ln -sfv ../../lib/$(readlink /usr/lib/libhistory.so ) /usr/lib/libhistory.so + + If desired, install the documentation: + +install -v -m644 doc/*.{ps,pdf,html,dvi} /usr/share/doc/readline-&readline-version; + + + + + Contents of Readline + + + Installed libraries + Installed directories + + + libhistory.so and libreadline.so + /usr/include/readline and + /usr/share/doc/readline-&readline-version; + + + + + Short Descriptions + + + + + libhistory + + Provides a consistent user interface for recalling lines + of history + + libhistory + + + + + + libreadline + + Provides a set of commands for manipulating text entered in an + interactive session of a program. + + libreadline + + + + + + + + +
diff --git a/chapter08/revisedchroot.xml b/chapter08/revisedchroot.xml new file mode 100644 index 000000000..0e836d661 --- /dev/null +++ b/chapter08/revisedchroot.xml @@ -0,0 +1,70 @@ + + + %general-entities; +]> + + + + + Cleaning Up + + Finally, clean up some extra files left around from running tests: + +rm -rf /tmp/* + + Now log out and reenter the chroot environment with an updated + chroot command. From now on, use this updated chroot command any time + you need to reenter the chroot environment after exiting: + +logout + +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 + + Here the +h option is not used anymore, since + all the previous programs have been replaced: hashing is therefore + possible. + + If the virtual kernel file systems have been unmounted, either manually + or through a reboot, ensure that the virtual kernel file systems are mounted + when reentering the chroot. This process was explained in and . + + There were several static libraries that were not suppressed earlier + in the chapter in order to satisfy the regression tests in several packages. These + libraries are from binutils, bzip2, e2fsprogs, flex, libtool, and zlib. If desired, + remove them now: + +rm -f /usr/lib/lib{bfd,opcodes}.a +rm -f /usr/lib/libctf{,-nobfd}.a +rm -f /usr/lib/libbz2.a +rm -f /usr/lib/lib{com_err,e2p,ext2fs,ss}.a +rm -f /usr/lib/libltdl.a +rm -f /usr/lib/libfl.a +rm -f /usr/lib/libz.a + + There are also several files installed in the /usr/lib and /usr/libexec + directories with a file name extention of .la. These are "libtool archive" + files. As already said, they 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. + To remove them, run: + +find /usr/lib /usr/libexec -name \*.la -delete + + For more information about libtool archive files, see the BLFS section "About Libtool + Archive (.la) files". + + Finally, remove the temporary 'tester' usr account created at the + beginning of this chapter. + +sed -i '/tester/d' /etc/passwd /etc/group +rm -rf /home/tester + 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/chapter08/shadow.xml b/chapter08/shadow.xml new file mode 100644 index 000000000..425112cbd --- /dev/null +++ b/chapter08/shadow.xml @@ -0,0 +1,608 @@ + + + %general-entities; +]> + + + + + + shadow + &shadow-version; +
&shadow-url;
+
+ + Shadow-&shadow-version; + + + Shadow + + + + + + <para>The Shadow package contains programs for handling passwords in a secure + way.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&shadow-ch6-sbu;</seg> + <seg>&shadow-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Shadow + + + If you would like to enforce the use of strong passwords, refer to + for installing + CrackLib prior to building Shadow. Then add + --with-libcrack to the configure + command below. + + + Disable the installation of the groups program + and its man pages, as Coreutils provides a better version. Also, + prevent the installation of manual pages that were already installed in + : + +sed -i 's/groups$(EXEEXT) //' src/Makefile.in +find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; +find man -name Makefile.in -exec sed -i 's/getspnam\.3 / /' {} \; +find man -name Makefile.in -exec sed -i 's/passwd\.5 / /' {} \; + + Instead of using the default + crypt method, use the more secure + SHA-512 method of password encryption, which also + allows passwords longer than 8 characters. It is also necessary to change + the obsolete /var/spool/mail location + for user mailboxes that Shadow uses by default to the /var/mail location used currently: + +sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \ + -e 's@/var/spool/mail@/var/mail@' etc/login.defs + + + If you chose to build Shadow with Cracklib support, run the following: + +sed -i 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' etc/login.defs + + + Make a minor change to make the first group number generated + by useradd 1000: + +sed -i 's/1000/999/' etc/useradd + + Prepare Shadow for compilation: + +touch /usr/bin/passwd +./configure --sysconfdir=/etc \ + --with-group-name-max-length=32 + + + The meaning of the configure option: + + + touch /usr/bin/passwd + + The file /usr/bin/passwd needs + to exist because its location is harcoded in some programs, and + the default location if it does not exist is not right. + + + + --with-group-name-max-length=32 + + The maximum user name is 32 characters. Make the maximum + group name the same. + + + + + + Compile the package: + +make + + This package does not come with a test suite. + + Install the package: + +make install + + + + + + + + Configuring Shadow + + + Shadow + configuring + + + This package contains utilities to add, modify, and delete users and + groups; set and change their passwords; and perform other administrative + tasks. For a full explanation of what password shadowing + means, see the doc/HOWTO file within the unpacked + source tree. If using Shadow support, keep in mind that programs which need + to verify passwords (display managers, FTP programs, pop3 daemons, etc.) + must be Shadow-compliant. That is, they need to be able to work with + shadowed passwords. + + To enable shadowed passwords, run the following command: + +pwconv + + To enable shadowed group passwords, run: + +grpconv + + Shadow's stock configuration for the useradd + utility has a few caveats that need some explanation. First, the default + action for the useradd utility is to create the user and + a group of the same name as the user. By default the user ID (UID) and + group ID (GID) numbers will begin with 1000. This means if you don't pass + parameters to useradd, each user will be a member of a + unique group on the system. If this behavior is undesirable, you'll need + to pass the -g parameter to + useradd. The default parameters are stored in the + /etc/default/useradd file. You may need to modify two + parameters in this file to suit your particular needs. + + + <filename>/etc/default/useradd</filename> Parameter Explanations + + + GROUP=1000 + + This parameter sets the beginning of the group numbers used in + the /etc/group file. You can modify it to anything you desire. Note + that useradd will never reuse a UID or GID. If the + number identified in this parameter is used, it will use the next + available number after this. Note also that if you don't have a group + 1000 on your system the first time you use useradd + without the -g parameter, you'll get a message + displayed on the terminal that says: + useradd: unknown GID 1000. You may + disregard this message and group number 1000 will be used. + + + + CREATE_MAIL_SPOOL=yes + + This parameter causes useradd to create a + mailbox file for the newly created user. useradd + will make the group ownership of this file to the + mail group with 0660 + permissions. If you would prefer that these mailbox files are not + created by useradd, issue the following + command: + +sed -i 's/yes/no/' /etc/default/useradd + + + + + + + + + + Setting the root password + + Choose a password for user root and set it + by running: + +passwd root + + + + + Contents of Shadow + + + Installed programs + Installed directory + + + chage, chfn, chgpasswd, chpasswd, chsh, expiry, faillog, gpasswd, + groupadd, groupdel, groupmems, groupmod, grpck, grpconv, grpunconv, + lastlog, login, logoutd, newgidmap, newgrp, newuidmap, newusers, + nologin, passwd, pwck, pwconv, pwunconv, sg (link to newgrp), su, + useradd, userdel, usermod, vigr (link to vipw), and vipw + /etc/default + + + + + Short Descriptions + + + + + chage + + Used to change the maximum number of days between obligatory + password changes + + chage + + + + + + chfn + + Used to change a user's full name and other information + + chfn + + + + + + chgpasswd + + Used to update group passwords in batch mode + + chgpasswd + + + + + + chpasswd + + Used to update user passwords in batch mode + + chpasswd + + + + + + chsh + + Used to change a user's default login shell + + chsh + + + + + + expiry + + Checks and enforces the current password expiration policy + + expiry + + + + + + faillog + + Is used to examine the log of login failures, to set a maximum + number of failures before an account is blocked, or to reset the + failure count + + faillog + + + + + + gpasswd + + Is used to add and delete members and administrators to + groups + + gpasswd + + + + + + groupadd + + Creates a group with the given name + + groupadd + + + + + + groupdel + + Deletes the group with the given name + + groupdel + + + + + + groupmems + + Allows a user to administer his/her own group membership list + without the requirement of super user privileges. + + groupmems + + + + + + groupmod + + Is used to modify the given group's name or GID + + groupmod + + + + + + grpck + + Verifies the integrity of the group files + /etc/group and + /etc/gshadow + + grpck + + + + + + grpconv + + Creates or updates the shadow group file from the normal + group file + + grpconv + + + + + + grpunconv + + Updates /etc/group from + /etc/gshadow and then deletes the latter + + grpunconv + + + + + + lastlog + + Reports the most recent login of all users or of a + given user + + lastlog + + + + + + login + + Is used by the system to let users sign on + + login + + + + + + logoutd + + Is a daemon used to enforce restrictions on log-on time + and ports + + logoutd + + + + + + newgidmap + + Is used to set the gid mapping of a user namespace + + newgidmap + + + + + + newgrp + + Is used to change the current GID during a login session + + newgrp + + + + + + newuidmap + + Is used to set the uid mapping of a user namespace + + newuidmap + + + + + + newusers + + Is used to create or update an entire series of user + accounts + + newusers + + + + + + nologin + + Displays a message that an account is not available; it is designed + to be used as the default shell for accounts that have been + disabled + + nologin + + + + + + passwd + + Is used to change the password for a user or group account + + passwd + + + + + + pwck + + Verifies the integrity of the password files + /etc/passwd and + /etc/shadow + + pwck + + + + + + pwconv + + Creates or updates the shadow password file from the normal + password file + + pwconv + + + + + + pwunconv + + Updates /etc/passwd from + /etc/shadow and then deletes the latter + + pwunconv + + + + + + sg + + Executes a given command while the user's GID + is set to that of the given group + + sg + + + + + + su + + Runs a shell with substitute user and group IDs + + su + + + + + + useradd + + Creates a new user with the given name, or updates the default + new-user information + + useradd + + + + + + userdel + + Deletes the given user account + + userdel + + + + + + usermod + + Is used to modify the given user's login name, User + Identification (UID), shell, initial group, home directory, etc. + + usermod + + + + + + vigr + + Edits the /etc/group or + /etc/gshadow files + + vigr + + + + + + vipw + + Edits the /etc/passwd or + /etc/shadow files + + vipw + + + + + + + + +
diff --git a/chapter08/strippingagain.xml b/chapter08/strippingagain.xml new file mode 100644 index 000000000..fb2a1b55f --- /dev/null +++ b/chapter08/strippingagain.xml @@ -0,0 +1,81 @@ + + + %general-entities; +]> + + + + + Stripping Again + + This section is optional. If the intended user is not a + programmer and does not plan to do + any debugging on the system software, the system size can be decreased + by about 90 MB by removing the debugging symbols from binaries and + libraries. This causes no inconvenience other than not being able to + debug the software fully anymore. + + Most people who use the commands mentioned below do not + experience any difficulties. However, it is easy to make a typo and + render the new system unusable, so before running the + strip commands, it is a good idea to make a + backup of the LFS system in its current state. + + First place the debugging symbols for selected libraries + in separate files. This debugging information is needed if running + regression tests that use valgrind or gdb later in BLFS. + + + + + +save_lib="ld-&glibc-version;.so libc-&glibc-version;.so libpthread-&glibc-version;.so libthread_db-&libthread_db-version;.so" + +cd /lib + +for LIB in $save_lib; do + objcopy --only-keep-debug $LIB $LIB.dbg + strip --strip-unneeded $LIB + objcopy --add-gnu-debuglink=$LIB.dbg $LIB +done + +save_usrlib="libquadmath.so.&libquadmath-version; libstdc++.so.&libstdcpp-version; + libitm.so.&libitm-version; libatomic.so.&libatomic-version;" + +cd /usr/lib + +for LIB in $save_usrlib; do + objcopy --only-keep-debug $LIB $LIB.dbg + strip --strip-unneeded $LIB + objcopy --add-gnu-debuglink=$LIB.dbg $LIB +done + +unset LIB save_lib save_usrlib + + + Now the binaries and libraries can be stripped: +find /usr/lib -type f -name \*.a \ + -exec strip --strip-debug {} ';' + +find /lib /usr/lib -type f -name \*.so* ! -name \*dbg \ + -exec strip --strip-unneeded {} ';' + +find /{bin,sbin} /usr/{bin,sbin,libexec} -type f \ + -exec strip --strip-all {} ';' + + A large number of files will be reported as having their file + format not recognized. These warnings can be safely ignored. These + warnings indicate that those files are scripts instead of + binaries. + + diff --git a/chapter08/sysklogd.xml b/chapter08/sysklogd.xml new file mode 100644 index 000000000..e96980cb4 --- /dev/null +++ b/chapter08/sysklogd.xml @@ -0,0 +1,136 @@ + + + %general-entities; +]> + + + + + + sysklogd + &sysklogd-version; +
&sysklogd-url;
+
+ + Sysklogd-&sysklogd-version; + + + Sysklogd + + + + + + <para>The Sysklogd package contains programs for logging system messages, + such as those given by the kernel when unusual things happen.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&sysklogd-ch6-sbu;</seg> + <seg>&sysklogd-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Sysklogd + + First, fix problems that causes a segmentation fault under + some conditions in klogd and fix an obsolete program construct: + +sed -i '/Error loading kernel symbols/{n;n;d}' ksym_mod.c +sed -i 's/union wait/int/' syslogd.c + + Compile the package: + +make + + This package does not come with a test suite. + + Install the package: + +make BINDIR=/sbin install + + + + + Configuring Sysklogd + + + Sysklogd + configuring + + + + /etc/syslog.conf + + + Create a new /etc/syslog.conf file by running the + following: + +cat > /etc/syslog.conf << "EOF" +# Begin /etc/syslog.conf + +auth,authpriv.* -/var/log/auth.log +*.*;auth,authpriv.none -/var/log/sys.log +daemon.* -/var/log/daemon.log +kern.* -/var/log/kern.log +mail.* -/var/log/mail.log +user.* -/var/log/user.log +*.emerg * + +# End /etc/syslog.conf +EOF + + + + + Contents of Sysklogd + + + Installed programs + + + klogd and syslogd + + + + + Short Descriptions + + + + + klogd + + A system daemon for intercepting and logging kernel messages + + klogd + + + + + + syslogd + + Logs the messages that system programs offer for logging [Every + logged message contains at least a date stamp and a hostname, and + normally the program's name too, but that depends on how trusting the + logging daemon is told to be.] + + syslogd + + + + + + + + +
diff --git a/chapter08/systemd.xml b/chapter08/systemd.xml new file mode 100644 index 000000000..2cf2d1d1b --- /dev/null +++ b/chapter08/systemd.xml @@ -0,0 +1,830 @@ + + + %general-entities; +]> + + + + + + systemd + &systemd-version; +
&systemd-url;
+
+ + Systemd-&systemd-version; + + + systemd + + + + + + <para>The systemd package contains programs for controlling the startup, + running, and shutdown of the system.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&systemd-ch6-sbu;</seg> + <seg>&systemd-ch6-du;</seg> + </seglistitem> + </segmentedlist> + </sect2> + + <sect2 role="installation"> + <title>Installation of systemd + + First, apply a patch to fix the build with GCC-10: + +patch -Np1 -i ../systemd-&systemd-version;-gcc_10-fixes-1.patch + + + Create a symlink to work around missing xsltproc: + +ln -sf /bin/true /usr/bin/xsltproc + + Set up the man pages: + +tar -xf ../systemd-man-pages-&systemd-version;.tar.xz + + Remove tests that cannot be built in chroot: + +sed '179,$ d' -i src/resolve/meson.build + + Remove an unneeded group, + render, from the default udev + rules: + +sed -i 's/GROUP="render", //' rules.d/50-udev-default.rules.in + + Prepare systemd for compilation: + +mkdir -p build +cd build + +LANG=en_US.UTF-8 \ +meson --prefix=/usr \ + --sysconfdir=/etc \ + --localstatedir=/var \ + -Dblkid=true \ + -Dbuildtype=release \ + -Ddefault-dnssec=no \ + -Dfirstboot=false \ + -Dinstall-tests=false \ + -Dkmod-path=/bin/kmod \ + -Dldconfig=false \ + -Dmount-path=/bin/mount \ + -Drootprefix= \ + -Drootlibdir=/lib \ + -Dsplit-usr=true \ + -Dsulogin-path=/sbin/sulogin \ + -Dsysusers=false \ + -Dumount-path=/bin/umount \ + -Db_lto=false \ + -Drpmmacrosdir=no \ + -Dhomed=false \ + -Duserdb=false \ + -Dman=true \ + .. + + + The meaning of the meson options: + + + + + -D*-path=* + + These switches provide location of binaries needed by + systemd at runtime that have not yet been installed. + + + + + -Ddefault-dnssec=no + + This switch turns off the experimental DNSSEC support. + + + + + -Dfirstboot=false + + This switch prevents installation of systemd + services responsible for setting up the system for + the first time. They are not useful for LFS because + everything is done manually. + + + + + -Dinstall-tests=false + + This switch prevents installation of the compiled tests. + + + + + -Dldconfig=false + + This switch prevents installation of a systemd unit that runs + ldconfig at boot, which is not useful for source + distributions such as LFS and makes the boot time longer. Remove it + if the described feature is desired. + + + + + -Droot* + + These switches ensure that core programs and + shared libraries are installed in the subdirectories + of the root partition. + + + + + -Dsplit-usr=true + + This switch ensures that systemd will work on + systems where /bin, /lib and /sbin directories are not + symlinks to their /usr counterparts. + + + + + -Dsysusers=false + + This switch prevents installation of systemd + services responsible for setting up the + /etc/group and + /etc/passwd files. Both files + were created earlier in this chapter. + + + + + -Drpmmacrosdir=no + + This switch disables installation of RPM Macros + for use with systemd because LFS does not support RPM. + + + + + -D{userdb,homed}=false + + Remove two daemons that have dependencies that do not fit + the scope of LFS. + + + + + + Compile the package: + +LANG=en_US.UTF-8 ninja + + Install the package: + +LANG=en_US.UTF-8 ninja install + + Remove an unnecessary symbolic link: + +rm -f /usr/bin/xsltproc + + Create the /etc/machine-id file needed by + systemd-journald: + +systemd-machine-id-setup + + Setup the basic target structure: + +systemctl preset-all + + Disable a service that is known to cause problems with systems that + use a network configuration other than what is provided by + systemd-networkd: + + +systemctl disable systemd-time-wait-sync.service + + Prevent systemd from resetting the maximum PID value which causes + some problems with packages and units in BLFS: + + +rm -f /usr/lib/sysctl.d/50-pid-max.conf + + + + + + Contents of systemd + + + Installed programs + Installed libraries + Installed directories + + + bootctl, busctl, coredumpctl, halt (symlink to systemctl), + hostnamectl, init, journalctl, kernel-install, localectl, loginctl, + machinectl, networkctl, portablectl, poweroff (symlink to + systemctl), reboot (symlink to systemctl), resolvconf (symlink to + resolvectl), resolvectl, runlevel (symlink to systemctl), shutdown + (symlink to systemctl), systemctl, systemd-analyze, + systemd-ask-password, systemd-cat, systemd-cgls, systemd-cgtop, + systemd-delta, systemd-detect-virt, systemd-escape, systemd-hwdb, + systemd-id128, systemd-inhibit, systemd-machine-id-setup, + systemd-mount, systemd-notify, systemd-nspawn, systemd-path, + systemd-repart, systemd-resolve (symlink to resolvectl), systemd-run, + systemd-socket-activate, systemd-stdio-bridge, systemd-tmpfiles, + systemd-tty-ask-password-agent, systemd-umount (symlink to + systemd-mount), telinit (symlink to systemctl), timedatectl, and + udevadm + libnss_myhostname.so.2, libnss_mymachines.so.2, + libnss_resolve.so.2, libnss_systemd.so.2, + libsystemd.so, libsystemd-shared-&systemd-version;.so (in /lib/systemd), + and libudev.so + /etc/binfmt.d, /etc/init.d, /etc/kernel, /etc/modules-load.d, + /etc/sysctl.d, /etc/systemd, /etc/tmpfiles.d, /etc/udev, + /etc/xdg/systemd, /lib/systemd, /lib/udev, /usr/include/systemd, + /usr/lib/binfmt.d, /usr/lib/kernel, /usr/lib/modules-load.d, + /usr/lib/sysctl.d, /usr/lib/systemd, /usr/lib/tmpfiles.d, + /usr/share/doc/systemd-&systemd-version;, /usr/share/factory, + /usr/share/systemd, /var/lib/systemd, and /var/log/journal + + + + + Short Descriptions + + + + + bootctl + + Used to query the firmware and boot manager settings + + bootctl + + + + + + busctl + + Used to introspect and monitor the D-Bus bus + + busctl + + + + + + coredumpctl + + Used to retrieve coredumps from the systemd journal + + coredumpctl + + + + + + halt + + Normally invokes shutdown with the + -h option, except when already in run-level 0, + then it tells the kernel to halt the system; it notes in the + file /var/log/wtmp that the system is being + brought down + + halt + + + + + + hostnamectl + + Used to query and change the system hostname and related + settings + + hostnamectl + + + + + + init + + The first process to be started when the kernel has initialized + the hardware which takes over the boot process and starts all + processes according to its configuration files + + init + + + + + + journalctl + + Used to query the contents of the systemd journal + + journalctl + + + + + + kernel-install + + Used to add and remove kernel and initramfs images to and + from /boot + + kernel-install + + + + + + localectl + + Used to query and change the system locale and keyboard layout + settings + + localectl + + + + + + loginctl + + Used to introspect and control the state of the systemd Login + Manager + + loginctl + + + + + + machinectl + + Used to introspect and control the state of the systemd Virtual + Machine and Container Registration Manager + + machinectl + + + + + + networkctl + + Used to introspect the state of the network links as seen by + systemd-networkd + + networkctl + + + + + + portablectl + + Used to attach or detach portable services from the local + system + + portablectl + + + + + + poweroff + + Tells the kernel to halt the system and switch off the computer + (see halt) + + poweroff + + + + + + reboot + + Tells the kernel to reboot the system (see + halt) + + reboot + + + + + + resolvconf + + Register DNS server and domain configuration with + systemd-resolved + + resolvconf + + + + + + resolvectl + + Send control commands to the network name resolution + manager, or resolve domain names, IPv4 and IPv6 addresses, + DNS records, and services. + + resolvectl + + + + + + runlevel + + Reports the previous and the current run-level, as noted in the + last run-level record in /var/run/utmp + + runlevel + + + + + + shutdown + + Brings the system down in a secure way, signaling all processes + and notifying all logged-in users + + shutdown + + + + + + systemctl + + Used to introspect and control the state of the systemd system + and service manager + + systemctl + + + + + + systemd-analyze + + Used to determine system boot-up performance of the current + boot + + systemd-analyze + + + + + + systemd-ask-password + + Used to query a system password or passphrase from the user, + using a question message specified on the command line + + systemd-ask-password + + + + + + systemd-cat + + Used to connect STDOUT and STDERR of a process with the Journal + + + systemd-cat + + + + + + systemd-cgls + + Recursively shows the contents of the selected Linux control + group hierarchy in a tree + + systemd-cgls + + + + + + systemd-cgtop + + Shows the top control groups of the local Linux control group + hierarchy, ordered by their CPU, memory and disk I/O load + + systemd-cgtop + + + + + + systemd-delta + + Used to identify and compare configuration files in + /etc that override default + counterparts in /usr + + systemd-delta + + + + + + systemd-detect-virt + + Detects execution in a virtualized environment + + systemd-detect-virt + + + + + + systemd-escape + + Used to escape strings for inclusion in systemd unit + names + + systemd-escape + + + + + + systemd-hwdb + + Used to manage hardware database (hwdb) + + systemd-hwdb + + + + + + systemd-id128 + + Generate and print id128 strings + + systemd-id128 + + + + + + systemd-inhibit + + Used to execute a program with a shutdown, sleep or idle + inhibitor lock taken + + systemd-inhibit + + + + + + systemd-machine-id-setup + + Used by system installer tools to initialize the machine ID + stored in /etc/machine-id at install time with a + randomly generated ID + + systemd-machine-id-setup + + + + + + systemd-mount + + A tool to temporarily mount or auto-mount a drive. + + systemd-mount + + + + + + systemd-notify + + Used by daemon scripts to notify the init system about status + changes + + systemd-notify + + + + + + systemd-nspawn + + Used to run a command or OS in a light-weight namespace + container + + systemd-nspawn + + + + + + systemd-path + + Used to query system and user paths + + systemd-path + + + + + + systemd-repart + + Used go grow and add partitions to a partition table when + systemd is used in an OS image (e.g. a container). + + systemd-repart + + + + + + systemd-resolve + + Used to resolve domain names, IPV4 and IPv6 addresses, DNS + resource records, and services + + systemd-resolve + + + + + + systemd-run + + Used to create and start a transient .service or a .scope unit + and run the specified command in it + + systemd-run + + + + + + + + systemd-socket-activate + + A tool to listen on socket devices and launch a process upon + connection. + + systemd-socket-activate + + + + + + systemd-tmpfiles + + Creates, deletes and cleans up volatile and temporary files and + directories, based on the configuration file format and location + specified in + tmpfiles.d directories + + systemd-tmpfiles + + + + + + systemd-umount + + Unmount mount points + + systemd-umount + + + + + + systemd-tty-ask-password-agent + + Used to list or process pending systemd password requests + + systemd-tty-ask-password-agent + + + + + + telinit + + Tells init which run-level to change + to + + telinit + + + + + + timedatectl + + Used to query and change the system clock and its settings + + + timedatectl + + + + + + udevadm + + Generic udev administration tool: controls the udevd daemon, + provides info from the Udev database, monitors uevents, waits for + uevents to finish, tests udev configuration, and triggers uevents + for a given device + + udevadm + + + + + + libsystemd + + The main systemd utility library + + libsystemd + + + + + + libudev + + A library to access Udev device information + + libudev + + + + + + + + +
diff --git a/chapter08/sysvinit.xml b/chapter08/sysvinit.xml new file mode 100644 index 000000000..0c171acf5 --- /dev/null +++ b/chapter08/sysvinit.xml @@ -0,0 +1,220 @@ + + + %general-entities; +]> + + + + + + sysvinit + &sysvinit-version; +
&sysvinit-url;
+
+ + Sysvinit-&sysvinit-version; + + + Sysvinit + + + + + + <para>The Sysvinit package contains programs for controlling the startup, + running, and shutdown of the system.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&sysvinit-ch6-sbu;</seg> + <seg>&sysvinit-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Sysvinit + + + First, apply a patch that removes several programs installed by other + packages, clarifies a message, and fixes a compiler warning: + +patch -Np1 -i ../&sysvinit-consolidated-patch; + + Compile the package: + +make + + This package does not come with a test suite. + + Install the package: + +make install + + + + + Contents of Sysvinit + + + Installed programs + + + bootlogd, fstab-decode, halt, init, killall5, + poweroff (link to halt), reboot (link to halt), runlevel, + shutdown, and telinit (link to init) + + + + + Short Descriptions + + + + + bootlogd + + Logs boot messages to a log file + + bootlogd + + + + + + fstab-decode + + Run a command with fstab-encoded arguments + + fstab-decode + + + + + + halt + + Normally invokes shutdown with the + -h option, except when already in run-level 0, + then it tells the kernel to halt the system; it notes in the + file /var/log/wtmp that the system is being + brought down + + halt + + + + + + init + + The first process to be started when the kernel has initialized + the hardware which takes over the boot process and starts all the + proceses specified in its configuration file + + init + + + + + + killall5 + + Sends a signal to all processes, except the processes in its own + session so it will not kill its parent shell + + killall5 + + + + + + poweroff + + Tells the kernel to halt the system and switch off the computer + (see halt) + + poweroff + + + + + + reboot + + Tells the kernel to reboot the system (see + halt) + + reboot + + + + + + runlevel + + Reports the previous and the current run-level, as noted in the + last run-level record in /var/run/utmp + + runlevel + + + + + + shutdown + + Brings the system down in a secure way, signaling all processes + and notifying all logged-in users + + shutdown + + + + + + telinit + + Tells init which run-level to change to + + telinit + + + + + + + + +
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/chapter08/vim.xml b/chapter08/vim.xml new file mode 100644 index 000000000..263122bd7 --- /dev/null +++ b/chapter08/vim.xml @@ -0,0 +1,319 @@ + + + %general-entities; +]> + + + + + + vim + &vim-version; +
&vim-url;
+
+ + Vim-&vim-version; + + + Vim + + + + + + <para>The Vim package contains a powerful text editor.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&vim-ch6-sbu;</seg> + <seg>&vim-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + <tip> + <title>Alternatives to Vim + + If you prefer another editor—such as Emacs, Joe, or + Nano—please refer to for suggested + installation instructions. + + + + + + Installation of Vim + + First, change the default location of the vimrc + configuration file to /etc: + +echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h + + + Prepare Vim for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To 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 -c "LANG=en_US.UTF-8 make -j1 test" &> vim-test.log + + + + The test suite outputs a lot of binary data to the screen. This can + cause issues with the settings of the current terminal. The problem can be + avoided by redirecting the output to a log file as shown above. A + successful test will result in the words "ALL DONE" in the log file + at completion. + + Install the package: + +make install + + Many users are used to using vi instead of + vim. To allow execution of vim + when users habitually enter vi, create a + symlink for both the binary and the man page in the provided + languages: + +ln -sv vim /usr/bin/vi +for L in /usr/share/man/{,*/}man1/vim.1; do + ln -sv vim.1 $(dirname $L)/vi.1 +done + + By default, Vim's documentation is installed in /usr/share/vim. The following symlink + allows the documentation to be accessed via /usr/share/doc/vim-&vim-version;, making + it consistent with the location of documentation for other packages: + +ln -sv ../&vim-docdir;/doc /usr/share/doc/vim-&vim-version; + + If an X Window System is going to be installed on the LFS + system, it may be necessary to recompile Vim after installing X. Vim + comes with a GUI version of the editor that requires X and some + additional libraries to be installed. For more information on this + process, refer to the Vim documentation and the Vim installation page + in the BLFS book at . + + + + + Configuring Vim + + + /etc/vimrc + + + By default, vim runs in vi-incompatible mode. + This may be new to users who have used other editors in the past. The + nocompatible setting is included below to highlight the + fact that a new behavior is being used. It also reminds those who would + change to compatible mode that it should be the first + setting in the configuration file. This is necessary because it changes + other settings, and overrides must come after this setting. Create a default + vim configuration file by running the following: + +cat > /etc/vimrc << "EOF" +" Begin /etc/vimrc + +" Ensure defaults are set before customizing settings, not after +source $VIMRUNTIME/defaults.vim +let skip_defaults_vim=1 + +set nocompatible +set backspace=2 +set mouse= +syntax on +if (&term == "xterm") || (&term == "putty") + set background=dark +endif + +" End /etc/vimrc +EOF + + The set nocompatible setting makes + vim behave in a more useful way (the default) than the + vi-compatible manner. Remove the no to keep the old + vi behavior. The set backspace=2 + setting allows backspacing over line breaks, autoindents, and the start of + insert. The syntax on parameter enables vim's syntax + highlighting. The set mouse= setting enables + proper pasting of text with the mouse when working in chroot or over a + remote connection. Finally, the if statement with the + set background=dark setting corrects + vim's guess about the background color of some terminal + emulators. This gives the highlighting a better color scheme for use on the + black background of these programs. + + Documentation for other available options can be obtained by + running the following command: + +vim -c ':options' + + + By default, Vim only installs spell files for the English language. + To install spell files for your preferred language, download the + *.spl and optionally, the *.sug + files for your language and character encoding from and save them to + /usr/share/&vim-docdir;/spell/. + + To use these spell files, some configuration in + /etc/vimrc is needed, e.g.: + +set spelllang=en,ru +set spell + + For more information, see the appropriate README file located + at the URL above. + + + + + + Contents of Vim + + + Installed programs + Installed directory + + + ex (link to vim), rview (link to vim), rvim (link to vim), vi + (link to vim), view (link to vim), vim, vimdiff (link to vim), vimtutor, + and xxd + /usr/share/vim + + + + + Short Descriptions + + + + + ex + + Starts vim in ex mode + + ex + + + + + + rview + + Is a restricted version of view; no shell + commands can be started and view cannot be + suspended + + rview + + + + + + rvim + + Is a restricted version of vim; no shell + commands can be started and vim cannot be + suspended + + rvim + + + + + + vi + + Link to vim + + vi + + + + + + view + + Starts vim in read-only mode + + view + + + + + + vim + + Is the editor + + vim + + + + + + vimdiff + + Edits two or three versions of a file with vim + and shows differences + + vimdiff + + + + + + vimtutor + + Teaches the basic keys and commands of + vim + + vimtutor + + + + + + xxd + + Creates a hex dump of the given file; it can + also do the reverse, so it can be used for binary patching + + xxd + + + + + + + + +
diff --git a/chapter08/xml-parser.xml b/chapter08/xml-parser.xml new file mode 100644 index 000000000..54d5bcb35 --- /dev/null +++ b/chapter08/xml-parser.xml @@ -0,0 +1,92 @@ + + + %general-entities; +]> + + + + + + xml-parser + &xml-parser-version; +
&xml-parser-url;
+
+ + XML::Parser-&xml-parser-version; + + + XML::Parser + + + + + + <para>The XML::Parser module is a Perl interface to James Clark's + XML parser, Expat.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&xml-parser-ch6-sbu;</seg> + <seg>&xml-parser-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of XML::Parser + + Prepare XML::Parser for compilation: + +perl Makefile.PL + + Compile the package: + +make + + To test the results, issue: + +make test + + Install the package: + +make install + + + + + Contents of XML::Parser + + + Installed module + + + Expat.so + + + + + Short Descriptions + + + + + Expat + + provides the Perl Expat interface + + Expat + + + + + + + + +
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/chapter08/zlib.xml b/chapter08/zlib.xml new file mode 100644 index 000000000..2dcc49413 --- /dev/null +++ b/chapter08/zlib.xml @@ -0,0 +1,101 @@ + + + %general-entities; +]> + + + + + + zlib + &zlib-version; +
&zlib-url;
+
+ + Zlib-&zlib-version; + + + Zlib + + + + + + <para>The Zlib package contains compression and decompression routines used by + some programs.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&zlib-ch6-sbu;</seg> + <seg>&zlib-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Zlib + + Prepare Zlib for compilation: + +./configure --prefix=/usr + + Compile the package: + +make + + To test the results, issue: + +make check + + Install the package: + +make install + + The shared library needs to be moved to + /lib, and as a result the + .so file in + /usr/lib will need to be recreated: + +mv -v /usr/lib/libz.so.* /lib +ln -sfv ../../lib/$(readlink /usr/lib/libz.so) /usr/lib/libz.so + + + + + Contents of Zlib + + + Installed libraries + + + libz.{a,so} + + + + + Short Descriptions + + + + + libz + + Contains compression and decompression functions used by + some programs + + libz + + + + + + + + +
diff --git a/chapter08/zstd.xml b/chapter08/zstd.xml new file mode 100644 index 000000000..71e7794b6 --- /dev/null +++ b/chapter08/zstd.xml @@ -0,0 +1,136 @@ + + + %general-entities; +]> + + + + + + zstd + &zstd-version; +
&zstd-url;
+
+ + Zstd-&zstd-version; + + + zstd + + + + + + <para>Zstandard is a real-time compression algorithm, providing high + compression ratios. It offers a very wide range of compression / speed + trade-offs, while being backed by a very fast decoder.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&zstd-ch6-sbu;</seg> + <seg>&zstd-ch6-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of Zstd + + Compile the package: + +make + + This package does not come with a test suite. + + Install the package: + +make prefix=/usr install + + Remove the static library and move the shared library to + /lib. Also, the + .so file in + /usr/lib will need to be recreated: + +rm -v /usr/lib/libzstd.a +mv -v /usr/lib/libzstd.so.* /lib +ln -sfv ../../lib/$(readlink /usr/lib/libzstd.so) /usr/lib/libzstd.so + + + + + Contents of Zstd + + + Installed programs + Installed library + + + zstd, + zstdcat (link to zstd), + zstdgrep, + zstdless, + zstdmt (link to zstd), and + unzstd (link to zstd) + + + libzstd.so + + + + + Short Descriptions + + + + + zstd + + Compresses or decompresses files using the ZSTD format + + zstd + + + + + + zstdgrep + + Runs grep on ZSTD compressed files + + zstdgrep + + + + + + zstdless + + Runs less on ZSTD compressed files + + zstdless + + + + + + libzstd + + The library implementing lossless data + compression, using the ZSTD algorithm + + libzstd + + + + + + + + +
diff --git a/chapter09/bootscripts.xml b/chapter09/bootscripts.xml new file mode 100644 index 000000000..5c2b28d7c --- /dev/null +++ b/chapter09/bootscripts.xml @@ -0,0 +1,331 @@ + + + %general-entities; +]> + + + + + + bootscripts + &lfs-bootscripts-version; +
&lfs-bootscripts-url;
+
+ + LFS-Bootscripts-&lfs-bootscripts-version; + + + Bootscripts + + + + + + <para>The LFS-Bootscripts package contains a set of scripts to start/stop + the LFS system at bootup/shutdown. + The configuration files and procedures needed to + customize the boot process are described in the following sections.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&lfs-bootscripts-ch7-sbu;</seg> + <seg>&lfs-bootscripts-ch7-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of LFS-Bootscripts + + Install the package: + +make install + + + + + Contents of LFS-Bootscripts + + Installed scripts + Installed directories + + + checkfs, cleanfs, console, functions, halt, ifdown, + ifup, localnet, modules, mountfs, mountvirtfs, network, rc, reboot, + sendsignals, setclock, ipv4-static, swap, sysctl, sysklogd, template, + udev, and udev_retry + /etc/rc.d, /etc/init.d (symbolic link), /etc/sysconfig, + /lib/services, /lib/lsb (symbolic link) + + + + + Short Descriptions + + + + + checkfs + + Checks the integrity of the file systems before they are mounted + (with the exception of journal and network based file systems) + + checkfs + + + + + + cleanfs + + Removes files that should not be preserved between reboots, such + as those in /var/run/ and + /var/lock/; it re-creates + /var/run/utmp and removes the possibly present + /etc/nologin, /fastboot, and + /forcefsck files + + cleanfs + + + + + + console + + Loads the correct keymap table for the desired keyboard layout; + it also sets the screen font + + console + + + + + + functions + + Contains common functions, such as error and status checking, + that are used by several bootscripts + + functions + + + + + + halt + + Halts the system + + halt + + + + + + ifdown + + Stops a network device + + ifdown + + + + + + ifup + + Initializes a network device + + ifup + + + + + + localnet + + Sets up the system's hostname and local loopback device + + localnet + + + + + + modules + + Loads kernel modules listed in + /etc/sysconfig/modules, using arguments + that are also given there + + modules + + + + + + mountfs + + Mounts all file systems, except ones that are marked + noauto or are network based + + mountfs + + + + + + mountvirtfs + + Mounts virtual kernel file systems, such as proc + + mountvirtfs + + + + + + network + + Sets up network interfaces, such as network cards, and sets up + the default gateway (where applicable) + + network + + + + + + rc + + The master run-level control script; it is responsible for + running all the other bootscripts one-by-one, in a sequence determined + by the name of the symbolic links being processed + + rc + + + + + + reboot + + Reboots the system + + reboot + + + + + + sendsignals + + Makes sure every process is terminated before the system reboots + or halts + + sendsignals + + + + + + setclock + + Resets the kernel clock to local time in case the hardware clock + is not set to UTC time + + setclock + + + + + + ipv4-static + + Provides the functionality needed to assign a static Internet + Protocol (IP) address to a network interface + + ipv4-static + + + + + + swap + + Enables and disables swap files and partitions + + swap + + + + + + sysctl + + Loads system configuration values from + /etc/sysctl.conf, if that file exists, + into the running kernel + + sysctl + + + + + + sysklogd + + Starts and stops the system and kernel log daemons + + sysklogd + + + + + + template + + A template to create custom bootscripts for other + daemons + + template + + + + + + udev + + Prepares the /dev + directory and starts Udev + + udev + + + + + + udev_retry + + Retries failed udev uevents, and copies generated rules + files from /run/udev to + /etc/udev/rules.d if required + + udev_retry + + + + + + + + +
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/chapter09/clock.xml b/chapter09/clock.xml new file mode 100644 index 000000000..872ba677c --- /dev/null +++ b/chapter09/clock.xml @@ -0,0 +1,104 @@ + + + %general-entities; +]> + + + + + Configuring the system clock + + + clock + configuring + + This section discusses how to configure the + systemd-timedated system service, which configures + system clock and timezone. + + If you cannot remember whether or not the hardware clock is set to UTC, + find out by running the hwclock --localtime --show + command. This will display what the current time is according to the hardware + clock. If this time matches whatever your watch says, then the hardware clock is + set to local time. If the output from hwclock is not local + time, chances are it is set to UTC time. Verify this by adding or subtracting + the proper amount of hours for the timezone to the time shown by + hwclock. For example, if you are currently in the MST + timezone, which is also known as GMT -0700, add seven hours to the local + time. + + systemd-timedated reads /etc/adjtime, + and depending on the contents of the file, it sets the clock to either UTC or + local time. + + Create the /etc/adjtime file with the following contents + if your hardware clock is set to local time: + +cat > /etc/adjtime << "EOF" +0.0 0 0.0 +0 +LOCAL +EOF + + If /etc/adjtime isn't present at first boot, + systemd-timedated will assume that hardware clock is + set to UTC and adjust the file according to that. + + You can also use the timedatectl utility to tell + systemd-timedated if your hardware clock is set to + UTC or local time: + +timedatectl set-local-rtc 1 + + timedatectl can also be used to change system time and + time zone. + + To change your current system time, issue: + +timedatectl set-time YYYY-MM-DD HH:MM:SS + + Hardware clock will also be updated accordingly. + + To change your current time zone, issue: + +timedatectl set-timezone TIMEZONE + + You can get a list of available time zones by running: + +timedatectl list-timezones + + Please note that the timedatectl command can + be used only on a system booted with systemd. + + + Network Time Synchronization + + Starting with version 213, systemd ships a daemon called + systemd-timesyncd which can be used to + synchronize the system time with remote NTP servers. + + The daemon is not intended as a replacement for the well + established NTP daemon, but as a client only implementation + of the SNTP protocol which can be used for less advanced + tasks and on resource limited systems. + + Starting with systemd version 216, the + systemd-timesyncd daemon is enabled by + default. If you want to disable it, issue the following + command: + +systemctl disable systemd-timesyncd + + The /etc/systemd/timesyncd.conf file + can be used to change the NTP servers that + systemd-timesyncd synchronizes with. + + Please note that when system clock is set to Local Time, + systemd-timesyncd won't update hardware + clock. + + + + diff --git a/chapter09/consoled.xml b/chapter09/consoled.xml new file mode 100644 index 000000000..bf1fdc8e0 --- /dev/null +++ b/chapter09/consoled.xml @@ -0,0 +1,139 @@ + + + %general-entities; +]> + + + + + Configuring the Linux Console + + + console + configuring + + + This section discusses how to configure the + systemd-vconsole-setup system service, which configures + the virtual console font and console keymap. + + The systemd-vconsole-setup service reads the + /etc/vconsole.conf file for configuration + information. Decide which keymap and screen font will be used. Various + language-specific HOWTOs can also help with this, see . + Examine localectl list-keymaps output for a list of + valid console keymaps. Look in + /usr/share/consolefonts + directory for valid screen fonts. + + The /etc/vconsole.conf file should contain lines + of the form: VARIABLE="value". The following variables are recognized: + + + + + KEYMAP + + This variable specifies the key mapping table for the keyboard. If + unset, it defaults to us. + + + + + KEYMAP_TOGGLE + + This variable can be used to configure a second toggle keymap and + is unset by default. + + + + + FONT + + This variable specifies the font used by the virtual + console. + + + + + FONT_MAP + + This variable specifies the console map to be used. + + + + + FONT_UNIMAP + + This variable specifies the Unicode font map. + + + + + + An example for a German keyboard and console is given below: + +cat > /etc/vconsole.conf << "EOF" +KEYMAP=de-latin1 +FONT=Lat2-Terminus16 +EOF + + You can change KEYMAP value at runtime by using the + localectl utility: + +localectl set-keymap MAP + + Please note that the localectl command can + be used only on a system booted with systemd. + + You can also use localectl utility with the + corresponding parameters to change X11 keyboard layout, model, variant + and options: + +localectl set-x11-keymap LAYOUT [MODEL] [VARIANT] [OPTIONS] + + To list possible values for localectl set-x11-keymap + parameters, run localectl with parameters listed below: + + + + + + list-x11-keymap-models + + Show known X11 keyboard mapping models. + + + + + list-x11-keymap-layouts + + Show known X11 keyboard mapping layouts. + + + + + list-x11-keymap-variants + + Show known X11 keyboard mapping variants. + + + + + list-x11-keymap-options + + Show known X11 keyboard mapping options. + + + + + + Using any of the parameters listed above requires the + XKeyboard Config package from BLFS. + + diff --git a/chapter09/etcshells.xml b/chapter09/etcshells.xml new file mode 100644 index 000000000..30961c80c --- /dev/null +++ b/chapter09/etcshells.xml @@ -0,0 +1,49 @@ + + + %general-entities; +]> + + + + + + Creating the /etc/shells File + + + /etc/shells + + + The shells file contains a list of + login shells on the system. Applications use this file to determine + whether a shell is valid. For each shell a single line should be + present, consisting of the shell's path, relative to the root of the + directory structure (/). + + For example, this file is consulted by chsh + to determine whether an unprivileged user may change the login shell for her + own account. If the command name is not listed, the user will be denied of + change. + + It is a requirement for applications such as + GDM which does not populate the + face browser if it can't find /etc/shells, or + FTP daemons which traditionally disallow access to users + with shells not included in this file. + +cat > /etc/shells << "EOF" +# Begin /etc/shells + +/bin/sh +/bin/bash + +# End /etc/shells +EOF + + diff --git a/chapter09/getcounted.xml b/chapter09/getcounted.xml deleted file mode 100644 index bc0ad8908..000000000 --- a/chapter09/getcounted.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - %general-entities; -]> - - - - - Get Counted - - Now that you have finished the book, do you want to be counted as an - LFS user? Head over to and - register as an LFS user by entering your name and the first LFS version you - have used. - - Let's reboot into LFS now. - - diff --git a/chapter09/inputrc.xml b/chapter09/inputrc.xml new file mode 100644 index 000000000..00d36877f --- /dev/null +++ b/chapter09/inputrc.xml @@ -0,0 +1,82 @@ + + + %general-entities; +]> + + + + + Creating the /etc/inputrc File + + + /etc/inputrc + + + The inputrc file is the configuration file for + the Readline library, which provides editing capabilities while the user is + entering a line from the terminal. It works by translating keyboard inputs + into specific actions. Readline is used by Bash and most other shells as + well as many other applications. + + Most people do not need user-specific functionality so the command + below creates a global /etc/inputrc used by everyone who + logs in. If you later decide you need to override the defaults on a per-user + basis, you can create a .inputrc file in the user's home + directory with the modified mappings. + + For more information on how to edit the inputrc + file, see info bash under the Readline Init + File section. info readline is also a good + source of information. + + Below is a generic global inputrc along with comments + to explain what the various options do. Note that comments cannot be on the same + line as commands. Create the file using the following command: + +cat > /etc/inputrc << "EOF" +# Begin /etc/inputrc +# Modified by Chris Lynn <roryo@roryo.dynup.net> + +# Allow the command prompt to wrap to the next line +set horizontal-scroll-mode Off + +# Enable 8bit input +set meta-flag On +set input-meta On + +# Turns off 8th bit stripping +set convert-meta Off + +# Keep the 8th bit for display +set output-meta On + +# none, visible or audible +set bell-style none + +# All of the following map the escape sequence of the value +# contained in the 1st argument to the readline specific functions +"\eOd": backward-word +"\eOc": forward-word + +# for linux console +"\e[1~": beginning-of-line +"\e[4~": end-of-line +"\e[5~": beginning-of-history +"\e[6~": end-of-history +"\e[3~": delete-char +"\e[2~": quoted-insert + +# for xterm +"\eOH": beginning-of-line +"\eOF": end-of-line + +# for Konsole +"\e[H": beginning-of-line +"\e[F": end-of-line + +# End /etc/inputrc +EOF + + 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/chapter09/introductiond.xml b/chapter09/introductiond.xml new file mode 100644 index 000000000..fa2403edb --- /dev/null +++ b/chapter09/introductiond.xml @@ -0,0 +1,73 @@ + + + %general-entities; +]> + + + + + Introduction + + This chapter discusses configuration files and systemd services. + First, the general configuration files needed to set up networking are + presented. + + + + + + + + + + + + + + Second, issues that affect the proper setup of devices are + discussed. + + + + + + + + + + + Third, configuring the system clock and keyboard layout. + + + + + + + + + + + + Fourth, a brief introduction to the scripts and configuration + files used when the user logs into the system. + + + + + + + + + + + And finally, configuring the systemd behavior. + + + + + + + + diff --git a/chapter09/locale.xml b/chapter09/locale.xml new file mode 100644 index 000000000..5f473ac72 --- /dev/null +++ b/chapter09/locale.xml @@ -0,0 +1,152 @@ + + + %general-entities; +]> + + + + + Configuring the System Locale + + + /etc/locale.conf + + + The /etc/locale.conf below sets some + environment variables necessary for native language support. Setting + them properly results in: + + + + The output of programs translated into the native language + + + Correct classification of characters into letters, digits and other + classes. This is necessary for bash to properly accept + non-ASCII characters in command lines in non-English locales + + + The correct alphabetical sorting order for the country + + + Appropriate default paper size + + + Correct formatting of monetary, time, and date values + + + + Replace <ll> below with the two-letter code + for the desired language (e.g., en) and + <CC> with the two-letter code for the appropriate + country (e.g., GB). <charmap> should + be replaced with the canonical charmap for your chosen locale. Optional + modifiers such as @euro may also be present. + + The list of all locales supported by Glibc can be obtained by running + the following command: + +locale -a + + Charmaps can have a number of aliases, e.g., ISO-8859-1 + is also referred to as iso8859-1 and iso88591. + Some applications cannot handle the various synonyms correctly (e.g., require + that UTF-8 is written as UTF-8, not + utf8), so it is safest in most + cases to choose the canonical name for a particular locale. To determine + the canonical name, run the following command, where <locale + name> is the output given by locale -a for + your preferred locale (en_GB.iso88591 in our example). + +LC_ALL=<locale name> locale charmap + + For the en_GB.iso88591 locale, the above command + will print: + +ISO-8859-1 + + This results in a final locale setting of en_GB.ISO-8859-1. + It is important that the locale found using the heuristic above is tested prior + to it being added to the Bash startup files: + +LC_ALL=<locale name> locale language +LC_ALL=<locale name> locale charmap +LC_ALL=<locale name> locale int_curr_symbol +LC_ALL=<locale name> locale int_prefix + + The above commands should print the language name, the character + encoding used by the locale, the local currency, and the prefix to dial + before the telephone number in order to get into the country. If any of the + commands above fail with a message similar to the one shown below, this means + that your locale was either not installed in Chapter 6 or is not supported by + the default installation of Glibc. + +locale: Cannot set LC_* to default locale: No such file or directory + + If this happens, you should either install the desired locale using the + localedef command, or consider choosing a different locale. + Further instructions assume that there are no such error messages from + Glibc. + + + Some packages beyond LFS may also lack support for your chosen locale. One + example is the X library (part of the X Window System), which outputs the + following error message if the locale does not exactly match one of the character + map names in its internal files: + +Warning: locale not supported by Xlib, locale set to C + + In several cases Xlib expects that the character map will be listed in + uppercase notation with canonical dashes. For instance, "ISO-8859-1" rather + than "iso88591". It is also possible to find an appropriate specification by + removing the charmap part of the locale specification. This can be checked + by running the locale charmap command in both locales. + For example, one would have to change "de_DE.ISO-8859-15@euro" to + "de_DE@euro" in order to get this locale recognized by Xlib. + + Other packages can also function incorrectly (but may not necessarily + display any error messages) if the locale name does not meet their expectations. + In those cases, investigating how other Linux distributions support your locale + might provide some useful information. + + Once the proper locale settings have been determined, create the + /etc/locale.conf file: + +cat > /etc/locale.conf << "EOF" +LANG=<ll>_<CC>.<charmap><@modifiers> +EOF + + Note that you can modify /etc/locale.conf with the + systemd localectl utility. To use + localectl for the example above, run: + +localectl set-locale LANG="<ll>_<CC>.<charmap><@modifiers>" + + You can also specify other language specific environment variables such + as LANG, LC_CTYPE, LC_NUMERIC or + any other environment variable from locale output. Just + separate them with a space. An example where LANG is set as + en_US.UTF-8 but LC_CTYPE is set as just en_US is: + +localectl set-locale LANG="en_US.UTF-8" LC_CTYPE="en_US" + + Please note that the localectl command can + be used only on a system booted with systemd. + + The C (default) and en_US (the recommended + one for United States English users) locales are different. C + uses the US-ASCII 7-bit character set, and treats bytes with the high bit set + as invalid characters. That's why, e.g., the ls command + substitutes them with question marks in that locale. Also, an attempt to send + mail with such characters from Mutt or Pine results in non-RFC-conforming + messages being sent (the charset in the outgoing mail is indicated as unknown + 8-bit). So you can use the C locale only if you are sure that + you will never need 8-bit characters. + + UTF-8 based locales are not supported well by many programs. + Work is in progress to document and, if possible, fix such problems, see + . + + diff --git a/chapter09/network.xml b/chapter09/network.xml new file mode 100644 index 000000000..b527258ee --- /dev/null +++ b/chapter09/network.xml @@ -0,0 +1,247 @@ + + + %general-entities; +]> + + + + + General Network Configuration + + + network + configuring + + + Creating Network Interface Configuration Files + + Which interfaces are brought up and down by the network script + usually depends on the files in /etc/sysconfig/. This directory should + contain a file for each interface to be configured, such as + ifconfig.xyz, where xyz should describe + the network card. The interface name (e.g. eth0) is usually appropriate. + Inside this file are attributes to this interface, such as its IP + address(es), subnet masks, and so forth. It is necessary that the stem of + the filename be ifconfig. + + If the procedure in the previous section was not used, Udev + will assign network card interface names based on system physical + characteristics such as enp2s1. If you are not sure what your interface + name is, you can always run ip link or ls + /sys/class/net after you have booted your system. + + + The following command creates a sample file for the + eth0 device with a static IP address: + +cd /etc/sysconfig/ +cat > ifconfig.eth0 << "EOF" +ONBOOT=yes +IFACE=eth0 +SERVICE=ipv4-static +IP=192.168.1.2 +GATEWAY=192.168.1.1 +PREFIX=24 +BROADCAST=192.168.1.255 +EOF + + The values in italics must be changed in every file to match + the proper setup. + + If the ONBOOT variable is set to yes the + System V network script will bring up the Network Interface Card (NIC) during + booting of the system. If set to anything but yes the NIC + will be ignored by the network script and not be automatically brought up. + The interface can be manually started or stopped with the + ifup and ifdown commands. + + The IFACE variable defines the interface name, + for example, eth0. It is required for all network device configuration + files. The filename extension must match this value. + + The SERVICE variable defines the method used for + obtaining the IP address. The LFS-Bootscripts package has a modular IP + assignment format, and creating additional files in the /lib/services/ directory allows other IP + assignment methods. This is commonly used for Dynamic Host Configuration + Protocol (DHCP), which is addressed in the BLFS book. + + The GATEWAY variable should contain the default + gateway IP address, if one is present. If not, then comment out the + variable entirely. + + The PREFIX variable contains the number of + bits used in the subnet. Each octet in an IP address is 8 bits. If the + subnet's netmask is 255.255.255.0, then it is using the first three octets + (24 bits) to specify the network number. If the netmask is 255.255.255.240, + it would be using the first 28 bits. Prefixes longer than 24 bits are + commonly used by DSL and cable-based Internet Service Providers (ISPs). + In this example (PREFIX=24), the netmask is 255.255.255.0. Adjust the + PREFIX variable according to your specific subnet. + If omitted, the PREFIX defaults to 24. + + For more information see the ifup man page. + + + + Creating the /etc/resolv.conf File + + + /etc/resolv.conf + + + The system will need some means of obtaining Domain Name Service + (DNS) name resolution to resolve Internet domain names to IP addresses, and + vice versa. This is best achieved by placing the IP address of the DNS + server, available from the ISP or network administrator, into + /etc/resolv.conf. Create the file by running the + following: + +cat > /etc/resolv.conf << "EOF" +# Begin /etc/resolv.conf + +domain <Your Domain Name> +nameserver <IP address of your primary nameserver> +nameserver <IP address of your secondary nameserver> + +# End /etc/resolv.conf +EOF + + The domain statement can be omitted + or replaced with a search statement. See the man page for + resolv.conf for more details. + + Replace <IP address of the nameserver> + with the IP address of the DNS most appropriate for the setup. There will + often be more than one entry (requirements demand secondary servers for + fallback capability). If you only need or want one DNS server, remove the + second nameserver line from the file. The IP address + may also be a router on the local network. + + + The Google Public IPv4 DNS addresses are 8.8.8.8 and 8.8.4.4. + + + + + + Configuring the system hostname + + + hostname + configuring + + + During the boot process, the file /etc/hostname + is used for establishing the system's hostname. + + Create the /etc/hostname file and enter a + hostname by running: + +echo "<lfs>" > /etc/hostname + + <lfs> needs to be replaced with the + name given to the computer. Do not enter the Fully Qualified Domain Name + (FQDN) here. That information is put in the + /etc/hosts file. + + + + + Customizing the /etc/hosts File + + + /etc/hosts + + + + localnet + /etc/hosts + + + + network + /etc/hosts + + + Decide on the IP address, fully-qualified domain name (FQDN), and + possible aliases for use in the /etc/hosts file. The + syntax is: + +IP_address myhost.example.org aliases + + Unless the computer is to be visible to the Internet (i.e., there is + a registered domain and a valid block of assigned IP addresses—most + users do not have this), make sure that the IP address is in the private + network IP address range. Valid ranges are: + +Private Network Address Range Normal Prefix +10.0.0.1 - 10.255.255.254 8 +172.x.0.1 - 172.x.255.254 16 +192.168.y.1 - 192.168.y.254 24 + + x can be any number in the range 16-31. y can be any number in the + range 0-255. + + A valid private IP address could be 192.168.1.1. A valid FQDN for + this IP could be lfs.example.org. + + Even if not using a network card, a valid FQDN is still required. + This is necessary for certain programs to operate correctly. + + Create the /etc/hosts file by running: + +cat > /etc/hosts << "EOF" +# Begin /etc/hosts + +127.0.0.1 localhost.localdomain localhost +127.0.1.1 <FQDN> <HOSTNAME> +<192.168.1.1> <FQDN> <HOSTNAME> [alias1] [alias2 ...] +::1 localhost ip6-localhost ip6-loopback +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters + +# End /etc/hosts +EOF + + The <192.168.1.1>, + <FQDN>, and + <HOSTNAME> values need to be + changed for specific uses or requirements (if assigned an IP address by a + network/system administrator and the machine will be connected to an + existing network). The optional alias name(s) can be omitted. + + + + + + diff --git a/chapter09/networkd.xml b/chapter09/networkd.xml new file mode 100644 index 000000000..688c315aa --- /dev/null +++ b/chapter09/networkd.xml @@ -0,0 +1,335 @@ + + + %general-entities; +]> + + + + + General Network Configuration + + + network + configuring + + This section only applies if a network card is to be + configured. + + + Network Interface Configuration Files + + Starting with version 209, systemd ships a network configuration + daemon called systemd-networkd which can be used for + basic network configuration. Additionally, since version 213, DNS name + resolution can be handled by systemd-resolved in place + of a static /etc/resolv.conf file. Both services are + enabled by default. + + Configuration files for systemd-networkd (and + systemd-resolved) can be placed in + /usr/lib/systemd/network + or /etc/systemd/network. Files in + /etc/systemd/network have a + higher priority than the ones in + /usr/lib/systemd/network. + There are three types of configuration files: + .link, + .netdev and + .network files. For detailed + descriptions and example contents of these configuration files, consult + the systemd-link(5), + systemd-netdev(5) and + systemd-network(5) manual pages. + + + Network Device Naming + + + Udev normally assigns network card interface names based + on system physical characteristics such as enp2s1. If you are + not sure what your interface name is, you can always run + ip link after you have booted your system. + + + + For most systems, there is only one network interface for + each type of connection. For example, the classic interface + name for a wired connection is eth0. A wireless connection + will usually have the name wifi0 or wlan0. + + + + If you prefer to use the classic or customized network interface names, + there are three alternative ways to do that: + + + + + Mask udev's .link file for the default policy: +ln -s /dev/null /etc/systemd/network/99-default.link + + + + + + Create a manual naming scheme, for example by naming the + interfaces something like "internet0", "dmz0", or "lan0". + For that, create .link + files in /etc/systemd/network/, that choose an explicit name or a + better naming scheme for one, some, or all of your interfaces. + For example: + + +cat > /etc/systemd/network/10-ether0.link << "EOF" +[Match] +# Change the MAC address as appropriate for your network device +MACAddress=12:34:45:78:90:AB + +[Link] +Name=ether0 +EOF + + + See the man page systemd.link(5) for more information. + + + + + + In /boot/grub/grub.cfg, pass the option net.ifnames=0 on the + kernel command line. + + + + + + + Static IP Configuration + + The command below creates a basic configuration file for a + Static IP setup (using both systemd-networkd and + systemd-resolved): + +cat > /etc/systemd/network/10-eth-static.network << "EOF" +[Match] +Name=<network-device-name> + +[Network] +Address=192.168.0.2/24 +Gateway=192.168.0.1 +DNS=192.168.0.1 +Domains=<Your Domain Name> +EOF + + Multiple DNS entries can be added if you have more than one DNS + server. Do not include DNS or Domains entries if you intend to use a + static /etc/resolv.conf file. + + + + + DHCP Configuration + + The command below creates a basic configuration file for an IPv4 + DHCP setup: + +cat > /etc/systemd/network/10-eth-dhcp.network << "EOF" +[Match] +Name=<network-device-name> + +[Network] +DHCP=ipv4 + +[DHCP] +UseDomains=true +EOF + + + + + + + Creating the /etc/resolv.conf File + + + /etc/resolv.conf + + + If the system is going to be connected to the Internet, it will + need some means of Domain Name Service (DNS) name resolution to + resolve Internet domain names to IP addresses, and vice versa. This is + best achieved by placing the IP address of the DNS server, available + from the ISP or network administrator, into + /etc/resolv.conf. + + + systemd-resolved Configuration + + If using another means to configure your network + interfaces (ex: ppp, network-manager, etc.), or if using any type of + local resolver (ex: bind, dnsmasq, etc.), or any other software that + generates an /etc/resolv.conf (ex: resolvconf), the + systemd-resolved service should not be + used. + + When using systemd-resolved for DNS + configuration, it creates the file + /run/systemd/resolve/resolv.conf. Create a + symlink in /etc to use the generated file: + +ln -sfv /run/systemd/resolve/resolv.conf /etc/resolv.conf + + + + + Static resolv.conf Configuration + + If a static /etc/resolv.conf is desired, + create it by running the following command: + +cat > /etc/resolv.conf << "EOF" +# Begin /etc/resolv.conf + +domain <Your Domain Name> +nameserver <IP address of your primary nameserver> +nameserver <IP address of your secondary nameserver> + +# End /etc/resolv.conf +EOF + + The domain statement can be omitted + or replaced with a search statement. See the man page + for resolv.conf for more details. + + Replace + <IP address of the nameserver> + with the IP address of the DNS most appropriate for the setup. There will + often be more than one entry (requirements demand secondary servers for + fallback capability). If you only need or want one DNS server, remove the + second nameserver line from the file. The IP address + may also be a router on the local network. + + The Google Public IPv4 DNS addresses are + 8.8.8.8 and 8.8.4.4 + for IPv4, and 2001:4860:4860::8888 and + 2001:4860:4860::8844 for IPv6. + + + + + + + Configuring the system hostname + + + hostname + configuring + + + During the boot process, the file /etc/hostname + is used for establishing the system's hostname. + + Create the /etc/hostname file and enter a + hostname by running: + +echo "<lfs>" > /etc/hostname + + <lfs> needs to be replaced with the + name given to the computer. Do not enter the Fully Qualified Domain Name + (FQDN) here. That information is put in the + /etc/hosts file. + + + + + Customizing the /etc/hosts File + + + /etc/hosts + + + + localnet + /etc/hosts + + + + network + /etc/hosts + + + Decide on a fully-qualified domain name (FQDN), and possible aliases + for use in the /etc/hosts file. If using static + addresses, you'll also need to decide on an IP address. The syntax + for a hosts file entry is: + +IP_address myhost.example.org aliases + + Unless the computer is to be visible to the Internet (i.e., there is + a registered domain and a valid block of assigned IP addresses—most + users do not have this), make sure that the IP address is in the private + network IP address range. Valid ranges are: + +Private Network Address Range Normal Prefix +10.0.0.1 - 10.255.255.254 8 +172.x.0.1 - 172.x.255.254 16 +192.168.y.1 - 192.168.y.254 24 + + x can be any number in the range 16-31. y can be any number in the + range 0-255. + + A valid private IP address could be 192.168.1.1. A valid FQDN for + this IP could be lfs.example.org. + + Even if not using a network card, a valid FQDN is still required. + This is necessary for certain programs to operate correctly. + + If using DHCP, DHCPv6, IPv6 Autoconfiguration, or if a network card + is not going to be configured, create the /etc/hosts + file by running the following command: + +cat > /etc/hosts << "EOF" +# Begin /etc/hosts + +127.0.0.1 localhost.localdomain localhost +127.0.1.1 <FQDN> <HOSTNAME> +::1 localhost ip6-localhost ip6-loopback +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters + +# End /etc/hosts +EOF + + The ::1 entry is the IPv6 counterpart of 127.0.0.1 and represents + the IPv6 loopback interface. 127.0.1.1 is a loopback entry reserved + specifically for the FQDN. + + If using a static address, create the /etc/hosts + file by running this command instead: + +cat > /etc/hosts << "EOF" +# Begin /etc/hosts + +127.0.0.1 localhost +127.0.1.1 <FQDN> <HOSTNAME> +<192.168.0.2> <FQDN> <HOSTNAME> [alias1] [alias2] ... +::1 localhost ip6-localhost ip6-loopback +ff02::1 ip6-allnodes +ff02::2 ip6-allrouters + +# End /etc/hosts +EOF + + The <192.168.0.2>, + <FQDN>, and + <HOSTNAME> values need to be + changed for specific uses or requirements (if assigned an IP address by a + network/system administrator and the machine will be connected to an + existing network). The optional alias name(s) can be omitted. + + + + diff --git a/chapter09/profile.xml b/chapter09/profile.xml new file mode 100644 index 000000000..226dd9fac --- /dev/null +++ b/chapter09/profile.xml @@ -0,0 +1,162 @@ + + + %general-entities; +]> + + + + + The Bash Shell Startup Files + + + /etc/profile + + + The shell program /bin/bash (hereafter referred to + as the shell) uses a collection of startup files to help + create an environment to run in. Each file has a specific use and may affect + login and interactive environments differently. The files in the /etc directory provide global settings. If an + equivalent file exists in the home directory, it may override the global + settings. + + An interactive login shell is started after a successful login, using + /bin/login, by reading the /etc/passwd + file. An interactive non-login shell is started at the command-line (e.g., + [prompt]$/bin/bash). A non-interactive + shell is usually present when a shell script is running. It is non-interactive + because it is processing a script and not waiting for user input between + commands. + + For more information, see info bash under the + Bash Startup Files and Interactive Shells section. + + The files /etc/profile and + ~/.bash_profile are read when the shell is + invoked as an interactive login shell. + + The base /etc/profile below sets some + environment variables necessary for native language support. Setting + them properly results in: + + + + The output of programs translated into the native language + + + Correct classification of characters into letters, digits and other + classes. This is necessary for bash to properly accept + non-ASCII characters in command lines in non-English locales + + + The correct alphabetical sorting order for the country + + + Appropriate default paper size + + + Correct formatting of monetary, time, and date values + + + + Replace <ll> below with the two-letter code + for the desired language (e.g., en) and + <CC> with the two-letter code for the appropriate + country (e.g., GB). <charmap> should + be replaced with the canonical charmap for your chosen locale. Optional + modifiers such as @euro may also be present. + + The list of all locales supported by Glibc can be obtained by running + the following command: + +locale -a + + Charmaps can have a number of aliases, e.g., ISO-8859-1 + is also referred to as iso8859-1 and iso88591. + Some applications cannot handle the various synonyms correctly (e.g., require + that UTF-8 is written as UTF-8, not + utf8), so it is safest in most + cases to choose the canonical name for a particular locale. To determine + the canonical name, run the following command, where <locale + name> is the output given by locale -a for + your preferred locale (en_GB.iso88591 in our example). + +LC_ALL=<locale name> locale charmap + + For the en_GB.iso88591 locale, the above command + will print: + +ISO-8859-1 + + This results in a final locale setting of en_GB.ISO-8859-1. + It is important that the locale found using the heuristic above is tested prior + to it being added to the Bash startup files: + +LC_ALL=<locale name> locale language +LC_ALL=<locale name> locale charmap +LC_ALL=<locale name> locale int_curr_symbol +LC_ALL=<locale name> locale int_prefix + + The above commands should print the language name, the character + encoding used by the locale, the local currency, and the prefix to dial + before the telephone number in order to get into the country. If any of the + commands above fail with a message similar to the one shown below, this means + that your locale was either not installed in Chapter 6 or is not supported by + the default installation of Glibc. + +locale: Cannot set LC_* to default locale: No such file or directory + + If this happens, you should either install the desired locale using the + localedef command, or consider choosing a different locale. + Further instructions assume that there are no such error messages from + Glibc. + + + Some packages beyond LFS may also lack support for your chosen locale. One + example is the X library (part of the X Window System), which outputs the + following error message if the locale does not exactly match one of the character + map names in its internal files: + +Warning: locale not supported by Xlib, locale set to C + + In several cases Xlib expects that the character map will be listed in + uppercase notation with canonical dashes. For instance, "ISO-8859-1" rather + than "iso88591". It is also possible to find an appropriate specification by + removing the charmap part of the locale specification. This can be checked + by running the locale charmap command in both locales. + For example, one would have to change "de_DE.ISO-8859-15@euro" to + "de_DE@euro" in order to get this locale recognized by Xlib. + + Other packages can also function incorrectly (but may not necessarily + display any error messages) if the locale name does not meet their expectations. + In those cases, investigating how other Linux distributions support your locale + might provide some useful information. + + Once the proper locale settings have been determined, create the + /etc/profile file: + +cat > /etc/profile << "EOF" +# Begin /etc/profile + +export LANG=<ll>_<CC>.<charmap><@modifiers> + +# End /etc/profile +EOF + + The C (default) and en_US (the recommended + one for United States English users) locales are different. C + uses the US-ASCII 7-bit character set, and treats bytes with the high bit set + as invalid characters. That's why, e.g., the ls command + substitutes them with question marks in that locale. Also, an attempt to send + mail with such characters from Mutt or Pine results in non-RFC-conforming + messages being sent (the charset in the outgoing mail is indicated as unknown + 8-bit). So you can use the C locale only if you are sure that + you will never need 8-bit characters. + + UTF-8 based locales are not supported well by some programs. + Work is in progress to document and, if possible, fix such problems, see + . + + diff --git a/chapter09/reboot.xml b/chapter09/reboot.xml deleted file mode 100644 index c6a857dbd..000000000 --- a/chapter09/reboot.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - %general-entities; -]> - - - - - Rebooting the System - - Now that all of the software has been installed, it is time to reboot - your computer. However, you should be aware of a few things. The system you - have created in this book is quite minimal, and most likely will not have - the functionality you would need to be able to continue forward. By installing - a few extra packages from the BLFS book while still in our current chroot - environment, you can leave yourself in a much better position to continue on - once you reboot into your new LFS installation. Here are some suggestions: - - - - A text mode browser such as Lynx - will allow you to easily view the BLFS book in one virtual terminal, while - building packages in another. - - The GPM package will allow - you to perform copy/paste actions in your virtual - terminals. - - If you are in a situation where static IP configuration - does not meet your networking requirements, installing a package - such as dhcpcd - or the client portion of dhcp may be - useful. - - Installing sudo may be useful for - building packages as a non-root user and easily installing the resulting - packages in your new system. - - If you want to access your new system from a remote system - within a comfortable GUI environment, install openssh. - - - To make fetching files over the internet easier, install - wget. - - - If one or more of your disk drives have a GUID partition - table (GPT), either gptfdisk or parted will be useful. - - - Finally, a review of the following configuration files - is also appropriate at this point. - - - /etc/bashrc - /etc/dircolors - /etc/fstab - /etc/hosts - /etc/inputrc - /etc/profile - /etc/resolv.conf - /etc/vimrc - /root/.bash_profile - /root/.bashrc - /etc/sysconfig/ifconfig.eth0 - - - - - Now that we have said that, let's move on to booting our shiny new LFS - installation for the first time! First exit from the chroot environment: - -logout - - Then unmount the virtual file systems: - -umount -v $LFS/dev/pts -umount -v $LFS/dev -umount -v $LFS/run -umount -v $LFS/proc -umount -v $LFS/sys - - Unmount the LFS file system itself: - -umount -v $LFS - - If multiple partitions were created, unmount the other - partitions before unmounting the main one, like this: - -umount -v $LFS/usr -umount -v $LFS/home -umount -v $LFS - - Now, reboot the system with: - -shutdown -r now - - Assuming the GRUB boot loader was set up as outlined earlier, the menu - is set to boot LFS &version; automatically. - - When the reboot is complete, the LFS system is ready for use and - more software may be added to suit your needs. - - diff --git a/chapter09/symlinks.xml b/chapter09/symlinks.xml new file mode 100644 index 000000000..951e6976d --- /dev/null +++ b/chapter09/symlinks.xml @@ -0,0 +1,256 @@ + + + %general-entities; +]> + + + + + Managing Devices + + + + Network Devices + + Udev, by default, names network devices according to Firmware/BIOS + data or physical characteristics like the bus, slot, or MAC address. The + purpose of this naming convention is to ensure that network devices are + named consistently and not based on the time the network card was + discovered. For example, on a computer having two network cards made by + Intel and Realtek, the network card manufactured by Intel may become eth0 + and the Realtek card becomes eth1. In some cases, after a reboot the cards + get renumbered the other way around. + + In the new naming scheme, typical network device names would then + be something like enp5s0 or wlp3s0. If this naming convention is not + desired, the traditional naming scheme or a custom scheme can be + implemented. + + + Disabling Persistent Naming on the Kernel Command Line + + The traditional naming scheme using eth0, eth1, etc can be + restored by adding net.ifnames=0 on the + kernel command line. This is most appropriate for those systems + that have only one ethernet device of the same type. Laptops + often have multiple ethernet connections that are named eth0 and + wlan0 and are also candidates for this method. The command line + is passed in the GRUB configuration file. + See . + + + + Creating Custom Udev Rules + + The naming scheme can be customized by creating custom Udev + rules. A script has been included that generates the initial rules. + Generate these rules by running: + +bash /lib/udev/init-net-rules.sh + + Now, inspect the + /etc/udev/rules.d/70-persistent-net.rules file, to + find out which name was assigned to which network device: + +cat /etc/udev/rules.d/70-persistent-net.rules + + In some cases such as when MAC addresses have been assigned to + a network card manually or in a virtual environment such as Qemu or Xen, + the network rules file may not have been generated because addresses + are not consistently assigned. In these cases, this method cannot + be used. + + The file begins with a comment block followed by two lines for each + NIC. The first line for each NIC is a commented description showing its + hardware IDs (e.g. its PCI vendor and device IDs, if it's a PCI card), + along with its driver in parentheses, if the driver can be found. Neither + the hardware ID nor the driver is used to determine which name to give an + interface; this information is only for reference. The second line is the + Udev rule that matches this NIC and actually assigns it a name. + + All Udev rules are made up of several keys, separated by commas and + optional whitespace. This rule's keys and an explanation of each of them + are as follows: + + + + SUBSYSTEM=="net" - This tells Udev to ignore + devices that are not network cards. + + + ACTION=="add" - This tells Udev to ignore this + rule for a uevent that isn't an add ("remove" and "change" uevents also + happen, but don't need to rename network interfaces). + + + DRIVERS=="?*" - This exists so that Udev will + ignore VLAN or bridge sub-interfaces (because these sub-interfaces do + not have drivers). These sub-interfaces are skipped because the name + that would be assigned would collide with their parent devices. + + + ATTR{address} - The value of this key is the + NIC's MAC address. + + + ATTR{type}=="1" - This ensures the rule only + matches the primary interface in the case of certain wireless drivers, + which create multiple virtual interfaces. The secondary interfaces are + skipped for the same reason that VLAN and bridge sub-interfaces are + skipped: there would be a name collision otherwise. + + + NAME - The value of this key is the name that + Udev will assign to this interface. + + + + The value of NAME is the important part. Make sure + you know which name has been assigned to each of your network cards before + proceeding, and be sure to use that NAME value when + creating your configuration files below. + + + + + + + + CD-ROM symlinks + + Some software that you may want to install later (e.g., various + media players) expect the /dev/cdrom + and /dev/dvd symlinks to exist, and + to point to a CD-ROM or DVD-ROM device. Also, it may be convenient to put + references to those symlinks into /etc/fstab. Udev + comes with a script that will generate rules files to create these symlinks + for you, depending on the capabilities of each device, but you need to + decide which of two modes of operation you wish to have the script use. + + First, the script can operate in by-path mode (used by + default for USB and FireWire devices), where the rules it creates depend on + the physical path to the CD or DVD device. Second, it can operate in + by-id mode (default for IDE and SCSI devices), where the + rules it creates depend on identification strings stored in the CD or DVD + device itself. The path is determined by Udev's path_id + script, and the identification strings are read from the hardware by its + ata_id or scsi_id programs, depending + on which type of device you have. + + There are advantages to each approach; the correct approach to use + will depend on what kinds of device changes may happen. If you expect the + physical path to the device (that is, the ports and/or slots that it plugs + into) to change, for example because you plan on moving the drive to a + different IDE port or a different USB connector, then you should use the + by-id mode. On the other hand, if you expect the device's + identification to change, for example because it may die, and you would + replace it with a different device with the same capabilities and which + is plugged into the same connectors, then you should use the + by-path mode. + + If either type of change is possible with your drive, then choose a + mode based on the type of change you expect to happen more often. + + + + External devices (for example, a USB-connected CD drive) + should not use by-path persistence, because each time the device is plugged + into a new external port, its physical path will change. All + externally-connected devices will have this problem if you write Udev rules + to recognize them by their physical path; the problem is not limited to CD + and DVD drives. + + If you wish to see the values that the Udev scripts will use, then + for the appropriate CD-ROM device, find the corresponding directory under + /sys (e.g., this can be + /sys/block/hdd) and + run a command similar to the following: + +udevadm test /sys/block/hdd + + Look at the lines containing the output of various *_id programs. + The by-id mode will use the ID_SERIAL value if it exists and + is not empty, otherwise it will use a combination of ID_MODEL and + ID_REVISION. The by-path mode will use the ID_PATH value. + + If the default mode is not suitable for your situation, then the + following modification can be made to the + /etc/udev/rules.d/83-cdrom-symlinks.rules file, + as follows (where mode is one of + by-id or by-path): + +sed -i -e 's/"write_cd_rules"/"write_cd_rules mode"/' \ + /etc/udev/rules.d/83-cdrom-symlinks.rules + + Note that it is not necessary to create the rules files or symlinks + at this time, because you have bind-mounted the host's + /dev directory into the LFS system, + and we assume the symlinks exist on the host. The rules and symlinks will + be created the first time you boot your LFS system. + + However, if you have multiple CD-ROM devices, then the symlinks + generated at that time may point to different devices than they point to on + your host, because devices are not discovered in a predictable order. The + assignments created when you first boot the LFS system will be stable, so + this is only an issue if you need the symlinks on both systems to point to + the same device. If you need that, then inspect (and possibly edit) the + generated /etc/udev/rules.d/70-persistent-cd.rules + file after booting, to make sure the assigned symlinks match what you need. + + + + + + Dealing with duplicate devices + + As explained in , the order in + which devices with the same function appear in + /dev is essentially random. + E.g., if you have a USB web camera and a TV tuner, sometimes + /dev/video0 refers to the camera and + /dev/video1 refers to the tuner, and sometimes + after a reboot the order changes to the opposite one. + For all classes of hardware except sound cards and network cards, this is + fixable by creating Udev rules for custom persistent symlinks. + The case of network cards is covered separately in + , and sound card configuration can + be found in BLFS. + + For each of your devices that is likely to have this problem + (even if the problem doesn't exist in your current Linux distribution), + find the corresponding directory under + /sys/class or + /sys/block. + For video devices, this may be + /sys/class/video4linux/videoX. + Figure out the attributes that identify the device uniquely (usually, + vendor and product IDs and/or serial numbers work): + +udevadm info -a -p /sys/class/video4linux/video0 + + Then write rules that create the symlinks, e.g.: + +cat > /etc/udev/rules.d/83-duplicate_devs.rules << "EOF" + +# Persistent symlinks for webcam and tuner +KERNEL=="video*", ATTRS{idProduct}=="1910", ATTRS{idVendor}=="0d81", \ + SYMLINK+="webcam" +KERNEL=="video*", ATTRS{device}=="0x036f", ATTRS{vendor}=="0x109e", \ + SYMLINK+="tvtuner" + +EOF + + The result is that /dev/video0 and + /dev/video1 devices still refer randomly to the tuner + and the web camera (and thus should never be used directly), but there are + symlinks /dev/tvtuner and + /dev/webcam that always point to the correct + device. + + + + diff --git a/chapter09/systemd-custom.xml b/chapter09/systemd-custom.xml new file mode 100644 index 000000000..787fd4572 --- /dev/null +++ b/chapter09/systemd-custom.xml @@ -0,0 +1,313 @@ + + + %general-entities; +]> + + + + + Systemd Usage and Configuration + + + Systemd Customization + + + + Basic Configuration + + The /etc/systemd/system.conf file contains a set + of options to control basic systemd operations. The default file has all + entries commented out with the default settings indicated. This file is + where the log level may be changed as well as some basic logging settings. + See the systemd-system.conf(5) manual page for details + on each configuration option. + + + + + Disabling Screen Clearing at Boot Time + + The normal behavior for systemd is to clear the screen at + the end of the boot sequence. If desired, this behavior may be + changed by running the following command: + +mkdir -pv /etc/systemd/system/getty@tty1.service.d + +cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf << EOF +[Service] +TTYVTDisallocate=no +EOF + + The boot messages can always be reviewed by using the + journalctl -b command as the root user. + + + + + Disabling tmpfs for /tmp + + By default, /tmp is created as + a tmpfs. If this is not desired, it can be overridden by the following: + +ln -sfv /dev/null /etc/systemd/system/tmp.mount + + Alternatively, if a a separate partition for + /tmp is desired, specify that + partition in an /etc/fstab entry. + + + + Do not create the symbolic link above if a separate partition is used + for /tmp. This will prevent the + root file system (/) from being remounted r/w and make the system + unusable when booted. + + + + + + + Configuring Automatic File Creation and Deletion + + There are several services that create or delete files or + directories: + + + systemd-tmpfiles-clean.service + systemd-tmpfiles-setup-dev.service + systemd-tmpfiles-setup.service + + + The system location for the configuration files is + /usr/lib/tmpfiles.d/*.conf. The local + configuration files are in + /etc/tmpfiles.d. Files in + /etc/tmpfiles.d override + files with the same name in + /usr/lib/tmpfiles.d. See + tmpfiles.d(5) manual page for file format + details. + + + Note that the syntax for the + /usr/lib/tmpfiles.d/*.conf files can be + confusing. For example, the default deletion of files in the /tmp directory + is located in /usr/lib/tmpfiles.d/tmp.conf with + the line: + +q /tmp 1777 root root 10d + + The type field, q, discusses creating a subvolume with quotas which + is really only applicable to btrfs filesystems. It references type v + which in turn references type d (directory). This then creates the + specified directory if is is not present and adjusts the permissions + and ownership as specified. Contents of the directory will be + subject to time based cleanup if the age argument is specified. + + + + If the default parameters are not desired, then the file should + be copied to /etc/tmpfiles.d + and edited as desired. For example: + +mkdir -p /etc/tmpfiles.d +cp /usr/lib/tmpfiles.d/tmp.conf /etc/tmpfiles.d + + + + + + Overriding Default Services Behavior + + The parameter of a unit can be overriden by creating a directory + and a configuration file in /etc/systemd/system. For example: + +mkdir -pv /etc/systemd/system/foobar.service.d + +cat > /etc/systemd/system/foobar.service.d/foobar.conf << EOF +[Service] +Restart=always +RestartSec=30 +EOF + + See systemd.unit(5) manual page for more + information. After creating the configuration file, run + systemctl daemon-reload and systemctl + restart foobar to activate the changes to a service. + + + + + Debugging the Boot Sequence + + Rather than plain shell scripts used in SysVinit or BSD style init + systems, systemd uses a unified format for different types of startup + files (or units). The command systemctl is used to + enable, disable, control state, and obtain status of unit files. Here + are some examples of frequently used commands: + + + + systemctl list-units -t <service> [--all]: + lists loaded unit files of type service. + + + systemctl list-units -t <target> [--all]: + lists loaded unit files of type target. + + + systemctl show -p Wants <multi-user.target>: + shows all units that depend on the multi-user target. Targets are + special unit files that are anogalous to runlevels under + SysVinit. + + + systemctl status <servicename.service>: + shows the status of the servicename service. The .service extension + can be omitted if there are no other unit files with the same name, + such as .socket files (which create a listening socket that provides + similar functionality to inetd/xinetd). + + + + + + + Working with the Systemd Journal + + Logging on a system booted with systemd is handled with + systemd-journald (by default), rather than a typical unix syslog daemon. + You can also add a normal syslog daemon and have both work side by + side if desired. The systemd-journald program stores journal entries in a + binary format rather than a plain text log file. To assist with + parsing the file, the command journalctl is provided. + Here are some examples of frequently used commands: + + + + journalctl -r: shows all contents of the + journal in reverse chronological order. + + + journalctl -u UNIT: + shows the journal entries associated with the specified UNIT + file. + + + journalctl -b[=ID] -r: shows the journal + entries since last successful boot (or for boot ID) in reverse + chronological order. + + + journalctl -f: povides functionality similar + to tail -f (follow). + + + + + + + Working with Core Dumps + + Core dumps are useful to debug crashed programs, especially + when a daemon process crashes. On systemd booted systems the core + dumping is handled by systemd-coredump. It will + log the core dump into the journal and store the core dump itself in + /var/lib/systemd/coredump. + To retrieve and process core dumps, coredumpctl + tool is provided. Here are some examples of frequently used commands: + + + + + coredumpctl -r: lists all core dumps in + reversed chronological order. + + + coredumpctl -1 info: show the information + of the last core dump. + + + coredumpctl -1 debug: load the last core + dump into GDB. + + + + + Core dumps may use a lot of disk space. The maximum disk space + used by core dumps can be limited by creating a configuration file in + /etc/systemd/coredump.conf.d. + For example: + +mkdir -pv /etc/systemd/coredump.conf.d + +cat > /etc/systemd/coredump.conf.d/maxuse.conf << EOF +[Coredump] +MaxUse=5G +EOF + + See systemd-coredump(8), + coredumpctl(1), and + coredump.conf.d(5) manual pages for more + information. + + + + Long Running Processes + + Beginning with systemd-230, all user processes are killed when a user + session is ended, even if nohup is used, or the process uses the + daemon() or setsid() functions. + This is a deliberate change from a historically permissive environment to a + more restrictive one. The new behavior may cause issues if you depend on + long running programs (e.g., screen or + tmux) to remain active after ending your user session. + There are three ways to enable lingering processes to remain after a user + session is ended. + + + + + Enable process lingering for only selected users: + Normal users have permission to enable process lingering + with the command loginctl enable-linger for their + own user. System administrators can use the same command with a + user argument to enable for a user. That user + can then use the systemd-run command to start + long running processes. For example: systemd-run --scope + --user /usr/bin/screen. If you enable lingering for your + user, the user@.service will remain even after all login sessions are + closed, and will automatically start at system boot. This has the + advantage of explicitly allowing and disallowing processes to run + after the user session has ended, but breaks backwards compatibility + with tools like nohup and utilities that use + deamon(). + + + + + Enable system-wide process lingering: + You can set KillUserProcesses=no in + /etc/systemd/logind.conf to enable process lingering + globally for all users. This has the benefit of leaving the old + method available to all users at the expense of explicit control. + + + + + Disable at build-time: You can enable + lingering by default while building systemd by adding the switch + -Ddefault-kill-user-processes=false to the + meson command for systemd. This completely + disables the ability of systemd to kill user processes at session + end. + + + + + + + diff --git a/chapter09/theend.xml b/chapter09/theend.xml deleted file mode 100644 index 9f2ca17cc..000000000 --- a/chapter09/theend.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - %general-entities; -]> - - - - - The End - - - /etc/lfs-release - - - - /etc/lsb-release - - - - /etc/os-release - - - Well done! The new LFS system is installed! We wish you much - success with your shiny new custom-built Linux system. - - It may be a good idea to create an - /etc/lfs-release file. By having this file, it is very - easy for you (and for us if you need to ask for help at some point) to find - out which LFS version is installed on the system. Create this file by - running: - -echo &version; > /etc/lfs-release - -echo &versiond; > /etc/lfs-release - - Two files describing the installed system may be used by packages - that will be installed on the system, either in binary form or by building - them. - - The first one shows the status of your - new system with respect to the Linux Standards Base (LSB). To create - this file, run: - -cat > /etc/lsb-release << "EOF" -DISTRIB_ID="Linux From Scratch" -DISTRIB_RELEASE="&version;" -DISTRIB_CODENAME="<your name here>" -DISTRIB_DESCRIPTION="Linux From Scratch" -EOF - -cat > /etc/lsb-release << "EOF" -DISTRIB_ID="Linux From Scratch" -DISTRIB_RELEASE="&versiond;" -DISTRIB_CODENAME="<your name here>" -DISTRIB_DESCRIPTION="Linux From Scratch" -EOF - - The second one contains roughly the same information, and is used - by systemd and some graphical desktop environments. To create - this file, run: - -cat > /etc/os-release << "EOF" -NAME="Linux From Scratch" -VERSION="&version;" -ID=lfs -PRETTY_NAME="Linux From Scratch &version;" -VERSION_CODENAME="<your name here>" -EOF - -cat > /etc/os-release << "EOF" -NAME="Linux From Scratch" -VERSION="&versiond;" -ID=lfs -PRETTY_NAME="Linux From Scratch &versiond;" -VERSION_CODENAME="<your name here>" -EOF - - Be sure to put some sort of customization for the fields - 'DISTRIB_CODENAME' and 'VERSION_CODENAME' to make the system uniquely - yours. - - diff --git a/chapter09/udev.xml b/chapter09/udev.xml new file mode 100644 index 000000000..6060849be --- /dev/null +++ b/chapter09/udev.xml @@ -0,0 +1,342 @@ + + + %general-entities; +]> + + + + + Overview of Device and Module Handling + + + Udev + usage + + + In , we installed the Udev + package when eudev + systemd was built. Before we go into the + details regarding how this works, a brief history of previous methods of + handling devices is in order. + + Linux systems in general traditionally used a static device creation + method, whereby a great many device nodes were created under /dev (sometimes literally thousands of nodes), + regardless of whether the corresponding hardware devices actually existed. This + was typically done via a MAKEDEV script, which contains a + number of calls to the mknod program with the relevant + major and minor device numbers for every possible device that might exist in + the world. + + Using the Udev method, only those devices which are detected by the + kernel get device nodes created for them. Because these device nodes will be + created each time the system boots, they will be stored on a devtmpfs file system (a virtual file system + that resides entirely in system memory). Device nodes do not require much + space, so the memory that is used is negligible. + + + History + + In February 2000, a new filesystem called devfs was merged into the 2.3.46 kernel + and was made available during the 2.4 series of stable kernels. Although + it was present in the kernel source itself, this method of creating devices + dynamically never received overwhelming support from the core kernel + developers. + + The main problem with the approach adopted by devfs was the way it handled device + detection, creation, and naming. The latter issue, that of device node + naming, was perhaps the most critical. It is generally accepted that if + device names are allowed to be configurable, then the device naming policy + should be up to a system administrator, not imposed on them by any + particular developer(s). The devfs file system also suffered from race + conditions that were inherent in its design and could not be fixed without a + substantial revision to the kernel. It was marked as deprecated for a long + period – due to a lack of maintenance – and was finally removed + from the kernel in June, 2006. + + With the development of the unstable 2.5 kernel tree, later released + as the 2.6 series of stable kernels, a new virtual filesystem called + sysfs came to be. The job of + sysfs is to export a view of + the system's hardware configuration to userspace processes. With this + userspace-visible representation, the possibility of developing a userspace + replacement for devfs became + much more realistic. + + + + + Udev Implementation + + + Sysfs + + The sysfs filesystem + was mentioned briefly above. One may wonder how sysfs knows about the devices present on + a system and what device numbers should be used for them. Drivers that + have been compiled into the kernel directly register their objects with a + sysfs (devtmpfs internally) + as they are detected by the kernel. For drivers compiled as modules, this + registration will happen when the module is loaded. Once the sysfs filesystem is mounted (on /sys), + data which the drivers register with sysfs are available to userspace + processes and to udevd for processing (including modifications to device + nodes). + + + + + Device Node Creation + + Device files are created by the kernel by the devtmpfs filesystem. Any driver that + wishes to register a device node will go through the devtmpfs (via the driver core) to do it. + When a devtmpfs instance is + mounted on /dev, the device node + will initially be created with a fixed name, permissions, and + owner. + + A short time later, the kernel will send a uevent to + udevd. Based on the rules specified in the files within the + /etc/udev/rules.d, /lib/udev/rules.d, and /run/udev/rules.d directories, + udevd will create additional symlinks to the device node, or + change its permissions, owner, or group, or modify the internal + udevd database entry (name) for that object. + + The rules in these three directories are numbered and all three + directories are merged together. If udevd can't find a + rule for the device it is creating, it will leave the permissions and + ownership at whatever devtmpfs used initially. + + + Module Loading + + Device drivers compiled as modules may have aliases built into them. + Aliases are visible in the output of the modinfo + program and are usually related to the bus-specific identifiers of devices + supported by a module. For example, the snd-fm801 + driver supports PCI devices with vendor ID 0x1319 and device ID 0x0801, + and has an alias of pci:v00001319d00000801sv*sd*bc04sc01i*. + For most devices, the bus driver exports the alias of the driver that + would handle the device via sysfs. E.g., the + /sys/bus/pci/devices/0000:00:0d.0/modalias file + might contain the string + pci:v00001319d00000801sv00001319sd00001319bc04sc01i00. + The default rules provided with Udev will cause udevd + to call out to /sbin/modprobe with the contents of the + MODALIAS uevent environment variable (which should be the + same as the contents of the modalias file in sysfs), + thus loading all modules whose aliases match this string after wildcard + expansion. + + In this example, this means that, in addition to + snd-fm801, the obsolete (and unwanted) + forte driver will be loaded if it is + available. See below for ways in which the loading of unwanted drivers can + be prevented. + + The kernel itself is also able to load modules for network + protocols, filesystems and NLS support on demand. + + + + + Handling Hotpluggable/Dynamic Devices + + When you plug in a device, such as a Universal Serial Bus (USB) MP3 + player, the kernel recognizes that the device is now connected and + generates a uevent. This uevent is then handled by + udevd as described above. + + + + + + + Problems with Loading Modules and Creating Devices + + There are a few possible problems when it comes to automatically + creating device nodes. + + + A kernel module is not loaded automatically + + Udev will only load a module if it has a bus-specific alias and the + bus driver properly exports the necessary aliases to sysfs. In other cases, one should + arrange module loading by other means. With Linux-&linux-version;, Udev is + known to load properly-written drivers for INPUT, IDE, PCI, USB, SCSI, + SERIO, and FireWire devices. + + To determine if the device driver you require has the necessary + support for Udev, run modinfo with the module name as + the argument. Now try locating the device directory under + /sys/bus and check whether there is + a modalias file there. + + If the modalias file exists in sysfs, the driver supports the device and + can talk to it directly, but doesn't have the alias, it is a bug in the + driver. Load the driver without the help from Udev and expect the issue + to be fixed later. + + If there is no modalias file in the relevant + directory under /sys/bus, this + means that the kernel developers have not yet added modalias support to + this bus type. With Linux-&linux-version;, this is the case with ISA + busses. Expect this issue to be fixed in later kernel versions. + + Udev is not intended to load wrapper drivers such as + snd-pcm-oss and non-hardware drivers such as + loop at all. + + + + + A kernel module is not loaded automatically, and Udev is not + intended to load it + + If the wrapper module only enhances the + functionality provided by some other module (e.g., + snd-pcm-oss enhances the functionality of + snd-pcm by making the sound cards available to OSS + applications), configure modprobe to load the wrapper + after Udev loads the wrapped module. To do this, add a + softdep line to the corresponding + /etc/modprobe.d/<filename>.conf + file. For example: + +softdep snd-pcm post: snd-pcm-oss + + Note that the softdep command also allows + pre: dependencies, or a mixture of both + pre: and post:. See the + modprobe.d(5) manual page for more information + on softdep syntax and capabilities. + + If the module in question is not a wrapper and is useful by itself, + configure the modules bootscript to load this + module on system boot. To do this, add the module name to the + /etc/sysconfig/modules file on a separate line. + This works for wrapper modules too, but is suboptimal in that case. + + + + + Udev loads some unwanted module + + Either don't build the module, or blacklist it in a + /etc/modprobe.d/blacklist.conf file as done with the + forte module in the example below: + +blacklist forte + + Blacklisted modules can still be loaded manually with the + explicit modprobe command. + + + + + Udev creates a device incorrectly, or makes a wrong symlink + + This usually happens if a rule unexpectedly matches a device. For + example, a poorly-written rule can match both a SCSI disk (as desired) + and the corresponding SCSI generic device (incorrectly) by vendor. + Find the offending rule and make it more specific, with the help of the + udevadm info command. + + + + + Udev rule works unreliably + + This may be another manifestation of the previous problem. If not, + and your rule uses sysfs + attributes, it may be a kernel timing issue, to be fixed in later kernels. + For now, you can work around it by creating a rule that waits for the used + sysfs attribute and appending + it to the /etc/udev/rules.d/10-wait_for_sysfs.rules + file (create this file if it does not exist). Please notify the LFS + Development list if you do so and it helps. + + + + + Udev does not create a device + + Further text assumes that the driver is built statically into the + kernel or already loaded as a module, and that you have already checked + that Udev doesn't create a misnamed device. + + Udev has no information needed to create a device node if a kernel + driver does not export its data to + sysfs. This is most common + with third party drivers from outside the kernel tree. Create a static + device node in /lib/udev/devices with the + appropriate major/minor numbers (see the file + devices.txt inside the kernel documentation or the + documentation provided by the third party driver vendor). The static + device node will be copied to /dev + by udev. + + + + + Device naming order changes randomly after rebooting + + This is due to the fact that Udev, by design, handles uevents and + loads modules in parallel, and thus in an unpredictable order. This will + never be fixed. You should not rely upon the kernel device + names being stable. Instead, create your own rules that make symlinks with + stable names based on some stable attributes of the device, such as a + serial number or the output of various *_id utilities installed by Udev. + See and + for examples. + + + + + + + Useful Reading + + Additional helpful documentation is available at the following + sites: + + + + + A Userspace Implementation of devfs + + + + + The sysfs Filesystem + + + + + + + + + diff --git a/chapter09/usage.xml b/chapter09/usage.xml new file mode 100644 index 000000000..4a4cf6c36 --- /dev/null +++ b/chapter09/usage.xml @@ -0,0 +1,710 @@ + + + + %general-entities; +]> + + + + + System V Bootscript Usage and Configuration + + + Bootscripts + usage + + + + How Do the System V Bootscripts Work? + + Linux uses a special booting facility named SysVinit that is based on a + concept of run-levels. It can be quite different from one + system to another, so it cannot be assumed that because things worked in one + particular Linux distribution, they should work the same in LFS too. LFS has its + own way of doing things, but it respects generally accepted standards. + + SysVinit (which will be referred to as init from now on) + works using a run-levels scheme. There are seven (numbered 0 to 6) run-levels + (actually, there are more run-levels, but they are for special cases and are + generally not used. See init(8) for more details), and + each one of those corresponds to the actions the computer is supposed to + perform when it starts up. The default run-level is 3. Here are the + descriptions of the different run-levels as they are implemented: + +0: halt the computer +1: single-user mode +2: multi-user mode without networking +3: multi-user mode with networking +4: reserved for customization, otherwise does the same as 3 +5: same as 4, it is usually used for GUI login (like X's xdm or KDE's kdm) +6: reboot the computer + + + + + Configuring Sysvinit + + + Sysvinit + configuring + + + + /etc/inittab + + + During the kernel initialization, the first program that is run + is either specified on the command line or, by default + init. This program reads the initialization file + /etc/inittab. Create this file with: + +cat > /etc/inittab << "EOF" +# Begin /etc/inittab + +id:3:initdefault: + +si::sysinit:/etc/rc.d/init.d/rc S + +l0:0:wait:/etc/rc.d/init.d/rc 0 +l1:S1:wait:/etc/rc.d/init.d/rc 1 +l2:2:wait:/etc/rc.d/init.d/rc 2 +l3:3:wait:/etc/rc.d/init.d/rc 3 +l4:4:wait:/etc/rc.d/init.d/rc 4 +l5:5:wait:/etc/rc.d/init.d/rc 5 +l6:6:wait:/etc/rc.d/init.d/rc 6 + +ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now + +su:S016:once:/sbin/sulogin + +1:2345:respawn:/sbin/agetty --noclear tty1 9600 +2:2345:respawn:/sbin/agetty tty2 9600 +3:2345:respawn:/sbin/agetty tty3 9600 +4:2345:respawn:/sbin/agetty tty4 9600 +5:2345:respawn:/sbin/agetty tty5 9600 +6:2345:respawn:/sbin/agetty tty6 9600 + +# End /etc/inittab +EOF + + An explanation of this initialization file is in the man page for + inittab. For LFS, the key command that is run is + rc. The initialization file above will instruct + rc to run all the scripts starting with an S in the + /etc/rc.d/rcS.d directory + followed by all the scripts starting with an S in the /etc/rc.d/rc?.d directory where the question + mark is specified by the initdefault value. + + As a convenience, the rc script reads a library of + functions in /lib/lsb/init-functions. + This library also reads an optional configuration file, + /etc/sysconfig/rc.site. Any of the system + configuration file parameters described in subsequent sections can be + alternatively placed in this file allowing consolidation of all system + parameters in this one file. + + As a debugging convenience, the functions script also logs all output + to /run/var/bootlog. Since the /run directory is a tmpfs, this file is not + persistent across boots, however it is appended to the more permanent file + /var/log/boot.log at the end of the boot process. + + + Changing Run Levels + + Changing run-levels is done with init + <runlevel>, where + <runlevel> is the target run-level. For example, to + reboot the computer, a user could issue the init 6 command, + which is an alias for the reboot command. Likewise, + init 0 is an alias for the halt + command. + + There are a number of directories under /etc/rc.d that look like rc?.d (where ? is the number of the run-level) and + rcsysinit.d, all containing a number of + symbolic links. Some begin with a K, the others begin with + an S, and all of them have two numbers following the + initial letter. The K means to stop (kill) a service and the S means to start a + service. The numbers determine the order in which the scripts are run, from 00 + to 99—the lower the number the earlier it gets executed. When + init switches to another run-level, the appropriate services + are either started or stopped, depending on the runlevel chosen. + + The real scripts are in /etc/rc.d/init.d. They do the actual work, and + the symlinks all point to them. K links and S links point to + the same script in /etc/rc.d/init.d. + This is because the scripts can be called with different parameters like + start, stop, + restart, reload, and + status. When a K link is encountered, the appropriate + script is run with the stop argument. When an S link + is encountered, the appropriate script is run with the + start argument. + + There is one exception to this explanation. Links that start + with an S in the rc0.d and rc6.d directories will not cause anything + to be started. They will be called with the parameter + stop to stop something. The logic behind this + is that when a user is going to reboot or halt the system, nothing + needs to be started. The system only needs to be stopped. + + These are descriptions of what the arguments make the scripts + do: + + + + + start + + The service is started. + + + + + stop + + The service is stopped. + + + + + restart + + The service is stopped and then started again. + + + + + reload + + The configuration of the service is updated. + This is used after the configuration file of a service was modified, when + the service does not need to be restarted. + + + + + status + + Tells if the service is running and with which PIDs. + + + + + + Feel free to modify the way the boot process works (after all, + it is your own LFS system). The files given here are an example of how + it can be done. + + + + + + Udev Bootscripts + + The /etc/rc.d/init.d/udev initscript starts + udevd, triggers any "coldplug" devices that have + already been created by the kernel and waits for any rules to complete. + The script also unsets the uevent handler from the default of + /sbin/hotplug . This is done because the kernel no + longer needs to call out to an external binary. Instead + udevd will listen on a netlink socket for uevents that + the kernel raises. + + The /etc/rc.d/init.d/udev_retry initscript takes + care of re-triggering events for subsystems whose rules may rely on + filesystems that are not mounted until the mountfs + script is run (in particular, /usr + and /var may cause this). This + script runs after the mountfs script, so those rules + (if re-triggered) should succeed the second time around. It is + configured from the /etc/sysconfig/udev_retry file; + any words in this file other than comments are considered subsystem names + to trigger at retry time. To find the subsystem of a device, use + udevadm info --attribute-walk <device> where + <device> is an absolute path in /dev or /sys such as /dev/sr0 or + /sys/class/rtc. + + For information on kernel module loading and udev, see + . + + + + + Configuring the System Clock + + + setclock + configuring + + The setclock script reads the time from the hardware + clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor + (CMOS) clock. If the hardware clock is set to UTC, this script will convert the + hardware clock's time to the local time using the + /etc/localtime file (which tells the + hwclock program which timezone the user is in). There is no + way to detect whether or not the hardware clock is set to UTC, so this + needs to be configured manually. + + The setclock is run via + udev when the kernel detects the hardware + capability upon boot. It can also be run manually with the stop parameter to + store the system time to the CMOS clock. + + If you cannot remember whether or not the hardware clock is set to UTC, + find out by running the hwclock --localtime --show + command. This will display what the current time is according to the hardware + clock. If this time matches whatever your watch says, then the hardware clock is + set to local time. If the output from hwclock is not local + time, chances are it is set to UTC time. Verify this by adding or subtracting + the proper amount of hours for the timezone to the time shown by + hwclock. For example, if you are currently in the MST + timezone, which is also known as GMT -0700, add seven hours to the local + time. + + Change the value of the UTC variable below + to a value of 0 (zero) if the hardware clock + is not set to UTC time. + + Create a new file /etc/sysconfig/clock by running + the following: + +cat > /etc/sysconfig/clock << "EOF" +# Begin /etc/sysconfig/clock + +UTC=1 + +# Set this to any options you might need to give to hwclock, +# such as machine hardware clock type for Alphas. +CLOCKPARAMS= + +# End /etc/sysconfig/clock +EOF + + A good hint explaining how to deal with time on LFS is available + at . It explains issues such as + time zones, UTC, and the TZ environment variable. + + The CLOCKPARAMS and UTC paramaters may be alternatively set + in the /etc/sysconfig/rc.site file. + + + + + + + Configuring the Linux Console + + + console + configuring + + + This section discusses how to configure the console + bootscript that sets up the keyboard map, console font and console kernel log + level. If non-ASCII characters (e.g., the copyright sign, the British pound + sign and Euro symbol) will not be used and the keyboard is a U.S. one, much + of this section can be skipped. Without the configuration file, (or + equivalent settings in rc.site), the + console bootscript will do nothing. + + The console script reads the + /etc/sysconfig/console file for configuration + information. Decide which keymap and screen font will be used. Various + language-specific HOWTOs can also help with this, see . If still in + doubt, look in the /usr/share/keymaps + and /usr/share/consolefonts directories + for valid keymaps and screen fonts. Read loadkeys(1) and + setfont(8) manual pages to determine the correct + arguments for these programs. + + The /etc/sysconfig/console file should contain lines + of the form: VARIABLE="value". The following variables are recognized: + + + + LOGLEVEL + + This variable specifies the log level for kernel messages sent + to the console as set by dmesg -n. Valid levels are + from "1" (no messages) to "8". The default level is "7". + + + + + KEYMAP + + This variable specifies the arguments for the + loadkeys program, typically, the name of keymap + to load, e.g., it. If this variable is not set, the + bootscript will not run the loadkeys program, + and the default kernel keymap will be used. Note that a few keymaps + have multiple versions with the same name (cz and its variants in + qwerty/ and qwertz/, es in olpc/ and qwerty/, and trf in fgGIod/ and + qwerty/). In these cases the parent directory should also be specified + (e.g. qwerty/es) to ensure the proper keymap is loaded. + + + + + + KEYMAP_CORRECTIONS + + This (rarely used) variable + specifies the arguments for the second call to the + loadkeys program. This is useful if the stock keymap + is not completely satisfactory and a small adjustment has to be made. E.g., + to include the Euro sign into a keymap that normally doesn't have it, + set this variable to euro2. + + + + + FONT + + This variable specifies the arguments for the + setfont program. Typically, this includes the font + name, -m, and the name of the application character + map to load. E.g., in order to load the lat1-16 font + together with the 8859-1 application character map + (as it is appropriate in the USA), + + set this variable to lat1-16 -m 8859-1. + In UTF-8 mode, the kernel uses the application character map for + conversion of composed 8-bit key codes in the keymap to UTF-8, and thus + the argument of the "-m" parameter should be set to the encoding of the + composed key codes in the keymap. + + + + + + UNICODE + + Set this variable to 1, yes or + true in order to put the + console into UTF-8 mode. This is useful in UTF-8 based locales and + harmful otherwise. + + + + + LEGACY_CHARSET + + For many keyboard layouts, there is no stock Unicode keymap in + the Kbd package. The console bootscript will + convert an available keymap to UTF-8 on the fly if this variable is + set to the encoding of the available non-UTF-8 keymap. + + + + + + Some examples: + + + + + For a non-Unicode setup, only the KEYMAP and FONT variables are + generally needed. E.g., for a Polish setup, one would use: +cat > /etc/sysconfig/console << "EOF" +# Begin /etc/sysconfig/console + +KEYMAP="pl2" +FONT="lat2a-16 -m 8859-2" + +# End /etc/sysconfig/console +EOF + + + + As mentioned above, it is sometimes necessary to adjust a + stock keymap slightly. The following example adds the Euro symbol to the + German keymap: + +cat > /etc/sysconfig/console << "EOF" +# Begin /etc/sysconfig/console + +KEYMAP="de-latin1" +KEYMAP_CORRECTIONS="euro2" +FONT="lat0-16 -m 8859-15" +UNICODE="1" + +# End /etc/sysconfig/console +EOF + + + + The following is a Unicode-enabled example for Bulgarian, where a + stock UTF-8 keymap exists: + +cat > /etc/sysconfig/console << "EOF" +# Begin /etc/sysconfig/console + +UNICODE="1" +KEYMAP="bg_bds-utf8" +FONT="LatArCyrHeb-16" + +# End /etc/sysconfig/console +EOF + + + + Due to the use of a 512-glyph LatArCyrHeb-16 font in the previous + example, bright colors are no longer available on the Linux console unless + a framebuffer is used. If one wants to have bright colors without + framebuffer and can live without characters not belonging to his language, + it is still possible to use a language-specific 256-glyph font, as + illustrated below: + +cat > /etc/sysconfig/console << "EOF" +# Begin /etc/sysconfig/console + +UNICODE="1" +KEYMAP="bg_bds-utf8" +FONT="cyr-sun16" + +# End /etc/sysconfig/console +EOF + + + + The following example illustrates keymap autoconversion from + ISO-8859-15 to UTF-8 and enabling dead keys in Unicode mode: + +cat > /etc/sysconfig/console << "EOF" +# Begin /etc/sysconfig/console + +UNICODE="1" +KEYMAP="de-latin1" +KEYMAP_CORRECTIONS="euro2" +LEGACY_CHARSET="iso-8859-15" +FONT="LatArCyrHeb-16 -m 8859-15" + +# End /etc/sysconfig/console +EOF + + + + Some keymaps have dead keys (i.e., keys that don't produce a + character by themselves, but put an accent on the character produced + by the next key) or define composition rules (such as: press + Ctrl+. A E to get Æ in the default keymap). + Linux-&linux-version; interprets dead keys and composition rules in the + keymap correctly only when the source characters to be composed together + are not multibyte. This deficiency doesn't affect keymaps for European + languages, because there accents are added to unaccented ASCII + characters, or two ASCII characters are composed together. However, in + UTF-8 mode it is a problem, e.g., for the Greek language, where one + sometimes needs to put an accent on the letter alpha. + The solution is either to avoid the use of UTF-8, or to install the + X window system that doesn't have this limitation in its input + handling. + + + + For Chinese, Japanese, Korean and some other languages, the Linux + console cannot be configured to display the needed characters. Users + who need such languages should install the X Window System, fonts that + cover the necessary character ranges, and the proper input method (e.g., + SCIM, it supports a wide variety of languages). + + + + + + + The /etc/sysconfig/console file only controls + the Linux text console localization. It has nothing to do with setting + the proper keyboard layout and terminal fonts in the X Window System, with + ssh sessions or with a serial console. In such situations, limitations + mentioned in the last two list items above do not apply. + + + + + + Creating Files at Boot + + + File creation at boot + configuring + + + At times, it is desired to create files at boot time. For instance, + the /tmp/.ICE-unix directory + may be desired. This can be done by creating an entry in the + /etc/sysconfig/createfiles configuration script. + The format of this file is embedded in the comments of the default + configuration file. + + + + Configuring the sysklogd Script + + + sysklogd + configuring + + + The sysklogd script invokes the + syslogd program as a part of System V initialization. The + -m 0 option turns off the periodic timestamp mark that + syslogd writes to the log files every 20 minutes by + default. If you want to turn on this periodic timestamp mark, edit + /etc/sysconfig/rc.site and define the variable + SYSKLOGD_PARMS to the desired value. For instance, to remove all parameters, + set the variable to a null value: + +SYSKLOGD_PARMS= + + See man syslogd for more options. + + + + + The rc.site File + + + rc.site + + + The optional /etc/sysconfig/rc.site file contains + settings that are automatically set for each SystemV boot script. It can + alternatively set the values specified in the hostname, + console, and clock files in the + /etc/sysconfig/ directory. If the + associated variables are present in both these separate files and + rc.site, the values in the script specific files have + precedence. + + rc.site also contains parameters that can + customize other aspects of the boot process. Setting the IPROMPT variable + will enable selective running of bootscripts. Other options are described + in the file comments. The default version of the file is as follows: + + + &site; + + + Customizing the Boot and Shutdown Scripts + + The LFS boot scripts boot and shut down a system in a fairly + efficient manner, but there are a few tweaks that you can make in the + rc.site file to improve speed even more and to adjust messages according + to your preferences. To do this, adjust the settings in + the /etc/sysconfig/rc.site file above. + + + + During the boot script udev, there is + a call to udev settle that requires some time to + complete. This time may or may not be required depending on devices present + in the system. If you only have simple partitions and a single ethernet + card, the boot process will probably not need to wait for this command. To + skip it, set the variable OMIT_UDEV_SETTLE=y. + + The boot script udev_retry also runs + udev settle by default. This command is only needed by + default if the /var directory is + separately mounted. This is because the clock needs the file + /var/lib/hwclock/adjtime. Other customizations may + also need to wait for udev to complete, but in many installations it is not + needed. Skip the command by setting the variable OMIT_UDEV_RETRY_SETTLE=y. + + + By default, the file system checks are silent. This can + appear to be a delay during the bootup process. To turn on the + fsck output, set the variable VERBOSE_FSCK=y. + + + When rebooting, you may want to skip the filesystem check, + fsck, completely. To do this, either create the file + /fastboot or reboot the system with the command + /sbin/shutdown -f -r now. On the other hand, you can + force all file systems to be checked by creating + /forcefsck or running shutdown with + the -F parameter instead of -f. + + + Setting the variable FASTBOOT=y will disable fsck + during the boot process until it is removed. This is not recommended + on a permanent basis. + + Normally, all files in the /tmp directory are deleted at boot time. + Depending on the number of files or directories present, this can cause a + noticeable delay in the boot process. To skip removing these files set the + variable SKIPTMPCLEAN=y. + + During shutdown, the init program sends + a TERM signal to each program it has started (e.g. agetty), waits for a set + time (default 3 seconds), and sends each process a KILL signal and waits + again. This process is repeated in the sendsignals + script for any processes that are not shut down by their own scripts. The + delay for init can be set by passing a parameter. For + example to remove the delay in init, pass the -t0 + parameter when shutting down or rebooting (e.g. /sbin/shutdown + -t0 -r now). The delay for the sendsignals + script can be skipped by setting the parameter + KILLDELAY=0. + + + + + + diff --git a/chapter09/whatnow.xml b/chapter09/whatnow.xml deleted file mode 100644 index 273eb7740..000000000 --- a/chapter09/whatnow.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - %general-entities; -]> - - - - - What Now? - - Thank you for reading this LFS book. We hope that you have - found this book helpful and have learned more about the system - creation process. - - Now that the LFS system is installed, you may be wondering - What next? To answer that question, we have compiled a - list of resources for you. - - - - - Maintenance - - Bugs and security notices are reported regularly for all software. - Since an LFS system is compiled from source, it is up to you to keep - abreast of such reports. There are several online resources that track - such reports, some of which are shown below: - - - - - CERT (Computer - Emergency Response Team) - - CERT has a mailing list that publishes security alerts concerning - various operating systems and applications. Subscription information is - available at . - - - - Bugtraq - - Bugtraq is a full-disclosure computer security mailing list. It - publishes newly discovered security issues, and occasionally potential - fixes for them. Subscription information is available at . - - - - - - - Beyond Linux From Scratch - - The Beyond Linux From Scratch book covers installation - procedures for a wide range of software beyond the scope of the LFS - Book. The BLFS project is located at . - - - - LFS Hints - - The LFS Hints are a collection of educational documents - submitted by volunteers in the LFS community. The hints are available - at . - - - - Mailing lists - - There are several LFS mailing lists you may subscribe to if you - are in need of help, want to stay current with the latest developments, - want to contribute to the project, and more. See for more - information. - - - - The Linux Documentation Project - - The goal of The Linux Documentation Project (TLDP) is to - collaborate on all of the issues of Linux documentation. The TLDP features - a large collection of HOWTOs, guides, and man pages. It is located at - . - - - - - 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/chapter10/fstab.xml b/chapter10/fstab.xml new file mode 100644 index 000000000..ebfae3aaf --- /dev/null +++ b/chapter10/fstab.xml @@ -0,0 +1,125 @@ + + + %general-entities; +]> + + + + + Creating the /etc/fstab File + + + /etc/fstab + + + The /etc/fstab file is used by some programs to + determine where file systems are to be mounted by default, in which order, and + which must be checked (for integrity errors) prior to mounting. Create a new + file systems table like this: + +cat > /etc/fstab << "EOF" +# Begin /etc/fstab + +# file system mount-point type options dump fsck +# order + +/dev/<xxx> / <fff> defaults 1 1 +/dev/<yyy> swap swap pri=1 0 0 +proc /proc proc nosuid,noexec,nodev 0 0 +sysfs /sys sysfs nosuid,noexec,nodev 0 0 +devpts /dev/pts devpts gid=5,mode=620 0 0 +tmpfs /run tmpfs defaults 0 0 +devtmpfs /dev devtmpfs mode=0755,nosuid 0 0 + +# End /etc/fstab +EOF + +cat > /etc/fstab << "EOF" +# Begin /etc/fstab + +# file system mount-point type options dump fsck +# order + +/dev/<xxx> / <fff> defaults 1 1 +/dev/<yyy> swap swap pri=1 0 0 + +# End /etc/fstab +EOF + + Replace <xxx>, + <yyy>, and <fff> + with the values appropriate for the system, for example, sda2, sda5, and ext4. For details on the six + fields in this file, see man 5 fstab. + + Filesystems with MS-DOS or Windows origin (i.e. vfat, ntfs, smbfs, + cifs, iso9660, udf) need a special option, utf8, in order for non-ASCII + characters in file names to be interpreted properly. For non-UTF-8 locales, + the value of should be set to be the same as the + character set of the locale, adjusted in such a way that the kernel + understands it. This works if the relevant character set definition (found + under File systems -> Native Language Support when configuring the kernel) + has been compiled into the kernel or built as a module. However, if the + character set of the locale is UTF-8, the corresponding option + would make the file system case sensitive. To + fix this, use the special option instead of + , for UTF-8 locales. The + codepage option is also needed for vfat and smbfs filesystems. + It should be set to the codepage number used under MS-DOS in your country. + For example, in order to mount USB flash drives, a ru_RU.KOI8-R user would + need the following in the options portion of its mount line in + /etc/fstab: + +noauto,user,quiet,showexec,codepage=866,iocharset=koi8r + + The corresponding options fragment for ru_RU.UTF-8 users is: + +noauto,user,quiet,showexec,codepage=866,utf8 + + Note that using is the default for + iso8859-1 (which keeps the file system case + insensitive), and the option tells + the kernel to convert the file names using UTF-8 so they can be + interpreted in the UTF-8 locale. + + + + It is also possible to specify default codepage and iocharset values for + some filesystems during kernel configuration. The relevant parameters + are named + Default NLS Option (, + Default Remote NLS Option (), + Default codepage for FAT (), and + Default iocharset for FAT (). + There is no way to specify these settings for the + ntfs filesystem at kernel compilation time. + + It is possible to make the ext3 filesystem reliable across power + failures for some hard disk types. To do this, add the + mount option to the appropriate entry in + /etc/fstab. To check if the disk drive supports + this option, run + hdparm + on the applicable disk drive. For example, if: + +hdparm -I /dev/sda | grep NCQ + + returns non-empty output, the option is supported. + + Note: Logical Volume Management (LVM) based partitions cannot use the + option. + + 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/chapter10/kernel.xml b/chapter10/kernel.xml new file mode 100644 index 000000000..0033028cf --- /dev/null +++ b/chapter10/kernel.xml @@ -0,0 +1,403 @@ + + + %general-entities; +]> + + + + + + kernel + &linux-version; +
&linux-url;
+
+ + Linux-&linux-version; + + + Linux + + + + + + <para>The Linux package contains the Linux kernel.</para> + + <segmentedlist> + <segtitle>&buildtime;</segtitle> + <segtitle>&diskspace;</segtitle> + + <seglistitem> + <seg>&linux-ch8-sbu;</seg> + <seg>&linux-ch8-du;</seg> + </seglistitem> + </segmentedlist> + + </sect2> + + <sect2 role="installation"> + <title>Installation of the kernel + + Building the kernel involves a few steps—configuration, + compilation, and installation. Read the README file + in the kernel source tree for alternative methods to the way this book + configures the kernel. + + Prepare for compilation by running the following command: + +make mrproper + + This ensures that the kernel tree is absolutely clean. The + kernel team recommends that this command be issued prior to each + kernel compilation. Do not rely on the source tree being clean after + un-tarring. + + + + Configure the kernel via a menu-driven interface. For general + information on kernel configuration see . BLFS has some information + regarding particular kernel configuration requirements of packages outside + of LFS at . Additional + information about configuring and building the kernel can be found at + + + + + A good starting place for setting up the kernel configuration is to + run make defconfig. This will set the base + configuration to a good state that takes your current system architecture + into account. + + Be sure to enable/disable/set the following features or the system might + not work correctly or boot at all: + + +Device Drivers ---> + Generic Driver Options ---> + [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] + [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] + +Kernel hacking ---> + Choose kernel unwinder (Frame pointer unwinder) ---> [CONFIG_UNWINDER_FRAME_POINTER] + + +General setup --> + [*] Control Group support [CONFIG_CGROUPS] + [ ] Enable deprecated sysfs features to support old userspace tools [CONFIG_SYSFS_DEPRECATED] + [*] Configure standard kernel features (expert users) [CONFIG_EXPERT] ---> + [*] open by fhandle syscalls [CONFIG_FHANDLE] + [ ] Auditing support [CONFIG_AUDIT] +Processor type and features ---> + [*] Enable seccomp to safely compute untrusted bytecode [CONFIG_SECCOMP] +Firmware Drivers ---> + [*] Export DMI identification via sysfs to userspace [CONFIG_DMIID] +Networking support ---> + Networking options ---> + <*> The IPv6 protocol [CONFIG_IPV6] +Device Drivers ---> + Generic Driver Options ---> + [ ] Support for uevent helper [CONFIG_UEVENT_HELPER] + [*] Maintain a devtmpfs filesystem to mount at /dev [CONFIG_DEVTMPFS] + Firmware Loader ---> + [ ] Enable the firmware sysfs fallback mechanism [CONFIG_FW_LOADER_USER_HELPER] +File systems ---> + [*] Inotify support for userspace [CONFIG_INOTIFY_USER] + <*> Kernel automounter support (supports v3, v4, and v5) [CONFIG_AUTOFS_FS] + Pseudo filesystems ---> + [*] Tmpfs POSIX Access Control Lists [CONFIG_TMPFS_POSIX_ACL] + [*] Tmpfs extended attributes [CONFIG_TMPFS_XATTR] + + + + While "The IPv6 Protocol" is not strictly + required, it is highly recommended by the systemd developers. + + + There are several other options that may be desired + depending on the requirements for the system. For a list of options needed + for BLFS packages, see the BLFS + Index of Kernel Settings + (&lfs-root;blfs/view/&short-version;/longindex.html#kernel-config-index). + + + If your host hardware is using UEFI, then the 'make defconfig' + above should automatically add in some EFI-related kernel options. + + In order to allow your LFS kernel to be booted from within your + host's UEFI boot environment, your kernel must have this option + selected: + +Processor type and features ---> + [*] EFI stub support [CONFIG_EFI_STUB] + + A fuller description of managing UEFI environments from within LFS + is covered by the lfs-uefi.txt hint at + . + + + + + The rationale for the above configuration items: + + + Support for uevent helper + + Having this option set may interfere with device + management when using Udev/Eudev. + + + + + Maintain a devtmpfs + + This will create automated device nodes which are populated by the + kernel, even without Udev running. Udev then runs on top of this, + managing permissions and adding symlinks. This configuration + item is required for all users of Udev/Eudev. + + + + + +make menuconfig + + + The meaning of optional make environment variables: + + + LANG=<host_LANG_value> LC_ALL= + + This establishes the locale setting to the one used on the + host. This may be needed for a proper menuconfig ncurses interface + line drawing on a UTF-8 linux text console. + + If used, be sure to replace + <host_LANG_value> by the value of + the $LANG variable from your host. You can + alternatively use instead the host's value of $LC_ALL + or $LC_CTYPE. + + + + + + Alternatively, make oldconfig may be more + appropriate in some situations. See the README + file for more information. + + If desired, skip kernel configuration by copying the kernel + config file, .config, from the host system + (assuming it is available) to the unpacked linux-&linux-version; directory. However, + we do not recommend this option. It is often better to explore all the + configuration menus and create the kernel configuration from + scratch. + + Compile the kernel image and modules: + +make + + If using kernel modules, module configuration in /etc/modprobe.d may be required. + Information pertaining to modules and kernel configuration is + located in and in the kernel + documentation in the linux-&linux-version;/Documentation directory. + Also, modprobe.d(5) may be of interest. + + Unless module support has been disabled in the kernel configuration, + install the modules with: + +make modules_install + + After kernel compilation is complete, additional steps are + required to complete the installation. Some files need to be copied to + the /boot directory. + + + If the host system has a separate /boot partition, the files copied + below should go there. The easiest way to do that is to bind /boot on the + host (outside chroot) to /mnt/lfs/boot before proceeding. As the root + user in the host system: + +mount --bind /boot /mnt/lfs/boot + + + The path to the kernel image may vary depending on the platform being + used. The filename below can be changed to suit your taste, but the stem of + the filename should be vmlinuz to be compatible with + the automatic setup of the boot process described in the next section. The + following command assumes an x86 architecture: + +cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&version; + +cp -iv arch/x86/boot/bzImage /boot/vmlinuz-&linux-version;-lfs-&versiond; + + System.map is a symbol file for the kernel. + It maps the function entry points of every function in the kernel API, + as well as the addresses of the kernel data structures for the running + kernel. It is used as a resource when investigating kernel problems. + Issue the following command to install the map file: + +cp -iv System.map /boot/System.map-&linux-version; + + The kernel configuration file .config + produced by the make menuconfig step + above contains all the configuration selections for the kernel + that was just compiled. It is a good idea to keep this file for future + reference: + +cp -iv .config /boot/config-&linux-version; + + Install the documentation for the Linux kernel: + +install -d /usr/share/doc/linux-&linux-version; +cp -r Documentation/* /usr/share/doc/linux-&linux-version; + + It is important to note that the files in the kernel source + directory are not owned by root. Whenever a + package is unpacked as user root (like we did + inside chroot), the files have the user and group IDs of whatever + they were on the packager's computer. This is usually not a problem + for any other package to be installed because the source tree is + removed after the installation. However, the Linux source tree is + often retained for a long time. Because of this, there is a chance + that whatever user ID the packager used will be assigned to somebody + on the machine. That person would then have write access to the kernel + source. + + + In many cases, the configuration of the kernel will need to be + updated for packages that will be installed later in BLFS. Unlike + other packages, it is not necessary to remove the kernel source tree + after the newly built kernel is installed. + + If the kernel source tree is going to be retained, run + chown -R 0:0 on the linux-&linux-version; directory to ensure + all files are owned by user root. + + + + Some kernel documentation recommends creating a symlink from + /usr/src/linux pointing to the kernel + source directory. This is specific to kernels prior to the 2.6 series and + must not be created on an LFS system as it can cause + problems for packages you may wish to build once your base LFS system is + complete. + + + + The headers in the system's include directory (/usr/include) should + always be the ones against which Glibc was compiled, + that is, the sanitised headers installed in . Therefore, they should + never be replaced by either the raw kernel headers + or any other kernel sanitized headers. + + + + + + Configuring Linux Module Load Order + + + /etc/modprobe.d/usb.conf + + + Most of the time Linux modules are loaded automatically, but + sometimes it needs some specific direction. The program that loads + modules, modprobe or insmod, uses + /etc/modprobe.d/usb.conf for this purpose. This file + needs to be created so that if the USB drivers (ehci_hcd, ohci_hcd and + uhci_hcd) have been built as modules, they will be loaded in the correct + order; ehci_hcd needs to be loaded prior to ohci_hcd and uhci_hcd in order + to avoid a warning being output at boot time. + + Create a new file /etc/modprobe.d/usb.conf by running + the following: + +install -v -m755 -d /etc/modprobe.d +cat > /etc/modprobe.d/usb.conf << "EOF" +# Begin /etc/modprobe.d/usb.conf + +install ohci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i ohci_hcd ; true +install uhci_hcd /sbin/modprobe ehci_hcd ; /sbin/modprobe -i uhci_hcd ; true + +# End /etc/modprobe.d/usb.conf +EOF + + + + + Contents of Linux + + + Installed files + Installed directories + + + config-&linux-version;, + vmlinuz-&linux-version;-lfs-&version;, + vmlinuz-&linux-version;-lfs-&versiond;, + and System.map-&linux-version; + /lib/modules, /usr/share/doc/linux-&linux-version; + + + + + Short Descriptions + + + + + config-&linux-version; + + Contains all the configuration selections for the kernel + + /boot/config-&linux-version; + + + + + + vmlinuz-&linux-version;-lfs-&version; + vmlinuz-&linux-version;-lfs-&versiond; + + The engine of the Linux system. When turning on the computer, + the kernel is the first part of the operating system that gets loaded. + It detects and initializes all components of the computer's hardware, + then makes these components available as a tree of files to the + software and turns a single CPU into a multitasking machine capable + of running scores of programs seemingly at the same time + + lfskernel-&linux-version; + + + + + + System.map-&linux-version; + + A list of addresses and symbols; it maps the entry points and + addresses of all the functions and data structures in the + kernel + + /boot/System.map-&linux-version; + + + + + + + + +
diff --git a/chapter11/chapter11.xml b/chapter11/chapter11.xml new file mode 100644 index 000000000..8b4c53a1d --- /dev/null +++ b/chapter11/chapter11.xml @@ -0,0 +1,19 @@ + + + %general-entities; +]> + + + + + + The End + + + + + + + diff --git a/chapter11/getcounted.xml b/chapter11/getcounted.xml new file mode 100644 index 000000000..bc0ad8908 --- /dev/null +++ b/chapter11/getcounted.xml @@ -0,0 +1,20 @@ + + + %general-entities; +]> + + + + + Get Counted + + Now that you have finished the book, do you want to be counted as an + LFS user? Head over to and + register as an LFS user by entering your name and the first LFS version you + have used. + + Let's reboot into LFS now. + + diff --git a/chapter11/reboot.xml b/chapter11/reboot.xml new file mode 100644 index 000000000..c6a857dbd --- /dev/null +++ b/chapter11/reboot.xml @@ -0,0 +1,113 @@ + + + %general-entities; +]> + + + + + Rebooting the System + + Now that all of the software has been installed, it is time to reboot + your computer. However, you should be aware of a few things. The system you + have created in this book is quite minimal, and most likely will not have + the functionality you would need to be able to continue forward. By installing + a few extra packages from the BLFS book while still in our current chroot + environment, you can leave yourself in a much better position to continue on + once you reboot into your new LFS installation. Here are some suggestions: + + + + A text mode browser such as Lynx + will allow you to easily view the BLFS book in one virtual terminal, while + building packages in another. + + The GPM package will allow + you to perform copy/paste actions in your virtual + terminals. + + If you are in a situation where static IP configuration + does not meet your networking requirements, installing a package + such as dhcpcd + or the client portion of dhcp may be + useful. + + Installing sudo may be useful for + building packages as a non-root user and easily installing the resulting + packages in your new system. + + If you want to access your new system from a remote system + within a comfortable GUI environment, install openssh. + + + To make fetching files over the internet easier, install + wget. + + + If one or more of your disk drives have a GUID partition + table (GPT), either gptfdisk or parted will be useful. + + + Finally, a review of the following configuration files + is also appropriate at this point. + + + /etc/bashrc + /etc/dircolors + /etc/fstab + /etc/hosts + /etc/inputrc + /etc/profile + /etc/resolv.conf + /etc/vimrc + /root/.bash_profile + /root/.bashrc + /etc/sysconfig/ifconfig.eth0 + + + + + Now that we have said that, let's move on to booting our shiny new LFS + installation for the first time! First exit from the chroot environment: + +logout + + Then unmount the virtual file systems: + +umount -v $LFS/dev/pts +umount -v $LFS/dev +umount -v $LFS/run +umount -v $LFS/proc +umount -v $LFS/sys + + Unmount the LFS file system itself: + +umount -v $LFS + + If multiple partitions were created, unmount the other + partitions before unmounting the main one, like this: + +umount -v $LFS/usr +umount -v $LFS/home +umount -v $LFS + + Now, reboot the system with: + +shutdown -r now + + Assuming the GRUB boot loader was set up as outlined earlier, the menu + is set to boot LFS &version; automatically. + + When the reboot is complete, the LFS system is ready for use and + more software may be added to suit your needs. + + diff --git a/chapter11/theend.xml b/chapter11/theend.xml new file mode 100644 index 000000000..9f2ca17cc --- /dev/null +++ b/chapter11/theend.xml @@ -0,0 +1,84 @@ + + + %general-entities; +]> + + + + + The End + + + /etc/lfs-release + + + + /etc/lsb-release + + + + /etc/os-release + + + Well done! The new LFS system is installed! We wish you much + success with your shiny new custom-built Linux system. + + It may be a good idea to create an + /etc/lfs-release file. By having this file, it is very + easy for you (and for us if you need to ask for help at some point) to find + out which LFS version is installed on the system. Create this file by + running: + +echo &version; > /etc/lfs-release + +echo &versiond; > /etc/lfs-release + + Two files describing the installed system may be used by packages + that will be installed on the system, either in binary form or by building + them. + + The first one shows the status of your + new system with respect to the Linux Standards Base (LSB). To create + this file, run: + +cat > /etc/lsb-release << "EOF" +DISTRIB_ID="Linux From Scratch" +DISTRIB_RELEASE="&version;" +DISTRIB_CODENAME="<your name here>" +DISTRIB_DESCRIPTION="Linux From Scratch" +EOF + +cat > /etc/lsb-release << "EOF" +DISTRIB_ID="Linux From Scratch" +DISTRIB_RELEASE="&versiond;" +DISTRIB_CODENAME="<your name here>" +DISTRIB_DESCRIPTION="Linux From Scratch" +EOF + + The second one contains roughly the same information, and is used + by systemd and some graphical desktop environments. To create + this file, run: + +cat > /etc/os-release << "EOF" +NAME="Linux From Scratch" +VERSION="&version;" +ID=lfs +PRETTY_NAME="Linux From Scratch &version;" +VERSION_CODENAME="<your name here>" +EOF + +cat > /etc/os-release << "EOF" +NAME="Linux From Scratch" +VERSION="&versiond;" +ID=lfs +PRETTY_NAME="Linux From Scratch &versiond;" +VERSION_CODENAME="<your name here>" +EOF + + Be sure to put some sort of customization for the fields + 'DISTRIB_CODENAME' and 'VERSION_CODENAME' to make the system uniquely + yours. + + diff --git a/chapter11/whatnow.xml b/chapter11/whatnow.xml new file mode 100644 index 000000000..273eb7740 --- /dev/null +++ b/chapter11/whatnow.xml @@ -0,0 +1,92 @@ + + + %general-entities; +]> + + + + + What Now? + + Thank you for reading this LFS book. We hope that you have + found this book helpful and have learned more about the system + creation process. + + Now that the LFS system is installed, you may be wondering + What next? To answer that question, we have compiled a + list of resources for you. + + + + + Maintenance + + Bugs and security notices are reported regularly for all software. + Since an LFS system is compiled from source, it is up to you to keep + abreast of such reports. There are several online resources that track + such reports, some of which are shown below: + + + + + CERT (Computer + Emergency Response Team) + + CERT has a mailing list that publishes security alerts concerning + various operating systems and applications. Subscription information is + available at . + + + + Bugtraq + + Bugtraq is a full-disclosure computer security mailing list. It + publishes newly discovered security issues, and occasionally potential + fixes for them. Subscription information is available at . + + + + + + + Beyond Linux From Scratch + + The Beyond Linux From Scratch book covers installation + procedures for a wide range of software beyond the scope of the LFS + Book. The BLFS project is located at . + + + + LFS Hints + + The LFS Hints are a collection of educational documents + submitted by volunteers in the LFS community. The hints are available + at . + + + + Mailing lists + + There are several LFS mailing lists you may subscribe to if you + are in need of help, want to stay current with the latest developments, + want to contribute to the project, and more. See for more + information. + + + + The Linux Documentation Project + + The goal of The Linux Documentation Project (TLDP) is to + collaborate on all of the issues of Linux documentation. The TLDP features + a large collection of HOWTOs, guides, and man pages. It is located at + . + + + + + 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 -- cgit v1.2.3-54-g00ecf From 22422a8a13083ea8efc196dc410cfac0f498856c Mon Sep 17 00:00:00 2001 From: Pierre Labastie Date: Mon, 8 Jun 2020 08:12:16 +0000 Subject: Remove unneeded files in chapter 6, and fix href' in chapter 7 git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11901 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- chapter06/binutils-pass1.xml | 156 ------------------ chapter06/bison.xml | 82 ---------- chapter06/bzip2.xml | 112 ------------- chapter06/chroot.xml | 65 -------- chapter06/createfiles.xml | 204 ----------------------- chapter06/creatingdirs.xml | 59 ------- chapter06/dejagnu.xml | 96 ----------- chapter06/expect.xml | 139 ---------------- chapter06/flex.xml | 88 ---------- chapter06/gcc-pass1.xml | 208 ----------------------- chapter06/generalinstructions.xml | 120 -------------- chapter06/gettext.xml | 85 ---------- chapter06/glibc.xml | 230 -------------------------- chapter06/kernfs.xml | 115 ------------- chapter06/libstdc++-pass2.xml | 114 ------------- chapter06/libstdc++.xml | 122 -------------- chapter06/linux-headers.xml | 207 ----------------------- chapter06/perl.xml | 79 --------- chapter06/python.xml | 88 ---------- chapter06/tcl.xml | 191 ---------------------- chapter06/texinfo.xml | 74 --------- chapter06/toolchaintechnotes.xml | 335 -------------------------------------- chapter06/util-linux.xml | 113 ------------- chapter07/bash.xml | 2 +- chapter07/binutils-pass1.xml | 2 +- chapter07/binutils-pass2.xml | 2 +- chapter07/bison.xml | 2 +- chapter07/bzip2.xml | 2 +- chapter07/coreutils.xml | 2 +- chapter07/diffutils.xml | 2 +- chapter07/file.xml | 2 +- chapter07/findutils.xml | 2 +- chapter07/flex.xml | 2 +- chapter07/gawk.xml | 2 +- chapter07/gcc-pass1.xml | 2 +- chapter07/gcc-pass2.xml | 2 +- chapter07/gettext.xml | 2 +- chapter07/glibc.xml | 2 +- chapter07/grep.xml | 2 +- chapter07/gzip.xml | 2 +- chapter07/m4.xml | 2 +- chapter07/make.xml | 2 +- chapter07/ncurses.xml | 2 +- chapter07/patch.xml | 2 +- chapter07/python.xml | 2 +- chapter07/sed.xml | 2 +- chapter07/tar.xml | 2 +- chapter07/texinfo.xml | 2 +- chapter07/xz.xml | 2 +- 49 files changed, 26 insertions(+), 3108 deletions(-) delete mode 100644 chapter06/binutils-pass1.xml delete mode 100644 chapter06/bison.xml delete mode 100644 chapter06/bzip2.xml delete mode 100644 chapter06/chroot.xml delete mode 100644 chapter06/createfiles.xml delete mode 100644 chapter06/creatingdirs.xml delete mode 100644 chapter06/dejagnu.xml delete mode 100644 chapter06/expect.xml delete mode 100644 chapter06/flex.xml delete mode 100644 chapter06/gcc-pass1.xml delete mode 100644 chapter06/generalinstructions.xml delete mode 100644 chapter06/gettext.xml delete mode 100644 chapter06/glibc.xml delete mode 100644 chapter06/kernfs.xml delete mode 100644 chapter06/libstdc++-pass2.xml delete mode 100644 chapter06/libstdc++.xml delete mode 100644 chapter06/linux-headers.xml delete mode 100644 chapter06/perl.xml delete mode 100644 chapter06/python.xml delete mode 100644 chapter06/tcl.xml delete mode 100644 chapter06/texinfo.xml delete mode 100644 chapter06/toolchaintechnotes.xml delete mode 100644 chapter06/util-linux.xml (limited to 'chapter06/linux-headers.xml') diff --git a/chapter06/binutils-pass1.xml b/chapter06/binutils-pass1.xml deleted file mode 100644 index 8658cfcfe..000000000 --- a/chapter06/binutils-pass1.xml +++ /dev/null @@ -1,156 +0,0 @@ - - - %general-entities; -]> - - - - - - binutils-pass1 - &binutils-version; -
&binutils-url;
-
- - 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/bison.xml b/chapter06/bison.xml deleted file mode 100644 index afe84a403..000000000 --- a/chapter06/bison.xml +++ /dev/null @@ -1,82 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-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="../chapter08/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/chapter06/bzip2.xml b/chapter06/bzip2.xml deleted file mode 100644 index 828b7fc0f..000000000 --- a/chapter06/bzip2.xml +++ /dev/null @@ -1,112 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-bzip2" role="wrap"> - <?dbhtml filename="bzip2.html"?> - - <sect1info condition="script"> - <productname>bzip2</productname> - <productnumber>&bzip2-version;</productnumber> - <address>&bzip2-url;</address> - </sect1info> - - <title>Bzip2-&bzip2-version; - - - Bzip2 - tools - - - - - - <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/bzip2.xml" - xpointer="xpointer(/sect1/sect2[1]/para[1])"/> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&bzip2-ch5-sbu;</seg> - <seg>&bzip2-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Bzip2 - - 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/chapter06/chroot.xml b/chapter06/chroot.xml deleted file mode 100644 index 5b6310af7..000000000 --- a/chapter06/chroot.xml +++ /dev/null @@ -1,65 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-chroot"> - <?dbhtml filename="chroot.html"?> - - <title>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/createfiles.xml b/chapter06/createfiles.xml deleted file mode 100644 index aed8d79da..000000000 --- a/chapter06/createfiles.xml +++ /dev/null @@ -1,204 +0,0 @@ - - - %general-entities; -]> - - - - - Creating Essential Files and Symlinks - - - /etc/passwd - - - - /etc/group - - - - /var/run/utmp - - - - /var/log/btmp - - - - /var/log/lastlog - - - - /var/log/wtmp - - - Historically, Linux maintains a list of the mounted file systems in the - file /etc/mtab. Modern kernels maintain this list - internally and exposes it to the user via the /proc filesystem. To satisfy utilities that - expect the presence of /etc/mtab, create the following - symbolic link: - -ln -sv /proc/self/mounts /etc/mtab - - In order for user root to be - able to login and for the name root to be recognized, there - must be relevant entries in the /etc/passwd and - /etc/group files. - - Create the /etc/passwd file by running the following - command: - -cat > /etc/passwd << "EOF" -root:x:0:0:root:/root:/bin/bash -bin:x:1:1:bin:/dev/null:/bin/false -daemon:x:6:6:Daemon User:/dev/null:/bin/false -messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false -nobody:x:99:99:Unprivileged User:/dev/null:/bin/false -EOF - -cat > /etc/passwd << "EOF" -root:x:0:0:root:/root:/bin/bash -bin:x:1:1:bin:/dev/null:/bin/false -daemon:x:6:6:Daemon User:/dev/null:/bin/false -messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false -systemd-bus-proxy:x:72:72:systemd Bus Proxy:/:/bin/false -systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/bin/false -systemd-journal-remote:x:74:74:systemd Journal Remote:/:/bin/false -systemd-journal-upload:x:75:75:systemd Journal Upload:/:/bin/false -systemd-network:x:76:76:systemd Network Management:/:/bin/false -systemd-resolve:x:77:77:systemd Resolver:/:/bin/false -systemd-timesync:x:78:78:systemd Time Synchronization:/:/bin/false -systemd-coredump:x:79:79:systemd Core Dumper:/:/bin/false -nobody:x:99:99:Unprivileged User:/dev/null:/bin/false -EOF - - The actual password for root - (the x used here is just a placeholder) will be set later. - - Create the /etc/group file by running the following - command: - -cat > /etc/group << "EOF" -root:x:0: -bin:x:1:daemon -sys:x:2: -kmem:x:3: -tape:x:4: -tty:x:5: -daemon:x:6: -floppy:x:7: -disk:x:8: -lp:x:9: -dialout:x:10: -audio:x:11: -video:x:12: -utmp:x:13: -usb:x:14: -cdrom:x:15: -adm:x:16: -messagebus:x:18: -input:x:24: -mail:x:34: -kvm:x:61: -wheel:x:97: -nogroup:x:99: -users:x:999: -EOF - -cat > /etc/group << "EOF" -root:x:0: -bin:x:1:daemon -sys:x:2: -kmem:x:3: -tape:x:4: -tty:x:5: -daemon:x:6: -floppy:x:7: -disk:x:8: -lp:x:9: -dialout:x:10: -audio:x:11: -video:x:12: -utmp:x:13: -usb:x:14: -cdrom:x:15: -adm:x:16: -messagebus:x:18: -systemd-journal:x:23: -input:x:24: -mail:x:34: -kvm:x:61: -systemd-bus-proxy:x:72: -systemd-journal-gateway:x:73: -systemd-journal-remote:x:74: -systemd-journal-upload:x:75: -systemd-network:x:76: -systemd-resolve:x:77: -systemd-timesync:x:78: -systemd-coredump:x:79: -wheel:x:97: -nogroup:x:99: -users:x:999: -EOF - - The created groups are not part of any standard—they are groups - decided on in part by the requirements of the Udev configuration in the next - chapter, and in part by common convention employed by a number of existing - Linux distributions. In addition, some test suites rely on specific users - or groups. The Linux Standard Base (LSB, available at ) recommends only that, besides the group - root with a Group ID (GID) of 0, - a group bin with a GID of 1 be - present. All other group names and GIDs can be chosen freely by the system - administrator since well-written programs do not depend on GID numbers, but - rather use the group's name. - - Some tests in need a regular - user. We add this user here and delete this account at the end of that - chapter. - -echo "tester:x:$(ls -n $(tty) | cut -d" " -f3):101::/home/tester:/bin/bash" >> /etc/passwd -echo "tester:x:101:" >> /etc/group -install -o tester -d /home/tester - - To remove the I have no name! prompt, start a new - shell. Since the - /etc/passwd and /etc/group - files have been created, user name and group name resolution will now - work: - -exec /bin/bash --login +h - - Note the use of the +h directive. This tells - bash not to use its internal path hashing. Without this - directive, bash would remember the paths to binaries it has - executed. To ensure the use of the newly compiled binaries as soon as they are - installed, the +h directive will be used for the duration - of this chapter. - - The login, agetty, and - init programs (and others) use a number of log - files to record information such as who was logged into the system and - when. However, these programs will not write to the log files if they - do not already exist. Initialize the log files and give them - proper permissions: - -touch /var/log/{btmp,lastlog,faillog,wtmp} -chgrp -v utmp /var/log/lastlog -chmod -v 664 /var/log/lastlog -chmod -v 600 /var/log/btmp - - The /var/log/wtmp file records all logins and - logouts. The /var/log/lastlog file records when each - user last logged in. The /var/log/faillog file records - failed login attempts. The /var/log/btmp file records - the bad login attempts. - - The /run/utmp file records the users that - are currently logged in. This file is created dynamically in the boot - scripts. - - diff --git a/chapter06/creatingdirs.xml b/chapter06/creatingdirs.xml deleted file mode 100644 index 359717ff7..000000000 --- a/chapter06/creatingdirs.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - %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 deleted file mode 100644 index 8f1ab7648..000000000 --- a/chapter06/dejagnu.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - %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/expect.xml b/chapter06/expect.xml deleted file mode 100644 index 20b227ea5..000000000 --- a/chapter06/expect.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - %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/flex.xml b/chapter06/flex.xml deleted file mode 100644 index 88e263413..000000000 --- a/chapter06/flex.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - %general-entities; -]> - - - - - - flex - &flex-version; -
&flex-url;
-
- - 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/chapter06/gcc-pass1.xml b/chapter06/gcc-pass1.xml deleted file mode 100644 index 1bd308f09..000000000 --- a/chapter06/gcc-pass1.xml +++ /dev/null @@ -1,208 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-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/generalinstructions.xml b/chapter06/generalinstructions.xml deleted file mode 100644 index 05b88b98c..000000000 --- a/chapter06/generalinstructions.xml +++ /dev/null @@ -1,120 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-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 deleted file mode 100644 index 34d0ee32e..000000000 --- a/chapter06/gettext.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - %general-entities; -]> - - - - - - gettext - &gettext-version; -
&gettext-url;
-
- - Gettext-&gettext-version; - - - Gettext - tools - - - - - - <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-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/chapter06/glibc.xml b/chapter06/glibc.xml deleted file mode 100644 index 5213c23e5..000000000 --- a/chapter06/glibc.xml +++ /dev/null @@ -1,230 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-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/chapter06/kernfs.xml b/chapter06/kernfs.xml deleted file mode 100644 index dd6b8991c..000000000 --- a/chapter06/kernfs.xml +++ /dev/null @@ -1,115 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-kernfs"> - <?dbhtml filename="kernfs.html"?> - - <title>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 deleted file mode 100644 index 999a4fa4e..000000000 --- a/chapter06/libstdc++-pass2.xml +++ /dev/null @@ -1,114 +0,0 @@ - - - %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 deleted file mode 100644 index 3a1b0f2bf..000000000 --- a/chapter06/libstdc++.xml +++ /dev/null @@ -1,122 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-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 deleted file mode 100644 index 6c1af3173..000000000 --- a/chapter06/linux-headers.xml +++ /dev/null @@ -1,207 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-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/perl.xml b/chapter06/perl.xml deleted file mode 100644 index 663d3dbc2..000000000 --- a/chapter06/perl.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - %general-entities; -]> - - - - - - perl - &perl-version; -
&perl-url;
-
- - Perl-&perl-version; - - - Perl - tools - - - - - - <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-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/chapter06/python.xml b/chapter06/python.xml deleted file mode 100644 index 52c070ab3..000000000 --- a/chapter06/python.xml +++ /dev/null @@ -1,88 +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-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="../chapter08/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/chapter06/tcl.xml b/chapter06/tcl.xml deleted file mode 100644 index bd17a91a8..000000000 --- a/chapter06/tcl.xml +++ /dev/null @@ -1,191 +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; - <!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/chapter06/texinfo.xml b/chapter06/texinfo.xml deleted file mode 100644 index 8434c7112..000000000 --- a/chapter06/texinfo.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - %general-entities; -]> - - - - - - texinfo - &texinfo-version; -
&texinfo-url;
-
- - Texinfo-&texinfo-version; - - - Texinfo - temporary - - - - - - <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-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/chapter06/toolchaintechnotes.xml b/chapter06/toolchaintechnotes.xml deleted file mode 100644 index 63c9210e5..000000000 --- a/chapter06/toolchaintechnotes.xml +++ /dev/null @@ -1,335 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" - "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ - <!ENTITY % general-entities SYSTEM "../general.ent"> - %general-entities; -]> - -<sect1 id="ch-tools-toolchaintechnotes"> - <?dbhtml filename="toolchaintechnotes.html"?> - - <title>Toolchain Technical Notes - - This section explains some of the rationale and technical details - behind the overall build method. It is not essential to immediately - understand everything in this section. Most of this information will be - clearer after performing an actual build. This section can be referred - to at any time during the process. - - The overall goal of is to - produce a temporary area that contains a known-good set of tools that can be - isolated from the host system. By using chroot, the - commands in the remaining chapters will be contained within that environment, - ensuring a clean, trouble-free build of the target LFS system. The build - process has been designed to minimize the risks for new readers and to provide - the most educational value at the same time. - - 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 deleted file mode 100644 index 6aebad7a1..000000000 --- a/chapter06/util-linux.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - %general-entities; -]> - - - - - - util-linux - &util-linux-version; -
&util-linux-url;
-
- - Util-linux-&util-linux-version; - - - Util-linux - tools - - - - - - <para>The Util-linux package contains miscellaneous utility programs.</para> - - <segmentedlist> - <segtitle>&buildtime;</segtitle> - <segtitle>&diskspace;</segtitle> - - <seglistitem> - <seg>&util-linux-ch5-sbu;</seg> - <seg>&util-linux-ch5-du;</seg> - </seglistitem> - </segmentedlist> - - </sect2> - - <sect2 role="installation"> - <title>Installation of Util-linux - - 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/bash.xml b/chapter07/bash.xml index ee1fb574e..92627e92c 100644 --- a/chapter07/bash.xml +++ b/chapter07/bash.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/bash.xml" + href="../chapter08/bash.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/binutils-pass1.xml b/chapter07/binutils-pass1.xml index 8658cfcfe..e91c64a62 100644 --- a/chapter07/binutils-pass1.xml +++ b/chapter07/binutils-pass1.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/binutils.xml" + href="../chapter08/binutils.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/binutils-pass2.xml b/chapter07/binutils-pass2.xml index 5d0fd7e6d..d88bb84e2 100644 --- a/chapter07/binutils-pass2.xml +++ b/chapter07/binutils-pass2.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/binutils.xml" + href="../chapter08/binutils.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/bison.xml b/chapter07/bison.xml index 3ed86713a..afe84a403 100644 --- a/chapter07/bison.xml +++ b/chapter07/bison.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/bison.xml" + href="../chapter08/bison.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/bzip2.xml b/chapter07/bzip2.xml index 828b7fc0f..3288b2a81 100644 --- a/chapter07/bzip2.xml +++ b/chapter07/bzip2.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/bzip2.xml" + href="../chapter08/bzip2.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/coreutils.xml b/chapter07/coreutils.xml index f1e380f7e..378abebff 100644 --- a/chapter07/coreutils.xml +++ b/chapter07/coreutils.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/coreutils.xml" + href="../chapter08/coreutils.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/diffutils.xml b/chapter07/diffutils.xml index 194fe4607..6594058be 100644 --- a/chapter07/diffutils.xml +++ b/chapter07/diffutils.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/diffutils.xml" + href="../chapter08/diffutils.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/file.xml b/chapter07/file.xml index 5a821d180..83a473b70 100644 --- a/chapter07/file.xml +++ b/chapter07/file.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/file.xml" + href="../chapter08/file.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/findutils.xml b/chapter07/findutils.xml index 073c1640c..bf9f9c62a 100644 --- a/chapter07/findutils.xml +++ b/chapter07/findutils.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/findutils.xml" + href="../chapter08/findutils.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/flex.xml b/chapter07/flex.xml index 88e263413..076ca927c 100644 --- a/chapter07/flex.xml +++ b/chapter07/flex.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/flex.xml" + href="../chapter08/flex.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/gawk.xml b/chapter07/gawk.xml index d5b5d6d8d..105abdb8e 100644 --- a/chapter07/gawk.xml +++ b/chapter07/gawk.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/gawk.xml" + href="../chapter08/gawk.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/gcc-pass1.xml b/chapter07/gcc-pass1.xml index 1bd308f09..7db6408c2 100644 --- a/chapter07/gcc-pass1.xml +++ b/chapter07/gcc-pass1.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/gcc.xml" + href="../chapter08/gcc.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/gcc-pass2.xml b/chapter07/gcc-pass2.xml index 5f6864d02..7f7d7a021 100644 --- a/chapter07/gcc-pass2.xml +++ b/chapter07/gcc-pass2.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/gcc.xml" + href="../chapter08/gcc.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/gettext.xml b/chapter07/gettext.xml index a3baed723..34d0ee32e 100644 --- a/chapter07/gettext.xml +++ b/chapter07/gettext.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/gettext.xml" + href="../chapter08/gettext.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/glibc.xml b/chapter07/glibc.xml index 5213c23e5..39aabd12c 100644 --- a/chapter07/glibc.xml +++ b/chapter07/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/chapter07/grep.xml b/chapter07/grep.xml index bac311f2f..6a8ada4b8 100644 --- a/chapter07/grep.xml +++ b/chapter07/grep.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/grep.xml" + href="../chapter08/grep.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/gzip.xml b/chapter07/gzip.xml index e9bdd3bd8..e5b5d0a37 100644 --- a/chapter07/gzip.xml +++ b/chapter07/gzip.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/gzip.xml" + href="../chapter08/gzip.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/m4.xml b/chapter07/m4.xml index 3f51c11d1..79559f6da 100644 --- a/chapter07/m4.xml +++ b/chapter07/m4.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/m4.xml" + href="../chapter08/m4.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/make.xml b/chapter07/make.xml index 2d054dd9e..fef5555aa 100644 --- a/chapter07/make.xml +++ b/chapter07/make.xml @@ -24,7 +24,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/make.xml" + href="../chapter08/make.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/ncurses.xml b/chapter07/ncurses.xml index e2455eb7a..93cf85263 100644 --- a/chapter07/ncurses.xml +++ b/chapter07/ncurses.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/ncurses.xml" + href="../chapter08/ncurses.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/patch.xml b/chapter07/patch.xml index 08bad5c56..ecd5b2c47 100644 --- a/chapter07/patch.xml +++ b/chapter07/patch.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/patch.xml" + href="../chapter08/patch.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/python.xml b/chapter07/python.xml index 8e7afaf03..52c070ab3 100644 --- a/chapter07/python.xml +++ b/chapter07/python.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/python.xml" + href="../chapter08/python.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/sed.xml b/chapter07/sed.xml index 5daaf6b7e..f146b5102 100644 --- a/chapter07/sed.xml +++ b/chapter07/sed.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/sed.xml" + href="../chapter08/sed.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/tar.xml b/chapter07/tar.xml index 26f676121..ff2008e28 100644 --- a/chapter07/tar.xml +++ b/chapter07/tar.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/tar.xml" + href="../chapter08/tar.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/texinfo.xml b/chapter07/texinfo.xml index 2cb7764cb..8434c7112 100644 --- a/chapter07/texinfo.xml +++ b/chapter07/texinfo.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/texinfo.xml" + href="../chapter08/texinfo.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> diff --git a/chapter07/xz.xml b/chapter07/xz.xml index 83e4a96d6..9e2d0da4b 100644 --- a/chapter07/xz.xml +++ b/chapter07/xz.xml @@ -25,7 +25,7 @@ <title/> <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" - href="../chapter06/xz.xml" + href="../chapter08/xz.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> -- cgit v1.2.3-54-g00ecf