r5290 - in branches/cross-lfs/BOOK/chroot: . common raq2

jhuntwork at linuxfromscratch.org jhuntwork at linuxfromscratch.org
Wed May 11 21:17:10 PDT 2005


Author: jhuntwork
Date: 2005-05-11 22:17:09 -0600 (Wed, 11 May 2005)
New Revision: 5290

Added:
   branches/cross-lfs/BOOK/chroot/common/
   branches/cross-lfs/BOOK/chroot/common/changingowner.xml
   branches/cross-lfs/BOOK/chroot/common/chroot.xml
   branches/cross-lfs/BOOK/chroot/common/createfiles.xml
   branches/cross-lfs/BOOK/chroot/common/creatingdirs.xml
   branches/cross-lfs/BOOK/chroot/common/devices.xml
   branches/cross-lfs/BOOK/chroot/common/kernfs.xml
   branches/cross-lfs/BOOK/chroot/common/pwdgroup.xml
   branches/cross-lfs/BOOK/chroot/common/revisedchroot.xml
   branches/cross-lfs/BOOK/chroot/common/util-linux.xml
   branches/cross-lfs/BOOK/chroot/ppc-chapter.xml
   branches/cross-lfs/BOOK/chroot/raq2-chapter.xml
   branches/cross-lfs/BOOK/chroot/raq2/
   branches/cross-lfs/BOOK/chroot/raq2/creatingdirs.xml
   branches/cross-lfs/BOOK/chroot/sparc-chapter.xml
   branches/cross-lfs/BOOK/chroot/sparc64-chapter.xml
   branches/cross-lfs/BOOK/chroot/x86-chapter.xml
Removed:
   branches/cross-lfs/BOOK/chroot/changingowner.xml
   branches/cross-lfs/BOOK/chroot/chapter.xml
   branches/cross-lfs/BOOK/chroot/chroot.xml
   branches/cross-lfs/BOOK/chroot/createfiles.xml
   branches/cross-lfs/BOOK/chroot/creatingdirs.xml
   branches/cross-lfs/BOOK/chroot/devices.xml
   branches/cross-lfs/BOOK/chroot/kernfs.xml
   branches/cross-lfs/BOOK/chroot/pwdgroup.xml
   branches/cross-lfs/BOOK/chroot/revisedchroot.xml
   branches/cross-lfs/BOOK/chroot/util-linux.xml
Log:
Updating chroot dir

Deleted: branches/cross-lfs/BOOK/chroot/changingowner.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/changingowner.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/changingowner.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -1,40 +0,0 @@
-<?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" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<sect1 id="ch-chroot-changingowner">
-<title>Changing Ownership</title>
-<?dbhtml filename="changingowner.html"?>
-
-<para>Currently, the <filename class="directory">/tools</filename>
-directory is owned by the user <emphasis>lfs</emphasis>, a user that
-exists only on the host system. Although the <filename
-class="directory">/tools</filename> directory can be deleted once the
-LFS system has been finished, it can be retained to build additional
-LFS systems. If the <filename class="directory">/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">/tools</filename> directory and all the files
-therein, thus exposing these files to possible malicious
-manipulation.</para>
-
-<para>To avoid this issue, add the <emphasis>lfs</emphasis> 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. Alternatively, assign
-the contents of the <filename class="directory">/tools</filename>
-directory to user <emphasis>root</emphasis> by running the following
-command:</para>
-
-<screen><userinput>chown -R 0:0 /tools</userinput></screen>
-
-<para>The command uses <parameter>0:0</parameter> instead of
-<parameter>root:root</parameter>, because <command>chown</command>
-is unable to resolve the name <quote>root</quote> until the password
-file has been created. This book assumes you ran this
-<command>chown</command> command.</para>
-
-</sect1>
-

Deleted: branches/cross-lfs/BOOK/chroot/chapter.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/chapter.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/chapter.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -1,20 +0,0 @@
-<?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" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<chapter id="chapter-chroot" xreflabel="If You Are Going to Chroot">
-<?dbhtml dir="chroot"?>
-<title>If You Are Going to Chroot</title>
-<?dbhtml filename="chapter.html"?>
-
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="util-linux.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="kernfs.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="chroot.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="changingowner.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="creatingdirs.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="createfiles.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="pwdgroup.xml"/>
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="devices.xml"/>
-
-</chapter>

Deleted: branches/cross-lfs/BOOK/chroot/chroot.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/chroot.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/chroot.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -1,61 +0,0 @@
-<?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" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<sect1 id="ch-chroot-chroot">
-<title>Entering the Chroot Environment</title>
-<?dbhtml filename="chroot.html"?>
-
-<para>It is time to enter the chroot environment to begin
-building and installing the final LFS system. As user
-<emphasis>root</emphasis>, run the following command to enter the
-realm 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>
-
-<para>The <parameter>-i</parameter> option given to the
-<command>env</command> command will clear all variables of the chroot
-environment. After that, only the <envar>HOME</envar>,
-<envar>TERM</envar>, <envar>PS1</envar>, and
-<envar>PATH</envar> variables are set again. The
-<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
-<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 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 not be used anymore as soon as its final version
-is installed. This occurs when the shell does not <quote>remember</quote> the
-locations of executed binaries—for this reason, hashing is switched
-off by passing the <parameter>+h</parameter> option to <command>bash</command>.</para>
-
-<para>It is important that all the commands throughout the remainder
-of this chapter and the following chapters be run from within the
-chroot environment. If you leave this environment for any reason
-(rebooting for example), remember to first mount the <systemitem
-class="filesystem">proc</systemitem> and <systemitem
-class="filesystem">devpts</systemitem> file systems (discussed in the
-previous section) and enter chroot again before continuing with the
-installations.</para>
-
-<para>Note that the bash prompt will say <quote>I have no
-name!</quote> This is normal because the
-<filename>/etc/passwd</filename> file has not been created yet.</para>
-
-</sect1>
-

Added: branches/cross-lfs/BOOK/chroot/common/changingowner.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/common/changingowner.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/common/changingowner.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,40 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-chroot-changingowner">
+<title>Changing Ownership</title>
+<?dbhtml filename="changingowner.html"?>
+
+<para>Currently, the <filename class="directory">/tools</filename>
+directory is owned by the user <emphasis>lfs</emphasis>, a user that
+exists only on the host system. Although the <filename
+class="directory">/tools</filename> directory can be deleted once the
+LFS system has been finished, it can be retained to build additional
+LFS systems. If the <filename class="directory">/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">/tools</filename> directory and all the files
+therein, thus exposing these files to possible malicious
+manipulation.</para>
+
+<para>To avoid this issue, add the <emphasis>lfs</emphasis> 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. Alternatively, assign
+the contents of the <filename class="directory">/tools</filename>
+directory to user <emphasis>root</emphasis> by running the following
+command:</para>
+
+<screen><userinput>chown -R 0:0 /tools</userinput></screen>
+
+<para>The command uses <parameter>0:0</parameter> instead of
+<parameter>root:root</parameter>, because <command>chown</command>
+is unable to resolve the name <quote>root</quote> until the password
+file has been created. This book assumes you ran this
+<command>chown</command> command.</para>
+
+</sect1>
+

Added: branches/cross-lfs/BOOK/chroot/common/chroot.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/common/chroot.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/common/chroot.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,61 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-chroot-chroot">
+<title>Entering the Chroot Environment</title>
+<?dbhtml filename="chroot.html"?>
+
+<para>It is time to enter the chroot environment to begin
+building and installing the final LFS system. As user
+<emphasis>root</emphasis>, run the following command to enter the
+realm 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>
+
+<para>The <parameter>-i</parameter> option given to the
+<command>env</command> command will clear all variables of the chroot
+environment. After that, only the <envar>HOME</envar>,
+<envar>TERM</envar>, <envar>PS1</envar>, and
+<envar>PATH</envar> variables are set again. The
+<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
+<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 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 not be used anymore as soon as its final version
+is installed. This occurs when the shell does not <quote>remember</quote> the
+locations of executed binaries—for this reason, hashing is switched
+off by passing the <parameter>+h</parameter> option to <command>bash</command>.</para>
+
+<para>It is important that all the commands throughout the remainder
+of this chapter and the following chapters be run from within the
+chroot environment. If you leave this environment for any reason
+(rebooting for example), remember to first mount the <systemitem
+class="filesystem">proc</systemitem> and <systemitem
+class="filesystem">devpts</systemitem> file systems (discussed in the
+previous section) and enter chroot again before continuing with the
+installations.</para>
+
+<para>Note that the bash prompt will say <quote>I have no
+name!</quote> This is normal because the
+<filename>/etc/passwd</filename> file has not been created yet.</para>
+
+</sect1>
+

Added: branches/cross-lfs/BOOK/chroot/common/createfiles.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/common/createfiles.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/common/createfiles.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,21 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-chroot-createfiles">
+<title>Creating Essential Symlinks</title>
+<?dbhtml filename="createfiles.html"?>
+
+<para>Some programs hard-wire paths to programs which do not yet
+exist. 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 -s /tools/bin/{bash,cat,pwd,stty} /bin
+ln -s /tools/bin/perl /usr/bin
+ln -s /tools/lib/libgcc_s.so{,.1} /usr/lib
+ln -s bash /bin/sh</userinput></screen>
+
+</sect1>
+

Added: branches/cross-lfs/BOOK/chroot/common/creatingdirs.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/common/creatingdirs.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/common/creatingdirs.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,67 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-chroot-creatingdirs">
+<title>Creating Directories</title>
+<?dbhtml filename="creatingdirs.html"?>
+
+<para>It is time to create some structure in the LFS file system.
+Create a directory tree. Issuing the following commands will create a
+standard tree:</para>
+ 
+<screen><userinput>install -d /{bin,boot,dev,etc/opt,home,lib,mnt}
+install -d /{sbin,srv,usr/local,var,opt}
+install -d /root -m 0750
+install -d /tmp /var/tmp -m 1777
+install -d /media/{floppy,cdrom}
+install -d /usr/{bin,include,lib,sbin,share,src}
+ln -s share/{man,doc,info} /usr
+install -d /usr/share/{doc,info,locale,man}
+install -d /usr/share/{misc,terminfo,zoneinfo}
+install -d /usr/share/man/man{1,2,3,4,5,6,7,8}
+install -d /usr/local/{bin,etc,include,lib,sbin,share,src}
+ln -s share/{man,doc,info} /usr/local
+install -d /usr/local/share/{doc,info,locale,man}
+install -d /usr/local/share/{misc,terminfo,zoneinfo}
+install -d /usr/local/share/man/man{1,2,3,4,5,6,7,8}
+install -d /var/{lock,log,mail,run,spool}
+install -d /var/{opt,cache,lib/{misc,locate},local}
+install -d /opt/{bin,doc,include,info}
+install -d /opt/{lib,man/man{1,2,3,4,5,6,7,8}}</userinput></screen>
+
+<para>Directories are, by default, created with permission mode 755,
+but this is not desirable for all directories. In the commands above,
+two changes are made—one to the home directory of user
+<emphasis>root</emphasis>, and another to the directories for
+temporary files.</para>
+
+<para>The first mode change ensures that not just anybody can enter
+the <filename class="directory">/root</filename> directory—the same
+as a normal user would do with his or her home directory. The second
+mode change makes sure that any user can write to the <filename
+class="directory">/tmp</filename> and <filename
+class="directory">/var/tmp</filename> directories, but cannot remove
+other users' files from them. The latter is prohibited by the
+so-called <quote>sticky bit,</quote> the highest bit (1) in the 1777
+bit mask.</para>
+
+<sect2>
+<title>FHS Compliance Note</title>
+
+<para>The directory tree is based on the Filesystem Hierarchy Standard
+(FHS) standard (available at <ulink
+url="http://www.pathname.com/fhs/"/>). Besides the tree created above,
+this standard stipulates the existence of <filename
+class="directory">/usr/local/games</filename> and <filename
+class="directory">/usr/share/games</filename>.  We do not recommend
+these for a base system, however, feel free to make the system
+FHS-compliant.  The FHS is not precise as to the structure of the
+<filename class="directory">/usr/local/share</filename> subdirectory,
+so we created only the directories that are needed.</para>
+
+</sect2>
+
+</sect1>
+

Added: branches/cross-lfs/BOOK/chroot/common/devices.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/common/devices.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/common/devices.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,81 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-chroot-devices">
+<title>Populating /dev</title>
+<?dbhtml filename="devices.html"?>
+
+<indexterm zone="ch-chroot-devices"><primary sortas="e-Devices">/dev/*</primary></indexterm>
+
+<sect2>
+<title>Creating Initial Device Nodes</title>
+
+<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. Create these by
+running the following commands:</para>
+
+<screen><userinput>mknod -m 600 /dev/console c 5 1
+mknod -m 666 /dev/null c 1 3</userinput></screen>
+</sect2>
+
+<sect2>
+<title>Mounting ramfs and Populating /dev</title>
+
+<para>The ideal way to populate <filename
+class="directory">/dev</filename> is to mount a <systemitem
+class="filesystem">ramfs</systemitem> onto <filename
+class="directory">/dev</filename>, like <systemitem
+class="filesystem">tmpfs</systemitem>, and create the devices on there
+during each bootup. Since the system has not been booted, it is
+necessary to do what the bootscripts would otherwise do and populate
+<filename class="directory">/dev</filename>. Begin by mounting
+<filename class="directory">/dev</filename>:</para>
+
+<screen><userinput>mount -n -t ramfs none /dev</userinput></screen>
+
+<!-- Edit Me -->
+<para>Since the Udev package will not be installed until later on in the
+process, create a minimal set of device nodes used for building:</para>
+
+<screen><userinput>mknod -m 622 /dev/console c 5 1
+mknod -m 666 /dev/null c 1 3
+mknod -m 666 /dev/zero c 1 5
+mknod -m 666 /dev/ptmx c 5 2
+mknod -m 666 /dev/tty c 5 0
+mknod -m 444 /dev/random c 1 8
+mknod -m 444 /dev/urandom c 1 9
+chown root:tty /dev/{console,ptmx,tty}</userinput></screen>
+<!-- -->
+
+<para>There are some symlinks and directories required by LFS that are
+not created by Udev, so create those here:</para>
+
+<screen><userinput>ln -s /proc/self/fd /dev/fd
+ln -s /proc/self/fd/0 /dev/stdin
+ln -s /proc/self/fd/1 /dev/stdout
+ln -s /proc/self/fd/2 /dev/stderr
+ln -s /proc/kcore /dev/core
+mkdir /dev/pts
+mkdir /dev/shm</userinput></screen>
+
+<para>Finally, mount the proper virtual (kernel) file systems on the
+newly-created directories:</para>
+
+<screen><userinput>mount -t devpts -o gid=4,mode=620 none /dev/pts
+mount -t tmpfs none /dev/shm</userinput></screen>
+
+<para>The <command>mount</command> commands executed above may result
+in the following warning message:</para>
+
+<screen><computeroutput>can't open /etc/fstab: No such file or directory.</computeroutput></screen>
+
+<para>This file—<filename>/etc/fstab</filename>—has not
+been created yet but is also not required for the file systems to be
+properly mounted. As such, the warning can be safely ignored.</para>
+</sect2>
+
+</sect1>
+

Added: branches/cross-lfs/BOOK/chroot/common/kernfs.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/common/kernfs.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/common/kernfs.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,43 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-chroot-kernfs">
+<title>Mounting Virtual Kernel File Systems</title>
+<?dbhtml filename="kernfs.html"?>
+
+<para>From this point on, we will be running all commands as
+the <emphasis>root</emphasis> user. So begin by exiting from the su
+as <emphasis>lfs</emphasis>.</para>
+
+<screen><userinput>exit</userinput></screen>
+
+<para>Various file systems exported by the kernel do not exist on the
+hard drive, but are used to communicate to and from the kernel
+itself.</para>
+
+<para>Begin by creating directories onto which the file systems will be mounted:</para>
+
+<screen><userinput>mkdir -p $LFS/{proc,sys}</userinput></screen>
+
+<para>Now mount the file systems:</para>
+
+<screen><userinput>mount -t proc proc $LFS/proc
+mount -t sysfs sysfs $LFS/sys</userinput></screen>
+
+<para>Remember that if for any reason you stop working on the LFS
+system and start again later, it is important to check that these file
+systems are mounted again before entering the chroot
+environment.</para>
+
+<para>Additional file systems will soon be mounted from within the
+chroot environment. To keep the host up to date, perform a <quote>fake
+mount</quote> for each of these now:</para>
+
+<screen><userinput>mount -f -t ramfs ramfs $LFS/dev
+mount -f -t tmpfs tmpfs $LFS/dev/shm
+mount -f -t devpts -o gid=4,mode=620 devpts $LFS/dev/pts</userinput></screen>
+
+</sect1>
+

Added: branches/cross-lfs/BOOK/chroot/common/pwdgroup.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/common/pwdgroup.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/common/pwdgroup.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,92 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-chroot-pwdgroup">
+<title>Creating the passwd, group, and log Files</title>
+<?dbhtml filename="pwdgroup.html"?>
+
+<indexterm zone="ch-chroot-pwdgroup"><primary sortas="e-/etc/passwd">/etc/passwd</primary></indexterm>
+<indexterm zone="ch-chroot-pwdgroup"><primary sortas="e-/etc/group">/etc/group</primary></indexterm>
+<indexterm zone="ch-chroot-pwdgroup"><primary sortas="e-/var/run/utmp">/var/run/utmp</primary></indexterm>
+<indexterm zone="ch-chroot-pwdgroup"><primary sortas="e-/var/log/btmp">/var/log/btmp</primary></indexterm>
+<indexterm zone="ch-chroot-pwdgroup"><primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary></indexterm>
+<indexterm zone="ch-chroot-pwdgroup"><primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary></indexterm>
+
+<para>In order for user <emphasis>root</emphasis> to be able to login
+and for the name <quote>root</quote> to be recognized, there need to
+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><userinput>cat > /etc/passwd << "EOF"
+<literal>root:x:0:0:root:/root:/bin/bash
+nobody:x:65534:65534:Nobody:/:/sbin/nologin</literal>
+EOF</userinput></screen>
+
+<para>The actual password for <emphasis>root</emphasis> (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><userinput>cat > /etc/group << "EOF"
+<literal>root:x:0:
+console:x:1:
+tty:x:2:
+kmem:x:3:
+disk:x:4:
+utmp:x:5:
+nogroup:x:65534:</literal>
+EOF</userinput></screen>
+
+<para>The created groups are not part of any standard—they are some
+of the groups that the Udev configuration will be using in the next
+section. The Linux Standard Base (LSB, available at <ulink
+url="http://www.linuxbase.org"/>) recommends only that, besides the
+group <quote>root</quote> with a Group ID (GID) of 0, a group
+<quote>bin</quote> with a GID of 1 be present. All other group names
+and GIDs can be chosen freely by the system administrator since
+well-written packages do not depend on GID numbers, but rather use the
+group's name.</para>
+
+
+<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><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. In order to use the newly compiled
+binaries as soon as they are installed, turn off this function 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/run/utmp /var/log/{btmp,lastlog,wtmp}
+chgrp utmp /var/run/utmp /var/log/lastlog
+chmod 664 /var/run/utmp /var/log/lastlog</userinput></screen>
+
+<para>The <filename>/var/run/utmp</filename> file records the users
+that are currently logged in. 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/btmp</filename> file
+records the bad login attempts.</para>
+
+</sect1>
+

Added: branches/cross-lfs/BOOK/chroot/common/revisedchroot.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/common/revisedchroot.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/common/revisedchroot.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,44 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-chroot-revisedchroot">
+<title>Cleaning Up</title>
+<?dbhtml filename="revisedchroot.html"?>
+
+<para>From now on, when reentering the chroot environment after
+exiting, use the following modified chroot command:</para>
+
+<screen><userinput>chroot "$LFS" /usr/bin/env -i \
+    HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
+    PATH=/bin:/usr/bin:/sbin:/usr/sbin \
+    /bin/bash --login</userinput></screen>
+
+<para>The reason for this is that, since the programs in <filename
+class="directory">/tools</filename> are no longer needed, the
+directory can be deleted to regain space. Before actually deleting the
+directory, exit from chroot and reenter it with the above command.
+Also, before removing <filename class="directory">/tools</filename>,
+tar it up and store it in a safe place in case another LFS system will
+be built.</para>
+
+<note><para>Removing <filename class="directory">/tools</filename>
+will also remove the temporary copies of Tcl, Expect, and DejaGNU
+which were used for running the toolchain tests. To use these programs
+later on, they will need to be recompiled and re-installed. The
+installation instructions are the same as in <xref
+linkend="chapter-temporary-tools"/>, apart from changing the prefix
+from <filename class="directory">/tools</filename> to <filename
+class="directory">/usr</filename>. The BLFS book discusses a slightly
+different approach to installing Tcl (see <ulink
+url="&blfs-root;"/>).</para></note>
+
+<para>The packages and patches stored in <filename
+class="directory">/sources</filename> can also be moved to a more
+usual location, such as <filename
+class="directory">/usr/src/packages</filename>. The entire directory
+can also be deleted if its contents have been burned to a CD.</para>
+
+</sect1>
+

Added: branches/cross-lfs/BOOK/chroot/common/util-linux.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/common/util-linux.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/common/util-linux.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,63 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-chroot-util-linux" role="wrap">
+<title>Util-linux-&util-linux-version;</title>
+<?dbhtml filename="util-linux.html"?>
+
+<indexterm zone="ch-chroot-util-linux">
+<primary sortas="a-Util-linux">Util-linux</primary>
+<secondary>chroot</secondary></indexterm>
+
+<sect2 role="package"><title/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../../final-system/common/util-linux.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
+
+<segmentedlist>
+<segtitle>&buildtime;</segtitle>
+<segtitle>&diskspace;</segtitle>
+<seglistitem><seg>0.2 SBU</seg><seg>16 MB</seg></seglistitem>
+</segmentedlist>
+
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../../final-system/common/util-linux.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/>
+
+</sect2>
+
+<sect2 role="installation">
+<title>Installation of Util-linux</title>
+
+<para>Util-linux does not use the freshly installed headers and
+libraries from the <filename class="directory">/tools</filename>
+directory. This is fixed by altering the configure script:</para>
+
+<screen><userinput>sed -i 's@/usr/include@/tools/include at g' configure</userinput></screen>
+
+<para>Prepare Util-linux for compilation:</para>
+
+<screen><userinput>./configure</userinput></screen>
+
+<para>Compile some support routines:</para>
+
+<screen><userinput>make ARCH="" CPU="" -C lib</userinput></screen>
+
+<para>Since only a couple of the utilities contained in this package
+are needed, build only those:</para>
+
+<screen><userinput>make ARCH="" CPU="" -C mount mount umount
+make ARCH="" CPU="" -C text-utils more</userinput></screen>
+
+<para>This package does not come with a test suite.</para>
+
+<para>Copy these programs to the temporary tools directory:</para>
+
+<screen><userinput>cp mount/{,u}mount text-utils/more /tools/bin</userinput></screen>
+
+</sect2>
+
+<sect2 role="content"><title/>
+<para>Details on this package are located in <xref
+linkend="contents-util-linux" role="."/></para>
+</sect2>
+</sect1>
+

Deleted: branches/cross-lfs/BOOK/chroot/createfiles.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/createfiles.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/createfiles.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -1,21 +0,0 @@
-<?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" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<sect1 id="ch-chroot-createfiles">
-<title>Creating Essential Symlinks</title>
-<?dbhtml filename="createfiles.html"?>
-
-<para>Some programs hard-wire paths to programs which do not yet
-exist. 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 -s /tools/bin/{bash,cat,pwd,stty} /bin
-ln -s /tools/bin/perl /usr/bin
-ln -s /tools/lib/libgcc_s.so{,.1} /usr/lib
-ln -s bash /bin/sh</userinput></screen>
-
-</sect1>
-

Deleted: branches/cross-lfs/BOOK/chroot/creatingdirs.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/creatingdirs.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/creatingdirs.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -1,73 +0,0 @@
-<?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" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<sect1 id="ch-chroot-creatingdirs">
-<title>Creating Directories</title>
-<?dbhtml filename="creatingdirs.html"?>
-
-<para>It is time to create some structure in the LFS file system.
-Create a directory tree. Issuing the following commands will create a
-standard tree:</para>
- 
-<screen><userinput>install -d /{bin,boot,dev,etc/opt,home,lib,mnt}
-install -d /{sbin,srv,usr/local,var,opt}
-install -d /root -m 0750
-install -d /tmp /var/tmp -m 1777
-install -d /media/{floppy,cdrom}
-install -d /usr/{bin,include,lib,sbin,share,src}
-ln -s share/{man,doc,info} /usr
-install -d /usr/share/{doc,info,locale,man}
-install -d /usr/share/{misc,terminfo,zoneinfo}
-install -d /usr/share/man/man{1,2,3,4,5,6,7,8}
-install -d /usr/local/{bin,etc,include,lib,sbin,share,src}
-ln -s share/{man,doc,info} /usr/local
-install -d /usr/local/share/{doc,info,locale,man}
-install -d /usr/local/share/{misc,terminfo,zoneinfo}
-install -d /usr/local/share/man/man{1,2,3,4,5,6,7,8}
-install -d /var/{lock,log,mail,run,spool}
-install -d /var/{opt,cache,lib/{misc,locate},local}
-install -d /opt/{bin,doc,include,info}
-install -d /opt/{lib,man/man{1,2,3,4,5,6,7,8}}</userinput></screen>
-
-<para arch="raq2">FIXME. Some explanation is needed here for the next commands.</para>
-
-<screen arch="raq2"><userinput>cd /boot
-ln -s . boot</userinput></screen>
-
-<para>Directories are, by default, created with permission mode 755,
-but this is not desirable for all directories. In the commands above,
-two changes are made—one to the home directory of user
-<emphasis>root</emphasis>, and another to the directories for
-temporary files.</para>
-
-<para>The first mode change ensures that not just anybody can enter
-the <filename class="directory">/root</filename> directory—the same
-as a normal user would do with his or her home directory. The second
-mode change makes sure that any user can write to the <filename
-class="directory">/tmp</filename> and <filename
-class="directory">/var/tmp</filename> directories, but cannot remove
-other users' files from them. The latter is prohibited by the
-so-called <quote>sticky bit,</quote> the highest bit (1) in the 1777
-bit mask.</para>
-
-
-<sect2>
-<title>FHS Compliance Note</title>
-
-<para>The directory tree is based on the Filesystem Hierarchy Standard
-(FHS) standard (available at <ulink
-url="http://www.pathname.com/fhs/"/>). Besides the tree created above,
-this standard stipulates the existence of <filename
-class="directory">/usr/local/games</filename> and <filename
-class="directory">/usr/share/games</filename>.  We do not recommend
-these for a base system, however, feel free to make the system
-FHS-compliant.  The FHS is not precise as to the structure of the
-<filename class="directory">/usr/local/share</filename> subdirectory,
-so we created only the directories that are needed.</para>
-
-</sect2>
-
-</sect1>
-

Deleted: branches/cross-lfs/BOOK/chroot/devices.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/devices.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/devices.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -1,81 +0,0 @@
-<?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" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<sect1 id="ch-chroot-devices">
-<title>Populating /dev</title>
-<?dbhtml filename="devices.html"?>
-
-<indexterm zone="ch-chroot-devices"><primary sortas="e-Devices">/dev/*</primary></indexterm>
-
-<sect2>
-<title>Creating Initial Device Nodes</title>
-
-<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. Create these by
-running the following commands:</para>
-
-<screen><userinput>mknod -m 600 /dev/console c 5 1
-mknod -m 666 /dev/null c 1 3</userinput></screen>
-</sect2>
-
-<sect2>
-<title>Mounting ramfs and Populating /dev</title>
-
-<para>The ideal way to populate <filename
-class="directory">/dev</filename> is to mount a <systemitem
-class="filesystem">ramfs</systemitem> onto <filename
-class="directory">/dev</filename>, like <systemitem
-class="filesystem">tmpfs</systemitem>, and create the devices on there
-during each bootup. Since the system has not been booted, it is
-necessary to do what the bootscripts would otherwise do and populate
-<filename class="directory">/dev</filename>. Begin by mounting
-<filename class="directory">/dev</filename>:</para>
-
-<screen><userinput>mount -n -t ramfs none /dev</userinput></screen>
-
-<!-- Edit Me -->
-<para>Since the Udev package will not be installed until later on in the
-process, create a minimal set of device nodes used for building:</para>
-
-<screen><userinput>mknod -m 622 /dev/console c 5 1
-mknod -m 666 /dev/null c 1 3
-mknod -m 666 /dev/zero c 1 5
-mknod -m 666 /dev/ptmx c 5 2
-mknod -m 666 /dev/tty c 5 0
-mknod -m 444 /dev/random c 1 8
-mknod -m 444 /dev/urandom c 1 9
-chown root:tty /dev/{console,ptmx,tty}</userinput></screen>
-<!-- -->
-
-<para>There are some symlinks and directories required by LFS that are
-not created by Udev, so create those here:</para>
-
-<screen><userinput>ln -s /proc/self/fd /dev/fd
-ln -s /proc/self/fd/0 /dev/stdin
-ln -s /proc/self/fd/1 /dev/stdout
-ln -s /proc/self/fd/2 /dev/stderr
-ln -s /proc/kcore /dev/core
-mkdir /dev/pts
-mkdir /dev/shm</userinput></screen>
-
-<para>Finally, mount the proper virtual (kernel) file systems on the
-newly-created directories:</para>
-
-<screen><userinput>mount -t devpts -o gid=4,mode=620 none /dev/pts
-mount -t tmpfs none /dev/shm</userinput></screen>
-
-<para>The <command>mount</command> commands executed above may result
-in the following warning message:</para>
-
-<screen><computeroutput>can't open /etc/fstab: No such file or directory.</computeroutput></screen>
-
-<para>This file—<filename>/etc/fstab</filename>—has not
-been created yet but is also not required for the file systems to be
-properly mounted. As such, the warning can be safely ignored.</para>
-</sect2>
-
-</sect1>
-

Deleted: branches/cross-lfs/BOOK/chroot/kernfs.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/kernfs.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/kernfs.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -1,45 +0,0 @@
-<?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" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<sect1 id="ch-chroot-kernfs">
-<title>Mounting Virtual Kernel File Systems</title>
-<?dbhtml filename="kernfs.html"?>
-
-<para>From this point on, we will be running all commands as
-the <emphasis>root</emphasis> user. So begin by exiting from the su
-as <emphasis>lfs</emphasis>.</para>
-
-<screen><userinput>exit</userinput></screen>
-
-<para>Various file systems exported by the kernel do not exist on the
-hard drive, but are used to communicate to and from the kernel
-itself.</para>
-
-<para>Begin by creating directories onto which the file systems will be mounted:</para>
-
-<screen arch="x86;sparc;ppc;"><userinput>mkdir -p $LFS/{proc,sys}</userinput></screen>
-
-<screen arch="raq2"><userinput>mkdir -p $LFS/{proc,sys,dev/{shm,pts}}</userinput></screen>
-
-<para>Now mount the file systems:</para>
-
-<screen><userinput>mount -t proc proc $LFS/proc
-mount -t sysfs sysfs $LFS/sys</userinput></screen>
-
-<para>Remember that if for any reason you stop working on the LFS
-system and start again later, it is important to check that these file
-systems are mounted again before entering the chroot
-environment.</para>
-
-<para>Additional file systems will soon be mounted from within the
-chroot environment. To keep the host up to date, perform a <quote>fake
-mount</quote> for each of these now:</para>
-
-<screen><userinput>mount -f -t ramfs ramfs $LFS/dev
-mount -f -t tmpfs tmpfs $LFS/dev/shm
-mount -f -t devpts -o gid=4,mode=620 devpts $LFS/dev/pts</userinput></screen>
-
-</sect1>
-

Added: branches/cross-lfs/BOOK/chroot/ppc-chapter.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/ppc-chapter.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/ppc-chapter.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,20 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+<chapter id="chapter-chroot" xreflabel="If You Are Going to Chroot">
+<?dbhtml dir="chroot"?>
+<title>If You Are Going to Chroot</title>
+<?dbhtml filename="chapter.html"?>
+
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/util-linux.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/kernfs.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/chroot.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/changingowner.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/creatingdirs.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/createfiles.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/pwdgroup.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/devices.xml"/>
+
+</chapter>

Deleted: branches/cross-lfs/BOOK/chroot/pwdgroup.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/pwdgroup.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/pwdgroup.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -1,92 +0,0 @@
-<?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" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<sect1 id="ch-chroot-pwdgroup">
-<title>Creating the passwd, group, and log Files</title>
-<?dbhtml filename="pwdgroup.html"?>
-
-<indexterm zone="ch-chroot-pwdgroup"><primary sortas="e-/etc/passwd">/etc/passwd</primary></indexterm>
-<indexterm zone="ch-chroot-pwdgroup"><primary sortas="e-/etc/group">/etc/group</primary></indexterm>
-<indexterm zone="ch-chroot-pwdgroup"><primary sortas="e-/var/run/utmp">/var/run/utmp</primary></indexterm>
-<indexterm zone="ch-chroot-pwdgroup"><primary sortas="e-/var/log/btmp">/var/log/btmp</primary></indexterm>
-<indexterm zone="ch-chroot-pwdgroup"><primary sortas="e-/var/log/lastlog">/var/log/lastlog</primary></indexterm>
-<indexterm zone="ch-chroot-pwdgroup"><primary sortas="e-/var/log/wtmp">/var/log/wtmp</primary></indexterm>
-
-<para>In order for user <emphasis>root</emphasis> to be able to login
-and for the name <quote>root</quote> to be recognized, there need to
-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><userinput>cat > /etc/passwd << "EOF"
-<literal>root:x:0:0:root:/root:/bin/bash
-nobody:x:65534:65534:Nobody:/:/sbin/nologin</literal>
-EOF</userinput></screen>
-
-<para>The actual password for <emphasis>root</emphasis> (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><userinput>cat > /etc/group << "EOF"
-<literal>root:x:0:
-console:x:1:
-tty:x:2:
-kmem:x:3:
-disk:x:4:
-utmp:x:5:
-nogroup:x:65534:</literal>
-EOF</userinput></screen>
-
-<para>The created groups are not part of any standard—they are some
-of the groups that the Udev configuration will be using in the next
-section. The Linux Standard Base (LSB, available at <ulink
-url="http://www.linuxbase.org"/>) recommends only that, besides the
-group <quote>root</quote> with a Group ID (GID) of 0, a group
-<quote>bin</quote> with a GID of 1 be present. All other group names
-and GIDs can be chosen freely by the system administrator since
-well-written packages do not depend on GID numbers, but rather use the
-group's name.</para>
-
-
-<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><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. In order to use the newly compiled
-binaries as soon as they are installed, turn off this function 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/run/utmp /var/log/{btmp,lastlog,wtmp}
-chgrp utmp /var/run/utmp /var/log/lastlog
-chmod 664 /var/run/utmp /var/log/lastlog</userinput></screen>
-
-<para>The <filename>/var/run/utmp</filename> file records the users
-that are currently logged in. 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/btmp</filename> file
-records the bad login attempts.</para>
-
-</sect1>
-

Added: branches/cross-lfs/BOOK/chroot/raq2/creatingdirs.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/raq2/creatingdirs.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/raq2/creatingdirs.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,69 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../../general.ent">
+  %general-entities;
+]>
+<sect1 id="ch-chroot-creatingdirs">
+<title>Creating Directories</title>
+<?dbhtml filename="creatingdirs.html"?>
+
+<para>It is time to create some structure in the LFS file system.
+Create a directory tree. Issuing the following commands will create a
+standard tree:</para>
+ 
+<screen><userinput>install -d /{bin,boot,dev,etc/opt,home,lib,mnt}
+install -d /{sbin,srv,usr/local,var,opt}
+install -d /root -m 0750
+install -d /tmp /var/tmp -m 1777
+install -d /media/{floppy,cdrom}
+install -d /usr/{bin,include,lib,sbin,share,src}
+ln -s share/{man,doc,info} /usr
+install -d /usr/share/{doc,info,locale,man}
+install -d /usr/share/{misc,terminfo,zoneinfo}
+install -d /usr/share/man/man{1,2,3,4,5,6,7,8}
+install -d /usr/local/{bin,etc,include,lib,sbin,share,src}
+ln -s share/{man,doc,info} /usr/local
+install -d /usr/local/share/{doc,info,locale,man}
+install -d /usr/local/share/{misc,terminfo,zoneinfo}
+install -d /usr/local/share/man/man{1,2,3,4,5,6,7,8}
+install -d /var/{lock,log,mail,run,spool}
+install -d /var/{opt,cache,lib/{misc,locate},local}
+install -d /opt/{bin,doc,include,info}
+install -d /opt/{lib,man/man{1,2,3,4,5,6,7,8}}
+cd /boot
+ln -s . boot</userinput></screen>
+
+<para>Directories are, by default, created with permission mode 755,
+but this is not desirable for all directories. In the commands above,
+two changes are made—one to the home directory of user
+<emphasis>root</emphasis>, and another to the directories for
+temporary files.</para>
+
+<para>The first mode change ensures that not just anybody can enter
+the <filename class="directory">/root</filename> directory—the same
+as a normal user would do with his or her home directory. The second
+mode change makes sure that any user can write to the <filename
+class="directory">/tmp</filename> and <filename
+class="directory">/var/tmp</filename> directories, but cannot remove
+other users' files from them. The latter is prohibited by the
+so-called <quote>sticky bit,</quote> the highest bit (1) in the 1777
+bit mask.</para>
+
+<sect2>
+<title>FHS Compliance Note</title>
+
+<para>The directory tree is based on the Filesystem Hierarchy Standard
+(FHS) standard (available at <ulink
+url="http://www.pathname.com/fhs/"/>). Besides the tree created above,
+this standard stipulates the existence of <filename
+class="directory">/usr/local/games</filename> and <filename
+class="directory">/usr/share/games</filename>.  We do not recommend
+these for a base system, however, feel free to make the system
+FHS-compliant.  The FHS is not precise as to the structure of the
+<filename class="directory">/usr/local/share</filename> subdirectory,
+so we created only the directories that are needed.</para>
+
+</sect2>
+
+</sect1>
+

Added: branches/cross-lfs/BOOK/chroot/raq2-chapter.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/raq2-chapter.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/raq2-chapter.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,20 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+<chapter id="chapter-chroot" xreflabel="If You Are Going to Chroot">
+<?dbhtml dir="chroot"?>
+<title>If You Are Going to Chroot</title>
+<?dbhtml filename="chapter.html"?>
+
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/util-linux.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/kernfs.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/chroot.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/changingowner.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="raq2/creatingdirs.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/createfiles.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/pwdgroup.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/devices.xml"/>
+
+</chapter>

Deleted: branches/cross-lfs/BOOK/chroot/revisedchroot.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/revisedchroot.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/revisedchroot.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -1,44 +0,0 @@
-<?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" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<sect1 id="ch-chroot-revisedchroot">
-<title>Cleaning Up</title>
-<?dbhtml filename="revisedchroot.html"?>
-
-<para>From now on, when reentering the chroot environment after
-exiting, use the following modified chroot command:</para>
-
-<screen><userinput>chroot "$LFS" /usr/bin/env -i \
-    HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
-    PATH=/bin:/usr/bin:/sbin:/usr/sbin \
-    /bin/bash --login</userinput></screen>
-
-<para>The reason for this is that, since the programs in <filename
-class="directory">/tools</filename> are no longer needed, the
-directory can be deleted to regain space. Before actually deleting the
-directory, exit from chroot and reenter it with the above command.
-Also, before removing <filename class="directory">/tools</filename>,
-tar it up and store it in a safe place in case another LFS system will
-be built.</para>
-
-<note><para>Removing <filename class="directory">/tools</filename>
-will also remove the temporary copies of Tcl, Expect, and DejaGNU
-which were used for running the toolchain tests. To use these programs
-later on, they will need to be recompiled and re-installed. The
-installation instructions are the same as in <xref
-linkend="chapter-temporary-tools"/>, apart from changing the prefix
-from <filename class="directory">/tools</filename> to <filename
-class="directory">/usr</filename>. The BLFS book discusses a slightly
-different approach to installing Tcl (see <ulink
-url="&blfs-root;"/>).</para></note>
-
-<para>The packages and patches stored in <filename
-class="directory">/sources</filename> can also be moved to a more
-usual location, such as <filename
-class="directory">/usr/src/packages</filename>. The entire directory
-can also be deleted if its contents have been burned to a CD.</para>
-
-</sect1>
-

Added: branches/cross-lfs/BOOK/chroot/sparc-chapter.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/sparc-chapter.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/sparc-chapter.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,20 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+<chapter id="chapter-chroot" xreflabel="If You Are Going to Chroot">
+<?dbhtml dir="chroot"?>
+<title>If You Are Going to Chroot</title>
+<?dbhtml filename="chapter.html"?>
+
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/util-linux.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/kernfs.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/chroot.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/changingowner.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/creatingdirs.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/createfiles.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/pwdgroup.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/devices.xml"/>
+
+</chapter>

Added: branches/cross-lfs/BOOK/chroot/sparc64-chapter.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/sparc64-chapter.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/sparc64-chapter.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,20 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+<chapter id="chapter-chroot" xreflabel="If You Are Going to Chroot">
+<?dbhtml dir="chroot"?>
+<title>If You Are Going to Chroot</title>
+<?dbhtml filename="chapter.html"?>
+
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/util-linux.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/kernfs.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/chroot.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/changingowner.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/creatingdirs.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/createfiles.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/pwdgroup.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/devices.xml"/>
+
+</chapter>

Deleted: branches/cross-lfs/BOOK/chroot/util-linux.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/util-linux.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/util-linux.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -1,63 +0,0 @@
-<?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" [
-  <!ENTITY % general-entities SYSTEM "../general.ent">
-  %general-entities;
-]>
-<sect1 id="ch-chroot-util-linux" role="wrap">
-<title>Util-linux-&util-linux-version;</title>
-<?dbhtml filename="util-linux.html"?>
-
-<indexterm zone="ch-chroot-util-linux">
-<primary sortas="a-Util-linux">Util-linux</primary>
-<secondary>chroot</secondary></indexterm>
-
-<sect2 role="package"><title/>
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../final-system/util-linux.xml" xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
-
-<segmentedlist>
-<segtitle>&buildtime;</segtitle>
-<segtitle>&diskspace;</segtitle>
-<seglistitem><seg>0.2 SBU</seg><seg>16 MB</seg></seglistitem>
-</segmentedlist>
-
-<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="../final-system/util-linux.xml" xpointer="xpointer(/sect1/sect2[1]/segmentedlist[2])"/>
-
-</sect2>
-
-<sect2 role="installation">
-<title>Installation of Util-linux</title>
-
-<para>Util-linux does not use the freshly installed headers and
-libraries from the <filename class="directory">/tools</filename>
-directory. This is fixed by altering the configure script:</para>
-
-<screen><userinput>sed -i 's@/usr/include@/tools/include at g' configure</userinput></screen>
-
-<para>Prepare Util-linux for compilation:</para>
-
-<screen><userinput>./configure</userinput></screen>
-
-<para>Compile some support routines:</para>
-
-<screen><userinput>make ARCH="" CPU="" -C lib</userinput></screen>
-
-<para>Since only a couple of the utilities contained in this package
-are needed, build only those:</para>
-
-<screen><userinput>make ARCH="" CPU="" -C mount mount umount
-make ARCH="" CPU="" -C text-utils more</userinput></screen>
-
-<para>This package does not come with a test suite.</para>
-
-<para>Copy these programs to the temporary tools directory:</para>
-
-<screen><userinput>cp mount/{,u}mount text-utils/more /tools/bin</userinput></screen>
-
-</sect2>
-
-<sect2 role="content"><title/>
-<para>Details on this package are located in <xref
-linkend="contents-util-linux" role="."/></para>
-</sect2>
-</sect1>
-

Added: branches/cross-lfs/BOOK/chroot/x86-chapter.xml
===================================================================
--- branches/cross-lfs/BOOK/chroot/x86-chapter.xml	2005-05-12 04:16:48 UTC (rev 5289)
+++ branches/cross-lfs/BOOK/chroot/x86-chapter.xml	2005-05-12 04:17:09 UTC (rev 5290)
@@ -0,0 +1,20 @@
+<?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" [
+  <!ENTITY % general-entities SYSTEM "../general.ent">
+  %general-entities;
+]>
+<chapter id="chapter-chroot" xreflabel="If You Are Going to Chroot">
+<?dbhtml dir="chroot"?>
+<title>If You Are Going to Chroot</title>
+<?dbhtml filename="chapter.html"?>
+
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/util-linux.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/kernfs.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/chroot.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/changingowner.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/creatingdirs.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/createfiles.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/pwdgroup.xml"/>
+<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="common/devices.xml"/>
+
+</chapter>




More information about the lfs-book mailing list