home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 13 / CDA13.ISO / DOC / HOWTO / BOOTDISK.GZ / BOOTDISK
Encoding:
Text File  |  1996-08-18  |  88.9 KB  |  2,234 lines

  1.   The Linux Bootdisk HOWTO
  2.   Tom Fawcett and Graham Chapman
  3.   v2.1, 18 August 1996
  4.  
  5.   This document describes how to create Linux boot, boot/root and util¡
  6.   ity maintenance disks. These disks could be used as rescue disks or to
  7.   test new kernels.  Note: if you haven't read the Linux FAQ and related
  8.   documents such as the Linux Installation HOWTO and the Linux Install
  9.   Guide, then you should not be trying to build boot diskettes.
  10.  
  11.   1.  Introduction
  12.  
  13.   1.1.  Why Build Boot Disks?
  14.  
  15.   Linux boot disks are useful in a number of situations, such as:
  16.  
  17.   ╖  Testing a new kernel.
  18.  
  19.   ╖  Recovering from disk or system failure. Such a failure could be
  20.      anything from a lost boot sector to a disk head crash.
  21.  
  22.   There are several ways of producing boot disks:
  23.  
  24.   ╖  Use one from a distribution such as Slackware. This will at least
  25.      allow you to boot.
  26.  
  27.   ╖  Use a rescue package to set up disks designed to be used as rescue
  28.      disks.
  29.  
  30.   ╖  Learn what is required for each of the various types of disk to
  31.      operate, then build your own.
  32.  
  33.   I originally chose the last option - learn how it works so that you
  34.   can do it yourself. That way, if something breaks, you can work out
  35.   what to do to fix it. Plus you learn a lot about how Linux works along
  36.   the way.
  37.  
  38.   Experienced Linux users may find little of use in this document.
  39.   However users new to Linux system administration who wish to protect
  40.   against root disk loss and other mishaps may find it useful.
  41.  
  42.   A note on versions - this document has been updated to support the
  43.   following packages and versions:
  44.  
  45.   ╖  Linux 2.0.6
  46.  
  47.   ╖  LILO 0.19
  48.  
  49.   Copyright (c) Tom Fawcett and Graham Chapman 1996.
  50.  
  51.   Permission is granted for this material to be freely used and
  52.   distributed, provided the source is acknowledged.  The copyright
  53.   conditions are intended to be no more restrictive than version 2 of
  54.   the GNU General Public License as published by the Free Software
  55.   Foundation.
  56.  
  57.   No warranty of any kind is provided. You use this material at your own
  58.   risk.
  59.  
  60.   1.2.  Feedback and Credits
  61.  
  62.   We welcome any feedback, good or bad, on the content of this document.
  63.   Please let us know if you find any errors or omissions. Send comments,
  64.   corrections and questions to Tom Fawcett (fawcett@nynexst.com) or
  65.   Graham Chapman (grahamc@zeta.org.au).
  66.  
  67.   I thank the following people for correcting errors and providing
  68.   useful suggestions for improvement:
  69.  
  70.                Randolph Bentson
  71.                Grant R. Bowman
  72.                Scott Burkett
  73.                Cameron Davidson
  74.                Bruce Elliot
  75.                HARIGUCHI Youichi
  76.                Bjxrn-Helge Mevik
  77.                Dwight Spencer
  78.                Cameron Spitzer
  79.                Johannes Stille
  80.  
  81.   1.3.  Change History
  82.  
  83.   v2.1, 18 August 1996. Changes in this version:
  84.  
  85.   Summary: this was a major cleanup to reflect changes between kernel
  86.   version 1.2 and 2.0. Specific changes are:
  87.  
  88.   ╖  Chg: replaced shell scripts and directory listings.
  89.  
  90.   ╖  Chg: removed most of the text of "oversize ramdisk" FAQ question.
  91.  
  92.   ╖  Fix: mkfs -i should have been mke2fs -i.
  93.  
  94.   ╖  Fix: missing parameter name in dd command to zero rootdisk device.
  95.  
  96.   ╖  Fix: remove accidental extra parameter from mke2fs command to
  97.      create rootdisk filesystem.
  98.  
  99.   ╖  Chg: minor changes to reflect less reliance on the Bootkit utility.
  100.  
  101.   ╖  Chg: change section cross-references to refer to section title, not
  102.      number (sometime I'll add hypertext links...)
  103.  
  104.   ╖  Add: use cpio as an alternate way of copying files.
  105.  
  106.   ╖  Add: tips for removing unnecessary device special files.
  107.  
  108.   ╖  Add: FAQ question - what to do if nothing happens at boot time.
  109.  
  110.   ╖  Add: various minor changes.
  111.  
  112.   v2.0, 12 June 1996. Changes in this version:
  113.  
  114.   ╖  Add: additional author and maintainer, Tom Fawcett.
  115.  
  116.   ╖  Add: section 6.3, Ramdisk Usage.
  117.  
  118.   ╖  Add: section titled Advanced Bootdisk Creation, which describes how
  119.      to take advantage of ramdisk changes in kernels 1.3.48+
  120.  
  121.   ╖  Chg: rewrite section on /lib directory.
  122.  
  123.   ╖  Chg: various minor tips on changed ramdisk usage.
  124.  
  125.   Version history:
  126.  
  127.   ╖  v1.02, 25 June 1995 - minor changes.
  128.  
  129.   ╖  v1.01, 6 February 1995 - minor changes.
  130.  
  131.   ╖  v1.0, 2 January 1995 - first release in standard HOWTO layout.
  132.  
  133.   ╖  v0.10, 1 Novemer 1994 - original version, labelled "Draft".
  134.  
  135.   2.  Disks
  136.  
  137.   2.1.  Summary of Disk Types
  138.  
  139.   I classify boot-related disks into 4 types. The discussion here and
  140.   throughout this document uses the term "disk" to refer to diskettes
  141.   unless otherwise specified. Most of the discussion could be equally
  142.   well applied to hard disks.
  143.  
  144.   A summary of disk types and uses is:
  145.  
  146.      boot
  147.         A disk containing a kernel which can be booted. The disk can
  148.         contain a filesystem and use a boot loader to boot, or it can
  149.         simply contain the kernel only at the start of the disk.  The
  150.         disk can be used to boot the kernel using a root file system on
  151.         another disk. This could be useful if you lost your boot loader
  152.         due to, for example, an incorrect installation attempt.
  153.  
  154.      root
  155.         A disk with a file system containing everything required to run
  156.         a Linux system. It does not necessarily contain either a kernel
  157.         or a boot loader.
  158.  
  159.         This disk can be used to run the system independently of any
  160.         other disks, once the kernel has been booted. A special kernel
  161.         feature allows a separate root disk to be mounted after booting,
  162.         with the root disk being automatically copied to a ramdisk.
  163.  
  164.         You could use this type of disk to check another disk for
  165.         corruption without mounting it, or to restore another disk after
  166.         a disk failure or loss of files.
  167.  
  168.      boot/root
  169.         A disk which is the same as a root disk, but contains a kernel
  170.         and a boot loader. It can be used to boot from, and to run the
  171.         system. The advantage of this type of disk is that is it compact
  172.         - everything required is on a single disk.  However the
  173.         gradually increasing size of everything means that it won't
  174.         necessarily always be possbile to fit everything on a single
  175.         diskette, even with compression.
  176.  
  177.      utility
  178.         A disk which contains a file system, but is not intended to be
  179.         mounted as a root file system. It is an additional data disk.
  180.         You would use this type of disk to carry additional utilities
  181.         where you have too much to fit on your root disk.
  182.  
  183.         The term "utility" only really applies to diskettes, where you
  184.         would use a utility disk to store additional recovery utility
  185.         software.
  186.  
  187.   The most flexible approach for rescue diskettes is probably to use
  188.   separate boot and root diskettes, and one or more utility diskettes to
  189.   handle the overflow.
  190.  
  191.   2.2.  Boot
  192.  
  193.   2.2.1.  Overview
  194.  
  195.   All PC systems start the boot process by executing code in ROM to load
  196.   the sector from sector 0, cylinder 0 of the boot drive and try and
  197.   execute it. On most bootable disks, sector 0, cylinder 0 contains
  198.   either:
  199.  
  200.   ╖  code from a boot loader such as LILO, which locates the kernel,
  201.      loads it and executes it to start the boot proper.
  202.  
  203.   ╖  the start of an operating system kernel, such as Linux.
  204.  
  205.   If a Linux kernel has been written to a diskette as a raw device, then
  206.   the first sector will be the first sector of the Linux kernel itself,
  207.   and this sector will continue the boot process by loading the rest of
  208.   the kernel and running Linux. For a more detailed description of the
  209.   boot sector contents, see the documentation in lilo-01.5 or higher.
  210.  
  211.   An alternative method of storing a kernel on a boot disk is to create
  212.   a filesystem, not as a root filesystem, but simply as a means of
  213.   installing LILO and thus allowing boot-time command line options to be
  214.   specified. For example, the same kernel could then be used to boot
  215.   using a hard disk root filesystem, or a diskette root filesystem. This
  216.   could be useful if you were trying to rebuild the hard disk
  217.   filesystem, and wanted to repeatedly test results.
  218.  
  219.   2.2.2.  Setting Pointer to Root
  220.  
  221.   The kernel must somehow obtain a pointer to the drive and partititon
  222.   to be mounted as the root drive. This can be provided in several ways:
  223.  
  224.   ╖  By setting ROOT_DEV = devicename in the Linux kernel makefile and
  225.      rebuilding the kernel (for advice on how to rebuild the kernel,
  226.      read the Linux FAQ and look in /usr/src/linux). Comments in the
  227.      Linux makefile describe the valid values for devicename.
  228.  
  229.   ╖  By running the rdev utility:
  230.  
  231.                rdev filename devicename
  232.  
  233.   This will set the root device of the kernel contained in filename to
  234.   be devicename. For example:
  235.  
  236.                rdev zImage /dev/sda1
  237.  
  238.   This sets the root device in the kernel in zImage to the first parti¡
  239.   tion on the first SCSI drive.
  240.  
  241.   There are some alternative ways of issuing the rdev command. Try:
  242.  
  243.                rdev -h
  244.  
  245.   and it will display command usage.
  246.  
  247.   There is usually no need to configure the root device for boot
  248.   diskette use, because the kernel currently used to boot from probably
  249.   already points to the root drive device. The need can arise, howoever,
  250.   if you obtain a kernel from another machine, for example, from a
  251.   distribution, or if you want to use the kernel to boot a root
  252.   diskette. It is probably a good idea to check the current root drive
  253.   setting, just in case it is wrong. To get rdev to check the current
  254.   root device in a kernel file, enter the command:
  255.  
  256.                rdev <filename>
  257.  
  258.   It is possible to change the root device set in a kernel by means
  259.   other than using rdev. For details, see the FAQ at the end of this
  260.   document.
  261.  
  262.   2.2.3.  Copying Kernel to Boot Diskette
  263.  
  264.   Once the kernel has been configured then it must be copied to the boot
  265.   diskette.
  266.  
  267.   The commands described below (and throughout the HOWTO) assume that
  268.   the diskettes have been formatted. If not, then use fdformat to format
  269.   the diskettes before continuing.
  270.  
  271.   If the disk is not intended to contain a file system, then the kernel
  272.   can be copied using the dd command, as follows:
  273.  
  274.                dd if=infilename of=devicename
  275.  
  276.                where   infilename is the name of the kernel
  277.                and     devicename is the diskette raw device,
  278.                        usually /dev/fd0
  279.  
  280.   The cp command can also be used:
  281.  
  282.                cp filename devicename
  283.  
  284.   For example:
  285.  
  286.                dd if=zImage of=/dev/fd0
  287.        or
  288.                cp zImage /dev/fd0
  289.  
  290.   The seek parameter to the dd command should NOT be used. The file must
  291.   be copied to start at the boot sector (sector 0, cylinder 0), and
  292.   omitting the seek parameter will do this.
  293.  
  294.   The output device name to be used is usually /dev/fd0 for the primary
  295.   diskette drive (i.e. drive "A:" in DOS), and /dev/fd1 for the
  296.   secondary. These device names will cause the kernel to autodetect the
  297.   attributes of the drives. Drive attributes can be specified to the
  298.   kernel by using other device names: for example /dev/fd0H1440
  299.   specifies a high density 1.44 Mb drive. It is rare to need to use
  300.   these specific device names.
  301.  
  302.   Where the kernel is to be copied to a boot disk containing a
  303.   filesystem, then the disk is mounted at a suitable point in a
  304.   currently-mounted filesystem, then the cp command is used. For
  305.   example:
  306.  
  307.                mount -t ext2 /dev/fd0 /mnt
  308.                cp zImage /mnt
  309.                umount /mnt
  310.  
  311.   Note that for almost all operations in this HOWTO, the user should be
  312.   operating as the superuser.
  313.  
  314.   2.3.  Root
  315.  
  316.   2.3.1.  Overview
  317.  
  318.   A root disk contains a complete working Linux system, but without
  319.   necessarily including a kernel. In other words, the disk may not be
  320.   bootable, but once the kernel is running, the root disk contains
  321.   everything needed to support a full Linux system. To be able to do
  322.   this, the disk must include the minimum requirements for a Linux
  323.   system:
  324.  
  325.   ╖  File system.
  326.  
  327.   ╖  Minimum set of directories - dev, proc, bin, etc, lib, usr, tmp.
  328.  
  329.   ╖  Basic set of utilities - bash (to run a shell), ls, cp etc.
  330.  
  331.   ╖  Minimum set of config files - rc, inittab, fstab etc.
  332.  
  333.   ╖  Runtime library to provide basic functions used by utilities.
  334.  
  335.   Of course, any system only becomes useful when you can run something
  336.   on it, and a root diskette usually only becomes useful when you can do
  337.   something like:
  338.  
  339.   ╖  Check a file system on another drive, for example to check your
  340.      root file system on your hard drive, you need to be able to boot
  341.      Linux from another drive, as you can with a root diskette system.
  342.      Then you can run fsck on your original root drive while it is not
  343.      mounted.
  344.  
  345.   ╖  Restore all or part of your original root drive from backup using
  346.      archive/compression utilities including cpio, tar, gzip and ftape.
  347.  
  348.   2.4.  Boot/Root
  349.  
  350.   This is essentially the same as the root disk, with the addition of a
  351.   kernel and a boot loader such as LILO.
  352.  
  353.   With this configuration, a kernel file is copied to the root file
  354.   system, and LILO is then run to install a configuration which points
  355.   to the kernel file on the target disk. At boot time, LILO will boot
  356.   the kernel from the target disk.
  357.  
  358.   Several files must be copied to the diskette for this method to work.
  359.   Details of these files and the required LILO configuration, including
  360.   a working sample, are given below in the section titled "LILO".
  361.  
  362.   2.4.1.  RAM Disks and Root Filesystems on Diskette
  363.  
  364.   For a diskette root filesystem to be efficient, you need to be able to
  365.   run it from a ramdisk, i.e. an emulated disk drive in main memory.
  366.   This avoids having the system run at a snail's pace, which a diskette
  367.   would impose. The Ftape HOWTO states that a ramdisk will be required
  368.   when using Ftape because Ftape requires exclusive use of the diskette
  369.   controller.
  370.  
  371.   There is an added benefit from using a ramdisk - the Linux kernel
  372.   includes an automatic ramdisk root feature, whereby it will, under
  373.   certain circumstances, automatically copy the contents of a root
  374.   diskette to a ramdisk, and then switch the root drive to be the
  375.   ramdisk instead of the diskette. This has three major benefits:
  376.  
  377.   ╖  The system runs a lot faster.
  378.  
  379.   ╖  The diskette drive is freed up to allow other diskettes to be used
  380.      on a single-diskette drive system.
  381.  
  382.   ╖  With compression, the ramdisk image on a disk can be substantially
  383.      smaller than (eg, 40% the size of) the corresponding disk image.
  384.      This means that a 1.44 meg floppy disk may hold a root containing
  385.      roughly 3.6 meg.
  386.  
  387.   For kernels 1.3.48+, the ramdisk code was substantially rewritten.
  388.   You have some more options and the commands for using the ramdisk are
  389.   somewhat different. The section titled "Advanced Bootdisk Creation"
  390.   discusses how to take advantage of these.
  391.  
  392.   You must configure your kernel to have ramdisk support, but the
  393.   ramdisk is dynamically expandible so you need not specify the size.
  394.   rdev -r is no longer used to specify the ramdisk size, but instead
  395.   sets a ramdisk word in the kernel image.  The section titled "Advanced
  396.   Bootdisk Creation" discusses this in more detail.
  397.  
  398.   If you have a kernel *before* 1.3.48, the following requirements
  399.   apply. Note that this applies ONLY to kernels prior to 1.3.48.
  400.  
  401.   ╖  The file system on the diskette drive must be either a minix or an
  402.      ext2 file system. The ext2 file system is generally the preferred
  403.      file system to use. Note that if you have a Linux kernel earlier
  404.      than 1.1.73, then you should see the comments in the section titled
  405.      "File Systems" to see whether your kernel will support ext2. If
  406.      your kernel is old then you may have to use minix. This will not
  407.      cause any significant problems.
  408.  
  409.   ╖  A ramdisk must be configured into the kernel, and it must be at
  410.      least as big as the diskette drive.
  411.  
  412.   A ramdisk can be configured into the kernel in several ways:
  413.  
  414.   ╖  By uncommenting the RAMDISK macro in the Linux kernel makefile, so
  415.      that it reads:
  416.  
  417.                RAMDISK = -DRAMDISK=1440
  418.  
  419.   to define a ramdisk of 1440 1K blocks, the size of a high-density
  420.   diskette.
  421.  
  422.   ╖  By running the rdev utility, available on most Linux systems. This
  423.      utility displays or sets values for several things in the kernel,
  424.      including the desired size for a ramdisk. To configure a ramdisk of
  425.      1440 blocks into a kernel in a file named zImage, enter:
  426.  
  427.                rdev -r zImage 1440
  428.  
  429.   this might change in the future, of course. To see what your version
  430.   of rdev does, enter the command:
  431.  
  432.                rdev -h
  433.  
  434.   and it should display its options.
  435.  
  436.   ╖  By using the boot loader package LILO to configure it into your
  437.      kernel at boot time. This can be done using the LILO configuration
  438.      parameter:
  439.  
  440.                ramdisk = 1440
  441.  
  442.   to request a ramdisk of 1440 1K blocks at boot time.
  443.  
  444.   ╖  By interrupting a LILO automatic boot and adding ramdisk=1440 to
  445.      the command line. For example, such a command line might be:
  446.  
  447.                zImage ramdisk=1440
  448.  
  449.   See the section on LILO for more details.
  450.  
  451.   ╖  By editing the kernel file and altering the values near the start
  452.      of the file which record the ramdisk size. This is definitely a
  453.      last resort, but can be done. See the FAQ near the end of this
  454.      document for more details.
  455.  
  456.   The easiest of these methods is LILO configuration, because you need
  457.   to set up a LILO configuration file anyway, so why not add the ramdisk
  458.   size here?
  459.  
  460.   LILO configuration is briefly described in a section titled "LILO"
  461.   below, but it is advisable to obtain the latest stable version of LILO
  462.   from your nearest Linux mirror site, and read the documentation that
  463.   comes with it.
  464.  
  465.   Ramdisks can be made larger than the size of a diskette, and made to
  466.   contain a filesystem as large as the ramdisk. This can be useful to
  467.   load all the software required for rescue work onto a single high-
  468.   performance ramdisk. The method of doing this is described in the FAQ
  469.   section under the question "How can I create an oversize ramdisk
  470.   filesystem?"
  471.  
  472.   2.5.  Utility
  473.  
  474.   Often one disk is not sufficient to hold all the software you need to
  475.   be able to perform rescue functions of analysing, repairing and
  476.   restoring corrupted disk drives. By the time you include tar, gzip
  477.   e2fsck, fdisk, Ftape and so on, there is enough for a whole new
  478.   diskette, maybe even more if you want lots of tools.
  479.  
  480.   This means that a rescue set often requires a utility diskette, with a
  481.   file system containing any extra files required. This file system can
  482.   then be mounted at a convenient point, such as /usr, on the boot/root
  483.   system.
  484.  
  485.   Creating a file system is fairly easy, and is described in the section
  486.   titled "File Systems".
  487.  
  488.   3.  Components
  489.  
  490.   3.1.  File Systems
  491.  
  492.   The Linux kernel now supports two file system types for root disks to
  493.   be automatically copied to ramdisk. These are minix and ext2, of which
  494.   ext2 is the preferred file system.  The ext2 support was added
  495.   sometime between 1.1.17 and 1.1.57, I'm not sure exactly which. If you
  496.   have a kernel within this range then edit
  497.   /usr/src/linux/drivers/block/ramdisk.c and look for the word "ext2".
  498.   If it is not found, then you will have to use a minix file system, and
  499.   therefore the "mkfs" command to create it. If using ext2, then you may
  500.   find it useful to use the -i option to specify more inodes than the
  501.   default; -i 2000 is suggested so that you don't run out of inodes.
  502.   Alternatively, you can save on inodes by removing lots of unnecessary
  503.   /dev files. Mke2fs will by default create 360 inodes on a 1.44Mb
  504.   diskette. I find that 120 inodes is ample on my current rescue root
  505.   diskette, but if you include all the devices in the /dev directory
  506.   then you will easily exceed 360. Using a compressed root filesystem
  507.   allows a larger filesystem, and hence more inodes by default, but you
  508.   may still need to either reduce the number of files or increase the
  509.   number of inodes.
  510.  
  511.   To create an ext2 file system on a diskette on my system, I issue the
  512.   following command:
  513.  
  514.           mke2fs -m 0 /dev/fd0
  515.  
  516.   The mke2fs command will automatically detect the space available and
  517.   configure itself accordingly. If desired, the diskette size in 1Kb
  518.   blocks can be specified to speed up mke2fs operation. The -m 0
  519.   parameter prevents it from reserving space for root, and hence
  520.   provides more usable space on the disk.
  521.  
  522.   An easy way to test the result is to create a system using the above
  523.   command or similar, and then attempt to mount the diskette. If it is
  524.   an ext2 system, then the command:
  525.  
  526.                mount -t ext2 /dev/fd0 /<mount point>
  527.  
  528.   should work.
  529.  
  530.   3.2.  Kernel
  531.  
  532.   3.2.1.  Building a Custom Kernel
  533.  
  534.   In most cases it would be possible to copy your current kernel and
  535.   boot the diskette from that. However there may be cases where you wish
  536.   to build a separate one.
  537.  
  538.   One reason is size.  The kernel is one of the largest files in a
  539.   minimum system, so if you want to build a boot/root diskette, then you
  540.   will have to reduce the size of the kernel as much as possible.  The
  541.   kernel now supports changing the diskette after booting and before
  542.   mounting root, so it is not necessary any more to squeeze the kernel
  543.   into the same disk as everything else, therefore these comments apply
  544.   only if you choose to build a boot/root diskette.
  545.  
  546.   There are two ways of reducing kernel size:
  547.  
  548.   ╖  Building it with the minumum set of facilities necessary to support
  549.      the desired system. This means leaving out everything you don't
  550.      need. Networking is a good thing to leave out, as well as support
  551.      for any disk drives and other devices which you don't need when
  552.      running your boot/root system.
  553.  
  554.   ╖  Compressing it, using the standard compressed-kernel option
  555.      included in the makefile:
  556.  
  557.                make zImage
  558.  
  559.   Refer to the documentation included with the kernel source for up-to-
  560.   date information on building compressed kernels.  Note that the kernel
  561.   source is usually in /usr/src/linux.
  562.  
  563.   Having worked out a minimum set of facilities to include in a kernel,
  564.   you then need to work out what to add back in. Probably the most
  565.   common uses for a boot/root diskette system would be to examine and
  566.   restore a corrupted root file system, and to do this you may need
  567.   kernel support.
  568.  
  569.   For example, if your backups are all held on tape using Ftape to
  570.   access your tape drive, then, if you lose your current root drive and
  571.   drives containing Ftape, then you will not be able to restore from
  572.   your backup tapes. You will have to reinstall Linux, download and
  573.   reinstall Ftape, and then try and read your backups.
  574.  
  575.   It is probably desirable to maintain a copy of the same version of
  576.   backup utilities used to write the backups, so that you don't waste
  577.   time trying to install versions that cannot read your backup tapes.
  578.  
  579.   The point here is that, whatever I/O support you have added to your
  580.   kernel to support backups should also be added into your boot/root
  581.   kernel.
  582.  
  583.   The procedure for actually building the kernel is described in the
  584.   documentation that comes with the kernel. It is quite easy to follow,
  585.   so start by looking in /usr/src/linux. Note that if you have trouble
  586.   building a kernel, then you should probably not attempt to build
  587.   boot/root systems anyway.
  588.  
  589.   3.3.  Devices
  590.  
  591.   A /dev directory containing a special file for all devices to be used
  592.   by the system is mandatory for any Linux system. The directory itself
  593.   is a normal directory, and can be created with the mkdir command in
  594.   the normal way. The device special files, however, must be created in
  595.   a special way, using the mknod command.
  596.  
  597.   There is a shortcut, though - copy your existing /dev directory
  598.   contents, and delete the ones you don't want. The only requirement is
  599.   that you copy the device special files using the -R option.   (--
  600.   Warning: The cp command supplied with the most recent version of
  601.   fileutils (3.13) is reported not to respect the -R flag.--)
  602.  
  603.   This will copy the directory without attempting to copy the contents
  604.   of the files. Note that if you use lower caser, as in "-r", there will
  605.   be a vast difference, because you will probably end up copying the
  606.   entire contents of all of your hard disks - or at least as much of
  607.   them as will fit on a diskette! Therefore, take care, and use the
  608.   command:
  609.  
  610.                cp -dpR /dev /mnt
  611.  
  612.   assuming that the diskette is mounted at /mnt.  The dp switches ensure
  613.   that symbolic links are copied as links (rather than the target file
  614.   being copied) and that the original file attributes are preserved,
  615.   thus preserving ownership information.
  616.  
  617.   You can also use the -p option of cpio, because cpio will handle
  618.   device special files correctly, and not try and copy the contents.
  619.   For example:
  620.  
  621.                cd /dev
  622.                find . -print | cpio -pmd /mnt/dev
  623.  
  624.   will copy all device special files from /dev to /mnt/dev. In fact it
  625.   will copy all files in the directory tree starting at /dev, and will
  626.   create any required subdirectories in the target directory tree.
  627.  
  628.   If you want to do it the hard way, use ls -l to display the major and
  629.   minor device numbers for the devices you want, and create them on the
  630.   diskette using mknod.
  631.  
  632.   Many distributions include a shell script called MAKEDEV in the /dev
  633.   directory. This shell script could be used to create the devices, but
  634.   it is probably easier to just copy your existing ones, especially for
  635.   rescue disk purposes.
  636.  
  637.   Whichever way the device directory is copied, it is worth checking
  638.   that any special devices you need have been placed on the rescue
  639.   diskette. For example, Ftape uses tape devices, so you will need to
  640.   copy all of these.
  641.  
  642.   Note that an inode is required for each device special file, and
  643.   inodes can at times be a scarce resource, especially on diskette
  644.   filesystems. It therefore makes sense to remove any device special
  645.   files that you don't need from the diskette /dev directory. Many
  646.   devices are obviously unnecessary on specific systems. For example, if
  647.   you do not have SCSI disks, then you can safely remove all the device
  648.   files starting with "sd". Similarly, if you don't intend to use your
  649.   serial port then all the device files starting with "cua" can go.
  650.  
  651.   3.4.  Directories
  652.  
  653.   It might be possible to get away with just /dev, /proc and /etc to run
  654.   a Linux system. I don't know - I've never tested it. However it will
  655.   certainly be difficult, because without shared libraries all your
  656.   executables would have to be statically linked. A reasonable minimum
  657.   set of directories consists of the following:
  658.  
  659.      /dev
  660.         Required to perform I/O with devices
  661.  
  662.      /proc
  663.         Required by the ps command
  664.  
  665.      /etc
  666.         System configuration files
  667.  
  668.      /bin
  669.         Utility executables considered part of the system
  670.  
  671.      /lib
  672.         Shared libraries to provide run-time support
  673.  
  674.      /mnt
  675.         A mount point for maintenance on other disks
  676.  
  677.      /usr
  678.         Additional utilities and applications
  679.  
  680.   Note that the directory tree presented here is for root diskette use
  681.   only.  Refer to the Linux File System Standard for much better
  682.   information on how file systems should be structured in "standard"
  683.   Linux systems.
  684.  
  685.   Four of these directories can be created very easily:
  686.  
  687.   ╖  /dev is described above in the section titled DEVICES.
  688.  
  689.   ╖  /proc only needs to exist. Once the directory is created using
  690.      mkdir, nothing more is required.
  691.  
  692.   ╖  Of the others, /mnt and /usr are included in this list only as
  693.      mount points for use after the boot/root system is running.  Hence
  694.      again, these directories only need to be created.
  695.  
  696.   The remaining 3 directories are described in the following sections.
  697.  
  698.   3.4.1.  /etc
  699.  
  700.   This directory must contain a number of configuration files. On most
  701.   systems, these can be divided into 3 groups:
  702.  
  703.   ╖  Required at all times, e.g. rc, fstab, passwd.
  704.  
  705.   ╖  May be required, but no-one is too sure.
  706.  
  707.   ╖  Junk that crept in.
  708.  
  709.   Files which are not essential can be identified with the command:
  710.  
  711.                ls -ltru
  712.  
  713.   This lists files in reverse order of date last accessed, so if any
  714.   files are not being accessed, then they can be omitted from a root
  715.   diskette.
  716.  
  717.   On my root diskettes, I have the number of config files down to 15.
  718.   This reduces my work to dealing with three sets of files:
  719.  
  720.   ╖  The ones I must configure for a boot/root system:
  721.  
  722.                rc.d/*  system startup and run level change scripts
  723.                fstab   list of file systems to be mounted
  724.                inittab parameters for the init process - the
  725.                        first process started at boot time.
  726.  
  727.   ╖  the ones I should tidy up for a boot/root system:
  728.  
  729.                passwd  list of logins
  730.                shadow  contains passwords
  731.  
  732.   These should be pruned on secure systems to avoid copying user's pass¡
  733.   words off the system, and so that when you boot from diskette,
  734.   unwanted logins are rejected.  (-- Note that there is a reason not to
  735.   prune passwd and shadow.  Tar (and probably other archivers) stores
  736.   user and group names with files.  If you restore files to your hard
  737.   disk from tape, the files will be restored with their original names.
  738.   If these names do not exist in passwd/group when they are restored,
  739.   the UID/GID will not be correct.--)
  740.  
  741.   ╖  The rest. They work at the moment, so I leave them alone.
  742.  
  743.   Out of this, I only really have to configure two files, and what they
  744.   should contain is surprisingly small.
  745.  
  746.   ╖  rc should contain:
  747.  
  748.                #!/bin/sh
  749.                /etc/mount -av
  750.                /bin/hostname boot_root
  751.  
  752.   and I don't really need to run hostname - it just looks nicer if I do.
  753.   Even mount is actually only needed to mount /proc to support the ps
  754.   command - Linux will run without it, although rescue operations are
  755.   rather limited without mount!
  756.  
  757.   ╖  fstab should contain:
  758.  
  759.                /dev/ram        /               ext2    defaults
  760.                /dev/fd0        /               ext2    defaults
  761.                /proc           /proc           proc    defaults
  762.  
  763.   I don't think that the first entry is really needed, but I find that
  764.   if I leave it out, mount won't mount /proc.
  765.  
  766.   Inittab should be ok as is, unless you want to ensure that users on
  767.   serial ports cannot login. To prevent this, comment out all the
  768.   entries for /etc/getty which include a ttys or ttyS device at the end
  769.   of the line.  Leave in the tty ports so that you can login at the
  770.   console.
  771.  
  772.   Inittab defines what the system will run or rerun in various states
  773.   including startup, move to multi-user mode, powerfail, and others.  A
  774.   point to be careful of here is to carefully check that the commands
  775.   entered in inittab refer to programs which are present and to the
  776.   correct directory. If you place your command files on your rescue disk
  777.   using the sample directory listing in this HOWTO as a guide, and then
  778.   copy your inittab to your rescue disk without checking it, then the
  779.   probability of failure will be quite high, because half of the inittab
  780.   entries will refer to missing programs or to the wrong directory.
  781.  
  782.   It is worth noting here as well that some programs cannot be moved
  783.   from one directory to another or they will fail at runtime because
  784.   they have hardcoded the name of another program which they attempt to
  785.   run. For example on my system, /etc/shutdown has hardcoded in it
  786.   /etc/reboot. If I move reboot to /bin/reboot, and then issue a
  787.   shutdown command, it will fail because it can't find the reboot file.
  788.  
  789.   For the rest, just copy all the text files in your /etc directory,
  790.   plus all the executables in your /etc directory that you cannot be
  791.   sure you do not need. As a guide, consult the sample ls listing in
  792.   "Sample Boot/Root ls-lR Directory Listing" - this is what I have, so
  793.   probably it will be sufficient for you if you copy only those files -
  794.   but note that systems differ a great deal, so you cannot be sure that
  795.   the same set of files on your system is equivalent to the files on
  796.   mine. The only sure method is to start with inittab and work out what
  797.   is required.
  798.  
  799.   Most systems now use an /etc/rc.d directory containing shell scripts
  800.   for different run levels.  The absolute minimum is a single rc script,
  801.   but it will probably be a lot simpler in practice to copy the inittab
  802.   and /etc/rc.d directory from your existing system, and prune the shell
  803.   scripts in the rc.d directory to remove processing not relevent to a
  804.   diskette system environment.
  805.  
  806.   3.4.2.  /bin
  807.  
  808.   Here is a convenient point to place the extra utilities you need to
  809.   perform basic operations, utilities such as ls, mv, cat, dd etc.
  810.  
  811.   See the section titled "Sample Boot/Root ls-lR Directory Listing" for
  812.   the list of files that I place in my boot/root /bin directory. You may
  813.   notice that it does not include any of the utilities required to
  814.   restore from backup, such as cpio, tar, gzip etc. That is because I
  815.   place these on a separate utility diskette, to save space on the
  816.   boot/root diskette. Once I have booted my boot/root diskette, it then
  817.   copies itself to the ramdisk leaving the diskette drive free to mount
  818.   another diskette, the utility diskette. I usually mount this as /usr.
  819.  
  820.   Creation of a utility diskette is described below in the section
  821.   titled "Adding Utility Diskettes".
  822.  
  823.   3.4.3.  /lib
  824.  
  825.   In /lib you place necessary shared libraries and loaders.  If the
  826.   necessary libraries are not found in your /lib directory then the
  827.   system will be unable to boot. If you're lucky you may see an error
  828.   message telling you why.
  829.  
  830.   Nearly every program requires at least the libc library:
  831.  
  832.                libc.so.X
  833.  
  834.   where X is the current version number.  Check your /lib directory.
  835.   Note that libc.so.4 may be a symlink to a libc library with version
  836.   number in the filename. If you issue the command:
  837.  
  838.                ls -l /lib
  839.  
  840.   you will see something like:
  841.  
  842.                libc.so.4 -> libc.so.4.5.21
  843.  
  844.   In this case, the libc library you want is libc.so.4.5.21. This is an
  845.   example only - the ELF libc library is currently libc.so.5.xxxx.
  846.  
  847.   To find other libraries you should go through all the binaries you
  848.   plan to include and check their dependencies.  You can do this with
  849.   ldd command.  For example, on my system the command:
  850.  
  851.           ldd /bin/mount
  852.  
  853.   produces the output:
  854.  
  855.                /bin/mount:
  856.                        libc.so.5 => /lib/libc.so.5.2.18
  857.  
  858.   indicating that /bin/mount needs the library libc.so.5, which is a
  859.   symbolic link to libc.so.5.2.18.
  860.  
  861.   In /lib you must also include one or more loaders to load the
  862.   libraries.  The loader file is either ld.so (for a.out libraries) or
  863.   ld-linux.so (for ELF libraries).  If you're not sure which you need,
  864.   run the "file" command on the library.  For example, on my system:
  865.  
  866.                file /lib/libc.so.5.2.18
  867.  
  868.   tells me:
  869.  
  870.                /lib/libc.so.5.2.18: ELF 32-bit LSB shared object ...
  871.  
  872.   so it needs an ELF loader.  If you have an a.out library you'll
  873.   instead see something like:
  874.  
  875.                /lib/libc.so.4.7.2: Linux/i386 demand-paged executable (QMAGIC) ...
  876.  
  877.   Copy the specific loader(s) you need.
  878.  
  879.   Libraries and loaders should be checked carefully against the included
  880.   binaries.  If the kernel cannot load a necessary library, the kernel
  881.   will usually hang with no error message.
  882.  
  883.   3.5.  LILO
  884.  
  885.   3.5.1.  Overview
  886.  
  887.   For the boot/root to be any use, it must be bootable. To achieve this,
  888.   the easiest way is to install a boot loader, which is a piece of
  889.   executable code stored at sector 0, cylinder 0 of the diskette. See
  890.   the section above titled "BOOT DISKETTE" for an overview of the boot
  891.   process.
  892.  
  893.   LILO is a tried and trusted boot loader available from any Linux
  894.   mirror site. It allows you to configure the boot loader, including:
  895.  
  896.   ╖  Which device is to be mounted as the root drive.
  897.  
  898.   ╖  Whether to use a ramdisk.
  899.  
  900.   3.5.2.  Sample LILO Configuration
  901.  
  902.   This provides a very convenient place to specify to the kernel how it
  903.   should boot. My root/boot LILO configuration file, used with LILO
  904.   0.15, is:
  905.  
  906.        ______________________________________________________________________
  907.        boot = /dev/fd0
  908.        install = ./mnt/boot.b
  909.        map = ./mnt/lilo.map
  910.        delay = 50
  911.        message = ./mnt/lilo.msg
  912.        timeout = 150
  913.        compact
  914.        image = ./mnt/zImage
  915.                ramdisk = 1440
  916.                root = /dev/fd0
  917.        ______________________________________________________________________
  918.  
  919.   Note that I have not tested this recently, because I no longer use
  920.   LILO-based boot/root diskettes. There is no reason to suppose that it
  921.   does not still work, but if you try it and it fails, you must read the
  922.   LILO documentation to find out why.
  923.  
  924.   Note also that boot/root systems no longer rely on LILO, because since
  925.   1.3.48, the kernel supports loading a compressed root filesystem from
  926.   the same diskette as the kernel. See the section "Advanced Bootdisk
  927.   Creation" for details.
  928.  
  929.   If you have a kernel later than 1.3.48, the "ramdisk = 1440" line is
  930.   unnecessary and should be removed.
  931.  
  932.   Note that boot.b, lilo.msg and the kernel must first have been copied
  933.   to the diskette using a command similar to:
  934.  
  935.        ______________________________________________________________________
  936.        cp /boot/boot.b ./mnt
  937.        ______________________________________________________________________
  938.  
  939.   If this is not done, then LILO will not run correctly at boot time if
  940.   the hard disk is not available, and there is little point setting up a
  941.   rescue disk which requires a hard disk in order to boot.
  942.  
  943.   I run lilo using the command:
  944.  
  945.                /sbin/lilo -C <configfile>
  946.  
  947.   I run it from the directory containing the mnt directory where I have
  948.   mounted the diskette. This means that I am telling LILO to install a
  949.   boot loader on the boot device (/dev/fd0 in this case), to boot a
  950.   kernel in the root directory of the diskette.
  951.  
  952.   I have also specified that I want the root device to be the diskette,
  953.   and I want a ramdisk created of 1440 1K blocks, the same size as the
  954.   diskette. Since I have created an ext2 file system on the diskette,
  955.   this completes all the conditions required for Linux to automatically
  956.   switch the root device to the ramdisk, and copy the diskette contents
  957.   there as well.
  958.  
  959.   The ramdisk features of Linux are described further in the section
  960.   above titled "RAM DISKS AND BOOT/ROOT SYSTEMS".
  961.  
  962.   It is also worth considering using the "single" parameter to cause
  963.   Linux to boot in single-user mode. This could be useful to prevent
  964.   users logging in on serial ports.
  965.  
  966.   I also use the "DELAY" "MESSAGE" and "TIMEOUT" statements so that when
  967.   I boot the disk, LILO will give me the opportunity to enter command
  968.   line options if I wish. I don't need them at present, but I never know
  969.   when I might want to set a different root device or mount a filesystem
  970.   read-only.
  971.  
  972.   The message file I use contains the message:
  973.  
  974.        Linux Boot/Root Diskette
  975.        ========================
  976.  
  977.        Enter a command line of the form:
  978.  
  979.              zImage [ command-line options]
  980.  
  981.        If nothing is entered, linux will be loaded with
  982.        defaults after 15 seconds.
  983.  
  984.   This is simply a reminder to myself what my choices are.
  985.  
  986.   Readers are urged to read the LILO documentation carefully before
  987.   atttempting to install anything. It is relatively easy to destroy
  988.   partitions if you use the wrong "boot = " parameter. If you are
  989.   inexperienced, do NOT run LILO until you are sure you understand it
  990.   and you have triple-checked your parameters.
  991.  
  992.   Note that you must re-run LILO every time you change the kernel, so
  993.   that LILO can set up its map file to correctly describe the new kernel
  994.   file. It is in fact possible to replace the kernel file with one which
  995.   is almost identical without rerunning LILO, but it is far better not
  996.   to gamble - if you change the kernel, re-run LILO.
  997.  
  998.   3.5.3.  Removing LILO
  999.  
  1000.   One other thing I might as well add here while I'm on the LILO topic:
  1001.   if you mess up lilo on a drive containing DOS, you can always replace
  1002.   the boot sector with the DOS boot loader by issuing the DOS command:
  1003.  
  1004.                FDISK /MBR
  1005.  
  1006.   where MBR stands for "Master Boot Record". Note that some purists
  1007.   disagree with this, and they may have grounds, but it works.
  1008.  
  1009.   3.5.4.  Useful LILO Options
  1010.  
  1011.   LILO has several useful options which are worth keeping in mind when
  1012.   building boot disks:
  1013.  
  1014.   ╖  Command line options - you can enter command line options to set
  1015.      the root device, ramdisk size (for kernels less than 1.3.48),
  1016.      special device parameters, or other things. If you include the
  1017.      DELAY = nn statement in your LILO configuration file, then LILO
  1018.      will pause to allow you to select a kernel image to boot, and to
  1019.      enter, on the same line, any options.  For example:
  1020.  
  1021.                zImage aha152x=0x340,11,3,1 ro
  1022.  
  1023.   will pass the aha152x parameters through to the aha152x scsi disk
  1024.   driver (provided that driver has been included when the kernel was
  1025.   built) and will ask for the root filesystem to be mounted read-only.
  1026.  
  1027.   ╖  Command line "lock" option - this option asks LILO to store the
  1028.      command line entered as the default command line to be used for all
  1029.      future boots. This is particularly useful where you have a device
  1030.      which cannot be autoselected. By using "lock" you can avoid having
  1031.      to type in the device parameter string every time you boot.  For
  1032.      example:
  1033.  
  1034.                zImage aha152x=0x340,11,3,1 root=/dev/sda8 ro lock
  1035.  
  1036.   ╖  APPEND configuration statement - this allows device parameter
  1037.      strings to be stored in the configuration, as an alternative to
  1038.      using the "lock" command line option. Note that any keywords of the
  1039.      form word=value MUST be enclosed in quotes. For example:
  1040.  
  1041.                APPEND = "aha152x=0x340,11,3,1"
  1042.  
  1043.   ╖  DELAY configuration statement - this pauses for DELAY tenths of
  1044.      seconds and allows the user to interrupt the automatic boot of the
  1045.      default command line, so that the user can enter an alternate
  1046.      command line.
  1047.  
  1048.   4.  Advanced Bootdisk Creation
  1049.  
  1050.   4.1.  Overview
  1051.  
  1052.   Previous Sections of this document covered the basics of creating
  1053.   boot/root disks, and are applicable to nearly all kernels up to the
  1054.   present (2.0, the latest stable kernel).
  1055.  
  1056.   Kernels 1.3.48+ involved a substantial rewrite of the ramdisk code,
  1057.   adding significant new capabilities.  These kernels could
  1058.   automatically detect compressed filesystems, uncompress them and load
  1059.   them into the ramdisk on boot-up.  Root filesystems could be placed on
  1060.   a second disk, and as of kernel 1.3.98 or so, ramdisks are dynamically
  1061.   expandable.
  1062.  
  1063.   Altogether, these new capabilities mean that boot disks can contain
  1064.   substantially more than they used to.  With compression, a 1722K disk
  1065.   may now hold up to about 3.5 megs of files.  As anyone who has created
  1066.   bootdisks knows, much time is spent pruning down the file set and
  1067.   finding trimmed-down versions of files that will all fit in a small
  1068.   filesystem.  With the new capabilities this is no longer such a
  1069.   concern.
  1070.  
  1071.   Unfortunately, creating bootdisks to exploit these new features is
  1072.   slightly more difficult now.  To build a compressed filesystem on a
  1073.   floppy, the filesystem has to be built on another device and then
  1074.   compressed and transferred to the floppy.  This means a few more
  1075.   steps.
  1076.  
  1077.   The basic strategy is to create a compressed root filesystem, copy the
  1078.   kernel to the floppy disk, tell the kernel where to find the root
  1079.   filesystem, then copy the compressed root filesystem to the floppy.
  1080.  
  1081.   Here's a simple ASCII drawing of what the disk will look like:
  1082.  
  1083.        |<--- zImage --->|<------ Compressed root filesystem -------->|
  1084.        |________________|____________________________________________|
  1085.                     Floppy disk space
  1086.  
  1087.   Here are the steps to create the boot floppy:
  1088.  
  1089.   4.2.  Creating a root filesystem
  1090.  
  1091.   The root filesystem is created pretty much the same way as outlined in
  1092.   Section 2.3 of this document.  The primary difference is that you can
  1093.   no longer create a root filesystem directly on a floppy -- you must
  1094.   create it on a separate device larger than the floppy area it will
  1095.   occupy.
  1096.  
  1097.   4.2.1.  Choosing a device
  1098.  
  1099.   In order to build such a root filesystem, you need a spare device that
  1100.   is large enough.  There are several choices:
  1101.  
  1102.   ╖  If you have an unused hard disk partition that is large enough
  1103.      (several megabytes), this is the easiest solution.  Alternatively,
  1104.      if you have enough physical RAM you can simply turn off swapping
  1105.      and build the filesystem in your swap partition.
  1106.  
  1107.      However, most people don't have a spare partition and can't afford
  1108.      to turn swapping off, so...
  1109.  
  1110.   ╖  Use a loopback device.  A loopback device allows a disk file on an
  1111.      existing filesystem to be treated as a device.  In order to use
  1112.      loopback devices you need specially modified mount and unmount
  1113.      programs.  You can find these at:
  1114.  
  1115.           ftp://ftp.win.tue.nl:/pub/linux/util/mount-2.5X.tar.gz
  1116.  
  1117.   where X is the latest modification letter.
  1118.  
  1119.   If you do not have loop devices (/dev/loop0, /dev/loop1, etc) on your
  1120.   system, you'll have to create them first.  The command
  1121.  
  1122.                MAKEDEV loop
  1123.  
  1124.   will do this.   (-- Older MAKEDEV scripts may not know about loop
  1125.   devices.  A MAKEDEV that can create loop devices is available in the
  1126.   directory ftp://tsx-11.mit.edu/pub/linux/sources/sbin/ --)
  1127.  
  1128.   One you've installed these special mount/umount binaries, create a
  1129.   temporary file on a hard disk with enough capacity (eg, /tmp/fsfile).
  1130.   You can use a command like
  1131.  
  1132.                dd if=/dev/zero of=/tmp/fsfile bs=1k count=nnn
  1133.  
  1134.   to create an nnn-block file.
  1135.  
  1136.   Use the file name in place of DEVICE below.  When you issue a mount
  1137.   command you must include the option "-o loop" to tell mount to use a
  1138.   loopback device.  For example:
  1139.  
  1140.                mount -o loop -t ext2 /tmp/fsfile /mnt
  1141.  
  1142.   will mount /tmp/fsfile (via a loopback device) at the mount point
  1143.   /mnt.  A 'df' will confirm this.
  1144.  
  1145.   ╖  A final option is to use the ramdisk (DEVICE = /dev/ram or
  1146.      /dev/ramdisk).  In this case, RAM is used to simulate a disk drive.
  1147.      The ramdisk must be large enough to hold a filesystem of the
  1148.      appropriate size. Check your Lilo configuration file
  1149.      (/etc/lilo.conf) for a line like:
  1150.  
  1151.                RAMDISK_SIZE = nnn
  1152.  
  1153.   which determines how much RAM will be allocated.  The default is
  1154.   4096K.
  1155.  
  1156.   After you've chosen one of these options, prepare the device with:
  1157.  
  1158.           dd if=/dev/zero of=DEVICE bs=1k count=3000
  1159.  
  1160.   This command zeroes out the device.  This step is important because
  1161.   the filesystem on the device will be compressed later, so all unused
  1162.   portions should be filled with zeroes to achieve maximum compression.
  1163.  
  1164.   Next, create the filesystem with:
  1165.  
  1166.                mke2fs -m 0 DEVICE
  1167.  
  1168.   (If you're using a loopback device, the disk file you're using should
  1169.   be supplied in place of this DEVICE.  In this case, mke2fs will ask if
  1170.   you really want to do this; say yes.)
  1171.  
  1172.   Then mount the device:
  1173.  
  1174.                mount -t ext2 DEVICE /mnt
  1175.  
  1176.   Proceed as before, copying files into /mnt, as specified in Section
  1177.   2.3.
  1178.  
  1179.   4.2.2.  Compressing the filesystem
  1180.  
  1181.   After you're done copying files into the root filesystem, you need to
  1182.   copy it back out and compress it.  First, umount it:
  1183.  
  1184.                umount /mnt
  1185.  
  1186.   (Technically you can copy the filesystem without unmounting it first,
  1187.   but that's somewhat dangerous, and bad practice.)
  1188.  
  1189.   Next, copy data off the device to a disk file.  Call the disk file
  1190.   rootfs:
  1191.  
  1192.                dd if=DEVICE of=rootfs bs=1k
  1193.  
  1194.   Then compress it.  Use the '-9' option of gzip for maximal
  1195.   compression:
  1196.  
  1197.                gzip -9 rootfs
  1198.  
  1199.   This may take several minutes.  When it finishes, you'll have a file
  1200.   rootfs.gz that is your compressed root filesystem.
  1201.  
  1202.   If you're tight on disk space you can combine dd and gzip:
  1203.  
  1204.                dd if=DEVICE bs=1k | gzip -9 > rootfs.gz
  1205.  
  1206.   4.3.  Calculating the space
  1207.  
  1208.   At this point, check the space to make sure both the kernel and the
  1209.   root filesystem will fit on the floppy.  An "ls -l" will show how many
  1210.   bytes each occupies; divide by 1024 to determine how many blocks each
  1211.   will need.  For partial blocks, be sure to round up to the next block.
  1212.  
  1213.   For example, if the kernel size is 453281 bytes, it will need
  1214.  
  1215.                ceil(453281 / 1024) = 443
  1216.  
  1217.   blocks, so it will occupy blocks 0-442 on the floppy disk.  The com¡
  1218.   pressed root filesystem will begin at block 443.  Remember this block
  1219.   number for the commands to follow; call it ROOTBEGIN.
  1220.  
  1221.   You must tell the kernel where on the floppy to find the root
  1222.   filesystem.  Inside the kernel image is a ramdisk word that specifies
  1223.   where the root filesystem is to be found, along with other options.
  1224.   The word is defined in /usr/src/linux/arch/i386/kernel/setup.c and is
  1225.   interpreted as follows:
  1226.  
  1227.                bits  0-10:     Offset to start of ramdisk, in 1024 byte blocks
  1228.                                (This is ROOTBEGIN, calculated above)
  1229.                bits 11-13:     unused
  1230.                bit     14:     Flag indicating that ramdisk is to be loaded
  1231.                bit     15:     Flag indicating to prompt for floppy
  1232.  
  1233.   (If bit 15 is set, on boot-up you will be prompted to place a new
  1234.   floppy disk in the drive.  This is necessary for a two-disk boot set,
  1235.   discussed below in the section "Making a two-disk set".  For now, this
  1236.   will be zero.)
  1237.  
  1238.   If the root filesystem is to begin at block 443, the ramdisk word is
  1239.  
  1240.                1BB (hex)       443 (decimal)     (bits 0-10)
  1241.             + 4000 (hex)       Ramdisk load flag (bit 14)
  1242.               ----------
  1243.             = 41BB (hex)
  1244.             =16827 (decimal)
  1245.  
  1246.   This ramdisk word will be set in the kernel image using the "rdev -r"
  1247.   command in the next section.
  1248.   4.4.  Copying files to the floppy
  1249.  
  1250.   At this point you're ready to create the boot floppy.  First copy the
  1251.   kernel:
  1252.  
  1253.                dd if=zImage of=/dev/fd0
  1254.  
  1255.   Next, tell the kernel to find its root filesystem on the floppy:
  1256.  
  1257.                rdev /dev/fd0 /dev/fd0
  1258.  
  1259.   Next, you have to set the ramdisk word in the kernel image now
  1260.   residing on the floppy.  The ramdisk word is set using the "rdev -r"
  1261.   command.  Using the figure calculated above in the section titled
  1262.   "Calculating the space":
  1263.  
  1264.                rdev -r zImage 16827
  1265.  
  1266.   Finally, place the root filesystem on the floppy after the kernel.
  1267.   The dd command has a seek option that allows you to specify how many
  1268.   blocks to skip:
  1269.  
  1270.                dd if=rootfs.gz of=/dev/fd0 bs=1k seek=443
  1271.  
  1272.   (The value 443 is ROOTBEGIN from the section "Calculating the space"
  1273.   above.)
  1274.  
  1275.   Wait for the floppy drive to finish writing, and you're done.
  1276.  
  1277.   4.5.  Making a two-disk set
  1278.  
  1279.   If you want more space, you can make a two-disk boot set.  In this
  1280.   case, the first floppy disk will contain the kernel alone, and the
  1281.   second will contain the compressed root filesystem.  With this
  1282.   configuration you can use a compressed filesystem of up to 1440K.
  1283.  
  1284.   A two-disk set is created using a simple variation of the instructions
  1285.   above.  First, you must set the ramdisk PROMPT flag to 1 to instruct
  1286.   the kernel to prompt and wait for the second floppy.  The root
  1287.   filesystem will begin at byte 0 of the second floppy.
  1288.  
  1289.   From the section "Calculating the space" above, the ramdisk PROMPT
  1290.   flag (bit 15) will be set to 1, and the ramdisk offset will be zero.
  1291.   In our example the new calculation would be:
  1292.  
  1293.                   4000 (hex)      Ramdisk load flag (bit 14)
  1294.                 + 8000 (hex)      Ramdisk prompt flag (bit 15)
  1295.                 ------------
  1296.                 = C000 (hex)
  1297.                 =49152 (decimal)
  1298.  
  1299.   which would be used in the 'rdev -r' calculation as before.
  1300.  
  1301.   Follow the instructions of "Copying files to the floppy" above, but
  1302.   after issuing the 'rdev -r' command, put a new floppy in the drive and
  1303.   issue the command:
  1304.  
  1305.                dd if=rootfs.gz of=/dev/fd0
  1306.  
  1307.   The seek option is not needed since the root filesystem starts at
  1308.   block zero.
  1309.  
  1310.   5.  Samples
  1311.  
  1312.   5.1.  Disk Directory Listings
  1313.  
  1314.   This lists the contents of directories from my root and utility
  1315.   diskettes. These lists are provided as an example only of the files
  1316.   included to create a working system. I have added some explanatory
  1317.   notes where it seemed useful.
  1318.  
  1319.   5.1.1.  Root Disk ls-lR Directory Listing
  1320.  
  1321.   total 18
  1322.   drwxr-xr-x   2 root     root         1024 Jul 29 21:16 bin/
  1323.   drwxr-xr-x   2 root     root         9216 Jul 28 16:21 dev/
  1324.   drwxr-xr-x   3 root     root         1024 Jul 29 20:25 etc/
  1325.   drwxr-xr-x   2 root     root         1024 Jul 28 19:53 lib/
  1326.   drwxr-xr-x   2 root     root         1024 Jul 24 22:47 mnt/
  1327.   drwxr-xr-x   2 root     root         1024 Jul 24 22:47 proc/
  1328.   drwxr-xr-x   2 root     root         1024 Jul 28 19:07 sbin/
  1329.   drwxr-xr-x   2 root     root         1024 Jul 29 20:57 tmp/
  1330.   drwxr-xr-x   4 root     root         1024 Jul 29 21:35 usr/
  1331.   drwxr-xr-x   3 root     root         1024 Jul 28 19:52 var/
  1332.  
  1333.   bin:
  1334.   total 713
  1335.   -rwxr-xr-x   1 root     bin          7737 Jul 24 22:16 cat*
  1336.   -rwxr-xr-x   1 root     bin          9232 Jul 24 22:48 chmod*
  1337.   -rwxr-xr-x   1 root     bin          8156 Jul 24 22:48 chown*
  1338.   -rwxr-xr-x   1 root     bin         19652 Jul 24 22:48 cp*
  1339.   -rwxr-xr-x   1 root     root         8313 Jul 29 21:16 cut*
  1340.   -rwxr-xr-x   1 root     bin         12136 Jul 24 22:48 dd*
  1341.   -rwxr-xr-x   1 root     bin          9308 Jul 24 22:48 df*
  1342.   -rwxr-xr-x   1 root     root         9036 Jul 29 20:24 dircolors*
  1343.   -rwxr-xr-x   1 root     bin          9064 Jul 24 22:48 du*
  1344.   -rwxr-x---   1 root     bin         69252 Jul 24 22:51 e2fsck*
  1345.   -rwxr-xr-x   1 root     bin          5361 Jul 24 22:48 echo*
  1346.   -rwxr-xr-x   1 root     bin          5696 Jul 24 22:16 hostname*
  1347.   -rwxr-xr-x   1 root     bin          6596 Jul 24 22:49 kill*
  1348.   -rwxr-xr-x   1 root     bin         10644 Jul 24 22:17 ln*
  1349.   -rwxr-xr-x   1 root     bin         13508 Jul 24 22:17 login*
  1350.   -rwxr-xr-x   1 root     bin         26976 Jul 24 22:17 ls*
  1351.   -rwxr-xr-x   1 root     bin          7416 Jul 24 22:49 mkdir*
  1352.   -rwxr-x---   1 root     bin         34596 Jul 24 22:51 mke2fs*
  1353.   -rwxr-xr-x   1 root     bin          6712 Jul 24 22:49 mknod*
  1354.   -rwxr-xr-x   1 root     bin         20304 Jul 24 22:17 more*
  1355.   -rwxr-xr-x   1 root     bin         24704 Jul 24 22:17 mount*
  1356.   -rwxr-xr-x   1 root     bin         12464 Jul 24 22:17 mv*
  1357.   -rwxr-xr-x   1 root     bin         20829 Jul 24 22:50 ps*
  1358.   -rwxr-xr-x   1 root     bin          9424 Jul 24 22:50 rm*
  1359.   -rwxr-xr-x   1 root     bin          4344 Jul 24 22:50 rmdir*
  1360.   -rwxr-xr-x   1 root     root       299649 Jul 27 14:12 sh*
  1361.   -rwxr-xr-x   1 root     bin          9853 Jul 24 22:17 su*
  1362.   -rwxr-xr-x   1 root     bin           380 Jul 27 14:12 sync*
  1363.   -rwxr-xr-x   1 root     bin         13620 Jul 24 22:17 umount*
  1364.   -rwxr-xr-x   1 root     root         5013 Jul 29 20:03 uname*
  1365.  
  1366.   dev:
  1367.   total 0
  1368.   lrwxrwxrwx   1 root     root           10 Jul 24 22:34 cdrom -> /dev/sbpcd
  1369.   crw--w--w-   1 root     tty        4,   0 Jul 24 21:49 console
  1370.   brw-rw----   1 root     floppy     2,   0 Apr 28  1995 fd0
  1371.   lrwxrwxrwx   1 root     root            4 Jul 24 22:34 ftape -> rft0
  1372.   crw-rw-rw-   1 root     sys       10,   2 Jul 18  1994 inportbm
  1373.   crw-rw----   1 root     kmem       1,   2 Jul 28 16:21 kmem
  1374.   crw-rw----   1 root     kmem       1,   1 Jul 18  1994 mem
  1375.   lrwxrwxrwx   1 root     root            4 Jul 24 22:34 modem -> cua0
  1376.   lrwxrwxrwx   1 root     root            4 Jul 24 22:34 mouse -> cua1
  1377.   crw-rw-rw-   1 root     sys        1,   3 Jul 18  1994 null
  1378.   brw-rw----   1 root     disk       1,   1 Jul 18  1994 ram
  1379.   crw-rw----   1 root     disk      27,   0 Jul 18  1994 rft0
  1380.   brw-rw----   1 root     disk      25,   0 Jul 19  1994 sbpcd
  1381.   ***  I have only included devices for the SCSI partitions I use.
  1382.   ***  If you use IDE, then use /dev/hdxx instead.
  1383.   brw-rw----   1 root     disk       8,   0 Apr 29  1995 sda
  1384.   brw-rw----   1 root     disk       8,   6 Apr 29  1995 sda6
  1385.   brw-rw----   1 root     disk       8,   7 Apr 29  1995 sda7
  1386.   brw-rw----   1 root     disk       8,   8 Apr 29  1995 sda8
  1387.   lrwxrwxrwx   1 root     root            7 Jul 28 12:56 systty -> console
  1388.   ***  this link from systty to console is required
  1389.   crw-rw-rw-   1 root     tty        5,   0 Jul 18  1994 tty
  1390.   crw--w--w-   1 root     tty        4,   0 Jul 18  1994 tty0
  1391.   crw--w----   1 root     tty        4,   1 Jul 24 22:33 tty1
  1392.   crw--w----   1 root     tty        4,   2 Jul 24 22:34 tty2
  1393.   crw--w--w-   1 root     root       4,   3 Jul 24 21:49 tty3
  1394.   crw--w--w-   1 root     root       4,   4 Jul 24 21:49 tty4
  1395.   crw--w--w-   1 root     root       4,   5 Jul 24 21:49 tty5
  1396.   crw--w--w-   1 root     root       4,   6 Jul 24 21:49 tty6
  1397.   crw-rw-rw-   1 root     tty        4,   7 Jul 18  1994 tty7
  1398.   crw-rw-rw-   1 root     tty        4,   8 Jul 18  1994 tty8
  1399.   crw-rw-rw-   1 root     tty        4,   9 Jul 19  1994 tty9
  1400.   crw-rw-rw-   1 root     sys        1,   5 Jul 18  1994 zero
  1401.  
  1402.   etc:
  1403.   total 20
  1404.   -rw-r--r--   1 root     root         2167 Jul 29 20:25 DIR_COLORS
  1405.   -rw-r--r--   1 root     root           20 Jul 28 12:37 HOSTNAME
  1406.   -rw-r--r--   1 root     root          109 Jul 24 22:57 fstab
  1407.   -rw-r--r--   1 root     root          271 Jul 24 22:21 group
  1408.   -rw-r--r--   1 root     root         2353 Jul 24 22:27 inittab
  1409.   -rw-r--r--   1 root     root            0 Jul 29 21:02 issue
  1410.   -rw-r--r--   1 root     root         2881 Jul 28 19:38 ld.so.cache
  1411.   ***  Lots of things get upset at boot time if ld.so.cache is missing, but
  1412.   ***  make sure that ldconfig is included and run from rc.x to
  1413.   ***  update it.
  1414.   -rw-r--r--   1 root     root           12 Jul 24 22:22 motd
  1415.   -rw-r--r--   1 root     root          606 Jul 28 19:25 passwd
  1416.   -rw-r--r--   1 root     root         1065 Jul 24 22:21 profile
  1417.   drwxr-xr-x   2 root     root         1024 Jul 29 21:01 rc.d/
  1418.   -rw-r--r--   1 root     root           18 Jul 24 22:21 shells
  1419.   -rw-r--r--   1 root     root          774 Jul 28 13:43 termcap
  1420.   -rw-r--r--   1 root     root          126 Jul 28 13:44 ttys
  1421.   -rw-r--r--   1 root     root            0 Jul 24 22:47 utmp
  1422.  
  1423.   etc/rc.d:
  1424.   total 5
  1425.   *** I didn't bother with shutdown scripts - everthing runs on a
  1426.   *** ramdisk, so there's not much point shutting it down.
  1427.   -rwxr-xr-x   1 root     root         1158 Jul 24 22:23 rc.K*
  1428.   -rwxr-xr-x   1 root     root         1151 Jul 28 19:08 rc.M*
  1429.   -rwxr-xr-x   1 root     root          507 Jul 29 20:25 rc.S*
  1430.  
  1431.   lib:
  1432.   total 588
  1433.   *** I have an ELF system, so I include the ELF loader ld-linux.so. if
  1434.   *** you are still on a.out, then you need ld.so. Use the file command to
  1435.   *** see which libraries you should include.
  1436.   lrwxrwxrwx   1 root     root           17 Jul 24 23:36 ld-linux.so.1 -> ld-linux.so.1.7.3*
  1437.   -rwxr-xr-x   1 root     root        20722 Aug 15  1995 ld-linux.so.1.7.3*
  1438.   lrwxrwxrwx   1 root     root           13 Jul 24 23:36 libc.so.5 -> libc.so.5.0.9*
  1439.   -rwxr-xr-x   1 root     root       562683 May 19  1995 libc.so.5.0.9*
  1440.   ***  Must include libtermcap
  1441.   lrwxrwxrwx   1 root     root           19 Jul 28 19:53 libtermcap.so.2 -> libtermcap.so.2.0.0*
  1442.   -rwxr-xr-x   1 root     root        11360 May 19  1995 libtermcap.so.2.0.0*
  1443.  
  1444.   mnt:
  1445.   total 0
  1446.  
  1447.   proc:
  1448.   total 0
  1449.  
  1450.   sbin:
  1451.   total 191
  1452.   ***  I use Slackware, which uses agetty. Many systems use getty.
  1453.   ***  Check your /etc/inittab to see which it uses. Note that you
  1454.   ***  need (a)getty and login to be able to start doing much.
  1455.   -rwxr-xr-x   1 root     bin         11309 Jul 24 22:54 agetty*
  1456.   -rwxr-xr-x   1 root     bin          5204 Jul 24 22:19 halt*
  1457.   ***  Must have this to boot
  1458.   -rwxr-xr-x   1 root     bin         20592 Jul 24 22:19 init*
  1459.   -rwxr-xr-x   1 root     root        86020 Jul 28 19:07 ldconfig*
  1460.   -rwxr-xr-x   1 root     bin          5329 Jul 27 14:10 mkswap*
  1461.   -rwxr-xr-x   1 root     root         5204 Jul 24 22:20 reboot*
  1462.   -rwxr-xr-x   1 root     bin         12340 Jul 24 22:20 shutdown*
  1463.   -rwxr-xr-x   1 root     root         5029 Jul 24 22:20 swapoff*
  1464.   -rwxr-xr-x   1 root     bin          5029 Jul 24 22:20 swapon*
  1465.   -rwxr-xr-x   1 root     root        20592 Jul 27 18:18 telinit*
  1466.   -rwxr-xr-x   1 root     root         7077 Jul 24 22:20 update*
  1467.  
  1468.   tmp:
  1469.   total 0
  1470.  
  1471.   usr:
  1472.   total 2
  1473.   drwxr-xr-x   2 root     root         1024 Jul 29 21:00 adm/
  1474.   drwxr-xr-x   2 root     root         1024 Jul 29 21:16 lib/
  1475.  
  1476.   usr/adm:
  1477.   total 0
  1478.  
  1479.   usr/lib:
  1480.   total 0
  1481.  
  1482.   var:
  1483.   total 1
  1484.   ***  Several things complained until I included this and
  1485.   ***  the /etc/rc.S code to initialise /var/run/utmp, but this
  1486.   ***  won't necessarily apply to your system.
  1487.   drwxr-xr-x   2 root     root         1024 Jul 28 19:52 run/
  1488.  
  1489.   var/run:
  1490.   total 0
  1491.  
  1492.   5.1.2.  Utility Disk ls-lR Directory Listing
  1493.  
  1494.        total 579
  1495.        -rwxr-xr-x   1 root     root        42333 Jul 28 19:05 cpio*
  1496.        -rwxr-xr-x   1 root     root       103560 Jul 29 21:31 elvis*
  1497.        -rwxr-xr-x   1 root     root        56401 Jul 28 19:06 find*
  1498.        -rw-r--r--   1 root     root       128254 Jul 28 19:03 ftape.o
  1499.        -rwxr-xr-x   1 root     root        64161 Jul 29 20:47 grep*
  1500.        -rwxr-xr-x   1 root     root        45309 Jul 29 20:48 gzip*
  1501.        -rwxr-xr-x   1 root     root        23560 Jul 28 19:04 insmod*
  1502.        -rwxr-xr-x   1 root     root          118 Jul 28 19:04 lsmod*
  1503.        lrwxrwxrwx   1 root     root            5 Jul 28 19:04 mt -> mt-st*
  1504.        -rwxr-xr-x   1 root     root         9573 Jul 28 19:03 mt-st*
  1505.        lrwxrwxrwx   1 root     root            6 Jul 28 19:05 rmmod -> insmod*
  1506.        -rwxr-xr-x   1 root     root       104085 Jul 28 19:05 tar*
  1507.        lrwxrwxrwx   1 root     root            5 Jul 29 21:35 vi -> elvis*
  1508.  
  1509.   5.2.  Shell Scripts to Build Diskettes
  1510.  
  1511.   These shell scripts are provided as examples only. I use them on my
  1512.   system to create rescue diskettes. You may find it convenient to use
  1513.   them, but if so, read the instructions carefully - for example, if you
  1514.   specify the wrong swap device, you will find your root filesystem has
  1515.   been throroughly and permanently erased.... so just be darn sure you
  1516.   have it correctly configured before you use it!
  1517.  
  1518.   The upside of the scripts are that they provide a quick way to get a
  1519.   rescue set together, by doing the following:
  1520.  
  1521.   ╖  copy a kernel to a bootdisk, and use rdev to configure it, as
  1522.      explained above.
  1523.  
  1524.   ╖  adjust mkroot to your system and build a root disk. Use the
  1525.      directory listing above as a guide to what to include.
  1526.  
  1527.   ╖  use mkutil to throw your favourite utilities onto one or more
  1528.      utility disks.
  1529.  
  1530.   There are two shell scripts:
  1531.  
  1532.   ╖  mkroot - builds a root or boot/root diskette.
  1533.  
  1534.   ╖  mkutil - builds a utility diskette.
  1535.  
  1536.   Both are currently configured to run in the parent directory of
  1537.   boot_disk and util_disk, each of which contains everything to be
  1538.   copied to it's diskette. Note that these shell scripts will *NOT*
  1539.   automatically set up and copy all the files for you - you work out
  1540.   which files are needed, set up the directories and copy the files to
  1541.   those directories. The shell scripts are samples which will copy the
  1542.   contents of those directories. Note that they are primitive shell
  1543.   scripts and are not meant for the novice user.
  1544.  
  1545.   The scripts both contain configuration variables at the start which
  1546.   allow them to be easily configured to run anywhere.  First, set up the
  1547.   model directories and copy all the required files into them. To see
  1548.   what directories and files are needed, have a look at the sample
  1549.   directory listings in the previous sections.
  1550.  
  1551.   Check the configuration variables in the shell scripts and change them
  1552.   as required before running the scripts.
  1553.  
  1554.   5.2.1.  mkroot - Make Root Diskette
  1555.  
  1556.   ______________________________________________________________________
  1557.   # mkroot: make a root disk - creates a root diskette
  1558.   #         by building a file system on it, then mounting it and
  1559.   #         copying required files from a model.
  1560.   #         Note: the model to copy from from must dirst be set up,
  1561.   #         then change the configuration variables below to suit
  1562.   #         your system.
  1563.   #
  1564.   # usage: mkroot [ -d swap | ram ]
  1565.   #       where swap means use $SWAPDEV swap device
  1566.   #       and ram means use $RAMDISKDEV ramdisk device
  1567.  
  1568.   # Copyright (c) Graham Chapman 1996. All rights reserved.
  1569.   # Permission is granted for this material to be freely
  1570.   # used and distributed, provided the source is acknowledged.
  1571.   # No warranty of any kind is provided. You use this material
  1572.   # at your own risk.
  1573.  
  1574.   # Configuration variables - set these to suit your system
  1575.   #
  1576.   ####  set the device to use to build the root filesystem on.
  1577.   ####  ramdisk is safer - swap is ok only if you have plenty of
  1578.   ####  free memory. If linux can't swap then things get nasty.
  1579.   USEDEVICE="ramdisk"             # set to either "ramdisk" or "swap"
  1580.   RAMDISKDEV="/dev/ram"           # ramdisk device <==== CHANGE if using ramdisk
  1581.   SWAPDEV="/dev/sda7"             # swap device    <==== CHANGE if using swap
  1582.   FSBLOCKS=3072                   # desired filesystem size in blocks
  1583.   #
  1584.   ####  set name or directory where you have set up your rootdisk
  1585.   ####  model
  1586.   ROOTDISKDIR="./root_disk"       # name of root disk directory
  1587.   MOUNTPOINT="/mnt"               # temporary mount point for diskette
  1588.   DISKETTEDEV="/dev/fd0"          # device name of diskette drive
  1589.   LOGFL="`pwd`/mkroot.log"        # log filename
  1590.   TEMPROOTFS="/tmp/mkrootfs.gz"   # temp file for compressed filesystem
  1591.   # End of Configuration variables
  1592.  
  1593.   # Internal variables
  1594.   ROOTDISKDEV=
  1595.  
  1596.   case $USEDEVICE in
  1597.   swap|ramdisk)   :;;
  1598.   *)      echo "Invalid setting for USEDEVICE variable"
  1599.           exit;;
  1600.   esac
  1601.  
  1602.   clear
  1603.   echo "    ***************** W A R N I N G ******************
  1604.  
  1605.   Use this script with care. If you don't understand it, then
  1606.   exit NOW!"
  1607.  
  1608.   if [ "$USEDEVICE" = "swap" ]
  1609.   then
  1610.           ROOTDISKDEV=$SWAPDEV
  1611.           echo -e "\nThis script will temporarily remove the swap file $SWAPDEV"
  1612.           echo "and use the space to build a compressed root filesystem from"
  1613.           echo "the files in the directory tree below $ROOTDISKDIR. To do this"
  1614.           echo "safely you must have 8Mb or more of memory, and you should"
  1615.           echo "switch to single user mode via 'init 1'."
  1616.           echo -e "\nIf you have used a ramdisk since the last reboot, then"
  1617.           echo "reboot NOW before using this script."
  1618.           echo -e "\nIf the script fails, you may not have a swap partition. Run 'free'"
  1619.           echo "and check the total size to see if it is correct. If the swap"
  1620.           echo "partition $SWAPDEV is missing, do the following:"
  1621.           echo "  umount $MOUNTPOINT"
  1622.           echo "  mkswap $SWAPDEV"
  1623.           echo "  swapon $SWAPDEV"
  1624.           echo "to restore the swap partition $SWAPDEV."
  1625.   else
  1626.           ROOTDISKDEV=$RAMDISKDEV
  1627.           echo -e "\nThis script will use a ramdisk of $FSBLOCKS Kb. To do this safely"
  1628.           echo "you must have at least 8Mb of memory. If you have only 8Mb you should"
  1629.           echo "ensure nothing else is running on the machine."
  1630.           echo -e "\nWhen the script is complete, the ramdisk will still be present, so"
  1631.           echo "you should reboot to reclaim the memory allocated to the ramdisk."
  1632.   fi
  1633.  
  1634.   echo -e "
  1635.   Do you want to continue (y/n)? \c"
  1636.   read ans
  1637.   if [ "$ans" != "Y" -a $ans != "y" ]
  1638.   then
  1639.           echo "not confirmed - aborting"
  1640.           exit
  1641.   fi
  1642.  
  1643.   echo "Starting mkroot at `date`" > $LOGFL
  1644.  
  1645.   if [ "$USEDEVICE" = "swap" ]
  1646.   then
  1647.           echo "Unmounting swap device $SWAPDEV" | tee -a $LOGFL
  1648.           swapoff $SWAPDEV >> $LOGFL 2>&1
  1649.   fi
  1650.  
  1651.   echo "Zeroing device $ROOTDISKDEV" | tee -a $LOGFL
  1652.   dd if=/dev/zero of=$ROOTDISKDEV bs=1024 count=$FSBLOCKS >> $LOGFL 2>&1
  1653.   if [ $? -ne 0 ]
  1654.   then
  1655.           echo "dd zeroing $ROOTDISKDEV failed" | tee -a $LOGFL
  1656.           exit 1
  1657.   fi
  1658.  
  1659.   echo "Creating filesystem on device $ROOTDISKDEV" | tee -a $LOGFL
  1660.   mke2fs -m0 $ROOTDISKDEV $FSBLOCKS >> $LOGFL 2>&1
  1661.  
  1662.   echo "Mounting $ROOTDISKDEV filesystem at $MOUNTPOINT" | tee -a $LOGFL
  1663.   mount -t ext2 $ROOTDISKDEV $MOUNTPOINT >> $LOGFL 2>&1
  1664.   if [ $? -ne 0 ]
  1665.   then
  1666.           echo "mount failed"
  1667.           exit 1
  1668.   fi
  1669.  
  1670.   # copy the directories containing files
  1671.   echo "Copying files from $ROOTDISKDIR to $MOUNTPOINT" | tee -a $LOGFL
  1672.   currdir=`pwd`
  1673.   cd $ROOTDISKDIR
  1674.   find . -print | cpio -dpumv $MOUNTPOINT >> $LOGFL 2>&1
  1675.   if [ $? -ne 0 ]
  1676.   then
  1677.           echo "cpio step failed."
  1678.           cd $currdir
  1679.           exit 1
  1680.   fi
  1681.   cd $currdir
  1682.  
  1683.   fssize=`du -sk $MOUNTPOINT|cut -d"      " -f1`
  1684.   echo "Uncompressed root filesystem size is $fssize Kb" | tee -a $LOGFL
  1685.   echo "Unmounting filesystem from $ROOTDISKDEV" | tee -a $LOGFL
  1686.   umount $MOUNTPOINT >> $LOGFL 2>&1
  1687.  
  1688.   echo "Compressing filesystem from $ROOTDISKDEV into $TEMPROOTFS
  1689.           This may take a few minutes..." | tee -a $LOGFL
  1690.  
  1691.   #       We don't bother with gzip -9 here - takes more than twice as long
  1692.   #       and saves less than 1% in space on my root disk...
  1693.   dd if=$ROOTDISKDEV bs=1024 count=$FSBLOCKS 2>>$LOGFL | gzip -c > $TEMPROOTFS
  1694.  
  1695.   fssize=`du -k $TEMPROOTFS|cut -d"       " -f1`
  1696.   echo "Compressed root filesystem size is $fssize Kb" | tee -a $LOGFL
  1697.  
  1698.   echo -e "Insert diskette in $DISKETTEDEV and press any key
  1699.           ***  Warning: data on diskette will be overwritten!\c"
  1700.   read ans
  1701.  
  1702.   echo "Copying compressed filesystem from $TEMPROOTFS to $DISKETTEDEV" | tee -a $LOGFL
  1703.   dd if=$TEMPROOTFS of=$DISKETTEDEV >>$LOGFL 2>&1
  1704.   if [ $? -ne 0 ]
  1705.   then
  1706.           echo "copy step failed."
  1707.           exit 1
  1708.   fi
  1709.  
  1710.   if [ "$USEDEVICE" = "swap" ]
  1711.   then
  1712.           echo "Reinitialising swap device $SWAPDEV" | tee -a $LOGFL
  1713.           mkswap $SWAPDEV >> $LOGFL 2>&1
  1714.           echo "Starting swapping to swap device $SWAPDEV" | tee -a $LOGFL
  1715.           swapon $SWAPDEV >> $LOGFL 2>&1
  1716.   fi
  1717.  
  1718.   echo "Deleting $TEMPROOTFS" | tee -a $LOGFL
  1719.   rm $TEMPROOTFS
  1720.  
  1721.   echo "mkroot completed at `date`" >> $LOGFL
  1722.  
  1723.   echo "Root diskette creation complete - please read log file $LOGFL"
  1724.   ______________________________________________________________________
  1725.  
  1726.   5.2.2.  mkutil - Make Utility Diskette
  1727.  
  1728.   ______________________________________________________________________
  1729.   # mkutil: make a utility diskette - creates a utility diskette
  1730.   #         by building a file system on it, then mounting it and
  1731.   #         copying required files from a model.
  1732.   #         Note: the model to copy from from must first be set up,
  1733.   #         then change the configuration variables below to suit
  1734.   #         your system.
  1735.  
  1736.   # Copyright (c) Graham Chapman 1996. All rights reserved.
  1737.   # Permission is granted for this material to be freely
  1738.   # used and distributed, provided the source is acknowledged.
  1739.   # No warranty of any kind is provided. You use this material
  1740.   # at your own risk.
  1741.  
  1742.   # Configuration variables...
  1743.   UTILDISKDIR=./util_disk         # name of directory containing model
  1744.   MOUNTPOINT=/mnt                 # temporary mount point for diskette
  1745.   DISKETTEDEV=/dev/fd0            # device name of diskette drive
  1746.  
  1747.   echo $0: create utility diskette
  1748.   echo Warning: data on diskette will be overwritten!
  1749.   echo Insert diskette in $DISKETTEDEV and and press any key...
  1750.   read anything
  1751.  
  1752.   mke2fs $DISKETTEDEV
  1753.   if [ $? -ne 0 ]
  1754.   then
  1755.           echo mke2fs failed
  1756.           exit
  1757.   fi
  1758.  
  1759.   # Any file system type would do here
  1760.   mount -t ext2 $DISKETTEDEV $MOUNTPOINT
  1761.   if [ $? -ne 0 ]
  1762.   then
  1763.           echo mount failed
  1764.           exit
  1765.   fi
  1766.  
  1767.   # copy the directories containing files
  1768.   cp -dpr $UTILDISKDIR/* $MOUNTPOINT
  1769.  
  1770.   umount $MOUNTPOINT
  1771.  
  1772.   echo Utility diskette complete
  1773.   ______________________________________________________________________
  1774.  
  1775.   6.  FAQ
  1776.  
  1777.   6.1.  Q. I boot from my boot/root disks and nothing happens. What do I
  1778.   do?
  1779.  
  1780.   This is the most common problem experienced by first-time root disk
  1781.   users, and it can be quite tricky finding the cause. The basic problem
  1782.   is that there is very little that is exactly the same in all Linux
  1783.   systems, but to get a system to boot to the stage where it will talk
  1784.   to you requires several components to be present and correctly
  1785.   configured.
  1786.  
  1787.   The first thing to be understood is that creating a root disk is
  1788.   usually an iterative process. Requirements change as the kernel
  1789.   changes, and different distributions arrange things in different ways.
  1790.   The normal boot process is for the kernel to execute /sbin/init, which
  1791.   in turn reads /etc/inittab to find out what to execute next... but
  1792.   anything is possible, so to understand things you must RTFM,
  1793.   including:
  1794.  
  1795.   ╖  the man pages for init, inittab , agetty or getty, login, ldconfig.
  1796.  
  1797.   ╖  the kernel documentation in /usr/src/linux/Documentation.
  1798.  
  1799.   ╖  the /etc/rc.x scripts and /etc/inittab in your system.
  1800.  
  1801.   The general approach to building a root disk is to assemble components
  1802.   from your existing system, and try and get the diskette-based system
  1803.   to the point where it displays messages on the console. Once it starts
  1804.   talking to you, the battle is half over, because you can see what it
  1805.   is complaining about, and you can fix individual problems until the
  1806.   system works smoothly.
  1807.  
  1808.   Inittab is possibly the trickiest part because its syntax and content
  1809.   depend on the init program used and the nature of the system. The only
  1810.   way to tackle it really is to read the man pages for init and inittab
  1811.   and work out exactly what your existing system is doing when it boots.
  1812.  
  1813.   The recommended procedure for investigating the problem where the
  1814.   system will not talk to you is as follows:
  1815.  
  1816.   ╖  check that the root disk actually contains the directories you
  1817.      think it does. It is easy to copy at the wrong level so that you
  1818.      end up with something like /root_disk/bin instead of /bin on your
  1819.      root diskette.
  1820.  
  1821.   ╖  check /sbin/init is present, and /etc/inittab has a system
  1822.      initialisation entry. This should contain a command of the form
  1823.      /etc/rc.x, to execute one of the /etc/rc scripts. The specific
  1824.      script in the inittab must exist.
  1825.  
  1826.   ╖  check what the the /etc/rc.x script specified in inittab does
  1827.      exist.  All commands that it executes must be present on the disk.
  1828.  
  1829.   ╖  check that there is a /lib/libc.so and /lib/libtermcap.so, with the
  1830.      same links as appear in your lib directory on your hard disk.
  1831.  
  1832.   ╖  check that any symbolic links in your /dev directory in your
  1833.      existing system also exist on your root diskette filesystem, where
  1834.      those links are to devices which you have included in your root
  1835.      diskette. In particular, /dev/console links are essential in many
  1836.      cases.
  1837.  
  1838.   ╖  check that you have included /dev/tty1 on your root disk.
  1839.  
  1840.   ╖  check that you have included /dev/null, /dev/zero, /dev/mem,
  1841.      /dev/ram and /dev/kmem devices.
  1842.  
  1843.   ╖  check your kernel configuration - support for all resources
  1844.      required up to login point must be built in, not modules. Also,
  1845.      ramdisk support must be included.
  1846.  
  1847.   ╖  check that your kernel root device and ramdisk settings are
  1848.      correct. Refer to the Advanced Bootdisk Creation section for
  1849.      details.
  1850.  
  1851.   6.2.  Q. How can I make a boot disk with a XXX driver?
  1852.  
  1853.   The easiest way is to obtain a Slackware kernel from your nearest
  1854.   Slackware mirror site. Slackware kernels are generic kernels which
  1855.   atttempt to include drivers for as many devices as possible, so if you
  1856.   have a SCSI or IDE controller, chances are that a driver for it is
  1857.   included in the Slackware kernel.
  1858.  
  1859.   Go to the a1 directory and select either IDE or SCSI kernel depending
  1860.   on the type of controller you have. Check the xxxxkern.cfg file for
  1861.   the selected kernel to see the drivers which have been included in
  1862.   that kernel. If the device you want is in that list, then the
  1863.   corresponding kernel should boot your computer. Download the
  1864.   xxxxkern.tgz file and copy it to your boot diskette as described above
  1865.   in the section on making boot disks.
  1866.  
  1867.   You must then check the root device in the kernel, using the rdev
  1868.   command:
  1869.  
  1870.                rdev zImage
  1871.  
  1872.   Rdev will then display the current root device in the kernel. If this
  1873.   is not the same as the root device you want, then use rdev to change
  1874.   it.  For example, the kernel I tried was set to /dev/sda2, but my root
  1875.   scsi partition is /dev/sda8. To use a root diskette, you would have to
  1876.   use the command:
  1877.  
  1878.                rdev zImage /dev/fd0
  1879.  
  1880.   If you want to know how to set up a Slackware root disk as well,
  1881.   that's outside the scope of this HOWTO, so I suggest you check the
  1882.   Linux Install Guide or get the Slackware distribution. See the section
  1883.   in this HOWTO titled "References".
  1884.  
  1885.   6.3.  Q. How do I update my boot floppy with a new kernel?
  1886.  
  1887.   Just copy the kernel to your boot diskette using the dd command for a
  1888.   boot diskette without a filesystem, or the cp command for a boot/root
  1889.   disk. Refer to the section in this HOWTO titled "Boot" for details on
  1890.   creating a boot disk. The description applies equally to updating a
  1891.   kernel on a boot disk.
  1892.  
  1893.   6.4.  Q. How do I remove LILO so that I can use DOS to boot again?
  1894.  
  1895.   This is not really a Bootdisk topic, but it is asked so often, so: the
  1896.   answer is, use the DOS command:
  1897.  
  1898.                FDISK /MBR
  1899.  
  1900.   MBR stands for Master Boot Record, and it replaces the boot sector
  1901.   with a clean DOS one, without affecting the partition table. Some
  1902.   purists disagree with this, but even the author of LILO, Werner
  1903.   Almesberger, suggests it. It is easy, and it works.
  1904.  
  1905.   You can also use the dd command to copy the backup saved by LILO to
  1906.   the boot sector - refer to the LILO documentation if you wish to do
  1907.   this.
  1908.  
  1909.   6.5.  Q. How can I boot if I've lost my kernel AND my boot disk?
  1910.  
  1911.   If you don't have a boot disk standing by, then probably the easiest
  1912.   method is to obtain a Slackware kernel for your disk controller type
  1913.   (IDE or SCSI) as described above for "How do I make a boot disk with a
  1914.   XXX driver?". You can then boot your computer using this kernel, then
  1915.   repair whatever damage there is.
  1916.  
  1917.   The kernel you get may not have the root device set to the disk type
  1918.   and partition you want. For example, Slackware's generic scsi kernel
  1919.   has the root device set to /dev/sda2, whereas my root Linux partition
  1920.   happens to be /dev/sda8. In this case the root device in the kernel
  1921.   will have to be changed.
  1922.  
  1923.   You can still change the root device and ramdisk settings in the
  1924.   kernel even if all you have is a kernel, and some other operating
  1925.   system, such as DOS.
  1926.  
  1927.   Rdev changes kernel settings by changing the values at fixed offsets
  1928.   in the kernel file, so you can do the same if you have a hex editor
  1929.   available on whatever systems you do still have running - for example,
  1930.   Norton Utilities Disk Editor under DOS.  You then need to check and if
  1931.   necessary change the values in the kernel at the following offsets:
  1932.  
  1933.        0x01F8  Low byte of RAMDISK size
  1934.        0x01F9  High byte of RAMDISK size
  1935.        0x01FC  Root minor device number - see below
  1936.        0X01FD  Root major device number - see below
  1937.  
  1938.   The ramdisk size is the number of blocks of ramdisk to create.  If you
  1939.   want to boot from a root diskette then set this to decimal 1440, which
  1940.   is 0x05A0, thus set offset 0x01F8 to 0xA0 and offset 0x01F9 to 0x05.
  1941.   This will allocate enough space for a 1.4Mb diskette.
  1942.  
  1943.   Note that the meaning of the ramdisk size word changed in kernel
  1944.   version 1.3.48. This meaning is described in the section titled
  1945.   "Advanced Bootdisk Creation".
  1946.  
  1947.   The major and minor device numbers must be set to the device you want
  1948.   to mount your root filesystem on. Some useful values to select from
  1949.   are:
  1950.  
  1951.        device          major minor
  1952.        /dev/fd0            2     0   1st floppy drive
  1953.        /dev/hda1           3     1   partition 1 on 1st IDE drive
  1954.        /dev/sda1           8     1   partition 1 on 1st scsi drive
  1955.        /dev/sda8           8     8   partition 8 on 1st scsi drive
  1956.  
  1957.   Once you have set these values then you can write the file to a
  1958.   diskette using either Norton Utilities Disk Editor, or a program
  1959.   called rawrite.exe. This program is included in several distributions,
  1960.   including the SLS and Slackware distributions.  It is a DOS program
  1961.   which writes a file to the "raw" disk, starting at the boot sector,
  1962.   instead of writing it to the file system. If you use Norton Utilities,
  1963.   then you must write the file to a physical disk starting at the
  1964.   beginning of the disk.
  1965.  
  1966.   6.6.  Q. How can I make extra copies of boot/root diskettes?
  1967.  
  1968.   It is never desirable to have just one set of rescue disks - 2 or 3
  1969.   should be kept in case one is unreadable.
  1970.  
  1971.   The easiest way of making copies of any diskettes, including bootable
  1972.   and utility diskettes, is to use the dd command to copy the contents
  1973.   of the original diskette to a file on your hard drive, and then use
  1974.   the same command to copy the file back to a new diskette.  Note that
  1975.   you do not need to, and should not, mount the diskettes, because dd
  1976.   uses the raw device interface.
  1977.  
  1978.   To copy the original, enter the command:
  1979.  
  1980.                dd if=devicename of=filename
  1981.                where   devicename the device name of the diskette
  1982.                        drive
  1983.                and     filename the name of the file where you
  1984.                        want to copy to
  1985.  
  1986.   For example, to copy from /dev/fd0 to a temporary file called
  1987.   /tmp/diskette.copy, I would enter the command:
  1988.  
  1989.                dd if=/dev/fd0 of=/tmp/diskette.copy
  1990.  
  1991.   Omitting the "count" parameter, as we have done here, means that the
  1992.   whole diskette of 2880 (for a high-density) blocks will be copied.
  1993.  
  1994.   To copy the resulting file back to a new diskette, insert the new
  1995.   diskette and enter the reverse command:
  1996.  
  1997.                dd if=filename of=devicename
  1998.  
  1999.   Note that the above discussion assumes that you have only one diskette
  2000.   drive. If you have two of the same type, then you can copy diskettes
  2001.   using a command like:
  2002.  
  2003.                dd if=/dev/fd0 of=/dev/fd1
  2004.  
  2005.   6.7.  Q. How can I boot without typing in "ahaxxxx=nn,nn,nn" every
  2006.   time?
  2007.  
  2008.   Where a disk device cannot be autodetected it is necessary to supply
  2009.   the kernel with a command device parameter string, such as:
  2010.  
  2011.                aha152x=0x340,11,3,1
  2012.  
  2013.   This parameter string can be supplied in several ways using LILO:
  2014.  
  2015.   ╖  By entering it on the command line every time the system is booted
  2016.      via LILO. This is boring, though.
  2017.  
  2018.   ╖  By using the LILO "lock" keyword to make it store the command line
  2019.      as the default command line, so that LILO will use the same options
  2020.      every time it boots.
  2021.  
  2022.   ╖  By using the APPEND statement in the lilo config file. Note that
  2023.      the parameter string must be enclosed in quotes.
  2024.  
  2025.   For example, a sample command line using the above parameter string
  2026.   would be:
  2027.  
  2028.                zImage  aha152x=0x340,11,3,1 root=/dev/sda1 lock
  2029.  
  2030.   This would pass the device parameter string through, and also ask the
  2031.   kernel to set the root device to /dev/sda1 and save the whole command
  2032.   line and reuse it for all future boots.
  2033.  
  2034.   A sample APPEND statement is:
  2035.  
  2036.                APPEND = "aha152x=0x340,11,3,1"
  2037.  
  2038.   Note that the parameter string must NOT be enclosed in quotes on the
  2039.   command line, but it MUST be enclosed in quotes in the APPEND
  2040.   statement.
  2041.  
  2042.   Note also that for the parameter string to be acted on, the kernel
  2043.   must contain the driver for that disk type. If it does not, then there
  2044.   is nothing listening for the parameter string, and you will have to
  2045.   rebuild the kernel to include the required driver. For details on
  2046.   rebuilding the kernel, cd to /usr/src/linux and read the README, and
  2047.   read the Linux FAQ and Installation HOWTO. Alternatively you could
  2048.   obtain a generic kernel for the disk type and install that.
  2049.  
  2050.   Readers are strongly urged to read the LILO documentation before
  2051.   experimenting with LILO installation. Incautious use of the "BOOT"
  2052.   statement can damage partitions.
  2053.  
  2054.   6.8.  Q. How can I create an oversize ramdisk filesystem?
  2055.  
  2056.   For kernels 1.3.48+, it is best to create a compressed filesystem as
  2057.   described in Advanced Bootdisk Creation. If your kernel is earlier
  2058.   than this, you can either upgrade, or refer to version 2.0 or below of
  2059.   this HOWTO.
  2060.  
  2061.   6.9.  Q. At boot time, I get error A: cannot execute B. Why?
  2062.  
  2063.   There are several cases of program names being hardcoded in various
  2064.   utilities. These cases do not occur everywhere, but they may explain
  2065.   why an executable apparently cannot be found on your system even
  2066.   though you can see that it is there. You can find out if a given
  2067.   program has the name of another hardcoded by using the "strings"
  2068.   command and piping the output through grep.
  2069.  
  2070.   Known examples of hardcoding are:
  2071.  
  2072.   ╖  Shutdown in some versions has /etc/reboot hardcoded, so reboot must
  2073.      be placed in the /etc directory.
  2074.  
  2075.   ╖  Init has caused problems for at least one person, with the kernel
  2076.      being unable to find init.
  2077.  
  2078.      To fix these problems, either move the programs to the correct
  2079.      directory, or change configuration files (e.g. inittab) to point to
  2080.      the correct directory. If in doubt, put programs in the same
  2081.      directories as they are on your hard disk, and use the same inittab
  2082.      and /etc/rc.d files as they appear on your hard disk.
  2083.  
  2084.   6.10.  Q. My kernel has ramdisk support, but initializes ramdisks of
  2085.   0K
  2086.  
  2087.   Where this occurs, a kernel message similar to:
  2088.  
  2089.        Ramdisk driver initialized : 16 ramdisks of 0K size
  2090.  
  2091.   appears as the kernel is booting. The size should be either the
  2092.   default of 4096K, or the size specified in kernel parameters
  2093.   ramdisk_size or ramdisk.  If the size is 0K, it is probably because
  2094.   the size has been set to 0 by kernel parameters at boot time. This
  2095.   could possibly be because of an overlooked LILO configuration file
  2096.   parameter:
  2097.  
  2098.        ramdisk 0
  2099.  
  2100.   This was included in sample LILO configuration files included in some
  2101.   older distributions, and was put there to override any previous kernel
  2102.   setting.  Since 1.3.48 it is irrelevant, because the ramdisk_size
  2103.   kernel parameter now sets the maximum ramdisk size, not the size
  2104.   allocated at boot time.  No ramdisk memory is allocated at boot time.
  2105.  
  2106.   The solution is to remove the LILO ramdisk parameter.
  2107.  
  2108.   Note that if you attempt to use a ramdisk which has been set to 0K,
  2109.   then behaviour can be unpredictable, and can result in kernel panics.
  2110.  
  2111.   7.  References
  2112.  
  2113.   In this section, vvv is used in package names in place of the version,
  2114.   to avoid referring here to specific versions. When retrieving a
  2115.   package, always get the latest version unless you have good reasons
  2116.   for not doing so.
  2117.  
  2118.   7.1.  LILO - Linux Loader
  2119.  
  2120.   Written by Werner Almesberger. Excellent boot loader, and the
  2121.   documentation includes information on the boot sector contents and the
  2122.   early stages of the boot process.
  2123.  
  2124.   Ftp from: tsx-11.mit.edu: /pub/linux/packages/lilo/lilo.vvv.tar.gz
  2125.   also on sunsite and mirror sites.
  2126.  
  2127.   7.2.  Linux FAQ and HOWTOs
  2128.  
  2129.   These are available from many sources. Look at the usenet newsgroups
  2130.   news.answers and comp.os.linux.announce.
  2131.  
  2132.   Ftp from: sunsite.unc.edu:/pub/Linux/docs
  2133.  
  2134.   ╖  FAQ is in /pub/linux/docs/faqs/linux-faq
  2135.  
  2136.   ╖  HOWTOs are in /pub/Linux/docs/HOWTO
  2137.  
  2138.   For WWW, start at the Linux documentation home page:
  2139.  
  2140.        http://sunsite.unc.edu/mdw/linux.html
  2141.  
  2142.   If desperate, send mail to:
  2143.  
  2144.                mail-server@rtfm.mit.edu
  2145.  
  2146.   with the word "help" in the message, then follow the mailed
  2147.   instructions.
  2148.  
  2149.   Note: if you haven't read the Linux FAQ and related documents such as
  2150.   the Linux Installation HOWTO and the Linux Install Guide, then you
  2151.   should not be trying to build boot diskettes.
  2152.  
  2153.   7.3.  Ramdisk Usage
  2154.  
  2155.   An excellent description of the how the new ramdisk code works may be
  2156.   found with the documentation supplied with the Linux kernel.  See
  2157.   /usr/src/linux/Documentation/ramdisk.txt.  It is written by Paul
  2158.   Gortmaker and includes a section on creating a compressed ramdisk,
  2159.   similar to the section titled "Advanced Bootdisk Creation" of this
  2160.   HOWTO.
  2161.  
  2162.   7.4.  Rescue Packages
  2163.  
  2164.   7.4.1.  Bootkit
  2165.  
  2166.   Written by Scott Burkett. Bootkit provides a flexible menu-driven
  2167.   framework for managing rescue disk creation and contents. It uses the
  2168.   Dialog package to provide nice menus, and a straight-forward directory
  2169.   tree to contain definitions of rescue disk contents. The package
  2170.   includes samples of the main files needed. The package aims to provide
  2171.   only the framework; it is up to the user to work out what to put on
  2172.   the disks and set up the config files accordingly.  For those users
  2173.   who don't mind doing this, it is a good choice.
  2174.  
  2175.   Ftp from: sunsite.unc.edu: /pub/Linux/system/Recovery/Bootkit-
  2176.   vvv.tar.gz
  2177.  
  2178.   7.4.2.  CatRescue
  2179.  
  2180.   Written by Oleg Kibirev. This package concentrates on saving space on
  2181.   the rescue diskettes by extensive use of compression, and by
  2182.   implementing executables as shells scripts. The doco includes some
  2183.   tips on what to do in various disaster situations.
  2184.  
  2185.   Ftp from: gd.cs.csufresno.edu/pub/sun4bin/src/CatRescue100.tgz
  2186.  
  2187.   7.4.3.  Rescue Shell Scripts
  2188.  
  2189.   Written by Thomas Heiling. This contains shell scripts to produce boot
  2190.   and boot/root diskettes. It has some dependencies on specific versions
  2191.   of other software such as LILO, and so might need some effort to
  2192.   convert to your system, but it might be useful as a starting point if
  2193.   you wanted more comprehensive shell scripts than are provided in this
  2194.   document.
  2195.  
  2196.   Ftp from: sunsite.unc.edu:/pub/Linux/system/Recovery/rescue.tgz
  2197.  
  2198.   7.4.4.  SAR - Search and Rescue
  2199.  
  2200.   Written by Karel Kubat. SAR produces a rescue diskette, using several
  2201.   techniques to minimize the space required on the diskette.  The manual
  2202.   includes a description of the Linux boot/login process.
  2203.  
  2204.   Ftp from: ftp.icce.rug.nl:/pub/unix/SAR-vvv.tar.gz
  2205.  
  2206.   The manual is available via WWW from:
  2207.  
  2208.   http://www.icce.rug.nl/karel/programs/SAR.html
  2209.  
  2210.   7.4.5.  YARD
  2211.  
  2212.   Written by Tom Fawcett.  Yard produces customized rescue diskettes
  2213.   using the compressed ramdisk option of more recent kernels (1.3.48+).
  2214.   Yard was designed to automate most of the instructions in Section 4,
  2215.   above.  In addition, Yard checks your file selections (loaders and
  2216.   libraries, and /etc/fstab, rc, and passwd) to make sure you've
  2217.   included everything needed to make a bootable rescue disk.  Yard needs
  2218.   Perl 5 and LILO, and works with kernel 1.3.48+.
  2219.  
  2220.   Ftp from: sunsite.unc.edu:/pub/Linux/system/Recovery/yard-1.n.tar.gz
  2221.  
  2222.   A companion set of customized rescue specifications is available for
  2223.   use with Yard.
  2224.  
  2225.   Ftp from: sunsite.unc.edu:/pub/Linux/system/Recovery/yard-prefabs-
  2226.   n.tar.gz
  2227.  
  2228.   7.5.  Slackware Distribution
  2229.  
  2230.   Apart from being one of the more popular Linux distributions around,
  2231.   it is also a good place to get a generic kernel. It is available from
  2232.   almost everywhere, so there is little point in putting addresses here.
  2233.  
  2234.