From 81fd230419b0cfd052b08fc1ed352bb7d49975df Mon Sep 17 00:00:00 2001 From: Gerard Beekmans Date: Sat, 19 Feb 2005 22:16:42 +0000 Subject: [PATCH] Trunk is now identical to Testing git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@4648 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- INSTALL | 19 +- Makefile | 18 +- TODO | 10 - appendixa/acronymlist.xml | 397 +++++++++++++++- appendixb/acknowledgments.xml | 285 ++++++++++- chapter01/administrativa.xml | 82 +++- chapter01/askforhelp.xml | 106 ++++- chapter01/bootcd.xml | 55 ++- chapter01/changelog.xml | 235 +++++---- chapter01/how.xml | 74 ++- chapter02/creatingfilesystem.xml | 26 +- chapter02/creatingpartition.xml | 47 +- chapter02/introduction.xml | 5 +- chapter02/mounting.xml | 46 +- chapter03/introduction.xml | 40 +- chapter03/packages.xml | 156 +++--- chapter03/patches.xml | 38 +- chapter04/aboutlfs.xml | 25 +- chapter04/aboutsbus.xml | 40 +- chapter04/abouttestsuites.xml | 40 +- chapter04/addinguser.xml | 70 ++- chapter04/creatingtoolsdir.xml | 32 ++ chapter04/settingenviron.xml | 68 +++ chapter05/adjusting.xml | 85 +++- chapter05/bash.xml | 38 +- chapter05/binutils-pass1.xml | 115 ++++- chapter05/binutils-pass2.xml | 63 ++- chapter05/bison.xml | 19 +- chapter05/bzip2.xml | 19 +- chapter05/chapter05.xml | 6 - chapter05/coreutils.xml | 40 +- chapter05/dejagnu.xml | 29 +- chapter05/diffutils.xml | 17 +- chapter05/expect.xml | 82 +++- chapter05/findutils.xml | 19 +- chapter05/flex.xml | 25 +- chapter05/gawk.xml | 19 +- chapter05/gcc-pass1.xml | 102 +++- chapter05/gcc-pass2.xml | 164 ++++++- chapter05/gettext.xml | 42 +- chapter05/glibc.xml | 162 ++++++- chapter05/grep.xml | 37 +- chapter05/gzip.xml | 17 +- chapter05/hostreqs.xml | 30 +- chapter05/introduction.xml | 57 ++- chapter05/linux-libc-headers.xml | 29 ++ chapter05/m4.xml | 21 +- chapter05/make.xml | 17 +- chapter05/ncurses.xml | 36 ++ chapter05/patch.xml | 19 + chapter05/perl.xml | 38 +- chapter05/sed.xml | 17 +- chapter05/stripping.xml | 23 +- chapter05/tar.xml | 17 +- chapter05/tcl.xml | 67 ++- chapter05/texinfo.xml | 17 +- chapter05/toolchaintechnotes.xml | 214 ++++++++- chapter05/udev.xml | 40 -- chapter05/util-linux.xml | 24 +- chapter06/aboutdebug.xml | 41 +- chapter06/autoconf.xml | 101 +++- chapter06/automake.xml | 173 ++++++- chapter06/bash.xml | 73 ++- chapter06/binutils.xml | 230 ++++++++- chapter06/bison.xml | 54 ++- chapter06/bzip2.xml | 140 +++++- chapter06/changingowner.xml | 28 +- chapter06/chroot.xml | 46 +- chapter06/coreutils.xml | 785 ++++++++++++++++++++++++++++++- chapter06/createfiles.xml | 6 +- chapter06/creatingdirs.xml | 37 +- chapter06/devices.xml | 47 +- chapter06/diffutils.xml | 55 ++- chapter06/e2fsprogs.xml | 330 ++++++++++++- chapter06/file.xml | 40 +- chapter06/findutils.xml | 90 +++- chapter06/flex.xml | 78 ++- chapter06/gawk.xml | 86 +++- chapter06/gcc.xml | 162 ++++++- chapter06/gettext.xml | 266 ++++++++++- chapter06/glibc.xml | 585 ++++++++++++++++++++++- chapter06/grep.xml | 44 +- chapter06/groff.xml | 327 ++++++++++++- chapter06/grub.xml | 81 +++- chapter06/gzip.xml | 142 +++++- chapter06/hotplug.xml | 126 ++++- chapter06/iana-etc.xml | 39 +- chapter06/inetutils.xml | 136 +++++- chapter06/introduction.xml | 61 ++- chapter06/iproute2.xml | 253 +++++++++- chapter06/kbd.xml | 248 +++++++++- chapter06/kernfs.xml | 21 +- chapter06/less.xml | 57 ++- chapter06/libol.xml | 39 +- chapter06/libtool.xml | 45 +- chapter06/linux-libc-headers.xml | 37 +- chapter06/m4.xml | 35 +- chapter06/make.xml | 29 +- chapter06/man-pages.xml | 26 +- chapter06/man.xml | 135 +++++- chapter06/mktemp.xml | 55 ++- chapter06/module-init-tools.xml | 120 ++++- chapter06/ncurses.xml | 162 ++++++- chapter06/patch.xml | 37 +- chapter06/perl.xml | 280 ++++++++++- chapter06/procps.xml | 158 ++++++- chapter06/psmisc.xml | 82 +++- chapter06/pwdgroup.xml | 60 ++- chapter06/readjusting.xml | 84 +++- chapter06/readline.xml | 66 ++- chapter06/revisedchroot.xml | 29 +- chapter06/sed.xml | 30 +- chapter06/shadow.xml | 352 +++++++++++++- chapter06/strippingagain.xml | 38 +- chapter06/syslogng.xml | 39 +- chapter06/sysvinit.xml | 191 +++++++- chapter06/tar.xml | 37 +- chapter06/texinfo.xml | 99 +++- chapter06/udev.xml | 105 ++++- chapter06/util-linux.xml | 572 +++++++++++++++++++++- chapter06/vim.xml | 281 ++++++++++- chapter06/zlib.xml | 45 +- chapter07/bootscripts.xml | 207 +++++++- chapter07/console.xml | 81 +++- chapter07/hostname.xml | 12 + chapter07/hosts.xml | 45 +- chapter07/inputrc.xml | 41 +- chapter07/introduction.xml | 17 +- chapter07/network.xml | 79 +++- chapter07/profile.xml | 83 +++- chapter07/setclock.xml | 35 ++ chapter07/udev.xml | 229 ++++++++- chapter07/usage.xml | 107 ++++- chapter08/fstab.xml | 42 ++ chapter08/grub.xml | 84 +++- chapter08/introduction.xml | 6 +- chapter08/kernel.xml | 197 +++++++- chapter09/chapter09.xml | 2 +- chapter09/getcounted.xml | 8 +- chapter09/reboot.xml | 33 +- chapter09/theend.xml | 12 +- chapter09/whatnow.xml | 39 +- general.ent | 7 +- prologue/audience.xml | 81 +++- prologue/bookinfo.xml | 20 +- prologue/dedication.xml | 1 + prologue/foreword.xml | 57 ++- prologue/organization.xml | 30 +- prologue/prerequisites.xml | 27 +- prologue/typography.xml | 48 +- stylesheets/lfs-chunked.xsl | 2 +- stylesheets/lfs-nochunks.xsl | 2 +- stylesheets/lfs.css | 5 - 153 files changed, 12730 insertions(+), 845 deletions(-) delete mode 100644 TODO delete mode 100644 chapter05/udev.xml diff --git a/INSTALL b/INSTALL index 82cf8ae41..62e2961d7 100644 --- a/INSTALL +++ b/INSTALL @@ -20,23 +20,8 @@ If all you want to do is convert XML to HTML perform the following: * DocBook DTD - http://www.linuxfromscratch.org/blfs/view/svn/pst/xml.html -* DocBook XSL Stylesheets (1.67.2) - install -d /usr/share/xml/docbook/xsl-stylesheets-1.67.2 - chown -R root:root . - cp -af INSTALL VERSION common eclipse extensions fo html htmlhelp images \ - javahelp lib manpages params profiling template xhtml \ - /usr/share/xml/docbook/xsl-stylesheets-1.67.2 - install -d /usr/share/doc/xml - cp -af doc/* /usr/share/doc/xml - cd /usr/share/xml/docbook/xsl-stylesheets-1.67.2 && \ - sed -i -e 's@current/@1.67.2/@' INSTALL && \ - sh INSTALL - xmlcatalog --noout --add "delegateURI" \ - "http://docbook.sourceforge.net/release/xsl/1.67.2/" \ - "file:///usr/share/xml/docbook/xsl-stylesheets-1.67.2/catalog.xml" \ - /etc/xml/catalog - ln -sf xsl-stylesheets-$(VERSION) \ - /usr/share/xml/docbook/xsl-stylesheets-current +* DocBook XSL Stylesheets + - http://www.linuxfromscratch.org/blfs/view/svn/pst/docbook-xsl.html * HTMLTidy - http://www.linuxfromscratch.org/blfs/view/svn/general/tidy.html diff --git a/Makefile b/Makefile index 2bc4e2cab..4bf6f9488 100644 --- a/Makefile +++ b/Makefile @@ -5,9 +5,9 @@ NOCHUNKS_OUTPUT=LFS-BOOK.html XSLROOTDIR=/usr/share/xml/docbook/xsl-stylesheets-current lfs: - xsltproc --xinclude --nonet -stringparam chunk.quietly $(CHUNK_QUIET) \ - -stringparam base.dir $(BASEDIR)/ stylesheets/lfs-chunked.xsl \ - index.xml + xsltproc --xinclude --nonet -stringparam profile.condition html \ + -stringparam chunk.quietly $(CHUNK_QUIET) -stringparam base.dir $(BASEDIR)/ \ + stylesheets/lfs-chunked.xsl index.xml if [ ! -e $(BASEDIR)/stylesheets ]; then \ mkdir -p $(BASEDIR)/stylesheets; \ @@ -32,8 +32,9 @@ lfs: for filename in `find $(BASEDIR) -name "*.html"`; do \ sed -i -e "s@text/html@application/xhtml+xml@g" $$filename; \ done; + # -# This is the old "pdf" target. The old "print" target below has been +# This is the old "pdf" target. The old "print" target below has been # renamed to "pdf" and will be used. This commented out previous_pdf # target can be removed eventually. It'll remain here for a bit for # historical reasons @@ -46,7 +47,7 @@ lfs: # rm lfs.fo pdf: - xsltproc --xinclude --nonet --stringparam profile.condition print \ + xsltproc --xinclude --nonet --stringparam profile.condition pdf \ --output $(BASEDIR)/lfs-pdf.xml stylesheets/lfs-profile.xsl index.xml xsltproc --nonet --output $(BASEDIR)/lfs-pdf.fo stylesheets/lfs-pdf.xsl \ $(BASEDIR)/lfs-pdf.xml @@ -55,10 +56,15 @@ pdf: rm $(BASEDIR)/lfs-pdf.xml $(BASEDIR)/lfs-pdf.fo nochunks: - xsltproc --xinclude --nonet --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \ + xsltproc --xinclude --nonet -stringparam profile.condition html \ + --output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \ stylesheets/lfs-nochunks.xsl index.xml + tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true + sed -i -e "s@text/html@application/xhtml+xml@g" \ + $(BASEDIR)/$(NOCHUNKS_OUTPUT) + validate: xmllint --noout --nonet --xinclude --postvalid index.xml diff --git a/TODO b/TODO deleted file mode 100644 index 95596151c..000000000 --- a/TODO +++ /dev/null @@ -1,10 +0,0 @@ - - Mention --enable-kernel=... where appropriate. - - POSIX compliance patches (aka, removing the coreutils hack). - - Pass --enable-const (and maybe --enable-widec) to ncurses. - - Use that E2fsprogs patch to include Readline support in debugfs. - - See about removing some things from Chapter 5, like patch. We can build - those at the beginning of chapter 6 and have one less package to compile. - We need to be sure this doens't break the pureness though. - - Check for pureness and fix any occurrences of breakage. - - Add more index terms to hotplug page. - - Convert some patches to seds (only sane ones, though). diff --git a/appendixa/acronymlist.xml b/appendixa/acronymlist.xml index 815ffe207..132a31d59 100644 --- a/appendixa/acronymlist.xml +++ b/appendixa/acronymlist.xml @@ -8,7 +8,402 @@ Acronyms and Terms -See testing + + + + +ABIApplication Binary Interface + + + +ALFSAutomated Linux From Scratch + + + +ALSAAdvanced Linux +Sound Architecture + + + +APIApplication +Programming Interface + + + +ASCIIAmerican Standard +Code for Information Interchange + + + +BIOSBasic Input/Output +System + + + +BLFSBeyond Linux From +Scratch + + + +BSDBerkeley Software +Distribution + + + +chrootchange root + + + +CMOSComplementary +Metal Oxide Semiconductor + + + +COS +Class Of Service + + + +CPU +Central Processing Unit + + + +CRC +Cyclic Redundancy Check + + + +CVS +Concurrent Versions System + + + +DHCP +Dynamic Host Configuration Protocol + + + +DNS +Domain Name Service + + + +EGA +Enhanced Graphics Adapter + + + +ELF +Executable and Linkable Format + + + +EOF +End of File + + + +EQN +equation + + + +EVMS +Enterprise Volume Management System + + + +ext2 +second extended file system + + + +FAQ +Frequently Asked Questions + + + +FHS +Filesystem Hierarchy Standard + + + +FIFO +First-In, First Out + + + +FQDN +Fully Qualified Domain Name + + + +FTP +File Transfer Protocol + + + +GB +Gibabytes + + + +GCC +GNU Compiler Collection + + + +GID +Group Identifier + + + +GMT +Greenwich Mean Time + + + +GPG +GNU Privacy Guard + + + +HTML +Hypertext Markup Language + + + +IDE +Integrated Drive Electronics + + + +IEEE +Institute of Electrical and Electronic Engineers + + + +IO +Input/Output + + + +IP +Internet Protocol + + + +IPC +Inter-Process Communication + + + +IRC +Internet Relay Chat + + + +ISO +International Organization for Standardization + + + +ISP +Internet Service Provider + + + +KB +Kilobytes + + + +LED +Light Emitting Diode + + + +LFS +Linux From Scratch + + + +LSB +Linux Standards Base + + + +MB +Megabytes + + + +MBR +Master Boot Record + + + +MD5 +Message Digest 5 + + + +NIC +Network Interface Card + + + +NLS +Native Language Support + + + +NNTP +Network News Transport Protocol + + + +NPTL +Native POSIX Threading Library + + + +OSS +Open Sound System + + + +PCH +Pre-Compiled Headers + + + +PCRE +Perl Compatible Regular Expression + + + +PID +Process Identifier + + + +PLFS +Pure Linux From Scratch + + + +PTY +pseudo terminal + + + +QA +Quality Assurance + + + +QOS +Quality Of Service + + + +RAM +Random Access Memory + + + +RPC +Remote Procedure Call + + + +RTC +Real Time Clock + + + +SBU +Static Binutils Unit + + + +SCO +The Santa Cruz Operation + + + +SGR +Select Graphic Rendition + + + +SHA1 +Secure-Hash Algorithm 1 + + + +SMP +Symmetric Multi-Processor + + + +TLDP +The Linux Documentation Project + + + +TFTP +Trivial File Transfer Protocol + + + +TLS +Thread-Local Storage + + + +UID +User Identifier + + + +umask +user file-creation mask + + + +USB +Universal Serial Bus + + + +UTC +Coordinated Universal Time + + + +UUID +Universally Unique Identifier + + + +VC +Virtual Console + + + +VGA +Video Graphics Array + + + +VT +Virtual Terminal + + + diff --git a/appendixb/acknowledgments.xml b/appendixb/acknowledgments.xml index 332735422..c7c8aa2c2 100644 --- a/appendixb/acknowledgments.xml +++ b/appendixb/acknowledgments.xml @@ -8,7 +8,290 @@ Acknowledgments -See testing +We would like to thank the following people and organizations +for their contributions to the Linux From Scratch Project. + +Project Team Members + + + +Gerard +Beekmans <gerard@linuxfromscratch.org> – Linux From +Scratch initiator, LFS Project organizer + +Christine +Barczak <theladyskye@linuxfromscratch.org> – LFS Book +Editor + +Matthew Burgess +<matthew@linuxfromscratch.org> – LFS Project Co-Leader, LFS +general package maintainer, LFS Technical Writer. + +Craig +Colton <meerkats@bellsouth.net> – LFS, Automated Linux +From Scratch (ALFS), BLFS and hints project logo +creator + +Nathan +Coulson <nathan@linuxfromscratch.org> – LFS bootscripts +maintainer + +Jeroen +Coumans <jeroen@linuxfromscratch.org> – Website +developer, FAQ maintainer + +Bruce +Dubbs <bdubbs@linuxfromscratch.org> – LFS Quality +Assurance (QA) Team leader, BLFS Book Editor + +Manuel +Canales Esparcia <manuel@linuxfromscratch.org> – LFS +XML/XSL maintainer + +Jim +Gifford <jim@linuxfromscratch.org> – LFS Technical +Writer, Patches maintainer + +Jeremy +Huntwork <jhuntwork@linuxfromscratch.org> – ALFS Maintainer, LFS Live-CD maintainer + +Nicholas Leippe +<nicholas@linuxfromscratch.org> – Wiki +maintainer + +Anderson Lizardo +<lizardo@linuxfromscratch.org> – Website backend scripts +maintainer + +Scot +Mc Pherson <scot@linuxfromscratch.org> – LFS NNTP gateway +maintainer. + +Ryan +Oliver <ryan@linuxfromscratch.org> – Testing Team +leader, Toolchain maintainer, co-creator of Pure LFS +(PLFS) + +Alexander +Patrakov <semzx@newmail.ru> – Former LFS Technical +Writer + +James +Robertson <jwrober@linuxfromscratch.org> – Bugzilla +maintainer, Wiki developer, LFS Tecnical Writer + +Tushar +Teredesai <tushar@linuxfromscratch.org> – BLFS Book +Editor, hints and patches projects maintainer + +Jeremy +Utley <jeremy@linuxfromscratch.org> – LFS Technical +Writer, Bugzilla maintainer, LFS bootscripts maintainer, LFS Server +co-administrator + +Zack +Winkles <zwinkles@gmail.com> – Former LFS Technical +Writer + +Countless other people on the various LFS and BLFS mailing lists +who helped make this book possible by giving their suggestions, +testing the book, and submitting bug reports, instructions, and their +experiences with installing various packages. + + + +Translators + + + +Manuel Canales +Esparcia <macana@lfs-es.com> – Spanish LFS translation +project + +Johan +Lenglet <johan@linuxfromscratch.org> – French LFS +translation project + +Anderson Lizardo +<lizardo@linuxfromscratch.org> – Portuguese LFS translation +project + +Thomas +Reitelbach <tr@erdfunkstelle.de> – German LFS +translation project + + + +Mirror Maintainers + +North American Mirrors + + + +Scott +Kveton <scott@osuosl.org> – lfs.oregonstate.edu +mirror + +Mikhail +Pastukhov <miha@xuy.biz> – lfs.130th.net +mirror + +William Astle +<lost@l-w.net> – ca.linuxfromscratch.org +mirror + +Jeremy +Polen <jpolen@rackspace.com> – us2.linuxfromscratch.org +mirror + +Tim Jackson +<tim@idge.net> – linuxfromscratch.idge.net +mirror + +Jeremy +Utley <jeremy@linux-phreak.net> – lfs.linux-phreak.net +mirror + + + +South American Mirrors + + + +Andres +Meggiotto <sysop@mesi.com.ar> – lfs.mesi.com.ar +mirror + +Manuel +Canales Esparcia <manuel@linuxfromscratch.org> – +www.dattaweb.com/~lfs-eso/lfsmirror mirror + +Eduardo B. +Fonseca <ebf@aedsolucoes.com.br> – +br.linuxfromscratch.org mirror + + + +European Mirrors + + + +Barna +Koczka <barna@siker.hu> – hu.linuxfromscratch.org +mirror + +UK Mirror +Service – linuxfromscratch.mirror.ac.uk +mirror + +Martin +Voss <Martin.Voss@ada.de> – lfs.linux-matrix.net +mirror + +Guido +Passet <guido@primerelay.net> – nl.linuxfromscratch.org +mirror + +Bastiaan +Jacques <baafie@planet.nl> – lfs.pagefault.net +mirror + +Roel Neefs +<lfs-mirror@linuxfromscratch.rave.org> – +linuxfromscratch.rave.org mirror + +Justin +Knierim <justin@jrknierim.de> – www.lfs-matrix.de +mirror + +Stephan +Brendel <stevie@stevie20.de> – lfs.netservice-neuss.de +mirror + +Antonin Sprinzl +<Antonin.Sprinzl@tuwien.ac.at> – at.linuxfromscratch.org +mirror + +Fredrik +Danerklint <fredan-lfs@fredan.org> – +se.linuxfromscratch.org mirror + +Parisian sysadmins +<archive@doc.cs.univ-paris8.fr> – www2.fr.linuxfromscratch.org +mirror + +Alexander +Velin <velin@zadnik.org> – bg.linuxfromscratch.org +mirror + + Dirk +Webster <dirk@securewebservices.co.uk> – +lfs.securewebservices.co.uk mirror + +Thomas +Skyt <thomas@sofagang.dk> – dk.linuxfromscratch.org +mirror + +Simon +Nicoll <sime@dot-sime.com> – uk.linuxfromscratch.org +mirror + + + + +Asian Mirrors + + + +Pui +Yong <pyng@spam.averse.net> – sg.linuxfromscratch.org +mirror + +Stuart +Harris <stuart@althalus.me.uk> – +lfs.mirror.intermedia.com.sg mirror + + + +Australian Mirrors + + + +Jason +Andrade <jason@dstc.edu.au> – au.linuxfromscratch.org +mirror + + + +A very special thank you to our donators + + + +Dean +Benson <dean@vipersoft.co.uk> for several monetary +contributions + +Hagen +Herrschaft <hrx@hrxnet.de> for donating a 2.2 GHz P4 +system, now running under the name of Lorien + +VA +Software who, on behalf of Linux.com, donated a VA Linux 420 +(former StartX SP2) workstation + +Mark Stone for donating Belgarath, the +linuxfromscratch.org server + + diff --git a/chapter01/administrativa.xml b/chapter01/administrativa.xml index adf02c2b0..6708e8d06 100644 --- a/chapter01/administrativa.xml +++ b/chapter01/administrativa.xml @@ -7,6 +7,86 @@ Resources -See testing + + +FAQ + +If during the building of the LFS system you encounter any +errors, have any questions, or think there is a typo in the book, +please start by consulting the Frequently Asked Questions (FAQ) at +. + + + +Mailing Lists + +The linuxfromscratch.org server hosts a number of +mailing lists used for the development of the LFS project. These lists +include the main development and support lists, among others. + +For information on the different lists, how to subscribe, archive +locations, and additional information, visit +. + + + +IRC + +Several members of the LFS community offer assistance on our +community Internet Relay Chat (IRC) network. Before using this +support, please make sure that your question is not already answered in the LFS +FAQ or the mailing list archives. You can find the IRC network at +irc.linuxfromscratch.org, irc.linux-phreak.net +or irc.lfs-matrix.de. +The support channel is named #LFS-support. + + + +News Server + +The mailing lists hosted at linuxfromscratch.org are +also accessible via the Network News Transfer Protocol (NNTP) server. +All messages posted to a mailing list are copied to the corresponding +newsgroup, and vice versa. + +The news server is located at +news.linuxfromscratch.org. + + + +Wiki + +For more information on packages, updated versions, tweaks, and +personal experiences, see the LFS Wiki at . +Users can also add information there to help others with their future +LFS activities. + + + +References + +For additional information on the packages, useful tips are +available at +. + + + + +Mirror Sites + +The LFS project has a number of world-wide mirrors to make +accessing the website and downloading the required packages more +convenient. Please visit the LFS website at +for a list of current mirrors. + + + +Contact Information + +Please direct all your questions and comments to one of the LFS mailing +lists (see above). + + diff --git a/chapter01/askforhelp.xml b/chapter01/askforhelp.xml index df7e83f11..1dc36c365 100644 --- a/chapter01/askforhelp.xml +++ b/chapter01/askforhelp.xml @@ -7,6 +7,110 @@ Help -See testing +If an issue or a question is encountered while working +through this book, check the FAQ page at . +Questions are often already answered there. If your question is +not answered on this page, try to find the source of the problem. The +following hint will give you some guidance for troubleshooting: . + +We also have a wonderful LFS community that is willing to offer +assistance through IRC and the mailing lists (see the section of this book). In order +to assist with diagnosing and solving the problem, please include +all relevant information in your request for help. + + +Things to Mention + +Apart from a brief explanation of the problem being experienced, +the essential things to include in any request for help are: + + +The version of the book being used (in this case +&version;) +The host distribution and version being used to +create LFS +The package or section the problem was encountered in +The exact error message or symptom being received +Note whether you have deviated from the book at all + + +Deviating from this book does not +mean that we will not help you. After all, LFS is about personal +preference. Being upfront about any changes to the established +procedure helps us evaluate and determine possible causes of your +problem. + + + +Configure Problems + +If something goes wrong during the stage where the configure +script is run, review the config.log file. This +file may contain errors encountered during configure which were not +printed to the screen. Include those relevant lines if you need to ask +for help. + + + +Compile Problems + +Both the screen output and the contents of various files are +useful in determining the cause of compile issues. The screen output +from the ./configure script and the +make run can be helpful. It +is not necessary to include the entire output, but do include enough +of the relevant information. Below is an example of the type of +information to include from the screen output from make: + +gcc -DALIASPATH=\"/mnt/lfs/usr/share/locale:.\" +-DLOCALEDIR=\"/mnt/lfs/usr/share/locale\" +-DLIBDIR=\"/mnt/lfs/usr/lib\" +-DINCLUDEDIR=\"/mnt/lfs/usr/include\" -DHAVE_CONFIG_H -I. -I. +-g -O2 -c getopt1.c +gcc -g -O2 -static -o make ar.o arscan.o commands.o dir.o +expand.o file.o function.o getopt.o implicit.o job.o main.o +misc.o read.o remake.o rule.o signame.o variable.o vpath.o +default.o remote-stub.o version.o opt1.o +-lutil job.o: In function `load_too_high': +/lfs/tmp/make-3.79.1/job.c:1565: undefined reference +to `getloadavg' +collect2: ld returned 1 exit status +make[2]: *** [make] Error 1 +make[2]: Leaving directory `/lfs/tmp/make-3.79.1' +make[1]: *** [all-recursive] Error 1 +make[1]: Leaving directory `/lfs/tmp/make-3.79.1' +make: *** [all-recursive-am] Error 2 + +In this case, many people would just include the bottom +section: + +make [2]: *** [make] Error 1 + +This is not enough information to properly diagnose the problem +because it only notes that something went wrong, not +what went wrong. The entire section, as in the +example above, is what should be saved because it includes the command +that was executed and the associated error message(s). + +An excellent article about asking for help on the Internet is +available online at . Read and +follow the hints in this document to increase the likelihood of getting +the help you need. + + + +Test Suite Problems + +Many packages provide a test suite which, depending on the +importance of the package, should be run. Sometimes packages will +generate false or expected failures. If these errors are encountered, +check the LFS Wiki page at to see if we have +noted and investigated these issues. If these issues are noted and +addressed, there is no need to be concerned. + + diff --git a/chapter01/bootcd.xml b/chapter01/bootcd.xml index 773f76c9b..47542fc6f 100644 --- a/chapter01/bootcd.xml +++ b/chapter01/bootcd.xml @@ -7,7 +7,60 @@ About the Included CD -See testing +For your convenience, we have included a CD with this book that +contains the source packages needed for creating a Linux From Scratch +system. The CD is bootable and provides a stable working environment +for building LFS. This book refers to this system as the +host system. The CD images are actively maintained and +updated versions can be found at + + +In addition to the tools required to build LFS, the host system +on the CD has a number of other helpful tools installed: + + + An HTML version of this book + The X Window System Environment + + Web Tools + + Wget (command line file retriever) + Lynx (text web browser) + Irssi (console IRC client) + Firefox (graphical web browser) + Xchat (X-based IRC client) + + + + + Text Editors + + Vim + Nano + + + + + Network Tools + + SSH Server and Client + NFS Server and Client + Smbmount (mount.cifs) for Windows shares + Subversion + Dhcpcd (DHCP client) + + + + + Filesystem Programs + + Reiserfsprogs + Xfsprogs + + + + nALFS - A tool for automating LFS builds + diff --git a/chapter01/changelog.xml b/chapter01/changelog.xml index 1721d7913..c0f2ba9ed 100644 --- a/chapter01/changelog.xml +++ b/chapter01/changelog.xml @@ -3,7 +3,7 @@ %general-entities; ]> - + Changelog @@ -12,141 +12,188 @@ version is probably already available. To find out, please check one of the mirrors via . -Below is a list of differences between the Testing and Unstable versions -of the LFS Book. +Below is a list of changes made since the previous release of the book, +first a summary, then a detailed log. Upgraded to: -automake-1.9.5 -e2fsprogs-1.36 -expect-5.43.0 -file-4.13 -findutils-4.2.17 -glibc-2.3.4 -grub-0.96 -lfs-bootscripts-3.1.0 -libol-0.3.15 -libtool-1.5.14 -linux-libc-headers-2.6.10.0 -procps-3.2.5 -sed-4.1.4 -shadow-4.0.7 -syslog-ng-1.6.6 -util-linux-2.12q +Automake 1.9.5 +Binutils 2.15.94.0.2 +Bison 2.0 +E2fsprogs 1.36 +Expect 5.43.0 +File 4.13 +Findutils 4.2.17 +GCC 3.4.3 +Glibc 20041011 +Grep 2.5.1a +Grub 0.96 +Iana-Etc 1.03 +Iproute2 2.6.9-041019 +LFS-Bootscripts 3.1.0 +Libtool 1.5.14 +Linux 2.6.10 +Linux-libc-headers 2.6.10.0 +Man 1.5p +Man-pages 2.01 +Module-init-tools 3.1 +Perl 5.8.6 +Procps 3.2.5 +Sed 4.1.4 +Shadow 4.0.7 +Sysvinit 2.86 +Tar 1.15.1 +Texinfo 4.8 +Tcl 8.4.9 +Udev 050 +Util-linux 2.12q +Zlib 1.2.2 Added: -bash-3.0-fixes-3.patch +bash-3.0-fixes-1.patch +bash-3.0-avoid_WCONTINUED-1.patch +Hotplug 2004_09_23 iproute2-2.6.9_041019-find_update-1.patch +Libol 0.3.15 +linux-2.6.10-security_fix-1.patch +Syslog-ng 1.6.6 +util-linux-2.12p-cramfs-1.patch +vim-6.0-security_fix-1.patch - + Removed: -bash-3.0-fixes-1.patch +bash-3.0-display_wrap-1.patch +man-1.5o1-80cols-1.patch +Sysklogd 1.4.1 +sysvinit-2.85-proclen-1.patch +texinfo-4.7-segfault-1.patch +util-linux-2.12b-sfdisk-1.patch +zlib-1.2.1-security-1.patch -February 13, 2005 [matt]: Add a link to BLFS' index of -packages requiring kernel configuration. Fixes bug 1028. - -February 13, 2005 [matt]: Fix bug 1030 by moving the Get -Counted section to after the user has rebooted for the first time. -Fixes bug 1030. - -February 13, 2005 [matt]: Upgraded to glibc-2.3.4 - - -February 13, 2005 [matt]: Upgraded to grub-0.96 - - -February 13, 2005 [matt]: Upgraded to e2fsprogs-1.36 - - -February 13, 2005 [matt]: Upgraded to findutils-4.2.17 - - -February 13, 2005 [matt]: Upgraded to expect-5.43.0 - - -February 13, 2005 [matt]: Upgraded to libtool-1.5.14 - - -February 13, 2005 [matt]: Upgraded to automake-1.9.5 - - -February 13, 2005 [matt]: Upgraded to file-4.13 - - -February 5, 2005 [matt]: Added a space to the toolchain -readjustment perl command. This stops the specs file being -incorrectly modified if the command is run more than once. Fixes bug 1023. - +February 19, 2005 [gerard]: Synchronized Testing +branch with current Unstable/Trunk. Move Testing branch to Trunk and +discontinue Testing branch as per lfs-dev discussion on branch +changes. February 5, 2005 [matt]: Copy hotplug's pnp.distmap file to -silence its warnings +silence its warnings. Also tidy up some explanatory text -February 5, 2005 [matt]: Upgraded to syslog-ng-1.6.6 +January 29, 2005 [matt]: Upgraded to sed-4.1.4 + +January 29, 2005 [matt]: Upgraded to procps-3.2.5 -February 5, 2005 [matt]: Upgraded to libol-0.3.15 +January 29, 2005 [matt]: Upgraded to shadow-4.0.7 -January 29th, 2005 [matt]: Upgraded to findutils 4.2.15 +January 29, 2005 [matt]: Upgraded to util-linux-2.12q. -January 28th, 2005 [matt]: Upgraded to sed-4.1.4 - +January 27, 2005 [matt]: Added a warning that the +/usr/src/linux symlink shouldn't be +created. Fixes bug 1012. -January 27th, 2005 [matt]: Upgraded to findutils 4.2.14 - +January 27, 2005 [matt]: Added link to the live-cd FTP +location. Fixes bug 1014. -January 27th, 2005 [matt]: Upgraded to sed-4.1.3 - +January 27, 2005 [matt]: Added bison, flex and m4 to binutils +dependency list. Fixes Bug 1018. -January 27th, 2005 [matt]: Upgraded to procps-3.2.5 - +January 27, 2005 [manuel]: Updated to gcc-3.4.3-specs-2.patch. -January 27th, 2005 [matt]: Upgraded to shadow-4.0.7 - +January 19, 2005 [jeremy]: Added an extra symlink for +libgcc_s.so to chapter 6 - this never migrated from unstable until now. -January 27th, 2005 [matt]: Upgraded to util-linux-2.12q - +January 9, 2005 [matt]: Added a security patch for the kernel -January 9th, 2005 [jeremy]: Removed --enable-shared from libol, -since the shared library is installed by default for this package - thanks -Archaic +January 9, 2005 [matt]: Added a security patch for vim -January 5th, 2005 [jeremy]: Upgraded to findutils 4.2.11 +January 9, 2005 [matt]: Upgraded to man-1.5p -December 31st, 2004 [jeremy]: Oops - forgot to remove the -separate targets for hotplug and syslog-ng - fixed. +January 9, 2005 [matt]: Upgraded to texinfo-4.8 -December 31st, 2004 [jeremy]: Upgrade to LFS-Bootscripts 3.1.0 +January 9, 2005 [matt]: Upgraded to util-linux-2.12p -December 30th, 2004 [jeremy]: Added Archaic's sed to stop -installation of shadow's groups binary, as well as it's man page. +January 9, 2005 [matt]: Upgraded to udev-050 -December 25th, 2004 [jeremy]: Upgrade to glibc snapshot -of 20041220 +January 9, 2005 [matt]: Upgraded to tcl-8.4.9 -December 19th, 2004 [jeremy]: Updated GCC-testresults link to -be appropriate for GCC 3.4.3 +January 9, 2005 [matt]: Upgraded to tar-1.15.1 -December 6th, 2004 [jim]: Fixes a few typo's done by me. -Added a patch for IPRoute2 to fix usage with the newer findutils. -Updated Readline and Zlib library location changes. -Bumped findutils to 4.2.9 and util-linux 2.12j. -Used the same methodology used on zlib and readline on shadow. +January 9, 2005 [matt]: Upgraded to perl-5.8.6 -December 3rd, 2004 [jim]: Changed readline and zlib instructions -to use --libdir for the libraries. Bumped perl to 5.8.6. Corrected wording in -readline. +January 9, 2005 [matt]: Upgraded to man-pages-2.01 + +January 9, 2005 [matt]: Upgraded to linux-libc-headers-2.6.10.0 + +January 9, 2005 [matt]: Upgraded to linux-2.6.10 + +January 9, 2005 [matt]: Upgraded to gcc-3.4.3 + +January 9, 2005 [matt]: Upgraded to bison-2.0 + +January 9, 2005 [matt]: Upgraded to autoconf-1.9.4 + +January 5, 2005 [jeremy]: Minor textual correction in network +configuration, since iproute will not recognize the old eth0:1 format for +ip aliasing. Closes bug 1013. + +January 5, 2005 [jeremy]: Added the --disable-selinux parameter +to Ch 5 glibc. Allows building from hosts which use SELinux functionality, +like Fedora Core 3 + +December 25, 2004 [jeremy]: Added text suggested by MSB, +closing Bug 943 + +December 25, 2004 [jeremy]: Upgraded binutils to 2.14.94.0.2 - +should fix the TLS strip issue that's been seen, at least on X86 + +December 22, 2004 [manuel]: Readded to chapter09/reboot.xml a para lost +from version 5.1. + +December 20, 2004 [manuel]: Made Grub's configuration location +FHS compliant. + +December 19, 2004 [manuel]: Added the irc.lfs-matrix.de IRC server. + +December 5, 2004 [jeremy]: Added the DOCBOOKTOMAN parameter +to Module-init-utils - without this, compilation fails. Thanks Boris Buegling + +December 2, 2004 [jeremy]: Removed the old display_wrap bash +patch, in favor of the newer fixes patch, and added the avoid_WCONTINUED +patch as well + +December 2, 2004 [jeremy]: Upgraded to TCL 8.4.8, Grep 2.5.1a +Util-linux 2.12i, Iana-etc 1.03, File 4.12, Module-init-tools 3.1, Procps 3.2.4 + + +December 2, 2004 [jeremy]: Migrated change from unstable to +build Glibc against sanitized linux-libc-headers instead of raw kernel headers, +bringing us more in line with what the kernel developers think should be +happening. + +December 1, 2004 [jeremy]: Dropped Udev from being built in +Chapter 5, in favor of creating a minimal set of devices at the beginning +of Chapter 6. All devices are created after the installation of Udev near +the end of Chapter 6 + +December 1, 2004 [jeremy]: Upgraded to Automake 1.9.3, +Binutils 2.15.92.0.2, Findutils 4.2.3, GCC 3.4.2, Glibc 20041011, Iana-Etc 1.02 +Iproute2 2.6.9-041019, LFS-Bootscripts 2.2.3, Libtool 1.5.10, Linux 2.6.9 +Linux-libc-headers 2.6.9.1, Man 1.5o1, Man-pages 1.70, Shadow 4.0.6, +Udev 046, Zlib 1.2.2, Hotplug 2004_09_23, Libol 0.3.14, Syslog-ng 1.6.5 +Branch frozen for LFS 6.0 as of October 10, 2004 + diff --git a/chapter01/how.xml b/chapter01/how.xml index 98828fc8a..b2390fb48 100644 --- a/chapter01/how.xml +++ b/chapter01/how.xml @@ -7,6 +7,78 @@ How to Build an LFS System -See testing +The LFS system will be built by using a previously installed +Linux distribution (such as Debian, Mandrake, Red Hat, or SuSE). This +existing Linux system (the host) will be used as a starting point to +provide necessary programs, including a compiler, linker, and shell, +to build the new system. Select the development option +during the distribution installation to be able to access these +tools. + + of this book describes how +to create a new Linux native partition and file system, the place +where the new LFS system will be compiled and installed. explains which packages and +patches need to be downloaded to build an LFS system and how to store +them on the new file system. +discusses the setup for an appropriate work environment. Please read + carefully as it explains several +important issues the developer should be aware of before beginning to +work through and +beyond. + + explains the +installation of a number of packages that will form the basic +development suite (or toolchain) which is used to build the actual +system in . Some of these +packages are needed to resolve circular dependencies—for example, +to compile a compiler, you need a compiler. + + also shows the user how +to build a first pass of the toolchain, including Binutils and GCC +(first pass basically means these two core packages will be +re-installed a second time). The programs from these packages will be +linked statically in order to be used independently of the host +system. The next step is to build Glibc, the C library. Glibc will be +compiled by the toolchain programs built in the first pass. Then, a +second pass of the toolchain will be built. This time, the toolchain +will be dynamically linked against the newly built Glibc. The +remaining packages are built +using this second pass toolchain. When this is done, the LFS +installation process will no longer depend on the host distribution, +with the exception of the running kernel. + +While this may initially seem like a lot of work to get away +from a host distribution, a full technical explanation is provided at +the beginning of , +including notes on the differences between +statically and dynamically-linked programs. + +In , the full LFS system is +built. The chroot (change root) program is used to enter a virtual +environment and start a new shell whose root directory will be set to +the LFS partition. This is very similar to rebooting and instructing +the kernel to mount the LFS partition as the root partition. The +system does not actually reboot, but instead chroots because creating a +bootable system requires additional work which is not necessary just +yet. The major advantage is that chrooting allows the +builder to continue using the host while LFS is being built. While +waiting for package compilation to complete, a user can switch to a +different virtual console (VC) or X desktop and continue using the +computer as normal. + +To finish the installation, the bootscripts are set up in , and the kernel and boot loader are set +up in . contains information on furthering the +LFS experience beyond this book. After the steps in this book have +been implemented, the computer will be ready to reboot into the new +LFS system. + +This is the process in a nutshell. Detailed information on each +step is discussed in the following chapters and package descriptions. +Items that may seem complicated will be clarified, and everything will +fall into place as the developer embarks on the LFS adventure. + diff --git a/chapter02/creatingfilesystem.xml b/chapter02/creatingfilesystem.xml index 489153e23..f013b9dec 100644 --- a/chapter02/creatingfilesystem.xml +++ b/chapter02/creatingfilesystem.xml @@ -7,6 +7,30 @@ Creating a File System on the Partition -See testing +Now that a blank partition has been set up, the file system can +be created. The most widely-used system in the Linux world is the +second extended file system (ext2), but with the newer high-capacity +hard disks, the journaling file systems are becoming increasingly +popular. Here we will create an ext2 file system, but build +instructions for other file systems can be found at . + +To create an ext2 file system on the LFS partition, run the following: + +mke2fs /dev/[xxx] + +Replace [xxx] with the name of the LFS +partition (hda5 in our previous example). + +If a swap partition was created, it will need to be initialized +as a swap partition too (also known as formatting, as described above +with mke2fs) by running the following. If you are using an existing +swap partition, there is no need to format it. + +mkswap /dev/[yyy] + +Replace [yyy] with the name of the swap +partition. + diff --git a/chapter02/creatingpartition.xml b/chapter02/creatingpartition.xml index 78c4cbaa6..f3ef3de91 100644 --- a/chapter02/creatingpartition.xml +++ b/chapter02/creatingpartition.xml @@ -7,6 +7,51 @@ Creating a New Partition -See testing + +Like most other operating systems, LFS is usually installed on +a dedicated partition. If you have an empty partition or enough +unpartitioned space on one of your hard disks to make one, using this +for your LFS installation is recommended. However, an LFS system (in +fact even multiple LFS systems) may also be installed on a partition +already occupied by another operating system and the different systems +will co-exist peacefully. The document + explains +how to implement this, whereas this book discusses the method of +using a fresh partition for the installation. + + +A minimal system requires a partition of around 1.3 gigabytes +(GB). This is enough to store all the source tarballs and compile +the packages. However, if the LFS system is intended to be the primary +Linux system, additional software will probably be installed which +will require additional space (2 or 3 GB). The LFS system itself will +not take up this much space. A large portion of this required amount +of space is to provide sufficient free temporary space. Compiling +packages can require a lot of disk space which will be reclaimed after +the package is installed. + +Because there is not always enough Random Access Memory (RAM) +available for compilation processes, it is a good idea to use a small +disk partition as swap space. This space is used by the kernel to +store seldom-used data to make room in memory for active processes. +The swap partition for an LFS system can be the same as the one used +by the host system, so another swap partition will not need to be +created if your host system already has one setup. + +Start a disk partitioning program such as +cfdisk or fdisk with a command +line option naming the hard disk on which the new partition will be +created—for example /dev/hda for +the primary Integrated Drive Electronics (IDE) disk. Create a Linux native +partition and a swap partition, if needed. Please refer to the man +pages of cfdisk or fdisk if you +do not yet know how to use the programs. + +Remember the designation of the new partition (e.g., +hda5). This book will refer to this as the LFS +partition. Also remember the designation of the swap partition. These +names will be needed later for the /etc/fstab +file. + diff --git a/chapter02/introduction.xml b/chapter02/introduction.xml index 1619521fa..209e069b8 100644 --- a/chapter02/introduction.xml +++ b/chapter02/introduction.xml @@ -7,6 +7,9 @@ Introduction -See testing +In this chapter, the partition which will host the LFS system is +prepared. We will create the partition itself, create a file system +on it, and mount it. + diff --git a/chapter02/mounting.xml b/chapter02/mounting.xml index fb31964a7..0ac3f91bf 100644 --- a/chapter02/mounting.xml +++ b/chapter02/mounting.xml @@ -7,6 +7,50 @@ Mounting the New Partition -See testing +Now that a file system has been created, the partition needs to +be made accessible. In order to do this, the partition needs to be +mounted at a chosen mount point. For the purposes of this book, it is +assumed that the file system is mounted under /mnt/lfs, but the directory choice is up +to you. + +Choose a mount point and assign it to the LFS +environment variable by running: + +export LFS=/mnt/lfs + +Next, create the mount point and mount the LFS file system by +running: + +mkdir -p $LFS +mount /dev/[xxx] $LFS + +Replace [xxx] with the designation of the LFS +partition. + +If using multiple partitions for LFS (e.g., one for / and another for /usr), mount them using: + +mkdir -p $LFS +mount /dev/[xxx] $LFS +mkdir $LFS/usr +mount /dev/[yyy] $LFS/usr + +Replace [xxx] and +[yyy] with the appropriate partition +names. + +Ensure that this new partition is not mounted with permissions +that are too restrictive (such as the nosuid, nodev, or noatime +options). Run the mount command without any +parameters to see what options are set for the mounted LFS +partition. If nosuid, nodev, +and/or noatime are set, the partition will need +to be remounted. + +Now that there is an established place to work, it is time to +download the packages. + diff --git a/chapter03/introduction.xml b/chapter03/introduction.xml index 2573020b6..5791720a5 100644 --- a/chapter03/introduction.xml +++ b/chapter03/introduction.xml @@ -7,12 +7,48 @@ Introduction -Create a dir for the sources: +This chapter includes a list of packages that need to be +downloaded for building a basic Linux system. The listed version numbers +correspond to versions of the software that are known to work, and +this book is based on their use. We highly recommend not using newer +versions because the build commands for one version may not work with +a newer version. The newest package versions may also have problems +that work-arounds have not been developed for yet. + +All the URLs, when possible, refer to the package's information +page at . The Freshmeat pages +provide easy access to official download sites, as well as project +websites, mailing lists, FAQ, changelogs, and more. + +Download locations may not always be accessible. If a download +location has changed since this book was published, Google () provides a useful search engine for +most packages. If this search is unsuccessful, try one of the +alternate means of downloading discussed at . + +Downloaded packages and patches will need to be stored somewhere +that is conveniently available throughout the entire build. A working +directory is also required to unpack the sources and build them. +$LFS/sources can be used both +as the place to store the tarballs and patches and as a working +directory. By using this directory, the required elements will be +located on the LFS partition and will be available during all stages +of the building process. + +To create this directory, execute, as user +root, the following command before starting the +download session: mkdir $LFS/sources -Set the permissions of that dir: +Make this directory writable and sticky. Sticky +means that even if multiple users have write permission on a +directory, only the owner of a file can delete the file within a +sticky directory. The following command will enable the write and +sticky modes: chmod a+wt $LFS/sources + diff --git a/chapter03/packages.xml b/chapter03/packages.xml index da281d61d..babbb6e01 100644 --- a/chapter03/packages.xml +++ b/chapter03/packages.xml @@ -10,131 +10,136 @@ Download or otherwise obtain the following packages: -Packages -Autoconf (&autoconf-version;) - 903 KB: +Autoconf (&autoconf-version;) - 903 kilobytes (KB): - + -Automake (&automake-version;) - 740 KB: +Automake (&automake-version;) - 681 KB: - + Bash (&bash-version;) - 1,910 KB: - + Binutils (&binutils-version;) - 10,666 KB: - + Bison (&bison-version;) - 796 KB: - + Bzip2 (&bzip2-version;) - 650 KB: - + Coreutils (&coreutils-version;) - 3,860 KB: - + DejaGNU (&dejagnu-version;) - 1,055 KB: - + Diffutils (&diffutils-version;) - 762 KB: - + -E2fsprogs (&e2fsprogs-version;) - 3,188 KB: +E2fsprogs (&e2fsprogs-version;) - 3,003 KB: - + -Expect (&expect-version;) - 513 KB: +Expect (&expect-version;) - 510 KB: - + -File (&file-version;) - 411 KB: +File (&file-version;) - 356 KB: - + +File (&file-version;) may no longer be available at the +listed location. The site administrators of the master download +location occasionally remove older versions when new ones are +released. An alternate download location that may have the correct +version available is . -Findutils (&findutils-version;) - 914 KB: +Findutils (&findutils-version;) - 760 KB: - + Flex (&flex-version;) - 372 KB: - + -Gawk (&gawk-version;) - 1,596 KB: +Gawk (&gawk-version;) - 1,692 KB: - + -GCC (&gcc-version;) - ~27,000KB: +GCC (&gcc-version;) - 27,000 KB: - + Gettext (&gettext-version;) - 6,397 KB: - + -Glibc (&glibc-version;) - 12,904 KB: +Glibc (&glibc-version;) - 13,101 KB: - + @@ -148,19 +153,19 @@ Grep (&grep-version;) - 545 KB: - + Groff (&groff-version;) - 2,360 KB: - + -Grub (&grub-version;) - 963 KB: +Grub (&grub-version;) - 902 KB: @@ -183,19 +188,19 @@ Iana-Etc (&iana-etc-version;) - 161 KB: - + Inetutils (&inetutils-version;) - 1,019 KB: - + -IPRoute2 (&iproute2-version;) - 230 KB: +IPRoute2 (&iproute2-version;) - 264 KB: @@ -204,84 +209,84 @@ Kbd (&kbd-version;) - 617 KB: - + Less (&less-version;) - 259 KB: - + -LFS-Bootscripts (&lfs-bootscripts-version;) - 14 KB: +LFS-Bootscripts (&lfs-bootscripts-version;) - 16 KB: - -Libol (&libol-version;) - 337 KB: + +Libol (&libol-version;) - 336 KB: - + -Libtool (&libtool-version;) - 2,668 KB: +Libtool (&libtool-version;) - 2,602 KB: - + -Linux (&linux-version;) - 30,051 KB: +Linux (&linux-version;) - 34,793 KB: - + -Linux-Libc-Headers (&linux-libc-headers-version;) - 2,460 KB: +Linux-Libc-Headers (&linux-libc-headers-version;) - 2,602 KB: -M4 (&m4-version;) - 310 KB: +M4 (&m4-version;) - 337 KB: - + Make (&make-version;) - 899 KB: - + -Man (&man-version;) - 228 KB: +Man (&man-version;) - 223 KB: - + -Man-pages (&man-pages-version;) - 1,629 KB: +Man-pages (&man-pages-version;) - 1,586 KB: - + Mktemp (&mktemp-version;) - 69 KB: - + @@ -295,91 +300,91 @@ Ncurses (&ncurses-version;) - 2,019 KB: - + Patch (&patch-version;) - 182 KB: - + -Perl (&perl-version;) - 9,466 KB: +Perl (&perl-version;) - 9,373 KB: - + Procps (&procps-version;) - 271 KB: - + Psmisc (&psmisc-version;) - 375 KB: - + Readline (&readline-version;) - 940 KB: - + Sed (&sed-version;) - 776 KB: - + Shadow (&shadow-version;) - 996 KB: - + -Syslog-ng (&syslog-ng-version;) - 369 KB: +Syslog-ng (&syslog-ng-version;) - 388 KB: -Sysvinit (&sysvinit-version;) - 97 KB: +Sysvinit (&sysvinit-version;) - 91 KB: - + Tar (&tar-version;) - 1,025 KB: - + -Tcl (&tcl-version;) - 3,414 KB: +Tcl (&tcl-version;) - 3,363 KB: - + Texinfo (&texinfo-version;) - 1,385 KB: - + @@ -405,37 +410,36 @@ -Util-linux (&util-linux-version;) - 1,339: +Util-linux (&util-linux-version;) - 1,339 KB: - + Vim (&vim-version;) - 3,612 KB: - + Vim (&vim-version;) language files (optional) - 1,033 KB: - + Zlib (&zlib-version;) - 277 KB: - + - + diff --git a/chapter03/patches.xml b/chapter03/patches.xml index 28a01a6fc..c7d3efb8f 100644 --- a/chapter03/patches.xml +++ b/chapter03/patches.xml @@ -7,17 +7,23 @@ Needed Patches +In addition to the packages, several patches are also required. +These patches correct any mistakes in the packages that should be +fixed by the maintainer. The patches also make small modifications to +make the packages easier to work with. The following patches will be +needed to build an LFS system: + -Bash Various Fixes - 23 KB: +Bash Various Fixes - 21 KB: - + -Bash Avoid Wcontinued Patch - 1KB: +Bash Avoid Wcontinued Patch - 1 KB: @@ -26,7 +32,8 @@ Coreutils Suppress Uptime, Kill, Su Patch - 16 KB: - + + @@ -52,7 +59,7 @@ - GCC Linkonce Patch - 12KB: + GCC Linkonce Patch - 12 KB: @@ -75,21 +82,24 @@ Inetutils Kernel Headers Patch - 1 KB: - + + Inetutils No-Server-Man-Pages Patch - 4 KB: - + + IPRoute2 Disable DB Patch - 1 KB: - + + @@ -122,9 +132,9 @@ -Readline Various Fixes - 7 KB: +Readline Display Wrap Patch - 1 KB: - + @@ -142,4 +152,12 @@ +In addition to the above required patches, there exist a number of +optional patches created by the LFS community. These optional patches +solve minor problems or enable functionality that is not enabled by +default. Feel free to peruse the patches database located at + and acquire any additional +patches to suit the system needs. + + diff --git a/chapter04/aboutlfs.xml b/chapter04/aboutlfs.xml index 2c270a08a..64f20f1b4 100644 --- a/chapter04/aboutlfs.xml +++ b/chapter04/aboutlfs.xml @@ -7,6 +7,29 @@ About $LFS -See testing +Throughout this book, the environment variable LFS will +be used several times. It is paramount that this variable is always defined. +It should be set to the mount point chosen for the LFS partition. +Check that the LFS variable is set up properly with: + +echo $LFS + +Make sure the output shows the path to the LFS partition's mount +point, which is /mnt/lfs if the +provided example was followed. If the output is incorrect, the +variable can be set with: + +export LFS=/mnt/lfs + +Having this variable set is beneficial in that commands such as +mkdir $LFS/tools can be typed literally. The shell +will automatically replace $LFS with +/mnt/lfs (or whatever the variable was set to) when it +processes the command line. + +Do not forget to check that $LFS is set whenever +you leave and reenter the current working environment (as when doing a +su to root or another user). + diff --git a/chapter04/aboutsbus.xml b/chapter04/aboutsbus.xml index d99ac1f0f..34e1a1ef4 100644 --- a/chapter04/aboutsbus.xml +++ b/chapter04/aboutsbus.xml @@ -7,6 +7,44 @@ About SBUs -See testing +Many people would like to know beforehand approximately how long +it takes to compile and install each package. Because Linux From +Scratch can be built on many different systems, it is impossible to +provide accurate time estimates. The biggest package (Glibc) will +take approximately 20 minutes on the fastest systems, but could take +up to three days on slower systems! Instead of providing actual times, +the Static Build Unit (SBU) measure will be +used instead. + +The SBU measure works as follows. The first package to be compiled +from this book is the statically-linked Binutils in . The time it takes to compile +this package is what will be referred to as the Static Build Unit +or SBU. All other compile times will be expressed relative to this +time. + +For example, consider a package whose compilation time is 4.5 +SBUs. This means that if a system took 10 minutes to compile and +install the static Binutils, it will take +approximately 45 minutes to build this example +package. Fortunately, most build times are shorter than the one +for Binutils. + +Please note that if the system compiler on the host is GCC-2.x based, the +SBUs listed may be somewhat understated. This is because the SBU is +based on the very first package, compiled with the old GCC, while the +rest of the system is compiled with the newer GCC-&gcc-version; (which is +known to be approximately 30 percent slower). SBUs are also not +highly accurate for Symmetric Multi-Processor (SMP)-based machines. + +To view actual timings for a number of specific machines, we recommend +. + +In general, SBUs are not very accurate because they depend on many +factors, not just the GCC version. They are provided +here to give an estimate of how long it might take to +install a package, but the numbers can vary by as much as dozens of +minutes in some cases. + diff --git a/chapter04/abouttestsuites.xml b/chapter04/abouttestsuites.xml index cfa1b9705..82ca9b062 100644 --- a/chapter04/abouttestsuites.xml +++ b/chapter04/abouttestsuites.xml @@ -7,6 +7,44 @@ About the Test Suites -See testing +Most packages provide a test suite. Running the test suite for a +newly built package is a good idea because it can provide a sanity +check indicating that everything compiled correctly. A test suite +that passes its set of checks usually proves that the package is +functioning as the developer intended. It does not, however, guarantee +that the package is totally bug free. + +Some test suites are more important than others. For example, +the test suites for the core toolchain packages—GCC, Binutils, and +Glibc—are of the utmost importance due to their central role in a +properly functioning system. The test suites for GCC and Glibc can +take a very long time to complete, especially on slower hardware, but +are strongly recommended. + +Experience has shown that there is little to be gained +from running the test suites in . There can be no escaping the fact +that the host system always exerts some influence on the tests in that +chapter, often causing inexplicable failures. Because the tools built +in are temporary and +eventually discarded, we do not recommend running the test suites in + for the average reader. The +instructions for running those test suites are provided for the +benefit of testers and developers, but they are strictly +optional. + +A common issue with running the test suites for Binutils and GCC +is running out of pseudo terminals (PTYs). This can result in a high +number of failing tests. This may happen for several reasons, but the +most likely cause is that the host system does not have the +devpts file system set up +correctly. This issue is discussed in greater detail in . + +Sometimes package test suites will give false failures. Consult +the LFS Wiki at to verify that these +failures are expected. This site is valid for all tests throughout this +book. + diff --git a/chapter04/addinguser.xml b/chapter04/addinguser.xml index 5073eac68..d701566ba 100644 --- a/chapter04/addinguser.xml +++ b/chapter04/addinguser.xml @@ -7,17 +7,85 @@ Adding the LFS User -Issue the following commands to add the new user: +When logged in as user root, making a +single mistake can damage or destroy a system. Therefore, we recommend +building the packages in this chapter as an unprivileged user. You +could use your own user name, but to make it easier to set up a clean +work environment, create a new user called lfs as +a member of a new group (also named lfs) and use +this user during the installation process. As +root, issue the following commands to add the new +user: groupadd lfs useradd -s /bin/bash -g lfs -m -k /dev/null lfs +The meaning of the command line options: + + + +-s /bin/bash +This makes +bash the default shell for user +lfs. + + + +-g lfs +This option adds user lfs to group +lfs. + + + +-m +This creates a home +directory for lfs. + + + +-k /dev/null +This parameter +prevents possible copying of files from a skeleton directory (default +is /etc/skel) by changing the input location to +the special null device. + + + +lfs +This is the actual name for the created group and +user. + + + +To log in as lfs (as opposed to switching +to user lfs when +logged in as root, which does not require the +lfs user to have a +password), give lfs a password: + passwd lfs +Grant lfs full access to +$LFS/tools by making +lfs the directory owner: + chown lfs $LFS/tools +If a separate working directory was created as suggested, give +user lfs ownership of this directory: + chown lfs $LFS/sources +Next, login as user lfs. This can be done +via a virtual console, through a display manager, or with the +following substitute user command: + su - lfs +The - instructs +su to start a login shell as opposed to a non-login +shell. The difference between these two types of shells can be found +in detail in the Bash man and info pages. + + diff --git a/chapter04/creatingtoolsdir.xml b/chapter04/creatingtoolsdir.xml index 36e4fe7a4..8ab7fde3a 100644 --- a/chapter04/creatingtoolsdir.xml +++ b/chapter04/creatingtoolsdir.xml @@ -7,8 +7,40 @@ Creating the $LFS/tools Directory +All programs compiled in will be installed under $LFS/tools to keep them separate from the +programs compiled in . The +programs compiled here are temporary tools and will not be a part of +the final LFS system. By keeping these programs in a separate +directory, they can easily be discarded later after their use. This +also prevents these programs from ending up in the host production +directories (easy to do by accident in ). + +Create the required directory by running the following as +root: + mkdir $LFS/tools +The next step is to create a /tools +symlink on the host system. This will point to the newly-created directory on +the LFS partition. Run this command as root as +well: + ln -s $LFS/tools / +The above command is correct. The ln +command has a few syntactic variations, so be sure to check the info +and man pages before reporting what you may think is an +error. + +The created symlink enables the toolchain to be compiled so that +it always refers to /tools, +meaning that the compiler, assembler, and linker will work both in +this chapter (when we are still using some tools from the host) and in +the next (when we are chrooted to the LFS +partition). + + diff --git a/chapter04/settingenviron.xml b/chapter04/settingenviron.xml index ea2672707..247b55e96 100644 --- a/chapter04/settingenviron.xml +++ b/chapter04/settingenviron.xml @@ -7,10 +7,35 @@ Setting Up the Environment +Set up a good working environment by creating two new startup +files for the bash shell. While logged in as user +lfs, issue the +following command to create a new .bash_profile: + cat > ~/.bash_profile << "EOF" exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash EOF +When logged on as user lfs, the +initial shell is usually a login shell which reads the +/etc/profile of the host (probably containing +some settings and environment variables) and then +.bash_profile. The exec env +-i.../bin/bash command in the +.bash_profile file replaces the running shell +with a new one with a completely empty environment, except for the +HOME, TERM, and +PS1 variables. This ensures that no unwanted and +potentially hazardous environment variables from the host system leak +into the build environment. The technique used here achieves the goal +of ensuring a clean environment. + +The new instance of the shell is a non-login +shell, which does not read the /etc/profile or +.bash_profile files, but rather reads the +.bashrc file instead. Create the +.bashrc file now: + cat > ~/.bashrc << "EOF" set +h umask 022 @@ -20,6 +45,49 @@ PATH=/tools/bin:/bin:/usr/bin export LFS LC_ALL PATH EOF +The set +h command turns off +bash's hash function. Hashing is ordinarily a useful +feature—bash uses a hash table to remember the +full path of executable files to avoid searching the PATH time +and again to find the same executable. However, the new tools +should be used as soon as they are installed. By switching off the +hash function, the shell will always search the PATH when a program is +to be run. As such, the shell will find the newly compiled +tools in $LFS/tools as soon as +they are available without remembering a previous version of the same +program in a different location. + +Setting the user file-creation mask (umask) to 022 ensures that newly +created files and directories are only writable by their owner, but +are readable and executable by anyone (assuming default modes are used +by the open(2) system call, new files will end up with permission mode +644 and directories with mode 755). + +The LFS variable should be set to the +chosen mount point. + +The LC_ALL variable controls the +localization of certain programs, making their messages follow the +conventions of a specified country. If the host system uses a version +of Glibc older than 2.2.4, having LC_ALL set to something other than +POSIX or C (during this chapter) may +cause issues if you exit the chroot environment and wish to return +later. Setting LC_ALL to POSIX +or C (the two are equivalent) ensures that +everything will work as expected in the chroot environment. + +By putting /tools/bin +ahead of the standard PATH, all the programs installed in are picked up by the shell +immediately after their installation. This, combined with turning off +hashing, limits the risk that old programs from +the host are being used when they should not be used any +longer. + +Finally, to have the environment fully prepared for building the +temporary tools, source the just-created user profile: + source ~/.bash_profile + diff --git a/chapter05/adjusting.xml b/chapter05/adjusting.xml index ac342fe87..834ef166f 100644 --- a/chapter05/adjusting.xml +++ b/chapter05/adjusting.xml @@ -7,12 +7,34 @@ Adjusting the Toolchain -Run the following command from within -the binutils-build directory: +Now that the temporary C libraries have been installed, all +tools compiled in the rest of this chapter should be linked against +these libraries. In order to accomplish this, the linker and the +compiler's specs file need to be adjusted. + +The linker, adjusted at the end of the first pass of Binutils, +is installed by running the following command from within the +binutils-build directory: make -C ld install -Amend the GCC specs file: +From this point onwards, everything will link only +against the libraries in /tools/lib. + +If the earlier warning to retain the Binutils source and +build directories from the first pass was missed, ignore the above +command. This results in a small chance that the subsequent testing +programs will link against libraries on the host. This is not ideal, +but it is not a major problem. The situation is corrected when the +second pass of Binutils is installed later. + +Now that the adjusted linker is installed, the Binutils build and source +directories should be removed. + +The next task is to amend the GCC specs file so that it points +to the new dynamic linker. A simple sed script will accomplish this: + + SPECFILE=`gcc --print-file specs` && sed 's@ /lib/ld-linux.so.2@ /tools/lib/ld-linux.so.2@g' \ @@ -20,24 +42,71 @@ sed 's@ /lib/ld-linux.so.2@ /tools/lib/ld-linux.so.2@g' \ mv -f tempspecfile $SPECFILE && unset SPECFILE -Make clean-up: +It is recommended that the above +command be copy-and-pasted in order to ensure accuracy. +Alternatively, the specs file can be edited by hand. This is done by +replacing every occurrence of /lib/ld-linux.so.2 with +/tools/lib/ld-linux.so.2 + +Be sure to visually inspect the specs file in order to verify the +intended changes have been made. + +If working on a platform where the name of the +dynamic linker is something other than +ld-linux.so.2, replace +ld-linux.so.2 with the name of the platform's +dynamic linker in the above commands. Refer back to if +necessary. + +There is a possibility that some include files from the host +system have found their way into GCC's private include dir. This can +happen as a result of GCC's fixincludes process, which runs as part +of the GCC build. This is explained in more detail later in this +chapter. Run the following command to eliminate this +possibility: rm -f /tools/lib/gcc/*/*/include/{pthread.h,bits/sigthread.h} -Test the tools: +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 'main(){}' > dummy.c cc dummy.c readelf -l a.out | grep ': /tools' -The output of the last command will be of the form: +If everything is working correctly, there should be no errors, +and the output of the last command will be of the form: [Requesting program interpreter: /tools/lib/ld-linux.so.2] -Remove the test files: +Note that /tools/lib +appears as the prefix of the dynamic linker. + +If the output is not shown as above or there was no output at +all, then something is wrong. Investigate and retrace the steps to +find out where the problem is and correct it. This issue must be +resolved before continuing on. First, perform the sanity check again, +using gcc instead of cc. If this +works, then the /tools/bin/cc symlink is missing. +Revisit and install the symlink. +Next, ensure that the PATH is correct. This can be checked by running +echo $PATH and verifying that /tools/bin is at the head of the list. If +the PATH is wrong it could mean that you are not logged in as user +lfs or that something went wrong back in Another option is that something +may have gone wrong with the specs file amendment above. In this case, +redo the specs file amendment, being careful to copy-and-paste the +commands. + +Once all is well, clean up the test files: rm dummy.c a.out - + + diff --git a/chapter05/bash.xml b/chapter05/bash.xml index 62feb7904..930bd964a 100644 --- a/chapter05/bash.xml +++ b/chapter05/bash.xml @@ -7,8 +7,12 @@ Bash-&bash-version; + +Bash +tools +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/bash.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -16,12 +20,16 @@ <seglistitem><seg>1.2 SBU</seg><seg>27 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/bash.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> <title>Installation of Bash -Apply a patch: + +Bash has a problem when compiled against newer versions of Glibc, causing +it to hang inappropriately. This patch fixes the problem: patch -Np1 -i ../bash-&bash-version;-avoid_WCONTINUED-1.patch @@ -29,21 +37,39 @@ ./configure --prefix=/tools --without-bash-malloc -Compile the program: +The meaning of the configure option: + + + +--without-bash-malloc +This options 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 -To test the results, issue: -make test. +To test the results, issue: make +tests. -Then install it : +Install the package: make install -Create a symlink: +Make a link for the programs that use sh for +a shell: ln -s bash /tools/bin/sh + +<para>Details on this package are located in <xref linkend="contents-bash" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/binutils-pass1.xml b/chapter05/binutils-pass1.xml index 4dc8b3e1a..9f35ae722 100644 --- a/chapter05/binutils-pass1.xml +++ b/chapter05/binutils-pass1.xml @@ -7,7 +7,12 @@ <title>Binutils-&binutils-version; - Pass 1 + +Binutils +tools, pass 1 + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/binutils.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,44 +20,134 @@ <seglistitem><seg>1.0 SBU</seg><seg>194 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/binutils.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> <title>Installation of Binutils -Create a build dir: +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. + +This package is known to have issues when its default +optimization flags (including the -march and +-mcpu options) are changed. If any environment +variables that override default optimizations have been defined, such +as CFLAGS and CXXFLAGS, +unset them when building Binutils. + +The Binutils documentation recommends building Binutils outside of the +source directory in a dedicated build directory: mkdir ../binutils-build cd ../binutils-build -If you want the SBU values you could wrap the four commands in a -time command like this: -time { ./configure ... && ... && ... -&& make install; }. +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 four commands in a time +command like this: time { ./configure ... && ... +&& ... && make install; }. Now prepare Binutils for compilation: ../binutils-&binutils-version;/configure --prefix=/tools \ --disable-nls +The meaning of the configure options: + + + +--prefix=/tools +This tells the configure script to prepare to install the Binutils +programs in the /tools directory. + + + +--disable-nls +This disables internationalization. This is not needed +for the static programs, and NLS can cause problems when linking +statically. + + + Continue with compiling the package: make configure-host make LDFLAGS="-all-static" -Now install the package: +The meaning of the make parameters: + + + +configure-host +This forces all subdirectories to be configured +immediately. A statically-linked build will fail without it. Use this +option to work around the problem. + + + +LDFLAGS="-all-static" +This tells the linker that all Binutils programs +should be linked statically. However, strictly speaking, +"-all-static" is passed to the +libtool program, which then passes +"-static" to the linker. + + + +Compilation is now complete. Ordinarily we would now run the +test suite, but at this early stage the test suite framework (Tcl, +Expect, and DejaGNU) is not yet in place. The benefits of running the +tests at this point are minimal since the programs from this +first pass will soon be replaced by those from the second. + +Install the package: make install -Now prepare the linker for the Adjusting phase later on: +Next, prepare the linker for the Adjusting phase +later on: make -C ld clean make -C ld LDFLAGS="-all-static" LIB_PATH=/tools/lib -Do not yet remove the Binutils build and -source directories. You will need them again in their current state a bit -further on in this chapter. +The meaning of the make parameters: + + + +-C ld clean +This tells the make program to remove all compiled +files in the ld +subdirectory. + + + +-C ld LDFLAGS="-all-static" +LIB_PATH=/tools/lib +This option rebuilds everything in the +ld subdirectory. Specifying +the LIB_PATH Makefile variable on the command +line allows us to override the default value +and point it to the temporary tools location. The value of this variable +specifies the linker's default library search path. This preparation +is used later in the chapter. + + + +Do not remove the Binutils +build and source directories yet. These will be needed again in their +current state later in this chapter. + +<para>Details on this package are located in <xref +linkend="contents-binutils" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/binutils-pass2.xml b/chapter05/binutils-pass2.xml index 0c28271f7..85a574309 100644 --- a/chapter05/binutils-pass2.xml +++ b/chapter05/binutils-pass2.xml @@ -7,7 +7,14 @@ <title>Binutils-&binutils-version; - Pass 2 + +Binutils +tools, pass 2 + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" + href="../chapter06/binutils.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,39 +22,57 @@ <seglistitem><seg>1.5 SBU</seg><seg>108 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" + href="../chapter06/binutils.xml" + xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> <title>Re-installation of Binutils +This package is known to have issues when its default +optimization flags (including the -march and +-mcpu options) are changed. If any environment +variables that override default optimizations have been defined, such +as CFLAGS and CXXFLAGS, +unset them when building Binutils. + Create a separate build directory again: mkdir ../binutils-build cd ../binutils-build -Now prepare Binutils for compilation: +Prepare Binutils for compilation: ../binutils-&binutils-version;/configure --prefix=/tools \ --enable-shared --with-lib-path=/tools/lib +The meaning of the new configure option: + + + +--with-lib-path=/tools/lib +This tells the configure script to specify the library +search path during the compilation of Binutils, resulting in /tools/lib being passed to the linker. +This prevents the linker from searching through library directories on +the host. + + + Compile the package: make -Test the results: +Compilation is now complete. As discussed earlier, running the +test suite is not mandatory for the temporary tools here in this +chapter. To run the Binutils test suite anyway, issue the following +command: - -make -k check +make check -Except for a few known failures, the binutils tests should all pass. The -exceptions to this rule are as follows: - -* 5 FAIL (unexpected failure) for visibility -* 1 FAIL for selective4 -* 1 FAIL for selective5 - - -And install the package: +Install the package: make install @@ -58,10 +83,16 @@ chapter: make -C ld LIB_PATH=/usr/lib:/lib -Do not yet remove the Binutils source and -build directories. You will need these directories again in the next chapter -in the state they are in now. +Do not remove the Binutils source and +build directories yet. These directories will be needed again in the next +chapter in their current state. + +<para>Details on this package are located in <xref +linkend="contents-binutils" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/bison.xml b/chapter05/bison.xml index e3572e99d..dc237997d 100644 --- a/chapter05/bison.xml +++ b/chapter05/bison.xml @@ -7,7 +7,12 @@ <title>Bison-&bison-version; + +Bison +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/bison.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.6 SBU</seg><seg>10.6 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/bison.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -28,13 +35,19 @@ <screen><userinput>make</userinput></screen> -<para>To test the results, issue: -<userinput>make check</userinput>.</para> +<para>To test the results, issue: <userinput>make +check</userinput>.</para> -<para>Now install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-bison" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/bzip2.xml b/chapter05/bzip2.xml index fb2ae264e..a45dee979 100644 --- a/chapter05/bzip2.xml +++ b/chapter05/bzip2.xml @@ -7,7 +7,12 @@ <title>Bzip2-&bzip2-version; + +Bzip2 +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/bzip2.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,20 +20,28 @@ <seglistitem><seg>0.1 SBU</seg><seg>2.5 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/bzip2.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> <title>Installation of Bzip2 -The Bzip2 package doesn't contain a configure -script. Compile it with a straightforward: +The Bzip2 package does not contain a configure +script. Compile it with: make -And install it: +Install the package: make PREFIX=/tools install + +<para>Details on this package are located in <xref +linkend="contents-bzip2" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/chapter05.xml b/chapter05/chapter05.xml index 353071c9d..9c567c530 100644 --- a/chapter05/chapter05.xml +++ b/chapter05/chapter05.xml @@ -14,9 +14,6 @@ <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="binutils-pass1.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gcc-pass1.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="linux-libc-headers.xml"/> -<!-- -<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="kernel-headers.xml"/> ---> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="glibc.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="adjusting.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="tcl.xml"/> @@ -44,9 +41,6 @@ <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="flex.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="util-linux.xml"/> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="perl.xml"/> -<!-- -<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="udev.xml"/> ---> <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="stripping.xml"/> </chapter> diff --git a/chapter05/coreutils.xml b/chapter05/coreutils.xml index f99768465..e7bf67d37 100644 --- a/chapter05/coreutils.xml +++ b/chapter05/coreutils.xml @@ -7,7 +7,12 @@ <title>Coreutils-&coreutils-version; + +Coreutils +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/coreutils.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.9 SBU</seg><seg>69 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/coreutils.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -24,17 +31,44 @@ <screen><userinput>DEFAULT_POSIX2_VERSION=199209 ./configure --prefix=/tools</userinput></screen> +<para>This package has an issue when compiled against versions of +Glibc later than 2.3.2. Some of the Coreutils utilities (such as +<command>head</command>, <command>tail</command>, and +<command>sort</command>) will reject their traditional syntax, a +syntax that has been in use for approximately 30 years. This old +syntax is so pervasive that compatibility should be preserved until +the many places where it is used can be updated. Backwards +compatibility is achieved by setting the +<envar>DEFAULT_POSIX2_VERSION</envar> environment variable to +<quote>199209</quote> in the above command. If you do not want +Coreutils to be backwards compatible with the traditional syntax, then +omit setting the <envar>DEFAULT_POSIX2_VERSION</envar> +environment variable. It is important to remember that doing so will +have consequences, including the need to patch the many packages that +still use the old syntax. Therefore, it is recommended that the +instructions be followed exactly as given above.</para> + <para>Compile the package:</para> <screen><userinput>make</userinput></screen> -<para>To test the result, issue: -<userinput>make RUN_EXPENSIVE_TESTS=yes check</userinput></para> +<para>To test the results, issue: <userinput>make +RUN_EXPENSIVE_TESTS=yes check</userinput>. The +<parameter>RUN_EXPENSIVE_TESTS=yes</parameter> parameter tells the +test suite to run several additional tests that are considered +relatively expensive (in terms of CPU power and memory usage) on some +platforms, but generally are not a problem on Linux.</para> -<para>And install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-coreutils" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/dejagnu.xml b/chapter05/dejagnu.xml index 25e3e87b2..2b9703030 100644 --- a/chapter05/dejagnu.xml +++ b/chapter05/dejagnu.xml @@ -3,13 +3,14 @@ <!ENTITY % general-entities SYSTEM "../general.ent"> %general-entities; ]> -<sect1 id="ch-tools-dejagnu" xreflabel="DejaGNU" role="wrap"> +<sect1 id="ch-tools-dejagnu" role="wrap"> <title>DejaGNU-&dejagnu-version; DejaGNU +<para>The DejaGNU package contains a framework for testing other programs.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,11 @@ <seglistitem><seg>0.1 SBU</seg><seg>8.6 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>DejaGNU installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -32,11 +38,28 @@ </sect2> + <sect2 id="contents-dejagnu" role="content"><title>Contents of DejaGNU -See testing + +Installed program +runtest + + +Short Descriptions + + + +runtest + +A wrapper script that locates the proper +expect shell and then runs DejaGNU +runtest + + + - + diff --git a/chapter05/diffutils.xml b/chapter05/diffutils.xml index 7d9d49eb5..b3408d512 100644 --- a/chapter05/diffutils.xml +++ b/chapter05/diffutils.xml @@ -7,7 +7,12 @@ Diffutils-&diffutils-version; + +Diffutils +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/diffutils.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.1 SBU</seg><seg>7.5 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/diffutils.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -28,10 +35,18 @@ <screen><userinput>make</userinput></screen> -<para>And install it:</para> +<para>This package does not come with a test suite.</para> + +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-diffutils" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/expect.xml b/chapter05/expect.xml index 11887dfd2..5d99eaf4d 100644 --- a/chapter05/expect.xml +++ b/chapter05/expect.xml @@ -3,13 +3,15 @@ <!ENTITY % general-entities SYSTEM "../general.ent"> %general-entities; ]> -<sect1 id="ch-tools-expect" xreflabel="Expect" role="wrap"> +<sect1 id="ch-tools-expect" role="wrap"> <title>Expect-&expect-version; Expect +<para>The Expect package contains a program for carrying out scripted dialogues +with other interactive programs.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,12 +19,18 @@ <seglistitem><seg>0.1 SBU</seg><seg>3.9 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Expect installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, Sed, and Tcl</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Expect -Apply a patch: +First, fix a bug that can result in false failures during the GCC test +suite run: patch -Np1 -i ../expect-&expect-version;-spawn-1.patch @@ -30,26 +38,84 @@ ./configure --prefix=/tools --with-tcl=/tools/lib --with-x=no +The meaning of the configure options: + + + +--with-tcl=/tools/lib +This ensures that the configure script finds the Tcl installation in +the temporary tools location instead of possibly locating an existing +one on the host system. + + + +--with-x=no +This tells the configure script not to search for Tk +(the Tcl GUI component) or the X Window System libraries, both of +which may reside on the host system. + + + Build the package: make -To test the results, issue: -make test +To test the results, issue: make test. +Note that the Expect test suite is known to experience failures under +certain host conditions that are not within our control. Therefore, +test suite failures here are not surprising and are not considered +critical. -And install it: +Install the package: make SCRIPTS="" install -You can now remove the source directories of both Tcl and Expect. +The meaning of the make parameter: + + + +SCRIPTS="" +This prevents installation of the supplementary expect +scripts, which are not needed. + + + +The source directories of both Tcl and Expect can now be removed. Contents of Expect -See testing + +Installed program +Installed library +expectlibexpect-5.42.a + + +Short Descriptions + + + +expect + +Communicates with other interactive +programs according to a script +expect + + + + +libexpect-5.42.a + +Contains functions that allow Expect to be used as a Tcl extension or to +be used directly from C or C++ (without Tcl) +libexpect-5.42 + + + - + diff --git a/chapter05/findutils.xml b/chapter05/findutils.xml index 0da1b5bc0..d75f15b90 100644 --- a/chapter05/findutils.xml +++ b/chapter05/findutils.xml @@ -7,7 +7,12 @@ Findutils-&findutils-version; + +Findutils +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/findutils.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.2 SBU</seg><seg>7.6 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/findutils.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -28,13 +35,19 @@ <screen><userinput>make</userinput></screen> -<para>To test the results, issue: -<userinput>make check</userinput></para> +<para>To test the results, issue: <userinput>make +check</userinput>.</para> -<para>And install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-findutils" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/flex.xml b/chapter05/flex.xml index d8f01a11e..c78a52ffc 100644 --- a/chapter05/flex.xml +++ b/chapter05/flex.xml @@ -3,11 +3,16 @@ <!ENTITY % general-entities SYSTEM "../general.ent"> %general-entities; ]> -<sect1 id="ch-tools-flex" xreflabel="Flex" role="wrap"> +<sect1 id="ch-tools-flex" role="wrap"> <title>Flex-&flex-version; + +Flex +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/flex.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,16 +20,22 @@ <seglistitem><seg>0.6 SBU</seg><seg>10.6 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/flex.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> <title>Installation of Flex -Apply a patch: +Flex contains several known bugs. These can be fixed with the +following patch: patch -Np1 -i ../flex-&flex-version;-debian_fixes-2.patch -Touch the man-page: +The GNU autotools will detect that the Flex source code has been +modified by the previous patch and tries to update the manual page +accordingly. This does not work on many systems, and the default page is +fine, so make sure it does not get regenerated: touch doc/flex.1 @@ -39,10 +50,16 @@ To test the results, issue: make check. -Now install the package: +Install the package: make install + +<para>Details on this package are located in <xref +linkend="contents-flex" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/gawk.xml b/chapter05/gawk.xml index 62ad8768d..e72817f81 100644 --- a/chapter05/gawk.xml +++ b/chapter05/gawk.xml @@ -7,7 +7,12 @@ <title>Gawk-&gawk-version; + +Gawk +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gawk.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.2 SBU</seg><seg>17 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gawk.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -28,13 +35,19 @@ <screen><userinput>make</userinput></screen> -<para>To test the results, issue: -<userinput>make check</userinput></para> +<para>To test the results (not necessary), issue: <userinput>make +check</userinput>.</para> -<para>And install it:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-gawk" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/gcc-pass1.xml b/chapter05/gcc-pass1.xml index 39b343a2e..503438558 100644 --- a/chapter05/gcc-pass1.xml +++ b/chapter05/gcc-pass1.xml @@ -7,7 +7,12 @@ <title>GCC-&gcc-version; - Pass 1 + +GCC +tools, pass 1 + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gcc.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,36 +20,117 @@ <seglistitem><seg>4.4 SBU</seg><seg>300 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gcc.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> <title>Installation of GCC -Create a build dir: +Unpack only the gcc-core tarball because neither the C++ +compiler nor the test suite will be needed here. + +This package is known to have issues when its default +optimization flags (including the -march and +-mcpu options) are changed. If any environment +variables that override default optimizations have been defined, such +as CFLAGS and CXXFLAGS, +unset them when building GCC. + +The GCC documentation recommends building GCC outside of the +source directory in a dedicated build directory: mkdir ../gcc-build cd ../gcc-build Prepare GCC for compilation: - -CC="gcc -B/usr/bin" ../gcc-&gcc-version;/configure \ - --prefix=/tools --libexecdir=/tools/lib \ - --with-local-prefix=/tools --disable-nls \ - --enable-shared --enable-languages=c +../gcc-&gcc-version;/configure --prefix=/tools \ + --libexecdir=/tools/lib --with-local-prefix=/tools \ + --disable-nls --enable-shared --enable-languages=c + +The meaning of the configure options: + + + +--with-local-prefix=/tools +The purpose of this switch is to remove /usr/local/include +from gcc's include search path. This is not absolutely +essential, however, it helps to minimize the influence of the host +system. + + + + +--enable-shared +This switch may seem counter-intuitive at first. +However, this switch allows the building of +libgcc_s.so.1 and +libgcc_eh.a, and having +libgcc_eh.a available ensures that the configure +script for Glibc (the next package we compile) produces the proper +results. Note that the GCC binaries will still be linked statically +because this is controlled by the -static value of +the BOOT_LDFLAGS variable in the next +step. + + + +--enable-languages=c +This option ensures that only the C compiler is built. +This option is only needed when you have downloaded and unpacked the +full GCC tarball, as opposed to just the gcc-core +tarball. + + Continue with compiling the package: make BOOT_LDFLAGS="-static" bootstrap -Now install the package: +The meaning of the make parameters: + + + +BOOT_LDFLAGS="-static" +This tells GCC to link its programs statically. + + + +bootstrap +This target does not just compile GCC, but compiles it +several times. It uses the programs compiled in a first round to +compile itself a second time, and then again a third time. It then +compares these second and third compiles to make sure it can reproduce +itself flawlessly. This also implies that it was compiled +correctly. + + + +Compilation is now complete. At this point, the test suite would +normally be run, but, as mentioned before, the test suite framework is +not in place yet. The benefits of running the tests at this point +are minimal since the programs from this first pass will soon be +replaced. + +Install the package: make install -Create a symlink: +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 -s gcc /tools/bin/cc + +<para>Details on this package are located in <xref +linkend="contents-gcc" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/gcc-pass2.xml b/chapter05/gcc-pass2.xml index 9058c02ea..202f9a0d9 100644 --- a/chapter05/gcc-pass2.xml +++ b/chapter05/gcc-pass2.xml @@ -7,6 +7,10 @@ <title>GCC-&gcc-version; - Pass 2 + +GCC +tools, pass 2 + <segmentedlist> @@ -15,25 +19,88 @@ <seglistitem><seg>11.0 SBU</seg><seg>274 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gcc.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> <title>Re-installation of GCC -Check if there is PTYs for the test suites: +This package is known to have issues when its default +optimization flags (including the -march and +-mcpu options) are changed. If any environment +variables that override default optimizations have been defined, such +as CFLAGS and CXXFLAGS, +unset them when building GCC. + +The tools required to test GCC and Binutils—Tcl, Expect +and DejaGNU—are installed now. GCC and Binutils can now be +rebuilt, linking them against the new Glibc and testing them properly +(if running the test suites in this chapter). Please note that these +test suites are highly dependent on properly functioning PTYs which +are provided by the host. PTYs are most commonly implemented via the +devpts file system. Check +to see if the host system is set up correctly in this regard by +performing a quick test: expect -c "spawn ls" -Apply two patches: +The response might be: + +The system has no more ptys. +Ask your system administrator to create more. + +If the above message is received, the host does not have its +PTYs set up properly. In this case, there is no point in running the +test suites for GCC and Binutils until this issue is resolved. Please +consult the LFS Wiki at for more +information on how to get PTYs working. + +Because the C and the C++ compilers will be built, unpack both +the core and the g++ tarballs (as well as test suite, if you want to +run the tests). By unpacking them in the working directory, they will +all unfold into a single gcc-&gcc-version;/ subdirectory. + +First correct a known problem and make an essential adjustment: patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes-1.patch patch -Np1 -i ../gcc-&gcc-version;-specs-2.patch +The first patch disables the GCC fixincludes +script. This was briefly mentioned earlier, but a more in-depth +explanation of the fixincludes process is warranted here. Under normal +circumstances, the GCC fixincludes script scans the +system for header files that need to be fixed. It might find that some +Glibc header files on the host system need to be fixed, and will fix +them and put them in the GCC private include directory. In , after the newer Glibc has been +installed, this private include directory will be searched before the +system include directory. This may result in GCC finding the fixed +headers from the host system, which most likely will not match the +Glibc version used for the LFS system. + +The second patch changes GCC's default location of the dynamic +linker (typically ld-linux.so.2). It also removes +/usr/include from GCC's include +search path. Patching now rather than adjusting the specs file after +installation ensures that the new dynamic linker is used during the +actual build of GCC. That is, all of the final (and temporary) +binaries created during the build will link against the new +Glibc. + +The above patches are critical in ensuring a +successful overall build. Do not forget to apply +them. + Create a separate build directory again: mkdir ../gcc-build cd ../gcc-build +Before starting to build GCC, remember to unset any environment +variables that override the default optimization flags. + Now prepare GCC for compilation: ../gcc-&gcc-version;/configure --prefix=/tools \ @@ -42,36 +109,105 @@ cd ../gcc-build --enable-threads=posix --enable-__cxa_atexit \ --enable-languages=c,c++ --disable-libstdcxx-pch +The meaning of the new configure options: + + + +--enable-clocale=gnu +This option ensures the correct locale model is +selected for the C++ libraries under all circumstances. If the +configure script finds the de_DE locale installed, it will select the +correct gnu locale model. However, if the de_DE locale is not +installed, there is the risk of building Application Binary Interface +(ABI)-incompatible C++ libraries because the incorrect generic locale +model may be selected. + + + +--enable-threads=posix +This enables C++ exception handling for multi-threaded +code. + + + +--enable-__cxa_atexit +This option allows use of +__cxa_atexit, rather than +atexit, to register C++ destructors for local +statics and global objects. This option is essential for fully +standards-compliant handling of destructors. It also effects the C++ +ABI, and therefore results in C++ shared libraries and C++ programs +that are interoperable with other Linux +distributions. + + + +--enable-languages=c,c++ +This option +ensures that both the C and C++ compilers are built. + + + +--disable-libstdcxx-pch +Do not build the pre-compiled header (PCH) for +libstdc++. It takes up a lot of space, +and we have no use for it. + + + Compile the package: make -Test the results +There is no need to use the bootstrap +target now because the compiler being used to compile this GCC was +built from the exact same version of the GCC sources used +earlier. + +Compilation is now complete. As previously mentioned, running +the test suites for the temporary tools compiled in this chapter is +not mandatory. To run the GCC test suite anyway, use the following +command: make -k check -To get a summary of the test suite results, run this: +The -k flag is used to make the test suite run +through to completion and not stop at the first failure. The GCC test +suite is very comprehensive and is almost guaranteed to generate a few +failures. To receive a summary of the test suite results, run: ../gcc-&gcc-version;/contrib/test_summary For only the summaries, pipe the output through -grep -A7 Summ +grep -A7 Summ. Results can be compared to those posted to the gcc-testresults -mailing list to see similar configurations to the one being built. For an example of how -current GCC-&gcc-version; should look on i686-pc-linux-gnu, see -. +mailing list to see similar configurations to the one being built. For +an example of how current GCC-&gcc-version; should look on +i686-pc-linux-gnu, see . -And finally install the package: +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: make install -At this point it is strongly recommended to repeat the sanity check -we performed earlier in this chapter. Refer back to - and repeat the little test compilation. If -the result is wrong, then most likely you forgot to apply the above mentioned -GCC Specs patch. +At this point it is strongly recommended to repeat the +sanity check we performed earlier in this chapter. Refer back to and repeat the test compilation. If +the result is wrong, the most likely reason is that the GCC Specs +patch was not properly applied. + +<para>Details on this package are located in <xref +linkend="contents-gcc" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/gettext.xml b/chapter05/gettext.xml index feb4c38ed..ceca963c1 100644 --- a/chapter05/gettext.xml +++ b/chapter05/gettext.xml @@ -7,7 +7,12 @@ <title>Gettext-&gettext-version; + +Gettext +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gettext.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.5 SBU</seg><seg>55 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gettext.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -25,17 +32,46 @@ <screen><userinput>./configure --prefix=/tools --disable-libasprintf \ --disable-csharp</userinput></screen> +<para>The meaning of the configure options:</para> + +<variablelist> +<varlistentry> +<term><parameter>--disable-libasprintf</parameter></term> +<listitem><para>This flag tells Gettext not to build the +<filename class="libraryfile">asprintf</filename> library. Because nothing in this +chapter or the next requires this library and Gettext gets rebuilt later, +exclude it to save time and space.</para></listitem> +</varlistentry> + +<varlistentry> +<term><parameter>--disable-csharp</parameter></term> +<listitem><para>This tells Gettext not to use a C# compiler, even if a +C# compiler is installed on the host. This needs to be done because +once we enter the chroot environment, C# will no longer be +available.</para></listitem> +</varlistentry> +</variablelist> + <para>Compile the package:</para> <screen><userinput>make</userinput></screen> -<para>To test the results, issue: -<userinput>make check</userinput></para> +<para>To test the results, issue: <userinput>make check</userinput>. +This takes quite some time, around 7 SBUs. The Gettext test suite is +known to experience failures under certain host conditions, for +example when it finds a Java compiler on the host. An experimental +patch to disable Java is available from the LFS Patches project at +<ulink url="&lfs-root;patches/"/>.</para> -<para>And install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref linkend="contents-gettext" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/glibc.xml b/chapter05/glibc.xml index dcb468a56..1e3d4925b 100644 --- a/chapter05/glibc.xml +++ b/chapter05/glibc.xml @@ -7,7 +7,12 @@ <title>Glibc-&glibc-version; + +Glibc +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/glibc.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,12 +20,26 @@ <seglistitem><seg>11.8 SBU</seg><seg>800 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/glibc.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> <title>Installation of Glibc -Create a build dir: +This package is known to have issues when its default +optimization flags (including the -march and +-mcpu options) are changed. If any environment +variables that override default optimizations have been defined, such +as CFLAGS and CXXFLAGS, +unset them when building Glibc. + +It should be noted that compiling Glibc in any way other than +the method suggested in this book puts the stability of the system at +risk. + +The Glibc documentation recommends building Glibc outside of the source +directory in a dedicated build directory: mkdir ../glibc-build cd ../glibc-build @@ -33,32 +52,153 @@ cd ../glibc-build --without-gd --without-cvs --with-headers=/tools/include \ --disable-selinux +The meaning of the configure options: + + + +--disable-profile +This builds the libraries without profiling +information. Omit this option if profiling on the temporary tools is +necessary. + + + +--enable-add-ons +This tells Glibc to use the NPTL add-on as its threading +library. + + + +--enable-kernel=2.6.0 +This tells Glibc to compile the library with support +for 2.6.x Linux kernels. + + + +--with-binutils=/tools/bin +While not required, this switch ensures that there are +no errors pertaining to which Binutils programs get used during the +Glibc build. + + + +--without-gd +This prevents the build of the +memusagestat program, which insists on linking +against the host's libraries (libgd, libpng, libz, +etc.). + + + +--without-cvs +This prevents the Makefile files from +attempting automatic CVS checkouts when using a CVS snapshot. While +this command is not required, it is recommended because it suppresses +an annoying, but harmless, warning about a missing autoconf +program. + + + +--with-headers=/tools/include +This tells Glibc to compile itself against the headers recently +installed to the tools directory, so that it knows exactly what features the +kernel has and can optimize itself accordingly. + + + + +--disable-selinux +When building from hosts using SELinux functionality +(i.e. Fedora Core 3), glibc will try to integrate this functionality into +itself, but will fail, because we do not have this functionality in the LFS +tools enviornment. This option will disable this, allowing glibc to build +correctly, but will not otherwise affect the build. + + + + +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, but it can sometimes cause issues when running the +test suite. This msgfmt program is part of the +Gettext package which the host distribution should provide. If +msgfmt is present but deemed incompatible, upgrade +the host system's Gettext package or continue without it and see if +the test suite runs without problems regardless. + Compile the package: make -Test the results: +Compilation is now complete. As mentioned earlier, running the +test suites for the temporary tools installed in this chapter is not +mandatory. To run the Glibc test suite (if desired), the following +command will do so: make check For a discussion of test failures that are of particular -importance, please see . +importance, please see + +In this chapter, some tests can be adversely effected by +existing tools or environmental issues on the host system. Glibc test +suite failures in this chapter are typically not worrisome. The Glibc +installed in is the one that +will ultimately end up being used, so that is the one that needs to pass +most tests (even in , some +failures could still occur, for example, with the math tests). + +When experiencing a failure, make a note of it, then continue by +reissuing the make check command. The test suite should pick up where it left +off and continue. This stop-start sequence can be circumvented by +issuing a make -k check command. If using this option, be sure to log the +output so that the log file can be examined for failures later. + +The install stage of Glibc will issue a harmless warning at the +end about the absence of /tools/etc/ld.so.conf. +Prevent this warning with: mkdir /tools/etc touch /tools/etc/ld.so.conf -Now install the package: +Install the package: make install -To install the Glibc locales, use the following +Different countries and cultures have varying conventions for +how to communicate. These conventions range from the format for +representing dates and times to more complex issues, such as the +language spoken. The internationalization of GNU +programs works by locale. + +If the test suites are not being run in this chapter (as +per the recommendation), there is no need to install the locales now. +The appropriate locales will be installed in the next +chapter. + +To install the Glibc locales anyway, use the following command: make localedata/install-locales -An alternative to running the previous command is to install only those -locales which you need or want. The following instructions, instead of the -install-locales target above, will install the minimum set of locales necessary +To save time, an alternative to running the +previous command (which generates and installs every locale Glibc is +aware of) is to install only those locales that are wanted and needed. +This can be achieved by using the localedef +command. Information on this command is located in the +INSTALL file in the Glibc source. However, there +are a number of locales that are essential in order for the tests of +future packages to pass, in particular, the +libstdc++ tests from GCC. The following +instructions, instead of the install-locales +target used above, will install the minimum set of locales necessary for the tests to run successfully: mkdir -p /tools/lib/locale @@ -76,4 +216,10 @@ localedef -i ja_JP -f EUC-JP ja_JP
+ +<para>Details on this package are located in <xref +linkend="contents-glibc" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/grep.xml b/chapter05/grep.xml index 7af37c4b6..6cc9ce553 100644 --- a/chapter05/grep.xml +++ b/chapter05/grep.xml @@ -7,7 +7,12 @@ <title>Grep-&grep-version; + +Grep +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/grep.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.1 SBU</seg><seg>5.8 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/grep.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -25,12 +32,32 @@ <screen><userinput>./configure --prefix=/tools \ --disable-perl-regexp --with-included-regex</userinput></screen> +<para>The meaning of the configure options:</para> + +<variablelist> +<varlistentry> +<term><parameter>--disable-perl-regexp</parameter></term> +<listitem><para>This makes sure that the <command>grep</command> +program does not get linked against a Perl Compatible Regular +Expression (PCRE) library that may be present on the host and would +not be available once we enter the chroot +environment.</para></listitem> +</varlistentry> + +<varlistentry> +<term><parameter>--with-included-regex</parameter></term> +<listitem><para>This ensures that Grep uses its internal regular +expression code. Without this switch, Grep will use the code from +Glibc, which is known to be buggy.</para></listitem> +</varlistentry> +</variablelist> + <para>Compile the package:</para> <screen><userinput>make</userinput></screen> -<para>To test the results, issue: -<userinput>make check</userinput></para> +<para>To test the results, issue: <userinput>make +check</userinput>.</para> <para>Install the package:</para> @@ -38,4 +65,10 @@ </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-grep" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/gzip.xml b/chapter05/gzip.xml index f8c86b663..3683d5ff9 100644 --- a/chapter05/gzip.xml +++ b/chapter05/gzip.xml @@ -7,7 +7,12 @@ <title>Gzip-&gzip-version; + +Gzip +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gzip.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.1 SBU</seg><seg>2.6 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/gzip.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -28,10 +35,18 @@ <screen><userinput>make</userinput></screen> -<para>And install it:</para> +<para>This package does not come with a test suite.</para> + +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-gzip" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/hostreqs.xml b/chapter05/hostreqs.xml index c4a216a24..310d450d1 100644 --- a/chapter05/hostreqs.xml +++ b/chapter05/hostreqs.xml @@ -7,6 +7,34 @@ <title>Host System Requirements -See testing. +The host must be running at least a 2.6.2 kernel compiled with +GCC-3.0 or higher. There are two main reasons for this high +requirement. First, the Native POSIX Threading Library (NPTL) +test suite will segfault if the host's kernel has not been compiled with +GCC-3.0 or a later version. Secondly, the 2.6.2 or later version of +the kernel is required for the use of Udev. Udev creates devices +dynamically by reading from the sysfs file system. However, support +for this filesystem has only recently been implemented in most of +the kernel drivers. We must be sure that all critical system devices +get created properly. + +In order to determine whether the host kernel meets the +requirements outlined above, run the following command: + +cat /proc/version + +This will produce output similar to: + +Linux version 2.6.2 (user@host) (gcc version 3.4.0) #1 + Tue Apr 20 21:22:18 GMT 2004 + +If the results of the above command state that the host kernel +was not compiled using a GCC-3.0 (or later) compiler, one will need to +be compiled. The host system will then need to be rebooted to use the +newly compiled kernel. Instructions for compiling the kernel and +configuring the boot loader (assuming the host uses GRUB) are located +in . + diff --git a/chapter05/introduction.xml b/chapter05/introduction.xml index e16f460a8..4438bd7a6 100644 --- a/chapter05/introduction.xml +++ b/chapter05/introduction.xml @@ -7,6 +7,61 @@ Introduction -See testing. +This chapter shows how to compile and install 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. + +The files compiled in this chapter will be installed under the +$LFS/tools directory to keep +them separate from the files installed in the next chapter and the +host production directories. Since the packages compiled here are +temporary, we do not want them to pollute the soon-to-be LFS +system. + +Before issuing the build instructions for a package, the package +should be unpacked as user lfs, and a +cd into the created directory should be performed. The build +instructions assume that the bash shell is in use. + +Several of the packages are patched before compilation, but only +when the patch is needed to circumvent a problem. A patch is often +needed in both this and the next 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. + +After installing each package, delete its source and build +directories, unless specifically instructed otherwise. Deleting the +sources saves space and prevents mis-configuration when the same +package is reinstalled later. Only three of the packages need to +retain the source and build directories in order for their contents to +be used by later commands. Pay special attention to these +reminders. + +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. + diff --git a/chapter05/linux-libc-headers.xml b/chapter05/linux-libc-headers.xml index 167dceb57..4370bef9f 100644 --- a/chapter05/linux-libc-headers.xml +++ b/chapter05/linux-libc-headers.xml @@ -7,7 +7,14 @@ Linux-Libc-Headers-&linux-libc-headers-version; + +Linux-Libc-Headers +tools, headers + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" + href="../chapter06/linux-libc-headers.xml" + xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,16 +22,38 @@ <seglistitem><seg>0.1 SBU</seg><seg>22 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" + href="../chapter06/linux-libc-headers.xml" + xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + + </sect2> <sect2 role="installation"> <title>Installation of Linux-Libc-Headers +For years it has been common practice to use raw kernel +headers (straight from a kernel tarball) in /usr/include, but over the +last few years, the kernel developers have taken a strong stance that +this should not be done. This gave birth to the Linux-Libc-Headers +Project, which was designed to maintain an Application Programming +Interface (API) stable version of the Linux headers. + Install the header files: cp -R include/asm-i386 /tools/include/asm cp -R include/linux /tools/include +If your architecture is not i386 (compatible), adjust the first command +accordingly. + + + + +<para>Details on this package are located in <xref +linkend="contents-linux-libc-headers" role="."/></para> </sect2> </sect1> + diff --git a/chapter05/m4.xml b/chapter05/m4.xml index bab2b6a18..c861f0593 100644 --- a/chapter05/m4.xml +++ b/chapter05/m4.xml @@ -3,11 +3,16 @@ <!ENTITY % general-entities SYSTEM "../general.ent"> %general-entities; ]> -<sect1 id="ch-tools-m4" xreflabel="M4" role="wrap"> +<sect1 id="ch-tools-m4" role="wrap"> <title>M4-&m4-version; + +M4 +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/m4.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.1 SBU</seg><seg>3.0 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/m4.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -28,13 +35,19 @@ <screen><userinput>make</userinput></screen> -<para>To test the results, issue: -<userinput>make check</userinput>.</para> +<para>To test the results, issue: <userinput>make +check</userinput>.</para> -<para>Now install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-m4" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/make.xml b/chapter05/make.xml index ea37ca105..d20b8ac0a 100644 --- a/chapter05/make.xml +++ b/chapter05/make.xml @@ -7,7 +7,12 @@ <title>Make-&make-version; + +Make +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/make.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.2 SBU</seg><seg>8.8 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/make.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -28,8 +35,8 @@ <screen><userinput>make</userinput></screen> -<para>To test the results, issue: -<userinput>make check</userinput></para> +<para>To test the results, issue: <userinput>make +check</userinput>.</para> <para>Install the package:</para> @@ -37,4 +44,10 @@ </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-make" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/ncurses.xml b/chapter05/ncurses.xml index 8227b03bb..72538b445 100644 --- a/chapter05/ncurses.xml +++ b/chapter05/ncurses.xml @@ -7,7 +7,12 @@ <title>Ncurses-&ncurses-version; + +Ncurses +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/ncurses.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.7 SBU</seg><seg>26 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/ncurses.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -25,14 +32,43 @@ <screen><userinput>./configure --prefix=/tools --with-shared \ --without-debug --without-ada --enable-overwrite</userinput></screen> +<para>The meaning of the configure options:</para> + +<variablelist> +<varlistentry> +<term><parameter>--without-ada</parameter></term> +<listitem><para>This tells Ncurses not to build its Ada bindings, even +if an Ada compiler is installed on the host. This needs to be done +because once we enter the chroot environment, Ada will no longer be +available.</para></listitem> +</varlistentry> + +<varlistentry> +<term><parameter>--enable-overwrite</parameter></term> +<listitem><para>This tells Ncurses to install its header files into +<filename class="directory">/tools/include</filename>, instead of +<filename class="directory">/tools/include/ncurses</filename>, to +ensure that other packages can find the Ncurses headers +successfully.</para></listitem> +</varlistentry> +</variablelist> + <para>Compile the package:</para> <screen><userinput>make</userinput></screen> +<para>This package does not come with a test suite.</para> + <para>Install the package:</para> <screen><userinput>make install</userinput></screen> </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-ncurses" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/patch.xml b/chapter05/patch.xml index 0f8c62cb5..ec5bc8888 100644 --- a/chapter05/patch.xml +++ b/chapter05/patch.xml @@ -7,7 +7,12 @@ <title>Patch-&patch-version; + +Patch +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/patch.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.1 SBU</seg><seg>1.9 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/patch.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -24,14 +31,26 @@ <screen><userinput>CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/tools</userinput></screen> +<para>The preprocessor flag <parameter>-D_GNU_SOURCE</parameter> is +only needed on the PowerPC platform. It can be left out on other +architectures.</para> + <para>Compile the package:</para> <screen><userinput>make</userinput></screen> +<para>This package does not come with a test suite.</para> + <para>Install the package:</para> <screen><userinput>make install</userinput></screen> </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-patch" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/perl.xml b/chapter05/perl.xml index d118bb56f..77d619441 100644 --- a/chapter05/perl.xml +++ b/chapter05/perl.xml @@ -7,7 +7,12 @@ <title>Perl-&perl-version; + +Perl +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/perl.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,24 +20,45 @@ <seglistitem><seg>0.8 SBU</seg><seg>74 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/perl.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> <title>Installation of Perl -First adapt some hard-wired paths to the C library: +First adapt some hard-wired paths to the C library by applying +the following patch: patch -Np1 -i ../perl-&perl-version;-libc-1.patch -Now prepare Perl for compilation: +Prepare Perl for compilation (make sure to get the 'IO Fcntl POSIX' +part of the command correct—they are all letters): ./configure.gnu --prefix=/tools -Dstatic_ext='IO Fcntl POSIX' +The meaning of the configure option: + + + +-Dstatic_ext='IO Fcntl POSIX' +This tells Perl to build the minimum set of static +extensions needed for installing and testing the Coreutils package in +the next chapter. + + + Compile only the required tools: make perl utilities -Then copy these tools and their libraries: +Although Perl comes with a test suite, it is not recommended to +run it at this point. Only part of Perl was built and running +make test now will cause the rest of Perl to be +built as well, which is unnecessary at this point. The test suite can +be run in the next chapter if desired. + +Copy these tools and their libraries: cp perl pod/pod2man /tools/bin mkdir -p /tools/lib/perl5/&perl-version; @@ -40,4 +66,10 @@ cp -R lib/* /tools/lib/perl5/&perl-version; + +<para>Details on this package are located in <xref +linkend="contents-perl" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/sed.xml b/chapter05/sed.xml index 271e01d4d..9bb1090e4 100644 --- a/chapter05/sed.xml +++ b/chapter05/sed.xml @@ -7,7 +7,12 @@ <title>Sed-&sed-version; + +Sed +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/sed.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.2 SBU</seg><seg>5.2 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/sed.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -28,8 +35,8 @@ <screen><userinput>make</userinput></screen> -<para>To test the results, issue: -<userinput>make check</userinput></para> +<para>To test the results, issue: <userinput>make +check</userinput>.</para> <para>Install the package:</para> @@ -37,4 +44,10 @@ </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-sed" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/stripping.xml b/chapter05/stripping.xml index 5e7d7a00a..dcafa39da 100644 --- a/chapter05/stripping.xml +++ b/chapter05/stripping.xml @@ -7,13 +7,32 @@ <title>Stripping -Strip the programs and libraries: +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 +130 MB of unneeded debugging symbols. Remove those symbols +with: strip --strip-debug /tools/lib/* strip --strip-unneeded /tools/{,s}bin/* -Remove the documentation: +The last of the above commands will skip some twenty files, +reporting that it does not recognize their file format. Most of these +are scripts instead of binaries. + +Take care not to use +--strip-unneeded on the libraries. The static +ones would be destroyed and the toolchain packages would need to be +built all over again. + +To save another 30 MB, remove the documentation: rm -rf /tools/{doc,info,man} +There will now be at least 850 MB of free space on the LFS file +system that can be used to build and install Glibc in the next phase. +If you can build and install Glibc, you can build and install the rest +too. + + diff --git a/chapter05/tar.xml b/chapter05/tar.xml index bd279bada..21e59b24c 100644 --- a/chapter05/tar.xml +++ b/chapter05/tar.xml @@ -7,7 +7,12 @@ Tar-&tar-version; + +Tar +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/tar.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.2 SBU</seg><seg>10 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/tar.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -28,8 +35,8 @@ <screen><userinput>make</userinput></screen> -<para>To test the results, issue: -<userinput>make check</userinput></para> +<para>To test the results, issue: <userinput>make +check</userinput>.</para> <para>Install the package:</para> @@ -37,4 +44,10 @@ </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-tar" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/tcl.xml b/chapter05/tcl.xml index 7f15832c2..69dcbdec3 100644 --- a/chapter05/tcl.xml +++ b/chapter05/tcl.xml @@ -3,13 +3,14 @@ <!ENTITY % general-entities SYSTEM "../general.ent"> %general-entities; ]> -<sect1 id="ch-tools-tcl" xreflabel="Tcl" role="wrap"> +<sect1 id="ch-tools-tcl" role="wrap"> <title>Tcl-&tcl-version; Tcl +<para>The Tcl package contains the Tool Command Language.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,11 +18,26 @@ <seglistitem><seg>0.9 SBU</seg><seg>23 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Tcl installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, and Sed</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. +Installing three packages for testing purposes may seem excessive, but +it is very reassuring, if not essential, to know that the most +important tools are working properly. Even if the test suites are not +run in this chapter (they are not mandatory), these packages +are required to run the test suites in . + Prepare Tcl for compilation: cd unix @@ -31,14 +47,22 @@ make -To test the results, issue: -TZ=UTC make test. +To test the results, issue: TZ=UTC make +test. The Tcl test suite is known to experience failures +under certain host conditions that are not fully understood. +Therefore, test suite failures here are not surprising, and are not +considered critical. The TZ=UTC parameter sets +the time zone to Coordinated Universal Time (UTC), also known as +Greenwich Mean Time (GMT), but only for the duration of the test suite +run. This ensures that the clock tests are exercised correctly. +Details on the TZ environment variable is provided in +. Install the package: make install -Do not remove the +Do not remove the tcl&tcl-version; source directory yet, as the next package will need its internal headers. @@ -50,8 +74,41 @@ will need its internal headers. Contents of Tcl -See testing + +Installed programs +Installed library +tclsh (link to tclsh8.4) and tclsh8.4libtcl8.4.so + + +Short Descriptions + + + +tclsh8.4 + +The Tcl command shell +tclsh8.4 + + + + +tclsh + +A link to tclsh8.4 +tclsh + + + + +libtcl8.4.so + +The Tcl library +libtcl8.4.so + + + + diff --git a/chapter05/texinfo.xml b/chapter05/texinfo.xml index dce70c00b..3a7ddf4c6 100644 --- a/chapter05/texinfo.xml +++ b/chapter05/texinfo.xml @@ -7,7 +7,12 @@ Texinfo-&texinfo-version; + +Texinfo +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/texinfo.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,6 +20,8 @@ <seglistitem><seg>0.2 SBU</seg><seg>16 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/texinfo.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> @@ -28,8 +35,8 @@ <screen><userinput>make</userinput></screen> -<para>To test the results, issue: -<userinput>make check</userinput></para> +<para>To test the results, issue: <userinput>make +check</userinput>.</para> <para>Install the package:</para> @@ -37,4 +44,10 @@ </sect2> +<sect2 role="content"><title/> +<para>Details on this package are located in <xref +linkend="contents-texinfo" role="."/></para> +</sect2> + </sect1> + diff --git a/chapter05/toolchaintechnotes.xml b/chapter05/toolchaintechnotes.xml index afc621085..9c2951387 100644 --- a/chapter05/toolchaintechnotes.xml +++ b/chapter05/toolchaintechnotes.xml @@ -7,6 +7,218 @@ <title>Toolchain Technical Notes -See testing +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 back to at any time during the process. + +The overall goal of is +to provide a temporary environment that can be chrooted into and from +which can be produced a clean, trouble-free build of the target LFS +system in . Along the way, we +separate from the host system as much as possible, and in doing so, +build a self-contained and self-hosted toolchain. It should be noted +that the build process has been designed to minimize the risks for new +readers and provide maximum educational value at the same time. In +other words, more advanced techniques could be used to build the +system. + + +Before continuing, be aware of the name of the working platform, +often referred to as the target triplet. Many times, the target +triplet will probably be i686-pc-linux-gnu. A +simple way to determine the name of the target triplet is to run the +config.guess script that comes with the source for +many packages. Unpack the Binutils sources and run the script: +./config.guess and note the output. + +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 will usually be +ld-linux.so.2. On platforms that are less +prevalent, the name might be ld.so.1, +and newer 64 bit platforms might be named something else entirely. The name of +the platform's dynamic linker can be determined by looking in the +/lib directory on the host +system. A sure-fire way to determine the name is to inspect a random +binary from the host system by running: readelf -l <name +of binary> | grep interpreter and noting the output. +The authoritative reference covering all platforms is in the +shlib-versions file in the root of the Glibc +source tree. + + +Some key technical points of how the build +method works: + + +The process is similar in principle to +cross-compiling, whereby tools installed in the same prefix work in +cooperation, and thus utilize a little GNU +magic + +Careful manipulation of the standard linker's library +search path ensures programs are linked only against chosen +libraries + +Careful manipulation of gcc's +specs file tell the compiler which target dynamic +linker will be used + + +Binutils is installed first because the +./configure runs of both GCC and Glibc perform +various feature tests on the assembler and linker to determine which +software features to enable or disable. This is more important than +one might first realize. An incorrectly configured GCC or Glibc can +result in a subtly broken toolchain, where the impact of such breakage +might not show up until near the end of the build of an entire +distribution. A test suite failure will usually alert this error +before too much additional work is performed. + +Binutils installs its assembler and linker in two locations, +/tools/bin and /tools/$TARGET_TRIPLET/bin. The tools in +one location are hard linked to the other. An important facet of the +linker is its library search order. Detailed information can be +obtained from ld by passing it the +--verbose flag. For example, an ld +--verbose | grep SEARCH will illustrate the current search +paths and their order. It shows which files are linked by +ld by compiling a dummy program and passing the +--verbose switch to the linker. For example, +gcc dummy.c -Wl,--verbose 2>&1 | grep +succeeded will show all the files successfully opened +during the linking. + +The next package installed is GCC. An example of what can be +seen during its run of ./configure is: + +checking what assembler to use... + /tools/i686-pc-linux-gnu/bin/as +checking what linker to use... /tools/i686-pc-linux-gnu/bin/ld + +This is important for the reasons mentioned above. It also +demonstrates that GCC's configure script does not search the PATH +directories to find which tools to use. However, during the actual +operation of gcc itself, the same +search paths are not necessarily used. To find out which standard +linker gcc will use, run: gcc +-print-prog-name=ld. + +Detailed information can be obtained from gcc +by passing it the -v command line option while +compiling a dummy program. For example, gcc -v +dummy.c will show detailed information about the +preprocessor, compilation, and assembly stages, including +gcc's included search paths and their order. + +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 gcc found in a +PATH directory. +The binary tools and kernel headers can be a bit more complicated. +Therefore, take no risks and use the available configure switches to +enforce the correct selections. After the run of +./configure, check the contents of the +config.make file in the glibc-build directory for all important +details. Note the use of CC="gcc -B/tools/bin/" +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. + +After the Glibc installation, make some adjustments to ensure +that searching and linking take place only within the /tools prefix. Install an adjusted +ld, which has a hard-wired search path limited to +/tools/lib. Then amend +gcc's specs file to point to the new dynamic linker +in /tools/lib. This last step +is vital to the whole process. As mentioned above, a hard-wired path +to a dynamic linker is embedded into every Executable and Link Format +(ELF)-shared executable. This can be inspected by running: +readelf -l <name of binary> | grep +interpreter. Amending gcc's specs file +ensures that every program compiled from here through the end of this +chapter will use the new dynamic linker in /tools/lib. + +The need to use the new dynamic linker is also the reason why +the Specs patch is applied for the second pass of GCC. Failure to do +so will result in the GCC programs themselves having the name of the +dynamic linker from the host system's /lib directory embedded into them, which +would defeat the goal of getting away from the host. + +During the second pass of Binutils, we are able to utilize the +--with-lib-path configure switch to control +ld's library search path. From this point onwards, +the core toolchain is self-contained and self-hosted. The remainder of +the packages all build +against the new Glibc in /tools. + +Upon entering the chroot environment in , the first major package to be +installed is Glibc, due to its self-sufficient nature mentioned above. +Once this Glibc is installed into /usr, perform a quick changeover of the +toolchain defaults, then proceed in building the rest of the target +LFS system. + + +Notes on Static Linking + +Besides their specific task, most programs have to perform many +common and sometimes trivial operations. These include allocating +memory, searching directories, reading and writing files, string +handling, pattern matching, arithmetic, and other tasks. Instead of +obliging each program to reinvent the wheel, the GNU system provides +all these basic functions in ready-made libraries. The major library +on any Linux system is Glibc. + +There are two primary ways of linking the functions from a +library to a program that uses them—statically or dynamically. When +a program is linked statically, the code of the used functions is +included in the executable, resulting in a rather bulky program. When +a program is dynamically linked, it includes a reference to the +dynamic linker, the name of the library, and the name of the function, +resulting in a much smaller executable. A third option is to use the +programming interface of the dynamic linker (see the +dlopen man page for more information). + +Dynamic linking is the default on Linux and has three major +advantages over static linking. First, only one copy of the executable +library code is needed on the hard disk, instead of having multiple +copies of the same code included in several programs, thus saving +disk space. Second, when several programs use the same library +function at the same time, only one copy of the function's code is +required in core, thus saving memory space. Third, when a library +function gets a bug fixed or is otherwise improved, only the one +library needs to be recompiled instead of recompiling all programs +that make use of the improved function. + +If dynamic linking has several advantages, why then do we +statically link the first two packages in this chapter? The reasons +are threefold—historical, educational, and technical. The +historical reason is that earlier versions of LFS statically linked +every program in this chapter. Educationally, knowing the difference +between static and dynamic linking is useful. The technical benefit is +a gained element of independence from the host, meaning that those +programs can be used independently of the host system. However, it is +worth noting that an overall successful LFS build can still be +achieved when the first two packages are built dynamically. + + + diff --git a/chapter05/udev.xml b/chapter05/udev.xml deleted file mode 100644 index 0809dfd53..000000000 --- a/chapter05/udev.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - %general-entities; -]> - -Udev-&udev-version; - - - - -<segmentedlist> -<segtitle>&buildtime;</segtitle> -<segtitle>&diskspace;</segtitle> -<seglistitem><seg>0.2 SBU</seg><seg>5.2 MB</seg></seglistitem> -</segmentedlist> - -</sect2> - -<sect2 role="installation"> -<title>Installation of Udev - -The following patch makes Udev respect the DESTDIR variable: - -patch -Np1 -i ../udev-&udev-version;-DESTDIR-1.patch - -Now compile Udev: - -make prefix=/tools udevdir=/dev - -Install the package: - -make DESTDIR=/tools udevdir=/dev install - -cp ../udev-config-2.permissions /tools/etc/udev/permissions.d/00-lfs.permissions -cp ../udev-config-1.rules /tools/etc/udev/rules.d/00-lfs.rules - - - - diff --git a/chapter05/util-linux.xml b/chapter05/util-linux.xml index 4349f326f..1c0ae3c19 100644 --- a/chapter05/util-linux.xml +++ b/chapter05/util-linux.xml @@ -7,7 +7,12 @@ Util-linux-&util-linux-version; + +Util-linux +tools + +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/util-linux.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -15,12 +20,16 @@ <seglistitem><seg>0.2 SBU</seg><seg>16 MB</seg></seglistitem> </segmentedlist> +<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../chapter06/util-linux.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/> + </sect2> <sect2 role="installation"> <title>Installation of Util-linux -Issue a sed sustitution: +Util-linux does not use the freshly installed headers and +libraries from the /tools +directory. This is fixed by altering the configure script: sed -i 's@/usr/include@/tools/include@g' configure @@ -32,14 +41,23 @@ make -C lib -Build the needed utilities: +Since only a couple of the utilities contained in this package +are needed, build only those: make -C mount mount umount make -C text-utils more -Now copy these programs to the temporary tools directory: +This package does not come with a test suite. + +Copy these programs to the temporary tools directory: cp mount/{,u}mount text-utils/more /tools/bin + + + +<para>Details on this package are located in <xref +linkend="contents-utillinux" role="."/></para> </sect2> </sect1> + diff --git a/chapter06/aboutdebug.xml b/chapter06/aboutdebug.xml index f0ac8956f..7ef47d71c 100644 --- a/chapter06/aboutdebug.xml +++ b/chapter06/aboutdebug.xml @@ -7,6 +7,45 @@ <title>About Debugging Symbols -See testing +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. Additional information on system +optimization can be found at &hints-root; optimization.txt. + diff --git a/chapter06/autoconf.xml b/chapter06/autoconf.xml index ad766f602..790d1408b 100644 --- a/chapter06/autoconf.xml +++ b/chapter06/autoconf.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + 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> @@ -17,6 +19,11 @@ <seglistitem><seg>0.5 SBU</seg><seg>7.7 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Autoconf installation depends on</segtitle> +<seglistitem><seg>Bash, Coreutils, Diffutils, Grep, +M4, Make, Perl, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -31,7 +38,7 @@ <screen><userinput>make</userinput></screen> <para>To test the results, issue: -<userinput>make check</userinput></para> +<userinput>make check</userinput>. This takes a long time, about 2 SBUs.</para> <para>Install the package:</para> @@ -39,11 +46,97 @@ </sect2> - <sect2 id="contents-autoconf" role="content"><title>Contents of Autoconf -See testing + +Installed programs +autoconf, autoheader, autom4te, +autoreconf, autoscan, autoupdate, and ifnames + + +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 index ae50cd74b..ebf4ad482 100644 --- a/chapter06/automake.xml +++ b/chapter06/automake.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + Automake-&automake-version; Automake +<para>The Automake package contains programs for generating Makefiles for use +with Autoconf.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +19,11 @@ <seglistitem><seg>0.2 SBU</seg><seg>6.8 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Automake installation depends on</segtitle> +<seglistitem><seg>Autoconf, Bash, Coreutils, +Diffutils, Grep, M4, Make, Perl, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -31,7 +38,7 @@ <screen><userinput>make</userinput></screen> <para>To test the results, issue: -<userinput>make check</userinput></para> +<userinput>make check</userinput>. This takes a long time, about 5 SBUs.</para> <para>Install the package:</para> @@ -42,8 +49,168 @@ <sect2 id="contents-automake" role="content"><title>Contents of Automake -See testing + +Installed programs +acinstall, aclocal, aclocal-&automake-version;, +automake, automake-&automake-version;, +compile, config.guess, config.sub, depcomp, elisp-comp, install-sh, mdate-sh, +missing, mkinstalldirs, py-compile, symlink-tree, and ylwrap + + +Short Descriptions + + + +acinstall + +A script that installs aclocal-style M4 files +acinstall + + + + +aclocal + +Generates aclocal.m4 +files based on the contents of configure.in files +aclocal + + + + +aclocal-&automake-version; + +A hard link to aclocal +aclocal-&automake-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 generate the +corresponding Makefile.in file +automake + + + + +automake-&automake-version; + +A hard link to automake +automake-&automake-version; + + + + +compile + +A wrapper for compilers +compile + + + + +config.guess + +A script that attempts to guess +the canonical triplet for the given build, host, or target architecture +config.guess + + + + +config.sub + +A configuration validation subroutine script +config.sub + + + + +depcomp + +A script for compiling a program so that dependency information +is generated in addition to the desired output +depcomp + + + + +elisp-comp + +Byte-compiles Emacs Lisp code +elisp-comp + + + + +install-sh + +A script that installs a program, script, or data file +install-sh + + + + +mdate-sh + +A script that prints the modification time of a file or directory +mdate-sh + + + + +missing + +A script acting as a common stub for missing GNU programs during +an installation +missing + + + + +mkinstalldirs + +A script that creates a directory tree +mkinstalldirs + + + + +py-compile + +Compiles a Python program +py-compile + + + + +symlink-tree + +A script to create a symlink tree of a directory tree +symlink-tree + + + + +ylwrap + +A wrapper for lex and yacc +ylwrap + + + + diff --git a/chapter06/bash.xml b/chapter06/bash.xml index 8803aad6a..b7c459f1e 100644 --- a/chapter06/bash.xml +++ b/chapter06/bash.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Bash-&bash-version; Bash +<para>The Bash package contains the Bourne-Again SHell.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,16 +18,24 @@ <seglistitem><seg>1.2 SBU</seg><seg>27 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Bash installation depends on</segtitle> +<seglistitem><seg>Binutils, Coreutils, Diffutils, Gawk, +GCC, Glibc, Grep, Make, Ncurses, and Sed.</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Bash -Apply a patch: + +The following patch fixes various issues, including a problem where Bash +will sometimes only show 33 characters on a line, then wrap to the next: patch -Np1 -i ../bash-&bash-version;-fixes-1.patch -Apply another patch: +Bash also has issues when compiled against newer versions of Glibc. The +following patch resolves this problem: patch -Np1 -i ../bash-&bash-version;-avoid_WCONTINUED-1.patch @@ -35,6 +44,17 @@ ./configure --prefix=/usr --bindir=/bin \ --without-bash-malloc --with-installed-readline +The meaning of the configure option: + + + +--with-installed-readline +This options 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 @@ -46,17 +66,60 @@ make install -Run the newly compiled bash program: +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 -See testing + +Installed programs +bash, bashbug, and sh (link to bash) + + +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 bug reports +concerning bash in a standard format +bashbug + + + + +sh + +A symlink to the bash program; when invoked +as sh, bash tries to mimic the +startup behavior of historical versions of sh as +closely as possible, while conforming to the POSIX standard as well +sh + + + + diff --git a/chapter06/binutils.xml b/chapter06/binutils.xml index f749f0864..c3032612a 100644 --- a/chapter06/binutils.xml +++ b/chapter06/binutils.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + 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> @@ -17,21 +19,45 @@ <seglistitem><seg>1.4 SBU</seg><seg>167 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Binutils installation depends on</segtitle> +<seglistitem><seg>Bash, Bison, Coreutils, Diffutils, Flex, GCC, Gettext, +Glibc, Grep, M4, Make, Perl, Sed, and Texinfo</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Binutils -Check if there is PTYs for the test suites: +This package is known to have issues when its default +optimization flags (including the -march and +-mcpu options) are changed. If any environment +variables that override default optimizations have been defined, such +as CFLAGS and CXXFLAGS, +unset them when building Binutils. + +Verify that the PTYs are working properly inside the chroot +environment. Check that everything is set up correctly by performing a +simple test: expect -c "spawn ls" -Create the build directory: +If the following message shows up, the chroot environment is not +set up for proper PTY operation: + +The system has no more ptys. +Ask your system administrator to create more. + +This issue needs to be resolved before running the test suites +for Binutils and GCC. + +The Binutils documentation recommends building Binutils outside of the +source directory in a dedicated build directory: mkdir ../binutils-build cd ../binutils-build -Now prepare Binutils for compilation: +Prepare Binutils for compilation: ../binutils-&binutils-version;/configure --prefix=/usr \ --enable-shared @@ -40,19 +66,33 @@ cd ../binutils-build make tooldir=/usr +Normally, the tooldir (the directory where the executables will +ultimately be located) is set to $(exec_prefix)/$(target_alias), which +expands into /usr/i686-pc-linux-gnu/usr/i686-pc- +linux-gnu. Because this is a custom system, this +target-specific directory in /usr is not required. This setup 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 - -The test suite notes from are still -very much appropriate here.. +make check Install the package: make tooldir=/usr install -Install the libiberty header file: +Install the libiberty header file that is needed by +some packages: cp ../binutils-&binutils-version;/include/libiberty.h /usr/include @@ -61,8 +101,176 @@ very much appropriate here.. Contents of Binutils -See testing + +Installed programs +Installed libraries +addr2line, ar, as, c++filt, gprof, ld, nm, objcopy, objdump, +ranlib, readelf, size, strings, and strip +libiberty.a, libbfd.[a,so], and libopcodes.[a,so] + + +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 + + + + +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 + + + + +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 + + + + +libiberty + +Contains routines used by various GNU programs, including +getopt, obstack, +strerror, strtol, and +strtoul +libiberty + + + + +libbfd + +The Binary File Descriptor library +libbfd + + + + +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 ad2b668bc..8626349bf 100644 --- a/chapter06/bison.xml +++ b/chapter06/bison.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Bison-&bison-version; Bison +<para>The Bison package contains a parser generator.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,11 @@ <seglistitem><seg>0.6 SBU</seg><seg>10.6 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Bison installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Gettext, Glibc, Grep, M4, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -33,17 +39,57 @@ <para>To test the results, issue: <userinput>make check</userinput>.</para> -<para>Now install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> </sect2> - <sect2 id="contents-bison" role="content"><title>Contents of Bison -See testing + +Installed programs +Installed library +bison and yaccliby.a + + +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.a + +the Yacc library containing implementations of Yacc-compatible +yyerror and main functions; +this library is normally not very useful, but POSIX requires +it +liby.a + + + + diff --git a/chapter06/bzip2.xml b/chapter06/bzip2.xml index 2751da0dd..24f83aab9 100644 --- a/chapter06/bzip2.xml +++ b/chapter06/bzip2.xml @@ -3,13 +3,16 @@ %general-entities; ]> - + Bzip2-&bzip2-version; Bzip2 +<para>The Bzip2 package contains programs for compressing and decompressing +files. Text files yield a much better compression than with the +traditional <command>gzip</command>.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +20,11 @@ <seglistitem><seg>0.1 SBU</seg><seg>3.0 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Bzip2 installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, and Make</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -27,15 +35,27 @@ <screen><userinput>make -f Makefile-libbz2_so make clean</userinput></screen> +<para>The <parameter>-f</parameter> flag will cause Bzip2 to be built +using a different <filename>Makefile</filename> file, in this case the +<filename>Makefile-libbz2_so</filename> file, which creates a dynamic +<filename class="libraryfile">libbz2.so</filename> library and links the Bzip2 +utilities against it.</para> + <para>Compile the package:</para> <screen><userinput>make</userinput></screen> -<para>Install the package:</para> +<para>If reinstalling Bzip2, perform +<userinput>rm -f /usr/bin/bz*</userinput> first, otherwise the following +<command>make install</command> will fail.</para> + +<para>Install the programs:</para> <screen><userinput>make install</userinput></screen> -<para>Do some location changes:</para> +<para>Install the shared <command>bzip2</command> binary into the +<filename class="directory">/bin</filename> directory, make +some necessary symbolic links, and clean up:</para> <screen><userinput>cp bzip2-shared /bin/bzip2 cp -a libbz2.so* /lib @@ -49,8 +69,120 @@ ln -s bzip2 /bin/bzcat</userinput></screen> <sect2 id="contents-bzip2" role="content"><title>Contents of Bzip2 -See testing + +Installed programs +Installed libraries +bunzip2 (link to bzip2), bzcat (link to bzip2), bzcmp, bzdiff, +bzegrep, bzfgrep, bzgrep, bzip2, bzip2recover, bzless, and bzmore +libbz2.a, libbz2.so (link to libbz2.so.1.0), libbz2.so.1.0 (link to +libbz2.so.&bzip2-version;), and libbz2.so.&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 + + + + +bzgrep + +Runs grep on bzipped files +bzgrep + + + + +bzegrep + +Runs egrep on bzipped files +bzegrep + + + + +bzfgrep + +Runs fgrep on bzipped files +bzfgrep + + + + +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/chapter06/changingowner.xml b/chapter06/changingowner.xml index 9d53404f6..a22e199c5 100644 --- a/chapter06/changingowner.xml +++ b/chapter06/changingowner.xml @@ -7,8 +7,34 @@ Changing Ownership -Change the owner of /tools: +Currently, the /tools +directory is owned by the user lfs, a user that +exists only on the host system. Although the /tools directory can be deleted once the +LFS system has been finished, it can be retained to build additional +LFS systems. If the /tools +directory is kept as is, the files are owned by a user ID without a +corresponding account. This is dangerous because a user account +created later could get this same user ID and would own the /tools directory and all the files +therein, thus exposing these files to possible malicious +manipulation. + +To avoid this issue, 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. Alternatively, assign +the contents of the /tools +directory to user root by running the following +command: chown -R 0:0 /tools +The command uses 0:0 instead of +root:root, because chown +is unable to resolve the name root until the password +file has been created. This book assumes you ran this +chown command. + + diff --git a/chapter06/chroot.xml b/chapter06/chroot.xml index 9ef1cca3e..c9afcdc13 100644 --- a/chapter06/chroot.xml +++ b/chapter06/chroot.xml @@ -7,11 +7,55 @@ Entering the Chroot Environment -Enter the chroot environment: +It is time to enter the chroot environment to begin +building and installing the final LFS 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" /tools/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ /tools/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 +comes last in the PATH. This means that a +temporary tool will not be used anymore as soon as 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. + +It is important that all the commands throughout the remainder +of this chapter and the following chapters be run from within the +chroot environment. If you leave this environment for any reason +(rebooting for example), remember to first mount the proc and devpts file systems (discussed in the +previous section) and enter chroot again before continuing with the +installations. + +Note that the bash prompt will say I have no +name! This is normal because the +/etc/passwd file has not been created yet. + + diff --git a/chapter06/coreutils.xml b/chapter06/coreutils.xml index d4c93c84b..6df281e33 100644 --- a/chapter06/coreutils.xml +++ b/chapter06/coreutils.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + Coreutils-&coreutils-version; Coreutils +<para>The Coreutils package contains utilities for showing and setting the +basic system characteristics.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,16 +19,25 @@ <seglistitem><seg>0.9 SBU</seg><seg>69 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Coreutils installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, GCC, +Gettext, Glibc, Grep, Make, Perl, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Coreutils -Apply a patch: +A known issue with the uname program from +this package is that the -p switch always +returns unknown. The following patch +fixes this behavior for Intel architectures: patch -Np1 -i ../coreutils-&coreutils-version;-uname-2.patch -Apply another patch: +Prevent Coreutils from installing binaries that will be later be +installed by other packages: patch -Np1 -i \ ../coreutils-&coreutils-version;-suppress_uptime_kill_su-1.patch @@ -39,21 +50,30 @@ make +The test suite of Coreutils makes several assumptions about the +presence of files and users that are not valid this early in the LFS +build. Therefore, additional items need to be set up before running +the tests. Skip down to Install the package if +not running the test suite. + Create two dummy groups and a dummy user name: echo "dummy1:x:1000:" >> /etc/group echo "dummy2:x:1001:dummy" >> /etc/group echo "dummy:x:1000:1000:::/bin/bash" >> /etc/passwd -Run the root tests: +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=dummy check-root -Run the user tests: +Then run the remainder of the tests as the +dummy user: src/su dummy -c "make RUN_EXPENSIVE_TESTS=yes check" -Remove the dummy user and groups: +When testing is complete, remove the dummy user and +groups: sed -i '/dummy/d' /etc/passwd /etc/group @@ -61,7 +81,7 @@ echo "dummy:x:1000:1000:::/bin/bash" >> /etc/passwd make install -And move some programs to their proper locations: +Move programs to the proper locations: mv /usr/bin/{[,basename,cat,chgrp,chmod,chown,cp,dd,df} /bin mv /usr/bin/{date,echo,false,head,hostname,install,ln} /bin @@ -69,7 +89,7 @@ mv /usr/bin/{ls,mkdir,mknod,mv,pwd,rm,rmdir,sync} /bin mv /usr/bin/{sleep,stty,test,touch,true,uname} /bin mv /usr/bin/chroot /usr/sbin -Create a symlink: +Finally, create a symlink to be FHS-compliant: ln -s ../../bin/install /usr/bin @@ -78,8 +98,755 @@ mv /usr/bin/chroot /usr/sbin Contents of Coreutils -See testing + +Installed programs +basename, cat, 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, hostname, id, install, join, link, ln, logname, ls, md5sum, +mkdir, mkfifo, mknod, mv, nice, nl, nohup, od, paste, pathchk, pinky, +pr, printenv, printf, ptx, pwd, readlink, rm, rmdir, seq, sha1sum, +shred, sleep, sort, split, stat, stty, sum, sync, tac, tail, tee, +test, touch, tr, true, tsort, tty, uname, unexpand, uniq, unlink, +users, vdir, wc, who, whoami, and yes + + +Short Descriptions + + + +basename + +Strips any path and a given suffix from a file name +basename + + + + +cat + +Concatenates files to standard output +cat + + + + +chgrp + +Changes the group ownership of each given file to the given +group; the group can either be either given a name or a numeric +ID +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 +each given file to the given user/group pair +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 + + + + +hostname + +Reports or sets the name of the host +hostname + + + + +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 + + + + +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 + + + + +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 + + + + +rm + +Removes files or directories +rm + + + + +rmdir + +Removes directories if they are empty +rmdir + + + + +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 + + + + +shred + +Overwrites the given files repeatedly with complex patterns, +making it difficult to recover the data +shred + + + + +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 + + + + +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 + + + + +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 + + + + +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 +unexpand + + + + +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 + + + + diff --git a/chapter06/createfiles.xml b/chapter06/createfiles.xml index de27a6c76..7e5ddc97a 100644 --- a/chapter06/createfiles.xml +++ b/chapter06/createfiles.xml @@ -7,7 +7,10 @@ Creating Essential Symlinks -Create some needed links. +Some programs hard-wire paths to programs which do not yet +exist. In order to satisfy these programs, create a number of symbolic +links which will be replaced by real files throughout the course of +this chapter after the software has been installed. ln -s /tools/bin/{bash,cat,pwd,stty} /bin ln -s /tools/bin/perl /usr/bin @@ -15,3 +18,4 @@ ln -s /tools/lib/libgcc_s.so{,.1} /usr/lib ln -s bash /bin/sh + diff --git a/chapter06/creatingdirs.xml b/chapter06/creatingdirs.xml index b989b7879..e7881c982 100644 --- a/chapter06/creatingdirs.xml +++ b/chapter06/creatingdirs.xml @@ -7,7 +7,9 @@ Creating Directories -Create a dirs tree: +It is time to create some structure in the LFS file system. +Create a directory tree. Issuing the following commands will create a +standard tree: install -d /{bin,boot,dev,etc/opt,home,lib,mnt} install -d /{sbin,srv,usr/local,var,opt} @@ -29,4 +31,37 @@ install -d /var/{opt,cache,lib/{misc,locate},local} install -d /opt/{bin,doc,include,info} install -d /opt/{lib,man/man{1,2,3,4,5,6,7,8}} +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 +other users' 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) standard (available at ). Besides the tree created above, +this standard stipulates the existence of /usr/local/games and /usr/share/games. We do not recommend +these for a base system, however, feel free to make the system +FHS-compliant. The FHS is not precise as to the structure of the +/usr/local/share subdirectory, +so we created only the directories that are needed. + + + + diff --git a/chapter06/devices.xml b/chapter06/devices.xml index 4663f4caf..e46cf8ba5 100644 --- a/chapter06/devices.xml +++ b/chapter06/devices.xml @@ -3,20 +3,42 @@ %general-entities; ]> - + Populating /dev -Create the initial device nodes +/dev/* + + +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. Create these by +running the following commands: mknod -m 600 /dev/console c 5 1 mknod -m 666 /dev/null c 1 3 + -Mount a ramfs in /dev + +Mounting ramfs and Populating /dev + +The ideal way to populate /dev is to mount a ramfs onto /dev, like tmpfs, and create the devices on there +during each bootup. Since the system has not been booted, it is +necessary to do what the bootscripts would otherwise do and populate +/dev. Begin by mounting +/dev: mount -n -t ramfs none /dev -Create a minimal set of device nodes: + +Since the Udev package will not be installed until later on in the +process, create a minimal set of device nodes used for building: mknod -m 622 /dev/console c 5 1 mknod -m 666 /dev/null c 1 3 @@ -26,8 +48,10 @@ mknod -m 666 /dev/tty c 5 0 mknod -m 444 /dev/random c 1 8 mknod -m 444 /dev/urandom c 1 9 chown root:tty /dev/{console,ptmx,tty} + -Create some symlinks and directories: +There are some symlinks and directories required by LFS that are +not created by Udev, so create those here: ln -s /proc/self/fd /dev/fd ln -s /proc/self/fd/0 /dev/stdin @@ -37,10 +61,21 @@ ln -s /proc/kcore /dev/core mkdir /dev/pts mkdir /dev/shm -Mount the virtual file systems: +Finally, mount the proper virtual (kernel) file systems on the +newly-created directories: mount -t devpts -o gid=4,mode=620 none /dev/pts mount -t tmpfs none /dev/shm +The mount commands executed above may result +in the following warning message: + +can't open /etc/fstab: No such file or directory. + +This file—/etc/fstab—has not +been created yet but is also not required for the file systems to be +properly mounted. As such, the warning can be safely ignored. + + diff --git a/chapter06/diffutils.xml b/chapter06/diffutils.xml index dfe1e4d2d..3649469f2 100644 --- a/chapter06/diffutils.xml +++ b/chapter06/diffutils.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + Diffutils-&diffutils-version; Diffutils +<para>The Diffutils package contains programs that show the differences +between files or directories.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +19,11 @@ <seglistitem><seg>0.1 SBU</seg><seg>7.5 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Diffutils installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, GCC, +Gettext, Glibc, Grep, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -30,7 +37,9 @@ <screen><userinput>make</userinput></screen> -<para>Install it:</para> +<para>This package does not come with a test suite.</para> + +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -39,8 +48,48 @@ <sect2 id="contents-diffutils" role="content"><title>Contents of Diffutils -See testing + +Installed programs +cmp, diff, diff3, and sdiff + + +Short Descriptions + + + +cmp + +Compares two files and reports whether or in which bytes they differ +cmp + + + + +diff + +Compares two files or directories and reports which lines in the files differ +diff + + + + +diff3 + +Compares three files line by line +diff3 + + + + +sdiff + +Merges two files and interactively outputs the results +sdiff + + + + diff --git a/chapter06/e2fsprogs.xml b/chapter06/e2fsprogs.xml index 2a134265c..b3e5ecc30 100644 --- a/chapter06/e2fsprogs.xml +++ b/chapter06/e2fsprogs.xml @@ -3,13 +3,16 @@ %general-entities; ]> - + 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> journaling file system.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,12 +20,18 @@ <seglistitem><seg>0.6 SBU</seg><seg>4.9 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>E2fsprogs installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, +Diffutils, Gawk, GCC, Gettext, Glibc, Grep, Make, Sed, and Texinfo</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of E2fsprogs -Create a build directory: +It is recommended that E2fsprogs be built in a subdirectory of the source tree: + mkdir build cd build @@ -32,6 +41,39 @@ cd build ../configure --prefix=/usr --with-root-prefix="" \ --enable-elf-shlibs --disable-evms +The meaning of the configure options: + + + +--with-root-prefix="" +Certain programs (such as the +e2fsck program) are considered essential programs. +When, for example, /usr is not +mounted, these essential programs 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, which is not +where they should be. + + + +--enable-elf-shlibs +This creates the shared libraries which some programs +in this package use. + + + +--disable-evms +This disables the building of the Enterprise Volume +Management System (EVMS) plugin. This plugin is not up-to-date with +the latest EVMS internal interfaces and EVMS is not installed as part +of a base LFS system, so the plugin is not required. See the EVMS +website at for more +information regarding EVMS. + + + Compile the package: make @@ -43,16 +85,296 @@ cd build make install -Also install the shared libraries: +Install the shared libraries: make install-libs + + Contents of E2fsprogs -See testing + +Installed programs +Installed libraries +badblocks, blkid, chattr, +compile_et, debugfs, dumpe2fs, e2fsck, e2image, e2label, findfs, fsck, +fsck.ext2, fsck.ext3, logsave, lsattr, mk_cmds, mke2fs, mkfs.ext2, mkfs.ext3, +mklost+found, resize2fs, tune2fs, and uuidgen. +libblkid.[a,so], libcom_err.[a,so], libe2p.[a,so], +libext2fs.[a,so], libss.[a,so], and libuuid.[a,so] + + +Short Descriptions + + + +badblocks + +Searches a device (usually a disk partition) for bad blocks +badblocks + + + + +blkid + +A command line utility to locate and print block device attributes +blkid + + + + +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 + + + + +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 + + + + +findfs + +Finds a file system by label or Universally Unique Identifier (UUID) +findfs + + + + +fsck + +Is used to check, and optionally repair, file systems +fsck + + + + +fsck.ext2 + +By default checks ext2 +file systems +fsck.ext2 + + + + +fsck.ext3 + +By default checks ext3 +file systems +fsck.ext3 + + + + +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 helps messages into a C +source file suitable for use with the libss subsystem library +mk_cmds + + + + +mke2fs + +Is used to create a second extended file system on the given +device +mke2fs + + + + +mkfs.ext2 + +By default creates ext2 +file systems +mkfs.ext2 + + + + +mkfs.ext3 + +By default creates ext3 +file systems +mkfs.ext3 + + + + +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 + + + + +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 + + + + +libblkid + +Contains routines for device identification and token extraction +libblkid + + + + +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 + + + + +libuuid + +Contains routines for generating unique identifiers for objects +that may be accessible beyond the local system +libuuid + + + + diff --git a/chapter06/file.xml b/chapter06/file.xml index 6079e8ebc..639353cd2 100644 --- a/chapter06/file.xml +++ b/chapter06/file.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + File-&file-version; File +<para>The File package contains a utility for determining the type of files.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,11 @@ <seglistitem><seg>0.1 SBU</seg><seg>6.3 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>File installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, Sed, and Zlib</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -30,7 +36,7 @@ <screen><userinput>make</userinput></screen> -<para>Now install it:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -39,8 +45,36 @@ <sect2 id="contents-file" role="content"><title>Contents of File -See testing + +Installed programs +Installed library +filelibmagic.[a,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/chapter06/findutils.xml b/chapter06/findutils.xml index 15e61801c..1bbbccc06 100644 --- a/chapter06/findutils.xml +++ b/chapter06/findutils.xml @@ -3,13 +3,17 @@ %general-entities; ]> - + Findutils-&findutils-version; Findutils +<para>The Findutils package contains programs to find files. Processes +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> @@ -17,6 +21,11 @@ <seglistitem><seg>0.2 SBU</seg><seg>7.5 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Findutils installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, +Diffutils, GCC, Gettext, Glibc, Grep, Make and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -27,6 +36,10 @@ <screen><userinput>./configure --prefix=/usr --libexecdir=/usr/lib/locate \ --localstatedir=/var/lib/locate</userinput></screen> +<para>The <parameter>localstatedir</parameter> directive above changes the +location of the <command>locate</command> database to be in <filename +class="directory">/var/lib/locate</filename>, which is FHS-compliant.</para> + <para>Compile the package:</para> <screen><userinput>make</userinput></screen> @@ -34,17 +47,86 @@ <para>To test the results, issue: <userinput>make check</userinput>.</para> -<para>Now install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> </sect2> - <sect2 id="contents-findutils" role="content"><title>Contents of Findutils -See testing + +Installed programs +bigram, code, find, frcode, locate, updatedb, and xargs + + +Short Descriptions + + + +bigram + +Was formerly used to produce locate databases +bigram + + + + +code + +Was formerly used to produce locate +databases; it is the ancestor of frcode. +code + + + + +find + +Searches given directory trees for files matching the specified criteria +find + + + + +frcode + +Is called by updatedb to compress the list of file names; it uses +front-compression, reducing the database size by a factor of four to +five. +frcode + + + + +locate + +Searches through a database of file names and reports the names +that contain a given string or match a given pattern +locate + + + + +updatedb + +Updates the locate database; it scans +the entire file system (including other file systems that are currently mounted, +unless told not to) and puts every file name it finds into the database +updatedb + + + + +xargs + +Can be used to apply a given command to a list of files +xargs + + + + diff --git a/chapter06/flex.xml b/chapter06/flex.xml index 9772cfcf4..90282002b 100644 --- a/chapter06/flex.xml +++ b/chapter06/flex.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + Flex-&flex-version; Flex +<para>The Flex package contains a utility for generating programs that +recognize patterns in text.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,20 +19,28 @@ <seglistitem><seg>0.1 SBU</seg><seg>3.4 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Flex installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Bison, Coreutils, Diffutils, +GCC, Gettext, Glibc, Grep, M4, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Flex -Apply a patch: +Flex contains several known bugs. Fix these with the following patch: patch -Np1 -i ../flex-&flex-version;-debian_fixes-2.patch -Touch the man-page: +The GNU autotools detects that the Flex source code has been +modified by the previous patch and tries to update the manual page +accordingly. This does not work correctly on many systems, and the +default page is fine, so make sure it does not get regenerated: touch doc/flex.1 -Now prepare Flex for compilation: +Prepare Flex for compilation: ./configure --prefix=/usr @@ -41,15 +51,21 @@ To test the results, issue: make check. -Now install the package: +Install the package: make install -Create a symlink: +There are some packages that expect to find the +lex library in /usr/lib. Create a symlink to account for +this: ln -s libfl.a /usr/lib/libl.a -Create a lex script: +A few programs do not know about flex yet and +try to run its predecessor, lex. To support those +programs, create a wrapper script named lex that +calls flex in lex emulation mode: cat > /usr/bin/lex << "EOF" #!/bin/sh @@ -66,8 +82,54 @@ chmod 755 /usr/bin/lex Contents of Flex -See testing + +Installed programs +Installed library +flex, flex++ (link to flex), and lex +libfl.a + + +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++ + +Invokes a version of flex that is used exclusively for C++ scanners +flex++ + + + + +lex + +Script that runs flex in lex +emulation mode +lex + + + + +libfl.a + +The flex library +libfl.a + + + + diff --git a/chapter06/gawk.xml b/chapter06/gawk.xml index 02d6cd526..c9968b531 100644 --- a/chapter06/gawk.xml +++ b/chapter06/gawk.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Gawk-&gawk-version; Gawk +<para>The Gawk package contains programs for manipulating text files.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,11 @@ <seglistitem><seg>0.2 SBU</seg><seg>17 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Gawk installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, +Diffutils, GCC, Gettext, Glibc, Grep, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -33,7 +39,7 @@ <para>To test the results, issue: <userinput>make check</userinput>.</para> -<para>Now install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -42,8 +48,82 @@ <sect2 id="contents-gawk" role="content"><title>Contents of Gawk -See testing + +Installed programs +awk (link to gawk), gawk, gawk-&gawk-version;, grcat, igawk, +pgawk, pgawk-&gawk-version;, and pwcat + + +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; + + + + +grcat + +Dumps the group database /etc/group +grcat + + + + +igawk + +Gives gawk the ability to include files +igawk + + + + +pgawk + +The profiling version of gawk +pgawk + + + + +pgawk-&gawk-version; + +Hard link to pgawk +pgawk-&gawk-version; + + + + +pwcat + +Dumps the password database /etc/passwd +pwcat + + + + diff --git a/chapter06/gcc.xml b/chapter06/gcc.xml index bb0e6a172..4015b693a 100644 --- a/chapter06/gcc.xml +++ b/chapter06/gcc.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + 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> @@ -17,29 +19,54 @@ <seglistitem><seg>11.7 SBU</seg><seg>294 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>GCC installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, Findutils, +Gawk, Gettext, Glibc, Grep, Make, Perl, Sed, and Texinfo</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of GCC -Apply a patch: +This package is known to have issues when its default +optimization flags (including the -march and +-mcpu options) are changed. If any environment +variables that override default optimizations have been defined, such +as CFLAGS and CXXFLAGS, +unset them when building GCC. + +Unpack both the gcc-core and the gcc-g++ tarballs—they will +unpack into the same directory. Likewise, extract the gcc-testsuite +package. The full GCC package contains additional compilers. +Instructions for building these can be found at . + +Apply only the No-Fixincludes patch (not the Specs patch) also +used in the previous chapter: patch -Np1 -i ../gcc-&gcc-version;-no_fixincludes-1.patch -Apply another patch: +GCC fails to compile some packages outside of a base Linux From Scratch +install (e.g., Mozilla and kdegraphics) when used in conjunction with newer +versions of Binutils. Apply the following patch to fix this issue: patch -Np1 -i ../gcc-&gcc-version;-linkonce-1.patch -Apply a sed substitution: +Apply a sed substitution that will suppress the installation of +libiberty.a. The version of +libiberty.a provided by +Binutils will be used instead: sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in -Create a build directory: +The GCC documentation recommends building GCC outside of the source +directory in a dedicated build directory: mkdir ../gcc-build cd ../gcc-build -Now prepare GCC for compilation: +Prepare GCC for compilation: ../gcc-&gcc-version;/configure --prefix=/usr \ --libexecdir=/usr/lib --enable-shared \ @@ -50,35 +77,140 @@ cd ../gcc-build make -Test the results): +In this section, the test suite for GCC is considered +critical. Do not skip it under any circumstance. + +Test the results, but do not stop at errors: make -k check -The test suite notes from are still very -much appropriate here. +Some of the errors are known issues and were noted in the +previous chapter. The test suite notes from are still relevant here. Be sure to +refer back to them as necessary. -Now install the package: +Install the package: make install -Create this symlink: +Some packages expect the C PreProcessor to be installed in the +/lib directory. +To support those packages, create this symlink: ln -s ../usr/bin/cpp /lib -Create another symlink: +Many packages use the name cc to call the C +compiler. To satisfy those packages, create a symlink: ln -s gcc /usr/bin/cc -Refer back to -and repeat the check. +At this point, it is strongly recommended to repeat the +sanity check performed earlier in this chapter. Refer back to and repeat the check. If the results +are in error, then the most likely reason is that the GCC Specs patch +from was erroneously applied +here. Contents of GCC -See testing + +Installed programs +Installed libraries +c++, cc (link to gcc), cpp, g++, gcc, gccbug, and +gcov +libgcc.a, libgcc_eh.a, libgcc_s.so, libstdc++.[a,so], and libsupc++.a + + +Short Descriptions + + + +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 + + + + +c++ + +The C++ compiler +c++ + + + + +g++ + +The C++ compiler +g++ + + + + +gcc + +The C compiler +gcc + + + + +gccbug + +A shell script used to help create useful bug reports +gccbug + + + + +gcov + +A coverage testing tool; it is used to analyze programs to +determine where optimizations will have the most effect +gcov + + + + +libgcc + +Contains run-time support for gcc +libgcc* + + + + +libstdc++ + +The standard C++ library +libstdc++ + + + + +libsupc++ + +Provides supporting routines for the C++ programming language +libsupc++ + + + + diff --git a/chapter06/gettext.xml b/chapter06/gettext.xml index 04e6b233e..50d338227 100644 --- a/chapter06/gettext.xml +++ b/chapter06/gettext.xml @@ -3,13 +3,16 @@ %general-entities; ]> - + Gettext-&gettext-version; Gettext +<para>The Gettext package contains utilities for internationalization and +localization. These allow programs to be compiled with NLS, enabling them +to output messages in the user's native language.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +20,11 @@ <seglistitem><seg>0.5 SBU</seg><seg>55 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Gettext installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Bison, Coreutils, +Diffutils, Gawk, GCC, Glibc, Grep, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -31,9 +39,10 @@ <screen><userinput>make</userinput></screen> <para>To test the results, issue: -<userinput>make check</userinput>.</para> +<userinput>make check</userinput>. This takes a very long time, around +7 SBUs.</para> -<para>Now install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -42,8 +51,257 @@ <sect2 id="contents-gettext" role="content"><title>Contents of Gettext -See testing + +Installed programs +Installed libraries +autopoint, config.charset, config.rpath, envsubst, gettext, +gettextize, hostname, msgattrib, msgcat, msgcmp, msgcomm, msgconv, msgen, +msgexec, msgfilter, msgfmt, msggrep, msginit, msgmerge, msgunfmt, msguniq, +ngettext, and xgettext +libasprintf[a,so], libgettextlib[a,so], libgettextpo[a,so] and libgettextsrc[a,so] + + +Short Descriptions + + + +autopoint + +Copies standard Gettext infrastructure files into a source package +autopoint + + + + +config.charset + +Outputs a system-dependent table of character encoding aliases +config.charset + + + + +config.rpath + +Outputs a system-dependent set of variables, describing how to set the +runtime search path of shared libraries in an executable +config.rpath + + + + +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 + + + + +gettextize + +Copies all standard Gettext files into the given top-level +directory of a package to begin internationalizing it +gettextize + + + + +hostname + +Displays a network hostname in various forms +hostname + + + + +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 +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 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 + + + + +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 + + + + diff --git a/chapter06/glibc.xml b/chapter06/glibc.xml index c2bd6519c..8e7732795 100644 --- a/chapter06/glibc.xml +++ b/chapter06/glibc.xml @@ -3,13 +3,17 @@ %general-entities; ]> - + 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> @@ -17,56 +21,131 @@ <seglistitem><seg>12.3 SBU</seg><seg>784 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Glibc installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +Gawk, GCC, Gettext, Grep, Make, Perl, Sed, and Texinfo</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Glibc -The linuxthreads tarball contains the man pages for the threading -libraries installed by glibc. Unpack the tarball from within the glibc source -directory: +This package is known to have issues when its default +optimization flags (including the -march and +-mcpu options) are changed. If any environment +variables that override default optimizations have been defined, such +as CFLAGS and CXXFLAGS, +unset them when building Glibc. -tar xjvf ../glibc-linuxthreads-&glibc-version;.tar.bz2 +The Glibc build system is self-contained and will install +perfectly, even though the compiler specs file and linker are still +pointing at /tools. The specs +and linker cannot be adjusted before the Glibc install because the +Glibc autoconf tests would give false results and defeat the goal +of achieving a clean build. -Create a build directory: +The linuxthreads tarball contains the man pages for the +threading libraries installed by glibc. Unpack the tarball from +within the glibc source directory: + +tar xjvf /sources/glibc-linuxthreads-&glibc-version;.tar.bz2 + +The Glibc documentation recommends building Glibc outside of the source +directory in a dedicated build directory: mkdir ../glibc-build cd ../glibc-build -Now prepare Glibc for compilation: +Prepare Glibc for compilation: ../glibc-&glibc-version;/configure --prefix=/usr \ --disable-profile --enable-add-ons \ --enable-kernel=2.6.0 --without-cvs \ --libexecdir=/usr/lib/glibc +The meaning of the new configure option: + + + +--libexecdir=/usr/lib/glibc +This changes the location of the +pt_chown program from its default of /usr/libexec to /usr/lib/glibc. + + + Compile the package: make +In this section, the test suite for Glibc is +considered critical. Do not skip it under any +circumstance. + Test the results: make check -The Glibc test suite is highly dependent on certain functions of your host -system. See testing for explanations. +The Glibc test suite is highly dependent on certain functions of +the host system, in particular the kernel. In general, the Glibc test +suite is always expected to pass. However, in certain circumstances, +some failures are unavoidable. This is a list of the most common +issues: -Fix an annoying little warning with: + +The math tests sometimes fail when running +on systems where the CPU is not a relatively new genuine Intel or authentic AMD. +Certain optimization settings are also known to be a factor here. + +The gettext test sometimes fails due to +host system issues. The exact reasons are not yet clear. + +The atime test sometimes fails +when the LFS partition is mounted with the +noatime option. + +The shm test can fail when the +host system is using the devfs file system but does not have +the tmpfs file system +mounted at /dev/shm. This +occurs because of a lack of support for tmpfs in the +kernel. + +When running on older and slower hardware, some tests +can fail because of test timeouts being exceeded. + + +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 -And install the package: +Install the package: make install -To install the Glibc locales, use the following -command: +The locales that can make the system respond in a different +language were not installed by the above command. Install this +with: make localedata/install-locales -An alternative to running the previous command is to install only those -locales which you need or want. The following instructions, instead of the -install-locales target above, will install the minimum set of locales necessary +To save time, an alternative to running the +previous command (which generates and installs every locale Glibc is +aware of) is to install only those locales that are wanted and needed. +This can be achieved by using the localedef +command. Information on this command is located in the +INSTALL file in the Glibc source. However, there +are a number of locales that are essential in order for the tests of +future packages to pass, in particular, the +libstdc++ tests from GCC. The following +instructions, instead of the install-locales +target used above, will install the minimum set of locales necessary for the tests to run successfully: mkdir -p /usr/lib/locale @@ -82,18 +161,40 @@ localedef -i fr_FR@euro -f ISO-8859-15 fr_FR@euro localedef -i it_IT -f ISO-8859-1 it_IT localedef -i ja_JP -f EUC-JP ja_JP -Build the linuxthreads man pages: +Some locales installed by the make +localedata/install-locales command above are not properly +supported by some applications that are in the LFS and BLFS books. +Because of the various problems that arise due to application +programmers making assumptions that break in such locales, LFS should +not be used in locales that utilize multibyte character sets +(including UTF-8) or right-to-left writing order. Numerous unofficial +and unstable patches are required to fix these problems, and it has +been decided by the LFS developers not to support such complex locales. This applies to the +ja_JP and fa_IR locales as well—they have been installed only for +GCC and Gettext tests to pass, and the watch program +(part of the Procps package) does not work properly in them. Various +attempts to circumvent these restrictions are documented in +internationalization-related hints. + +Build the linuxthreads man pages, which are a great reference +on the threading API (applicable to NPTL as well): make -C ../glibc-&glibc-version;/linuxthreads/man -And install these pages: +Install these pages: make -C ../glibc-&glibc-version;/linuxthreads/man install - Configuring Glibc +/etc/nsswitch.conf +/etc/localtime + +The /etc/nsswitch.conf file needs to be +created because, although Glibc provides defaults when this file is +missing or corrupt, the Glibc defaults do not work well with +networking. The time zone also needs to be set up. Create a new file /etc/nsswitch.conf by running the following: @@ -116,20 +217,56 @@ rpc: files # End /etc/nsswitch.conf EOF -To find out what time zone you're in, run the following script: +To determine the local time zone, run the following script: tzselect -Then create the /etc/localtime file by running: +After answering a few questions about the location, the script +will output the name of the time zone (e.g., +EST5EDT or Canada/Eastern). +Then create the /etc/localtime file by +running: cp --remove-destination /usr/share/zoneinfo/[xxx] \ /etc/localtime +Replace [xxx] with the name of the time zone that the +tzselect provided (e.g., Canada/Eastern). + +The meaning of the cp option: + + + +--remove-destination +This is needed to force removal of the already +existing symbolic link. The reason for copying the file instead of +using a symlink is to cover the situation where /usr is on a separate partition. This +could be important when booted into single user +mode. + + + Configuring 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: @@ -145,11 +282,413 @@ EOF - Contents of Glibc -See testing + +Installed programs +Installed libraries +catchsegv, gencat, getconf, +getent, iconv, iconvconfig, ldconfig, ldd, lddlibc4, locale, +localedef, mtrace, nscd, nscd_nischeck, pcprofiledump, pt_chown, rpcgen, +rpcinfo, sln, sprof, tzselect, xtrace, zdump, and zic +ld.so, libBrokenLocale.[a,so], +libSegFault.so, libanl.[a,so], libbsd-compat.a, libc.[a,so], +libcrypt.[a,so], libdl.[a,so], libg.a, libieee.a, libm.[a,so], libmcheck.a, +libmemusage.so, libnsl.a, libnss_compat.so, libnss_dns.so, libnss_files.so, +libnss_hesiod.so, libnss_nis.so, libnss_nisplus.so, libpcprofile.so, +libpthread.[a,so], libresolv.[a,so], librpcsvc.a, librt.[a,so], +libthread_db.so, and libutil.[a,so] + + +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 + +Tells the compiler to enable or disable the use of POSIX locales +for built-in operations +locale + + + + +localedef + +Compiles locale specifications +localedef + + + + +mtrace + +Reads and interprets a memory trace file and +ouputs a summary in human-readable format +mtrace + + + + +nscd + +A daemon that provides a cache for the most common name +service requests +nscd + + + + +nscd_nischeck + +Checks whether or not secure mode is necessary for NIS+ lookup +nscd_nischeck + + + + +pcprofiledump + +Dumps information generated by PC profiling +pcprofiledump + + + + +pt_chown + +A helper program for grantpt to set +the owner, group and access permissions of a slave pseudo terminal +pt_chown + + + + +rpcgen + +Generates C code to implement the Remote Procecure Call (RPC) protocol +rpcgen + + + + +rpcinfo + +Makes an RPC call to an RPC server +rpcinfo + + + + +sln + +A statically linked ln program +sln + + + + +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.so + +The helper program for shared library executables +ld.so + + + + +libBrokenLocale + +Used by programs, such as Mozilla, to solve broken locales +libBrokenLocale + + + + +libSegFault + +The segmentation fault signal handler +libSegFault + + + + +libanl + +An asynchronous name lookup library +libanl + + + + +libbsd-compat + +Provides the portability needed +in order to run certain Berkey Software Distribution (BSD) programs under Linux +libbsd-compat + + + + +libc + +The main C library +libc + + + + +libcrypt + +The cryptography library +libcrypt + + + + +libdl + +The dynamic linking interface library +libdl + + + + +libg + +A runtime library for g++ +libg + + + + +libieee + +The Institute of Electrical and Electronic Engineers (IEEE) floating point library +libieee + + + + +libm + +The mathematical library +libm + + + + +libmcheck + +Contains code run at boot +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 + +Contains profiling functions used +to track the amount of CPU time spent in specific source code lines +libpcprofile + + + + +libpthread + +The POSIX threads library +libpthread + + + + +libresolv + +Contains functions for creating, +sending, and interpreting packets to the Internet domain name servers +libresolv + + + + +librpcsvc + +Contains functions providing miscellaneous RPC services +librpcsvc + + + + +librt + +Contains functions providing most of the +interfaces specified by the POSIX.1b Realtime Extension +librt + + + + +libthread_db + +Contains functions useful for +building debuggers for multi-threaded programs +libthread_db + + + + +libutil + +Contains code for standard functions used in many different Unix utilities +libutil + + + + diff --git a/chapter06/grep.xml b/chapter06/grep.xml index 2753ceca4..2a526d400 100644 --- a/chapter06/grep.xml +++ b/chapter06/grep.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Grep-&grep-version; Grep +<para>The Grep package contains programs for searching through files.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,11 @@ <seglistitem><seg>0.1 SBU</seg><seg>5.8 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Grep installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, +Diffutils, GCC, Gettext, Glibc, Make, Sed, and Texinfo</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -33,7 +39,7 @@ <para>To test the results, issue: <userinput>make check</userinput>.</para> -<para>Now install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -42,8 +48,40 @@ <sect2 id="contents-grep" role="content"><title>Contents of Grep -See testing + +Installed programs +egrep (link to grep), fgrep (link to grep), and grep + + +Short Descriptions + + + +egrep + +Prints lines matching an extended regular expression +egrep + + + + +fgrep + +Prints lines matching a list of fixed strings +fgrep + + + + +grep + +Prints lines matching a basic regular expression +grep + + + + diff --git a/chapter06/groff.xml b/chapter06/groff.xml index eae23fc23..5289367b8 100644 --- a/chapter06/groff.xml +++ b/chapter06/groff.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Groff-&groff-version; Groff +<para>The Groff package contains programs for processing and formatting text.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,11 +18,21 @@ <seglistitem><seg>0.5 SBU</seg><seg>43 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Groff installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +Gawk, GCC, Glibc, Grep, Make, and Sed</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. + Prepare Groff for compilation: PAGE=[paper_size] ./configure --prefix=/usr @@ -30,11 +41,12 @@ make -Now install it: +Install the package: make install -Create the following symlinks: +Some documentation programs, such as xman, +will not work properly without the following symlinks: ln -s soelim /usr/bin/zsoelim ln -s eqn /usr/bin/geqn @@ -45,8 +57,315 @@ ln -s tbl /usr/bin/gtbl Contents of Groff -See testing + +Installed programs +addftinfo, afmtodit, eqn, eqn2graph, geqn (link to eqn), grn, +grodvi, groff, groffer, grog, grolbp, grolj4, grops, grotty, gtbl (link to tbl), hpftodit, +indxbib, lkbib, lookbib, mmroff, neqn, nroff, pfbtops, pic, pic2graph, post-grohtml, +pre-grohtml, refer, soelim, tbl, tfmtodit, troff, and zsoelim (link to soelim) + + +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 + + + + +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 + + + + +eqn + +A link to eqn +geqn + + + + +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 -e, -man, +-me, -mm, +-ms, -p, -s, +and -t 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 + + + + +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 + + + + +gtbl + +Is the GNU implementation of tbl +gtbl + + + + +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 + + + + +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 + + + + +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 + + + + +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 + + + + +zsoelim + +Is the GNU implementation of soelim +zsoelim + + + + diff --git a/chapter06/grub.xml b/chapter06/grub.xml index 721c2731e..9f5a0efe0 100644 --- a/chapter06/grub.xml +++ b/chapter06/grub.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Grub-&grub-version; Grub +<para>The Grub package contains the Grand Unified Bootloader.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,28 +18,49 @@ <seglistitem><seg>0.2 SBU</seg><seg>10 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Grub installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, Ncurses, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Grub +This package is known to have issues when its default +optimization flags (including the -march and +-mcpu options) are changed. If any environment +variables that override default optimizations have been defined, such +as CFLAGS and CXXFLAGS, +unset them when building Grub. + Prepare Grub for compilation: ./configure --prefix=/usr -Now compile the package: +Compile the package: make To test the results, issue: make check. -Now install it: +Note that the test results will always show the error +ufs2_stage1_5 is too big. This is due to a compiler +issue, but can be ignored unless you plan to boot from an UFS +partition. The partitions are normally only used by Sun +workstations. + +Install the package: make install mkdir /boot/grub cp /usr/lib/grub/i386-pc/stage{1,2} /boot/grub +Replace i386-pc with whatever +directory is appropriate for the hardware in use. + The i386-pc directory contains a number of *stage1_5 files, different ones for different file systems. Review the files available and copy @@ -52,9 +74,58 @@ copy the e2fs_stage1_5 and/or Contents of Grub -See testing + +Installed programs +grub, grub-install, +grub-md5-crypt, grub-terminfo, and mbchk + + +Short Descriptions + + + +grub + +The Grand Unified Bootloader's command shell +grub + + + + +grub-install + +Installs GRUB on the given device +grub-install + + + + +grub-md5-crypt + +Encrypts a password in MD5 format +grub-md5-crypt + + + + +grub-terminfo + +Generates a terminfo command from a terminfo name; it can be +employed if an unknown terminal is being used +grub-terminfo + + + + +mbchk + +Checks the format of a multi-boot kernel +mbchk + + + - + diff --git a/chapter06/gzip.xml b/chapter06/gzip.xml index ea1c677b1..e7e35fa3f 100644 --- a/chapter06/gzip.xml +++ b/chapter06/gzip.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + Gzip-&gzip-version; Gzip +<para>The Gzip package contains programs for compressing and decompressing +files.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +19,11 @@ <seglistitem><seg>0.1 SBU</seg><seg>2.6 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Gzip installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -26,7 +33,10 @@ <screen><userinput>./configure --prefix=/usr</userinput></screen> -<para>Issue a sed command:</para> +<para>The <command>gzexe</command> script has the location of the +<command>gzip</command> binary hard-wired into it. Because the +location of the binary is changed later, the following command ensures +that the new location gets placed into the script:</para> <screen><userinput>sed -i 's@"BINDIR"@/bin@g' gzexe.in</userinput></screen> @@ -51,8 +61,134 @@ ln -s gunzip /bin/uncompress</userinput></screen> <sect2 id="contents-gzip" role="content"><title>Contents of Gzip -See testing + +Installed programs +gunzip (link to gzip), gzexe, +gzip, uncompress (link to gunzip), zcat (link to gzip), zcmp, zdiff, +zegrep, zfgrep, zforce, zgrep, zless, zmore, and znew + + +Short Descriptions + + + +gunzip + +Decompresses gzipped files +gunzip + + + + +gzexe + +Creates self-uncompressing executable files +gzexe + + + + +gzip + +Compresses the given files using Lempel-Ziv (LZ77) coding +gzip + + + + +uncompress + +Decompresses compressed files +uncompress + + + + +zcat + +Uncompresses the given gzipped files to standard output +zcat + + + + +zcmp + +Runs cmp on gzipped files +zcmp + + + + +zdiff + +Runs diff on gzipped files +zdiff + + + + +zegrep + +Runs egrep on gzipped files +zegrep + + + + +zfgrep + +Runs fgrep on gzipped files +zfgrep + + + + +zforce + +Forces a .gz extension on all given files +that are gzipped files, so that gzip will not compress them again; this can be +useful when file names were truncated during a file transfer +zforce + + + + +zgrep + +Runs grep on gzipped files +zgrep + + + + +zless + +Runs less on gzipped files +zless + + + + +zmore + +Runs more on gzipped files +zmore + + + + +znew + +Re-compresses files from compress format to +gzip format—.Z +to .gz +znew + + + + diff --git a/chapter06/hotplug.xml b/chapter06/hotplug.xml index 12a3e0d0f..cfa04326d 100644 --- a/chapter06/hotplug.xml +++ b/chapter06/hotplug.xml @@ -10,6 +10,12 @@ Hotplug +<para>The Hotplug package contains scripts that react upon hotplug events +generated by the kernel. Such events correspond to every change in the kernel +state visible in the <systemitem class="filesystem">sysfs</systemitem> +filesystem, e.g., the addition and removal of hardware. This package also +detects existing hardware during boot and inserts the relevant modules into the +running kernel.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +23,10 @@ <seglistitem><seg>0.01 SBU</seg><seg>0.1 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Hotplug installation depends on</segtitle> +<seglistitem><seg>Unchecked</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -26,15 +36,17 @@ <screen><userinput>make install</userinput></screen> -<para>Copy a file that the "install" target omits.</para> +<para>Copy a file that the <quote>install</quote> target omits.</para> <screen><userinput>cp etc/hotplug/pnp.distmap /etc/hotplug</userinput></screen> -<para>Remove Hotplug's init script:</para> +<para>Remove the init script that Hotplug installs, since we're going to be +using the script included with LFS-Bootscripts:</para> <screen><userinput>rm -rf /etc/init.d</userinput></screen> -<para>Remove the network hotplug agent:</para> +<para>Network device hotplugging is not supported by LFS bootscripts yet. For +that reason, remove the network hotplug agent:</para> <screen><userinput>rm -f /etc/hotplug/net.agent</userinput></screen> </sect2> @@ -42,7 +54,113 @@ <sect2 id="contents-hotplug" role="content"><title>Contents of Hotplug -See testing + +Installed program +Installed scripts +Installed files +hotplug +/etc/hotplug/*.rc, /etc/hotplug/*.agent +/etc/hotplug/hotplug.functions, /etc/hotplug/blacklist, /etc/hotplug/{pci,usb}, +/etc/hotplug/usb.usermap, /etc/hotplug.d + +Short Descriptions + + + +hotplug + +hotplug +This script is called by default by Linux kernel when something +changes in its internal state (e.g., a new device is added or removed). + + + + +/etc/hotplug/*.rc + +/etc/hotplug/*.rc +These scripts are used for cold plugging, i.e., detection and other +specific actions upon hardware already present during system startup. +They are called by the hotplug initscript that comes +from the LFS-Bootscripts package. +The *.rc +scripts try to recover hotplug events that were lost during system boot +because, e.g., the root filesystem was not mounted by the kernel. + + + + + +/etc/hotplug/*.agent + +/etc/hotplug/*.agent +These scripts are called by hotplug +in response to different types of hotplug events generated by the kernel. +Their action is to insert corresponding kernel modules and call user-provided +scripts, if any. + + + + + +/etc/hotplug/hotplug.functions + +/etc/hotplug/hotplug.functions +This file contains common functions used by other scripts in Hotplug +package. + + + + + +/etc/hotplug/blacklist + +/etc/hotplug/blacklist +This file contains the list of modules that should never be +inserted into the kernel by hotplug scripts. + + + + + +/etc/hotplug/{pci,usb} + +/etc/hotplug/{pci,usb} +These directories are supposed to contain user-written handlers for +hotplug events. + + + + + +/etc/hotplug/usb.usermap + +/etc/hotplug/usb.usermap +This file contains rules that determine which user-defined handlers to +call for each USB device, based on its vendor, id and other attributes. + + + + + +/etc/hotplug.d + +/etc/hotplug.d +This directory contains programs (or symlinks to them) +that are interested in receiving hotplug events. E.g., +Udev puts its symlink here during installation. + + + + diff --git a/chapter06/iana-etc.xml b/chapter06/iana-etc.xml index c37ce147c..3f10e728e 100644 --- a/chapter06/iana-etc.xml +++ b/chapter06/iana-etc.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Iana-Etc-&iana-etc-version; Iana-Etc +<para>The Iana-Etc package provides data for network services and protocols.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,10 @@ <seglistitem><seg>0.1 SBU</seg><seg>641 KB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Iana-Etc installation depends on</segtitle> +<seglistitem><seg>Make</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -26,7 +31,7 @@ <screen><userinput>make</userinput></screen> -<para>Now install it:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -35,9 +40,35 @@ <sect2 id="contents-iana-etc" role="content"><title>Contents of Iana-Etc -See testing + +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 index 41571c3b5..e489dfc06 100644 --- a/chapter06/inetutils.xml +++ b/chapter06/inetutils.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Inetutils-&inetutils-version; Inetutils +<para>The Inetutils package contains programs for basic networking.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,35 +18,84 @@ <seglistitem><seg>0.2 SBU</seg><seg>11 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Inetutils installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, +Diffutils, GCC, Glibc, Grep, Make, Ncurses, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Inetutils -Apply a patch patch: +Inetutils has issues with the Linux 2.6 kernel series. Fix these +issues by applying the following patch: patch -Np1 -i ../inetutils-&inetutils-version;-kernel_headers-1.patch -Apply another patch: +All programs that come with Inetutils will not be installed. +However, the Inetutils build system will insist on installing all the +man pages anyway. The following patch will correct this +situation: patch -Np1 -i ../inetutils-&inetutils-version;-no_server_man_pages-1.patch -Now prepare Inetutils for compilation: +Prepare Inetutils for compilation: ./configure --prefix=/usr --libexecdir=/usr/sbin \ --sysconfdir=/etc --localstatedir=/var \ --disable-logger --disable-syslogd \ --disable-whois --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 better version later. + + + +--disable-syslogd +This option +prevents Inetutils from installing the System Log Daemon, which is +installed with the Sysklogd package. + + + +--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-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. More +information can be found at . Note that +better replacements are available for many of these +servers. + + + Compile the package: make -Install it: +Install the package: make install -Move the ping program: +Move the ping program to its FHS-compliant +place: mv /usr/bin/ping /bin @@ -54,8 +104,80 @@ Contents of Inetutils -See testing + +Installed programs +ftp, ping, rcp, rlogin, rsh, talk, telnet, and tftp + + +Short Descriptions + + + +ftp + +Is the file transfer protocol program +ftp + + + + +ping + +Sends echo-request packets and reports how long the replies take +ping + + + + +rcp + +Performs remote file copy +rcp + + + + +rlogin + +Performs remote login +rlogin + + + + +rsh + +Runs a remote shell +rsh + + + + +talk + +Is used to chat with another user +talk + + + + +telnet + +An interface to the TELNET protocol +telnet + + + + +tftp + +A trivial file transfer program +tftp + + + + diff --git a/chapter06/introduction.xml b/chapter06/introduction.xml index a26434375..b19f69e45 100644 --- a/chapter06/introduction.xml +++ b/chapter06/introduction.xml @@ -7,6 +7,65 @@ Introduction -See testing +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 the user (or the system) needs it. For every +installed package, a summary of its contents is given, followed by +concise descriptions of each program and library the package +installed. + +If using the compiler optimizations provided in this chapter, +please review the optimization hint at . Compiler optimizations 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. The small potential gains achieved in using +compiler optimizations are often outweighed by the risks. First-time +builders of LFS are encouraged to build without custom optimizations. +The subsequent system will still run very fast and be stable at the +same time. + +The order that packages are installed in this chapter needs to +be strictly followed to ensure that no program accidentally acquires a +path referring to /tools +hard-wired into it. For the same reason, do not compile packages in +parallel. Compiling in parallel may save time (especially on dual-CPU +machines), but it could result in a program containing a hard-wired +path to /tools, which will +cause the program to stop working when that directory is +removed. + +Before the installation instructions, each installation page +provides information about the package, including a concise +description of what it contains, approximately how long it will take +to build, how much disk space is required during this building +process, and any other packages needed to successfully build the +package. Following the installation instructions, there is a list of +programs and libraries (along with brief descriptions of these) that +the package installs. + +To keep track of which package installs particular files, a package +manager can be used. For a general overview of different styles of package +managers, please refer to . +For a package management method specifically geared towards LFS, we recommend . + +The remainder of this book is to be performed while logged +in as user root and no longer as user +lfs. + diff --git a/chapter06/iproute2.xml b/chapter06/iproute2.xml index 3cce62619..cf492bd64 100644 --- a/chapter06/iproute2.xml +++ b/chapter06/iproute2.xml @@ -3,16 +3,17 @@ %general-entities; ]> - -Iproute2-&iproute2-version; + + Iproute2-&iproute2-version; - - iproute2 + Iproute2 - + <para>The Iproute2 package contains programs for basic and advanced + IPV4-based networking. + </para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> @@ -21,42 +22,244 @@ <seg>.6 MB</seg> </seglistitem> </segmentedlist> - + <segmentedlist> + <segtitle>Iproute2 installation depends on</segtitle> + <seglistitem> + <seg>GCC, Glibc, Make, Linux-Headers, and Sed</seg> + </seglistitem> + </segmentedlist> </sect2> - <sect2 role="installation"> <title>Installation of Iproute2 - - Apply a patch + The arpd binary included in this package is + dependent on Berkeley DB. Because arpd is not a very + common requirement on a base Linux system, remove the dependency on + Berkeley DB by applying the patch using the command below. If + the arpd binary is needed, instructions for + compiling Berkeley DB can be found in the BLFS Book at . + patch -Np1 -i ../iproute2-&iproute2-patch-version;-remove_db-1.patch - - The patch below fixes the issue with the newer versions of findutils, - the issue will give an error message it options are not in the proper order. - This patch corrects this issue for IPRoute2. +The patch below fixes the issue with the newer versions of +findutils whose find command will report an error +message when its options are not in the proper order. - patch -Np1 -i ../iproute2-&iproute2-patch-version;-find_update-1.patch +patch -Np1 -i ../iproute2-&iproute2-patch-version;-find_update-1.patch - Prepare iproute2 for compilation: - + + Prepare Iproute2 for compilation: ./configure Compile the package: make SBINDIR=/sbin - Now install it: - - - make install SBINDIR=/sbin - + The meaning of the make option: + + + + SBINDIR=/sbin + This makes sure that the Iproute2 binaries will install into + /sbin. This is the correct + location according to the FHS, because some of the Iproute2 binaries are used + in the bootscripts. + + + + + Install the package: + + make SBINDIR=/sbin install - Contents of Iproute2 - - See testing - + Contents of Iproute2 + + Installed programs + + ifstat, ip, nstat, routef, routel, rtmon, rtstat, ss, and tc. + + + + Short Descriptions + + + + + ifstat + + + Shows the interfaces statistic, including the amount of transmitted + and received packages 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 + continously monitor the state of devices, addresses and routes. + + + ip + + + + + + + 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 + + + + + + + rtmon + + + Route monitoring utility. + + rtmon + + + + + + + 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 index 99acf19cd..055a81d9f 100644 --- a/chapter06/kbd.xml +++ b/chapter06/kbd.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Kbd-&kbd-version; Kbd +<para>The Kbd package contains key-table files and keyboard utilities.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,11 @@ <seglistitem><seg>0.1 SBU</seg><seg>12 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Kbd installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Bison, Coreutils, +Diffutils, Flex, GCC, Gettext, Glibc, Grep, Gzip, M4, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -30,7 +36,7 @@ <screen><userinput>make</userinput></screen> -<para>Now install it:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -38,8 +44,244 @@ <sect2 id="contents-kbd" role="content"><title>Contents of Kbd -See testing + +Installed programs +chvt, deallocvt, dumpkeys, +fgconsole, getkeycodes, getunimap, kbd_mode, kbdrate, loadkeys, loadunimap, +mapscrn, openvt, psfaddtable (link to psfxtable), psfgettable (link to +psfxtable), psfstriptable (link to psfxtable), psfxtable, resizecons, +setfont, setkeycodes, setleds, setlogcons, setmetamode, setvesablank, +showconsolefont, showkey, unicode_start, and unicode_stop + + +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 + + + + +getunimap + +Prints the currently used unimap +getunimap + + + + +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 + +A link to psfxtable +psfaddtable + + + + +psfgettable + +A link to psfxtable +psfgettable + + + + +psfstriptable + +A link to psfxtable +psfstriptable + + + + +psfxtable + +Handle Unicode character tables for console fonts +psfxtable + + + + +resizecons + +Changes the kernel idea of the console size +resizecons + + + + +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 + + + + +setlogcons + +Sends kernel messages to the console +setlogcons + + + + +setmetamode + +Defines the keyboard meta-key handling +setmetamode + + + + +setvesablank + +Lets the user adjust the built-in hardware screensaver (a blank +screen) +setvesablank + + + + +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. Never use it on LFS, +because applications are not configured to support UNICODE. +unicode_start + + + + +unicode_stop + +Reverts keyboard and console from UNICODE mode +unicode_stop + + + + diff --git a/chapter06/kernfs.xml b/chapter06/kernfs.xml index a82a03b96..0f925c979 100644 --- a/chapter06/kernfs.xml +++ b/chapter06/kernfs.xml @@ -1,10 +1,17 @@ - + + %general-entities; +]> Mounting Virtual Kernel File Systems -Create the dirs: +Various file systems exported by the kernel do not exist on the +hard drive, but are used to communicate to and from the kernel +itself. + +Begin by creating directories onto which the file systems will be mounted: mkdir -p $LFS/{proc,sys} @@ -13,10 +20,18 @@ mount -t proc proc $LFS/proc mount -t sysfs sysfs $LFS/sys -Do some fake mounts: +Remember that if for any reason you stop working on the LFS +system and start again later, it is important to check that these file +systems are mounted again before entering the chroot +environment. + +Additional file systems will soon be mounted from within the +chroot environment. To keep the host up to date, perform a fake +mount for each of these now: mount -f -t ramfs ramfs $LFS/dev mount -f -t tmpfs tmpfs $LFS/dev/shm mount -f -t devpts -o gid=4,mode=620 devpts $LFS/dev/pts + diff --git a/chapter06/less.xml b/chapter06/less.xml index ccae7af41..fffd1f3ed 100644 --- a/chapter06/less.xml +++ b/chapter06/less.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Less-&less-version; Less +<para>The Less package contains a text file viewer.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,11 @@ <seglistitem><seg>0.1 SBU</seg><seg>3.4 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Less installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, Ncurses, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -26,20 +32,63 @@ <screen><userinput>./configure --prefix=/usr --bindir=/bin --sysconfdir=/etc</userinput></screen> +<para>The meaning of the configure option:</para> + +<variablelist> +<varlistentry> +<term><parameter>--sysconfdir=/etc</parameter></term> +<listitem><para>This option tells the programs created by the package to look in +<filename class="directory">/etc</filename> for the configuration files.</para></listitem> +</varlistentry> +</variablelist> + <para>Compile the package:</para> <screen><userinput>make</userinput></screen> -<para>Now install it:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> - </sect2> <sect2 id="contents-less" role="content"><title>Contents of Less -See testing + +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/libol.xml b/chapter06/libol.xml index abb38e48f..a593f1e17 100644 --- a/chapter06/libol.xml +++ b/chapter06/libol.xml @@ -10,6 +10,7 @@ Libol +<para>The Libol package contains support libraries needed by Syslog-ng.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,10 @@ <seglistitem><seg>Unchecked</seg><seg>Unchecked</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Libol installation depends on</segtitle> +<seglistitem><seg>Unchecked</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -24,14 +29,13 @@ <para>Prepare Libol for compilation</para> -<!--NEW--> <screen><userinput>./configure --prefix=/usr</userinput></screen> -<para>Compile Libol:</para> +<para>Compile the package:</para> <screen><userinput>make</userinput></screen> -<para>Now install it:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -40,7 +44,34 @@ <sect2 id="contents-libol" role="content"><title>Contents of Libol -See testing + +Installed programs +Unchecked + + + diff --git a/chapter06/libtool.xml b/chapter06/libtool.xml index 13691bb8b..403d2e968 100644 --- a/chapter06/libtool.xml +++ b/chapter06/libtool.xml @@ -3,13 +3,16 @@ %general-entities; ]> - + 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> @@ -17,6 +20,11 @@ <seglistitem><seg>1.5 SBU</seg><seg>20 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Libtool installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -42,8 +50,41 @@ <sect2 id="contents-libtool" role="content"><title>Contents of Libtool -See testing + +Installed programs +Installed libraries +libtool and libtoolizelibltdl.[a,so] + + +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-libc-headers.xml b/chapter06/linux-libc-headers.xml index 5db583994..aa14b87bf 100644 --- a/chapter06/linux-libc-headers.xml +++ b/chapter06/linux-libc-headers.xml @@ -12,6 +12,8 @@ +<para>The Linux-Libc-Headers package contains the +<quote>sanitized</quote> kernel headers.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -19,21 +21,34 @@ <seglistitem><seg>0.1 SBU</seg><seg>22 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Linux-Libc-Headers installation depends on</segtitle> +<seglistitem><seg>Coreutils</seg></seglistitem> +</segmentedlist> + </sect2> <sect2 role="installation"> <title>Installation of Linux-Libc-Headers +For years it has been common practice to use raw +kernel headers (straight from a kernel tarball) in /usr/include, but over the last few +years, the kernel developers have taken a strong stance that this +should not be done. This gave birth to the Linux-Libc-Headers Project, +which was designed to maintain an API stable version of the Linux +headers. + Install the header files: cp -R include/asm-i386 /usr/include/asm cp -R include/linux /usr/include -Assure that all the headers are owned by root: +Ensure that all the headers are owned by root: chown -R root:root /usr/include/{asm,linux} -And make sure all the users can read the headers: +Make sure the users can read the headers: find /usr/include/{asm,linux} -type d -exec chmod 755 {} \; find /usr/include/{asm,linux} -type f -exec chmod 644 {} \; @@ -43,8 +58,24 @@ find /usr/include/{asm,linux} -type f -exec chmod 644 {} \; Contents of Linux-Libc-Headers -See testing + +Installed headers +/usr/include/{asm,linux}/*.h + + +Short Descriptions + + + +/usr/include/{asm,linux}/*.h + +The Linux headers API +/usr/include/{asm,linux}/*.h + + + + diff --git a/chapter06/m4.xml b/chapter06/m4.xml index f81e5c583..ba350ab94 100644 --- a/chapter06/m4.xml +++ b/chapter06/m4.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + M4-&m4-version; M4 +<para>The M4 package contains a macro processor.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,11 @@ <seglistitem><seg>0.1 SBU</seg><seg>3.0 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>M4 installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, GCC, +Gettext, Glibc, Grep, Make, Perl, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -33,7 +39,7 @@ <para>To test the results, issue: <userinput>make check</userinput>.</para> -<para>And install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -42,8 +48,31 @@ <sect2 id="contents-m4" role="content"><title>Contents of M4 -See testing + +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/chapter06/make.xml b/chapter06/make.xml index a0dd5ce18..585f94ca3 100644 --- a/chapter06/make.xml +++ b/chapter06/make.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Make-&make-version; Make +<para>The Make package contains a program for compiling large packages.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,11 @@ <seglistitem><seg>0.2 SBU</seg><seg>8.8 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Make installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Gettext, Glibc, Grep, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -33,7 +39,7 @@ <para>To test the results, issue: <userinput>make check</userinput>.</para> -<para>Now install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -42,8 +48,25 @@ <sect2 id="contents-make" role="content"><title>Contents of Make -See testing + +Installed program +make + + +Short Descriptions + + + +make + +Automatically determines which pieces of a large package need to +be recompiled and then issues the relevant commands +make + + + + diff --git a/chapter06/man-pages.xml b/chapter06/man-pages.xml index e9fcaeeed..ce568ae14 100644 --- a/chapter06/man-pages.xml +++ b/chapter06/man-pages.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Man-pages-&man-pages-version; Man-pages +<para>The Man-pages package contains over 1,200 manual pages.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,10 @@ <seglistitem><seg>0.1 SBU</seg><seg>15 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Man-pages installation depends on</segtitle> +<seglistitem><seg>Bash, Coreutils, and Make</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -31,8 +36,25 @@ <sect2 id="contents-manpages" role="content"><title>Contents of Man-pages -See testing + +Installed files +various manual pages + + +Short Descriptions + + + +manual pages + +Describe the C and C++ functions, important +device files, and significant configuration files +manual pages + + + + diff --git a/chapter06/man.xml b/chapter06/man.xml index 042cb5fee..1a0bce0ff 100644 --- a/chapter06/man.xml +++ b/chapter06/man.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Man-&man-version; Man +<para>The Man package contains programs for finding and viewing manual pages.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,40 +18,160 @@ <seglistitem><seg>0.1 SBU</seg><seg>1.9MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Man installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Gawk, GCC, +Glibc, Grep, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Man -Issue a sed substitution: +Two adjustments need to be made to the sources of Man. + +The first is a sed substitution to add the +-R switch to the PAGER +variable so that escape sequences are properly handled by Less: sed -i 's@-is@&R@g' configure -Issue another sed substitution: +The second is also a sed substitution to comment out the +MANPATH /usr/man line in the +man.conf file to prevent redundant results when +using programs such as whatis: sed -i 's@MANPATH./usr/man@#&@g' src/man.conf.in -Now prepare Man for compilation: +Prepare Man for compilation: ./configure -confdir=/etc +The meaning of the configure options: + + + +-confdir=/etc +This tells the man program to look for the +man.conf configuration file in the /etc directory. + + + Compile the package: make -Lastly, install it: +Install the package: make install -For some internazionalitation issues, see testing. +To disable Select Graphic Rendition (SGR) escape +sequences, edit the man.conf file and +add the -c switch to +the NROFF variable. + +If the character set uses 8-bit characters, search for the line +beginning with NROFF in +/etc/man.conf, and verify that it looks as +follows: + +NROFF /usr/bin/nroff -Tlatin1 -mandoc + +Note that latin1 should be used even if it is not +the character set of the locale. The reason is that, according to the +specification, groff has no means of typesetting +characters outside International Organization for Standards +(ISO) 8859-1 without some strange escape codes. When formatting manual +pages, groff thinks that they are in the ISO 8859-1 +encoding and this -Tlatin1 switch tells +groff to use the same encoding for output. Since +groff does no recoding of input characters, the +formatted result is really in the same encoding as input, and therefore +it is usable as the input for a pager. + +This does not solve the problem of a non-working +man2dvi program for localized manual pages in +non-ISO 8859-1 locales. Also, it does not work with multibyte +character sets. The first problem does not currently have a solution. +The second issue is not of concern because the LFS installation does +not support multibyte character sets. + +Additional information with regards to the compression of +man and info pages can be found in the BLFS book at +http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/ +compressdoc.html. Contents of Man -See testing + +Installed programs +apropos, makewhatis, man, +man2dvi, man2html, and whatis + + +Short Descriptions + + + +apropos + +Searches the whatis database and displays the short descriptions +of system commands that contain a given string +apropos + + + + +makewhatis + +Builds the whatis database; it reads all the manual pages in the +manpath and writes the name and a short description in the whatis +database for each page +makewhatis + + + + +man + +Formats and displays the requested on-line manual page +man + + + + +man2dvi + +Converts a manual page into dvi format +man2dvi + + + + +man2html + +Converts a manual page into HTML +man2html + + + + +whatis + +Searches the whatis database and displays the short descriptions +of system commands that contain the given keyword as a separate +word +whatis + + + + diff --git a/chapter06/mktemp.xml b/chapter06/mktemp.xml index b71176dfb..d478ab874 100644 --- a/chapter06/mktemp.xml +++ b/chapter06/mktemp.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + Mktemp-&mktemp-version; Mktemp +<para>The Mktemp package contains programs used to create secure temporary +files in shell scripts.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,24 +19,42 @@ <seglistitem><seg>0.1 SBU</seg><seg>317 KB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Mktemp installation depends on</segtitle> +<seglistitem><seg>Coreutils, Make, and Patch</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Mktemp -Apply a patch: +Many scripts still use the deprecated +tempfile program, which has functionality similar +to mktemp. Patch Mktemp to include a +tempfile wrapper: patch -Np1 -i ../mktemp-&mktemp-version;-add_tempfile-1.patch -Now prepare Mktemp for compilation: +Prepare Mktemp for compilation: ./configure --prefix=/usr --with-libc +The meaning of the configure option: + + + +--with-libc +This causes the mktemp program to +use the mkstemp and mkdtemp +functions from the system C library. + + + Compile the package: make -Now install it: +Install the package: make install make install-tempfile @@ -44,8 +64,33 @@ make install-tempfile Contents of Mktemp -See testing + +Installed programs +mktemp and tempfile + + +Short Descriptions + + + +mktemp + +Creates temporary files in a secure manner; it is used in scripts +mktemp + + + + +tempfile + +Creates temporary files in a less secure manner than +mktemp; it is installed for backwards-compatibility +tempfile + + + + diff --git a/chapter06/module-init-tools.xml b/chapter06/module-init-tools.xml index d6e84cf5d..26a8a1ad6 100644 --- a/chapter06/module-init-tools.xml +++ b/chapter06/module-init-tools.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + Module-Init-Tools-&module-init-tools-version; Module-Init-Tools +<para>The Module-Init-Tools package contains programs for handling kernel +modules in Linux kernels greater than or equal to version 2.5.47.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +19,11 @@ <seglistitem><seg>0.1 SBU</seg><seg>650 KB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Module-Init-Tools installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Bison, +Coreutils, Diffutils, Flex, GCC, Glibc, Grep, M4, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -30,10 +37,14 @@ <screen><userinput>make DOCBOOKTOMAN=""</userinput></screen> +<!-- Edit me --> +<para>The <command>DOCBOOKTOMAN</command> option allows the compile process to +complete without regenerating the man pages.</para> + <para>To test the results, issue: <userinput>make check</userinput>.</para> -<para>Install it:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -42,8 +53,111 @@ <sect2 id="contents-module-init-tools" role="content"><title>Contents of Module-Init-Tools -See testing + +Installed programs +depmod, genksyms, insmod, +insmod_ksymoops_clean, kallsyms (link to insmod), kernelversion, ksyms +(link to insmod), lsmod (link to insmod), modinfo, modprobe (link to +insmod), and rmmod (link to insmod) + + +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 + + + + +genksyms + +Generates symbol version information +genksyms + + + + +insmod + +Installs a loadable module in the running kernel +insmod + + + + +insmod_ksymoops_clean + +Deletes saved ksyms and modules not accessed for two days +insmod_ksymoops_clean + + + + +kallsyms + +Extracts all kernel symbols for debugging +kallsyms + + + + +kernelversion + +Reports the major version of the running kernel +kernelversion + + + + +ksyms + +Displays exported kernel symbols +ksyms + + + + +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 + + + + diff --git a/chapter06/ncurses.xml b/chapter06/ncurses.xml index 61050f6ca..90ff64b51 100644 --- a/chapter06/ncurses.xml +++ b/chapter06/ncurses.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + Ncurses-&ncurses-version; Ncurses +<para>The Ncurses package contains libraries for terminal-independent +handling of character screens.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +19,11 @@ <seglistitem><seg>0.6 SBU</seg><seg>27 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Ncurses installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +Gawk, GCC, Glibc, Grep, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -30,6 +37,8 @@ <screen><userinput>make</userinput></screen> +<para>This package does not come with a test suite.</para> + <para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -38,15 +47,17 @@ <screen><userinput>chmod 755 /usr/lib/*.&ncurses-version;</userinput></screen> -<para>Now fix a library:</para> +<para>Fix a library that should not be executable:</para> <screen><userinput>chmod 644 /usr/lib/libncurses++.a</userinput></screen> -<para>Move the libraries to the <filename class="directory">/lib</filename> directory:</para> +<para>Move the libraries to the <filename class="directory">/lib</filename> directory, +where they are expected to reside:</para> <screen><userinput>mv /usr/lib/libncurses.so.5* /lib</userinput></screen> -<para>Recreate some symlinks:</para> +<para>Because the libraries have been moved, a few symlinks are pointing to +non-existent files. Recreate those symlinks:</para> <screen><userinput>ln -sf ../../lib/libncurses.so.5 /usr/lib/libncurses.so ln -sf libncurses.so /usr/lib/libcurses.so</userinput></screen> @@ -55,8 +66,149 @@ ln -sf libncurses.so /usr/lib/libcurses.so</userinput></screen> <sect2 id="contents-ncurses" role="content"><title>Contents of Ncurses -See testing + +Installed programs +Installed libraries +captoinfo (link to tic), clear, infocmp, infotocap (link to tic), +reset (link to tset), tack, tic, toe, tput, and tset +libcurses.[a,so] (link to libncurses.[a,so]), libform.[a,so], libmenu.[a,so], +libncurses++.a, libncurses.[a,so], and libpanel.[a,so] + + +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 + + + + +reset + +Reinitializes a terminal to its default values +reset + + + + +tack + +The terminfo action checker; it is mainly used to test the +accuracy of an entry in the terminfo database +tack + + + + +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 + + + + +libcurses + +A link to libncurses +libcurses + + + + +libncurses + +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 +libncurses + + + + +libform + +Contains functions to implement forms +libform + + + + +libmenu + +Contains functions to implement menus +libmenu + + + + +libpanel + +Contains functions to implement panels +libpanel + + + + diff --git a/chapter06/patch.xml b/chapter06/patch.xml index 5d28069f6..d935dfc14 100644 --- a/chapter06/patch.xml +++ b/chapter06/patch.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Patch-&patch-version; Patch +<para>The Patch package contains a program for modifying files.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,12 +18,19 @@ <seglistitem><seg>0.1 SBU</seg><seg>1.9 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Patch installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Patch -Prepare Patch for compilation: +Prepare Patch for compilation. The preprocessor flag +-D_GNU_SOURCE is only needed on the PowerPC +platform. It can be left it out on other architectures: CPPFLAGS=-D_GNU_SOURCE ./configure --prefix=/usr @@ -30,7 +38,9 @@ make -Now install it: +This package does not come with a test suite. + +Install the package: make install @@ -39,8 +49,27 @@ Contents of Patch -See testing + +Installed program +patch + + +Short Descriptions + + + +patch + +Modifies files according to a patch file. A patch file is normally +a difference listing created with the diff program. By applying +these differences to the original files, patch creates the patched +versions. +patch + + + + diff --git a/chapter06/perl.xml b/chapter06/perl.xml index 1bc1397ff..1faa7a9c1 100644 --- a/chapter06/perl.xml +++ b/chapter06/perl.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Perl-&perl-version; Perl +<para>The Perl package contains the Practical Extraction and Report Language.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,24 +18,44 @@ <seglistitem><seg>2.9 SBU</seg><seg>143 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Perl installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +Gawk, GCC, Glibc, Grep, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Perl -Prepare Perl for compilation: +To have full control over the way Perl is set up, run the +interactive Configure script and hand-pick the way +this package is built. If the defaults it auto-detects are suitable, +prepare Perl for compilation with: ./configure.gnu --prefix=/usr -Dpager="/bin/less -isR" +The meaning of the configure option: + + + +-Dpager="/bin/less -isR" +This corrects an error in the perldoc code with the invocation +of the less program. + + + Compile the package: make -Create a basic /etc/hosts file: +To run the test suite, first create a basic +/etc/hosts file which is needed by a couple of +tests to resolve the network name localhost: echo "127.0.0.1 localhost $(hostname)" > /etc/hosts -Run the tests: +Now run the tests, if desired: make test @@ -47,8 +68,257 @@ Contents of Perl -See testing + +Installed programs +Installed libraries +a2p, c2ph, dprofpp, enc2xs, +find2perl, h2ph, h2xs, libnetcfg, perl, perl&perl-version; (link to perl), +perlbug, perlcc, perldoc, perlivp, piconv, pl2pm, pod2html, pod2latex, pod2man, +pod2text, pod2usage, podchecker, podselect, psed (link to s2p), pstruct (link +to c2ph), s2p, splain, and xsubpp +Several hundred which cannot all be listed here + + +Short Descriptions + + + +a2p + +Translates awk to Perl +a2p + + + + +c2ph + +Dumps C structures as generated from cc -g -S +c2ph + + + + +dprofpp + +Displays Perl profile data +dprofpp + + + + +en2cxs + +Builds a Perl extension for the Encode module from either +Unicode Character Mappings or Tcl Encoding Files +en2cxs + + + + +find2perl + +Translates find commands to Perl +find2perl + + + + +h2ph + +Converts .h C header files to +.ph Perl header files +h2ph + + + + +h2xs + +Converts .h C header files to Perl extensions +h2xs + + + + +libnetcfg + +Can be used to configure the libnet +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 + + + + +perlcc + +Generates executables from Perl programs +perlcc + + + + +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 + + + + +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 + + + + +pod2latex + +Converts files from pod format to LaTeX format +pod2latex + + + + +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 + + + + +psed + +A Perl version of the stream editor sed +psed + + + + +pstruct + +Dumps C structures as generated from cc -g -S stabs +pstruct + + + + +s2p + +Translates sed to Perl +s2p + + + + +splain + +Is used to force verbose warning diagnostics in Perl +splain + + + + +xsubpp + +Converts Perl XS code into C code +xsubpp + + + + diff --git a/chapter06/procps.xml b/chapter06/procps.xml index 09dcfafe4..102836c9a 100644 --- a/chapter06/procps.xml +++ b/chapter06/procps.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Procps-&procps-version; Procps +<para>The Procps package contains programs for monitoring processes.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,16 +18,21 @@ <seglistitem><seg>0.1 SBU</seg><seg>6.2 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Procps installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, GCC, Glibc, +Make, and Ncurses</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Procps -Compile Procps: +Compile the package: make -Install it: +Install the package: make install @@ -35,8 +41,152 @@ Contents of Procps -See testing + +Installed programs +Installed library +free, kill, pgrep, pkill, +pmap, ps, skill, snice, sysctl, tload, top, uptime, vmstat, w, and watch +libproc.so + + +Short Descriptions + + + +free + +Reports the amount of free and used memory (both physical and +swap memory) in the system +free + + + + +kill + +Sends signals to processes +kill + + + + +pgrep + +Looks up processes based on their name and other attributes +pgrep + + + + +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 + + + + +skill + +Sends signals to processes matching the given criteria +skill + + + + +snice + +Changes the scheduling priority of processes matching the given criteria +snice + + + + +sysctl + +Modifies kernel parameters at run time +sysctl + + + + +tload + +Prints a graph of the current system load average +tload + + + + +top + +Displays the top CPU 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 + + + + +libproc + +Contains the functions used by most programs in this package +libproc + + + + diff --git a/chapter06/psmisc.xml b/chapter06/psmisc.xml index 5cdaa6c0f..bcceec79a 100644 --- a/chapter06/psmisc.xml +++ b/chapter06/psmisc.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + Psmisc-&psmisc-version; Psmisc +<para>The Psmisc package contains programs for displaying information on +processes.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +19,11 @@ <seglistitem><seg>0.1 SBU</seg><seg>2.2 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Psmisc installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Gettext, Glibc, Grep, Make, Ncurses, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -26,20 +33,44 @@ <screen><userinput>./configure --prefix=/usr --exec-prefix=""</userinput></screen> +<para>The meaning of the configure option:</para> + +<variablelist> +<varlistentry> +<term><parameter>--exec-prefix=""</parameter></term> +<listitem><para>This causes the binaries to be installed in <filename +class="directory">/bin</filename> instead of <filename +class="directory">/usr/bin</filename>. Because the Psmisc programs are +often used in bootscripts, they should be available when the <filename +class="directory">/usr</filename> file system is not +mounted.</para></listitem> +</varlistentry> +</variablelist> + <para>Compile the package:</para> <screen><userinput>make</userinput></screen> -<para>Now install it:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> -<para>Move a program:</para> +<para>There is no reason for the <command>pstree</command> and +<command>pstree.x11</command> programs to reside in <filename +class="directory">/bin</filename>. Therefore, move them to <filename +class="directory">/usr/bin</filename>. Also, there is no need for +<command>pstree.x11</command> to exist as a separate program. Make it +a symbolic link to <command>pstree</command> instead:</para> <screen><userinput>mv /bin/pstree* /usr/bin ln -sf pstree /usr/bin/pstree.x11</userinput></screen> -<para>If you're not going to use Sysvinit, you should create the following symlink:</para> +<para>By default, Psmisc's <command>pidof</command> program is not +installed. This usually is not a problem because it is installed later +in the Sysvinit package, which provides a better +<command>pidof</command> program. If Sysvinit will not be used for a +particular system, complete the installation of Psmisc by creating the +following symlink:</para> <screen><userinput>ln -s killall /bin/pidof</userinput></screen> @@ -48,8 +79,49 @@ ln -sf pstree /usr/bin/pstree.x11</userinput></screen> <sect2 id="contents-psmisc" role="content"><title>Contents of Psmisc -See testing + +Installed programs +fuser, killall, 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 + + + + +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/pwdgroup.xml b/chapter06/pwdgroup.xml index 864c818f3..990fe976e 100644 --- a/chapter06/pwdgroup.xml +++ b/chapter06/pwdgroup.xml @@ -7,13 +7,30 @@ Creating the passwd, group, and log Files -Create the /etc/passwd file: +/etc/passwd +/etc/group +/var/run/utmp +/var/log/btmp +/var/log/lastlog +/var/log/wtmp + +In order for user root to be able to login +and for the name root to be recognized, there need to +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 EOF -Create the /etc/group file: +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: @@ -33,14 +50,49 @@ utmp:x:13: usb:x:14: EOF -Start a new shell: +The created groups are not part of any standard—they are some +of the groups that the Udev configuration will be using in the next +section. 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 packages do not depend on GID numbers, but rather use the +group's name. + +To remove the I have no name! prompt, start a new +shell. Since a full Glibc was installed in and the +/etc/passwd and /etc/group +files have been created, user name and group name resolution will now +work. exec /tools/bin/bash --login +h -Initialize the log files and give them their proper permissions: +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. In order to use the newly compiled +binaries as soon as they are installed, turn off this function 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/run/utmp /var/log/{btmp,lastlog,wtmp} chgrp utmp /var/run/utmp /var/log/lastlog chmod 664 /var/run/utmp /var/log/lastlog +The /var/run/utmp file records the users +that are currently logged in. The /var/log/wtmp +file records all logins and logouts. The +/var/log/lastlog file records when +each user last logged in. The /var/log/btmp file +records the bad login attempts. + + diff --git a/chapter06/readjusting.xml b/chapter06/readjusting.xml index cda2768f1..5d07a94e8 100644 --- a/chapter06/readjusting.xml +++ b/chapter06/readjusting.xml @@ -7,31 +7,99 @@ Re-adjusting the Toolchain -Install the adjusted linker by running the following from within the -binutils-build directory: +Now that the new and final C libraries have been installed, it +is time to adjust the toolchain again. The toolchain will be adjusted +so that it will link any newly compiled program against these new +libraries. This is the same process used in the +Adjusting phase in the beginning of , even though it looks to be +reversed. In , the chain was +guided from the host's /{,usr/}lib directories to the new +/tools/lib directory. Now, the +chain will be guided from that same /tools/lib directory to the LFS +/{,usr/}lib directories. + +Start by adjusting the linker. The source and build directories +from the second pass over Binutils were retained for this purpose. +Install the adjusted linker by running the following command from +within the binutils-build +directory: make -C ld INSTALL=/tools/bin/install install -Amend the GCC specs file: +If the earlier warning to retain the Binutils source and +build directories from the second pass in was missed, or if they were +accidentally deleted or are inaccessible, ignore the above command. +The result will be that the next package, Binutils, will link against +the C libraries in /tools +rather than in /{,usr/}lib. +This is not ideal, however, testing has shown that the resulting +Binutils program binaries should be identical. + +From now on, every compiled program will link only against the +libraries in /usr/lib and +/lib. The extra +INSTALL=/tools/bin/install option is needed +because the Makefile file created during the +second pass still contains the reference to +/usr/bin/install, which has not been installed yet. +Some host distributions contain a ginstall symbolic link which takes +precedence in the Makefile file and can cause a +problem. The above command takes care of this issue. + +Remove the Binutils source and build directories now. + +Next, amend the GCC specs file so that it points to the new +dynamic linker. A perl command accomplishes this: perl -pi -e 's@ /tools/lib/ld-linux.so.2@ /lib/ld-linux.so.2@g;' \ -e 's@\*startfile_prefix_spec:\n@$_/usr/lib/ @g;' \ `gcc --print-file specs` -Perform a simple sanity check: +It is a good idea to visually inspect the specs file to verify the intended +change was actually made. + +If working on a platform where the name of the +dynamic linker is something other than +ld-linux.so.2, substitute +ld-linux.so.2 with the name of the platform's +dynamic linker in the above commands. Refer back to if +necessary. + +It is imperative at this point to stop and ensure that +the basic functions (compiling and linking) of the adjusted toolchain +are working as expected. To do this, perform a sanity +check: echo 'main(){}' > dummy.c cc dummy.c readelf -l a.out | grep ': /lib' -The output of the last command will be: +If everything is working correctly, 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: /lib/ld-linux.so.2] -Once you are satisfied that all is well, clean up the test files: +Note that /lib is now +the prefix of our dynamic linker. -rm dummy.c a.out - +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 amendment +above. Any issues will need to be resolved before continuing on with +the process. +Once everything is working correctly, clean up the test +files: + +rm dummy.c a.out + diff --git a/chapter06/readline.xml b/chapter06/readline.xml index cd15918ec..7c3a1b3d0 100644 --- a/chapter06/readline.xml +++ b/chapter06/readline.xml @@ -3,27 +3,35 @@ %general-entities; ]> - + Readline-&readline-version; Readline +<para>The Readline package contains the Readline command-line library.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> -<seglistitem><seg>XXX SBU</seg><seg>3.8 MB</seg></seglistitem> +<seglistitem><seg>0.11 SBU</seg><seg>3.8 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Readline installation depends on</segtitle> +<seglistitem><seg>Binutils, Coreutils, Diffutils, Gawk, +GCC, Glibc, Grep, Make, Ncurses, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Readline - -Apply a patch. +The following patch includes a fix for the problem where +Readline sometimes only shows 33 characters on a line and then wraps +to the next line. It also includes other fixes recommended by the +Readline author. patch -Np1 -i ../readline-&readline-version;-fixes-1.patch @@ -35,31 +43,71 @@ make SHLIB_XLDFLAGS=-lncurses +The meaning of the make option: + + + +SHLIB_XLDFLAGS=-lncurses +This option forces Readline to link against the +libncurses library. + + + Install the package: make install -Give Readline's dynamic libraries to a more appropriate permissions: +Give Readline's dynamic libraries more appropriate permissions: chmod 755 /lib/lib{readline,history}.so* -Now we move the static libraries to a more appropriate location: +Now we move the static libraries to a more appropriate +location: mv /lib/lib{readline,history}.a /usr/lib -Now we will remove the old, .so files in /lib and relink them into /usr/lib. +Next we will remove the old, .so files in +/lib and relink them into +/usr/lib. rm /lib/lib{readline,history}.so ln -sf ../../lib/libreadline.so.5 /usr/lib/libreadline.so ln -sf ../../lib/libhistory.so.5 /usr/lib/libhistory.so + Contents of Readline + +Installed libraries +libhistory.[a,so], and libreadline.[a,so] + -See testing +Short Descriptions + + + +libhistory + +Provides a consistent user interface +for recalling lines of history +libhistory + + + + +libreadline + +Aids in the consistency of user interface +across discrete programs that need to provide a command line +interface +libreadline + + + + - + diff --git a/chapter06/revisedchroot.xml b/chapter06/revisedchroot.xml index c6afe2bf9..00f627602 100644 --- a/chapter06/revisedchroot.xml +++ b/chapter06/revisedchroot.xml @@ -7,11 +7,38 @@ Cleaning Up -Modified chroot command: +From now on, when reentering the chroot environment after +exiting, use the following modified chroot command: chroot "$LFS" /usr/bin/env -i \ HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /bin/bash --login +The reason for this is that, since the programs in /tools are no longer needed, the +directory can be deleted to regain space. Before actually deleting the +directory, exit from chroot and reenter it with the above command. +Also, before removing /tools, +tar it up and store it in a safe place in case another LFS system will +be built. + +Removing /tools +will also remove the temporary copies of Tcl, Expect, and DejaGNU +which were used for running the toolchain tests. To use these programs +later on, they will need to be recompiled and re-installed. The +installation instructions are the same as in , apart from changing the prefix +from /tools to /usr. The BLFS book discusses a slightly +different approach to installing Tcl (see ). + +The packages and patches stored in /sources can also be moved to a more +usual location, such as /usr/src/packages. The entire directory +can also be deleted if its contents have been burned to a CD. + + diff --git a/chapter06/sed.xml b/chapter06/sed.xml index 2b971d9ce..e16857a5f 100644 --- a/chapter06/sed.xml +++ b/chapter06/sed.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Sed-&sed-version; Sed +<para>The Sed package contains a stream editor.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,11 @@ <seglistitem><seg>0.2 SBU</seg><seg>5.2 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Sed installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, +Diffutils, GCC, Gettext, Glibc, Grep, Make, and Texinfo</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -33,7 +39,7 @@ <para>To test the results, issue: <userinput>make check</userinput>.</para> -<para>Now install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -42,10 +48,24 @@ <sect2 id="contents-sed" role="content"><title>Contents of Sed -See testing + +Installed program +sed + + +Short Descriptions + + + +sed + +Filters and transforms text files in a single pass +sed + + + - - + diff --git a/chapter06/shadow.xml b/chapter06/shadow.xml index 7dc58a043..91948b3a4 100644 --- a/chapter06/shadow.xml +++ b/chapter06/shadow.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + Shadow-&shadow-version; Shadow +<para>The Shadow package contains programs for handling passwords in a secure +way.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +19,11 @@ <seglistitem><seg>0.4 SBU</seg><seg>11 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Shadow installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Bison, Coreutils, +Diffutils, GCC, Gettext, Glibc, Grep, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -26,7 +33,8 @@ <screen><userinput>./configure --libdir=/lib --enable-shared</userinput></screen> -<para>Remove the installation of the groups program, and it's man page:</para> +<para>Remove the installation of the <command>groups</command> program, and its man page as +Coreutils provides a better version:</para> <screen><userinput>sed -i 's/groups$(EXEEXT) //' src/Makefile sed -i '/groups/d' man/Makefile</userinput></screen> @@ -35,31 +43,48 @@ sed -i '/groups/d' man/Makefile</userinput></screen> <screen><userinput>make</userinput></screen> -<para>Then install it:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> -<para>Install two config files:</para> +<para id="shadow-limits-login_access">Shadow uses two files to configure +authentication settings for the system. Install these two config files:</para> + +<indexterm zone="shadow-limits-login_access"><primary sortas="e-/etc/limits">/etc/limits</primary></indexterm> +<indexterm zone="shadow-limits-login_access"><primary sortas="e-/etc/login.access">/etc/login.access</primary></indexterm> <screen><userinput>cp etc/{limits,login.access} /etc</userinput></screen> -<para>Change a configuration file while copying it:</para> +<para id="shadow-login_defs">Instead of using the default <emphasis>crypt</emphasis> method, +use the more secure <emphasis>MD5</emphasis> method of password +encryption, which also allows passwords longer than 8 characters. It +is also necessary to change the obsolete <filename +class="directory">/var/spool/mail</filename> location for user +mailboxes that Shadow uses by default to the <filename +class="directory">/var/mail</filename> location used currently. Both +of these can be accomplished by changing the relevant configuration +file while copying it to its destination:</para> + +<indexterm zone="shadow-login_defs"><primary sortas="e-/etc/login.defs">/etc/login.defs</primary></indexterm> <screen><userinput>sed -e's@#MD5_CRYPT_ENAB.no@MD5_CRYPT_ENAB yes@' \ -e 's@/var/spool/mail@/var/mail@' \ etc/login.defs.linux > /etc/login.defs</userinput></screen> -<para>Move a program:</para> +<para>Move a misplaced program to its proper location:</para> <screen><userinput>mv /usr/bin/passwd /bin</userinput></screen> -<para>Move the library:</para> +<para>Move Shadow's libraries to more appropriate locations:</para> <screen><userinput>mv /lib/libshadow.*a /usr/lib rm /lib/libshadow.so ln -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen> -<para>Create a dir:</para> +<para>The <parameter>-D</parameter> option of the +<command>useradd</command> program requires the <filename +class="directory">/etc/default</filename> directory for it to work +properly:</para> <screen><userinput>mkdir /etc/default</userinput></screen> @@ -67,8 +92,21 @@ ln -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen> <sect2 id="conf-shadow" role="configuration"><title>Configuring Shadow + +Shadow +configuring -To enable shadowed passwords: +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 @@ -76,23 +114,313 @@ ln -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so grpconv +Under normal circumstances, passwords will not have been created +yet. However, if returning to this section later to enable shadowing, +reset any current user passwords with the passwd +command or any group passwords with the gpasswd +command. + Setting the root password -Choose a password for user root and set it via: +Choose a password for user root and set it +by running: passwd root - Contents of Shadow -See testing + +Installed programs +Installed libraries +chage, chfn, chpasswd, chsh, expiry, faillog, gpasswd, +groupadd, groupdel, groupmod, groups, grpck, grpconv, grpunconv, lastlog, login, +logoutd, mkpasswd, newgrp, newusers, passwd, pwck, pwconv, pwunconv, sg +(link to newgrp), useradd, userdel, usermod, vigr (link to vipw), and vipw +libshadow[.a,so] + + + +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 info +chfn + + + + +chpasswd + +Used to update the passwords of an entire series of user +accounts +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 + + + + +groupmod + +Is used to modify the given group's name or GID +groupmod + + + + +groups + +Reports the groups of which the given users are members +groups + + + + +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 + + + + +mkpasswd + +Generates random passwords +mkpasswd + + + + +newgrp + +Is used to change the current GID during a login session +newgrp + + + + +newusers + +Is used to create or update an entire series of user accounts +newusers + + + + +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 + +su +Runs a shell with substitute user and group IDs + + + + +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 + + + + +libshadow + +Contains functions used by most programs in this package +libshadow + + + + diff --git a/chapter06/strippingagain.xml b/chapter06/strippingagain.xml index e0531df3e..f6c5fa2ec 100644 --- a/chapter06/strippingagain.xml +++ b/chapter06/strippingagain.xml @@ -1,24 +1,54 @@ - + + %general-entities; +]> Stripping Again -Exit from chroot: +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 200 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 command 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 command, it is a good idea to make a +backup of the current situation. + +Before performing the stripping, take special care to ensure that +none of the binaries that are about to be stripped are running. If +unsure whether the user entered chroot with the command given in + first exit from +chroot: logout -Reenter with: +Then reenter it with: chroot $LFS /tools/bin/env -i \ HOME=/root TERM=$TERM PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin \ /tools/bin/bash --login -Strip the binaries and libraries: +Now the binaries and libraries can be safely stripped: /tools/bin/find /{,usr/}{bin,lib,sbin} -type f \ -exec /tools/bin/strip --strip-debug '{}' ';' +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. + +If disk space is very tight, the +--strip-all option can be used on the binaries +in /{,usr/}{bin,sbin} to gain +several more megabytes. Do not use this option on libraries—they will +be destroyed. + diff --git a/chapter06/syslogng.xml b/chapter06/syslogng.xml index 249fdbc99..04b432af6 100644 --- a/chapter06/syslogng.xml +++ b/chapter06/syslogng.xml @@ -10,6 +10,8 @@ Syslog-ng +<para>The Syslog-ng package contains programs for logging system messages, such +as those given by the kernel when unusual things happen.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +19,10 @@ <seglistitem><seg>Unchecked</seg><seg>Unchecked</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Syslog-ng installation depends on</segtitle> +<seglistitem><seg>Unchecked</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -26,11 +32,11 @@ <screen><userinput>./configure --prefix=/usr --sysconfdir=/etc</userinput></screen> -<para>Compile Syslog-ng:</para> +<para>Compile the package:</para> <screen><userinput>make</userinput></screen> -<para>Now install it:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -38,8 +44,14 @@ <sect2 id="conf-syslogng" role="configuration"><title>Configuring Syslog-ng + +Syslog-ng +configuring -Create a /etc/syslog-ng/syslog-ng.conf file: +/etc/syslog-ng/syslog-ng.conf + +Create a new /etc/syslog-ng/syslog-ng.conf file by +running the following: mkdir -p /etc/syslog-ng cat > /etc/syslog-ng/syslog-ng.conf << "EOF" @@ -121,7 +133,26 @@ EOF Contents of Syslog-ng -See testing + +Installed programs +Unchecked + + +Short Descriptions + + + +syslog-ng + +syslog-ng +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. + + + + diff --git a/chapter06/sysvinit.xml b/chapter06/sysvinit.xml index b3cfab986..65af49d7f 100644 --- a/chapter06/sysvinit.xml +++ b/chapter06/sysvinit.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + 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> @@ -17,21 +19,34 @@ <seglistitem><seg>0.1 SBU</seg><seg> 0.9 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Sysvinit installation depends on</segtitle> +<seglistitem><seg>Binutils, Coreutils, GCC, Glibc, and Make</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Sysvinit -Issue a sed sustitution: +When run-levels are changed (for example, when halting the +system), init sends termination signals to those +processes that init itself started and that should +not be running in the new run-level. While doing this, +init outputs messages like Sending processes +the TERM signal which seem to imply that it is sending these +signals to all currently running processes. To avoid this +misinterpretation, modify the source so that these messages read like +Sending processes started by init the TERM signal +instead: sed -i 's@Sending processes@& started by init@g' \ src/init.c -Compile Sysvinit: +Compile the package: make -C src -Then install it: +Install the package: make -C src install @@ -39,8 +54,14 @@ Configuring Sysvinit + +Sysvinit +configuring -Create a /etc/inittab file: +/etc/inittab + +Create a new file /etc/inittab by running the +following: cat > /etc/inittab << "EOF" # Begin /etc/inittab @@ -71,14 +92,90 @@ su:S016:once:/sbin/sulogin # End /etc/inittab EOF +The -I '\033(K' option tells +agetty to send this escape sequence to the terminal +before doing anything else. This escape sequence switches the console +character set to a user-defined one, which can be modified by running +the setfont program. The console +initscript from the LFS-Bootscripts package calls the setfont +program during system startup. Sending this escape sequence is +necessary for people who use non-ISO 8859-1 screen fonts, but it does +not effect native English speakers. + Contents of Sysvinit -See testing + +Installed programs +halt, init, killall5, last, lastb (link to last), mesg, pidof (link to +killall5), poweroff (link to halt), reboot (link to halt), runlevel, shutdown, sulogin, telinit +(link to init), utmpdump, and wall + - + +pidof + +Reports the PIDs of the given programs +pidof + + + + +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 + + + + +sulogin + +Allows root to log in; it is +normally invoked by init when the system goes into single user mode +sulogin + + + + +telinit + +Tells init which run-level to change to +telinit + + + + +utmpdump + +Displays the content of the given login file in a more +user-friendly format +utmpdump + + + + +wall + +Writes a message to all logged-in users +wall + + + + diff --git a/chapter06/tar.xml b/chapter06/tar.xml index 48c821b2f..9c6b581b5 100644 --- a/chapter06/tar.xml +++ b/chapter06/tar.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Tar-&tar-version; Tar +<para>The Tar package contains an archiving program.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +18,11 @@ <seglistitem><seg>0.2 SBU</seg><seg>10 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Tar installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, +Diffutils, GCC, Gettext, Glibc, Grep, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -33,7 +39,7 @@ <para>To test the results, issue: <userinput>make check</userinput>.</para> -<para>Now install the package:</para> +<para>Install the package:</para> <screen><userinput>make install</userinput></screen> @@ -42,8 +48,33 @@ <sect2 id="contents-tar" role="content"><title>Contents of Tar -See testing + +Installed programs +rmt and tar + + +Short Descriptions + + + +rmt + +Remotely manipulates a magnetic +tape drive through an interprocess communication connection +rmt + + + + +tar + +Creates and extracts files from archives, also known as tarballs +tar + + + + diff --git a/chapter06/texinfo.xml b/chapter06/texinfo.xml index 65b0a6d9d..7560a62a0 100644 --- a/chapter06/texinfo.xml +++ b/chapter06/texinfo.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + Texinfo-&texinfo-version; Texinfo +<para>The Texinfo package contains programs for reading, writing, and +converting Info documents.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,6 +19,11 @@ <seglistitem><seg>0.2 SBU</seg><seg>17 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Texinfo installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, +Diffutils, GCC, Gettext, Glibc, Grep, Make, Ncurses, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> @@ -37,12 +44,29 @@ <screen><userinput>make install</userinput></screen> -<para>Optionally install the components belonging in a TeX installation:</para> +<para>Optionally, install the components belonging in a TeX installation:</para> <screen><userinput>make TEXMF=/usr/share/texmf install-tex</userinput></screen> -<para>If ever you need to recreate the -<filename>/usr/share/info/dir</filename> file, run this:</para> +<para>The meaning of the make parameter:</para> + +<variablelist> +<varlistentry> +<term><parameter>TEXMF=/usr/share/texmf</parameter></term> +<listitem><para>The <envar>TEXMF</envar> makefile variable holds the location of the +root of the TeX tree if, for example, a TeX package will be installed +later.</para></listitem> +</varlistentry> +</variablelist> + +<para>The Info documentation system uses a plain text file to hold its +list of menu entries. The file is located at +<filename>/usr/share/info/dir</filename>. Unfortunately, due to +occasional problems in the Makefiles of various packages, it can +sometimes get out of step with the Info manuals installed on the +system. If the <filename>/usr/share/info/dir</filename> file ever +needs to be recreated, the following optional commands will accomplish +the task:</para> <screen><userinput>cd /usr/share/info rm dir @@ -52,11 +76,74 @@ done</userinput></screen> </sect2> - <sect2 id="contents-texinfo" role="content"><title>Contents of Texinfo -See testing + +Installed programs +info, infokey, install-info, +makeinfo, texi2dvi, and texindex + + +Short Descriptions + + + +info + +Used to read Info documents which are similar to man +pages, but often go much deeper than just explaining all the command +line options. For example, compare man bison and +info bison. +info + + + + +infokey + +Compiles a source file containing Info customizations into a +binary format +infokey + + + + +install-info + +Used to install Info files; it updates entries in the Info index +file +install-info + + + + +makeinfo + +Translates the given Texinfo source documents into +info files, plain text, or HTML +makeinfo + + + + +texi2dvi + +Used to format the given Texinfo document into a +device-independent file that can be printed +texi2dvi + + + + +texindex + +Used to sort Texinfo index files +texindex + + + + diff --git a/chapter06/udev.xml b/chapter06/udev.xml index b1a34c51d..e25ed756d 100644 --- a/chapter06/udev.xml +++ b/chapter06/udev.xml @@ -10,6 +10,7 @@ Udev +<para>The Udev package contains programs for dynamic creation of device nodes.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,36 +18,128 @@ <seglistitem><seg>0.2 SBU</seg><seg>5.2 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Udev installation depends on</segtitle> +<seglistitem><seg>Coreutils and Make</seg></seglistitem> +</segmentedlist> + </sect2> <sect2 role="installation"> <title>Installation of Udev -Compile Udev: +Compile the package: make udevdir=/dev -Install it: + + +udevdir=/dev +This tells udev in which directory +devices nodes are to be created. + + + +This package does not come with a test suite. + +Install the package: make udevdir=/dev install -Install our configuration files: +Udev's configuration is far from ideal by default, so install +the configuration files here: cp ../udev-config-2.permissions \ /etc/udev/permissions.d/25-lfs.permissions cp ../udev-config-1.rules /etc/udev/rules.d/25-lfs.rules -Create the full compliment of device nodes: + +Run the udevstart program to create our full +compliment of device nodes. /sbin/udevstart - Contents of Udev -See testing + +Installed programs +Installed directory +udev, udevd, udevsend, udevstart, udevinfo, and udevtest +/etc/udev + +Short Descriptions + + + +udev + +Creates device nodes in /dev or renames network interfaces (not +in LFS) in response to hotplug events +udev + + + +udevd + +A daemon that reorders hotplug events before submitting them to +udev, +thus avoiding various race conditions +udevd + + + +udevsend + +Delivers hotplug events to udevd +udevsend + + + +udevstart + +Creates device nodes in /dev that correspond to drivers compiled directly +into the kernel; it performs that task by simulating hotplug events presumably +dropped by the kernel before invocation of this program (e.g., because the root +filesystem has not been mounted) and submitting such synthetic hotplug events +to udev +udevstart + + + + +udevinfo + +Allows users to query the udev database for +information on any device currently present on the system; it also +provides a way to query any device in the sysfs tree to help create udev +rules +udevinfo + + + +udevtest + +Simulates a udev run for the given device, +and prints out the name of the node the real udev would +have created or (not in LFS) the name of the renamed network interface +udevtest + + + +/etc/udev + +Contains udev configuation files, +device permissions, and rules for device naming +/etc/udev + + + diff --git a/chapter06/util-linux.xml b/chapter06/util-linux.xml index 8ea6d5b2b..fcdc35383 100644 --- a/chapter06/util-linux.xml +++ b/chapter06/util-linux.xml @@ -3,13 +3,16 @@ %general-entities; ]> - + 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> @@ -17,12 +20,22 @@ <seglistitem><seg>0.2 SBU</seg><seg>16 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Util-linux installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, +Diffutils, GCC, Gettext, Glibc, Grep, Make, Ncurses, Sed, and Zlib</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>FHS compliance notes -Issue a sed sustitution: +The FHS recommends using the /var/lib/hwclock directory instead of the +usual /etc directory as the +location for the adjtime file. To make the +hwclock program FHS-compliant, run the +following: sed -i 's@etc/adjtime@var/lib/hwclock/adjtime@g' \ hwclock/hwclock.c @@ -46,17 +59,566 @@ linux-libc-headers. The following patch properly fixes that issue make HAVE_KILL=yes HAVE_SLN=yes -Now install the package: +The meaning of the make parameters: + + + +HAVE_KILL=yes +This prevents the +kill program (already installed by Procps) from being +built and installed again. + + + +HAVE_SLN=yes +This prevents the sln program (a +statically linked version of ln already installed +by Glibc) from being built and installed again. + + + +This package does not come with a test suite. + +Install the package: make HAVE_KILL=yes HAVE_SLN=yes install - Contents of Util-linux -See testing + +Installed programs +agetty, arch, blockdev, cal, cfdisk, chkdupexe, col, colcrt, +colrm, column, ctrlaltdel, cytune, ddate, dmesg, elvtune, fdformat, fdisk, +fsck.cramfs, fsck.minix, getopt, hexdump, hwclock, ipcrm, ipcs, isosize, line, +logger, look, losetup, mcookie, mkfs, mkfs.bfs, mkfs.cramfs, mkfs.minix, mkswap, +more, mount, namei, pg, pivot_root, ramsize (link to rdev), raw, rdev, readprofile, +rename, renice, rev, rootflags (link to rdev), script, setfdprm, setsid, setterm, +sfdisk, swapdev, swapoff (link to swapon), swapon, tunelp, ul, umount, vidmode (link to rdev), +whereis, and write + + +Short Descriptions + + + +agetty + +Opens a tty port, prompts for a login name, +and then invokes the login program +agetty + + + + +arch + +Reports the machine's architecture +arch + + + + +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 + + + + +chkdupexe + +Finds duplicate executables +chkdupexe + + + + +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 + + + + +cytune + +Tunes the parameters of the serial line drivers for +Cyclades cards +cytune + + + + +ddate + +Gives the Discordian date or converts the given Gregorian date +to a Discordian one +ddate + + + + +dmesg + +Dumps the kernel boot messages +dmesg + + + + +elvtune + +Tunes the performance and interactivity of a block +device +elvtune + + + + +fdformat + +Low-level formats a floppy disk +fdformat + + + + +fdisk + +Manipulates the partition table of the given device +fdisk + + + + +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 + + + + +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 + + + + +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 + + + + +line + +Copies a single line +line + + + + +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 + + + + +mcookie + +Generates magic cookies (128-bit random hexadecimal numbers) for +xauth +mcookie + + + + +mkfs + +Builds a file system on a device (usually a hard disk +partition) +mkfs + + + + +mkfs.bfs + +Creates an 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 + + + + +namei + +Shows the symbolic links in the given pathnames +namei + + + + +pg + +Displays a text file one screen full at a time +pg + + + + +pivot_root + +Makes the given file system the new root file system of the +current process +pivot_root + + + + +ramsize + +Sets the size of the RAM disk in a bootable image +ramsize + + + + +raw + +Used to bind a Linux raw character device to a block +device +raw + + + + +rdev + +Queries and sets the root device, among other things, in a +bootable image +rdev + + + + +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 + + + + +rev + +Reverses the lines of a given file +rev + + + + +rootflags + +Sets the rootflags in a bootable image +rootflags + + + + +script + +Makes a typescript of a terminal session +script + + + + +setfdprm + +Sets user-provided floppy disk parameters +setfdprm + + + + +setsid + +Runs the given program in a new session +setsid + + + + +setterm + +Sets terminal attributes +setterm + + + + +sfdisk + +A disk partition table manipulator +sfdisk + + + + +swapdev + +Sets the swap device in a bootable image +swapdev + + + + +swapoff + +Disables devices and files for paging and swapping +swapoff + + + + +swapon + +Enables devices and files for paging and swapping +swapon + + + + +tunelp + +Tunes the parameters of the line printer +tunelp + + + + +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 + + + + +vidmode + +Sets the video mode in a bootable image +vidmode + + + + +whereis + +Reports the location of binary, the source, and the manual page +for the given command +whereis + + + + +write + +Sends a message to the given user +if that user has not disabled receipt of such messages +write + + + + diff --git a/chapter06/vim.xml b/chapter06/vim.xml index aeeaf535c..ec263cced 100644 --- a/chapter06/vim.xml +++ b/chapter06/vim.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + Vim-&vim-version; Vim +<para>The Vim package contains a powerful text editor.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,12 +18,30 @@ <seglistitem><seg>0.4 SBU</seg><seg>34 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Vim installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Diffutils, +GCC, Glibc, Grep, Make, Ncurses, and Sed</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 -Change the default locations of the configuration files: +First, unpack both +vim-&vim-version;.tar.bz2 and (optionally) +vim-&vim-version;-lang.tar.gz archives into the +same directory. Then, change the default locations of the +vimrc and gvimrc +configuration files to /etc: echo '#define SYS_VIMRC_FILE "/etc/vimrc"' >> src/feature.h echo '#define SYS_GVIMRC_FILE "/etc/gvimrc"' >> src/feature.h @@ -36,28 +55,56 @@ following patch fixes the problem: ./configure --prefix=/usr --enable-multibyte +The optional but highly recommended +--enable-multibyte switch includes support for +editing files in multibyte character encodings into +vim. This is needed if using a locale with +a multibyte character set. This switch is also helpful to be able to +edit text files initially created in Linux distributions like Fedora +Core that use UTF-8 as a default character set. + Compile the package: make To test the results, issue: -make test +make test. However, this test suite outputs a +lot of chaotic characters to the screen, which can cause issues with +the settings of the current terminal. Therefore, running the test +suite here is optional. -Now install the package: +Install the package: make install -Create a symlink: +Many users are used to using vi instead of +vim. To allow execution of vim +when users habitually enter vi, create a +symlink: ln -s vim /usr/bin/vi +If the 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/vim -Create a default vim configuration file by running -the following: +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 appear +first. 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 @@ -65,7 +112,6 @@ the following: set nocompatible set backspace=2 syntax on - if (&term == "iterm") || (&term == "putty") set background=dark endif @@ -73,32 +119,215 @@ endif " End /etc/vimrc EOF - - -Documentation for other available options can be obtained by running -the following command: +Documentation for other available options can be obtained by +running the following command: vim -c ':options' - Contents of Vim -See testing + +Installed programs +efm_filter.pl, efm_perl.pl, ex (link to vim), less.sh, mve.awk, +pltags.pl, ref, rview (link to vim), rvim (link to vim), shtags.pl, tcltags, vi (link to vim), +view (link to vim), vim, vim132, vim2html.pl, vimdiff (link to vim), vimm, vimspell.sh, +vimtutor, and xxd + + +Short Descriptions + + + +efm_filter.pl + +A filter for creating an error file that can be read by vim +efm_filter.pl + + + + +efm_perl.pl + +Reformats the error messages of the +Perl interpreter for use with the quickfix mode of vim +efm_perl.pl + + + + +ex + +Starts vim in ex mode +ex + + + + +less.sh + +A script that starts vim with less.vim +less.sh + + + + +mve.awk + +Processes vim errors +mve.awk + + + + +pltags.pl + +Creates a tags file for Perl code for use by vim +pltags.pl + + + + +ref + +Checks the spelling of arguments +ref + + + + +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 + + + + +shtags.pl + +Generates a tag file for Perl scripts +shtags.pl + + + + +tcltags + +Generates a tag file for TCL code +tcltags + + + + +view + +Starts vim in read-only mode +view + + + + +vi + +Is the editor +vi + + + + +vim + +Is the editor +vim + + + + +vim132 + +Starts vim with the terminal in 132-column mode +vim132 + + + + +vim2html.pl + +Converts Vim documentation to HypterText Markup Language (HTML) +vim2html.pl + + + + +vimdiff + +Edits two or three versions of a file with vim and show differences +vimdiff + + + + +vimm + +Enables the DEC locator input model on a remote terminal +vimm + + + + +vimspell.sh + +Spells a file and generates the syntax statements necessary +to highlight in vim. This script requires the old Unix spell +command, which is provided neither in LFS nor in BLFS +vimspell.sh + + + + +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/zlib.xml b/chapter06/zlib.xml index 606751c8d..77c731ba9 100644 --- a/chapter06/zlib.xml +++ b/chapter06/zlib.xml @@ -3,13 +3,15 @@ %general-entities; ]> - + Zlib-&zlib-version; Zlib +<para>The Zlib package contains compression and un-compression routines used by +some programs.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,12 +19,22 @@ <seglistitem><seg>0.1 SBU</seg><seg>1.5 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Zlib installation depends on</segtitle> +<seglistitem><seg>Binutils, Coreutils, GCC, Glibc, Make, and Sed</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of Zlib - +Zlib is known to build its shared library incorrectly if +CFLAGS is specified in the environment. If using a +specified CFLAGS +variable, be sure to add the -fPIC directive to +the CFLAGS variable for the duration of the +configure command below, then remove it afterwards. + Prepare Zlib for compilation: ./configure --prefix=/usr --shared --libdir=/lib @@ -38,25 +50,27 @@ make install -Now we will remove the old, .so files in /lib and relink them into /usr/lib. +Next we will remove the old, .so files in +the /lib directory and relink them +into /usr/lib. rm /lib/libz.so ln -sf ../../lib/libz.so.&zlib-version; /usr/lib/libz.so -Now also build the non-shared (static) library: +Build the static library: make clean ./configure --prefix=/usr make -To again test the results, issue: +To test the results again, issue: make check. Install the static library: make install -And fix the permissions on the static library: +Fix the permissions on the static library: chmod 644 /usr/lib/libz.a @@ -65,8 +79,25 @@ make Contents of Zlib -See testing + +Installed libraries +libz[a,so] + + +Short Descriptions + + + +libz + +Contains compression and un-compression +functions used by some programs +libz + + + + diff --git a/chapter07/bootscripts.xml b/chapter07/bootscripts.xml index 171330018..71d3a353f 100644 --- a/chapter07/bootscripts.xml +++ b/chapter07/bootscripts.xml @@ -3,13 +3,14 @@ %general-entities; ]> - + LFS-Bootscripts-&lfs-bootscripts-version; Bootscripts +<para>The LFS-Bootscripts package contains a set of bootscripts.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> @@ -17,22 +18,220 @@ <seglistitem><seg>0.1 SBU</seg><seg>0.3 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>LFS-Bootscripts installation depends on</segtitle> +<seglistitem><seg>Bash and Coreutils</seg></seglistitem> +</segmentedlist> </sect2> <sect2 role="installation"> <title>Installation of LFS-Bootscripts -Installation of the bootscripts is very simple: +Install the package: make install - Contents of LFS-bootscripts -See testing + +Installed scripts +checkfs, cleanfs, console, functions, halt, ifdown, ifup, +localnet, mountfs, mountkernfs, network, rc, reboot, sendsignals, setclock, static, +swap, sysklogd, template, and udev + + +Short Descriptions + + + +checkfs + +Checks 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 keymap table specified as proper for the keyboard +layout; it also sets the screen font +console + + + + +functions + +Contains functions shared among different scripts, such as error +and status checking +functions + + + + +halt + +Halts the system +halt + + + + +hotplug + +Load modules for system devices +hotplug + + + + +ifdown + +Assists the network script with network devices +ifdown + + + + +ifup + +Assists the network script with network devices +ifup + + + + +localnet + +Sets up the system's hostname and local loopback device +localnet + + + + +mountfs + +Mounts all file systems, except ones that are marked +noauto or are network based +mountfs + + + + +mountkernfs + +Is used to mount kernel-provided file systems, such as +proc +mountkernfs + + + + +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 other scripts 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 + + + + +static + +Provides the functionality needed to assign a static Internet +Protocol (IP) address to a network interface +static + + + + +swap + +Enables and disables swap files and partitions +swap + + + + +syslog-ng + +Starts and stops the system and kernel log daemons +syslog-ng + + + + +template + +A template to create custom bootscripts for other +daemons +template + + + + +udev + +Sets up udev and create the devices nodes in /dev +udev + + + + diff --git a/chapter07/console.xml b/chapter07/console.xml index 3e5bfdc22..8e59c4bc9 100644 --- a/chapter07/console.xml +++ b/chapter07/console.xml @@ -7,15 +7,66 @@ Configuring the Linux Console -Create the configuration file: + +console +configuring + +This section discusses how to configure the +console initscript that sets up the keyboard map +and the console font. If non-ASCII characters (British pound and Euro +character are examples of non-ASCII characters) will not be used and +the keyboard is a U.S. one, skip this section. Without the +configuration file, the console initscript will do nothing. + +The console script uses the +/etc/sysconfig/console as a configuration file. +Decide which keymap and screen font will be used. The +language-specific HOWTO can help with this. A pre-made +/etc/sysconfig/console file with known settings +for several countries was installed with the LFS-Bootscripts package, +so the relevant section can be uncommented if the country is +supported. If still in doubt, look in the /usr/share/kbd directory for valid +keymaps and screen fonts. Read the loadkeys and setfont manual pages +and determine the correct arguments for these programs. Once decided, +create the configuration file with the following command: cat >/etc/sysconfig/console <<"EOF" KEYMAP="[arguments for loadkeys]" FONT="[arguments for setfont]" EOF -If you see that keycode 14 is Backspace and not Delete, -create the following keymap snippet to fix this issue: +For example, for Spanish users who also want to use the Euro +character (accessible by pressing AltGr+E), the following settings are +correct: + +cat >/etc/sysconfig/console <<"EOF" +KEYMAP="es euro2" +FONT="lat9-16 -u iso01" +EOF + +The FONT line above is correct only for the ISO 8859-15 +character set. If using ISO 8859-1 and, therefore, a pound sign +instead of Euro, the correct FONT line would be: + +FONT="lat1-16" + +If the KEYMAP or FONT variable is not set, the +console initscript will not run the corresponding +program. + +In some keymaps, the Backspace and Delete keys send characters +different from ones in the default keymap built into the kernel. This +confuses some applications. For example, +Emacs displays its help (instead of erasing +the character before the cursor) when Backspace is pressed. To check +if the keymap in use is effected (this works only for i386 +keymaps): + +zgrep '\W14\W' [/path/to/your/keymap] + +If the keycode 14 is Backspace instead of Delete, create the +following keymap snippet to fix this issue: mkdir -p /etc/kbd && cat > /etc/kbd/bs-sends-del <<"EOF" keycode 14 = Delete Delete Delete Delete @@ -27,12 +78,32 @@ create the following keymap snippet to fix this issue: altgr control alt keycode 111 = Boot EOF -Then tell the console script to load this snippet -after the main keymap: +Tell the console script to load this +snippet after the main keymap: cat >>/etc/sysconfig/console <<"EOF" KEYMAP_CORRECTION="/etc/kbd/bs-sends-del" EOF +To compile the keymap directly into the kernel instead of +setting it every time from the console bootscript, +follow the instructions given in +Doing this ensures that the keyboard will always work as expected, +even when booting into maintenance mode (by passing +init=/bin/sh to the kernel), because the +console bootscript will not be run in that +situation. Additionally, the kernel will not set the screen font +automatically. This should not pose many problems because ASCII characters +will be handled correctly, and it is unlikely that a user would need +to rely on non-ASCII characters while in maintenance mode. + +Since the kernel will set up the keymap, it is possible to omit +the KEYMAP variable from the +/etc/sysconfig/console configuration file. It can +also be left in place, if desired, without consequence. Keeping it +could be beneficial if running several different kernels where it is +difficult to ensure that the keymap is compiled into every one of +them. + diff --git a/chapter07/hostname.xml b/chapter07/hostname.xml index 5b299f335..46c083a43 100644 --- a/chapter07/hostname.xml +++ b/chapter07/hostname.xml @@ -7,10 +7,22 @@ Configuring the localnet Script + +localnet +configuring + +Part of the localnet script is setting up the system's hostname. This +needs to be configured in the /etc/sysconfig/network. Create the /etc/sysconfig/network file and enter a hostname by running: echo "HOSTNAME=[lfs]" > /etc/sysconfig/network +[lfs] needs to be replaced with the +name the computer is to be called. Do not enter the Fully Qualified +Domain Name (FQDN) here. That information will be put in the +/etc/hosts file later. + + diff --git a/chapter07/hosts.xml b/chapter07/hosts.xml index bc81d39e8..b2a77c0c0 100644 --- a/chapter07/hosts.xml +++ b/chapter07/hosts.xml @@ -7,8 +7,42 @@ Creating the /etc/hosts File -If a network card is to be configured, create the -/etc/hosts file by running: +/etc/hosts + + +localnet +/etc/hosts + + +network +/etc/hosts + +If a network card is to be configured, decide on the IP-address, +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 (e.g., +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: + + Class Networks + A 10.0.0.0 + B 172.16.0.0 through 172.31.0.0 + C 192.168.0.0 through 192.168.255.0 + +A valid IP address could be 192.168.1.1. A valid FQDN for this +IP could be www.linuxfromscratch.org (not recommended because this is +a valid registered domain address and could cause domain name server +issues). + +Even if not using a network card, an 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 (network card version) @@ -19,6 +53,12 @@ # End /etc/hosts (network card version) EOF +The [192.168.1.1] and +[<HOSTNAME>.example.org] +values need to be changed for specific users or requirements (if +assigned an IP address by a network/system administrator and the +machine will be connected to an existing network). + If a network card is not going to be configured, create the /etc/hosts file by running: @@ -31,3 +71,4 @@ EOF EOF + diff --git a/chapter07/inputrc.xml b/chapter07/inputrc.xml index 62fcb3173..200f9a31b 100644 --- a/chapter07/inputrc.xml +++ b/chapter07/inputrc.xml @@ -7,7 +7,45 @@ Creating the /etc/inputrc File -Create the /etc/inputrc file: +/etc/inputrc + +The /etc/inputrc file deals with mapping +the keyboard for specific situations. This file is the start-up file +used by Readline, the input-related +library used by Bash and most other +shells. + +For more information, see the bash info page, section +Readline Init File. The readline info page is +also a good source of information. + +Global values are set in /etc/inputrc. +Personal user values are set in ~/.inputrc. The +~/.inputrc file will override the global settings +file. A later page sets up Bash to use +/etc/inputrc if there is no +.inputrc for a user when +/etc/profile is read (usually at login). To make +the system use both, or to negate global keyboard handling, it is a +good idea to place a default .inputrc into the +/etc/skel directory for use +with new users. + +Below is a base /etc/inputrc, along with +comments to explain what the various options do. Note that comments +cannot be on the same line as commands. + +To create the .inputrc in /etc/skel using the command below, change +the command's output to /etc/skel/.inputrc and be sure to +check/set permissions afterward. Copy that file to +/etc/inputrc and the home directory of any user +already existing on the system, including root, +that needs a private version of the file. Be certain to use the +-p parameter of cp to +maintain permissions and be sure to change owner and group +appropriately. cat > /etc/inputrc << "EOF" # Begin /etc/inputrc @@ -56,3 +94,4 @@ set bell-style none EOF + diff --git a/chapter07/introduction.xml b/chapter07/introduction.xml index bfff7e7c7..b4c8ea547 100644 --- a/chapter07/introduction.xml +++ b/chapter07/introduction.xml @@ -7,6 +7,21 @@ Introduction -See testing +This chapter details how to install the bootscripts and set them up +properly. Most of these scripts will work without modification, but a +few require additional configuration files because they deal with +hardware-dependent information. + +System-V style init scripts are employed in this book because they are +widely used. For additional options, a hint detailing the BSD style +init setup is available at +. +Searching the LFS mailing lists for depinit will also offer +additional choices. + +If using an alternate style of init scripts, skip this chapter +and move on to . + diff --git a/chapter07/network.xml b/chapter07/network.xml index 3a86d1a20..304341033 100644 --- a/chapter07/network.xml +++ b/chapter07/network.xml @@ -7,12 +7,43 @@ Configuring the network Script + +network +configuring + +This section only applies if a network card is to be +configured. + +If a network card will not be used, there is likely no need to +create any configuration files relating to network cards. If that is +the case, remove the network +symlinks from all run-level directories (/etc/rc.d/rc*.d). Creating Network Interface Configuration Files -The following command creates a sample ipv4 file for the -eth0 device: + +Which interfaces are brought up and down by the network script +depends on the files and directories in the /etc/sysconfig/network-devices hierarchy. +This directory should contain a directory for each interface to be configured, +such as ifconfig.xyz, where xyz is a +network interface name. Inside this directory would be files defining +the attributes to this interface, such as its IP address(es), subnet +masks, and so forth. + + +If the /etc/sysconfig/network-devices directory +is to be renamed or moved, make sure to edit the +/etc/sysconfig/rc file and update the +network_devices option by providing it with the new +path. + +New files are created in this directory. The following +command creates a sample ipv4 file for the +eth0 device: cd /etc/sysconfig/network-devices && mkdir ifconfig.eth0 && @@ -25,12 +56,46 @@ PREFIX=24 BROADCAST=192.168.1.255 EOF +The values of these variables must be changed in every file to +match the proper setup. If the ONBOOT variable is +set to yes the 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 brought up. + +The SERVICE variable defines the method of +obtaining the IP address. The LFS bootscripts have a modular IP +assignment format, and creating additional files in the /etc/sysconfig/network-devices/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 needs to contain 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 according to the specific subnet. + Creating the /etc/resolv.conf File +/etc/resolv.conf -Create the file by running the following: +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. Create the file by running the +following: cat > /etc/resolv.conf << "EOF" # Begin /etc/resolv.conf @@ -42,6 +107,14 @@ nameserver [IP address of your secondary nameserver] # End /etc/resolv.conf EOF +Replace [IP address of the +nameserver] with the IP address of the DNS most +appropriate for the setup. There will often be more than one entry +(requirements demand secondary servers for fallback capability). If +you only need or want one DNS server, remove the second +nameserver line from the file. The IP address may +also be a router on the local network. + diff --git a/chapter07/profile.xml b/chapter07/profile.xml index d60d64d67..fa1b1a232 100644 --- a/chapter07/profile.xml +++ b/chapter07/profile.xml @@ -7,8 +7,74 @@ The Bash Shell Startup Files +/etc/profile -Create the /etc/profile file: +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 effect 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 - Nodes: +Bash Startup Files and Interactive Shells. + +The files /etc/profile and +~/.bash_profile are read when the shell is +invoked as an interactive login shell. + +A 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 + + +This script also sets the INPUTRC +environment variable that makes Bash and +Readline use the +/etc/inputrc file created earlier. + +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). It may also be +necessary to specify (and this is actually the preferred form) the +character encoding (e.g. iso8859-1) after a dot (so +that the result is en_GB.iso8859-1). Issue the +following command for more information: + +man 3 setlocale + +The list of all locales supported by Glibc can be obtained by running +the following command: + +locale -a + +Once the proper locale settings have been determined, create the +/etc/profile file: cat > /etc/profile << "EOF" # Begin /etc/profile @@ -20,4 +86,19 @@ export INPUTRC=/etc/inputrc # End /etc/profile EOF +The C (default) and en_US +(the recommended one for United States English users) locales are +different. + +Setting the keyboard layout, screen font, and +locale-related environment variables are the only internationalization +steps needed to support locales that use ordinary single-byte +encodings and left-to-right writing direction. More complex cases +(including UTF-8 based locales) require additional steps and +additional patches because many applications tend to not work properly +under such conditions. These steps and patches are not included in +the LFS book and such locales are not supported by LFS in any +way. + + diff --git a/chapter07/setclock.xml b/chapter07/setclock.xml index d933eb59f..0527fac00 100644 --- a/chapter07/setclock.xml +++ b/chapter07/setclock.xml @@ -7,6 +7,36 @@ Configuring the setclock Script + +setclock +configuring + +The setclock script reads the time from the hardware clock, +also known as 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 time, so this +needs to be manually configured. + +If you cannot remember whether or not the hardware +clock is set to UTC time, find out by running +the hwclock --localtime --show command. This will tell +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 this +hwclock time. For example, if you live in the MST +timezone, which is also known as GMT -0700, add seven hours to the local +time. Then, account for Daylight Savings Time, which requires +subtracting an hour (or only add six in the first place) during the summer +months. + +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: @@ -19,4 +49,9 @@ UTC=1 # 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. + + diff --git a/chapter07/udev.xml b/chapter07/udev.xml index 73b90c419..51e001134 100644 --- a/chapter07/udev.xml +++ b/chapter07/udev.xml @@ -11,8 +11,235 @@ Udev usage +In , we installed the Udev +package. Before we go into the details regarding how this works, +a brief history of previous methods of handling devices is in +order. -See testing +Linux systems in general traditionally use a static device +creation method, whereby a great many device nodes are created under +/dev (sometimes literally +thousands of nodes), regardless of whether the corresponding hardware +devices actually exist. This is 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 +ramfs (a file system that +resides entirely in memory and does not take up any disk space). +Device nodes do not require much disk space, so the memory that is +used in negligable. + + +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 suffers from race +conditions that are inherent in its design and cannot be fixed +without a substantial revision to the kernel. It has also been marked +as deprecated due to a lack of recent maintenance. + +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 structure to userspace processes. With +this userspace visible representation, the possibility of seeing a +userspace replacement for devfs became much more +realistic. + + + +Udev Implementation + +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. Drivers that +have been compiled into the kernel directly register their objects +with sysfs as they are +detected by the kernel. For drivers compiled as modules, this will +happen when the module is loaded. Once the sysfs filesystem is mounted (on +/sys), the data which the +built-in drivers registered with sysfs are available to userspace +processes and to udev for device node creation. + +The S10udev initscript takes care of creating +these device nodes when Linux is booted. This script starts with +registering /sbin/udev as a hotplug event handler. +Hotplug events (discussed below) should not be generated during this +stage, but udev is registered just in case they do +occur. The udevstart program then walks through +the /sys filesystem and +creates devices under /dev that +match the descriptions. For example, +/sys/class/tty/vcs/dev contains the string +7:0 This string is used by udevstart +to create /dev/vcs with major number +7 and minor 0. The +permissions of each and every device that udevstart +creates are set using files from the /etc/udev.d/permissions.d/ directory. +These are numbered in a similar fashion to the LFS bootscripts. If +udev cannot find a permissions file for the device +it is creating, it will default permissions to +600 and ownership to +root:root. The names of the nodes created under +the /dev directory are +configured according to the rules specified in the files within the +/etc/udev/rules.d/ +directory. + +Once the above stage is complete, all devices that were already +present and have compiled-in drivers will be available for use. What +about those devices that have modular drivers? + +Earlier, we mentioned the concept of a hotplug event +handler. When a new device connection is detected by the +kernel, the kernel will generate a hotplug event and look at the file +/proc/sys/kernel/hotplug to find out the +userspace program that handles the device's connection. The +udev initscript registered udev +as this handler. When these hotplug events are generated, the kernel +will tell udev to check the /sys filesystem for the information +pertaining to this new device and create the /dev entry for it. + +This brings us to one problem that exists with +udev, and likewise with devfs before it. It is commonly +referred to as the chicken and egg problem. Most Linux +distrubtions handle loading modules via entries in +/etc/modules.conf. Access to a device node causes +the appropriate kernel module to load. With udev, +this method will not work because the device node does not exist until +the module is loaded. To solve this, the +S05modules bootscript was added to the +lfs-bootscripts package, along with the +/etc/sysconfig/modules file. By +adding module +names to the modules file, these modules will be +loaded when the computer is starting up. This allows +udev to detect the devices and create the +appropriate device nodes. + +Note that on slower machines or for drivers that create a lot +of device nodes, the process of creating devices may take a few +seconds to complete. This means that some device nodes may not be +immediately accessible. + + + +Handling Hotpluggable/Dynamic Devices + +When you plug in a device, such a Universal Serial Bus (USB) MP3 player, the kernel +recognizes that the device is now connected and generates a hotplug +event. If the driver is already loaded (either because it was compiled +into the kernel or because it was loaded via the +S05modules bootscript), udev will +be called upon to create the relevant device node(s) according to the +sysfs data available in +/sys. If the driver for the +just plugged in device is available as a module but currently unloaded, +then attaching the device to the system will only cause the kernel's +bus driver to generate a hotplug event that notifies userspace of the +new device connection and it not being attached to a driver. In +effect, nothing happens and the device itself is not usable +yet. + +If building a system that has a lot of drivers compiled as +modules rather than directly built into the kernel, using the +S05modules may not be practical. The Hotplug +package (see ) can +be beneficial in these cases. When the Hotplug package is installed, +it will respond to the aforementioned kernel's bus driver hotplug +events. The Hotplug package will load the appropriate module and make +this device available by creating the device node(s) for it. + + + +Problems with Creating Devices + +There are a few known problems when it comes to automatically creating +devices nodes: + +1) A kernel driver may not export its data to sysfs. + +This is most common with third party drivers from outside the +kernel tree. These drivers will not end up having their device nodes +created. Use the +/etc/sysconfig/createfiles configuration file to +manually create the devices. Consult the +devices.txt file inside the kernel documentation +or the documentation for that driver to find the proper major/minor +numbers. + +2) A non-hardware device is required. This is most common with +the Advanced Linux Sound Architecture (ALSA) project's Open Sound +System (OSS) compatibility module. These types of devices can be +handled in one of two ways: + + + +Adding the module names to +/etc/sysconfig/modules +Using an +install line in +/etc/modprobe.conf. This tells the +modprobe command when loading this module, +also load this other module, at the same time. For example: + +install snd-pcm modprobe -i snd-pcm ; modprobe \ + snd-pcm-oss ; true + +This will cause the system to load both the +snd-pcm and snd-pcm-oss +modules when any request is made to load the driver +snd-pcm. + + + + +Useful Reading + +Additional helpful documentation is available at the following +sites: + + +A Userspace Implementation of devfs +http://www.kroah.com/linux/talks/ols_2003_udev_paper/ +Reprint-Kroah-Hartman-OLS2003.pdf + +udev FAQ + + +The Linux Kernel Driver Model +http://public.planetmirror.com/pub/lca/2003/proceedings/papers/ +Patrick_Mochel/Patrick_Mochel.pdf + + diff --git a/chapter07/usage.xml b/chapter07/usage.xml index 918f981f7..5baede25b 100644 --- a/chapter07/usage.xml +++ b/chapter07/usage.xml @@ -7,7 +7,112 @@ How Do These Bootscripts Work? + +Bootscripts +usage -See testing +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 <insert distro name>, 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 (from 0 to 6) +run-levels (actually, there are more run-levels, but they are for +special cases and are generally not used. The init man page describes +those 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 + +The command used to change run-levels is init +[runlevel], where +[runlevel] is the target run-level. For +example, to reboot the computer, a user would issue the init +6 command. The reboot command is an +alias for it, as is the halt command an alias for +init 0. + +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 get killed and others get started. + +The real scripts are in /etc/rc.d/init.d. They do the actual +work, and the symlinks all point to them. Killing links and starting +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. + diff --git a/chapter08/fstab.xml b/chapter08/fstab.xml index 015e26bc6..969d306fb 100644 --- a/chapter08/fstab.xml +++ b/chapter08/fstab.xml @@ -7,6 +7,13 @@ 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, +which must be checked, and in which order. Create a new file systems +table like this: + cat > /etc/fstab << "EOF" # Begin /etc/fstab @@ -22,4 +29,39 @@ shm /dev/shm tmpfs defaults 0 0 # End /etc/fstab EOF +Replace [xxx], +[yyy], and [fff] +with the values appropriate for the system, for example, hda2, hda5, and ext2. For details on the six +fields in this file, see man 5 fstab. + +When using a journalling file system, the 1 +1 at the end of the line should be replaced with +0 0 because such a partition does not need to +be dumped or checked. + +The /dev/shm mount point +for tmpfs is included to +allow enabling POSIX-shared memory. The kernel must have the required +support built into it for this to work (more about this is in the next +section). Please note that very little software currently uses +POSIX-shared memory. Therefore, consider the /dev/shm mount point optional. For more +information, see +Documentation/filesystems/tmpfs.txt in the kernel +source tree. + +There are other lines which may be added to the +/etc/fstab file. One example is a line for USB +devices: + +usbfs /proc/bus/usb usbfs devgid=14,devmode=0660 0 0 + +This option will only work if Support for Host-side +USB and USB device filesystem are compiled into +the kernel (not as a module). + + diff --git a/chapter08/grub.xml b/chapter08/grub.xml index 4d50002a0..12487ec71 100644 --- a/chapter08/grub.xml +++ b/chapter08/grub.xml @@ -7,35 +7,82 @@ Making the LFS System Bootable + +Grub +configuring -We highly recommend that you create a Grub boot floppy diskette just in case. -Insert a blank floppy diskette and run the following commands: +Your shiny new LFS system is almost complete. One of the last +things to do is to ensure that the system can be properly booted. The +instructions below apply only to computers of IA-32 architecture, +meaning mainstream PCs. Information on boot loading for +other architectures should be available in the usual resource-specific +locations for those architectures. + +Boot loading can be a complex area, so a few cautionary +words are in order. Be familiar with the current boot loader and any other +operating systems present on the hard drive(s) that need to be +bootable. Make sure that an emergency boot disk is ready to +rescue the computer if the computer becomes +unusable (un-bootable). + +Earlier, we compiled and installed the Grub boot loader software +in preparation for this step. The procedure involves writing some +special Grub files to specific locations on the hard drive. We highly +recommend creating a Grub boot floppy diskette as a backup. Insert a +blank floppy diskette and run the following commands: dd if=/boot/grub/stage1 of=/dev/fd0 bs=512 count=1 dd if=/boot/grub/stage2 of=/dev/fd0 bs=512 seek=1 -Remove the diskette and store it somewhere safe. Now we'll run the +Remove the diskette and store it somewhere safe. Now, run the grub shell: grub -First, tell Grub where to search for its stage{1,2} -files -- you can use the Tab key everywhere to make Grub show the alternatives: +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, both starting from zero. For example, partition hda1 is (hd0,0) to +Grub and hdb3 is +(hd1,2). 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). + +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 hda4. + +Tell Grub where to search for its +stage{1,2} files. The Tab key can be used +everywhere to make Grub show the alternatives: root (hd0,3) -Tell Grub to install itself into the MBR (Master Boot Record) of +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). In this scenario, it would make more sense to install +Grub into the boot sector of the LFS partition. In this +case, this next command would become setup +(hd0,3). + +Tell Grub to install itself into the MBR of hda: setup (hd0) -If all is well, Grub will have reported finding its files in -/boot/grub. That's all there is to it: +If all went well, Grub will have reported finding its files in +/boot/grub. That's all there is +to it. Quit the grub shell: quit -Now we need to create a menu list file, defining Grub's -boot menu: +Create a menu list file defining Grub's boot menu: cat > /boot/grub/menu.lst << "EOF" # Begin /boot/grub/menu.lst @@ -55,7 +102,7 @@ root (hd0,3) kernel /boot/lfskernel-&linux-version; root=/dev/hda4 EOF -You may want to add an entry for your host distribution. It might look +Add an entry for the host distribution if desired. It might look like this: cat >> /boot/grub/menu.lst << "EOF" @@ -65,8 +112,8 @@ kernel /boot/kernel-2.4.20 root=/dev/hda3 initrd /boot/initrd-2.4.20 EOF -Also, if you happen to dual-boot Windows, the following entry should -allow booting it: +If dual-booting Windows, the following entry will allow +booting it: cat >> /boot/grub/menu.lst << "EOF" title Windows @@ -74,11 +121,16 @@ rootnoverify (hd0,0) chainloader +1 EOF -The FHS stipulates that Grub's menu.lst file should be symlinked to -/etc/grub/menu.lst. To satisfy this requirement, issue the following -command: +If info grub does not provide all necessary material, additional +information regarding Grub is located on its website at: +. + +The FHS stipulates that Grub's menu.lst file should be symlinked to +/etc/grub/menu.lst. To satisfy this requirement, issue the +following command: mkdir /etc/grub && ln -s /boot/grub/menu.lst /etc/grub + diff --git a/chapter08/introduction.xml b/chapter08/introduction.xml index d936cf2ed..6fa80cadc 100644 --- a/chapter08/introduction.xml +++ b/chapter08/introduction.xml @@ -7,6 +7,10 @@ Introduction -See testing +It is time to make the LFS system bootable. This chapter +discusses creating an fstab file, building a +kernel for the new LFS system, and installing the Grub boot loader so +that the LFS system can be selected for booting at startup. + diff --git a/chapter08/kernel.xml b/chapter08/kernel.xml index 9fe3bc889..4b775a3d9 100644 --- a/chapter08/kernel.xml +++ b/chapter08/kernel.xml @@ -3,26 +3,37 @@ %general-entities; ]> - + Linux-&linux-version; Linux +<para>The Linux package contains the kernel and the header files.</para> <segmentedlist> <segtitle>&buildtime;</segtitle> <segtitle>&diskspace;</segtitle> -<seglistitem><seg>All default options: 4.20 SBU</seg> -<seg>All default options: 181 MB</seg></seglistitem> +<seglistitem><seg>4.20 SBU</seg> +<seg>181 MB</seg></seglistitem> </segmentedlist> +<segmentedlist> +<segtitle>Linux installation depends on</segtitle> +<seglistitem><seg>Bash, Binutils, Coreutils, Findutils, +GCC, Glibc, Grep, Gzip, Make, Modutils, Perl, and Sed</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 alternate methods to the way this +book configures the kernel. + Kernel version 2.6.10 has a security vulnerability that will allow user processes to gain root privledges upon loading of a kernel module. See: for more information. The following patch fixes this problem: @@ -33,50 +44,200 @@ processes to gain root privledges upon loading of a kernel module. See: make mrproper - +This ensures that the kernel tree is absolutely clean. The +kernel team recommends that this command be issued prior to each +kernel compilation. Do not rely on the source tree being clean after +un-tarring. -If, in , you decided you want -to compile the keymap into the kernel, issue the command below: +If, in it was decided to +compile the keymap into the kernel, issue the command below: loadkeys -m /usr/share/kbd/keymaps/[path to keymap] > \ drivers/char/defkeymap.c -Configure the kernel via a menu-driven interface. BLFS has some -information regarding particular kernel configuration requirements of -packages outside of LFS at -. +For example, if using a Dutch keyboard, use +/usr/share/kbd/keymaps/i386/qwerty/nl.map.gz/usr/share/kbd/keymaps/i386/ +qwerty/nl.map.gz. + +Configure the kernel via a menu-driven interface: make menuconfig +Alternatively, make oldconfig may be more appropriate in some +situations. See the README file for more +information. + +When configuring the kernel, be sure to enable the +Support for hot-pluggable devices option under the +General Setup menu. This enables hotplug events that +are used by udev to populate the /dev directory with device +nodes. + +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. + +For POSIX-shared memory support, ensure that the kernel config +option Virtual memory file system support is enabled. +It resides within the File systems menu and is normally +enabled by default. + +LFS bootscripts make the assumption that either both +Support for Host-side USB and USB device +filesystem have been compiled directly into the kernel, or +that neither is compiled at all. Bootscripts will not work properly +if it is a module (usbcore.ko). + +NPTL requires the kernel to be compiled with GCC 3.x, in +this case &gcc-version;. Compiling with 2.95.x is known to cause failures in +the glibc test suite, so it is not recommended to compile the kernel +with gcc 2.95.x. + Compile the kernel image and modules: make -Install the modules, if your kernel configuration uses them: +If using kernel modules, an +/etc/modprobe.conf file may be needed. +Information pertaining to modules and kernel configuration is +located in the kernel documentation in the linux-&linux-version;/Documentation +directory. The modprobe.conf man page may also be +of interest. + +Be very careful when reading other documentation because it +usually applies to 2.4.x kernels only. As far as we know, kernel +configuration issues specific to Hotplug and Udev are not documented. +The problem is that Udev will create a device node only if Hotplug or +a user-written script inserts the corresponding module into the +kernel, and not all modules are detectable by Hotplug. Note that +statements like the one below in the +/etc/modprobe.conf file do not work with +Udev: + +alias char-major-XXX some-module + +Because of the complications with Hotplug, Udev, and modules, we +strongly recommend starting with a completely non-modular kernel +configuration, especially if this is the first time using Udev. + +Install the modules, if the kernel configuration uses them: make modules_install -The path to the kernel image may vary depending on the platform you're -using. Issue the following command to install the kernel: +If there are many modules and very little space, consider +stripping and compressing the modules. For most users, such +compression is not worth the time, but if the system is pressed for +space, see . + +After kernel compilation is complete, additional steps are +required to complete the installation. Some files need to be copied to +the /boot directory. + +The path to the kernel image may vary depending on the platform +being used. Issue the following command to install the kernel: cp arch/i386/boot/bzImage /boot/lfskernel-&linux-version; +System.map is a symbol file for the kernel. +It maps the function entry points of every function in the kernel API, +as well as the addresses of the kernel data structures for the running +kernel. Issue the following command to install the map file: + cp 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 .config /boot/config-&linux-version; -If you are going to keep the kernel source tree around, you may want to -run chown -R 0:0 on the -linux-&linux-version; directory to ensure all files are -owned by user root. +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. + +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. Contents of Linux -See testing + +Installed files +kernel, kernel headers, +and System.map + + +Short Descriptions + + + +kernel + +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. +kernel + + + + +kernel headers + +Defines the interface to the services that the kernel provides. +The headers in the system's include directory should +always be the ones against which Glibc was +compiled and therefore, should not be replaced +when upgrading the kernel. +kernel headers + + + + +System.map + +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 + + + + diff --git a/chapter09/chapter09.xml b/chapter09/chapter09.xml index 76ddd3856..51f0ba6eb 100644 --- a/chapter09/chapter09.xml +++ b/chapter09/chapter09.xml @@ -9,8 +9,8 @@ - + diff --git a/chapter09/getcounted.xml b/chapter09/getcounted.xml index 06d0d7791..df48e09ba 100644 --- a/chapter09/getcounted.xml +++ b/chapter09/getcounted.xml @@ -7,6 +7,12 @@ Get Counted -See testing +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/reboot.xml b/chapter09/reboot.xml index 82c026b36..8bc45eafd 100644 --- a/chapter09/reboot.xml +++ b/chapter09/reboot.xml @@ -7,13 +7,35 @@ 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. Installing a text mode web +browser, such as Lynx, you can easily view the BLFS book in one virtual +terminal, while building packages in another. The GPM package will also allow +you to perform copy/paste actions in your virtual terminals. Lastly, if you +are in a situation where static IP configuration does not meet your networking +requirements, installing packages such as dhcpcd or ppp at this point might +also be useful. + + +Now that we have said that, lets move on to booting our shiny new LFS +installation for the first time! First exit from the chroot environment: + logout +Then unmount the virtual files systems: + umount $LFS/dev/pts umount $LFS/dev/shm umount $LFS/dev umount $LFS/proc -umount $LFS/sys +umount $LFS/sys + +Unmount the LFS file system itself: umount $LFS @@ -24,6 +46,15 @@ partitions before unmounting the main one, like this: umount $LFS/home umount $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 +software can be added. + + diff --git a/chapter09/theend.xml b/chapter09/theend.xml index 6e28b27e9..91dab3861 100644 --- a/chapter09/theend.xml +++ b/chapter09/theend.xml @@ -7,8 +7,18 @@ The End -Create the /etc/lfs-release file: +/etc/lfs-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 + diff --git a/chapter09/whatnow.xml b/chapter09/whatnow.xml index 056ce5398..4df9d0cad 100644 --- a/chapter09/whatnow.xml +++ b/chapter09/whatnow.xml @@ -7,6 +7,43 @@ What Now? -See testing +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. + + +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 cab1ff4b5..e45ab0330 100644 --- a/general.ent +++ b/general.ent @@ -1,6 +1,6 @@ - - + + @@ -8,8 +8,9 @@ - + + diff --git a/prologue/audience.xml b/prologue/audience.xml index 2d2edf45d..b9a1842a1 100644 --- a/prologue/audience.xml +++ b/prologue/audience.xml @@ -7,6 +7,85 @@ Audience -See testing +There are many reasons why somebody would want to read this +book. The principle reason is to install a Linux system straight +from the source code. A question many people raise is, why go +through all the hassle of manually building a Linux system from +scratch when you can just download and install an existing +one? That is a good question and is the impetus for this +section of the book. + +One important reason for LFS's existence is to help people learn +how a Linux system works from the inside out. Building an LFS system +helps demonstrate what makes Linux tick, and how things work together +and depend on each other. One of the best things that this learning +experience provides is the ability to customize Linux to your own +tastes and needs. + +A key benefit of LFS is that it allows users to have more +control over the system without relying on someone else's Linux +implementation. With LFS, you are in the +driver's seat and dictate every aspect of the system, such as the +directory layout and bootscript setup. You also dictate where, why, +and how programs are installed. + +Another benefit of LFS is the ability to create a very compact +Linux system. When installing a regular distribution, one is often +forced to install several programs which are probably never used. +These programs waste precious disk space, or worse, CPU cycles. It is +not difficult to build an LFS system of less than 100 megabytes (MB), +which is substantially smaller compared to most existing setups. Does +this still sound like a lot of space? A few of us have been working on +creating a very small embedded LFS system. We successfully built a +system that was specialized to run the Apache web server with +approximately 8MB of disk space used. Further stripping could bring +this down to 5 MB or less. Try that with a regular distribution! +This is only one of the many benefits of designing your own Linux +implementation. + +We could compare Linux distributions to a hamburger purchased at +a fast-food restaurant—you have no idea what might be in what +you are eating. LFS, on the other hand, does not give you a hamburger. +Rather, LFS provides the recipe to make the exact hamburger desired. +This allows users to review the recipe, omit unwanted ingredients, and +add your own ingredients to enhance the flavor of the burger. +When you are satisfied with the recipe, move on to preparing it. It +can be made to exact specifications—broil it, bake it, deep-fry +it, or barbecue it. + +Another analogy that we can use is that of comparing LFS with a +finished house. LFS provides the skeletal plan of a house, but it is up +to you to build it. LFS maintains the freedom to adjust plans +throughout the process, customizing it to the user's needs and +preferences. + +An additional advantage of a custom built Linux system is +security. By compiling the entire system from source code, you are +empowered to audit everything and apply all the security patches +desired. It is no longer necessary to wait for somebody else to +compile binary packages that fix a security hole. Unless you +examine the patch and implement it yourself, you have no guarantee +that the new binary package was built correctly and adequately fixes +the problem. + +The goal of Linux From Scratch is to build a complete and usable +foundation-level system. Readers who do not wish to build their own +Linux system from scratch may not benefit from the information in this +book. If you only want to know what happens while the computer boots, +we recommend the From Power Up To Bash Prompt HOWTO +located at or on +The Linux Documentation Project's (TLDP) website at . +The HOWTO builds a system which is similar to that of this book, +but it focuses strictly on creating a system capable of booting to a +BASH prompt. Consider your objective. If you wish to build a Linux +system while learning along the way, then this book is your best +choice. + +There are too many good reasons to build your own LFS system to +list them all here. This section is only the tip of the iceberg. As +you continue in your LFS experience, you will find the power that +information and knowledge truly bring. + diff --git a/prologue/bookinfo.xml b/prologue/bookinfo.xml index 1fbf9e04d..2aca11534 100644 --- a/prologue/bookinfo.xml +++ b/prologue/bookinfo.xml @@ -14,20 +14,12 @@ - 1999-2005 + 1999–2005 Gerard Beekmans - - -In this book there is only the commands to build an LFS system -and new stuff. For a full version with all the explanations see . - - - -Copyright (c) 1999-2005, Gerard Beekmans +Copyright (c) 1999–2005, Gerard Beekmans All rights reserved. @@ -38,14 +30,14 @@ met: Redistributions in any form must retain the above copyright -notice, this list of conditions and the following disclaimer. +notice, this list of conditions and the following disclaimer Neither the name of Linux From Scratch nor the names of its contributors may be used to endorse or promote products derived -from this material without specific prior written permission. +from this material without specific prior written permission Any material derived from Linux From Scratch must contain -a reference to the Linux From Scratch project. +a reference to the Linux From Scratch project @@ -62,5 +54,5 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + diff --git a/prologue/dedication.xml b/prologue/dedication.xml index a523b2936..41cca4d77 100644 --- a/prologue/dedication.xml +++ b/prologue/dedication.xml @@ -7,3 +7,4 @@ Dedication This book is dedicated + diff --git a/prologue/foreword.xml b/prologue/foreword.xml index c9aaf7242..7f2c31288 100644 --- a/prologue/foreword.xml +++ b/prologue/foreword.xml @@ -7,6 +7,61 @@ Foreword -See testing +My adventures in Linux began six years ago when I downloaded and +installed my first distribution. After working with it for awhile, I +discovered issues I definitely would have liked to see improved upon. +For example, I didn't like the arrangement of the bootscripts or the way +programs were configured by default. I tried a number of alternate +distributions to address these issues, yet each had its pros and cons. +Finally, I realized that if I wanted full satisfaction from my Linux +system, I would have to build my own from scratch. + +What does this mean? I resolved not to use pre-compiled packages +of any kind, nor CD-ROMs or boot disks that would install basic +utilities. I would use my current Linux system to develop my own +customized system. This perfect Linux system would then +have the strengths of various systems without their associated +weaknesses. In the beginning, the idea was rather daunting, but I +remained committed to the idea that a system could be built that would +conform to my needs and desires rather than to a standard that just +did not fit what I was looking for. + +After sorting through issues such as circular dependencies and +compile-time errors, I created a custom-built Linux system that was +fully operational and suitable to individual needs. This process also +allowed me to create compact and streamlined Linux systems which are +faster and take up less space than traditional operating systems. I +called this system a Linux From Scratch system, or an LFS system for +short. + +As I shared my goals and experiences with other members of the +Linux community, it became apparent that there was sustained interest +in the ideas set forth in my Linux adventures. Such custom-built LFS +systems not only to meet user specifications and requirements, but +also serve as an ideal learning opportunity for programmers and system +administrators to enhance their Linux skills. Out of this broadened +interest, the Linux From Scratch Project was born. + +This Linux From Scratch book provides +readers with the background and instruction to design and build custom +Linux systems. This book highlights the Linux from Scratch project and +the benefits of using this system. Users can dictate all aspects of +their system, including directory layout, script setup, and security. +The resulting system will be compiled straight from the source code, +and the user will be able to specify where, why, and how programs are +installed. This book allows readers to fully customize Linux systems +to their own needs and allows users more control over their +system. + +I hope you will have a great time working on your own LFS +system, and enjoy the numerous benefits of having a system that is +truly your own. + + + +-- +Gerard Beekmans +gerard@linuxfromscratch.org + diff --git a/prologue/organization.xml b/prologue/organization.xml index 70d8572e4..f701fc388 100644 --- a/prologue/organization.xml +++ b/prologue/organization.xml @@ -7,6 +7,34 @@ Structure -See testing +This book is divided into the following parts. + + +Part I - Introduction + +Part I explains a few important notes on how to proceed with the +LFS installation. This section also provides meta-information about +the book. + + + +Part II - Preparing for the Build + +Part II describes how to prepare for the building process—making +a partition, downloading the packages, and compiling temporary +tools. + + + +Part III - Building the LFS System + +Part III guides the reader through the building of the LFS +system—compiling and installing all the packages one by one, +setting up the boot scripts, and installing the kernel. The resulting +Linux system is the foundation on which other software can be built to +expand the system as desired. At the end of this book, there is an +easy to use reference listing all of the programs, libraries, and +important files that have been installed. + diff --git a/prologue/prerequisites.xml b/prologue/prerequisites.xml index b22902560..506fe4487 100644 --- a/prologue/prerequisites.xml +++ b/prologue/prerequisites.xml @@ -7,6 +7,31 @@ Prerequisites -See testing +This book assumes that the reader has a reasonable knowledge of using +and installing Linux software. Before building an LFS system, we +recommend reading the following HOWTOs: + + +Software-Building-HOWTO + + +This is a comprehensive guide to building and installing +generic Unix software distributions under Linux. + +The Linux Users' Guide + + +This guide covers the usage of assorted Linux software. + +The Essential Pre-Reading Hint + + +This is an LFS Hint written specifically for users new to Linux. +It includes a list of links to excellent sources of information on a +wide range of topics. Anyone attempting to install LFS should have an +understanding of many of the topics in this hint. + + + diff --git a/prologue/typography.xml b/prologue/typography.xml index d13d31282..3a74378a4 100644 --- a/prologue/typography.xml +++ b/prologue/typography.xml @@ -7,6 +7,52 @@ Typography -See testing +To make things easier to follow, there are a few typographical +conventions used throughout this book. This section contains some +examples of the typographical format found throughout Linux From +Scratch. + +./configure --prefix=/usr + +This form of text is designed to be typed exactly as seen unless +otherwise noted in the surrounding text. It is also used in the +explanation sections to identify which of the commands is being +referenced. + +install-info: unknown option '--dir-file=/mnt/lfs/usr/info/dir' + +This form of text (fixed width text) shows screen output, +probably as the result of commands issued. This format is also used +to show filenames, such as +/etc/ld.so.conf. + +Emphasis + +This form of text is used for several purposes in the book, +mainly to emphasize important points or items. + + + +This format is used for hyperlinks, both within the LFS +community and to external pages, including HOWTOs, download locations, +and websites. + +cat > $LFS/etc/group << "EOF" +root:x:0: +bin:x:1: +...... +EOF + +This format is used when creating configuration files. The first +command tells the system to create the file +$LFS/etc/group from whatever is typed on the +following lines until the sequence end of file (EOF) is encountered. +Therefore, this entire section is generally typed as seen. + +[REPLACED TEXT] + +This format is used to encapsulate text that is not to be typed +as seen or copy-and-pasted. + diff --git a/stylesheets/lfs-chunked.xsl b/stylesheets/lfs-chunked.xsl index bfe985b7a..47b564447 100644 --- a/stylesheets/lfs-chunked.xsl +++ b/stylesheets/lfs-chunked.xsl @@ -24,7 +24,7 @@ Voila! (Man I hope we can do this better in XSLT 2.0) --> - + diff --git a/stylesheets/lfs-nochunks.xsl b/stylesheets/lfs-nochunks.xsl index f3b2fb30a..375f1d8cd 100644 --- a/stylesheets/lfs-nochunks.xsl +++ b/stylesheets/lfs-nochunks.xsl @@ -5,7 +5,7 @@ version="1.0"> - + diff --git a/stylesheets/lfs.css b/stylesheets/lfs.css index 22b70d0f8..68c23331d 100644 --- a/stylesheets/lfs.css +++ b/stylesheets/lfs.css @@ -230,11 +230,6 @@ tt, code, kbd, pre, .command { font-family: monospace; } -pre { - margin-top: .5em; - margin-bottom: .5em; -} - pre.userinput { color: #101310; background-color: #e5e5e5;