Ignore:
Timestamp:
05/03/2004 10:59:46 AM (20 years ago)
Author:
Matthew Burgess <matthew@…>
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.0, 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, v5_1, v5_1_1, 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:
0c43171, 2ec64b3, a4a675f
Parents:
287ea55
Message:
  • Merged newxml into HEAD

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • chapter06/chapter06.xml

    r287ea55 r673b0d8  
     1<?xml version="1.0" encoding="ISO-8859-1"?>
     2<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
     3  <!ENTITY % general-entities SYSTEM "../general.ent">
     4  %general-entities;
     5]>
    16<chapter id="chapter-building-system" xreflabel="Chapter 6">
     7<?dbhtml dir="chapter06"?>
    28<title>Installing basic system software</title>
    3 <?dbhtml filename="chapter06.html" dir="chapter06"?>
    4 
    5 
    6 <sect1 id="ch-system-introduction">
    7 <title>Introduction</title>
    8 <?dbhtml filename="introduction.html" dir="chapter06"?>
    9 
    10 <para>In this chapter we enter the building site, and start
    11 constructing our LFS system in earnest. That is, we chroot into
    12 our temporary mini Linux system, create some auxiliary things,
    13 and then start installing all the packages, one by one.</para>
    14  
    15 <para>The installation of all this software is pretty straightforward,
    16 and you will probably think it would be much shorter to give here
    17 the generic installation instructions and explain in full only the
    18 installation of those packages that require an alternate method.
    19 Although we agree with that, we nevertheless choose to give the
    20 full instructions for each and every package, simply to minimize
    21 the possibilities for mistakes.</para>
    22 
    23 <para>The key to learning what makes a Linux system work is to know
    24 what each package is used for and why the user (or the system) needs it.
    25 For this purpose for every installed package a summary of its content is
    26 given followed by concise descriptions of each program and library it
    27 installed.</para>
    28 
    29 <para>If you plan to use compiler optimizations in this chapter, take a look at
    30 the optimization hint at <ulink url="&hints-root;optimization.txt"/>. Compiler
    31 optimizations can make a program run slightly faster, but they may also cause
    32 compilation difficulties and even problems when running the program. If a
    33 package refuses to compile when using optimization, try to compile it without
    34 optimization and see if the problem goes away. Even if the package does compile
    35 when using optimization, there is the risk it may have been compiled incorrectly
    36 due to complex interactions between the code and build tools. In short, the
    37 small potential gains achieved in using compiler optimization are generally
    38 outweighed by the risk. First time builders of LFS are encouraged to build
    39 without custom optimizations. Your system will still be very fast and very
    40 stable at the same time.</para>
    41 
    42 <para>The order in which packages are installed in this chapter has
    43 to be strictly followed, to ensure that no program gets a path referring
    44 to <filename class="directory">/tools</filename> hard-wired into it.
    45 For the same reason, <emphasis>do not </emphasis> compile packages
    46 in parallel. Compiling in parallel may save you some time (especially on
    47 dual-CPU machines), but it could result in a program containing a
    48 hard-wired path to <filename class="directory">/tools</filename>,
    49 which will cause the program to stop working when that directory
    50 is removed.</para>
    51 
    52 <para>Before the installation instructions each installation page gives some
    53 information about the package: a concise description of what it contains, how
    54 long it will approximately take to build it, how much disk space it needs
    55 during this building process, the official download location of the package
    56 (in case you just want to update a few of them), and which other packages it
    57 needs in order to be built successfully. After the installation instructions
    58 follows a list of programs and libraries that the package installs, together
    59 with a series of short descriptions of these.</para>
    60 
    61 <para>If you wish to keep track of which package installs what files, you may
    62 want to use a package manager. For a general overview of package managers have
    63 a look at <ulink url="&blfs-root;view/cvs/introduction/pkgmgt.html"/>. And for
    64 a package management method specifically geared towards LFS see
    65 <ulink url="&hints-root;more_control_and_pkg_man.txt"/>.</para>
    66 
    67 </sect1>
    68 
    69 
    70 <sect1 id="ch-system-proc">
    71 <title>Mounting the proc and devpts file systems</title>
    72 <?dbhtml filename="proc.html" dir="chapter06"?>
    73 
    74 <para>In order for certain programs to function properly, the
    75 <emphasis>proc</emphasis> and <emphasis>devpts</emphasis> file systems must be
    76 available within the chroot environment. The proc file system is the process
    77 information pseudo file system through which the kernel provides information
    78 about the status of the system. And the devpts file system is nowadays the most
    79 common way pseudo terminals (PTYs) are implemented. Since kernel version 2.4, a
    80 file system can be mounted as many times and in as many places as you like,
    81 thus it's not a problem that these file systems are already mounted on your
    82 host system, especially so because they are virtual file systems.</para>
    83 
    84 <para>First become <emphasis>root</emphasis>, as only <emphasis>root</emphasis>
    85 can mount file systems in unusual places. Then check again that the LFS
    86 environment variable is set correctly by running <userinput>echo
    87 $LFS</userinput> and making sure it shows the path to your LFS partition's
    88 mount point, which is <filename class="directory">/mnt/lfs</filename> if you
    89 followed our example.</para>
    90 
    91 <para>Now make the mount points for these filesystems:</para>
    92 
    93 <screen><userinput>mkdir -p $LFS/{proc,dev/pts}</userinput></screen>
    94 
    95 <para>Mount the <emphasis>proc</emphasis> file system with:</para>
    96 
    97 <screen><userinput>mount proc $LFS/proc -t proc</userinput></screen>
    98 
    99 <para>And mount the <emphasis>devpts</emphasis> file system with:</para>
    100 
    101 <screen><userinput>mount devpts $LFS/dev/pts -t devpts</userinput></screen>
    102 
    103 <para>This last command might fail with an error like:</para>
    104 
    105 <blockquote><screen>filesystem devpts not supported by kernel</screen></blockquote>
    106 
    107 <para>The most likely cause for this is that your host system's kernel was
    108 compiled without support for the devpts file system (you can check which file
    109 systems your kernel supports with <command>cat /proc/filesystems</command>,
    110 for example). A few PTYs are needed to be able to run the suites for Binutils
    111 and GCC later on. If your kernel does not support devpts, do not worry, there
    112 is another way to get them working inside the chroot environment. We'll cover
    113 this shortly in the <xref linkend="ch-system-MAKEDEV"/> section.</para>
    114 
    115 <para>Remember that if for any reason you stop working on your LFS, and start
    116 again later, it's important to check that these file systems are mounted again
    117 before entering the chroot environment, otherwise problems could occur.</para>
    118 
    119 </sect1>
    120 
    121 
    122 <sect1 id="ch-system-chroot">
    123 <title>Entering the chroot environment</title>
    124 <?dbhtml filename="chroot.html" dir="chapter06"?>
    125 
    126 <para>It is time to enter the chroot environment in order to begin building
    127 and installing your final LFS system. Still as <emphasis>root</emphasis> run
    128 the following command to enter the small world that is, at the moment,
    129 populated with only the temporary tools:</para>
    130 
    131 <screen><userinput>chroot $LFS /tools/bin/env -i \
    132 &nbsp;&nbsp;&nbsp;&nbsp;HOME=/root  TERM=$TERM  PS1='\u:\w\$ ' \
    133 &nbsp;&nbsp;&nbsp;&nbsp;PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
    134 &nbsp;&nbsp;&nbsp;&nbsp;/tools/bin/bash +h</userinput></screen>
    135 
    136 <para>The <emphasis>-i</emphasis> option passed to the <command>env</command>
    137 command will clear all variables of the chroot environment. After that, only
    138 the HOME, TERM, PS1 and PATH variables are set again. The HOME variable is set
    139 mainly to prevent several small warnings during the configure runs of
    140 Diffutils, Grep and Grub. The TERM variable is set to make programs such as
    141 <command>less</command> and <command>vim</command>, that make use of the
    142 Ncurses package, operate properly -- the TERM=$TERM construct sets the TERM
    143 variable inside chroot to the same value as outside chroot. The main prompt
    144 (PS1) is set to "username:working-dir# " (since the "\$" becomes "#" for root).
    145 If you need other variables present, such as CFLAGS, CXXFLAGS or LDFLAGS, this
    146 is a good place to set them.</para>
    147 
    148 <para>From this point on there's no need to use the LFS variable anymore,
    149 because everything you do will be restricted to the LFS file system -- since
    150 what the shell thinks is <filename class="directory">/</filename> is actually
    151 the value of <filename class="directory">$LFS</filename>, which was passed to
    152 the chroot command.</para>
    153 
    154 <para>Notice that <filename class="directory">/tools/bin</filename> comes
    155 last in the PATH. This means that a temporary tool will not be used any more
    156 as soon as its final version is installed. Well, at least when the shell
    157 doesn't remember the locations of executed binaries -- for this reason hashing
    158 is switched off by passing the <emphasis>+h</emphasis> option to
    159 <command>bash</command>.</para>
    160 
    161 <para>You have to make sure all the commands in the rest of this chapter and
    162 in the following chapters are run from within the chroot environment.
    163 If you ever leave this environment for any reason (rebooting for example),
    164 you must remember to first mount the proc and devpts file systems (discussed
    165 in the previous section) <emphasis>and</emphasis> enter chroot again before
    166 continuing with the installations.</para>
    167 
    168 <para>Note that the bash prompt will say "I have no name!" This is normal, as
    169 the <filename>/etc/passwd</filename> file has not been created yet.</para>
    170 
    171 </sect1>
    172 
    173 
    174 <sect1 id="ch-system-changingowner">
    175 <title>Changing ownership</title>
    176 <?dbhtml filename="changingowner.html" dir="chapter06"?>
    177 
    178 <para>Right now the <filename class="directory">/tools</filename> directory
    179 is owned by the user <emphasis>lfs</emphasis>, a user that exists only on your
    180 host system. Although you will probably want to delete the
    181 <filename class="directory">/tools</filename> directory once you have
    182 finished your LFS system, you may want to keep it around, for example to
    183 build more LFS systems. But if you keep the
    184 <filename class="directory">/tools</filename> directory as it is, you end up
    185 with files owned by a user ID without a corresponding account. This is
    186 dangerous because a user account created later on could get this same user ID
    187 and would suddenly own the <filename class="directory">/tools</filename>
    188 directory and all the files therein, thus exposing these files to possible
    189 malicious manipulation.</para>
    190 
    191 <para>To avoid this issue, you could add the <emphasis>lfs</emphasis> user to
    192 your new LFS system later on when creating the <filename>/etc/passwd</filename>
    193 file, taking care to assign it the same user and group IDs as on your host
    194 system. Alternatively, you can (and the book assumes you do) assign the
    195 contents of the <filename class="directory">/tools</filename> directory to
    196 user <emphasis>root</emphasis> by running the following command:</para>
    197 
    198 <screen><userinput>chown -R 0:0 /tools</userinput></screen>
    199 
    200 <para>The command uses "0:0" instead of "root:root", because
    201 <userinput>chown</userinput> is unable to resolve the name "root" until the
    202 password file has been created.</para>
    203 
    204 </sect1>
    205 
    206 
    207 <sect1 id="ch-system-creatingdirs">
    208 <title>Creating directories</title>
    209 <?dbhtml filename="creatingdirs.html" dir="chapter06"?>
    210 
    211 <para>Let's now create some structure in our LFS file system. Let's create
    212 a directory tree. Issuing the following commands will create a more or less
    213 standard tree:</para>
    214  
    215 <screen><userinput>mkdir -p /{bin,boot,dev/{pts,shm},etc/opt,home,lib,mnt,proc}
    216 mkdir -p /{root,sbin,tmp,usr/local,var,opt}
    217 mkdir /usr/{bin,include,lib,sbin,share,src}
    218 ln -s share/{man,doc,info} /usr
    219 mkdir /usr/share/{doc,info,locale,man}
    220 mkdir /usr/share/{misc,terminfo,zoneinfo}
    221 mkdir /usr/share/man/man{1,2,3,4,5,6,7,8}
    222 mkdir /usr/local/{bin,etc,include,lib,sbin,share,src}
    223 ln -s share/{man,doc,info} /usr/local
    224 mkdir /usr/local/share/{doc,info,locale,man}
    225 mkdir /usr/local/share/{misc,terminfo,zoneinfo}
    226 mkdir /usr/local/share/man/man{1,2,3,4,5,6,7,8}
    227 mkdir /var/{lock,log,mail,run,spool}
    228 mkdir -p /var/{tmp,opt,cache,lib/misc,local}
    229 mkdir /opt/{bin,doc,include,info}
    230 mkdir -p /opt/{lib,man/man{1,2,3,4,5,6,7,8}}</userinput></screen>
    231 
    232 <para>Directories are, by default, created with permission mode 755, but this
    233 isn't desirable for all directories. We will make two changes: one to the home
    234 directory of <emphasis>root</emphasis>, and another to the directories for
    235 temporary files.</para>
    236 
    237 <screen><userinput>chmod 0750 /root
    238 chmod 1777 /tmp /var/tmp</userinput></screen>
    239 
    240 <para>The first mode change ensures that not just anybody can enter the
    241 <filename class="directory">/root</filename> directory -- the same
    242 as a normal user would do with his or her home directory.
    243 The second mode change makes sure that any user can write to the
    244 <filename class="directory">/tmp</filename> and
    245 <filename class="directory">/var/tmp</filename> directories, but
    246 cannot remove other users' files from them. The latter is prohibited
    247 by the so-called "sticky bit" -- the highest bit in the 1777 bit mask.</para>
    248 
    249 <sect2>
    250 <title>FHS compliance note</title>
    251 
    252 <para>We have based our directory tree on the FHS standard (available at
    253 <ulink url="http://www.pathname.com/fhs/"/>). Besides the above created
    254 tree this standard stipulates the existence of
    255 <filename class="directory">/usr/local/games</filename> and
    256 <filename class="directory">/usr/share/games</filename>, but we don't
    257 much like these for a base system. However, feel free to make your system
    258 FHS-compliant. As to the structure of the
    259 <filename class="directory">/usr/local/share</filename> subdirectory, the FHS
    260 isn't precise, so we created here the directories that we think are needed.</para>
    261 
    262 </sect2>
    263 
    264 </sect1>
    265 
    266 
    267 <sect1 id="ch-system-createfiles">
    268 <title>Creating essential symlinks</title>
    269 <?dbhtml filename="createfiles.html" dir="chapter06"?>
    270 
    271 <para>Some programs hard-wire paths to programs which don't exist yet. In
    272 order to satisfy these programs, we create a number of symbolic links which
    273 will be replaced by real files throughout the course of this chapter when
    274 we're installing all the software.</para>
    275 
    276 <screen><userinput>ln -s /tools/bin/{bash,cat,pwd,stty} /bin
    277 ln -s /tools/bin/perl /usr/bin
    278 ln -s /tools/lib/libgcc_s.so.1 /usr/lib
    279 ln -s bash /bin/sh</userinput></screen>
    280 
    281 </sect1>
    282 
    283 
    284 <sect1 id="ch-system-pwdgroup">
    285 <title>Creating the passwd, group and log files</title>
    286 <?dbhtml filename="pwdgroup.html" dir="chapter06"?>
    287 
    288 <para>In order for <emphasis>root</emphasis> to be able to login and for the
    289 name "root" to be recognized, there need to be relevant entries in the
    290 <filename>/etc/passwd</filename> and <filename>/etc/group</filename> files.</para>
    291 
    292 <para>Create the <filename>/etc/passwd</filename> file by running the following
    293 command:</para>
    294 
    295 <screen><userinput>cat &gt; /etc/passwd &lt;&lt; "EOF"</userinput>
    296 root:x:0:0:root:/root:/bin/bash
    297 <userinput>EOF</userinput></screen>
    298 
    299 <para>The actual password for <emphasis>root</emphasis> (the "x" here is just a
    300 placeholder) will be set later.</para>
    301 
    302 <para>Create the <filename>/etc/group</filename> file by running the following
    303 command:</para>
    304 
    305 <screen><userinput>cat &gt; /etc/group &lt;&lt; "EOF"</userinput>
    306 root:x:0:
    307 bin:x:1:
    308 sys:x:2:
    309 kmem:x:3:
    310 tty:x:4:
    311 tape:x:5:
    312 daemon:x:6:
    313 floppy:x:7:
    314 disk:x:8:
    315 lp:x:9:
    316 dialout:x:10:
    317 audio:x:11:
    318 <userinput>EOF</userinput></screen>
    319 
    320 <para>The created groups aren't part of any standard -- they are some of the
    321 groups that the <command>make_devices</command> script in the next section
    322 uses. The LSB (<ulink url="http://www.linuxbase.org/">Linux Standard
    323 Base</ulink>) recommends only that, beside the group "root" with a GID of 0, a
    324 group "bin" with a GID of 1 be present. All other group names and GIDs can
    325 be chosen freely by the system administrator, since well-written packages don't
    326 depend on GID numbers but use the group's name.</para>
    327 
    328 <para>To get rid of the "I have no name!" prompt, we will start a new shell.
    329 Since we installed a full Glibc in <xref linkend="chapter-temporary-tools"/>,
    330 and have just created the <filename>/etc/passwd</filename> and
    331 <filename>/etc/group</filename> files, user name and group name resolution
    332 will now work.</para>
    333 
    334 <screen><userinput>exec /tools/bin/bash +h</userinput></screen>
    335 
    336 <para>Note the use of the <emphasis>+h</emphasis> directive. This tells
    337 <command>bash</command> not to use its internal path hashing. Without this
    338 directive, <command>bash</command> would remember the paths to binaries it
    339 has executed. Since we want to use our newly compiled binaries as soon as
    340 they are installed, we turn off this function for the duration of this
    341 chapter.</para>
    342 
    343 <para>The <command>login</command>, <command>agetty</command> and
    344 <command>init</command> programs (and some others) use a number of log
    345 files to record information such as who was logged into the system and when.
    346 These programs, however, won't write to the log files if they don't already
    347 exist. Initialize the log files and give them their proper permissions:</para>
    348 
    349 <screen><userinput>touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
    350 chmod 644 /var/run/utmp /var/log/{btmp,lastlog,wtmp}</userinput></screen>
    351 
    352 <para>The <filename>/var/run/utmp</filename> file records the users that are
    353 currently logged in. The <filename>/var/log/wtmp</filename> file records all
    354 logins and logouts. The <filename>/var/log/lastlog</filename> file records for
    355 each user when he or she last logged in. The <filename>/var/log/btmp</filename>
    356 file records the bad login attempts.</para>
    357 
    358 </sect1>
    359 
    360 
    361 &c6-makedev;
    362 &c6-kernel-headers;
    363 &c6-manpages;
    364 &c6-glibc;
    365 
    366 
    367 <sect1 id="ch-system-readjusting">
    368 <title>Re-adjusting the toolchain</title>
    369 <?dbhtml filename="readjusting.html" dir="chapter06"?>
    370 
    371 <para>Now that the new and final C libraries have been installed, it's time to
    372 adjust our toolchain again. We'll adjust it so that it will link any newly
    373 compiled program against these new libraries. This is in fact the same thing we
    374 did in the "Adjusting" phase in the beginning of the previous chapter, even
    375 though it looks like the reverse: then we guided the chain from the host's
    376 <filename class="directory">/{,usr/}lib</filename> to the new
    377 <filename class="directory">/tools/lib</filename>, now we guide it from that
    378 same <filename class="directory">/tools/lib</filename>
    379 to the LFS's <filename class="directory">/{,usr/}lib</filename>.</para>
    380 
    381 <para>First we adjust the linker. For this we retained the
    382 source and build directories from the second pass over Binutils. Install the
    383 adjusted linker by running the following from within the
    384 <filename class="directory">binutils-build</filename> directory:</para>
    385 
    386 <screen><userinput>make -C ld INSTALL=/tools/bin/install install</userinput></screen>
    387 
    388 <note><para>If you somehow missed the earlier warning to retain the Binutils
    389 source and build directories from the second pass in
    390 <xref linkend="chapter-temporary-tools"/>, or otherwise accidentally deleted them or just
    391 don't have access to them, don't worry, all is not lost. Just ignore the above
    392 command. The result will be that the next package, Binutils, will link against
    393 the C libraries in <filename class="directory">/tools</filename> rather
    394 than in <filename class="directory">/{,usr/}lib</filename>. This is not ideal,
    395 however, our testing has shown that the resulting Binutils program binaries
    396 should be identical.</para></note>
    397 
    398 <para>From now on every compiled program will link <emphasis>only</emphasis>
    399 against the libraries in <filename>/usr/lib</filename> and
    400 <filename>/lib</filename>. The extra
    401 <emphasis>INSTALL=/tools/bin/install</emphasis> is needed because the Makefile
    402 created during the second pass still contains the reference to
    403 <filename>/usr/bin/install</filename>, which we obviously haven't installed yet.
    404 Some host distributions contain a <filename class="symlink">ginstall</filename>
    405 symbolic link which takes precedence in the Makefile and thus can cause a
    406 problem here. The above command takes care of this also.</para>
    407 
    408 <para>You must now remove the Binutils source and build directories. (This is
    409 important, as you should start the next section with a fresh untarring of the
    410 package.)</para>
    411 
    412 <para>The next thing to do is to amend our GCC specs file so that it points
    413 to the new dynamic linker. Just like earlier on, we use a sed to accomplish
    414 this:</para>
    415 
    416 <!-- Ampersands are needed to allow cut and paste -->
    417 
    418 <screen><userinput>SPECFILE=/tools/lib/gcc-lib/*/*/specs &amp;&amp;
    419 sed -e 's@ /tools/lib/ld-linux.so.2@ /lib/ld-linux.so.2@g' \
    420 &nbsp;&nbsp;&nbsp;&nbsp;$SPECFILE &gt; newspecfile &amp;&amp;
    421 mv -f newspecfile $SPECFILE &amp;&amp;
    422 unset SPECFILE</userinput></screen>
    423 
    424 <para>Again, cutting and pasting the above is recommended. And just like
    425 before, it is a good idea to visually inspect the specs file to verify the
    426 intended change was actually made.</para>
    427 
    428 <important><para>If you are working on a platform where the name of the dynamic
    429 linker is something other than <filename>ld-linux.so.2</filename>, you
    430 <emphasis>must</emphasis> substitute <filename>ld-linux.so.2</filename> with the
    431 name of your platform's dynamic linker in the above commands. Refer back to
    432 <xref linkend="tools-technicalnotes"/> if necessary.</para></important>
    433 
    434 <!-- HACK - Force some whitespace to appease tidy -->
    435 <literallayout></literallayout>
    436 
    437 <caution><para>It is imperative at this point to stop and ensure that the
    438 basic functions (compiling and linking) of the adjusted toolchain are working
    439 as expected. For this we are going to perform a simple sanity check:</para>
    440 
    441 <screen><userinput>echo 'main(){}' &gt; dummy.c
    442 cc dummy.c
    443 readelf -l a.out | grep ': /lib'</userinput></screen>
    444 
    445 <para>If everything is working correctly, there should be no errors, and the
    446 output of the last command will be (allowing for platform specific differences
    447 in dynamic linker name):</para>
    448 
    449 <blockquote><screen>[Requesting program interpreter: /lib/ld-linux.so.2]</screen></blockquote>
    450 
    451 <para>Note especially that <filename class="directory">/lib</filename> is now
    452 the prefix of our dynamic linker.</para>
    453 
    454 <para> If you did not receive the output
    455 as shown above, or received no output at all, then something is seriously wrong.
    456 You will need to investigate and retrace your steps to find out where the
    457 problem is and correct it. There is no point in continuing until this is done.
    458 Most likely something went wrong with the specs file amendment above.</para>
    459 
    460 <para>Once you are satisfied that all is well, clean up the test files:</para>
    461 
    462 <screen><userinput>rm dummy.c a.out</userinput></screen>
    463 </caution>
    464 
    465 <!-- HACK - Force some whitespace to appease tidy -->
    466 <literallayout></literallayout>
    467 
    468 </sect1>
    469 
    470 
    471 &c6-binutils;
    472 &c6-gcc;
    473 
    474 &c6-coreutils;
    475 &c6-zlib;
    476 &c6-lfs-utils;
    477 &c6-findutils;
    478 &c6-gawk;
    479 &c6-ncurses;
    480 &c6-vim;
    481 &c6-m4;
    482 &c6-bison;
    483 &c6-less;
    484 &c6-groff;
    485 &c6-sed;
    486 &c6-flex;
    487 &c6-gettext;
    488 &c6-nettools;
    489 &c6-inetutils;
    490 &c6-perl;
    491 &c6-texinfo;
    492 &c6-autoconf;
    493 &c6-automake;
    494 &c6-bash;
    495 &c6-file;
    496 &c6-libtool;
    497 &c6-bzip2;
    498 &c6-diffutils;
    499 &c6-ed;
    500 &c6-kbd;
    501 &c6-e2fsprogs;
    502 &c6-grep;
    503 &c6-grub;
    504 &c6-gzip;
    505 &c6-man;
    506 &c6-make;
    507 &c6-modutils;
    508 &c6-patch;
    509 &c6-procinfo;
    510 &c6-procps;
    511 &c6-psmisc;
    512 &c6-shadow;
    513 &c6-sysklogd;
    514 &c6-sysvinit;
    515 &c6-tar;
    516 &c6-utillinux;
    517 &c6-gcc-2953;
    518 
    519 
    520 <sect1 id="ch-system-aboutdebug">
    521 <title>About debugging symbols</title>
    522 <?dbhtml filename="aboutdebug.html" dir="chapter06"?>
    523 
    524 <para>Most programs and libraries are, by default, compiled with debugging
    525 symbols included (with <command>gcc</command>'s <emphasis>-g</emphasis>
    526 option). This means that, when debugging a program or library that was compiled
    527 with debugging information included, the debugger can give you not only memory
    528 addresses but also the names of the routines and variables.</para>
    529  
    530 <para>The inclusion of these debugging symbols, however, enlarges a program or
    531 library significantly. To get an idea of the amount of space these symbols
    532 occupy, have a look at the following:</para>
    533 
    534 <itemizedlist>
    535 
    536 <listitem><para>a bash binary
    537 with debugging symbols: 1200 KB</para></listitem>
    538 
    539 <listitem><para>a bash binary
    540 without debugging symbols: 480 KB</para></listitem>
    541 
    542 <listitem><para>Glibc and GCC files (/lib and /usr/lib)
    543 with debugging symbols: 87 MB</para></listitem>
    544 
    545 <listitem><para>Glibc and GCC files
    546 without debugging symbols: 16 MB</para></listitem>
    547 
    548 </itemizedlist>
    549 
    550 <para>Sizes may vary somewhat, depending on which compiler was used and which C
    551 library, but when comparing programs with and without debugging symbols the
    552 difference will generally be a factor between 2 and 5.</para>
    553 
    554 <para>As most people will probably never use a debugger on their system
    555 software, a lot of disk space can be regained by removing these symbols. For
    556 your convenience, the next section shows how to strip all debugging symbols
    557 from all programs and libraries. Information on other ways of optimizing your
    558 system can be found in the hint at <ulink
    559 url="&hints-root;optimization.txt"/>.</para>
    560 
    561 </sect1>
     9<?dbhtml filename="chapter06.html"?>
     10
     11
     12<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="introduction.xml"/>
     13
     14
     15<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="proc.xml"/>
     16
     17
     18<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="chroot.xml"/>
     19
     20
     21<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="changingowner.xml"/>
     22
     23
     24<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="creatingdirs.xml"/>
     25
     26
     27<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="createfiles.xml"/>
     28
     29
     30<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="pwdgroup.xml"/>
     31
     32
     33<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="makedev.xml"/>
     34
     35
     36<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="kernel-headers.xml"/>
     37
     38
     39<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="man-pages.xml"/>
     40
     41
     42<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="glibc.xml"/>
     43
     44
     45
     46
     47<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="readjusting.xml"/>
     48
     49
     50<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="binutils.xml"/>
     51
     52
     53<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gcc.xml"/>
     54
     55
     56
     57<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="coreutils.xml"/>
     58
     59
     60<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="zlib.xml"/>
     61
     62
     63<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="mktemp.xml"/>
     64
     65
     66<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="iana-etc.xml"/>
     67
     68
     69<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="findutils.xml"/>
     70
     71
     72<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gawk.xml"/>
     73
     74
     75<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="ncurses.xml"/>
     76
     77
     78<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="vim.xml"/>
     79
     80
     81<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="m4.xml"/>
     82
     83
     84<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="bison.xml"/>
     85
     86
     87<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="less.xml"/>
     88
     89
     90<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="groff.xml"/>
     91
     92
     93<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="sed.xml"/>
     94
     95
     96<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="flex.xml"/>
     97
     98
     99<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gettext.xml"/>
     100
     101
     102<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="net-tools.xml"/>
     103
     104
     105<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="inetutils.xml"/>
     106
     107
     108<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="perl.xml"/>
     109
     110
     111<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="texinfo.xml"/>
     112
     113
     114<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="autoconf.xml"/>
     115
     116
     117<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="automake.xml"/>
     118
     119
     120<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="bash.xml"/>
     121
     122
     123<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="file.xml"/>
     124
     125
     126<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="libtool.xml"/>
     127
     128
     129<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="bzip2.xml"/>
     130
     131
     132<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="diffutils.xml"/>
     133
     134
     135<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="ed.xml"/>
     136
     137
     138<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="kbd.xml"/>
     139
     140
     141<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="e2fsprogs.xml"/>
     142
     143
     144<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="grep.xml"/>
     145
     146
     147<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="grub.xml"/>
     148
     149
     150<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gzip.xml"/>
     151
     152
     153<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="man.xml"/>
     154
     155
     156<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="make.xml"/>
     157
     158
     159<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="modutils.xml"/>
     160
     161
     162<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="patch.xml"/>
     163
     164
     165<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="procinfo.xml"/>
     166
     167
     168<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="procps.xml"/>
     169
     170
     171<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="psmisc.xml"/>
     172
     173
     174<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="shadow.xml"/>
     175
     176
     177<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="sysklogd.xml"/>
     178
     179
     180<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="sysvinit.xml"/>
     181
     182
     183<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="tar.xml"/>
     184
     185
     186<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="util-linux.xml"/>
     187
     188
     189<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="gcc-2953.xml"/>
     190
     191
     192
     193
     194<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="aboutdebug.xml"/>
    562195
    563196
    564197<sect1 id="ch-system-strippingagain">
    565198<title>Stripping again</title>
    566 <?dbhtml filename="strippingagain.html" dir="chapter06"?>
     199<?dbhtml filename="strippingagain.html"?>
    567200
    568201<para>If you are not a programmer and don't plan to do any debugging on your
     
    586219
    587220<screen><userinput>chroot $LFS /tools/bin/env -i \
    588 &nbsp;&nbsp;&nbsp;&nbsp;HOME=/root  TERM=$TERM PS1='\u:\w\$ ' \
    589 &nbsp;&nbsp;&nbsp;&nbsp;PATH=/bin:/usr/bin:/sbin:/usr/sbin \
    590 &nbsp;&nbsp;&nbsp;&nbsp;/tools/bin/bash</userinput></screen>
     221    HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
     222    PATH=/bin:/usr/bin:/sbin:/usr/sbin \
     223    /tools/bin/bash --login</userinput></screen>
    591224
    592225<para>Now you can safely strip the binaries and libraries:</para>
    593226
    594227<screen><userinput>/tools/bin/find /{,usr/}{bin,lib,sbin} -type f \
    595 &nbsp;&nbsp;&nbsp;-exec /tools/bin/strip --strip-debug '{}' ';'</userinput></screen>
     228   -exec /tools/bin/strip --strip-debug '{}' ';'</userinput></screen>
    596229
    597230<para>A large number of files will be reported as having their file format not
     
    608241
    609242
    610 <sect1 id="ch-system-revisedchroot">
    611 <title>Cleaning up</title>
    612 <?dbhtml filename="revisedchroot.html" dir="chapter06"?>
    613 
    614 <para>From now on, when you exit the chroot environment and wish to reenter
    615 it, you should use the following modified chroot command:</para>
    616 
    617 <screen><userinput>chroot $LFS /usr/bin/env -i \
    618 &nbsp;&nbsp;&nbsp;&nbsp;HOME=/root  TERM=$TERM  PS1='\u:\w\$ ' \
    619 &nbsp;&nbsp;&nbsp;&nbsp;PATH=/bin:/usr/bin:/sbin:/usr/sbin \
    620 &nbsp;&nbsp;&nbsp;&nbsp;/bin/bash</userinput></screen>
    621 
    622 <para>The reason for this is that, since the programs in <filename
    623 class="directory">/tools</filename> are no longer needed, you may want to
    624 delete the whole directory and regain the space. Before actually deleting the
    625 directory, exit from chroot and reenter it with the above command. Also, before
    626 removing <filename class="directory">/tools</filename>, you may want to tar it
    627 up and store it in a safe place, in case you want to build another LFS system
    628 soon.</para>
    629 
    630 <note><para>Removing <filename class="directory">/tools</filename> will also
    631 remove the temporary copies of Tcl, Expect and DejaGnu, which were used for
    632 running the toolchain tests. If you want to use these programs later on, you
    633 will need to recompile and re-install them. The installation instructions are
    634 the same as in <xref linkend="chapter-temporary-tools"/>, apart from changing
    635 the prefix from <emphasis>/tools</emphasis> to <emphasis>/usr</emphasis>. The
    636 BLFS book discusses a slightly different approach to installing Tcl, see <ulink
    637 url="&blfs-root;"/>.</para></note>
    638 
    639 <para>You may also want to move the packages and patches stored in <filename
    640 class="directory">/sources</filename> to a more usual location, such as
    641 <filename class="directory">/usr/src/packages</filename>, and remove the
    642 directory -- or simply delete the whole directory if you've burned its contents
    643 on a CD).</para>
    644 
    645 </sect1>
     243<xi:include xmlns:xi="http://www.w3.org/2003/XInclude" href="revisedchroot.xml"/>
    646244
    647245</chapter>
    648 
Note: See TracChangeset for help on using the changeset viewer.