Loadlin and Linux
What is loadlin?
Loadlin is a free, open-source Linux loader (LOAD LINux). It is a
program written to allow you to boot Linux without having to use LILO or a
boot disk, using the DOS command line instead. IMHO, it is the best way to
boot Linux if you use Windows or DOS.
Why is that?
Well, basically you have three alternatives to Loadlin: LILO, a kernel
"dd"'ed onto a floppy, and a LILO floppy. If you aren't sure that you want
to keep Linux, you might not want to take the gamble of overwriting your
MBR with LILO. LILO has been known to fail, and the MBR is one of the most
important areas of the hard drive. And kernel->floppy bootdisks cannot
be passed parameters, and are also unreliable. Or you could be like me,
stuck sharing a computer with others whom you might not want getting into
your system (e.g. parents and younger siblings :-)
Where can I get it?
If you got Linux on a CD, then there is probably a copy on there, as it is
necessary for installing on computers with non-bootable CD-ROM drives. On
the Red Hat CDs, it is in the directory "dosutils". On Slackware CDs, it
is in disk A9 ("slakware\a9"). You can also get it at that all-holy
repository of all things Linux, Sunsite.
Or, if you're lazy, click
here.
Okay, so now what do I do?
Well, here's the basic usage summary for loadlin:
loadlin kernel_file [initrd=initrd_file]
[options_passed_to_kernel]
At the least, your command line will look something like this:
loadlin kernel_file root=root_device ro
The option kernel_file is the filename of the kernel image. The "root="
option is one that is passed to the kernel. For instance, I use the option
"root=/dev/hdc1". Replace "hdc1" with whatever root device you want. "ro"
means mount the root device in read-only mode. You could use "rw" instead
to mount in read-write. I don't recommend that you do this, because most
distributions will fsck your root device on startup and then remount in
read-write mode.
Setting it all up
This section will explain how to set up loadlin so you can boot quickly
and easily boot into Linux. You will need:
- Documentation for your distribution
- Loadlin v1.6a or higher
- A copy of your kernel image
- A copy of your initial ramdisk (if you have one)
WARNING: Do not use any loadlin older than 1.6a
(the one linked to above) with 2.2.* kernels!!!! YOU
HAVE BEEN WARNED.
First of all, read the docs for your distribution. Read the ChangeLog, the
README.1ST, and all of that sort of stuff. Yeah, it's boring, no one likes
it, but it could save you a lot of greif later. Find out if your system
needs an initial ramdisk at boot, and where that file is (usually
"/boot/initrd"). Copy it to your WinDoze or DOS directory. Copy
your kernel image, often "/vmlinuz" or "/boot/vmlinuz",
to your WinBlows directory. Then reboot into whatever MicroBloat OS you
happen to be using.
Now, make the directory "C:\linux". Move vmlinuz,
initrd (if you have one), and loadlin.exe into that
directory. Then, create a file called "linux.bat". Move this into
any directory in your path (C:\windows and
C:\windows\command should be safe bets on any windows system, and
C:\dos for DOS systems). Then edit it so that it looks like
this:
REM This first line if for Windows systems only
c:\windows\smartrv/c
\linux\loadlin \linux\vmlinuz _other_options_
The first line flushes the disk cache, which is most desirable considering
you might screw up the computer if you don't. The second line starts up
loadlin, and it's bye-bye DOS :) You're going to replace
"_other_options_" with options that will be passed on to the
kernel. We will now find out what those options are.
Passing options to the kernel
There are a bunch of options that you can pass to the kernel, so I'll just
show you a few of the more important ones:
initrd= |
(DOS)Filename of the initial ramdisk. This is loaded by loadlin and
passed on to the kernel.
|
root= |
Root device, to be mounted as "/". This is a Linux device (e.g.
"/dev/hda1")
|
ro/rw |
One of these is specified immediately after "root=/dev/foo". ro=readonly,
rw=read/write. Unless otherwise specified in the documentation, use
"ro".
|
ram= |
If you have more than 64MB of ram, specify the amount here
|
Any others not covered here can probably be found in the documentation
included with the Linux source. Have a look in
/usr/src/linux/Documentation if you need more information (in
fact, you should probably read the stuff in there anyway :-).
Here we go
Now it's time to boot up Linux. If you are in Windows, hit ALT+F4 and
choose "Restart in DOS mode". You must be at a "real" DOS prompt. Now,
assuming you've got your batch file and \linux directory set up, just type
"linux" and it should boot!
Sample linux.bat
If you need an example, here's my linux.bat:
\windows\smartdrv/c
\linux\loadlin \linux\vmlinuz root=/dev/hdc1 ro
If you have any questions, feel free to email me.
|