Split Chapter 5 into three separate chapters.

Implement a new method of cross-building the LFS tool chain
and other tools to simplify the method of isolating the 
new system from the original host.  This will be the start of
LFS-10.0.

Move old trunk/BOOK to branches/old-trunk.



git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@11946 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
Bruce Dubbs 2020-06-16 11:56:28 +00:00
commit 675606bde2
200 changed files with 7503 additions and 8165 deletions

View File

@ -26,7 +26,7 @@ ifeq ($(REV), sysv)
BASEDIR ?= ~/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
@ -46,9 +46,6 @@ book: validate profile-html
@echo "Copying CSS code and images..."
$(Q)mkdir -p $(BASEDIR)/stylesheets
$(Q)cp stylesheets/lfs-xsl/*.css $(BASEDIR)/stylesheets
$(Q)pushd $(BASEDIR)/ > /dev/null; \
# sed -i -e "s@../stylesheets@stylesheets@g" *.html; \
popd > /dev/null
$(Q)mkdir -p $(BASEDIR)/images
$(Q)cp images/*.png $(BASEDIR)/images

View File

@ -828,8 +828,8 @@
</seglistitem>
</segmentedlist>
<!-- Begin Gcc dependency info -->
<bridgehead renderas="sect2" id="gcc-dep">Gcc</bridgehead>
<!-- Begin GCC dependency info -->
<bridgehead renderas="sect2" id="gcc-dep">GCC</bridgehead>
<segmentedlist>
<segtitle>&dependencies;</segtitle>
@ -1948,7 +1948,7 @@
<segtitle>&dependencies;</segtitle>
<seglistitem>
<seg>Binutils, Coreutils, Gcc, and Python</seg>
<seg>Binutils, Coreutils, GCC, and Python</seg>
</seglistitem>
</segmentedlist>
@ -1983,7 +1983,7 @@
<segtitle>&dependencies;</segtitle>
<seglistitem>
<seg>Binutils, Coreutils, Gcc, Make, and Perl</seg>
<seg>Binutils, Coreutils, GCC, Make, and Perl</seg>
</seglistitem>
</segmentedlist>

View File

@ -43,6 +43,19 @@
appropriate for the entry or if needed the entire day's listitem.
-->
<listitem>
<para>2020-06-16</para>
<itemizedlist>
<listitem>
<para>[bdubbs] - Split Chapter 5 into three separate chapters.
Implement a new method of cross-building the LFS tool chain
and other tools to simplify the method of isolating the
new system from the original host. This will be the start of
LFS-10.0.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>2020-06-03</para>
<itemizedlist>
@ -216,6 +229,16 @@
</itemizedlist>
</listitem>
<listitem>
<para>2020-05-09</para>
<itemizedlist>
<listitem>
<para>[pierre] - Patch GCC pass 2 to allow cross-compile
(specific to new cross method).</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>2020-05-08</para>
<itemizedlist>

View File

@ -44,42 +44,28 @@
discusses the setup of an appropriate working environment. Please read
<xref linkend="chapter-final-preps"/> carefully as it explains several
important issues you need be aware of before beginning to
work your way through <xref linkend="chapter-temporary-tools"/> and beyond.</para>
work your way through <xref linkend="chapter-cross-tools"/> and beyond.</para>
<para><xref linkend="chapter-temporary-tools"/> explains the
installation of a number of packages that will form the basic
development suite (or toolchain) which is used to build the actual
system in <xref linkend="chapter-building-system"/>. Some of these
packages are needed to resolve circular dependencies&mdash;for example,
to compile a compiler, you need a compiler.</para>
<para><xref linkend="chapter-cross-tools"/>, explains the installation of
the initial tool chain, (binutils, gcc, and glibc) using cross compilation
techniques to isolate the new tools from the host system.</para>
<para><xref linkend="chapter-temporary-tools"/> also shows you how to
build a first pass of the toolchain, including Binutils and GCC (first pass
basically means these two core packages will be reinstalled).
The next step is to build Glibc, the C library. Glibc will be compiled by
the toolchain programs built in the first pass. Then, a second pass of the
toolchain will be built. This time, the toolchain will be dynamically linked
against the newly built Glibc. The remaining <xref
linkend="chapter-temporary-tools"/> packages are built using this second
pass toolchain. When this is done, the LFS installation process will no
longer depend on the host distribution, with the exception of the running
kernel. </para>
<para><xref linkend="chapter-temporary-tools"/> shows you how to
cross-compile basic utilities using the just built cross-toolchain.</para>
<para><xref linkend="chapter-chroot-temporary-tools"/> then enters a
"chroot" environment and uses the previously built tools to build
the additional tools needed to build and test the final system.</para>
<para>This effort to isolate the new system from the host distribution may
seem excessive. A full technical explanation as to why this is done is provided in
<xref linkend="ch-tools-toolchaintechnotes"/>.</para>
seem excessive. A full technical explanation as to why this is done is
provided in <xref linkend="ch-tools-toolchaintechnotes"/>.</para>
<para>In <xref linkend="chapter-building-system"/>, the full LFS system is
built. The <command>chroot</command> (change root) program is used to enter
a virtual environment and start a new shell whose root directory will be
set to the LFS partition. This is very similar to rebooting and instructing
the kernel to mount the LFS partition as the root partition. The system
does not actually reboot, but instead uses <command>chroot</command> because
creating a bootable system requires additional work which is not necessary
just yet. The major advantage is that <quote>chrooting</quote> allows you
to continue using the host system while LFS is being built. While waiting
for package compilations to complete, you can continue using your computer as
normal.</para>
<para>In <xref linkend="chapter-building-system"/>, The
full LFS system is built. Another advantage provided by the chroot
environment is that it allows you to continue using the host system
while LFS is being built. While waiting for package compilations to
complete, you can continue using your computer as normal.</para>
<para>To finish the installation, the basic system configuration is set up in
<xref linkend="chapter-config"/>, and the kernel and boot loader are set

View File

@ -11,6 +11,10 @@
<title>What's new since the last release</title>
<para>In this version of LFS, there has been a major reorganization
of the book using techniques that avoid changing the host system
and provides a more straight forward build process.</para>
<para>Below is a list of package updates made since the previous
release of the book.</para>

View File

@ -52,42 +52,9 @@
<screen role="nodump"><userinput>mkfs -v -t ext4 /dev/<replaceable>&lt;xxx&gt;</replaceable></userinput></screen>
<!--
<para>Replace <replaceable>&lt;xxx&gt;</replaceable> with the name of the LFS
partition (<filename class="devicefile">sda5</filename> in our previous
example).</para>
partition.</para>
<note>
<para>Some host distributions use custom features in their filesystem
creation tools (E2fsprogs). This can cause problems when booting into your new
LFS in Chapter&nbsp;9, as those features will not be supported by the LFS-installed
E2fsprogs; you will get an error similar to <quote>unsupported filesystem
features, upgrade your e2fsprogs</quote>. To check if your host system
uses custom enhancements, run the following command:</para>
<screen role="nodump"><userinput>debugfs -R feature /dev/<replaceable>&lt;xxx&gt;</replaceable></userinput></screen>
<para>If the output contains features other than
<option>has_journal</option>, <option>ext_attr</option>,
<option>resize_inode</option>, <option>dir_index</option>,
<option>filetype</option>, <option>sparse_super</option>,
<option>large_file</option> or <option>needs_recovery</option>, then your
host system may have custom enhancements. In that case, to avoid later
problems, you should compile the stock E2fsprogs package and use the
resulting binaries to re-create the filesystem on your LFS partition:</para>
<screen role="nodump"><userinput>cd /tmp
tar -xzvf /path/to/sources/e2fsprogs-&e2fsprogs-version;.tar.gz
cd e2fsprogs-&e2fsprogs-version;
mkdir -v build
cd build
../configure
make #note that we intentionally don't 'make install' here!
./misc/mke2fs -jv /dev/<replaceable>&lt;xxx&gt;</replaceable>
cd /tmp
rm -rfv e2fsprogs-&e2fsprogs-version;</userinput></screen>
</note>
-->
<para>If you are using an existing <systemitem class="filesystem">swap
</systemitem> partition, there is no need to format it. If a new
<systemitem class="filesystem"> swap</systemitem> partition was created,

View File

@ -15,21 +15,6 @@
is to use an available empty partition or, if you have enough unpartitioned
space, to create one.</para>
<!--
<para>It is possible to install an LFS system (in fact even multiple LFS
systems) on a partition already occupied by another
operating system and the different systems will co-exist peacefully. The
document <ulink url="&hints-root;lfs_next_to_existing_systems.txt"/>
contains notes on how to implement this. This document was last updated
in 2004. It has not been updated since and it has not been tested with
recent versions of this LFS book. The document is more than likely not
usable as-is and you will need to account for changes made to the LFS
procedures since it was written. This is only recommended for expert LFS
users.</para>
-->
<para>A minimal system requires a partition of around 10 gigabytes (GB).
This is enough to store all the source tarballs and compile the packages.
However, if the LFS system is intended to be the primary Linux system,
@ -77,7 +62,7 @@
<title>Other Partition Issues</title>
<para>Requests for advice on system partitioning are often posted on the LFS mailing
lists. This is a highly subjective topic. The default for most distributions
lists. This is a highly subjective topic. The default for most distributions
is to use the entire drive with the exception of one small swap partition. This
is not optimal for LFS for several reasons. It reduces flexibility, makes
sharing of data across multiple distributions or LFS builds more difficult, makes
@ -89,7 +74,7 @@
<para>A root LFS partition (not to be confused with the
<filename class="directory">/root</filename> directory) of
ten gigabytes is a good compromise for most systems. It provides enough
twenty gigabytes is a good compromise for most systems. It provides enough
space to build LFS and most of BLFS, but is small enough so that multiple
partitions can be easily created for experimentation.</para> </sect3>
@ -102,13 +87,21 @@
hold the swap partition to two gigabytes and monitor the amount of disk
swapping.</para>
<para>Swapping is never good. Generally you can tell if a system is
swapping by just listening to disk activity and observing how the system
reacts to commands. The first reaction to swapping should be to check for
an unreasonable command such as trying to edit a five gigabyte file. If
swapping becomes a normal occurrence, the best solution is to purchase more
RAM for your system.</para>
</sect3>
<para>If you want to use the hibernation feature (suspend-to-disk) of Linux,
it writes out the contents of RAM to the swap partition before turning off
the machine. In this case the size of the swap partition should be at
least as large as the system's installed RAM.</para>
<para>Swapping is never good. For mechanical hard drives you can generally
tell if a system is swapping by just listening to disk activity and
observing how the system reacts to commands. For an SSD drive you will not
be able to hear swapping but you can tell how much swap space is being used
by the <command>top</command> or <command>free</command> programs. Use of
an SSD drive for a swap partition should be avoided if possible. The first
reaction to swapping should be to check for an unreasonable command such as
trying to edit a five gigabyte file. If swapping becomes a normal
occurrence, the best solution is to purchase more RAM for your
system.</para> </sect3>
<sect3>
<title>The Grub Bios Partition</title>
@ -140,7 +133,7 @@
<listitem><para>/boot &ndash; Highly recommended. Use this partition to
store kernels and other booting information. To minimize potential boot
problems with larger disks, make this the first physical partition on
your first disk drive. A partition size of 100 megabytes is quite
your first disk drive. A partition size of 200 megabytes is quite
adequate.</para></listitem>
<listitem><para>/home &ndash; Highly recommended. Share your home
@ -150,7 +143,7 @@
<listitem><para>/usr &ndash; A separate /usr partition is generally used
if providing a server for a thin client or diskless workstation. It is
normally not needed for LFS. A size of five gigabytes will handle most
normally not needed for LFS. A size of ten gigabytes will handle most
installations.</para></listitem>
<listitem><para>/opt &ndash; This directory is most useful for

View File

@ -25,49 +25,55 @@
<itemizedlist>
<listitem>
<para>Procedures done as the root user after Section 2.4 need to
have the LFS environment variable set <emphasis>FOR THE ROOT
USER</emphasis>.</para>
<para>Procedures done as the root user after Section 2.4 need to
have the LFS environment variable set <emphasis>FOR THE ROOT
USER</emphasis>.</para>
</listitem>
</itemizedlist>
</sect2>
<sect2>
<title>Chapter&nbsp;5</title>
<title>Chapter&nbsp;5&ndash;6</title>
<itemizedlist>
<listitem>
<para>The /mnt/lfs partition must be mounted.</para>
<para>The /mnt/lfs partition must be mounted.</para>
</listitem>
<listitem>
<para><emphasis>ALL</emphasis> instructions in Chapter&nbsp;5
must be done by user <emphasis>lfs</emphasis>.
A <command>su - lfs</command> needs to be done before any
task in Chapter&nbsp;5.</para>
<para>Threse two chapters must be done as user <emphasis>lfs</emphasis>.
A <command>su - lfs</command> needs to be done before any task in these
chapters. Failing to do that, you are at risk of installing packages to the
host, and potentially rendering it unusable.</para>
</listitem>
<listitem>
<para>The procedures in <xref linkend='ch-tools-generalinstructions'/>
are critical. If there is any
doubt about installing a package, ensure any previously expanded
tarballs are removed, re-extract the package files, and complete all
tarballs are removed, then re-extract the package files, and complete all
instructions in that section.</para>
</listitem>
</itemizedlist>
</sect2>
<sect2>
<title>Chapters&nbsp;6&ndash;8</title>
<title>Chapter&nbsp;7&ndash;10</title>
<itemizedlist>
<listitem>
<para>The /mnt/lfs partition must be mounted.</para>
</listitem>
<listitem>
<para>A few operations, from <quote>Changing Ownership</quote> to
<quote>Entering the Chroot Environment</quote> must be done as the
root user, with the LFS envirnment variable set for the root user.</para>
</listitem>
<listitem>
<para> When entering chroot, the LFS environment variable must be set
for root. The LFS variable is not used otherwise.</para>
for root. The LFS variable is not used afterwards.</para>
</listitem>
<listitem>

View File

@ -50,24 +50,7 @@
<para>MD5 sum: <literal>&coreutils-i18n-patch-md5;</literal></para>
</listitem>
</varlistentry>
<!--
<varlistentry>
<term>Flex Fixes Patch - <token>&flex-fixes-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&flex-fixes-patch;"/></para>
<para>MD5 sum: <literal>&flex-fixes-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<!--
<varlistentry>
<term>Gccc ASAN Patch - <token>&gcc-asan-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&gcc-asan-patch;"/></para>
<para>MD5 sum: <literal>&gcc-asan-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<varlistentry>
<term>Glibc FHS Patch - <token>&glibc-fhs-patch-size;</token>:</term>
<listitem>
@ -75,15 +58,15 @@
<para>MD5 sum: <literal>&glibc-fhs-patch-md5;</literal></para>
</listitem>
</varlistentry>
<!--
<varlistentry>
<term>Glibc Glob Security Patch - <token>&glibc-glob-patch-size;</token>:</term>
<term>GCC Cross Build Fix Patch - <token>&gcc-cross-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&glibc-glob-patch;"/></para>
<para>MD5 sum: <literal>&glibc-glob-patch-md5;</literal></para>
<para>Download: <ulink url="&patches-root;&gcc-cross-patch;"/></para>
<para>MD5 sum: <literal>&gcc-cross-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<varlistentry>
<term>Kbd Backspace/Delete Fix Patch - <token>&kbd-backspace-patch-size;</token>:</term>
<listitem>
@ -91,24 +74,7 @@
<para>MD5 sum: <literal>&kbd-backspace-patch-md5;</literal></para>
</listitem>
</varlistentry>
<!--
<varlistentry>
<term>Ninja Limit Jobs Patch - <token>&ninja-limit-jobs-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&ninja-limit-jobs-patch;"/></para>
<para>MD5 sum: <literal>&ninja-limit-jobs-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<!--
<varlistentry>
<term>Readline Upstream Fixes Patch - <token>&readline-fixes-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&readline-fixes-patch;"/></para>
<para>MD5 sum: <literal>&readline-fixes-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<varlistentry revision="sysv">
<term>Sysvinit Consolidated Patch - <token>&sysvinit-consolidated-patch-size;</token>:</term>
<listitem>
@ -116,15 +82,6 @@
<para>MD5 sum: <literal>&sysvinit-consolidated-patch-md5;</literal></para>
</listitem>
</varlistentry>
<!--
<varlistentry revision="systemd">
<term>Systemd Consolidated Patch - <token>&systemd-consolidated-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&systemd-consolidated-patch;"/></para>
<para>MD5 sum: <literal>&systemd-consolidated-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
<varlistentry revision="systemd">
<term>Systemd GCC-10 Patch - <token>&systemd-gcc10-patch-size;</token>:</term>

View File

@ -20,16 +20,16 @@
used instead.</para>
<para>The SBU measure works as follows. The first package to be compiled
from this book is Binutils in <xref linkend="chapter-temporary-tools"/>. The
from this book is binutils in <xref linkend="chapter-cross-tools"/>. The
time it takes to compile this package is what will be referred to as the
Standard Build Unit or SBU. All other compile times will be expressed relative
to this time.</para>
<para>For example, consider a package whose compilation time is 4.5
SBUs. This means that if a system took 10 minutes to compile and
install the first pass of Binutils, it will take
install the first pass of binutils, it will take
<emphasis>approximately</emphasis> 45 minutes to build this example package.
Fortunately, most build times are shorter than the one for Binutils.</para>
Fortunately, most build times are shorter than the one for binutils.</para>
<para>In general, SBUs are not entirely accurate because they depend on many
factors, including the host system's version of GCC. They are provided here
@ -41,13 +41,13 @@
compilation time for a package can be reduced by performing a "parallel
make" by either setting an environment variable or telling the
<command>make</command> program how many processors are available. For
instance, a Core2Duo can support two simultaneous processes with:</para>
instance, an Intel i5-6500 CPU can support four simultaneous processes with:</para>
<screen role="nodump"><userinput>export MAKEFLAGS='-j 2'</userinput></screen>
<screen role="nodump"><userinput>export MAKEFLAGS='-j4'</userinput></screen>
<para>or just building with:</para>
<screen role="nodump"><userinput>make -j2</userinput></screen>
<screen role="nodump"><userinput>make -j4</userinput></screen>
<para>When multiple processors are used in this way, the SBU units in the
book will vary even more than they normally would. In some cases, the make

View File

@ -18,25 +18,20 @@
that the package is totally bug free.</para>
<para>Some test suites are more important than others. For example,
the test suites for the core toolchain packages&mdash;GCC, Binutils, and
Glibc&mdash;are of the utmost importance due to their central role in a
properly functioning system. The test suites for GCC and Glibc can
the test suites for the core toolchain packages&mdash;GCC, binutils, and
glibc&mdash;are of the utmost importance due to their central role in a
properly functioning system. The test suites for GCC and glibc can
take a very long time to complete, especially on slower hardware, but
are strongly recommended.</para>
<note>
<para>Experience has shown that there is little to be gained from running
the test suites in <xref linkend="chapter-temporary-tools"/>. There can be
no escaping the fact that the host system always exerts some influence on
the tests in that chapter, often causing inexplicable failures. Because
the tools built in <xref linkend="chapter-temporary-tools"/> are temporary
and eventually discarded, we do not recommend running the test suites in
<xref linkend="chapter-temporary-tools"/> for the average reader. The
instructions for running those test suites are provided for the benefit of
testers and developers, but they are strictly optional.</para>
<para>Running the test suites in <xref linkend="chapter-cross-tools"/>
and <xref linkend="chapter-temporary-tools"/>
is impossible, since the programs are compiled with a cross-compiler,
so are not supposed to be able to run on the build host.</para>
</note>
<para>A common issue with running the test suites for Binutils and GCC
<para>A common issue with running the test suites for binutils and GCC
is running out of pseudo terminals (PTYs). This can result in a high
number of failing tests. This may happen for several reasons, but the
most likely cause is that the host system does not have the

View File

@ -11,8 +11,8 @@
<title>Adding the LFS User</title>
<para>When logged in as user <systemitem class="username">root</systemitem>,
making a single mistake can damage or destroy a system. Therefore, we
recommend building the packages in the next chapter as an unprivileged user.
making a single mistake can damage or destroy a system. Therefore,
the packages in the next two chapters are built as an unprivileged user.
You could use your own user name, but to make it easier to set up a clean
working environment, create a new user called <systemitem
class="username">lfs</systemitem> as a member of a new group (also named
@ -62,7 +62,7 @@ useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen>
<varlistentry>
<term><parameter>lfs</parameter></term>
<listitem>
<para>This is the actual name for the created group and user.</para>
<para>This is the actual name for the created user.</para>
</listitem>
</varlistentry>
@ -77,10 +77,13 @@ useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen>
<screen role="nodump"><userinput>passwd lfs</userinput></screen>
<para>Grant <systemitem class="username">lfs</systemitem> full access to
<filename class="directory">$LFS/tools</filename> by making
all directories under <filename class="directory">$LFS</filename> by making
<systemitem class="username">lfs</systemitem> the directory owner:</para>
<screen><userinput>chown -v lfs $LFS/tools</userinput></screen>
<screen><userinput>chown -v lfs $LFS/{usr,lib,var,etc,bin,sbin,tools}
case $(uname -m) in
x86_64) chown -v lfs $LFS/lib64 ;;
esac</userinput></screen>
<para>If a separate working directory was created as suggested, give
user <systemitem class="username">lfs</systemitem> ownership of this
@ -95,7 +98,7 @@ useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen>
<para>Next, login as user <systemitem class="username">lfs</systemitem>.
This can be done via a virtual console, through a display manager, or with
the following substitute user command:</para>
the following substitute/switch user command:</para>
<screen role="nodump"><userinput>su - lfs</userinput></screen>

View File

@ -13,7 +13,7 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
<!--<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="aboutlfs.xml"/>-->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingtoolsdir.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingminlayout.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="addinguser.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="settingenviron.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="aboutsbus.xml"/>

View File

@ -0,0 +1,35 @@
<?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-creatingminlayout">
<?dbhtml filename="creatingminlayout.html"?>
<title>Creating the Minimal directory layout in LFS filesystem</title>
<para>The first task performed in the LFS partition is to create a minimal
directory hierarchy so that programs compiled in <xref
linkend="chapter-temporary-tools"/> may be installed in their final
location. This is needed so that those temporary programs be overwritten
when rebuilding them in <xref linkend="chapter-building-system"/>.</para>
<para>Create the required directory layout by running the following as
<systemitem class="username">root</systemitem>:</para>
<screen><userinput>mkdir -pv $LFS/{usr,lib,var,etc,bin,sbin}
case $(uname -m) in
x86_64) mkdir -pv $LFS/lib64 ;;
esac</userinput></screen>
<para>Programs in <xref linkend="chapter-temporary-tools"/> will be compiled
with a cross-compiler (more details in section <xref
linkend="ch-tools-toolchaintechnotes"/>). In order to separate this
cross-compiler from the other programs, it will be installed in a special
directory. Create this directory with:</para>
<screen><userinput>mkdir -pv $LFS/tools</userinput></screen>
</sect1>

View File

@ -11,7 +11,7 @@
<title>Introduction</title>
<para>In this chapter, we will perform a few additional tasks to prepare
for building the temporary system. We will create a directory in
for building the temporary system. We will create a set of directories in
<filename class="directory">$LFS</filename> for the installation of the
temporary tools, add an unprivileged user to reduce risk,
and create an appropriate build environment for that user. We will also

View File

@ -43,12 +43,14 @@ umask 022
LFS=/mnt/lfs
LC_ALL=POSIX
LFS_TGT=$(uname -m)-lfs-linux-gnu
PATH=/tools/bin:/bin:/usr/bin
PATH=/usr/bin
if [ ! -L /bin ]; then PATH=/bin:$PATH; fi
PATH=$LFS/tools/bin:$PATH
export LFS LC_ALL LFS_TGT PATH</literal>
EOF</userinput></screen>
<variablelist>
<title>The meaning of the command line options in <filename>.bashrc</filename></title>
<title>The meaning of the settings in <filename>.bashrc</filename></title>
<varlistentry>
<term><parameter>set +h</parameter></term>
@ -61,7 +63,7 @@ EOF</userinput></screen>
be used as soon as they are installed. By switching off the hash function,
the shell will always search the <envar>PATH</envar> when a program is to
be run. As such, the shell will find the newly compiled tools in
<filename class="directory">$LFS/tools</filename> as soon as they are
<filename class="directory">~/tools</filename> as soon as they are
available without remembering a previous version of the same program in a
different location.</para>
</listitem>
@ -108,14 +110,36 @@ EOF</userinput></screen>
</varlistentry>
<varlistentry>
<term><parameter>PATH=/tools/bin:/bin:/usr/bin</parameter></term>
<term><parameter>PATH=/usr/bin</parameter></term>
<listitem>
<para>By putting <filename class="directory">/tools/bin</filename> ahead of the
standard <envar>PATH</envar>, all the programs installed in <xref
linkend="chapter-temporary-tools"/> are picked up by the shell immediately after
their installation. This, combined with turning off hashing, limits the risk
that old programs are used from the host when the same programs are available in
the Chapter 5 environment.</para>
<para>Many modern linux distributions have merged <filename
class="directory">/bin</filename> and <filename
class="directory">/usr/bin</filename>. When this is the case, the standard
<envar>PATH</envar> variable needs just to be set to <filename
class="directory">/usr/bin/</filename> for the <xref
linkend="chapter-temporary-tools"/> environment. When this is not the
case, the following line adds <filename class="directory">/bin</filename>
to the path.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>if [ ! -L /bin ]; then PATH=/bin:$PATH; fi</parameter></term>
<listitem>
<para>If <filename class="directory">/bin</filename> is not a symbolic
link, then it has to be added to the <envar>PATH</envar> variable.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>PATH=$LFS/tools/bin:$PATH</parameter></term>
<listitem>
<para>By putting <filename class="directory">$LFS/tools/bin</filename> ahead of the
standard <envar>PATH</envar>, the cross-compiler installed at the beginning
of <xref linkend="chapter-cross-tools"/> is picked up by the shell
immediately after its installation. This, combined with turning off hashing,
limits the risk that the compiler from the host be used instead of the
cross-compiler.</para>
</listitem>
</varlistentry>
@ -123,7 +147,7 @@ EOF</userinput></screen>
<term><parameter>export LFS LC_ALL LFS_TGT PATH</parameter></term>
<listitem>
<para>While the above commands have set some variables, in order
to make them visible within any sub-shells, we export them</para>
to make them visible within any sub-shells, we export them.</para>
</listitem>
</varlistentry>

View File

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

View File

@ -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>
@ -33,8 +33,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&binutils-ch5p1-sbu;</seg>
<seg>&binutils-ch5p1-du;</seg>
<seg>&binutils-tmpp1-sbu;</seg>
<seg>&binutils-tmpp1-du;</seg>
</seglistitem>
</segmentedlist>
@ -63,18 +63,14 @@ cd build</userinput></screen>
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; ...
command like this: <userinput>time { ./configure ... &amp;&amp; make
&amp;&amp; make install; }</userinput>.</para>
</note>
<note><para>The approximate build SBU values and required disk space
in Chapter&nbsp;5 does not include test suite data.</para></note>
<para>Now prepare Binutils for compilation:</para>
<screen><userinput remap="configure">../configure --prefix=/tools \
<screen><userinput remap="configure">../configure --prefix=$LFS/tools \
--with-sysroot=$LFS \
--with-lib-path=/tools/lib \
--target=$LFS_TGT \
--disable-nls \
--disable-werror</userinput></screen>
@ -83,11 +79,11 @@ cd build</userinput></screen>
<title>The meaning of the configure options:</title>
<varlistentry>
<term><parameter>--prefix=/tools</parameter></term>
<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">/tools</filename>
directory.</para>
binutils programs in the <filename
class="directory">$LFS/tools</filename> directory.</para>
</listitem>
</varlistentry>
@ -99,21 +95,13 @@ cd build</userinput></screen>
</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
<command>configure</command> script to adjust binutil's build system
for building a cross linker. </para>
</listitem>
</varlistentry>
@ -140,19 +128,6 @@ cd build</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. Ordinarily we would now run the
test suite, but at this early stage the test suite framework (Tcl,
Expect, and DejaGNU) is not yet in place. The benefits of running the
tests at this point are minimal since the programs from this
first pass will soon be replaced by those from the second.</para>
<para>If building on x86_64, create a symlink to ensure the sanity of
the toolchain:</para>
<screen><userinput remap="install">case $(uname -m) in
x86_64) mkdir -v /tools/lib &amp;&amp; ln -sv lib /tools/lib64 ;;
esac</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>

View File

@ -1,156 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-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">CC=$LFS_TGT-gcc \
AR=$LFS_TGT-ar \
RANLIB=$LFS_TGT-ranlib \
../configure \
--prefix=/tools \
--disable-nls \
--disable-werror \
--with-lib-path=/tools/lib \
--with-sysroot</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>CC=$LFS_TGT-gcc AR=$LFS_TGT-ar RANLIB=$LFS_TGT-ranlib</parameter></term>
<listitem>
<para>Because this is really a native build of Binutils, setting these
variables ensures that the build system uses the cross-compiler and
associated tools instead of the ones on the host system.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-lib-path=/tools/lib</parameter></term>
<listitem>
<para>This tells the configure script to specify the library
search path during the compilation of Binutils, resulting in
<filename class="directory">/tools/lib</filename> being passed
to the linker. This prevents the linker from searching through
library directories on the host.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-sysroot</parameter></term>
<listitem>
<para>This defines a default (non-existent) sysroot directory
<filename class="directory">/tools/$LFS_TGT/sys-root</filename>.
It is useful when looking for shared objects which are required by
other shared objects explicitly included on the linker's command
line. Those objects are searched into the directories listed in
<filename>&lt;sysroot&gt;/etc/ld.so.conf</filename>, and failing
that, into the linker search path, which is right. If this switch
is not given, <filename>/etc/ld.so.conf</filename> on the host
is used, that is, programs may be linked to libraries on
the host, which we want to avoid.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>Now prepare the linker for the <quote>Re-adjusting</quote> phase in
the next chapter:</para>
<screen><userinput remap="adjust">make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
cp -v ld/ld-new /tools/bin</userinput></screen>
<variablelist>
<title>The meaning of the make parameters:</title>
<varlistentry>
<term><parameter>-C ld clean</parameter></term>
<listitem>
<para>This tells the make program to remove all compiled
files in the <filename class="directory">ld</filename>
subdirectory.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>-C ld LIB_PATH=/usr/lib:/lib</parameter></term>
<listitem>
<para>This option rebuilds everything in the <filename
class="directory">ld</filename> subdirectory. Specifying the
<envar>LIB_PATH</envar> Makefile variable on the command line
allows us to override the default value of the temporary tools
and point it to the proper final path. The value of this variable
specifies the linker's default library search path. This
preparation is used in the next chapter.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-binutils" role="."/></para>
</sect2>
</sect1>

View File

@ -1,91 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-bzip2" role="wrap">
<?dbhtml filename="bzip2.html"?>
<sect1info condition="script">
<productname>bzip2</productname>
<productnumber>&bzip2-version;</productnumber>
<address>&bzip2-url;</address>
</sect1info>
<title>Bzip2-&bzip2-version;</title>
<indexterm zone="ch-tools-bzip2">
<primary sortas="a-Bzip2">Bzip2</primary>
<secondary>tools</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/bzip2.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&bzip2-ch5-sbu;</seg>
<seg>&bzip2-ch5-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Bzip2</title>
<para>The Bzip2 package does not contain a <command>configure</command>
script. 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
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</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make PREFIX=/tools install
cp -v bzip2-shared /tools/bin/bzip2
cp -av libbz2.so* /tools/lib
ln -sv libbz2.so.1.0 /tools/lib/libbz2.so</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

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

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>Compiling a Cross-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,33 +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="binutils-pass2.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc-pass2.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tcl.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="expect.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dejagnu.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="m4.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="ncurses.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bash.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bison.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="coreutils.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="diffutils.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="file.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="findutils.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gawk.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gettext.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="grep.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gzip.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="make.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="patch.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="perl.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="python.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sed.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="tar.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="texinfo.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="util-linux.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="xz.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="stripping.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="changingowner.xml"/>
</chapter>

View File

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

View File

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

View File

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

View File

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

View File

@ -1,72 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-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=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results, issue:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-flex" role="."/></para>
</sect2>
</sect1>

View File

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

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>
@ -33,8 +33,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&gcc-ch5p1-sbu;</seg>
<seg>&gcc-ch5p1-du;</seg>
<seg>&gcc-tmpp1-sbu;</seg>
<seg>&gcc-tmpp1-du;</seg>
</seglistitem>
</segmentedlist>
@ -43,7 +43,7 @@
<sect2 role="installation">
<title>Installation of Cross GCC</title>
<para>GCC now requires the GMP, MPFR and MPC packages. As these packages may
<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
@ -62,42 +62,7 @@ mv -v gmp-&gmp-version; gmp
tar -xf ../mpc-&mpc-version;.tar.gz
mv -v mpc-&mpc-version; mpc</userinput></screen>
<para>The following command will change the location of GCC's default
dynamic linker to use the one installed in <filename
class="directory">/tools</filename>. It also removes <filename
class="directory">/usr/include</filename> from GCC's include search path.
Issue:</para>
<screen><userinput remap="pre">for file in gcc/config/{linux,i386/linux{,64}}.h
do
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
-e 's@/usr@/tools@g' $file.orig &gt; $file
echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' &gt;&gt; $file
touch $file.orig
done</userinput></screen>
<para>In case the above seems hard to follow, let's break it down a bit.
First we copy the files <filename>gcc/config/linux.h</filename>,
<filename>gcc/config/i386/linux.h</filename>, and
<filename>gcc/config/i386/linux64.h</filename> to a file of
the same name but with an added suffix of <quote>.orig</quote>. Then the
first sed expression prepends <quote>/tools</quote> to every instance of
<quote>/lib/ld</quote>, <quote>/lib64/ld</quote> or
<quote>/lib32/ld</quote>, while the second one replaces hard-coded
instances of <quote>/usr</quote>. Next, we add our define statements which
alter the default startfile prefix to the end of the file. Note that the
trailing <quote>/</quote> in <quote>/tools/lib/</quote> is required.
Finally, we use <command>touch</command> to update the timestamp on the
copied files. When used in conjunction with <command>cp -u</command>, this
prevents unexpected changes to the original files in case the commands are
inadvertently run twice.</para>
<para>Finally, on x86_64 hosts, set the default directory name for
<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
@ -107,19 +72,6 @@ done</userinput></screen>
;;
esac</userinput></screen>
<!--
<para>GCC doesn't detect stack protection correctly, which causes problems
for the build of Glibc-&glibc-version;, so fix that by issuing the following
command:</para>
<screen><userinput remap="pre">sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure</userinput></screen>
-->
<!--
<para>Also fix a problem identified upstream:</para>
<screen><userinput remap="pre">sed -i 's/if \((code.*))\)/if (\1 \&amp;\&amp; \!DEBUG_INSN_P (insn))/' gcc/sched-deps.c</userinput></screen>
-->
<para>The GCC documentation recommends building GCC
in a dedicated build directory:</para>
@ -130,13 +82,12 @@ cd build</userinput></screen>
<screen><userinput remap="configure">../configure \
--target=$LFS_TGT \
--prefix=/tools \
--prefix=$LFS/tools \
--with-glibc-version=2.11 \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
--with-local-prefix=/tools \
--with-native-system-header-dir=/tools/include \
--enable-initfini-array \
--disable-nls \
--disable-shared \
--disable-multilib \
@ -181,26 +132,11 @@ cd build</userinput></screen>
</varlistentry>
<varlistentry>
<term><parameter>--with-local-prefix=/tools</parameter></term>
<term><parameter>--enable-initfini-array</parameter></term>
<listitem>
<para>The local prefix is the location in the system that GCC will search
for locally installed include files. The default is <filename>/usr/local</filename>.
Setting this to <filename>/tools</filename> helps keep the host location of
<filename>/usr/local</filename> out of this GCC's search path.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-native-system-header-dir=/tools/include</parameter></term>
<listitem>
<para>By default, GCC searches <filename>/usr/include</filename> for
system headers. In conjunction with the sysroot switch, this would
normally translate to <filename>$LFS/usr/include</filename>. However
the headers that will be installed in the next two sections will go
to <filename>$LFS/tools/include</filename>. This switch ensures that
gcc will find them correctly. In the second pass of GCC, this same
switch will ensure that no headers from the host system are
found.</para>
<para>This switch forces the use of some internal data structures
that are needed but cannot be detected when building a cross
compiler.</para>
</listitem>
</varlistentry>
@ -208,33 +144,33 @@ cd build</userinput></screen>
<term><parameter>--disable-shared</parameter></term>
<listitem>
<para>This switch forces GCC to link its internal libraries
statically. We do this to avoid possible issues with the host
system.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-decimal-float, --disable-threads,
--disable-libatomic, --disable-libgomp, <!--- -disable-libmpx,-->
--disable-libquadmath, --disable-libssp, --disable-libvtv,
--disable-libstdcxx</parameter></term>
<listitem>
<para>These switches disable support for the decimal floating point
extension, threading, libatomic, libgomp, <!--libmpx, --> libquadmath, libssp,
libvtv, and the C++ standard library respectively. These features
will fail to compile when building a cross-compiler and are not
necessary for the task of cross-compiling the temporary libc.</para>
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-multilib</parameter></term>
<listitem>
<para>On x86_64, LFS does not yet support a multilib configuration.
<para>On x86_64, LFS does not support a multilib configuration.
This switch is harmless for x86.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-decimal-float, --disable-threads,
--disable-libatomic, --disable-libgomp,
--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, 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>--enable-languages=c,c++</parameter></term>
<listitem>
@ -249,26 +185,25 @@ cd build</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. At this point, the test suite would
normally be run, but, as mentioned before, the test suite framework is
not in place yet. The benefits of running the tests at this point
are minimal since the programs from this first pass will soon be
replaced.</para>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<!--
<para>Using <parameter>- -disable-shared</parameter> means that the
<filename>libgcc_eh.a</filename> file isn't created and installed. The
Glibc package depends on this library as it uses
<parameter>-lgcc_eh</parameter> within its build system. This dependency
can be satisfied by creating a symlink to <filename>libgcc.a</filename>,
since that file will end up containing the objects normally contained in
<filename>libgcc_eh.a</filename>:</para>
<screen><userinput remap="install">make install</userinput></screen>
<screen><userinput remap="install">ln -sv libgcc.a `$LFS_TGT-gcc -print-libgcc-file-name | sed 's/libgcc/&amp;_eh/'`</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">

View File

@ -1,232 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-gcc-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>Once again, change the location of GCC's default dynamic linker to
use the one installed in <filename
class="directory">/tools</filename>.</para>
<screen><userinput remap="pre">for file in gcc/config/{linux,i386/linux{,64}}.h
do
cp -uv $file{,.orig}
sed -e 's@/lib\(64\)\?\(32\)\?/ld@/tools&amp;@g' \
-e 's@/usr@/tools@g' $file.orig &gt; $file
echo '
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""' &gt;&gt; $file
touch $file.orig
done</userinput></screen>
<para>If building on x86_64, change the default directory name for 64-bit
libraries to <quote>lib</quote>:</para>
<screen><userinput remap="pre">case $(uname -m) in
x86_64)
sed -e '/m64=/s/lib64/lib/' \
-i.orig gcc/config/i386/t-linux64
;;
esac</userinput></screen>
<para>Our first build of GCC has installed a couple of internal system
headers. Normally one of them, <filename>limits.h</filename>, will in turn
include the corresponding system <filename>limits.h</filename> header, in
this case, <filename>/tools/include/limits.h</filename>. However, at the
time of the first build of gcc <filename>/tools/include/limits.h</filename>
did not exist, so the internal header that GCC installed is a partial,
self-contained file and does not include the extended features of the
system header. This was adequate for building the temporary libc, but this
build of GCC now requires the full internal header. Create a full version
of the internal header using a command that is identical to what the GCC
build system does in normal circumstances:</para>
<screen><userinput remap="pre">cat gcc/limitx.h gcc/glimits.h gcc/limity.h &gt; \
`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/include-fixed/limits.h</userinput></screen>
<!--
<para>For x86 machines, the limited number of registers is a bottleneck
for the system. Free one up by not using a frame pointer that is not
needed:</para>
<screen><userinput remap="pre">case `uname -m` in
i?86) sed -i 's/^T_CFLAGS =$/&amp; -fomit-frame-pointer/' gcc/Makefile.in ;;
esac</userinput></screen>
-->
<para>Create a separate build directory again:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Before starting to build GCC, remember to unset any environment
variables that override the default optimization flags.</para>
<para>Now prepare GCC for compilation:</para>
<screen><userinput remap="configure">CC=$LFS_TGT-gcc \
CXX=$LFS_TGT-g++ \
AR=$LFS_TGT-ar \
RANLIB=$LFS_TGT-ranlib \
../configure \
--prefix=/tools \
--with-local-prefix=/tools \
--with-native-system-header-dir=/tools/include \
--enable-languages=c,c++ \
--disable-libstdcxx-pch \
--disable-multilib \
--disable-bootstrap \
--disable-libgomp</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>--enable-languages=c,c++</parameter></term>
<listitem>
<para>This option ensures that both the C and C++ compilers are
built.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-libstdcxx-pch</parameter></term>
<listitem>
<para>Do not build the pre-compiled header (PCH) for
<filename class="libraryfile">libstdc++</filename>. It takes up a
lot of space, and we have no use for it.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-bootstrap</parameter></term>
<listitem>
<para>For native builds of GCC, the default is to do a "bootstrap"
build. This does not just compile GCC, but compiles it several times.
It uses the programs compiled in a first round to compile itself a
second time, and then again a third time. The second and third
iterations are compared to make sure it can reproduce itself
flawlessly. This also implies that it was compiled correctly.
However, the LFS build method should provide a solid compiler
without the need to bootstrap each time.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<para>As a finishing touch, create a symlink. Many programs and scripts
run <command>cc</command> instead of <command>gcc</command>, which is
used to keep programs generic and therefore usable on all kinds of UNIX
systems where the GNU C compiler is not always installed. Running
<command>cc</command> leaves the system administrator free to decide
which C compiler to install:</para>
<screen><userinput remap="install">ln -sv gcc /tools/bin/cc</userinput></screen>
<caution>
<para>At this point, it is imperative to stop and ensure that the basic
functions (compiling and linking) of the new toolchain are working as
expected. To perform a sanity check, run the following commands:</para>
<screen><userinput>echo 'int main(){}' &gt; dummy.c
cc dummy.c
readelf -l a.out | grep ': /tools'</userinput></screen>
<para>If everything is working correctly, there should be no errors,
and the output of the last command will be of the form:</para>
<screen><computeroutput>[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
<para>Note that the dynamic linker will be /tools/lib/ld-linux.so.2
for 32-bit machines.</para>
<para>If the output is not shown as above or there was no output at all,
then something is wrong. Investigate and retrace the steps to find out
where the problem is and correct it. This issue must be resolved before
continuing on. First, perform the sanity check again, using
<command>gcc</command> instead of <command>cc</command>. If this works,
then the <filename class="symlink">/tools/bin/cc</filename> symlink is
missing. Install the symlink as per above.
Next, ensure that the <envar>PATH</envar> is correct. This
can be checked by running <command>echo $PATH</command> and verifying that
<filename class="directory">/tools/bin</filename> is at the head of the
list. If the <envar>PATH</envar> is wrong it could mean that you are not
logged in as user <systemitem class="username">lfs</systemitem> or that
something went wrong back in <xref linkend="ch-preps-settingenviron"
role="."/></para>
<para>Once all is well, clean up the test files:</para>
<screen><userinput>rm -v dummy.c a.out</userinput></screen>
</caution>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-gcc" role="."/></para>
</sect2>
</sect1>

View File

@ -18,7 +18,7 @@
<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.
both this and the following chapters, but sometimes in only one location.
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
@ -81,9 +81,9 @@
<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
<filename class="directory">/mnt/lfs/sources/</filename>.<!-- Do
<emphasis>not</emphasis> put sources in
<filename class="directory">/mnt/lfs/tools/</filename>.</para>
<filename class="directory">/mnt/lfs/tools/</filename>. --></para>
</listitem>
<listitem>
<para>Change to the sources directory.</para>
@ -93,8 +93,8 @@
<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>
to be built. In Chapters 5 and 6, 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

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>
@ -33,8 +33,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&glibc-ch5-sbu;</seg>
<seg>&glibc-ch5-du;</seg>
<seg>&glibc-tmp-sbu;</seg>
<seg>&glibc-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -43,6 +43,25 @@
<sect2 role="installation">
<title>Installation of Glibc</title>
<para>First, create a symbolic link for LSB compliance. Additionally,
for x86_64, create a compatibility symbolic link required for proper
operation of the dynamic library loader:</para>
<screen><userinput remap="pre">case $(uname -m) in
i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3
;;
x86_64) 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
;;
esac</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>
@ -52,11 +71,12 @@ cd build</userinput></screen>
<para>Next, prepare Glibc for compilation:</para>
<screen><userinput remap="configure">../configure \
--prefix=/tools \
--prefix=/usr \
--host=$LFS_TGT \
--build=$(../scripts/config.guess) \
--enable-kernel=&min-kernel; \
--with-headers=/tools/include</userinput></screen>
--with-headers=$LFS/usr/include \
libc_cv_slibdir=/lib</userinput></screen>
<!--
libc_cv_forced_unwind=yes \
libc_cv_c_cleanup=yes</userinput></screen> -->
@ -68,7 +88,7 @@ cd build</userinput></screen>
<term><parameter>--host=$LFS_TGT, --build=$(../scripts/config.guess)</parameter></term>
<listitem>
<para>The combined effect of these switches is that Glibc's build system
configures itself to cross-compile, using the cross-linker and
configures itself to be cross-compiled, using the cross-linker and
cross-compiler in <filename class="directory">/tools</filename>.</para>
</listitem>
</varlistentry>
@ -83,43 +103,22 @@ cd build</userinput></screen>
</varlistentry>
<varlistentry>
<term><parameter>--with-headers=/tools/include</parameter></term>
<term><parameter>--with-headers=$LFS/usr/include</parameter></term>
<listitem>
<para>This tells Glibc to compile itself against the headers recently
installed to the tools directory, so that it knows exactly what
features the kernel has and can optimize itself accordingly.</para>
<para>This tells Glibc to compile itself against the headers
recently installed to the $LFS/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_forced_unwind=yes</parameter></term>
<term><parameter>libc_cv_slibdir=/lib</parameter></term>
<listitem>
<para>The linker installed during
<xref linkend="ch-tools-binutils-pass1"/> was cross-compiled and as
such cannot be used until Glibc has been installed. This means that
the configure test for force-unwind support will fail, as it relies on
a working linker. The libc_cv_forced_unwind=yes variable is passed in
order to inform <command>configure</command> that force-unwind
support is available without it having to run the test.</para>
<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>
@ -147,40 +146,71 @@ cd build</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<warning><para>If <envar>LFS</envar> is not properly set, and despite the
recommendations, you are building as root, the next command will install
the newly built glibc to your host system, which most likely will render it
unusable. So double check that the environment is correctly set for user
<systemitem class="username">lfs</systemitem>.</para></warning>
<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 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 ': /tools'</userinput></screen>
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>
<para>If everything is working correctly, there should be no errors,
and the output of the last command will be of the form:</para>
<screen><computeroutput>[Requesting program interpreter: /tools/lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
<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>/tools/lib/ld-linux.so.2</filename>.</para>
<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>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>
<para>Once all is well, clean up the test files:</para>
<screen><userinput>rm -v dummy.c a.out</userinput></screen>
</caution>
</caution>
<note><para>Building Binutils in the section after next will serve as an
additional check that the toolchain has been built properly. If Binutils
fails to build, it is an indication that something has gone wrong with the
previous Binutils, GCC, or Glibc installations.</para></note>
<note><para>Building packages in the next chapter 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 a utility provided by the GCC
developers:</para>
<screen><userinput>$LFS/tools/libexec/gcc/$LFS_TGT/&gcc-version;/install-tools/mkheaders</userinput></screen>
</sect2>

View File

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

View File

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

View File

@ -10,20 +10,15 @@
<title>Introduction</title>
<para>This chapter shows how to build a minimal Linux system.
This system will contain just enough tools to start constructing the final
LFS system in <xref linkend="chapter-building-system"/> and allow a working
environment with more user convenience than a minimum environment would.</para>
<para>This chapter shows how to build a cross-compiler and its associated
tools. Although here cross-compilation is faked, the principles are
the same as for a real cross-toolchain, and are detailed in the next
section.</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
<para>The programs compiled in this chapter will be installed under the
<filename class="directory">$LFS/tools</filename> directory to keep them
separate from the files installed in the next chapter and the host
production directories. Since the packages compiled here are temporary,
we do not want them to pollute the soon-to-be LFS system.</para>
separate from the files installed in the following chapters. The libraries,
on the other hand, are installed into their final place, since they pertain
to the system we want to build.</para>
</sect1>

View File

@ -5,8 +5,8 @@
%general-entities;
]>
<sect1 id="ch-tools-libstdcpp" role="wrap">
<?dbhtml filename="gcc-libstdc++.html"?>
<sect1 id="ch-tools-libstdcpp-pass1" role="wrap">
<?dbhtml filename="gcc-libstdc++-pass1.html"?>
<sect1info condition="script">
<productname>gcc-libstdc++</productname>
@ -14,11 +14,11 @@
<address>&gcc-url;</address>
</sect1info>
<title>Libstdc++ from GCC-&gcc-version;</title>
<title>Libstdc++ from GCC-&gcc-version;, Pass 1</title>
<indexterm zone="ch-tools-libstdcpp">
<indexterm zone="ch-tools-libstdcpp-pass1">
<primary sortas="a-GCC">GCC</primary>
<secondary>tools, libstdc++</secondary>
<secondary>tools, libstdc++ pass 1</secondary>
</indexterm>
<sect2 role="package">
@ -28,7 +28,8 @@
to compile C++ code
(part of GCC is written in C++), but we had to defer its installation
when we built <xref linkend="ch-tools-gcc-pass1"/>
because it depends on glibc, which was not yet available in /tools.
because it depends on glibc, which was not yet available in the target
directory.
</para>
<segmentedlist>
@ -36,8 +37,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&libstdcpp-ch5-sbu;</seg>
<seg>&libstdcpp-ch5-du;</seg>
<seg>&libstdcpp-tmpp1-sbu;</seg>
<seg>&libstdcpp-tmpp1-du;</seg>
</seglistitem>
</segmentedlist>
@ -52,19 +53,19 @@
<filename>gcc-&gcc-version;</filename> directory.</para>
</note>
<para>Create a separate build directory for Libstdc++ and enter it:</para>
<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>
<para>Prepare libstdc++ for compilation:</para>
<screen><userinput remap="configure">../libstdc++-v3/configure \
--host=$LFS_TGT \
--prefix=/tools \
--build=$(../config.guess) \
--prefix=/usr \
--disable-multilib \
--disable-nls \<!--
- -disable-libstdcxx-threads \-->
--disable-nls \
--disable-libstdcxx-pch \
--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen>
@ -74,19 +75,11 @@ cd build</userinput></screen>
<varlistentry>
<term><parameter>--host=...</parameter></term>
<listitem>
<para>Indicates to use the cross compiler we have just built
<para>Specifies the use the cross compiler we have just built
instead of the one in <filename>/usr/bin</filename>.</para>
</listitem>
</varlistentry>
<!--
<varlistentry>
<term><parameter>- -disable-libstdcxx-threads</parameter></term>
<listitem>
<para>Since gcc-pass1 is built without thread support, the C++
thread library cannot be built either.</para>
</listitem>
</varlistentry>
-->
<varlistentry>
<term><parameter>--disable-libstdcxx-pch</parameter></term>
<listitem>
@ -98,9 +91,9 @@ cd build</userinput></screen>
<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>
<para>This is the location where the C++ compiler should search for the
standard include files. 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>
@ -114,7 +107,7 @@ cd build</userinput></screen>
<para>Install the library:</para>
<screen><userinput remap="install">make install</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>

View File

@ -24,17 +24,16 @@
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/linux-headers.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<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>
<seg>&linux-headers-tmp-sbu;</seg>
<seg>&linux-headers-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -60,15 +59,148 @@
location.</para>
<screen><userinput remap="make">make headers
</userinput><userinput remap="install">cp -rv usr/include/* /tools/include</userinput></screen>
find usr/include -name '.*' -delete
rm usr/include/Makefile
</userinput><userinput remap="install">cp -rv usr/include $LFS/usr</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<sect2 id="contents-linux-headers" role="content">
<title>Contents of Linux API Headers</title>
<para>Details on this package are located in
<xref linkend="contents-linux-headers" role="."/></para>
<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>

View File

@ -1,79 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-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=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the M4 test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-m4" role="."/></para>
</sect2>
</sect1>

View File

@ -1,123 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-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>Prepare Ncurses for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools \
--with-shared \
--without-debug \
--without-ada \
--enable-widec \
--enable-overwrite</userinput></screen>
<variablelist>
<title>The meaning of the 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-overwrite</parameter></term>
<listitem>
<para>This tells Ncurses to install its header files into
<filename class="directory">/tools/include</filename>, instead of
<filename class="directory">/tools/include/ncurses</filename>, to
ensure that other packages can find the Ncurses headers
successfully.</para>
</listitem>
</varlistentry>
<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>
</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
ln -s libncursesw.so /tools/lib/libncurses.so</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-ncurses" role="."/></para>
</sect2>
</sect1>

View File

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-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=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Patch test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-patch" role="."/></para>
</sect2>
</sect1>

View File

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-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=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Sed test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-sed" role="."/></para>
</sect2>
</sect1>

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-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>strip --strip-debug /tools/lib/*
/usr/bin/strip --strip-unneeded /tools/{,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.
Also use the system strip command to include the strip binary in /tools.</para>
<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 /tools/{,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 /tools/{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

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-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=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Tar test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-tar" role="."/></para>
</sect2>
</sect1>

View File

@ -16,151 +16,322 @@
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 overall goal of this chapter and <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>
<note>
<para>Before continuing, be aware of the name of the working platform,
often referred to as the target triplet. A simple way to determine the
name of the target 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>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>
<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>
<sect2 id="cross-compile" xreflabel="About Cross-Compilation">
<para>Some key technical points of how the <xref
linkend="chapter-temporary-tools"/> build method works:</para>
<title>About Cross-Compilation</title>
<itemizedlist>
<listitem>
<para>Slightly adjusting the name of the working platform, by changing the
&quot;vendor&quot; field target triplet by way of the
<envar>LFS_TGT</envar> variable, ensures that the first build of Binutils
and GCC produces a compatible cross-linker and cross-compiler. Instead of
producing binaries for another architecture, the cross-linker and
cross-compiler will produce binaries compatible with the current
hardware.</para>
</listitem>
<listitem>
<para> The temporary libraries are cross-compiled. Because a
cross-compiler by its nature cannot rely on anything from its host
system, this method removes potential contamination of the target
system by lessening the chance of headers or libraries from the host
being incorporated into the new tools. Cross-compilation also allows for
the possibility of building both 32-bit and 64-bit libraries on 64-bit
capable hardware.</para>
</listitem>
<listitem>
<para>Careful manipulation of the GCC source tells the compiler which target
dynamic linker will be used.</para>
</listitem>
</itemizedlist>
<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>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>Let us first define some terms used in this context:</para>
<para>Binutils installs its assembler and linker in two locations,
<filename class="directory">/tools/bin</filename> and <filename
class="directory">/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, an <userinput>ld --verbose | grep SEARCH</userinput>
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,
<userinput>gcc dummy.c -Wl,--verbose 2&gt;&amp;1 | grep succeeded</userinput>
will show all the files successfully opened during the linking.</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>
<para>The next package installed is GCC. An example of what can be
seen during its run of <command>configure</command> is:</para>
<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>
<screen><computeroutput>checking what assembler to use... /tools/i686-lfs-linux-gnu/bin/as
checking what linker to use... /tools/i686-lfs-linux-gnu/bin/ld</computeroutput></screen>
<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>
<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:
<userinput>gcc -print-prog-name=ld</userinput>.</para>
</variablelist>
<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, <userinput>gcc -v dummy.c</userinput> will show
detailed information about the preprocessor, compilation, and assembly stages,
including <command>gcc</command>'s included search paths and their order.</para>
<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>
<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>
<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>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>i686-lfs-linux-gnu-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">glibc-build</filename> directory for all important details.
Note the use of <parameter>CC="i686-lfs-gnu-gcc"</parameter> 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>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>
<para>During the second pass of Binutils, we are able to utilize the
<parameter>--with-lib-path</parameter> configure switch to control
<command>ld</command>'s library search path.</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>For the second pass of GCC, its sources also need to be modified to
tell GCC to use the new dynamic linker. Failure to do so will result in the
GCC programs themselves having the name of the dynamic linker from the host
system's <filename class="directory">/lib</filename> directory embedded into
them, which would defeat the goal of getting away from the host. From this
point onwards, the core toolchain is self-contained and self-hosted. The
remainder of the <xref linkend="chapter-temporary-tools"/> packages all build
against the new Glibc in <filename
class="directory">/tools</filename>.</para>
<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>
<para>Upon entering the chroot environment in <xref
linkend="chapter-building-system"/>, the first major package to be
installed is Glibc, due to its self-sufficient nature mentioned above.
Once this Glibc is installed into <filename
class="directory">/usr</filename>, we will perform a quick changeover of the
toolchain defaults, and then proceed in building the rest of the target
LFS system.</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> option when building the cross linker and
cross compiler to tell them where to find the needed host files. This
ensures that 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 based 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 (1) the build system of
GCC does not know that it is usable on pc, and (2) 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 in
Chapter 6 by all the programs that need themselves to be built. The install
step of libstdc++ uses the <envar>DESTDIR</envar> variable to have the
programs land into the LFS filesystem.</para>
<para>In Chapter 7 the native lfs compiler is built. First binutils-pass2,
with the same <envar>DESTDIR</envar> install as the other programs is
built, and then the second pass of GCC is constructed, 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 the host is the same as the target, but is
different from the build system. 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-chroot-temporary-tools"/>, 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
<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>

View File

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-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>Prepare Util-linux for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools \
--without-python \
--disable-makeinstall-chown \
--without-systemdsystemunitdir \
--without-ncurses \
PKG_CONFIG=""</userinput></screen>
<variablelist>
<title>The meaning of the configure option:</title>
<varlistentry>
<term><parameter>--without-python</parameter></term>
<listitem>
<para>This switch disables using <application>Python</application>
if it is installed on the host system. It avoids trying to build
unneeded bindings.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-makeinstall-chown</parameter></term>
<listitem>
<para>This switch disables using the <command>chown</command> command
during installation. This is not needed when installing into the
/tools directory and avoids the necessity of installing as
root.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--without-ncurses</parameter></term>
<listitem>
<para>This switch disables using the ncurses library for
the build process. This is not needed when installing into the
/tools directory and avoids problems on some host distros.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--without-systemdsystemunitdir</parameter></term>
<listitem>
<para>On systems that use systemd, the package tries to install
a systemd specific file to a non-existent directory in /tools.
This switch disables the unnecessary action.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>PKG_CONFIG=""</envar></term>
<listitem>
<para>Setting this environment variable prevents adding unneeded
features that may be available on the host. Note that the location
shown for setting this environment variable is different from other
LFS sections where variables are set preceding the command. This
location is shown to demonstrate an alternative way of setting an
environment variable when using configure.</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>

View File

@ -1,74 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-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=/tools</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Xz test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
</sect2>
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-xz" role="."/></para>
</sect2>
</sect1>

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-tmp-sbu;</seg>
<seg>&bash-tmp-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:</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,102 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-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-tmpp2-sbu;</seg>
<seg>&binutils-tmpp2-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 \
--enable-64-bit-bfd</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>--enable-shared</parameter></term>
<listitem>
<para>Builds <filename
class="libraryfile">libbfd</filename> as a shared library.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--enable-64-bit-bfd</parameter></term>
<listitem>
<para>Enables 64-bit support (on hosts with narrower word sizes).
May not be needed on 64-bit systems, but does no harm.</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,105 +5,29 @@
%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="kernfs.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="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="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="glibc.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="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"/>
</chapter>

File diff suppressed because it is too large Load Diff

View File

@ -1,379 +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-createfiles">
<?dbhtml filename="createfiles.html"?>
<title>Creating Essential Files and Symlinks</title>
<indexterm zone="ch-system-createfiles">
<primary sortas="e-/etc/passwd">/etc/passwd</primary>
</indexterm>
<indexterm zone="ch-system-createfiles">
<primary sortas="e-/etc/group">/etc/group</primary>
</indexterm>
<indexterm zone="ch-system-createfiles">
<primary sortas="e-/var/run/utmp">/var/run/utmp</primary>
</indexterm>
<indexterm zone="ch-system-createfiles">
<primary sortas="e-/var/log/btmp">/var/log/btmp</primary>
</indexterm>
<indexterm zone="ch-system-createfiles">
<primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary>
</indexterm>
<indexterm zone="ch-system-createfiles">
<primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary>
</indexterm>
<para>Some programs use hard-wired paths to programs which do not exist yet.
In order to satisfy these programs, create a number of symbolic links which
will be replaced by real files throughout the course of this chapter after the
software has been installed:</para>
<screen><userinput>ln -sv /tools/bin/{bash,cat,chmod,dd,echo,false,ln,ls,mkdir,pwd,rm,stty,touch} /bin
ln -sv /tools/bin/{env,install,perl,printf} /usr/bin
ln -sv /tools/lib/libgcc_s.so{,.1} /usr/lib
ln -sv /tools/lib/libstdc++.{a,so{,.6}} /usr/lib
ln -sv bash /bin/sh
for lib in blkid mount uuid fdisk
do
ln -sv /tools/lib/lib$lib.so* /usr/lib
sed 's|/tools|/usr|' /tools/lib/pkgconfig/${lib}.pc \
&gt; /usr/lib/pkgconfig/${lib}.pc
done
for incdir in blkid libmount uuid libfdisk
do
ln -svf /tools/include/$incdir /usr/include
done
mkdir -pv /tools/lib/locale
ln -sv /usr/lib/locale/locale-archive /tools/lib/locale</userinput></screen>
<variablelist>
<title>The purpose of each link:</title>
<varlistentry>
<term><parameter><filename>/bin/bash</filename></parameter></term>
<listitem>
<para>Many <command>bash</command> scripts specify
<filename>/bin/bash</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/bin/cat</filename></parameter></term>
<listitem>
<para>This pathname is hard-coded into Glibc's configure script.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/bin/dd</filename></parameter></term>
<listitem>
<para>The path to <filename>dd</filename> will be hard-coded into the
<filename>/usr/bin/libtool</filename> utility.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/bin/echo</filename></parameter></term>
<listitem>
<para>This is to satisfy one of the tests in Glibc's test suite, which
expects <filename>/bin/echo</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/usr/bin/env</filename></parameter></term>
<listitem>
<para>This pathname is hard-coded into some packages build procedures.
<!-- systemd This may not be needed if we move sysd to the end--></para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/usr/bin/install</filename></parameter></term>
<listitem>
<para>The path to <filename>install</filename> will be hard-coded into
the <filename>/usr/lib/bash/Makefile.inc</filename> file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/bin/ln</filename></parameter></term>
<listitem>
<para>The path to <filename>ln</filename> will be hard-coded into the
<filename>/usr/lib/perl5/&perl-version;/&lt;target-triplet&gt;/Config_heavy.pl</filename>
file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/bin/pwd</filename></parameter></term>
<listitem>
<para>Some <command>configure</command> scripts, particularly Glibc's,
have this pathname hard-coded.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/bin/rm</filename></parameter></term>
<listitem>
<para>The path to <filename>rm</filename> will be hard-coded into the
<filename>/usr/lib/perl5/&perl-version;/&lt;target-triplet&gt;/Config_heavy.pl</filename>
file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/bin/stty</filename></parameter></term>
<listitem>
<para>This pathname is hard-coded into Expect, therefore it is needed
for Binutils and GCC test suites to pass.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/usr/bin/perl</filename></parameter></term>
<listitem>
<para>Many Perl scripts hard-code this path to the
<command>perl</command> program.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/usr/lib/libgcc_s.so{,.1}</filename></parameter></term>
<listitem>
<para>Glibc needs this for the pthreads library to work.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/usr/lib/libstdc++{,.6}</filename></parameter></term>
<listitem>
<para>This is needed by several tests in Glibc's test suite, as well as
for C++ support in GMP.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter><filename>/bin/sh</filename></parameter></term>
<listitem>
<para>Many shell scripts hard-code <filename>/bin/sh</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>
<filename>/usr/lib/lib{blkid,fdisk,mount,uuid}.so*</filename>,
<filename>/usr/include/{blkid,libfdisk,libmount,uuid}</filename>,
<filename>/usr/lib/pkgconfig/{blkid,fdisk,mount,uuid}.pc</filename>
</parameter>
</term>
<listitem>
<para>These links and files allow
<phrase revision="sysv">eudev</phrase>
<phrase revision="systemd">systemd</phrase> to find the
util-linux libraries installed in chapter 5, without creating
wrong references to /tools. The uuid library is also needed for
building a python module.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>
<filename>/tools/lib/locale/locale-archive</filename>
</parameter>
</term>
<listitem>
<para>Some programs built in chapter 5 look for installed
locale descriptions in this file. The locale descriptions will be
installed in <filename>/usr/lib/locale/locale-archive</filename>
after building the final glibc. The symlink allows those programs
to use the installed locales.</para>
</listitem>
</varlistentry>
</variablelist>
<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 this
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 later in the chapter need a regular user. We add this
user here and delete this account at the end of the 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 a full Glibc was installed in <xref
linkend="chapter-temporary-tools"/> and 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 /tools/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

@ -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-tmp-sbu;</seg>
<seg>&diffutils-tmp-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>

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-tmp-sbu;</seg>
<seg>&file-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -43,65 +45,27 @@
<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-tmp-sbu;</seg>
<seg>&findutils-tmp-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-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-tmp-sbu;</seg>
<seg>&gawk-tmp-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>

159
chapter06/gcc-pass2.xml Normal file
View File

@ -0,0 +1,159 @@
<?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-tmpp2-sbu;</seg>
<seg>&gcc-tmpp2-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 allows 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 utility 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

@ -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-tmp-sbu;</seg>
<seg>&grep-tmp-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-tmp-sbu;</seg>
<seg>&gzip-tmp-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,79 +5,26 @@
%general-entities;
]>
<sect1 id="ch-system-introduction">
<sect1 id="ch-tools-introduction-cross">
<?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>This chapter shows how to cross-compile basic utilities using
the just built cross-toolchain. Those utilities are installed into
their final location, but cannot be used yet. Basic tasks still rely on
the host's tools. Nevertheless, the installed libraries are used when
linking.</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>Using the utilities will be possible in next chapter after entering
the <quote>chroot</quote> environment. But all the packages built in the
present chapter need to be built before we do that. Therefore we cannot be
independent of the host system yet.</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>The order that packages are installed in this chapter needs to be
strictly followed to ensure that no program accidentally acquires a path
referring to <filename class="directory">/tools</filename> hard-wired into
it. For the same reason, do not compile separate packages in parallel.
Compiling in parallel may save time (especially on dual-CPU machines), but it
could result in a program containing a hard-wired path to <filename
class="directory">/tools</filename>, which will cause the program to stop
working when that directory is removed.</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>Once again, let us recall that improper setting of <envar>LFS</envar>
together with building as root, may render your computer unusable.
This whole chapter must be done as user <systemitem
class="username">lfs</systemitem>, with the enviroment as described in
<xref linkend="ch-preps-settingenviron"/>.</para>
</sect1>

View File

@ -1,209 +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-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-system-linux-headers">
<primary sortas="a-Linux">Linux</primary>
<secondary>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-ch6-sbu;</seg>
<seg>&linux-headers-ch6-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 and dependencies lying around
from previous activity:</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 is
not available in <filename class="directory">/tools</filename>. The
headers are first placed in <filename class="directory">./usr</filename>,
then some files used by the kernel developers are removed, then
the files are copied to their final 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/* /usr/include</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-system-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-system-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-system-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-system-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-system-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-system-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-system-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-system-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-system-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-system-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-system-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-tmp-sbu;</seg>
<seg>&m4-tmp-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-tmp-sbu;</seg>
<seg>&make-tmp-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-tmp-sbu;</seg>
<seg>&ncurses-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -41,23 +43,54 @@
<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
pushd build
../configure
make -C include
make -C progs tic
popd</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 \
<screen><userinput remap="configure">./configure --prefix=/usr \
--host=$LFS_TGT \
--build=$(./config.guess) \
--mandir=/usr/share/man \
--with-manpage-format=normal \
--with-shared \
--without-debug \
--without-ada \
--without-normal \
--enable-widec</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>--with-manpage-format=normal</parameter></term>
<listitem>
<para>This prevents Ncurses installing compressed manual
pages, which may happen if the host distribution itself
has compressed manual pages.</para>
</listitem>
</varlistentry>
<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>
@ -72,14 +105,6 @@
</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>
@ -94,286 +119,30 @@
<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-tmp-sbu;</seg>
<seg>&patch-tmp-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-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-tmp-sbu;</seg>
<seg>&sed-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -40,61 +43,27 @@
<sect2 role="installation">
<title>Installation of Sed</title>
<para>First fix an issue in the LFS environment:</para>
<screen><userinput remap="pre">sed -i 's/usr/tools/' build-aux/help2man</userinput></screen>
<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>

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-tmp-sbu;</seg>
<seg>&tar-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -42,74 +45,25 @@
<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>

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-tmp-sbu;</seg>
<seg>&xz-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -44,320 +43,33 @@
<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 <xref linkend="contents-xz" role="."/></para>
</sect2>

View File

@ -25,7 +25,7 @@
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/bison.xml"
href="../chapter08/bison.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
@ -33,8 +33,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&bison-ch5-sbu;</seg>
<seg>&bison-ch5-du;</seg>
<seg>&bison-tmp-sbu;</seg>
<seg>&bison-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -45,16 +45,26 @@
<para>Prepare Bison for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<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>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>

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 address this issue, 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,tools}
case $(uname -m) in
x86_64) chown -R root:root $LFS/lib64 ;;
esac</userinput></screen>
</sect1>

View File

@ -5,39 +5,28 @@
%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="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="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"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="stripping.xml"/>
</chapter>

View File

@ -5,22 +5,25 @@
%general-entities;
]>
<sect1 id="ch-system-chroot">
<sect1 id="ch-tools-chroot">
<?dbhtml filename="chroot.html"?>
<title>Entering the Chroot Environment</title>
<para>It is time to enter the chroot environment to begin building and
installing the final LFS system. As user <systemitem
<para>Now that all the packages which are required to build the rest of the
needed tools 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>
environment that is, at the moment, populated with only the temporary
tools:</para>
<screen role="nodump"><userinput>chroot "$LFS" /tools/bin/env -i \
<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:/tools/bin \
/tools/bin/bash --login +h</userinput></screen>
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
@ -29,17 +32,17 @@
<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
to operate properly. If other variables are desired, 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
<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> comes last
<para>Notice that <filename class="directory">/tools/bin</filename> is not
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

210
chapter07/createfiles.xml Normal file
View File

@ -0,0 +1,210 @@
<?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>Create a basic <filename>/etc/hosts</filename> file to be
referenced in some test suites, and in one of Perl's configuration files
as well:</para>
<screen><userinput>echo "127.0.0.1 localhost $(hostname)" &gt; /etc/hosts</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>
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 Chapter
9, 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://refspecs.linuxfoundation.org/lsb.shtml"/>) only recommends 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 and the next 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

@ -5,28 +5,22 @@
%general-entities;
]>
<sect1 id="ch-system-creatingdirs">
<sect1 id="ch-tools-creatingdirs">
<?dbhtml filename="creatingdirs.html"?>
<title>Creating Directories</title>
<para>It is time to create some structure in the LFS file system. Create a
standard directory tree by issuing the following commands:</para>
<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},sbin,srv,var}
install -dv -m 0750 /root
install -dv -m 1777 /tmp /var/tmp
mkdir -pv /{media/{floppy,cdrom},srv,var}
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
mkdir -v /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -v /usr/libexec
mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -pv /usr/{,local/}share/man/man{1..8}
mkdir -v /usr/lib/pkgconfig
case $(uname -m) in
x86_64) mkdir -v /lib64 ;;
esac
install -dv -m 1777 /tmp /var/tmp
install -dv -m 0750 /root
mkdir -v /var/{log,mail,spool}
ln -sv /run /var/run

View File

@ -32,8 +32,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&dejagnu-ch5-sbu;</seg>
<seg>&dejagnu-ch5-du;</seg>
<seg>&dejagnu-tmp-sbu;</seg>
<seg>&dejagnu-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -44,11 +44,15 @@
<para>Prepare DejaGNU for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<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</userinput></screen>
<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>

View File

@ -38,8 +38,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&expect-ch5-sbu;</seg>
<seg>&expect-ch5-du;</seg>
<seg>&expect-tmp-sbu;</seg>
<seg>&expect-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -48,39 +48,31 @@
<sect2 role="installation">
<title>Installation of Expect</title>
<para>First, force Expect's configure script to use <filename>/bin/stty</filename>
instead of a <filename>/usr/local/bin/stty</filename> it may find on the host system.
This will ensure that our test suite tools remain sane for the final builds of our
toolchain:</para>
<para>Prepare Expect for compilation:</para>
<screen><userinput remap="pre">cp -v configure{,.orig}
sed 's:/usr/local/bin:/bin:' configure.orig &gt; configure</userinput></screen>
<para>Now prepare Expect for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools \
--with-tcl=/tools/lib \
--with-tclinclude=/tools/include</userinput></screen>
<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=/tools/lib</parameter></term>
<term><parameter>--with-tcl=/usr/lib</parameter></term>
<listitem>
<para>This ensures that the configure script finds the Tcl
installation in the temporary tools location instead of possibly
locating an existing one on the host system.</para>
<para>This parameter is needed to tell
<command>configure</command> where the
<command>tclConfig.sh</command> script is located.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-tclinclude=/tools/include</parameter></term>
<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>
headers.</para>
</listitem>
</varlistentry>
@ -90,33 +82,10 @@ sed 's:/usr/local/bin:/bin:' configure.orig &gt; configure</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Expect test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make test</userinput></screen>
<para>Note that the Expect test suite is known to experience failures under
certain host conditions that are not within our control. Therefore,
test suite failures here are not surprising and are not considered
critical.</para>
<para>Install the package:</para>
<screen><userinput remap="install">make SCRIPTS="" install</userinput></screen>
<variablelist>
<title>The meaning of the make parameter:</title>
<varlistentry>
<term><parameter>SCRIPTS=""</parameter></term>
<listitem>
<para>This prevents installation of the supplementary Expect
scripts, which are not needed.</para>
</listitem>
</varlistentry>
</variablelist>
<screen><userinput remap="install">make install
ln -svf expect&expect-version;/libexpect&expect-version;.so /usr/lib</userinput></screen>
</sect2>

View File

@ -25,7 +25,7 @@
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/gettext.xml"
href="../chapter08/gettext.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
@ -33,8 +33,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&gettext-ch5-sbu;</seg>
<seg>&gettext-ch5-du;</seg>
<seg>&gettext-tmp-sbu;</seg>
<seg>&gettext-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -52,16 +52,7 @@
<variablelist>
<title>The meaning of the configure option:</title>
<!--
<varlistentry>
<term><parameter>EMACS="no"</parameter></term>
<listitem>
<para>This prevents the configure script from determining where to
install Emacs Lisp files as the test is known to hang on some hosts.
</para>
</listitem>
</varlistentry>
-->
<varlistentry>
<term><parameter>--disable-shared</parameter></term>
<listitem>
@ -76,22 +67,17 @@
<screen><userinput remap="make">make</userinput></screen>
<para>
Due to the limited environment, running the test suite at this stage
is not recommended.</para>
<para>Install the <command>msgfmt</command>, <command>msgmerge</command> and
<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} /tools/bin</userinput></screen>
<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>
<para>Details on this package are located in <xref linkend="contents-gettext" role="."/></para>
</sect2>

View File

@ -5,221 +5,29 @@
%general-entities;
]>
<sect1 id="ch-config-introduction" revision="sysv">
<sect1 id="ch-tools-introduction-chroot">
<?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 the last missing bits of the temporary
system: first, the tools needed by the build machinery of various packages,
then three packages needed to run tests. Now that all circular dependencies
have been resolved, we can use a <quote>chroot</quote> environment,
completely isolated the host operating system used for the build, except
for the running kernel.</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>-->
<para>For proper operation of the isolated environment, some communication
with the running kernel must be established. This is done through the
so-called <emphasis>Virtual Kernel File Systems</emphasis>, which must be
mounted when entering the chroot environment. You may want to check
that they are mounted by issuing <command>findmnt</command>.</para>
<sect2 id='sysv-desc'>
<title>System V</title>
<para>Until <xref linkend="ch-tools-chroot"/>, the commands must be
run as <systemitem class="username">root</systemitem>, with the
<envar>LFS</envar> variable set. After entering chroot, all commands
are run as root, fortunately without access to the OS of the computer
you built LFS on. Be careful anyway, as it is easy to destroy the whole
LFS system with badly formed commands.</para>
<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>
<!--
<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>
-->
</sect1>

View File

@ -5,12 +5,12 @@
%general-entities;
]>
<sect1 id="ch-system-kernfs">
<sect1 id="ch-tools-kernfs">
<?dbhtml filename="kernfs.html"?>
<title>Preparing Virtual Kernel File Systems</title>
<indexterm zone="ch-system-kernfs">
<indexterm zone="ch-tools-kernfs">
<primary sortas="e-/dev/">/dev/*</primary>
</indexterm>
@ -30,9 +30,10 @@
<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
class="devicefile">null</filename> devices. The device nodes must be
created on the hard disk so that they are available before the kernel
populates <systemitem class="filesystem">/dev</systemitem>), and
additionally when Linux is started with
<parameter>init=/bin/bash</parameter>. Create the devices by running the
following commands:</para>
@ -72,7 +73,7 @@ mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
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>
@ -100,7 +101,7 @@ mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
</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

View File

@ -0,0 +1,110 @@
<?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>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 built in that
section because it is a native compiler and should not be used outside of
chroot and risks polluting the libraries with some host components.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&libstdcpp-tmpp2-sbu;</seg>
<seg>&libstdcpp-tmpp2-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>These 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>

View File

@ -25,7 +25,7 @@
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/perl.xml"
href="../chapter08/perl.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
@ -33,8 +33,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&perl-ch5-sbu;</seg>
<seg>&perl-ch5-du;</seg>
<seg>&perl-tmp-sbu;</seg>
<seg>&perl-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -45,11 +45,10 @@
<para>Prepare Perl for compilation:</para>
<screen><userinput remap="configure">sh Configure -des -Dprefix=/tools -Dlibs=-lm -Uloclibpth -Ulocincpth</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>-des</parameter></term>
<listitem>
@ -59,44 +58,20 @@
</listitem>
</varlistentry>
<varlistentry>
<term>
<parameter>-Uloclibpth</parameter> and
<parameter>-Ulocincpth</parameter>
</term>
<listitem>
<para>These entries undefine variables that cause the configuration
to search for locally installed components that may exist on the
host system.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Build the package:</para>
<para>Build and install the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Although Perl comes with a test suite, it would be better to wait
until it is installed in the next chapter.</para>
<para>Only a few of the utilities and libraries need to be installed at this
time:</para>
<screen><userinput remap="install">cp -v perl cpan/podlators/scripts/pod2man /tools/bin
mkdir -pv /tools/lib/perl5/&perl-version;
cp -Rv lib/* /tools/lib/perl5/&perl-version;</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>
<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-tools-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,16 +16,16 @@
<title>Python-&python-version;</title>
<indexterm zone="ch-tools-Python">
<indexterm zone="ch-system-Python-temp">
<primary sortas="a-Python">Python</primary>
<secondary>tools</secondary>
<secondary>temporary</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/python.xml"
href="../chapter08/python.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
@ -33,8 +33,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&python-ch5-sbu;</seg>
<seg>&python-ch5-du;</seg>
<seg>&python-tmp-sbu;</seg>
<seg>&python-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -50,18 +50,9 @@
uppercase first letter).</para>
</note>
<para>This package first builds the Python interpreter, then some
standard Python modules. The main script for building modules is
written in Python, and uses hard-coded paths to the host <filename
class="directory">/usr/include</filename> and <filename
class="directory">/usr/lib</filename> directories. To prevent them
from being used, issue:</para>
<screen><userinput remap="pre">sed -i '/def add_multiarch_paths/a \ return' setup.py</userinput></screen>
<para>Prepare Python for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools --without-ensurepip</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr --without-ensurepip</userinput></screen>
<variablelist>
<title>The meaning of the configure option:</title>
@ -80,10 +71,6 @@
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. The test suite requires TK and
and X Windows and cannot be run at this time.
</para>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
@ -93,8 +80,7 @@
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-python" role="."/></para>
<para>Details on this package are located in <xref linkend="contents-python" role="."/></para>
</sect2>

188
chapter07/stripping.xml Normal file
View File

@ -0,0 +1,188 @@
<?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>Finishing Temporary Tools</title>
<para>
The steps in this section are optional. Skip this section entirely
if you are not really short on disk space and do not want to create
a backup of the temporary tools.
</para>
<para>
The following steps are performed from outside the chroot
environment. That means, you have to leave the chroot environment
first before continuing. The reason for that is to:
<itemizedlist>
<listitem>
<para>
make sure that objects are not in use while they are
manipulated.
</para>
</listitem>
<listitem>
<para>
get access to file system locations outside of the chroot
environment to store/read the backup archive which should
not be placed within the
<filename class="directory">$LFS</filename> hierarchy for
safety reasons.
</para>
</listitem>
</itemizedlist>
</para>
<para>
Leave the chroot environment and unmount the kernel virtual file
systems:
</para>
<note>
<para>All of the following instructions are executed by
<systemitem class="username">root</systemitem>. Take extra
care about the commands you're going to run as mistakes
here can modify your host system. Be aware that the
environment variable <envar>LFS</envar> is set for user
<systemitem class="username">lfs</systemitem> by default
but it might <emphasis>not</emphasis> be set for
<systemitem class="username">root</systemitem>. Whenever
commands are to be executed by <systemitem class="username">root</systemitem>,
make sure you have set <envar>LFS</envar> accordingly.
This has been discussed in <xref linkend='ch-partitioning-aboutlfs'/>.
</para>
</note>
<screen role="nodump"><userinput>exit
umount $LFS/dev{/pts,}
umount $LFS/{sys,proc,run}</userinput></screen>
<sect2>
<title>Stripping</title>
<para>If the LFS partition is rather small, it is good to
know that unnecessary items can be removed. The executables and
libraries built so far contain a little over 90 MB of unneeded debugging
symbols.</para>
<para>Strip off debugging symbols from binaries:</para>
<screen role="nodump"><userinput>strip --strip-debug $LFS/usr/lib/*
strip --strip-unneeded $LFS/usr/{,s}bin/*
strip --strip-unneeded $LFS/tools/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 2</quote>, since it is the one that knows how to strip
our cross-compiled programs.--></para>
<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 space (slightly more than 35 MB), remove the documentation:</para>
<screen role="nodump"><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 non-autotools build systems.
Remove those files now:</para>
<screen role="nodump"><userinput>find $LFS/usr/{lib,libexec} -name \*.la -delete</userinput></screen>
<para>At this point, you should have at least 5 GB of free space on the
chroot partition 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. You can check the free disk space with the command
<command>df -h $LFS</command>.</para>
</sect2>
<sect2>
<title>Backup</title>
<para>
Now that the essential tools have been created, its time to think about
a backup. When every check has passed successfully in the previously
built packages, your temporary tools are in a good state and might be
backed up for later reuse. In case of fatal failures in the subsequent
chapters, it often turns out that removing everything and starting over
(more carefully) is the best option to recover. Unfortunatly, all the
temporary tools will be removed, too. To avoid spending extra time to
redo something which has been built successfully, prepare a backup.
</para>
<para>
Make sure you have at least 600 MB free disk space (the source tarballs
will be included in the backup archive) in the home directory of user
<systemitem class="username">root</systemitem>.
</para>
<para>
Create the backup archive by running the following command:
</para>
<screen role="nodump" revision="sysv"><userinput>cd $LFS &amp;&amp;
tar -cJpf $HOME/lfs-temp-tools-&version;.tar.xz .</userinput></screen>
<screen role="nodump" revision="systemd"><userinput>cd $LFS &amp;&amp;
tar -cJpf $HOME/lfs-temp-tools-&versiond;.tar.xz .</userinput></screen>
<para>
Replace <envar>$HOME</envar> by a directory of your choice if you
do not want to have the backup stored in <systemitem
class="username">root</systemitem>'s home directory.
</para>
</sect2>
<sect2>
<title>Restore</title>
<para>
In case some mistakes have been made and you need to start over, you can
use this backup to restore the temporary tools and save some recovery time.
Since the sources are located under
<filename class="directory">$LFS</filename>, they are included in the
backup archive as well, so they do not need to be downloaded again. After
checking that <filename class="directory">$LFS</filename> is set properly,
restore the backup by executing the following commands:
</para>
<!-- Make the following look different so users don't blindly run the
restore when they don't need to. -->
<screen role="nodump" revision="sysv"><computeroutput>cd $LFS &amp;&amp;
rm -rf ./* &amp;&amp;
tar -xpf $HOME/lfs-temp-tools-&version;.tar.xz</computeroutput></screen>
<screen role="nodump" revision="systemd"><computeroutput>cd $LFS &amp;&amp;
rm -rf ./* &amp;&amp;
tar -xpf $HOME/lfs-temp-tools-&versiond;.tar.xz</computeroutput></screen>
<para>
Again, double check that the environment has been setup properly
and continue building the rest of the system.
</para>
<important>
<para>
If you left the chroot environment either to strip off debug
symbols, create a backup or restart building using a restore,
remember to mount the kernel virtual filesystems now again as
described in <xref linkend='ch-tools-kernfs'/> and re-enter
the chroot environment (see <xref linkend='ch-tools-chroot'/>)
again before continuing.
</para>
</important>
</sect2>
</sect1>

View File

@ -3,6 +3,8 @@
"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">
@ -32,8 +34,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&tcl-ch5-sbu;</seg>
<seg>&tcl-ch5-du;</seg>
<seg>&tcl-tmp-sbu;</seg>
<seg>&tcl-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -43,11 +45,10 @@
<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
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. Even if the test suites are not
run in this chapter (they are not mandatory), these packages are required
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
@ -56,27 +57,54 @@
<para>Prepare Tcl for compilation:</para>
<screen><userinput remap="configure">cd unix
./configure --prefix=/tools</userinput></screen>
<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 shell 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</userinput></screen>
<screen><userinput remap="make">make
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Tcl test suite anyway, issue the following command:</para>
sed -e "s|$SRCDIR/unix|/usr/lib|" \
-e "s|$SRCDIR|/usr/include|" \
-i tclConfig.sh
<screen><userinput remap="test">TZ=UTC make test</userinput></screen>
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
<para>The Tcl test suite may experience failures under certain host
conditions that are not fully understood. Therefore, test suite failures
here are not surprising, and are not considered critical. The
<parameter>TZ=UTC</parameter> parameter sets the time zone to Coordinated
Universal Time (UTC), but only
for the duration of the test suite run. This ensures that the clock tests
are exercised correctly. Details on the <envar>TZ</envar> environment
variable are provided in <xref linkend="chapter-config"/>.</para>
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> instructions after the
<quote>make</quote> command removes references to the build directory from
the configuration files and replaces them with the install directory.
This is not mandatory for the remainder of LFS, but may be needed in case a
package built later uses Tcl.</para>
<para>Install the package:</para>
@ -85,16 +113,15 @@
<para>Make the installed library writable so debugging symbols can
be removed later:</para>
<screen><userinput remap="install">chmod -v u+w /tools/lib/libtcl&tcl-major-version;.so</userinput></screen>
<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>
<para>Install Tcl's headers. The next package, Expect, requires them.</para>
<screen><userinput remap="install">make install-private-headers</userinput></screen>
<para>Now make a necessary symbolic link:</para>
<screen><userinput remap="install">ln -sv tclsh&tcl-major-version; /tools/bin/tclsh</userinput></screen>
<screen><userinput remap="install">ln -sfv tclsh&tcl-major-version; /usr/bin/tclsh</userinput></screen>
</sect2>
@ -106,8 +133,14 @@
<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>
<seg>
tclsh (link to tclsh&tcl-major-version;) and
tclsh&tcl-major-version;
</seg>
<seg>
libtcl&tcl-major-version;.so and
libtclstub&tcl-major-version;.a
</seg>
</seglistitem>
</segmentedlist>

View File

@ -5,8 +5,8 @@
%general-entities;
]>
<sect1 id="ch-tools-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,16 +16,16 @@
<title>Texinfo-&texinfo-version;</title>
<indexterm zone="ch-tools-texinfo">
<indexterm zone="ch-system-texinfo-temp">
<primary sortas="a-Texinfo">Texinfo</primary>
<secondary>tools</secondary>
<secondary>temporary</secondary>
</indexterm>
<sect2 role="package">
<title/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
href="../chapter06/texinfo.xml"
href="../chapter08/texinfo.xml"
xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
<segmentedlist>
@ -33,8 +33,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&texinfo-ch5-sbu;</seg>
<seg>&texinfo-ch5-du;</seg>
<seg>&texinfo-tmp-sbu;</seg>
<seg>&texinfo-tmp-du;</seg>
</seglistitem>
</segmentedlist>
@ -45,7 +45,7 @@
<para>Prepare Texinfo for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/tools</userinput></screen>
<screen><userinput remap="configure">./configure --prefix=/usr</userinput></screen>
<note>
<para>As part of the configure process, a test is made that indicates an
@ -57,12 +57,6 @@
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. As discussed earlier, running the test
suite is not mandatory for the temporary tools here in this chapter. To run
the Texinfo test suite anyway, issue the following command:</para>
<screen><userinput remap="test">make check</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
@ -72,8 +66,7 @@
<sect2 role="content">
<title/>
<para>Details on this package are located in
<xref linkend="contents-texinfo" role="."/></para>
<para>Details on this package are located in <xref linkend="contents-texinfo" role="."/></para>
</sect2>

112
chapter07/util-linux.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-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-tmp-sbu;</seg>
<seg>&util-linux-tmp-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>
<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 for this temporary tool, but it prevents creating a file
at another location, which would not be overwritten or removed
when building the final util-linux package.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--disable-*</parameter></term>
<listitem>
<para>These 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>

View File

@ -13,8 +13,8 @@
<para>Most programs and libraries are, by default, compiled with
debugging symbols included (with <command>gcc</command>'s
<parameter>-g</parameter> option). This means that when debugging a
program or library that was compiled with debugging information
included, the debugger can provide not only memory addresses, but also
program or library that was compiled with debugging information,
the debugger can provide not only memory addresses, but also
the names of the routines and variables.</para>
<para>However, the inclusion of these debugging symbols enlarges a

View File

@ -32,8 +32,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&acl-ch6-sbu;</seg>
<seg>&acl-ch6-du;</seg>
<seg>&acl-fin-sbu;</seg>
<seg>&acl-fin-du;</seg>
</seglistitem>
</segmentedlist>
@ -50,7 +50,8 @@
--libexecdir=/usr/lib \
--docdir=/usr/share/doc/acl-&acl-version;</userinput></screen>
<screen revision="systemd"><userinput remap="configure">./configure --prefix=/usr \
<screen revision="systemd"><userinput remap="configure">
./configure --prefix=/usr \
--disable-static \
--libexecdir=/usr/lib \
--docdir=/usr/share/doc/acl-&acl-version;</userinput></screen>

View File

@ -50,7 +50,7 @@ readelf -l a.out | grep ': /lib'</userinput></screen>
<para os="b">There should be no errors,
and the output of the last command will be (allowing for
platform-specific differences in dynamic linker name):</para>
platform-specific differences in the dynamic linker name):</para>
<screen os="c"><computeroutput>[Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]</computeroutput></screen>
@ -104,7 +104,7 @@ SEARCH_DIR("/lib")</computeroutput></screen>
<screen os="o"><computeroutput>attempt to open /lib/libc.so.6 succeeded</computeroutput></screen>
<para os="p">Lastly, make sure GCC is using the correct dynamic linker:</para>
<para os="p">Make sure GCC is using the correct dynamic linker:</para>
<screen os="q"><userinput>grep found dummy.log</userinput></screen>
@ -115,8 +115,8 @@ SEARCH_DIR("/lib")</computeroutput></screen>
<para os="t">If the output does not appear as shown above or is not received
at all, then something is seriously wrong. Investigate and retrace the
steps to find out where the problem is and correct it. The most likely
reason is that something went wrong with the specs file adjustment. Any
steps to find out where the problem is and correct it. <!--The most likely
reason is that something went wrong with the specs file adjustment.--> Any
issues will need to be resolved before continuing with the process.</para>
<para os="u">Once everything is working correctly, clean up the test files:</para>

View File

@ -31,8 +31,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&attr-ch6-sbu;</seg>
<seg>&attr-ch6-du;</seg>
<seg>&attr-fin-sbu;</seg>
<seg>&attr-fin-du;</seg>
</seglistitem>
</segmentedlist>

View File

@ -31,8 +31,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&autoconf-ch6-sbu;</seg>
<seg>&autoconf-ch6-du;</seg>
<seg>&autoconf-fin-sbu;</seg>
<seg>&autoconf-fin-du;</seg>
</seglistitem>
</segmentedlist>
@ -43,7 +43,7 @@
<para>First, fix a bug generated by Perl 5.28.</para>
<screen><userinput remap="pre">sed '361 s/{/\\{/' -i bin/autoscan.in</userinput></screen>
<screen><userinput remap="pre">sed -i '361 s/{/\\{/' bin/autoscan.in</userinput></screen>
<para>Prepare Autoconf for compilation:</para>
@ -59,7 +59,7 @@
<screen><userinput remap="test">make check</userinput></screen>
<!--
<para>This takes a long time, about &autoconf-ch6-sbu-tests; SBUs. In addition,
<para>This takes a long time, about &autoconf-fin-sbu-tests; SBUs. In addition,
several tests are skipped that use Automake. For full test coverage,
Autoconf can be re-tested after Automake has been installed. In addition,
two tests fail due to changes in libtool-2.4.3 and later.</para>

View File

@ -31,8 +31,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&automake-ch6-sbu;</seg>
<seg>&automake-ch6-du;</seg>
<seg>&automake-fin-sbu;</seg>
<seg>&automake-fin-du;</seg>
</seglistitem>
</segmentedlist>
@ -43,7 +43,7 @@
<para>Fix a failing test:</para>
<screen><userinput remap="pre">sed -i "s/''/etags/" t/tags-lisp-space.sh</userinput></screen>
<screen><userinput remap="pre">sed -i "s/''/etags/" t/tags-lisp-space.sh</userinput></screen>
<para>Prepare Automake for compilation:</para>
@ -53,26 +53,12 @@
<screen><userinput remap="make">make</userinput></screen>
<!--<para>There are a couple of tests that incorrectly link to the
wrong version of the flex library, so we temporarily work around
the problem. Also, using the -j4 make option speeds up the tests, even on
systems with only one processor, due to internal delays in individual
tests. To test the results, issue:</para>
-->
<para> Using the -j4 make option speeds up the tests, even on systems with
only one processor, due to internal delays in individual tests. To test
the results, issue:</para>
<!--<screen><userinput remap="test">sed -i "s:./configure:LEXLIB=/usr/lib/libfl.a &amp;:" t/lex-{clean,depend}-cxx.sh
make -j4 check</userinput></screen>-->
<screen><userinput remap="test">make -j4 check</userinput></screen>
<para>One test is known to fail in the LFS environment:
tags-lisp-space.sh.</para>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>

166
chapter08/bash.xml Normal file
View File

@ -0,0 +1,166 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-system-bash" role="wrap">
<?dbhtml filename="bash.html"?>
<sect1info condition="script">
<productname>bash</productname>
<productnumber>&bash-version;</productnumber>
<address>&bash-url;</address>
</sect1info>
<title>Bash-&bash-version;</title>
<indexterm zone="ch-system-bash">
<primary sortas="a-Bash">Bash</primary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Bash package contains the Bourne-Again SHell.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&bash-fin-sbu;</seg>
<seg>&bash-fin-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<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>
<variablelist>
<title>The meaning of the new configure option:</title>
<varlistentry>
<term><parameter>--with-installed-readline</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>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Skip down to <quote>Install the
package</quote> if not running the test suite.</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="test">chown -Rv tester .</userinput></screen>
<para>Now, run the tests as the <systemitem
class="username">tester</systemitem> user:</para>
<screen><userinput remap="test">su tester &lt;&lt; EOF
PATH=$PATH make tests &lt; $(tty)
EOF</userinput></screen>
<para>Install the package and move the main executable to
<filename class='directory'>/bin</filename>:</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 continues to disable hashing so
that new programs are found as they become available.</para>
</note>
</sect2>
<sect2 id="contents-bash" role="content">
<title>Contents of Bash</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>
</sect2>
</sect1>

View File

@ -31,8 +31,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&bc-ch6-sbu;</seg>
<seg>&bc-ch6-du;</seg>
<seg>&bc-fin-sbu;</seg>
<seg>&bc-fin-du;</seg>
</seglistitem>
</segmentedlist>
@ -40,62 +40,18 @@
<sect2 role="installation">
<title>Installation of Bc</title>
<!--
<para>First, change an internal script to use <command>sed</command> instead
of <command>ed</command>:</para>
<screen><userinput remap="pre">cat &gt; bc/fix-libmath_h &lt;&lt; "EOF"
#! /bin/bash
sed -e '1 s/^/{"/' \
-e 's/$/",/' \
-e '2,$ s/^/"/' \
-e '$ d' \
-i libmath.h
sed -e '$ s/$/0}/' \
-i libmath.h
EOF</userinput></screen>
<para>Create temporary symbolic links so the package can find
the readline library and confirm that its required libncurses
library is available. Even though the libraries are in /tools/lib
at this point, the system will use /usr/lib at the end of
this chapter.</para>
<screen><userinput remap="pre">ln -sv /tools/lib/libncursesw.so.6 /usr/lib/libncursesw.so.6
ln -sfv libncursesw.so.6 /usr/lib/libncurses.so</userinput></screen>
<para>Fix an issue in <command>configure</command> due to missing
files in the early stages of LFS:</para>
<screen><userinput remap="pre">sed -i -e '/flex/s/as_fn_error/: ;; # &amp;/' configure</userinput></screen>
-->
<para>Prepare Bc for compilation:</para>
<!--
<screen><userinput remap="configure">./configure - -prefix=/usr \
- -with-readline \
- -mandir=/usr/share/man \
- -infodir=/usr/share/info</userinput></screen>
-->
<screen><userinput remap="configure">PREFIX=/usr CC=gcc CFLAGS="-std=c99" ./configure.sh -G -O3</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
<!--
<varlistentry>
<term><parameter>- -with-readline</parameter></term>
<listitem>
<para>This option tells Bc to use the <filename
class="libraryfile">readline</filename> library that is already
installed on the system rather than using its own readline
version.</para>
</listitem>
</varlistentry>
-->
<varlistentry>
<term><parameter>CC=gcc CFLAGS="-std=c99"</parameter></term>
<listitem>
<para>These parameters specify the compiler and C standard to use.</para>
<para>These parameters specify the compiler and the C standard to use.</para>
</listitem>
</varlistentry>
@ -118,14 +74,6 @@ ln -sfv libncursesw.so.6 /usr/lib/libncurses.so</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<!--
<para>To test bc, run the commands below. There is quite a bit of output,
so you may want to redirect it to a file. There are a very small percentage
of tests (10 of 12,144) that will indicate a round off error at the last
digit.</para>
<screen><userinput remap="test">echo "quit" | ./bc/bc -l Test/checklib.b</userinput></screen>
-->
<para>To test bc, run:</para>

View File

@ -31,8 +31,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&binutils-ch6-sbu;</seg>
<seg>&binutils-ch6-du;</seg>
<seg>&binutils-fin-sbu;</seg>
<seg>&binutils-fin-du;</seg>
</seglistitem>
</segmentedlist>

View File

@ -30,8 +30,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&bison-ch6-sbu;</seg>
<seg>&bison-ch6-du;</seg>
<seg>&bison-fin-sbu;</seg>
<seg>&bison-fin-du;</seg>
</seglistitem>
</segmentedlist>
@ -39,38 +39,19 @@
<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>
<!-- 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>
<screen><userinput remap="make">make -j1</userinput></screen>-->
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>To test the results (about 5.5 SBU), issue:</para>
<para>The tests are known to fail using multiple processors.
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>
-->
<screen><userinput remap="test">make -j1 check</userinput></screen>
<para>Install the package:</para>

View File

@ -33,8 +33,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&bzip2-ch6-sbu;</seg>
<seg>&bzip2-ch6-du;</seg>
<seg>&bzip2-fin-sbu;</seg>
<seg>&bzip2-fin-du;</seg>
</seglistitem>
</segmentedlist>
@ -90,7 +90,7 @@ make clean</userinput></screen>
<screen><userinput remap="install">cp -v bzip2-shared /bin/bzip2
cp -av libbz2.so* /lib
ln -sv ../../lib/libbz2.so.1.0 /usr/lib/libbz2.so
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>

View File

@ -5,15 +5,99 @@
%general-entities;
]>
<chapter id="chapter-bootable" xreflabel="Chapter&nbsp;8">
<chapter id="chapter-building-system" xreflabel="Chapter&nbsp;8">
<?dbhtml dir="chapter08"?>
<?dbhtml filename="chapter08.html"?>
<title>Making the LFS System Bootable</title>
<title>Installing Basic System Software</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="fstab.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="kernel.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="man-pages.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="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="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="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="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="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"/>
</chapter>

View File

@ -30,8 +30,8 @@
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&check-ch5-sbu;</seg>
<seg>&check-ch5-du;</seg>
<seg>&check-fin-sbu;</seg>
<seg>&check-fin-du;</seg>
</seglistitem>
</segmentedlist>
@ -56,11 +56,9 @@
<para>Note that the Check test suite may take a relatively long
(up to 4 SBU) time.</para>
<para>Install the package and fix a script:</para>
<para>Install the package:</para>
<screen><userinput remap="install">make docdir=/usr/share/doc/check-&check-version; install &amp;&amp;
sed -i '1 s/tools/usr/' /usr/bin/checkmk</userinput></screen>
<!-- Removes a hardcoded call to /tools/bin/gawk at line 1 of checkmk. -->
<screen><userinput remap="install">make docdir=/usr/share/doc/check-&check-version; install</userinput></screen>
</sect2>

1292
chapter08/coreutils.xml Normal file

File diff suppressed because it is too large Load Diff

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