384 lines
16 KiB
HTML
384 lines
16 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>The Linux Bootdisk HOWTO: FAQ</TITLE>
|
|
</HEAD>
|
|
<BODY bgcolor="#ffffff">
|
|
<A HREF="Bootdisk-HOWTO-5.html"><IMG SRC="prev.gif" ALT="Previous"></A>
|
|
<A HREF="Bootdisk-HOWTO-7.html"><IMG SRC="next.gif" ALT="Next"></A>
|
|
<A HREF="Bootdisk-HOWTO.html#toc6"><IMG SRC="toc.gif" ALT="Contents"></A>
|
|
<HR>
|
|
<H2><A NAME="s6">6. FAQ</A></H2>
|
|
|
|
|
|
<H2><A NAME="ss6.1">6.1 Q. How can I make a boot disk with a XXX driver?</A></H2>
|
|
|
|
<P>The easiest way is to obtain a Slackware kernel from your nearest
|
|
Slackware mirror site. Slackware kernels are generic kernels which atttempt
|
|
to include drivers for as many devices as possible, so if you have a
|
|
SCSI or IDE controller, chances are that a driver for it is included
|
|
in the Slackware kernel.</P>
|
|
<P>Go to the a1 directory and select either IDE or SCSI
|
|
kernel depending on the type of controller you have. Check the xxxxkern.cfg
|
|
file for the selected kernel to see the drivers which have been included
|
|
in that kernel. If the device you want is in that list, then the
|
|
corresponding kernel should boot your computer. Download the xxxxkern.tgz
|
|
file and copy it to your boot diskette as described above in the section
|
|
on making boot disks.</P>
|
|
<P>You must then check the root device in the kernel, using the rdev
|
|
command:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
rdev zImage
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
</P>
|
|
<P>Rdev will then display the current root device in the kernel. If this
|
|
is not the same as the root device you want, then use rdev to change it.
|
|
For example, the kernel I tried was set to /dev/sda2, but my root
|
|
scsi partition is /dev/sda8. To use a root diskette, you would have
|
|
to use the command:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
rdev zImage /dev/fd0
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
</P>
|
|
<P>If you want to know how to set up a Slackware root disk as well,
|
|
that's outside the scope of this HOWTO, so I suggest you check the
|
|
Linux Install Guide or get the Slackware distribution. See the section
|
|
in this HOWTO titled "References".</P>
|
|
|
|
|
|
<H2><A NAME="ss6.2">6.2 Q. How do I update my boot floppy with a new kernel?</A></H2>
|
|
|
|
<P>Just copy the kernel to your boot diskette using the dd command for
|
|
a boot diskette without a filesystem, or the cp command for a
|
|
boot/root disk. Refer to the section in this HOWTO titled "Boot"
|
|
for details on creating a boot disk. The description applies equally
|
|
to updating a kernel on a boot disk.</P>
|
|
|
|
|
|
<H2><A NAME="ss6.3">6.3 Q. How do I remove LILO so that I can use DOS to boot again?</A></H2>
|
|
|
|
<P>This is not really a Bootdisk topic, but it is asked so often, so: the
|
|
answer is, use the DOS command:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
FDISK /MBR
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
</P>
|
|
<P>MBR stands for Master Boot Record, and it replaces the boot sector
|
|
with a clean DOS one, without affecting the partition table. Some
|
|
purists disagree with this, but even the author of LILO, Werner
|
|
Almesberger, suggests it. It is easy, and it works.</P>
|
|
<P>You can also use the dd command to copy the backup saved by LILO
|
|
to the boot sector - refer to the LILO documentation if you wish
|
|
to do this.</P>
|
|
|
|
|
|
<H2><A NAME="ss6.4">6.4 Q. How can I boot if I've lost my kernel AND my boot disk?</A></H2>
|
|
|
|
<P>If you don't have a boot disk standing by, then probably
|
|
the easiest method is to obtain a Slackware kernel for your
|
|
disk controller type (IDE or SCSI) as described above for "How do I
|
|
make a boot disk with a XXX driver?". You can then boot your
|
|
computer using this kernel, then repair whatever damage there is.</P>
|
|
<P>The kernel you get may not have the root device set to the disk
|
|
type and partition you want. For example, Slackware's generic
|
|
scsi kernel has the root device set to /dev/sda2, whereas my
|
|
root Linux partition happens to be /dev/sda8. In this case the
|
|
root device in the kernel will have to be changed.</P>
|
|
<P>You can still change the root device and ramdisk settings in the kernel
|
|
even if all you have is a kernel, and some other operating system,
|
|
such as DOS.</P>
|
|
<P>Rdev changes kernel settings by changing the
|
|
values at fixed offsets in the kernel file, so you can do the same
|
|
if you have a hex editor available on whatever systems you do still
|
|
have running - for example, Norton Utilities Disk Editor under DOS.
|
|
You then need to check and if necessary change the values in the
|
|
kernel at the following offsets:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
0x01F8 Low byte of RAMDISK size
|
|
0x01F9 High byte of RAMDISK size
|
|
0x01FC Root minor device number - see below
|
|
0X01FD Root major device number - see below
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
</P>
|
|
<P>The ramdisk size is the number of blocks of ramdisk to create.
|
|
If you want to boot from a root diskette then set this to decimal
|
|
1440, which is 0x05A0, thus set offset 0x01F8 to 0xA0 and
|
|
offset 0x01F9 to 0x05. This will allocate enough space for
|
|
a 1.4Mb diskette.</P>
|
|
<P>The major and minor device numbers must be set to the device
|
|
you want to mount your root filesystem on. Some useful values
|
|
to select from are:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
device major minor
|
|
/dev/fd0 2 0 1st floppy drive
|
|
/dev/hda1 3 1 partition 1 on 1st IDE drive
|
|
/dev/sda1 8 1 partition 1 on 1st scsi drive
|
|
/dev/sda8 8 8 partition 8 on 1st scsi drive
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
</P>
|
|
<P>Once you have set these values then you can write the file to
|
|
a diskette using either Norton Utilities Disk Editor, or a program called
|
|
rawrite.exe. This program is included
|
|
in several distributions, including the SLS and Slackware distributions.
|
|
It is a DOS program which writes a file to the "raw" disk, starting
|
|
at the boot sector, instead of writing it to the file system. If you use
|
|
Norton Utilities, then you must write the file to a physical disk
|
|
starting at the beginning of the disk.</P>
|
|
|
|
|
|
<H2><A NAME="ss6.5">6.5 Q. How can I make extra copies of boot/root diskettes?</A></H2>
|
|
|
|
<P>It is never desirable to have just one set of rescue disks - 2 or 3
|
|
should be kept in case one is unreadable.</P>
|
|
<P>The easiest way of making copies of any diskettes, including
|
|
bootable and utility diskettes, is to use the dd command to copy the
|
|
contents of the original diskette to a file on your hard drive, and
|
|
then use the same command to copy the file back to a new diskette.
|
|
Note that you do not need to, and should not, mount the diskettes,
|
|
because dd uses the raw device interface.</P>
|
|
<P>To copy the original, enter the command:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
dd if=devicename of=filename
|
|
where devicename the device name of the diskette
|
|
drive
|
|
and filename the name of the file where you
|
|
want to copy to
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
</P>
|
|
<P>For example, to copy from /dev/fd0 to a temporary file called
|
|
/tmp/diskette.copy, I would enter the command:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
dd if=/dev/fd0 of=/tmp/diskette.copy
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
</P>
|
|
<P>Omitting the "count" parameter, as we have done here, means that the
|
|
whole diskette of 2880 (for a high-density) blocks will be copied.</P>
|
|
<P>To copy the resulting file back to a new diskette, insert the new
|
|
diskette and enter the reverse command:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
dd if=filename of=devicename
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
</P>
|
|
<P>Note that the above discussion assumes that you have only one diskette
|
|
drive. If you have two of the same type, then you can copy diskettes
|
|
using a command like:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
dd if=/dev/fd0 of=/dev/fd1
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
</P>
|
|
|
|
|
|
<H2><A NAME="ss6.6">6.6 Q. How can I boot without typing in "ahaxxxx=nn,nn,nn" every time?</A></H2>
|
|
|
|
<P>Where a disk device cannot be autodetected it is necessary to supply
|
|
the kernel with a command device parameter string, such as:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
aha152x=0x340,11,3,1
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
This parameter string can be supplied in several ways using LILO:
|
|
<UL>
|
|
<LI>By entering it on the command line every time the system
|
|
is booted via LILO. This is boring, though.</LI>
|
|
<LI>By using the LILO "lock" keyword to make it store the
|
|
command line as the default command line, so that LILO will use
|
|
the same options every time it boots.</LI>
|
|
<LI>By using the APPEND statement in the lilo config file. Note that
|
|
the parameter string must be enclosed in quotes.</LI>
|
|
</UL>
|
|
</P>
|
|
<P>For example, a sample command line using the above parameter string
|
|
would be:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
zImage aha152x=0x340,11,3,1 root=/dev/sda1 lock
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
This would pass the device parameter string through, and also ask the
|
|
kernel to set the root device to /dev/sda1 and save the whole command
|
|
line and reuse it for all future boots.</P>
|
|
<P>A sample APPEND statement is:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
APPEND = "aha152x=0x340,11,3,1"
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
</P>
|
|
<P>Note that the parameter string must NOT be enclosed in quotes on the
|
|
command line, but it MUST be enclosed in quotes in the APPEND statement.</P>
|
|
<P>Note also that for the parameter string to be acted on, the kernel
|
|
must contain the driver for that disk type. If it does not, then there
|
|
is nothing listening for the parameter string, and you will have to
|
|
rebuild the kernel to include the required driver. For details on
|
|
rebuilding the kernel, cd to /usr/src/linux and read the README, and
|
|
read the Linux FAQ and Installation HOWTO. Alternatively you could
|
|
obtain a generic kernel for the disk type and install that.</P>
|
|
<P>Readers are strongly urged to read the LILO documentation before
|
|
experimenting with LILO installation. Incautious use of the "BOOT"
|
|
statement can damage partitions.</P>
|
|
|
|
|
|
<H2><A NAME="ss6.7">6.7 Q. How can I create an oversize ramdisk filesystem?</A></H2>
|
|
|
|
<P>The following instructions apply to kernels earlier than 1.3.48.
|
|
For kernels 1.3.48+, it is best to create a compressed filesystem as
|
|
described in Section 7.</P>
|
|
<P>An oversize ramdisk filesystem is a filesystem in a ramdisk larger
|
|
than the size of the root disk it was loaded from. This can be
|
|
extremely useful when using Ftape, which requires exclusive use
|
|
of the floppy disk controller (see the Ftape HOWTO for details.)</P>
|
|
<P>Two things are required: create an oversize file system on the
|
|
root diskette, and then patch the kernel so that it will not
|
|
try to load blocks off the end of the diskette.</P>
|
|
<P>To create an oversize filesystem, two methods are possible:
|
|
<UL>
|
|
<LI>Use the "blocks" e2fsck parameter to specify the size of
|
|
filesystem that you eventually want in the ramdisk. For example:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
mke2fs /dev/fd0 3000
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
will create a filesystem on the diskette of 3000 1Kb blocks. The
|
|
diskette only has 1440 blocks, but mke2fs does not care about this.
|
|
E2fs will care about it if you try to use more than 1440 blocks
|
|
of data (allowing for blocks used as inodes and reserved etc),
|
|
but up to this point it is quite safe. You will soon find out if
|
|
you try to load too much on the diskette because an I/O error will result.</LI>
|
|
<LI>Create a partition on your hard disk as large as the filesystem
|
|
you want on the ramdisk. Then create a filesystem on it and load in
|
|
the files you want. Then use dd to copy only the first 1440 blocks
|
|
to diskette, and then check that there was nothing in the uncopied
|
|
part of the filesystem. For example:
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
dd if=/dev/hdb of=/dev/fd0 bs=1024 count=1440
|
|
dd if=/dev/hdb of=tailpart bs=1024 skip=1440
|
|
cmp -l tailparm /dev/zero
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
</LI>
|
|
</UL>
|
|
|
|
Of the two, I prefer the first method - it appears easier and safer.</P>
|
|
<P>The second thing required to get an oversized filesystem is to get the
|
|
kernel to stop loading at the end of the physical diskette when it
|
|
tries to load the root diskette into ramdisk. To do this, a simple
|
|
patch can be applied to the ramdisk driver, which should be found in
|
|
/usr/src/linux/drivers/block/ramdisk.c. The following patch has been
|
|
contributed by Bruce Elliot. It is for kernel version 1.2.0, but it
|
|
should be fairly easy to apply to later versions. Even if the patch
|
|
will not apply, the code is not complex, so the patch could easily
|
|
be modified until it worked.</P>
|
|
<P>
|
|
<BLOCKQUOTE><CODE>
|
|
<PRE>
|
|
=================================================================
|
|
X--- ramdisk.c~ Mon Jan 23 13:04:09 1995
|
|
X+++ ramdisk.c Mon May 29 00:54:52 1995
|
|
X@@ -113,6 +113,7 @@
|
|
X (struct ext2_super_block *)&sb;
|
|
X int block, tries;
|
|
X int i = 1;
|
|
X+ int fblocks;
|
|
X int nblocks;
|
|
X char *cp;
|
|
X
|
|
X@@ -168,12 +169,16 @@
|
|
X nblocks, rd_length >> BLOCK_SIZE_BITS);
|
|
X return;
|
|
X }
|
|
X- printk("RAMDISK: Loading %d blocks into RAM disk", nblocks);
|
|
X+ fblocks = blk_size[MAJOR(ROOT_DEV)][MINOR(ROOT_DEV)];
|
|
X+ if (fblocks > nblocks)
|
|
X+ fblocks = nblocks;
|
|
X+ printk("RAMDISK: Loading %d blocks into %d block filesystem "
|
|
X+ "in RAM disk", fblocks, nblocks);
|
|
X
|
|
X /* We found an image file system. Load it into core! */
|
|
X cp = rd_start;
|
|
X- while (nblocks) {
|
|
X- if (nblocks > 2)
|
|
X+ while (fblocks) {
|
|
X+ if (fblocks > 2)
|
|
X bh = breada(ROOT_DEV, block, BLOCK_SIZE, 0, PAGE_SIZE);
|
|
X else
|
|
X bh = bread(ROOT_DEV, block, BLOCK_SIZE);
|
|
X@@ -184,7 +189,7 @@
|
|
X }
|
|
X (void) memcpy(cp, bh->b_data, BLOCK_SIZE);
|
|
X brelse(bh);
|
|
X- if (!(nblocks-- & 15)) printk(".");
|
|
X+ if (!(fblocks-- & 15)) printk(".");
|
|
X cp += BLOCK_SIZE;
|
|
X block++;
|
|
X i++;
|
|
=================================================================
|
|
</PRE>
|
|
</CODE></BLOCKQUOTE>
|
|
|
|
With this patch, the kernel stops loading at the end of the
|
|
physical diskette, leaving a filesystem larger than the disk.</P>
|
|
<P>Some warnings: I have been able to create stable ramdisk filesystems
|
|
in this fashion of 3500 blocks, but if I try 3600 or more then the
|
|
kernel collapses with an error something like "fixup table corrupt".
|
|
I have not been able to track down why, but obviously something is
|
|
overflowing. Up to 3500 blocks, though, I have had no problems.</P>
|
|
|
|
|
|
<H2><A NAME="ss6.8">6.8 Q. At boot time, I get error <CODE>A: cannot execute B</CODE>. Why?</A></H2>
|
|
|
|
<P>There are several cases of program names being hardcoded in various
|
|
utilities. These cases do not occur everywhere, but they may explain
|
|
why an executable apparently cannot be found on your system even though
|
|
you can see that it is there. You can find out if a given program
|
|
has the name of another hardcoded by using the "strings" command and
|
|
piping the output through grep.</P>
|
|
<P>Known examples of hardcoding are:
|
|
<UL>
|
|
<LI>Shutdown in some versions has <CODE>/etc/reboot</CODE> hardcoded, so
|
|
<CODE>reboot</CODE> must be placed in the /etc directory.</LI>
|
|
<LI>Init has caused problems for at least one person, with the kernel
|
|
being unable to find init. </LI>
|
|
</UL>
|
|
|
|
To fix these problems, either move the programs to the correct directory,
|
|
or change configuration files (e.g. inittab) to point to the correct
|
|
directory. If in doubt, put programs in the same directories as they
|
|
are on your hard disk, and use the same inittab and <CODE>/etc/rc.d</CODE>
|
|
files as they appear on your hard disk.</P>
|
|
|
|
|
|
<HR>
|
|
<A HREF="Bootdisk-HOWTO-5.html"><IMG SRC="prev.gif" ALT="Previous"></A>
|
|
<A HREF="Bootdisk-HOWTO-7.html"><IMG SRC="next.gif" ALT="Next"></A>
|
|
<A HREF="Bootdisk-HOWTO.html#toc6"><IMG SRC="toc.gif" ALT="Contents"></A>
|
|
<hr>
|
|
Space for these documents provided by
|
|
<A href="http://www.spade.com/">Ben Spade</A>
|
|
in support of the Linux community.
|
|
|
|
</BODY>
|
|
</HTML>
|