Initial commit of alternative cross LFS

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11897 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
Bruce Dubbs 2020-06-07 20:16:00 +00:00
parent d53fefab5a
commit fcc027677d
201 changed files with 16808 additions and 7386 deletions

View File

@ -23,10 +23,10 @@ ifneq ($(REV), sysv)
endif
ifeq ($(REV), sysv)
BASEDIR ?= ~/lfs-book
BASEDIR ?= ~/cross2-lfs-book
PDF_OUTPUT ?= LFS-BOOK.pdf
NOCHUNKS_OUTPUT ?= LFS-BOOK.html
DUMPDIR ?= ~/lfs-commands
DUMPDIR ?= ~/cross-lfs-commands
else
BASEDIR ?= ~/lfs-systemd
PDF_OUTPUT ?= LFS-SYSD-BOOK.pdf

View File

@ -25,7 +25,7 @@
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/binutils.xml"
href="../chapter08/binutils.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>

View File

@ -5,11 +5,11 @@
%general-entities;
]>
<chapter id="chapter-temporary-tools" xreflabel="Chapter&nbsp;5">
<chapter id="chapter-cross-tools" xreflabel="Chapter&nbsp;5">
<?dbhtml dir="chapter05"?>
<?dbhtml filename="chapter05.html"?>
<title>Constructing a Temporary System</title>
<title>Cross Compiling a Toolchain</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"/>
@ -19,39 +19,5 @@
<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="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="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="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="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="xz.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="stripping.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="changingowner.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kernfs.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chroot.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingdirs.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="createfiles.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++-pass2.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="flex.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="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="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="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"/>
</chapter>

View File

@ -25,7 +25,7 @@
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/gcc.xml"
href="../chapter08/gcc.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>

View File

@ -25,7 +25,7 @@
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/glibc.xml"
href="../chapter08/glibc.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-bash" role="wrap">
<sect1 id="ch-tools-bash" role="wrap">
<?dbhtml filename="bash.html"?>
<sect1info condition="script">
@ -16,22 +16,25 @@
<title>Bash-&bash-version;</title>
<indexterm zone="ch-system-bash">
<indexterm zone="ch-tools-bash">
<primary sortas="a-Bash">Bash</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Bash package contains the Bourne-Again SHell.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/bash.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&bash-ch6-sbu;</seg>
<seg>&bash-ch6-du;</seg>
<seg>&bash-ch5-sbu;</seg>
<seg>&bash-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -40,27 +43,24 @@
<sect2 role="installation">
<title>Installation of Bash</title>
<para>Incorporate some upstream fixes:</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=/usr \
--docdir=/usr/share/doc/bash-&bash-version; \
--without-bash-malloc \
--with-installed-readline</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--build=$(support/config.guess) \
--host=$LFS_TGT \
--without-bash-malloc</userinput></screen>
<variablelist>
<title>The meaning of the new configure option:</title>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--with-installed-readline</parameter></term>
<term><parameter>--without-bash-malloc</parameter></term>
<listitem>
<para>This option tells Bash to use the <filename
class="libraryfile">readline</filename> library that is already
installed on the system rather than using its own readline
version.</para>
<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>
@ -70,103 +70,26 @@
<screen><userinput remap="make">make</userinput></screen>
<para>Skip down to <quote>Install the
package</quote> if not running the test suite.</para>
<para>Install the package:</para>
<para>To prepare the tests, ensure that the <systemitem class="username">tester</systemitem> user can write to the sources tree:</para>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
<screen><userinput remap="test">chown -Rv tester .</userinput></screen>
<para>Move the excutable to where it is expected to be:</para>
<para>Now, run the tests as the <systemitem
class="username">tester</systemitem> user:</para>
<screen><userinput remap="install">mv $LFS/usr/bin/bash $LFS/bin/bash</userinput></screen>
<screen><userinput remap="test">su tester &lt;&lt; EOF
PATH=$PATH make tests &lt; $(tty)
EOF</userinput></screen>
<!--
<para>The <systemitem class="username">tester</systemitem>
user does not have enough permissions for all the tests to pass. This shows
up in some <quote>diff</quote> output in four test results. Portions of the
run-execscript, run-lastpipe, run-read, and run-test programs
are known to fail in the LFS chroot environment, but pass if the tests
are run in a full system.</para>
-->
<para>Install the package and move the main executable to
<filename class='directory'>/bin</filename>:</para>
<para>Make a link for the programs that use <command>sh</command> for
a shell:</para>
<screen><userinput remap="install">make install
mv -vf /usr/bin/bash /bin</userinput></screen>
<para>Run the newly compiled <command>bash</command> program (replacing the one that is
currently being executed):</para>
<screen role="nodump"><userinput>exec /bin/bash --login +h</userinput></screen>
<note>
<para>The parameters used make the <command>bash</command>
process an interactive login shell and continue to disable hashing so
that new programs are found as they become available.</para>
</note>
<screen><userinput remap="install">ln -sv bash $LFS/bin/sh</userinput></screen>
</sect2>
<sect2 id="contents-bash" role="content">
<title>Contents of Bash</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed directory</segtitle>
<seglistitem>
<seg>bash, bashbug, and sh (link to bash)</seg>
<seg>/usr/include/bash, /usr/lib/bash, and
/usr/share/doc/bash-&bash-version;</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="bash">
<term><command>bash</command></term>
<listitem>
<para>A widely-used command interpreter; it performs many types of
expansions and substitutions on a given command line before executing
it, thus making this interpreter a powerful tool</para>
<indexterm zone="ch-system-bash bash">
<primary sortas="b-bash">bash</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="bashbug">
<term><command>bashbug</command></term>
<listitem>
<para>A shell script to help the user compose and mail standard
formatted bug reports concerning <command>bash</command></para>
<indexterm zone="ch-system-bash bashbug">
<primary sortas="b-bashbug">bashbug</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="sh">
<term><command>sh</command></term>
<listitem>
<para>A symlink to the <command>bash</command> program; when invoked
as <command>sh</command>, <command>bash</command> tries to mimic the
startup behavior of historical versions of <command>sh</command> as
closely as possible, while conforming to the POSIX standard as
well</para>
<indexterm zone="ch-system-bash sh">
<primary sortas="b-sh">sh</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-bash" role="."/></para>
</sect2>

View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-binutils-pass1" role="wrap">
<?dbhtml filename="binutils-pass1.html"?>
<sect1info condition="script">
<productname>binutils-pass1</productname>
<productnumber>&binutils-version;</productnumber>
<address>&binutils-url;</address>
</sect1info>
<title>Binutils-&binutils-version; - Pass 1</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=$LFS/tools \
--with-sysroot=$LFS \
--target=$LFS_TGT \
--disable-nls \
--disable-werror</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--prefix=$LFS/tools</parameter></term>
<listitem>
<para>This tells the configure script to prepare to install the
Binutils programs in the <filename
class="directory">$LFS/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>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,94 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-binutils-pass2" role="wrap">
<?dbhtml filename="binutils-pass2.html"?>
<sect1info condition="script">
<productname>binutils-pass2</productname>
<productnumber>&binutils-version;</productnumber>
<address>&binutils-url;</address>
</sect1info>
<title>Binutils-&binutils-version; - Pass 2</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="../chapter08/binutils.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&binutils-ch5p2-sbu;</seg>
<seg>&binutils-ch5p2-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Binutils</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">../configure \
--prefix=/usr \
--build=$(../config.guess) \
--host=$LFS_TGT \
--disable-nls \
--enable-shared \
--disable-werror</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>--host=$LFS_TGT</parameter></term>
<listitem>
<para>This tells the configure script that we want to build
this pass of binutils for the $LFS_TGT machine, using our just
built cross-compiler. This prevents the linker from searching
through library directories on the host.</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 DESTDIR=$LFS 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

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-bison" role="wrap">
<sect1 id="ch-tools-bison" role="wrap">
<?dbhtml filename="bison.html"?>
<sect1info condition="script">
@ -16,22 +16,25 @@
<title>Bison-&bison-version;</title>
<indexterm zone="ch-system-bison">
<indexterm zone="ch-tools-bison">
<primary sortas="a-Bison">Bison</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Bison package contains a parser generator.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/bison.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&bison-ch6-sbu;</seg>
<seg>&bison-ch6-du;</seg>
<seg>&bison-ch5-sbu;</seg>
<seg>&bison-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -39,103 +42,40 @@
<sect2 role="installation">
<title>Installation of Bison</title>
<!--
<para>First, fix a build problem with the current version:</para>
<screen><userinput remap="pre">sed -i '9327 s/mv/cp/' Makefile.in</userinput></screen>
-->
<para>Prepare Bison for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr --docdir=/usr/share/doc/bison-&bison-version;</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--docdir=/usr/share/doc/bison-&bison-version;</userinput></screen>
<!-- I could not find a race condidtion in the current version.
<para>Compile the package, but work around a race condition in the
current version:</para>
<variablelist>
<title>The meaning of the new configure option:</title>
<screen><userinput remap="make">make -j1</userinput></screen>-->
<varlistentry>
<term><parameter>--docdir=/usr/share/doc/bison-&bison-version;</parameter></term>
<listitem>
<para>This tells the build system to install bison documentation
into a versioned directory.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results (about 5.5 SBU), issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Fourteen tests fail in the "Diagnostics" section, probably because of
missing locales.</para>
<!--
<para>There is a circular dependency between bison and flex with regard to
the checks. If desired, after installing flex in the next section, the
bison package can be rebuilt and the bison checks can be run with
<command>make check</command>.</para>
-->
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 id="contents-bison" role="content">
<title>Contents of Bison</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed library</segtitle>
<segtitle>Installed directory</segtitle>
<seglistitem>
<seg>bison and yacc</seg>
<seg>liby.a</seg>
<seg>/usr/share/bison</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="bison">
<term><command>bison</command></term>
<listitem>
<para>Generates, from a series of rules, a program for analyzing the
structure of text files; Bison is a replacement for Yacc (Yet Another
Compiler Compiler)</para>
<indexterm zone="ch-system-bison bison">
<primary sortas="b-bison">bison</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="yacc">
<term><command>yacc</command></term>
<listitem>
<para>A wrapper for <command>bison</command>, meant for programs that
still call <command>yacc</command> instead of <command>bison</command>;
it calls <command>bison</command> with the <parameter>-y</parameter>
option</para>
<indexterm zone="ch-system-bison yacc">
<primary sortas="b-yacc">yacc</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="liby">
<term><filename class="libraryfile">liby</filename></term>
<listitem>
<para>The Yacc library containing implementations of Yacc-compatible
<function>yyerror</function> and <function>main</function> functions;
this library is normally not very useful, but POSIX requires it</para>
<indexterm zone="ch-system-bison liby">
<primary sortas="c-liby">liby</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-bison" role="."/></para>
</sect2>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-bzip2" role="wrap">
<sect1 id="ch-tools-bzip2" role="wrap">
<?dbhtml filename="bzip2.html"?>
<sect1info condition="script">
@ -16,25 +16,25 @@
<title>Bzip2-&bzip2-version;</title>
<indexterm zone="ch-system-bzip2">
<indexterm zone="ch-tools-bzip2">
<primary sortas="a-Bzip2">Bzip2</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Bzip2 package contains programs for compressing and decompressing
files. Compressing text files with <command>bzip2</command> yields a much
better compression percentage than with the traditional
<command>gzip</command>.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/bzip2.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&bzip2-ch6-sbu;</seg>
<seg>&bzip2-ch6-du;</seg>
<seg>&bzip2-ch5-sbu;</seg>
<seg>&bzip2-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -43,11 +43,13 @@
<sect2 role="installation">
<title>Installation of Bzip2</title>
<para>Apply a patch that will install the documentation for this package:</para>
<para>Apply a patch that will install the documentation for this
package:</para>
<screen><userinput remap="pre">patch -Np1 -i ../&bzip2-docs-patch;</userinput></screen>
<para>The following command ensures installation of symbolic links are relative:</para>
<para>The following command ensures installation of symbolic links are
relative:</para>
<screen><userinput remap="pre">sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile</userinput></screen>
@ -55,9 +57,12 @@
<screen><userinput remap="pre">sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile</userinput></screen>
<para>Prepare Bzip2 for compilation with:</para>
<para>The Bzip2 package does not contain a <command>configure</command>
script. There are two <filename>Makefile</filename>, one for the shared
library, and the other for the static library. Since we need both, We
do the compilation in two stages. First the shared library:</para>
<screen><userinput remap="make">make -f Makefile-libbz2_so
<screen><userinput remap="make">make CC=$LFS_TGT-gcc -f Makefile-libbz2_so
make clean</userinput></screen>
<variablelist>
@ -76,174 +81,31 @@ make clean</userinput></screen>
</variablelist>
<para>Compile and test the package:</para>
<para>Compile and test the package with:</para>
<screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="make">make CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</userinput></screen>
<para>Install the programs:</para>
<para>Install the package:</para>
<screen><userinput remap="install">make PREFIX=/usr install</userinput></screen>
<screen><userinput remap="install">make PREFIX=$LFS/usr install</userinput></screen>
<para>Install the shared <command>bzip2</command> binary into the
<filename class="directory">/bin</filename> directory, make
some necessary symbolic links, and clean up:</para>
<filename class="directory">/bin</filename> directory, make some necessary
symbolic links, and clean up:</para>
<screen><userinput remap="install">cp -v bzip2-shared /bin/bzip2
cp -av libbz2.so* /lib
<screen><userinput remap="install">cp -v bzip2-shared $LFS/bin/bzip2
cp -av libbz2.so* $LFS/lib
ln -sv ../../lib/libbz2.so.1.0 $LFS/usr/lib/libbz2.so
rm -v /usr/bin/{bunzip2,bzcat,bzip2}
ln -sv bzip2 /bin/bunzip2
ln -sv bzip2 /bin/bzcat</userinput></screen>
rm -v $LFS/usr/bin/{bunzip2,bzcat,bzip2}
ln -sv bzip2 $LFS/bin/bunzip2
ln -sv bzip2 $LFS/bin/bzcat</userinput></screen>
</sect2>
<sect2 id="contents-bzip2" role="content">
<title>Contents of Bzip2</title>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed libraries</segtitle>
<segtitle>Installed directory</segtitle>
<seglistitem>
<seg>bunzip2 (link to bzip2), bzcat (link to bzip2), bzcmp (link to
bzdiff), bzdiff, bzegrep (link to bzgrep), bzfgrep (link to bzgrep),
bzgrep, bzip2, bzip2recover, bzless (link to bzmore), and bzmore</seg>
<seg>libbz2.{a,so}</seg>
<seg>/usr/share/doc/bzip2-&bzip2-version;</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="bunzip2">
<term><command>bunzip2</command></term>
<listitem>
<para>Decompresses bzipped files</para>
<indexterm zone="ch-system-bzip2 bunzip2">
<primary sortas="b-bunzip2">bunzip2</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="bzcat">
<term><command>bzcat</command></term>
<listitem>
<para>Decompresses to standard output</para>
<indexterm zone="ch-system-bzip2 bzcat">
<primary sortas="b-bzcat">bzcat</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="bzcmp">
<term><command>bzcmp</command></term>
<listitem>
<para>Runs <command>cmp</command> on bzipped files</para>
<indexterm zone="ch-system-bzip2 bzcmp">
<primary sortas="b-bzcmp">bzcmp</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="bzdiff">
<term><command>bzdiff</command></term>
<listitem>
<para>Runs <command>diff</command> on bzipped files</para>
<indexterm zone="ch-system-bzip2 bzdiff">
<primary sortas="b-bzdiff">bzdiff</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="bzegrep">
<term><command>bzegrep</command></term>
<listitem>
<para>Runs <command>egrep</command> on bzipped files</para>
<indexterm zone="ch-system-bzip2 bzegrep">
<primary sortas="b-bzegrep">bzegrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="bzfgrep">
<term><command>bzfgrep</command></term>
<listitem>
<para>Runs <command>fgrep</command> on bzipped files</para>
<indexterm zone="ch-system-bzip2 bzfgrep">
<primary sortas="b-bzfgrep">bzfgrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="bzgrep">
<term><command>bzgrep</command></term>
<listitem>
<para>Runs <command>grep</command> on bzipped files</para>
<indexterm zone="ch-system-bzip2 bzgrep">
<primary sortas="b-bzgrep">bzgrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="bzip2">
<term><command>bzip2</command></term>
<listitem>
<para>Compresses files using the Burrows-Wheeler block sorting text
compression algorithm with Huffman coding; the compression rate is
better than that achieved by more conventional compressors using
<quote>Lempel-Ziv</quote> algorithms, like <command>gzip</command></para>
<indexterm zone="ch-system-bzip2 bzip2">
<primary sortas="b-bzip2">bzip2</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="bzip2recover">
<term><command>bzip2recover</command></term>
<listitem>
<para>Tries to recover data from damaged bzipped files</para>
<indexterm zone="ch-system-bzip2 bzip2recover">
<primary sortas="b-bzip2recover">bzip2recover</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="bzless">
<term><command>bzless</command></term>
<listitem>
<para>Runs <command>less</command> on bzipped files</para>
<indexterm zone="ch-system-bzip2 bzless">
<primary sortas="b-bzless">bzless</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="bzmore">
<term><command>bzmore</command></term>
<listitem>
<para>Runs <command>more</command> on bzipped files</para>
<indexterm zone="ch-system-bzip2 bzmore">
<primary sortas="b-bzmore">bzmore</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libbz2">
<term><filename class="libraryfile">libbz2</filename></term>
<listitem>
<para>The library implementing lossless, block-sorting data
compression, using the Burrows-Wheeler algorithm</para>
<indexterm zone="ch-system-bzip2 libbz2">
<primary sortas="c-libbz2">libbz2</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-bzip2" role="."/></para>
</sect2>

View File

@ -0,0 +1,41 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-changingowner">
<?dbhtml filename="changingowner.html"?>
<title>Changing Ownership</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 whole directory hierarchy in <filename
class="directory">$LFS</filename>
is owned by the user <systemitem class="username">lfs</systemitem>, a user
that exists only on the host system. If the directories under <filename
class="directory">$LFS</filename> are kept as they are, the files are
owned by a user ID without a corresponding account. This is dangerous because
a user account created later could get this same user ID and would own all
the files under <filename class="directory">$LFS</filename>, 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/*</filename> directories to
user <systemitem class="username">root</systemitem> by running the following
command:</para>
<screen><userinput>chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,lib64,tools}</userinput></screen>
</sect1>

View File

@ -5,101 +5,30 @@
%general-entities;
]>
<chapter id="chapter-building-system" xreflabel="Chapter&nbsp;6">
<chapter id="chapter-temporary-tools" xreflabel="Chapter&nbsp;6">
<?dbhtml dir="chapter06"?>
<?dbhtml filename="chapter06.html"?>
<title>Installing Basic System Software</title>
<title>Cross Compiling Temporary Tools</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="pkgmgt.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="man-pages.xml"/>
<!-- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="adjusting.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="zlib.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="xz.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="zstd.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="readline.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="bc.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="flex.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="binutils.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gmp.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mpfr.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="mpc.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="attr.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="acl.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libcap.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="shadow.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="pkgconfig.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="sed.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="psmisc.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="iana-etc.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="bison.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="bash.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libtool.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gdbm.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gperf.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="expat.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inetutils.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="xml-parser.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="intltool.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="autoconf.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="automake.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kmod.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libelf.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libffi.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="openssl.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="ninja.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="meson.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="check.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="gawk.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="groff.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="grub.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="less.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="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="iproute2.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kbd.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libpipeline.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="man-db.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="vim.xml"/>
<!-- systemd only -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="systemd.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dbus.xml"/>
<!-- sysv only -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="eudev.xml"/>
<!-- Both sysv on systemd builds -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="procps.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="util-linux.xml"/>
<!-- Both sysv and systemd builds -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="e2fsprogs.xml"/>
<!-- sysv only -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysklogd.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysvinit.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="aboutdebug.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="strippingagain.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="revisedchroot.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="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="stripping.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="changingowner.xml"/>
</chapter>

65
chapter06/chroot.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-chroot">
<?dbhtml filename="chroot.html"?>
<title>Entering the Chroot Environment</title>
<para>Now that all the packages which depend on themselves for being built
are on the system, it is time to enter the chroot environment to finish
installing the remaining temporary tools. This environment will be in use
also for installing the final system. As user <systemitem
class="username">root</systemitem>, run the following command to enter the
realm that is, at the moment, populated with only the temporary tools:</para>
<screen role="nodump"><userinput>chroot "$LFS" /usr/bin/env -i \
HOME=/root \
TERM="$TERM" \
PS1='(lfs chroot) \u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login +h</userinput></screen>
<para>The <parameter>-i</parameter> option given to the <command>env</command>
command will clear all variables of the chroot environment. After that, only
the <envar>HOME</envar>, <envar>TERM</envar>, <envar>PS1</envar>, and
<envar>PATH</envar> variables are set again. The
<parameter>TERM=$TERM</parameter> construct will set the <envar>TERM</envar>
variable inside chroot to the same value as outside chroot. This variable is
needed for programs like <command>vim</command> and <command>less</command>
to operate properly. If other variables are needed, such as
<envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is a good place to set
them again.</para>
<para>From this point on, there is no need to use the
<envar>LFS</envar> variable anymore, because all work will be restricted
to the LFS file system. This is because the Bash shell is told that
<filename class="directory">$LFS</filename> is now the root
(<filename class="directory">/</filename>) directory.</para>
<para>Notice that <filename class="directory">/tools/bin</filename> is not
anymore in the <envar>PATH</envar>. This means that a temporary tool will no longer be
used once its final version is installed. This occurs when the shell does not
<quote>remember</quote> the locations of executed binaries&mdash;for this
reason, hashing is switched off by passing the <parameter>+h</parameter> option
to <command>bash</command>.</para>
<para>Note that the <command>bash</command> prompt will say
<computeroutput>I have no name!</computeroutput> This is normal because the
<filename>/etc/passwd</filename> file has not been created yet.</para>
<note>
<para>It is important that all the commands throughout the remainder of this
chapter and the following chapters are run from within the chroot
environment. If you leave this environment for any reason (rebooting for
example), ensure that the virtual kernel filesystems are mounted as
explained in <xref linkend="ch-system-bindmount"/> and <xref
linkend="ch-system-kernfsmount"/> and enter chroot again before continuing
with the installation.</para>
</note>
</sect1>

File diff suppressed because it is too large Load Diff

204
chapter06/createfiles.xml Normal file
View File

@ -0,0 +1,204 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-createfiles">
<?dbhtml filename="createfiles.html"?>
<title>Creating Essential Files and Symlinks</title>
<indexterm zone="ch-tools-createfiles">
<primary sortas="e-/etc/passwd">/etc/passwd</primary>
</indexterm>
<indexterm zone="ch-tools-createfiles">
<primary sortas="e-/etc/group">/etc/group</primary>
</indexterm>
<indexterm zone="ch-tools-createfiles">
<primary sortas="e-/var/run/utmp">/var/run/utmp</primary>
</indexterm>
<indexterm zone="ch-tools-createfiles">
<primary sortas="e-/var/log/btmp">/var/log/btmp</primary>
</indexterm>
<indexterm zone="ch-tools-createfiles">
<primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary>
</indexterm>
<indexterm zone="ch-tools-createfiles">
<primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary>
</indexterm>
<para>Historically, Linux maintains a list of the mounted file systems in the
file <filename>/etc/mtab</filename>. Modern kernels maintain this list
internally and exposes it to the user via the <filename
class="directory">/proc</filename> filesystem. To satisfy utilities that
expect the presence of <filename>/etc/mtab</filename>, create the following
symbolic link:</para>
<screen><userinput>ln -sv /proc/self/mounts /etc/mtab</userinput></screen>
<para>In order for user <systemitem class="username">root</systemitem> to be
able to login and for the name <quote>root</quote> to be recognized, there
must be relevant entries in the <filename>/etc/passwd</filename> and
<filename>/etc/group</filename> files.</para>
<para>Create the <filename>/etc/passwd</filename> file by running the following
command:</para>
<screen revision="sysv"><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
<literal>root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
daemon:x:6:6:Daemon User:/dev/null:/bin/false
messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
EOF</userinput></screen>
<screen revision="systemd"><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
<literal>root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
daemon:x:6:6:Daemon User:/dev/null:/bin/false
messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
systemd-bus-proxy:x:72:72:systemd Bus Proxy:/:/bin/false
systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/bin/false
systemd-journal-remote:x:74:74:systemd Journal Remote:/:/bin/false
systemd-journal-upload:x:75:75:systemd Journal Upload:/:/bin/false
systemd-network:x:76:76:systemd Network Management:/:/bin/false
systemd-resolve:x:77:77:systemd Resolver:/:/bin/false
systemd-timesync:x:78:78:systemd Time Synchronization:/:/bin/false
systemd-coredump:x:79:79:systemd Core Dumper:/:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
EOF</userinput></screen>
<para>The actual password for <systemitem class="username">root</systemitem>
(the <quote>x</quote> used here is just a placeholder) will be set later.</para>
<para>Create the <filename>/etc/group</filename> file by running the following
command:</para>
<screen revision="sysv"><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
<literal>root:x:0:
bin:x:1:daemon
sys:x:2:
kmem:x:3:
tape:x:4:
tty:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:
adm:x:16:
messagebus:x:18:
input:x:24:
mail:x:34:
kvm:x:61:
wheel:x:97:
nogroup:x:99:
users:x:999:</literal>
EOF</userinput></screen>
<screen revision="systemd"><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
<literal>root:x:0:
bin:x:1:daemon
sys:x:2:
kmem:x:3:
tape:x:4:
tty:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:
adm:x:16:
messagebus:x:18:
systemd-journal:x:23:
input:x:24:
mail:x:34:
kvm:x:61:
systemd-bus-proxy:x:72:
systemd-journal-gateway:x:73:
systemd-journal-remote:x:74:
systemd-journal-upload:x:75:
systemd-network:x:76:
systemd-resolve:x:77:
systemd-timesync:x:78:
systemd-coredump:x:79:
wheel:x:97:
nogroup:x:99:
users:x:999:</literal>
EOF</userinput></screen>
<para>The created groups are not part of any standard&mdash;they are groups
decided on in part by the requirements of the Udev configuration in the next
chapter, and in part by common convention employed by a number of existing
Linux distributions. In addition, some test suites rely on specific users
or groups. The Linux Standard Base (LSB, available at <ulink
url="http://www.linuxbase.org"/>) recommends only that, besides the group
<systemitem class="groupname">root</systemitem> with a Group ID (GID) of 0,
a group <systemitem class="groupname">bin</systemitem> with a GID of 1 be
present. All other group names and GIDs can be chosen freely by the system
administrator since well-written programs do not depend on GID numbers, but
rather use the group's name.</para>
<para>Some tests in <xref linkend="chapter-building-system"/> need a regular
user. We add this user here and delete this account at the end of that
chapter.</para>
<screen><userinput>echo "tester:x:$(ls -n $(tty) | cut -d" " -f3):101::/home/tester:/bin/bash" &gt;&gt; /etc/passwd
echo "tester:x:101:" &gt;&gt; /etc/group
install -o tester -d /home/tester</userinput></screen>
<para>To remove the <quote>I have no name!</quote> prompt, start a new
shell. Since the
<filename>/etc/passwd</filename> and <filename>/etc/group</filename>
files have been created, user name and group name resolution will now
work:</para>
<screen role="nodump"><userinput>exec /bin/bash --login +h</userinput></screen>
<para>Note the use of the <parameter>+h</parameter> directive. This tells
<command>bash</command> not to use its internal path hashing. Without this
directive, <command>bash</command> would remember the paths to binaries it has
executed. To ensure the use of the newly compiled binaries as soon as they are
installed, the <parameter>+h</parameter> directive will be used for the duration
of this chapter.</para>
<para>The <command>login</command>, <command>agetty</command>, and
<command>init</command> programs (and others) use a number of log
files to record information such as who was logged into the system and
when. However, these programs will not write to the log files if they
do not already exist. Initialize the log files and give them
proper permissions:</para>
<screen><userinput>touch /var/log/{btmp,lastlog,faillog,wtmp}
chgrp -v utmp /var/log/lastlog
chmod -v 664 /var/log/lastlog
chmod -v 600 /var/log/btmp</userinput></screen>
<para>The <filename>/var/log/wtmp</filename> file records all logins and
logouts. The <filename>/var/log/lastlog</filename> file records when each
user last logged in. The <filename>/var/log/faillog</filename> file records
failed login attempts. The <filename>/var/log/btmp</filename> file records
the bad login attempts.</para>
<note><para>The <filename>/run/utmp</filename> file records the users that
are currently logged in. This file is created dynamically in the boot
scripts.</para></note>
</sect1>

View File

@ -0,0 +1,59 @@
<?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-creatingdirs">
<?dbhtml filename="creatingdirs.html"?>
<title>Creating Directories</title>
<para>It is time to create the full structure in the LFS file system. Create
a standard directory tree by issuing the following commands:</para>
<screen><userinput>mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
mkdir -pv /{media/{floppy,cdrom},srv,var}
install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -pv /usr/{,local/}share/man/man{1..8}
mkdir -v /var/{log,mail,spool}
ln -sv /run /var/run
ln -sv /run/lock /var/lock
mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}</userinput></screen>
<para>Directories are, by default, created with permission mode 755, but
this is not desirable for all directories. In the commands above, two
changes are made&mdash;one to the home directory of user <systemitem
class="username">root</systemitem>, and another to the directories for
temporary files.</para>
<para>The first mode change ensures that not just anybody can enter
the <filename class="directory">/root</filename> directory&mdash;the
same as a normal user would do with his or her home directory. The
second mode change makes sure that any user can write to the
<filename class="directory">/tmp</filename> and <filename
class="directory">/var/tmp</filename> directories, but cannot remove
another user's files from them. The latter is prohibited by the so-called
<quote>sticky bit,</quote> the highest bit (1) in the 1777 bit mask.</para>
<sect2>
<title>FHS Compliance Note</title>
<para>The directory tree is based on the Filesystem Hierarchy Standard
(FHS) (available at <ulink
url="https://refspecs.linuxfoundation.org/fhs.shtml"/>). The FHS also specifies
the optional existence of some directories such as <filename
class="directory">/usr/local/games</filename> and <filename
class="directory">/usr/share/games</filename>. We create only the
directories that are needed. However, feel free to create these
directories. </para>
</sect2>
</sect1>

96
chapter06/dejagnu.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-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 <application>DejaGnu</application> package contains a framework for running test
suites on GNU tools. It is written in <command>expect</command>, which itself
uses <application>Tcl</application> (Tool Command Language).</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&dejagnu-ch5-sbu;</seg>
<seg>&dejagnu-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of DejaGNU</title>
<para>Prepare DejaGNU for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr
makeinfo --html --no-split -o doc/dejagnu.html doc/dejagnu.texi
makeinfo --plaintext -o doc/dejagnu.txt doc/dejagnu.texi</userinput></screen>
<para>Build and install the package:</para>
<screen><userinput remap="install">make install
install -v -dm755 /usr/share/doc/dejagnu-&dejagnu-version;
install -v -m644 doc/dejagnu.{html,txt} \
/usr/share/doc/dejagnu-&dejagnu-version;</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>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-diffutils" role="wrap">
<sect1 id="ch-tools-diffutils" role="wrap">
<?dbhtml filename="diffutils.html"?>
<sect1info condition="script">
@ -16,23 +16,25 @@
<title>Diffutils-&diffutils-version;</title>
<indexterm zone="ch-system-diffutils">
<indexterm zone="ch-tools-diffutils">
<primary sortas="a-Diffutils">Diffutils</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Diffutils package contains programs that show the differences
between files or directories.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/diffutils.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&diffutils-ch6-sbu;</seg>
<seg>&diffutils-ch6-du;</seg>
<seg>&diffutils-ch5-sbu;</seg>
<seg>&diffutils-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -43,82 +45,23 @@
<para>Prepare Diffutils for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr --host=$LFS_TGT</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<sect2 id="contents-diffutils" role="content">
<title>Contents of Diffutils</title>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<seglistitem>
<seg>cmp, diff, diff3, and sdiff</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="cmp">
<term><command>cmp</command></term>
<listitem>
<para>Compares two files and reports whether or in which bytes they
differ</para>
<indexterm zone="ch-system-diffutils cmp">
<primary sortas="b-cmp">cmp</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="diff">
<term><command>diff</command></term>
<listitem>
<para>Compares two files or directories and reports which lines in
the files differ</para>
<indexterm zone="ch-system-diffutils diff">
<primary sortas="b-diff">diff</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="diff3">
<term><command>diff3</command></term>
<listitem>
<para>Compares three files line by line</para>
<indexterm zone="ch-system-diffutils diff3">
<primary sortas="b-diff3">diff3</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="sdiff">
<term><command>sdiff</command></term>
<listitem>
<para>Merges two files and interactively outputs the results</para>
<indexterm zone="ch-system-diffutils sdiff">
<primary sortas="b-sdiff">sdiff</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-diffutils" role="."/></para>
</sect2>

139
chapter06/expect.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="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 <application>Expect</application> package contains tools for
automating, via scripted dialogues, interactive applications such as
<command>telnet</command>, <command>ftp</command>,
<command>passwd</command>, <command>fsck</command>,
<command>rlogin</command>, and <command>tip</command>.
<application>Expect</application> is also useful for testing these same
applications as well as easing all sorts of tasks that are prohibitively
difficult with anything else. The <application>DejaGnu</application>
framework is written in <application>Expect</application>.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&expect-ch5-sbu;</seg>
<seg>&expect-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Expect</title>
<para>Prepare Expect for compilation:</para>
<screen><userinput remap="configure">
./configure --prefix=/usr \
--with-tcl=/usr/lib \
--enable-shared \
--mandir=/usr/share/man \
--with-tclinclude=/usr/include</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--with-tcl=/usr/lib</parameter></term>
<listitem>
<para>This parameter is needed to tell the
<command>configure</command> where the
<command>tclConfig.sh</command> is located.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-tclinclude=/usr/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>Install the package:</para>
<screen><userinput remap="install">make install
ln -svf expect&expect-version;/libexpect&expect-version;.so /usr/lib</userinput></screen>
</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>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-file" role="wrap">
<sect1 id="ch-tools-file" role="wrap">
<?dbhtml filename="file.html"?>
<sect1info condition="script">
@ -16,23 +16,25 @@
<title>File-&file-version;</title>
<indexterm zone="ch-system-file">
<indexterm zone="ch-tools-file">
<primary sortas="a-File">File</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The File package contains a utility for determining the type of a given
file or files.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/file.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&file-ch6-sbu;</seg>
<seg>&file-ch6-du;</seg>
<seg>&file-ch5-sbu;</seg>
<seg>&file-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -43,65 +45,28 @@
<para>Prepare File for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT</userinput></screen>
<!-- devs: if using - -build here, the build system wants to compile
the signature file with "file" on the build system, but stops if it is not
the same version. One possibility would be to build "file" on the build
system first, but it is simpler to have the system think it is not
cross-compiling, and use the just built "file". -->
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 id="contents-file" role="content">
<title>Contents of File</title>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed library</segtitle>
<seglistitem>
<seg>file</seg>
<seg>libmagic.so</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="file">
<term><command>file</command></term>
<listitem>
<para>Tries to classify each given file; it does this by performing
several tests&mdash;file system tests, magic number tests, and language
tests</para>
<indexterm zone="ch-system-file file">
<primary sortas="b-file">file</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libmagic">
<term><filename class="libraryfile">libmagic</filename></term>
<listitem>
<para>Contains routines for magic number recognition, used by the
<command>file</command> program</para>
<indexterm zone="ch-system-file libmagic">
<primary sortas="c-libmagic">libmagic</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<sect2 role="content">
<title/>
<para>Details on this package are located in<!-- TODO
<xref linkend="contents-file" role="."/> --></para>
</sect2>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-findutils" role="wrap">
<sect1 id="ch-tools-findutils" role="wrap">
<?dbhtml filename="findutils.html"?>
<sect1info condition="script">
@ -16,25 +16,25 @@
<title>Findutils-&findutils-version;</title>
<indexterm zone="ch-system-findutils">
<indexterm zone="ch-tools-findutils">
<primary sortas="a-Findutils">Findutils</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Findutils package contains programs to find files. These programs
are provided to recursively search through a directory tree and to
create, maintain, and search a database (often faster than the recursive
find, but unreliable if the database has not been recently updated).</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/findutils.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&findutils-ch6-sbu;</seg>
<seg>&findutils-ch6-du;</seg>
<seg>&findutils-ch5-sbu;</seg>
<seg>&findutils-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -45,116 +45,30 @@
<para>Prepare Findutils for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr --localstatedir=/var/lib/locate</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--localstatedir</parameter></term>
<listitem>
<para>This option changes the location of the <command>locate</command>
database to be in <filename class="directory">/var/lib/locate</filename>,
which is FHS-compliant.</para>
</listitem>
</varlistentry>
</variablelist>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">chown -Rv tester .
su tester -c "PATH=$PATH make check"</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
<para revision="sysv">Some of the scripts in the LFS-Bootscripts package
depend on <command>find</command>. As <filename
class="directory">/usr</filename> may not be available during the early
stages of booting, this program needs to be on the root partition. The
<command>updatedb</command> script also needs to be modified to correct an
explicit path:</para>
<para>Move the excutable to its final expected location:</para>
<para revision="systemd"> Some packages in BLFS and beyond expect the
<command>find</command> program in <filename
class="directory">/bin</filename>, so make sure it's placed there:</para>
<screen><userinput remap="install">mv -v /usr/bin/find /bin
sed -i 's|find:=${BINDIR}|find:=/bin|' /usr/bin/updatedb</userinput></screen>
<screen><userinput remap="install">mv -v $LFS/usr/bin/find $LFS/bin
sed -i 's|find:=${BINDIR}|find:=/bin|' $LFS/usr/bin/updatedb</userinput></screen>
</sect2>
<sect2 id="contents-findutils" role="content">
<title>Contents of Findutils</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed directory</segtitle>
<seglistitem>
<seg>find, locate, updatedb, and xargs</seg>
<seg>/var/lib/locate</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="find">
<term><command>find</command></term>
<listitem>
<para>Searches given directory trees for files matching the specified
criteria</para>
<indexterm zone="ch-system-findutils find">
<primary sortas="b-find">find</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="locate">
<term><command>locate</command></term>
<listitem>
<para>Searches through a database of file names and reports the names
that contain a given string or match a given pattern</para>
<indexterm zone="ch-system-findutils locate">
<primary sortas="b-locate">locate</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="updatedb">
<term><command>updatedb</command></term>
<listitem>
<para>Updates the <command>locate</command> database; it scans the
entire file system (including other file systems that are currently
mounted, unless told not to) and puts every file name it finds into
the database</para>
<indexterm zone="ch-system-findutils updatedb">
<primary sortas="b-updatedb">updatedb</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xargs">
<term><command>xargs</command></term>
<listitem>
<para>Can be used to apply a given command to a list of files</para>
<indexterm zone="ch-system-findutils xargs">
<primary sortas="b-xargs">xargs</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-findutils" role="."/></para>
</sect2>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-flex" role="wrap">
<sect1 id="ch-tools-flex" role="wrap">
<?dbhtml filename="flex.html"?>
<sect1info condition="script">
@ -16,23 +16,25 @@
<title>Flex-&flex-version;</title>
<indexterm zone="ch-system-flex">
<indexterm zone="ch-tools-flex">
<primary sortas="a-Flex">Flex</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Flex package contains a utility for generating programs that
recognize patterns in text.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/flex.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&flex-ch6-sbu;</seg>
<seg>&flex-ch6-du;</seg>
<seg>&flex-ch5-sbu;</seg>
<seg>&flex-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -41,108 +43,45 @@
<sect2 role="installation">
<title>Installation of Flex</title>
<!--
<para>First, fix a problem introduced with glibc-2.26:</para>
<screen><userinput remap="pre">sed -i "/math.h/a #include &lt;malloc.h&gt;" src/flexdef.h</userinput></screen>
<para>The build procedure assumes the <application>help2man</application>
program is available to create a man page from the executable - -help option.
This is not present, so we use an environment variable to skip this process.
Now, prepare Flex for compilation:</para> -->
<para>Prepare Flex for compilation:</para>
<!-- <screen><userinput remap="configure">HELP2MAN=/tools/bin/true \ -->
<screen><userinput remap="configure">./configure --prefix=/usr --docdir=/usr/share/doc/flex-&flex-version;</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--docdir=/usr/share/doc/flex-&flex-version;</userinput></screen>
<!--
<variablelist>
<title>The meaning of the new configure option:</title>
<varlistentry>
<term><parameter>- -disable-bootstrap</parameter></term>
<listitem>
<para>Normally, building flex is done in two stages. A first
programs, which is used to generate the source of a second one,
which is then compiled. When using cross-compilation, the first
program is generated on the build system. However, due to a bug
in configure, the presence of some function is tested only on the
host system. If this function is not found on the build system, the
build fails. This can be prevented by disabling the two stage
build.</para>
</listitem>
</varlistentry>
</variablelist>
-->
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results (about 0.5 SBU), issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>A few programs do not know about <command>flex</command> yet and
try to run its predecessor, <command>lex</command>. To support those
programs, create a symbolic link named <filename>lex</filename> that
runs <filename>flex</filename> in <command>lex</command> emulation
mode:</para>
<screen><userinput remap="install">ln -sv flex /usr/bin/lex</userinput></screen>
</sect2>
<sect2 id="contents-flex" role="content">
<title>Contents of Flex</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed libraries</segtitle>
<segtitle>Installed directory</segtitle>
<seglistitem>
<seg>flex, flex++ (link to flex), and lex (link to flex)</seg>
<seg>libfl.so</seg>
<seg>/usr/share/doc/flex-&flex-version;</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="flex">
<term><command>flex</command></term>
<listitem>
<para>A tool for generating programs that recognize patterns in text;
it allows for the versatility to specify the rules for pattern-finding,
eradicating the need to develop a specialized program</para>
<indexterm zone="ch-system-flex flex">
<primary sortas="b-flex">flex</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="flexpp">
<term><command>flex++</command></term>
<listitem>
<para>An extension of flex, is used for generating C++ code
and classes. It is a symbolic link to <command>flex</command></para>
<indexterm zone="ch-system-flex flexpp">
<primary sortas="b-flex++">flex++</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="lex">
<term><command>lex</command></term>
<listitem>
<para>A symbolic link that runs <command>flex</command> in
<command>lex</command> emulation mode</para>
<indexterm zone="ch-system-flex lex">
<primary sortas="b-lex">lex</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libfl">
<term><filename class="libraryfile">libfl</filename></term>
<listitem>
<para>The <filename class="libraryfile">flex</filename> library</para>
<indexterm zone="ch-system-flex libfl">
<primary sortas="c-libfl">libfl</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-flex" role="."/></para>
</sect2>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-gawk" role="wrap">
<sect1 id="ch-tools-gawk" role="wrap">
<?dbhtml filename="gawk.html"?>
<sect1info condition="script">
@ -16,22 +16,25 @@
<title>Gawk-&gawk-version;</title>
<indexterm zone="ch-system-gawk">
<indexterm zone="ch-tools-gawk">
<primary sortas="a-Gawk">Gawk</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Gawk package contains programs for manipulating text files.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/gawk.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&gawk-ch6-sbu;</seg>
<seg>&gawk-ch6-du;</seg>
<seg>&gawk-ch5-sbu;</seg>
<seg>&gawk-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -46,82 +49,25 @@
<para>Prepare Gawk for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(./config.guess)</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>If desired, install the documentation:</para>
<screen><userinput remap="install">mkdir -v /usr/share/doc/gawk-&gawk-version;
cp -v doc/{awkforai.txt,*.{eps,pdf,jpg}} /usr/share/doc/gawk-&gawk-version;</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 id="contents-gawk" role="content">
<title>Contents of Gawk</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed libraries</segtitle>
<segtitle>Installed directories</segtitle>
<seglistitem>
<seg>awk (link to gawk), gawk, and awk-&gawk-version;</seg>
<seg>filefuncs.so, fnmatch.so, fork.so, inplace.so, intdiv.so, ordchr.so,
readdir.so, readfile.so, revoutput.so, revtwoway.so, rwarray.so,
and time.so (all in /usr/lib/gawk)</seg>
<seg>/usr/lib/gawk, /usr/libexec/awk, /usr/share/awk, and
/usr/share/doc/gawk-&gawk-version;</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="awk">
<term><command>awk</command></term>
<listitem>
<para>A link to <command>gawk</command></para>
<indexterm zone="ch-system-gawk awk">
<primary sortas="b-awk">awk</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gawk">
<term><command>gawk</command></term>
<listitem>
<para>A program for manipulating text files; it is the GNU
implementation of <command>awk</command></para>
<indexterm zone="ch-system-gawk gawk">
<primary sortas="b-gawk">gawk</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gawk-version">
<term><command>gawk-&gawk-version;</command></term>
<listitem>
<para>A hard link to <command>gawk</command></para>
<indexterm zone="ch-system-gawk gawk-version">
<primary sortas="b-gawk-&gawk-version;">gawk-&gawk-version;</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-gawk" role="."/></para>
</sect2>

208
chapter06/gcc-pass1.xml Normal file
View File

@ -0,0 +1,208 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-gcc-pass1" role="wrap" xreflabel="gcc-pass1">
<?dbhtml filename="gcc-pass1.html"?>
<sect1info condition="script">
<productname>gcc-pass1</productname>
<productnumber>&gcc-version;</productnumber>
<address>&gcc-url;</address>
</sect1info>
<title>GCC-&gcc-version; - Pass 1</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 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>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>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=$LFS/tools \
--with-glibc-version=2.11 \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
--enable-initfini-array \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-decimal-float \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--with-glibc-version=2.11</parameter></term>
<listitem>
<para>This option ensures the package will be compatible with the host's
version of glibc. It is set to the minimum glibc requirement
specified in the <xref linkend="ch-partitioning-hostreqs"/>.</para>
</listitem>
</varlistentry>
<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>--disable-shared</parameter></term>
<listitem>
<para>This switch forces GCC to link its internal libraries
statically. We need this because the shared libraries require glibc,
which is not yet installed on the target system.</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>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>This build of GCC has installed a couple of internal system
headers. Normally one of them, <filename>limits.h</filename>, would in turn
include the corresponding system <filename>limits.h</filename> header, in
this case, <filename>$LFS/usr/include/limits.h</filename>. However, at the
time of this build of gcc <filename>$LFS/usr/include/limits.h</filename>
does not exist, so the internal header that has just been installed is a
partial, self-contained file and does not include the extended features of
the system header. This is adequate for building glibc, but the full
internal header will be needed later. Create a full version of the internal
header using a command that is identical to what the GCC build system does
in normal circumstances:</para>
<screen><userinput remap="install">cd ..
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gcc" role="."/></para>
</sect2>
</sect1>

160
chapter06/gcc-pass2.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-gcc-pass2" role="wrap">
<?dbhtml filename="gcc-pass2.html"?>
<sect1info condition="script">
<productname>gcc-pass2</productname>
<productnumber>&gcc-version;</productnumber>
<address>&gcc-url;</address>
</sect1info>
<title>GCC-&gcc-version; - Pass 2</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="../chapter08/gcc.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&gcc-ch5p2-sbu;</seg>
<seg>&gcc-ch5p2-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of GCC</title>
<para>As in the first build of GCC, the GMP, MPFR, and MPC packages are
required. Unpack the tarballs and move them into the required directory
names:</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>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>Fix an issue with GCC-10.1 when building with a cross
compiler:</para>
<screen><userinput remap="pre">patch -Np1 -i ../&gcc-cross-patch;</userinput></screen>
<para>Create a separate build directory again:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Create a symlink that allos libgcc to be built with posix threads
support:</para>
<screen><userinput remap="pre">mkdir -pv $LFS_TGT/libgcc
ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</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">../configure \
--build=$(../config.guess) \
--host=$LFS_TGT \
--prefix=/usr \
CC_FOR_TARGET=$LFS_TGT-gcc \
--with-build-sysroot=$LFS \
--enable-initfini-array \
--disable-nls \
--disable-multilib \
--disable-decimal-float \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title><!-- WIP -->
<varlistentry>
<term><parameter>-with-build-sysroot=$LFS</parameter></term>
<listitem>
<para>Normally, using <parameter>--host=</parameter> ensures that
a cross-compiler is used for building gcc, and that compiler knows
that it has to look for headers and libraries in <filename
class="directory">$LFS</filename>. But the build system of GCC uses
other tools, which are not aware of this location. This switch is
needed to have them find the needed files in <filename
class="directory">$LFS</filename>, and not on the host.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--enable-initfini-array</parameter></term>
<listitem>
<para>This option is automatically enabled when building a native
compiler with a native compiler on x86. But here, we build with
a cross compiler, so we need to explicitely set this option.</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 DESTDIR=$LFS 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 $LFS/usr/bin/cc</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,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='ch-partitioning-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>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-gettext" role="wrap">
<sect1 id="ch-tools-gettext" role="wrap">
<?dbhtml filename="gettext.html"?>
<sect1info condition="script">
@ -16,25 +16,25 @@
<title>Gettext-&gettext-version;</title>
<indexterm zone="ch-system-gettext">
<indexterm zone="ch-tools-gettext">
<primary sortas="a-Gettext">Gettext</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Gettext package contains utilities for internationalization and
localization. These allow programs to be compiled with NLS (Native Language
Support), enabling them to output messages in the user's native
language.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/gettext.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&gettext-ch6-sbu;</seg>
<seg>&gettext-ch6-du;</seg>
<seg>&gettext-ch5-sbu;</seg>
<seg>&gettext-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -43,402 +43,42 @@
<sect2 role="installation">
<title>Installation of Gettext</title>
<!-- This has been fixed in upstream gnulib, when a new version of
gettext is released, please check #4055 to see if the change has been
picked up in this package
As of April 11, 2018, 'TESTS = test-lock' is in gettext-runtime/tests/Makefile.am
Perhaps the test is fixed.
<para>For our temporary set of tools, we only need to install
three programs from Gettext.</para>
There is no reference to 'test' or TEST in gettext-tools/gnulib-tests/Makefile.am
-->
<!--
<para>First, suppress two invocations of test-lock which on some machines
can loop forever:</para>
<screen><userinput remap="pre">sed -i '/^TESTS =/d' gettext-runtime/tests/Makefile.in &amp;&amp;
sed -i 's/test-lock..EXEEXT.//' gettext-tools/gnulib-tests/Makefile.in</userinput></screen>-->
<!-- As of April 11, 2018 appdata.* is NOT in git master, but appears
to be in metainfo.{its,loc}, When updating, check BLFS gnome-screenshot. -->
<!--
<para>Now fix a configuration file:</para>
<screen><userinput remap="pre">sed -e '/AppData/{N;N;p;s/\.appdata\./.metainfo./}' \
-i gettext-tools/its/appdata.loc</userinput></screen>
-->
<para>Prepare Gettext for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--disable-static \
--docdir=/usr/share/doc/gettext-&gettext-version;</userinput></screen>
<screen><userinput remap="configure">./configure --disable-shared</userinput></screen>
<variablelist>
<title>The meaning of the configure option:</title>
<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 BISON_LOCALEDIR=/usr/share/locale</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<variablelist>
<title>The meaning of the make parameter:</title>
<para>Install the <command>msgfmt</command>, <command>msgmerge</command> and
<command>xgettext</command> programs:</para>
<varlistentry>
<term><parameter>BISON_LOCALEDIR=/usr/share/locale</parameter></term>
<listitem>
<para>Since bison is not yet installed in /usr, configure hardcodes
the directory containing translations for the bison program (the
"locale" directory) as /tools/share/locale. Passing this variable
to make allows overriding the choice made by configure.</para>
</listitem>
</varlistentry>
</variablelist>
<para>To test the results (this takes a long time, around 3 SBUs),
issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install
chmod -v 0755 /usr/lib/preloadable_libintl.so</userinput></screen>
<screen><userinput remap="install">cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin</userinput></screen>
</sect2>
<sect2 id="contents-gettext" role="content">
<title>Contents of Gettext</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed libraries</segtitle>
<segtitle>Installed directories</segtitle>
<seglistitem>
<seg>autopoint, envsubst, gettext, gettext.sh,
gettextize, msgattrib, msgcat, msgcmp, msgcomm, msgconv, msgen,
msgexec, msgfilter, msgfmt, msggrep, msginit, msgmerge, msgunfmt, msguniq,
ngettext, recode-sr-latin, and xgettext</seg>
<seg>libasprintf.so, libgettextlib.so, libgettextpo.so,
libgettextsrc.so, libtextstyle.so, and preloadable_libintl.so</seg>
<seg>/usr/lib/gettext, /usr/share/doc/gettext-&gettext-version;,
/usr/share/gettext, and /usr/share/gettext-0.19.8</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="autopoint">
<term><command>autopoint</command></term>
<listitem>
<para>Copies standard Gettext infrastructure files into a source
package</para>
<indexterm zone="ch-system-gettext autopoint">
<primary sortas="b-autopoint">autopoint</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="envsubst">
<term><command>envsubst</command></term>
<listitem>
<para>Substitutes environment variables in shell format strings</para>
<indexterm zone="ch-system-gettext envsubst">
<primary sortas="b-envsubst">envsubst</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gettext">
<term><command>gettext</command></term>
<listitem>
<para>Translates a natural language message into the user's language
by looking up the translation in a message catalog</para>
<indexterm zone="ch-system-gettext gettext">
<primary sortas="b-gettext">gettext</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gettext.sh">
<term><command>gettext.sh</command></term>
<listitem>
<para>Primarily serves as a shell function library for gettext</para>
<indexterm zone="ch-system-gettext gettext.sh">
<primary sortas="b-gettext.sh">gettext.sh</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gettextize">
<term><command>gettextize</command></term>
<listitem>
<para>Copies all standard Gettext files into the given top-level
directory of a package to begin internationalizing it</para>
<indexterm zone="ch-system-gettext gettextize">
<primary sortas="b-gettextize">gettextize</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msgattrib">
<term><command>msgattrib</command></term>
<listitem>
<para>Filters the messages of a translation catalog according to their
attributes and manipulates the attributes</para>
<indexterm zone="ch-system-gettext msgattrib">
<primary sortas="b-msgattrib">msgattrib</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msgcat">
<term><command>msgcat</command></term>
<listitem>
<para>Concatenates and merges the given
<filename class="extension">.po</filename> files</para>
<indexterm zone="ch-system-gettext msgcat">
<primary sortas="b-msgcat">msgcat</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msgcmp">
<term><command>msgcmp</command></term>
<listitem>
<para>Compares two <filename class="extension">.po</filename>
files to check that both contain the same set of msgid strings</para>
<indexterm zone="ch-system-gettext msgcmp">
<primary sortas="b-msgcmp">msgcmp</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msgcomm">
<term><command>msgcomm</command></term>
<listitem>
<para>Finds the messages that are common to the given
<filename class="extension">.po</filename> files</para>
<indexterm zone="ch-system-gettext msgcomm">
<primary sortas="b-msgcomm">msgcomm</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msgconv">
<term><command>msgconv</command></term>
<listitem>
<para>Converts a translation catalog to a different character
encoding</para>
<indexterm zone="ch-system-gettext msgconv">
<primary sortas="b-msgconv">msgconv</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msgen">
<term><command>msgen</command></term>
<listitem>
<para>Creates an English translation catalog</para>
<indexterm zone="ch-system-gettext msgen">
<primary sortas="b-msgen">msgen</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msgexec">
<term><command>msgexec</command></term>
<listitem>
<para>Applies a command to all translations of a translation
catalog</para>
<indexterm zone="ch-system-gettext msgexec">
<primary sortas="b-msgexec">msgexec</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msgfilter">
<term><command>msgfilter</command></term>
<listitem>
<para>Applies a filter to all translations of a translation
catalog</para>
<indexterm zone="ch-system-gettext msgfilter">
<primary sortas="b-msgfilter">msgfilter</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msgfmt">
<term><command>msgfmt</command></term>
<listitem>
<para>Generates a binary message catalog from a translation
catalog</para>
<indexterm zone="ch-system-gettext msgfmt">
<primary sortas="b-msgfmt">msgfmt</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msggrep">
<term><command>msggrep</command></term>
<listitem>
<para>Extracts all messages of a translation catalog that match a
given pattern or belong to some given source files</para>
<indexterm zone="ch-system-gettext msggrep">
<primary sortas="b-msggrep">msggrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msginit">
<term><command>msginit</command></term>
<listitem>
<para>Creates a new <filename class="extension">.po</filename> file,
initializing the meta information with values from the user's
environment</para>
<indexterm zone="ch-system-gettext msginit">
<primary sortas="b-msginit">msginit</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msgmerge">
<term><command>msgmerge</command></term>
<listitem>
<para>Combines two raw translations into a single file</para>
<indexterm zone="ch-system-gettext msgmerge">
<primary sortas="b-msgmerge">msgmerge</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msgunfmt">
<term><command>msgunfmt</command></term>
<listitem>
<para>Decompiles a binary message catalog into raw translation
text</para>
<indexterm zone="ch-system-gettext msgunfmt">
<primary sortas="b-msgunfmt">msgunfmt</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="msguniq">
<term><command>msguniq</command></term>
<listitem>
<para>Unifies duplicate translations in a translation catalog</para>
<indexterm zone="ch-system-gettext msguniq">
<primary sortas="b-msguniq">msguniq</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="ngettext">
<term><command>ngettext</command></term>
<listitem>
<para>Displays native language translations of a textual message whose
grammatical form depends on a number</para>
<indexterm zone="ch-system-gettext ngettext">
<primary sortas="b-ngettext">ngettext</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="recode-sr-latin">
<term><command>recode-sr-latin</command></term>
<listitem>
<para>Recodes Serbian text from Cyrillic to Latin script</para>
<indexterm zone="ch-system-gettext recode-sr-latin">
<primary sortas="b-recode-sr-latin">recode-sr-latin</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xgettext">
<term><command>xgettext</command></term>
<listitem>
<para>Extracts the translatable message lines from the given source
files to make the first translation template</para>
<indexterm zone="ch-system-gettext xgettext">
<primary sortas="b-xgettext">xgettext</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libasprintf">
<term><filename class="libraryfile">libasprintf</filename></term>
<listitem>
<para>defines the <emphasis>autosprintf</emphasis> class, which makes
C formatted output routines usable in C++ programs, for use with the
<emphasis>&lt;string&gt;</emphasis> strings and the
<emphasis>&lt;iostream&gt;</emphasis> streams</para>
<indexterm zone="ch-system-gettext libasprintf">
<primary sortas="c-libasprintf">libasprintf</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libgettextlib">
<term><filename class="libraryfile">libgettextlib</filename></term>
<listitem>
<para>a private library containing common routines used by the
various Gettext programs; these are not intended for general use</para>
<indexterm zone="ch-system-gettext libgettextlib">
<primary sortas="c-libgettextlib">libgettextlib</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libgettextpo">
<term><filename class="libraryfile">libgettextpo</filename></term>
<listitem>
<para>Used to write specialized programs that process
<filename class="extension">.po</filename> files; this library is
used when the standard applications shipped with Gettext (such as
<command>msgcomm</command>, <command>msgcmp</command>,
<command>msgattrib</command>, and <command>msgen</command>) will
not suffice</para>
<indexterm zone="ch-system-gettext libgettextpo">
<primary sortas="c-libgettextpo">libgettextpo</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libgettextsrc">
<term><filename class="libraryfile">libgettextsrc</filename></term>
<listitem>
<para>A private library containing common routines used by the
various Gettext programs; these are not intended for general use</para>
<indexterm zone="ch-system-gettext libgettextsrc">
<primary sortas="c-libgettextsrc">libgettextsrc</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libtextstyle">
<term><filename class="libraryfile">libtextstyle</filename></term>
<listitem>
<para>Text styling library</para>
<indexterm zone="ch-system-gettext libtextstyle">
<primary sortas="c-libtextstyle">libtextstyle</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="preloadable_libintl">
<term><filename class="libraryfile">preloadable_libintl</filename></term>
<listitem>
<para>A library, intended to be used by LD_PRELOAD that assists
<filename class="libraryfile">libintl</filename> in logging
untranslated messages</para>
<indexterm zone="ch-system-gettext preloadable_libintl">
<primary sortas="c-preloadable_libintl">preloadable_libintl</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-gettext" role="."/></para>
</sect2>

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-grep" role="wrap">
<sect1 id="ch-tools-grep" role="wrap">
<?dbhtml filename="grep.html"?>
<sect1info condition="script">
@ -16,22 +16,25 @@
<title>Grep-&grep-version;</title>
<indexterm zone="ch-system-grep">
<indexterm zone="ch-tools-grep">
<primary sortas="a-Grep">Grep</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Grep package contains programs for searching through files.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/grep.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&grep-ch6-sbu;</seg>
<seg>&grep-ch6-du;</seg>
<seg>&grep-ch5-sbu;</seg>
<seg>&grep-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -42,69 +45,25 @@
<para>Prepare Grep for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr --bindir=/bin</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--bindir=/bin</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 id="contents-grep" role="content">
<title>Contents of Grep</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<seglistitem>
<seg>egrep, fgrep, and grep</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="egrep">
<term><command>egrep</command></term>
<listitem>
<para>Prints lines matching an extended regular expression</para>
<indexterm zone="ch-system-grep egrep">
<primary sortas="b-egrep">egrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="fgrep">
<term><command>fgrep</command></term>
<listitem>
<para>Prints lines matching a list of fixed strings</para>
<indexterm zone="ch-system-grep fgrep">
<primary sortas="b-fgrep">fgrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grep">
<term><command>grep</command></term>
<listitem>
<para>Prints lines matching a basic regular expression</para>
<indexterm zone="ch-system-grep grep">
<primary sortas="b-grep">grep</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-grep" role="."/></para>
</sect2>

View File

@ -1,374 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-system-grub" role="wrap">
<?dbhtml filename="grub.html"?>
<sect1info condition="script">
<productname>grub</productname>
<productnumber>&grub-version;</productnumber>
<address>&grub-url;</address>
</sect1info>
<title>GRUB-&grub-version;</title>
<indexterm zone="ch-system-grub">
<primary sortas="a-Grub">GRUB</primary>
</indexterm>
<sect2 role="package">
<title/>
<para>The GRUB package contains the GRand Unified Bootloader.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&grub-ch6-sbu;</seg>
<seg>&grub-ch6-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of GRUB</title>
<para>Prepare GRUB for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--sbindir=/sbin \
--sysconfdir=/etc \
--disable-efiemu \
--disable-werror</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>--disable-werror</parameter></term>
<listitem>
<para>This allows the build to complete with warnings introduced
by more recent Flex versions.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-efiemu</parameter></term>
<listitem>
<para>This option minimizes what is built by disabling a feature and
testing programs not needed for LFS.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>This package does not come with a test suite.</para>
<para>Install the package:</para>
<screen><userinput remap="install">make install
mv -v /etc/bash_completion.d/grub /usr/share/bash-completion/completions</userinput></screen>
<para>Using GRUB to make your LFS system bootable will be discussed in
<xref linkend="ch-bootable-grub"/>.</para>
</sect2>
<sect2 id="contents-gRUB" role="content">
<title>Contents of GRUB</title>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed directories</segtitle>
<seglistitem>
<seg>grub-bios-setup, grub-editenv, grub-file, grub-fstest,
grub-glue-efi, grub-install, grub-kbdcomp, grub-macbless,
grub-menulst2cfg, grub-mkconfig,
grub-mkimage, grub-mklayout, grub-mknetdir,
grub-mkpasswd-pbkdf2, grub-mkrelpath, grub-mkrescue, grub-mkstandalone,
grub-ofpathname, grub-probe, grub-reboot, grub-render-label,
grub-script-check,
grub-set-default, grub-sparc64-setup, and grub-syslinux2cfg</seg>
<seg>/usr/lib/grub, /etc/grub.d, /usr/share/grub, and /boot/grub (when grub-install
is first run)</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="grub-bios-setup">
<term><command>grub-bios-setup</command></term>
<listitem>
<para>Is a helper program for grub-install</para>
<indexterm zone="ch-system-grub grub-bios-setup">
<primary sortas="b-grub-bios-setup">grub-bios-setup</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-editenv">
<term><command>grub-editenv</command></term>
<listitem>
<para>A tool to edit the environment block</para>
<indexterm zone="ch-system-grub grub-editenv">
<primary sortas="b-grub-editenv">grub-editenv</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-file">
<term><command>grub-file</command></term>
<listitem>
<para>Checks if FILE is of the specified type.</para>
<indexterm zone="ch-system-grub grub-file">
<primary sortas="b-grub-file">grub-file</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-fstest">
<term><command>grub-fstest</command></term>
<listitem>
<para>Tool to debug the filesystem driver</para>
<indexterm zone="ch-system-grub grub-fstest">
<primary sortas="b-grub-fstest">grub-fstest</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-glue-efi">
<term><command>grub-glue-efi</command></term>
<listitem>
<para>Processes ia32 and amd64 EFI images and glues them
according to Apple format.</para>
<indexterm zone="ch-system-grub grub-glue-efi">
<primary sortas="b-grub-glue-efi">grub-glue-efi</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-install">
<term><command>grub-install</command></term>
<listitem>
<para>Install GRUB on your drive</para>
<indexterm zone="ch-system-grub grub-install">
<primary sortas="b-grub-install">grub-install</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-kbdcomp">
<term><command>grub-kbdcomp</command></term>
<listitem>
<para>Script that converts an xkb layout into one recognized by
GRUB</para>
<indexterm zone="ch-system-grub grub-kbdcomp">
<primary sortas="b-grub-kbdcomp">grub-kbdcomp</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-macbless">
<term><command>grub-macbless</command></term>
<listitem>
<para>Mac-style bless on HFS or HFS+ files</para>
<indexterm zone="ch-system-grub grub-macbless">
<primary sortas="b-grub-macbless">grub-macbless</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-menulst2cfg">
<term><command>grub-menulst2cfg</command></term>
<listitem>
<para>Converts a GRUB Legacy <filename>menu.lst</filename>
into a <filename>grub.cfg</filename> for use with GRUB 2</para>
<indexterm zone="ch-system-grub grub-menulst2cfg">
<primary sortas="b-grub-menulst2cfg">grub-menulst2cfg</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mkconfig">
<term><command>grub-mkconfig</command></term>
<listitem>
<para>Generate a grub config file</para>
<indexterm zone="ch-system-grub grub-mkconfig">
<primary sortas="b-grub-mkconfig">grub-mkconfig</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mkimage">
<term><command>grub-mkimage</command></term>
<listitem>
<para>Make a bootable image of GRUB</para>
<indexterm zone="ch-system-grub grub-mkimage">
<primary sortas="b-grub-mkimage">grub-mkimage</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mklayout">
<term><command>grub-mklayout</command></term>
<listitem>
<para>Generates a GRUB keyboard layout file</para>
<indexterm zone="ch-system-grub grub-mklayout">
<primary sortas="b-grub-mklayout">grub-mklayout</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mknetdir">
<term><command>grub-mknetdir</command></term>
<listitem>
<para>Prepares a GRUB netboot directory</para>
<indexterm zone="ch-system-grub grub-mknetdir">
<primary sortas="b-grub-mknetdir">grub-mknetdir</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mkpasswd-pbkdf2">
<term><command>grub-mkpasswd-pbkdf2</command></term>
<listitem>
<para>Generates an encrypted PBKDF2 password for use in the boot
menu</para>
<indexterm zone="ch-system-grub grub-mkpasswd-pbkdf2">
<primary sortas="b-grub-mkpasswd-pbkdf2">grub-mkpasswd-pbkdf2</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mkrelpath">
<term><command>grub-mkrelpath</command></term>
<listitem>
<para>Makes a system pathname relative to its root</para>
<indexterm zone="ch-system-grub grub-mkrelpath">
<primary sortas="b-grub-mkrelpath">grub-mkrelpath</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mkrescue">
<term><command>grub-mkrescue</command></term>
<listitem>
<para>Make a bootable image of GRUB suitable for a floppy disk or CDROM/DVD</para>
<indexterm zone="ch-system-grub grub-mkrescue">
<primary sortas="b-grub-mkrescue">grub-mkrescue</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-mkstandalone">
<term><command>grub-mkstandalone</command></term>
<listitem>
<para>Generates a standalone image</para>
<indexterm zone="ch-system-grub grub-mkstandalone">
<primary sortas="b-grub-mkstandalone">grub-mkstandalone</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-ofpathname">
<term><command>grub-ofpathname</command></term>
<listitem>
<para>Is a helper program that prints the path of a GRUB device</para>
<indexterm zone="ch-system-grub grub-ofpathname">
<primary sortas="b-grub-ofpathname">grub-ofpathname</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-probe">
<term><command>grub-probe</command></term>
<listitem>
<para>Probe device information for a given path or device</para>
<indexterm zone="ch-system-grub grub-probe">
<primary sortas="b-grub-probe">grub-probe</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-reboot">
<term><command>grub-reboot</command></term>
<listitem>
<para>Sets the default boot entry for GRUB for the next boot only</para>
<indexterm zone="ch-system-grub grub-reboot">
<primary sortas="b-grub-reboot">grub-reboot</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-render-label">
<term><command>grub-render-label</command></term>
<listitem>
<para>Render Apple .disk_label for Apple Macs</para>
<indexterm zone="ch-system-grub grub-render-label">
<primary sortas="b-grub-render-label">grub-render-label</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-script-check">
<term><command>grub-script-check</command></term>
<listitem>
<para>Checks GRUB configuration script for syntax errors</para>
<indexterm zone="ch-system-grub grub-script-check">
<primary sortas="b-grub-script-check">grub-script-check</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-set-default">
<term><command>grub-set-default</command></term>
<listitem>
<para>Sets the default boot entry for GRUB</para>
<indexterm zone="ch-system-grub grub-set-default">
<primary sortas="b-grub-set-default">grub-set-default</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-sparc64-setup">
<term><command>grub-sparc64-setup</command></term>
<listitem>
<para>Is a helper program for grub-setup</para>
<indexterm zone="ch-system-grub grub-sparc64-setup">
<primary sortas="b-grub-sparc64-setup">grub-setup</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="grub-syslinux2cfg">
<term><command>grub-syslinux2cfg</command></term>
<listitem>
<para>Transform a syslinux config file into grub.cfg format</para>
<indexterm zone="ch-system-grub grub-syslinux2cfg">
<primary sortas="b-grub-syslinux2cfg">grub-syslinux2cfg</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-gzip" role="wrap">
<sect1 id="ch-tools-gzip" role="wrap">
<?dbhtml filename="gzip.html"?>
<sect1info condition="script">
@ -16,23 +16,25 @@
<title>Gzip-&gzip-version;</title>
<indexterm zone="ch-system-gzip">
<indexterm zone="ch-tools-gzip">
<primary sortas="a-Gzip">Gzip</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Gzip package contains programs for compressing and decompressing
files.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/gzip.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&gzip-ch6-sbu;</seg>
<seg>&gzip-ch6-du;</seg>
<seg>&gzip-ch5-sbu;</seg>
<seg>&gzip-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -43,193 +45,27 @@
<para>Prepare Gzip for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr --host=$LFS_TGT</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Two tests are known to fail in the LFS environment:
help-version and zmore.</para>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
<para>Move a program that needs to be on the root filesystem:</para>
<para>Move the excutable to its final expected location:</para>
<screen><userinput remap="install">mv -v /usr/bin/gzip /bin</userinput></screen>
<screen><userinput remap="install">mv -v $LFS/usr/bin/gzip $LFS/bin</userinput></screen>
</sect2>
<sect2 id="contents-gzip" role="content">
<title>Contents of Gzip</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<seglistitem>
<seg>gunzip, gzexe, gzip, uncompress (hard link with gunzip), zcat, zcmp,
zdiff, zegrep, zfgrep, zforce, zgrep, zless, zmore, and znew</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="gunzip">
<term><command>gunzip</command></term>
<listitem>
<para>Decompresses gzipped files</para>
<indexterm zone="ch-system-gzip gunzip">
<primary sortas="b-gunzip">gunzip</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gzexe">
<term><command>gzexe</command></term>
<listitem>
<para>Creates self-decompressing executable files</para>
<indexterm zone="ch-system-gzip gzexe">
<primary sortas="b-gzexe">gzexe</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="gzip">
<term><command>gzip</command></term>
<listitem>
<para>Compresses the given files using Lempel-Ziv (LZ77) coding</para>
<indexterm zone="ch-system-gzip gzip">
<primary sortas="b-gzip">gzip</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="uncompress">
<term><command>uncompress</command></term>
<listitem>
<para>Decompresses compressed files</para>
<indexterm zone="ch-system-gzip uncompress">
<primary sortas="b-uncompress">uncompress</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="zcat">
<term><command>zcat</command></term>
<listitem>
<para>Decompresses the given gzipped files to standard output</para>
<indexterm zone="ch-system-gzip zcat">
<primary sortas="b-zcat">zcat</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="zcmp">
<term><command>zcmp</command></term>
<listitem>
<para>Runs <command>cmp</command> on gzipped files</para>
<indexterm zone="ch-system-gzip zcmp">
<primary sortas="b-zcmp">zcmp</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="zdiff">
<term><command>zdiff</command></term>
<listitem>
<para>Runs <command>diff</command> on gzipped files</para>
<indexterm zone="ch-system-gzip zdiff">
<primary sortas="b-zdiff">zdiff</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="zegrep">
<term><command>zegrep</command></term>
<listitem>
<para>Runs <command>egrep</command> on gzipped files</para>
<indexterm zone="ch-system-gzip zegrep">
<primary sortas="b-zegrep">zegrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="zfgrep">
<term><command>zfgrep</command></term>
<listitem>
<para>Runs <command>fgrep</command> on gzipped files</para>
<indexterm zone="ch-system-gzip zfgrep">
<primary sortas="b-zfgrep">zfgrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="zforce">
<term><command>zforce</command></term>
<listitem>
<para>Forces a <filename class="extension">.gz</filename> extension on
all given files that are gzipped files, so that <command>gzip</command>
will not compress them again; this can be useful when file names were
truncated during a file transfer</para>
<indexterm zone="ch-system-gzip zforce">
<primary sortas="b-zforce">zforce</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="zgrep">
<term><command>zgrep</command></term>
<listitem>
<para>Runs <command>grep</command> on gzipped files</para>
<indexterm zone="ch-system-gzip zgrep">
<primary sortas="b-zgrep">zgrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="zless">
<term><command>zless</command></term>
<listitem>
<para>Runs <command>less</command> on gzipped files</para>
<indexterm zone="ch-system-gzip zless">
<primary sortas="b-zless">zless</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="zmore">
<term><command>zmore</command></term>
<listitem>
<para>Runs <command>more</command> on gzipped files</para>
<indexterm zone="ch-system-gzip zmore">
<primary sortas="b-zmore">zmore</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="znew">
<term><command>znew</command></term>
<listitem>
<para>Re-compresses files from <command>compress</command> format to
<command>gzip</command> format&mdash;<filename
class="extension">.Z</filename> to <filename
class="extension">.gz</filename></para>
<indexterm zone="ch-system-gzip znew">
<primary sortas="b-znew">znew</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-gzip" role="."/></para>
</sect2>

View File

@ -5,70 +5,25 @@
%general-entities;
]>
<sect1 id="ch-system-introduction">
<sect1 id="ch-tools-introduction">
<?dbhtml filename="introduction.html"?>
<title>Introduction</title>
<para>In this chapter, we enter the building site and start constructing the
LFS system in earnest. That is, we chroot into the temporary mini Linux system,
make a few final preparations, and then begin installing the packages.</para>
<para>The installation of this software is straightforward. Although in many
cases the installation instructions could be made shorter and more generic,
we have opted to provide the full instructions for every package to minimize
the possibilities for mistakes. The key to learning what makes a Linux system
work is to know what each package is used for and why you (or the system)
may need it.</para>
<para>We do not recommend using optimizations. They can make
a program run slightly faster, but they may also cause compilation
difficulties and problems when running the program. If a package refuses to
compile when using optimization, try to compile it without optimization and
see if that fixes the problem. Even if the package does compile when using
optimization, there is the risk it may have been compiled incorrectly because
of the complex interactions between the code and build tools. Also note that
the <option>-march</option> and <option>-mtune</option> options using values
not specified in the book have not been tested. This may cause problems with
the toolchain packages (Binutils, GCC and Glibc). The small potential gains
achieved in using compiler optimizations are often outweighed by the risks.
First-time builders of LFS are encouraged to build without custom
optimizations. The subsequent system will still run very fast and be stable
at the same time.</para>
<para>Before the installation instructions, each installation page provides
information about the package, including a concise description of what it
contains, approximately how long it will take to build, and how much disk
space is required during this building process. Following the installation
instructions, there is a list of programs and libraries (along with brief
descriptions of these) that the package installs.</para>
<note><para>The SBU values and required disk space includes
test suite data for all applicable packages in Chapter&nbsp;6.</para></note>
<sect2>
<title>About libraries</title>
<para>In general, the LFS editors discourage building and installing static
libraries. The original purpose for most static libraries has been made
obsolete in a modern Linux system. In addition linking a static library
into a program can be detrimental. If an update to the library is needed
to remove a security problem, all programs that use the static library will
need to be relinked to the new library. Since the use of static libraries
is not always obvious, the relevant programs (and the procedures needed to
do the linking) may not even be known.</para>
<para>In the procedures in Chapter&nbsp;6, we remove or disable installation of
most static libraries. Usually this is done by passing a
<option>--disable-static</option> option to <command>configure</command>.
In other cases, alternate means are needed. In a few cases, especially
glibc and gcc, the use of static libraries remains essential to the general
package building process. </para>
<para>For a more complete discussion of libraries, see the discussion
<ulink url="&blfs-root;/view/&short-version;/introduction/libraries.html">
Libraries: Static or shared?</ulink> in the BLFS book.</para>
</sect2>
<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</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>

115
chapter06/kernfs.xml Normal file
View File

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-kernfs">
<?dbhtml filename="kernfs.html"?>
<title>Preparing Virtual Kernel File Systems</title>
<indexterm zone="ch-tools-kernfs">
<primary sortas="e-/dev/">/dev/*</primary>
</indexterm>
<para>Various file systems exported by the kernel are used to communicate to
and from the kernel itself. These file systems are virtual in that no disk
space is used for them. The content of the file systems resides in
memory.</para>
<para>Begin by creating directories onto which the file systems will be
mounted:</para>
<screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen>
<sect2>
<title>Creating Initial Device Nodes</title>
<para>When the kernel boots the system, it requires the presence of a few
device nodes, in particular the <filename
class="devicefile">console</filename> and <filename
class="devicefile">null</filename> devices. The device nodes must be created
on the hard disk so that they are available before <command>udevd</command>
has been started, and additionally when Linux is started with
<parameter>init=/bin/bash</parameter>. Create the devices by running the
following commands:</para>
<screen><userinput>mknod -m 600 $LFS/dev/console c 5 1
mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
</sect2>
<sect2 id="ch-system-bindmount">
<title>Mounting and Populating /dev</title>
<para>The recommended method of populating the <filename
class="directory">/dev</filename> directory with devices is to mount a
virtual filesystem (such as <systemitem
class="filesystem">tmpfs</systemitem>) on the <filename
class="directory">/dev</filename> directory, and allow the devices to be
created dynamically on that virtual filesystem as they are detected or
accessed. Device creation is generally done during the boot process
by Udev. Since this new system does not yet have Udev and has not yet
been booted, it is necessary to mount and populate <filename
class="directory">/dev</filename> manually. This is accomplished by bind
mounting the host system's <filename class="directory">/dev</filename>
directory. A bind mount is a special type of mount that allows you to
create a mirror of a directory or mount point to some other location. Use
the following command to achieve this:</para>
<screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen>
</sect2>
<sect2 id="ch-system-kernfsmount">
<title>Mounting Virtual Kernel File Systems</title>
<para>Now mount the remaining virtual kernel filesystems:</para>
<screen><userinput>mount -v --bind /dev/pts $LFS/dev/pts
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
<variablelist>
<title>The meaning of the mount options for devpts:</title>
<varlistentry>
<term><parameter>gid=5</parameter></term>
<listitem>
<para>This ensures that all devpts-created device nodes are owned by
group ID 5. This is the ID we will use later on for the <systemitem
class="groupname">tty</systemitem> group. We use the group ID instead
of a name, since the host system might use a different ID for its
<systemitem class="groupname">tty</systemitem> group.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode=0620</parameter></term>
<listitem>
<para>This ensures that all devpts-created device nodes have mode 0620
(user readable and writable, group writable). Together with the
option above, this ensures that devpts will create device nodes that
meet the requirements of grantpt(), meaning the Glibc
<command>pt_chown</command> helper binary (which is not installed by
default) is not necessary.</para>
</listitem>
</varlistentry>
</variablelist>
<para>In some host systems, <filename>/dev/shm</filename> is a
symbolic link to <filename class="directory">/run/shm</filename>.
The /run tmpfs was mounted above so in this case only a
directory needs to be created.</para>
<screen><userinput>if [ -h $LFS/dev/shm ]; then
mkdir -pv $LFS/$(readlink $LFS/dev/shm)
fi</userinput></screen>
</sect2>
</sect1>

View File

@ -0,0 +1,114 @@
<?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-pass2" role="wrap">
<?dbhtml filename="gcc-libstdc++-pass2.html"?>
<sect1info condition="script">
<productname>gcc-libstdc++</productname>
<productnumber>&gcc-version;</productnumber>
<address>&gcc-url;</address>
</sect1info>
<title>Libstdc++ from GCC-&gcc-version;, Pass 2</title>
<indexterm zone="ch-tools-libstdcpp-pass2">
<primary sortas="a-GCC">GCC</primary>
<secondary>tools, libstdc++ pass 2</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>Again, when building <xref linkend="ch-tools-gcc-pass2"/>, we had to
defer the installation of the C++ standard library, because no suitable
compiler was available to compile it: we could not use the compiler
installed, because this compiler is a native
compiler, and should not be used outside of chroot without being at
risk of polluting the build with some host components.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<!-- TODO -->
<seglistitem>
<seg>&libstdcpp-ch5-sbu;</seg>
<seg>&libstdcpp-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Target Libstdc++</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 link which exists when building Libstdc++ in the gcc
tree:</para>
<screen><userinput remap="pre">ln -s gthr-posix.h libgcc/gthr-default.h</userinput></screen>
<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 \
CXXFLAGS="-g -O2 -D_GNU_SOURCE" \
--prefix=/usr \
--disable-multilib \
--disable-nls \
--disable-libstdcxx-pch</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>CXXFLAGS="-g -O2 -D_GNU_SOURCE"</parameter></term>
<listitem>
<para>Those flags are passed by the top level Makefile when doing
a full build of GCC.</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>
</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>

122
chapter06/libstdc++.xml Normal file
View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-libstdcpp-pass1" role="wrap">
<?dbhtml filename="gcc-libstdc++-pass1.html"?>
<sect1info condition="script">
<productname>gcc-libstdc++</productname>
<productnumber>&gcc-version;</productnumber>
<address>&gcc-url;</address>
</sect1info>
<title>Libstdc++ from GCC-&gcc-version;, Pass 1</title>
<indexterm zone="ch-tools-libstdcpp-pass1">
<primary sortas="a-GCC">GCC</primary>
<secondary>tools, libstdc++ pass 1</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 the target
directory.
</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&libstdcpp-ch5-sbu;</seg>
<seg>&libstdcpp-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Target Libstdc++</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 \
--build=$(../config.guess) \
--prefix=/usr \
--disable-multilib \
--disable-nls \
--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-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 DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gcc" role="."/></para>
</sect2>
</sect1>

207
chapter06/linux-headers.xml Normal file
View File

@ -0,0 +1,207 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-linux-headers" role="wrap">
<?dbhtml filename="linux-headers.html"?>
<sect1info condition="script">
<productname>linux-headers</productname>
<productnumber>&linux-version;</productnumber>
<address>&linux-url;</address>
</sect1info>
<title>Linux-&linux-version; API Headers</title>
<indexterm zone="ch-tools-linux-headers">
<primary sortas="a-Linux">Linux</primary>
<secondary>tools, API headers</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Linux API Headers (in linux-&linux-version;.tar.xz) expose the
kernel's API for use by Glibc.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&linux-headers-ch5-sbu;</seg>
<seg>&linux-headers-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Linux API Headers</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.
The recommended make target <quote>headers_install</quote> cannot be
used, because it requires <application>rsync</application>, which may not
be available. The headers are first placed in
<filename class="directory">./usr</filename>, then copied to the needed
location.</para>
<screen><userinput remap="make">make headers
find usr/include -name '.*' -delete
rm usr/include/Makefile
</userinput><userinput remap="install">cp -rv usr/include $LFS/usr</userinput></screen>
</sect2>
<sect2 id="contents-linux-headers" role="content">
<title>Contents of Linux API Headers</title>
<segmentedlist>
<segtitle>Installed headers</segtitle>
<segtitle>Installed directories</segtitle>
<seglistitem>
<seg>/usr/include/asm/*.h, /usr/include/asm-generic/*.h,
/usr/include/drm/*.h, /usr/include/linux/*.h, /usr/include/misc/*.h,
/usr/include/mtd/*.h, /usr/include/rdma/*.h, /usr/include/scsi/*.h,
/usr/include/sound/*.h, /usr/include/video/*.h,
and /usr/include/xen/*.h</seg>
<seg>/usr/include/asm, /usr/include/asm-generic, /usr/include/drm,
/usr/include/linux, /usr/include/misc, /usr/include/mtd,
/usr/include/rdma, /usr/include/scsi, /usr/include/sound,
/usr/include/video, and /usr/include/xen</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="asm">
<term><filename class="headerfile">/usr/include/asm/*.h</filename></term>
<listitem>
<para>The Linux API ASM Headers</para>
<indexterm zone="ch-tools-linux-headers asm">
<primary sortas="e-/usr/include/asm/*.h">/usr/include/asm/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="asm-generic">
<term><filename class="headerfile">/usr/include/asm-generic/*.h</filename></term>
<listitem>
<para>The Linux API ASM Generic Headers</para>
<indexterm zone="ch-tools-linux-headers asm-generic">
<primary sortas="e-/usr/include/asm-generic/*.h">/usr/include/asm-generic/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="drm">
<term><filename class="headerfile">/usr/include/drm/*.h</filename></term>
<listitem>
<para>The Linux API DRM Headers</para>
<indexterm zone="ch-tools-linux-headers drm">
<primary sortas="e-/usr/include/drm/*.h">/usr/include/drm/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="linux">
<term><filename class="headerfile">/usr/include/linux/*.h</filename></term>
<listitem>
<para>The Linux API Linux Headers</para>
<indexterm zone="ch-tools-linux-headers linux">
<primary sortas="e-/usr/include/linux/*.h">/usr/include/linux/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="misc">
<term><filename class="headerfile">/usr/include/misc/*.h</filename></term>
<listitem>
<para>The Linux API Miscellaneous Headers</para>
<indexterm zone="ch-tools-linux-headers misc">
<primary sortas="e-/usr/include/misc/*.h">/usr/include/misc/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="mtd">
<term><filename class="headerfile">/usr/include/mtd/*.h</filename></term>
<listitem>
<para>The Linux API MTD Headers</para>
<indexterm zone="ch-tools-linux-headers mtd">
<primary sortas="e-/usr/include/mtd/*.h">/usr/include/mtd/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="rdma">
<term><filename class="headerfile">/usr/include/rdma/*.h</filename></term>
<listitem>
<para>The Linux API RDMA Headers</para>
<indexterm zone="ch-tools-linux-headers rdma">
<primary sortas="e-/usr/include/rdma/*.h">/usr/include/rdma/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="scsi">
<term><filename class="headerfile">/usr/include/scsi/*.h</filename></term>
<listitem>
<para>The Linux API SCSI Headers</para>
<indexterm zone="ch-tools-linux-headers scsi">
<primary sortas="e-/usr/include/scsi/*.h">/usr/include/scsi/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="sound">
<term><filename class="headerfile">/usr/include/sound/*.h</filename></term>
<listitem>
<para>The Linux API Sound Headers</para>
<indexterm zone="ch-tools-linux-headers sound">
<primary sortas="e-/usr/include/sound/*.h">/usr/include/sound/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="video">
<term><filename class="headerfile">/usr/include/video/*.h</filename></term>
<listitem>
<para>The Linux API Video Headers</para>
<indexterm zone="ch-tools-linux-headers video">
<primary sortas="e-/usr/include/video/*.h">/usr/include/video/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xen">
<term><filename class="headerfile">/usr/include/xen/*.h</filename></term>
<listitem>
<para>The Linux API Xen Headers</para>
<indexterm zone="ch-tools-linux-headers xen">
<primary sortas="e-/usr/include/xen/*.h">/usr/include/xen/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-m4" role="wrap">
<sect1 id="ch-tools-m4" role="wrap">
<?dbhtml filename="m4.html"?>
<sect1info condition="script">
@ -16,22 +16,25 @@
<title>M4-&m4-version;</title>
<indexterm zone="ch-system-m4">
<indexterm zone="ch-tools-m4">
<primary sortas="a-M4">M4</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The M4 package contains a macro processor.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/m4.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&m4-ch6-sbu;</seg>
<seg>&m4-ch6-du;</seg>
<seg>&m4-ch5-sbu;</seg>
<seg>&m4-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -40,64 +43,31 @@
<sect2 role="installation">
<title>Installation of M4</title>
<para>First, make some fixes required by glibc-2.28:</para>
<para>First, make some fixes introduced 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=/usr</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 id="contents-m4" role="content">
<title>Contents of M4</title>
<segmentedlist>
<segtitle>Installed program</segtitle>
<seglistitem>
<seg>m4</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="m4">
<!-- Don't remove the extra space, it prevet a FOP warning. -->
<term><command>m4 </command></term>
<listitem>
<para>Copies the given files while expanding the macros that they
contain [These macros are either built-in or user-defined and can
take any number of arguments. Besides performing macro expansion,
<command>m4</command> has built-in functions for including named
files, running Unix commands, performing integer arithmetic,
manipulating text, recursion, etc. The <command>m4</command> program
can be used either as a front-end to a compiler or as a macro processor
in its own right.]</para>
<indexterm zone="ch-system-m4 m4">
<primary sortas="b-m4">m4</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-m4" role="."/></para>
</sect2>

View File

@ -4,8 +4,7 @@
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-system-make" role="wrap">
<sect1 id="ch-tools-make" role="wrap">
<?dbhtml filename="make.html"?>
<sect1info condition="script">
@ -16,22 +15,25 @@
<title>Make-&make-version;</title>
<indexterm zone="ch-system-make">
<indexterm zone="ch-tools-make">
<primary sortas="a-Make">Make</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Make package contains a program for compiling packages.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/make.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&make-ch6-sbu;</seg>
<seg>&make-ch6-du;</seg>
<seg>&make-ch5-sbu;</seg>
<seg>&make-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -39,60 +41,42 @@
<sect2 role="installation">
<title>Installation of Make</title>
<!--
<para>Again, 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=/usr</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--without-guile \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)</userinput></screen>
<variablelist>
<title>The meaning of the new configure option:</title>
<varlistentry>
<term><parameter>--without-guile</parameter></term>
<listitem>
<para>Although we are cross-compiling, configure tries to use
guile from the build host if it finds it. This makes compilation
fail, so this switch prevents using it.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>The test suite needs to know where supporting perl files are located.
We use an environment variable to accomplish this. To test the
results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<sect2 id="contents-make" role="content">
<title>Contents of Make</title>
<segmentedlist>
<segtitle>Installed program</segtitle>
<seglistitem>
<seg>make</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="make">
<term><command>make</command></term>
<listitem>
<para>Automatically determines which pieces of a package need to
be (re)compiled and then issues the relevant commands</para>
<indexterm zone="ch-system-make make">
<primary sortas="b-make">make</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-make" role="."/></para>
</sect2>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-ncurses" role="wrap">
<sect1 id="ch-tools-ncurses" role="wrap">
<?dbhtml filename="ncurses.html"?>
<sect1info condition="script">
@ -16,23 +16,25 @@
<title>Ncurses-&ncurses-version;</title>
<indexterm zone="ch-system-ncurses">
<indexterm zone="ch-tools-ncurses">
<primary sortas="a-Ncurses">Ncurses</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Ncurses package contains libraries for terminal-independent
handling of character screens.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/ncurses.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&ncurses-ch6-sbu;</seg>
<seg>&ncurses-ch6-du;</seg>
<seg>&ncurses-ch5-sbu;</seg>
<seg>&ncurses-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -41,23 +43,45 @@
<sect2 role="installation">
<title>Installation of Ncurses</title>
<para>Don't install a static library that is not handled by configure:</para>
<para>First, ensure that <command>gawk</command> is found first during configuration:</para>
<screen><userinput remap="pre">sed -i '/LIBTOOL_INSTALL/d' c++/Makefile.in</userinput></screen>
<screen><userinput remap="pre">sed -i s/mawk// configure</userinput></screen>
<para>Then, run the following commands to build the <quote>tic</quote>
program on the build host:</para>
<screen><userinput remap="pre">mkdir build
cd build
../configure
make -C include
make -C progs tic
cd ..</userinput></screen>
<para>Prepare Ncurses for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--mandir=/usr/share/man \
--with-shared \
--without-debug \
--without-normal \
--enable-pc-files \
--enable-widec</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(./config.guess) \
--mandir=/usr/share/man \
--with-shared \
--without-debug \
--without-ada \
--without-normal \
--enable-widec \
--enable-pc-files</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>--without-ada</parameter></term>
<listitem>
<para>This ensures that Ncurses does not build support for the Ada
compiler which may be present on the host but will not be available
once we enter the <command>chroot</command> environment.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--enable-widec</parameter></term>
<listitem>
@ -87,293 +111,46 @@
</para>
</listitem>
</varlistentry>
<!--
<varlistentry>
<term><parameter>- -disable-db-install</parameter></term>
<listitem>
<para>This switch disables building the terminfo database: it is not
needed at this stage, and if <command>tic</command> is too old,
it cannot compile recent databases.</para>
</listitem>
</varlistentry>
-->
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>This package has a test suite, but it can only be run after the
package has been installed. The tests reside in the
<filename class="directory">test/</filename> directory. See the
<filename>README</filename> file in that directory for further details.
</para>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<!-- TODO: check and document -->
<screen><userinput remap="install">make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install
ln -s libncursesw.so $LFS/usr/lib/libncurses.so</userinput></screen>
<para>Move the shared libraries to the
<filename class="directory">/lib</filename> directory, where they are
expected to reside:</para>
<screen><userinput remap="install">mv -v /usr/lib/libncursesw.so.6* /lib</userinput></screen>
<screen><userinput remap="install">mv -v $LFS/usr/lib/libncursesw.so.6* $LFS/lib</userinput></screen>
<para>Because the libraries have been moved, one symlink points to
a non-existent file. Recreate it:</para>
<screen><userinput remap="install">ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so</userinput></screen>
<screen><userinput remap="install">ln -sfv ../../lib/$(readlink $LFS/usr/lib/libncursesw.so) $LFS/usr/lib/libncursesw.so</userinput></screen>
<para>Many applications still expect the linker to be able to find
non-wide-character Ncurses libraries. Trick such applications into linking with
wide-character libraries by means of symlinks and linker scripts:</para>
<screen><userinput remap="install">for lib in ncurses form panel menu ; do
rm -vf /usr/lib/lib${lib}.so
echo "INPUT(-l${lib}w)" &gt; /usr/lib/lib${lib}.so
ln -sfv ${lib}w.pc /usr/lib/pkgconfig/${lib}.pc
done</userinput></screen>
<para>Finally, make sure that old applications that look for
<filename class="libraryfile">-lcurses</filename> at build time are still
buildable:</para>
<screen><userinput remap="install">rm -vf /usr/lib/libcursesw.so
echo "INPUT(-lncursesw)" &gt; /usr/lib/libcursesw.so
ln -sfv libncurses.so /usr/lib/libcurses.so</userinput></screen>
<para>If desired, install the Ncurses documentation:</para>
<screen><userinput remap="install">mkdir -v /usr/share/doc/ncurses-&ncurses-version;
cp -v -R doc/* /usr/share/doc/ncurses-&ncurses-version;</userinput></screen>
<note>
<para>The instructions above don't create non-wide-character Ncurses
libraries since no package installed by compiling from sources would link
against them at runtime. However, the only known binary-only
applications that link against non-wide-character Ncurses libraries
require version 5. If you must have such libraries because of some binary-only
application or to be compliant with LSB, build the package again with the
following commands:</para>
<screen role="nodump"><userinput>make distclean
./configure --prefix=/usr \
--with-shared \
--without-normal \
--without-debug \
--without-cxx-binding \
--with-abi-version=5
make sources libs
cp -av lib/lib*.so.5* /usr/lib</userinput></screen>
</note>
</sect2>
<sect2 id="contents-ncurses" role="content">
<title>Contents of Ncurses</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed libraries</segtitle>
<segtitle>Installed directories</segtitle>
<seglistitem>
<seg>
captoinfo (link to tic),
clear,
infocmp,
infotocap (link to tic),
ncursesw6-config,
reset (link to tset),
tabs,
tic,
toe,
tput, and
tset
</seg>
<seg>
libcursesw.so (symlink and linker script to libncursesw.so),
libformw.so,
libmenuw.so,
libncursesw.so,
libncurses++w.a,
libpanelw.so, and their non-wide-character counterparts without "w"
in the library names.</seg>
<seg>
/usr/share/tabset,
/usr/share/terminfo, and
/usr/share/doc/ncurses-&ncurses-version;
</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="captoinfo">
<term><command>captoinfo</command></term>
<listitem>
<para>Converts a termcap description into a terminfo description</para>
<indexterm zone="ch-system-ncurses captoinfo">
<primary sortas="b-captoinfo">captoinfo</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="clear">
<term><command>clear</command></term>
<listitem>
<para>Clears the screen, if possible</para>
<indexterm zone="ch-system-ncurses clear">
<primary sortas="b-clear">clear</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="infocmp">
<term><command>infocmp</command></term>
<listitem>
<para>Compares or prints out terminfo descriptions</para>
<indexterm zone="ch-system-ncurses infocmp">
<primary sortas="b-infocmp">infocmp</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="infotocap">
<term><command>infotocap</command></term>
<listitem>
<para>Converts a terminfo description into a termcap description</para>
<indexterm zone="ch-system-ncurses infotocap">
<primary sortas="b-infotocap">infotocap</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="ncursesw6-config">
<term><command>ncursesw6-config</command></term>
<listitem>
<para>Provides configuration information for ncurses</para>
<indexterm zone="ch-system-ncurses ncursesw6-config">
<primary sortas="b-ncursesw6-config">ncursesw6-config</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="reset">
<term><command>reset</command></term>
<listitem>
<para>Reinitializes a terminal to its default values</para>
<indexterm zone="ch-system-ncurses reset">
<primary sortas="b-reset">reset</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="tabs">
<term><command>tabs</command></term>
<listitem>
<para>Clears and sets tab stops on a terminal</para>
<indexterm zone="ch-system-ncurses tabs">
<primary sortas="b-tabs">tabs</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="tic">
<term><command>tic</command></term>
<listitem>
<para>The terminfo entry-description compiler that translates a
terminfo file from source format into the binary format needed for the
ncurses library routines [A terminfo file contains information on the
capabilities of a certain terminal.]</para>
<indexterm zone="ch-system-ncurses tic">
<primary sortas="b-tic">tic</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="toe">
<term><command>toe</command></term>
<listitem>
<para>Lists all available terminal types, giving the primary name and
description for each</para>
<indexterm zone="ch-system-ncurses toe">
<primary sortas="b-toe">toe</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="tput">
<term><command>tput</command></term>
<listitem>
<para>Makes the values of terminal-dependent capabilities available to
the shell; it can also be used to reset or initialize a terminal or
report its long name</para>
<indexterm zone="ch-system-ncurses tput">
<primary sortas="b-tput">tput</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="tset">
<term><command>tset</command></term>
<listitem>
<para>Can be used to initialize terminals</para>
<indexterm zone="ch-system-ncurses tset">
<primary sortas="b-tset">tset</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libcursesw">
<term><filename class="libraryfile">libcursesw</filename></term>
<listitem>
<para>A link to <filename>libncursesw</filename></para>
<indexterm zone="ch-system-ncurses libcursesw">
<primary sortas="c-libcursesw">libcursesw</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libncursesw">
<term><filename class="libraryfile">libncursesw</filename></term>
<listitem>
<para>Contains functions to display text in many complex ways on a
terminal screen; a good example of the use of these functions is the
menu displayed during the kernel's <command>make
menuconfig</command></para>
<indexterm zone="ch-system-ncurses libncursesw">
<primary sortas="c-libncursesw">libncursesw</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libformw">
<term><filename class="libraryfile">libformw</filename></term>
<listitem>
<para>Contains functions to implement forms</para>
<indexterm zone="ch-system-ncurses libformw">
<primary sortas="c-libformw">libformw</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libmenuw">
<term><filename class="libraryfile">libmenuw</filename></term>
<listitem>
<para>Contains functions to implement menus</para>
<indexterm zone="ch-system-ncurses libmenuw">
<primary sortas="c-libmenuw">libmenuw</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libpanelw">
<term><filename class="libraryfile">libpanelw</filename></term>
<listitem>
<para>Contains functions to implement panels</para>
<indexterm zone="ch-system-ncurses libpanelw">
<primary sortas="c-libpanelw">libpanelw</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-ncurses" role="."/></para>
</sect2>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-patch" role="wrap">
<sect1 id="ch-tools-patch" role="wrap">
<?dbhtml filename="patch.html"?>
<sect1info condition="script">
@ -16,24 +16,25 @@
<title>Patch-&patch-version;</title>
<indexterm zone="ch-system-patch">
<indexterm zone="ch-tools-patch">
<primary sortas="a-Patch">Patch</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Patch package contains a program for modifying or creating files
by applying a <quote>patch</quote> file typically created by the
<command>diff</command> program.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/patch.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&patch-ch6-sbu;</seg>
<seg>&patch-ch6-du;</seg>
<seg>&patch-ch5-sbu;</seg>
<seg>&patch-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -44,52 +45,25 @@
<para>Prepare Patch for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 id="contents-patch" role="content">
<title>Contents of Patch</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed program</segtitle>
<seglistitem>
<seg>patch</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="patch">
<term><command>patch</command></term>
<listitem>
<para>Modifies files according to a patch file [A patch file is
normally a difference listing created with the <command>diff</command>
program. By applying these differences to the original files,
<command>patch</command> creates the patched versions.]</para>
<indexterm zone="ch-system-patch patch">
<primary sortas="b-patch">patch</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-patch" role="."/></para>
</sect2>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-perl" role="wrap">
<sect1 id="ch-tools-perl" role="wrap">
<?dbhtml filename="perl.html"?>
<sect1info condition="script">
@ -16,23 +16,25 @@
<title>Perl-&perl-version;</title>
<indexterm zone="ch-system-perl">
<indexterm zone="ch-tools-perl">
<primary sortas="a-Perl">Perl</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Perl package contains the Practical Extraction and Report
Language.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/perl.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&perl-ch6-sbu;</seg>
<seg>&perl-ch6-du;</seg>
<seg>&perl-ch5-sbu;</seg>
<seg>&perl-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -41,481 +43,36 @@
<sect2 role="installation">
<title>Installation of Perl</title>
<para>First create a basic <filename>/etc/hosts</filename> file to be
referenced in one of Perl's configuration files as well as the optional
test suite:</para>
<para>Prepare Perl for compilation:</para>
<screen><userinput remap="pre">echo "127.0.0.1 localhost $(hostname)" &gt; /etc/hosts</userinput></screen>
<para>This version of Perl now builds the Compress::Raw::Zlib and
Compress::Raw::BZip2 modules. By
default Perl will use an internal copy of the sources for the build.
Issue the following command so that Perl will use the libraries
installed on the system:</para>
<screen><userinput remap="pre">export BUILD_ZLIB=False
export BUILD_BZIP2=0</userinput></screen>
<!--
<para>Apply a patch to allow the Errno.pm module and the h2ph
program to build correctly when building with GCC 5:</para>
<screen><userinput remap="pre">patch -Np1 -i ../&perl-gcc5-fixes-patch;</userinput></screen>
-->
<para>To have full control over the way Perl is set up, you can remove the
<quote>-des</quote> options from the following command and hand-pick the way
this package is built. Alternatively, use the command exactly as below to
use the defaults that Perl auto-detects:</para>
<screen><userinput remap="configure">sh Configure -des -Dprefix=/usr \
-Dvendorprefix=/usr \
-Dman1dir=/usr/share/man/man1 \
-Dman3dir=/usr/share/man/man3 \
-Dpager="/usr/bin/less -isR" \
-Duseshrplib \
-Dusethreads</userinput></screen>
<screen><userinput remap="configure">sh Configure -des -Dprefix=/usr</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<title>The meaning of the new Configure options:</title>
<varlistentry>
<term><parameter>-Dvendorprefix=/usr</parameter></term>
<term><parameter>-des</parameter></term>
<listitem>
<para>This ensures <command>perl</command> knows how to
tell packages where they should install their perl modules.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>-Dpager="/usr/bin/less -isR"</parameter></term>
<listitem>
<para>This ensures that <userinput>less</userinput> is used instead
of <userinput>more</userinput>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>-Dman1dir=/usr/share/man/man1
-Dman3dir=/usr/share/man/man3</parameter></term>
<listitem>
<para>Since Groff is not installed yet, <command>Configure</command>
thinks that we do not want man pages for Perl. Issuing these
parameters overrides this decision.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>-Duseshrplib</parameter></term>
<listitem>
<para>Build a shared libperl needed by some perl modules.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>-Dusethreads</parameter></term>
<listitem>
<para>Build perl with support for threads.</para>
<para>This is a combination of three options: -d uses defaults for
all items; -e ensures completion of all tasks; -s silences
non-essential output.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<para>Build the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results (approximately 11 SBU), issue:</para>
<screen><userinput remap="test">make test</userinput></screen>
<!--note><para>One test fails due to using the most recent version of gdbm.
</para></note-->
<para>Install the package and clean up:</para>
<screen><userinput remap="install">make install
unset BUILD_ZLIB BUILD_BZIP2</userinput></screen>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 id="contents-perl" role="content">
<title>Contents of Perl</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed libraries</segtitle>
<segtitle>Installed directory</segtitle>
<seglistitem>
<seg>corelist, cpan, enc2xs, encguess, h2ph, h2xs, instmodsh,
json_pp, libnetcfg, perl, perl&perl-version; (hard link to perl),
perlbug, perldoc, perlivp, perlthanks (hard link to perlbug), piconv,
pl2pm, pod2html, pod2man, pod2text, pod2usage, podchecker, podselect,
prove, ptar, ptardiff, ptargrep, shasum,
splain, xsubpp, and zipdetails</seg>
<seg>Many which cannot all be listed here</seg>
<seg>/usr/lib/perl5</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<!--
<varlistentry id="c2ph">
<term><command>c2ph</command></term>
<listitem>
<para>Dumps C structures as generated from
<command>cc -g -S</command></para>
<indexterm zone="ch-system-perl c2ph">
<primary sortas="b-c2ph">c2ph</primary>
</indexterm>
</listitem>
</varlistentry>
-->
<varlistentry id="corelist">
<term><command>corelist</command></term>
<listitem>
<para>A commandline frontend to Module::CoreList</para>
<indexterm zone="ch-system-perl corelist">
<primary sortas="b-corelist">corelist</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="cpan">
<term><command>cpan</command></term>
<listitem>
<para>Interact with the Comprehensive Perl Archive Network (CPAN)
from the command line</para>
<indexterm zone="ch-system-perl cpan">
<primary sortas="b-cpan">cpan</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="enc2xs">
<term><command>enc2xs</command></term>
<listitem>
<para>Builds a Perl extension for the Encode module from either
Unicode Character Mappings or Tcl Encoding Files</para>
<indexterm zone="ch-system-perl enc2xs">
<primary sortas="b-enc2xs">enc2xs</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="encguess">
<term><command>encguess</command></term>
<listitem>
<para>Guess the encoding type of one or several files</para>
<indexterm zone="ch-system-perl encguess">
<primary sortas="b-encguess">encguess</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="h2ph">
<term><command>h2ph</command></term>
<listitem>
<para>Converts <filename class="extension">.h</filename> C header
files to <filename class="extension">.ph</filename> Perl header
files</para>
<indexterm zone="ch-system-perl h2ph">
<primary sortas="b-h2ph">h2ph</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="h2xs">
<term><command>h2xs</command></term>
<listitem>
<para>Converts <filename class="extension">.h</filename> C header
files to Perl extensions</para>
<indexterm zone="ch-system-perl h2xs">
<primary sortas="b-h2xs">h2xs</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="instmodsh">
<term><command>instmodsh</command></term>
<listitem>
<para>Shell script for examining installed Perl modules,
and can create a tarball from an installed module</para>
<indexterm zone="ch-system-perl instmodsh">
<primary sortas="b-instmodsh">instmodsh</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="json_pp">
<term><command>json_pp</command></term>
<listitem>
<para>Converts data between certain input and output formats</para>
<indexterm zone="ch-system-perl json_pp">
<primary sortas="b-json_pp">json_pp</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libnetcfg">
<term><command>libnetcfg</command></term>
<listitem>
<para>Can be used to configure the
<filename class="libraryfile">libnet</filename> Perl module</para>
<indexterm zone="ch-system-perl libnetcfg">
<primary sortas="b-libnetcfg">libnetcfg</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="perl">
<term><command>perl</command></term>
<listitem>
<para>Combines some of the best features of C, <command>sed</command>,
<command>awk</command> and <command>sh</command> into a single
swiss-army language</para>
<indexterm zone="ch-system-perl perl">
<primary sortas="b-perl">perl</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="perl-version">
<term><command>perl&perl-version;</command></term>
<listitem>
<para>A hard link to <command>perl</command></para>
<indexterm zone="ch-system-perl perl-version">
<primary sortas="b-perl&perl-version;">perl&perl-version;</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="perlbug">
<term><command>perlbug</command></term>
<listitem>
<para>Used to generate bug reports about Perl, or the modules that come
with it, and mail them</para>
<indexterm zone="ch-system-perl perlbug">
<primary sortas="b-perlbug">perlbug</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="perldoc">
<term><command>perldoc</command></term>
<listitem>
<para>Displays a piece of documentation in pod format that is embedded
in the Perl installation tree or in a Perl script</para>
<indexterm zone="ch-system-perl perldoc">
<primary sortas="b-perldoc">perldoc</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="perlivp">
<term><command>perlivp</command></term>
<listitem>
<para>The Perl Installation Verification Procedure; it can be used to
verify that Perl and its libraries have been installed
correctly</para>
<indexterm zone="ch-system-perl perlivp">
<primary sortas="b-perlivp">perlivp</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="perlthanks">
<term><command>perlthanks</command></term>
<listitem>
<para>Used to generate thank you messages to mail to the Perl
developers</para>
<indexterm zone="ch-system-perl perlthanks">
<primary sortas="b-perlthanks">perlthanks</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="piconv">
<term><command>piconv</command></term>
<listitem>
<para>A Perl version of the character encoding converter
<command>iconv</command></para>
<indexterm zone="ch-system-perl piconv">
<primary sortas="b-piconv">piconv</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="pl2pm">
<term><command>pl2pm</command></term>
<listitem>
<para>A rough tool for converting Perl4
<filename class="extension">.pl</filename> files to Perl5
<filename class="extension">.pm</filename> modules</para>
<indexterm zone="ch-system-perl pl2pm">
<primary sortas="b-pl2pm">pl2pm</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="pod2html">
<term><command>pod2html</command></term>
<listitem>
<para>Converts files from pod format to HTML format</para>
<indexterm zone="ch-system-perl pod2html">
<primary sortas="b-pod2html">pod2html</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="pod2man">
<term><command>pod2man</command></term>
<listitem>
<para>Converts pod data to formatted *roff input</para>
<indexterm zone="ch-system-perl pod2man">
<primary sortas="b-pod2man">pod2man</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="pod2text">
<term><command>pod2text</command></term>
<listitem>
<para>Converts pod data to formatted ASCII text</para>
<indexterm zone="ch-system-perl pod2text">
<primary sortas="b-pod2text">pod2text</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="pod2usage">
<term><command>pod2usage</command></term>
<listitem>
<para>Prints usage messages from embedded pod docs in files</para>
<indexterm zone="ch-system-perl pod2usage">
<primary sortas="b-pod2usage">pod2usage</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="podchecker">
<term><command>podchecker</command></term>
<listitem>
<para>Checks the syntax of pod format documentation files</para>
<indexterm zone="ch-system-perl podchecker">
<primary sortas="b-podchecker">podchecker</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="podselect">
<term><command>podselect</command></term>
<listitem>
<para>Displays selected sections of pod documentation</para>
<indexterm zone="ch-system-perl podselect">
<primary sortas="b-podselect">podselect</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="prove">
<term><command>prove</command></term>
<listitem>
<para>Command line tool for running tests against the Test::Harness
module</para>
<indexterm zone="ch-system-perl prove">
<primary sortas="b-prove">prove</primary>
</indexterm>
</listitem>
</varlistentry>
<!--
<varlistentry id="pstruct">
<term><command>pstruct</command></term>
<listitem>
<para>Dumps C structures as generated from <command>cc -g -S</command>
stabs</para>
<indexterm zone="ch-system-perl pstruct">
<primary sortas="b-pstruct">pstruct</primary>
</indexterm>
</listitem>
</varlistentry>
-->
<varlistentry id="ptar">
<term><command>ptar</command></term>
<listitem>
<para>A <command>tar</command>-like program written in Perl</para>
<indexterm zone="ch-system-perl ptar">
<primary sortas="b-ptar">ptar</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="ptardiff">
<term><command>ptardiff</command></term>
<listitem>
<para>A Perl program that compares an extracted archive with an
unextracted one</para>
<indexterm zone="ch-system-perl ptardiff">
<primary sortas="b-ptardiff">ptardiff</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="ptargrep">
<term><command>ptargrep</command></term>
<listitem>
<para>A Perl program that applies pattern matching to the contents
of files in a tar archive</para>
<indexterm zone="ch-system-perl ptargrep">
<primary sortas="b-ptargrep">ptargrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="shasum">
<term><command>shasum</command></term>
<listitem>
<para>Prints or checks SHA checksums</para>
<indexterm zone="ch-system-perl shasum">
<primary sortas="b-shasum">shasum</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="splain">
<term><command>splain</command></term>
<listitem>
<para>Is used to force verbose warning diagnostics in Perl</para>
<indexterm zone="ch-system-perl splain">
<primary sortas="b-splain">splain</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xsubpp">
<term><command>xsubpp</command></term>
<listitem>
<para>Converts Perl XS code into C code</para>
<indexterm zone="ch-system-perl xsubpp">
<primary sortas="b-xsubpp">xsubpp</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="zipdetails">
<term><command>zipdetails</command></term>
<listitem>
<para>Displays details about the internal structure of a Zip file</para>
<indexterm zone="ch-system-perl zipdetails">
<primary sortas="b-zipdetails">zipdetails</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-perl" role="."/></para>
</sect2>

View File

@ -5,8 +5,8 @@
%general-entities;
]>
<sect1 id="ch-system-Python" role="wrap">
<?dbhtml filename="Python.html"?>
<sect1 id="ch-system-Python-temp" role="wrap">
<?dbhtml filename="Python-temp.html"?>
<sect1info condition="script">
<productname>Python</productname>
@ -16,66 +16,54 @@
<title>Python-&python-version;</title>
<indexterm zone="ch-system-Python">
<primary sortas="a-python">python</primary>
<indexterm zone="ch-system-Python-temp">
<primary sortas="a-Python">Python</primary>
<secondary>temporary</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Python 3 package contains the Python development environment. It
is useful for object-oriented programming, writing scripts, prototyping
large programs or developing entire applications.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/python.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&python-ch6-sbu;</seg>
<seg>&python-ch6-du;</seg>
<seg>&python-ch5-sbu;</seg>
<seg>&python-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Python 3</title>
<title>Installation of Python</title>
<note>
<para>There are two package files whose name starts with
<quote>python</quote>. The one to extract from is
<filename>Python-&python-version;.tar.xz</filename> (notice the
uppercase first letter).</para>
</note>
<para>Prepare Python for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--enable-shared \
--with-system-expat \
--with-system-ffi \
--with-ensurepip=yes</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr --without-ensurepip</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<title>The meaning of the configure option:</title>
<varlistentry>
<term><parameter>--with-system-expat</parameter></term>
<listitem>
<para>This switch enables linking against system version of
<application>Expat</application>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-system-ffi</parameter></term>
<listitem>
<para>This switch enables linking against system version of
<application>libffi</application>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-ensurepip=yes</parameter></term>
<listitem>
<para>This switch enables building <command>pip</command> and
<command>setuptools</command> packaging programs.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--without-ensurepip</parameter></term>
<listitem>
<para>This switch disables the Python package installer, which is not
needed at this stage.</para>
</listitem>
</varlistentry>
</variablelist>
@ -83,171 +71,18 @@
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue <command>make test</command>.
Some tests requiring network connection or additional packages are
skipped. The test named test_normalization fails because network
configuration is not completed yet. For more comprehensive results,
the test can be rerun when Python 3 is reinstalled in BLFS.</para>
<para>Install the package:</para>
<screen><userinput remap="install">make install
chmod -v 755 /usr/lib/libpython&python-minor;.so
chmod -v 755 /usr/lib/libpython3.so
ln -sfv pip&python-minor; /usr/bin/pip3</userinput></screen>
<variablelist>
<title>The meaning of the install commands:</title>
<!-- ====== Change 8m if Python minor version changes ======= -->
<varlistentry>
<term><command>chmod -v 755 /usr/lib/libpython3.{8.,}so</command></term>
<listitem>
<para>Fix permissions for libraries to be consistent with other
libraries.</para>
</listitem>
</varlistentry>
</variablelist>
<para>If desired, install the preformatted documentation:</para>
<screen><userinput remap="install">install -v -dm755 /usr/share/doc/python-&python-version;/html
tar --strip-components=1 \
--no-same-owner \
--no-same-permissions \
-C /usr/share/doc/python-&python-version;/html \
-xvf ../python-&python-version;-docs-html.tar.bz2</userinput></screen>
<variablelist>
<title>The meaning of the documentation install commands:</title>
<varlistentry>
<term><option>--no-same-owner</option> and <option>--no-same-permissions</option></term>
<listitem>
<para>Ensure the installed files have the correct ownership and
permissions. Without these options, using <application>tar</application>
will install the package files with the upstream creator's values.
</para>
</listitem>
</varlistentry>
</variablelist>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 id="contents-python" role="content">
<title>Contents of Python 3</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed Programs</segtitle>
<segtitle>Installed Library</segtitle>
<segtitle>Installed Directories</segtitle>
<seglistitem>
<seg>
2to3, idle3, pip3, pydoc3, python3, and python3-config
</seg>
<seg>
libpython&python-minor;.so and libpython3.so
</seg>
<seg>
/usr/include/python&python-minor;,
/usr/lib/python3, and
/usr/share/doc/python-&python-version;
</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="python-2to3">
<term><command>2to3</command></term>
<listitem>
<para>
is a <application>Python</application> program that reads
<application>Python 2.x</application> source code and applies a
series of fixes to transform it into valid
<application>Python 3.x</application> code.
</para>
<indexterm zone="ch-system-Python">
<primary sortas="b-2to3">2to3</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="idle3">
<term><command>idle3</command></term>
<listitem>
<para>
is a wrapper script that opens a <application>Python</application>
aware GUI editor. For this script to run, you must have installed
<application>Tk</application> before Python so that the Tkinter
Python module is built.
</para>
<indexterm zone="ch-system-Python">
<primary sortas="b-idle3">idle3</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="pip3">
<term><command>pip3</command></term>
<listitem>
<para>
The package installer for Python. You can use pip to install
packages from Python Package Index and other indexes.
</para>
<indexterm zone="ch-system-Python">
<primary sortas="b-pip3">pip3</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="pydoc3">
<term><command>pydoc3</command></term>
<listitem>
<para>
is the <application>Python</application> documentation tool.
</para>
<indexterm zone="ch-system-Python">
<primary sortas="b-pydoc3">pydoc3</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="python3">
<term><command>python3</command></term>
<listitem>
<para>
is an interpreted, interactive, object-oriented programming
language.
</para>
<indexterm zone="ch-system-Python">
<primary sortas="b-python3">python3</primary>
</indexterm>
</listitem>
</varlistentry>
<!--
<varlistentry id="pyvenv">
<term><command>pyvenv</command></term>
<listitem>
<para>
creates virtual <application>Python</application> environments in
one or more target directories.
</para>
<indexterm zone="ch-system-Python">
<primary sortas="b-pyvenv">pyvenv</primary>
</indexterm>
</listitem>
</varlistentry>
-->
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-python" role="."/></para>
</sect2>
</sect1>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-sed" role="wrap">
<sect1 id="ch-tools-sed" role="wrap">
<?dbhtml filename="sed.html"?>
<sect1info condition="script">
@ -16,22 +16,25 @@
<title>Sed-&sed-version;</title>
<indexterm zone="ch-system-sed">
<indexterm zone="ch-tools-sed">
<primary sortas="a-Sed">Sed</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Sed package contains a stream editor.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/sed.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&sed-ch6-sbu;</seg>
<seg>&sed-ch6-du;</seg>
<seg>&sed-ch5-sbu;</seg>
<seg>&sed-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -42,55 +45,25 @@
<para>Prepare Sed for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr --bindir=/bin</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--bindir=/bin</userinput></screen>
<para>Compile the package and generate the HTML documentation:</para>
<para>Compile the package:</para>
<screen><userinput remap="make">make
make html</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<para>Install the package:</para>
<screen><userinput remap="test">chown -Rv tester .
su tester -c "PATH=$PATH make check"</userinput></screen>
<para>Install the package and its documentation:</para>
<screen><userinput remap="install">make install
install -d -m755 /usr/share/doc/sed-&sed-version;
install -m644 doc/sed.html /usr/share/doc/sed-&sed-version;</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 id="contents-sed" role="content">
<title>Contents of Sed</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed program</segtitle>
<segtitle>Installed directory</segtitle>
<seglistitem>
<seg>sed</seg>
<seg>/usr/share/doc/sed-&sed-version;</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="sed">
<term><command>sed</command></term>
<listitem>
<para>Filters and transforms text files in a single pass</para>
<indexterm zone="ch-system-sed sed">
<primary sortas="b-sed">sed</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-sed" role="."/></para>
</sect2>

53
chapter06/stripping.xml Normal file
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-stripping">
<?dbhtml filename="stripping.html"?>
<title>Stripping</title>
<para>The steps in this section are optional, but if the LFS partition is
rather small, it is beneficial to learn that unnecessary items can be removed.
The executables and libraries built so far contain about 70 MB of unneeded
debugging symbols. Remove those symbols with:</para>
<screen><userinput>$LFS_TGT-strip --strip-debug $LFS/usr/lib/*
$LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/*</userinput></screen>
<para>These commands will skip a number of files, reporting that it does not
recognize their file format. Most of these are scripts instead of binaries.
Note that we use the <command>strip</command> program built in
<quote>Binutils pass 1</quote>, since it is the one that knows how to strip
our cross-compiled programs.</para>
<!-- Normally, the host "strip" could be used too, since it is actually the
same computer. But Some old versions of binutils may generate buggy crt1.o
and the like, because they do not know about recently introduced symbol
types. For more details,
see https://sourceware.org/bugzilla/show_bug.cgi?id=22875-->
<para>Take care <emphasis>not</emphasis> to use
<parameter>--strip-unneeded</parameter> on the libraries. The static
ones would be destroyed and the toolchain packages would need to be
built all over again.</para>
<para>To save more, remove the documentation:</para>
<screen><userinput>rm -rf $LFS/usr/{,share}/{info,man,doc}</userinput></screen>
<para>The libtool .la files are only useful when linking with static
libraries. They are unneeded, and potentially harmful, when using dynamic
shared libraries, specially when using also non-autotools build systems.
Remove those files now:</para>
<screen><userinput>find $LFS/usr/{lib,libexec} -name \*.la -delete</userinput></screen>
<para>At this point, you should have at least 3 GB of free space in
<envar>$LFS</envar> that can be used to build and install Glibc and Gcc in
the next phase. If you can build and install Glibc, you can build and install
the rest too.</para>
</sect1>

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-tar" role="wrap">
<sect1 id="ch-tools-tar" role="wrap">
<?dbhtml filename="tar.html"?>
<sect1info condition="script">
@ -16,22 +16,25 @@
<title>Tar-&tar-version;</title>
<indexterm zone="ch-system-tar">
<indexterm zone="ch-tools-tar">
<primary sortas="a-Tar">Tar</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Tar package contains an archiving program.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/tar.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&tar-ch6-sbu;</seg>
<seg>&tar-ch6-du;</seg>
<seg>&tar-ch5-sbu;</seg>
<seg>&tar-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -42,74 +45,26 @@
<para>Prepare Tar for compilation:</para>
<screen><userinput remap="configure">FORCE_UNSAFE_CONFIGURE=1 \
./configure --prefix=/usr \
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess) \
--bindir=/bin</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><envar>FORCE_UNSAFE_CONFIGURE=1</envar></term>
<listitem>
<para>This forces the test for <function>mknod</function> to be run
as root. It is generally considered dangerous to run this test as
the root user, but as it is being run on a system that has only been
partially built, overriding it is OK.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results (about 3 SBU), issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<!-- Seems to pass for version 1.31. Keeping as a comment just in case...
<para>One test, link mismatch, is known to fail.</para>
-->
<para>Install the package:</para>
<screen><userinput remap="install">make install
make -C doc install-html docdir=/usr/share/doc/tar-&tar-version;</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<sect2 id="contents-tar" role="content">
<title>Contents of Tar</title>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed directory</segtitle>
<seglistitem>
<seg>tar</seg>
<seg>/usr/share/doc/tar-&tar-version;</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="tar">
<term><command>tar</command></term>
<listitem>
<para>Creates, extracts files from, and lists the contents of archives,
also known as tarballs</para>
<indexterm zone="ch-system-tar tar">
<primary sortas="b-tar">tar</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-tar" role="."/></para>
</sect2>

191
chapter06/tcl.xml Normal file
View File

@ -0,0 +1,191 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
<!ENTITY tdbc-ver "1.1.1">
<!ENTITY itcl-ver "4.2.0">
]>
<sect1 id="ch-tools-tcl" role="wrap">
<?dbhtml filename="tcl.html"?>
<sect1info condition="script">
<productname>tcl</productname>
<productnumber>&tcl-version;</productnumber>
<address>&tcl-url;</address>
</sect1info>
<title>Tcl-&tcl-version;</title>
<indexterm zone="ch-tools-tcl">
<primary sortas="a-Tcl">Tcl</primary>
</indexterm>
<sect2 role="package">
<title/>
<para>The <application>Tcl</application> package contains the Tool Command Language,
a robust general-purpose scripting language. The <application>Expect</application> package
is written in the <application>Tcl</application> language.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&tcl-ch5-sbu;</seg>
<seg>&tcl-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Tcl</title>
<para>This package and the next two (Expect and DejaGNU) are
installed to support running the test suites for GCC and Binutils and other
packages. Installing three packages for testing purposes may seem
excessive, but it is very reassuring, if not essential, to know that the
most important tools are working properly. These packages are required
to run the test suites in <xref linkend="chapter-building-system"/>.</para>
<para>Note that the Tcl package used here is a minimal version needed
to run the LFS tests. For the full package, see the
<ulink url='&blfs-book;general/tcl.html'>BLFS Tcl procedures</ulink>.</para>
<para>Prepare Tcl for compilation:</para>
<screen><userinput remap="configure">SRCDIR=$(pwd)
cd unix
./configure --prefix=/usr \
--mandir=/usr/share/man \
$([ "$(uname -m)" = x86_64 ] &amp;&amp; echo --enable-64bit)</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>$([ "$(uname -m)" = x86_64 ] &amp;&amp; echo --enable-64bit)</parameter></term>
<listitem>
<para>The construct <parameter>$(&lt;shell command&gt;)</parameter>
is replaced by the output of the chell command. Here this output is
empty if running on a 32 bit machine, and is
<parameter>--enable-64bit</parameter> if running on a 64 bit machine.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>Build the package:</para>
<screen><userinput remap="make">make
sed -e "s|$SRCDIR/unix|/usr/lib|" \
-e "s|$SRCDIR|/usr/include|" \
-i tclConfig.sh
sed -e "s|$SRCDIR/unix/pkgs/tdbc&tdbc-ver;|/usr/lib/tdbc&tdbc-ver;|" \
-e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;/generic|/usr/include|" \
-e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;/library|/usr/lib/tcl8.6|" \
-e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;|/usr/include|" \
-i pkgs/tdbc&tdbc-ver;/tdbcConfig.sh
sed -e "s|$SRCDIR/unix/pkgs/itcl&itcl-ver;|/usr/lib/itcl&itcl-ver;|" \
-e "s|$SRCDIR/pkgs/itcl&itcl-ver;/generic|/usr/include|" \
-e "s|$SRCDIR/pkgs/itcl&itcl-ver;|/usr/include|" \
-i pkgs/itcl&itcl-ver;/itclConfig.sh
unset SRCDIR</userinput></screen>
<para>The various <quote>sed</quote> after the <quote>make</quote> command
remove references to the build directory from various configuration files,
and replaces them with the install directory. This is not mandatory
for the remaining of LFS, but may be needed in case a package built later
uses Tcl.</para>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>Make the installed library writable so debugging symbols can
be removed later:</para>
<screen><userinput remap="install">chmod -v u+w /usr/lib/libtcl&tcl-major-version;.so</userinput></screen>
<para>Install Tcl's headers. The next package, Expect, requires them
to build.</para>
<screen><userinput remap="install">make install-private-headers</userinput></screen>
<para>Now make a necessary symbolic link:</para>
<screen><userinput remap="install">ln -sfv tclsh&tcl-major-version; /usr/bin/tclsh</userinput></screen>
</sect2>
<sect2 id="contents-tcl" role="content">
<title>Contents of Tcl</title>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed library</segtitle>
<seglistitem>
<seg>tclsh (link to tclsh&tcl-major-version;) and tclsh&tcl-major-version;</seg>
<seg>libtcl&tcl-major-version;.so, libtclstub&tcl-major-version;.a</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="tclsh&tcl-major-version;">
<term><command>tclsh&tcl-major-version;</command></term>
<listitem>
<para>The Tcl command shell</para>
<indexterm zone="ch-tools-tcl tclsh&tcl-major-version;">
<primary sortas="b-tclsh&tcl-major-version;">tclsh&tcl-major-version;</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="tclsh">
<term><command>tclsh</command></term>
<listitem>
<para>A link to tclsh&tcl-major-version;</para>
<indexterm zone="ch-tools-tcl tclsh">
<primary sortas="b-tclsh">tclsh</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libtcl&tcl-major-version;.so">
<term><filename class="libraryfile">libtcl&tcl-major-version;.so</filename></term>
<listitem>
<para>The Tcl library</para>
<indexterm zone="ch-tools-tcl libtcl&tcl-major-version;.so">
<primary sortas="c-libtcl&tcl-major-version;.so">libtcl&tcl-major-version;.so</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libtclstub&tcl-major-version;.a">
<term><filename class="libraryfile">libtclstub&tcl-major-version;.a</filename></term>
<listitem>
<para>The Tcl Stub library</para>
<indexterm zone="ch-tools-tcl libtclstub&tcl-major-version;.a">
<primary sortas="c-libtclstub&tcl-major-version;.a">libtclstub&tcl-major-version;.a</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>

View File

@ -5,8 +5,8 @@
%general-entities;
]>
<sect1 id="ch-system-texinfo" role="wrap">
<?dbhtml filename="texinfo.html"?>
<sect1 id="ch-system-texinfo-temp" role="wrap">
<?dbhtml filename="texinfo-temp.html"?>
<sect1info condition="script">
<productname>texinfo</productname>
@ -16,23 +16,25 @@
<title>Texinfo-&texinfo-version;</title>
<indexterm zone="ch-system-texinfo">
<indexterm zone="ch-system-texinfo-temp">
<primary sortas="a-Texinfo">Texinfo</primary>
<secondary>temporary</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Texinfo package contains programs for reading, writing, and
converting info pages.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/texinfo.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&texinfo-ch6-sbu;</seg>
<seg>&texinfo-ch6-du;</seg>
<seg>&texinfo-ch5-sbu;</seg>
<seg>&texinfo-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -43,194 +45,29 @@
<para>Prepare Texinfo for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr --disable-static</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--disable-static</parameter></term>
<listitem>
<para>In this case, the top-level configure script will complain that
this is an unrecognized option, but the configure script for
XSParagraph recognizes it and uses it to disable installing a static
<filename class="libraryfile">XSParagraph.a</filename> to <filename
class="directory">/usr/lib/texinfo</filename>.</para>
</listitem>
</varlistentry>
</variablelist>
<note>
<para>As part of the configure process, a test is made that indicates an
error for TestXS_la-TestXS.lo. This is not relevant for LFS and should be
ignored.</para>
</note>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>Optionally, install the components belonging in a TeX
installation:</para>
<!-- FIXME: doesn't the TeX installation in BLFS overwrite files there? -->
<screen><userinput remap="install">make TEXMF=/usr/share/texmf install-tex</userinput></screen>
<variablelist>
<title>The meaning of the make parameter:</title>
<varlistentry>
<term><parameter>TEXMF=/usr/share/texmf</parameter></term>
<listitem>
<para>The <envar>TEXMF</envar> makefile variable holds the location
of the root of the TeX tree if, for example, a TeX package will be
installed later.</para>
</listitem>
</varlistentry>
</variablelist>
<para>The Info documentation system uses a plain text file to hold its list of
menu entries. The file is located at <filename>/usr/share/info/dir</filename>.
Unfortunately, due to occasional problems in the Makefiles of various packages,
it can sometimes get out of sync with the info pages installed on the system.
If the <filename>/usr/share/info/dir</filename> file ever needs to be
recreated, the following optional commands will accomplish the task:</para>
<screen role="nodump"><userinput>pushd /usr/share/info
rm -v dir
for f in *
do install-info $f dir 2&gt;/dev/null
done
popd</userinput></screen>
</sect2>
<sect2 id="contents-texinfo" role="content">
<title>Contents of Texinfo</title>
<sect2 role="content">
<title/>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed library</segtitle>
<segtitle>Installed directories</segtitle>
<seglistitem>
<seg>info, install-info, makeinfo (link to texi2any),
pdftexi2dvi, pod2texi, texi2any, texi2dvi, texi2pdf, and texindex</seg>
<seg>MiscXS.so, Parsetexi.so, and XSParagraph.so
(all in /usr/lib/texinfo)</seg>
<seg>/usr/share/texinfo and /usr/lib/texinfo</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="info">
<term><command>info</command></term>
<listitem>
<para>Used to read info pages which are similar to man pages, but
often go much deeper than just explaining all the available command
line options [For example, compare <command>man bison</command> and
<command>info bison</command>.]</para>
<indexterm zone="ch-system-texinfo info">
<primary sortas="b-info">info</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="install-info">
<term><command>install-info</command></term>
<listitem>
<para>Used to install info pages; it updates entries in the
<command>info</command> index file</para>
<indexterm zone="ch-system-texinfo install-info">
<primary sortas="b-install-info">install-info</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="makeinfo">
<term><command>makeinfo</command></term>
<listitem>
<para>Translates the given Texinfo source documents into
info pages, plain text, or HTML</para>
<indexterm zone="ch-system-texinfo makeinfo">
<primary sortas="b-makeinfo">makeinfo</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="pdftexi2dvi">
<term><command>pdftexi2dvi</command></term>
<listitem>
<para>Used to format the given Texinfo document into a
Portable Document Format (PDF) file</para>
<indexterm zone="ch-system-texinfo pdftexi2dvi">
<primary sortas="b-pdftexi2dvi">pdftexi2dvi</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="pod2texi">
<term><command>pod2texi</command></term>
<listitem>
<para>Converts Pod to Texinfo format</para>
<indexterm zone="ch-system-texinfo pod2texi">
<primary sortas="b-pod2texi">pod2texi</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="texi2any">
<term><command>texi2any</command></term>
<listitem>
<para>Translate Texinfo source documentation to
various other formats</para>
<indexterm zone="ch-system-texinfo texi2any">
<primary sortas="b-texiany">texi2any</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="texi2dvi">
<term><command>texi2dvi</command></term>
<listitem>
<para>Used to format the given Texinfo document into a
device-independent file that can be printed</para>
<indexterm zone="ch-system-texinfo texi2dvi">
<primary sortas="b-texi2dvi">texi2dvi</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="texi2pdf">
<term><command>texi2pdf</command></term>
<listitem>
<para>Used to format the given Texinfo document into a
Portable Document Format (PDF) file</para>
<indexterm zone="ch-system-texinfo texi2pdf">
<primary sortas="b-texi2pdf">texi2pdf</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="texindex">
<term><command>texindex</command></term>
<listitem>
<para>Used to sort Texinfo index files</para>
<indexterm zone="ch-system-texinfo texindex">
<primary sortas="b-texindex">texindex</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<para>Details on this package are located in
<xref linkend="contents-texinfo" role="."/></para>
</sect2>

View File

@ -0,0 +1,335 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-toolchaintechnotes">
<?dbhtml filename="toolchaintechnotes.html"?>
<title>Toolchain Technical Notes</title>
<para>This section explains some of the rationale and technical details
behind the overall build method. It is not essential to immediately
understand everything in this section. Most of this information will be
clearer after performing an actual build. This section can be referred
to at any time during the process.</para>
<para>The overall goal of <xref linkend="chapter-temporary-tools"/> is to
produce a temporary area that contains a known-good set of tools that can be
isolated from the host system. By using <command>chroot</command>, the
commands in the remaining chapters will be contained within that environment,
ensuring a clean, trouble-free build of the target LFS system. The build
process has been designed to minimize the risks for new readers and to provide
the most educational value at the same time.</para>
<para>The build process is based on the process of
<emphasis>cross-compilation</emphasis>. Cross-compilation is normally used
for building a compiler and its toolchain for a machine different from
the one that is used for the build. This is not strictly needed for LFS,
since the machine where the new system will run is the same as the one
used for the build. But cross-compilation has the great advantage that
anything that is cross-compiled cannot depend on the host environment.</para>
<sect2 id="cross-compile" xreflabel="About Cross-Compilation">
<title>About Cross-Compilation</title>
<para>Cross-compilation involves some concepts that deserve a section on
their own. Although this section may be omitted in a first reading, it
is strongly suggested to come back to it later in order to get a full
grasp of the build process.</para>
<para>Let us first define some terms used in this context:</para>
<variablelist>
<varlistentry><term>build</term><listitem>
<para>is the machine where we build programs. Note that this machine
is referred to as the <quote>host</quote> in other
sections.</para></listitem>
</varlistentry>
<varlistentry><term>host</term><listitem>
<para>is the machine/system where the built programs will run. Note
that this use of <quote>host</quote> is not the same as in other
sections.</para></listitem>
</varlistentry>
<varlistentry><term>target</term><listitem>
<para>is only used for compilers. It is the machine the compiler
produces code for. It may be different from both build and
host.</para></listitem>
</varlistentry>
</variablelist>
<para>As an example, let us imagine the following scenario: we may have a
compiler on a slow machine only, let's call the machine A, and the compiler
ccA. We may have also a fast machine (B), but with no compiler, and we may
want to produce code for a another slow machine (C). Then, to build a
compiler for machine C, we would have three stages:</para>
<informaltable align="center">
<tgroup cols="5">
<colspec colnum="1" align="center"/>
<colspec colnum="2" align="center"/>
<colspec colnum="3" align="center"/>
<colspec colnum="4" align="center"/>
<colspec colnum="5" align="left"/>
<thead>
<row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
<entry>Target</entry><entry>Action</entry></row>
</thead>
<tbody>
<row>
<entry>1</entry><entry>A</entry><entry>A</entry><entry>B</entry>
<entry>build cross-compiler cc1 using ccA on machine A</entry>
</row>
<row>
<entry>2</entry><entry>A</entry><entry>B</entry><entry>B</entry>
<entry>build cross-compiler cc2 using cc1 on machine A</entry>
</row>
<row>
<entry>3</entry><entry>B</entry><entry>C</entry><entry>C</entry>
<entry>build compiler ccC using cc2 on machine B</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>Then, all the other programs needed by machine C can be compiled
using cc2 on the fast machine B. Note that unless B can run programs
produced for C, there is no way to test the built programs until machine
C itself is running. For example, for testing ccC, we may want to add a
fourth stage:</para>
<informaltable align="center">
<tgroup cols="5">
<colspec colnum="1" align="center"/>
<colspec colnum="2" align="center"/>
<colspec colnum="3" align="center"/>
<colspec colnum="4" align="center"/>
<colspec colnum="5" align="left"/>
<thead>
<row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
<entry>Target</entry><entry>Action</entry></row>
</thead>
<tbody>
<row>
<entry>4</entry><entry>C</entry><entry>C</entry><entry>C</entry>
<entry>rebuild and test ccC using itself on machine C</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>In the example above, only cc1 and cc2 are cross-compilers, that is,
they produce code for a machine different from the one they are run on.
The other compilers ccA and ccC produce code for the machine they are run
on. Such compilers are called <emphasis>native</emphasis> compilers.</para>
</sect2>
<sect2 id="lfs-cross">
<title>Implementation of Cross-Compilation for LFS</title>
<note>
<para>Almost all the build systems use names of the form
cpu-vendor-kernel-os referred to as the machine triplet. An astute
reader may wonder why a <quote>triplet</quote> refers to a four component
name. The reason is history: initially, three component names were enough
to designate unambiguously a machine, but with new machines and systems
appearing, that proved insufficient. The word <quote>triplet</quote>
remained. A simple way to determine your machine triplet is to run
the <command>config.guess</command>
script that comes with the source for many packages. Unpack the Binutils
sources and run the script: <userinput>./config.guess</userinput> and note
the output. For example, for a 32-bit Intel processor the
output will be <emphasis>i686-pc-linux-gnu</emphasis>. On a 64-bit
system it will be <emphasis>x86_64-pc-linux-gnu</emphasis>.</para>
<para>Also be aware of the name of the platform's dynamic linker, often
referred to as the dynamic loader (not to be confused with the standard
linker <command>ld</command> that is part of Binutils). The dynamic linker
provided by Glibc finds and loads the shared libraries needed by a
program, prepares the program to run, and then runs it. The name of the
dynamic linker for a 32-bit Intel machine will be <filename
class="libraryfile">ld-linux.so.2</filename> (<filename
class="libraryfile">ld-linux-x86-64.so.2</filename> for 64-bit systems). A
sure-fire way to determine the name of the dynamic linker is to inspect a
random binary from the host system by running: <userinput>readelf -l
&lt;name of binary&gt; | grep interpreter</userinput> and noting the
output. The authoritative reference covering all platforms is in the
<filename>shlib-versions</filename> file in the root of the Glibc source
tree.</para>
</note>
<para>In order to fake a cross compilation, the name of the host triplet
is slightly adjusted by changing the &quot;vendor&quot; field in the
<envar>LFS_TGT</envar> variable. We also use the
<parameter>--with-sysroot</parameter> when building the cross linker and
cross compiler, to tell them where to find the needed host files. This
ensures none of the other programs built in <xref
linkend="chapter-temporary-tools"/> can link to libraries on the build
machine. Only two stages are mandatory, and one more for tests:</para>
<informaltable align="center">
<tgroup cols="5">
<colspec colnum="1" align="center"/>
<colspec colnum="2" align="center"/>
<colspec colnum="3" align="center"/>
<colspec colnum="4" align="center"/>
<colspec colnum="5" align="left"/>
<thead>
<row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
<entry>Target</entry><entry>Action</entry></row>
</thead>
<tbody>
<row>
<entry>1</entry><entry>pc</entry><entry>pc</entry><entry>lfs</entry>
<entry>build cross-compiler cc1 using cc-pc on pc</entry>
</row>
<row>
<entry>2</entry><entry>pc</entry><entry>lfs</entry><entry>lfs</entry>
<entry>build compiler cc-lfs using cc1 on pc</entry>
</row>
<row>
<entry>3</entry><entry>lfs</entry><entry>lfs</entry><entry>lfs</entry>
<entry>rebuild and test cc-lfs using itself on lfs</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>In the above table, <quote>on pc</quote> means the commands are run
on a machine using the already installed distribution. <quote>On
lfs</quote> means the commands are run in a chrooted environment.</para>
<para>Now, there is more about cross-compiling: the C language is not
just a compiler, but also defines a standard library. In this book, the
GNU C library, named glibc, is used. This library must
be compiled for the lfs machine, that is, using the cross compiler cc1.
But the compiler itself uses an internal library implementing complex
instructions not available in the assembler instruction set. This
internal library is named libgcc, and must be linked to the glibc
library to be fully functional! Furthermore, the standard library for
C++ (libstdc++) also needs being linked to glibc. The solution
to this chicken and egg problem is to first build a degraded cc1+libgcc,
lacking some fuctionalities such as threads and exception handling, then
build glibc using this degraded compiler (glibc itself is not
degraded), then build libstdc++. But this last library will lack the
same functionalities as libgcc.</para>
<para>This is not the end of the story: the conclusion of the preceding
paragraph is that cc1 is unable to build a fully functional libstdc++, but
this is the only compiler available for building the C/C++ libraries
during stage 2! Of course, the compiler built during stage 2, cc-lfs,
would be able to build those libraries, but (i) the build system of
gcc does not know that it is usable on pc, and (ii) using it on pc
would be at risk of linking to the pc libraries, since cc-lfs is a native
compiler. So we have to build libstdc++ later, in chroot.</para>
</sect2>
<sect2 id="other-details">
<title>Other procedural details</title>
<para>The cross-compiler will be installed in a separate <filename
class="directory">$LFS/tools</filename> directory, since it will not
be part of the final system.</para>
<para>Binutils is installed first because the <command>configure</command>
runs of both GCC and Glibc perform various feature tests on the assembler
and linker to determine which software features to enable or disable. This
is more important than one might first realize. An incorrectly configured
GCC or Glibc can result in a subtly broken toolchain, where the impact of
such breakage might not show up until near the end of the build of an
entire distribution. A test suite failure will usually highlight this error
before too much additional work is performed.</para>
<para>Binutils installs its assembler and linker in two locations,
<filename class="directory">$LFS/tools/bin</filename> and <filename
class="directory">$LFS/tools/$LFS_TGT/bin</filename>. The tools in one
location are hard linked to the other. An important facet of the linker is
its library search order. Detailed information can be obtained from
<command>ld</command> by passing it the <parameter>--verbose</parameter>
flag. For example, <command>$LFS_TGT-ld --verbose | grep SEARCH</command>
will illustrate the current search paths and their order. It shows which
files are linked by <command>ld</command> by compiling a dummy program and
passing the <parameter>--verbose</parameter> switch to the linker. For
example,
<command>$LFS_TGT-gcc dummy.c -Wl,--verbose 2&gt;&amp;1 | grep succeeded</command>
will show all the files successfully opened during the linking.</para>
<para>The next package installed is GCC. An example of what can be
seen during its run of <command>configure</command> is:</para>
<screen><computeroutput>checking what assembler to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/as
checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ld</computeroutput></screen>
<para>This is important for the reasons mentioned above. It also
demonstrates that GCC's configure script does not search the PATH
directories to find which tools to use. However, during the actual
operation of <command>gcc</command> itself, the same search paths are not
necessarily used. To find out which standard linker <command>gcc</command>
will use, run: <command>$LFS_TGT-gcc -print-prog-name=ld</command>.</para>
<para>Detailed information can be obtained from <command>gcc</command> by
passing it the <parameter>-v</parameter> command line option while compiling
a dummy program. For example, <command>gcc -v dummy.c</command> will show
detailed information about the preprocessor, compilation, and assembly
stages, including <command>gcc</command>'s included search paths and their
order.</para>
<para>Next installed are sanitized Linux API headers. These allow the
standard C library (Glibc) to interface with features that the Linux
kernel will provide.</para>
<para>The next package installed is Glibc. The most important
considerations for building Glibc are the compiler, binary tools, and
kernel headers. The compiler is generally not an issue since Glibc will
always use the compiler relating to the <parameter>--host</parameter>
parameter passed to its configure script; e.g. in our case, the compiler
will be <command>$LFS_TGT-gcc</command>. The binary tools and kernel
headers can be a bit more complicated. Therefore, take no risks and use
the available configure switches to enforce the correct selections. After
the run of <command>configure</command>, check the contents of the
<filename>config.make</filename> file in the <filename
class="directory">build</filename> directory for all important details.
Note the use of <parameter>CC="$LFS_TGT-gcc"</parameter> (with
<envar>$LFS_TGT</envar> expanded) to control which binary tools are used
and the use of the <parameter>-nostdinc</parameter> and
<parameter>-isystem</parameter> flags to control the compiler's include
search path. These items highlight an important aspect of the Glibc
package&mdash;it is very self-sufficient in terms of its build machinery
and generally does not rely on toolchain defaults.</para>
<para>As said above, the standard C++ library is compiled next, followed
by all the programs that need themselves to be built. The install step
uses the <envar>DESTDIR</envar> variable to have the programs land into
the LFS filesystem.</para>
<para>Then the native lfs compiler is built. First Binutils Pass 2, with
the same <envar>DESTDIR</envar> install as the other programs, then the
second pass of GCC, omitting libstdc++ and other non-important libraries.
Due to some weird logic in GCC's configure script,
<envar>CC_FOR_TARGET</envar> ends up as <command>cc</command> when host
is the same as target, but is different from build. This is why
<parameter>CC_FOR_TARGET=$LFS_TGT-gcc</parameter> is put explicitely into
the configure options.</para>
<para>Upon entering the chroot environment in <xref
linkend="chapter-building-system"/>, the first task is to install
libstdc++. Then temporary installations of programs needed for the proper
operation of the toolchain are performed. Programs needed for testing
other programs are also built. From this point onwards, the
core toolchain is self-contained and self-hosted. In the remainder of
the <xref linkend="chapter-building-system"/>, final versions of all the
packages needed for a fully functional system are built, tested and
installed.</para>
</sect2>
</sect1>

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@
%general-entities;
]>
<sect1 id="ch-system-xz" role="wrap">
<sect1 id="ch-tools-xz" role="wrap">
<?dbhtml filename="xz.html"?>
<sect1info condition="script">
@ -16,26 +16,25 @@
<title>Xz-&xz-version;</title>
<indexterm zone="ch-system-xz">
<indexterm zone="ch-tools-xz">
<primary sortas="a-xz">Xz</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Xz package contains programs for compressing and decompressing
files. It provides capabilities for the lzma and the newer xz compression
formats. Compressing text files with <command>xz</command> yields a better
compression percentage than with the traditional <command>gzip</command> or
<command>bzip2</command> commands.</para>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/xz.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&xz-ch6-sbu;</seg>
<seg>&xz-ch6-du;</seg>
<seg>&xz-ch5-sbu;</seg>
<seg>&xz-ch5-du;</seg>
</seglistitem>
</segmentedlist>
@ -44,320 +43,34 @@
<sect2 role="installation">
<title>Installation of Xz</title>
<para>Prepare Xz for compilation with:</para>
<para>Prepare Xz for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--disable-static \
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess) \
--disable-static \
--docdir=/usr/share/doc/xz-&xz-version;</userinput></screen>
<para>Compile the package:</para>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<para>Install the package:</para>
<screen><userinput remap="test">make check</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
<para>Install the package and make sure that all essential files are in the
correct directory:</para>
<para>Make sure that all essential files are in the correct directory:</para>
<screen><userinput remap="install">make install
mv -v /usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} /bin
mv -v /usr/lib/liblzma.so.* /lib
ln -svf ../../lib/$(readlink /usr/lib/liblzma.so) /usr/lib/liblzma.so</userinput></screen>
<screen><userinput remap="install">mv -v $LFS/usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} $LFS/bin
mv -v $LFS/usr/lib/liblzma.so.* $LFS/lib
ln -svf ../../lib/$(readlink $LFS/usr/lib/liblzma.so) $LFS/usr/lib/liblzma.so</userinput></screen>
</sect2>
<sect2 id="contents-xz" role="content">
<title>Contents of Xz</title>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed libraries</segtitle>
<segtitle>Installed directories</segtitle>
<seglistitem>
<seg>
lzcat (link to xz),
lzcmp (link to xzdiff),
lzdiff (link to xzdiff),
lzegrep (link to xzgrep),
lzfgrep (link to xzgrep),
lzgrep (link to xzgrep),
lzless (link to xzless),
lzma (link to xz),
lzmadec,
lzmainfo,
lzmore (link to xzmore),
unlzma (link to xz),
unxz (link to xz),
xz,
xzcat (link to xz),
xzcmp (link to xzdiff),
xzdec,
xzdiff,
xzegrep (link to xzgrep),
xzfgrep (link to xzgrep),
xzgrep,
xzless, and
xzmore</seg>
<seg>
liblzma.so
</seg>
<seg>
/usr/include/lzma and
/usr/share/doc/xz-&xz-version;
</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="lzcat">
<term><command>lzcat</command></term>
<listitem>
<para>Decompresses to standard output</para>
<indexterm zone="ch-system-xz lzcat">
<primary sortas="b-lzcat">lzcat</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="lzcmp">
<term><command>lzcmp</command></term>
<listitem>
<para>Runs <command>cmp</command> on LZMA compressed files</para>
<indexterm zone="ch-system-xz lzcmp">
<primary sortas="b-lzcmp">lzcmp</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="lzdiff">
<term><command>lzdiff</command></term>
<listitem>
<para>Runs <command>diff</command> on LZMA compressed files</para>
<indexterm zone="ch-system-xz lzdiff">
<primary sortas="b-lzdiff">lzdiff</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="lzegrep">
<term><command>lzegrep</command></term>
<listitem>
<para>Runs <command>egrep</command> on LZMA compressed files</para>
<indexterm zone="ch-system-xz lzegrep">
<primary sortas="b-lzegrep">lzegrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="lzfgrep">
<term><command>lzfgrep</command></term>
<listitem>
<para>Runs <command>fgrep</command> on LZMA compressed files</para>
<indexterm zone="ch-system-xz lzfgrep">
<primary sortas="b-lzfgrep">lzfgrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="lzgrep">
<term><command>lzgrep</command></term>
<listitem>
<para>Runs <command>grep</command> on LZMA compressed files</para>
<indexterm zone="ch-system-xz lzgrep">
<primary sortas="b-lzgrep">lzgrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="lzless">
<term><command>lzless</command></term>
<listitem>
<para>Runs <command>less</command> on LZMA compressed files</para>
<indexterm zone="ch-system-xz lzless">
<primary sortas="b-lzless">lzless</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="lzma">
<term><command>lzma</command></term>
<listitem>
<para>Compresses or decompresses files using the LZMA format</para>
<indexterm zone="ch-system-xz lzma">
<primary sortas="b-lzma">lzma</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="lzmadec">
<term><command>lzmadec</command></term>
<listitem>
<para>A small and fast decoder for LZMA compressed files</para>
<indexterm zone="ch-system-xz lzmadec">
<primary sortas="b-lzmadec">lzmadec</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="lzmainfo">
<term><command>lzmainfo</command></term>
<listitem>
<para>Shows information stored in the LZMA compressed file header</para>
<indexterm zone="ch-system-xz lzmainfo">
<primary sortas="b-lzmainfo">lzmainfo</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="lzmore">
<term><command>lzmore</command></term>
<listitem>
<para>Runs <command>more</command> on LZMA compressed files</para>
<indexterm zone="ch-system-xz lzmore">
<primary sortas="b-lzmamore">lzmore</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="unlzma">
<term><command>unlzma</command></term>
<listitem>
<para>Decompresses files using the LZMA format</para>
<indexterm zone="ch-system-xz unlzma">
<primary sortas="b-unlzma">unlzma</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="unxz">
<term><command>unxz</command></term>
<listitem>
<para>Decompresses files using the XZ format</para>
<indexterm zone="ch-system-xz unxz">
<primary sortas="b-unxz">unxz</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xz">
<term><command>xz</command></term>
<listitem>
<para>Compresses or decompresses files using the XZ format</para>
<indexterm zone="ch-system-xz xz">
<primary sortas="b-xz">xz</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xzcat">
<term><command>xzcat</command></term>
<listitem>
<para>Decompresses to standard output</para>
<indexterm zone="ch-system-xz xzcat">
<primary sortas="b-xzcat">xzcat</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xzcmp">
<term><command>xzcmp</command></term>
<listitem>
<para>Runs <command>cmp</command> on XZ compressed files</para>
<indexterm zone="ch-system-xz xzcmp">
<primary sortas="b-xzcmp">xzcmp</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xzdec">
<term><command>xzdec</command></term>
<listitem>
<para>A small and fast decoder for XZ compressed files</para>
<indexterm zone="ch-system-xz xzdec">
<primary sortas="b-xzdec">xzdec</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xzdiff">
<term><command>xzdiff</command></term>
<listitem>
<para>Runs <command>diff</command> on XZ compressed files</para>
<indexterm zone="ch-system-xz xzdiff">
<primary sortas="b-xzdiff">xzdiff</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xzegrep">
<term><command>xzegrep</command></term>
<listitem>
<para>Runs <command>egrep</command> on XZ compressed files</para>
<indexterm zone="ch-system-xz xzegrep">
<primary sortas="b-xzegrep">xzegrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xzfgrep">
<term><command>xzfgrep</command></term>
<listitem>
<para>Runs <command>fgrep</command> on XZ compressed files</para>
<indexterm zone="ch-system-xz xzfgrep">
<primary sortas="b-xzfgrep">xzfgrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xzgrep">
<term><command>xzgrep</command></term>
<listitem>
<para>Runs <command>grep</command> on XZ compressed files</para>
<indexterm zone="ch-system-xz xzgrep">
<primary sortas="b-xzgrep">xzgrep</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xzless">
<term><command>xzless</command></term>
<listitem>
<para>Runs <command>less</command> on XZ compressed files</para>
<indexterm zone="ch-system-xz xzless">
<primary sortas="b-xzless">xzless</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xzmore">
<term><command>xzmore</command></term>
<listitem>
<para>Runs <command>more</command> on XZ compressed files</para>
<indexterm zone="ch-system-xz xzmore">
<primary sortas="b-xzmore">xzmore</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="liblzma">
<term><filename class="libraryfile">liblzma</filename></term>
<listitem>
<para>The library implementing lossless, block-sorting data
compression, using the Lempel-Ziv-Markov chain algorithm</para>
<indexterm zone="ch-system-xz liblzma">
<primary sortas="c-liblzma">liblzma</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
<sect2 role="content">
<title/>
<para>Details on this package are located in<!-- TODO
<xref linkend="contents-xz" role="."/> --></para>
</sect2>

96
chapter07/bash.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-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>Prepare Bash for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--build=$(support/config.guess) \
--host=$LFS_TGT \
--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>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
<para>Move the excutable to where it is expected to be:</para>
<screen><userinput remap="install">mv $LFS/usr/bin/bash $LFS/bin/bash</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 $LFS/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,156 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-binutils-pass1" role="wrap">
<?dbhtml filename="binutils-pass1.html"?>
<sect1info condition="script">
<productname>binutils-pass1</productname>
<productnumber>&binutils-version;</productnumber>
<address>&binutils-url;</address>
</sect1info>
<title>Binutils-&binutils-version; - Pass 1</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=$LFS/tools \
--with-sysroot=$LFS \
--target=$LFS_TGT \
--disable-nls \
--disable-werror</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--prefix=$LFS/tools</parameter></term>
<listitem>
<para>This tells the configure script to prepare to install the
Binutils programs in the <filename
class="directory">$LFS/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>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,94 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-binutils-pass2" role="wrap">
<?dbhtml filename="binutils-pass2.html"?>
<sect1info condition="script">
<productname>binutils-pass2</productname>
<productnumber>&binutils-version;</productnumber>
<address>&binutils-url;</address>
</sect1info>
<title>Binutils-&binutils-version; - Pass 2</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">../configure \
--prefix=/usr \
--build=$(../config.guess) \
--host=$LFS_TGT \
--disable-nls \
--enable-shared \
--disable-werror</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>--host=$LFS_TGT</parameter></term>
<listitem>
<para>This tells the configure script that we want to build
this pass of binutils for the $LFS_TGT machine, using our just
built cross-compiler. This prevents the linker from searching
through library directories on the host.</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 DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-binutils" role="."/></para>
</sect2>
</sect1>

82
chapter07/bison.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="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=/usr \
--docdir=/usr/share/doc/bison-&bison-version;</userinput></screen>
<variablelist>
<title>The meaning of the new configure option:</title>
<varlistentry>
<term><parameter>--docdir=/usr/share/doc/bison-&bison-version;</parameter></term>
<listitem>
<para>This tells the build system to install bison documentation
into a versioned directory.</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>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-bison" role="."/></para>
</sect2>
</sect1>

112
chapter07/bzip2.xml Normal file
View File

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-bzip2" role="wrap">
<?dbhtml filename="bzip2.html"?>
<sect1info condition="script">
<productname>bzip2</productname>
<productnumber>&bzip2-version;</productnumber>
<address>&bzip2-url;</address>
</sect1info>
<title>Bzip2-&bzip2-version;</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>Apply a patch that will install the documentation for this
package:</para>
<screen><userinput remap="pre">patch -Np1 -i ../&bzip2-docs-patch;</userinput></screen>
<para>The following command ensures installation of symbolic links are
relative:</para>
<screen><userinput remap="pre">sed -i 's@\(ln -s -f \)$(PREFIX)/bin/@\1@' Makefile</userinput></screen>
<para>Ensure the man pages are installed into the correct location:</para>
<screen><userinput remap="pre">sed -i "s@(PREFIX)/man@(PREFIX)/share/man@g" Makefile</userinput></screen>
<para>The Bzip2 package does not contain a <command>configure</command>
script. There are two <filename>Makefile</filename>, one for the shared
library, and the other for the static library. Since we need both, We
do the compilation in two stages. First the shared library:</para>
<screen><userinput remap="make">make CC=$LFS_TGT-gcc -f Makefile-libbz2_so
make clean</userinput></screen>
<variablelist>
<title>The meaning of the make parameter:</title>
<varlistentry>
<term><parameter>-f Makefile-libbz2_so</parameter></term>
<listitem>
<para>This will cause Bzip2 to be built using a different
<filename>Makefile</filename> file, in this case the
<filename>Makefile-libbz2_so</filename> file, which creates a dynamic
<filename class="libraryfile">libbz2.so</filename> library and links
the Bzip2 utilities against it.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile and test the package with:</para>
<screen><userinput remap="make">make CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make PREFIX=$LFS/usr install</userinput></screen>
<para>Install the shared <command>bzip2</command> binary into the
<filename class="directory">/bin</filename> directory, make some necessary
symbolic links, and clean up:</para>
<screen><userinput remap="install">cp -v bzip2-shared $LFS/bin/bzip2
cp -av libbz2.so* $LFS/lib
ln -sv ../../lib/libbz2.so.1.0 $LFS/usr/lib/libbz2.so
rm -v $LFS/usr/bin/{bunzip2,bzcat,bzip2}
ln -sv bzip2 $LFS/bin/bunzip2
ln -sv bzip2 $LFS/bin/bzcat</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,41 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-changingowner">
<?dbhtml filename="changingowner.html"?>
<title>Changing Ownership</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 whole directory hierarchy in <filename
class="directory">$LFS</filename>
is owned by the user <systemitem class="username">lfs</systemitem>, a user
that exists only on the host system. If the directories under <filename
class="directory">$LFS</filename> are kept as they are, the files are
owned by a user ID without a corresponding account. This is dangerous because
a user account created later could get this same user ID and would own all
the files under <filename class="directory">$LFS</filename>, 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/*</filename> directories to
user <systemitem class="username">root</systemitem> by running the following
command:</para>
<screen><userinput>chown -R root:root $LFS/{usr,lib,var,etc,bin,sbin,lib64,tools}</userinput></screen>
</sect1>

View File

@ -5,39 +5,25 @@
%general-entities;
]>
<chapter id="chapter-config" xreflabel="Chapter&nbsp;7">
<chapter id="chapter-chroot-temporary-tools" xreflabel="Chapter&nbsp;7">
<?dbhtml dir="chapter07"?>
<?dbhtml filename="chapter07.html"?>
<title>System Configuration</title>
<title>Entering Chroot and Building Additional Tools</title>
<!-- sysv -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.xml"/>
<!-- systemd -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introductiond.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="networkd.xml"/>
<!-- common -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udev.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="symlinks.xml"/>
<!-- sysv -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="network.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="usage.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="profile.xml"/>
<!-- systemd -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="clock.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="consoled.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="locale.xml"/>
<!-- common -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="inputrc.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="etcshells.xml"/>
<!-- systemd -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="systemd-custom.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kernfs.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chroot.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingdirs.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="createfiles.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++-pass2.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="gettext.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="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="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"/>
</chapter>

65
chapter07/chroot.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-chroot">
<?dbhtml filename="chroot.html"?>
<title>Entering the Chroot Environment</title>
<para>Now that all the packages which depend on themselves for being built
are on the system, it is time to enter the chroot environment to finish
installing the remaining temporary tools. This environment will be in use
also for installing the final system. As user <systemitem
class="username">root</systemitem>, run the following command to enter the
realm that is, at the moment, populated with only the temporary tools:</para>
<screen role="nodump"><userinput>chroot "$LFS" /usr/bin/env -i \
HOME=/root \
TERM="$TERM" \
PS1='(lfs chroot) \u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
/bin/bash --login +h</userinput></screen>
<para>The <parameter>-i</parameter> option given to the <command>env</command>
command will clear all variables of the chroot environment. After that, only
the <envar>HOME</envar>, <envar>TERM</envar>, <envar>PS1</envar>, and
<envar>PATH</envar> variables are set again. The
<parameter>TERM=$TERM</parameter> construct will set the <envar>TERM</envar>
variable inside chroot to the same value as outside chroot. This variable is
needed for programs like <command>vim</command> and <command>less</command>
to operate properly. If other variables are needed, such as
<envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is a good place to set
them again.</para>
<para>From this point on, there is no need to use the
<envar>LFS</envar> variable anymore, because all work will be restricted
to the LFS file system. This is because the Bash shell is told that
<filename class="directory">$LFS</filename> is now the root
(<filename class="directory">/</filename>) directory.</para>
<para>Notice that <filename class="directory">/tools/bin</filename> is not
anymore in the <envar>PATH</envar>. This means that a temporary tool will no longer be
used once its final version is installed. This occurs when the shell does not
<quote>remember</quote> the locations of executed binaries&mdash;for this
reason, hashing is switched off by passing the <parameter>+h</parameter> option
to <command>bash</command>.</para>
<para>Note that the <command>bash</command> prompt will say
<computeroutput>I have no name!</computeroutput> This is normal because the
<filename>/etc/passwd</filename> file has not been created yet.</para>
<note>
<para>It is important that all the commands throughout the remainder of this
chapter and the following chapters are run from within the chroot
environment. If you leave this environment for any reason (rebooting for
example), ensure that the virtual kernel filesystems are mounted as
explained in <xref linkend="ch-system-bindmount"/> and <xref
linkend="ch-system-kernfsmount"/> and enter chroot again before continuing
with the installation.</para>
</note>
</sect1>

105
chapter07/coreutils.xml Normal file
View File

@ -0,0 +1,105 @@
<?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=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess) \
--enable-install-program=hostname \
--enable-no-install-program=kill,uptime</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>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS 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>
-->
<para>Move programs to their final expected locations. Although this is
not necessary in this temporary environment, we must do so because some
programs harcode executable locations:</para>
<screen><userinput remap="install">mv -v $LFS/usr/bin/{cat,chgrp,chmod,chown,cp,date,dd,df,echo} $LFS/bin
mv -v $LFS/usr/bin/{false,ln,ls,mkdir,mknod,mv,pwd,rm} $LFS/bin
mv -v $LFS/usr/bin/{rmdir,stty,sync,true,uname} $LFS/bin
mv -v $LFS/usr/bin/chroot $LFS/usr/sbin
mkdir -pv $LFS/usr/share/man/man8
mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8
sed -i s/\"1\"/\"8\"/1 $LFS/usr/share/man/man8/chroot.8
mv -v $LFS/usr/bin/{head,nice,sleep,touch} $LFS/bin</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-coreutils" role="."/></para>
</sect2>
</sect1>

204
chapter07/createfiles.xml Normal file
View File

@ -0,0 +1,204 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-createfiles">
<?dbhtml filename="createfiles.html"?>
<title>Creating Essential Files and Symlinks</title>
<indexterm zone="ch-tools-createfiles">
<primary sortas="e-/etc/passwd">/etc/passwd</primary>
</indexterm>
<indexterm zone="ch-tools-createfiles">
<primary sortas="e-/etc/group">/etc/group</primary>
</indexterm>
<indexterm zone="ch-tools-createfiles">
<primary sortas="e-/var/run/utmp">/var/run/utmp</primary>
</indexterm>
<indexterm zone="ch-tools-createfiles">
<primary sortas="e-/var/log/btmp">/var/log/btmp</primary>
</indexterm>
<indexterm zone="ch-tools-createfiles">
<primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary>
</indexterm>
<indexterm zone="ch-tools-createfiles">
<primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary>
</indexterm>
<para>Historically, Linux maintains a list of the mounted file systems in the
file <filename>/etc/mtab</filename>. Modern kernels maintain this list
internally and exposes it to the user via the <filename
class="directory">/proc</filename> filesystem. To satisfy utilities that
expect the presence of <filename>/etc/mtab</filename>, create the following
symbolic link:</para>
<screen><userinput>ln -sv /proc/self/mounts /etc/mtab</userinput></screen>
<para>In order for user <systemitem class="username">root</systemitem> to be
able to login and for the name <quote>root</quote> to be recognized, there
must be relevant entries in the <filename>/etc/passwd</filename> and
<filename>/etc/group</filename> files.</para>
<para>Create the <filename>/etc/passwd</filename> file by running the following
command:</para>
<screen revision="sysv"><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
<literal>root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
daemon:x:6:6:Daemon User:/dev/null:/bin/false
messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
EOF</userinput></screen>
<screen revision="systemd"><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"
<literal>root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/dev/null:/bin/false
daemon:x:6:6:Daemon User:/dev/null:/bin/false
messagebus:x:18:18:D-Bus Message Daemon User:/var/run/dbus:/bin/false
systemd-bus-proxy:x:72:72:systemd Bus Proxy:/:/bin/false
systemd-journal-gateway:x:73:73:systemd Journal Gateway:/:/bin/false
systemd-journal-remote:x:74:74:systemd Journal Remote:/:/bin/false
systemd-journal-upload:x:75:75:systemd Journal Upload:/:/bin/false
systemd-network:x:76:76:systemd Network Management:/:/bin/false
systemd-resolve:x:77:77:systemd Resolver:/:/bin/false
systemd-timesync:x:78:78:systemd Time Synchronization:/:/bin/false
systemd-coredump:x:79:79:systemd Core Dumper:/:/bin/false
nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
EOF</userinput></screen>
<para>The actual password for <systemitem class="username">root</systemitem>
(the <quote>x</quote> used here is just a placeholder) will be set later.</para>
<para>Create the <filename>/etc/group</filename> file by running the following
command:</para>
<screen revision="sysv"><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
<literal>root:x:0:
bin:x:1:daemon
sys:x:2:
kmem:x:3:
tape:x:4:
tty:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:
adm:x:16:
messagebus:x:18:
input:x:24:
mail:x:34:
kvm:x:61:
wheel:x:97:
nogroup:x:99:
users:x:999:</literal>
EOF</userinput></screen>
<screen revision="systemd"><userinput>cat &gt; /etc/group &lt;&lt; "EOF"
<literal>root:x:0:
bin:x:1:daemon
sys:x:2:
kmem:x:3:
tape:x:4:
tty:x:5:
daemon:x:6:
floppy:x:7:
disk:x:8:
lp:x:9:
dialout:x:10:
audio:x:11:
video:x:12:
utmp:x:13:
usb:x:14:
cdrom:x:15:
adm:x:16:
messagebus:x:18:
systemd-journal:x:23:
input:x:24:
mail:x:34:
kvm:x:61:
systemd-bus-proxy:x:72:
systemd-journal-gateway:x:73:
systemd-journal-remote:x:74:
systemd-journal-upload:x:75:
systemd-network:x:76:
systemd-resolve:x:77:
systemd-timesync:x:78:
systemd-coredump:x:79:
wheel:x:97:
nogroup:x:99:
users:x:999:</literal>
EOF</userinput></screen>
<para>The created groups are not part of any standard&mdash;they are groups
decided on in part by the requirements of the Udev configuration in the next
chapter, and in part by common convention employed by a number of existing
Linux distributions. In addition, some test suites rely on specific users
or groups. The Linux Standard Base (LSB, available at <ulink
url="http://www.linuxbase.org"/>) recommends only that, besides the group
<systemitem class="groupname">root</systemitem> with a Group ID (GID) of 0,
a group <systemitem class="groupname">bin</systemitem> with a GID of 1 be
present. All other group names and GIDs can be chosen freely by the system
administrator since well-written programs do not depend on GID numbers, but
rather use the group's name.</para>
<para>Some tests in <xref linkend="chapter-building-system"/> need a regular
user. We add this user here and delete this account at the end of that
chapter.</para>
<screen><userinput>echo "tester:x:$(ls -n $(tty) | cut -d" " -f3):101::/home/tester:/bin/bash" &gt;&gt; /etc/passwd
echo "tester:x:101:" &gt;&gt; /etc/group
install -o tester -d /home/tester</userinput></screen>
<para>To remove the <quote>I have no name!</quote> prompt, start a new
shell. Since the
<filename>/etc/passwd</filename> and <filename>/etc/group</filename>
files have been created, user name and group name resolution will now
work:</para>
<screen role="nodump"><userinput>exec /bin/bash --login +h</userinput></screen>
<para>Note the use of the <parameter>+h</parameter> directive. This tells
<command>bash</command> not to use its internal path hashing. Without this
directive, <command>bash</command> would remember the paths to binaries it has
executed. To ensure the use of the newly compiled binaries as soon as they are
installed, the <parameter>+h</parameter> directive will be used for the duration
of this chapter.</para>
<para>The <command>login</command>, <command>agetty</command>, and
<command>init</command> programs (and others) use a number of log
files to record information such as who was logged into the system and
when. However, these programs will not write to the log files if they
do not already exist. Initialize the log files and give them
proper permissions:</para>
<screen><userinput>touch /var/log/{btmp,lastlog,faillog,wtmp}
chgrp -v utmp /var/log/lastlog
chmod -v 664 /var/log/lastlog
chmod -v 600 /var/log/btmp</userinput></screen>
<para>The <filename>/var/log/wtmp</filename> file records all logins and
logouts. The <filename>/var/log/lastlog</filename> file records when each
user last logged in. The <filename>/var/log/faillog</filename> file records
failed login attempts. The <filename>/var/log/btmp</filename> file records
the bad login attempts.</para>
<note><para>The <filename>/run/utmp</filename> file records the users that
are currently logged in. This file is created dynamically in the boot
scripts.</para></note>
</sect1>

View File

@ -0,0 +1,59 @@
<?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-creatingdirs">
<?dbhtml filename="creatingdirs.html"?>
<title>Creating Directories</title>
<para>It is time to create the full structure in the LFS file system. Create
a standard directory tree by issuing the following commands:</para>
<screen><userinput>mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
mkdir -pv /{media/{floppy,cdrom},srv,var}
install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -pv /usr/{,local/}share/man/man{1..8}
mkdir -v /var/{log,mail,spool}
ln -sv /run /var/run
ln -sv /run/lock /var/lock
mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}</userinput></screen>
<para>Directories are, by default, created with permission mode 755, but
this is not desirable for all directories. In the commands above, two
changes are made&mdash;one to the home directory of user <systemitem
class="username">root</systemitem>, and another to the directories for
temporary files.</para>
<para>The first mode change ensures that not just anybody can enter
the <filename class="directory">/root</filename> directory&mdash;the
same as a normal user would do with his or her home directory. The
second mode change makes sure that any user can write to the
<filename class="directory">/tmp</filename> and <filename
class="directory">/var/tmp</filename> directories, but cannot remove
another user's files from them. The latter is prohibited by the so-called
<quote>sticky bit,</quote> the highest bit (1) in the 1777 bit mask.</para>
<sect2>
<title>FHS Compliance Note</title>
<para>The directory tree is based on the Filesystem Hierarchy Standard
(FHS) (available at <ulink
url="https://refspecs.linuxfoundation.org/fhs.shtml"/>). The FHS also specifies
the optional existence of some directories such as <filename
class="directory">/usr/local/games</filename> and <filename
class="directory">/usr/share/games</filename>. We create only the
directories that are needed. However, feel free to create these
directories. </para>
</sect2>
</sect1>

96
chapter07/dejagnu.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-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 <application>DejaGnu</application> package contains a framework for running test
suites on GNU tools. It is written in <command>expect</command>, which itself
uses <application>Tcl</application> (Tool Command Language).</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&dejagnu-ch5-sbu;</seg>
<seg>&dejagnu-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of DejaGNU</title>
<para>Prepare DejaGNU for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr
makeinfo --html --no-split -o doc/dejagnu.html doc/dejagnu.texi
makeinfo --plaintext -o doc/dejagnu.txt doc/dejagnu.texi</userinput></screen>
<para>Build and install the package:</para>
<screen><userinput remap="install">make install
install -v -dm755 /usr/share/doc/dejagnu-&dejagnu-version;
install -v -m644 doc/dejagnu.{html,txt} \
/usr/share/doc/dejagnu-&dejagnu-version;</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>

68
chapter07/diffutils.xml Normal file
View File

@ -0,0 +1,68 @@
<?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=/usr --host=$LFS_TGT</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-diffutils" role="."/></para>
</sect2>
</sect1>

139
chapter07/expect.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="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 <application>Expect</application> package contains tools for
automating, via scripted dialogues, interactive applications such as
<command>telnet</command>, <command>ftp</command>,
<command>passwd</command>, <command>fsck</command>,
<command>rlogin</command>, and <command>tip</command>.
<application>Expect</application> is also useful for testing these same
applications as well as easing all sorts of tasks that are prohibitively
difficult with anything else. The <application>DejaGnu</application>
framework is written in <application>Expect</application>.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&expect-ch5-sbu;</seg>
<seg>&expect-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Expect</title>
<para>Prepare Expect for compilation:</para>
<screen><userinput remap="configure">
./configure --prefix=/usr \
--with-tcl=/usr/lib \
--enable-shared \
--mandir=/usr/share/man \
--with-tclinclude=/usr/include</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--with-tcl=/usr/lib</parameter></term>
<listitem>
<para>This parameter is needed to tell the
<command>configure</command> where the
<command>tclConfig.sh</command> is located.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-tclinclude=/usr/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>Install the package:</para>
<screen><userinput remap="install">make install
ln -svf expect&expect-version;/libexpect&expect-version;.so /usr/lib</userinput></screen>
</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>

73
chapter07/file.xml Normal file
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-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=/usr \
--host=$LFS_TGT</userinput></screen>
<!-- devs: if using - -build here, the build system wants to compile
the signature file with "file" on the build system, but stops if it is not
the same version. One possibility would be to build "file" on the build
system first, but it is simpler to have the system think it is not
cross-compiling, and use the just built "file". -->
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in<!-- TODO
<xref linkend="contents-file" role="."/> --></para>
</sect2>
</sect1>

75
chapter07/findutils.xml Normal file
View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-findutils" role="wrap">
<?dbhtml filename="findutils.html"?>
<sect1info condition="script">
<productname>findutils</productname>
<productnumber>&findutils-version;</productnumber>
<address>&findutils-url;</address>
</sect1info>
<title>Findutils-&findutils-version;</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>Prepare Findutils for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
<para>Move the excutable to its final expected location:</para>
<screen><userinput remap="install">mv -v $LFS/usr/bin/find $LFS/bin
sed -i 's|find:=${BINDIR}|find:=/bin|' $LFS/usr/bin/updatedb</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-findutils" role="."/></para>
</sect2>
</sect1>

88
chapter07/flex.xml Normal file
View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-flex" role="wrap">
<?dbhtml filename="flex.html"?>
<sect1info condition="script">
<productname>flex</productname>
<productnumber>&flex-version;</productnumber>
<address>&flex-url;</address>
</sect1info>
<title>Flex-&flex-version;</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>Prepare Flex for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--docdir=/usr/share/doc/flex-&flex-version;</userinput></screen>
<!--
<variablelist>
<title>The meaning of the new configure option:</title>
<varlistentry>
<term><parameter>- -disable-bootstrap</parameter></term>
<listitem>
<para>Normally, building flex is done in two stages. A first
programs, which is used to generate the source of a second one,
which is then compiled. When using cross-compilation, the first
program is generated on the build system. However, due to a bug
in configure, the presence of some function is tested only on the
host system. If this function is not found on the build system, the
build fails. This can be prevented by disabling the two stage
build.</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>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-flex" role="."/></para>
</sect2>
</sect1>

74
chapter07/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>First, ensure some unneeded files are not installed:</para>
<screen><userinput remap="pre">sed -i 's/extras//' Makefile.in</userinput></screen>
<para>Prepare Gawk for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(./config.guess)</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gawk" role="."/></para>
</sect2>
</sect1>

208
chapter07/gcc-pass1.xml Normal file
View File

@ -0,0 +1,208 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-gcc-pass1" role="wrap" xreflabel="gcc-pass1">
<?dbhtml filename="gcc-pass1.html"?>
<sect1info condition="script">
<productname>gcc-pass1</productname>
<productnumber>&gcc-version;</productnumber>
<address>&gcc-url;</address>
</sect1info>
<title>GCC-&gcc-version; - Pass 1</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 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>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>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=$LFS/tools \
--with-glibc-version=2.11 \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
--enable-initfini-array \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-decimal-float \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--with-glibc-version=2.11</parameter></term>
<listitem>
<para>This option ensures the package will be compatible with the host's
version of glibc. It is set to the minimum glibc requirement
specified in the <xref linkend="ch-partitioning-hostreqs"/>.</para>
</listitem>
</varlistentry>
<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>--disable-shared</parameter></term>
<listitem>
<para>This switch forces GCC to link its internal libraries
statically. We need this because the shared libraries require glibc,
which is not yet installed on the target system.</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>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>This build of GCC has installed a couple of internal system
headers. Normally one of them, <filename>limits.h</filename>, would in turn
include the corresponding system <filename>limits.h</filename> header, in
this case, <filename>$LFS/usr/include/limits.h</filename>. However, at the
time of this build of gcc <filename>$LFS/usr/include/limits.h</filename>
does not exist, so the internal header that has just been installed is a
partial, self-contained file and does not include the extended features of
the system header. This is adequate for building glibc, but the full
internal header will be needed later. Create a full version of the internal
header using a command that is identical to what the GCC build system does
in normal circumstances:</para>
<screen><userinput remap="install">cd ..
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gcc" role="."/></para>
</sect2>
</sect1>

160
chapter07/gcc-pass2.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-gcc-pass2" role="wrap">
<?dbhtml filename="gcc-pass2.html"?>
<sect1info condition="script">
<productname>gcc-pass2</productname>
<productnumber>&gcc-version;</productnumber>
<address>&gcc-url;</address>
</sect1info>
<title>GCC-&gcc-version; - Pass 2</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>As in the first build of GCC, the GMP, MPFR, and MPC packages are
required. Unpack the tarballs and move them into the required directory
names:</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>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>Fix an issue with GCC-10.1 when building with a cross
compiler:</para>
<screen><userinput remap="pre">patch -Np1 -i ../&gcc-cross-patch;</userinput></screen>
<para>Create a separate build directory again:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Create a symlink that allos libgcc to be built with posix threads
support:</para>
<screen><userinput remap="pre">mkdir -pv $LFS_TGT/libgcc
ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</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">../configure \
--build=$(../config.guess) \
--host=$LFS_TGT \
--prefix=/usr \
CC_FOR_TARGET=$LFS_TGT-gcc \
--with-build-sysroot=$LFS \
--enable-initfini-array \
--disable-nls \
--disable-multilib \
--disable-decimal-float \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title><!-- WIP -->
<varlistentry>
<term><parameter>-with-build-sysroot=$LFS</parameter></term>
<listitem>
<para>Normally, using <parameter>--host=</parameter> ensures that
a cross-compiler is used for building gcc, and that compiler knows
that it has to look for headers and libraries in <filename
class="directory">$LFS</filename>. But the build system of GCC uses
other tools, which are not aware of this location. This switch is
needed to have them find the needed files in <filename
class="directory">$LFS</filename>, and not on the host.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--enable-initfini-array</parameter></term>
<listitem>
<para>This option is automatically enabled when building a native
compiler with a native compiler on x86. But here, we build with
a cross compiler, so we need to explicitely set this option.</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 DESTDIR=$LFS 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 $LFS/usr/bin/cc</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,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='ch-partitioning-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>

85
chapter07/gettext.xml Normal file
View File

@ -0,0 +1,85 @@
<?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 install
three programs from Gettext.</para>
<para>Prepare Gettext for compilation:</para>
<screen><userinput remap="configure">./configure --disable-shared</userinput></screen>
<variablelist>
<title>The meaning of the configure option:</title>
<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</userinput></screen>
<para>Install the <command>msgfmt</command>, <command>msgmerge</command> and
<command>xgettext</command> programs:</para>
<screen><userinput remap="install">cp -v gettext-tools/src/{msgfmt,msgmerge,xgettext} /usr/bin</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gettext" role="."/></para>
</sect2>
</sect1>

230
chapter07/glibc.xml Normal file
View File

@ -0,0 +1,230 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-glibc" role="wrap">
<?dbhtml filename="glibc.html"?>
<sect1info condition="script">
<productname>glibc</productname>
<productnumber>&glibc-version;</productnumber>
<address>&glibc-url;</address>
</sect1info>
<title>Glibc-&glibc-version;</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>First, create two symbolic links, which are needed for proper
operation of the dynamic library loader:</para>
<screen><userinput remap="pre">ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3</userinput></screen>
<para>Some of the Glibc programs use the non-FHS compliant
<filename class="directory">/var/db</filename> directory to store their
runtime data. Apply the following patch to make such programs store their
runtime data in the FHS-compliant locations:</para>
<screen><userinput remap="pre">patch -Np1 -i ../glibc-&glibc-version;-fhs-1.patch</userinput></screen>
<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=/usr \
--host=$LFS_TGT \
--build=$(../scripts/config.guess) \
--enable-kernel=&min-kernel; \
--with-headers=$LFS/usr/include \
libc_cv_slibdir=/lib</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 be cross-compiled, 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=$LFS/usr/include</parameter></term>
<listitem>
<para>This tells Glibc to compile itself against the headers recently
installed to the usr/include directory, so that it knows exactly what
features the kernel has and can optimize itself accordingly.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>libc_cv_slibdir=/lib</parameter></term>
<listitem>
<para>This ensures that the library is installed in /lib instead
of the default /lib64 on 64 bit machines.</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 DESTDIR=$LFS install</userinput></screen>
<variablelist>
<title>The meaning of the <command>make install</command> option:</title>
<varlistentry>
<term><parameter>DESTDIR=$LFS</parameter></term>
<listitem>
<para>The <envar>DESTDIR</envar> make variable is used by almost all
packages to define the location where the package should be
installed. If it is not set, it defaults to the root (<filename
class="directory">/</filename>) directory. Here we specify that
the package be installed in <filename class="directory">$LFS
</filename>, which will become the root after <xref linkend=
"ch-tools-chroot"/>.</para>
</listitem>
</varlistentry>
</variablelist>
<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 '/ld-linux'</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: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
<para>Note that for 32-bit machines, the interpreter name will be
<filename>/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 packages in the next sections will serve as an
additional check that the toolchain has been built properly. If some
package, especially binutils-pass2 or gcc-pass2, fails to build, it is
an indication that something has gone wrong with the
previous Binutils, GCC, or Glibc installations.</para></note>
<para>Now that our cross-toolchain is complete, finalize the installation
of the limits.h header. For doing so, run an utility provided by the GCC
developers:</para>
<screen><userinput>$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-glibc" role="."/></para>
</sect2>
</sect1>

70
chapter07/grep.xml Normal file
View File

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-grep" role="wrap">
<?dbhtml filename="grep.html"?>
<sect1info condition="script">
<productname>grep</productname>
<productnumber>&grep-version;</productnumber>
<address>&grep-url;</address>
</sect1info>
<title>Grep-&grep-version;</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=/usr \
--host=$LFS_TGT \
--bindir=/bin</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-grep" role="."/></para>
</sect2>
</sect1>

72
chapter07/gzip.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-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=/usr --host=$LFS_TGT</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
<para>Move the excutable to its final expected location:</para>
<screen><userinput remap="install">mv -v $LFS/usr/bin/gzip $LFS/bin</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

@ -5,221 +5,25 @@
%general-entities;
]>
<sect1 id="ch-config-introduction" revision="sysv">
<sect1 id="ch-tools-introduction">
<?dbhtml filename="introduction.html"?>
<title>Introduction</title>
<para>Booting a Linux system involves several tasks. The process must
mount both virtual and real file systems, initialize devices, activate swap,
check file systems for integrity, mount any swap partitions or files, set
the system clock, bring up networking, start any daemons required by the
system, and accomplish any other custom tasks needed by the user. This
process must be organized to ensure the tasks are performed in the correct
order but, at the same time, be executed as fast as possible.</para>
<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>In the packages that were installed in Chapter&nbsp;6, there were two
different boot systems installed. LFS provides the ability to easily
select which system the user wants to use and to compare and contrast the
two systems by actually running each system on the local computer. The
advantages and disadvantages of these systems is presented below.</para>-->
<sect2 id='sysv-desc'>
<title>System V</title>
<para>System V is the classic boot process that has been used in Unix and
Unix-like systems such as Linux since about 1983. It consists of a small
program, <command>init</command>, that sets up basic programs such as
<command>login</command> (via getty) and runs a script. This script,
usually named <command>rc</command>, controls the execution of a set of
additional scripts that perform the tasks required to initialize the
system.</para>
<para>The <command>init</command> program is controlled by the
<filename>/etc/inittab</filename> file and is organized into run levels that
can be run by the user:</para>
<literallayout>
0 &mdash; halt
1 &mdash; Single user mode
2 &mdash; Multiuser, without networking
3 &mdash; Full multiuser mode
4 &mdash; User definable
5 &mdash; Full multiuser mode with display manager
6 &mdash; reboot
</literallayout>
<para>The usual default run level is 3 or 5.</para>
<bridgehead renderas="sect3">Advantages</bridgehead>
<itemizedlist>
<listitem>
<para>Established, well understood system.</para>
</listitem>
<listitem>
<para>Easy to customize.</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Disadvantages</bridgehead>
<itemizedlist>
<listitem>
<para>Slower to boot. A medium speed base LFS system
takes 8-12 seconds where the boot time is measured from the
first kernel message to the login prompt. Network
connectivity is typically established about 2 seconds
after the login prompt.</para>
</listitem>
<listitem>
<para>Serial processing of boot tasks. This is related to the previous
point. A delay in any process such as a file system check, will
delay the entire boot process.</para>
</listitem>
<listitem>
<para>Does not directly support advanced features like
control groups (cgroups), and per-user fair share scheduling.</para>
</listitem>
<listitem>
<para>Adding scripts requires manual, static sequencing decisions.</para>
</listitem>
</itemizedlist>
</sect2>
<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>
<!--
<sect2 id='sysd-desc'>
<title>Systemd</title>
<para>Systemd is a group of interconnected programs that handles system and
individual process requests. It provides a dependency system between
various entities called "units". It automatically addresses dependencies
between units and can execute several startup tasks in parallel. It
provides login, inetd, logging, time, and networking services. </para>
<bridgehead renderas="sect3">Advantages</bridgehead>
<itemizedlist>
<listitem>
<para>Used on many established distributions by default.</para>
</listitem>
<listitem>
<para>There is extensive documentation.
See <ulink url="http://www.freedesktop.org/wiki/Software/systemd/"/>.</para>
</listitem>
<listitem>
<para>Parallel execution of boot processes. A medium speed
base LFS system takes 6-10 seconds from kernel start to a
login prompt. Network connectivity is typically established
about 2 seconds after the login prompt. More complex startup
procedures may show a greater speedup when compared to System V.</para>
</listitem>
<listitem>
<para>Implements advanced features such as control groups to
manage related processes.</para>
</listitem>
<listitem>
<para>Maintains backward compatibility with System V programs
and scripts.</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Disadvantages</bridgehead>
<itemizedlist>
<listitem>
<para>There is a substantial learning curve.</para>
</listitem>
<listitem>
<para>Some advanced features such as dbus or cgroups cannot be
disabled if they are not otherwise needed.</para>
</listitem>
<listitem>
<para>Although implemented as several executable programs
the user cannot choose to implement only the portions desired.</para>
</listitem>
<listitem>
<para>Due to the nature of using compiled programs, systemd is
more difficult to debug.</para>
</listitem>
<listitem>
<para>Logging is done in a binary format. Extra tools must
be used to process logs or additional processes must be implemented
to duplicate traditional logging programs.</para>
</listitem>
</itemizedlist>
</sect2>
-->
<!--
<sect2 id='sysv'>
<title>Selecting a Boot Method</title>
<para>Selecting a boot method in LFS is relatively easy.
Both systems are installed side-by-side. The only task needed is to
ensure the files that are needed by the system have the correct names.
The following scripts do that.</para>
<screen><userinput remap="install">cat &gt; /usr/sbin/set-systemd &lt;&lt; "EOF"
#! /bin/bash
ln -svfn init-systemd /sbin/init
ln -svfn init.d-systemd /etc/init.d
for tool in halt poweroff reboot runlevel shutdown telinit; do
ln -sfvn ${tool}-systemd /sbin/${tool}
ln -svfn ${tool}-systemd.8 /usr/share/man/man8/${tool}.8
done
echo "Now reboot with /sbin/reboot-sysv"
EOF
chmod 0744 /usr/sbin/set-systemd
cat &gt; /usr/sbin/set-sysv &lt;&lt; "EOF"
#! /bin/bash
ln -sfvn init-sysv /sbin/init
ln -svfn init.d-sysv /etc/init.d
for tool in halt poweroff reboot runlevel shutdown telinit; do
ln -sfvn ${tool}-sysv /sbin/${tool}
ln -svfn ${tool}-sysv.8 /usr/share/man/man8/${tool}.8
done
echo "Now reboot with /sbin/reboot-systemd"
EOF
chmod 0744 /usr/sbin/set-sysv</userinput></screen>
<note><para>The comment about the correct command to reboot in the
above scripts is correct. The reboot command for the current boot
system must be used after the script changes the default reboot command.
</para></note>
<para>Now set the desired boot system. The default is System V:</para>
<screen><userinput remap="install">/usr/sbin/set-sysv</userinput></screen>
<para>Changing the boot system can be done at any time by running the
appropriate script above and rebooting.</para>
</sect2>
<para>The files compiled in this chapter will be installed under the
<filename class="directory">$LFS</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>

115
chapter07/kernfs.xml Normal file
View File

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-kernfs">
<?dbhtml filename="kernfs.html"?>
<title>Preparing Virtual Kernel File Systems</title>
<indexterm zone="ch-tools-kernfs">
<primary sortas="e-/dev/">/dev/*</primary>
</indexterm>
<para>Various file systems exported by the kernel are used to communicate to
and from the kernel itself. These file systems are virtual in that no disk
space is used for them. The content of the file systems resides in
memory.</para>
<para>Begin by creating directories onto which the file systems will be
mounted:</para>
<screen><userinput>mkdir -pv $LFS/{dev,proc,sys,run}</userinput></screen>
<sect2>
<title>Creating Initial Device Nodes</title>
<para>When the kernel boots the system, it requires the presence of a few
device nodes, in particular the <filename
class="devicefile">console</filename> and <filename
class="devicefile">null</filename> devices. The device nodes must be created
on the hard disk so that they are available before <command>udevd</command>
has been started, and additionally when Linux is started with
<parameter>init=/bin/bash</parameter>. Create the devices by running the
following commands:</para>
<screen><userinput>mknod -m 600 $LFS/dev/console c 5 1
mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
</sect2>
<sect2 id="ch-system-bindmount">
<title>Mounting and Populating /dev</title>
<para>The recommended method of populating the <filename
class="directory">/dev</filename> directory with devices is to mount a
virtual filesystem (such as <systemitem
class="filesystem">tmpfs</systemitem>) on the <filename
class="directory">/dev</filename> directory, and allow the devices to be
created dynamically on that virtual filesystem as they are detected or
accessed. Device creation is generally done during the boot process
by Udev. Since this new system does not yet have Udev and has not yet
been booted, it is necessary to mount and populate <filename
class="directory">/dev</filename> manually. This is accomplished by bind
mounting the host system's <filename class="directory">/dev</filename>
directory. A bind mount is a special type of mount that allows you to
create a mirror of a directory or mount point to some other location. Use
the following command to achieve this:</para>
<screen><userinput>mount -v --bind /dev $LFS/dev</userinput></screen>
</sect2>
<sect2 id="ch-system-kernfsmount">
<title>Mounting Virtual Kernel File Systems</title>
<para>Now mount the remaining virtual kernel filesystems:</para>
<screen><userinput>mount -v --bind /dev/pts $LFS/dev/pts
mount -vt proc proc $LFS/proc
mount -vt sysfs sysfs $LFS/sys
mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
<variablelist>
<title>The meaning of the mount options for devpts:</title>
<varlistentry>
<term><parameter>gid=5</parameter></term>
<listitem>
<para>This ensures that all devpts-created device nodes are owned by
group ID 5. This is the ID we will use later on for the <systemitem
class="groupname">tty</systemitem> group. We use the group ID instead
of a name, since the host system might use a different ID for its
<systemitem class="groupname">tty</systemitem> group.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>mode=0620</parameter></term>
<listitem>
<para>This ensures that all devpts-created device nodes have mode 0620
(user readable and writable, group writable). Together with the
option above, this ensures that devpts will create device nodes that
meet the requirements of grantpt(), meaning the Glibc
<command>pt_chown</command> helper binary (which is not installed by
default) is not necessary.</para>
</listitem>
</varlistentry>
</variablelist>
<para>In some host systems, <filename>/dev/shm</filename> is a
symbolic link to <filename class="directory">/run/shm</filename>.
The /run tmpfs was mounted above so in this case only a
directory needs to be created.</para>
<screen><userinput>if [ -h $LFS/dev/shm ]; then
mkdir -pv $LFS/$(readlink $LFS/dev/shm)
fi</userinput></screen>
</sect2>
</sect1>

View File

@ -0,0 +1,114 @@
<?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-pass2" role="wrap">
<?dbhtml filename="gcc-libstdc++-pass2.html"?>
<sect1info condition="script">
<productname>gcc-libstdc++</productname>
<productnumber>&gcc-version;</productnumber>
<address>&gcc-url;</address>
</sect1info>
<title>Libstdc++ from GCC-&gcc-version;, Pass 2</title>
<indexterm zone="ch-tools-libstdcpp-pass2">
<primary sortas="a-GCC">GCC</primary>
<secondary>tools, libstdc++ pass 2</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>Again, when building <xref linkend="ch-tools-gcc-pass2"/>, we had to
defer the installation of the C++ standard library, because no suitable
compiler was available to compile it: we could not use the compiler
installed, because this compiler is a native
compiler, and should not be used outside of chroot without being at
risk of polluting the build with some host components.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<!-- TODO -->
<seglistitem>
<seg>&libstdcpp-ch5-sbu;</seg>
<seg>&libstdcpp-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Target Libstdc++</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 link which exists when building Libstdc++ in the gcc
tree:</para>
<screen><userinput remap="pre">ln -s gthr-posix.h libgcc/gthr-default.h</userinput></screen>
<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 \
CXXFLAGS="-g -O2 -D_GNU_SOURCE" \
--prefix=/usr \
--disable-multilib \
--disable-nls \
--disable-libstdcxx-pch</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>CXXFLAGS="-g -O2 -D_GNU_SOURCE"</parameter></term>
<listitem>
<para>Those flags are passed by the top level Makefile when doing
a full build of GCC.</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>
</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>

122
chapter07/libstdc++.xml Normal file
View File

@ -0,0 +1,122 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-libstdcpp-pass1" role="wrap">
<?dbhtml filename="gcc-libstdc++-pass1.html"?>
<sect1info condition="script">
<productname>gcc-libstdc++</productname>
<productnumber>&gcc-version;</productnumber>
<address>&gcc-url;</address>
</sect1info>
<title>Libstdc++ from GCC-&gcc-version;, Pass 1</title>
<indexterm zone="ch-tools-libstdcpp-pass1">
<primary sortas="a-GCC">GCC</primary>
<secondary>tools, libstdc++ pass 1</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 the target
directory.
</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&libstdcpp-ch5-sbu;</seg>
<seg>&libstdcpp-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Target Libstdc++</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 \
--build=$(../config.guess) \
--prefix=/usr \
--disable-multilib \
--disable-nls \
--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-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 DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gcc" role="."/></para>
</sect2>
</sect1>

207
chapter07/linux-headers.xml Normal file
View File

@ -0,0 +1,207 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-linux-headers" role="wrap">
<?dbhtml filename="linux-headers.html"?>
<sect1info condition="script">
<productname>linux-headers</productname>
<productnumber>&linux-version;</productnumber>
<address>&linux-url;</address>
</sect1info>
<title>Linux-&linux-version; API Headers</title>
<indexterm zone="ch-tools-linux-headers">
<primary sortas="a-Linux">Linux</primary>
<secondary>tools, API headers</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Linux API Headers (in linux-&linux-version;.tar.xz) expose the
kernel's API for use by Glibc.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&linux-headers-ch5-sbu;</seg>
<seg>&linux-headers-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Linux API Headers</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.
The recommended make target <quote>headers_install</quote> cannot be
used, because it requires <application>rsync</application>, which may not
be available. The headers are first placed in
<filename class="directory">./usr</filename>, then copied to the needed
location.</para>
<screen><userinput remap="make">make headers
find usr/include -name '.*' -delete
rm usr/include/Makefile
</userinput><userinput remap="install">cp -rv usr/include $LFS/usr</userinput></screen>
</sect2>
<sect2 id="contents-linux-headers" role="content">
<title>Contents of Linux API Headers</title>
<segmentedlist>
<segtitle>Installed headers</segtitle>
<segtitle>Installed directories</segtitle>
<seglistitem>
<seg>/usr/include/asm/*.h, /usr/include/asm-generic/*.h,
/usr/include/drm/*.h, /usr/include/linux/*.h, /usr/include/misc/*.h,
/usr/include/mtd/*.h, /usr/include/rdma/*.h, /usr/include/scsi/*.h,
/usr/include/sound/*.h, /usr/include/video/*.h,
and /usr/include/xen/*.h</seg>
<seg>/usr/include/asm, /usr/include/asm-generic, /usr/include/drm,
/usr/include/linux, /usr/include/misc, /usr/include/mtd,
/usr/include/rdma, /usr/include/scsi, /usr/include/sound,
/usr/include/video, and /usr/include/xen</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="asm">
<term><filename class="headerfile">/usr/include/asm/*.h</filename></term>
<listitem>
<para>The Linux API ASM Headers</para>
<indexterm zone="ch-tools-linux-headers asm">
<primary sortas="e-/usr/include/asm/*.h">/usr/include/asm/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="asm-generic">
<term><filename class="headerfile">/usr/include/asm-generic/*.h</filename></term>
<listitem>
<para>The Linux API ASM Generic Headers</para>
<indexterm zone="ch-tools-linux-headers asm-generic">
<primary sortas="e-/usr/include/asm-generic/*.h">/usr/include/asm-generic/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="drm">
<term><filename class="headerfile">/usr/include/drm/*.h</filename></term>
<listitem>
<para>The Linux API DRM Headers</para>
<indexterm zone="ch-tools-linux-headers drm">
<primary sortas="e-/usr/include/drm/*.h">/usr/include/drm/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="linux">
<term><filename class="headerfile">/usr/include/linux/*.h</filename></term>
<listitem>
<para>The Linux API Linux Headers</para>
<indexterm zone="ch-tools-linux-headers linux">
<primary sortas="e-/usr/include/linux/*.h">/usr/include/linux/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="misc">
<term><filename class="headerfile">/usr/include/misc/*.h</filename></term>
<listitem>
<para>The Linux API Miscellaneous Headers</para>
<indexterm zone="ch-tools-linux-headers misc">
<primary sortas="e-/usr/include/misc/*.h">/usr/include/misc/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="mtd">
<term><filename class="headerfile">/usr/include/mtd/*.h</filename></term>
<listitem>
<para>The Linux API MTD Headers</para>
<indexterm zone="ch-tools-linux-headers mtd">
<primary sortas="e-/usr/include/mtd/*.h">/usr/include/mtd/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="rdma">
<term><filename class="headerfile">/usr/include/rdma/*.h</filename></term>
<listitem>
<para>The Linux API RDMA Headers</para>
<indexterm zone="ch-tools-linux-headers rdma">
<primary sortas="e-/usr/include/rdma/*.h">/usr/include/rdma/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="scsi">
<term><filename class="headerfile">/usr/include/scsi/*.h</filename></term>
<listitem>
<para>The Linux API SCSI Headers</para>
<indexterm zone="ch-tools-linux-headers scsi">
<primary sortas="e-/usr/include/scsi/*.h">/usr/include/scsi/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="sound">
<term><filename class="headerfile">/usr/include/sound/*.h</filename></term>
<listitem>
<para>The Linux API Sound Headers</para>
<indexterm zone="ch-tools-linux-headers sound">
<primary sortas="e-/usr/include/sound/*.h">/usr/include/sound/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="video">
<term><filename class="headerfile">/usr/include/video/*.h</filename></term>
<listitem>
<para>The Linux API Video Headers</para>
<indexterm zone="ch-tools-linux-headers video">
<primary sortas="e-/usr/include/video/*.h">/usr/include/video/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="xen">
<term><filename class="headerfile">/usr/include/xen/*.h</filename></term>
<listitem>
<para>The Linux API Xen Headers</para>
<indexterm zone="ch-tools-linux-headers xen">
<primary sortas="e-/usr/include/xen/*.h">/usr/include/xen/*.h</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>

74
chapter07/m4.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-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 introduced 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=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-m4" role="."/></para>
</sect2>
</sect1>

83
chapter07/make.xml Normal file
View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-make" role="wrap">
<?dbhtml filename="make.html"?>
<sect1info condition="script">
<productname>make</productname>
<productnumber>&make-version;</productnumber>
<address>&make-url;</address>
</sect1info>
<title>Make-&make-version;</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>Prepare Make for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--without-guile \
--host=$LFS_TGT \
--build=$(build-aux/config.guess)</userinput></screen>
<variablelist>
<title>The meaning of the new configure option:</title>
<varlistentry>
<term><parameter>--without-guile</parameter></term>
<listitem>
<para>Although we are cross-compiling, configure tries to use
guile from the build host if it finds it. This makes compilation
fail, so this switch prevents using it.</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 DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-make" role="."/></para>
</sect2>
</sect1>

157
chapter07/ncurses.xml Normal file
View File

@ -0,0 +1,157 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-ncurses" role="wrap">
<?dbhtml filename="ncurses.html"?>
<sect1info condition="script">
<productname>ncurses</productname>
<productnumber>&ncurses-version;</productnumber>
<address>&ncurses-url;</address>
</sect1info>
<title>Ncurses-&ncurses-version;</title>
<indexterm zone="ch-tools-ncurses">
<primary sortas="a-Ncurses">Ncurses</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/ncurses.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&ncurses-ch5-sbu;</seg>
<seg>&ncurses-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Ncurses</title>
<para>First, ensure that <command>gawk</command> is found first during configuration:</para>
<screen><userinput remap="pre">sed -i s/mawk// configure</userinput></screen>
<para>Then, run the following commands to build the <quote>tic</quote>
program on the build host:</para>
<screen><userinput remap="pre">mkdir build
cd build
../configure
make -C include
make -C progs tic
cd ..</userinput></screen>
<para>Prepare Ncurses for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(./config.guess) \
--mandir=/usr/share/man \
--with-shared \
--without-debug \
--without-ada \
--without-normal \
--enable-widec \
--enable-pc-files</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>--without-ada</parameter></term>
<listitem>
<para>This ensures that Ncurses does not build support for the Ada
compiler which may be present on the host but will not be available
once we enter the <command>chroot</command> environment.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--enable-widec</parameter></term>
<listitem>
<para>This switch causes wide-character libraries (e.g., <filename
class="libraryfile">libncursesw.so.&ncurses-version;</filename>)
to be built instead of normal ones (e.g., <filename
class="libraryfile">libncurses.so.&ncurses-version;</filename>).
These wide-character libraries are usable in both multibyte and
traditional 8-bit locales, while normal libraries work properly
only in 8-bit locales. Wide-character and normal libraries are
source-compatible, but not binary-compatible.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--enable-pc-files</parameter></term>
<listitem>
<para>This switch generates and installs .pc files for pkg-config.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--without-normal</parameter></term>
<listitem>
<para>This switch disables building and installing most static libraries.
</para>
</listitem>
</varlistentry>
<!--
<varlistentry>
<term><parameter>- -disable-db-install</parameter></term>
<listitem>
<para>This switch disables building the terminfo database: it is not
needed at this stage, and if <command>tic</command> is too old,
it cannot compile recent databases.</para>
</listitem>
</varlistentry>
-->
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<!-- TODO: check and document -->
<screen><userinput remap="install">make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install
ln -s libncursesw.so $LFS/usr/lib/libncurses.so</userinput></screen>
<para>Move the shared libraries to the
<filename class="directory">/lib</filename> directory, where they are
expected to reside:</para>
<screen><userinput remap="install">mv -v $LFS/usr/lib/libncursesw.so.6* $LFS/lib</userinput></screen>
<para>Because the libraries have been moved, one symlink points to
a non-existent file. Recreate it:</para>
<screen><userinput remap="install">ln -sfv ../../lib/$(readlink $LFS/usr/lib/libncursesw.so) $LFS/usr/lib/libncursesw.so</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-ncurses" role="."/></para>
</sect2>
</sect1>

70
chapter07/patch.xml Normal file
View File

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

79
chapter07/perl.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-perl" role="wrap">
<?dbhtml filename="perl.html"?>
<sect1info condition="script">
<productname>perl</productname>
<productnumber>&perl-version;</productnumber>
<address>&perl-url;</address>
</sect1info>
<title>Perl-&perl-version;</title>
<indexterm zone="ch-tools-perl">
<primary sortas="a-Perl">Perl</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter08/perl.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&perl-ch5-sbu;</seg>
<seg>&perl-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Perl</title>
<para>Prepare Perl for compilation:</para>
<screen><userinput remap="configure">sh Configure -des -Dprefix=/usr</userinput></screen>
<variablelist>
<title>The meaning of the new Configure options:</title>
<varlistentry>
<term><parameter>-des</parameter></term>
<listitem>
<para>This is a combination of three options: -d uses defaults for
all items; -e ensures completion of all tasks; -s silences
non-essential output.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Build the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-perl" role="."/></para>
</sect2>
</sect1>

88
chapter07/python.xml Normal file
View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-system-Python-temp" role="wrap">
<?dbhtml filename="Python-temp.html"?>
<sect1info condition="script">
<productname>Python</productname>
<productnumber>&python-version;</productnumber>
<address>&python-url;</address>
</sect1info>
<title>Python-&python-version;</title>
<indexterm zone="ch-system-Python-temp">
<primary sortas="a-Python">Python</primary>
<secondary>temporary</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/python.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&python-ch5-sbu;</seg>
<seg>&python-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Python</title>
<note>
<para>There are two package files whose name starts with
<quote>python</quote>. The one to extract from is
<filename>Python-&python-version;.tar.xz</filename> (notice the
uppercase first letter).</para>
</note>
<para>Prepare Python for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr --without-ensurepip</userinput></screen>
<variablelist>
<title>The meaning of the configure option:</title>
<varlistentry>
<term><parameter>--without-ensurepip</parameter></term>
<listitem>
<para>This switch disables the Python package installer, which is not
needed at this stage.</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>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-python" role="."/></para>
</sect2>
</sect1>

70
chapter07/sed.xml Normal file
View File

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

53
chapter07/stripping.xml Normal file
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-stripping">
<?dbhtml filename="stripping.html"?>
<title>Stripping</title>
<para>The steps in this section are optional, but if the LFS partition is
rather small, it is beneficial to learn that unnecessary items can be removed.
The executables and libraries built so far contain about 70 MB of unneeded
debugging symbols. Remove those symbols with:</para>
<screen><userinput>$LFS_TGT-strip --strip-debug $LFS/usr/lib/*
$LFS_TGT-strip --strip-unneeded $LFS/usr/{,s}bin/*</userinput></screen>
<para>These commands will skip a number of files, reporting that it does not
recognize their file format. Most of these are scripts instead of binaries.
Note that we use the <command>strip</command> program built in
<quote>Binutils pass 1</quote>, since it is the one that knows how to strip
our cross-compiled programs.</para>
<!-- Normally, the host "strip" could be used too, since it is actually the
same computer. But Some old versions of binutils may generate buggy crt1.o
and the like, because they do not know about recently introduced symbol
types. For more details,
see https://sourceware.org/bugzilla/show_bug.cgi?id=22875-->
<para>Take care <emphasis>not</emphasis> to use
<parameter>--strip-unneeded</parameter> on the libraries. The static
ones would be destroyed and the toolchain packages would need to be
built all over again.</para>
<para>To save more, remove the documentation:</para>
<screen><userinput>rm -rf $LFS/usr/{,share}/{info,man,doc}</userinput></screen>
<para>The libtool .la files are only useful when linking with static
libraries. They are unneeded, and potentially harmful, when using dynamic
shared libraries, specially when using also non-autotools build systems.
Remove those files now:</para>
<screen><userinput>find $LFS/usr/{lib,libexec} -name \*.la -delete</userinput></screen>
<para>At this point, you should have at least 3 GB of free space in
<envar>$LFS</envar> that can be used to build and install Glibc and Gcc in
the next phase. If you can build and install Glibc, you can build and install
the rest too.</para>
</sect1>

71
chapter07/tar.xml Normal file
View File

@ -0,0 +1,71 @@
<?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-tar" role="wrap">
<?dbhtml filename="tar.html"?>
<sect1info condition="script">
<productname>tar</productname>
<productnumber>&tar-version;</productnumber>
<address>&tar-url;</address>
</sect1info>
<title>Tar-&tar-version;</title>
<indexterm zone="ch-tools-tar">
<primary sortas="a-Tar">Tar</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/tar.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&tar-ch5-sbu;</seg>
<seg>&tar-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Tar</title>
<para>Prepare Tar for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess) \
--bindir=/bin</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-tar" role="."/></para>
</sect2>
</sect1>

191
chapter07/tcl.xml Normal file
View File

@ -0,0 +1,191 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
<!ENTITY tdbc-ver "1.1.1">
<!ENTITY itcl-ver "4.2.0">
]>
<sect1 id="ch-tools-tcl" role="wrap">
<?dbhtml filename="tcl.html"?>
<sect1info condition="script">
<productname>tcl</productname>
<productnumber>&tcl-version;</productnumber>
<address>&tcl-url;</address>
</sect1info>
<title>Tcl-&tcl-version;</title>
<indexterm zone="ch-tools-tcl">
<primary sortas="a-Tcl">Tcl</primary>
</indexterm>
<sect2 role="package">
<title/>
<para>The <application>Tcl</application> package contains the Tool Command Language,
a robust general-purpose scripting language. The <application>Expect</application> package
is written in the <application>Tcl</application> language.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&tcl-ch5-sbu;</seg>
<seg>&tcl-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Tcl</title>
<para>This package and the next two (Expect and DejaGNU) are
installed to support running the test suites for GCC and Binutils and other
packages. Installing three packages for testing purposes may seem
excessive, but it is very reassuring, if not essential, to know that the
most important tools are working properly. These packages are required
to run the test suites in <xref linkend="chapter-building-system"/>.</para>
<para>Note that the Tcl package used here is a minimal version needed
to run the LFS tests. For the full package, see the
<ulink url='&blfs-book;general/tcl.html'>BLFS Tcl procedures</ulink>.</para>
<para>Prepare Tcl for compilation:</para>
<screen><userinput remap="configure">SRCDIR=$(pwd)
cd unix
./configure --prefix=/usr \
--mandir=/usr/share/man \
$([ "$(uname -m)" = x86_64 ] &amp;&amp; echo --enable-64bit)</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>$([ "$(uname -m)" = x86_64 ] &amp;&amp; echo --enable-64bit)</parameter></term>
<listitem>
<para>The construct <parameter>$(&lt;shell command&gt;)</parameter>
is replaced by the output of the chell command. Here this output is
empty if running on a 32 bit machine, and is
<parameter>--enable-64bit</parameter> if running on a 64 bit machine.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>Build the package:</para>
<screen><userinput remap="make">make
sed -e "s|$SRCDIR/unix|/usr/lib|" \
-e "s|$SRCDIR|/usr/include|" \
-i tclConfig.sh
sed -e "s|$SRCDIR/unix/pkgs/tdbc&tdbc-ver;|/usr/lib/tdbc&tdbc-ver;|" \
-e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;/generic|/usr/include|" \
-e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;/library|/usr/lib/tcl8.6|" \
-e "s|$SRCDIR/pkgs/tdbc&tdbc-ver;|/usr/include|" \
-i pkgs/tdbc&tdbc-ver;/tdbcConfig.sh
sed -e "s|$SRCDIR/unix/pkgs/itcl&itcl-ver;|/usr/lib/itcl&itcl-ver;|" \
-e "s|$SRCDIR/pkgs/itcl&itcl-ver;/generic|/usr/include|" \
-e "s|$SRCDIR/pkgs/itcl&itcl-ver;|/usr/include|" \
-i pkgs/itcl&itcl-ver;/itclConfig.sh
unset SRCDIR</userinput></screen>
<para>The various <quote>sed</quote> after the <quote>make</quote> command
remove references to the build directory from various configuration files,
and replaces them with the install directory. This is not mandatory
for the remaining of LFS, but may be needed in case a package built later
uses Tcl.</para>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>Make the installed library writable so debugging symbols can
be removed later:</para>
<screen><userinput remap="install">chmod -v u+w /usr/lib/libtcl&tcl-major-version;.so</userinput></screen>
<para>Install Tcl's headers. The next package, Expect, requires them
to build.</para>
<screen><userinput remap="install">make install-private-headers</userinput></screen>
<para>Now make a necessary symbolic link:</para>
<screen><userinput remap="install">ln -sfv tclsh&tcl-major-version; /usr/bin/tclsh</userinput></screen>
</sect2>
<sect2 id="contents-tcl" role="content">
<title>Contents of Tcl</title>
<segmentedlist>
<segtitle>Installed programs</segtitle>
<segtitle>Installed library</segtitle>
<seglistitem>
<seg>tclsh (link to tclsh&tcl-major-version;) and tclsh&tcl-major-version;</seg>
<seg>libtcl&tcl-major-version;.so, libtclstub&tcl-major-version;.a</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="tclsh&tcl-major-version;">
<term><command>tclsh&tcl-major-version;</command></term>
<listitem>
<para>The Tcl command shell</para>
<indexterm zone="ch-tools-tcl tclsh&tcl-major-version;">
<primary sortas="b-tclsh&tcl-major-version;">tclsh&tcl-major-version;</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="tclsh">
<term><command>tclsh</command></term>
<listitem>
<para>A link to tclsh&tcl-major-version;</para>
<indexterm zone="ch-tools-tcl tclsh">
<primary sortas="b-tclsh">tclsh</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libtcl&tcl-major-version;.so">
<term><filename class="libraryfile">libtcl&tcl-major-version;.so</filename></term>
<listitem>
<para>The Tcl library</para>
<indexterm zone="ch-tools-tcl libtcl&tcl-major-version;.so">
<primary sortas="c-libtcl&tcl-major-version;.so">libtcl&tcl-major-version;.so</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="libtclstub&tcl-major-version;.a">
<term><filename class="libraryfile">libtclstub&tcl-major-version;.a</filename></term>
<listitem>
<para>The Tcl Stub library</para>
<indexterm zone="ch-tools-tcl libtclstub&tcl-major-version;.a">
<primary sortas="c-libtclstub&tcl-major-version;.a">libtclstub&tcl-major-version;.a</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>

74
chapter07/texinfo.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-system-texinfo-temp" role="wrap">
<?dbhtml filename="texinfo-temp.html"?>
<sect1info condition="script">
<productname>texinfo</productname>
<productnumber>&texinfo-version;</productnumber>
<address>&texinfo-url;</address>
</sect1info>
<title>Texinfo-&texinfo-version;</title>
<indexterm zone="ch-system-texinfo-temp">
<primary sortas="a-Texinfo">Texinfo</primary>
<secondary>temporary</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/texinfo.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&texinfo-ch5-sbu;</seg>
<seg>&texinfo-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Texinfo</title>
<para>Prepare Texinfo for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
<note>
<para>As part of the configure process, a test is made that indicates an
error for TestXS_la-TestXS.lo. This is not relevant for LFS and should be
ignored.</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>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-texinfo" role="."/></para>
</sect2>
</sect1>

View File

@ -0,0 +1,335 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-toolchaintechnotes">
<?dbhtml filename="toolchaintechnotes.html"?>
<title>Toolchain Technical Notes</title>
<para>This section explains some of the rationale and technical details
behind the overall build method. It is not essential to immediately
understand everything in this section. Most of this information will be
clearer after performing an actual build. This section can be referred
to at any time during the process.</para>
<para>The overall goal of <xref linkend="chapter-temporary-tools"/> is to
produce a temporary area that contains a known-good set of tools that can be
isolated from the host system. By using <command>chroot</command>, the
commands in the remaining chapters will be contained within that environment,
ensuring a clean, trouble-free build of the target LFS system. The build
process has been designed to minimize the risks for new readers and to provide
the most educational value at the same time.</para>
<para>The build process is based on the process of
<emphasis>cross-compilation</emphasis>. Cross-compilation is normally used
for building a compiler and its toolchain for a machine different from
the one that is used for the build. This is not strictly needed for LFS,
since the machine where the new system will run is the same as the one
used for the build. But cross-compilation has the great advantage that
anything that is cross-compiled cannot depend on the host environment.</para>
<sect2 id="cross-compile" xreflabel="About Cross-Compilation">
<title>About Cross-Compilation</title>
<para>Cross-compilation involves some concepts that deserve a section on
their own. Although this section may be omitted in a first reading, it
is strongly suggested to come back to it later in order to get a full
grasp of the build process.</para>
<para>Let us first define some terms used in this context:</para>
<variablelist>
<varlistentry><term>build</term><listitem>
<para>is the machine where we build programs. Note that this machine
is referred to as the <quote>host</quote> in other
sections.</para></listitem>
</varlistentry>
<varlistentry><term>host</term><listitem>
<para>is the machine/system where the built programs will run. Note
that this use of <quote>host</quote> is not the same as in other
sections.</para></listitem>
</varlistentry>
<varlistentry><term>target</term><listitem>
<para>is only used for compilers. It is the machine the compiler
produces code for. It may be different from both build and
host.</para></listitem>
</varlistentry>
</variablelist>
<para>As an example, let us imagine the following scenario: we may have a
compiler on a slow machine only, let's call the machine A, and the compiler
ccA. We may have also a fast machine (B), but with no compiler, and we may
want to produce code for a another slow machine (C). Then, to build a
compiler for machine C, we would have three stages:</para>
<informaltable align="center">
<tgroup cols="5">
<colspec colnum="1" align="center"/>
<colspec colnum="2" align="center"/>
<colspec colnum="3" align="center"/>
<colspec colnum="4" align="center"/>
<colspec colnum="5" align="left"/>
<thead>
<row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
<entry>Target</entry><entry>Action</entry></row>
</thead>
<tbody>
<row>
<entry>1</entry><entry>A</entry><entry>A</entry><entry>B</entry>
<entry>build cross-compiler cc1 using ccA on machine A</entry>
</row>
<row>
<entry>2</entry><entry>A</entry><entry>B</entry><entry>B</entry>
<entry>build cross-compiler cc2 using cc1 on machine A</entry>
</row>
<row>
<entry>3</entry><entry>B</entry><entry>C</entry><entry>C</entry>
<entry>build compiler ccC using cc2 on machine B</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>Then, all the other programs needed by machine C can be compiled
using cc2 on the fast machine B. Note that unless B can run programs
produced for C, there is no way to test the built programs until machine
C itself is running. For example, for testing ccC, we may want to add a
fourth stage:</para>
<informaltable align="center">
<tgroup cols="5">
<colspec colnum="1" align="center"/>
<colspec colnum="2" align="center"/>
<colspec colnum="3" align="center"/>
<colspec colnum="4" align="center"/>
<colspec colnum="5" align="left"/>
<thead>
<row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
<entry>Target</entry><entry>Action</entry></row>
</thead>
<tbody>
<row>
<entry>4</entry><entry>C</entry><entry>C</entry><entry>C</entry>
<entry>rebuild and test ccC using itself on machine C</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>In the example above, only cc1 and cc2 are cross-compilers, that is,
they produce code for a machine different from the one they are run on.
The other compilers ccA and ccC produce code for the machine they are run
on. Such compilers are called <emphasis>native</emphasis> compilers.</para>
</sect2>
<sect2 id="lfs-cross">
<title>Implementation of Cross-Compilation for LFS</title>
<note>
<para>Almost all the build systems use names of the form
cpu-vendor-kernel-os referred to as the machine triplet. An astute
reader may wonder why a <quote>triplet</quote> refers to a four component
name. The reason is history: initially, three component names were enough
to designate unambiguously a machine, but with new machines and systems
appearing, that proved insufficient. The word <quote>triplet</quote>
remained. A simple way to determine your machine triplet is to run
the <command>config.guess</command>
script that comes with the source for many packages. Unpack the Binutils
sources and run the script: <userinput>./config.guess</userinput> and note
the output. For example, for a 32-bit Intel processor the
output will be <emphasis>i686-pc-linux-gnu</emphasis>. On a 64-bit
system it will be <emphasis>x86_64-pc-linux-gnu</emphasis>.</para>
<para>Also be aware of the name of the platform's dynamic linker, often
referred to as the dynamic loader (not to be confused with the standard
linker <command>ld</command> that is part of Binutils). The dynamic linker
provided by Glibc finds and loads the shared libraries needed by a
program, prepares the program to run, and then runs it. The name of the
dynamic linker for a 32-bit Intel machine will be <filename
class="libraryfile">ld-linux.so.2</filename> (<filename
class="libraryfile">ld-linux-x86-64.so.2</filename> for 64-bit systems). A
sure-fire way to determine the name of the dynamic linker is to inspect a
random binary from the host system by running: <userinput>readelf -l
&lt;name of binary&gt; | grep interpreter</userinput> and noting the
output. The authoritative reference covering all platforms is in the
<filename>shlib-versions</filename> file in the root of the Glibc source
tree.</para>
</note>
<para>In order to fake a cross compilation, the name of the host triplet
is slightly adjusted by changing the &quot;vendor&quot; field in the
<envar>LFS_TGT</envar> variable. We also use the
<parameter>--with-sysroot</parameter> when building the cross linker and
cross compiler, to tell them where to find the needed host files. This
ensures none of the other programs built in <xref
linkend="chapter-temporary-tools"/> can link to libraries on the build
machine. Only two stages are mandatory, and one more for tests:</para>
<informaltable align="center">
<tgroup cols="5">
<colspec colnum="1" align="center"/>
<colspec colnum="2" align="center"/>
<colspec colnum="3" align="center"/>
<colspec colnum="4" align="center"/>
<colspec colnum="5" align="left"/>
<thead>
<row><entry>Stage</entry><entry>Build</entry><entry>Host</entry>
<entry>Target</entry><entry>Action</entry></row>
</thead>
<tbody>
<row>
<entry>1</entry><entry>pc</entry><entry>pc</entry><entry>lfs</entry>
<entry>build cross-compiler cc1 using cc-pc on pc</entry>
</row>
<row>
<entry>2</entry><entry>pc</entry><entry>lfs</entry><entry>lfs</entry>
<entry>build compiler cc-lfs using cc1 on pc</entry>
</row>
<row>
<entry>3</entry><entry>lfs</entry><entry>lfs</entry><entry>lfs</entry>
<entry>rebuild and test cc-lfs using itself on lfs</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>In the above table, <quote>on pc</quote> means the commands are run
on a machine using the already installed distribution. <quote>On
lfs</quote> means the commands are run in a chrooted environment.</para>
<para>Now, there is more about cross-compiling: the C language is not
just a compiler, but also defines a standard library. In this book, the
GNU C library, named glibc, is used. This library must
be compiled for the lfs machine, that is, using the cross compiler cc1.
But the compiler itself uses an internal library implementing complex
instructions not available in the assembler instruction set. This
internal library is named libgcc, and must be linked to the glibc
library to be fully functional! Furthermore, the standard library for
C++ (libstdc++) also needs being linked to glibc. The solution
to this chicken and egg problem is to first build a degraded cc1+libgcc,
lacking some fuctionalities such as threads and exception handling, then
build glibc using this degraded compiler (glibc itself is not
degraded), then build libstdc++. But this last library will lack the
same functionalities as libgcc.</para>
<para>This is not the end of the story: the conclusion of the preceding
paragraph is that cc1 is unable to build a fully functional libstdc++, but
this is the only compiler available for building the C/C++ libraries
during stage 2! Of course, the compiler built during stage 2, cc-lfs,
would be able to build those libraries, but (i) the build system of
gcc does not know that it is usable on pc, and (ii) using it on pc
would be at risk of linking to the pc libraries, since cc-lfs is a native
compiler. So we have to build libstdc++ later, in chroot.</para>
</sect2>
<sect2 id="other-details">
<title>Other procedural details</title>
<para>The cross-compiler will be installed in a separate <filename
class="directory">$LFS/tools</filename> directory, since it will not
be part of the final system.</para>
<para>Binutils is installed first because the <command>configure</command>
runs of both GCC and Glibc perform various feature tests on the assembler
and linker to determine which software features to enable or disable. This
is more important than one might first realize. An incorrectly configured
GCC or Glibc can result in a subtly broken toolchain, where the impact of
such breakage might not show up until near the end of the build of an
entire distribution. A test suite failure will usually highlight this error
before too much additional work is performed.</para>
<para>Binutils installs its assembler and linker in two locations,
<filename class="directory">$LFS/tools/bin</filename> and <filename
class="directory">$LFS/tools/$LFS_TGT/bin</filename>. The tools in one
location are hard linked to the other. An important facet of the linker is
its library search order. Detailed information can be obtained from
<command>ld</command> by passing it the <parameter>--verbose</parameter>
flag. For example, <command>$LFS_TGT-ld --verbose | grep SEARCH</command>
will illustrate the current search paths and their order. It shows which
files are linked by <command>ld</command> by compiling a dummy program and
passing the <parameter>--verbose</parameter> switch to the linker. For
example,
<command>$LFS_TGT-gcc dummy.c -Wl,--verbose 2&gt;&amp;1 | grep succeeded</command>
will show all the files successfully opened during the linking.</para>
<para>The next package installed is GCC. An example of what can be
seen during its run of <command>configure</command> is:</para>
<screen><computeroutput>checking what assembler to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/as
checking what linker to use... /mnt/lfs/tools/i686-lfs-linux-gnu/bin/ld</computeroutput></screen>
<para>This is important for the reasons mentioned above. It also
demonstrates that GCC's configure script does not search the PATH
directories to find which tools to use. However, during the actual
operation of <command>gcc</command> itself, the same search paths are not
necessarily used. To find out which standard linker <command>gcc</command>
will use, run: <command>$LFS_TGT-gcc -print-prog-name=ld</command>.</para>
<para>Detailed information can be obtained from <command>gcc</command> by
passing it the <parameter>-v</parameter> command line option while compiling
a dummy program. For example, <command>gcc -v dummy.c</command> will show
detailed information about the preprocessor, compilation, and assembly
stages, including <command>gcc</command>'s included search paths and their
order.</para>
<para>Next installed are sanitized Linux API headers. These allow the
standard C library (Glibc) to interface with features that the Linux
kernel will provide.</para>
<para>The next package installed is Glibc. The most important
considerations for building Glibc are the compiler, binary tools, and
kernel headers. The compiler is generally not an issue since Glibc will
always use the compiler relating to the <parameter>--host</parameter>
parameter passed to its configure script; e.g. in our case, the compiler
will be <command>$LFS_TGT-gcc</command>. The binary tools and kernel
headers can be a bit more complicated. Therefore, take no risks and use
the available configure switches to enforce the correct selections. After
the run of <command>configure</command>, check the contents of the
<filename>config.make</filename> file in the <filename
class="directory">build</filename> directory for all important details.
Note the use of <parameter>CC="$LFS_TGT-gcc"</parameter> (with
<envar>$LFS_TGT</envar> expanded) to control which binary tools are used
and the use of the <parameter>-nostdinc</parameter> and
<parameter>-isystem</parameter> flags to control the compiler's include
search path. These items highlight an important aspect of the Glibc
package&mdash;it is very self-sufficient in terms of its build machinery
and generally does not rely on toolchain defaults.</para>
<para>As said above, the standard C++ library is compiled next, followed
by all the programs that need themselves to be built. The install step
uses the <envar>DESTDIR</envar> variable to have the programs land into
the LFS filesystem.</para>
<para>Then the native lfs compiler is built. First Binutils Pass 2, with
the same <envar>DESTDIR</envar> install as the other programs, then the
second pass of GCC, omitting libstdc++ and other non-important libraries.
Due to some weird logic in GCC's configure script,
<envar>CC_FOR_TARGET</envar> ends up as <command>cc</command> when host
is the same as target, but is different from build. This is why
<parameter>CC_FOR_TARGET=$LFS_TGT-gcc</parameter> is put explicitely into
the configure options.</para>
<para>Upon entering the chroot environment in <xref
linkend="chapter-building-system"/>, the first task is to install
libstdc++. Then temporary installations of programs needed for the proper
operation of the toolchain are performed. Programs needed for testing
other programs are also built. From this point onwards, the
core toolchain is self-contained and self-hosted. In the remainder of
the <xref linkend="chapter-building-system"/>, final versions of all the
packages needed for a fully functional system are built, tested and
installed.</para>
</sect2>
</sect1>

113
chapter07/util-linux.xml Normal file
View File

@ -0,0 +1,113 @@
<?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-util-linux" role="wrap">
<?dbhtml filename="util-linux.html"?>
<sect1info condition="script">
<productname>util-linux</productname>
<productnumber>&util-linux-version;</productnumber>
<address>&util-linux-url;</address>
</sect1info>
<title>Util-linux-&util-linux-version;</title>
<indexterm zone="ch-tools-util-linux">
<primary sortas="a-Util-linux">Util-linux</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Util-linux package contains miscellaneous utility programs.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&util-linux-ch5-sbu;</seg>
<seg>&util-linux-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Util-linux</title>
<para>First create a directory
to enable storage for the <command>hwclock</command> program:</para>
<screen><userinput remap="pre">mkdir -pv /var/lib/hwclock</userinput></screen>
<para>Prepare Util-linux for compilation:</para>
<screen><userinput remap="configure">./configure ADJTIME_PATH=/var/lib/hwclock/adjtime \
--docdir=/usr/share/doc/util-linux-&util-linux-version; \
--disable-chfn-chsh \
--disable-login \
--disable-nologin \
--disable-su \
--disable-setpriv \
--disable-runuser \
--disable-pylibmount \
--disable-static \
--without-python</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<!-- TODO -->
<varlistentry>
<term><parameter>ADJTIME_PATH=/var/lib/hwclock/adjtime</parameter></term>
<listitem>
<para>This sets the location of the file recording information about
the hardware clock, in accordance to the FHS. This is not stricly
needed fot his temporary tool, but it prevent creating a file
at another location, which would not be overwritten or removed
when building the final util-linux.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-*</parameter></term>
<listitem>
<para>Those switches prevent warnings about building components
that require packages not in LFS or not installed yet.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--without-python</parameter></term>
<listitem>
<para>This switch disables using <application>Python</application>.
It avoids trying to build unneeded bindings.</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>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-utillinux" role="."/></para>
</sect2>
</sect1>

77
chapter07/xz.xml Normal file
View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-xz" role="wrap">
<?dbhtml filename="xz.html"?>
<sect1info condition="script">
<productname>xz</productname>
<productnumber>&xz-version;</productnumber>
<address>&xz-url;</address>
</sect1info>
<title>Xz-&xz-version;</title>
<indexterm zone="ch-tools-xz">
<primary sortas="a-xz">Xz</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/xz.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&xz-ch5-sbu;</seg>
<seg>&xz-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Xz</title>
<para>Prepare Xz for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(build-aux/config.guess) \
--disable-static \
--docdir=/usr/share/doc/xz-&xz-version;</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
<para>Make sure that all essential files are in the correct directory:</para>
<screen><userinput remap="install">mv -v $LFS/usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} $LFS/bin
mv -v $LFS/usr/lib/liblzma.so.* $LFS/lib
ln -svf ../../lib/$(readlink $LFS/usr/lib/liblzma.so) $LFS/usr/lib/liblzma.so</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in<!-- TODO
<xref linkend="contents-xz" role="."/> --></para>
</sect2>
</sect1>

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