<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<article>
  <title>Building Installation Media</title>

  <section>
    <title>Determining The Requirements</title>

    <para>The GNU/Linux System Architect Toolkit is designed to help people
    create their own distributions built from source code. Users of the
    Architect Toolkit decide which packages they need for their distribution.
    After downloading the source code onto a development system Architect
    takes care of turning the source into binary packages. Once all of the
    binary packages are created they need to be installed onto the target
    system. And that is the task of the installation media.</para>

    <para>The installation media is a bootable system that contains just
    enough functionality to get packages installed onto the target media. Such
    a limited system can be made small enough to fit on a couple of floppy
    disks or a CD-ROM. Floppy-based installation disks have the advantage of
    being easy to build and make changes to, but they are severely limited on
    storage capacity. CD-ROM's have plenty of storage space, but are more
    tedious to build and, in the case of non-rewritable disks, less forgiving
    of mistakes. We will explore both types of installation media starting
    with floppy disks and then moving into bootable CD-ROMs.</para>
  </section>

  <section>
    <title>Constructing The Root Filesystem</title>

    <para>Once the installation media has booted it really does not matter if
    it is a floppy diskset or a CD-ROM, it will have the same
    funcationality.</para>

    <section>
      <title>Make A List Of Necessary Commands</title>

      <para>To install a new system we need to:</para>

      <orderedlist>
        <listitem>
          <para>Partition disks - fdisk, sfdisk</para>
        </listitem>

        <listitem>
          <para>Mirror partitions - mdadm</para>
        </listitem>

        <listitem>
          <para>Create filesytems - mke2fs</para>
        </listitem>

        <listitem>
          <para>Mount filesystems - mount</para>
        </listitem>

        <listitem>
          <para>Fetch packages - ifconfig, tftp</para>
        </listitem>

        <listitem>
          <para>Install packages - tar, gz</para>
        </listitem>

        <listitem>
          <para>Install a boot loader - grub</para>
        </listitem>
      </orderedlist>

      <para>In addition we need a shell and any required library files.</para>
    </section>

    <section>
      <title>Build The Required Packages</title>

      <para>We will need to build the following packages:<itemizedlist>
          <listitem>
            <para>bash-mini</para>
          </listitem>

          <listitem>
            <para>coreutils</para>
          </listitem>

          <listitem>
            <para>e2fsprogs</para>
          </listitem>

          <listitem>
            <para>glibc</para>
          </listitem>

          <listitem>
            <para>grub (or grub-serial0)</para>
          </listitem>

          <listitem>
            <para>gzip</para>
          </listitem>

          <listitem>
            <para>mdadm (optional)</para>
          </listitem>

          <listitem>
            <para>net-tools (optional)</para>
          </listitem>

          <listitem>
            <para>netkit-tftp (optional)</para>
          </listitem>

          <listitem>
            <para>tar</para>
          </listitem>

          <listitem>
            <para>util-linux</para>
          </listitem>
        </itemizedlist></para>
    </section>

    <section>
      <title>Create A Staging Area</title>

      <para></para>
    </section>

    <section>
      <title>Extract The Required Files</title>

      <para></para>

      <itemizedlist>
        <listitem>
          <para>bash-mini - (extract all)</para>
        </listitem>

        <listitem>
          <para>coreutils - bin/cat, bin/chmod, bin/chown, bin/cp, bin/ln,
          bin/ls, bin/mkdir, bin/mknod, bin/mv, bin/rm, bin/stty,
          bin/sync</para>
        </listitem>

        <listitem>
          <para>e2fsprogs - sbin/mke2fs</para>
        </listitem>

        <listitem>
          <para>glibc - lib/ld-linux.so.2, lib/libc.so.6, lib/libdl.so.2,
          lib/librt.so.1, lib/libpthread.so.0</para>
        </listitem>

        <listitem>
          <para>grub (or grub-serial0) - boot, sbin/grub</para>
        </listitem>

        <listitem>
          <para>gzip - bin/gzip, bin/gunzip</para>
        </listitem>

        <listitem>
          <para>mdadm (optional) - sbin/mdadm</para>
        </listitem>

        <listitem>
          <para>net-tools (optional) - sbin/ifconfig sbin/route</para>
        </listitem>

        <listitem>
          <para>netkit-tftp (optional) - bin/tftp</para>
        </listitem>

        <listitem>
          <para>tar - bin/tar</para>
        </listitem>

        <listitem>
          <para>util-linux - bin/mount, bin/umount, sbin/fdisk,
          sbin/sfdisk</para>
        </listitem>
      </itemizedlist>
    </section>

    <section>
      <title>Create Configuration Files</title>

      <para>We need an a blank <filename>mtab</filename> and an
      <filename>fstab</filename> that looks like this:</para>

      <programlisting>/dev/ram0     /          ext2     defaults     0     0
proc          /proc      proc     defaults     0     0</programlisting>

      <para>We need an <filename>/sbin/init.sh</filename> that looks like
      this:</para>

      <programlisting>#!/bin/sh
PATH=/sbin:/bin
export PATH
mount -o remount,rw /
mount -a</programlisting>
    </section>

    <section>
      <title>Test The Files In The Staging Area</title>

      <para>Using the chroot command</para>
    </section>

    <section>
      <title>Create A Filesystem Image</title>

      <para>Using a loopback device</para>
    </section>
  </section>

  <section>
    <title>Building A Boot/Root Diskset</title>

    <para></para>

    <section>
      <title>Create A Boot Disk</title>

      <para></para>

      <procedure>
        <step>
          <para>Decide if the boot disk will be used on a machine that is set
          up with a serial console or if it will have a monitor and
          keyboard.</para>
        </step>

        <step>
          <para>Choose either the grub-serial0 package or the grub package
          depending on the decision made in the previous step.</para>
        </step>

        <step>
          <para>Extract the chosen package to a temporary location.</para>

          <programlisting><prompt>bash#</prompt> cd /var/tmp
<prompt>bash#</prompt> tar -zxf grub-serial0-0.95.i386.tar.gz</programlisting>
        </step>

        <step>
          <para>Create a second extended filesystem on a floppy disk and mount
          it on /media/floppy.</para>

          <programlisting><prompt>bash#</prompt> mke2fs -m0 /dev/fd0
<prompt>bash#</prompt> mount /dev/fd0 /media/floppy</programlisting>
        </step>

        <step>
          <para>Copy the entire /boot directory from the grub package onto the
          floppy.</para>

          <programlisting><prompt>bash#</prompt> cp -R /var/tmp/grub-serial0-0.95/boot /media/floppy</programlisting>
        </step>

        <step>
          <para>Copy a Linux kernel to the diskette.</para>

          <programlisting><prompt>bash#</prompt> cp /usr/src/linux/arch/i386/boot/zImage /media/floppy/boot/vmlinuz</programlisting>
        </step>

        <step>
          <para>Create an appropriate menu.lst file if desired.</para>

          <programlisting><prompt>bash#</prompt> cat &lt;&lt;"END-OF-FILE" &gt;/media/floppy/boot/grub/menu.lst
<prompt>&gt;</prompt> # GRUB configuration file for serial console operation
<prompt>&gt;</prompt> serial --unit=0 --speed=9600
<prompt>&gt;</prompt> terminal serial
<prompt>&gt;</prompt> default 0 
<prompt>&gt;</prompt> timeout 3 
<prompt>&gt;</prompt> title Serial Console Boot Disk
<prompt>&gt;</prompt> kernel (fd0)/boot/vmlinuz root=/dev/fd0 load_ramdisk=1 prompt_ramdisk=1 console=ttyS0
<prompt>&gt;</prompt> END-OF-FILE</programlisting>
        </step>

        <step>
          <para>Unmount the floppy.</para>

          <programlisting><prompt>bash#</prompt> umount /dev/fd0</programlisting>
        </step>

        <step>
          <para>Run the grub binary from the recently extracted grub
          package.</para>

          <programlisting><prompt>bash#</prompt> /var/tmp/grub-serial0-0.95/sbin/grub</programlisting>
        </step>

        <step>
          <para>Exectute the grub commands to set up the bootloader code on
          the floppy.</para>

          <programlisting><prompt>grub&gt;</prompt> root (fd0)
<prompt>grub&gt;</prompt> setup (fd0)</programlisting>
        </step>
      </procedure>
    </section>

    <section>
      <title>Write The Root Filesystem Image To Diskette</title>

      <para></para>
    </section>

    <section>
      <title>Test The Configuration</title>

      <para></para>
    </section>
  </section>

  <section>
    <title>Building A Bootable CD-ROM</title>

    <para></para>
  </section>
</article>