[7f1fcd8] | 1 | <chapter id="chapter06" xreflabel="Chapter 6">
|
---|
[6370fa6] | 2 | <title>Installing basic system software</title>
|
---|
[576e206] | 3 | <?dbhtml filename="chapter06.html" dir="chapter06"?>
|
---|
[6370fa6] | 4 |
|
---|
[d322394] | 5 |
|
---|
[3be4d97] | 6 | <sect1 id="ch-system-introduction">
|
---|
[d322394] | 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 |
|
---|
[5888299] | 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 |
|
---|
[d322394] | 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 |
|
---|
[bfa54edc] | 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 |
|
---|
[d322394] | 61 | </sect1>
|
---|
| 62 |
|
---|
| 63 |
|
---|
[3be4d97] | 64 | <sect1 id="ch-system-chroot">
|
---|
[d322394] | 65 | <title>Entering the chroot environment</title>
|
---|
| 66 | <?dbhtml filename="chroot.html" dir="chapter06"?>
|
---|
| 67 |
|
---|
| 68 | <para>It is time to enter the chroot environment in order to begin installing
|
---|
| 69 | the packages we need. Before you can chroot, however, you need to become
|
---|
| 70 | <emphasis>root</emphasis>, since only <emphasis>root</emphasis>
|
---|
| 71 | can execute the <userinput>chroot</userinput> command.</para>
|
---|
| 72 |
|
---|
| 73 | <para>Just like earlier, ensure the LFS environment variable is set up properly
|
---|
| 74 | by running <userinput>echo $LFS</userinput> and ensuring it shows the path to
|
---|
| 75 | your LFS partition's mount point, which is
|
---|
| 76 | <filename class="directory">/mnt/lfs</filename> if you followed our
|
---|
| 77 | example.</para>
|
---|
| 78 |
|
---|
| 79 | <para>Become <emphasis>root</emphasis> and run the following command
|
---|
| 80 | to enter the chroot environment:</para>
|
---|
| 81 |
|
---|
| 82 | <screen><userinput>chroot $LFS /tools/bin/env -i \
|
---|
| 83 | HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
|
---|
| 84 | PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
|
---|
[a195a6c] | 85 | /tools/bin/bash --login +h</userinput></screen>
|
---|
[d322394] | 86 |
|
---|
| 87 | <para>The <userinput>-i</userinput> option given to the
|
---|
| 88 | <userinput>env</userinput> command will clear all variables of the chroot
|
---|
| 89 | environment. After that, only the HOME, TERM, PS1 and PATH variables are
|
---|
| 90 | set again. The TERM=$TERM construct will set the TERM variable inside chroot
|
---|
| 91 | to the same value as outside chroot; this variable is needed for programs
|
---|
| 92 | like <userinput>vim</userinput> and <userinput>less</userinput> to operate
|
---|
| 93 | properly. If you need other variables present, such as CFLAGS or CXXFLAGS,
|
---|
| 94 | this is a good place to set them again.</para>
|
---|
| 95 |
|
---|
| 96 | <para>From this point on there's no need to use the LFS variable anymore,
|
---|
| 97 | because everything you do will be restricted to the LFS file system -- since
|
---|
| 98 | what the shell thinks is <filename class="directory">/</filename> is actually
|
---|
| 99 | the value of <filename class="directory">$LFS</filename>, which was passed to
|
---|
| 100 | the chroot command.</para>
|
---|
| 101 |
|
---|
| 102 | <para>Notice that <filename class="directory">/tools/bin</filename> comes
|
---|
| 103 | last in the PATH. This means that a temporary tool will not be used any more
|
---|
[17476c5] | 104 | as soon as its final version is installed. Well, at least when the shell
|
---|
[d322394] | 105 | doesn't remember the locations of executed binaries -- for this reason hashing
|
---|
[a195a6c] | 106 | is switched off by passing the <userinput>+h</userinput> option to
|
---|
| 107 | <userinput>bash</userinput>.</para>
|
---|
[d322394] | 108 |
|
---|
| 109 | <para>You have to make sure all the commands in the rest of this chapter and
|
---|
| 110 | in the following chapters are run from within the chroot environment.
|
---|
| 111 | If you ever leave this environment for any reason (rebooting for example),
|
---|
| 112 | you must remember to again enter chroot and mount the proc and devpts
|
---|
[ab3b93b] | 113 | file systems (discussed later) before continuing with the installations.</para>
|
---|
[d322394] | 114 |
|
---|
| 115 | <para>Note that the bash prompt will say "I have no name!" This is
|
---|
| 116 | normal, as the <filename>/etc/passwd</filename> file has not been
|
---|
| 117 | created yet.</para>
|
---|
| 118 |
|
---|
| 119 | </sect1>
|
---|
| 120 |
|
---|
| 121 |
|
---|
[3be4d97] | 122 | <sect1 id="ch-system-changingowner">
|
---|
[d322394] | 123 | <title>Changing ownership</title>
|
---|
| 124 | <?dbhtml filename="changingowner.html" dir="chapter06"?>
|
---|
| 125 |
|
---|
| 126 | <para>Right now the <filename class="directory">/tools</filename> directory
|
---|
| 127 | is owned by the user <emphasis>lfs</emphasis>, a user that exists only on your
|
---|
| 128 | host system. Although you will probably want to delete the
|
---|
| 129 | <filename class="directory">/tools</filename> directory once you have
|
---|
| 130 | finished your LFS system, you may want to keep it around, for example to
|
---|
| 131 | build more LFS systems. But if you keep the
|
---|
| 132 | <filename class="directory">/tools</filename> directory as it is, you end up
|
---|
| 133 | with files owned by a user ID without a corresponding account. This is
|
---|
| 134 | dangerous because a user account created later on could get this same user ID
|
---|
| 135 | and would suddenly own the <filename class="directory">/tools</filename>
|
---|
| 136 | directory and all the files therein, thus exposing these files to possible
|
---|
| 137 | malicious manipulation.</para>
|
---|
| 138 |
|
---|
| 139 | <para>To avoid this issue, you could add the <emphasis>lfs</emphasis> user to
|
---|
| 140 | your new LFS system later on when creating the <filename>/etc/passwd</filename>
|
---|
| 141 | file, taking care to assign it the same user and group IDs as on your host
|
---|
| 142 | system. Alternatively, you can (and the book assumes you do) assign the
|
---|
| 143 | contents of the <filename class="directory">/tools</filename> directory to
|
---|
| 144 | user <emphasis>root</emphasis> by running the following command:</para>
|
---|
| 145 |
|
---|
| 146 | <screen><userinput>chown -R 0:0 /tools</userinput></screen>
|
---|
| 147 |
|
---|
| 148 | <para>The command uses "0:0" instead of "root:root", because
|
---|
| 149 | <userinput>chown</userinput> is unable to resolve the name "root" until the
|
---|
| 150 | password file has been created.</para>
|
---|
| 151 |
|
---|
| 152 | </sect1>
|
---|
| 153 |
|
---|
| 154 |
|
---|
[3be4d97] | 155 | <sect1 id="ch-system-creatingdirs">
|
---|
[d322394] | 156 | <title>Creating directories</title>
|
---|
| 157 | <?dbhtml filename="creatingdirs.html" dir="chapter06"?>
|
---|
| 158 |
|
---|
| 159 | <para>Let's now create some structure in our LFS file system. Let's create
|
---|
| 160 | a directory tree. Issuing the following commands will create a more or less
|
---|
| 161 | standard tree:</para>
|
---|
| 162 |
|
---|
[b3adaba] | 163 | <screen><userinput>mkdir -p /{bin,boot,dev/{pts,shm},etc/opt,home,lib,mnt,proc}
|
---|
[d322394] | 164 | mkdir -p /{root,sbin,tmp,usr/local,var,opt}
|
---|
| 165 | for dirname in /usr /usr/local
|
---|
| 166 | do
|
---|
| 167 | mkdir $dirname/{bin,etc,include,lib,sbin,share,src}
|
---|
| 168 | ln -s share/{man,doc,info} $dirname
|
---|
[9c8916b] | 169 | mkdir $dirname/share/{doc,info,locale,man}
|
---|
| 170 | mkdir $dirname/share/{misc,terminfo,zoneinfo}
|
---|
[d322394] | 171 | mkdir $dirname/share/man/man{1,2,3,4,5,6,7,8}
|
---|
| 172 | done
|
---|
| 173 | mkdir /var/{lock,log,mail,run,spool}
|
---|
| 174 | mkdir -p /var/{tmp,opt,cache,lib/misc,local}
|
---|
| 175 | mkdir /opt/{bin,doc,include,info}
|
---|
| 176 | mkdir -p /opt/{lib,man/man{1,2,3,4,5,6,7,8}}</userinput></screen>
|
---|
| 177 |
|
---|
| 178 | <para>Directories are, by default, created with permission mode 755, but this
|
---|
| 179 | isn't desirable for all directories. We will make two changes: one to the home
|
---|
| 180 | directory of <emphasis>root</emphasis>, and another to the directories for
|
---|
| 181 | temporary files.</para>
|
---|
| 182 |
|
---|
| 183 | <screen><userinput>chmod 0750 /root
|
---|
| 184 | chmod 1777 /tmp /var/tmp</userinput></screen>
|
---|
| 185 |
|
---|
| 186 | <para>The first mode change ensures that not just anybody can enter the
|
---|
| 187 | <filename class="directory">/root</filename> directory -- the same
|
---|
| 188 | as a normal user would do with his or her home directory.
|
---|
| 189 | The second mode change makes sure that any user can write to the
|
---|
| 190 | <filename class="directory">/tmp</filename> and
|
---|
| 191 | <filename class="directory">/var/tmp</filename> directories, but
|
---|
| 192 | cannot remove other users' files from them. The latter is prohibited
|
---|
| 193 | by the so-called "sticky bit" -- the highest bit in the 1777 bit mask.</para>
|
---|
| 194 |
|
---|
| 195 | <sect2>
|
---|
| 196 | <title>FHS compliance note</title>
|
---|
| 197 |
|
---|
| 198 | <para>We have based our directory tree on the FHS standard (available at
|
---|
| 199 | <ulink url="http://www.pathname.com/fhs/"/>). Besides the above created
|
---|
| 200 | tree this standard stipulates the existence of
|
---|
| 201 | <filename class="directory">/usr/local/games</filename> and
|
---|
| 202 | <filename class="directory">/usr/share/games</filename>, but we don't
|
---|
| 203 | much like these for a base system. However, feel free to make your system
|
---|
| 204 | FHS-compliant. As to the structure of the
|
---|
| 205 | <filename class="directory">/usr/local/share</filename> subdirectory, the FHS
|
---|
| 206 | isn't precise, so we created here the directories that we think are needed.</para>
|
---|
| 207 |
|
---|
| 208 | </sect2>
|
---|
| 209 |
|
---|
| 210 | </sect1>
|
---|
| 211 |
|
---|
| 212 |
|
---|
[5e2cb65] | 213 | &c6-mountproc;
|
---|
[d322394] | 214 |
|
---|
| 215 |
|
---|
[3be4d97] | 216 | <sect1 id="ch-system-createfiles">
|
---|
[d322394] | 217 | <title>Creating essential symlinks</title>
|
---|
| 218 | <?dbhtml filename="createfiles.html" dir="chapter06"?>
|
---|
| 219 |
|
---|
| 220 | <para>Some programs hard-wire paths to programs which don't exist yet. In
|
---|
| 221 | order to satisfy these programs, we create a number of symbolic links which
|
---|
| 222 | will be replaced by real files throughout the course of this chapter when
|
---|
| 223 | we're installing all the software.</para>
|
---|
| 224 |
|
---|
| 225 | <screen><userinput>ln -s /tools/bin/{bash,cat,pwd,stty} /bin
|
---|
| 226 | ln -s /tools/bin/perl /usr/bin
|
---|
| 227 | ln -s /tools/lib/libgcc_s.so.1 /usr/lib
|
---|
| 228 | ln -s bash /bin/sh</userinput></screen>
|
---|
| 229 |
|
---|
| 230 | </sect1>
|
---|
| 231 |
|
---|
| 232 |
|
---|
[3be4d97] | 233 | <sect1 id="ch-system-pwdgroup">
|
---|
[b6f86141] | 234 | <title>Creating the passwd, group and log files</title>
|
---|
[d322394] | 235 | <?dbhtml filename="pwdgroup.html" dir="chapter06"?>
|
---|
| 236 |
|
---|
| 237 | <para>In order for <emphasis>root</emphasis> to be able to login and for the
|
---|
| 238 | name "root" to be recognized, there need to be relevant entries in the
|
---|
| 239 | <filename>/etc/passwd</filename> and <filename>/etc/group</filename> files.</para>
|
---|
| 240 |
|
---|
| 241 | <para>Create the <filename>/etc/passwd</filename> file by running the following
|
---|
| 242 | command:</para>
|
---|
| 243 |
|
---|
| 244 | <screen><userinput>cat > /etc/passwd << "EOF"</userinput>
|
---|
| 245 | root:x:0:0:root:/root:/bin/bash
|
---|
| 246 | <userinput>EOF</userinput></screen>
|
---|
| 247 |
|
---|
| 248 | <para>The actual password for <emphasis>root</emphasis> (the "x" here is just a
|
---|
| 249 | placeholder) will be set later.</para>
|
---|
| 250 |
|
---|
| 251 | <para>Create the <filename>/etc/group</filename> file by running the following
|
---|
| 252 | command:</para>
|
---|
| 253 |
|
---|
| 254 | <screen><userinput>cat > /etc/group << "EOF"</userinput>
|
---|
| 255 | root:x:0:
|
---|
| 256 | bin:x:1:
|
---|
| 257 | sys:x:2:
|
---|
| 258 | kmem:x:3:
|
---|
| 259 | tty:x:4:
|
---|
| 260 | tape:x:5:
|
---|
| 261 | daemon:x:6:
|
---|
| 262 | floppy:x:7:
|
---|
| 263 | disk:x:8:
|
---|
| 264 | lp:x:9:
|
---|
| 265 | dialout:x:10:
|
---|
| 266 | audio:x:11:
|
---|
| 267 | <userinput>EOF</userinput></screen>
|
---|
| 268 |
|
---|
| 269 | <para>The created groups aren't part of any standard -- they are the groups
|
---|
| 270 | that the MAKEDEV script in the next section uses. Besides the group "root", the
|
---|
| 271 | LSB (<ulink url="http://www.linuxbase.org"/>) recommends only a group "bin",
|
---|
| 272 | with a GID of 1, be present. All other group names and GIDs can be chosen
|
---|
| 273 | freely by the user, as well-written packages don't depend on GID numbers but
|
---|
| 274 | use the group's name.</para>
|
---|
| 275 |
|
---|
[15b6ed4] | 276 | <para>To get rid of the "I have no name!" prompt, we will start a new shell.
|
---|
| 277 | Since we installed a full Glibc in <xref linkend="chapter05"/>, and have just
|
---|
| 278 | created the <filename>/etc/passwd</filename> and
|
---|
| 279 | <filename>/etc/group</filename> files, user name and group name resolution
|
---|
| 280 | will now work.</para>
|
---|
[d322394] | 281 |
|
---|
| 282 | <screen><userinput>exec /tools/bin/bash --login +h</userinput></screen>
|
---|
| 283 |
|
---|
| 284 | <para>Note the use of the <userinput>+h</userinput> directive. This tells
|
---|
| 285 | <userinput>bash</userinput> not to use its internal path hashing. Without this
|
---|
| 286 | directive, <userinput>bash</userinput> would remember the paths to binaries it
|
---|
| 287 | has executed. Since we want to use our newly compiled binaries as soon as
|
---|
| 288 | they are installed, we turn off this function for the duration of this
|
---|
| 289 | chapter.</para>
|
---|
| 290 |
|
---|
[b6f86141] | 291 | <para>The <userinput>login</userinput>, <userinput>agetty</userinput> and
|
---|
| 292 | <userinput>init</userinput> programs (and some others) use a number of log
|
---|
| 293 | files to record information such as who was logged into the system and when.
|
---|
| 294 | These programs, however, won't write to the log files if they don't already
|
---|
| 295 | exist. Initialize the log files and give them their proper permissions:</para>
|
---|
| 296 |
|
---|
| 297 | <screen><userinput>touch /var/run/utmp /var/log/{btmp,lastlog,wtmp}
|
---|
| 298 | chmod 644 /var/run/utmp /var/log/{btmp,lastlog,wtmp}</userinput></screen>
|
---|
| 299 |
|
---|
| 300 | <para>The <filename>/var/run/utmp</filename> file records the users that are
|
---|
| 301 | currently logged in. The <filename>/var/log/wtmp</filename> file records all
|
---|
| 302 | logins and logouts. The <filename>/var/log/lastlog</filename> file records for
|
---|
| 303 | each user when he or she last logged in. The <filename>/var/log/btmp</filename>
|
---|
| 304 | file records the bad login attempts.</para>
|
---|
| 305 |
|
---|
[d322394] | 306 | </sect1>
|
---|
| 307 |
|
---|
| 308 |
|
---|
[4735209] | 309 | &c6-makedev;
|
---|
[5e2cb65] | 310 | &c6-kernel;
|
---|
[6babce5] | 311 | &c6-manpages;
|
---|
[abbd27a5] | 312 | &c6-glibc;
|
---|
[d322394] | 313 |
|
---|
| 314 |
|
---|
[3be4d97] | 315 | <sect1 id="ch-system-adjustingtoolchain">
|
---|
[d322394] | 316 | <title>Re-adjusting the toolchain</title>
|
---|
| 317 | <?dbhtml filename="adjustingtoolchain.html" dir="chapter06"?>
|
---|
| 318 |
|
---|
| 319 | <para>Now that the new C libraries have been installed, it's time to re-adjust
|
---|
| 320 | our toolchain. We'll adjust it so that it will link any newly compiled program
|
---|
| 321 | against the new C libraries. Basically, this is the reverse of what we did
|
---|
| 322 | in the "locking in" stage in the beginning of the previous chapter.</para>
|
---|
| 323 |
|
---|
| 324 | <para>The first thing to do is to adjust the linker. For this we retained the
|
---|
| 325 | source and build directories from the second pass over Binutils. Install the
|
---|
| 326 | adjusted linker by running the following from within the
|
---|
| 327 | <filename class="directory">binutils-build</filename> directory:</para>
|
---|
| 328 |
|
---|
| 329 | <screen><userinput>make -C ld INSTALL=/tools/bin/install install</userinput></screen>
|
---|
| 330 |
|
---|
| 331 | <note><para>If you somehow missed the earlier warning to retain the Binutils
|
---|
[15b6ed4] | 332 | source and build directories from the second pass in
|
---|
| 333 | <xref linkend="chapter05"/>, or otherwise accidentally deleted them or just
|
---|
| 334 | don't have access to them, don't worry, all is not lost. Just ignore the above
|
---|
| 335 | command. The result will be that the next package, Binutils, will link against
|
---|
| 336 | the Glibc libraries in <filename class="directory">/tools</filename> rather
|
---|
| 337 | than <filename class="directory">/usr</filename>. This is not ideal, however,
|
---|
| 338 | our testing has shown that the resulting Binutils program binaries should be
|
---|
[d322394] | 339 | identical.</para></note>
|
---|
| 340 |
|
---|
| 341 | <para>From now on every compiled program will link <emphasis>only</emphasis>
|
---|
| 342 | against the libraries in <filename>/usr/lib</filename> and
|
---|
| 343 | <filename>/lib</filename>. The extra
|
---|
| 344 | <userinput>INSTALL=/tools/bin/install</userinput> is needed because the Makefile
|
---|
| 345 | created during the second pass still contains the reference to
|
---|
| 346 | <filename>/usr/bin/install</filename>, which we obviously haven't installed yet.
|
---|
| 347 | Some host distributions contain a <filename class="symlink">ginstall</filename>
|
---|
| 348 | symbolic link which takes precedence in the Makefile and thus can cause a
|
---|
| 349 | problem here. The above command takes care of this also.</para>
|
---|
| 350 |
|
---|
| 351 | <para>You can now remove the Binutils source and build directories.</para>
|
---|
| 352 |
|
---|
| 353 | <para>The next thing to do is to amend our GCC specs file so that it points
|
---|
| 354 | to the new dynamic linker. Just like earlier on, we use a sed to accomplish
|
---|
| 355 | this:</para>
|
---|
| 356 |
|
---|
| 357 | <!-- Ampersands are needed to allow cut and paste -->
|
---|
| 358 |
|
---|
| 359 | <screen><userinput>SPECFILE=/tools/lib/gcc-lib/*/*/specs &&
|
---|
| 360 | sed -e 's@ /tools/lib/ld-linux.so.2@ /lib/ld-linux.so.2@g' \
|
---|
| 361 | $SPECFILE > newspecfile &&
|
---|
| 362 | mv -f newspecfile $SPECFILE &&
|
---|
| 363 | unset SPECFILE</userinput></screen>
|
---|
| 364 |
|
---|
| 365 | <para>Again, cutting and pasting the above is recommended. And just like
|
---|
[51fe215] | 366 | before, it is a good idea to visually inspect the specs file to verify the
|
---|
| 367 | intended change was actually made.</para>
|
---|
[d322394] | 368 |
|
---|
| 369 | <important><para>If you are working on a platform where the name of the dynamic
|
---|
| 370 | linker is something other than <filename>ld-linux.so.2</filename>, you
|
---|
| 371 | <emphasis>must</emphasis> substitute <filename>ld-linux.so.2</filename> with the
|
---|
| 372 | name of your platform's dynamic linker in the above commands. Refer back to
|
---|
[3be4d97] | 373 | <xref linkend="ch-tools-toolchaintechnotes"/> if necessary.</para></important>
|
---|
[d322394] | 374 |
|
---|
| 375 | <!-- HACK - Force some whitespace to appease tidy -->
|
---|
| 376 | <literallayout></literallayout>
|
---|
| 377 |
|
---|
| 378 | <caution><para>It is imperative at this point to stop and ensure that the
|
---|
| 379 | basic functions (compiling and linking) of the adjusted toolchain are working
|
---|
| 380 | as expected. For this we are going to perform a simple sanity check:</para>
|
---|
| 381 |
|
---|
| 382 | <screen><userinput>echo 'main(){}' > dummy.c
|
---|
[51fe215] | 383 | cc dummy.c
|
---|
[d322394] | 384 | readelf -l a.out | grep ': /lib'</userinput></screen>
|
---|
| 385 |
|
---|
| 386 | <para>If everything is working correctly, there should be no errors, and the
|
---|
| 387 | output of the last command will be:</para>
|
---|
| 388 |
|
---|
| 389 | <blockquote><screen>[Requesting program interpreter: /lib/ld-linux.so.2]</screen></blockquote>
|
---|
| 390 |
|
---|
[51fe215] | 391 | <para>(Of course allowing for platform specific differences in dynamic linker
|
---|
| 392 | name). Note especially that <filename class="directory">/lib</filename> now
|
---|
| 393 | appears as the prefix of our dynamic linker. If you did not receive the output
|
---|
| 394 | as shown above, or received no output at all, then something is seriously wrong.
|
---|
| 395 | You will need to investigate and retrace your steps to find out where the
|
---|
| 396 | problem is and correct it. There is no point in continuing until this is done.
|
---|
| 397 | Most likely something went wrong with the specs file amendment above.</para>
|
---|
[d322394] | 398 |
|
---|
| 399 | <para>Once you are satisfied that all is well, clean up the test files:</para>
|
---|
| 400 |
|
---|
| 401 | <screen><userinput>rm dummy.c a.out</userinput></screen>
|
---|
| 402 | </caution>
|
---|
| 403 |
|
---|
| 404 | <!-- HACK - Force some whitespace to appease tidy -->
|
---|
| 405 | <literallayout></literallayout>
|
---|
| 406 |
|
---|
| 407 | </sect1>
|
---|
| 408 |
|
---|
| 409 |
|
---|
[bc82645e] | 410 | &c6-binutils;
|
---|
[5e2cb65] | 411 | &c6-gcc;
|
---|
[d322394] | 412 |
|
---|
[bc82645e] | 413 | &c6-coreutils;
|
---|
[24380c7] | 414 | &c6-zlib;
|
---|
[0b6cb04] | 415 | &c6-lfs-utils;
|
---|
[abbd27a5] | 416 | &c6-findutils;
|
---|
[d7abb68] | 417 | &c6-gawk;
|
---|
[abbd27a5] | 418 | &c6-ncurses;
|
---|
| 419 | &c6-vim;
|
---|
[b42fa01] | 420 | &c6-m4;
|
---|
[abbd27a5] | 421 | &c6-bison;
|
---|
| 422 | &c6-less;
|
---|
| 423 | &c6-groff;
|
---|
[5e2cb65] | 424 | &c6-sed;
|
---|
| 425 | &c6-flex;
|
---|
| 426 | &c6-gettext;
|
---|
| 427 | &c6-nettools;
|
---|
[0b6cb04] | 428 | &c6-inetutils;
|
---|
[abbd27a5] | 429 | &c6-perl;
|
---|
| 430 | &c6-texinfo;
|
---|
| 431 | &c6-autoconf;
|
---|
| 432 | &c6-automake;
|
---|
| 433 | &c6-bash;
|
---|
| 434 | &c6-file;
|
---|
| 435 | &c6-libtool;
|
---|
| 436 | &c6-bzip2;
|
---|
[5c6ec43] | 437 | &c6-diffutils;
|
---|
[31bb453] | 438 | &c6-ed;
|
---|
[5df2845] | 439 | &c6-kbd;
|
---|
[abbd27a5] | 440 | &c6-e2fsprogs;
|
---|
| 441 | &c6-grep;
|
---|
[955533b] | 442 | &c6-grub;
|
---|
[abbd27a5] | 443 | &c6-gzip;
|
---|
[5e2cb65] | 444 | &c6-man;
|
---|
[abbd27a5] | 445 | &c6-make;
|
---|
| 446 | &c6-modutils;
|
---|
[31bb453] | 447 | &c6-patch;
|
---|
[abbd27a5] | 448 | &c6-procinfo;
|
---|
| 449 | &c6-procps;
|
---|
| 450 | &c6-psmisc;
|
---|
| 451 | &c6-shadowpwd;
|
---|
| 452 | &c6-sysklogd;
|
---|
| 453 | &c6-sysvinit;
|
---|
| 454 | &c6-tar;
|
---|
| 455 | &c6-utillinux;
|
---|
[d0dfce4] | 456 | &c6-gcc-2953;
|
---|
[d322394] | 457 |
|
---|
| 458 |
|
---|
[3be4d97] | 459 | <sect1 id="ch-system-revisedchroot">
|
---|
[d322394] | 460 | <title>Revised chroot command</title>
|
---|
| 461 | <?dbhtml filename="revisedchroot.html" dir="chapter06"?>
|
---|
| 462 |
|
---|
| 463 | <para>From now on when you exit the chroot environment and wish to re-enter
|
---|
| 464 | it, you should run the following modified chroot command:</para>
|
---|
| 465 |
|
---|
| 466 | <screen><userinput>chroot $LFS /usr/bin/env -i \
|
---|
| 467 | HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
|
---|
| 468 | PATH=/bin:/usr/bin:/sbin:/usr/sbin \
|
---|
| 469 | /bin/bash --login</userinput></screen>
|
---|
| 470 |
|
---|
| 471 | <para>The reason being there is no longer any need to use programs from the
|
---|
| 472 | <filename class="directory">/tools</filename> directory. However, we don't
|
---|
| 473 | want to remove the <filename class="directory">/tools</filename> directory
|
---|
| 474 | just yet. There is still some use for it towards the end of the book.</para>
|
---|
| 475 |
|
---|
| 476 | </sect1>
|
---|
| 477 |
|
---|
| 478 |
|
---|
[fd4c523] | 479 | &c6-bootscripts;
|
---|
[d322394] | 480 | &c6-aboutdebug;
|
---|
[6370fa6] | 481 |
|
---|
| 482 | </chapter>
|
---|
| 483 |
|
---|