mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-06-24 06:09:21 +01:00
Update initial Chapter 7 pages for cross2 branch
git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross2@11918 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
bc8cca581f
commit
387a32af4b
@ -28,10 +28,7 @@
|
|||||||
the files under <filename class="directory">$LFS</filename>, thus exposing
|
the files under <filename class="directory">$LFS</filename>, thus exposing
|
||||||
these files to possible malicious manipulation.</para>
|
these files to possible malicious manipulation.</para>
|
||||||
|
|
||||||
<para>To avoid this issue, you could add the <systemitem
|
<para>To address this issue, change the
|
||||||
class="username">lfs</systemitem> user to the new LFS system later when
|
|
||||||
creating the <filename>/etc/passwd</filename> file, taking care to assign it
|
|
||||||
the same user and group IDs as on the host system. Better yet, change the
|
|
||||||
ownership of the <filename class="directory">$LFS/*</filename> directories to
|
ownership of the <filename class="directory">$LFS/*</filename> directories to
|
||||||
user <systemitem class="username">root</systemitem> by running the following
|
user <systemitem class="username">root</systemitem> by running the following
|
||||||
command:</para>
|
command:</para>
|
||||||
|
@ -10,14 +10,15 @@
|
|||||||
|
|
||||||
<title>Entering the Chroot Environment</title>
|
<title>Entering the Chroot Environment</title>
|
||||||
|
|
||||||
<para>Now that all the packages which depend on themselves for being built
|
<para>Now that all the packages which are required to build the rest of the
|
||||||
are on the system, it is time to enter the chroot environment to finish
|
needed tools are on the system, it is time to enter the chroot environment to
|
||||||
installing the remaining temporary tools. This environment will be in use
|
finish installing the remaining temporary tools. This environment will be in
|
||||||
also for installing the final system. As user <systemitem
|
use also for installing the final system. As user <systemitem
|
||||||
class="username">root</systemitem>, run the following command to enter the
|
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" /usr/bin/env -i \
|
<screen role="nodump"><userinput>chroot "$LFS" /usr/bin/env -i \
|
||||||
HOME=/root \
|
HOME=/root \
|
||||||
TERM="$TERM" \
|
TERM="$TERM" \
|
||||||
PS1='(lfs chroot) \u:\w\$ ' \
|
PS1='(lfs chroot) \u:\w\$ ' \
|
||||||
@ -31,18 +32,18 @@
|
|||||||
<parameter>TERM=$TERM</parameter> construct will set the <envar>TERM</envar>
|
<parameter>TERM=$TERM</parameter> construct will set the <envar>TERM</envar>
|
||||||
variable inside chroot to the same value as outside chroot. This variable is
|
variable inside chroot to the same value as outside chroot. This variable is
|
||||||
needed for programs like <command>vim</command> and <command>less</command>
|
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
|
<envar>CFLAGS</envar> or <envar>CXXFLAGS</envar>, this is a good place to set
|
||||||
them again.</para>
|
them again.</para>
|
||||||
|
|
||||||
<para>From this point on, there is no need to use the
|
<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
|
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">$LFS</filename> is now the root
|
||||||
(<filename class="directory">/</filename>) directory.</para>
|
(<filename class="directory">/</filename>) directory.</para>
|
||||||
|
|
||||||
<para>Notice that <filename class="directory">/tools/bin</filename> is not
|
<para>Notice that <filename class="directory">/tools/bin</filename> is not
|
||||||
anymore in the <envar>PATH</envar>. This means that a temporary tool will no longer be
|
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
|
used once its final version is installed. This occurs when the shell does not
|
||||||
<quote>remember</quote> the locations of executed binaries—for this
|
<quote>remember</quote> the locations of executed binaries—for this
|
||||||
reason, hashing is switched off by passing the <parameter>+h</parameter> option
|
reason, hashing is switched off by passing the <parameter>+h</parameter> option
|
||||||
|
@ -76,7 +76,7 @@ nobody:x:99:99:Unprivileged User:/dev/null:/bin/false</literal>
|
|||||||
EOF</userinput></screen>
|
EOF</userinput></screen>
|
||||||
|
|
||||||
<para>The actual password for <systemitem class="username">root</systemitem>
|
<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>
|
will be set later.</para>
|
||||||
|
|
||||||
<para>Create the <filename>/etc/group</filename> file by running the following
|
<para>Create the <filename>/etc/group</filename> file by running the following
|
||||||
command:</para>
|
command:</para>
|
||||||
@ -145,16 +145,16 @@ users:x:999:</literal>
|
|||||||
EOF</userinput></screen>
|
EOF</userinput></screen>
|
||||||
|
|
||||||
<para>The created groups are not part of any standard—they are groups
|
<para>The created groups are not part of any standard—they are groups
|
||||||
decided on in part by the requirements of the Udev configuration in the next
|
decided on in part by the requirements of the Udev configuration in Chapter
|
||||||
chapter, and in part by common convention employed by a number of existing
|
9, and in part by common convention employed by a number of existing Linux
|
||||||
Linux distributions. In addition, some test suites rely on specific users
|
distributions. In addition, some test suites rely on specific users or
|
||||||
or groups. The Linux Standard Base (LSB, available at <ulink
|
groups. The Linux Standard Base (LSB, available at <ulink
|
||||||
url="http://www.linuxbase.org"/>) recommends only that, besides the group
|
url="http://refspecs.linuxfoundation.org/lsb.shtml"/>) only recommends that,
|
||||||
<systemitem class="groupname">root</systemitem> with a Group ID (GID) of 0,
|
besides the group <systemitem class="groupname">root</systemitem> with a
|
||||||
a group <systemitem class="groupname">bin</systemitem> with a GID of 1 be
|
Group ID (GID) of 0, a group <systemitem class="groupname">bin</systemitem>
|
||||||
present. All other group names and GIDs can be chosen freely by the system
|
with a GID of 1 be present. All other group names and GIDs can be chosen
|
||||||
administrator since well-written programs do not depend on GID numbers, but
|
freely by the system administrator since well-written programs do not depend
|
||||||
rather use the group's name.</para>
|
on GID numbers, but rather use the group's name.</para>
|
||||||
|
|
||||||
<para>Some tests in <xref linkend="chapter-building-system"/> need a regular
|
<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
|
user. We add this user here and delete this account at the end of that
|
||||||
@ -177,7 +177,7 @@ install -o tester -d /home/tester</userinput></screen>
|
|||||||
directive, <command>bash</command> would remember the paths to binaries it has
|
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
|
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
|
installed, the <parameter>+h</parameter> directive will be used for the duration
|
||||||
of this chapter.</para>
|
of this and the next chapter.</para>
|
||||||
|
|
||||||
<para>The <command>login</command>, <command>agetty</command>, and
|
<para>The <command>login</command>, <command>agetty</command>, and
|
||||||
<command>init</command> programs (and others) use a number of log
|
<command>init</command> programs (and others) use a number of log
|
||||||
|
@ -15,12 +15,12 @@
|
|||||||
|
|
||||||
<screen><userinput>mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
|
<screen><userinput>mkdir -pv /{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
|
||||||
mkdir -pv /{media/{floppy,cdrom},srv,var}
|
mkdir -pv /{media/{floppy,cdrom},srv,var}
|
||||||
install -dv -m 0750 /root
|
|
||||||
install -dv -m 1777 /tmp /var/tmp
|
|
||||||
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
|
mkdir -pv /usr/{,local/}{bin,include,lib,sbin,src}
|
||||||
mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
|
mkdir -pv /usr/{,local/}share/{color,dict,doc,info,locale,man}
|
||||||
mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
|
mkdir -pv /usr/{,local/}share/{misc,terminfo,zoneinfo}
|
||||||
mkdir -pv /usr/{,local/}share/man/man{1..8}
|
mkdir -pv /usr/{,local/}share/man/man{1..8}
|
||||||
|
install -dv -m 1777 /tmp /var/tmp
|
||||||
|
install -dv -m 0750 /root
|
||||||
|
|
||||||
mkdir -v /var/{log,mail,spool}
|
mkdir -v /var/{log,mail,spool}
|
||||||
ln -sv /run /var/run
|
ln -sv /run /var/run
|
||||||
|
@ -10,28 +10,24 @@
|
|||||||
|
|
||||||
<title>Introduction</title>
|
<title>Introduction</title>
|
||||||
|
|
||||||
<para>This chapter shows how to build the last missing bits of the
|
<para>This chapter shows how to build the last missing bits of the temporary
|
||||||
temporary system: first, the tools needed by the build machinery of
|
system: first, the tools needed by the build machinery of various packages,
|
||||||
various packages, then three packages needed to run tests.
|
then three packages needed to run tests. Now that all circular dependencies
|
||||||
Now that all circular dependencies have been resolved,
|
have been resolved, we can use a <quote>chroot</quote> environment,
|
||||||
we can use a <quote>chroot</quote> environment, completely isolated
|
completely isolated the host operating system used for the build, except
|
||||||
from the computer used for the build, except for the running kernel.</para>
|
for the running kernel.</para>
|
||||||
|
|
||||||
<para>For proper operation of the isolated environment, some communication
|
<para>For proper operation of the isolated environment, some communication
|
||||||
with the running kernel must be established. This is done through the
|
with the running kernel must be established. This is done through the
|
||||||
so-called <emphasis>Virtual Kernel File Systems</emphasis>, which must be
|
so-called <emphasis>Virtual Kernel File Systems</emphasis>, which must be
|
||||||
mounted when entering the chroot environment. You may want to check
|
mounted when entering the chroot environment. You may want to check
|
||||||
that they are mounted by issuing <command>ls $LFS/dev</command>,
|
that they are mounted by issuing <command>findmnt</command>.</para>
|
||||||
<command>ls $LFS/proc</command>, or <command>ls $LFS/sys</command>.
|
|
||||||
Note that mounting the virtual kernel file systems must be done
|
|
||||||
<emphasis>each time you want to enter the chroot
|
|
||||||
environment</emphasis>.</para>
|
|
||||||
|
|
||||||
<para>Until <xref linkend="ch-tools-chroot"/>, the commands must be
|
<para>Until <xref linkend="ch-tools-chroot"/>, the commands must be
|
||||||
run as <systemitem class="username">root</systemitem>, with the
|
run as <systemitem class="username">root</systemitem>, with the
|
||||||
<envar>LFS</envar> variable set. After entering chroot, all commands
|
<envar>LFS</envar> variable set. After entering chroot, all commands
|
||||||
are run as root, fortunately without access to the OS of the computer
|
are run as root, fortunately without access to the OS of the computer
|
||||||
you build LFS on. Be careful anyway, as it is easy to destroy the whole
|
you built LFS on. Be careful anyway, as it is easy to destroy the whole
|
||||||
LFS system with badly formed commands.</para>
|
LFS system with badly formed commands.</para>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@ -30,9 +30,10 @@
|
|||||||
<para>When the kernel boots the system, it requires the presence of a few
|
<para>When the kernel boots the system, it requires the presence of a few
|
||||||
device nodes, in particular the <filename
|
device nodes, in particular the <filename
|
||||||
class="devicefile">console</filename> and <filename
|
class="devicefile">console</filename> and <filename
|
||||||
class="devicefile">null</filename> devices. The device nodes must be created
|
class="devicefile">null</filename> devices. The device nodes must be
|
||||||
on the hard disk so that they are available before <command>udevd</command>
|
created on the hard disk so that they are available before the kernel
|
||||||
has been started, and additionally when Linux is started with
|
populates <systemitem class="filesystem">/dev</systemitem>), and
|
||||||
|
additionally when Linux is started with
|
||||||
<parameter>init=/bin/bash</parameter>. Create the devices by running the
|
<parameter>init=/bin/bash</parameter>. Create the devices by running the
|
||||||
following commands:</para>
|
following commands:</para>
|
||||||
|
|
||||||
@ -72,7 +73,7 @@ mknod -m 666 $LFS/dev/null c 1 3</userinput></screen>
|
|||||||
mount -vt proc proc $LFS/proc
|
mount -vt proc proc $LFS/proc
|
||||||
mount -vt sysfs sysfs $LFS/sys
|
mount -vt sysfs sysfs $LFS/sys
|
||||||
mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
|
mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
|
||||||
|
<!--
|
||||||
<variablelist>
|
<variablelist>
|
||||||
<title>The meaning of the mount options for devpts:</title>
|
<title>The meaning of the mount options for devpts:</title>
|
||||||
|
|
||||||
@ -100,7 +101,7 @@ mount -vt tmpfs tmpfs $LFS/run</userinput></screen>
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
-->
|
||||||
<para>In some host systems, <filename>/dev/shm</filename> is a
|
<para>In some host systems, <filename>/dev/shm</filename> is a
|
||||||
symbolic link to <filename class="directory">/run/shm</filename>.
|
symbolic link to <filename class="directory">/run/shm</filename>.
|
||||||
The /run tmpfs was mounted above so in this case only a
|
The /run tmpfs was mounted above so in this case only a
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<sect2 role="package">
|
<sect2 role="package">
|
||||||
<title/>
|
<title/>
|
||||||
|
|
||||||
<para>The Grep package contains programs for searching through teh contents of files.</para>
|
<para>The Grep package contains programs for searching through the contents of files.</para>
|
||||||
|
|
||||||
<segmentedlist>
|
<segmentedlist>
|
||||||
<segtitle>&buildtime;</segtitle>
|
<segtitle>&buildtime;</segtitle>
|
||||||
|
@ -24,8 +24,7 @@
|
|||||||
<title/>
|
<title/>
|
||||||
|
|
||||||
<para>The Make package contains a program for controlling the generation of
|
<para>The Make package contains a program for controlling the generation of
|
||||||
executables and other non-source files of a program from the program's
|
executables and other non-source files of a package from source files.</para>
|
||||||
source files. .</para>
|
|
||||||
|
|
||||||
<segmentedlist>
|
<segmentedlist>
|
||||||
<segtitle>&buildtime;</segtitle>
|
<segtitle>&buildtime;</segtitle>
|
||||||
|
Loading…
Reference in New Issue
Block a user