Sophie

Sophie

distrib > Mandriva > 2010.0 > x86_64 > by-pkgid > b6e7ac7a80024d68ad96f898b3218a45 > files > 288

etherboot-5.4.4-4mdv2010.0.x86_64.rpm

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

<article>

<articleinfo>
<title>LILO with Etherboot</title>
<author>
<firstname>Ken Yap, &lt;ken_yap AT users PERIOD sourceforge PERIOD net&gt;</firstname>
</author>
<pubdate>10 May 2002</pubdate>

<abstract>
<para>
This HOWTO explains how to install LILO on disks that do not have any
Linux filesystems to boot DOS as well as Etherboot .(z)lilo images.

</para>
</abstract>
</articleinfo>

<sect1>
<title>Motivation</title>

<para>
LILO is perhaps the best known Linux boot loader and many people use it
to single or multiple boot OSes. What is less well known is that LILO
can also boot from disks that do not have any Linux partitions at all.
This follows from the design of LILO. The installer stores lists of disk
blocks to read in and the boot time portion does not care what kind of
partition the boot images are stored on. All that is needed is a way to
run the installer on a non-Linux partition. Any filesystem supported by
Linux can be handled, provided it can be mounted RW. This includes all
the FAT based DOS and Windows filesystems.

</para>
<para>
What I describe below is not actually Etherboot specific. It will work
just as well if you want to boot a Linux kernel from a DOS partition.
It just so happens that Etherboot can build images that look like Linux
kernels to the LILO installer.  Therefore most of the cleverness is in
getting a LILO installer to run on a non-Linux partition.

</para>
</sect1>

<sect1>
<title>The steps</title>

<para>

<orderedlist>
<listitem>
<para>
Get hold of a rescue floppy like tomsbtrt (www.toms.net). Other
rescue floppies or CDs should work also. All you have to be able to do
with the rescue disk is mount a DOS/Windows filesystem on the Linux
filesystem.

</para>
<para>
The next 4 steps are done on a host Linux system.
</para>
</listitem>
<listitem>

<para>
Get hold of a recent LILO distribution. I used lilo-21.7-5. Edit the
Makefile to generate a statically linked lilo executable by adding
--static to the link command. Do a make. This will generate a lilo
executable. You might want to run strip on this to reduce the size. Also
generated will be various boot programs ending in .b.

</para>
</listitem>
<listitem>

<para>
Create a working directory, say /tmp/lilo and under it mkdir boot/,
sbin/ and etc/.

</para>
</listitem>
<listitem>

<para>
Copy the .b files to /tmp/lilo/boot.  cp -p /tmp/lilo/boot-menu.b
/tmp/lilo/boot.b. You can also substitute -text for -menu if you prefer
a plain text prompt. Copy the lilo executable to /tmp/lilo/sbin.  Create
/tmp/lilo/etc/lilo.con and add an entry for DOS.  Add entries to
/tmp/lilo/etc/lilo.con for the Etherboot images.

</para>
</listitem>
<listitem>

<para>
Generate the Etherboot .zlilo or .lilo images you want and copy
them to /tmp/lilo/boot.  Remember to alter the names to 8.3 standard as
necessary.

</para>
</listitem>
<listitem>

<para>
In /tmp/lilo, zip the contents to say /tmp/lilo.zip. Use a floppy or
other means to transfer this to the DOS system. To save you work, you
can find a copy of this zip archive, minus the Etherboot images and the
lilo.con modifications, <ulink
url="http://etherboot.sourceforge.net/lilo2175.zip">here</ulink>.

</para>
</listitem>
<listitem>

<para>
Alternatively pack the archive with tar and gzip. This will allow
you to transfer this to the DOS system using the wget on the rescue
floppy, see below.

</para>
</listitem>
<listitem>

<para>
Unpack the archive in the root directory of the DOS system. If you
are using pkunzip, remember to use the option that preserves the paths.
You should end up with three new top level directories: \boot, \sbin and
\etc.

</para>
</listitem>
<listitem>

<para>
Reboot the DOS system using the rescue floppy. Mount the DOS
filesystem, say on /mnt.

</para>
</listitem>
<listitem>

<para>
Make a symlink from /mnt/boot to /boot. You can't use the -r /mnt
option of lilo because it will chroot to /mnt and look for /mnt/dev/hda,
and of course those device files don't exist on a DOS FS.

</para>
</listitem>
<listitem>

<para>
Run /mnt/sbin/lilo -v -C /mnt/etc/lilo.con This will write LILO into
the master boot sector.

</para>
</listitem>
<listitem>

<para>
Umount /mnt and reboot. Keep the rescue floppy around for future
modifications to \etc\lilo.con.

</para>
</listitem>
<listitem>

<para>
If you made a .tar.gz package instead of a .zip package, then you
can streamline all of the above with a couple of commands if you have a
web server handy and you can put a shell script and the .tar.gz package
there. Once you have booted tomsrtbt, issue a wget for the install shell
script, something like this:

<programlisting>
	wget http://172.16.2.25/thin/install.sh
</programlisting>

install.sh contains:

<programlisting>
#!/bin/sh
mount -t msdos /dev/hda1 /mnt
(cd /mnt; wget -O - http://172.16.2.25/thin/lilo2175.tar.gz | gunzip | tar xf - 2&gt;/dev/null)
rm -f /boot
ln -s /mnt/boot /boot
/mnt/sbin/lilo -v -C /mnt/etc/lilo.con
umount /mnt
</programlisting>

Run it with:

<programlisting>
	sh install.sh
</programlisting>

</para>
</listitem>
<listitem>

<para>
Advanced: If you have several types of network cards on your
network, you could provide different install scripts for them which
would fetch different images. Or you could parameterise install.sh.
Of if you are really cunning, you could try to extract the network card
identity out of a lsmod, as tomsrtbt autoprobes for several common NICs.

</para>
</listitem>
<listitem>

<para>
LILO should take control on boot up and there should be entries for
DOS and each Etherboot image. You can even have fancy splash graphics,
this is a LILO enhancement in some distributions like SuSE.

</para>
</listitem>
</orderedlist>
</para>
</sect1>

<sect1>
<title>Notes</title>

<para>

<itemizedlist>
<listitem>

<para>
The reason for making LILO afresh instead of using the one on the
rescue floppy is that the lilo executable must match the boot programs,
otherwise you get mysterious errors like Map segment is too big.  For
example the LILO in tomsbtrt is version 20.

</para>
</listitem>
<listitem>
<para>
Since LILO relies on the boot images staying at their block
locations on the disk, if you ever defrag the partition containing the
boot/ files, and the files get moved as a result, then LILO will fail.
So it would be a good idea to mark those files as unmovable (system and
RO I think). If you accidentally move the images, then you have to run
the LILO install step again.

</para>
</listitem>
</itemizedlist>
</para>
</sect1>
</article>