Initial creation of multilib branch

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/multilib@11565 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
Thomas Trepl 2019-04-01 16:48:31 +00:00
commit 1fa20991f4
2164 changed files with 606549 additions and 0 deletions

47
INSTALL Normal file
View File

@ -0,0 +1,47 @@
LFS Book Conversion Tools Installation Instructions
After downloading the SVN source, there are some things that need to be set up
on your computer if you want to convert the XML source into something easier to
read (e.g. HTML, TXT, or PDF). If you are interested in this, then keep
reading. If you are only interested in editing the XML source for re-
submission to the lfs-book or lfs-dev mailing lists, then you do not need this
document. Instead, you need to read the LFS Editor's Manual. See the LFS
website at http://www.linuxfromscratch.org for more information.
-------------------------------------------------------------------------------
If you want to convert the XML to HTML, install the following:
* libxml2
- http://www.linuxfromscratch.org/blfs/view/svn/general/libxml2.html
* libxslt
- http://www.linuxfromscratch.org/blfs/view/svn/general/libxslt.html
* DocBook DTD
- http://www.linuxfromscratch.org/blfs/view/svn/pst/xml.html
* DocBook XSL Stylesheets
- http://www.linuxfromscratch.org/blfs/view/svn/pst/docbook-xsl.html
* HTMLTidy
- http://www.linuxfromscratch.org/blfs/view/svn/general/tidy-html5.html
-------------------------------------------------------------------------------
If you want to convert the XML to TXT, install the above items, and then install
the following:
* lynx
- http://www.linuxfromscratch.org/blfs/view/svn/basicnet/lynx.html
-------------------------------------------------------------------------------
If you want to convert the XML to PDF, install the items listed above (except
lynx) and then install the following:
* JDK
- http://www.linuxfromscratch.org/blfs/view/svn/general/openjdk.html
* FOP and JAI
- http://www.linuxfromscratch.org/blfs/view/svn/pst/fop.html

210
Makefile Normal file
View File

@ -0,0 +1,210 @@
#BASEDIR = ~/lfs-book
#SYSDDIR = ~/lfs-systemd
#DUMPDIR = ~/lfs-commands
RENDERTMP = $(HOME)/tmp
CHUNK_QUIET = 1
ROOT_ID =
SHELL = /bin/bash
ifdef V
Q =
else
Q = @
endif
ifndef REV
REV = sysv
endif
ifneq ($(REV), sysv)
ifneq ($(REV), systemd)
$(error REV must be 'sysv' (default) or 'systemd'.)
endif
endif
ifeq ($(REV), sysv)
BASEDIR ?= ~/lfs-book
PDF_OUTPUT ?= LFS-BOOK.pdf
NOCHUNKS_OUTPUT ?= LFS-BOOK.html
DUMPDIR ?= ~/lfs-commands
else
BASEDIR ?= ~/lfs-systemd
PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf
NOCHUNKS_OUTPUT ?= LFS-SYSD-BOOK.html
DUMPDIR ?= ~/lfs-sysd-commands
endif
book: validate profile-html
@echo "Generating chunked XHTML files at $(BASEDIR)/ ..."
$(Q)xsltproc --nonet \
--stringparam chunk.quietly $(CHUNK_QUIET) \
--stringparam rootid "$(ROOT_ID)" \
--stringparam base.dir $(BASEDIR)/ \
stylesheets/lfs-chunked.xsl \
$(RENDERTMP)/lfs-html.xml
@echo "Copying CSS code and images..."
$(Q)mkdir -p $(BASEDIR)/stylesheets
$(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
$(Q)pushd $(BASEDIR)/ > /dev/null; \
sed -i -e "s@../stylesheets@stylesheets@g" *.html; \
popd > /dev/null
$(Q)mkdir -p $(BASEDIR)/images
$(Q)cp images/*.png $(BASEDIR)/images
@echo "Running Tidy and obfuscate.sh..."
$(Q)for filename in `find $(BASEDIR) -name "*.html"`; do \
tidy -config tidy.conf $$filename; \
true; \
/bin/bash obfuscate.sh $$filename; \
sed -e "s@text/html@application/xhtml+xml@g" \
-e "s/\xa9/\©/ " \
-i $$filename; \
done;
$(Q)$(MAKE) --no-print-directory wget-list md5sums
pdf: validate
@echo "Generating profiled XML for PDF..."
$(Q)xsltproc --nonet \
--stringparam profile.condition pdf \
--output $(RENDERTMP)/lfs-pdf.xml \
stylesheets/lfs-xsl/profile.xsl \
$(RENDERTMP)/lfs-full.xml
@echo "Generating FO file..."
$(Q)xsltproc --nonet \
--stringparam rootid "$(ROOT_ID)" \
--output $(RENDERTMP)/lfs-pdf.fo \
stylesheets/lfs-pdf.xsl \
$(RENDERTMP)/lfs-pdf.xml
$(Q)sed -i -e 's/span="inherit"/span="all"/' $(RENDERTMP)/lfs-pdf.fo
$(Q)bash pdf-fixups.sh $(RENDERTMP)/lfs-pdf.fo
@echo "Generating PDF file..."
$(Q)mkdir -p $(RENDERTMP)/images
$(Q)cp images/*.png $(RENDERTMP)/images
$(Q)mkdir -p $(BASEDIR)
$(Q)fop -q $(RENDERTMP)/lfs-pdf.fo $(BASEDIR)/$(PDF_OUTPUT) 2>fop.log
@echo "$(BASEDIR)/$(PDF_OUTPUT) created"
@echo "fop.log created"
nochunks: validate profile-html
@echo "Generating non chunked XHTML file..."
$(Q)xsltproc --nonet \
--stringparam rootid "$(ROOT_ID)" \
--output $(BASEDIR)/$(NOCHUNKS_OUTPUT) \
stylesheets/lfs-nochunks.xsl \
$(RENDERTMP)/lfs-html2.xml
@echo "Running Tidy..."
$(Q)tidy -config tidy.conf $(BASEDIR)/$(NOCHUNKS_OUTPUT) || true
@echo "Running obfuscate.sh..."
$(Q)bash obfuscate.sh $(BASEDIR)/$(NOCHUNKS_OUTPUT)
$(Q)sed -i -e "s@text/html@application/xhtml+xml@g" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
$(Q)sed -i -e "s@../wget-list@wget-list@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
$(Q)sed -i -e "s@../md5sums@md5sums@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
$(Q)sed -i -e "s@\xa9@\©@" $(BASEDIR)/$(NOCHUNKS_OUTPUT)
@echo "Output at $(BASEDIR)/$(NOCHUNKS_OUTPUT)"
tmpdir:
@echo "Creating and cleaning $(RENDERTMP)"
$(Q)mkdir -p $(RENDERTMP)
$(Q)rm -f $(RENDERTMP)/lfs*.xml
$(Q)rm -f $(RENDERTMP)/*wget*
$(Q)rm -f $(RENDERTMP)/*md5sum*
$(Q)rm -f $(RENDERTMP)/*pdf.fo
validate: tmpdir
@echo "Processing bootscripts..."
$(Q)bash process-scripts.sh
@echo "Adjusting for revision $(REV)..."
$(Q)xsltproc --nonet \
--xinclude \
--output $(RENDERTMP)/lfs-html2.xml \
--stringparam profile.revision $(REV) \
stylesheets/lfs-xsl/profile.xsl \
index.xml
@echo "Validating the book..."
$(Q)xmllint --nonet \
--noent \
--postvalid \
-o $(RENDERTMP)/lfs-full.xml \
$(RENDERTMP)/lfs-html2.xml
$(Q)rm -f appendices/*.script
$(Q)./aux-file-data.sh $(RENDERTMP)/lfs-full.xml
@echo "Validation complete."
profile-html:
@echo "Generating profiled XML for XHTML..."
$(Q)xsltproc --nonet \
--stringparam profile.condition html \
--output $(RENDERTMP)/lfs-html.xml \
stylesheets/lfs-xsl/profile.xsl \
$(RENDERTMP)/lfs-full.xml
wget-list: $(BASEDIR)/wget-list
$(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
packages.ent patches.ent
@echo "Generating consolidated wget list at $(BASEDIR)/wget-list ..."
$(Q)mkdir -p $(BASEDIR)
# $(Q)xsltproc --nonet --xinclude \
# --stringparam profile.revision $(REV) \
# --output $(RENDERTMP)/sysd-wget.xml \
# stylesheets/lfs-xsl/profile.xsl \
# chapter03/chapter03.xml
$(Q)xsltproc --xinclude --nonet \
--output $(BASEDIR)/wget-list \
stylesheets/wget-list.xsl \
chapter03/chapter03.xml
md5sums: $(BASEDIR)/md5sums
$(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
packages.ent patches.ent
@echo "Generating consolidated md5sum file at $(BASEDIR)/md5sums ..."
$(Q)mkdir -p $(BASEDIR)
$(Q)xsltproc --nonet --xinclude \
--stringparam profile.revision $(REV) \
--output $(RENDERTMP)/sysv-md5sum.xml \
stylesheets/lfs-xsl/profile.xsl \
chapter03/chapter03.xml
$(Q)xsltproc --xinclude --nonet \
--output $(BASEDIR)/md5sums \
stylesheets/md5sum.xsl \
$(RENDERTMP)/sysv-md5sum.xml
$(Q)sed -i -e \
"s/BOOTSCRIPTS-MD5SUM/$(shell md5sum lfs-bootscripts*.tar.bz2 | cut -d' ' -f1)/" \
$(BASEDIR)/md5sums
#dump-commands: validate
# @echo "Dumping book commands..."
# $(Q)xsltproc --nonet \
# --output $(RENDERTMP)/lfs-html.xml \
# --stringparam profile.revision $(REV) \
# stylesheets/lfs-xsl/profile.xsl \
# $(RENDERTMP)/lfs-full.xml
# $(Q)rm -rf $(DUMPDIR)
# $(Q)xsltproc --output $(DUMPDIR)/ \
# stylesheets/dump-commands.xsl \
# $(RENDERTMP)/lfs-html.xml
# @echo "Dumping book commands complete in $(DUMPDIR)"
all: book nochunks pdf # dump-commands
.PHONY : all book dump-commands nochunks pdf profile-html tmpdir validate md5sums wget-list

31
README Normal file
View File

@ -0,0 +1,31 @@
LFS Book README
This document is meant to instruct the user on how to convert the book's XML
source to other formats (e.g. HTML, PDF, PS and TXT). First, if you have not
already done so, please read the INSTALL file for instructions on how to install
the required software. If you have already completed the steps outlined in the
INSTALL file, then continue reading for examples how to convert these files into
various other formats.
In all examples, setting the parameter REV=systemd is needed to build the
systemd version of the book.
XML to XHTML:
-------------
make BASEDIR=/path/to/output/location
XML to single file XHTML (nochunks):
------------------------------------
make BASEDIR=/path/to/output/location nochunks
XML to TXT
----------
Follow the instructions for nochunks and then run:
lynx -dump /path/to/nochunks >/path/to/output
XML to PDF:
-----------
make BASEDIR=/path/to/output/location pdf

View File

@ -0,0 +1,470 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<appendix id="appendixb" xreflabel="Appendix B">
<?dbhtml dir="appendices"?>
<?dbhtml filename="acknowledgments.html"?>
<title>Acknowledgments</title>
<para>We would like to thank the following people and organizations
for their contributions to the Linux From Scratch Project.</para>
<itemizedlist>
<listitem>
<para><ulink url="mailto:gerard@linuxfromscratch.org">Gerard
Beekmans</ulink> &lt;gerard@linuxfromscratch.org&gt; &ndash;
LFS Creator</para>
</listitem>
<listitem>
<para><ulink url="mailto:bdubbs@linuxfromscratch.org">Bruce
Dubbs</ulink> &lt;bdubbs@linuxfromscratch.org&gt; &ndash; LFS Managing
Editor</para>
</listitem>
<listitem>
<para><ulink url="mailto:jim@linuxfromscratch.org">Jim
Gifford</ulink> &lt;jim@linuxfromscratch.org&gt; &ndash; CLFS Project
Co-Leader</para>
</listitem>
<listitem>
<para><ulink url="mailto:pierre@linuxfromscratch.org">Pierre Labastie</ulink>
&lt;pierre@linuxfromscratch.org&gt; &ndash; BLFS Editor and ALFS Lead</para>
</listitem>
<listitem>
<para><ulink url="mailto:dj@linuxfromscratch.org">DJ Lucas</ulink>
&lt;dj@linuxfromscratch.org&gt; &ndash; LFS and BLFS Editor</para>
</listitem>
<listitem>
<para><ulink url="mailto:ken@linuxfromscratch.org">Ken Moffat</ulink>
&lt;ken@linuxfromscratch.org&gt; &ndash; BLFS Editor</para>
</listitem>
<listitem>
<para>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.</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect2">Translators</bridgehead>
<itemizedlist>
<listitem>
<para><ulink url="mailto:macana@macana-es.com">Manuel Canales
Esparcia</ulink> &lt;macana@macana-es.com&gt; &ndash; Spanish
LFS translation project</para>
</listitem>
<listitem>
<para><ulink url="mailto:johan@linuxfromscratch.org">Johan
Lenglet</ulink> &lt;johan@linuxfromscratch.org&gt; &ndash; French LFS
translation project until 2008</para>
</listitem>
<listitem>
<para><ulink url="mailto:jmengual@linuxfromscratch.org">Jean-Philippe
Mengual </ulink> &lt;jmengual@linuxfromscratch.org&gt; &ndash; French LFS
translation project 2008-2016</para>
</listitem>
<listitem>
<para><ulink url="mailto:jlepiller@linuxfromscratch.org">Julien
Lepiller </ulink> &lt;jlepiller@linuxfromscratch.org&gt; &ndash; French LFS
translation project 2017-present</para>
</listitem>
<listitem>
<para><ulink url="mailto:lizardo@linuxfromscratch.org">Anderson
Lizardo</ulink> &lt;lizardo@linuxfromscratch.org&gt; &ndash;
Portuguese LFS translation project</para>
</listitem>
<listitem>
<para><ulink url="mailto:tr@erdfunkstelle.de">Thomas
Reitelbach </ulink> &lt;tr@erdfunkstelle.de&gt; &ndash; German LFS
translation project</para>
</listitem>
<listitem>
<para><ulink url="mailto:info@linuxfromscratch.org.ru">Anton Maisak</ulink>
&lt;info@linuxfromscratch.org.ru&gt; &ndash; Russian LFS
translation project</para>
</listitem>
<listitem>
<para><ulink url="mailto:helen@linuxfromscratch.org.ru">Elena Shevcova</ulink>
&lt;helen@linuxfromscratch.org.ru&gt; &ndash; Russian LFS
translation project</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect2">Mirror Maintainers</bridgehead>
<bridgehead renderas="sect3">North American Mirrors</bridgehead>
<itemizedlist>
<listitem>
<para><ulink url="mailto:scott@osuosl.org">Scott Kveton</ulink>
&lt;scott@osuosl.org&gt; &ndash; lfs.oregonstate.edu mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:lost@l-w.net">William Astle</ulink>
&lt;lost@l-w.net&gt; &ndash; ca.linuxfromscratch.org mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:eujon.sellers@gmail.com">Eujon Sellers</ulink>
&lt;jpolen@rackspace.com&gt; &ndash; lfs.introspeed.com mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:justin@knierim.org">Justin Knierim</ulink>
&lt;tim@idge.net&gt; &ndash; lfs-matrix.net mirror</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">South American Mirrors</bridgehead>
<itemizedlist>
<listitem>
<para><ulink url="mailto:manuel@linuxfromscratch.org">Manuel
Canales Esparcia</ulink> &lt;manuel@linuxfromscratch.org&gt; &ndash;
lfsmirror.lfs-es.info mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:lfalcon@thymbra.com">Luis Falcon</ulink>
&lt;Luis Falcon&gt; &ndash; torredehanoi.org mirror</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">European Mirrors</bridgehead>
<itemizedlist>
<listitem>
<para><ulink url="mailto:guido@primerelay.net">Guido Passet</ulink>
&lt;guido@primerelay.net&gt; &ndash; nl.linuxfromscratch.org mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:baafie@planet.nl">Bastiaan Jacques</ulink>
&lt;baafie@planet.nl&gt; &ndash; lfs.pagefault.net mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:sven.cranshoff@lineo.be">Sven Cranshoff</ulink>
&lt;sven.cranshoff@lineo.be&gt; &ndash; lfs.lineo.be mirror</para>
</listitem>
<listitem>
<para>Scarlet Belgium &ndash; lfs.scarlet.be mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:info@aliensoft.org">Sebastian Faulborn</ulink>
&lt;info@aliensoft.org&gt; &ndash; lfs.aliensoft.org mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:stuart@dontuse.ms">Stuart Fox</ulink>
&lt;stuart@dontuse.ms&gt; &ndash; lfs.dontuse.ms mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:admin@realhost.de">Ralf Uhlemann</ulink>
&lt;admin@realhost.de&gt; &ndash; lfs.oss-mirror.org mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:Antonin.Sprinzl@tuwien.ac.at">Antonin
Sprinzl</ulink> &lt;Antonin.Sprinzl@tuwien.ac.at&gt; &ndash;
at.linuxfromscratch.org mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:fredan-lfs@fredan.org">Fredrik
Danerklint</ulink> &lt;fredan-lfs@fredan.org&gt; &ndash;
se.linuxfromscratch.org mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:franck@linuxpourtous.com">Franck</ulink>
&lt;franck@linuxpourtous.com&gt; &ndash; lfs.linuxpourtous.com mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:baque@cict.fr">Philippe Baque</ulink>
&lt;baque@cict.fr&gt; &ndash; lfs.cict.fr mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:gyouja@pilgrims.ru">Vitaly Chekasin</ulink>
&lt;gyouja@pilgrims.ru&gt; &ndash; lfs.pilgrims.ru mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:kontakt@wankoo.org">Benjamin Heil</ulink>
&lt;kontakt@wankoo.org&gt; &ndash; lfs.wankoo.org mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:info@linuxfromscratch.org.ru">Anton Maisak</ulink>
&lt;info@linuxfromscratch.org.ru&gt; &ndash; linuxfromscratch.org.ru mirror</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Asian Mirrors</bridgehead>
<itemizedlist>
<listitem>
<para><ulink url="mailto:satit@wbac.ac.th">Satit Phermsawang</ulink>
&lt;satit@wbac.ac.th&gt; &ndash; lfs.phayoune.org mirror</para>
</listitem>
<listitem>
<para><ulink url="mailto:info@shizu-net.jp">Shizunet Co.,Ltd.</ulink>
&lt;info@shizu-net.jp&gt; &ndash; lfs.mirror.shizu-net.jp mirror</para>
</listitem>
<listitem>
<para><ulink url="http://www.initworld.com/">Init World</ulink>
&lt;http://www.initworld.com/&gt; &ndash; lfs.initworld.com mirror</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Australian Mirrors</bridgehead>
<itemizedlist>
<listitem>
<para><ulink url="mailto:jason@dstc.edu.au">Jason Andrade</ulink>
&lt;jason@dstc.edu.au&gt; &ndash; au.linuxfromscratch.org mirror</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect2">Former Project Team Members</bridgehead>
<itemizedlist>
<listitem>
<para><ulink url="mailto:theladyskye@linuxfromscratch.org">Christine
Barczak</ulink> &lt;theladyskye@linuxfromscratch.org&gt; &ndash; LFS
Book Editor</para>
</listitem>
<listitem>
<para>Archaic
&lt;archaic@linuxfromscratch.org&gt; &ndash; LFS Technical Writer/Editor,
HLFS Project Leader, BLFS Editor, Hints and Patches Project
Maintainer</para>
</listitem>
<listitem>
<para><ulink url="mailto:matthew@linuxfromscratch.org">Matthew
Burgess</ulink> &lt;matthew@linuxfromscratch.org&gt; &ndash;
LFS Project Leader, LFS Technical Writer/Editor</para>
</listitem>
<listitem>
<para><ulink url="mailto:nathan@linuxfromscratch.org">Nathan
Coulson</ulink> &lt;nathan@linuxfromscratch.org&gt; &ndash;
LFS-Bootscripts Maintainer</para>
</listitem>
<listitem>
<para>Timothy Bauscher</para>
</listitem>
<listitem>
<para>Robert Briggs</para>
</listitem>
<listitem>
<para>Ian Chilton</para>
</listitem>
<listitem>
<para><ulink url="mailto:jeroen@linuxfromscratch.org">Jeroen
Coumans</ulink> &lt;jeroen@linuxfromscratch.org&gt; &ndash; Website
Developer, FAQ Maintainer</para>
</listitem>
<listitem>
<para><ulink url="mailto:manuel@linuxfromscratch.org">Manuel
Canales Esparcia</ulink> &lt;manuel@linuxfromscratch.org&gt; &ndash;
LFS/BLFS/HLFS XML and XSL Maintainer</para>
</listitem>
<listitem>
<para>Alex Groenewoud &ndash; LFS Technical Writer</para>
</listitem>
<listitem>
<para>Marc Heerdink</para>
</listitem>
<listitem>
<para><ulink url="mailto:jhuntwork@linuxfromscratch.org">Jeremy
Huntwork</ulink> &lt;jhuntwork@linuxfromscratch.org&gt; &ndash; LFS
Technical Writer, LFS LiveCD Maintainer</para>
</listitem>
<listitem>
<para><ulink url="mailto:bryan@linuxfromscratch.org">Bryan
Kadzban</ulink> &lt;bryan@linuxfromscratch.org&gt; &ndash; LFS
Technical Writer</para>
</listitem>
<listitem>
<para>Mark Hymers</para>
</listitem>
<listitem><para>Seth W. Klein &ndash; FAQ maintainer</para></listitem>
<listitem>
<para><ulink url="mailto:nicholas@linuxfromscratch.org">Nicholas
Leippe</ulink> &lt;nicholas@linuxfromscratch.org&gt; &ndash; Wiki
Maintainer</para>
</listitem>
<listitem>
<para><ulink url="mailto:lizardo@linuxfromscratch.org">Anderson
Lizardo</ulink> &lt;lizardo@linuxfromscratch.org&gt; &ndash; Website
Backend-Scripts Maintainer</para>
</listitem>
<listitem>
<para><ulink url="mailto:randy@linuxfromscratch.org">Randy
McMurchy</ulink> &lt;randy@linuxfromscratch.org&gt; &ndash; BLFS
Project Leader, LFS Editor</para>
</listitem>
<listitem>
<para><ulink url="mailto:dnicholson@linuxfromscratch.org">Dan
Nicholson</ulink> &lt;dnicholson@linuxfromscratch.org&gt; &ndash; LFS and
BLFS Editor</para>
</listitem>
<listitem>
<para><ulink url="mailto:alexander@linuxfromscratch.org">Alexander
E. Patrakov</ulink> &lt;alexander@linuxfromscratch.org&gt; &ndash; LFS
Technical Writer, LFS Internationalization Editor,
LFS Live CD Maintainer</para>
</listitem>
<listitem>
<para>Simon Perreault</para>
</listitem>
<listitem>
<para><ulink url="mailto:scot@linuxfromscratch.org">Scot Mc
Pherson</ulink> &lt;scot@linuxfromscratch.org&gt; &ndash; LFS NNTP
Gateway Maintainer</para>
</listitem>
<listitem>
<para><ulink url="mailto:renodr@linuxfromscratch.org">Douglas R. Reno</ulink>
&lt;renodr@linuxfromscratch.org&gt; &ndash; Systemd Editor</para>
</listitem>
<listitem>
<para><ulink url="mailto:ryan@linuxfromscratch.org">Ryan
Oliver</ulink> &lt;ryan@linuxfromscratch.org&gt; &ndash; CLFS Project
Co-Leader</para>
</listitem>
<listitem>
<para><ulink url="mailto:gschafer@zip.com.au">Greg Schafer</ulink>
&lt;gschafer@zip.com.au&gt; &ndash; LFS Technical Writer and
Architect of the Next Generation 64-bit-enabling Build Method</para>
</listitem>
<listitem>
<para>Jesse Tie-Ten-Quee &ndash; LFS Technical Writer</para>
</listitem>
<listitem>
<para><ulink url="mailto:jwrober@linuxfromscratch.org">James
Robertson</ulink> &lt;jwrober@linuxfromscratch.org&gt; &ndash; Bugzilla
Maintainer</para>
</listitem>
<listitem>
<para><ulink url="mailto:tushar@linuxfromscratch.org">Tushar
Teredesai</ulink> &lt;tushar@linuxfromscratch.org&gt; &ndash; BLFS Book
Editor, Hints and Patches Project Leader</para>
</listitem>
<listitem>
<para><ulink url="mailto:jeremy@linuxfromscratch.org">Jeremy
Utley</ulink> &lt;jeremy@linuxfromscratch.org&gt; &ndash; LFS Technical
Writer, Bugzilla Maintainer, LFS-Bootscripts Maintainer</para>
</listitem>
<listitem>
<para><ulink url="mailto:zwinkles@gmail.com">Zack Winkles</ulink>
&lt;zwinkles@gmail.com&gt; &ndash; LFS Technical Writer</para>
</listitem>
</itemizedlist>
<!--
<bridgehead renderas="sect2">A very special thank you to our
donators</bridgehead>
<itemizedlist>
<listitem>
<para><ulink url="mailto:dean@vipersoft.co.uk">Dean Benson</ulink>
&lt;dean@vipersoft.co.uk&gt; for several monetary contributions</para>
</listitem>
<listitem>
<para><ulink url="mailto:hrx@hrxnet.de">Hagen Herrschaft</ulink>
&lt;hrx@hrxnet.de&gt; for donating a 2.2 GHz P4 system, now running
under the name of Lorien</para>
</listitem>
<listitem>
<para><ulink url="http://www.seocompany.ca/">SEO Company Canada</ulink>
supports Open Source projects and different Linux distributions</para>
</listitem>
<listitem>
<para><ulink url="http://www.vasoftware.com">VA Software</ulink> who,
on behalf of <ulink url="http://www.linux.com">Linux.com</ulink>,
donated a VA Linux 420 (former StartX SP2) workstation</para>
</listitem>
<listitem>
<para>Mark Stone for donating Belgarath, the first linuxfromscratch.org
server</para>
</listitem>
</itemizedlist>
-->
</appendix>

538
appendices/acronymlist.xml Normal file
View File

@ -0,0 +1,538 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<appendix id="appendixa" xreflabel="Appendix A">
<?dbhtml dir="appendices"?>
<?dbhtml filename="acronymlist.html"?>
<title>Acronyms and Terms</title>
<variablelist>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry>
<term><emphasis role="bold">ABI</emphasis></term>
<listitem>
<para>Application Binary Interface</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ALFS</emphasis></term>
<listitem>
<para>Automated Linux From Scratch</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">API</emphasis></term>
<listitem>
<para>Application Programming Interface</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ASCII</emphasis></term>
<listitem>
<para>American Standard Code for Information Interchange</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">BIOS</emphasis></term>
<listitem>
<para>Basic Input/Output System</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">BLFS</emphasis></term>
<listitem>
<para>Beyond Linux From Scratch</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">BSD</emphasis></term>
<listitem>
<para>Berkeley Software Distribution</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">chroot</emphasis></term>
<listitem>
<para>change root</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">CMOS</emphasis></term>
<listitem>
<para>Complementary Metal Oxide Semiconductor</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">COS</emphasis></term>
<listitem>
<para>Class Of Service</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">CPU</emphasis></term>
<listitem>
<para>Central Processing Unit</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">CRC</emphasis></term>
<listitem>
<para>Cyclic Redundancy Check</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">CVS</emphasis></term>
<listitem>
<para>Concurrent Versions System</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">DHCP</emphasis></term>
<listitem>
<para>Dynamic Host Configuration Protocol</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">DNS</emphasis></term>
<listitem>
<para>Domain Name Service</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">EGA</emphasis></term>
<listitem>
<para>Enhanced Graphics Adapter</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ELF</emphasis></term>
<listitem>
<para>Executable and Linkable Format</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">EOF</emphasis></term>
<listitem>
<para>End of File</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">EQN</emphasis></term>
<listitem>
<para>equation</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ext2</emphasis></term>
<listitem>
<para>second extended file system</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ext3</emphasis></term>
<listitem>
<para>third extended file system</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ext4</emphasis></term>
<listitem>
<para>fourth extended file system</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">FAQ</emphasis></term>
<listitem>
<para>Frequently Asked Questions</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">FHS</emphasis></term>
<listitem>
<para>Filesystem Hierarchy Standard</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">FIFO</emphasis></term>
<listitem>
<para>First-In, First Out</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">FQDN</emphasis></term>
<listitem>
<para>Fully Qualified Domain Name</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">FTP</emphasis></term>
<listitem>
<para>File Transfer Protocol</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">GB</emphasis></term>
<listitem>
<para>Gigabytes</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">GCC</emphasis></term>
<listitem>
<para>GNU Compiler Collection</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">GID</emphasis></term>
<listitem>
<para>Group Identifier</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">GMT</emphasis></term>
<listitem>
<para>Greenwich Mean Time</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">HTML</emphasis></term>
<listitem>
<para>Hypertext Markup Language</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">IDE</emphasis></term>
<listitem>
<para>Integrated Drive Electronics</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">IEEE</emphasis></term>
<listitem>
<para>Institute of Electrical and Electronic Engineers</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">IO</emphasis></term>
<listitem>
<para>Input/Output</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">IP</emphasis></term>
<listitem>
<para>Internet Protocol</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">IPC</emphasis></term>
<listitem>
<para>Inter-Process Communication</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">IRC</emphasis></term>
<listitem>
<para>Internet Relay Chat</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ISO</emphasis></term>
<listitem>
<para>International Organization for Standardization</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">ISP</emphasis></term>
<listitem>
<para>Internet Service Provider</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">KB</emphasis></term>
<listitem>
<para>Kilobytes</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">LED</emphasis></term>
<listitem>
<para>Light Emitting Diode</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">LFS</emphasis></term>
<listitem>
<para>Linux From Scratch</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">LSB</emphasis></term>
<listitem>
<para>Linux Standard Base</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">MB</emphasis></term>
<listitem>
<para>Megabytes</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">MBR</emphasis></term>
<listitem>
<para>Master Boot Record</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">MD5</emphasis></term>
<listitem>
<para>Message Digest 5</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">NIC</emphasis></term>
<listitem>
<para>Network Interface Card</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">NLS</emphasis></term>
<listitem>
<para>Native Language Support</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">NNTP</emphasis></term>
<listitem>
<para>Network News Transport Protocol</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">NPTL</emphasis></term>
<listitem>
<para>Native POSIX Threading Library</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">OSS</emphasis></term>
<listitem>
<para>Open Sound System</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">PCH</emphasis></term>
<listitem>
<para>Pre-Compiled Headers</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">PCRE</emphasis></term>
<listitem>
<para>Perl Compatible Regular Expression</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">PID</emphasis></term>
<listitem>
<para>Process Identifier</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">PTY</emphasis></term>
<listitem>
<para>pseudo terminal</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">QOS</emphasis></term>
<listitem>
<para>Quality Of Service</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">RAM</emphasis></term>
<listitem>
<para>Random Access Memory</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">RPC</emphasis></term>
<listitem>
<para>Remote Procedure Call</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">RTC</emphasis></term>
<listitem>
<para>Real Time Clock</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">SBU</emphasis></term>
<listitem>
<para>Standard Build Unit</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">SCO</emphasis></term>
<listitem>
<para>The Santa Cruz Operation</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">SHA1</emphasis></term>
<listitem>
<para>Secure-Hash Algorithm 1</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">TLDP</emphasis></term>
<listitem>
<para>The Linux Documentation Project</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">TFTP</emphasis></term>
<listitem>
<para>Trivial File Transfer Protocol</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">TLS</emphasis></term>
<listitem>
<para>Thread-Local Storage</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">UID</emphasis></term>
<listitem>
<para>User Identifier</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">umask</emphasis></term>
<listitem>
<para>user file-creation mask</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">USB</emphasis></term>
<listitem>
<para>Universal Serial Bus</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">UTC</emphasis></term>
<listitem>
<para>Coordinated Universal Time</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">UUID</emphasis></term>
<listitem>
<para>Universally Unique Identifier</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">VC</emphasis></term>
<listitem>
<para>Virtual Console</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">VGA</emphasis></term>
<listitem>
<para>Video Graphics Array</para>
</listitem>
</varlistentry>
<varlistentry>
<term><emphasis role="bold">VT</emphasis></term>
<listitem>
<para>Virtual Terminal</para>
</listitem>
</varlistentry>
</variablelist>
</appendix>

403
appendices/creat-comm.xml Normal file
View File

@ -0,0 +1,403 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="CC" xreflabel="Creative Commons License">
<?dbhtml filename="creat-comm.html"?>
<title>Creative Commons License</title>
<para role='title'>Creative Commons Legal Code</para>
<para role='title'>Attribution-NonCommercial-ShareAlike 2.0</para>
<important>
<para>CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT
PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN
"AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION
PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS
USE.</para>
</important>
<para role='title'>License</para>
<para>THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE
COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY
COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS
AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.</para>
<para>BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE
BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS
CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND
CONDITIONS.</para>
<orderedlist>
<?dbfo label-width="1.5em"?>
<listitem>
<para>Definitions</para>
<orderedlist>
<listitem>
<para>"Collective Work" means a work, such as a periodical issue, anthology or
encyclopedia, in which the Work in its entirety in unmodified form, along
with a number of other contributions, constituting separate and independent
works in themselves, are assembled into a collective whole. A work that
constitutes a Collective Work will not be considered a Derivative Work (as
defined below) for the purposes of this License.</para>
</listitem>
<listitem>
<para>"Derivative Work" means a work based upon the Work or upon
the Work and other pre-existing works, such as a translation, musical
arrangement, dramatization, fictionalization, motion picture version, sound
recording, art reproduction, abridgment, condensation, or any other form in
which the Work may be recast, transformed, or adapted, except that a work
that constitutes a Collective Work will not be considered a Derivative Work
for the purpose of this License. For the avoidance of doubt, where the Work
is a musical composition or sound recording, the synchronization of the Work
in timed-relation with a moving image ("synching") will be considered a
Derivative Work for the purpose of this License.</para>
</listitem>
<listitem>
<para>"Licensor" means the individual or entity that offers the
Work under the terms of this License.</para>
</listitem>
<listitem>
<para>"Original Author" means the individual or entity who created
the Work.</para>
</listitem>
<listitem>
<para>"Work" means the copyrightable work of authorship offered
under the terms of this License.</para>
</listitem>
<listitem>
<para>"You" means an individual or entity exercising rights under
this License who has not previously violated the terms of this License with
respect to the Work, or who has received express permission from the
Licensor to exercise rights under this License despite a previous
violation.</para>
</listitem>
<listitem>
<para>"License Elements" means the following high-level license
attributes as selected by Licensor and indicated in the title of this
License: Attribution, Noncommercial, ShareAlike.</para>
</listitem>
</orderedlist>
</listitem>
<listitem>
<para>Fair Use Rights. Nothing in this license is intended to reduce,
limit, or restrict any rights arising from fair use, first sale or other
limitations on the exclusive rights of the copyright owner under copyright law
or other applicable laws.</para>
</listitem>
<listitem>
<para>License Grant. Subject to the terms and conditions of this
License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
perpetual (for the duration of the applicable copyright) license to exercise
the rights in the Work as stated below:</para>
<orderedlist>
<listitem>
<para>to reproduce the Work, to incorporate the Work into one or
more Collective Works, and to reproduce the Work as incorporated in the
Collective Works;</para>
</listitem>
<listitem>
<para>to create and reproduce Derivative Works;</para>
</listitem>
<listitem>
<para>to distribute copies or phonorecords of, display publicly,
perform publicly, and perform publicly by means of a digital audio
transmission the Work including as incorporated in Collective
Works;</para>
</listitem>
<listitem>
<para>to distribute copies or phonorecords of, display publicly,
perform publicly, and perform publicly by means of a digital audio
transmission Derivative Works;</para>
</listitem>
</orderedlist>
<para>The above rights may be exercised in all media and formats whether now
known or hereafter devised. The above rights include the right to make such
modifications as are technically necessary to exercise the rights in other
media and formats. All rights not expressly granted by Licensor are hereby
reserved, including but not limited to the rights set forth in Sections 4(e)
and 4(f).</para>
</listitem>
<listitem>
<para>Restrictions.The license granted in Section 3 above is
expressly made subject to and limited by the following
restrictions:</para>
<orderedlist>
<listitem>
<para>You may distribute, publicly display, publicly perform, or
publicly digitally perform the Work only under the terms of this License, and
You must include a copy of, or the Uniform Resource Identifier for, this
License with every copy or phonorecord of the Work You distribute, publicly
display, publicly perform, or publicly digitally perform. You may not offer
or impose any terms on the Work that alter or restrict the terms of this
License or the recipients' exercise of the rights granted hereunder. You may
not sublicense the Work. You must keep intact all notices that refer to this
License and to the disclaimer of warranties. You may not distribute, publicly
display, publicly perform, or publicly digitally perform the Work with any
technological measures that control access or use of the Work in a manner
inconsistent with the terms of this License Agreement. The above applies to
the Work as incorporated in a Collective Work, but this does not require the
Collective Work apart from the Work itself to be made subject to the terms of
this License. If You create a Collective Work, upon notice from any Licensor
You must, to the extent practicable, remove from the Collective Work any
reference to such Licensor or the Original Author, as requested. If You
create a Derivative Work, upon notice from any Licensor You must, to the
extent practicable, remove from the Derivative Work any reference to such
Licensor or the Original Author, as requested.</para>
</listitem>
<listitem>
<para>You may distribute, publicly display, publicly perform, or
publicly digitally perform a Derivative Work only under the terms of this
License, a later version of this License with the same License Elements as
this License, or a Creative Commons iCommons license that contains the same
License Elements as this License (e.g. Attribution-NonCommercial-ShareAlike
2.0 Japan). You must include a copy of, or the Uniform Resource Identifier
for, this License or other license specified in the previous sentence with
every copy or phonorecord of each Derivative Work You distribute, publicly
display, publicly perform, or publicly digitally perform. You may not offer
or impose any terms on the Derivative Works that alter or restrict the terms
of this License or the recipients' exercise of the rights granted hereunder,
and You must keep intact all notices that refer to this License and to the
disclaimer of warranties. You may not distribute, publicly display, publicly
perform, or publicly digitally perform the Derivative Work with any
technological measures that control access or use of the Work in a manner
inconsistent with the terms of this License Agreement. The above applies to
the Derivative Work as incorporated in a Collective Work, but this does not
require the Collective Work apart from the Derivative Work itself to be made
subject to the terms of this License.</para>
</listitem>
<listitem>
<para>You may not exercise any of the rights granted to You in
Section 3 above in any manner that is primarily intended for or directed
toward commercial advantage or private monetary compensation. The exchange of
the Work for other copyrighted works by means of digital file-sharing or
otherwise shall not be considered to be intended for or directed toward
commercial advantage or private monetary compensation, provided there is no
payment of any monetary compensation in connection with the exchange of
copyrighted works.</para>
</listitem>
<listitem>
<para>If you distribute, publicly display, publicly perform, or
publicly digitally perform the Work or any Derivative Works or Collective
Works, You must keep intact all copyright notices for the Work and give the
Original Author credit reasonable to the medium or means You are utilizing by
conveying the name (or pseudonym if applicable) of the Original Author if
supplied; the title of the Work if supplied; to the extent reasonably
practicable, the Uniform Resource Identifier, if any, that Licensor specifies
to be associated with the Work, unless such URI does not refer to the
copyright notice or licensing information for the Work; and in the case of a
Derivative Work, a credit identifying the use of the Work in the Derivative
Work (e.g., "French translation of the Work by Original Author," or
"Screenplay based on original Work by Original Author"). Such credit may be
implemented in any reasonable manner; provided, however, that in the case of
a Derivative Work or Collective Work, at a minimum such credit will appear
where any other comparable authorship credit appears and in a manner at least
as prominent as such other comparable authorship credit.</para>
</listitem>
<listitem>
<para>For the avoidance of doubt, where the Work is a musical
composition:</para>
<orderedlist>
<listitem>
<para>Performance Royalties Under Blanket Licenses. Licensor
reserves the exclusive right to collect, whether individually or via a
performance rights society (e.g. ASCAP, BMI, SESAC), royalties for the
public performance or public digital performance (e.g. webcast) of the
Work if that performance is primarily intended for or directed toward
commercial advantage or private monetary compensation.</para>
</listitem>
<listitem>
<para>Mechanical Rights and Statutory Royalties. Licensor
reserves the exclusive right to collect, whether individually or via a
music rights agency or designated agent (e.g. Harry Fox Agency),
royalties for any phonorecord You create from the Work ("cover
version") and distribute, subject to the compulsory license created
by 17 USC Section 115 of the US Copyright Act (or the equivalent in
other jurisdictions), if Your distribution of such cover version is primarily
intended for or directed toward commercial advantage or private monetary
compensation. 6. Webcasting Rights and Statutory Royalties. For the
avoidance of doubt, where the Work is a sound recording, Licensor
reserves the exclusive right to collect, whether individually or via a
performance-rights society (e.g. SoundExchange), royalties for the public
digital performance (e.g. webcast) of the Work, subject to the compulsory
license created by 17 USC Section 114 of the US Copyright Act (or the
equivalent in other jurisdictions), if Your public digital performance is
primarily intended for or directed toward commercial advantage or private
monetary compensation.</para>
</listitem>
</orderedlist>
</listitem>
<listitem>
<para>Webcasting Rights and Statutory Royalties. For the
avoidance of doubt, where the Work is a sound recording, Licensor reserves
the exclusive right to collect, whether individually or via a
performance-rights society (e.g. SoundExchange), royalties for the public
digital performance (e.g. webcast) of the Work, subject to the compulsory
license created by 17 USC Section 114 of the US Copyright Act (or the
equivalent in other jurisdictions), if Your public digital performance is
primarily intended for or directed toward commercial advantage or private
monetary compensation.</para>
</listitem>
</orderedlist>
</listitem>
<listitem>
<para>Representations, Warranties and Disclaimer</para>
<para>UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR
OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND
CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING,
WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A
PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE.
SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH
EXCLUSION MAY NOT APPLY TO YOU.</para>
</listitem>
<listitem>
<para>Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY
APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY
FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES
ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</para>
</listitem>
<listitem>
<para>Termination</para>
<orderedlist>
<listitem>
<para>This License and the rights granted hereunder will terminate
automatically upon any breach by You of the terms of this License.
Individuals or entities who have received Derivative Works or Collective
Works from You under this License, however, will not have their licenses
terminated provided such individuals or entities remain in full compliance
with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any
termination of this License.</para>
</listitem>
<listitem>
<para>Subject to the above terms and conditions, the license
granted here is perpetual (for the duration of the applicable copyright in
the Work). Notwithstanding the above, Licensor reserves the right to release
the Work under different license terms or to stop distributing the Work at
any time; provided, however that any such election will not serve to withdraw
this License (or any other license that has been, or is required to be,
granted under the terms of this License), and this License will continue in
full force and effect unless terminated as stated above.</para>
</listitem>
</orderedlist>
</listitem>
<listitem>
<para>Miscellaneous</para>
<orderedlist>
<listitem>
<para>Each time You distribute or publicly digitally perform the
Work or a Collective Work, the Licensor offers to the recipient a license to
the Work on the same terms and conditions as the license granted to You under
this License.</para>
</listitem>
<listitem>
<para>Each time You distribute or publicly digitally perform a
Derivative Work, Licensor offers to the recipient a license to the original
Work on the same terms and conditions as the license granted to You under
this License.</para>
</listitem>
<listitem>
<para>If any provision of this License is invalid or unenforceable
under applicable law, it shall not affect the validity or enforceability of
the remainder of the terms of this License, and without further action by the
parties to this agreement, such provision shall be reformed to the minimum
extent necessary to make such provision valid and
enforceable.</para>
</listitem>
<listitem>
<para>No term or provision of this License shall be deemed waived
and no breach consented to unless such waiver or consent shall be in writing
and signed by the party to be charged with such waiver or
consent.</para>
</listitem>
<listitem>
<para>This License constitutes the entire agreement between the
parties with respect to the Work licensed here. There are no understandings,
agreements or representations with respect to the Work not specified here.
Licensor shall not be bound by any additional provisions that may appear in
any communication from You. This License may not be modified without the
mutual written agreement of the Licensor and You.</para>
</listitem>
</orderedlist>
</listitem>
</orderedlist>
<important>
<para>Creative Commons is not a party to this License, and makes no warranty
whatsoever in connection with the Work. Creative Commons will not be liable to
You or any party on any legal theory for any damages whatsoever, including
without limitation any general, special, incidental or consequential damages
arising in connection to this license. Notwithstanding the foregoing two (2)
sentences, if Creative Commons has expressly identified itself as the Licensor
hereunder, it shall have all rights and obligations of Licensor.</para>
<para>Except for the limited purpose of indicating to the public that the Work is
licensed under the CCPL, neither party will use the trademark "Creative
Commons" or any related trademark or logo of Creative Commons without the prior
written consent of Creative Commons. Any permitted use will be in compliance
with Creative Commons' then-current trademark usage guidelines, as may be
published on its website or otherwise made available upon request from time to
time.</para>
<para>Creative Commons may be contacted at <ulink url='http://creativecommons.org/' />.</para>
</important>
</sect1>

2766
appendices/dependencies.xml Normal file

File diff suppressed because it is too large Load Diff

25
appendices/license.xml Normal file
View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<appendix id="Licenses" xreflabel="Appendix E">
<?dbhtml dir="appendices"?>
<?dbhtml filename="licenses.html"?>
<title>LFS Licenses</title>
<para>This book is licensed under the Creative Commons
Attribution-NonCommercial-ShareAlike 2.0 License.</para>
<para>Computer instructions may be extracted from the book under the MIT
License.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creat-comm.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mit-lic.xml"/>
</appendix>

33
appendices/mit-lic.xml Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="MIT" xreflabel="MIT License">
<?dbhtml filename="mit.html" ?>
<title>The MIT License</title>
<para>Copyright &copy; &copyrightdate; Gerard Beekmans</para>
<para>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:</para>
<para>The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.</para>
<para>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.</para>
</sect1>

189
appendices/scripts.xml Normal file
View File

@ -0,0 +1,189 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
<!ENTITY checkfs SYSTEM "checkfs.script">
<!ENTITY cleanfs SYSTEM "cleanfs.script">
<!ENTITY console SYSTEM "console.script">
<!ENTITY halt SYSTEM "halt.script">
<!ENTITY initfunctions SYSTEM "init-functions.script">
<!ENTITY localnet SYSTEM "localnet.script">
<!ENTITY modules SYSTEM "modules.script">
<!ENTITY mountfs SYSTEM "mountfs.script">
<!ENTITY mountvirtfs SYSTEM "mountvirtfs.script">
<!ENTITY network SYSTEM "network.script">
<!ENTITY rc SYSTEM "rc.script">
<!ENTITY reboot SYSTEM "reboot.script">
<!ENTITY sendsignals SYSTEM "sendsignals.script">
<!ENTITY setclock SYSTEM "setclock.script">
<!ENTITY swap SYSTEM "swap.script">
<!ENTITY sysctl SYSTEM "sysctl.script">
<!ENTITY sysklogd SYSTEM "sysklogd.script">
<!ENTITY template SYSTEM "template.script">
<!ENTITY udev SYSTEM "udev.script">
<!ENTITY udev_retry SYSTEM "udev_retry.script">
<!ENTITY createfiles SYSTEM "createfiles.script">
<!ENTITY modules_sys SYSTEM "modules-sysinit.script">
<!ENTITY cfg_udev_retry SYSTEM "config-udev-retry.script">
<!ENTITY ifup SYSTEM "ifup.script">
<!ENTITY ifdown SYSTEM "ifdown.script">
<!ENTITY ipv4_static SYSTEM "ipv4-static.script">
<!ENTITY ipv4_static_route SYSTEM "ipv4-static-route.script">
%general-entities;
]>
<appendix id="scripts" xreflabel="Appendix D" revision="sysv">
<?dbhtml dir="scripts"?>
<?dbhtml filename="scripts.html"?>
<title>Boot and sysconfig scripts version-&lfs-bootscripts-version;</title>
<para>The scripts in this appendix are listed by the directory where they
normally reside. The order is <filename
class='directory'>/etc/rc.d/init.d</filename>, <filename
class='directory'>/etc/sysconfig</filename>, <filename
class='directory'>/etc/sysconfig/network-devices</filename>, and <filename
class='directory'>/etc/sysconfig/network-devices/services</filename>. Within
each section, the files are listed in the order they are normally called.
</para>
<sect1 id="rc" role="wrap">
<title>/etc/rc.d/init.d/rc</title>
<para>The <systemitem>rc</systemitem> script is the first script called by
<application>init</application> and initiates the boot process.</para>
<screen>&rc;</screen>
</sect1>
<sect1 id="init-functions" role="wrap">
<title>/lib/lsb/init-functions</title>
<screen>&initfunctions;</screen>
</sect1>
<sect1 id="mountvirtfs" role="wrap">
<title>/etc/rc.d/init.d/mountvirtfs</title>
<screen>&mountvirtfs;</screen>
</sect1>
<sect1 id="modules" role="wrap">
<title>/etc/rc.d/init.d/modules</title>
<screen>&modules;</screen>
</sect1>
<sect1 id="udev" role="wrap">
<title>/etc/rc.d/init.d/udev</title>
<screen>&udev;</screen>
</sect1>
<sect1 id="swap" role="wrap">
<title>/etc/rc.d/init.d/swap</title>
<screen>&swap;</screen>
</sect1>
<sect1 id="setclock" role="wrap">
<title>/etc/rc.d/init.d/setclock</title>
<screen>&setclock;</screen>
</sect1>
<sect1 id="checkfs" role="wrap">
<title>/etc/rc.d/init.d/checkfs</title>
<screen>&checkfs;</screen>
</sect1>
<sect1 id="mountfs" role="wrap">
<title>/etc/rc.d/init.d/mountfs</title>
<screen>&mountfs;</screen>
</sect1>
<sect1 id="udev_retry" role="wrap">
<title>/etc/rc.d/init.d/udev_retry</title>
<screen>&udev_retry;</screen>
</sect1>
<sect1 id="cleanfs" role="wrap">
<title>/etc/rc.d/init.d/cleanfs</title>
<screen>&cleanfs;</screen>
</sect1>
<sect1 id="console" role="wrap">
<title>/etc/rc.d/init.d/console</title>
<screen>&console;</screen>
</sect1>
<sect1 id="localnet" role="wrap">
<title>/etc/rc.d/init.d/localnet</title>
<screen>&localnet;</screen>
</sect1>
<sect1 id="sysctlscript" role="wrap">
<title>/etc/rc.d/init.d/sysctl</title>
<screen>&sysctl;</screen>
</sect1>
<sect1 id="sysklogd" role="wrap">
<title>/etc/rc.d/init.d/sysklogd</title>
<screen>&sysklogd;</screen>
</sect1>
<sect1 id="network" role="wrap">
<title>/etc/rc.d/init.d/network</title>
<screen>&network;</screen>
</sect1>
<sect1 id="sendsignals" role="wrap">
<title>/etc/rc.d/init.d/sendsignals</title>
<screen>&sendsignals;</screen>
</sect1>
<sect1 id="rebootscript" role="wrap">
<title>/etc/rc.d/init.d/reboot</title>
<screen>&reboot;</screen>
</sect1>
<sect1 id="haltscript" role="wrap">
<title>/etc/rc.d/init.d/halt</title>
<screen>&halt;</screen>
</sect1>
<sect1 id="template" role="wrap">
<title>/etc/rc.d/init.d/template</title>
<screen>&template;</screen>
</sect1>
<sect1 id="modulessys" role="wrap">
<title>/etc/sysconfig/modules</title>
<screen>&modules_sys;</screen>
</sect1>
<sect1 id="createfiles" role="wrap">
<title>/etc/sysconfig/createfiles</title>
<screen>&createfiles;</screen>
</sect1>
<sect1 id="config-udev-retry" role="wrap">
<title>/etc/sysconfig/udev-retry</title>
<screen>&cfg_udev_retry;</screen>
</sect1>
<sect1 id="ifup" role="wrap">
<title>/sbin/ifup</title>
<screen>&ifup;</screen>
</sect1>
<sect1 id="ifdown" role="wrap">
<title>/sbin/ifdown</title>
<screen>&ifdown;</screen>
</sect1>
<sect1 id="ipv4static" role="wrap">
<title>/lib/services/ipv4-static</title>
<screen>&ipv4_static;</screen>
</sect1>
<sect1 id="ipv4route" role="wrap">
<title>/lib/services/ipv4-static-route</title>
<screen>&ipv4_static_route;</screen>
</sect1>
</appendix>

23
appendices/udev-rules.xml Normal file
View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE appendix PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
<!ENTITY lfs-rules SYSTEM "55-lfs.rules.script">
%general-entities;
]>
<appendix id="rules" xreflabel="Appendix E" revision="sysv">
<?dbhtml dir="scripts"?>
<?dbhtml filename="eudev-rules.html"?>
<title>Udev configuration rules</title>
<para>The rules in this appendix are listed for convenience. Installation is
normally done via instructions in <xref linkend='ch-system-eudev'/>. </para>
<sect1 id="lfsrules" role="wrap">
<title>55-lfs.rules</title>
<screen>&lfs-rules;</screen>
</sect1>
</appendix>

30
aux-file-data.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
if [ $# -lt 1 ] ; then
echo "This script needs the location of the xml file to update"
exit 1
fi
FILE=$1
./make-aux-files.sh
# Bootscript data
bootscripts=$(ls lfs-bootscripts*.bz2)
base=$(basename $bootscripts .tar.bz2)
bootsize=$(ls -l --block-size=1024 $bootscripts | cut -f5 -d" ")
bootmd5=$(md5sum $bootscripts | cut -f1 -d" ")
# Figure intalled size of bootscripts
TOPDIR=$(pwd)
TMP_DIR=$(mktemp -d /tmp/lfsbootfiles.XXXXXX)
pushd $TMP_DIR > /dev/null
tar -xf $TOPDIR/$bootscripts
bootinstallsize=$(du -sk $TMP_DIR | cut -f1)
popd > /dev/null
rm -rf $TMP_DIR
sed -i -e s/BOOTSCRIPTS-SIZE/$bootsize/ \
-e s/BOOTSCRIPTS-INSTALL-KB/$bootinstallsize/ \
-e s/BOOTSCRIPTS-MD5SUM/$bootmd5/ $FILE

1139
bootscripts/ChangeLog Normal file

File diff suppressed because it is too large Load Diff

132
bootscripts/Makefile Normal file
View File

@ -0,0 +1,132 @@
ETCDIR=${DESTDIR}/etc
LIBDIR=${DESTDIR}/lib
SERVICEDIR=${LIBDIR}/services
MAN8=${DESTDIR}/usr/share/man/man8
SBIN=${DESTDIR}/sbin
MODE=754
DIRMODE=755
CONFMODE=644
all: links
install: all
create-dirs:
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc0.d
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc1.d
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc2.d
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc3.d
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc4.d
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc5.d
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rc6.d
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/rcS.d
install -d -m ${DIRMODE} ${ETCDIR}/rc.d/init.d
install -d -m ${DIRMODE} ${ETCDIR}/sysconfig
install -d -m ${DIRMODE} ${LIBDIR}
install -d -m ${DIRMODE} ${SERVICEDIR}
install -d -m ${DIRMODE} ${MAN8}
install -d -m ${DIRMODE} ${SBIN}
ln -sfn services ${LIBDIR}/lsb
ln -sfn rc.d/init.d ${ETCDIR}/init.d
files: create-dirs
install -m ${MODE} lfs/init.d/checkfs ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/cleanfs ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/halt ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/console ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/localnet ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/modules ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/mountfs ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/mountvirtfs ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/network ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/rc ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/reboot ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/sendsignals ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/setclock ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/swap ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/sysctl ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/sysklogd ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/template ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/udev ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/init.d/udev_retry ${ETCDIR}/rc.d/init.d/
install -m ${MODE} lfs/sbin/ifup ${SBIN}
install -m ${MODE} lfs/sbin/ifdown ${SBIN}
install -m ${CONFMODE} lfs/sbin/ifup.8 ${MAN8}
ln -sf ifup.8 ${MAN8}/ifdown.8
install -m ${MODE} lfs/lib/services/ipv4-static-route ${SERVICEDIR}
install -m ${MODE} lfs/lib/services/ipv4-static ${SERVICEDIR}
install -m ${CONFMODE} lfs/lib/services/init-functions ${SERVICEDIR}
if [ ! -f ${ETCDIR}/sysconfig/createfiles ]; then \
install -m ${CONFMODE} lfs/sysconfig/createfiles ${ETCDIR}/sysconfig/ ;\
fi
if [ ! -f ${ETCDIR}/sysconfig/modules ]; then \
install -m ${CONFMODE} lfs/sysconfig/modules ${ETCDIR}/sysconfig/ ;\
fi
if [ ! -f ${ETCDIR}/sysconfig/udev_retry ]; then \
install -m ${CONFMODE} lfs/sysconfig/udev_retry ${ETCDIR}/sysconfig/ ;\
fi
if [ ! -f ${ETCDIR}/sysconfig/rc.site ]; then \
install -m ${CONFMODE} lfs/sysconfig/rc.site ${ETCDIR}/sysconfig/ ;\
fi
links: rcS rc0 rc1 rc2 rc3 rc4 rc5 rc6
rcS: files
ln -sf ../init.d/mountvirtfs ${ETCDIR}/rc.d/rcS.d/S00mountvirtfs
ln -sf ../init.d/modules ${ETCDIR}/rc.d/rcS.d/S05modules
ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rcS.d/S08localnet
ln -sf ../init.d/udev ${ETCDIR}/rc.d/rcS.d/S10udev
ln -sf ../init.d/swap ${ETCDIR}/rc.d/rcS.d/S20swap
ln -sf ../init.d/checkfs ${ETCDIR}/rc.d/rcS.d/S30checkfs
ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rcS.d/S40mountfs
ln -sf ../init.d/cleanfs ${ETCDIR}/rc.d/rcS.d/S45cleanfs
ln -sf ../init.d/udev_retry ${ETCDIR}/rc.d/rcS.d/S50udev_retry
ln -sf ../init.d/console ${ETCDIR}/rc.d/rcS.d/S70console
ln -sf ../init.d/sysctl ${ETCDIR}/rc.d/rcS.d/S90sysctl
rc0: files
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc0.d/K80network
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc0.d/K90sysklogd
ln -sf ../init.d/sendsignals ${ETCDIR}/rc.d/rc0.d/S60sendsignals
ln -sf ../init.d/swap ${ETCDIR}/rc.d/rc0.d/S65swap
ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rc0.d/S70mountfs
ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rc0.d/S90localnet
ln -sf ../init.d/halt ${ETCDIR}/rc.d/rc0.d/S99halt
rc1: files
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc1.d/K80network
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc1.d/K90sysklogd
rc2: files
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc2.d/K80network
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc2.d/K90sysklogd
rc3: files
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc3.d/S10sysklogd
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc3.d/S20network
rc4: files
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc4.d/S10sysklogd
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc4.d/S20network
rc5: files
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc5.d/S10sysklogd
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc5.d/S20network
rc6: files
ln -sf ../init.d/network ${ETCDIR}/rc.d/rc6.d/K80network
ln -sf ../init.d/sysklogd ${ETCDIR}/rc.d/rc6.d/K90sysklogd
ln -sf ../init.d/sendsignals ${ETCDIR}/rc.d/rc6.d/S60sendsignals
ln -sf ../init.d/swap ${ETCDIR}/rc.d/rc6.d/S65swap
ln -sf ../init.d/mountfs ${ETCDIR}/rc.d/rc6.d/S70mountfs
ln -sf ../init.d/localnet ${ETCDIR}/rc.d/rc6.d/S90localnet
ln -sf ../init.d/reboot ${ETCDIR}/rc.d/rc6.d/S99reboot
uninstall:
rm -rf ${DESTDIR}/lib/services ${DESTDIR}/lib/lsb ${ETCDIR}/rc.d ${ETCDIR}/init.d \
${SBIN}/ifup ${SBIN}/ifdown ${MAN8}/ifup.8 ${MAN8}/ifdown.8 \
${ETCDIR}/sysconfig/rc
.PHONY: all create-dirs install files links rcS rc0 rc1 rc2 rc3 rc4 rc5 rc6 uninstall

74
bootscripts/README Normal file
View File

@ -0,0 +1,74 @@
Network Configuration:
Script Files:
/etc/rc.d/init.d/*
/sbin/ifup
/sbin/ifdown
/lib/lsb/*
Configuration Files:
/etc/sysconfig/ifconfig.*
Note: ifconfig.* files will be processed
in alphanumerical order on boot, and reversed on shutdown.
- IFACE : The interface that is being configured (e.g. eth0)
- SERVICE: Which script to run in services directory.
- ONBOOT : If set to yes, this interface will be started on bootup
/etc/sysconfig/network
- HOSTNAME: Value of the system's hostname (From LFS Book)
This value may also be set in /etc/sysconfig/rc.site
Additional Configuration:
SERVICE ipv4-static:
- IP : Static IP Address
- GATEWAY : Specifies the IP Address of the gateway server
- PREFIX : CIDR prefix of IP Address, defaults to 24 if not set
- PEER : IP Address of peer (for point-to-point connections and tunnels)
- BROADCAST: Broadcast address
SERVICE ipv4-static-route:
- TYPE : network (default type if not specified), default, host or unreachable
- IP : IP Address of target (for network, host and unreachable)
- PREFIX : CIDR prefix of target (for network, host and unreachable)
- GATEWAY: IP Address of gateway to reach target (for network and default)
SetClock configuration:
Configuration Files:
/etc/sysconfig/clock or /etc/sysconfig/rc.site
- UTC: 1 assumes hwclock is in UTC
0 assumes hwclock is in local time
- CLOCKPARAMS: any additional options to be passed to hwclock
CleanFS configuration:
Script Files:
/etc/rc.d/init.d/cleanfs
Configuration Files:
/etc/sysconfig/rc.site
- SKIPTMPCLEAN: skips cleaning of /tmp directory
/etc/sysconfig/createfiles
Each line is parsed, using space as a deliminator.
[NAME] [TYPE] [PERMISSIONS] [USER] [GROUP]
The below fields are currently only used on dev type.
([DEV TYPE] [MAJOR#] [MINOR#])
Name:
File/Directory/Device name
Type:
dir: creates a directory
file: creates a file
dev: creates a device
Permissions:
chmod the created file
User/Group:
chown the created file/dir to this user/group
Dev Type:
char: character [needs MAJOR#, MINOR#]
block: block [needs MAJOR#, MINOR#]
pipe: pipe
Major#:
Used by character and block devices.
Minor#:
Used by character and block devices.

View File

@ -0,0 +1,149 @@
#!/bin/sh
########################################################################
# Begin checkfs
#
# Description : File System Check
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# A. Luebke - luebke@users.sourceforge.net
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
# Based on checkfs script from LFS-3.1 and earlier.
#
# From man fsck
# 0 - No errors
# 1 - File system errors corrected
# 2 - System should be rebooted
# 4 - File system errors left uncorrected
# 8 - Operational error
# 16 - Usage or syntax error
# 32 - Fsck canceled by user request
# 128 - Shared library error
#
#########################################################################
### BEGIN INIT INFO
# Provides: checkfs
# Required-Start: udev swap $time
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Checks local filesystems before mounting.
# Description: Checks local filesystmes before mounting.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/lsb/init-functions
case "${1}" in
start)
if [ -f /fastboot ]; then
msg="/fastboot found, will omit "
msg="${msg} file system checks as requested.\n"
log_info_msg "${msg}"
exit 0
fi
log_info_msg "Mounting root file system in read-only mode... "
mount -n -o remount,ro / >/dev/null
if [ ${?} != 0 ]; then
log_failure_msg2
msg="\n\nCannot check root "
msg="${msg}filesystem because it could not be mounted "
msg="${msg}in read-only mode.\n\n"
msg="${msg}After you press Enter, this system will be "
msg="${msg}halted and powered off.\n\n"
log_failure_msg "${msg}"
log_info_msg "Press Enter to continue..."
wait_for_user
/etc/rc.d/init.d/halt stop
else
log_success_msg2
fi
if [ -f /forcefsck ]; then
msg="/forcefsck found, forcing file"
msg="${msg} system checks as requested."
log_success_msg "$msg"
options="-f"
else
options=""
fi
log_info_msg "Checking file systems..."
# Note: -a option used to be -p; but this fails e.g. on fsck.minix
if is_true "$VERBOSE_FSCK"; then
fsck ${options} -a -A -C -T
else
fsck ${options} -a -A -C -T >/dev/null
fi
error_value=${?}
if [ "${error_value}" = 0 ]; then
log_success_msg2
fi
if [ "${error_value}" = 1 ]; then
msg="\nWARNING:\n\nFile system errors "
msg="${msg}were found and have been corrected.\n"
msg="${msg} You may want to double-check that "
msg="${msg}everything was fixed properly."
log_warning_msg "$msg"
fi
if [ "${error_value}" = 2 -o "${error_value}" = 3 ]; then
msg="\nWARNING:\n\nFile system errors "
msg="${msg}were found and have been been "
msg="${msg}corrected, but the nature of the "
msg="${msg}errors require this system to be rebooted.\n\n"
msg="${msg}After you press enter, "
msg="${msg}this system will be rebooted\n\n"
log_failure_msg "$msg"
log_info_msg "Press Enter to continue..."
wait_for_user
reboot -f
fi
if [ "${error_value}" -gt 3 -a "${error_value}" -lt 16 ]; then
msg="\nFAILURE:\n\nFile system errors "
msg="${msg}were encountered that could not be "
msg="${msg}fixed automatically.\nThis system "
msg="${msg}cannot continue to boot and will "
msg="${msg}therefore be halted until those "
msg="${msg}errors are fixed manually by a "
msg="${msg}System Administrator.\n\n"
msg="${msg}After you press Enter, this system will be "
msg="${msg}halted and powered off.\n\n"
log_failure_msg "$msg"
log_info_msg "Press Enter to continue..."
wait_for_user
/etc/rc.d/init.d/halt stop
fi
if [ "${error_value}" -ge 16 ]; then
msg="FAILURE:\n\nUnexpected failure "
msg="${msg}running fsck. Exited with error "
msg="${msg} code: ${error_value}.\n"
log_info_msg $msg
exit ${error_value}
fi
exit 0
;;
*)
echo "Usage: ${0} {start}"
exit 1
;;
esac
# End checkfs

View File

@ -0,0 +1,122 @@
#!/bin/sh
########################################################################
# Begin cleanfs
#
# Description : Clean file system
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: cleanfs
# Required-Start: $local_fs
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Cleans temporary directories early in the boot process.
# Description: Cleans temporary directories /var/run, /var/lock, and
# optionally, /tmp. cleanfs also creates /var/run/utmp
# and any files defined in /etc/sysconfig/createfiles.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/lsb/init-functions
# Function to create files/directory on boot.
create_files()
{
# Input to file descriptor 9 and output to stdin (redirection)
exec 9>&0 < /etc/sysconfig/createfiles
while read name type perm usr grp dtype maj min junk
do
# Ignore comments and blank lines.
case "${name}" in
""|\#*) continue ;;
esac
# Ignore existing files.
if [ ! -e "${name}" ]; then
# Create stuff based on its type.
case "${type}" in
dir)
mkdir "${name}"
;;
file)
:> "${name}"
;;
dev)
case "${dtype}" in
char)
mknod "${name}" c ${maj} ${min}
;;
block)
mknod "${name}" b ${maj} ${min}
;;
pipe)
mknod "${name}" p
;;
*)
log_warning_msg "\nUnknown device type: ${dtype}"
;;
esac
;;
*)
log_warning_msg "\nUnknown type: ${type}"
continue
;;
esac
# Set up the permissions, too.
chown ${usr}:${grp} "${name}"
chmod ${perm} "${name}"
fi
done
# Close file descriptor 9 (end redirection)
exec 0>&9 9>&-
return 0
}
case "${1}" in
start)
log_info_msg "Cleaning file systems:"
if [ "${SKIPTMPCLEAN}" = "" ]; then
log_info_msg2 " /tmp"
cd /tmp &&
find . -xdev -mindepth 1 ! -name lost+found -delete || failed=1
fi
> /var/run/utmp
if grep -q '^utmp:' /etc/group ; then
chmod 664 /var/run/utmp
chgrp utmp /var/run/utmp
fi
(exit ${failed})
evaluate_retval
if egrep -qv '^(#|$)' /etc/sysconfig/createfiles 2>/dev/null; then
log_info_msg "Creating files and directories... "
create_files # Always returns 0
evaluate_retval
fi
exit $failed
;;
*)
echo "Usage: ${0} {start}"
exit 1
;;
esac
# End cleanfs

View File

@ -0,0 +1,112 @@
#!/bin/sh
########################################################################
# Begin console
#
# Description : Sets keymap and screen font
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Alexander E. Patrakov
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: console
# Required-Start:
# Should-Start: $local_fs
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Sets up a localised console.
# Description: Sets up fonts and language settings for the user's
# local as defined by /etc/sysconfig/console.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/lsb/init-functions
# Native English speakers probably don't have /etc/sysconfig/console at all
[ -r /etc/sysconfig/console ] && . /etc/sysconfig/console
is_true()
{
[ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ]
}
failed=0
case "${1}" in
start)
# See if we need to do anything
if [ -z "${KEYMAP}" ] && [ -z "${KEYMAP_CORRECTIONS}" ] &&
[ -z "${FONT}" ] && [ -z "${LEGACY_CHARSET}" ] &&
! is_true "${UNICODE}"; then
exit 0
fi
# There should be no bogus failures below this line!
log_info_msg "Setting up Linux console..."
# Figure out if a framebuffer console is used
[ -d /sys/class/graphics/fb0 ] && use_fb=1 || use_fb=0
# Figure out the command to set the console into the
# desired mode
is_true "${UNICODE}" &&
MODE_COMMAND="echo -en '\033%G' && kbd_mode -u" ||
MODE_COMMAND="echo -en '\033%@\033(K' && kbd_mode -a"
# On framebuffer consoles, font has to be set for each vt in
# UTF-8 mode. This doesn't hurt in non-UTF-8 mode also.
! is_true "${use_fb}" || [ -z "${FONT}" ] ||
MODE_COMMAND="${MODE_COMMAND} && setfont ${FONT}"
# Apply that command to all consoles mentioned in
# /etc/inittab. Important: in the UTF-8 mode this should
# happen before setfont, otherwise a kernel bug will
# show up and the unicode map of the font will not be
# used.
for TTY in `grep '^[^#].*respawn:/sbin/agetty' /etc/inittab |
grep -o '\btty[[:digit:]]*\b'`
do
openvt -f -w -c ${TTY#tty} -- \
/bin/sh -c "${MODE_COMMAND}" || failed=1
done
# Set the font (if not already set above) and the keymap
[ "${use_fb}" == "1" ] || [ -z "${FONT}" ] || setfont $FONT || failed=1
[ -z "${KEYMAP}" ] ||
loadkeys ${KEYMAP} >/dev/null 2>&1 ||
failed=1
[ -z "${KEYMAP_CORRECTIONS}" ] ||
loadkeys ${KEYMAP_CORRECTIONS} >/dev/null 2>&1 ||
failed=1
# Convert the keymap from $LEGACY_CHARSET to UTF-8
[ -z "$LEGACY_CHARSET" ] ||
dumpkeys -c "$LEGACY_CHARSET" | loadkeys -u >/dev/null 2>&1 ||
failed=1
# If any of the commands above failed, the trap at the
# top would set $failed to 1
( exit $failed )
evaluate_retval
exit $failed
;;
*)
echo "Usage: ${0} {start}"
exit 1
;;
esac
# End console

View File

@ -0,0 +1,39 @@
#!/bin/sh
########################################################################
# Begin halt
#
# Description : Halt Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: halt
# Required-Start:
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: 0
# Default-Stop:
# Short-Description: Halts the system.
# Description: Halts the System.
# X-LFS-Provided-By: LFS
### END INIT INFO
case "${1}" in
stop)
halt -d -f -i -p
;;
*)
echo "Usage: {stop}"
exit 1
;;
esac
# End halt

View File

@ -0,0 +1,70 @@
#!/bin/sh
########################################################################
# Begin localnet
#
# Description : Loopback device
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: localnet
# Required-Start: $local_fs
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Starts the local network.
# Description: Sets the hostname of the machine and starts the
# loopback interface.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/lsb/init-functions
[ -r /etc/sysconfig/network ] && . /etc/sysconfig/network
[ -r /etc/hostname ] && HOSTNAME=`cat /etc/hostname`
case "${1}" in
start)
log_info_msg "Bringing up the loopback interface..."
ip addr add 127.0.0.1/8 label lo dev lo
ip link set lo up
evaluate_retval
log_info_msg "Setting hostname to ${HOSTNAME}..."
hostname ${HOSTNAME}
evaluate_retval
;;
stop)
log_info_msg "Bringing down the loopback interface..."
ip link set lo down
evaluate_retval
;;
restart)
${0} stop
sleep 1
${0} start
;;
status)
echo "Hostname is: $(hostname)"
ip link show lo
;;
*)
echo "Usage: ${0} {start|stop|restart|status}"
exit 1
;;
esac
exit 0
# End localnet

View File

@ -0,0 +1,82 @@
#!/bin/sh
########################################################################
# Begin modules
#
# Description : Module auto-loading script
#
# Authors : Zack Winkles
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: modules
# Required-Start: mountvirtfs sysctl
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Loads required modules.
# Description: Loads modules listed in /etc/sysconfig/modules.
# X-LFS-Provided-By: LFS
### END INIT INFO
# Assure that the kernel has module support.
[ -e /proc/modules ] || exit 0
. /lib/lsb/init-functions
case "${1}" in
start)
# Exit if there's no modules file or there are no
# valid entries
[ -r /etc/sysconfig/modules ] || exit 0
egrep -qv '^($|#)' /etc/sysconfig/modules || exit 0
log_info_msg "Loading modules:"
# Only try to load modules if the user has actually given us
# some modules to load.
while read module args; do
# Ignore comments and blank lines.
case "$module" in
""|"#"*) continue ;;
esac
# Attempt to load the module, passing any arguments provided.
modprobe ${module} ${args} >/dev/null
# Print the module name if successful, otherwise take note.
if [ $? -eq 0 ]; then
log_info_msg2 " ${module}"
else
failedmod="${failedmod} ${module}"
fi
done < /etc/sysconfig/modules
# Print a message about successfully loaded modules on the correct line.
log_success_msg2
# Print a failure message with a list of any modules that
# may have failed to load.
if [ -n "${failedmod}" ]; then
log_failure_msg "Failed to load modules:${failedmod}"
exit 1
fi
;;
*)
echo "Usage: ${0} {start}"
exit 1
;;
esac
exit 0
# End modules

View File

@ -0,0 +1,77 @@
#!/bin/sh
########################################################################
# Begin mountfs
#
# Description : File System Mount Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: $local_fs
# Required-Start: udev checkfs
# Should-Start:
# Required-Stop: swap
# Should-Stop:
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Mounts/unmounts local filesystems defined in /etc/fstab.
# Description: Remounts root filesystem read/write and mounts all
# remaining local filesystems defined in /etc/fstab on
# start. Remounts root filesystem read-only and unmounts
# remaining filesystems on stop.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/lsb/init-functions
case "${1}" in
start)
log_info_msg "Remounting root file system in read-write mode..."
mount --options remount,rw / >/dev/null
evaluate_retval
# Remove fsck-related file system watermarks.
rm -f /fastboot /forcefsck
# Make sure /dev/pts exists
mkdir -p /dev/pts
# This will mount all filesystems that do not have _netdev in
# their option list. _netdev denotes a network filesystem.
log_info_msg "Mounting remaining file systems..."
mount --all --test-opts no_netdev >/dev/null
evaluate_retval
exit $failed
;;
stop)
# Don't unmount virtual file systems like /run
log_info_msg "Unmounting all other currently mounted file systems..."
# Ensure any loop devies are removed
losetup -D
umount --all --detach-loop --read-only \
--types notmpfs,nosysfs,nodevtmpfs,noproc,nodevpts >/dev/null
evaluate_retval
# Make sure / is mounted read only (umount bug)
mount --options remount,ro /
# Make all LVM volume groups unavailable, if appropriate
# This fails if swap or / are on an LVM partition
#if [ -x /sbin/vgchange ]; then /sbin/vgchange -an > /dev/null; fi
;;
*)
echo "Usage: ${0} {start|stop}"
exit 1
;;
esac
# End mountfs

View File

@ -0,0 +1,72 @@
#!/bin/sh
########################################################################
# Begin mountvirtfs
#
# Description : Mount proc, sysfs, and run
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: mountvirtfs
# Required-Start:
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Mounts /sys and /proc virtual (kernel) filesystems.
# Mounts /run (tmpfs) and /dev (devtmpfs).
# Description: Mounts /sys and /proc virtual (kernel) filesystems.
# Mounts /run (tmpfs) and /dev (devtmpfs).
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/lsb/init-functions
case "${1}" in
start)
# Make sure /run is available before logging any messages
if ! mountpoint /run >/dev/null; then
mount /run || failed=1
fi
mkdir -p /run/lock /run/shm
chmod 1777 /run/shm /run/lock
log_info_msg "Mounting virtual file systems: ${INFO}/run"
if ! mountpoint /proc >/dev/null; then
log_info_msg2 " ${INFO}/proc"
mount -o nosuid,noexec,nodev /proc || failed=1
fi
if ! mountpoint /sys >/dev/null; then
log_info_msg2 " ${INFO}/sys"
mount -o nosuid,noexec,nodev /sys || failed=1
fi
if ! mountpoint /dev >/dev/null; then
log_info_msg2 " ${INFO}/dev"
mount -o mode=0755,nosuid /dev || failed=1
fi
ln -sfn /run/shm /dev/shm
(exit ${failed})
evaluate_retval
exit $failed
;;
*)
echo "Usage: ${0} {start}"
exit 1
;;
esac
# End mountvirtfs

View File

@ -0,0 +1,87 @@
#!/bin/sh
########################################################################
# Begin network
#
# Description : Network Control Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# Nathan Coulson - nathan@linuxfromscratch.org
# Kevin P. Fleming - kpfleming@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: $network
# Required-Start: $local_fs swap localnet
# Should-Start: $syslog
# Required-Stop: $local_fs swap localnet
# Should-Stop: $syslog
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Starts and configures network interfaces.
# Description: Starts and configures network interfaces.
# X-LFS-Provided-By: LFS
### END INIT INFO
case "${1}" in
start)
# Start all network interfaces
for file in /etc/sysconfig/ifconfig.*
do
interface=${file##*/ifconfig.}
# Skip if $file is * (because nothing was found)
if [ "${interface}" = "*" ]
then
continue
fi
/sbin/ifup ${interface}
done
;;
stop)
# Unmount any network mounted file systems
umount --all --force --types nfs,cifs,nfs4
# Reverse list
net_files=""
for file in /etc/sysconfig/ifconfig.*
do
net_files="${file} ${net_files}"
done
# Stop all network interfaces
for file in ${net_files}
do
interface=${file##*/ifconfig.}
# Skip if $file is * (because nothing was found)
if [ "${interface}" = "*" ]
then
continue
fi
/sbin/ifdown ${interface}
done
;;
restart)
${0} stop
sleep 1
${0} start
;;
*)
echo "Usage: ${0} {start|stop|restart}"
exit 1
;;
esac
exit 0
# End network

236
bootscripts/lfs/init.d/rc Normal file
View File

@ -0,0 +1,236 @@
#!/bin/bash
########################################################################
# Begin rc
#
# Description : Main Run Level Control Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# : DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
. /lib/lsb/init-functions
print_error_msg()
{
log_failure_msg
# $i is set when called
MSG="FAILURE:\n\nYou should not be reading this error message.\n\n"
MSG="${MSG}It means that an unforeseen error took place in\n"
MSG="${MSG}${i},\n"
MSG="${MSG}which exited with a return value of ${error_value}.\n"
MSG="${MSG}If you're able to track this error down to a bug in one of\n"
MSG="${MSG}the files provided by the ${DISTRO_MINI} book,\n"
MSG="${MSG}please be so kind to inform us at ${DISTRO_CONTACT}.\n"
log_failure_msg "${MSG}"
log_info_msg "Press Enter to continue..."
wait_for_user
}
check_script_status()
{
# $i is set when called
if [ ! -f ${i} ]; then
log_warning_msg "${i} is not a valid symlink."
SCRIPT_STAT="1"
fi
if [ ! -x ${i} ]; then
log_warning_msg "${i} is not executable, skipping."
SCRIPT_STAT="1"
fi
}
run()
{
if [ -z $interactive ]; then
${1} ${2}
return $?
fi
while true; do
read -p "Run ${1} ${2} (Yes/no/continue)? " -n 1 runit
echo
case ${runit} in
c | C)
interactive=""
${i} ${2}
ret=${?}
break;
;;
n | N)
return 0
;;
y | Y)
${i} ${2}
ret=${?}
break
;;
esac
done
return $ret
}
# Read any local settings/overrides
[ -r /etc/sysconfig/rc.site ] && source /etc/sysconfig/rc.site
DISTRO=${DISTRO:-"Linux From Scratch"}
DISTRO_CONTACT=${DISTRO_CONTACT:-"lfs-dev@linuxfromscratch.org (Registration required)"}
DISTRO_MINI=${DISTRO_MINI:-"LFS"}
IPROMPT=${IPROMPT:-"no"}
# These 3 signals will not cause our script to exit
trap "" INT QUIT TSTP
[ "${1}" != "" ] && runlevel=${1}
if [ "${runlevel}" == "" ]; then
echo "Usage: ${0} <runlevel>" >&2
exit 1
fi
previous=${PREVLEVEL}
[ "${previous}" == "" ] && previous=N
if [ ! -d /etc/rc.d/rc${runlevel}.d ]; then
log_info_msg "/etc/rc.d/rc${runlevel}.d does not exist.\n"
exit 1
fi
if [ "$runlevel" == "6" -o "$runlevel" == "0" ]; then IPROMPT="no"; fi
# Note: In ${LOGLEVEL:-7}, it is ':' 'dash' '7', not minus 7
if [ "$runlevel" == "S" ]; then
[ -r /etc/sysconfig/console ] && source /etc/sysconfig/console
dmesg -n "${LOGLEVEL:-7}"
fi
if [ "${IPROMPT}" == "yes" -a "${runlevel}" == "S" ]; then
# The total length of the distro welcome string, without escape codes
wlen=${wlen:-$(echo "Welcome to ${DISTRO}" | wc -c )}
welcome_message=${welcome_message:-"Welcome to ${INFO}${DISTRO}${NORMAL}"}
# The total length of the interactive string, without escape codes
ilen=${ilen:-$(echo "Press 'I' to enter interactive startup" | wc -c )}
i_message=${i_message:-"Press '${FAILURE}I${NORMAL}' to enter interactive startup"}
# dcol and icol are spaces before the message to center the message
# on screen. itime is the amount of wait time for the user to press a key
wcol=$(( ( ${COLUMNS} - ${wlen} ) / 2 ))
icol=$(( ( ${COLUMNS} - ${ilen} ) / 2 ))
itime=${itime:-"3"}
echo -e "\n\n"
echo -e "\\033[${wcol}G${welcome_message}"
echo -e "\\033[${icol}G${i_message}${NORMAL}"
echo ""
read -t "${itime}" -n 1 interactive 2>&1 > /dev/null
fi
# Make lower case
[ "${interactive}" == "I" ] && interactive="i"
[ "${interactive}" != "i" ] && interactive=""
# Read the state file if it exists from runlevel S
[ -r /var/run/interactive ] && source /var/run/interactive
# Attempt to stop all services started by the previous runlevel,
# and killed in this runlevel
if [ "${previous}" != "N" ]; then
for i in $(ls -v /etc/rc.d/rc${runlevel}.d/K* 2> /dev/null)
do
check_script_status
if [ "${SCRIPT_STAT}" == "1" ]; then
SCRIPT_STAT="0"
continue
fi
suffix=${i#/etc/rc.d/rc$runlevel.d/K[0-9][0-9]}
prev_start=/etc/rc.d/rc$previous.d/S[0-9][0-9]$suffix
sysinit_start=/etc/rc.d/rcS.d/S[0-9][0-9]$suffix
if [ "${runlevel}" != "0" -a "${runlevel}" != "6" ]; then
if [ ! -f ${prev_start} -a ! -f ${sysinit_start} ]; then
MSG="WARNING:\n\n${i} can't be "
MSG="${MSG}executed because it was not "
MSG="${MSG}not started in the previous "
MSG="${MSG}runlevel (${previous})."
log_warning_msg "$MSG"
continue
fi
fi
run ${i} stop
error_value=${?}
if [ "${error_value}" != "0" ]; then print_error_msg; fi
done
fi
if [ "${previous}" == "N" ]; then export IN_BOOT=1; fi
if [ "$runlevel" == "6" -a -n "${FASTBOOT}" ]; then
touch /fastboot
fi
# Start all functions in this runlevel
for i in $( ls -v /etc/rc.d/rc${runlevel}.d/S* 2> /dev/null)
do
if [ "${previous}" != "N" ]; then
suffix=${i#/etc/rc.d/rc$runlevel.d/S[0-9][0-9]}
stop=/etc/rc.d/rc$runlevel.d/K[0-9][0-9]$suffix
prev_start=/etc/rc.d/rc$previous.d/S[0-9][0-9]$suffix
[ -f ${prev_start} -a ! -f ${stop} ] && continue
fi
check_script_status
if [ "${SCRIPT_STAT}" == "1" ]; then
SCRIPT_STAT="0"
continue
fi
case ${runlevel} in
0|6)
run ${i} stop
;;
*)
run ${i} start
;;
esac
error_value=${?}
if [ "${error_value}" != "0" ]; then print_error_msg; fi
done
# Store interactive variable on switch from runlevel S and remove if not
if [ "${runlevel}" == "S" -a "${interactive}" == "i" ]; then
echo "interactive=\"i\"" > /var/run/interactive
else
rm -f /var/run/interactive 2> /dev/null
fi
# Copy the boot log on initial boot only
if [ "${previous}" == "N" -a "${runlevel}" != "S" ]; then
cat $BOOTLOG >> /var/log/boot.log
# Mark the end of boot
echo "--------" >> /var/log/boot.log
# Remove the temporary file
rm -f $BOOTLOG 2> /dev/null
fi
# End rc

View File

@ -0,0 +1,43 @@
#!/bin/sh
########################################################################
# Begin reboot
#
# Description : Reboot Scripts
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: reboot
# Required-Start:
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: 6
# Default-Stop:
# Short-Description: Reboots the system.
# Description: Reboots the System.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/lsb/init-functions
case "${1}" in
stop)
log_info_msg "Restarting system..."
reboot -d -f -i
;;
*)
echo "Usage: ${0} {stop}"
exit 1
;;
esac
# End reboot

View File

@ -0,0 +1,66 @@
#!/bin/sh
########################################################################
# Begin sendsignals
#
# Description : Sendsignals Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: sendsignals
# Required-Start:
# Should-Start:
# Required-Stop: $local_fs swap localnet
# Should-Stop:
# Default-Start:
# Default-Stop: 0 6
# Short-Description: Attempts to kill remaining processes.
# Description: Attempts to kill remaining processes.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/lsb/init-functions
case "${1}" in
stop)
log_info_msg "Sending all processes the TERM signal..."
killall5 -15
error_value=${?}
sleep ${KILLDELAY}
if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
log_success_msg
else
log_failure_msg
fi
log_info_msg "Sending all processes the KILL signal..."
killall5 -9
error_value=${?}
sleep ${KILLDELAY}
if [ "${error_value}" = 0 -o "${error_value}" = 2 ]; then
log_success_msg
else
log_failure_msg
fi
;;
*)
echo "Usage: ${0} {stop}"
exit 1
;;
esac
exit 0
# End sendsignals

View File

@ -0,0 +1,63 @@
#!/bin/sh
########################################################################
# Begin setclock
#
# Description : Setting Linux Clock
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides:
# Required-Start:
# Should-Start: modules
# Required-Stop:
# Should-Stop: $syslog
# Default-Start: S
# Default-Stop:
# Short-Description: Stores and restores time from the hardware clock
# Description: On boot, system time is obtained from hwclock. The
# hardware clock can also be set on shutdown.
# X-LFS-Provided-By: LFS BLFS
### END INIT INFO
. /lib/lsb/init-functions
[ -r /etc/sysconfig/clock ] && . /etc/sysconfig/clock
case "${UTC}" in
yes|true|1)
CLOCKPARAMS="${CLOCKPARAMS} --utc"
;;
no|false|0)
CLOCKPARAMS="${CLOCKPARAMS} --localtime"
;;
esac
case ${1} in
start)
hwclock --hctosys ${CLOCKPARAMS} >/dev/null
;;
stop)
log_info_msg "Setting hardware clock..."
hwclock --systohc ${CLOCKPARAMS} >/dev/null
evaluate_retval
;;
*)
echo "Usage: ${0} {start|stop}"
exit 1
;;
esac
exit 0

View File

@ -0,0 +1,63 @@
#!/bin/sh
########################################################################
# Begin swap
#
# Description : Swap Control Script
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: swap
# Required-Start: udev
# Should-Start: modules
# Required-Stop: localnet
# Should-Stop:
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Mounts and unmounts swap partitions.
# Description: Mounts and unmounts swap partitions defined in
# /etc/fstab.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/lsb/init-functions
case "${1}" in
start)
log_info_msg "Activating all swap files/partitions..."
swapon -a
evaluate_retval
;;
stop)
log_info_msg "Deactivating all swap files/partitions..."
swapoff -a
evaluate_retval
;;
restart)
${0} stop
sleep 1
${0} start
;;
status)
log_success_msg "Retrieving swap status."
swapon -s
;;
*)
echo "Usage: ${0} {start|stop|restart|status}"
exit 1
;;
esac
exit 0
# End swap

View File

@ -0,0 +1,54 @@
#!/bin/sh
########################################################################
# Begin sysctl
#
# Description : File uses /etc/sysctl.conf to set kernel runtime
# parameters
#
# Authors : Nathan Coulson (nathan@linuxfromscratch.org)
# Matthew Burgress (matthew@linuxfromscratch.org)
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: sysctl
# Required-Start: mountvirtfs
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Makes changes to the proc filesystem
# Description: Makes changes to the proc filesystem as defined in
# /etc/sysctl.conf. See 'man sysctl(8)'.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/lsb/init-functions
case "${1}" in
start)
if [ -f "/etc/sysctl.conf" ]; then
log_info_msg "Setting kernel runtime parameters..."
sysctl -q -p
evaluate_retval
fi
;;
status)
sysctl -a
;;
*)
echo "Usage: ${0} {start|status}"
exit 1
;;
esac
exit 0
# End sysctl

View File

@ -0,0 +1,82 @@
#!/bin/sh
########################################################################
# Begin sysklogd
#
# Description : Sysklogd loader
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: $syslog
# Required-Start: localnet
# Should-Start:
# Required-Stop: $local_fs sendsignals
# Should-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Starts kernel and system log daemons.
# Description: Starts kernel and system log daemons.
# /etc/fstab.
# X-LFS-Provided-By: LFS
### END INIT INFO
# Note: sysklogd is not started in runlevel 2 due to possible
# remote logging configurations
. /lib/lsb/init-functions
case "${1}" in
start)
log_info_msg "Starting system log daemon..."
parms=${SYSKLOGD_PARMS-'-m 0'}
start_daemon /sbin/syslogd $parms
evaluate_retval
log_info_msg "Starting kernel log daemon..."
start_daemon /sbin/klogd
evaluate_retval
;;
stop)
log_info_msg "Stopping kernel log daemon..."
killproc /sbin/klogd
evaluate_retval
log_info_msg "Stopping system log daemon..."
killproc /sbin/syslogd
evaluate_retval
;;
reload)
log_info_msg "Reloading system log daemon config file..."
pid=`pidofproc syslogd`
kill -HUP "${pid}"
evaluate_retval
;;
restart)
${0} stop
sleep 1
${0} start
;;
status)
statusproc /sbin/syslogd
statusproc klogd
;;
*)
echo "Usage: ${0} {start|stop|reload|restart|status}"
exit 1
;;
esac
exit 0
# End sysklogd

View File

@ -0,0 +1,55 @@
#!/bin/sh
########################################################################
# Begin scriptname
#
# Description :
#
# Authors :
#
# Version : LFS x.x
#
# Notes :
#
########################################################################
### BEGIN INIT INFO
# Provides: template
# Required-Start:
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description:
# Description:
# X-LFS-Provided-By:
### END INIT INFO
. /lib/lsb/init-functions
case "${1}" in
start)
log_info_msg "Starting..."
start_daemon fully_qualified_path
;;
stop)
log_info_msg "Stopping..."
killproc fully_qualified_path
;;
restart)
${0} stop
sleep 1
${0} start
;;
*)
echo "Usage: ${0} {start|stop|restart}"
exit 1
;;
esac
exit 0
# End scriptname

View File

@ -0,0 +1,76 @@
#!/bin/sh
########################################################################
# Begin udev
#
# Description : Udev cold-plugging script
#
# Authors : Zack Winkles, Alexander E. Patrakov
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: udev $time
# Required-Start:
# Should-Start: modules
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Populates /dev with device nodes.
# Description: Mounts a tempfs on /dev and starts the udevd daemon.
# Device nodes are created as defined by udev.
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/lsb/init-functions
case "${1}" in
start)
log_info_msg "Populating /dev with device nodes... "
if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
log_failure_msg2
msg="FAILURE:\n\nUnable to create "
msg="${msg}devices without a SysFS filesystem\n\n"
msg="${msg}After you press Enter, this system "
msg="${msg}will be halted and powered off.\n\n"
log_info_msg "$msg"
log_info_msg "Press Enter to continue..."
wait_for_user
/etc/rc.d/init.d/halt stop
fi
# Start the udev daemon to continually watch for, and act on,
# uevents
/sbin/udevd --daemon
# Now traverse /sys in order to "coldplug" devices that have
# already been discovered
/sbin/udevadm trigger --action=add --type=subsystems
/sbin/udevadm trigger --action=add --type=devices
/sbin/udevadm trigger --action=change --type=devices
# Now wait for udevd to process the uevents we triggered
if ! is_true "$OMIT_UDEV_SETTLE"; then
/sbin/udevadm settle
fi
# If any LVM based partitions are on the system, ensure they
# are activated so they can be used.
if [ -x /sbin/vgchange ]; then /sbin/vgchange -a y >/dev/null; fi
log_success_msg2
;;
*)
echo "Usage ${0} {start}"
exit 1
;;
esac
exit 0
# End udev

View File

@ -0,0 +1,75 @@
#!/bin/sh
########################################################################
# Begin udev_retry
#
# Description : Udev cold-plugging script (retry)
#
# Authors : Alexander E. Patrakov
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
# Bryan Kadzban -
#
# Version : LFS 7.0
#
########################################################################
### BEGIN INIT INFO
# Provides: udev_retry
# Required-Start: udev
# Should-Start: $local_fs
# Required-Stop:
# Should-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Replays failed uevents and creates additional devices.
# Description: Replays any failed uevents that were skipped due to
# slow hardware initialization, and creates those needed
# device nodes
# X-LFS-Provided-By: LFS
### END INIT INFO
. /lib/lsb/init-functions
case "${1}" in
start)
log_info_msg "Retrying failed uevents, if any..."
# As of udev-186, the --run option is no longer valid
#rundir=$(/sbin/udevadm info --run)
rundir=/run/udev
# From Debian: "copy the rules generated before / was mounted
# read-write":
for file in ${rundir}/tmp-rules--*; do
dest=${file##*tmp-rules--}
[ "$dest" = '*' ] && break
cat $file >> /etc/udev/rules.d/$dest
rm -f $file
done
# Re-trigger the uevents that may have failed,
# in hope they will succeed now
/bin/sed -e 's/#.*$//' /etc/sysconfig/udev_retry | /bin/grep -v '^$' | \
while read line ; do
for subsystem in $line ; do
/sbin/udevadm trigger --subsystem-match=$subsystem --action=add
done
done
# Now wait for udevd to process the uevents we triggered
if ! is_true "$OMIT_UDEV_RETRY_SETTLE"; then
/sbin/udevadm settle
fi
evaluate_retval
;;
*)
echo "Usage ${0} {start}"
exit 1
;;
esac
exit 0
# End udev_retry

View File

@ -0,0 +1,804 @@
#!/bin/sh
########################################################################
#
# Begin /lib/lsb/init-funtions
#
# Description : Run Level Control Functions
#
# Authors : Gerard Beekmans - gerard@linuxfromscratch.org
# : DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
# Notes : With code based on Matthias Benkmann's simpleinit-msb
# http://winterdrache.de/linux/newboot/index.html
#
# The file should be located in /lib/lsb
#
########################################################################
## Environmental setup
# Setup default values for environment
umask 022
export PATH="/bin:/usr/bin:/sbin:/usr/sbin"
## Set color commands, used via echo
# Please consult `man console_codes for more information
# under the "ECMA-48 Set Graphics Rendition" section
#
# Warning: when switching from a 8bit to a 9bit font,
# the linux console will reinterpret the bold (1;) to
# the top 256 glyphs of the 9bit font. This does
# not affect framebuffer consoles
NORMAL="\\033[0;39m" # Standard console grey
SUCCESS="\\033[1;32m" # Success is green
WARNING="\\033[1;33m" # Warnings are yellow
FAILURE="\\033[1;31m" # Failures are red
INFO="\\033[1;36m" # Information is light cyan
BRACKET="\\033[1;34m" # Brackets are blue
# Use a colored prefix
BMPREFIX=" "
SUCCESS_PREFIX="${SUCCESS} * ${NORMAL}"
FAILURE_PREFIX="${FAILURE}*****${NORMAL}"
WARNING_PREFIX="${WARNING} *** ${NORMAL}"
SKIP_PREFIX="${INFO} S ${NORMAL}"
SUCCESS_SUFFIX="${BRACKET}[${SUCCESS} OK ${BRACKET}]${NORMAL}"
FAILURE_SUFFIX="${BRACKET}[${FAILURE} FAIL ${BRACKET}]${NORMAL}"
WARNING_SUFFIX="${BRACKET}[${WARNING} WARN ${BRACKET}]${NORMAL}"
SKIP_SUFFIX="${BRACKET}[${INFO} SKIP ${BRACKET}]${NORMAL}"
BOOTLOG=/run/bootlog
KILLDELAY=3
SCRIPT_STAT="0"
# Set any user specified environment variables e.g. HEADLESS
[ -r /etc/sysconfig/rc.site ] && . /etc/sysconfig/rc.site
## Screen Dimensions
# Find current screen size
if [ -z "${COLUMNS}" ]; then
COLUMNS=$(stty size)
COLUMNS=${COLUMNS##* }
fi
# When using remote connections, such as a serial port, stty size returns 0
if [ "${COLUMNS}" = "0" ]; then
COLUMNS=80
fi
## Measurements for positioning result messages
COL=$((${COLUMNS} - 8))
WCOL=$((${COL} - 2))
## Set Cursor Position Commands, used via echo
SET_COL="\\033[${COL}G" # at the $COL char
SET_WCOL="\\033[${WCOL}G" # at the $WCOL char
CURS_UP="\\033[1A\\033[0G" # Up one line, at the 0'th char
CURS_ZERO="\\033[0G"
################################################################################
# start_daemon() #
# Usage: start_daemon [-f] [-n nicelevel] [-p pidfile] pathname [args...] #
# #
# Purpose: This runs the specified program as a daemon #
# #
# Inputs: -f: (force) run the program even if it is already running. #
# -n nicelevel: specify a nice level. See 'man nice(1)'. #
# -p pidfile: use the specified file to determine PIDs. #
# pathname: the complete path to the specified program #
# args: additional arguments passed to the program (pathname) #
# #
# Return values (as defined by LSB exit codes): #
# 0 - program is running or service is OK #
# 1 - generic or unspecified error #
# 2 - invalid or excessive argument(s) #
# 5 - program is not installed #
################################################################################
start_daemon()
{
local force=""
local nice="0"
local pidfile=""
local pidlist=""
local retval=""
# Process arguments
while true
do
case "${1}" in
-f)
force="1"
shift 1
;;
-n)
nice="${2}"
shift 2
;;
-p)
pidfile="${2}"
shift 2
;;
-*)
return 2
;;
*)
program="${1}"
break
;;
esac
done
# Check for a valid program
if [ ! -e "${program}" ]; then return 5; fi
# Execute
if [ -z "${force}" ]; then
if [ -z "${pidfile}" ]; then
# Determine the pid by discovery
pidlist=`pidofproc "${1}"`
retval="${?}"
else
# The PID file contains the needed PIDs
# Note that by LSB requirement, the path must be given to pidofproc,
# however, it is not used by the current implementation or standard.
pidlist=`pidofproc -p "${pidfile}" "${1}"`
retval="${?}"
fi
# Return a value ONLY
# It is the init script's (or distribution's functions) responsibilty
# to log messages!
case "${retval}" in
0)
# Program is already running correctly, this is a
# successful start.
return 0
;;
1)
# Program is not running, but an invalid pid file exists
# remove the pid file and continue
rm -f "${pidfile}"
;;
3)
# Program is not running and no pidfile exists
# do nothing here, let start_deamon continue.
;;
*)
# Others as returned by status values shall not be interpreted
# and returned as an unspecified error.
return 1
;;
esac
fi
# Do the start!
nice -n "${nice}" "${@}"
}
################################################################################
# killproc() #
# Usage: killproc [-p pidfile] pathname [signal] #
# #
# Purpose: Send control signals to running processes #
# #
# Inputs: -p pidfile, uses the specified pidfile #
# pathname, pathname to the specified program #
# signal, send this signal to pathname #
# #
# Return values (as defined by LSB exit codes): #
# 0 - program (pathname) has stopped/is already stopped or a #
# running program has been sent specified signal and stopped #
# successfully #
# 1 - generic or unspecified error #
# 2 - invalid or excessive argument(s) #
# 5 - program is not installed #
# 7 - program is not running and a signal was supplied #
################################################################################
killproc()
{
local pidfile
local program
local prefix
local progname
local signal="-TERM"
local fallback="-KILL"
local nosig
local pidlist
local retval
local pid
local delay="30"
local piddead
local dtime
# Process arguments
while true; do
case "${1}" in
-p)
pidfile="${2}"
shift 2
;;
*)
program="${1}"
if [ -n "${2}" ]; then
signal="${2}"
fallback=""
else
nosig=1
fi
# Error on additional arguments
if [ -n "${3}" ]; then
return 2
else
break
fi
;;
esac
done
# Check for a valid program
if [ ! -e "${program}" ]; then return 5; fi
# Check for a valid signal
check_signal "${signal}"
if [ "${?}" -ne "0" ]; then return 2; fi
# Get a list of pids
if [ -z "${pidfile}" ]; then
# determine the pid by discovery
pidlist=`pidofproc "${1}"`
retval="${?}"
else
# The PID file contains the needed PIDs
# Note that by LSB requirement, the path must be given to pidofproc,
# however, it is not used by the current implementation or standard.
pidlist=`pidofproc -p "${pidfile}" "${1}"`
retval="${?}"
fi
# Return a value ONLY
# It is the init script's (or distribution's functions) responsibilty
# to log messages!
case "${retval}" in
0)
# Program is running correctly
# Do nothing here, let killproc continue.
;;
1)
# Program is not running, but an invalid pid file exists
# Remove the pid file.
rm -f "${pidfile}"
# This is only a success if no signal was passed.
if [ -n "${nosig}" ]; then
return 0
else
return 7
fi
;;
3)
# Program is not running and no pidfile exists
# This is only a success if no signal was passed.
if [ -n "${nosig}" ]; then
return 0
else
return 7
fi
;;
*)
# Others as returned by status values shall not be interpreted
# and returned as an unspecified error.
return 1
;;
esac
# Perform different actions for exit signals and control signals
check_sig_type "${signal}"
if [ "${?}" -eq "0" ]; then # Signal is used to terminate the program
# Account for empty pidlist (pid file still exists and no
# signal was given)
if [ "${pidlist}" != "" ]; then
# Kill the list of pids
for pid in ${pidlist}; do
kill -0 "${pid}" 2> /dev/null
if [ "${?}" -ne "0" ]; then
# Process is dead, continue to next and assume all is well
continue
else
kill "${signal}" "${pid}" 2> /dev/null
# Wait up to ${delay}/10 seconds to for "${pid}" to
# terminate in 10ths of a second
while [ "${delay}" -ne "0" ]; do
kill -0 "${pid}" 2> /dev/null || piddead="1"
if [ "${piddead}" = "1" ]; then break; fi
sleep 0.1
delay="$(( ${delay} - 1 ))"
done
# If a fallback is set, and program is still running, then
# use the fallback
if [ -n "${fallback}" -a "${piddead}" != "1" ]; then
kill "${fallback}" "${pid}" 2> /dev/null
sleep 1
# Check again, and fail if still running
kill -0 "${pid}" 2> /dev/null && return 1
fi
fi
done
fi
# Check for and remove stale PID files.
if [ -z "${pidfile}" ]; then
# Find the basename of $program
prefix=`echo "${program}" | sed 's/[^/]*$//'`
progname=`echo "${program}" | sed "s@${prefix}@@"`
if [ -e "/var/run/${progname}.pid" ]; then
rm -f "/var/run/${progname}.pid" 2> /dev/null
fi
else
if [ -e "${pidfile}" ]; then rm -f "${pidfile}" 2> /dev/null; fi
fi
# For signals that do not expect a program to exit, simply
# let kill do its job, and evaluate kill's return for value
else # check_sig_type - signal is not used to terminate program
for pid in ${pidlist}; do
kill "${signal}" "${pid}"
if [ "${?}" -ne "0" ]; then return 1; fi
done
fi
}
################################################################################
# pidofproc() #
# Usage: pidofproc [-p pidfile] pathname #
# #
# Purpose: This function returns one or more pid(s) for a particular daemon #
# #
# Inputs: -p pidfile, use the specified pidfile instead of pidof #
# pathname, path to the specified program #
# #
# Return values (as defined by LSB status codes): #
# 0 - Success (PIDs to stdout) #
# 1 - Program is dead, PID file still exists (remaining PIDs output) #
# 3 - Program is not running (no output) #
################################################################################
pidofproc()
{
local pidfile
local program
local prefix
local progname
local pidlist
local lpids
local exitstatus="0"
# Process arguments
while true; do
case "${1}" in
-p)
pidfile="${2}"
shift 2
;;
*)
program="${1}"
if [ -n "${2}" ]; then
# Too many arguments
# Since this is status, return unknown
return 4
else
break
fi
;;
esac
done
# If a PID file is not specified, try and find one.
if [ -z "${pidfile}" ]; then
# Get the program's basename
prefix=`echo "${program}" | sed 's/[^/]*$//'`
if [ -z "${prefix}" ]; then
progname="${program}"
else
progname=`echo "${program}" | sed "s@${prefix}@@"`
fi
# If a PID file exists with that name, assume that is it.
if [ -e "/var/run/${progname}.pid" ]; then
pidfile="/var/run/${progname}.pid"
fi
fi
# If a PID file is set and exists, use it.
if [ -n "${pidfile}" -a -e "${pidfile}" ]; then
# Use the value in the first line of the pidfile
pidlist=`/bin/head -n1 "${pidfile}"`
# This can optionally be written as 'sed 1q' to repalce 'head -n1'
# should LFS move /bin/head to /usr/bin/head
else
# Use pidof
pidlist=`pidof "${program}"`
fi
# Figure out if all listed PIDs are running.
for pid in ${pidlist}; do
kill -0 ${pid} 2> /dev/null
if [ "${?}" -eq "0" ]; then
lpids="${lpids}${pid} "
else
exitstatus="1"
fi
done
if [ -z "${lpids}" -a ! -f "${pidfile}" ]; then
return 3
else
echo "${lpids}"
return "${exitstatus}"
fi
}
################################################################################
# statusproc() #
# Usage: statusproc [-p pidfile] pathname #
# #
# Purpose: This function prints the status of a particular daemon to stdout #
# #
# Inputs: -p pidfile, use the specified pidfile instead of pidof #
# pathname, path to the specified program #
# #
# Return values: #
# 0 - Status printed #
# 1 - Input error. The daemon to check was not specified. #
################################################################################
statusproc()
{
local pidfile
local pidlist
if [ "${#}" = "0" ]; then
echo "Usage: statusproc [-p pidfle] {program}"
exit 1
fi
# Process arguments
while true; do
case "${1}" in
-p)
pidfile="${2}"
shift 2
;;
*)
if [ -n "${2}" ]; then
echo "Too many arguments"
return 1
else
break
fi
;;
esac
done
if [ -n "${pidfile}" ]; then
pidlist=`pidofproc -p "${pidfile}" $@`
else
pidlist=`pidofproc $@`
fi
# Trim trailing blanks
pidlist=`echo "${pidlist}" | sed -r 's/ +$//'`
base="${1##*/}"
if [ -n "${pidlist}" ]; then
/bin/echo -e "${INFO}${base} is running with Process" \
"ID(s) ${pidlist}.${NORMAL}"
else
if [ -n "${base}" -a -e "/var/run/${base}.pid" ]; then
/bin/echo -e "${WARNING}${1} is not running but" \
"/var/run/${base}.pid exists.${NORMAL}"
else
if [ -n "${pidfile}" -a -e "${pidfile}" ]; then
/bin/echo -e "${WARNING}${1} is not running" \
"but ${pidfile} exists.${NORMAL}"
else
/bin/echo -e "${INFO}${1} is not running.${NORMAL}"
fi
fi
fi
}
################################################################################
# timespec() #
# #
# Purpose: An internal utility function to format a timestamp #
# a boot log file. Sets the STAMP variable. #
# #
# Return value: Not used #
################################################################################
timespec()
{
STAMP="$(echo `date +"%b %d %T %:z"` `hostname`) "
return 0
}
################################################################################
# log_success_msg() #
# Usage: log_success_msg ["message"] #
# #
# Purpose: Print a successful status message to the screen and #
# a boot log file. #
# #
# Inputs: $@ - Message #
# #
# Return values: Not used #
################################################################################
log_success_msg()
{
/bin/echo -n -e "${BMPREFIX}${@}"
/bin/echo -e "${CURS_ZERO}${SUCCESS_PREFIX}${SET_COL}${SUCCESS_SUFFIX}"
# Strip non-printable characters from log file
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
timespec
/bin/echo -e "${STAMP} ${logmessage} OK" >> ${BOOTLOG}
return 0
}
log_success_msg2()
{
/bin/echo -n -e "${BMPREFIX}${@}"
/bin/echo -e "${CURS_ZERO}${SUCCESS_PREFIX}${SET_COL}${SUCCESS_SUFFIX}"
echo " OK" >> ${BOOTLOG}
return 0
}
################################################################################
# log_failure_msg() #
# Usage: log_failure_msg ["message"] #
# #
# Purpose: Print a failure status message to the screen and #
# a boot log file. #
# #
# Inputs: $@ - Message #
# #
# Return values: Not used #
################################################################################
log_failure_msg()
{
/bin/echo -n -e "${BMPREFIX}${@}"
/bin/echo -e "${CURS_ZERO}${FAILURE_PREFIX}${SET_COL}${FAILURE_SUFFIX}"
# Strip non-printable characters from log file
timespec
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
/bin/echo -e "${STAMP} ${logmessage} FAIL" >> ${BOOTLOG}
return 0
}
log_failure_msg2()
{
/bin/echo -n -e "${BMPREFIX}${@}"
/bin/echo -e "${CURS_ZERO}${FAILURE_PREFIX}${SET_COL}${FAILURE_SUFFIX}"
echo "FAIL" >> ${BOOTLOG}
return 0
}
################################################################################
# log_warning_msg() #
# Usage: log_warning_msg ["message"] #
# #
# Purpose: Print a warning status message to the screen and #
# a boot log file. #
# #
# Return values: Not used #
################################################################################
log_warning_msg()
{
/bin/echo -n -e "${BMPREFIX}${@}"
/bin/echo -e "${CURS_ZERO}${WARNING_PREFIX}${SET_COL}${WARNING_SUFFIX}"
# Strip non-printable characters from log file
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
timespec
/bin/echo -e "${STAMP} ${logmessage} WARN" >> ${BOOTLOG}
return 0
}
log_skip_msg()
{
/bin/echo -n -e "${BMPREFIX}${@}"
/bin/echo -e "${CURS_ZERO}${SKIP_PREFIX}${SET_COL}${SKIP_SUFFIX}"
# Strip non-printable characters from log file
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
/bin/echo "SKIP" >> ${BOOTLOG}
return 0
}
################################################################################
# log_info_msg() #
# Usage: log_info_msg message #
# #
# Purpose: Print an information message to the screen and #
# a boot log file. Does not print a trailing newline character. #
# #
# Return values: Not used #
################################################################################
log_info_msg()
{
/bin/echo -n -e "${BMPREFIX}${@}"
# Strip non-printable characters from log file
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
timespec
/bin/echo -n -e "${STAMP} ${logmessage}" >> ${BOOTLOG}
return 0
}
log_info_msg2()
{
/bin/echo -n -e "${@}"
# Strip non-printable characters from log file
logmessage=`echo "${@}" | sed 's/\\\033[^a-zA-Z]*.//g'`
/bin/echo -n -e "${logmessage}" >> ${BOOTLOG}
return 0
}
################################################################################
# evaluate_retval() #
# Usage: Evaluate a return value and print success or failyure as appropriate #
# #
# Purpose: Convenience function to terminate an info message #
# #
# Return values: Not used #
################################################################################
evaluate_retval()
{
local error_value="${?}"
if [ ${error_value} = 0 ]; then
log_success_msg2
else
log_failure_msg2
fi
}
################################################################################
# check_signal() #
# Usage: check_signal [ -{signal} | {signal} ] #
# #
# Purpose: Check for a valid signal. This is not defined by any LSB draft, #
# however, it is required to check the signals to determine if the #
# signals chosen are invalid arguments to the other functions. #
# #
# Inputs: Accepts a single string value in the form or -{signal} or {signal} #
# #
# Return values: #
# 0 - Success (signal is valid #
# 1 - Signal is not valid #
################################################################################
check_signal()
{
local valsig
# Add error handling for invalid signals
valsig="-ALRM -HUP -INT -KILL -PIPE -POLL -PROF -TERM -USR1 -USR2"
valsig="${valsig} -VTALRM -STKFLT -PWR -WINCH -CHLD -URG -TSTP -TTIN"
valsig="${valsig} -TTOU -STOP -CONT -ABRT -FPE -ILL -QUIT -SEGV -TRAP"
valsig="${valsig} -SYS -EMT -BUS -XCPU -XFSZ -0 -1 -2 -3 -4 -5 -6 -8 -9"
valsig="${valsig} -11 -13 -14 -15"
echo "${valsig}" | grep -- " ${1} " > /dev/null
if [ "${?}" -eq "0" ]; then
return 0
else
return 1
fi
}
################################################################################
# check_sig_type() #
# Usage: check_signal [ -{signal} | {signal} ] #
# #
# Purpose: Check if signal is a program termination signal or a control signal #
# This is not defined by any LSB draft, however, it is required to #
# check the signals to determine if they are intended to end a #
# program or simply to control it. #
# #
# Inputs: Accepts a single string value in the form or -{signal} or {signal} #
# #
# Return values: #
# 0 - Signal is used for program termination #
# 1 - Signal is used for program control #
################################################################################
check_sig_type()
{
local valsig
# The list of termination signals (limited to generally used items)
valsig="-ALRM -INT -KILL -TERM -PWR -STOP -ABRT -QUIT -2 -3 -6 -9 -14 -15"
echo "${valsig}" | grep -- " ${1} " > /dev/null
if [ "${?}" -eq "0" ]; then
return 0
else
return 1
fi
}
################################################################################
# wait_for_user() #
# #
# Purpose: Wait for the user to respond if not a headless system #
# #
################################################################################
wait_for_user()
{
# Wait for the user by default
[ "${HEADLESS=0}" = "0" ] && read ENTER
return 0
}
################################################################################
# is_true() #
# #
# Purpose: Utility to test if a variable is true | yes | 1 #
# #
################################################################################
is_true()
{
[ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] || [ "$1" = "y" ] ||
[ "$1" = "t" ]
}
# End /lib/lsb/init-functions

View File

@ -0,0 +1,87 @@
#!/bin/sh
########################################################################
# Begin /lib/services/ipv4-static
#
# Description : IPV4 Static Boot Script
#
# Authors : Nathan Coulson - nathan@linuxfromscratch.org
# Kevin P. Fleming - kpfleming@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
. /lib/lsb/init-functions
. ${IFCONFIG}
if [ -z "${IP}" ]; then
log_failure_msg "\nIP variable missing from ${IFCONFIG}, cannot continue."
exit 1
fi
if [ -z "${PREFIX}" -a -z "${PEER}" ]; then
log_warning_msg "\nPREFIX variable missing from ${IFCONFIG}, assuming 24."
PREFIX=24
args="${args} ${IP}/${PREFIX}"
elif [ -n "${PREFIX}" -a -n "${PEER}" ]; then
log_failure_msg "\nPREFIX and PEER both specified in ${IFCONFIG}, cannot continue."
exit 1
elif [ -n "${PREFIX}" ]; then
args="${args} ${IP}/${PREFIX}"
elif [ -n "${PEER}" ]; then
args="${args} ${IP} peer ${PEER}"
fi
if [ -n "${LABEL}" ]; then
args="${args} label ${LABEL}"
fi
if [ -n "${BROADCAST}" ]; then
args="${args} broadcast ${BROADCAST}"
fi
case "${2}" in
up)
if [ "$(ip addr show ${1} 2>/dev/null | grep ${IP}/)" = "" ]; then
# Cosmetic output
if ! $(echo ${SERVICE} | grep -q " "); then
log_info_msg2 "\n" # Terminate the previous message
fi
log_info_msg "Adding IPv4 address ${IP} to the ${1} interface..."
ip addr add ${args} dev ${1}
evaluate_retval
else
log_warning_msg "Cannot add IPv4 address ${IP} to ${1}. Already present."
fi
;;
down)
if [ "$(ip addr show ${1} 2>/dev/null | grep ${IP}/)" != "" ]; then
log_info_msg "Removing IPv4 address ${IP} from the ${1} interface..."
ip addr del ${args} dev ${1}
evaluate_retval
fi
if [ -n "${GATEWAY}" ]; then
# Only remove the gateway if there are no remaining ipv4 addresses
if [ "$(ip addr show ${1} 2>/dev/null | grep 'inet ')" != "" ]; then
log_info_msg "Removing default gateway..."
ip route del default
evaluate_retval
fi
fi
;;
*)
echo "Usage: ${0} [interface] {up|down}"
exit 1
;;
esac
# End /lib/services/ipv4-static

View File

@ -0,0 +1,98 @@
#!/bin/sh
########################################################################
# Begin /lib/services/ipv4-static-route
#
# Description : IPV4 Static Route Script
#
# Authors : Kevin P. Fleming - kpfleming@linuxfromscratch.org
# DJ Lucas - dj@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
########################################################################
. /lib/lsb/init-functions
. ${IFCONFIG}
case "${TYPE}" in
("" | "network")
need_ip=1
need_gateway=1
;;
("default")
need_gateway=1
args="${args} default"
desc="default"
;;
("host")
need_ip=1
;;
("unreachable")
need_ip=1
args="${args} unreachable"
desc="unreachable "
;;
(*)
log_failure_msg "Unknown route type (${TYPE}) in ${IFCONFIG}, cannot continue."
exit 1
;;
esac
if [ -n "${GATEWAY}" ]; then
MSG="The GATEWAY variable cannot be set in ${IFCONFIG} for static routes.\n"
log_failure_msg "$MSG Use STATIC_GATEWAY only, cannot continue"
exit 1
fi
if [ -n "${need_ip}" ]; then
if [ -z "${IP}" ]; then
log_failure_msg "IP variable missing from ${IFCONFIG}, cannot continue."
exit 1
fi
if [ -z "${PREFIX}" ]; then
log_failure_msg "PREFIX variable missing from ${IFCONFIG}, cannot continue."
exit 1
fi
args="${args} ${IP}/${PREFIX}"
desc="${desc}${IP}/${PREFIX}"
fi
if [ -n "${need_gateway}" ]; then
if [ -z "${STATIC_GATEWAY}" ]; then
log_failure_msg "STATIC_GATEWAY variable missing from ${IFCONFIG}, cannot continue."
exit 1
fi
args="${args} via ${STATIC_GATEWAY}"
fi
if [ -n "${SOURCE}" ]; then
args="${args} src ${SOURCE}"
fi
case "${2}" in
up)
log_info_msg "Adding '${desc}' route to the ${1} interface..."
ip route add ${args} dev ${1}
evaluate_retval
;;
down)
log_info_msg "Removing '${desc}' route from the ${1} interface..."
ip route del ${args} dev ${1}
evaluate_retval
;;
*)
echo "Usage: ${0} [interface] {up|down}"
exit 1
;;
esac
# End /lib/services/ipv4-static-route

100
bootscripts/lfs/sbin/ifdown Executable file
View File

@ -0,0 +1,100 @@
#!/bin/bash
########################################################################
# Begin /sbin/ifdown
#
# Description : Interface Down
#
# Authors : Nathan Coulson - nathan@linuxfromscratch.org
# Kevin P. Fleming - kpfleming@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.0
#
# Notes : the IFCONFIG variable is passed to the scripts found
# in the /lib/services directory, to indicate what file the
# service should source to get interface specifications.
#
########################################################################
RELEASE="7.0"
USAGE="Usage: $0 [ -hV ] [--help] [--version] interface"
VERSTR="LFS ifdown, version ${RELEASE}"
while [ $# -gt 0 ]; do
case "$1" in
--help | -h) help="y"; break ;;
--version | -V) echo "${VERSTR}"; exit 0 ;;
-*) echo "ifup: ${1}: invalid option" >&2
echo "${USAGE}" >& 2
exit 2 ;;
*) break ;;
esac
done
if [ -n "$help" ]; then
echo "${VERSTR}"
echo "${USAGE}"
echo
cat << HERE_EOF
ifdown is used to bring down a network interface. The interface
parameter, e.g. eth0 or eth0:2, must match the trailing part of the
interface specifications file, e.g. /etc/sysconfig/ifconfig.eth0:2.
HERE_EOF
exit 0
fi
file=/etc/sysconfig/ifconfig.${1}
# Skip backup files
[ "${file}" = "${file%""~""}" ] || exit 0
. /lib/lsb/init-functions
if [ ! -r "${file}" ]; then
log_warning_msg "${file} is missing or cannot be accessed."
exit 1
fi
. ${file}
if [ "$IFACE" = "" ]; then
log_failure_msg "${file} does not define an interface [IFACE]."
exit 1
fi
# We only need to first service to bring down the interface
S=`echo ${SERVICE} | cut -f1 -d" "`
if ip link show ${IFACE} > /dev/null 2>&1; then
if [ -n "${S}" -a -x "/lib/services/${S}" ]; then
IFCONFIG=${file} /lib/services/${S} ${IFACE} down
else
MSG="Unable to process ${file}. Either "
MSG="${MSG}the SERVICE variable was not set "
MSG="${MSG}or the specified service cannot be executed."
log_failure_msg "$MSG"
exit 1
fi
else
log_warning_msg "Interface ${1} doesn't exist."
fi
# Leave the interface up if there are additional interfaces in the device
link_status=`ip link show ${IFACE} 2>/dev/null`
if [ -n "${link_status}" ]; then
if [ "$(echo "${link_status}" | grep UP)" != "" ]; then
if [ "$(ip addr show ${IFACE} | grep 'inet ')" == "" ]; then
log_info_msg "Bringing down the ${IFACE} interface..."
ip link set ${IFACE} down
evaluate_retval
fi
fi
fi
# End /sbin/ifdown

138
bootscripts/lfs/sbin/ifup Executable file
View File

@ -0,0 +1,138 @@
#!/bin/sh
########################################################################
# Begin /sbin/ifup
#
# Description : Interface Up
#
# Authors : Nathan Coulson - nathan@linuxfromscratch.org
# Kevin P. Fleming - kpfleming@linuxfromscratch.org
# Update : Bruce Dubbs - bdubbs@linuxfromscratch.org
#
# Version : LFS 7.7
#
# Notes : The IFCONFIG variable is passed to the SERVICE script
# in the /lib/services directory, to indicate what file the
# service should source to get interface specifications.
#
########################################################################
up()
{
if ip link show $1 > /dev/null 2>&1; then
link_status=`ip link show $1`
if [ -n "${link_status}" ]; then
if ! echo "${link_status}" | grep -q UP; then
ip link set $1 up
fi
fi
else
log_failure_msg "\nInterface ${IFACE} doesn't exist."
exit 1
fi
}
RELEASE="7.7"
USAGE="Usage: $0 [ -hV ] [--help] [--version] interface"
VERSTR="LFS ifup, version ${RELEASE}"
while [ $# -gt 0 ]; do
case "$1" in
--help | -h) help="y"; break ;;
--version | -V) echo "${VERSTR}"; exit 0 ;;
-*) echo "ifup: ${1}: invalid option" >&2
echo "${USAGE}" >& 2
exit 2 ;;
*) break ;;
esac
done
if [ -n "$help" ]; then
echo "${VERSTR}"
echo "${USAGE}"
echo
cat << HERE_EOF
ifup is used to bring up a network interface. The interface
parameter, e.g. eth0 or eth0:2, must match the trailing part of the
interface specifications file, e.g. /etc/sysconfig/ifconfig.eth0:2.
HERE_EOF
exit 0
fi
file=/etc/sysconfig/ifconfig.${1}
# Skip backup files
[ "${file}" = "${file%""~""}" ] || exit 0
. /lib/lsb/init-functions
log_info_msg "Bringing up the ${1} interface... "
if [ ! -r "${file}" ]; then
log_failure_msg2 "${file} is missing or cannot be accessed."
exit 1
fi
. $file
if [ "$IFACE" = "" ]; then
log_failure_msg2 "${file} does not define an interface [IFACE]."
exit 1
fi
# Do not process this service if started by boot, and ONBOOT
# is not set to yes
if [ "${IN_BOOT}" = "1" -a "${ONBOOT}" != "yes" ]; then
log_skip_msg
exit 0
fi
for S in ${SERVICE}; do
if [ ! -x "/lib/services/${S}" ]; then
MSG="\nUnable to process ${file}. Either "
MSG="${MSG}the SERVICE '${S} was not present "
MSG="${MSG}or cannot be executed."
log_failure_msg "$MSG"
exit 1
fi
done
if [ "${SERVICE}" = "wpa" ]; then log_success_msg; fi
# Create/configure the interface
for S in ${SERVICE}; do
IFCONFIG=${file} /lib/services/${S} ${IFACE} up
done
# Bring up the interface and any components
for I in $IFACE $INTERFACE_COMPONENTS; do up $I; done
# Set MTU if requested. Check if MTU has a "good" value.
if test -n "${MTU}"; then
if [[ ${MTU} =~ ^[0-9]+$ ]] && [[ $MTU -ge 68 ]] ; then
for I in $IFACE $INTERFACE_COMPONENTS; do
ip link set dev $I mtu $MTU;
done
else
log_info_msg2 "Invalid MTU $MTU"
fi
fi
# Set the route default gateway if requested
if [ -n "${GATEWAY}" ]; then
if ip route | grep -q default; then
log_skip_msg "\n Gateway already setup; skipping."
else
log_info_msg "Setting up default gateway..."
ip route add default via ${GATEWAY} dev ${IFACE}
evaluate_retval
fi
fi
# End /sbin/ifup

185
bootscripts/lfs/sbin/ifup.8 Normal file
View File

@ -0,0 +1,185 @@
ifup(8) ifup(8)
NAME
ifup - bring a network interface up
ifdown - take a network interface down
SYNOPSIS
ifup IFACE
ifup -h|--help
ifup -V|--version
ifdown IFACE
ifdown -h|--help
ifdown -V|--version
DESCRIPTION
The ifup and ifdown commands may be used to configure
(or, respectively, deconfigure) a network interface based
on interface definitions in the file
/etc/sysconfig/ifconfig.IFACE.
OPTIONS
A summary of options is included below.
-h, --help
Show summary of options.
-V, --version
Show version information.
EXAMPLES
ifup eth0
Bring up the interface defined in the file
/etc/sysconfig/ifconfig.eth0
ONBOOT=no
IFACE=eth0
SERVICE=ipv4-static
IP=192.168.1.22
GATEWAY=192.168.1.1
PREFIX=24
BROADCAST=192.168.1.255
ifdown eth0:2
Bring down the interface defined in the file
/etc/sysconfig/ifconfig.eth0:2
ONBOOT=no
IFACE=eth0
LABEL=eth0:2
SERVICE=dhcpcd
DHCP_START="--waitip"
DHCP_STOP="-k"
# Set PRINTIP="yes" to have the script print the DHCP IP address
PRINTIP="yes"
# Set PRINTALL="yes" to print the DHCP assigned values for
# IP, SM, DG, and 1st NS.
PRINTALL="no"
ifup br0
Bring up the interface defined in the file
/etc/sysconfig/ifconfig.br0
ONBOOT=yes
IFACE=br0
SERVICE="bridge ipv4-static"
IP=192.168.1.22
GATEWAY=192.168.1.1
PREFIX=24
BROADCAST=192.168.1.255
STP=no # Spanning tree protocol, default no
INTERFACE_COMPONENTS=eth0 # Add to IFACE
IP_FORWARD=true
NOTES
The program does not configure network interfaces direct-
ly. It runs scripts defined by the SERVICE variable in
the network configuration file.
The configuration files must have the following environ-
ment variables set:
IFACE - The interface to configure, e.g. eth0. It must
be available in /sys/class/net.
SERVICE - The service script to run to bring up the inter-
face. Standard services are ipv4-static and
ipv4-static-route. Other services such as dhcp
or bridge may be installed. This value may
be a list of services when the interface is a
compound device such as a bridge.
ONBOOT - If set to 'yes', the specified interface is
configured by the netowrk boot script.
GATEWAY - The default IP address to use for routing if
the destination IP address is not in a static
route or on a local network, e.g., 192.168.1.1.
For secondary IP addresses on an interface, this
parameter should not be specified. If the service
is ipv4-static-route, this parameter must NOT
be set.
STATIC_GATEWAY - The default IP address to use for routing
when setting a static routing address.
INTERFACE_COMPONENTS - A list of component interfaces
only needed for a compound device such as a bridge.
This list is normally a single value, e.g. eth0,
for use with a virtual host such as kvm.
Other paramters that are service specific include:
ipv4-static
IP - The IP address of the interface,
e.g. 192.168.1.2.
PREFIX - The number of bits that specify the network
number of the interface. The default, if not
specified, is 24.
LABEL - The label to be assigned to the interface.
This is normally specified for assigning
additional IP addresses to a network
device. Example: eth0:2 (optional)
BROADCAST - The brodcast address for this interface,
e.g 192.168.1.255. If not specified,
the broadcast address will be calculated
from the IP and PREFIX.
ipv4-static-route
TYPE - The type of route, typically 'default',
'network', 'or host'.
IP - The IP address for a network or host, if the
TYPE is not 'default'.
PREFIX - The prefix for the associated IP address.
STATIC_GATEWAY - The IP address for a network route.
SOURCE - The source IP address to prefer when sending
to the destinations covered by the specified
route. (optional)
dhcp/dhclient
DHCP_START - Optional parameters to pass to the dhcp client
at startup.
DHCP_STOP - Optional paremeters to pass to the dhcp client
at shutdown.
PRINTIP - Flag to print the dhcp address to stdout
PRINTALL - Flag to print all obtained dhcp data to stdout
bridge
IP_FORWARD - An optional flag to enable the system to forward
inbound IP packets received by one interface to
another outbound interface.
STP - Set bridge spanning tree protocol. Default is no.
FILES
/etc/sysconfig/ifconfig.*
definitions of network interfaces
AUTHORS
The ifup/ifdown suite was written by Nathan Coulson
<nathan@linuxfromscratch.org> and Kevin P. Fleming
<kpfleming@linuxfromscratch.org>
and updated by Bruce Dubbs <bdubbs@linuxfromscratch>.
SEE ALSO
ip(8).
IFUP/IFDOWN 8 February 2015 ifup(8)

View File

@ -0,0 +1,31 @@
########################################################################
# Begin /etc/sysconfig/createfiles
#
# Description : Createfiles script config file
#
# Authors :
#
# Version : 00.00
#
# Notes : The syntax of this file is as follows:
# if type is equal to "file" or "dir"
# <filename> <type> <permissions> <user> <group>
# if type is equal to "dev"
# <filename> <type> <permissions> <user> <group> <devtype>
# <major> <minor>
#
# <filename> is the name of the file which is to be created
# <type> is either file, dir, or dev.
# file creates a new file
# dir creates a new directory
# dev creates a new device
# <devtype> is either block, char or pipe
# block creates a block device
# char creates a character deivce
# pipe creates a pipe, this will ignore the <major> and
# <minor> fields
# <major> and <minor> are the major and minor numbers used for
# the device.
########################################################################
# End /etc/sysconfig/createfiles

View File

@ -0,0 +1,18 @@
########################################################################
# Begin /etc/sysconfig/modules
#
# Description : Module auto-loading configuration
#
# Authors :
#
# Version : 00.00
#
# Notes : The syntax of this file is as follows:
# <module> [<arg1> <arg2> ...]
#
# Each module should be on its own line, and any options that you want
# passed to the module should follow it. The line deliminator is either
# a space or a tab.
########################################################################
# End /etc/sysconfig/modules

View File

@ -0,0 +1,92 @@
# rc.site
# Optional parameters for boot scripts.
# Distro Information
# These values, if specified here, override the defaults
#DISTRO="Linux From Scratch" # The distro name
#DISTRO_CONTACT="lfs-dev@linuxfromscratch.org" # Bug report address
#DISTRO_MINI="LFS" # Short name used in filenames for distro config
# Define custom colors used in messages printed to the screen
# Please consult `man console_codes` for more information
# under the "ECMA-48 Set Graphics Rendition" section
#
# Warning: when switching from a 8bit to a 9bit font,
# the linux console will reinterpret the bold (1;) to
# the top 256 glyphs of the 9bit font. This does
# not affect framebuffer consoles
# These values, if specified here, override the defaults
#BRACKET="\\033[1;34m" # Blue
#FAILURE="\\033[1;31m" # Red
#INFO="\\033[1;36m" # Cyan
#NORMAL="\\033[0;39m" # Grey
#SUCCESS="\\033[1;32m" # Green
#WARNING="\\033[1;33m" # Yellow
# Use a colored prefix
# These values, if specified here, override the defaults
#BMPREFIX=" "
#SUCCESS_PREFIX="${SUCCESS} * ${NORMAL}"
#FAILURE_PREFIX="${FAILURE}*****${NORMAL}"
#WARNING_PREFIX="${WARNING} *** ${NORMAL}"
# Manually seet the right edge of message output (characters)
# Useful when resetting console font during boot to override
# automatic screen width detection
#COLUMNS=120
# Interactive startup
#IPROMPT="yes" # Whether to display the interactive boot prompt
#itime="3" # The amount of time (in seconds) to display the prompt
# The total length of the distro welcome string, without escape codes
#wlen=$(echo "Welcome to ${DISTRO}" | wc -c )
#welcome_message="Welcome to ${INFO}${DISTRO}${NORMAL}"
# The total length of the interactive string, without escape codes
#ilen=$(echo "Press 'I' to enter interactive startup" | wc -c )
#i_message="Press '${FAILURE}I${NORMAL}' to enter interactive startup"
# Set scripts to skip the file system check on reboot
#FASTBOOT=yes
# Skip reading from the console
#HEADLESS=yes
# Write out fsck progress if yes
#VERBOSE_FSCK=no
# Speed up boot without waiting for settle in udev
#OMIT_UDEV_SETTLE=y
# Speed up boot without waiting for settle in udev_retry
#OMIT_UDEV_RETRY_SETTLE=yes
# Skip cleaning /tmp if yes
#SKIPTMPCLEAN=no
# For setclock
#UTC=1
#CLOCKPARAMS=
# For consolelog (Note that the default, 7=debug, is noisy)
#LOGLEVEL=7
# For network
#HOSTNAME=mylfs
# Delay between TERM and KILL signals at shutdown
#KILLDELAY=3
# Optional sysklogd parameters
#SYSKLOGD_PARMS="-m 0"
# Console parameters
#UNICODE=1
#KEYMAP="de-latin1"
#KEYMAP_CORRECTIONS="euro2"
#FONT="lat0-16 -m 8859-15"
#LEGACY_CHARSET=

View File

@ -0,0 +1,19 @@
########################################################################
# Begin /etc/sysconfig/udev_retry
#
# Description : udev_retry script configuration
#
# Authors :
#
# Version : 00.00
#
# Notes : Each subsystem that may need to be re-triggered after mountfs
# runs should be listed in this file. Probable subsystems to be
# listed here are rtc (due to /var/lib/hwclock/adjtime) and sound
# (due to both /var/lib/alsa/asound.state and /usr/sbin/alsactl).
# Entries are whitespace-separated.
########################################################################
rtc
# End /etc/sysconfig/udev_retry

131
chapter01/askforhelp.xml Normal file
View File

@ -0,0 +1,131 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-intro-askforhelp">
<?dbhtml filename="askforhelp.html"?>
<title>Help</title>
<para>If an issue or a question is encountered while working through
this book, please check the FAQ page at <ulink url="&faq-root;#generalfaq"/>.
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:
<ulink url="&hints-root;errors.txt"/>.</para>
<para>If you cannot find your problem listed in the FAQ, search the mailing
lists at <ulink url="&lfs-root;search.html"/>.</para>
<para>We also have a wonderful LFS community that is willing to offer
assistance through the mailing lists and IRC (see the <xref
linkend="ch-intro-resources"/> section of this book). However,
we get several support questions every day and many of them can be easily
answered by going to the FAQ and by searching the mailing lists first.
So, for us to offer the best assistance possible, you need to do some
research on your own first. That allows us to focus on the more unusual
support needs. If your searches do not produce a solution, please include
all relevant information (mentioned below) in your request for help.</para>
<sect2>
<title>Things to Mention</title>
<para>Apart from a brief explanation of the problem being experienced,
the essential things to include in any request for help are:</para>
<itemizedlist>
<listitem>
<para>The version of the book being used (in this case
<phrase revision="sysv">&version;</phrase>
<phrase revision="systemd">&versiond;</phrase>)</para>
</listitem>
<listitem>
<para>The host distribution and version being used to create LFS</para>
</listitem>
<listitem>
<para>The output from the <xref linkend='version-check'/> script</para>
</listitem>
<listitem>
<para>The package or section the problem was encountered in</para>
</listitem>
<listitem>
<para>The exact error message or symptom being received</para>
</listitem>
<listitem>
<para>Note whether you have deviated from the book at all </para>
</listitem>
</itemizedlist>
<note>
<para>Deviating from this book does <emphasis>not</emphasis> 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.</para>
</note>
</sect2>
<sect2>
<title>Configure Script Problems</title>
<para>If something goes wrong while running the <command>configure</command>
script, review the <filename>config.log</filename> file. This file may
contain errors encountered during <command>configure</command> which were
not printed to the screen. Include the <emphasis>relevant</emphasis> lines
if you need to ask for help.</para>
</sect2>
<sect2>
<title>Compilation Problems</title>
<para>Both the screen output and the contents of various files are useful
in determining the cause of compilation problems. The screen output from
the <command>configure</command> script and the <command>make</command>
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
<command>make</command>:</para>
<screen><computeroutput>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</computeroutput></screen>
<para>In this case, many people would just include the bottom
section:</para>
<screen><computeroutput>make [2]: *** [make] Error 1</computeroutput></screen>
<para>This is not enough information to properly diagnose the problem
because it only notes that something went wrong, not
<emphasis>what</emphasis> 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).</para>
<para>An excellent article about asking for help on the Internet is
available online at <ulink
url="http://catb.org/~esr/faqs/smart-questions.html"/>. Read and
follow the hints in this document to increase the likelihood of getting
the help you need.</para>
</sect2>
</sect1>

184
chapter01/changelog.xml Normal file
View File

@ -0,0 +1,184 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-scatter-changelog">
<?dbhtml filename="changelog.html"?>
<title>Changelog</title>
<para>This is version
<phrase revision="sysv">&version;</phrase>
<phrase revision="systemd">&versiond;</phrase>
of the Linux From Scratch book, dated
&releasedate;. If this book is more than six months old, a newer and better
version is probably already available. To find out, please check one of the
mirrors via <ulink url="&lfs-root;mirrors.html"/>.</para>
<para>Below is a list of changes made since the previous release of the
book.</para>
<itemizedlist>
<title>Changelog Entries:</title>
<!-- Changelog template
<listitem>
<para>Date</para>
<itemizedlist>
<listitem>
<para>[name] - New changelog entry.</para>
</listitem>
<listitem>
<para>[name] - Previous changelog entry.</para>
</listitem>
</itemizedlist>
</listitem>
Note: If a change is only specific to sysv or systemd, then use
<listitem revision="sysv"> or <listitem revision="systemd"> as
appropriate for the entry or if needed the entire day's listitem.
-->
<listitem>
<para>2019-03-27</para>
<itemizedlist>
<listitem>
<para>[bdubbs] - Revert to meson-0.49.2.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>2019-03-26</para>
<itemizedlist>
<listitem>
<para>[bdubbs] - Update to tzdata2019a. Fixes
<ulink url="&lfs-ticket-root;4448">#4448</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to Python-3.7.3. Fixes
<ulink url="&lfs-ticket-root;4447">#4447</ulink>.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>2019-03-25</para>
<itemizedlist>
<listitem>
<para>[bdubbs] - Update to iproute2-5.0.0. Fixes
<ulink url="&lfs-ticket-root;4446">#4446</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to linux-5.0.4. Fixes
<ulink url="&lfs-ticket-root;4444">#4444</ulink>.</para>
</listitem>
<listitem>
<para>[xry111] - Use -ffile-prefix-map instead of -isystem and
symlinks in the Glibc build to simplify the instruction.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>2019-03-13</para>
<itemizedlist>
<listitem>
<para>[xry111] - Update contents and short descriptions of
packages. Fixes
<ulink url="&lfs-ticket-root;4443">#4443</ulink>.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>2019-03-12</para>
<itemizedlist>
<listitem>
<para>[bdubbs] - Update to meson-0.50.0. Fixes
<ulink url="&lfs-ticket-root;4442">#4442</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to coreutils-8.31. Fixes
<ulink url="&lfs-ticket-root;4441">#4441</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to linux-5.0.1. Fixes
<ulink url="&lfs-ticket-root;4440">#4440</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to man-pages-5.00. Fixes
<ulink url="&lfs-ticket-root;4439">#4439</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to e2fsprogs-1.45.0. Fixes
<ulink url="&lfs-ticket-root;4438">#4438</ulink>.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem revision="systemd">
<para>2019-03-08</para>
<itemizedlist>
<listitem>
<para>[renodr] - Update to systemd-241. Fixes
<ulink url="&lfs-ticket-root;4424">#4424</ulink>.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>2019-03-05</para>
<itemizedlist>
<listitem>
<para>[bdubbs] - Update to linux-5.0. Fixes
<ulink url="&lfs-ticket-root;4437">#4437</ulink>.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>2019-03-01</para>
<itemizedlist>
<listitem>
<para>[bdubbs] - Update to texinfo-6.6. Fixes
<ulink url="&lfs-ticket-root;4427">#4427</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to tar-1.32. Fixes
<ulink url="&lfs-ticket-root;4431">#4431</ulink>.</para>
</listitem>
<listitem revision='sysv'>
<para>[bdubbs] - Update to sysvinit-2.94. Fixes
<ulink url="&lfs-ticket-root;4432">#4432</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to openssl-1.1.1b. Fixes
<ulink url="&lfs-ticket-root;4435">#4435</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to gcc-8.3.0. Fixes
<ulink url="&lfs-ticket-root;4430">#4430</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to linux-4.20.13. Fixes
<ulink url="&lfs-ticket-root;4434">#4434</ulink>.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>2019-03-01</para>
<itemizedlist>
<listitem>
<para>[bdubbs] - LFS-8.4 released.</para>
</listitem>
</itemizedlist>
</listitem>
</itemizedlist>
</sect1>

21
chapter01/chapter01.xml Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<chapter id="chapter-intro" xreflabel="Chapter&nbsp;1">
<?dbhtml dir="chapter01"?>
<?dbhtml filename="chapter01.html"?>
<title>Introduction</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="how.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="whatsnew.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="changelog.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="resources.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="askforhelp.xml"/>
<!--<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="livecd.xml"/>-->
</chapter>

96
chapter01/how.xml Normal file
View File

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-intro-how">
<?dbhtml filename="how.html"?>
<title>How to Build an LFS System</title>
<para>The LFS system will be built by using an already installed
Linux distribution (such as Debian, OpenMandriva, Fedora, or openSUSE). 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 <quote>development</quote> option
during the distribution installation to be able to access these
tools.</para>
<para>As an alternative to installing a separate distribution onto your
machine, you may wish to use <!-- the Linux From Scratch LiveCD or --> a LiveCD from a
commercial distribution. <!-- The LFS LiveCD works well as a host system,
providing all the tools you need to successfully follow the instructions in
this book. The LiveCD version is behind the current book, but is still useful
as a host for building the current book. The <quote>-nosrc</quote> or
<quote>-min</quote> editions of the LiveCD are the most appropriate for
building a current LFS system. For more information about the LFS LiveCD or
to download a copy, visit <ulink url="&livecd-root;"/>. --></para>
<!--
<note>
<para>The LFS LiveCD might not work on newer hardware configurations,
failing to boot or failing to detect some devices such as some SATA hard
drives.</para>
</note> -->
<para><xref linkend="chapter-partitioning"/> of this book describes how
to create a new Linux native partition and file system. This is the place
where the new LFS system will be compiled and installed. <xref
linkend="chapter-getting-materials"/> explains which packages and
patches need to be downloaded to build an LFS system and how to store
them on the new file system. <xref linkend="chapter-final-preps"/>
discusses the setup of an appropriate working environment. Please read
<xref linkend="chapter-final-preps"/> carefully as it explains several
important issues you need be aware of before beginning to
work your way through <xref linkend="chapter-temporary-tools"/> and beyond.</para>
<para><xref linkend="chapter-temporary-tools"/> 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 <xref linkend="chapter-building-system"/>. Some of these
packages are needed to resolve circular dependencies&mdash;for example,
to compile a compiler, you need a compiler.</para>
<para><xref linkend="chapter-temporary-tools"/> also shows you how to
build a first pass of the toolchain, including Binutils and GCC (first pass
basically means these two core packages will be reinstalled).
The next step is to build Glibc, the C library. Glibc will be compiled by
the toolchain programs built in the first pass. Then, a second pass of the
toolchain will be built. This time, the toolchain will be dynamically linked
against the newly built Glibc. The remaining <xref
linkend="chapter-temporary-tools"/> 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. </para>
<para>This effort to isolate the new system from the host distribution may
seem excessive. A full technical explanation as to why this is done is provided in
<xref linkend="ch-tools-toolchaintechnotes"/>.</para>
<para>In <xref linkend="chapter-building-system"/>, the full LFS system is
built. The <command>chroot</command> (change root) program is used to enter
a virtual environment and start a new shell whose root directory will be
set to the LFS partition. This is very similar to rebooting and instructing
the kernel to mount the LFS partition as the root partition. The system
does not actually reboot, but instead uses <command>chroot</command> because
creating a bootable system requires additional work which is not necessary
just yet. The major advantage is that <quote>chrooting</quote> allows you
to continue using the host system while LFS is being built. While waiting
for package compilations to complete, you can continue using your computer as
normal.</para>
<para>To finish the installation, the basic system configuration is set up in
<xref linkend="chapter-bootscripts"/>, and the kernel and boot loader are set
up in <xref linkend="chapter-bootable"/>. <xref linkend="chapter-finalizing"/>
contains information on continuing 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.</para>
<para>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 you embark on the LFS adventure.</para>
</sect1>

106
chapter01/livecd.xml Normal file
View File

@ -0,0 +1,106 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-intro-livecd">
<?dbhtml filename="livecd.html"?>
<title>About the Included CD</title>
<para>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
<quote>host system.</quote> The CD images are actively maintained and
updated versions can be found at
<ulink url="ftp://ftp.lfs-matrix.net/pub/lfs-livecd/"/></para>
<para>In addition to the tools required to build LFS, the host system
on the CD has a number of other helpful tools installed:</para>
<itemizedlist>
<listitem>
<para>An HTML version of this book</para>
</listitem>
<listitem>
<para>The X Window System Environment</para>
</listitem>
<listitem>
<para>Web Tools</para>
<itemizedlist>
<listitem>
<para>Wget (command line file retriever)</para>
</listitem>
<listitem>
<para>Lynx (text web browser)</para>
</listitem>
<listitem>
<para>Irssi (console IRC client)</para>
</listitem>
<listitem>
<para>Firefox (graphical web browser)</para>
</listitem>
<listitem>
<para>Xchat (X-based IRC client)</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>Text Editors</para>
<itemizedlist>
<listitem>
<para>Vim</para>
</listitem>
<listitem>
<para>Nano</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>Network Tools</para>
<itemizedlist>
<listitem>
<para>SSH Server and Client</para>
</listitem>
<listitem>
<para>NFS Server and Client</para>
</listitem>
<listitem>
<para>Smbmount (mount.cifs) for Windows shares</para>
</listitem>
<listitem>
<para>Subversion</para>
</listitem>
<listitem>
<para>Dhcpcd (DHCP client)</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>Filesystem Programs</para>
<itemizedlist>
<listitem>
<para>Reiserfsprogs</para>
</listitem>
<listitem>
<para>Xfsprogs</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>nALFS - A tool for automating LFS builds</para>
</listitem>
</itemizedlist>
</sect1>

92
chapter01/resources.xml Normal file
View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-intro-resources">
<?dbhtml filename="resources.html"?>
<title>Resources</title>
<sect2 id="ch-intro-faq">
<title>FAQ</title>
<para>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)
that is located at <ulink url="&faq-root;"/>.</para>
</sect2>
<sect2 id="ch-intro-maillists" xreflabel="Chapter&nbsp;1 - Mailing Lists">
<title>Mailing Lists</title>
<para>The <uri>linuxfromscratch.org</uri> 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. If the FAQ does not solve
the problem you are having, the next step would be to search the mailing
lists at <ulink url="&lfs-root;search.html"/>.</para>
<para>For information on the different lists, how to subscribe, archive
locations, and additional information, visit
<ulink url="&lfs-root;mail.html"/>.</para>
</sect2>
<!-- FIXME: Remove until such time as we have our own News Server, JH 20060105
<sect2 id="ch-intro-newsserver">
<title>News Server</title>
<para>The mailing lists hosted at <uri>linuxfromscratch.org</uri> 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.</para>
<para>The news server is located at
<uri>news.linuxfromscratch.org</uri>.</para>
</sect2> -->
<sect2 id="ch-intro-irc">
<title>IRC</title>
<para>Several members of the LFS community offer assistance on Internet
Relay Chat (IRC). 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 <uri>irc.freenode.net</uri>.
The support channel is named #LFS-support.</para>
</sect2>
<!-- Commentted out until the target link is updated
<sect2 id="ch-intro-references">
<title>References</title>
<para>For additional information on the packages, useful tips are
available in the LFS Package Reference page located at <ulink
url="http://www.linuxfromscratch.org/~matthew/LFS-references.html"/>.</para>
</sect2> -->
<sect2 id="ch-intro-mirrors" xreflabel="Chapter&nbsp;1 - Mirror sites">
<title>Mirror Sites</title>
<para>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 <ulink url="&lfs-root;mirrors.html"/> for a list
of current mirrors.</para>
</sect2>
<sect2 id="ch-intro-contactinfo">
<title>Contact Information</title>
<para>Please direct all your questions and comments to one of the LFS
mailing lists (see above).</para>
</sect2>
</sect1>

284
chapter01/whatsnew.xml Normal file
View File

@ -0,0 +1,284 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-intro-whatsnew">
<?dbhtml filename="whatsnew.html"?>
<title>What's new since the last release</title>
<para>Below is a list of package updates made since the previous
release of the book.</para>
<!--
Every package in the book is listed in the "Upgraded to:" section.
Comment/uncomment as needed. DO NOT delete any of these lines unless that
package is removed from the book entirely.
-->
<itemizedlist>
<title>Upgraded to:</title>
<listitem><para></para></listitem> <!-- satisfy build -->
<!--<listitem>
<para>None</para>
</listitem>-->
<!--<listitem>
<para>Acl-&acl-version;</para>
</listitem>-->
<!--<listitem>
<para>Attr-&attr-version;</para>
</listitem>-->
<!--<listitem>
<para>Autoconf-&autoconf-version;</para>
</listitem>-->
<!--<listitem>
<para>Automake-&automake-version;</para>
</listitem>-->
<!--<listitem>
<para>Bash &bash-version;</para>
</listitem>-->
<!--<listitem>
<para>Bc &bc-version;</para>
</listitem>-->
<!--<listitem>
<para>Binutils-&binutils-version;</para>
</listitem>-->
<!--<listitem>
<para>Bison-&bison-version;</para>
</listitem>-->
<!--<listitem>
<para>Bzip2-&bzip2-version;</para>
</listitem>-->
<!--<listitem>
<para>Check-&check-version;</para>
</listitem>-->
<listitem>
<para>Coreutils-&coreutils-version;</para>
</listitem>
<!--<listitem>
<para>DejaGNU-&dejagnu-version;</para>
</listitem>-->
<!--<listitem revision="systemd">
<para>D-Bus-&dbus-version;</para>
</listitem>-->
<!--<listitem>
<para>Diffutils-&diffutils-version;</para>
</listitem>-->
<!--<listitem revision="sysv">
<para>Eudev-&eudev-version;</para>
</listitem>-->
<listitem>
<para>E2fsprogs-&e2fsprogs-version;</para>
</listitem>
<!--<listitem>
<para>Expat-&expat-version;</para>
</listitem>-->
<!-- <listitem>
<para>Expect-&expect-version;</para>
</listitem>-->
<!--<listitem>
<para>File-&file-version;</para>
</listitem>-->
<!--<listitem>
<para>Findutils-&findutils-version;</para>
</listitem>-->
<!--<listitem>
<para>Flex-&flex-version;</para>
</listitem>-->
<!--<listitem>
<para>Gawk-&gawk-version;</para>
</listitem>-->
<listitem>
<para>GCC-&gcc-version;</para>
</listitem>
<!--<listitem>
<para>GDBM-&gdbm-version;</para>
</listitem>-->
<!--<listitem>
<para>Gettext-&gettext-version;</para>
</listitem>-->
<!--<listitem>
<para>Glibc-&glibc-version;</para>
</listitem>-->
<!--<listitem>
<para>GMP-&gmp-version;</para>
</listitem>-->
<!--<listitem>
<para>Gperf-&gperf-version;</para>
</listitem>-->
<!--<listitem>
<para>Grep-&grep-version;</para>
</listitem>-->
<!--<listitem>
<para>Groff-&groff-version;</para>
</listitem>-->
<!--<listitem>
<para>GRUB-&grub-version;</para>
</listitem>-->
<!--<listitem>
<para>Gzip-&gzip-version;</para>
</listitem>-->
<!--<listitem>
<para>IANA-Etc-&iana-etc-version;</para>
</listitem>-->
<!--<listitem>
<para>Inetutils-&inetutils-version;</para>
</listitem>-->
<!--<listitem>
<para>Intltool-&intltool-version;</para>
</listitem>-->
<listitem>
<para>IPRoute2-&iproute2-version;</para>
</listitem>
<!--<listitem>
<para>Kbd-&kbd-version;</para>
</listitem>-->
<!--<listitem>
<para>Kmod-&kmod-version;</para>
</listitem>-->
<!--<listitem>
<para>Less-&less-version;</para>
</listitem>-->
<!--<listitem>
<para>LFS-Bootscripts-&lfs-bootscripts-version;</para>
</listitem>-->
<!--<listitem>
<para>Libcap-&libcap-version;</para>
</listitem>-->
<!--<listitem>
<para>Libelf-&elfutils-version; (from elfutils)</para>
</listitem>-->
<!--<listitem>
<para>Libpipeline-&libpipeline-version;</para>
</listitem>-->
<!--<listitem>
<para>Libtool-&libtool-version;</para>
</listitem>-->
<listitem>
<para>Linux-&linux-version;</para>
</listitem>
<!--<listitem>
<para>M4-&m4-version;</para>
</listitem>-->
<!--<listitem>
<para>Make-&make-version;</para>
</listitem>-->
<!--<listitem>
<para>Man-DB-&man-db-version;</para>
</listitem>-->
<listitem>
<para>Man-pages-&man-pages-version;</para>
</listitem>
<listitem>
<para>Meson-&meson-version;</para>
</listitem>
<!-- <listitem>
<para>MPC-&mpc-version;</para>
</listitem>-->
<!--<listitem>
<para>MPFR-&mpfr-version;</para>
</listitem>-->
<!--<listitem>
<para>Ncurses-&ncurses-version;</para>
</listitem>-->
<!--<listitem>
<para>Ninja-&ninja-version;</para>
</listitem>-->
<listitem>
<para>Openssl-&openssl-version;</para>
</listitem>
<!-- <listitem>
<para>Patch-&patch-version;</para>
</listitem>-->
<!--<listitem>
<para>Perl-&perl-version;</para>
</listitem>-->
<!--<listitem>
<para>Pkg-config-&pkgconfig-version;</para>
</listitem>-->
<!--<listitem>
<para>Procps-ng-&procps-ng-version;</para>
</listitem>-->
<!--<listitem>
<para>Psmisc-&psmisc-version;</para>
</listitem>-->
<listitem>
<para>Python-&python-version;</para>
</listitem>
<!--<listitem>
<para>Readline-&readline-version;</para>
</listitem>-->
<!--<listitem>
<para>Sed-&sed-version;</para>
</listitem>-->
<!--<listitem>
<para>Shadow-&shadow-version;</para>
</listitem>-->
<!--<listitem revision="sysv">
<para>Sysklogd-&sysklogd-version;</para>
</listitem>-->
<listitem revision="systemd">
<para>Systemd-&systemd-version;</para>
</listitem>
<listitem revision="sysv">
<para>SysVinit-&sysvinit-version;</para>
</listitem>
<listitem>
<para>Tar-&tar-version;</para>
</listitem>
<!--<listitem>
<para>Tcl-&tcl-version;</para>
</listitem>-->
<listitem>
<para>Texinfo-&texinfo-version;</para>
</listitem>
<listitem>
<para>Tzdata-&tzdata-version;</para>
</listitem>
<!--<listitem>
<para>Util-Linux-&util-linux-version;</para>
</listitem>-->
<!--<listitem>
<para>Vim-&vim-version;</para>
</listitem>-->
<!--<listitem>
<para>XML-Parser-&xml-parser-version;</para>
</listitem>-->
<!--<listitem>
<para>XZ-Utils-&xz-version;</para>
</listitem>-->
<!--<listitem>
<para>Zlib-&zlib-version;</para>
</listitem>-->
</itemizedlist>
<!--<itemizedlist>
<title>Downgraded to:</title>
<listitem>
<para>PLACEHOLDER</para>
</listitem>
</itemizedlist>-->
<itemizedlist>
<title>Added:</title>
<listitem><para></para></listitem> <!-- satisfy build -->
</itemizedlist>
<itemizedlist>
<title>Removed:</title>
<listitem><para></para></listitem> <!-- satisfy build -->
<!--<listitem>
<para>bash-4.4-upstream_fixes-1.patch</para>
</listitem>-->
</itemizedlist>
</sect1>

67
chapter02/aboutlfs.xml Normal file
View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-partitioning-aboutlfs">
<?dbhtml filename="aboutlfs.html"?>
<title>Setting The $LFS Variable</title>
<para>Throughout this book, the environment variable <envar>LFS</envar> will
be used several times. You should ensure that this variable is always defined
throughout the LFS build process. It should be set to the name of the
directory where you will be building your LFS system - we will use
<filename class="directory">/mnt/lfs</filename> as an example, but the
directory choice is up to you. If you are building LFS on a separate
partition, this directory will be the mount point for the partition.
Choose a directory location and set the variable with the
following command:</para>
<screen role="nodump"><userinput>export LFS=<replaceable>/mnt/lfs</replaceable></userinput></screen>
<para>Having this variable set is beneficial in that commands such as
<command>mkdir -v $LFS/tools</command> can be typed literally. The shell
will automatically replace <quote>$LFS</quote> with
<quote>/mnt/lfs</quote> (or whatever the variable was set to) when it
processes the command line.</para>
<caution>
<para>Do not forget to check that <envar>LFS</envar> is set whenever
you leave and reenter the current working environment (such as when doing a
<command>su</command> to <systemitem class="username">root</systemitem> or
another user). Check that the <envar>LFS</envar> variable is set up
properly with:</para>
<screen role="nodump"><userinput>echo $LFS</userinput></screen>
<para>Make sure the output shows the path to your LFS system's build
location, which is <filename class="directory">/mnt/lfs</filename> if the
provided example was followed. If the output is incorrect, use the command
given earlier on this page to set <envar>$LFS</envar> to the correct
directory name.</para>
</caution>
<note><para>One way to ensure that the <envar>LFS</envar> variable is always
set is to edit the <filename>.bash_profile</filename> file in both your
personal home directory and in <filename>/root/.bash_profile</filename> and
enter the export command above. In addition, the shell specified in the
<filename>/etc/passwd</filename> file for all users that need the
<envar>LFS</envar> variable needs to be bash to ensure that the
<filename>/root/.bash_profile</filename> file is incorporated as a part of
the login process.</para>
<para>Another consideration is the method that is used to log into the
host system. If logging in through a graphical display manager, the
user's <filename>.bash_profile</filename> is not normally used when
a virtual terminal is started. In this case, add the export command to
the <filename>.bashrc</filename> file for the user and root. In addition,
some distributions have instructions to not run the <filename>.bashrc</filename>
instructions in a non-interactive bash invocation. Be sure to add the
export command before the test for non-interactive use.</para>
</note>
</sect1>

22
chapter02/chapter02.xml Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<chapter id="chapter-partitioning" xreflabel="Chapter&nbsp;2">
<?dbhtml dir="chapter02"?>
<?dbhtml filename="chapter02.html"?>
<title>Preparing the Host System</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hostreqs.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="stages.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingpartition.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingfilesystem.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="aboutlfs.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mounting.xml"/>
</chapter>

View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="space-creatingfilesystem">
<?dbhtml filename="creatingfilesystem.html"?>
<title>Creating a File System on the Partition</title>
<para>Now that a blank partition has been set up, the file system can be
created. LFS can use any file system recognized by the Linux kernel, but the
most common types are ext3 and ext4. The choice of file system can be
complex and depends on the characteristics of the files and the size of
the partition. For example:</para>
<variablelist>
<varlistentry>
<term>ext2</term>
<listitem><para>is suitable for small partitions that are updated infrequently
such as /boot.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>ext3</term>
<listitem><para>is an upgrade to ext2 that includes a journal
to help recover the partition's status in the case of an unclean
shutdown. It is commonly used as a general purpose file system.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>ext4</term>
<listitem><para>is the latest version of the ext file system family of
partition types. It provides several new capabilities including
nano-second timestamps, creation and use of very large files (16 TB), and
speed improvements.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Other file systems, including FAT32, NTFS, ReiserFS, JFS, and XFS are
useful for specialized purposes. More information about these file systems
can be found at <ulink
url="http://en.wikipedia.org/wiki/Comparison_of_file_systems"/>.</para>
<para>LFS assumes that the root file system (/) is of type ext4. To create
an <systemitem class="filesystem">ext4</systemitem> file system on the LFS
partition, run the following:</para>
<screen role="nodump"><userinput>mkfs -v -t ext4 /dev/<replaceable>&lt;xxx&gt;</replaceable></userinput></screen>
<!--
<para>Replace <replaceable>&lt;xxx&gt;</replaceable> with the name of the LFS
partition (<filename class="devicefile">sda5</filename> in our previous
example).</para>
<note>
<para>Some host distributions use custom features in their filesystem
creation tools (E2fsprogs). This can cause problems when booting into your new
LFS in Chapter&nbsp;9, as those features will not be supported by the LFS-installed
E2fsprogs; you will get an error similar to <quote>unsupported filesystem
features, upgrade your e2fsprogs</quote>. To check if your host system
uses custom enhancements, run the following command:</para>
<screen role="nodump"><userinput>debugfs -R feature /dev/<replaceable>&lt;xxx&gt;</replaceable></userinput></screen>
<para>If the output contains features other than
<option>has_journal</option>, <option>ext_attr</option>,
<option>resize_inode</option>, <option>dir_index</option>,
<option>filetype</option>, <option>sparse_super</option>,
<option>large_file</option> or <option>needs_recovery</option>, then your
host system may have custom enhancements. In that case, to avoid later
problems, you should compile the stock E2fsprogs package and use the
resulting binaries to re-create the filesystem on your LFS partition:</para>
<screen role="nodump"><userinput>cd /tmp
tar -xzvf /path/to/sources/e2fsprogs-&e2fsprogs-version;.tar.gz
cd e2fsprogs-&e2fsprogs-version;
mkdir -v build
cd build
../configure
make #note that we intentionally don't 'make install' here!
./misc/mke2fs -jv /dev/<replaceable>&lt;xxx&gt;</replaceable>
cd /tmp
rm -rfv e2fsprogs-&e2fsprogs-version;</userinput></screen>
</note>
-->
<para>If you are using an existing <systemitem class="filesystem">swap
</systemitem> partition, there is no need to format it. If a new
<systemitem class="filesystem"> swap</systemitem> partition was created,
it will need to be initialized with this command:</para>
<screen role="nodump"><userinput>mkswap /dev/<replaceable>&lt;yyy&gt;</replaceable></userinput></screen>
<para>Replace <replaceable>&lt;yyy&gt;</replaceable> with the name of the
<systemitem class="filesystem">swap</systemitem> partition.</para>
</sect1>

View File

@ -0,0 +1,181 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="space-creatingpartition">
<?dbhtml filename="creatingpartition.html"?>
<title>Creating a New Partition</title>
<para>Like most other operating systems, LFS is usually installed on a
dedicated partition. The recommended approach to building an LFS system
is to use an available empty partition or, if you have enough unpartitioned
space, to create one.</para>
<!--
<para>It is possible to install an LFS system (in fact even multiple LFS
systems) on a partition already occupied by another
operating system and the different systems will co-exist peacefully. The
document <ulink url="&hints-root;lfs_next_to_existing_systems.txt"/>
contains notes on how to implement this. This document was last updated
in 2004. It has not been updated since and it has not been tested with
recent versions of this LFS book. The document is more than likely not
usable as-is and you will need to account for changes made to the LFS
procedures since it was written. This is only recommended for expert LFS
users.</para>
-->
<para>A minimal system requires a partition of around 6 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. A 20 GB partition is a reasonable size to provide for growth. The LFS
system itself will not take up this much room. A large portion of this
requirement is to provide sufficient free temporary storage as well as
for adding additional capabilities after LFS is complete. Additionally, compiling
packages can require a lot of disk space which will be reclaimed after the
package is installed.</para>
<para>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
<systemitem class="filesystem">swap</systemitem> space. This is used by the
kernel to store seldom-used data and leave more memory available for active
processes. The <systemitem class="filesystem">swap</systemitem> partition for
an LFS system can be the same as the one used by the host system, in which
case it is not necessary to create another one.</para>
<para>Start a disk partitioning program such as <command>cfdisk</command>
or <command>fdisk</command> with a command line option naming the hard
disk on which the new partition will be created&mdash;for example
<filename class="devicefile">/dev/sda</filename> for the primary Integrated
Drive Electronics (IDE) disk. Create a Linux native partition and a
<systemitem class="filesystem">swap</systemitem> partition, if needed. Please
refer to <filename>cfdisk(8)</filename> or <filename>fdisk(8)</filename> if
you do not yet know how to use the programs.</para>
<note><para>For experienced users, other partitioning schemes are possible.
The new LFS system can be on a software <ulink
url="&blfs-book;postlfs/raid.html">RAID</ulink> array or an <ulink
url="&blfs-book;postlfs/aboutlvm.html">LVM</ulink> logical volume.
However, some of these options require an <ulink
url="&blfs-book;postlfs/initramfs.html">initramfs</ulink>, which is
an advanced topic. These partitioning methodologies are not recommended for
first time LFS users.</para></note>
<para>Remember the designation of the new partition (e.g., <filename
class="devicefile">sda5</filename>). This book will refer to this as
the LFS partition. Also remember the designation of the <systemitem
class="filesystem">swap</systemitem> partition. These names will be
needed later for the <filename>/etc/fstab</filename> file.</para>
<sect2>
<title>Other Partition Issues</title>
<para>Requests for advice on system partitioning are often posted on the LFS mailing
lists. This is a highly subjective topic. The default for most distributions
is to use the entire drive with the exception of one small swap partition. This
is not optimal for LFS for several reasons. It reduces flexibility, makes
sharing of data across multiple distributions or LFS builds more difficult, makes
backups more time consuming, and can waste disk space through inefficient
allocation of file system structures.</para>
<sect3>
<title>The Root Partition</title>
<para>A root LFS partition (not to be confused with the
<filename class="directory">/root</filename> directory) of
ten gigabytes is a good compromise for most systems. It provides enough
space to build LFS and most of BLFS, but is small enough so that multiple
partitions can be easily created for experimentation.</para> </sect3>
<sect3>
<title>The Swap Partition</title>
<para>Most distributions automatically create a swap partition. Generally
the recommended size of the swap partition is about twice the amount of
physical RAM, however this is rarely needed. If disk space is limited,
hold the swap partition to two gigabytes and monitor the amount of disk
swapping.</para>
<para>Swapping is never good. Generally you can tell if a system is
swapping by just listening to disk activity and observing how the system
reacts to commands. The first reaction to swapping should be to check for
an unreasonable command such as trying to edit a five gigabyte file. If
swapping becomes a normal occurrence, the best solution is to purchase more
RAM for your system.</para>
</sect3>
<sect3>
<title>The Grub Bios Partition</title>
<para>If the <emphasis>boot disk</emphasis> has been partitioned with a
GUID Partition Table (GPT), then a small, typically 1 MB, partition must be
created if it does not already exist. This partition is not formatted, but
must be available for GRUB to use during installation of the boot
loader. This partition will normally be labeled 'BIOS Boot' if using
<command>fdisk</command> or have a code of <emphasis>EF02</emphasis> if
using <command>gdisk</command>.</para>
<note><para>The Grub Bios partition must be on the drive that the BIOS
uses to boot the system. This is not necessarily the same drive where the
LFS root partition is located. Disks on a system may use different
partition table types. The requirement for this partition depends
only on the partition table type of the boot disk.</para></note>
</sect3>
<sect3>
<title>Convenience Partitions</title>
<para>There are several other partitions that are not required, but should
be considered when designing a disk layout. The following list
is not comprehensive, but is meant as a guide.</para>
<itemizedlist>
<listitem><para>/boot &ndash; Highly recommended. Use this partition to
store kernels and other booting information. To minimize potential boot
problems with larger disks, make this the first physical partition on
your first disk drive. A partition size of 100 megabytes is quite
adequate.</para></listitem>
<listitem><para>/home &ndash; Highly recommended. Share your home
directory and user customization across multiple distributions or LFS
builds. The size is generally fairly large and depends on available disk
space.</para></listitem>
<listitem><para>/usr &ndash; A separate /usr partition is generally used
if providing a server for a thin client or diskless workstation. It is
normally not needed for LFS. A size of five gigabytes will handle most
installations.</para></listitem>
<listitem><para>/opt &ndash; This directory is most useful for
BLFS where multiple installations of large packages like Gnome or KDE can
be installed without embedding the files in the /usr hierarchy. If
used, 5 to 10 gigabytes is generally adequate.</para>
</listitem>
<listitem><para>/tmp &ndash; A separate /tmp directory is rare, but
useful if configuring a thin client. This partition, if used, will
usually not need to exceed a couple of gigabytes.</para></listitem>
<listitem><para>/usr/src &ndash; This partition is very
useful for providing a location to store BLFS source files and
share them across LFS builds. It can also be used as a location
for building BLFS packages. A reasonably large partition of 30-50
gigabytes allows plenty of room.</para></listitem>
</itemizedlist>
<para>Any separate partition that you want automatically mounted upon boot
needs to be specified in the <filename>/etc/fstab</filename>. Details
about how to specify partitions will be discussed in <xref
linkend="ch-bootable-fstab"/>. </para>
</sect3>
</sect2>
</sect1>

237
chapter02/hostreqs.xml Normal file
View File

@ -0,0 +1,237 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="pre-hostreqs" xreflabel="Host System Requirements">
<?dbhtml filename="hostreqs.html"?>
<title>Host System Requirements</title>
<para>Your host system should have the following software with the
minimum versions indicated. This should not be an issue for most
modern Linux distributions. Also note that many distributions will
place software headers into separate packages, often in the form of
<quote>&lt;package-name&gt;-devel</quote> or
<quote>&lt;package-name&gt;-dev</quote>. Be sure to install those if
your distribution provides them.</para>
<para>Earlier versions of the listed software packages may work, but have
not been tested.</para>
<itemizedlist spacing="compact">
<listitem>
<para><emphasis role="strong">Bash-3.2</emphasis> (/bin/sh
should be a symbolic or hard link to bash)</para>
</listitem>
<listitem>
<para><emphasis role="strong">Binutils-2.25</emphasis> (Versions
greater than &binutils-version; are not recommended as they have
not been tested)</para>
</listitem>
<listitem>
<para><emphasis role="strong">Bison-2.7</emphasis> (/usr/bin/yacc
should be a link to bison or small script that executes bison)</para>
</listitem>
<listitem>
<para><emphasis role="strong">Bzip2-1.0.4</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Coreutils-6.9</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Diffutils-2.8.1</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Findutils-4.2.31</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Gawk-4.0.1</emphasis> (/usr/bin/awk
should be a link to gawk)</para>
</listitem>
<listitem>
<para><emphasis role="strong">GCC-5.2</emphasis> including the C++
compiler, <command>g++</command> (Versions greater than &gcc-version; are
not recommended as they have not been tested)</para>
</listitem>
<listitem>
<para><emphasis role="strong">Glibc-2.11</emphasis> (Versions
greater than &glibc-version; are not recommended as they have
not been tested)</para>
</listitem>
<listitem>
<para><emphasis role="strong">Grep-2.5.1a</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Gzip-1.3.12</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Linux Kernel-&min-kernel;</emphasis></para>
<para>The reason for the kernel version requirement is that we specify
that version when building <application>glibc</application> in Chapter&nbsp;6
at the recommendation of the developers. It is also required by
udev.</para>
<para>If the host kernel is earlier than &min-kernel; you will need to replace
the kernel with a more up to date version. There are two ways
you can go about this. First, see if your Linux vendor provides a &min-kernel;
or later kernel package. If so, you may wish to install it. If your
vendor doesn't offer an acceptable kernel package, or you would prefer not to
install it, you can compile a kernel yourself. Instructions for
compiling the kernel and configuring the boot loader (assuming the host
uses GRUB) are located in <xref linkend="chapter-bootable"/>.</para>
</listitem>
<listitem>
<para><emphasis role="strong">M4-1.4.10</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Make-4.0</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Patch-2.5.4</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Perl-5.8.8</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Python-3.4</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Sed-4.1.5</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Tar-1.22</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Texinfo-4.7</emphasis></para>
</listitem>
<listitem>
<para><emphasis role="strong">Xz-5.0.0</emphasis></para>
</listitem>
</itemizedlist>
<important>
<para>Note that the symlinks mentioned above are required to build an LFS
system using the instructions contained within this book. Symlinks that
point to other software (such as dash, mawk, etc.) may work, but are not
tested or supported by the LFS development team, and may require either
deviation from the instructions or additional patches to some
packages.</para>
</important>
<!-- Use an empty sect2 element to prevent a pdf warning. -->
<bridgehead renderas="sect2"
id="version-check"
xreflabel="Host System Requirements">
</bridgehead>
<!--<title> </title>-->
<para >To see whether your host system has all the appropriate versions, and
the ability to compile programs, run the following:</para>
<!-- ANY additional lines in the script cause a pdf rendering problem-->
<screen role="nodump"><userinput>cat &gt; version-check.sh &lt;&lt; "EOF"
<literal>#!/bin/bash
# Simple script to list version numbers of critical development tools
export LC_ALL=C
bash --version | head -n1 | cut -d" " -f2-4
MYSH=$(readlink -f /bin/sh)
echo "/bin/sh -&gt; $MYSH"
echo $MYSH | grep -q bash || echo "ERROR: /bin/sh does not point to bash"
unset MYSH
echo -n "Binutils: "; ld --version | head -n1 | cut -d" " -f3-
bison --version | head -n1
if [ -h /usr/bin/yacc ]; then
echo "/usr/bin/yacc -> `readlink -f /usr/bin/yacc`";
elif [ -x /usr/bin/yacc ]; then
echo yacc is `/usr/bin/yacc --version | head -n1`
else
echo "yacc not found"
fi
bzip2 --version 2&gt;&amp;1 &lt; /dev/null | head -n1 | cut -d" " -f1,6-
echo -n "Coreutils: "; chown --version | head -n1 | cut -d")" -f2
diff --version | head -n1
find --version | head -n1
gawk --version | head -n1
if [ -h /usr/bin/awk ]; then
echo "/usr/bin/awk -&gt; `readlink -f /usr/bin/awk`";
elif [ -x /usr/bin/awk ]; then
echo awk is `/usr/bin/awk --version | head -n1`
else
echo "awk not found"
fi
gcc --version | head -n1
g++ --version | head -n1
ldd --version | head -n1 | cut -d" " -f2- # glibc version
grep --version | head -n1
gzip --version | head -n1
cat /proc/version
m4 --version | head -n1
make --version | head -n1
patch --version | head -n1
echo Perl `perl -V:version`
python3 --version
sed --version | head -n1
tar --version | head -n1
makeinfo --version | head -n1 # texinfo version
xz --version | head -n1
<?hard-pagebreak?>
echo 'int main(){}' &gt; dummy.c &amp;&amp; g++ -o dummy dummy.c
if [ -x dummy ]
then echo "g++ compilation OK";
else echo "g++ compilation failed"; fi
rm -f dummy.c dummy</literal>
EOF
bash version-check.sh</userinput></screen>
<!--
<para>Also check for some library consistency:</para>
<screen role="nodump"><userinput>cat &gt; library-check.sh &lt;&lt; "EOF"
<literal>#!/bin/bash
for lib in lib{gmp,mpfr,mpc}.la; do
echo $lib: $(if find /usr/lib* -name $lib|
grep -q $lib;then :;else echo not;fi) found
done
unset lib</literal>
EOF
bash library-check.sh</userinput></screen>
<para>The files identified by this script should be all present
or all absent, but not only one or two present.</para>
-->
</sect1>

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="space-introduction">
<?dbhtml filename="introduction.html"?>
<title>Introduction</title>
<para>In this chapter, the host tools needed for building LFS
are checked and, if necessary, installed. Then a partition which will
host the LFS system is prepared. We will create the partition
itself, create a file system on it, and mount it.</para>
</sect1>

74
chapter02/mounting.xml Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="space-mounting">
<?dbhtml filename="mounting.html"?>
<title>Mounting the New Partition</title>
<para>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 the directory specified by the
<envar>LFS</envar> environment variable as described in the previous section.
</para>
<para>Create the mount point and mount the LFS file system by running:</para>
<screen role="nodump"><userinput>mkdir -pv $LFS
mount -v -t ext4 /dev/<replaceable>&lt;xxx&gt;</replaceable> $LFS</userinput></screen>
<para>Replace <replaceable>&lt;xxx&gt;</replaceable> with the designation of the LFS
partition.</para>
<para>If using multiple partitions for LFS (e.g., one for <filename
class="directory">/</filename> and another for <filename
class="directory">/usr</filename>), mount them using:</para>
<screen role="nodump"><userinput>mkdir -pv $LFS
mount -v -t ext4 /dev/<replaceable>&lt;xxx&gt;</replaceable> $LFS
mkdir -v $LFS/usr
mount -v -t ext4 /dev/<replaceable>&lt;yyy&gt;</replaceable> $LFS/usr</userinput></screen>
<para>Replace <replaceable>&lt;xxx&gt;</replaceable> and
<replaceable>&lt;yyy&gt;</replaceable> with the appropriate partition
names.</para>
<para>Ensure that this new partition is not mounted with permissions that are
too restrictive (such as the <option>nosuid</option> or
<option>nodev</option> options). Run the <command>mount</command> command
without any parameters to see what options are set for the mounted LFS
partition. If <option>nosuid</option> and/or <option>nodev</option> are set,
the partition will need to be remounted.</para>
<warning><para>The above instructions assume that you will not be restarting
your computer throughout the LFS process. If you shut down your system,
you will either need to remount the LFS partition each time you restart
the build process or modify your host system's /etc/fstab file to automatically
remount it upon boot. For example:
<screen role="nodump">/dev/<replaceable>&lt;xxx&gt;</replaceable> /mnt/lfs ext4 defaults 1 1</screen>
If you use additional optional partitions, be sure to add them also.
</para></warning>
<para>If you are using a <systemitem
class="filesystem">swap</systemitem> partition, ensure that it is enabled
using the <command>swapon</command> command:</para>
<screen role="nodump"><userinput>/sbin/swapon -v /dev/<replaceable>&lt;zzz&gt;</replaceable></userinput></screen>
<para>Replace <replaceable>&lt;zzz&gt;</replaceable> with the name of the
<systemitem class="filesystem">swap</systemitem> partition.</para>
<para>Now that there is an established place to work, it is time to
download the packages.</para>
</sect1>

82
chapter02/stages.xml Normal file
View File

@ -0,0 +1,82 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="stages">
<?dbhtml filename="stages.html"?>
<title>Building LFS in Stages</title>
<para>LFS is designed to be built in one session. That is, the
instructions assume that the system will not be shut down
during the process. That does not mean that the system has to
be done in one sitting. The issue is that certain procedures
have to be re-accomplished after a reboot if resuming LFS at
different points.</para>
<sect2>
<title>Chapters&nbsp;1&ndash;4</title>
<para>These chapters are accomplished on the host system. When
restarting, be careful of the following:</para>
<itemizedlist>
<listitem>
<para>Procedures done as the root user after Section 2.4 need to
have the LFS environment variable set <emphasis>FOR THE ROOT
USER</emphasis>.</para>
</listitem>
</itemizedlist>
</sect2>
<sect2>
<title>Chapter&nbsp;5</title>
<itemizedlist>
<listitem>
<para>The /mnt/lfs partition must be mounted.</para>
</listitem>
<listitem>
<para><emphasis>ALL</emphasis> instructions in Chapter&nbsp;5
must be done by user <emphasis>lfs</emphasis>.
A <command>su - lfs</command> needs to be done before any
task in Chapter&nbsp;5.</para>
</listitem>
<listitem>
<para>The procedures in <xref linkend='ch-tools-generalinstructions'/>
are critical. If there is any
doubt about installing a package, ensure any previously expanded
tarballs are removed, re-extract the package files, and complete all
instructions in that section.</para>
</listitem>
</itemizedlist>
</sect2>
<sect2>
<title>Chapters&nbsp;6&ndash;8</title>
<itemizedlist>
<listitem>
<para>The /mnt/lfs partition must be mounted.</para>
</listitem>
<listitem>
<para> When entering chroot, the LFS environment variable must be set
for root. The LFS variable is not used otherwise.</para>
</listitem>
<listitem>
<para> The virtual file systems must be mounted. This can be done
before or after entering chroot by changing to a host virtual terminal
and, as root, running the commands in
<xref linkend='ch-system-bindmount'/> and
<xref linkend='ch-system-kernfsmount'/>.</para>
</listitem>
</itemizedlist>
</sect2>
</sect1>

18
chapter03/chapter03.xml Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<chapter id="chapter-getting-materials" xreflabel="Chapter&nbsp;3">
<?dbhtml dir="chapter03"?>
<?dbhtml filename="chapter03.html"?>
<title>Packages and Patches</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="packages.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="patches.xml"/>
</chapter>

View File

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="materials-introduction">
<?dbhtml filename="introduction.html"?>
<title>Introduction</title>
<para>This chapter includes a list of packages that need to be downloaded in
order to build 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 against 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 require work-arounds. These work-arounds
will be developed and stabilized in the development version of the
book.</para>
<para>Download locations may not always be accessible. If a download
location has changed since this book was published, Google (<ulink
url="http://www.google.com/"/>) provides a useful search engine for
most packages. If this search is unsuccessful, try one of the
alternative means of downloading discussed at <ulink
url="&lfs-root;lfs/packages.html#packages"/>. </para>
<para>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.
<filename class="directory">$LFS/sources</filename> 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.</para>
<para>To create this directory, execute the following command, as user
<systemitem class="username">root</systemitem>, before starting the download
session:</para>
<screen role="nodump"><userinput>mkdir -v $LFS/sources</userinput></screen>
<para>Make this directory writable and sticky. <quote>Sticky</quote>
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:</para>
<screen role="nodump"><userinput>chmod -v a+wt $LFS/sources</userinput></screen>
<para>An easy way to download all of the packages and patches is by using
<ulink url="../wget-list">wget-list</ulink> as an input to
<command>wget</command>. For example:</para>
<screen role="nodump"><userinput>wget --input-file=wget-list --continue --directory-prefix=$LFS/sources</userinput></screen>
<para>Additionally, starting with LFS-7.0, there is a separate file,
<ulink url="../md5sums">md5sums</ulink>, which can be used to verify that all
the correct packages are available before proceeding. Place that file in
<filename class="directory">$LFS/sources</filename> and run:</para>
<screen role="nodump"><userinput>pushd $LFS/sources
md5sum -c md5sums
popd</userinput></screen>
</sect1>

771
chapter03/packages.xml Normal file
View File

@ -0,0 +1,771 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="materials-packages">
<?dbhtml filename="packages.html"?>
<title>All Packages</title>
<para>Download or otherwise obtain the following packages:</para>
<variablelist role="materials">
<varlistentry>
<term>Acl (&acl-version;) - <token>&acl-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&acl-home;"/></para>
<para>Download: <ulink url="&acl-url;"/></para>
<para>MD5 sum: <literal>&acl-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Attr (&attr-version;) - <token>&attr-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&attr-home;"/></para>
<para>Download: <ulink url="&attr-url;"/></para>
<para>MD5 sum: <literal>&attr-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Autoconf (&autoconf-version;) - <token>&autoconf-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&autoconf-home;"/></para>
<para>Download: <ulink url="&autoconf-url;"/></para>
<para>MD5 sum: <literal>&autoconf-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Automake (&automake-version;) - <token>&automake-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&automake-home;"/></para>
<para>Download: <ulink url="&automake-url;"/></para>
<para>MD5 sum: <literal>&automake-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Bash (&bash-version;) - <token>&bash-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&bash-home;"/></para>
<para>Download: <ulink url="&bash-url;"/></para>
<para>MD5 sum: <literal>&bash-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Bc (&bc-version;) - <token>&bc-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&bc-home;"/></para>
<para>Download: <ulink url="&bc-url;"/></para>
<para>MD5 sum: <literal>&bc-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Binutils (&binutils-version;) - <token>&binutils-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&binutils-home;"/></para>
<para>Download: <ulink url="&binutils-url;"/></para>
<para>MD5 sum: <literal>&binutils-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Bison (&bison-version;) - <token>&bison-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&bison-home;"/></para>
<para>Download: <ulink url="&bison-url;"/></para>
<para>MD5 sum: <literal>&bison-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Bzip2 (&bzip2-version;) - <token>&bzip2-size;</token>:</term>
<listitem>
<!--<para>Home page: <ulink url="&bzip2-home;"/></para>-->
<para>Download: <ulink url="&bzip2-url;"/></para>
<para>MD5 sum: <literal>&bzip2-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Check (&check-version;) - <token>&check-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&check-home;"/></para>
<para>Download: <ulink url="&check-url;"/></para>
<para>MD5 sum: <literal>&check-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Coreutils (&coreutils-version;) - <token>&coreutils-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&coreutils-home;"/></para>
<para>Download: <ulink url="&coreutils-url;"/></para>
<para>MD5 sum: <literal>&coreutils-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry revision="systemd">
<term>D-Bus (&dbus-version;) - <token>&dbus-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&dbus-home;"/></para>
<para>Download: <ulink url="&dbus-url;"/></para>
<para>MD5 sum: <literal>&dbus-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>DejaGNU (&dejagnu-version;) - <token>&dejagnu-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&dejagnu-home;"/></para>
<para>Download: <ulink url="&dejagnu-url;"/></para>
<para>MD5 sum: <literal>&dejagnu-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Diffutils (&diffutils-version;) - <token>&diffutils-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&diffutils-home;"/></para>
<para>Download: <ulink url="&diffutils-url;"/></para>
<para>MD5 sum: <literal>&diffutils-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>E2fsprogs (&e2fsprogs-version;) - <token>&e2fsprogs-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&e2fsprogs-home;"/></para>
<para>Download: <ulink url="&e2fsprogs-url;"/></para>
<para>MD5 sum: <literal>&e2fsprogs-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Elfutils (&elfutils-version;) - <token>&elfutils-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&elfutils-home;"/></para>
<para>Download: <ulink url="&elfutils-url;"/></para>
<para>MD5 sum: <literal>&elfutils-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry revision="sysv">
<term>Eudev (&eudev-version;) - <token>&eudev-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&eudev-url;"/></para>
<para>MD5 sum: <literal>&eudev-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Expat (&expat-version;) - <token>&expat-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&expat-home;"/></para>
<para>Download: <ulink url="&expat-url;"/></para>
<para>MD5 sum: <literal>&expat-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Expect (&expect-version;) - <token>&expect-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&expect-home;"/></para>
<para>Download: <ulink url="&expect-url;"/></para>
<para>MD5 sum: <literal>&expect-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>File (&file-version;) - <token>&file-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&file-home;"/></para>
<para>Download: <ulink url="&file-url;"/></para>
<para>MD5 sum: <literal>&file-md5;</literal></para>
<note>
<para>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 alternative download location that may have the correct
version available can also be found at: <ulink
url="http://www.linuxfromscratch.org/lfs/download.html#ftp"/>.</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term>Findutils (&findutils-version;) - <token>&findutils-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&findutils-home;"/></para>
<para>Download: <ulink url="&findutils-url;"/></para>
<para>MD5 sum: <literal>&findutils-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Flex (&flex-version;) - <token>&flex-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&flex-home;"/></para>
<para>Download: <ulink url="&flex-url;"/></para>
<para>MD5 sum: <literal>&flex-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Gawk (&gawk-version;) - <token>&gawk-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&gawk-home;"/></para>
<para>Download: <ulink url="&gawk-url;"/></para>
<para>MD5 sum: <literal>&gawk-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>GCC (&gcc-version;) - <token>&gcc-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&gcc-home;"/></para>
<para>Download: <ulink url="&gcc-url;"/></para>
<para>MD5 sum: <literal>&gcc-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>GDBM (&gdbm-version;) - <token>&gdbm-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&gdbm-home;"/></para>
<para>Download: <ulink url="&gdbm-url;"/></para>
<para>MD5 sum: <literal>&gdbm-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Gettext (&gettext-version;) - <token>&gettext-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&gettext-home;"/></para>
<para>Download: <ulink url="&gettext-url;"/></para>
<para>MD5 sum: <literal>&gettext-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Glibc (&glibc-version;) - <token>&glibc-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&glibc-home;"/></para>
<para>Download: <ulink url="&glibc-url;"/></para>
<para>MD5 sum: <literal>&glibc-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>GMP (&gmp-version;) - <token>&gmp-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&gmp-home;"/></para>
<para>Download: <ulink url="&gmp-url;"/></para>
<para>MD5 sum: <literal>&gmp-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Gperf (&gperf-version;) - <token>&gperf-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&gperf-home;"/></para>
<para>Download: <ulink url="&gperf-url;"/></para>
<para>MD5 sum: <literal>&gperf-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Grep (&grep-version;) - <token>&grep-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&grep-home;"/></para>
<para>Download: <ulink url="&grep-url;"/></para>
<para>MD5 sum: <literal>&grep-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Groff (&groff-version;) - <token>&groff-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&groff-home;"/></para>
<para>Download: <ulink url="&groff-url;"/></para>
<para>MD5 sum: <literal>&groff-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>GRUB (&grub-version;) - <token>&grub-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&grub-home;"/></para>
<para>Download: <ulink url="&grub-url;"/></para>
<para>MD5 sum: <literal>&grub-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Gzip (&gzip-version;) - <token>&gzip-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&gzip-home;"/></para>
<para>Download: <ulink url="&gzip-url;"/></para>
<para>MD5 sum: <literal>&gzip-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Iana-Etc (&iana-etc-version;) - <token>&iana-etc-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&iana-etc-home;"/></para>
<para>Download: <ulink url="&iana-etc-url;"/></para>
<para>MD5 sum: <literal>&iana-etc-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Inetutils (&inetutils-version;) - <token>&inetutils-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&inetutils-home;"/></para>
<para>Download: <ulink url="&inetutils-url;"/></para>
<para>MD5 sum: <literal>&inetutils-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Intltool (&intltool-version;) - <token>&intltool-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&intltool-home;"/></para>
<para>Download: <ulink url="&intltool-url;"/></para>
<para>MD5 sum: <literal>&intltool-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>IPRoute2 (&iproute2-version;) - <token>&iproute2-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&iproute2-home;"/></para>
<para>Download: <ulink url="&iproute2-url;"/></para>
<para>MD5 sum: <literal>&iproute2-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Kbd (&kbd-version;) - <token>&kbd-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&kbd-home;"/></para>
<para>Download: <ulink url="&kbd-url;"/></para>
<para>MD5 sum: <literal>&kbd-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Kmod (&kmod-version;) - <token>&kmod-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&kmod-home;"/></para>
<para>Download: <ulink url="&kmod-url;"/></para>
<para>MD5 sum: <literal>&kmod-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Less (&less-version;) - <token>&less-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&less-home;"/></para>
<para>Download: <ulink url="&less-url;"/></para>
<para>MD5 sum: <literal>&less-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry revision="sysv">
<term>LFS-Bootscripts (&lfs-bootscripts-version;) - <token>&lfs-bootscripts-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&lfs-bootscripts-home;"/></para>
<para>Download: <ulink url="&lfs-bootscripts-url;"/></para>
<para>MD5 sum: <literal>&lfs-bootscripts-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Libcap (&libcap-version;) - <token>&libcap-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&libcap-home;"/></para>
<para>Download: <ulink url="&libcap-url;"/></para>
<para>MD5 sum: <literal>&libcap-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Libffi (&libffi-version;) - <token>&libffi-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&libffi-home;"/></para>
<para>Download: <ulink url="&libffi-url;"/></para>
<para>MD5 sum: <literal>&libffi-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Libpipeline (&libpipeline-version;) - <token>&libpipeline-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&libpipeline-home;"/></para>
<para>Download: <ulink url="&libpipeline-url;"/></para>
<para>MD5 sum: <literal>&libpipeline-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Libtool (&libtool-version;) - <token>&libtool-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&libtool-home;"/></para>
<para>Download: <ulink url="&libtool-url;"/></para>
<para>MD5 sum: <literal>&libtool-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Linux (&linux-version;) - <token>&linux-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&linux-home;"/></para>
<para>Download: <ulink url="&linux-url;"/></para>
<para>MD5 sum: <literal>&linux-md5;</literal></para>
<note>
<para>The Linux kernel is updated relatively often, many times due to
discoveries of security vulnerabilities. The latest available
&linux-major-version;.&linux-minor-version;.x kernel version should be
used, unless the errata page says otherwise.</para>
<para>For users with limited speed or expensive bandwidth who wish to
update the Linux kernel, a baseline version of the package and
patches can be downloaded separately. This may save some time or
cost for a subsequent patch level upgrade within a minor release.
</para>
</note>
</listitem>
</varlistentry>
<varlistentry>
<term>M4 (&m4-version;) - <token>&m4-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&m4-home;"/></para>
<para>Download: <ulink url="&m4-url;"/></para>
<para>MD5 sum: <literal>&m4-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Make (&make-version;) - <token>&make-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&make-home;"/></para>
<para>Download: <ulink url="&make-url;"/></para>
<para>MD5 sum: <literal>&make-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Man-DB (&man-db-version;) - <token>&man-db-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&man-db-home;"/></para>
<para>Download: <ulink url="&man-db-url;"/></para>
<para>MD5 sum: <literal>&man-db-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Man-pages (&man-pages-version;) - <token>&man-pages-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&man-pages-home;"/></para>
<para>Download: <ulink url="&man-pages-url;"/></para>
<para>MD5 sum: <literal>&man-pages-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Meson (&meson-version;) - <token>&meson-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&meson-home;"/></para>
<para>Download: <ulink url="&meson-url;"/></para>
<para>MD5 sum: <literal>&meson-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>MPC (&mpc-version;) - <token>&mpc-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&mpc-home;"/></para>
<para>Download: <ulink url="&mpc-url;"/></para>
<para>MD5 sum: <literal>&mpc-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>MPFR (&mpfr-version;) - <token>&mpfr-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&mpfr-home;"/></para>
<para>Download: <ulink url="&mpfr-url;"/></para>
<para>MD5 sum: <literal>&mpfr-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Ninja (&ninja-version;) - <token>&ninja-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&ninja-home;"/></para>
<para>Download: <ulink url="&ninja-url;"/></para>
<para>MD5 sum: <literal>&ninja-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Ncurses (&ncurses-version;) - <token>&ncurses-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&ncurses-home;"/></para>
<para>Download: <ulink url="&ncurses-url;"/></para>
<para>MD5 sum: <literal>&ncurses-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>OpenSSL (&openssl-version;) - <token>&openssl-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&openssl-home;"/></para>
<para>Download: <ulink url="&openssl-url;"/></para>
<para>MD5 sum: <literal>&openssl-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Patch (&patch-version;) - <token>&patch-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&patch-home;"/></para>
<para>Download: <ulink url="&patch-url;"/></para>
<para>MD5 sum: <literal>&patch-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Perl (&perl-version;) - <token>&perl-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&perl-home;"/></para>
<para>Download: <ulink url="&perl-url;"/></para>
<para>MD5 sum: <literal>&perl-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Pkg-config (&pkgconfig-version;) - <token>&pkgconfig-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&pkgconfig-home;"/></para>
<para>Download: <ulink url="&pkgconfig-url;"/></para>
<para>MD5 sum: <literal>&pkgconfig-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Procps (&procps-ng-version;) - <token>&procps-ng-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&procps-ng-home;"/></para>
<para>Download: <ulink url="&procps-ng-url;"/></para>
<para>MD5 sum: <literal>&procps-ng-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Psmisc (&psmisc-version;) - <token>&psmisc-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&psmisc-home;"/></para>
<para>Download: <ulink url="&psmisc-url;"/></para>
<para>MD5 sum: <literal>&psmisc-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Python (&python-version;) - <token>&python-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&python-home;"/></para>
<para>Download: <ulink url="&python-url;"/></para>
<para>MD5 sum: <literal>&python-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Python Documentation (&python-version;) - <token>&python-docs-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&python-docs-url;"/></para>
<para>MD5 sum: <literal>&python-docs-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Readline (&readline-version;) - <token>&readline-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&readline-home;"/></para>
<para>Download: <ulink url="&readline-url;"/></para>
<para>MD5 sum: <literal>&readline-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Sed (&sed-version;) - <token>&sed-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&sed-home;"/></para>
<para>Download: <ulink url="&sed-url;"/></para>
<para>MD5 sum: <literal>&sed-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Shadow (&shadow-version;) - <token>&shadow-size;</token>:</term>
<listitem>
<!-- <para>Home page: <ulink url="&shadow-home;"/></para> -->
<para>Download: <ulink url="&shadow-url;"/></para>
<para>MD5 sum: <literal>&shadow-md5;</literal></para>
<!-- Using http://cdn.debian.net/debian/pool/main/s/shadow/
for now since alioth has not reconstituted shadow -->
</listitem>
</varlistentry>
<varlistentry revision="sysv">
<term>Sysklogd (&sysklogd-version;) - <token>&sysklogd-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&sysklogd-home;"/></para>
<para>Download: <ulink url="&sysklogd-url;"/></para>
<para>MD5 sum: <literal>&sysklogd-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry revision="systemd">
<term>Systemd (&systemd-version;) - <token>&systemd-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&systemd-home;"/></para>
<para>Download: <ulink url="&systemd-url;"/></para>
<para>MD5 sum: <literal>&systemd-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry revision="systemd">
<term>Systemd Man Pages(&systemd-version;) - <token>&systemd-man-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&systemd-home;"/></para>
<para>Download: <ulink url="&systemd-man-url;"/></para>
<para>MD5 sum: <literal>&systemd-man-md5;</literal></para>
<note>
<para>The Linux From Scratch team generates its own tarball of the
man pages using the systemd source. This is done in order to avoid
unnecessary dependencies.</para>
</note>
</listitem>
</varlistentry>
<varlistentry revision="sysv">
<term>Sysvinit (&sysvinit-version;) - <token>&sysvinit-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&sysvinit-home;"/></para>
<para>Download: <ulink url="&sysvinit-url;"/></para>
<para>MD5 sum: <literal>&sysvinit-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Tar (&tar-version;) - <token>&tar-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&tar-home;"/></para>
<para>Download: <ulink url="&tar-url;"/></para>
<para>MD5 sum: <literal>&tar-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Tcl (&tcl-version;) - <token>&tcl-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&tcl-home;"/></para>
<para>Download: <ulink url="&tcl-url;"/></para>
<para>MD5 sum: <literal>&tcl-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Texinfo (&texinfo-version;) - <token>&texinfo-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&texinfo-home;"/></para>
<para>Download: <ulink url="&texinfo-url;"/></para>
<para>MD5 sum: <literal>&texinfo-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Time Zone Data (&tzdata-version;) - <token>&tzdata-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&tzdata-home;"/></para>
<para>Download: <ulink url="&tzdata-url;"/></para>
<para>MD5 sum: <literal>&tzdata-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry revision="sysv">
<term>Udev-lfs Tarball (&udev-lfs-version;) - <token>&udev-lfs-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&udev-lfs-url;"/></para>
<para>MD5 sum: <literal>&udev-lfs-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Util-linux (&util-linux-version;) - <token>&util-linux-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&util-linux-home;"/></para>
<para>Download: <ulink url="&util-linux-url;"/></para>
<para>MD5 sum: <literal>&util-linux-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Vim (&vim-version;) - <token>&vim-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&vim-home;"/></para>
<para>Download: <ulink url="&vim-url;"/></para>
<para>MD5 sum: <literal>&vim-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>XML::Parser (&xml-parser-version;) - <token>&xml-parser-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&xml-parser-home;"/></para>
<para>Download: <ulink url="&xml-parser-url;"/></para>
<para>MD5 sum: <literal>&xml-parser-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Xz Utils (&xz-version;) - <token>&xz-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&xz-home;"/></para>
<para>Download: <ulink url="&xz-url;"/></para>
<para>MD5 sum: <literal>&xz-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Zlib (&zlib-version;) - <token>&zlib-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&zlib-home;"/></para>
<para>Download: <ulink url="&zlib-url;"/></para>
<para>MD5 sum: <literal>&zlib-md5;</literal></para>
</listitem>
</varlistentry>
</variablelist>
<para>Total size of these packages: about <returnvalue/></para>
</sect1>

139
chapter03/patches.xml Normal file
View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="materials-patches">
<?dbhtml filename="patches.html"?>
<title>Needed Patches</title>
<para>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:</para>
<variablelist role="materials">
<!--
<varlistentry>
<term>Bash Upstream Fixes Patch - <token>&bash-fixes-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&bash-fixes-patch;"/></para>
<para>MD5 sum: <literal>&bash-fixes-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<!--
<varlistentry>
<term>Bc Memory Leak Patch - <token>&bc-memory-leak-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&bc-memory-leak-patch;"/></para>
<para>MD5 sum: <literal>&bc-memory-leak-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<varlistentry>
<term>Bzip2 Documentation Patch - <token>&bzip2-docs-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&bzip2-docs-patch;"/></para>
<para>MD5 sum: <literal>&bzip2-docs-patch-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Coreutils Internationalization Fixes Patch - <token>&coreutils-i18n-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&coreutils-i18n-patch;"/></para>
<para>MD5 sum: <literal>&coreutils-i18n-patch-md5;</literal></para>
</listitem>
</varlistentry>
<!--
<varlistentry>
<term>Flex Fixes Patch - <token>&flex-fixes-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&flex-fixes-patch;"/></para>
<para>MD5 sum: <literal>&flex-fixes-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<!--
<varlistentry>
<term>Gccc ASAN Patch - <token>&gcc-asan-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&gcc-asan-patch;"/></para>
<para>MD5 sum: <literal>&gcc-asan-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<varlistentry>
<term>Glibc FHS Patch - <token>&glibc-fhs-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&glibc-fhs-patch;"/></para>
<para>MD5 sum: <literal>&glibc-fhs-patch-md5;</literal></para>
</listitem>
</varlistentry>
<!--
<varlistentry>
<term>Glibc Glob Security Patch - <token>&glibc-glob-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&glibc-glob-patch;"/></para>
<para>MD5 sum: <literal>&glibc-glob-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<varlistentry>
<term>Kbd Backspace/Delete Fix Patch - <token>&kbd-backspace-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&kbd-backspace-patch;"/></para>
<para>MD5 sum: <literal>&kbd-backspace-patch-md5;</literal></para>
</listitem>
</varlistentry>
<!--
<varlistentry>
<term>Ninja Limit Jobs Patch - <token>&ninja-limit-jobs-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&ninja-limit-jobs-patch;"/></para>
<para>MD5 sum: <literal>&ninja-limit-jobs-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<!--
<varlistentry>
<term>Readline Upstream Fixes Patch - <token>&readline-fixes-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&readline-fixes-patch;"/></para>
<para>MD5 sum: <literal>&readline-fixes-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<varlistentry revision="sysv">
<term>Sysvinit Consolidated Patch - <token>&sysvinit-consolidated-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&sysvinit-consolidated-patch;"/></para>
<para>MD5 sum: <literal>&sysvinit-consolidated-patch-md5;</literal></para>
</listitem>
</varlistentry>
<!--
<varlistentry revision="systemd">
<term>Systemd security patch - <token>&systemd-security-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&systemd-security-patch;"/></para>
<para>MD5 sum: <literal>&systemd-security-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
</variablelist>
<para>Total size of these patches: about <returnvalue/></para>
<para>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
<ulink url="&lfs-root;patches/downloads/"/> and acquire any additional
patches to suit your system needs.</para>
</sect1>

39
chapter04/aboutlfs.xml Normal file
View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="prepare-aboutlfs">
<?dbhtml filename="aboutlfs.html"?>
<title>About $LFS</title>
<para>Throughout this book, the environment variable <envar>LFS</envar> will
be used. It is paramount that this variable is always defined.
It should be set to the mount point chosen for the LFS partition.
Check that the <envar>LFS</envar> variable is set up properly with:</para>
<screen role="nodump"><userinput>echo $LFS</userinput></screen>
<para>Make sure the output shows the path to the LFS partition's mount
point, which is <filename class="directory">/mnt/lfs</filename> if the
provided example was followed. If the output is incorrect, the
variable can be set with:</para>
<screen role="nodump"><userinput>export LFS=/mnt/lfs</userinput></screen>
<para>Having this variable set is beneficial in that commands such as
<command>mkdir $LFS/tools</command> can be typed literally. The shell
will automatically replace <quote>$LFS</quote> with
<quote>/mnt/lfs</quote> (or whatever the variable was set to) when it
processes the command line.</para>
<para>Do not forget to check that <envar>$LFS</envar> is set whenever
you leave and reenter the current working environment (as when doing a
<command>su</command> to <systemitem class="username">root</systemitem>
or another user).</para>
</sect1>

61
chapter04/aboutsbus.xml Normal file
View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="prepare-aboutsbus">
<?dbhtml filename="aboutsbus.html"?>
<title>About SBUs</title>
<para>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 Standard Build Unit (SBU) measure will be
used instead.</para>
<para>The SBU measure works as follows. The first package to be compiled
from this book is Binutils in <xref linkend="chapter-temporary-tools"/>. The
time it takes to compile this package is what will be referred to as the
Standard Build Unit or SBU. All other compile times will be expressed relative
to this time.</para>
<para>For example, consider a package whose compilation time is 4.5
SBUs. This means that if a system took 10 minutes to compile and
install the first pass of Binutils, it will take
<emphasis>approximately</emphasis> 45 minutes to build this example package.
Fortunately, most build times are shorter than the one for Binutils.</para>
<para>In general, SBUs are not entirely accurate because they depend on many
factors, including the host system's version of GCC. They are provided here
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.</para>
<note>
<para>For many modern systems with multiple processors (or cores) the
compilation time for a package can be reduced by performing a "parallel
make" by either setting an environment variable or telling the
<command>make</command> program how many processors are available. For
instance, a Core2Duo can support two simultaneous processes with:</para>
<screen role="nodump"><userinput>export MAKEFLAGS='-j 2'</userinput></screen>
<para>or just building with:</para>
<screen role="nodump"><userinput>make -j2</userinput></screen>
<para>When multiple processors are used in this way, the SBU units in the
book will vary even more than they normally would. In some cases, the make
step will simply fail. Analyzing the output of the build process will also
be more difficult because the lines of different processes will be
interleaved. If you run into a problem with a build step, revert back to a
single processor build to properly analyze the error messages.</para>
</note>
</sect1>

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="prepare-abouttestsuites">
<?dbhtml filename="abouttestsuites.html"?>
<title>About the Test Suites</title>
<para>Most packages provide a test suite. Running the test suite for a
newly built package is a good idea because it can provide a <quote>sanity
check</quote> 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.</para>
<para>Some test suites are more important than others. For example,
the test suites for the core toolchain packages&mdash;GCC, Binutils, and
Glibc&mdash;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.</para>
<note>
<para>Experience has shown that there is little to be gained from running
the test suites in <xref linkend="chapter-temporary-tools"/>. 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 <xref linkend="chapter-temporary-tools"/> are temporary
and eventually discarded, we do not recommend running the test suites in
<xref linkend="chapter-temporary-tools"/> 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.</para>
</note>
<para>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
<systemitem class="filesystem">devpts</systemitem> file system set up
correctly. This issue is discussed in greater detail at
<ulink url="&lfs-root;lfs/faq.html#no-ptys"/>.</para>
<para>Sometimes package test suites will fail, but for reasons which the
developers are aware of and have deemed non-critical. Consult the logs located
at <ulink url="&test-results;"/> to verify whether or not these failures are
expected. This site is valid for all tests throughout this book.</para>
</sect1>

102
chapter04/addinguser.xml Normal file
View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-addinguser">
<?dbhtml filename="addinguser.html"?>
<title>Adding the LFS User</title>
<para>When logged in as user <systemitem class="username">root</systemitem>,
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
working environment, create a new user called <systemitem
class="username">lfs</systemitem> as a member of a new group (also named
<systemitem class="groupname">lfs</systemitem>) and use this user during
the installation process. As <systemitem class="username">root</systemitem>,
issue the following commands to add the new user:</para>
<screen><userinput>groupadd lfs
useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen>
<variablelist>
<title>The meaning of the command line options:</title>
<varlistentry>
<term><parameter>-s /bin/bash</parameter></term>
<listitem>
<para>This makes <command>bash</command> the default shell for user
<systemitem class="username">lfs</systemitem>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>-g lfs</parameter></term>
<listitem>
<para>This option adds user <systemitem class="username">lfs</systemitem>
to group <systemitem class="groupname">lfs</systemitem>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>-m</parameter></term>
<listitem>
<para>This creates a home directory for <systemitem
class="username">lfs</systemitem>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>-k /dev/null</parameter></term>
<listitem>
<para>This parameter prevents possible copying of files from a skeleton
directory (default is <filename class="directory">/etc/skel</filename>)
by changing the input location to the special null device.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>lfs</parameter></term>
<listitem>
<para>This is the actual name for the created group and user.</para>
</listitem>
</varlistentry>
</variablelist>
<para>To log in as <systemitem class="username">lfs</systemitem> (as opposed
to switching to user <systemitem class="username">lfs</systemitem> when logged
in as <systemitem class="username">root</systemitem>, which does not require
the <systemitem class="username">lfs</systemitem> user to have a password),
give <systemitem class="username">lfs</systemitem> a password:</para>
<screen role="nodump"><userinput>passwd lfs</userinput></screen>
<para>Grant <systemitem class="username">lfs</systemitem> full access to
<filename class="directory">$LFS/tools</filename> by making
<systemitem class="username">lfs</systemitem> the directory owner:</para>
<screen><userinput>chown -v lfs $LFS/tools</userinput></screen>
<para>If a separate working directory was created as suggested, give
user <systemitem class="username">lfs</systemitem> ownership of this
directory:</para>
<screen><userinput>chown -v lfs $LFS/sources</userinput></screen>
<para>Next, login as user <systemitem class="username">lfs</systemitem>.
This can be done via a virtual console, through a display manager, or with
the following substitute user command:</para>
<screen role="nodump"><userinput>su - lfs</userinput></screen>
<para>The <quote><parameter>-</parameter></quote> instructs
<command>su</command> 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
<filename>bash(1)</filename> and <command>info bash</command>.</para>
</sect1>

22
chapter04/chapter04.xml Normal file
View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<chapter id="chapter-final-preps" xreflabel="Chapter&nbsp;4">
<?dbhtml dir="chapter04"?>
<?dbhtml filename="chapter04.html"?>
<title>Final Preparations</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
<!--<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="aboutlfs.xml"/>-->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingtoolsdir.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="addinguser.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="settingenviron.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="aboutsbus.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="abouttestsuites.xml"/>
</chapter>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-creatingtoolsdir">
<?dbhtml filename="creatingtoolsdir.html"?>
<title>Creating the $LFS/tools Directory</title>
<para>All programs compiled in <xref linkend="chapter-temporary-tools"/>
will be installed under <filename class="directory">$LFS/tools</filename>
to keep them separate from the programs compiled in <xref
linkend="chapter-building-system"/>. 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 <xref
linkend="chapter-temporary-tools"/>).</para>
<para>Create the required directory by running the following as
<systemitem class="username">root</systemitem>:</para>
<screen><userinput>mkdir -v $LFS/tools</userinput></screen>
<para>The next step is to create a <filename class="symlink">/tools</filename>
symlink on the host system. This will point to the newly-created directory on
the LFS partition. Run this command as <systemitem
class="username">root</systemitem> as well:</para>
<screen><userinput>ln -sv $LFS/tools /</userinput></screen>
<note>
<para>The above command is correct. The <command>ln</command> command
has a few syntactic variations, so be sure to check
<command>info coreutils ln</command> and <filename>ln(1)</filename>
before reporting what you may think is an error.</para>
</note>
<para>The created symlink enables the toolchain to be compiled so that it
always refers to <filename class="directory">/tools</filename>, meaning
that the compiler, assembler, and linker will work both in Chapter&nbsp;5
(when we are still using some tools from the host) and in the next (when
we are <quote>chrooted</quote> to the LFS partition).</para>
</sect1>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="prepare-introduction">
<?dbhtml filename="introduction.html"?>
<title>Introduction</title>
<para>In this chapter, we will perform a few additional tasks to prepare
for building the temporary system. We will create a directory in
<filename class="directory">$LFS</filename> for the installation of the
temporary tools, add an unprivileged user to reduce risk,
and create an appropriate build environment for that user. We will also
explain the unit of time we use to measure how long LFS packages take to
build, or <quote>SBUs</quote>, and give some information about package
test suites.</para>
</sect1>

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-settingenviron">
<?dbhtml filename="settingenvironment.html"?>
<title>Setting Up the Environment</title>
<para>Set up a good working environment by creating two new startup files
for the <command>bash</command> shell. While logged in as user
<systemitem class="username">lfs</systemitem>, issue the following command
to create a new <filename>.bash_profile</filename>:</para>
<screen><userinput>cat &gt; ~/.bash_profile &lt;&lt; "EOF"
<literal>exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash</literal>
EOF</userinput></screen>
<para>When logged on as user <systemitem class="username">lfs</systemitem>,
the initial shell is usually a <emphasis>login</emphasis> shell which reads
the <filename>/etc/profile</filename> of the host (probably containing some
settings and environment variables) and then <filename>.bash_profile</filename>.
The <command>exec env -i.../bin/bash</command> command in the
<filename>.bash_profile</filename> file replaces the running shell with a new
one with a completely empty environment, except for the <envar>HOME</envar>,
<envar>TERM</envar>, and <envar>PS1</envar> 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.</para>
<para>The new instance of the shell is a <emphasis>non-login</emphasis>
shell, which does not read the <filename>/etc/profile</filename> or
<filename>.bash_profile</filename> files, but rather reads the
<filename>.bashrc</filename> file instead. Create the
<filename>.bashrc</filename> file now:</para>
<screen><userinput>cat &gt; ~/.bashrc &lt;&lt; "EOF"
<literal>set +h
umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
LFS_TGT=$(uname -m)-lfs-linux-gnu
PATH=/tools/bin:/bin:/usr/bin
export LFS LC_ALL LFS_TGT PATH</literal>
EOF</userinput></screen>
<para>The <command>set +h</command> command turns off
<command>bash</command>'s hash function. Hashing is ordinarily a useful
feature&mdash;<command>bash</command> uses a hash table to remember the
full path of executable files to avoid searching the <envar>PATH</envar>
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 <envar>PATH</envar> when a program is to
be run. As such, the shell will find the newly compiled tools in
<filename class="directory">$LFS/tools</filename> as soon as they are
available without remembering a previous version of the same program in a
different location.</para>
<para>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
<function>open(2)</function> system call, new files will end up with permission
mode 644 and directories with mode 755).</para>
<para>The <envar>LFS</envar> variable should be set to the chosen mount
point.</para>
<para>The <envar>LC_ALL</envar> variable controls the localization of certain
programs, making their messages follow the conventions of a specified country.
Setting <envar>LC_ALL</envar> to <quote>POSIX</quote> or <quote>C</quote>
(the two are equivalent) ensures that everything will work as expected in
the chroot environment.</para>
<para>The <envar>LFS_TGT</envar> variable sets a non-default, but compatible machine
description for use when building our cross compiler and linker and when cross
compiling our temporary toolchain. More information is contained in
<xref linkend="ch-tools-toolchaintechnotes" role=""/>.</para>
<para>By putting <filename class="directory">/tools/bin</filename> ahead of the
standard <envar>PATH</envar>, all the programs installed in <xref
linkend="chapter-temporary-tools"/> are picked up by the shell immediately after
their installation. This, combined with turning off hashing, limits the risk
that old programs are used from the host when the same programs are available in
the chapter 5 environment.</para>
<para>Finally, to have the environment fully prepared for building the
temporary tools, source the just-created user profile:</para>
<screen><userinput>source ~/.bash_profile</userinput></screen>
</sect1>

101
chapter05/bash.xml Normal file
View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-bash" role="wrap">
<?dbhtml filename="bash.html"?>
<sect1info condition="script">
<productname>bash</productname>
<productnumber>&bash-version;</productnumber>
<address>&bash-url;</address>
</sect1info>
<title>Bash-&bash-version;</title>
<indexterm zone="ch-tools-bash">
<primary sortas="a-Bash">Bash</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/bash.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&bash-ch5-sbu;</seg>
<seg>&bash-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Bash</title>
<!--
<para>First, apply the following patch to fix various bugs that have been
addressed upstream:</para>
<screen><userinput remap="pre">patch -Np1 -i ../&bash-fixes-patch;</userinput></screen>
-->
<para>Prepare Bash for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools --without-bash-malloc</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--without-bash-malloc</parameter></term>
<listitem>
<para>This option turns off the use of Bash's memory allocation
(<function>malloc</function>) function which is known to cause
segmentation faults. By turning this option off, Bash will use
the <function>malloc</function> functions from Glibc which are
more stable.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Bash test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make tests</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>Make a link for the programs that use <command>sh</command> for
a shell:</para>
<screen><userinput remap="install">ln -sv bash /tools/bin/sh</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-bash" role="."/></para>
</sect2>
</sect1>

View File

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-binutils-pass1" role="wrap">
<?dbhtml filename="binutils-pass1.html"?>
<sect1info condition="script">
<productname>binutils</productname>
<productnumber>&binutils-version;</productnumber>
<address>&binutils-url;</address>
</sect1info>
<title>Binutils-&binutils-version; - Pass 1</title>
<indexterm zone="ch-tools-binutils-pass1">
<primary sortas="a-Binutils">Binutils</primary>
<secondary>tools, pass 1</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/binutils.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&binutils-ch5p1-sbu;</seg>
<seg>&binutils-ch5p1-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Cross Binutils</title>
<note><para>Go back and re-read the notes in the previous section.
Understanding the notes labeled important will save you a lot
of problems later.</para></note>
<para>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.</para>
<para>The Binutils documentation recommends building Binutils
in a dedicated build directory:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<note>
<para>In order for the SBU values listed in the rest of the book
to be of any use, measure the time it takes to build this package from
the configuration, up to and including the first install. To achieve
this easily, wrap the commands in a <command>time</command>
command like this: <userinput>time { ./configure ... &amp;&amp; ...
&amp;&amp; make install; }</userinput>.</para>
</note>
<note><para>The approximate build SBU values and required disk space
in Chapter&nbsp;5 does not include test suite data.</para></note>
<para>Now prepare Binutils for compilation:</para>
<screen><userinput remap="configure">../configure --prefix=/tools \
--with-sysroot=$LFS \
--with-lib-path=/tools/lib \
--target=$LFS_TGT \
--disable-nls \
--disable-werror</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--prefix=/tools</parameter></term>
<listitem>
<para>This tells the configure script to prepare to install the
Binutils programs in the <filename class="directory">/tools</filename>
directory.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-sysroot=$LFS</parameter></term>
<listitem>
<para>For cross compilation, this tells the build system to look in
$LFS for the target system libraries as needed.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-lib-path=/tools/lib</parameter></term>
<listitem>
<para>This specifies which library path the linker should be
configured to use.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>--target=$LFS_TGT</envar></term>
<listitem>
<para>Because the machine description in the <envar>LFS_TGT</envar>
variable is slightly different than the value returned by the
<command>config.guess</command> script, this switch will tell the
<command>configure</command> script to adjust Binutil's build system
for building a cross linker. </para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-nls</parameter></term>
<listitem>
<para>This disables internationalization as i18n is not needed for the
temporary tools.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-werror</parameter></term>
<listitem>
<para>This prevents the build from stopping in the event that there
are warnings from the host's compiler.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Continue with compiling the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>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.</para>
<para>If building on x86_64, create a symlink to ensure the sanity of
the toolchain:</para>
<screen><userinput remap="install">case $(uname -m) in
x86_64) mkdir -v /tools/lib &amp;&amp; ln -sv lib /tools/lib64 ;;
esac</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-binutils" role="."/></para>
</sect2>
</sect1>

View File

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-binutils-pass2" role="wrap">
<?dbhtml filename="binutils-pass2.html"?>
<sect1info condition="script">
<productname>binutils</productname>
<productnumber>&binutils-version;</productnumber>
<address>&binutils-url;</address>
</sect1info>
<title>Binutils-&binutils-version; - Pass 2</title>
<indexterm zone="ch-tools-binutils-pass2">
<primary sortas="a-Binutils">Binutils</primary>
<secondary>tools, pass 2</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/binutils.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&binutils-ch5p2-sbu;</seg>
<seg>&binutils-ch5p2-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Binutils</title>
<para>Create a separate build directory again:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Prepare Binutils for compilation:</para>
<screen><userinput remap="configure">CC=$LFS_TGT-gcc \
AR=$LFS_TGT-ar \
RANLIB=$LFS_TGT-ranlib \
../configure \
--prefix=/tools \
--disable-nls \
--disable-werror \
--with-lib-path=/tools/lib \
--with-sysroot</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</parameter></term>
<listitem>
<para>Because this is really a native build of Binutils, setting these
variables ensures that the build system uses the cross-compiler and
associated tools instead of the ones on the host system.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-lib-path=/tools/lib</parameter></term>
<listitem>
<para>This tells the configure script to specify the library
search path during the compilation of Binutils, resulting in
<filename class="directory">/tools/lib</filename> being passed
to the linker. This prevents the linker from searching through
library directories on the host.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-sysroot</parameter></term>
<listitem>
<para>The sysroot feature enables the linker to find shared objects
which are required by other shared objects explicitly included on the
linker's command line. Without this, some packages may not build
successfully on some hosts.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>Now prepare the linker for the <quote>Re-adjusting</quote> phase in
the next chapter:</para>
<screen><userinput remap="adjust">make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
cp -v ld/ld-new /tools/bin</userinput></screen>
<variablelist>
<title>The meaning of the make parameters:</title>
<varlistentry>
<term><parameter>-C ld clean</parameter></term>
<listitem>
<para>This tells the make program to remove all compiled
files in the <filename class="directory">ld</filename>
subdirectory.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>-C ld LIB_PATH=/usr/lib:/lib</parameter></term>
<listitem>
<para>This option rebuilds everything in the <filename
class="directory">ld</filename> subdirectory. Specifying the
<envar>LIB_PATH</envar> Makefile variable on the command line
allows us to override the default value of the temporary tools
and point it to the proper final path. The value of this variable
specifies the linker's default library search path. This
preparation is used in the next chapter.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-binutils" role="."/></para>
</sect2>
</sect1>

72
chapter05/bison.xml Normal file
View File

@ -0,0 +1,72 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-bison" role="wrap">
<?dbhtml filename="bison.html"?>
<sect1info condition="script">
<productname>bison</productname>
<productnumber>&bison-version;</productnumber>
<address>&bison-url;</address>
</sect1info>
<title>Bison-&bison-version;</title>
<indexterm zone="ch-tools-bison">
<primary sortas="a-Bison">Bison</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/bison.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&bison-ch5-sbu;</seg>
<seg>&bison-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Bison</title>
<para>Prepare Bison for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-bison" role="."/></para>
</sect2>
</sect1>

65
chapter05/bzip2.xml Normal file
View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-bzip2" role="wrap">
<?dbhtml filename="bzip2.html"?>
<sect1info condition="script">
<productname>bzip2</productname>
<productnumber>&bzip2-version;</productnumber>
<address>&bzip2-url;</address>
</sect1info>
<title>Bzip2-&bzip2-version;</title>
<indexterm zone="ch-tools-bzip2">
<primary sortas="a-Bzip2">Bzip2</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/bzip2.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&bzip2-ch5-sbu;</seg>
<seg>&bzip2-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Bzip2</title>
<para>The Bzip2 package does not contain a <command>configure</command>
script. Compile and test it with:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make PREFIX=/tools install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-bzip2" role="."/></para>
</sect2>
</sect1>

View File

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-changingowner">
<?dbhtml filename="changingowner.html"?>
<title>Changing Ownership</title>
<note>
<para>The commands in the remainder of this book must be performed while
logged in as user <systemitem class="username">root</systemitem> and no
longer as user <systemitem class="username">lfs</systemitem>. Also, double
check that <envar>$LFS</envar> is set in <systemitem
class="username">root</systemitem>'s environment.</para>
</note>
<para>Currently, the <filename class="directory">$LFS/tools</filename> directory
is owned by the user <systemitem class="username">lfs</systemitem>, a user
that exists only on the host system. If the <filename
class="directory">$LFS/tools</filename> 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
<filename class="directory">$LFS/tools</filename> directory and all the files
therein, thus exposing these files to possible malicious manipulation.</para>
<para>To avoid this issue, you could add the <systemitem
class="username">lfs</systemitem> user to the new LFS system later when
creating the <filename>/etc/passwd</filename> file, taking care to assign it
the same user and group IDs as on the host system. Better yet, change the
ownership of the <filename class="directory">$LFS/tools</filename> directory to
user <systemitem class="username">root</systemitem> by running the following
command:</para>
<screen><userinput>chown -R root:root $LFS/tools</userinput></screen>
<para>Although the <filename class="directory">$LFS/tools</filename> directory
can be deleted once the LFS system has been finished, it can be retained to build
additional LFS systems <emphasis>of the same book version</emphasis>. How best
to backup <filename class="directory">$LFS/tools</filename> is a matter of
personal preference.</para>
<caution>
<para>If you intend to keep the temporary tools for use in building future LFS
systems, <emphasis>now</emphasis> is the time to back them up. Subsequent
commands in chapter 6 will alter the tools currently in place, rendering them
useless for future builds.</para>
</caution>
</sect1>

52
chapter05/chapter05.xml Normal file
View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<chapter id="chapter-temporary-tools" xreflabel="Chapter&nbsp;5">
<?dbhtml dir="chapter05"?>
<?dbhtml filename="chapter05.html"?>
<title>Constructing a Temporary System</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="toolchaintechnotes.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="generalinstructions.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="binutils-pass1.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc-pass1.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="linux-headers.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="glibc.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="binutils-pass2.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc-pass2.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tcl.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="expect.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dejagnu.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="m4.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ncurses.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bash.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bison.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bzip2.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="coreutils.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="diffutils.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="file.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="findutils.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gawk.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gettext.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="grep.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gzip.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="make.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="patch.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="perl.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="python.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sed.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tar.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="texinfo.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="util-linux.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="xz.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="stripping.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="changingowner.xml"/>
</chapter>

99
chapter05/coreutils.xml Normal file
View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-coreutils" role="wrap">
<?dbhtml filename="coreutils.html"?>
<sect1info condition="script">
<productname>coreutils</productname>
<productnumber>&coreutils-version;</productnumber>
<address>&coreutils-url;</address>
</sect1info>
<title>Coreutils-&coreutils-version;</title>
<indexterm zone="ch-tools-coreutils">
<primary sortas="a-Coreutils">Coreutils</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/coreutils.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&coreutils-ch5-sbu;</seg>
<seg>&coreutils-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Coreutils</title>
<para>Prepare Coreutils for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools --enable-install-program=hostname</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><envar>--enable-install-program=hostname</envar></term>
<listitem>
<para>This enables the <command>hostname</command> binary to be built
and installed &ndash; it is disabled by default but is required by the
Perl test suite.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Coreutils test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make RUN_EXPENSIVE_TESTS=yes check</userinput></screen>
<para>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>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<!--
<para>The above command refuses to install <filename>su</filename>
because the program cannot be installed setuid root as a non-privileged
user. By manually installing it, we can use it for running tests in the
final system as a non-privileged user. Install it with:</para>
<screen><userinput remap="install">cp -v src/su /tools/bin</userinput></screen>
-->
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-coreutils" role="."/></para>
</sect2>
</sect1>

90
chapter05/dejagnu.xml Normal file
View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-dejagnu" role="wrap">
<?dbhtml filename="dejagnu.html"?>
<sect1info condition="script">
<productname>dejagnu</productname>
<productnumber>&dejagnu-version;</productnumber>
<address>&dejagnu-url;</address>
</sect1info>
<title>DejaGNU-&dejagnu-version;</title>
<indexterm zone="ch-tools-dejagnu">
<primary sortas="a-DejaGNU">DejaGNU</primary>
</indexterm>
<sect2 role="package">
<title/>
<para>The DejaGNU package contains a framework for testing other
programs.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&dejagnu-ch5-sbu;</seg>
<seg>&dejagnu-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of DejaGNU</title>
<para>Prepare DejaGNU for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<para>Build and install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
</sect2>
<sect2 id="contents-dejagnu" role="content">
<title>Contents of DejaGNU</title>
<segmentedlist>
<segtitle>Installed program</segtitle>
<seglistitem>
<seg>runtest</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="runtest">
<term><command>runtest</command></term>
<listitem>
<para>A wrapper script that locates the proper
<command>expect</command> shell and then runs DejaGNU</para>
<indexterm zone="ch-tools-dejagnu runtest">
<primary sortas="b-runtest">runtest</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>

74
chapter05/diffutils.xml Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-diffutils" role="wrap">
<?dbhtml filename="diffutils.html"?>
<sect1info condition="script">
<productname>diffutils</productname>
<productnumber>&diffutils-version;</productnumber>
<address>&diffutils-url;</address>
</sect1info>
<title>Diffutils-&diffutils-version;</title>
<indexterm zone="ch-tools-diffutils">
<primary sortas="a-Diffutils">Diffutils</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/diffutils.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&diffutils-ch5-sbu;</seg>
<seg>&diffutils-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Diffutils</title>
<para>Prepare Diffutils for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Diffutils test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-diffutils" role="."/></para>
</sect2>
</sect1>

98
chapter05/e2fsprogs.xml Normal file
View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-e2fsprogs" role="wrap">
<?dbhtml filename="e2fsprogs.html"?>
<sect1info condition="script">
<productname>e2fsprogs</productname>
<productnumber>&e2fsprogs-version;</productnumber>
<address>&e2fsprogs-url;</address>
</sect1info>
<title>E2fsprogs-&e2fsprogs-version;</title>
<indexterm zone="ch-tools-e2fsprogs">
<primary sortas="a-E2fsprogs">E2fsprogs</primary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/e2fsprogs.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&e2fsprogs-ch5-sbu;</seg>
<seg>&e2fsprogs-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of E2fsprogs</title>
<para>The E2fsprogs documentation recommends that the package be built in
a subdirectory of the source tree: </para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Prepare E2fsprogs for compilation:</para>
<screen><userinput remap="configure">../configure --prefix=/tools --disable-libblkid --disable-libuuid</userinput></screen>
<variablelist>
<title>The meaning of the new configure option:</title>
<varlistentry>
<term><parameter>--disable-libblkid</parameter></term>
<listitem>
<para>This prevents E2fsprogs from building its own copy of the
libblkid library, which Util-Linux-NG provides.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-libuuid</parameter></term>
<listitem>
<para>This prevents E2fsprogs from building its own copy of the
libuuid library, which Util-Linux-NG provides.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the static libraries and headers required by Util-linux:</para>
<screen><userinput remap="install">make install-libs</userinput></screen>
<para>Make the installed static libraries writable so debugging symbols can
be removed later:</para>
<screen><userinput remap="install">chmod -v u+w \
/tools/lib/{libcom_err,libe2p,libext2fs,libss}.a</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-e2fsprogs" role="."/></para>
</sect2>
</sect1>

160
chapter05/expect.xml Normal file
View File

@ -0,0 +1,160 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-expect" role="wrap">
<?dbhtml filename="expect.html"?>
<sect1info condition="script">
<productname>expect</productname>
<productnumber>&expect-version;</productnumber>
<address>&expect-url;</address>
</sect1info>
<title>Expect-&expect-version;</title>
<indexterm zone="ch-tools-expect">
<primary sortas="a-Expect">Expect</primary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Expect package contains a program for carrying out scripted
dialogues with other interactive programs.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&expect-ch5-sbu;</seg>
<seg>&expect-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Expect</title>
<para>First, force Expect's configure script to use <filename>/bin/stty</filename>
instead of a <filename>/usr/local/bin/stty</filename> it may find on the host system.
This will ensure that our test suite tools remain sane for the final builds of our
toolchain:</para>
<screen><userinput remap="pre">cp -v configure{,.orig}
sed 's:/usr/local/bin:/bin:' configure.orig &gt; configure</userinput></screen>
<para>Now prepare Expect for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools \
--with-tcl=/tools/lib \
--with-tclinclude=/tools/include</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--with-tcl=/tools/lib</parameter></term>
<listitem>
<para>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.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-tclinclude=/tools/include</parameter></term>
<listitem>
<para>This explicitly tells Expect where to find Tcl's internal
headers. Using this option avoids conditions where
<command>configure</command> fails because it cannot automatically
discover the location of Tcl's headers.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Build the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Expect test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make test</userinput></screen>
<para>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.</para>
<para>Install the package:</para>
<screen><userinput remap="install">make SCRIPTS="" install</userinput></screen>
<variablelist>
<title>The meaning of the make parameter:</title>
<varlistentry>
<term><parameter>SCRIPTS=""</parameter></term>
<listitem>
<para>This prevents installation of the supplementary Expect
scripts, which are not needed.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 id="contents-expect" role="content">
<title>Contents of Expect</title>
<segmentedlist>
<segtitle>Installed program</segtitle>
<segtitle>Installed library</segtitle>
<seglistitem>
<seg>expect</seg>
<seg>libexpect-&expect-lib-version;.so</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="expect">
<term><command>expect</command></term>
<listitem>
<para>Communicates with other interactive programs according
to a script</para>
<indexterm zone="ch-tools-expect expect">
<primary sortas="b-expect">expect</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libexpect">
<term><filename class="libraryfile">libexpect-&expect-lib-version;.so</filename></term>
<listitem>
<para>Contains functions that allow Expect to be used as a Tcl
extension or to be used directly from C or C++ (without Tcl)</para>
<indexterm zone="ch-tools-expect libexpect">
<primary sortas="c-libexpect-&expect-lib-version;">libexpect-&expect-lib-version;</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>

74
chapter05/file.xml Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-file" role="wrap">
<?dbhtml filename="file.html"?>
<sect1info condition="script">
<productname>file</productname>
<productnumber>&file-version;</productnumber>
<address>&file-url;</address>
</sect1info>
<title>File-&file-version;</title>
<indexterm zone="ch-tools-file">
<primary sortas="a-File">File</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/file.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&file-ch5-sbu;</seg>
<seg>&file-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of File</title>
<para>Prepare File for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the File test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-file" role="."/></para>
</sect2>
</sect1>

80
chapter05/findutils.xml Normal file
View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-findutils" role="wrap">
<?dbhtml filename="findutils.html"?>
<sect1info condition="script">
<productname>findutils</productname>
<productnumber>&findutils-version;</productnumber>
<address>&findutils-url;</address>
</sect1info>
<title>Findutils-&findutils-version;</title>
<indexterm zone="ch-tools-findutils">
<primary sortas="a-Findutils">Findutils</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/findutils.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&findutils-ch5-sbu;</seg>
<seg>&findutils-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Findutils</title>
<para>First, make some fixes required by glibc-2.28:</para>
<screen><userinput remap="pre">sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' gl/lib/*.c
sed -i '/unistd/a #include &lt;sys/sysmacros.h&gt;' gl/lib/mountlist.c
echo "#define _IO_IN_BACKUP 0x100" >> gl/lib/stdio-impl.h</userinput></screen>
<para>Prepare Findutils for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Findutils test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-findutils" role="."/></para>
</sect2>
</sect1>

84
chapter05/flex.xml Normal file
View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-flex" role="wrap">
<?dbhtml filename="flex.html"?>
<sect1info condition="script">
<productname>flex</productname>
<productnumber>&flex-version;</productnumber>
<address>&flex-url;</address>
</sect1info>
<title>Flex-&flex-version;</title>
<indexterm zone="ch-tools-flex">
<primary sortas="a-Flex">Flex</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/flex.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&flex-ch5-sbu;</seg>
<seg>&flex-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Flex</title>
<!--
<para>Flex contains several known bugs. These can be fixed with the
following patch:</para>
<screen><userinput remap="pre">patch -Np1 -i ../&flex-fixes-patch;</userinput></screen>
<para>The GNU autotools will detect that the Flex source code has been
modified by the previous patch and tries to update the man page
accordingly. This does not work on many systems, and the default page is
fine, so make sure it does not get regenerated:</para>
<screen><userinput remap="pre">touch doc/flex.1</userinput></screen>
-->
<para>Prepare Flex for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-flex" role="."/></para>
</sect2>
</sect1>

74
chapter05/gawk.xml Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-gawk" role="wrap">
<?dbhtml filename="gawk.html"?>
<sect1info condition="script">
<productname>gawk</productname>
<productnumber>&gawk-version;</productnumber>
<address>&gawk-url;</address>
</sect1info>
<title>Gawk-&gawk-version;</title>
<indexterm zone="ch-tools-gawk">
<primary sortas="a-Gawk">Gawk</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/gawk.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&gawk-ch5-sbu;</seg>
<seg>&gawk-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Gawk</title>
<para>Prepare Gawk for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Gawk test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gawk" role="."/></para>
</sect2>
</sect1>

274
chapter05/gcc-pass1.xml Normal file
View File

@ -0,0 +1,274 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-gcc-pass1" role="wrap" xreflabel="gcc-pass1">
<?dbhtml filename="gcc-pass1.html"?>
<sect1info condition="script">
<productname>gcc</productname>
<productnumber>&gcc-version;</productnumber>
<address>&gcc-url;</address>
</sect1info>
<title>GCC-&gcc-version; - Pass 1</title>
<indexterm zone="ch-tools-gcc-pass1">
<primary sortas="a-GCC">GCC</primary>
<secondary>tools, pass 1</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/gcc.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&gcc-ch5p1-sbu;</seg>
<seg>&gcc-ch5p1-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Cross GCC</title>
<para>GCC now requires the GMP, MPFR and MPC packages. As these packages may
not be included in your host distribution, they will be built with
GCC. Unpack each package into the GCC source directory and rename the
resulting directories so the GCC build procedures will automatically
use them:</para>
<note><para>There are frequent misunderstandings about this chapter. The
procedures are the same as every other chapter as explained earlier (<xref
linkend='buildinstr'/>). First extract the gcc tarball from the sources
directory and then change to the directory created. Only then should you
proceed with the instructions below.</para></note>
<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
mv -v mpfr-&mpfr-version; mpfr
tar -xf ../gmp-&gmp-version;.tar.xz
mv -v gmp-&gmp-version; gmp
tar -xf ../mpc-&mpc-version;.tar.gz
mv -v mpc-&mpc-version; mpc</userinput></screen>
<para>The following command will change the location of GCC's default
dynamic linker to use the one installed in <filename
class="directory">/tools</filename>. It also removes <filename
class="directory">/usr/include</filename> from GCC's include search path.
Issue:</para>
<screen><userinput remap="pre">for file in gcc/config/{linux,i386/linux{,64}}.h
do
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
-e 's@/usr@/tools@g' $file.orig &gt; $file
echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' &gt;&gt; $file
touch $file.orig
done</userinput></screen>
<para>In case the above seems hard to follow, let's break it down a bit.
First we copy the files <filename>gcc/config/linux.h</filename>,
<filename>gcc/config/i386/linux.h</filename>, and
<filename>gcc/config/i368/linux64.h</filename> to a file of
the same name but with an added suffix of <quote>.orig</quote>. Then the
first sed expression prepends <quote>/tools</quote> to every instance of
<quote>/lib/ld</quote>, <quote>/lib64/ld</quote> or
<quote>/lib32/ld</quote>, while the second one replaces hard-coded
instances of <quote>/usr</quote>. Next, we add our define statements which
alter the default startfile prefix to the end of the file. Note that the
trailing <quote>/</quote> in <quote>/tools/lib/</quote> is required.
Finally, we use <command>touch</command> to update the timestamp on the
copied files. When used in conjunction with <command>cp -u</command>, this
prevents unexpected changes to the original files in case the commands are
inadvertently run twice.</para>
<para>Finally, on x86_64 hosts, set the default directory name for
64-bit libraries to <quote>lib</quote>:</para>
<screen><userinput remap="pre">case $(uname -m) in
x86_64)
sed -e '/m64=/s/lib64/lib/' \
-i.orig gcc/config/i386/t-linux64
;;
esac</userinput></screen>
<!--
<para>GCC doesn't detect stack protection correctly, which causes problems
for the build of Glibc-&glibc-version;, so fix that by issuing the following
command:</para>
<screen><userinput remap="pre">sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure</userinput></screen>
-->
<!--
<para>Also fix a problem identified upstream:</para>
<screen><userinput remap="pre">sed -i 's/if \((code.*))\)/if (\1 \&amp;\&amp; \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>
-->
<para>The GCC documentation recommends building GCC
in a dedicated build directory:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Prepare GCC for compilation:</para>
<screen><userinput remap="configure">../configure \
--target=$LFS_TGT \
--prefix=/tools \
--with-glibc-version=2.11 \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
--with-local-prefix=/tools \
--with-native-system-header-dir=/tools/include \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-decimal-float \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libmpx \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--with-newlib</parameter></term>
<listitem>
<para>Since a working C library is not yet available, this ensures
that the inhibit_libc constant is defined when building libgcc. This prevents
the compiling of any code that requires libc support.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--without-headers</parameter></term>
<listitem>
<para>When creating a complete cross-compiler, GCC requires
standard headers compatible with the target system. For our
purposes these headers will not be needed. This switch prevents
GCC from looking for them.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-local-prefix=/tools</parameter></term>
<listitem>
<para>The local prefix is the location in the system that GCC will search
for locally installed include files. The default is <filename>/usr/local</filename>.
Setting this to <filename>/tools</filename> helps keep the host location of
<filename>/usr/local</filename> out of this GCC's search path.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-native-system-header-dir=/tools/include</parameter></term>
<listitem>
<para>By default GCC searches <filename>/usr/include</filename> for
system headers. In conjunction with the sysroot switch, this would
normally translate to <filename>$LFS/usr/include</filename>. However
the headers that will be installed in the next two sections will go
to <filename>$LFS/tools/include</filename>. This switch ensures that
gcc will find them correctly. In the second pass of GCC, this same
switch will ensure that no headers from the host system are
found.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-shared</parameter></term>
<listitem>
<para>This switch forces GCC to link its internal libraries
statically. We do this to avoid possible issues with the host
system.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-decimal-float, --disable-threads,
--disable-libatomic, --disable-libgomp, --disable-libmpx,
--disable-libquadmath, --disable-libssp, --disable-libvtv,
--disable-libstdcxx</parameter></term>
<listitem>
<para>These switches disable support for the decimal floating point
extension, threading, libatomic, libgomp, libmpx, libquadmath, libssp,
libvtv, and the C++ standard library respectively. These features
will fail to compile when building a cross-compiler and are not
necessary for the task of cross-compiling the temporary libc.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-multilib</parameter></term>
<listitem>
<para>On x86_64, LFS does not yet support a multilib configuration.
This switch is harmless for x86.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--enable-languages=c,c++</parameter></term>
<listitem>
<para>This option ensures that only the C and C++ compilers are built.
These are the only languages needed now.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile GCC by running:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>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.</para>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<!--
<para>Using <parameter>- -disable-shared</parameter> means that the
<filename>libgcc_eh.a</filename> file isn't created and installed. The
Glibc package depends on this library as it uses
<parameter>-lgcc_eh</parameter> within its build system. This dependency
can be satisfied by creating a symlink to <filename>libgcc.a</filename>,
since that file will end up containing the objects normally contained in
<filename>libgcc_eh.a</filename>:</para>
<screen><userinput remap="install">ln -sv libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | sed 's/libgcc/&amp;_eh/'`</userinput></screen>
-->
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gcc" role="."/></para>
</sect2>
</sect1>

236
chapter05/gcc-pass2.xml Normal file
View File

@ -0,0 +1,236 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-gcc-pass2" role="wrap">
<?dbhtml filename="gcc-pass2.html"?>
<sect1info condition="script">
<productname>gcc</productname>
<productnumber>&gcc-version;</productnumber>
<address>&gcc-url;</address>
</sect1info>
<title>GCC-&gcc-version; - Pass 2</title>
<indexterm zone="ch-tools-gcc-pass2">
<primary sortas="a-GCC">GCC</primary>
<secondary>tools, pass 2</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/gcc.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&gcc-ch5p2-sbu;</seg>
<seg>&gcc-ch5p2-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of GCC</title>
<para>Our first build of GCC has installed a couple of internal system
headers. Normally one of them, <filename>limits.h</filename>, will in turn
include the corresponding system <filename>limits.h</filename> header, in
this case, <filename>/tools/include/limits.h</filename>. However, at the
time of the first build of gcc <filename>/tools/include/limits.h</filename>
did not exist, so the internal header that GCC installed is a partial,
self-contained file and does not include the extended features of the
system header. This was adequate for building the temporary libc, but this
build of GCC now requires the full internal header. Create a full version
of the internal header using a command that is identical to what the GCC
build system does in normal circumstances:</para>
<screen><userinput remap="pre">cat gcc/limitx.h gcc/glimits.h gcc/limity.h &gt; \
`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h</userinput></screen>
<!--
<para>For x86 machines, the limited number of registers is a bottleneck
for the system. Free one up by not using a frame pointer that is not
needed:</para>
<screen><userinput remap="pre">case `uname -m` in
i?86) sed -i 's/^T_CFLAGS =$/&amp; -fomit-frame-pointer/' gcc/Makefile.in ;;
esac</userinput></screen>
-->
<para>Once again, change the location of GCC's default dynamic linker to
use the one installed in <filename
class="directory">/tools</filename>.</para>
<screen><userinput remap="pre">for file in gcc/config/{linux,i386/linux{,64}}.h
do
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
-e 's@/usr@/tools@g' $file.orig &gt; $file
echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' &gt;&gt; $file
touch $file.orig
done</userinput></screen>
<para>If building on x86_64, change the default directory name for 64-bit
libraries to <quote>lib</quote>:</para>
<screen><userinput remap="pre">case $(uname -m) in
x86_64)
sed -e '/m64=/s/lib64/lib/' \
-i.orig gcc/config/i386/t-linux64
;;
esac</userinput></screen>
<para>As in the first build of GCC it requires the GMP, MPFR and MPC
packages. Unpack the tarballs and move them into the required directory
names:</para>
<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
mv -v mpfr-&mpfr-version; mpfr
tar -xf ../gmp-&gmp-version;.tar.xz
mv -v gmp-&gmp-version; gmp
tar -xf ../mpc-&mpc-version;.tar.gz
mv -v mpc-&mpc-version; mpc</userinput></screen>
<!--
<para>As in the first build of GCC, fix a problem identified upstream:</para>
<screen><userinput remap="pre">sed -i 's/if \((code.*))\)/if (\1 \&amp;\&amp; \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>
-->
<para>Create a separate build directory again:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Before starting to build GCC, remember to unset any environment
variables that override the default optimization flags.</para>
<para>Now prepare GCC for compilation:</para>
<screen><userinput remap="configure">CC=$LFS_TGT-gcc \
CXX=$LFS_TGT-g++ \
AR=$LFS_TGT-ar \
RANLIB=$LFS_TGT-ranlib \
../configure \
--prefix=/tools \
--with-local-prefix=/tools \
--with-native-system-header-dir=/tools/include \
--enable-languages=c,c++ \
--disable-libstdcxx-pch \
--disable-multilib \
--disable-bootstrap \
--disable-libgomp</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>--enable-languages=c,c++</parameter></term>
<listitem>
<para>This option ensures that both the C and C++ compilers are
built.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-libstdcxx-pch</parameter></term>
<listitem>
<para>Do not build the pre-compiled header (PCH) for
<filename class="libraryfile">libstdc++</filename>. It takes up a
lot of space, and we have no use for it.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-bootstrap</parameter></term>
<listitem>
<para>For native builds of GCC, the default is to do a "bootstrap"
build. This does not just compile GCC, but compiles it several times.
It uses the programs compiled in a first round to compile itself a
second time, and then again a third time. The second and third
iterations are compared to make sure it can reproduce itself
flawlessly. This also implies that it was compiled correctly.
However, the LFS build method should provide a solid compiler
without the need to bootstrap each time.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>As a finishing touch, create a symlink. Many programs and scripts
run <command>cc</command> instead of <command>gcc</command>, 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
<command>cc</command> leaves the system administrator free to decide
which C compiler to install:</para>
<screen><userinput remap="install">ln -sv gcc /tools/bin/cc</userinput></screen>
<caution>
<para>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:</para>
<screen><userinput>echo 'int main(){}' &gt; dummy.c
cc dummy.c
readelf -l a.out | grep ': /tools'</userinput></screen>
<para>If everything is working correctly, there should be no errors,
and the output of the last command will be of the form:</para>
<screen><computeroutput>[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
<para>Note that the dynamic linker will be /tools/lib/ld-linux.so.2
for 32-bit machines.</para>
<para>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
<command>gcc</command> instead of <command>cc</command>. If this works,
then the <filename class="symlink">/tools/bin/cc</filename> symlink is
missing. Install the symlink as per above.
Next, ensure that the <envar>PATH</envar> is correct. This
can be checked by running <command>echo $PATH</command> and verifying that
<filename class="directory">/tools/bin</filename> is at the head of the
list. If the <envar>PATH</envar> is wrong it could mean that you are not
logged in as user <systemitem class="username">lfs</systemitem> or that
something went wrong back in <xref linkend="ch-tools-settingenviron"
role="."/></para>
<para>Once all is well, clean up the test files:</para>
<screen><userinput>rm -v dummy.c a.out</userinput></screen>
</caution>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gcc" role="."/></para>
</sect2>
</sect1>

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-generalinstructions">
<?dbhtml filename="generalinstructions.html"?>
<title>General Compilation Instructions</title>
<para>When building packages there are several assumptions made within
the instructions:</para>
<itemizedlist>
<listitem>
<para>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 <emphasis>offset</emphasis> or
<emphasis>fuzz</emphasis> may also be encountered when applying a patch. Do
not worry about these warnings, as the patch was still successfully
applied.</para>
</listitem>
<listitem>
<para>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&mdash;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.</para>
</listitem>
<listitem>
<para>Check one last time that the <envar>LFS</envar> environment variable
is set up properly:</para>
<screen role="nodump"><userinput>echo $LFS</userinput></screen>
<para>Make sure the output shows the path to the LFS partition's mount
point, which is <filename class="directory">/mnt/lfs</filename>, using our
example.</para>
</listitem>
<listitem>
<para>Finally, two important items must be emphasized:</para>
<important>
<para>The build instructions assume that the <xref
linkend='pre-hostreqs'/>, including symbolic links, have been set
properly:</para>
<itemizedlist role='important'>
<listitem override='bullet'><para><command>bash</command> is the shell
in use.</para></listitem>
<listitem override='bullet'><para><command>sh</command> is a symbolic
link to <command>bash</command>.</para></listitem>
<listitem override='bullet'><para><command>/usr/bin/awk</command> is a
symbolic link to <command>gawk</command>.</para></listitem>
<listitem override='bullet'><para><command>/usr/bin/yacc</command> is a
symbolic link to <command>bison</command> or a small script that
executes bison.</para></listitem>
</itemizedlist>
</important>
<important>
<para>To re-emphasize the build process:</para>
<orderedlist numeration="arabic" spacing="compact">
<listitem>
<para>Place all the sources and patches in a directory that will be
accessible from the chroot environment such as
<filename class="directory">/mnt/lfs/sources/</filename>. Do
<emphasis>not</emphasis> put sources in
<filename class="directory">/mnt/lfs/tools/</filename>.</para>
</listitem>
<listitem>
<para>Change to the sources directory.</para>
</listitem>
<listitem id='buildinstr' xreflabel='Package build instructions'>
<para>For each package:</para>
<orderedlist numeration="loweralpha" spacing="compact">
<listitem>
<para>Using the <command>tar</command> program, extract the package
to be built. In Chapter&nbsp;5, ensure you are the <emphasis>lfs</emphasis>
user when extracting the package.</para>
</listitem>
<listitem>
<para>Change to the directory created when the package was
extracted.</para>
</listitem>
<listitem>
<para>Follow the book's instructions for building the package.</para>
</listitem>
<listitem>
<para>Change back to the sources directory.</para>
</listitem>
<listitem>
<para>Delete the extracted source directory unless instructed otherwise.</para>
</listitem>
</orderedlist>
</listitem>
</orderedlist>
</important>
</listitem>
</itemizedlist>
</sect1>

104
chapter05/gettext.xml Normal file
View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-gettext" role="wrap">
<?dbhtml filename="gettext.html"?>
<sect1info condition="script">
<productname>gettext</productname>
<productnumber>&gettext-version;</productnumber>
<address>&gettext-url;</address>
</sect1info>
<title>Gettext-&gettext-version;</title>
<indexterm zone="ch-tools-gettext">
<primary sortas="a-Gettext">Gettext</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/gettext.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&gettext-ch5-sbu;</seg>
<seg>&gettext-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Gettext</title>
<para>For our temporary set of tools, we only need to build and install
three programs from Gettext.</para>
<para>Prepare Gettext for compilation:</para>
<screen><userinput remap="configure">cd gettext-tools
EMACS="no" ./configure --prefix=/tools --disable-shared</userinput></screen>
<variablelist>
<title>The meaning of the configure option:</title>
<varlistentry>
<term><parameter>EMACS="no"</parameter></term>
<listitem>
<para>This prevents the configure script from determining where to
install Emacs Lisp files as the test is known to hang on some hosts.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-shared</parameter></term>
<listitem>
<para>We do not need to install any of the shared Gettext libraries at
this time, therefore there is no need to build them.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make -C gnulib-lib
make -C intl pluralx.c
make -C src msgfmt
make -C src msgmerge
make -C src xgettext</userinput></screen>
<para>As only three programs have been compiled, it is not possible to run the
test suite without compiling additional support libraries from the Gettext
package. It is therefore not recommended to attempt to run the test suite at
this stage.</para>
<para>Install the <command>msgfmt</command>, <command>msgmerge</command> and
<command>xgettext</command> programs:</para>
<screen><userinput remap="install">cp -v src/{msgfmt,msgmerge,xgettext} /tools/bin</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gettext" role="."/></para>
</sect2>
</sect1>

195
chapter05/glibc.xml Normal file
View File

@ -0,0 +1,195 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-glibc" role="wrap">
<?dbhtml filename="glibc.html"?>
<sect1info condition="script">
<productname>glibc</productname>
<productnumber>&glibc-version;</productnumber>
<address>&glibc-url;</address>
</sect1info>
<title>Glibc-&glibc-version;</title>
<indexterm zone="ch-tools-glibc">
<primary sortas="a-Glibc">Glibc</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/glibc.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&glibc-ch5-sbu;</seg>
<seg>&glibc-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Glibc</title>
<para>The Glibc documentation recommends building Glibc
in a dedicated build directory:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Next, prepare Glibc for compilation:</para>
<screen><userinput remap="configure">../configure \
--prefix=/tools \
--host=$LFS_TGT \
--build=$(../scripts/config.guess) \
--enable-kernel=&min-kernel; \
--with-headers=/tools/include</userinput></screen>
<!--
libc_cv_forced_unwind=yes \
libc_cv_c_cleanup=yes</userinput></screen> -->
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--host=$LFS_TGT, --build=$(../scripts/config.guess)</parameter></term>
<listitem>
<para>The combined effect of these switches is that Glibc's build system
configures itself to cross-compile, using the cross-linker and
cross-compiler in <filename class="directory">/tools</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--enable-kernel=&min-kernel;</parameter></term>
<listitem>
<para>This tells Glibc to compile the library with support
for &min-kernel; and later Linux kernels. Workarounds for older
kernels are not enabled.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-headers=/tools/include</parameter></term>
<listitem>
<para>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.</para>
</listitem>
</varlistentry>
<!--
<varlistentry>
<term><parameter>libc_cv_forced_unwind=yes</parameter></term>
<listitem>
<para>The linker installed during
<xref linkend="ch-tools-binutils-pass1"/> was cross-compiled and as
such cannot be used until Glibc has been installed. This means that
the configure test for force-unwind support will fail, as it relies on
a working linker. The libc_cv_forced_unwind=yes variable is passed in
order to inform <command>configure</command> that force-unwind
support is available without it having to run the test.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>libc_cv_c_cleanup=yes</parameter></term>
<listitem>
<para>Similarly, we pass libc_cv_c_cleanup=yes through to the
<command>configure</command> script so that the test is skipped and C
cleanup handling support is configured.</para>
</listitem>
</varlistentry>
-->
<!-- <varlistentry>
<term><parameter>libc_cv_ctors_header=yes</parameter></term>
<listitem>
<para>Similarly, we pass libc_cv_ctors_header=yes through to the
<command>configure</command> script so that the test is skipped and
gcc constructor support is configured.</para>
</listitem>
</varlistentry>-->
</variablelist>
<para>During this stage the following warning might appear:</para>
<blockquote>
<screen><computeroutput>configure: WARNING:
*** These auxiliary programs are missing or
*** incompatible versions: msgfmt
*** some features will be disabled.
*** Check the INSTALL file for required versions.</computeroutput></screen>
</blockquote>
<para>The missing or incompatible <command>msgfmt</command> program is
generally harmless. This <command>msgfmt</command> program is part of the
Gettext package which the host distribution should provide.</para>
<note><para>There have been reports that this package may fail when
building as a "parallel make". If this occurs, rerun the make command
with a "-j1" option.</para></note>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<caution>
<para>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:</para>
<screen><userinput>echo 'int main(){}' &gt; dummy.c
$LFS_TGT-gcc dummy.c
readelf -l a.out | grep ': /tools'</userinput></screen>
<para>If everything is working correctly, there should be no errors,
and the output of the last command will be of the form:</para>
<screen><computeroutput>[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
<para>Note that for 32-bit machines, the interpreter name will be
<filename>/tools/lib/ld-linux.so.2</filename>.</para>
<para>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.</para>
<para>Once all is well, clean up the test files:</para>
<screen><userinput>rm -v dummy.c a.out</userinput></screen>
</caution>
<note><para>Building Binutils in the section after next will serve as an
additional check that the toolchain has been built properly. If Binutils
fails to build, it is an indication that something has gone wrong with the
previous Binutils, GCC, or Glibc installations.</para></note>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-glibc" role="."/></para>
</sect2>
</sect1>

84
chapter05/gmp.xml Normal file
View File

@ -0,0 +1,84 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-gmp" role="wrap">
<?dbhtml filename="gmp.html"?>
<sect1info condition="script">
<productname>gmp</productname>
<productnumber>&gmp-version;</productnumber>
<address>&gmp-url;</address>
</sect1info>
<title>GMP-&gmp-version;</title>
<indexterm zone="ch-tools-gmp">
<primary sortas="a-GMP">GMP</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/gmp.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&gmp-ch5-sbu;</seg>
<seg>&gmp-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of GMP</title>
<para>Prepare GMP for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools --enable-mpbsd</userinput></screen>
<variablelist>
<title>The meaning of the configure option:</title>
<varlistentry>
<term><parameter>--enable-mpbsd</parameter></term>
<listitem>
<para>This builds the Berkeley MP compatibility library</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gmp" role="."/></para>
</sect2>
</sect1>

74
chapter05/grep.xml Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-grep" role="wrap">
<?dbhtml filename="grep.html"?>
<sect1info condition="script">
<productname>grep</productname>
<productnumber>&grep-version;</productnumber>
<address>&grep-url;</address>
</sect1info>
<title>Grep-&grep-version;</title>
<indexterm zone="ch-tools-grep">
<primary sortas="a-Grep">Grep</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/grep.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&grep-ch5-sbu;</seg>
<seg>&grep-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Grep</title>
<para>Prepare Grep for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Grep test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-grep" role="."/></para>
</sect2>
</sect1>

74
chapter05/gzip.xml Normal file
View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-gzip" role="wrap">
<?dbhtml filename="gzip.html"?>
<sect1info condition="script">
<productname>gzip</productname>
<productnumber>&gzip-version;</productnumber>
<address>&gzip-url;</address>
</sect1info>
<title>Gzip-&gzip-version;</title>
<indexterm zone="ch-tools-gzip">
<primary sortas="a-Gzip">Gzip</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/gzip.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&gzip-ch5-sbu;</seg>
<seg>&gzip-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Gzip</title>
<para>Prepare Gzip for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Gzip test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gzip" role="."/></para>
</sect2>
</sect1>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-introduction">
<?dbhtml filename="introduction.html"?>
<title>Introduction</title>
<para>This chapter shows how to build a minimal Linux system.
This system will contain just enough tools to start constructing the final
LFS system in <xref linkend="chapter-building-system"/> and allow a working
environment with more user convenience than a minimum environment would.</para>
<para>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.</para>
<para>The files compiled in this chapter will be installed under the
<filename class="directory">$LFS/tools</filename> 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.</para>
</sect1>

129
chapter05/libstdc++.xml Normal file
View File

@ -0,0 +1,129 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-libstdcpp" role="wrap">
<?dbhtml filename="gcc-libstdc++.html"?>
<sect1info condition="script">
<productname>gcc</productname>
<productnumber>&gcc-version;</productnumber>
<address>&gcc-url;</address>
</sect1info>
<title>Libstdc++ from GCC-&gcc-version;</title>
<indexterm zone="ch-tools-libstdcpp">
<primary sortas="a-GCC">GCC</primary>
<secondary>tools, libstdc++</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>Libstdc++ is the standard C++ library. It is needed
to compile C++ code
(part of GCC is written in C++), but we had to defer its installation
when we built <xref linkend="ch-tools-gcc-pass1"/>
because it depends on glibc, which was not yet available in /tools.
</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&libstdcpp-ch5-sbu;</seg>
<seg>&libstdcpp-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Target Libstdc++</title>
<note>
<para><application>Libstdc++</application> is part of the GCC sources.
You should first unpack the GCC tarball and change to the
<filename>gcc-&gcc-version;</filename> directory.</para>
</note>
<para>Create a separate build directory for Libstdc++ and enter it:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Prepare Libstdc++ for compilation:</para>
<screen><userinput remap="configure">../libstdc++-v3/configure \
--host=$LFS_TGT \
--prefix=/tools \
--disable-multilib \
--disable-nls \
--disable-libstdcxx-threads \
--disable-libstdcxx-pch \
--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--host=...</parameter></term>
<listitem>
<para>Indicates to use the cross compiler we have just built
instead of the one in <filename>/usr/bin</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-libstdcxx-threads</parameter></term>
<listitem>
<para>Since we have not yet built the C threads library, the C++
one cannot be built either.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-libstdcxx-pch</parameter></term>
<listitem>
<para>This switch prevents the installation of precompiled
include files, which are not needed at this stage.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</parameter></term>
<listitem>
<para>This is the location where the standard include files are
searched by the C++ compiler. In a normal build, this information
is automatically passed to the Libstdc++ <command>configure</command>
options from the top level directory. In our case, this information
must be explicitly given.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile libstdc++ by running:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the library:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gcc" role="."/></para>
</sect2>
</sect1>

View File

@ -0,0 +1,73 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-linux-headers" role="wrap">
<?dbhtml filename="linux-headers.html"?>
<sect1info condition="script">
<productname>linux</productname>
<productnumber>&linux-version;</productnumber>
<address>&linux-url;</address>
</sect1info>
<title>Linux-&linux-version; API Headers</title>
<indexterm zone="ch-tools-linux-headers">
<primary sortas="a-Linux">Linux</primary>
<secondary>tools, API headers</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/linux-headers.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&linux-headers-ch5-sbu;</seg>
<seg>&linux-headers-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Linux API Headers</title>
<para>The Linux kernel needs to expose an Application Programming Interface
(API) for the system's C library (Glibc in LFS) to use. This is done
by way of sanitizing various C header files that are shipped in the Linux
kernel source tarball.</para>
<para>Make sure there are no stale files embedded in the package:</para>
<screen><userinput remap="pre">make mrproper</userinput></screen>
<para>Now extract the user-visible kernel headers from the source.
They are placed in an intermediate local directory and copied to the needed
location because the extraction process removes any existing files in
the target directory.</para>
<screen><userinput remap="make">make INSTALL_HDR_PATH=dest headers_install
</userinput><userinput remap="install">cp -rv dest/include/* /tools/include</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-linux-headers" role="."/></para>
</sect2>
</sect1>

79
chapter05/m4.xml Normal file
View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-m4" role="wrap">
<?dbhtml filename="m4.html"?>
<sect1info condition="script">
<productname>m4</productname>
<productnumber>&m4-version;</productnumber>
<address>&m4-url;</address>
</sect1info>
<title>M4-&m4-version;</title>
<indexterm zone="ch-tools-m4">
<primary sortas="a-M4">M4</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/m4.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&m4-ch5-sbu;</seg>
<seg>&m4-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of M4</title>
<para>First, make some fixes required by glibc-2.28:</para>
<screen><userinput remap="pre">sed -i 's/IO_ftrylockfile/IO_EOF_SEEN/' lib/*.c
echo "#define _IO_IN_BACKUP 0x100" >> lib/stdio-impl.h</userinput></screen>
<para>Prepare M4 for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the M4 test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-m4" role="."/></para>
</sect2>
</sect1>

90
chapter05/make.xml Normal file
View File

@ -0,0 +1,90 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-make" role="wrap">
<?dbhtml filename="make.html"?>
<sect1info condition="script">
<productname>make</productname>
<productnumber>&make-version;</productnumber>
<address>&make-url;</address>
</sect1info>
<title>Make-&make-version;</title>
<indexterm zone="ch-tools-make">
<primary sortas="a-Make">Make</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/make.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&make-ch5-sbu;</seg>
<seg>&make-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Make</title>
<para>First, work around an error caused by glibc-2.27 and later:</para>
<screen><userinput remap="pre">sed -i '211,217 d; 219,229 d; 232 d' glob/glob.c</userinput></screen>
<para>Prepare Make for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools --without-guile</userinput></screen>
<variablelist>
<title>The meaning of the configure option:</title>
<varlistentry>
<term><parameter>--without-guile</parameter></term>
<listitem>
<para>This ensures that Make-&make-version; won't link against Guile libraries, which
may be present on the host system, but won't be available within the
<command>chroot</command> environment in the next chapter.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Make test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-make" role="."/></para>
</sect2>
</sect1>

Some files were not shown because too many files have changed in this diff Show More