- Timestamp:
- 01/30/2005 10:36:17 AM (19 years ago)
- 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:
- 8bbebcc
- Parents:
- 4642c89
- Location:
- chapter04
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
chapter04/aboutlfs.xml
r4642c89 r155d6d1 10 10 <para>See testing</para> 11 11 12 <!--13 <para>Throughout this book the environment variable LFS will be used several14 times. It is paramount that this variable is always defined. It should be set15 to the mount point you chose for your LFS partition. Check that your LFS16 variable is set up properly with:</para>17 18 <screen><userinput>echo $LFS</userinput></screen>19 20 <para>Make sure the output shows the path to your LFS partition's mount21 point, which is <filename class="directory">/mnt/lfs</filename> if you22 followed our example. If the output is wrong, you can always set the variable23 with:</para>24 25 <screen><userinput>export LFS=/mnt/lfs</userinput></screen>26 27 <para>Having this variable set means that if you are told to run a command like28 <command>mkdir $LFS/tools</command>, you can type it literally. Your shell29 will replace <quote>$LFS</quote> with <quote>/mnt/lfs</quote> (or whatever30 you set the variable to) when it processes the command line.</para>31 32 <para>Don't forget to check that <quote>$LFS</quote> is set whenever you leave and33 reenter the environment (as when doing a <quote>su</quote> to root or another user).34 </para>35 -->36 37 12 </sect1> -
chapter04/aboutsbus.xml
r4642c89 r155d6d1 10 10 <para>See testing</para> 11 11 12 <!--13 <para>Most people would like to know beforehand approximately how long it14 takes to compile and install each package. But <quote>Linux from Scratch</quote> is built15 on so many different systems, it is not possible to give actual times that are16 anywhere near accurate: the biggest package (Glibc) won't take more than17 twenty minutes on the fastest systems, but will take something like three days18 on the slowest - no kidding. So instead of giving actual times, we've come up19 with the idea of using the <emphasis>Static Binutils Unit</emphasis>20 (abbreviated to <emphasis>SBU</emphasis>).</para>21 22 <para>It works like this: the first package you compile in this book is the23 statically linked Binutils in <xref linkend="chapter-temporary-tools"/>, and the time it24 takes to compile this package is what we call the <quote>Static Binutils25 Unit</quote> or <quote>SBU</quote>. All other compile times will be expressed26 relative to this time.</para>27 28 <para>For example, consider a particular package whose compilation time is 4.529 SBUs. This means that if on your system it took 10 minutes to compile and30 install the static Binutils, then you know it will take31 <emphasis>approximately</emphasis> 45 minutes to build this package.32 Fortunately, most build times are much shorter than the one of Binutils.</para>33 34 <para>Note that if the system compiler on your host is GCC-2 based, the SBUs35 listed may end up being somewhat understated. This is because the SBU is based36 on the very first package, compiled with the old GCC, while the rest of the37 system is compiled with the newer GCC-&gcc-version; which is known to be38 approximately 30% slower.</para>39 40 <para>Also note that SBUs don't work well for SMP-based machines. But if you're41 so lucky as to have multiple processors, chances are that your system is so fast42 that you won't mind.</para>43 44 <para>If you wish to see actual timings for specific machines, have a look at45 <ulink url="&lfs-root;~bdubbs/"/>.</para>46 -->47 48 12 </sect1> -
chapter04/abouttestsuites.xml
r4642c89 r155d6d1 10 10 <para>See testing</para> 11 11 12 <!--13 <para>Most packages provide a test suite. Running the test suite for a newly14 built package is generally a good idea, as it can provide a nice sanity check15 that everything compiled correctly. A test suite that passes its set of checks16 usually proves that the package is functioning as the developer intended. It17 does not, however, guarantee that the package is totally bug free.</para>18 19 <para>Some test suites are more important than others. For example, the test20 suites for the core toolchain packages - GCC, Binutils, and Glibc - are of21 the utmost importance due to their central role in a properly functioning22 system. But be warned, the test suites for GCC and Glibc can take a very long23 time to complete, especially on slower hardware.</para>24 25 <note><para>Experience has shown us that there is little to be gained from running26 the test suites in <xref linkend="chapter-temporary-tools"/>. There can be no27 escaping the fact that the host system always exerts some influence on the28 tests in that chapter, often causing weird and inexplicable failures. Not only29 that, the tools built in <xref linkend="chapter-temporary-tools"/> are30 temporary and eventually discarded. For the average reader of this book we31 recommend <emphasis>not</emphasis> to run the test suites in32 <xref linkend="chapter-temporary-tools"/>. The instructions for running those test33 suites are still provided for the benefit of testers and developers, but they34 are strictly optional for everyone else.</para></note>35 36 <para>A common problem when running the test suites for Binutils and GCC is37 running out of pseudo terminals (PTYs for short). The symptom is a very high38 number of failing tests. This can happen for several reasons, but the most39 likely cause is that the host system doesn't have the40 <emphasis>devpts</emphasis> file system set up correctly. We'll discuss this in41 more detail later on in <xref linkend="chapter-temporary-tools"/>.</para>42 43 <para>Sometimes package test suites will give false failures. You can44 consult the LFS Wiki at <ulink url="&wiki-root;"/> to verify that these45 failures are normal. This applies to all tests throughout the book.</para>46 -->47 48 12 </sect1> -
chapter04/addinguser.xml
r4642c89 r155d6d1 8 8 <?dbhtml filename="addinguser.html"?> 9 9 10 <!-- 11 <para>When logged in as <emphasis>root</emphasis>, making a single mistake 12 can damage or even wreck your system. Therefore we recommend that you 13 build the packages in this chapter as an unprivileged user. You could 14 of course use your own user name, but to make it easier to set up a clean 15 work environment we'll create a new user <emphasis>lfs</emphasis> as a 16 member of a new group (also named <emphasis>lfs</emphasis>) and 17 use this one during the installation process. As <emphasis>root</emphasis>, 18 issue the following commands to add the new user:</para> 19 --> 10 <para>Issue the following commands to add the new user:</para> 20 11 21 12 <screen><userinput>groupadd lfs 22 13 useradd -s /bin/bash -g lfs -m -k /dev/null lfs</userinput></screen> 23 14 24 <!--25 <para>The meaning of the switches:</para>26 27 <variablelist>28 <varlistentry>29 <term><parameter>-s /bin/bash</parameter></term>30 <listitem><para>This makes31 <command>bash</command> the default shell for user32 <emphasis>lfs</emphasis>.</para></listitem>33 </varlistentry>34 35 <varlistentry>36 <term><parameter>-g lfs</parameter></term>37 <listitem><para>This adds user <emphasis>lfs</emphasis> to group38 <emphasis>lfs</emphasis></para></listitem>39 </varlistentry>40 41 <varlistentry>42 <term><parameter>-m</parameter></term>43 <listitem><para>This creates a home44 directory for <emphasis>lfs</emphasis>.</para></listitem>45 </varlistentry>46 47 <varlistentry>48 <term><parameter>-k /dev/null</parameter></term>49 <listitem><para>This parameter50 prevents possible copying of files from a skeleton directory (default51 is <filename class="directory">/etc/skel</filename>) by changing the input location to52 the special null device.</para></listitem>53 </varlistentry>54 </variablelist>55 56 <para>If you want to be able to log in as <emphasis>lfs</emphasis>, then give57 <emphasis>lfs</emphasis> a password:</para>58 -->59 60 15 <screen><userinput>passwd lfs</userinput></screen> 61 62 <!--63 <para>and grant <emphasis>lfs</emphasis> full access to64 <filename class="directory">$LFS/tools</filename> by making65 <emphasis>lfs</emphasis> the directory owner:</para>66 -->67 16 68 17 <screen><userinput>chown lfs $LFS/tools</userinput></screen> 69 18 70 <!--71 <para>If you made a separate working directory as suggested, give user72 <emphasis>lfs</emphasis> ownership of this directory too:</para>73 -->74 75 19 <screen><userinput>chown lfs $LFS/sources</userinput></screen> 76 77 <!--78 <para>Next, login as user <emphasis>lfs</emphasis>. This can be done via a79 virtual console, through a display manager, or with the following substitute80 user command:</para>81 -->82 20 83 21 <screen><userinput>su - lfs</userinput></screen> 84 22 85 <!--86 <para>The <quote><parameter>-</parameter></quote> instructs <command>su</command> to87 start a <emphasis>login</emphasis> shell.</para>88 -->89 90 23 </sect1> -
chapter04/creatingtoolsdir.xml
r4642c89 r155d6d1 8 8 <?dbhtml filename="creatingtoolsdir.html"?> 9 9 10 <!--11 <para>All programs compiled in <xref linkend="chapter-temporary-tools"/> will be installed under <filename12 class="directory">$LFS/tools</filename> to keep them separate from the13 programs compiled in <xref linkend="chapter-building-system"/>. The programs compiled here are only14 temporary tools and won't be a part of the final LFS system and by keeping them15 in a separate directory, we can later easily throw them away. This also16 helps prevent them from ending up in your host's production directories17 (easy to do in <xref linkend="chapter-temporary-tools"/>), which could be a very bad thing.</para>18 19 <para>Later on you might wish to search through the binaries of your system to20 see what files they make use of or link against. To make this searching easier21 you may want to choose a unique name for the directory in which the temporary22 tools are stored. Instead of the simple <quote>tools</quote> you could use23 something like <quote>tools-for-lfs</quote>. However, you'll need to be careful24 to adjust all references to <quote>tools</quote> throughout the book -25 including those in any patches, notably the GCC Specs Patch.</para>26 27 <para>Create the required directory by running the following:</para>28 -->29 30 10 <screen><userinput>mkdir $LFS/tools</userinput></screen> 31 32 <!--33 <para>The next step is to create a <filename>/tools</filename> symlink on34 your <emphasis>host</emphasis> system. It will point to the directory we just created on the LFS35 partition:</para>36 -->37 11 38 12 <screen><userinput>ln -s $LFS/tools /</userinput></screen> 39 13 40 <!--41 <note><para>The above command is correct. The <command>ln</command> command42 has a few syntactic variations, so be sure to check the info page before43 reporting what you may think is an error.</para></note>44 45 <para>The created symlink enables us to compile our toolchain so that it always46 refers to <filename class="directory">/tools</filename>, meaning that the compiler, assembler47 and linker will work both in this chapter (when we are still using some tools48 from the host) <emphasis>and</emphasis> in the next (when we are <quote>chrooted</quote> to49 the LFS partition).</para>50 -->51 52 14 </sect1> -
chapter04/settingenviron.xml
r4642c89 r155d6d1 8 8 <?dbhtml filename="settingenvironment.html"?> 9 9 10 <!--11 <para>We're going to set up a good working environment by creating two new12 startup files for the <command>bash</command> shell. While logged in as13 user <emphasis>lfs</emphasis>, issue the following command to create a new14 <filename>.bash_profile</filename>:</para>15 -->16 17 10 <screen><userinput>cat > ~/.bash_profile << "EOF" 18 11 exec env -i HOME=$HOME TERM=$TERM PS1='\u:\w\$ ' /bin/bash 19 12 EOF</userinput></screen> 20 21 <!--22 <para>Normally, when you log on as user <emphasis>lfs</emphasis>,23 the initial shell is a <emphasis>login</emphasis> shell which reads the24 <filename>/etc/profile</filename> of your host (probably containing some25 settings of environment variables) and then <filename>.bash_profile</filename>.26 The <command>exec env -i ... /bin/bash</command> command in the latter file27 replaces the running shell with a new one with a completely empty environment,28 except for the HOME, TERM and PS1 variables. This ensures that no unwanted and29 potentially hazardous environment variables from the host system leak into our30 build environment. The technique used here is a little strange, but it achieves31 the goal of enforcing a clean environment.</para>32 33 <para>The new instance of the shell is a <emphasis>non-login</emphasis> shell,34 which doesn't read the <filename>/etc/profile</filename> or35 <filename>.bash_profile</filename> files, but reads the36 <filename>.bashrc</filename> file instead. Create this latter file now:</para>37 -->38 13 39 14 <screen><userinput>cat > ~/.bashrc << "EOF" … … 46 21 EOF</userinput></screen> 47 22 48 <!--49 <para>The <command>set +h</command> command turns off50 <command>bash</command>'s hash function. Normally hashing is a useful51 feature: <command>bash</command> uses a hash table to remember the52 full pathnames of executable files to avoid searching the PATH time and time53 again to find the same executable. However, we'd like the new tools to be54 used as soon as they are installed. By switching off the hash function, our55 <quote>interactive</quote> commands (<command>make</command>,56 <command>patch</command>, <command>sed</command>,57 <command>cp</command> and so forth) will always use58 the newest available version during the build process.</para>59 60 <para>Setting the user file-creation mask to 022 ensures that newly created61 files and directories are only writable for their owner, but readable and62 executable for anyone.</para>63 64 <para>The LFS variable should of course be set to the mount point you65 chose.</para>66 67 <para>The LC_ALL variable controls the localization of certain programs,68 making their messages follow the conventions of a specified country. If your69 host system uses a version of Glibc older than 2.2.4,70 having LC_ALL set to something other than <quote>POSIX</quote> or71 <quote>C</quote> during this chapter may cause trouble if you exit the chroot72 environment and wish to return later. By setting LC_ALL to <quote>POSIX</quote>73 (or <quote>C</quote>, the two are equivalent) we ensure that74 everything will work as expected in the chroot environment.</para>75 76 <para>We prepend <filename class="directory">/tools/bin</filename> to the standard PATH so77 that, as we move along through this chapter, the tools we build will get used78 during the rest of the building process.</para>79 80 <para>Finally, to have our environment fully prepared for building the81 temporary tools, source the just-created profile:</para>82 -->83 84 23 <screen><userinput>source ~/.bash_profile</userinput></screen> 85 24
Note:
See TracChangeset
for help on using the changeset viewer.