
Using Debian From Scratch

John Goerzen

   PLEASE NOTE: THIS DOCUMENTATION IS NOT YET ANYWHERE NEAR
   FINISHED.

   FIXME: add copyright here
     _________________________________________________________

   Table of Contents
   1. Introduction to DFS

        1.1. DFS Features
        1.2. Getting DFS
        1.3. History of DFS

   2. Booting DFS

        2.1. Booting on i386 (PC)
        2.2. Booting on Alpha
        2.3. Booting on PowerPC
        2.4. Booting a Kernel
        2.5. Selecting CD-ROM device
        2.6. Detecting Hardware
        2.7. Enabling Ethernet

              2.7.1. Wireless Networking

        2.8. Dialup with PPP

   3. Installation
   A. Command Reference

        dfsbuild -- Generate custom Debian From Scratch CD images

   B. Links to Related Resources
     _________________________________________________________

Chapter 1. Introduction to DFS

   Welcome to Debian From Scratch (DFS). DFS is really two
   systems: 1) a bootable CD for repairing Linux systems or
   installing Debian; and 2) the program that generates the CDs
   that are used for #1. Most of this manual focuses on #1. A
   wide variety of DFS CDs can be made using the DFS build tools.
   This manual will refer to CDs made using the default
   configuration.
     _________________________________________________________

1.1. DFS Features

   You can expect the following from your DFS CD:

     * Bootable CD featuring the GNU Grub bootloader. Can be used
       to boot hard disk partitions even if no hard disk
       bootloader is present.
     * Kernel and userland support for all major filesystems,
       including ext2, ext3, JFS, XFS, ReiserFS, FAT, VFAT, NTFS,
       ISO9660, CramFS, tmpfs, and more. Userland support for
       Reiser4.
     * Kernel and userland support for different disk layout
       schemes including standard partitioning, Logical Volume
       Manager 2 (LVM2), software RAID, etc.
     * Full recovery tools runnable directly from CD, including:
          + Filesystem utilities for all major filesystems,
            including undeletion tools for ext2
          + Partition editors (fdisk, cfdisk, parted)
          + Text editors (nano, joe, vim, emacs)
          + C, Perl, Python, and OCaml development environments.
            Enough to configure and compile a new kernel and
            build basic .debs. Kernel 2.6.6 sources included on
            CD.
          + Full networking support, including PPP and various
            Ethernet cards and DHCP
          + Network tools including FTP clients, Web client, ssh,
            telnet, NFS, smbclient, tcpdump, netcat, etc.
          + Backup restoration tools such as rdiff-backup,
            dump/restore, tar, cpio, amanda client, afbackup
            client, etc.
          + CD and DVD burning tools
          + Basic printing tools (cat for local printers, rlpr
            for remote ones, and netcat for Jetdirect, plus
            unix2dos for text files and Ghostscript for emergency
            conversions)
          + Mail reader (mutt)
     * Base systems for multiple versions of Debian installable
       directly from CD, including: sarge, etch, and sid (stable,
       testing, and unstable).
     * Hybrid amd64 support: A single i386/amd64 hybrid CD
       provides enough to install or fix either an i386 or an
       AMD64 system. Includes 64-bit kernel with 32-bit emulation
       (to run the 32-bit userland on the CD). Also includes
       64-bit packages for bootstrapping a new AMD64 support. In
       short, you can boot a 64-bit kernel and be treated as a
       first-class citizen in almost all respects.
     * Easy porting to other architectures. Existing ports to
       Alpha and PowerPC.
     * i386 or x86_64 (amd64) kernels bootable directly from
       initial boot menu.
     * DFS generation scripts support custom kernels, packages,
       mirrors, compressed ISO images, and a high degree of
       flexibility.
     _________________________________________________________

1.2. Getting DFS

   You may download ISO images for DFS from John Goerzen's DFS
   site. The dfsbuild program is available from within Debian
   itself, or you may find it on the Debian package page.

   For more resources, please visit Appendix B>.
     _________________________________________________________

1.3. History of DFS

   DFS begain as the first installer for the amd64 port of
   Debian. I also wanted to have a handy rescue disk for systems
   that use LVM, Reiser4, etc. At the time, the Debian installers
   didn't support any of this.
     _________________________________________________________

Chapter 2. Booting DFS

   Booting procedures vary by architecture. Here are some basics:
     _________________________________________________________

2.1. Booting on i386 (PC)

   Booting DFS usually is as simple as inserting a CD into the
   drive. DFS can boot from an IDE or SCSI CD-ROM. On some
   systems, you may need to access your BIOS to enable booting
   from CD. When you have successfully booted DFS the CD, you'll
   see a blue Grub selection screen.
     _________________________________________________________

2.2. Booting on Alpha

   The DFS images for Alpha support the SRM console only at this
   time. If your system uses AlphaBIOS or some other BIOS, you
   may need to convert to SRM. If you need the SRM firmware, you
   may be able to find it on the Alpha firmware updates page.

   Details about SRM can be found at the SRM HOWTO. If you are
   reading this manual directly from the DFS CD-ROM, you can find
   the HOWTO at
   file:///usr/share/doc/aboot-base/SRM-HOWTO/index.html. If you
   are reading this on the Web, the SRM HOWTO can be found at
   http://www.tldp.org/HOWTO/SRM-HOWTO/ or
   http://www.alphalinux.org/faq/srm.html.

   Booting the DFS CD generally involves these steps:

    1. Boot to an SRM prompt. If your system is set to
       automatically boot an operating system, Ctrl-C at the
       appropriate time may accomplish this.
    2. Set the operating system type with: set os_type Unix.
    3. Find the device that represents your CD-ROM drive. Typing
       show dev will help you out. IDE users may often find dqa2
       as their CD-ROM device. Please consult show dev to
       discover the proper value for your system.
    4. Boot the aboot bootloader. Run: boot device -fl i. Replace
       device with your particular CD-ROM device.
    5. You should now see an aboot prompt. You can press "l"
       (lower-case "L") to see a list of available kernels. Press
       zero through 9 to boot one of them; the default should be
       set to 0. If you don't know what to do, just press 0.
    6. Linux should now start.
     _________________________________________________________

2.3. Booting on PowerPC

   The DFS images for PowerPC support booting from OpenFirmware
   (OF) into yaboot.

   Booting the DFS CD generally involves these steps:

    1. Boot into yaboot. On newer PowerPC (NewWorld) you can
       press "c" (or "Command-Option-Shift-Delete") during boot
       until you reach the yaboot bootprompt. If this does not
       work, you have to boot into OpenFirmware first. This can
       be done by pressing "Option-Command-o-f" (all four at the
       same time) during boot. The Option key might also be
       labeled "Alt" and the Command key with the Apple sign on
       your keyboard. Once you have reached the OpenFirmware
       prompt, type boot cd:,\boot\yaboot to boot into yaboot.
    2. You should now see an yaboot prompt. You can press "TAB"
       to see a list of available kernels. Enter the kernel's
       name to boot it. The *-safe options use "video=ofonly"
       which is needed if your machine has a framebuffer that is
       not well supported and booting would give flickering lines
       on the screen. "ofonly" relies on the OpenFirmware
       console.
    3. Linux should now start.
     _________________________________________________________

2.4. Booting a Kernel

   Depending on how your CD was built, you'll see options for one
   or more different kernel images. Select one appropriate for
   your system. If a given image says "amd64", this should only
   be used on amd64 systems such as Opteron or Athlon64 system.
   Note: if you intend to install a 64-bit amd64 system, you MUST
   boot from the 64-bit amd64 kernel. 
     _________________________________________________________

2.5. Selecting CD-ROM device

   In most cases, DFS can automatically detect which drive holds
   your DFS CD. However, if that check is time-consuming or
   fails, you can manually specify your CD with the dfscd
   parameter. To use it, select the kernel you wish, press e to
   edit the command and edit the "kernel" line. Insert something
   such as dfscd=/dev/hdc, press Enter, then b to boot.
     _________________________________________________________

2.6. Detecting Hardware

   Some hardware will automatically be configured. You can
   attempt to autodetect more hardware by running
   /etc/init.d/discover start. If you want to use USB devices,
   try /etc/init.d/hotplug start. Otherwise, you will likely need
   to manually load kernel modules. You can find them under
   /lib/modules/kernelversion. Tools such as lspci can help you
   find out what hardware you have that needs to be loaded.

   If you have PCMCIA devices, run /etc/init.d/pcmcia start.
     _________________________________________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interfaces. You should delete the eth0 line
   and replace it with something along these lines:
iface eth0 inet static
    address 192.168.0.4
    netmask 255.255.255.0
    gateway 192.168.0.1


   Then run ifup eth0. You'll also need to edit /etc/oot _____________________________

2.7. Enabling Ethernet

   If your network hardware was detected and your LAN uses DHCP,
   you can simply say ifup eth0. Your network will be activated.

   If your LAN does not use DHCP, you will need to edit
   /etc/networking/interf