cvs commit: LFS/newxml/chapter07 bootscripts.xml

matthew at linuxfromscratch.org matthew at linuxfromscratch.org
Sat Mar 6 02:46:09 PST 2004


matthew     04/03/06 03:46:09

  Added:       newxml/chapter05 adjusting.xml
               newxml/chapter06 readjusting.xml
               newxml/chapter07 bootscripts.xml
  Removed:     newxml/appendixa autoconf-contents.xml autoconf-deps.xml
                        autoconf.xml automake-contents.xml
                        automake-deps.xml automake.xml bash-contents.xml
                        bash-deps.xml bash.xml binutils-contents.xml
                        binutils-deps.xml binutils.xml bison-contents.xml
                        bison-deps.xml bison.xml bzip2-contents.xml
                        bzip2-deps.xml bzip2.xml coreutils-contents.xml
                        coreutils-deps.xml coreutils.xml
                        dejagnu-contents.xml dejagnu-deps.xml dejagnu.xml
                        diffutils-contents.xml diffutils-deps.xml
                        diffutils.xml e2fsprogs-contents.xml
                        e2fsprogs-deps.xml e2fsprogs.xml ed-contents.xml
                        ed-deps.xml ed.xml expect-contents.xml
                        expect-deps.xml expect.xml file-contents.xml
                        file-deps.xml file.xml findutils-contents.xml
                        findutils-deps.xml findutils.xml flex-contents.xml
                        flex-deps.xml flex.xml gawk-contents.xml
                        gawk-deps.xml gawk.xml gcc-contents.xml
                        gcc-deps.xml gcc.xml gettext-contents.xml
                        gettext-deps.xml gettext.xml glibc-contents.xml
                        glibc-deps.xml glibc.xml grep-contents.xml
                        grep-deps.xml grep.xml groff-contents.xml
                        groff-deps.xml groff.xml grub-contents.xml
                        grub-deps.xml grub.xml gzip-contents.xml
                        gzip-deps.xml gzip.xml inetutils-contents.xml
                        inetutils-deps.xml inetutils.xml introduction.xml
                        kbd-contents.xml kbd-deps.xml kbd.xml
                        kernel-contents.xml kernel-deps.xml kernel.xml
                        less-contents.xml less-deps.xml less.xml
                        lfs-bootscripts-contents.xml
                        lfs-bootscripts-deps.xml lfs-bootscripts.xml
                        lfs-utils-contents.xml lfs-utils-deps.xml
                        lfs-utils.xml libtool-contents.xml libtool-deps.xml
                        libtool.xml m4-contents.xml m4-deps.xml m4.xml
                        make-contents.xml make-deps.xml make.xml
                        makedev-contents.xml makedev-deps.xml makedev.xml
                        man-contents.xml man-deps.xml
                        man-pages-contents.xml man-pages-deps.xml
                        man-pages.xml man.xml modutils-contents.xml
                        modutils-deps.xml modutils.xml ncurses-contents.xml
                        ncurses-deps.xml ncurses.xml net-tools-contents.xml
                        net-tools-deps.xml net-tools.xml patch-contents.xml
                        patch-deps.xml patch.xml perl-contents.xml
                        perl-deps.xml perl.xml procinfo-contents.xml
                        procinfo-deps.xml procinfo.xml procps-contents.xml
                        procps-deps.xml procps.xml psmisc-contents.xml
                        psmisc-deps.xml psmisc.xml sed-contents.xml
                        sed-deps.xml sed.xml shadow-contents.xml
                        shadow-deps.xml shadow.xml sysklogd-contents.xml
                        sysklogd-deps.xml sysklogd.xml
                        sysvinit-contents.xml sysvinit-deps.xml
                        sysvinit.xml tar-contents.xml tar-deps.xml tar.xml
                        tcl-contents.xml tcl-deps.xml tcl.xml
                        texinfo-contents.xml texinfo-deps.xml texinfo.xml
                        util-linux-contents.xml util-linux-deps.xml
                        util-linux.xml vim-contents.xml vim-deps.xml
                        vim.xml zlib-contents.xml zlib-deps.xml zlib.xml
               newxml/chapter01 acknowledgments.xml conventions.xml
                        version.xml
               newxml/chapter05 locking-glibc.xml util-linux.xml
               newxml/chapter06 adjustingtoolchain.xml lfs-bootscripts.xml
  Log:
  Reorganising the file structure to reflect current CVS HEAD.  I'll
  expect this to break things until an imminent followup commit is made - you have
  been warned! :)
  
  Revision  Changes    Path
  1.1                  LFS/newxml/chapter05/adjusting.xml
  
  Index: adjusting.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3CR3//EN" "http://www.docbook.org/xml/4.3CR3/docbookx.dtd">
  <sect1 xmlns:xi="http://www.w3.org/2003/XInclude" id="ch-tools-adjusting">
  <title>Adjusting the toolchain</title>
  <?dbhtml filename="adjusting.html"?>
  
  <para>Now that the temporary C libraries have been installed, we want all
  the tools compiled in the rest of this chapter to be linked against these
  libraries. To accomplish this, we need to adjust the linker and the compiler's
  specs file. Some people would say that it is <emphasis>"black magic juju below
  this line"</emphasis>, but it is really very simple.</para>
  
  <para>First install the adjusted linker (adjusted at the end of the first pass
  of Binutils) by running the following command from within
  the <filename class="directory">binutils-build</filename> directory:</para>
  
  <screen><userinput>make -C ld install</userinput></screen>
  
  <para>From this point onwards everything will link <emphasis>only</emphasis>
  against the libraries in <filename>/tools/lib</filename>.</para>
  
  <note><para>If you somehow missed the earlier warning to retain the Binutils
  source and build directories from the first pass or otherwise accidentally
  deleted them or just don't have access to them, don't worry, all is not lost.
  Just ignore the above command. The result is a small chance of the subsequent
  testing programs linking against libraries on the host. This is not ideal, but
  it's not a major problem. The situation is corrected when we install the
  second pass of Binutils a bit further on.</para></note>
  
  <para>Now that the adjusted linker is installed, you have to
  <emphasis>remove</emphasis> the Binutils build and source directories.</para>
  
  <para>The next thing to do is to amend our GCC specs file so that it points
  to the new dynamic linker. A simple sed will accomplish this:</para>
  
  <!-- Ampersands are needed to allow cut and paste -->
  
  <screen><userinput>SPECFILE=/tools/lib/gcc-lib/*/*/specs &&
  sed -e 's@ /lib/ld-linux.so.2@ /tools/lib/ld-linux.so.2 at g' \
      $SPECFILE > tempspecfile &&
  mv -f tempspecfile $SPECFILE &&
  unset SPECFILE</userinput></screen>
  
  <para>We recommend that you cut-and-paste the above rather than try and type it
  all in. Or you can edit the specs file by hand if you want to: just replace the
  occurrence of "/lib/ld-linux.so.2" with "/tools/lib/ld-linux.so.2". Be sure to
  visually inspect the specs file to verify the intended change was actually
  made.</para>
  
  <important><para>If you are working on a platform where the name of the dynamic
  linker is something other than <filename>ld-linux.so.2</filename>, you
  <emphasis>must</emphasis> substitute <filename>ld-linux.so.2</filename> with the
  name of your platform's dynamic linker in the above commands. Refer back to
  <xref linkend="ch-tools-toolchaintechnotes"/> if necessary.</para></important>
  
  <para>Lastly, there is a possibility that some include files from the host
  system have found their way into GCC's private include dir. This can happen
  because of GCC's "fixincludes" process which runs as part of the GCC build.
  We'll explain more about this further on in this chapter. For now, run the
  following commands to eliminate this possibility:</para>
  
  <screen><userinput>rm -f /tools/lib/gcc-lib/*/*/include/{pthread.h,bits/sigthread.h}</userinput></screen>
  
  
  <caution><para>It is imperative at this point to stop and ensure that the basic
  functions (compiling and linking) of the new toolchain are working as expected.
  For this we are going to perform a simple sanity check:</para>
  
  <screen><userinput>echo 'main(){}' > dummy.c
  cc dummy.c
  readelf -l a.out | grep ': /tools'</userinput></screen>
  
  <para>If everything is working correctly, there should be no errors, and the
  output of the last command will be (allowing for platform specific differences
  in dynamic linker name):</para>
  
  <blockquote><screen>[Requesting program interpreter: /tools/lib/ld-linux.so.2]</screen></blockquote>
  
  <para>Note especially that <filename class="directory">/tools/lib</filename>
  appears as the prefix of our dynamic linker.</para>
  
  <para>If you did not receive the output
  as shown above, or received no output at all, then something is seriously wrong.
  You will need to investigate and retrace your steps to find out where the
  problem is and correct it. There is no point in continuing until this is done.
  First, redo the sanity check using <command>gcc</command> instead of
  <command>cc</command>. If this works it means the
  <filename class="symlink">/tools/bin/cc</filename> symlink is missing. Revisit
  <xref linkend="ch-tools-gcc-pass1"/> and fix the symlink. Second, ensure your PATH
  is correct. You can check this by running <userinput>echo $PATH</userinput> and
  verifying that <filename class="directory">/tools/bin</filename> is at the head
  of the list. If the PATH is wrong it could mean you're not logged in as user
  <emphasis>lfs</emphasis> or something went wrong back in
  <xref linkend="ch-tools-settingenviron"/>. Third, something may have gone wrong with
  the specs file amendment above. In this case redo the specs file amendment
  ensuring to cut-and-paste the commands as was recommended.</para>
  
  <para>Once you are satisfied that all is well, clean up the test files:</para>
  
  <screen><userinput>rm dummy.c a.out</userinput></screen>
  </caution>
  
  
  </sect1>
  
  
  
  1.1                  LFS/newxml/chapter06/readjusting.xml
  
  Index: readjusting.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3CR3//EN" "http://www.docbook.org/xml/4.3CR3/docbookx.dtd">
  <sect1 xmlns:xi="http://www.w3.org/2003/XInclude" id="ch-system-readjusting">
  <title>Re-adjusting the toolchain</title>
  <?dbhtml filename="readjusting.html"?>
  
  <para>Now that the new and final C libraries have been installed, it's time to
  adjust our toolchain again. We'll adjust it so that it will link any newly
  compiled program against these new libraries. This is in fact the same thing we
  did in the "Adjusting" phase in the beginning of the previous chapter, even
  though it looks like the reverse: then we guided the chain from the host's
  <filename class="directory">/{,usr/}lib</filename> to the new
  <filename class="directory">/tools/lib</filename>, now we guide it from that
  same <filename class="directory">/tools/lib</filename>
  to the LFS's <filename class="directory">/{,usr/}lib</filename>.</para>
  
  <para>First we adjust the linker. For this we retained the
  source and build directories from the second pass over Binutils. Install the
  adjusted linker by running the following from within the
  <filename class="directory">binutils-build</filename> directory:</para>
  
  <screen><userinput>make -C ld INSTALL=/tools/bin/install install</userinput></screen>
  
  <note><para>If you somehow missed the earlier warning to retain the Binutils
  source and build directories from the second pass in
  <xref linkend="chapter-temporary-tools"/>, or otherwise accidentally deleted them or just
  don't have access to them, don't worry, all is not lost. Just ignore the above
  command. The result will be that the next package, Binutils, will link against
  the C libraries in <filename class="directory">/tools</filename> rather
  than in <filename class="directory">/{,usr/}lib</filename>. This is not ideal,
  however, our testing has shown that the resulting Binutils program binaries
  should be identical.</para></note>
  
  <para>From now on every compiled program will link <emphasis>only</emphasis>
  against the libraries in <filename>/usr/lib</filename> and
  <filename>/lib</filename>. The extra
  <emphasis>INSTALL=/tools/bin/install</emphasis> is needed because the Makefile
  created during the second pass still contains the reference to
  <filename>/usr/bin/install</filename>, which we obviously haven't installed yet.
  Some host distributions contain a <filename class="symlink">ginstall</filename>
  symbolic link which takes precedence in the Makefile and thus can cause a
  problem here. The above command takes care of this also.</para>
  
  <para>You can now remove the Binutils source and build directories.</para>
  
  <para>The next thing to do is to amend our GCC specs file so that it points
  to the new dynamic linker. Just like earlier on, we use a sed to accomplish
  this:</para>
  
  <!-- Ampersands are needed to allow cut and paste -->
  
  <screen><userinput>SPECFILE=/tools/lib/gcc-lib/*/*/specs &&
  sed -e 's@ /tools/lib/ld-linux.so.2@ /lib/ld-linux.so.2 at g' \
      $SPECFILE > newspecfile &&
  mv -f newspecfile $SPECFILE &&
  unset SPECFILE</userinput></screen>
  
  <para>Again, cutting and pasting the above is recommended. And just like
  before, it is a good idea to visually inspect the specs file to verify the
  intended change was actually made.</para>
  
  <important><para>If you are working on a platform where the name of the dynamic
  linker is something other than <filename>ld-linux.so.2</filename>, you
  <emphasis>must</emphasis> substitute <filename>ld-linux.so.2</filename> with the
  name of your platform's dynamic linker in the above commands. Refer back to
  <xref linkend="ch-tools-toolchaintechnotes"/> if necessary.</para></important>
  
  
  <caution><para>It is imperative at this point to stop and ensure that the
  basic functions (compiling and linking) of the adjusted toolchain are working
  as expected. For this we are going to perform a simple sanity check:</para>
  
  <screen><userinput>echo 'main(){}' > dummy.c
  cc dummy.c
  readelf -l a.out | grep ': /lib'</userinput></screen>
  
  <para>If everything is working correctly, there should be no errors, and the
  output of the last command will be (allowing for platform specific differences
  in dynamic linker name):</para>
  
  <blockquote><screen>[Requesting program interpreter: /lib/ld-linux.so.2]</screen></blockquote>
  
  <para>Note especially that <filename class="directory">/lib</filename> is now
  the prefix of our dynamic linker.</para>
  
  <para> If you did not receive the output
  as shown above, or received no output at all, then something is seriously wrong.
  You will need to investigate and retrace your steps to find out where the
  problem is and correct it. There is no point in continuing until this is done.
  Most likely something went wrong with the specs file amendment above.</para>
  
  <para>Once you are satisfied that all is well, clean up the test files:</para>
  
  <screen><userinput>rm dummy.c a.out</userinput></screen>
  </caution>
  
  
  </sect1>
  
  
  
  1.1                  LFS/newxml/chapter07/bootscripts.xml
  
  Index: bootscripts.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.3CR3//EN" "http://www.docbook.org/xml/4.3CR3/docbookx.dtd">
  <sect1 xmlns:xi="http://www.w3.org/2003/XInclude" id="ch-scripts-bootscripts" xreflabel="Bootscripts">
  <title>Installing LFS-Bootscripts-1.12</title>
  <?dbhtml filename="bootscripts.html"?>
  
  <para>The LFS-Bootscripts package contains a set of bootscripts.</para>
  
  <screen>Approximate build time:  0.1 SBU
  Required disk space:     0.3 MB</screen>
  
  <literallayout>Official download location for LFS-Bootscripts (1.12): 
  <ulink url="http://downloads.linuxfromscratch.org/"/></literallayout>
  
  <para>For its installation LFS-Bootscripts depends on: Bash, Coreutils.</para>
  
  
  
  <sect2>
  <title>Installation of LFS-Bootscripts</title>
  
  <para>Install the boot scripts simply by copying them to their
  destination:</para>
  
  <screen><userinput>cp -a rc.d sysconfig /etc</userinput></screen>
  
  <para>Make sure <emphasis>root</emphasis> is owner of the scripts:</para>
  
  <screen><userinput>chown -R root:root /etc/rc.d /etc/sysconfig</userinput></screen>
  
  </sect2>
  
  
  <sect2 id="contents-bootscripts"><title>Contents of LFS-bootscripts</title>
  
  <para><emphasis>Installed scripts</emphasis>: checkfs, cleanfs, functions,
  halt, ifdown, ifup, loadkeys, localnet, mountfs, mountproc, network, rc,
  reboot, sendsignals, setclock, swap, sysklogd and template</para>
  
  </sect2>
  
  
  <sect2><title>Short descriptions</title>
  
  <para>The <command>checkfs</command> script checks the file systems just
  before they are mounted (with the exception of journal and network based
  file systems).</para>
  
  <para>The <command>cleanfs</command> script removes files that shouldn't be
  preserved between reboots, such as those in <filename>/var/run/</filename> and
  <filename>/var/lock/</filename>. It re-creates <filename>/var/run/utmp</filename>
  and removes the possibly present <filename>/etc/nologin</filename>,
  <filename>/fastboot</filename> and <filename>/forcefsck</filename> files.</para>
  
  <para>The <command>functions</command> script contains functions shared among
  different scripts, such as error and status checking.</para>
  
  <para>The <command>halt</command> script halts the system.</para>
  
  <para>The <command>ifdown</command> and <command>ifup</command> scripts assist
  the network script with network devices.</para>
  
  <para>The <command>loadkeys</command> script loads the keymap table you
  specified as proper for your keyboard layout.</para>
  
  <para>The <command>localnet</command> script sets up the system's hostname and
  local loopback device.</para>
  
  <para>The <command>mountfs</command> script mounts all file systems that
  aren't marked <emphasis>noauto</emphasis> or aren't network based.</para>
  
  <para>The <command>mountproc</command> script is used to mount the proc
  file system.</para>
  
  <para>The <command>network</command> script sets up network interfaces, such
  as network cards, and sets up the default gateway where applicable.</para>
  
  <para>The <command>rc</command> script is the master runlevel control script.
  It is responsible for running all the other scripts one-by-one in a specific
  sequence.</para>
  
  <para>The <command>reboot</command> script reboots the system.</para>
  
  <para>The <command>sendsignals</command> script makes sure every process is
  terminated before the system reboots or halts.</para>
  
  <para>The <command>setclock</command> script resets the kernel clock to
  localtime in case the hardware clock isn't set to GMT time.</para>
  
  <para>The <command>swap</command> script enables and disables swap files and
  partitions.</para>
  
  <para>The <command>sysklogd</command> script starts and stops the system and
  kernel log daemons.</para>
  
  <para>The <command>template</command> script is a template you can use to
  create your own bootscripts for your other daemons.</para>
  
  </sect2>
  
  
  
  </sect1>
  
  
  



More information about the lfs-book mailing list