mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-06-19 03:39:20 +01:00
Indented chapter 04.
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@7275 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
b0ed1af225
commit
6a3b6af435
@ -1,12 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
||||||
<!ENTITY % general-entities SYSTEM "../general.ent">
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
||||||
%general-entities;
|
%general-entities;
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<sect1 id="prepare-aboutlfs">
|
<sect1 id="prepare-aboutlfs">
|
||||||
<title>About $LFS</title>
|
|
||||||
<?dbhtml filename="aboutlfs.html"?>
|
<?dbhtml filename="aboutlfs.html"?>
|
||||||
|
|
||||||
|
<title>About $LFS</title>
|
||||||
|
|
||||||
<para>Throughout this book, the environment variable <envar>LFS</envar> will
|
<para>Throughout this book, the environment variable <envar>LFS</envar> will
|
||||||
be used several times. It is paramount that this variable is always defined.
|
be used several times. It is paramount that this variable is always defined.
|
||||||
It should be set to the mount point chosen for the LFS partition.
|
It should be set to the mount point chosen for the LFS partition.
|
||||||
@ -29,7 +32,8 @@ processes the command line.</para>
|
|||||||
|
|
||||||
<para>Do not forget to check that <envar>$LFS</envar> is set whenever
|
<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
|
you leave and reenter the current working environment (as when doing a
|
||||||
<quote>su</quote> to <emphasis>root</emphasis> or another user).</para>
|
<command>su</command> to <systemitem class="username">root</systemitem>
|
||||||
|
or another user).</para>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
||||||
<!ENTITY % general-entities SYSTEM "../general.ent">
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
||||||
%general-entities;
|
%general-entities;
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<sect1 id="prepare-aboutsbus">
|
<sect1 id="prepare-aboutsbus">
|
||||||
<title>About SBUs</title>
|
|
||||||
<?dbhtml filename="aboutsbus.html"?>
|
<?dbhtml filename="aboutsbus.html"?>
|
||||||
|
|
||||||
|
<title>About SBUs</title>
|
||||||
|
|
||||||
<para>Many people would like to know beforehand approximately how long
|
<para>Many people would like to know beforehand approximately how long
|
||||||
it takes to compile and install each package. Because Linux From
|
it takes to compile and install each package. Because Linux From
|
||||||
Scratch can be built on many different systems, it is impossible to
|
Scratch can be built on many different systems, it is impossible to
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
||||||
<!ENTITY % general-entities SYSTEM "../general.ent">
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
||||||
%general-entities;
|
%general-entities;
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<sect1 id="prepare-abouttestsuites">
|
<sect1 id="prepare-abouttestsuites">
|
||||||
<title>About the Test Suites</title>
|
|
||||||
<?dbhtml filename="abouttestsuites.html"?>
|
<?dbhtml filename="abouttestsuites.html"?>
|
||||||
|
|
||||||
|
<title>About the Test Suites</title>
|
||||||
|
|
||||||
<para>Most packages provide a test suite. Running the test suite for a
|
<para>Most packages provide a test suite. Running the test suite for a
|
||||||
newly built package is a good idea because it can provide a <quote>sanity
|
newly built package is a good idea because it can provide a <quote>sanity
|
||||||
check</quote> indicating that everything compiled correctly. A test suite
|
check</quote> indicating that everything compiled correctly. A test suite
|
||||||
@ -21,17 +24,17 @@ properly functioning system. The test suites for GCC and Glibc can
|
|||||||
take a very long time to complete, especially on slower hardware, but
|
take a very long time to complete, especially on slower hardware, but
|
||||||
are strongly recommended.</para>
|
are strongly recommended.</para>
|
||||||
|
|
||||||
<note><para>Experience has shown that there is little to be gained
|
<note>
|
||||||
from running the test suites in <xref
|
<para>Experience has shown that there is little to be gained from running
|
||||||
linkend="chapter-temporary-tools"/>. There can be no escaping the fact
|
the test suites in <xref linkend="chapter-temporary-tools"/>. There can be
|
||||||
that the host system always exerts some influence on the tests in that
|
no escaping the fact that the host system always exerts some influence on
|
||||||
chapter, often causing inexplicable failures. Because the tools built
|
the tests in that chapter, often causing inexplicable failures. Because
|
||||||
in <xref linkend="chapter-temporary-tools"/> are temporary and
|
the tools built in <xref linkend="chapter-temporary-tools"/> are temporary
|
||||||
eventually discarded, we do not recommend running the test suites in
|
and eventually discarded, we do not recommend running the test suites in
|
||||||
<xref linkend="chapter-temporary-tools"/> for the average reader. The
|
<xref linkend="chapter-temporary-tools"/> for the average reader. The
|
||||||
instructions for running those test suites are provided for the
|
instructions for running those test suites are provided for the benefit of
|
||||||
benefit of testers and developers, but they are strictly
|
testers and developers, but they are strictly optional.</para>
|
||||||
optional.</para></note>
|
</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
|
is running out of pseudo terminals (PTYs). This can result in a high
|
||||||
@ -47,4 +50,3 @@ at <ulink url="&test-results;"/> to verify whether or not these failures are
|
|||||||
expected. This site is valid for all tests throughout this book.</para>
|
expected. This site is valid for all tests throughout this book.</para>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@ -1,85 +1,98 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
||||||
<!ENTITY % general-entities SYSTEM "../general.ent">
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
||||||
%general-entities;
|
%general-entities;
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<sect1 id="ch-tools-addinguser">
|
<sect1 id="ch-tools-addinguser">
|
||||||
<title>Adding the LFS User</title>
|
|
||||||
<?dbhtml filename="addinguser.html"?>
|
<?dbhtml filename="addinguser.html"?>
|
||||||
|
|
||||||
<para>When logged in as user <emphasis>root</emphasis>, making a single mistake
|
<title>Adding the LFS User</title>
|
||||||
can damage or destroy a system. Therefore, we recommend building the packages in
|
|
||||||
this chapter as an unprivileged user. You could use your own user name, but to
|
<para>When logged in as user <systemitem class="username">root</systemitem>,
|
||||||
make it easier to set up a clean working environment, create a new user called
|
making a single mistake can damage or destroy a system. Therefore, we
|
||||||
<emphasis>lfs</emphasis> as a member of a new group (also named
|
recommend building the packages in this chapter as an unprivileged user.
|
||||||
<emphasis>lfs</emphasis>) and use this user during the installation process. As
|
You could use your own user name, but to make it easier to set up a clean
|
||||||
<emphasis>root</emphasis>, issue the following commands to add the new
|
working environment, create a new user called <systemitem
|
||||||
user:</para>
|
class="username">lfs</systemitem> as a member of a new group (also named
|
||||||
|
<systemitem class="groupname">lfs</systemitem>) and use this user during
|
||||||
|
the installation process. As <systemitem class="username">root</systemitem>,
|
||||||
|
issue the following commands to add the new user:</para>
|
||||||
|
|
||||||
<screen><userinput>groupadd lfs
|
<screen><userinput>groupadd lfs
|
||||||
useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen>
|
useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen>
|
||||||
|
|
||||||
<para>The meaning of the command line options:</para>
|
|
||||||
|
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
<title>The meaning of the command line options:</title>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><parameter>-s /bin/bash</parameter></term>
|
<term><parameter>-s /bin/bash</parameter></term>
|
||||||
<listitem><para>This makes
|
<listitem>
|
||||||
<command>bash</command> the default shell for user
|
<para>This makes <command>bash</command> the default shell for user
|
||||||
<emphasis>lfs</emphasis>.</para></listitem>
|
<systemitem class="username">lfs</systemitem>.</para>
|
||||||
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><parameter>-g lfs</parameter></term>
|
<term><parameter>-g lfs</parameter></term>
|
||||||
<listitem><para>This option adds user <emphasis>lfs</emphasis> to group
|
<listitem>
|
||||||
<emphasis>lfs</emphasis>.</para></listitem>
|
<para>This option adds user <systemitem class="username">lfs</systemitem>
|
||||||
|
to group <systemitem class="groupname">lfs</systemitem>.</para>
|
||||||
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><parameter>-m</parameter></term>
|
<term><parameter>-m</parameter></term>
|
||||||
<listitem><para>This creates a home
|
<listitem>
|
||||||
directory for <emphasis>lfs</emphasis>.</para></listitem>
|
<para>This creates a home directory for <systemitem
|
||||||
|
class="username">lfs</systemitem>.</para>
|
||||||
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><parameter>-k /dev/null</parameter></term>
|
<term><parameter>-k /dev/null</parameter></term>
|
||||||
<listitem><para>This parameter
|
<listitem>
|
||||||
prevents possible copying of files from a skeleton directory (default
|
<para>This parameter prevents possible copying of files from a skeleton
|
||||||
is <filename class="directory">/etc/skel</filename>) by changing the input location to
|
directory (default is <filename class="directory">/etc/skel</filename>)
|
||||||
the special null device.</para></listitem>
|
by changing the input location to the special null device.</para>
|
||||||
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><parameter>lfs</parameter></term>
|
<term><parameter>lfs</parameter></term>
|
||||||
<listitem><para>This is the actual name for the created group and
|
<listitem>
|
||||||
user.</para></listitem>
|
<para>This is the actual name for the created group and user.</para>
|
||||||
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
<para>To log in as <emphasis>lfs</emphasis> (as opposed to switching
|
<para>To log in as <systemitem class="username">lfs</systemitem> (as opposed
|
||||||
to user <emphasis>lfs</emphasis> when
|
to switching to user <systemitem class="username">lfs</systemitem> when logged
|
||||||
logged in as <emphasis>root</emphasis>, which does not require the
|
in as <systemitem class="username">root</systemitem>, which does not require
|
||||||
<emphasis>lfs</emphasis> user to have a
|
the <systemitem class="username">lfs</systemitem> user to have a password),
|
||||||
password), give <emphasis>lfs</emphasis> a password:</para>
|
give <systemitem class="username">lfs</systemitem> a password:</para>
|
||||||
|
|
||||||
<screen role="nodump"><userinput>passwd lfs</userinput></screen>
|
<screen role="nodump"><userinput>passwd lfs</userinput></screen>
|
||||||
|
|
||||||
<para>Grant <emphasis>lfs</emphasis> full access to
|
<para>Grant <systemitem class="username">lfs</systemitem> full access to
|
||||||
<filename class="directory">$LFS/tools</filename> by making
|
<filename class="directory">$LFS/tools</filename> by making
|
||||||
<emphasis>lfs</emphasis> the directory owner:</para>
|
<systemitem class="username">lfs</systemitem> the directory owner:</para>
|
||||||
|
|
||||||
<screen><userinput>chown -v lfs $LFS/tools</userinput></screen>
|
<screen><userinput>chown -v lfs $LFS/tools</userinput></screen>
|
||||||
|
|
||||||
<para>If a separate working directory was created as suggested, give
|
<para>If a separate working directory was created as suggested, give
|
||||||
user <emphasis>lfs</emphasis> ownership of this directory:</para>
|
user <systemitem class="username">lfs</systemitem> ownership of this
|
||||||
|
directory:</para>
|
||||||
|
|
||||||
<screen><userinput>chown -v lfs $LFS/sources</userinput></screen>
|
<screen><userinput>chown -v lfs $LFS/sources</userinput></screen>
|
||||||
|
|
||||||
<para>Next, login as user <emphasis>lfs</emphasis>. This can be done
|
<para>Next, login as user <systemitem class="username">lfs</systemitem>.
|
||||||
via a virtual console, through a display manager, or with the
|
This can be done via a virtual console, through a display manager, or with
|
||||||
following substitute user command:</para>
|
the following substitute user command:</para>
|
||||||
|
|
||||||
<screen><userinput>su - lfs</userinput></screen>
|
<screen role="nodump"><userinput>su - lfs</userinput></screen>
|
||||||
|
|
||||||
<para>The <quote><parameter>-</parameter></quote> instructs
|
<para>The <quote><parameter>-</parameter></quote> instructs
|
||||||
<command>su</command> to start a login shell as opposed to a non-login shell.
|
<command>su</command> to start a login shell as opposed to a non-login shell.
|
||||||
@ -87,4 +100,3 @@ The difference between these two types of shells can be found in detail in
|
|||||||
<filename>bash(1)</filename> and <command>info bash</command>.</para>
|
<filename>bash(1)</filename> and <command>info bash</command>.</para>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
||||||
<!ENTITY % general-entities SYSTEM "../general.ent">
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
||||||
%general-entities;
|
%general-entities;
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<chapter id="chapter-final-preps" xreflabel="Chapter 4">
|
<chapter id="chapter-final-preps" xreflabel="Chapter 4">
|
||||||
<?dbhtml dir="chapter04"?>
|
<?dbhtml dir="chapter04"?>
|
||||||
<title>Final Preparations</title>
|
|
||||||
<?dbhtml filename="chapter04.html"?>
|
<?dbhtml filename="chapter04.html"?>
|
||||||
|
|
||||||
|
<title>Final Preparations</title>
|
||||||
|
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="aboutlfs.xml"/>
|
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="aboutlfs.xml"/>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="creatingtoolsdir.xml"/>
|
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="creatingtoolsdir.xml"/>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="addinguser.xml"/>
|
<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="addinguser.xml"/>
|
||||||
|
@ -1,46 +1,48 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
||||||
<!ENTITY % general-entities SYSTEM "../general.ent">
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
||||||
%general-entities;
|
%general-entities;
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<sect1 id="ch-tools-creatingtoolsdir">
|
<sect1 id="ch-tools-creatingtoolsdir">
|
||||||
<title>Creating the $LFS/tools Directory</title>
|
|
||||||
<?dbhtml filename="creatingtoolsdir.html"?>
|
<?dbhtml filename="creatingtoolsdir.html"?>
|
||||||
|
|
||||||
<para>All programs compiled in <xref
|
<title>Creating the $LFS/tools Directory</title>
|
||||||
linkend="chapter-temporary-tools"/> will be installed under <filename
|
|
||||||
class="directory">$LFS/tools</filename> to keep them separate from the
|
<para>All programs compiled in <xref linkend="chapter-temporary-tools"/>
|
||||||
programs compiled in <xref linkend="chapter-building-system"/>. The
|
will be installed under <filename class="directory">$LFS/tools</filename>
|
||||||
programs compiled here are temporary tools and will not be a part of
|
to keep them separate from the programs compiled in <xref
|
||||||
the final LFS system. By keeping these programs in a separate
|
linkend="chapter-building-system"/>. The programs compiled here are
|
||||||
directory, they can easily be discarded later after their use. This
|
temporary tools and will not be a part of the final LFS system. By keeping
|
||||||
also prevents these programs from ending up in the host production
|
these programs in a separate directory, they can easily be discarded later
|
||||||
directories (easy to do by accident in <xref
|
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>
|
linkend="chapter-temporary-tools"/>).</para>
|
||||||
|
|
||||||
<para>Create the required directory by running the following as
|
<para>Create the required directory by running the following as
|
||||||
<emphasis>root</emphasis>:</para>
|
<systemitem class="username">root</systemitem>:</para>
|
||||||
|
|
||||||
<screen><userinput>mkdir -v $LFS/tools</userinput></screen>
|
<screen><userinput>mkdir -v $LFS/tools</userinput></screen>
|
||||||
|
|
||||||
<para>The next step is to create a <filename class="symlink">/tools</filename>
|
<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
|
symlink on the host system. This will point to the newly-created directory on
|
||||||
the LFS partition. Run this command as <emphasis>root</emphasis> as
|
the LFS partition. Run this command as <systemitem
|
||||||
well:</para>
|
class="username">root</systemitem> as well:</para>
|
||||||
|
|
||||||
<screen><userinput>ln -sv $LFS/tools /</userinput></screen>
|
<screen><userinput>ln -sv $LFS/tools /</userinput></screen>
|
||||||
|
|
||||||
<note><para>The above command is correct. The <command>ln</command> command has
|
<note>
|
||||||
a few syntactic variations, so be sure to check <command>info coreutils ln</command> and
|
<para>The above command is correct. The <command>ln</command> command
|
||||||
<filename>ln(1)</filename> before reporting what you may think is an
|
has a few syntactic variations, so be sure to check
|
||||||
error.</para></note>
|
<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
|
<para>The created symlink enables the toolchain to be compiled so that it
|
||||||
it always refers to <filename class="directory">/tools</filename>,
|
always refers to <filename class="directory">/tools</filename>, meaning
|
||||||
meaning that the compiler, assembler, and linker will work both in
|
that the compiler, assembler, and linker will work both in this chapter
|
||||||
this chapter (when we are still using some tools from the host) and in
|
(when we are still using some tools from the host) and in the next (when
|
||||||
the next (when we are <quote>chrooted</quote> to the LFS
|
we are <quote>chrooted</quote> to the LFS partition).</para>
|
||||||
partition).</para>
|
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@ -1,34 +1,35 @@
|
|||||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
||||||
|
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
||||||
<!ENTITY % general-entities SYSTEM "../general.ent">
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
||||||
%general-entities;
|
%general-entities;
|
||||||
]>
|
]>
|
||||||
|
|
||||||
<sect1 id="ch-tools-settingenviron">
|
<sect1 id="ch-tools-settingenviron">
|
||||||
<title>Setting Up the Environment</title>
|
|
||||||
<?dbhtml filename="settingenvironment.html"?>
|
<?dbhtml filename="settingenvironment.html"?>
|
||||||
|
|
||||||
<para>Set up a good working environment by creating two new startup
|
<title>Setting Up the Environment</title>
|
||||||
files for the <command>bash</command> shell. While logged in as user
|
|
||||||
<emphasis>lfs</emphasis>, issue the
|
<para>Set up a good working environment by creating two new startup files
|
||||||
following command to create a new <filename>.bash_profile</filename>:</para>
|
for the <command>bash</command> shell. While logged in as user
|
||||||
|
<systemitem class="username">lfs</systemitem>, issue the following command
|
||||||
|
to create a new <filename>.bash_profile</filename>:</para>
|
||||||
|
|
||||||
<screen><userinput>cat > ~/.bash_profile << "EOF"
|
<screen><userinput>cat > ~/.bash_profile << "EOF"
|
||||||
<literal>exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash</literal>
|
<literal>exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash</literal>
|
||||||
EOF</userinput></screen>
|
EOF</userinput></screen>
|
||||||
|
|
||||||
<para>When logged on as user <emphasis>lfs</emphasis>, the
|
<para>When logged on as user <systemitem class="username">lfs</systemitem>,
|
||||||
initial shell is usually a <emphasis>login</emphasis> shell which reads the
|
the initial shell is usually a <emphasis>login</emphasis> shell which reads
|
||||||
<filename>/etc/profile</filename> of the host (probably containing
|
the <filename>/etc/profile</filename> of the host (probably containing some
|
||||||
some settings and environment variables) and then
|
settings and environment variables) and then <filename>.bash_profile</filename>.
|
||||||
<filename>.bash_profile</filename>. The <command>exec env
|
The <command>exec env -i.../bin/bash</command> command in the
|
||||||
-i.../bin/bash</command> command in the
|
<filename>.bash_profile</filename> file replaces the running shell with a new
|
||||||
<filename>.bash_profile</filename> file replaces the running shell
|
one with a completely empty environment, except for the <envar>HOME</envar>,
|
||||||
with a new one with a completely empty environment, except for the
|
<envar>TERM</envar>, and <envar>PS1</envar> variables. This ensures that no
|
||||||
<envar>HOME</envar>, <envar>TERM</envar>, and
|
unwanted and potentially hazardous environment variables from the host system
|
||||||
<envar>PS1</envar> variables. This ensures that no unwanted and
|
leak into the build environment. The technique used here achieves the goal of
|
||||||
potentially hazardous environment variables from the host system leak
|
ensuring a clean environment.</para>
|
||||||
into the build environment. The technique used here achieves the goal
|
|
||||||
of ensuring a clean environment.</para>
|
|
||||||
|
|
||||||
<para>The new instance of the shell is a <emphasis>non-login</emphasis>
|
<para>The new instance of the shell is a <emphasis>non-login</emphasis>
|
||||||
shell, which does not read the <filename>/etc/profile</filename> or
|
shell, which does not read the <filename>/etc/profile</filename> or
|
||||||
@ -48,32 +49,31 @@ EOF</userinput></screen>
|
|||||||
<para>The <command>set +h</command> command turns off
|
<para>The <command>set +h</command> command turns off
|
||||||
<command>bash</command>'s hash function. Hashing is ordinarily a useful
|
<command>bash</command>'s hash function. Hashing is ordinarily a useful
|
||||||
feature—<command>bash</command> uses a hash table to remember the
|
feature—<command>bash</command> uses a hash table to remember the
|
||||||
full path of executable files to avoid searching the <envar>PATH</envar> time
|
full path of executable files to avoid searching the <envar>PATH</envar>
|
||||||
and again to find the same executable. However, the new tools
|
time and again to find the same executable. However, the new tools should
|
||||||
should be used as soon as they are installed. By switching off the
|
be used as soon as they are installed. By switching off the hash function,
|
||||||
hash function, the shell will always search the <envar>PATH</envar> when a program is
|
the shell will always search the <envar>PATH</envar> when a program is to
|
||||||
to be run. As such, the shell will find the newly compiled
|
be run. As such, the shell will find the newly compiled tools in
|
||||||
tools in <filename class="directory">$LFS/tools</filename> as soon as
|
<filename class="directory">$LFS/tools</filename> as soon as they are
|
||||||
they are available without remembering a previous version of the same
|
available without remembering a previous version of the same program in a
|
||||||
program in a different location.</para>
|
different location.</para>
|
||||||
|
|
||||||
<para>Setting the user file-creation mask (umask) to 022 ensures that newly
|
<para>Setting the user file-creation mask (umask) to 022 ensures that newly
|
||||||
created files and directories are only writable by their owner, but
|
created files and directories are only writable by their owner, but are
|
||||||
are readable and executable by anyone (assuming default modes are used
|
readable and executable by anyone (assuming default modes are used by the
|
||||||
by the open(2) system call, new files will end up with permission mode
|
<function>open(2)</function> system call, new files will end up with permission
|
||||||
644 and directories with mode 755).</para>
|
mode 644 and directories with mode 755).</para>
|
||||||
|
|
||||||
<para>The <envar>LFS</envar> variable should be set to the
|
<para>The <envar>LFS</envar> variable should be set to the chosen mount
|
||||||
chosen mount point.</para>
|
point.</para>
|
||||||
|
|
||||||
<para>The <envar>LC_ALL</envar> variable controls the
|
<para>The <envar>LC_ALL</envar> variable controls the localization of certain
|
||||||
localization of certain programs, making their messages follow the
|
programs, making their messages follow the conventions of a specified country.
|
||||||
conventions of a specified country. If the host system uses a version
|
If the host system uses a version of Glibc older than 2.2.4, having
|
||||||
of Glibc older than 2.2.4, having <envar>LC_ALL</envar> set to something other than
|
<envar>LC_ALL</envar> set to something other than <quote>POSIX</quote> or
|
||||||
<quote>POSIX</quote> or <quote>C</quote> (during this chapter) may
|
<quote>C</quote> (during this chapter) may cause issues if you exit the chroot
|
||||||
cause issues if you exit the chroot environment and wish to return
|
environment and wish to return later. Setting <envar>LC_ALL</envar> to
|
||||||
later. Setting <envar>LC_ALL</envar> to <quote>POSIX</quote>
|
<quote>POSIX</quote> or <quote>C</quote> (the two are equivalent) ensures that
|
||||||
or <quote>C</quote> (the two are equivalent) ensures that
|
|
||||||
everything will work as expected in the chroot environment.</para>
|
everything will work as expected in the chroot environment.</para>
|
||||||
|
|
||||||
<para>By putting <filename class="directory">/tools/bin</filename> ahead of the
|
<para>By putting <filename class="directory">/tools/bin</filename> ahead of the
|
||||||
@ -89,4 +89,3 @@ temporary tools, source the just-created user profile:</para>
|
|||||||
<screen><userinput>source ~/.bash_profile</userinput></screen>
|
<screen><userinput>source ~/.bash_profile</userinput></screen>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user