Changeset 81fd230 for chapter04


Ignore:
Timestamp:
02/19/2005 10:16:42 PM (19 years ago)
Author:
Gerard Beekmans <gerard@…>
Branches:
10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 6.1, 6.1.1, 6.3, 6.4, 6.5, 6.6, 6.7, 6.8, 7.0, 7.1, 7.2, 7.3, 7.4, 7.5, 7.5-systemd, 7.6, 7.6-systemd, 7.7, 7.7-systemd, 7.8, 7.8-systemd, 7.9, 7.9-systemd, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
3d31fc4
Parents:
2f9131f
Message:

Trunk is now identical to Testing

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@4648 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

Location:
chapter04
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • chapter04/aboutlfs.xml

    r2f9131f r81fd230  
    88<?dbhtml filename="aboutlfs.html"?>
    99
    10 <para>See testing</para>
     10<para>Throughout this book, the environment variable <envar>LFS</envar> will
     11be used several times. It is paramount that this variable is always defined.
     12It should be set to the mount point chosen for the LFS partition.
     13Check that the <envar>LFS</envar> variable is set up properly with:</para>
     14
     15<screen><userinput>echo $LFS</userinput></screen>
     16
     17<para>Make sure the output shows the path to the LFS partition's mount
     18point, which is <filename class="directory">/mnt/lfs</filename> if the
     19provided example was followed. If the output is incorrect, the
     20variable can be set with:</para>
     21
     22<screen><userinput>export LFS=/mnt/lfs</userinput></screen>
     23
     24<para>Having this variable set is beneficial in that commands such as
     25<command>mkdir $LFS/tools</command> can be typed literally. The shell
     26will automatically replace <quote>$LFS</quote> with
     27<quote>/mnt/lfs</quote> (or whatever the variable was set to) when it
     28processes the command line.</para>
     29
     30<para>Do not forget to check that <envar>$LFS</envar> is set whenever
     31you leave and reenter the current working environment (as when doing a
     32<quote>su</quote> to <emphasis>root</emphasis> or another user).</para>
    1133
    1234</sect1>
     35
  • chapter04/aboutsbus.xml

    r2f9131f r81fd230  
    88<?dbhtml filename="aboutsbus.html"?>
    99
    10 <para>See testing</para>
     10<para>Many people would like to know beforehand approximately how long
     11it takes to compile and install each package. Because Linux From
     12Scratch can be built on many different systems, it is impossible to
     13provide accurate time estimates.  The biggest package (Glibc) will
     14take approximately 20 minutes on the fastest systems, but could take
     15up to three days on slower systems! Instead of providing actual times,
     16the Static Build Unit (SBU) measure will be
     17used instead.</para>
     18
     19<para>The SBU measure works as follows. The first package to be compiled
     20from this book is the statically-linked Binutils in <xref
     21linkend="chapter-temporary-tools"/>.  The time it takes to compile
     22this package is what will be referred to as the Static Build Unit
     23or SBU. All other compile times will be expressed relative to this
     24time.</para>
     25
     26<para>For example, consider a package whose compilation time is 4.5
     27SBUs. This means that if a system took 10 minutes to compile and
     28install the static Binutils, it will take
     29<emphasis>approximately</emphasis> 45 minutes to build this example
     30package. Fortunately, most build times are shorter than the one
     31for Binutils.</para>
     32
     33<para>Please note that if the system compiler on the host is GCC-2.x based, the
     34SBUs listed may be somewhat understated. This is because the SBU is
     35based on the very first package, compiled with the old GCC, while the
     36rest of the system is compiled with the newer GCC-&gcc-version; (which is
     37known to be approximately 30 percent slower). SBUs are also not
     38highly accurate for Symmetric Multi-Processor (SMP)-based machines.</para>
     39
     40<para>To view actual timings for a number of specific machines, we recommend
     41<ulink url="&lfs-root;~bdubbs/"/>.</para>
     42
     43<para>In general, SBUs are not very accurate because they depend on many
     44factors, not just the GCC version. They are provided
     45here to give an estimate of how long it might take to
     46install a package, but the numbers can vary by as much as dozens of
     47minutes in some cases.</para>
    1148
    1249</sect1>
     50
  • chapter04/abouttestsuites.xml

    r2f9131f r81fd230  
    88<?dbhtml filename="abouttestsuites.html"?>
    99
    10 <para>See testing</para>
     10<para>Most packages provide a test suite. Running the test suite for a
     11newly built package is a good idea because it can provide a <quote>sanity
     12check</quote> indicating that everything compiled correctly. A test suite
     13that passes its set of checks usually proves that the package is
     14functioning as the developer intended. It does not, however, guarantee
     15that the package is totally bug free.</para>
     16
     17<para>Some test suites are more important than others. For example,
     18the test suites for the core toolchain packages&mdash;GCC, Binutils, and
     19Glibc&mdash;are of the utmost importance due to their central role in a
     20properly functioning system. The test suites for GCC and Glibc can
     21take a very long time to complete, especially on slower hardware, but
     22are strongly recommended.</para>
     23
     24<note><para>Experience has shown that there is little to be gained
     25from running the test suites in <xref
     26linkend="chapter-temporary-tools"/>. There can be no escaping the fact
     27that the host system always exerts some influence on the tests in that
     28chapter, often causing inexplicable failures. Because the tools built
     29in <xref linkend="chapter-temporary-tools"/> are temporary and
     30eventually discarded, we do not recommend running the test suites in
     31<xref linkend="chapter-temporary-tools"/> for the average reader. The
     32instructions for running those test suites are provided for the
     33benefit of testers and developers, but they are strictly
     34optional.</para></note>
     35
     36<para>A common issue with running the test suites for Binutils and GCC
     37is running out of pseudo terminals (PTYs). This can result in a high
     38number of failing tests. This may happen for several reasons, but the
     39most likely cause is that the host system does not have the
     40<systemitem class="filesystem">devpts</systemitem> file system set up
     41correctly. This issue is discussed in greater detail in <xref
     42linkend="chapter-temporary-tools"/>.</para>
     43
     44<para>Sometimes package test suites will give false failures. Consult
     45the LFS Wiki at <ulink url="&wiki-root;"/> to verify that these
     46failures are expected. This site is valid for all tests throughout this
     47book.</para>
    1148
    1249</sect1>
     50
  • chapter04/addinguser.xml

    r2f9131f r81fd230  
    88<?dbhtml filename="addinguser.html"?>
    99
    10 <para>Issue the following commands to add the new user:</para>
     10<para>When logged in as user <emphasis>root</emphasis>, making a
     11single mistake can damage or destroy a system. Therefore, we recommend
     12building the packages in this chapter as an unprivileged user. You
     13could use your own user name, but to make it easier to set up a clean
     14work environment, create a new user called <emphasis>lfs</emphasis> as
     15a member of a new group (also named <emphasis>lfs</emphasis>) and use
     16this user during the installation process. As
     17<emphasis>root</emphasis>, issue the following commands to add the new
     18user:</para>
    1119
    1220<screen><userinput>groupadd lfs
    1321useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen>
    1422
     23<para>The meaning of the command line options:</para>
     24
     25<variablelist>
     26<varlistentry>
     27<term><parameter>-s /bin/bash</parameter></term>
     28<listitem><para>This makes
     29<command>bash</command> the default shell for user
     30<emphasis>lfs</emphasis>.</para></listitem>
     31</varlistentry>
     32
     33<varlistentry>
     34<term><parameter>-g lfs</parameter></term>
     35<listitem><para>This option adds user <emphasis>lfs</emphasis> to group
     36<emphasis>lfs</emphasis>.</para></listitem>
     37</varlistentry>
     38
     39<varlistentry>
     40<term><parameter>-m</parameter></term>
     41<listitem><para>This creates a home
     42directory for <emphasis>lfs</emphasis>.</para></listitem>
     43</varlistentry>
     44
     45<varlistentry>
     46<term><parameter>-k /dev/null</parameter></term>
     47<listitem><para>This parameter
     48prevents possible copying of files from a skeleton directory (default
     49is <filename class="directory">/etc/skel</filename>) by changing the input location to
     50the special null device.</para></listitem>
     51</varlistentry>
     52
     53<varlistentry>
     54<term><parameter>lfs</parameter></term>
     55<listitem><para>This is the actual name for the created group and
     56user.</para></listitem>
     57</varlistentry>
     58</variablelist>
     59
     60<para>To log in as <emphasis>lfs</emphasis> (as opposed to switching
     61to user <emphasis>lfs</emphasis> when
     62logged in as <emphasis>root</emphasis>, which does not require the
     63<emphasis>lfs</emphasis> user to have a
     64password), give <emphasis>lfs</emphasis> a password:</para>
     65
    1566<screen><userinput>passwd lfs</userinput></screen>
     67
     68<para>Grant <emphasis>lfs</emphasis> full access to
     69<filename class="directory">$LFS/tools</filename> by making
     70<emphasis>lfs</emphasis> the directory owner:</para>
    1671
    1772<screen><userinput>chown lfs $LFS/tools</userinput></screen>
    1873
     74<para>If a separate working directory was created as suggested, give
     75user <emphasis>lfs</emphasis> ownership of this directory:</para>
     76
    1977<screen><userinput>chown lfs $LFS/sources</userinput></screen>
     78
     79<para>Next, login as user <emphasis>lfs</emphasis>. This can be done
     80via a virtual console, through a display manager, or with the
     81following substitute user command:</para>
    2082
    2183<screen><userinput>su - lfs</userinput></screen>
    2284
     85<para>The <quote><parameter>-</parameter></quote> instructs
     86<command>su</command> to start a login shell as opposed to a non-login
     87shell. The difference between these two types of shells can be found
     88in detail in the Bash man and info pages.</para>
     89
    2390</sect1>
     91
  • chapter04/creatingtoolsdir.xml

    r2f9131f r81fd230  
    88<?dbhtml filename="creatingtoolsdir.html"?>
    99
     10<para>All programs compiled in <xref
     11linkend="chapter-temporary-tools"/> will be installed under <filename
     12class="directory">$LFS/tools</filename> to keep them separate from the
     13programs compiled in <xref linkend="chapter-building-system"/>. The
     14programs compiled here are temporary tools and will not be a part of
     15the final LFS system.  By keeping these programs in a separate
     16directory, they can easily be discarded later after their use. This
     17also prevents these programs from ending up in the host production
     18directories (easy to do by accident in <xref
     19linkend="chapter-temporary-tools"/>).</para>
     20
     21<para>Create the required directory by running the following as
     22<emphasis>root</emphasis>:</para>
     23
    1024<screen><userinput>mkdir $LFS/tools</userinput></screen>
     25
     26<para>The next step is to create a <filename class="symlink">/tools</filename>
     27symlink on the host system.  This will point to the newly-created directory on
     28the LFS partition. Run this command as <emphasis>root</emphasis> as
     29well:</para>
    1130
    1231<screen><userinput>ln -s $LFS/tools /</userinput></screen>
    1332
     33<note><para>The above command is correct. The <command>ln</command>
     34command has a few syntactic variations, so be sure to check the info
     35and man pages before reporting what you may think is an
     36error.</para></note>
     37
     38<para>The created symlink enables the toolchain to be compiled so that
     39it always refers to <filename class="directory">/tools</filename>,
     40meaning that the compiler, assembler, and linker will work both in
     41this chapter (when we are still using some tools from the host) and in
     42the next (when we are <quote>chrooted</quote> to the LFS
     43partition).</para>
     44
    1445</sect1>
     46
  • chapter04/settingenviron.xml

    r2f9131f r81fd230  
    88<?dbhtml filename="settingenvironment.html"?>
    99
     10<para>Set up a good working environment by creating two new startup
     11files for the <command>bash</command> shell. While logged in as user
     12<emphasis>lfs</emphasis>, issue the
     13following command to create a new <filename>.bash_profile</filename>:</para>
     14
    1015<screen><userinput>cat &gt; ~/.bash_profile &lt;&lt; "EOF"
    1116<literal>exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash</literal>
    1217EOF</userinput></screen>
     18
     19<para>When logged on as user <emphasis>lfs</emphasis>, the
     20initial shell is usually a <emphasis>login</emphasis> shell which reads the
     21<filename>/etc/profile</filename> of the host (probably containing
     22some settings and environment variables) and then
     23<filename>.bash_profile</filename>. The <command>exec env
     24-i.../bin/bash</command> command in the
     25<filename>.bash_profile</filename> file replaces the running shell
     26with a new one with a completely empty environment, except for the
     27<envar>HOME</envar>, <envar>TERM</envar>, and
     28<envar>PS1</envar> variables. This ensures that no unwanted and
     29potentially hazardous environment variables from the host system leak
     30into the build environment. The technique used here achieves the goal
     31of ensuring a clean environment.</para>
     32
     33<para>The new instance of the shell is a <emphasis>non-login</emphasis>
     34shell, which does not read the <filename>/etc/profile</filename> or
     35<filename>.bash_profile</filename> files, but rather reads the
     36<filename>.bashrc</filename> file instead. Create the
     37<filename>.bashrc</filename> file now:</para>
    1338
    1439<screen><userinput>cat &gt; ~/.bashrc &lt;&lt; "EOF"
     
    2146EOF</userinput></screen>
    2247
     48<para>The <command>set +h</command> command turns off
     49<command>bash</command>'s hash function. Hashing is ordinarily a useful
     50feature&mdash;<command>bash</command> uses a hash table to remember the
     51full path of executable files to avoid searching the <envar>PATH</envar> time
     52and again to find the same executable. However, the new tools
     53should be used as soon as they are installed. By switching off the
     54hash function, the shell will always search the <envar>PATH</envar> when a program is
     55to be run. As such, the shell will find the newly compiled
     56tools in <filename class="directory">$LFS/tools</filename> as soon as
     57they are available without remembering a previous version of the same
     58program in a different location.</para>
     59
     60<para>Setting the user file-creation mask (umask) to 022 ensures that newly
     61created files and directories are only writable by their owner, but
     62are readable and executable by anyone (assuming default modes are used
     63by the open(2) system call, new files will end up with permission mode
     64644 and directories with mode 755).</para>
     65
     66<para>The <envar>LFS</envar> variable should be set to the
     67chosen mount point.</para>
     68
     69<para>The <envar>LC_ALL</envar> variable controls the
     70localization of certain programs, making their messages follow the
     71conventions of a specified country.  If the host system uses a version
     72of Glibc older than 2.2.4, having <envar>LC_ALL</envar> set to something other than
     73<quote>POSIX</quote> or <quote>C</quote> (during this chapter) may
     74cause issues if you exit the chroot environment and wish to return
     75later. Setting <envar>LC_ALL</envar> to <quote>POSIX</quote>
     76or <quote>C</quote> (the two are equivalent) ensures that
     77everything will work as expected in the chroot environment.</para>
     78
     79<para>By putting <filename class="directory">/tools/bin</filename>
     80ahead of the standard <envar>PATH</envar>, all the programs installed in <xref
     81linkend="chapter-temporary-tools"/> are picked up by the shell
     82immediately after their installation. This, combined with turning off
     83hashing, limits the risk that old programs from
     84the host are being used when they should not be used any
     85longer.</para>
     86
     87<para>Finally, to have the environment fully prepared for building the
     88temporary tools, source the just-created user profile:</para>
     89
    2390<screen><userinput>source ~/.bash_profile</userinput></screen>
    2491
    2592</sect1>
     93
Note: See TracChangeset for help on using the changeset viewer.