Update to new lfs structure

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/multilib@11986 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
Thomas Trepl 2020-06-29 07:55:01 +00:00 committed by Xℹ Ruoyao
parent 811b5a3978
commit 6dfcfecca3
No known key found for this signature in database
GPG Key ID: D95E4716CCBB34DC
214 changed files with 9166 additions and 10079 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
@ -59,9 +59,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
@ -175,7 +172,6 @@ $(BASEDIR)/wget-list: stylesheets/wget-list.xsl chapter03/chapter03.xml \
# $(Q)xsltproc --nonet --xinclude \
# --stringparam profile.revision $(REV) \
# --stringparam profile.arch $(ARCH) \
# --output $(RENDERTMP)/sysd-wget.xml \
# stylesheets/lfs-xsl/profile.xsl \
# chapter03/chapter03.xml
@ -193,7 +189,7 @@ $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
$(Q)xsltproc --nonet --xinclude \
--stringparam profile.revision $(REV) \
--stringparam profile.arch $(ARCH) \
--stringparam profile.arch $(ARCH) \
--output $(RENDERTMP)/sysv-md5sum.xml \
stylesheets/lfs-xsl/profile.xsl \
chapter03/chapter03.xml
@ -211,7 +207,6 @@ $(BASEDIR)/md5sums: stylesheets/wget-list.xsl chapter03/chapter03.xml \
# $(Q)xsltproc --nonet \
# --output $(RENDERTMP)/lfs-html.xml \
# --stringparam profile.revision $(REV) \
# --stringparam profile.arch $(ARCH) \
# stylesheets/lfs-xsl/profile.xsl \
# $(RENDERTMP)/lfs-full.xml

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>
@ -1303,8 +1303,8 @@
<segtitle>&dependencies;</segtitle>
<seglistitem>
<seg>Bash, Bison, Coreutils, Flex, GCC, Glibc, Make,
and Linux API Headers</seg>
<seg>Bash, Bison, Coreutils, Flex, GCC, Glibc, Make, Libcap,
Libelf, and Linux API Headers</seg>
</seglistitem>
</segmentedlist>
@ -1328,7 +1328,7 @@
<segtitle>&external;</segtitle>
<seglistitem>
<seg>None</seg>
<seg>Berkeley DB and Iptables</seg>
</seglistitem>
</segmentedlist>
@ -1464,7 +1464,7 @@
<segtitle>&before;</segtitle>
<seglistitem>
<seg>Shadow</seg>
<seg>IProute2 and Shadow</seg>
</seglistitem>
</segmentedlist>
@ -1499,7 +1499,7 @@
<segtitle>&before;</segtitle>
<seglistitem>
<seg>Linux Kernel</seg>
<seg>IProute2 and Linux Kernel</seg>
</seglistitem>
</segmentedlist>
@ -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

@ -38,12 +38,13 @@
<itemizedlist>
<listitem>
<para>The version of the book being used (in this case
<para>
The version of the book being used (in this case
<phrase arch="default" revision="sysv">&version;</phrase>
<phrase arch="ml_32,ml_x32,ml_all" revision="sysv">&version;-multilib</phrase>
<phrase arch="default" revision="systemd">&versiond;</phrase>
<phrase arch="ml_32,ml_x32,ml_all" revision="systemd">&versiond;-multilib</phrase>)</para>
<phrase arch="ml_32,ml_x32,ml_all" revision="systemd">&versiond;-multilib</phrase>)
</para>
</listitem>
<listitem>
<para>The host distribution and version being used to create LFS</para>
@ -58,7 +59,7 @@
<para>The exact error message or symptom being received</para>
</listitem>
<listitem>
<para>Note whether you have deviated from the book at all </para>
<para>Note whether you have deviated from the book at all</para>
</listitem>
</itemizedlist>

View File

@ -11,10 +11,10 @@
<title>Changelog</title>
<para>This is version
<phrase arch="default" revision="sysv">&version;</phrase>
<phrase arch="ml_32,ml_x32,ml_all" revision="sysv">&version;-multilib</phrase>
<phrase arch="default" revision="systemd">&versiond;</phrase>
<phrase arch="ml_32,ml_x32,ml_all" revision="systemd">&versiond;-multilib</phrase>
<phrase arch="default" revision="sysv">&version;</phrase>
<phrase arch="ml_32,ml_x32,ml_all" revision="sysv">&version;-multilib</phrase>
<phrase arch="default" revision="systemd">&versiond;</phrase>
<phrase arch="ml_32,ml_x32,ml_all" revision="systemd">&versiond;-multilib</phrase>
of the Linux From Scratch book, dated
&releasedate;. If this book is more than six months old, a newer and better
version is probably already available. To find out, please check one of the
@ -44,6 +44,92 @@
<listitem revision="sysv"> or <listitem revision="systemd"> as
appropriate for the entry or if needed the entire day's listitem.
-->
<listitem revision="systemd">
<itemizedlist>
<para>2020-06-22</para>
<listitem>
<para>[renodr] - Fix a segfault in systemd-udevd.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<itemizedlist>
<para>2020-06-17</para>
<listitem>
<para>[bdubbs] - Update to meson-0.54.3. Fixes
<ulink url="&lfs-ticket-root;4673">#4673</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to man-pages-5.07. Fixes
<ulink url="&lfs-ticket-root;4669">#4669</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to linux-5.7.2. Fixes
<ulink url="&lfs-ticket-root;4662">#4662</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to iproute2-5.7.0. Fixes
<ulink url="&lfs-ticket-root;4668">#4668</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to file-5.39. Fixes
<ulink url="&lfs-ticket-root;4671">#4671</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to elfutils-0.180. Fixes
<ulink url="&lfs-ticket-root;4670">#4670</ulink>.</para>
</listitem>
<listitem>
<para>[bdubbs] - Update to bison-3.6.4. Fixes
<ulink url="&lfs-ticket-root;4672">#4672</ulink>.</para>
</listitem>
</itemizedlist>
</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>
<listitem revision="systemd">
<para>[renodr] - Fix systemd's build with GCC-10 with a patch instead
of CFLAGS.</para>
</listitem>
<listitem>
<para>[renodr] - Update to perl-5.30.3 (security update). Fixes
<ulink url="&lfs-ticket-root;4664">#4664</ulink>.</para>
</listitem>
<listitem revision="systemd">
<para>[renodr] - Update to dbus-1.12.18 (security update). Fixes
<ulink url="&lfs-ticket-root;4665">#4665</ulink>.</para>
</listitem>
<listitem>
<para>[renodr] - Update to man-db-2.9.2. Fixes
<ulink url="&lfs-ticket-root;4663">#4663</ulink>.</para>
</listitem>
<listitem>
<para>[renodr] - Update to libcap-2.36. Fixes
<ulink url="&lfs-ticket-root;4666">#4666</ulink>.</para>
</listitem>
<listitem>
<para>[renodr] - Update to bison-3.6.3. Fixes
<ulink url="&lfs-ticket-root;4667">#4667</ulink>.</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>2020-05-31</para>
<itemizedlist>
@ -59,6 +145,17 @@
<listitem>
<para>2020-05-29</para>
<itemizedlist>
<listitem>
<para>[xry111] - Move flex earlier in chapter 6, so that binutils
can use it.</para>
</listitem>
<listitem>
<para>[xry111] - Remove bzip2 and flex from chapter 5.</para>
</listitem>
<listitem>
<para>[xry111] - Move zstd earlier in chapter 6, so that file and
GCC can use it.</para>
</listitem>
<listitem>
<para>[bdubbs] - Run sed and findutils tests as an
unprivileged user. Fixes
@ -176,6 +273,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

@ -1,106 +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-intro-livecd">
<?dbhtml filename="livecd.html"?>
<title>About the Included CD</title>
<para>For your convenience, we have included a CD with this book that
contains the source packages needed for creating a Linux From Scratch
system. The CD is bootable and provides a stable working environment
for building LFS. This book refers to this system as the
<quote>host system.</quote> The CD images are actively maintained and
updated versions can be found at
<ulink url="ftp://ftp.lfs-matrix.net/pub/lfs-livecd/"/></para>
<para>In addition to the tools required to build LFS, the host system
on the CD has a number of other helpful tools installed:</para>
<itemizedlist>
<listitem>
<para>An HTML version of this book</para>
</listitem>
<listitem>
<para>The X Window System Environment</para>
</listitem>
<listitem>
<para>Web Tools</para>
<itemizedlist>
<listitem>
<para>Wget (command line file retriever)</para>
</listitem>
<listitem>
<para>Lynx (text web browser)</para>
</listitem>
<listitem>
<para>Irssi (console IRC client)</para>
</listitem>
<listitem>
<para>Firefox (graphical web browser)</para>
</listitem>
<listitem>
<para>Xchat (X-based IRC client)</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>Text Editors</para>
<itemizedlist>
<listitem>
<para>Vim</para>
</listitem>
<listitem>
<para>Nano</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>Network Tools</para>
<itemizedlist>
<listitem>
<para>SSH Server and Client</para>
</listitem>
<listitem>
<para>NFS Server and Client</para>
</listitem>
<listitem>
<para>Smbmount (mount.cifs) for Windows shares</para>
</listitem>
<listitem>
<para>Subversion</para>
</listitem>
<listitem>
<para>Dhcpcd (DHCP client)</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>Filesystem Programs</para>
<itemizedlist>
<listitem>
<para>Reiserfsprogs</para>
</listitem>
<listitem>
<para>Xfsprogs</para>
</listitem>
</itemizedlist>
</listitem>
<listitem>
<para>nALFS - A tool for automating LFS builds</para>
</listitem>
</itemizedlist>
</sect1>

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>
@ -80,9 +84,9 @@
<!-- <listitem>
<para>Expect-&expect-version;</para>
</listitem>-->
<!--<listitem>
<listitem>
<para>File-&file-version;</para>
</listitem>-->
</listitem>
<!--<listitem>
<para>Findutils-&findutils-version;</para>
</listitem>-->
@ -164,9 +168,6 @@
<listitem>
<para>Linux-&linux-version;</para>
</listitem>
<listitem>
<para>Linux-Firmware-&linux-firmware-version;</para>
</listitem>
<!--<listitem>
<para>M4-&m4-version;</para>
</listitem>-->

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

@ -244,6 +244,7 @@ or all absent, but not only one or two present.</para>
&lt;M&gt; IA32 a.out support
[*] x32 ABI for 64-bit mode
</screen>
<para arch="ml_32,ml_x32,ml_all">The option 'IA32 a.out support' is
optional. In case your kernel does not have 'x32 ABI for 64-bit mode'
enabled but only 'IA32 Emulation', you can continue to build your
@ -251,7 +252,7 @@ or all absent, but not only one or two present.</para>
for building x32 objects. If neither 'IA32 Emulation' nor
'x32 ABI for 64-bit mode' is enabled, you will run in errors
latest when building <application>glibc</application> in Chapter 6,
so an upgrade of your host system is required.
so an upgrade of your host system kernel is required.
</para>
</sect1>

View File

@ -25,57 +25,63 @@
<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>
<para> The virtual file systems must be mounted. This can be done
before or after entering chroot by changing to a host virtual terminal
and, as root, running the commands in
<xref linkend='ch-system-bindmount'/> and
<xref linkend='ch-system-kernfsmount'/>.</para>
<xref linkend='ch-tools-bindmount'/> and
<xref linkend='ch-tools-kernfsmount'/>.</para>
</listitem>
</itemizedlist>
</sect2>

View File

@ -49,9 +49,28 @@
<screen role="nodump"><userinput>chmod -v a+wt $LFS/sources</userinput></screen>
<para>An easy way to download all of the packages and patches is by using
<ulink url="../wget-list">wget-list</ulink> as an input to
<command>wget</command>. For example:</para>
<para>There are several ways to optain all the necessary packages and patches
to build LFS:</para>
<itemizedlist>
<listitem>
<para>The files can be downloaded individually as described in the
next two sections.</para>
</listitem>
<listitem>
<para>For stable versions of the book, a tarball of all the needed files
can be downloaded from one of the LFS files mirrors listed at
<ulink url="http://www.linuxfromscratch.org/mirrors.html#files"/>.</para>
</listitem>
<listitem>
<para>The files can be downloaded using <command>wget</command> and
a wget-list as described below.</para>
</listitem>
</itemizedlist>
<para>To download all of the packages and patches by using
<ulink url="../wget-list">wget-list</ulink> as an input to the
<command>wget</command> command, use:</para>
<screen role="nodump"><userinput>wget --input-file=wget-list --continue --directory-prefix=$LFS/sources</userinput></screen>
@ -61,7 +80,10 @@
<filename class="directory">$LFS/sources</filename> and run:</para>
<screen role="nodump"><userinput>pushd $LFS/sources
md5sum -c md5sums
md5sum -c md5sums
popd</userinput></screen>
<para>This check can be used after retrieving the needed files with any of the
methods listed above.</para>
</sect1>

View File

@ -355,7 +355,7 @@
</listitem>
</varlistentry>
<varlistentry>
<varlistentry arch="ml_32,ml_x32,ml_all">
<term>ISL (&isl-version;) - <token>&isl-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&isl-home;"/></para>
@ -459,15 +459,6 @@
</listitem>
</varlistentry>
<varlistentry>
<term>Linux Firmware (&linux-firmware-version;) - <token>&linux-firmware-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&linux-firmware-home;"/></para>
<para>Download: <ulink url="&linux-firmware-url;"/></para>
<para>MD5 sum: <literal>&linux-firmware-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>M4 (&m4-version;) - <token>&m4-size;</token>:</term>
<listitem>
@ -531,15 +522,6 @@
</listitem>
</varlistentry>
<varlistentry>
<term>Ninja (&ninja-version;) - <token>&ninja-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&ninja-home;"/></para>
<para>Download: <ulink url="&ninja-url;"/></para>
<para>MD5 sum: <literal>&ninja-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Ncurses (&ncurses-version;) - <token>&ncurses-size;</token>:</term>
<listitem>
@ -549,6 +531,15 @@
</listitem>
</varlistentry>
<varlistentry>
<term>Ninja (&ninja-version;) - <token>&ninja-size;</token>:</term>
<listitem>
<para>Home page: <ulink url="&ninja-home;"/></para>
<para>Download: <ulink url="&ninja-url;"/></para>
<para>MD5 sum: <literal>&ninja-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>OpenSSL (&openssl-version;) - <token>&openssl-size;</token>:</term>
<listitem>
@ -711,6 +702,14 @@
</listitem>
</varlistentry>
<varlistentry>
<term>Tcl Documentation (&tcl-version;) - <token>&tcl-docs-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&tcl-docs-url;"/></para>
<para>MD5 sum: <literal>&tcl-docs-md5;</literal></para>
</listitem>
</varlistentry>
<varlistentry>
<term>Texinfo (&texinfo-version;) - <token>&texinfo-size;</token>:</term>
<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,15 @@
<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>
<term>Systemd GCC-10 Patch - <token>&systemd-gcc10-patch-size;</token>:</term>
<listitem>
<para>Download: <ulink url="&patches-root;&systemd-gcc10-patch;"/></para>
<para>MD5 sum: <literal>&systemd-gcc10-patch-md5;</literal></para>
</listitem>
</varlistentry>
-->
</variablelist>
<para>Total size of these patches: about <returnvalue/></para>

View File

@ -1,39 +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-preps-aboutlfs">
<?dbhtml filename="aboutlfs.html"?>
<title>About $LFS</title>
<para>Throughout this book, the environment variable <envar>LFS</envar> will
be used. It is paramount that this variable is always defined.
It should be set to the mount point chosen for the LFS partition.
Check that the <envar>LFS</envar> variable is set up properly with:</para>
<screen role="nodump"><userinput>echo $LFS</userinput></screen>
<para>Make sure the output shows the path to the LFS partition's mount
point, which is <filename class="directory">/mnt/lfs</filename> if the
provided example was followed. If the output is incorrect, the
variable can be set with:</para>
<screen role="nodump"><userinput>export LFS=/mnt/lfs</userinput></screen>
<para>Having this variable set is beneficial in that commands such as
<command>mkdir $LFS/tools</command> can be typed literally. The shell
will automatically replace <quote>$LFS</quote> with
<quote>/mnt/lfs</quote> (or whatever the variable was set to) when it
processes the command line.</para>
<para>Do not forget to check that <envar>$LFS</envar> is set whenever
you leave and reenter the current working environment (as when doing a
<command>su</command> to <systemitem class="username">root</systemitem>
or another user).</para>
</sect1>

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,16 @@ 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>
<screen arch="ml_32" ><userinput>chown -v lfs $LFS&lib-m32;</userinput></screen>
<screen arch="ml_x32" ><userinput>chown -v lfs $LFS&lib-mx32;</userinput></screen>
<screen arch="ml_all" ><userinput>chown -v lfs $LFS/{lib32,libx32}</userinput></screen>
<para>If a separate working directory was created as suggested, give
user <systemitem class="username">lfs</systemitem> ownership of this
@ -95,7 +101,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,46 @@
<?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>
<screen arch="ml_32" ><userinput>mkdir -pv $LFS&lib-m32;</userinput></screen>
<screen arch="ml_x32" ><userinput>mkdir -pv $LFS&lib-mx32;</userinput></screen>
<screen arch="ml_all" ><userinput>mkdir -pv $LFS/lib{,x}32</userinput></screen>
<!--
<screen arch="ml_32" ><userinput>mkdir -pv $LFS/{usr/,}lib32</userinput></screen>
<screen arch="ml_x32" ><userinput>mkdir -pv $LFS/{usr/,}libx32</userinput></screen>
<screen arch="ml_all" ><userinput>mkdir -pv $LFS/{usr/,}{lib32,libx32}</userinput></screen>
<screen arch="ml_32" ><userinput>mkdir -pv $LFS&usr-inc-m32;</userinput></screen>
<screen arch="ml_x32" ><userinput>mkdir -pv $LFS&usr-inc-mx32;</userinput></screen>
<screen arch="ml_all" ><userinput>mkdir -pv $LFS&usr-inc-m32;
mkdir -pv $LFS&usr-inc-mx32;</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

@ -1,48 +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-preps-creatingtoolsdir">
<?dbhtml filename="creatingtoolsdir.html"?>
<title>Creating the $LFS/tools Directory</title>
<para>All programs compiled in <xref linkend="chapter-temporary-tools"/>
will be installed under <filename class="directory">$LFS/tools</filename>
to keep them separate from the programs compiled in <xref
linkend="chapter-building-system"/>. The programs compiled here are
temporary tools and will not be a part of the final LFS system. By keeping
these programs in a separate directory, they can easily be discarded later
after their use. This also prevents these programs from ending up in the
host production directories (easy to do by accident in <xref
linkend="chapter-temporary-tools"/>).</para>
<para>Create the required directory by running the following as
<systemitem class="username">root</systemitem>:</para>
<screen><userinput>mkdir -v $LFS/tools</userinput></screen>
<para>The next step is to create a <filename class="symlink">/tools</filename>
symlink on the host system. This will point to the newly-created directory on
the LFS partition. Run this command as <systemitem
class="username">root</systemitem> as well:</para>
<screen><userinput>ln -sv $LFS/tools /</userinput></screen>
<note>
<para>The above command is correct. The <command>ln</command> command
has a few syntactic variations, so be sure to check
<command>info coreutils ln</command> and <filename>ln(1)</filename>
before reporting what you may think is an error.</para>
</note>
<para>The created symlink enables the toolchain to be compiled so that it
always refers to <filename class="directory">/tools</filename>, meaning
that the compiler, assembler, and linker will work both in Chapter&nbsp;5
(when we are still using some tools from the host) and in the next (when
we are <quote>chrooted</quote> to the LFS partition).</para>
</sect1>

View File

@ -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,7 +43,9 @@ 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>
<screen arch="ml_32,ml_x32,ml_all"><userinput>cat &gt; ~/.bashrc &lt;&lt; "EOF"
@ -54,12 +56,14 @@ LC_ALL=POSIX
LFS_TGT=x86_64-lfs-linux-gnu
LFS_TGT32=i686-lfs-linux-gnu
LFS_TGTX32=x86_64-lfs-linux-gnux32
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 LFS_TGT32 LFS_TGTX32 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>
@ -119,14 +123,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>
@ -134,12 +160,38 @@ 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>
</variablelist>
<important>
<para>Several commercial distributions add a non-documented instantiation
of <filename>/etc/bash.bashrc</filename> to the initialization of
<command>bash</command>. This file has the potential to modify the
<systemitem class="username">lfs</systemitem>
user's environment in ways that can affect the building of critical LFS
packages. To make sure the <systemitem class="username">lfs</systemitem>
user's envronment is clean, check for the
presence of <filename>/etc/bash.bashrc</filename> and, if present, move it
out of the way. As the <systemitem class="username">root</systemitem>
user, run:</para>
<screen role="nodump"><userinput>[ ! -e /etc/bash.bashrc ] || mv -v /etc/bash.bashrc /etc/bash.bashrc.NOUSE</userinput></screen>
<para>After use of the <systemitem class="username">lfs</systemitem>
user is finished at the beginning of <xref
linkend="chapter-chroot-temporary-tools"/>, you can restore
<filename>/etc/bash.bashrc</filename> (if desired).</para>
<para>Note that the LFS Bash package we will build in
<xref linkend="ch-system-bash"/> is not configured to load or execute
<filename>/etc/bash.bashrc</filename>, so this file is useless on a
completed LFS system.</para>
</important>
<para>Finally, to have the environment fully prepared for building the
temporary tools, source the just-created user profile:</para>

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>
@ -43,8 +43,9 @@
<sect2 role="installation">
<title>Installation of Cross Binutils</title>
<note><para>Go back and re-read the notes in the previous section.
Understanding the notes labeled important will save you a lot
<note><para>Go back and re-read the notes in the section titled <xref
linkend="ch-tools-generalinstructions"/>.
Understanding the notes labeled important can save you a lot
of problems later.</para></note>
<para>It is important that Binutils be the first package compiled
@ -63,43 +64,33 @@ 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 arch="default"><userinput remap="configure">../configure --prefix=/tools \
<screen arch="default"><userinput remap="configure">../configure --prefix=$LFS/tools \
--with-sysroot=$LFS \
--with-lib-path=/tools/lib \
--target=$LFS_TGT \
--disable-nls \
--disable-werror</userinput></screen>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">lpath=/tools/lib</userinput>
<userinput remap="configure" arch="ml_32,ml_all">lpath="$lpath:/tools/lib32"</userinput>
<userinput remap="configure" arch="ml_x32,ml_all">lpath="$lpath:/tools/libx32"</userinput>
<userinput remap="configure">../configure --prefix=/tools \
--with-sysroot=$LFS \
--with-lib-path=$lpath \
--target=$LFS_TGT \
--disable-nls \
--disable-werror \
--enable-64-bit-bfd \
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure --prefix=$LFS/tools \
--with-sysroot=$LFS \
--target=$LFS_TGT \
--disable-nls \
--disable-werror \
--enable-multilib</userinput></screen>
<variablelist>
<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>
@ -111,21 +102,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>
@ -146,31 +129,19 @@ cd build</userinput></screen>
</listitem>
</varlistentry>
<varlistentry arch="ml_32,ml_x32,ml_all">
<term><parameter>--enable-multilib</parameter></term>
<listitem>
<para>Enables multilib support.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Continue with compiling the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Compilation is now complete. Ordinarily we would now run the
test suite, but at this early stage the test suite framework (Tcl,
Expect, and DejaGNU) is not yet in place. The benefits of running the
tests at this point are minimal since the programs from this
first pass will soon be replaced by those from the second.</para>
<para arch="default">If building on x86_64, create a symlink to ensure the
sanity of the toolchain:</para>
<para arch="ml_32,ml_x32,ml_all">Create a symlink to ensure the sanity of
the toolchain:</para>
<screen arch="default"><userinput remap="install">case $(uname -m) in
x86_64) mkdir -v /tools/lib &amp;&amp; ln -sv lib /tools/lib64 ;;
esac</userinput></screen>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="install">mkdir -v /tools/lib &amp;&amp;
ln -sv lib /tools/lib64</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>

View File

@ -1,208 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-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 arch="default"><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>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">lpath=/tools/lib</userinput>
<userinput remap="configure" arch="ml_32,ml_all">lpath="$lpath:/tools/lib32"</userinput>
<userinput remap="configure" arch="ml_x32,ml_all">lpath="$lpath:/tools/libx32"</userinput>
<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=$lpath \
--with-sysroot \
--enable-64-bit-bfd \
--enable-multilib</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 arch="default">
<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 arch="ml_32,ml_x32,ml_all">
<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>,
<filename class="directory">/tools/lib32</filename> and
<filename class="directory">/tools/libx32</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>
<varlistentry arch="ml_32,ml_x32,ml_all">
<term><parameter>--enable-64-bit-bfd</parameter></term>
<listitem>
<para>TODO</para>
</listitem>
</varlistentry>
<varlistentry arch="ml_32,ml_x32,ml_all">
<term><parameter>--enable-multilib</parameter></term>
<listitem>
<para>TODO</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 arch="default"><userinput remap="adjust">make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
cp -v ld/ld-new /tools/bin</userinput></screen>
<screen arch="ml_all"><userinput remap="adjust">make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib:/usr/lib32:/lib32:/usr/libx32:/libx32
cp -v ld/ld-new /tools/bin</userinput></screen>
<screen arch="ml_32"><userinput remap="adjust">make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib:/usr/lib32:/lib32
cp -v ld/ld-new /tools/bin</userinput></screen>
<screen arch="ml_x32"><userinput remap="adjust">make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib:/usr/libx32:/libx32
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,48 +5,17 @@
%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"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="generalinstructions.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="binutils-pass1.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gcc-pass1.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="linux-headers.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="glibc.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="binutils-pass2.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="zlib.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,17 +43,11 @@
<sect2 role="installation">
<title>Installation of Cross GCC</title>
<para arch="default">GCC now requires the GMP, MPFR, and MPC packages. As
these packages may not be included in your host distribution, they will be
built with GCC. Unpack each package into the GCC source directory and
rename the resulting directories so the GCC build procedures will
automatically use them:</para>
<para arch="ml_32,ml_x32,ml_all">GCC now requires the GMP, ISL, MPFR, and MPC packages.
As these packages may not be included in your host distribution, they will
be built with GCC. Unpack each package into the GCC source directory and
rename the resulting directories so the GCC build procedures will
automatically use them:</para>
<para>GCC requires the GMP, MPFR and MPC packages. As these packages may
not be included in your host distribution, they will be built with
GCC. Unpack each package into the GCC source directory and rename the
resulting directories so the GCC build procedures will automatically
use them:</para>
<note><para>There are frequent misunderstandings about this chapter. The
procedures are the same as every other chapter as explained earlier (<xref
@ -61,56 +55,17 @@
directory and then change to the directory created. Only then should you
proceed with the instructions below.</para></note>
<screen arch="default"><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
<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>
<screen arch="ml_32,ml_x32,ml_all"><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
tar -xf ../isl-&isl-version;.tar.xz
mv -v mpc-&mpc-version; mpc</userinput>
<userinput remap="pre" arch="ml_32,ml_x32,ml_all">tar -xf ../isl-&isl-version;.tar.xz
mv -v isl-&isl-version; isl</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\)\?\(x32\)\?/ld@/tools&amp;@g' \
-e 's@/usr@/tools@g' $file.orig &gt; $file
touch $file.orig
done
sed -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/ s;\".*\";\"/tools/lib/\";" \
-e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_2/ s;\".*\";\"\";" \
-i gcc/gcc.c</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 arch="default">Finally, on x86_64 hosts, set the default directory
name for 64-bit libraries to <quote>lib</quote>:</para>
<para arch="default">On x86_64 hosts, set the default directory name for
64-bit libraries to <quote>lib</quote>:</para>
<screen arch="default"><userinput remap="pre">case $(uname -m) in
x86_64)
@ -119,33 +74,13 @@ sed -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/ s;\".*\";\"/tools/lib/
;;
esac</userinput></screen>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
-e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \
-i.orig gcc/config/i386/t-linux64</userinput></screen>
<para arch="ml_32,ml_x32,ml_all">Change the default directory name for
libraries:</para>
<!--
<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>
-->
<!-- Following patch might be obsolete with gcc >= 8.2.1 -->
<!-- see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86724 -->
<!-- Fix applied in ch5-gcc-pass{1,2}, ch6-gcc -->
<!--
<para arch="ml_32,ml_x32,ml_all">Fix an issue with isl-&isl-version;:</para>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e "/#include &lt;isl\/schedule_node.h&gt;/ a#include &lt;isl/id.h&gt;\n#include &lt;isl/space.h&gt;" \
-i gcc/graphite.h</userinput></screen>
-->
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
-e '/m32=/s/m32=.*/m32=..\&lib-m32;$(call if_multiarch,:i386-linux-gnu)/' \
-i.orig gcc/config/i386/t-linux64
</userinput></screen>
<para>The GCC documentation recommends building GCC
in a dedicated build directory:</para>
@ -155,21 +90,17 @@ cd build</userinput></screen>
<para>Prepare GCC for compilation:</para>
<screen><userinput arch="default" remap="configure">mloptions="--disable-multilib"</userinput>
<userinput arch="ml_32,ml_x32,ml_all" remap="configure">mloptions="--enable-multilib --with-multilib-list=m64"</userinput>
<userinput arch="ml_32,ml_all" remap="configure">mloptions="$mloptions,m32"</userinput>
<userinput arch="ml_x32,ml_all" remap="configure">mloptions="$mloptions,mx32"</userinput>
<userinput remap="configure">../configure \
<screen arch="default"><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 \
--disable-decimal-float \
--disable-threads \
--disable-libatomic \
@ -178,8 +109,31 @@ cd build</userinput></screen>
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++ \
$mloptions</userinput></screen>
--enable-languages=c,c++</userinput></screen>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure"
arch="ml_32">mlist=m64,m32</userinput><userinput remap="configure"
arch="ml_x32">mlist=m64,mx32</userinput><userinput remap="configure"
arch="ml_all">mlist=m64,m32,mx32</userinput>
<userinput remap="configure">../configure \
--target=$LFS_TGT \
--prefix=$LFS/tools \
--with-glibc-version=2.11 \
--with-sysroot=$LFS \
--with-newlib \
--without-headers \
--enable-initfini-array \
--disable-nls \
--disable-shared \
--enable-multilib --with-multilib-list=$mlist \
--disable-decimal-float \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++</userinput></screen>
<variablelist>
<title>The meaning of the configure options:</title>
@ -213,26 +167,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>
@ -240,39 +179,37 @@ 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 arch="default">
<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 arch="ml_32,ml_x32,ml_all">
<term><parameter>--enable-multilib,
--with-multilib-list=m32,m64,mx32</parameter></term>
<term><parameter>--enable-multilib --with-multilib-list=...</parameter></term>
<listitem>
<para>LFS now supports a multilib configuration. Enable it for the
32bit, the 64-bit, and the mixed mode.</para>
<para>LFS canbe used to support multilib. Which they are is
specified in the multilib list.</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>
@ -290,26 +227,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,267 +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 arch="default">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>
<para arch="ml_32,ml_x32,ml_all">As in the first build of GCC, the GMP, MPFR, MPC and ISL packages are
required. Unpack the tarballs and move them into the required directory
names:</para>
<screen arch="default"><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>
<screen arch="ml_32,ml_x32,ml_all"><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
tar -xf ../isl-&isl-version;.tar.xz
mv -v isl-&isl-version; isl</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\)\?\(x32\)\?/ld@/tools&amp;@g' \
-e 's@/usr@/tools@g' $file.orig &gt; $file
touch $file.orig
done
sed -e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_1/ s;\".*\";\"/tools/lib/\";" \
-e "/^#define[[:blank:]]*STANDARD_STARTFILE_PREFIX_2/ s;\".*\";\"\";" \
-i gcc/gcc.c</userinput></screen>
<para arch="default">If building on x86_64, change the default directory
name for 64-bit libraries to <quote>lib</quote>:</para>
<screen arch="default"><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>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
-e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \
-i.orig gcc/config/i386/t-linux64</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 arch="default" remap="configure">mloptions="--disable-multilib"</userinput>
<userinput arch="ml_32,ml_x32,ml_all" remap="configure">mloptions="--with-system-zlib --enable-multilib --with-multilib-list=m64"</userinput>
<userinput arch="ml_32,ml_all" remap="configure">mloptions="$mloptions,m32"</userinput>
<userinput arch="ml_x32,ml_all" remap="configure">mloptions="$mloptions,mx32"</userinput>
<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-bootstrap \
--disable-libgomp \
$mloptions</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 arch="ml_32,ml_all">Repeat the test for 32-bit:</para>
<screen arch="ml_32,ml_all"><userinput>cc -m32 dummy.c
readelf -l a.out | grep ': /tools'</userinput></screen>
<para arch="ml_32,ml_all">In this case, the output shoud be:</para>
<screen arch="ml_32,ml_all"><computeroutput>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</computeroutput></screen>
<para arch="ml_x32,ml_all">Repeat the test for x32-bit:</para>
<screen arch="ml_x32,ml_all"><userinput>cc -mx32 dummy.c
readelf -l a.out | grep ': /tools'</userinput></screen>
<para arch="ml_x32,ml_all">In this case, the output shoud be:</para>
<screen arch="ml_x32,ml_all"><computeroutput>[Requesting program interpreter: /tools/libx32/ld-linux-x32.so.2]</computeroutput></screen>
<para arch="default">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

@ -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,33 @@
<sect2 role="installation">
<title>Installation of Glibc</title>
<para arch="default">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 arch="default"><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 arch="ml_32,ml_x32,ml_all">First, create symbolic links for LSB compliance
and compatibility symbolic links required for proper
operation of the dynamic library loader:</para>
<!-- no ld-linux.so.2 here as multilib is based on x86_64, not on i686 -->
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64
ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3</userinput></screen>
<para>Some of the Glibc programs use the non-FHS compliant
<filename class="directory">/var/db</filename> directory to store their
runtime data. Apply the following patch to make such programs store their
runtime data in the FHS-compliant locations:</para>
<screen><userinput remap="pre">patch -Np1 -i ../glibc-&glibc-version;-fhs-1.patch</userinput></screen>
<para>The Glibc documentation recommends building Glibc
in a dedicated build directory:</para>
@ -52,18 +79,22 @@ cd build</userinput></screen>
<para>Next, prepare Glibc for compilation:</para>
<screen arch="default"><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>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure \
--prefix=/tools \
--prefix=/usr \
--host=$LFS_TGT \
--build=$(../scripts/config.guess) \
--enable-kernel=&min-kernel; \
--with-headers=$LFS/usr/include \
--enable-multi-arch \
--with-headers=/tools/include</userinput></screen>
--libdir=/usr/lib \
--libexecdir=/usr/lib \
libc_cv_slibdir=/lib</userinput></screen>
<!--
libc_cv_forced_unwind=yes \
libc_cv_c_cleanup=yes</userinput></screen> -->
@ -75,8 +106,8 @@ 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
cross-compiler in <filename class="directory">/tools</filename>.</para>
configures itself to be cross-compiled, using the cross-linker and
cross-compiler in <filename class="directory">$LFS/tools</filename>.</para>
</listitem>
</varlistentry>
@ -89,51 +120,23 @@ cd build</userinput></screen>
</listitem>
</varlistentry>
<varlistentry arch="ml_32,ml_x32,ml_all">
<term><parameter>--enable-multi-arch</parameter></term>
<varlistentry>
<term><parameter>--with-headers=$LFS/usr/include</parameter></term>
<listitem>
<para>Enables glibc for multiarch environments.</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>--with-headers=/tools/include</parameter></term>
<term><parameter>libc_cv_slibdir=/lib</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 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_forced_unwind=yes</parameter></term>
<listitem>
<para>The linker installed during
<xref linkend="ch-tools-binutils-pass1"/> was cross-compiled and as
such cannot be used until Glibc has been installed. This means that
the configure test for force-unwind support will fail, as it relies on
a working linker. The libc_cv_forced_unwind=yes variable is passed in
order to inform <command>configure</command> that force-unwind
support is available without it having to run the test.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>libc_cv_c_cleanup=yes</parameter></term>
<listitem>
<para>Similarly, we pass libc_cv_c_cleanup=yes through to the
<command>configure</command> script so that the test is skipped and C
cleanup handling support is configured.</para>
</listitem>
</varlistentry>
-->
<!-- <varlistentry>
<term><parameter>libc_cv_ctors_header=yes</parameter></term>
<listitem>
<para>Similarly, we pass libc_cv_ctors_header=yes through to the
<command>configure</command> script so that the test is skipped and
gcc constructor support is configured.</para>
</listitem>
</varlistentry>-->
</variablelist>
@ -161,216 +164,217 @@ 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 arch="default">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>
<sect2 arch="ml_32,ml_all" role="installation">
<title>Installation of Glibc 32-bit</title>
<!-- - - - - - - - - - -->
<!-- Multilib - 32bit -->
<!-- - - - - - - - - - -->
<sect2 arch="ml_32,ml_all">
<title>Building Glibc - 32bit</title>
<para>Clean the build directory for redoing glibc for 32-bit:</para>
<screen><userinput remap="pre">mkdir ../build32
cd ../build32</userinput></screen>
<para>Now recompile for m32. The extracted source can be
reused but needs to cleaned before installing the m32
version of Glibc.</para>
<para>Rebuild glibc for 32-bit:</para>
<screen><userinput remap="configure">echo slibdir=/tools/lib32 &gt; configparms
BUILD_CC="gcc -m32" \
CC="${LFS_TGT}-gcc -m32" \
CXX="${LFS_TGT}-g++ -m32" \
AR="${LFS_TGT}-ar" \
RANLIB="${LFS_TGT}-ranlib" \
../configure --prefix=/tools \
--build=$(../scripts/config.guess) \
--host=${LFS_TGT32} \
--enable-kernel=&min-kernel; \
--with-headers=/tools/include \
--with-binutils=/tools/bin \
--enable-multi-arch \
--libdir=/tools/lib32 \
--libexecdir=/tools/lib32</userinput></screen>
<!-- \
libc_cv_forced_unwind=yes \
libc_cv_c_cleanup=yes</userinput></screen> -->
<para>Clear the build directory and remove artefacts from
previous build:</para>
<screen><userinput remap="pre">make clean
find .. -name "*.a" -delete</userinput></screen>
<variablelist>
<title>The meaning of the extra configure options:</title>
<para>Configure Glibc for m32 with the following commands:</para>
<varlistentry>
<term><parameter>--enable-multi-arch</parameter></term>
<listitem>
<para>Enables glibc for multiarch environments.</para>
</listitem>
</varlistentry>
<screen><userinput remap="configure">CC="$LFS_TGT-gcc -m32" \
CXX="$LFS_TGT-g++ -m32" \
../configure \
--prefix=/usr \
--host=$LFS_TGT32 \
--build=$(../scripts/config.guess) \
--enable-kernel=&min-kernel; \
--with-headers=$LFS/usr/include \
--enable-multi-arch \
--libdir=&usr-lib-m32; \
--libexecdir=&usr-lib-m32; \
libc_cv_slibdir=&lib-m32;</userinput></screen>
<varlistentry>
<term><parameter>--libdir=/tools/lib32, --libexecdir=/tools/lib32</parameter></term>
<listitem>
<para>Overrides location for installing 32-bit files.</para>
</listitem>
</varlistentry>
<para>Compile the package:</para>
<varlistentry>
<term><parameter>--with-binutils=/tools/bin</parameter></term>
<listitem>
<para>This tells Glibc to compile itself against the utilities
found within our "tools" heirachy, because otherwise...</para>
</listitem>
</varlistentry>
</variablelist>
<para>Now compile the 32-bit version of glibc:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install 32-bit version of glibc:</para>
<screen><userinput remap="install">make install_root="${PWD}/DESTDIR" install
install -vdm755 /tools/lib32
cp -Rv DESTDIR/tools/lib32/* /tools/lib32
install -vm644 DESTDIR/tools/include/gnu/{lib-names,stubs}-32.h \
/tools/include/gnu/
ln -svf /tools/lib32/ld-linux.so.2 /tools/lib/</userinput></screen>
<para>Install the package:</para>
</sect2>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
cp -a DESTDIR&lib-m32;/* $LFS&lib-m32;/
cp -a DESTDIR&usr-lib-m32; $LFS/usr/
install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \
$LFS/usr/include/gnu/
ln -svf ..&lib-m32;/ld-linux.so.2 $LFS/lib/ld-linux.so.2</userinput></screen>
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Installation of Glibc x32-bit</title>
<para>Create a build directory for redoing glibc for x32-bit:</para>
<screen><userinput remap="pre">mkdir ../build32x
cd ../build32x</userinput></screen>
<para>Rebuild glibc for x32-bit:</para>
<screen><userinput remap="configure">echo slibdir=/tools/libx32 &gt; configparms
BUILD_CC="gcc -mx32" \
CC="${LFS_TGT}-gcc -mx32" \
CXX="${LFS_TGT}-g++ -mx32" \
AR="${LFS_TGT}-ar" \
RANLIB="${LFS_TGT}-ranlib" \
../configure --prefix=/tools \
--build=$(../scripts/config.guess) \
--host=${LFS_TGTX32} \
--enable-kernel=&min-kernel; \
--with-headers=/tools/include \
--with-binutils=/tools/bin \
--enable-multi-arch \
--libdir=/tools/libx32 \
--libexecdir=/tools/libx32</userinput></screen>
<!-- \
libc_cv_forced_unwind=yes \
libc_cv_c_cleanup=yes</userinput></screen> -->
<variablelist>
<title>The meaning of the extra configure options:</title>
<varlistentry>
<term><parameter>--enable-multi-arch</parameter></term>
<listitem>
<para>Enables glibc for multiarch environments.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--libdir=/tools/libx32, --libexecdir=/tools/libx32</parameter></term>
<listitem>
<para>Overrides location for installing x32-bit files.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>--with-binutils=/tools/bin</parameter></term>
<listitem>
<para>This tells Glibc to compile itself against the utilities
found within our "tools" heirachy, because otherwise...</para>
</listitem>
</varlistentry>
</variablelist>
<para>Now compile the x32-bit version of glibc:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install x32-bit version of glibc:</para>
<screen><userinput remap="install">make install_root="${PWD}/DESTDIR" install
install -vdm755 /tools/libx32
cp -Rv DESTDIR/tools/libx32/* /tools/libx32
install -vm644 DESTDIR/tools/include/gnu/lib-names-x32.h \
/tools/include/gnu/
[ -e DESTDIR/tools/include/gnu/stubs-x32.h ] \
&amp;&amp; install -vm644 DESTDIR/tools/include/gnu/stubs-x32.h /tools/include/gnu/ \
|| ln -v /tools/include/gnu/stubs-64.h /tools/include/gnu/stubs-x32.h
ln -svf /tools/libx32/ld-linux-x32.so.2 /tools/lib/</userinput></screen>
<!-- For whatever reason the stubs-x32.h doesn't get created. The 'ln' above is
just a "brute force" workaraound - by copying the stubs-64.h file. -->
<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>
<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 -m32 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/lib/ld-linux.so.2]</computeroutput></screen>
<screen><computeroutput>[Requesting program interpreter: /lib/ld-linux.so.2]</computeroutput></screen>
<para>Redo test for x32-ABI:</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>
<screen><userinput>echo 'int main(){}' &gt; dummy.c
$LFS_TGT-gcc -mx32 dummy.c
readelf -l a.out | grep ': /tools'</userinput></screen>
<para>Output should be like:</para>
<screen><computeroutput>[Requesting program interpreter: /tools/libx32/ld-linux-x32.so.2]</computeroutput></screen>
<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>
</sect2>
</caution>
</sect2><!-- m32 -->
<!-- - - - - - - - - - -->
<!-- Multilib - x32bit -->
<!-- - - - - - - - - - -->
<sect2 arch="ml_x32,ml_all">
<title>Building Glibc - x32bit</title>
<para>Now recompile for mx32. The extracted source can be
reused but needs to cleaned before installing the mx32
version of Glibc.</para>
<para>Clear the build directory and remove artefacts from
previous build:</para>
<screen><userinput remap="pre">make clean
find .. -name "*.a" -delete</userinput></screen>
<para>Configure Glibc for mx32 with the following commands:</para>
<screen><userinput remap="configure">CC="$LFS_TGT-gcc -mx32" \
CXX="$LFS_TGT-g++ -mx32" \
../configure \
--prefix=/usr \
--host=$LFS_TGTX32 \
--build=$(../scripts/config.guess) \
--enable-kernel=&min-kernel; \
--with-headers=$LFS/usr/include \
--enable-multi-arch \
--libdir=&usr-lib-mx32; \
--libexecdir=&usr-lib-mx32; \
libc_cv_slibdir=&lib-mx32;</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
cp -a DESTDIR&lib-mx32;/* $LFS&lib-mx32;/
cp -a DESTDIR&usr-lib-mx32; $LFS/usr/
install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-x32.h \
$LFS/usr/include/gnu/
ln -svf ..&lib-mx32;/ld-linux-x32.so.2 $LFS/lib/ld-linux-x32.so.2</userinput></screen>
<caution>
<para>At this point, it is imperative to stop and ensure that the basic
functions (compiling and linking) of the new toolchain are working as
expected. To perform a sanity check, run the following commands:</para>
<screen><userinput>echo 'int main(){}' &gt; dummy.c
$LFS_TGT-gcc -mx32 dummy.c
readelf -l a.out | grep '/ld-linux-x32'</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: /lib/ld-linux-x32.so.2]</computeroutput></screen>
<para>If the output is not shown as above or there was no output at all,
then something is wrong. Investigate and retrace the steps to find out
where the problem is and correct it. This issue must be resolved before
continuing on.</para>
<para>Once all is well, clean up the test files:</para>
<screen><userinput>rm -v dummy.c a.out</userinput></screen>
</caution>
</sect2><!-- mx32 -->
<sect2 role="content">
<title/>

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,14 @@
<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.</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,21 @@ 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>
<varlistentry arch="ml_32,ml_x32,ml_all">
<term><parameter>--disable-multilib</parameter></term>
<listitem>
<para>Since gcc-pass1 is built without thread support, the C++
thread library cannot be built either.</para>
<para>Even when building the multilib version, this switch is
given. This is because the additionally built libraries are
not required in this stage and some disk space and compile
time can be saved.</para>
</listitem>
</varlistentry>
-->
<varlistentry>
<term><parameter>--disable-libstdcxx-pch</parameter></term>
<listitem>
@ -98,9 +101,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 +117,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,177 +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 arch="ml_32,ml_all" role="installation">
<title>Installation of Ncurses - 32 bit</title>
<para>Prepare Ncurses for compilation:</para>
<screen><userinput remap="configure">make distclean &amp;&amp;
CC="${LFS_TGT}-gcc -m32" \
./configure --prefix=/tools \
--libdir=/tools/lib32 \
--with-shared \
--without-debug \
--without-ada \
--enable-widec \
--enable-overwrite \
--host="${LFS_TGT32}"</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 DESTDIR=$PWD/DESTDIR_32 install &amp;&amp;
cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32</userinput></screen>
</sect2>
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Installation of Ncurses - x32 bit</title>
<para>Repeat for the x32-ABI:</para>
<screen><userinput remap="configure">make distclean &amp;&amp;
CC="${LFS_TGT}-gcc -mx32" \
./configure --prefix=/tools \
--libdir=/tools/libx32 \
--with-shared \
--without-debug \
--without-ada \
--enable-widec \
--enable-overwrite \
--host="${LFS_TGTX32}"</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_x32 install &amp;&amp;
cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32</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,57 +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 arch="default"><userinput>strip --strip-debug /tools/lib/*
/usr/bin/strip --strip-unneeded /tools/{,s}bin/*</userinput></screen>
<screen arch="ml_32"><userinput>strip --strip-debug /tools/lib{,32}/*
/usr/bin/strip --strip-unneeded /tools/{,s}bin/*</userinput></screen>
<screen arch="ml_x32"><userinput>strip --strip-debug /tools/lib{,x32}/*
/usr/bin/strip --strip-unneeded /tools/{,s}bin/*</userinput></screen>
<screen arch="ml_all"><userinput>strip --strip-debug /tools/lib{,{,x}32}/*
/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 arch="default"><userinput>find /tools/{lib,libexec} -name \*.la -delete</userinput></screen>
<screen arch="ml_32"><userinput>find /tools/{lib{,32},libexec} -name \*.la -delete</userinput></screen>
<screen arch="ml_x32"><userinput>find /tools/{lib{,x32},libexec} -name \*.la -delete</userinput></screen>
<screen arch="ml_all"><userinput>find /tools/{lib{,{,x}32},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

@ -1,166 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-toolchaintechnotes">
<?dbhtml filename="toolchaintechnotes.html"?>
<title>Toolchain Technical Notes</title>
<para>This section explains some of the rationale and technical details
behind the overall build method. It is not essential to immediately
understand everything in this section. Most of this information will be
clearer after performing an actual build. This section can be referred
to at any time during the process.</para>
<para>The overall goal of <xref linkend="chapter-temporary-tools"/> is to
produce a temporary area that contains a known-good set of tools that can be
isolated from the host system. By using <command>chroot</command>, the
commands in the remaining chapters will be contained within that environment,
ensuring a clean, trouble-free build of the target LFS system. The build
process has been designed to minimize the risks for new readers and to provide
the most educational value at the same time.</para>
<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>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>Some key technical points of how the <xref
linkend="chapter-temporary-tools"/> build method works:</para>
<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>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">/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>
<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... /tools/i686-lfs-linux-gnu/bin/as
checking what linker to use... /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:
<userinput>gcc -print-prog-name=ld</userinput>.</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, <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>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>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>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>
<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>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>
</sect1>

View File

@ -1,180 +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>
<sect2 arch="ml_32,ml_all" role="installation">
<title>Installation of Util-Linux - 32 bit</title>
<para>Prepare Util-Linux for compilation:</para>
<screen><userinput remap="configure">make distclean &amp;&amp;
CC="${LFS_TGT}-gcc -m32" \
./configure \
--prefix=/tools \
--libdir=/tools/lib32 \
--without-python \
--disable-makeinstall-chown \
--without-systemdsystemunitdir \
--without-ncurses \
--host="${LFS_TGT32}" \
PKG_CONFIG=""</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 DESTDIR=$PWD/DESTDIR_32 install &amp;&amp;
cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32</userinput></screen>
</sect2>
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Installation of Util-Linux - x32 bit</title>
<para>Repeat for the x32-ABI:</para>
<screen><userinput remap="configure">make distclean &amp;&amp;
CC="${LFS_TGT}-gcc -mx32" \
./configure \
--prefix=/tools \
--libdir=/tools/libx32 \
--without-python \
--disable-makeinstall-chown \
--without-systemdsystemunitdir \
--without-ncurses \
--host="${LFS_TGTX32}" \
PKG_CONFIG=""</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_x32 install &amp;&amp;
cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32</userinput></screen>
</sect2>
</sect1>

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-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 arch="ml_32,ml_all" role="installation">
<title>Installation of Xz - 32 bit</title>
<para>Prepare Xz for compilation:</para>
<screen><userinput remap="configure">make distclean &amp;&amp;
CC="${LFS_TGT}-gcc -m32" \
./configure \
--prefix=/tools \
--libdir=/tools/lib32 \
--host="${LFS_TGT32}"</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 DESTDIR=$PWD/DESTDIR_32 install &amp;&amp;
cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32</userinput></screen>
</sect2>
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Installation of Xz - x32 bit</title>
<para>Repeat for the x32-ABI:</para>
<screen><userinput remap="configure">make distclean &amp;&amp;
CC="${LFS_TGT}-gcc -mx32" \
./configure \
--prefix=/tools \
--libdir=/tools/libx32 \
--host="${LFS_TGTX32}"</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_x32 install &amp;&amp;
cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32</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

@ -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 arch="ml_32,ml_x32,ml_all" id="ch-tools-zlib" role="wrap">
<?dbhtml filename="zlib.html"?>
<sect1info condition="script">
<productname>zlib</productname>
<productnumber>&zlib-version;</productnumber>
<address>&zlib-url;</address>
</sect1info>
<title>Zlib-&zlib-version;</title>
<indexterm zone="ch-tools-zlib">
<primary sortas="a-Zlib">Zlib</primary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Zlib package contains compression and decompression routines used by
some programs.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&zlib-ch6-sbu;</seg>
<seg>&zlib-ch6-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Zlib</title>
<para>Prepare Zlib 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 arch="ml_32,ml_all" role="installation">
<title>Installation of Zlib - 32 bit</title>
<para>Prepare Zlib for compilation:</para>
<screen><userinput remap="configure">make distclean &amp;&amp;
CC="${LFS_TGT}-gcc -m32" ./configure --prefix=/tools --libdir=/tools/lib32</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 DESTDIR=$PWD/DESTDIR_32 install &amp;&amp;
cp -Rv DESTDIR_32/tools/lib32/* /tools/lib32</userinput></screen>
</sect2>
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Installation of Zlib - x32 bit</title>
<para>Repeat for the x32-ABI:</para>
<screen><userinput remap="configure">make distclean &amp;&amp;
CC="${LFS_TGT}-gcc -mx32" ./configure --prefix=/tools --libdir=/tools/libx32</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR_x32 install &amp;&amp;
cp -Rv DESTDIR_x32/tools/libx32/* /tools/libx32</userinput></screen>
</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>Make a link for the programs that use <command>sh</command> for
a shell:</para>
<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>
<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,118 @@
<?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 arch="default"><userinput remap="configure">../configure \
--prefix=/usr \
--build=$(../config.guess) \
--host=$LFS_TGT \
--disable-nls \
--enable-shared \
--disable-werror \
--enable-64-bit-bfd</userinput></screen>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../configure \
--prefix=/usr \
--build=$(../config.guess) \
--host=$LFS_TGT \
--disable-nls \
--enable-shared \
--disable-werror \
--enable-64-bit-bfd \
--enable-multilib</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>
<varlistentry arch="ml_32,ml_x32,ml_all">
<term><parameter>--enable-multilib</parameter></term>
<listitem>
<para>Enables multilib support in bintutils.</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,111 +5,30 @@
%general-entities;
]>
<chapter id="chapter-building-system" xreflabel="Chapter&nbsp;6">
<chapter id="chapter-temporary-tools" xreflabel="Chapter&nbsp;6">
<?dbhtml dir="chapter06"?>
<?dbhtml filename="chapter06.html"?>
<title>Installing Basic System Software</title>
<title>Cross Compiling Temporary Tools</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="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"/>
<!-- arch="ml_32,ml_x32,ml_all" only -->
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="glibc-32.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="isl.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="zlib.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="linux-firmware.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,401 +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>
<para arch="ml_32,ml_all">32-bit builds also require these links:</para>
<screen arch="ml_32,ml_all"><userinput>ln -sv /tools/lib32/libgcc_s.so{,.1} /usr/lib32
ln -sv /tools/lib32/libstdc++.{a,so{,.6}} /usr/lib32
for lib in blkid mount uuid fdisk
do
ln -sv /tools/lib32/lib$lib.so* /usr/lib32/
sed 's|/tools|/usr|' /tools/lib32/pkgconfig/${lib}.pc \
&gt; /usr/lib32/pkgconfig/${lib}.pc
done</userinput></screen>
<para arch="ml_x32,ml_all">x32-bit builds also require these links:</para>
<screen arch="ml_x32,ml_all"><userinput>ln -sv /tools/libx32/libgcc_s.so{,.1} /usr/libx32
ln -sv /tools/libx32/libstdc++.{a,so{,.6}} /usr/libx32
ln -sv /usr/libx32 /
for lib in blkid mount uuid fdisk
do
ln -sv /tools/libx32/lib$lib.so* /usr/libx32/
sed 's|/tools|/usr|' /tools/libx32/pkgconfig/${lib}.pc \
&gt; /usr/libx32/pkgconfig/${lib}.pc
done</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,120 +45,26 @@
<para>Prepare File for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr</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>
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI 32 ~~~~~~~~~~~~~~~~~~~~ -->
<sect2 arch="ml_32,ml_all" role="installation">
<title>Installation of File - 32-bit</title>
<para>Clean previous build:</para>
<screen><userinput remap="pre">make distclean</userinput></screen>
<para>Prepare File for compilation:</para>
<screen><userinput remap="configure">CC="gcc -m32" ./configure \
--prefix=/usr \
--libdir=/usr/lib32 \
--host=i686-pc-linux-gnu</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>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
cp -Rv DESTDIR/usr/lib32/* /usr/lib32
rm -rf DESTDIR</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
</sect2>
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI x32 ~~~~~~~~~~~~~~~~~~~~ -->
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Installation of File - x32-bit</title>
<para>Clean previous build:</para>
<screen><userinput remap="pre">make distclean</userinput></screen>
<para>Prepare File for compilation:</para>
<screen><userinput remap="configure">CC="gcc -mx32" ./configure \
--prefix=/usr \
--libdir=/usr/libx32 \
--host=x86_64-pc-linux-gnux32</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
cp -Rv DESTDIR/usr/libx32/* /usr/libx32
rm -rf DESTDIR</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 <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>

188
chapter06/gcc-pass2.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-gcc-pass2" role="wrap" xreflabel="gcc-pass2">
<?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>
<userinput remap="pre" arch="ml_32,ml_x32,ml_all">tar -xf ../isl-&isl-version;.tar.xz
mv -v isl-&isl-version; isl</userinput></screen>
<para arch="default">If building on x86_64, change the default directory name for 64-bit
libraries to <quote>lib</quote>:</para>
<screen arch="default"><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 arch="ml_32,ml_x32,ml_all">Change the default directory name for
libraries:</para>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
-e '/m32=/s/m32=.*/m32=..\&lib-m32;$(call if_multiarch,:i386-linux-gnu)/' \
-i.orig gcc/config/i386/t-linux64</userinput></screen>
<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 arch="default"><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>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure"
arch="ml_32">mlist=m64,m32</userinput><userinput remap="configure"
arch="ml_x32">mlist=m64,mx32</userinput><userinput remap="configure"
arch="ml_all">mlist=m64,m32,mx32</userinput>
<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 \
--enable-multilib --with-multilib-list=$mlist \
--disable-decimal-float \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++ \
--with-system-zlib</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

@ -1,184 +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 arch="ml_32,ml_x32,ml_all" id="ch-system-glibc-32" role="wrap">
<?dbhtml filename="glibc-32.html"?>
<sect1info condition="script">
<productname>glibc-32</productname>
<productnumber>&glibc-version;</productnumber>
<address>&glibc-url;</address>
</sect1info>
<title>Glibc-&glibc-version; - 32-bit</title>
<indexterm zone="ch-system-glibc-32">
<primary sortas="a-Glibc-32">Glibc-32</primary>
</indexterm>
<sect2 role="installation">
<title>Preparation to install of ML-Glibc</title>
<screen><userinput remap="pre">patch -Np1 -i ../&glibc-fhs-patch;</userinput></screen>
<!-- No longer needed
<para>Fix a problem introduced with the linux-5.2 kernel:</para>
<screen><userinput remap="pre">sed -i '/asm.socket.h/a# include &lt;linux/sockios.h&gt;' \
sysdeps/unix/sysv/linux/bits/socket.h</userinput></screen>
-->
<para>Temporarily move a file that would get overwritten by the 32-bit builds:</para>
<screen><userinput remap="pre">mv /usr/include/limits.h{,.backup} </userinput></screen>
</sect2>
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI 32 ~~~~~~~~~~~~~~~~~~~~ -->
<sect2 arch="ml_32,ml_all" role="installation">
<title>Installation of Glibc - 32-bit</title>
<para>The Glibc documentation recommends building Glibc
in a dedicated build directory:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Prepare Glibc for compilation:</para>
<screen><userinput remap="configure">CC="gcc -m32 -ffile-prefix-map=/tools=/usr" \
CXX="g++ -m32 -ffile-prefix-map=/tools=/usr" \
../configure --prefix=/usr \
--disable-werror \
--enable-kernel=&min-kernel; \
--enable-stack-protector=strong \
--with-headers=/usr/include \
--enable-multi-arch \
--libdir=/usr/lib32 \
--libexecdir=/usr/lib32 \
libc_cv_slibdir=/usr/lib32 \
i686-pc-linux-gnu</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
make install_root=$PWD/DESTDIR install
mv -v DESTDIR/usr/lib32/* /usr/lib32/
install -vm644 DESTDIR/usr/include/gnu/{lib-names,stubs}-32.h \
/usr/include/gnu/
ln -svf ../usr/lib32/ld-linux.so.2 /lib/ld-linux.so.2
ln -svf ../usr/lib32/ld-linux.so.2 /lib/ld-lsb.so.3
ln -svf ../lib/locale /usr/lib32/locale</userinput></screen>
<para>Configure the linker cache configuration:</para>
<screen><userinput>echo "/usr/lib32" > /etc/ld.so.conf.d/lib32.conf
ldconfig</userinput></screen>
<para>Do cleanup:</para>
<screen><userinput>cd ..
rm -rf build</userinput></screen>
</sect2>
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI x32 ~~~~~~~~~~~~~~~~~~~~ -->
<!--
In case the compilation ends with
...
if test -r /autolfs/sources/glibc-2.29/build/DESTDIR/usr/include/gnu/stubs-x32.h && cmp -s /autolfs/sources/glibc-2.29/build/stubs.h /autolfs/sources/glibc-2.29/build/DESTDIR/usr/include/gnu/stubs-x32.h; \
then echo 'stubs.h unchanged'; \
else /usr/bin/install -c -m 644 /autolfs/sources/glibc-2.29/build/stubs.h /autolfs/sources/glibc-2.29/build/DESTDIR/usr/include/gnu/stubs-x32.h; fi
rm -f /autolfs/sources/glibc-2.29/build/stubs.h
/autolfs/sources/glibc-2.29/build/elf/sln /autolfs/sources/glibc-2.29/build/elf/symlink.list
/autolfs/sources/glibc-2.29/build/elf/sln: /autolfs/sources/glibc-2.29/build/elf/sln: cannot execute binary file
make[1]: *** [Makefile:106: install-symbolic-link] Error 126
make[1]: Leaving directory '/autolfs/sources/glibc-2.29'
make: *** [Makefile:12: install] Error 2
it is a good sign that the actually running kernel isn't ML-enabled.
ArchLinux's kernels are configured like
CONFIG_IA32_EMULATION=y
# CONFIG_IA32_AOUT is not set
# CONFIG_X86_X32 is not set <<<<<
It isn't x32-enabled ==> Error when building x32 stuff
-->
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Glibc - x32-bit</title>
<para>The Glibc documentation recommends building Glibc
in a dedicated build directory:</para>
<screen><userinput remap="pre">mkdir -v build
cd build</userinput></screen>
<para>Prepare Glibc for compilation:</para>
<screen><userinput remap="configure">CC="gcc -mx32 -ffile-prefix-map=/tools=/usr" \
CXX="g++ -mx32 -ffile-prefix-map=/tools=/usr" \
../configure --prefix=/usr \
--disable-werror \
--enable-kernel=&min-kernel; \
--enable-stack-protector=strong \
--with-headers=/usr/include \
--enable-multi-arch \
--libdir=/usr/libx32 \
--libexecdir=/usr/libx32 \
libc_cv_slibdir=/usr/libx32 \
x86_64-pc-linux-gnux32</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">sed '/test-installation/s@$(PERL)@echo not running@' -i ../Makefile
make install_root=$PWD/DESTDIR install
mv -v DESTDIR/usr/libx32/* /usr/libx32/
install -vm644 DESTDIR/usr/include/gnu/lib-names-x32.h /usr/include/gnu/
[ -e DESTDIR/usr/include/gnu/stubs-x32.h ] \
&amp;&amp; install -vm644 DESTDIR/usr/include/gnu/stubs-x32.h /usr/include/gnu/ \
|| ln -v /usr/include/gnu/stubs-64.h /usr/include/gnu/stubs-x32.h
ln -svf ../usr/libx32/ld-linux-x32.so.2 /lib/ld-linux-x32.so.2
ln -svf ../lib/locale /usr/libx32/locale</userinput></screen>
<!-- For whatever reason the stubs-x32.h doesn't get created. The 'ln' above is
just a "brute force" workaraound by copying the stubs-64.h file. -->
<para>Configure the linker cache configuration:</para>
<screen><userinput>echo "/usr/libx32" > /etc/ld.so.conf.d/libx32.conf
ldconfig</userinput></screen>
<para>Do cleanup:</para>
<screen><userinput>cd ..
rm -rf build</userinput></screen>
</sect2>
<!-- ~~~~~~~~~~~~~~~~~~~~ Cleanup ~~~~~~~~~~~~~~~~~~~~ -->
<sect2 role="installation">
<title>Cleanup</title>
<para>Restore the file we moved temporarily away:</para>
<screen><userinput remap="pre">mv /usr/include/limits.h{.backup,} </userinput></screen>
</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,113 +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-isl" role="wrap">
<?dbhtml filename="isl.html"?>
<sect1info condition="script">
<productname>isl</productname>
<productnumber>&isl-version;</productnumber>
<address>&isl-url;</address>
</sect1info>
<title>ISL-&isl-version;</title>
<indexterm zone="ch-system-isl">
<primary sortas="a-ISL">ISL</primary>
</indexterm>
<sect2 role="package">
<title/>
<para>ISL is a thread-safe C library for manipulating sets and relations
of integer points bounded by affine constraints.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&isl-ch6-sbu;</seg>
<seg>&isl-ch6-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of ISL</title>
<para>Prepare ISL for compilation:</para>
<screen><userinput remap="configure">./configure --prefix=/usr \
--disable-static \
--docdir=/usr/share/doc/isl-&isl-version;</userinput></screen>
<variablelist>
<title>The meaning of the new configure options:</title>
<varlistentry>
<term><parameter>--docdir=/usr/share/doc/isl-&isl-version;</parameter></term>
<listitem>
<para>This variable specifies the correct place for the
documentation.</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package and its documentation:</para>
<screen><userinput remap="install">make install
install -vd /usr/share/doc/isl-&isl-version;
install -m644 doc/{CodingStyle,manual.pdf,SubmittingPatches,user.pod} \
/usr/share/doc/isl-&isl-version;</userinput></screen>
<para>Finally, move a misplaced file:</para>
<screen><userinput remap="install">mkdir -pv /usr/share/gdb/auto-load/usr/lib
mv -v /usr/lib/libisl*gdb.py /usr/share/gdb/auto-load/usr/lib</userinput></screen>
</sect2>
<sect2 id="contents-isl" role="content">
<title>Contents of ISL</title>
<segmentedlist>
<segtitle>Installed Libraries</segtitle>
<segtitle>Installed directory</segtitle>
<seglistitem>
<seg>libisl.so</seg>
<seg>/usr/share/doc/isl-&isl-version;</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="libisl">
<term><filename class="libraryfile">libisl</filename></term>
<listitem>
<para>Contains integer set manipulation functions</para>
<indexterm zone="ch-system-isl libisl">
<primary sortas="c-libisl">libisl</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>

View File

@ -1,64 +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;
]>
<!--
Linux Firmware
~~~~~~~~~~~~~~
Checkout the tree at
https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/
$ PKGNAME=linux-firmware-$(date +%Y%m%d)
$ mkdir -pv $PKGNAME
$ cd $PKGNAME
$ <<checkout git tree here>>
$ cd ..
$ tar -cJf ${PKGNAME}.tar.xz $PKGNAME
-->
<sect1 id="ch-system-linux-firmware" role="wrap">
<?dbhtml filename="linux-firmware.html"?>
<sect1info condition="script">
<productname>linux-firmware</productname>
<productnumber>&linux-firmware-version;</productnumber>
<address>&linux-firmware-url;</address>
</sect1info>
<title>Linux-Firmware-&linux-firmware-version;</title>
<indexterm zone="ch-system-linux-firmware">
<primary sortas="a-Linux-Firmware">Linux-Firmware</primary>
</indexterm>
<sect2 role="package">
<title/>
<para>The Linux-Firmware package contains propietary kernel "blobs"
required for some specific hardware.</para>
<segmentedlist>
<segtitle>&buildtime;</segtitle>
<segtitle>&diskspace;</segtitle>
<seglistitem>
<seg>&linux-firmware-ch6-sbu;</seg>
<seg>&linux-firmware-ch6-du;</seg>
</seglistitem>
</segmentedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Linux-Firmware</title>
<para>Install the Linux-Firmware package with the following commands:</para>
<screen><userinput remap="install">cp -Rv * /lib/firmware</userinput></screen>
</sect2>
</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,31 +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 arch="default"><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>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">./configure --prefix=/usr \
--mandir=/usr/share/man \
--with-shared \
--without-debug \
--without-normal \
--enable-pc-files \
--enable-widec \
--with-pkg-config-libdir=/usr/lib/pkgconfig</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>
@ -80,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>
@ -96,417 +113,111 @@
</listitem>
</varlistentry>
<varlistentry arch="ml_32,ml_x32,ml_all">
<term><parameter>--with-pkg-config-libdir=/usr/lib/pkgconfig</parameter></term>
<listitem>
<para>This switch forces .pc to be installed in /usr/lib/pkgconfig. If
not set, .pc files gets installed in /usr/lib32 even for 64bit binaries.
</para>
</listitem>
</varlistentry>
</variablelist>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>This package has a test suite, but it can only be run after the
package has been installed. The tests reside in the
<filename class="directory">test/</filename> directory. See the
<filename>README</filename> file in that directory for further details.
</para>
<para>Install the package:</para>
<screen><userinput remap="install">make install</userinput></screen>
<!-- TODO: check and document -->
<screen><userinput remap="install">make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install
ln -s libncursesw.so $LFS/usr/lib/libncurses.so</userinput></screen>
<para>Move the shared libraries to the
<filename class="directory">/lib</filename> directory, where they are
expected to reside:</para>
<screen><userinput remap="install">mv -v /usr/lib/libncursesw.so.6* /lib</userinput></screen>
<screen><userinput remap="install">mv -v $LFS/usr/lib/libncursesw.so.6* $LFS/lib</userinput></screen>
<para>Because the libraries have been moved, one symlink points to
a non-existent file. Recreate it:</para>
<screen><userinput remap="install">ln -sfv ../../lib/$(readlink /usr/lib/libncursesw.so) /usr/lib/libncursesw.so</userinput></screen>
<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><userinput remap="install">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>
<screen><userinput remap="install">ln -sfv ../../lib/$(readlink $LFS/usr/lib/libncursesw.so) $LFS/usr/lib/libncursesw.so</userinput></screen>
</sect2>
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI 32 ~~~~~~~~~~~~~~~~~~~~ -->
<sect2 arch="ml_32,ml_all" role="installation">
<title>Installation of Ncurses - 32-bit</title>
<!-- - - - - - - - - - -->
<!-- Multilib - 32bit -->
<!-- - - - - - - - - - -->
<sect2 arch="ml_32,ml_all">
<title>Building Ncurses - 32bit</title>
<para>Clean previous build:</para>
<screen><userinput remap="pre">make distclean</userinput></screen>
<para>Prepare Ncurses for compilation:</para>
<para>Prepare Ncurses for compilation:</para>
<screen><userinput remap="configure">CC="gcc -m32" CXX="g++ -m32" \
./configure --prefix=/usr \
--libdir=/usr/lib32 \
--mandir=/usr/share/man \
--with-shared \
--without-debug \
--without-normal \
--enable-pc-files \
--enable-widec \
--host=i686-pc-linux-gnu \
--with-pkg-config-libdir=/usr/lib32/pkgconfig</userinput></screen>
<screen><userinput remap="configure">CC="$LFS_TGT-gcc -m32" \
CXX="$LFS_TGT-g++ -m32" \
./configure --prefix=/usr \
--host=$LFS_TGT32 \
--libdir=&usr-lib-m32; \
--mandir=/usr/share/man \
--with-shared \
--without-debug \
--without-normal \
--enable-pc-files \
--enable-widec \
--with-pkg-config-libdir=&usr-lib-m32;/pkgconfig</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make -j1</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
for lib in ncurses form panel menu ; do
rm -vf DESTDIR/usr/lib32/lib${lib}.so
echo "INPUT(-l${lib}w)" > DESTDIR/usr/lib32/lib${lib}.so
ln -svf ${lib}w.pc DESTDIR/usr/lib32/pkgconfig/$lib.pc
done
rm -vf DESTDIR/usr/lib32/libcursesw.so
echo "INPUT(-lncursesw)" > DESTDIR/usr/lib32/libcursesw.so
ln -sfv libncurses.so DESTDIR/usr/lib32/libcurses.so
cp -Rv DESTDIR/usr/lib32/* /usr/lib32
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR TIC_PATH=$(pwd)/build/progs/tic install
ln -s libncursesw.so DESTDIR&usr-lib-m32;/libcursesw.so
cp -Rv DESTDIR&usr-lib-m32;/* $LFS&usr-lib-m32;
rm -rf DESTDIR</userinput></screen>
<para>If desired, make the version 5 libraries in 32bit as well:</para>
</sect2><!-- m32 -->
<screen><userinput remap="install">make distclean
CC="gcc -m32" CXX="g++ -m32" \
./configure --prefix=/usr \
--with-shared \
--without-normal \
--without-debug \
--without-cxx-binding \
--with-abi-version=5 \
--host=i686-pc-linux-gnu
make -j1 sources libs
cp -av lib/lib*.so.5* /usr/lib32</userinput></screen>
</sect2>
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI x32 ~~~~~~~~~~~~~~~~~~~~ -->
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Installation of Ncurses - x32-bit</title>
<!-- - - - - - - - - - -->
<!-- Multilib - x32bit -->
<!-- - - - - - - - - - -->
<sect2 arch="ml_x32,ml_all">
<title>Building Ncurses - x32bit</title>
<para>Clean previous build:</para>
<screen><userinput remap="pre">make distclean</userinput></screen>
<para>Prepare Ncurses for compilation:</para>
<para>Prepare Ncurses for compilation:</para>
<screen><userinput remap="configure">CC="gcc -mx32" CXX="g++ -mx32" \
./configure --prefix=/usr \
--libdir=/usr/libx32 \
--mandir=/usr/share/man \
--with-shared \
--without-debug \
--without-normal \
--enable-pc-files \
--enable-widec \
--host=x86_64-pc-linux-gnux32 \
--with-pkg-config-libdir=/usr/libx32/pkgconfig</userinput></screen>
<screen><userinput remap="configure">CC="$LFS_TGT-gcc -mx32" \
CXX="$LFS_TGT-g++ -mx32" \
./configure --prefix=/usr \
--host=$LFS_TGTX32 \
--libdir=&usr-lib-mx32; \
--mandir=/usr/share/man \
--with-shared \
--without-debug \
--without-normal \
--enable-pc-files \
--enable-widec \
--with-pkg-config-libdir=&usr-lib-mx32;/pkgconfig</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make -j1</userinput></screen>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
for lib in ncurses form panel menu ; do
rm -vf DESTDIR/usr/libx32/lib${lib}.so
echo "INPUT(-l${lib}w)" > DESTDIR/usr/libx32/lib${lib}.so
ln -svf ${lib}w.pc DESTDIR/usr/libx32/pkgconfig/$lib.pc
done
rm -vf DESTDIR/usr/libx32/libcursesw.so
echo "INPUT(-lncursesw)" > DESTDIR/usr/libx32/libcursesw.so
ln -sfv libncurses.so DESTDIR/usr/libx32/libcurses.so
cp -Rv DESTDIR/usr/libx32/* /usr/libx32
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR TIC_PATH=$(pwd)/build/progs/tic install
ln -s libncursesw.so DESTDIR&usr-lib-mx32;/libcursesw.so
cp -Rv DESTDIR&usr-lib-mx32;/* $LFS&usr-lib-mx32;
rm -rf DESTDIR</userinput></screen>
<!-- Any package out there which still needs version 5?
Leave it out for x32bit for now.
</sect2><!-- mx32 -->
<para>If desired, make the version 5 libraries in x32bit as well:</para>
<sect2 role="content">
<title/>
<screen><userinput remap="install">make distclean
CC="gcc -mx32" CXX="g++ -mx32" \
./configure - -prefix=/usr \
- -with-shared \
- -without-normal \
- -without-debug \
- -without-cxx-binding \
- -with-abi-version=5
make -j1 sources libs
cp -av lib/lib*.so.5* /usr/libx32</userinput></screen>
-->
</sect2>
<sect2 id="contents-ncurses" role="content">
<title>Contents of Ncurses</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,378 +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>
<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 and 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>
</sect2>
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI 32 ~~~~~~~~~~~~~~~~~~~~ -->
<sect2 arch="ml_32,ml_all" role="installation">
<title>Installation of Xz - 32-bit</title>
<para>Clean previous build:</para>
<screen><userinput remap="pre">make distclean</userinput></screen>
<para>Prepare Xz for compilation:</para>
<screen><userinput remap="configure">CC="gcc -m32" ./configure \
--prefix=/usr \
--disable-static \
--libdir=/usr/lib32 \
--host=i686-pc-linux-gnu</userinput></screen>
<para>Compile the package:</para>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
cp -Rv DESTDIR/usr/lib32/* /usr/lib32
rm -rf DESTDIR</userinput></screen>
<screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
<para>Make sure that all essential files are in the correct directory:</para>
<screen><userinput remap="install">mv -v $LFS/usr/bin/{lzma,unlzma,lzcat,xz,unxz,xzcat} $LFS/bin
mv -v $LFS/usr/lib/liblzma.so.* $LFS/lib
ln -svf ../../lib/$(readlink $LFS/usr/lib/liblzma.so) $LFS/usr/lib/liblzma.so</userinput></screen>
</sect2>
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI x32 ~~~~~~~~~~~~~~~~~~~~ -->
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Installation of Xz - x32-bit</title>
<para>Clean previous build:</para>
<screen><userinput remap="pre">make distclean</userinput></screen>
<para>Prepare Xz for compilation:</para>
<screen><userinput remap="configure">CC="gcc -mx32" ./configure \
--prefix=/usr \
--disable-static \
--libdir=/usr/libx32 \
--host=x86_64-pc-linux-gnux32</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
cp -Rv DESTDIR/usr/libx32/* /usr/libx32
rm -rf DESTDIR</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,46 @@
<?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 and files under <filename
class="directory">$LFS</filename> are kept as they are, they will be
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>
<para arch="ml_32,ml_x32,ml_all">Some more directories exists for
multilib support. Change their ownership, too:</para>
<screen arch="ml_32,ml_x32,ml_all"><userinput arch="ml_32,ml_all">chown -R root:root $LFS&lib-m32;</userinput>
<userinput arch="ml_x32,ml_all">chown -R root:root $LFS&lib-mx32;</userinput></screen>
</sect1>

View File

@ -5,39 +5,32 @@
%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 Temporary 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"/>
<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"/>
-->
<!-- 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="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,19 +32,19 @@
<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
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
<para>Notice that <filename class="directory">/tools/bin</filename> is not
in the <envar>PATH</envar>. This means that the cross toolchain will no longer be
used in the chroot environment. This occurs when the shell does not
<quote>remember</quote> the locations of executed binaries&mdash;for this
reason, hashing is switched off by passing the <parameter>+h</parameter> option
to <command>bash</command>.</para>
@ -55,8 +58,8 @@
chapter and the following chapters are run from within the chroot
environment. If you leave this environment for any reason (rebooting for
example), ensure that the virtual kernel filesystems are mounted as
explained in <xref linkend="ch-system-bindmount"/> and <xref
linkend="ch-system-kernfsmount"/> and enter chroot again before continuing
explained in <xref linkend="ch-tools-bindmount"/> and <xref
linkend="ch-tools-kernfsmount"/> and enter chroot again before continuing
with the installation.</para>
</note>

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,37 +5,30 @@
%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
ln -sv /run/lock /var/lock
mkdir -pv /var/{opt,cache,lib/{color,misc,locate},local}</userinput></screen>
<screen arch="ml_32,mlx32,ml_all"><userinput arch="ml_32,ml_all">mkdir -pv /usr/lib32
install -vdm755 /usr/lib32/pkgconfig</userinput>
<userinput arch="ml_x32,ml_all">mkdir -pv /usr/libx32
install -vdm755 /usr/libx32/pkgconfig</userinput></screen>
<para arch="ml_32,ml_x32,ml_all">Required directories for multilib
support has already been created while previous installation steps.</para>
<para>Directories are, by default, created with permission mode 755, but
this is not desirable for all directories. In the commands above, two

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>
@ -41,7 +42,7 @@ mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
</sect2>
<sect2 id="ch-system-bindmount">
<sect2 id="ch-tools-bindmount">
<title>Mounting and Populating /dev</title>
<para>The recommended method of populating the <filename
@ -63,7 +64,7 @@ mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
</sect2>
<sect2 id="ch-system-kernfsmount">
<sect2 id="ch-tools-kernfsmount">
<title>Mounting Virtual Kernel File Systems</title>
<para>Now mount the remaining virtual kernel filesystems:</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,136 @@
<?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 arch="default"><userinput remap="configure">../libstdc++-v3/configure \
CXXFLAGS="-g -O2 -D_GNU_SOURCE" \
--prefix=/usr \
--disable-multilib \
--disable-nls \
--disable-libstdcxx-pch</userinput></screen>
<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../libstdc++-v3/configure \
CXXFLAGS="-g -O2 -D_GNU_SOURCE" \
--prefix=/usr \
--enable-multilib \
--disable-nls \
--disable-libstdcxx-pch \
--host=x86_64-lfs-linux-gnu</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>
<varlistentry arch="ml_32,ml_x32,ml_all">
<term><parameter>--enable-multilib</parameter></term>
<listitem>
<para>This switch is set by default but it is added here
explicitly for documentary purpose. The libstdc++ libraries
will be built for every arch (m64, m32, mx32) which are
made available in <xref linkend="ch-tools-gcc-pass1"/>.</para>
</listitem>
</varlistentry>
<varlistentry arch="ml_32,ml_x32,ml_all">
<term><parameter>--host=x86_64-pc-linux-gnu</parameter></term>
<listitem>
<para>Since up to now, the cross-compile tools are used. This
switch is set to place headers used for multilib to locations
where the final system can pick them up correctly.</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,22 @@
</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>Compile 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>Install the package:</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

@ -18,14 +18,14 @@
<indexterm zone="ch-tools-Python">
<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>

191
chapter07/stripping.xml Normal file
View File

@ -0,0 +1,191 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../general.ent">
%general-entities;
]>
<sect1 id="ch-tools-stripping">
<?dbhtml filename="stripping.html"?>
<title>Cleaning up and Saving the Temporary System</title>
<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.
While still in chroot, remove those files now:</para>
<screen><userinput>find /usr/{lib,libexec} -name \*.la -delete</userinput></screen>
<note><para>
All the remaining steps in this section are optional. Nevertheless,
as soon as you begin installing packages in <xref
linkend="chapter-building-system"/>, the temporary tools will be
overwritten. So it may be a good idea to do a backup of the temporary
tools as described below. The other steps are only needed if you are
really short on disk space.
</para></note>
<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>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. Unfortunately, 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 <envar>$LFS</envar> 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

@ -18,14 +18,14 @@
<indexterm zone="ch-tools-texinfo">
<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>

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

@ -0,0 +1,192 @@
<?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>
<!-- - - - - - - - - - -->
<!-- Multilib - 32bit -->
<!-- - - - - - - - - - -->
<sect2 arch="ml_32,ml_all" role="installation">
<title>Installation of Util-linux - 32-bit</title>
<para>Clean previous build:</para>
<screen><userinput remap="pre">make distclean</userinput></screen>
<para>Prepare Util-linux for compilation:</para>
<screen><userinput remap="configure">CC="gcc -m32" \
./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 \
--libdir=&usr-lib-m32; \
--host=i686-pc-linux-gnu</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32;
rm -rf DESTDIR</userinput></screen>
</sect2><!-- m32 -->
<!-- - - - - - - - - - -->
<!-- Multilib - x32bit -->
<!-- - - - - - - - - - -->
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Installation of Util-linux - x32-bit</title>
<para>Clean previous build:</para>
<screen><userinput remap="pre">make distclean</userinput></screen>
<para>Prepare Util-linux for compilation:</para>
<screen><userinput remap="configure">CC="gcc -mx32" \
./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 \
--libdir=&usr-lib-mx32; \
--host=x86_64-pc-linux-gnux32</userinput></screen>
<para>Compile the package:</para>
<screen><userinput remap="make">make</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32;
rm -rf DESTDIR</userinput></screen>
</sect2><!-- mx32 -->
<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>
@ -79,20 +79,24 @@ ln -sfv ../../lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so</userinput><
</sect2>
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI 32 ~~~~~~~~~~~~~~~~~~~~ -->
<!-- - - - - - - - - - -->
<!-- Multilib - 32bit -->
<!-- - - - - - - - - - -->
<sect2 arch="ml_32,ml_all" role="installation">
<title>Installation of Acl - 32-bit</title>
<title>Installation of Acl - 32bit</title>
<para>Clean previous build:</para>
<screen><userinput remap="pre">make distclean</userinput></screen>
<para>Prepare Acl for compilation:</para>
<para>Prepare Xz for compilation:</para>
<screen><userinput remap="configure">CC="gcc -m32" ./configure \
--prefix=/usr --libdir=/usr/lib32 \
--disable-static --libexecdir=/usr/lib32 \
<screen><userinput remap="configure">CC="gcc -m32" ./configure \
--prefix=/usr \
--disable-static \
--libdir=&usr-lib-m32; \
--libexecdir=&usr-lib-m32; \
--host=i686-pc-linux-gnu</userinput></screen>
<para>Compile the package:</para>
@ -101,26 +105,30 @@ ln -sfv ../../lib/$(readlink /usr/lib/libacl.so) /usr/lib/libacl.so</userinput><
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$(pwd)/DESTDIR install
cp -Rv DESTDIR/usr/lib32/* /usr/lib32
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32;
rm -rf DESTDIR</userinput></screen>
</sect2>
</sect2><!-- m32 -->
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI x32 ~~~~~~~~~~~~~~~~~~~~ -->
<!-- - - - - - - - - - -->
<!-- Multilib - x32bit -->
<!-- - - - - - - - - - -->
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Installation of Acl - x32-bit</title>
<title>Installation of Acl - x32bit</title>
<para>Clean previous build:</para>
<screen><userinput remap="pre">make distclean</userinput></screen>
<para>Prepare Acl for compilation:</para>
<para>Prepare Xz for compilation:</para>
<screen><userinput remap="configure">CC="gcc -mx32" ./configure \
--prefix=/usr --libdir=/usr/libx32 \
--disable-static --libexecdir=/usr/libx32 \
<screen><userinput remap="configure">CC="gcc -mx32" ./configure \
--prefix=/usr \
--disable-static \
--libdir=&usr-lib-mx32; \
--libexecdir=&usr-lib-mx32; \
--host=x86_64-pc-linux-gnux32</userinput></screen>
<para>Compile the package:</para>
@ -129,11 +137,11 @@ rm -rf DESTDIR</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$(pwd)/DESTDIR install
cp -Rv DESTDIR/usr/libx32/* /usr/libx32
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32;
rm -rf DESTDIR</userinput></screen>
</sect2>
</sect2><!-- mx32 -->
<sect2 id="contents-acl" role="content">
<title>Contents of Acl</title>

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>
@ -78,21 +78,23 @@ ln -sfv ../../lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.so</userinput
</sect2>
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI 32 ~~~~~~~~~~~~~~~~~~~~ -->
<!-- - - - - - - - - - -->
<!-- Multilib - 32bit -->
<!-- - - - - - - - - - -->
<sect2 arch="ml_32,ml_all" role="installation">
<title>Installation of Attr - 32-bit</title>
<title>Installation of Attr - 32bit</title>
<para>Clean previous build:</para>
<screen><userinput remap="pre">make distclean</userinput></screen>
<para>Prepare Attr for compilation:</para>
<para>Prepare Xz for compilation:</para>
<screen><userinput remap="configure">CC="gcc -m32" ./configure \
--prefix=/usr \
--disable-static \
--libdir=/usr/lib32 \
--libdir=&usr-lib-m32; \
--host=i686-pc-linux-gnu</userinput></screen>
<para>Compile the package:</para>
@ -101,27 +103,29 @@ ln -sfv ../../lib/$(readlink /usr/lib/libattr.so) /usr/lib/libattr.so</userinput
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$(pwd)/DESTDIR install
cp -Rv DESTDIR/usr/lib32/* /usr/lib32
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
cp -Rv DESTDIR&usr-lib-m32;/* &usr-lib-m32;
rm -rf DESTDIR</userinput></screen>
</sect2>
</sect2><!-- m32 -->
<!-- ~~~~~~~~~~~~~~~~~~~~ ABI x32 ~~~~~~~~~~~~~~~~~~~~ -->
<!-- - - - - - - - - - -->
<!-- Multilib - x32bit -->
<!-- - - - - - - - - - -->
<sect2 arch="ml_x32,ml_all" role="installation">
<title>Installation of Attr - x32-bit</title>
<title>Installation of Attr - x32bit</title>
<para>Clean previous build:</para>
<screen><userinput remap="pre">make distclean</userinput></screen>
<para>Prepare Attr for compilation:</para>
<para>Prepare Xz for compilation:</para>
<screen><userinput remap="configure">CC="gcc -mx32" ./configure \
--prefix=/usr \
--disable-static \
--libdir=/usr/libx32 \
--libdir=&usr-lib-mx32; \
--host=x86_64-pc-linux-gnux32</userinput></screen>
<para>Compile the package:</para>
@ -130,11 +134,11 @@ rm -rf DESTDIR</userinput></screen>
<para>Install the package:</para>
<screen><userinput remap="install">make DESTDIR=$(pwd)/DESTDIR install
cp -Rv DESTDIR/usr/libx32/* /usr/libx32
<screen><userinput remap="install">make DESTDIR=$PWD/DESTDIR install
cp -Rv DESTDIR&usr-lib-mx32;/* &usr-lib-mx32;
rm -rf DESTDIR</userinput></screen>
</sect2>
</sect2><!-- mx32 -->
<sect2 id="contents-attr" role="content">
<title>Contents of Attr</title>

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>

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