<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
  <!ENTITY % general-entities SYSTEM "../../general.ent">
  %general-entities;
]>

<sect1 id="ch-boot-createfiles">
  <?dbhtml filename="createfiles.html"?>

  <title>Creating Essential Symlinks</title>

  <para os="a">Some programs use hard-wired paths to files which do not exist
  yet. In order to satisfy these programs, create a number of symbolic
  links which will be replaced by real files throughout the course of
  the next chapter after the software has been installed.</para>

<screen os="b"><userinput>ln -sv /tools/bin/{bash,cat,echo,grep,login,pwd,stty} ${CLFS}/bin
ln -sv /tools/bin/file ${CLFS}/usr/bin
ln -sv /tools/lib/libgcc_s.so{,.1} ${CLFS}/usr/lib
ln -sv /tools/lib/libstdc++.so{.6,} ${CLFS}/usr/lib
sed -e 's/tools/usr/' /tools/lib/libstdc++.la &gt; ${CLFS}/usr/lib/libstdc++.la
ln -sv bash ${CLFS}/bin/sh
ln -sv /tools/sbin/init ${CLFS}/sbin
ln -sv /tools/etc/{login.{access,defs},limits} ${CLFS}/etc</userinput></screen>

  <variablelist os="c">
    <title>The purpose of each link:</title>

    <varlistentry os="c1">
      <term><parameter><filename>/bin/bash</filename></parameter></term>
      <listitem>
        <para>Many <command>bash</command> scripts specify
        <filename>/bin/bash</filename>.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c2">
      <term><parameter><filename>/bin/cat</filename></parameter></term>
      <listitem>
        <para>This pathname is hard-coded into Glibc's configure script.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c3">
      <term><parameter><filename>/bin/echo</filename></parameter></term>
      <listitem>
        <para>This is to satisfy one of the tests in Glibc's test suite, which
        expects <filename>/bin/echo</filename>.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c4">
      <term><parameter><filename>/bin/grep</filename></parameter></term>
      <listitem>
        <para>This to avoid a hard-coded
        <filename class="directory">/tools</filename> reference in Libtool.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c5">
      <term><parameter><filename>/bin/login</filename></parameter></term>
      <listitem>
        <para>The <command>agetty</command> program expects to find
        <command>login</command> in <filename class="directory">/bin</filename>.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c6">
      <term><parameter><filename>/bin/pwd</filename></parameter></term>
      <listitem>
        <para>Some <command>configure</command> scripts, particularly Glibc's,
        have this pathname hard-coded.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c7">
      <term><parameter><filename>/bin/stty</filename></parameter></term>
      <listitem>
        <para>This pathname is hard-coded into Expect, therefore it is needed
        for Binutils and GCC test suites to pass.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c8">
      <term><parameter><filename>/usr/bin/file</filename></parameter></term>
      <listitem>
        <para>Binutils' <command>configure</command> scripts specify this
        command location.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c9">
      <term><parameter><filename>/usr/lib/libgcc_s.so{,.1}</filename></parameter></term>
      <listitem>
        <para>Glibc needs this for the pthreads library to work.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c10">
      <term><parameter><filename>/usr/lib/libstdc++{,.6}</filename></parameter></term>
      <listitem>
        <para>This is needed by several tests in Glibc's test suite, as well as
        for C++ support in GMP.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c11">
      <term><parameter><filename>/usr/lib/libstdc++.la</filename></parameter></term>
      <listitem>
        <para>This prevents a <filename class="directory">/tools</filename>
        reference that would otherwise be in
        <filename>/usr/lib/libstdc++.la</filename> after GCC is installed.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c12">
      <term><parameter><filename>/bin/sh</filename></parameter></term>
      <listitem>
        <para>Many shell scripts hard-code <filename>/bin/sh</filename>.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c13">
      <term><parameter><filename>/sbin/init</filename></parameter></term>
      <listitem>
        <para>This is where the kernel expects to find <command>init</command>.</para>
      </listitem>
    </varlistentry>

    <varlistentry os="c14">
      <term><parameter><filename>/etc/{login.{access,defs},limits}</filename></parameter></term>
      <listitem>
        <para>These are configuration files used by Shadow and are expected to
        be found in <filename class="directory">/etc</filename>, for programs
        such as <command>login</command> and <command>su</command> to work.</para>
      </listitem>
    </varlistentry>

  </variablelist>

  <para os="d">Historically, Linux maintains a list of the mounted file systems
  in the file <filename>/etc/mtab</filename>. Modern kernels maintain this list
  internally and expose it to the user via the
  <filename class="directory">/proc</filename> filesystem. To satisfy utilities
  that expect the presence of <filename>/etc/mtab</filename>, create the
  following symbolic link:</para>

<screen os="e"><userinput>ln -sv /proc/self/mounts ${CLFS}/etc/mtab</userinput></screen>

</sect1>
