2004-05-03 11:59:46 +01:00
|
|
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
|
|
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
|
|
|
%general-entities;
|
|
|
|
]>
|
|
|
|
<sect1 id="ch-system-chroot">
|
|
|
|
<title>Entering the chroot environment</title>
|
|
|
|
<?dbhtml filename="chroot.html"?>
|
|
|
|
|
|
|
|
<para>It is time to enter the chroot environment in order to begin building
|
|
|
|
and installing your final LFS system. Still as <emphasis>root</emphasis> run
|
|
|
|
the following command to enter the small world that is, at the moment,
|
|
|
|
populated with only the temporary tools:</para>
|
|
|
|
|
|
|
|
<screen><userinput>chroot "$LFS" /tools/bin/env -i \
|
|
|
|
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
|
|
|
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
|
|
|
|
/tools/bin/bash --login +h</userinput></screen>
|
|
|
|
|
2004-06-13 13:58:23 +01:00
|
|
|
<para>The <parameter>-i</parameter> option given to the
|
2004-05-03 11:59:46 +01:00
|
|
|
<command>env</command> command will clear all variables of the chroot
|
|
|
|
environment. After that, only the HOME, TERM, PS1 and PATH variables are
|
2004-06-13 13:58:23 +01:00
|
|
|
set again. The <parameter>TERM=$TERM</parameter> construct will set the TERM variable inside chroot
|
2004-05-03 11:59:46 +01:00
|
|
|
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 you need other variables present, such as CFLAGS or CXXFLAGS,
|
|
|
|
this is a good place to set them again.</para>
|
|
|
|
|
|
|
|
<para>From this point on there's no need to use the LFS variable anymore,
|
|
|
|
because everything you do will be restricted to the LFS file system -- since
|
|
|
|
what the shell thinks is <filename class="directory">/</filename> is actually
|
|
|
|
the value of <filename class="directory">$LFS</filename>, which was passed to
|
|
|
|
the chroot command.</para>
|
|
|
|
|
|
|
|
<para>Notice that <filename class="directory">/tools/bin</filename> comes
|
|
|
|
last in the PATH. This means that a temporary tool will not be used any more
|
|
|
|
as soon as its final version is installed. Well, at least when the shell
|
|
|
|
doesn't remember the locations of executed binaries -- for this reason hashing
|
2004-06-13 13:58:23 +01:00
|
|
|
is switched off by passing the <parameter>+h</parameter> option to
|
2004-05-03 11:59:46 +01:00
|
|
|
<command>bash</command>.</para>
|
|
|
|
|
|
|
|
<para>You have to make sure all the commands in the rest of this chapter and
|
|
|
|
in the following chapters are run from within the chroot environment.
|
|
|
|
If you ever leave this environment for any reason (rebooting for example),
|
2004-06-13 13:58:23 +01:00
|
|
|
you must remember to first mount the <systemitem class="filesystem">proc</systemitem>
|
|
|
|
and <systemitem class="filesystem">devpts</systemitem> file systems (discussed
|
2004-05-03 11:59:46 +01:00
|
|
|
in the previous section) <emphasis>and</emphasis> enter chroot again before
|
|
|
|
continuing with the installations.</para>
|
|
|
|
|
2004-06-13 13:58:23 +01:00
|
|
|
<para>Note that the <command>bash</command> prompt will say
|
|
|
|
<computeroutput>I have no name!</computeroutput> This is
|
2004-05-03 11:59:46 +01:00
|
|
|
normal, as the <filename>/etc/passwd</filename> file has not been created yet.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
</sect1>
|