Sei sulla pagina 1di 3

BEGINNERS BOOT-UP

3 2000 LINUX M AGAZINE 99


The name loadlinisderived from load Linux and
thisdescribesexactlywhat the program does. It is
an M S-DOS program that loadsa Linux kernel into
memory, therebystarting the boot process. It is
convenient if you wish to run DOS and Windowsas
well asLinux. If your system isset up to boot into
DOS, you can start Windowsbytyping win or
you can start Linux byrunning linux . Even more
conveniently, you can arrange to select one of these
choicesfrom an M S-DOS boot menu.
Whywould you want to do this, when lilowill do
the same job and isa more commonlyused solution?
Well, for a start, lilowill onlywork if the Linux boot
partition iscontained within the first 1, 024 cylinders
of the hard disk. In the most common new-user
scenario, in which Linux hasbeen installed into the
space made byshrinking an existing DOS partition
that occupied the whole disk, thisisveryoften not
the case, leading to the situation where the would-be
newbie spendsan hour installing Linux and then
findsthat theycan t boot it.
Other benefitsfor the newcomer are that
loadliniseasyto set up and allowsyou to change
your boot optionsand kernel parametersusing
familiar DOS tools. It avoidschanging the contents
of the boot sector and the risk of losing the ability
to accessDOS and Windows. It also avoidsthe risk
of losing the abilityto boot Linux if you reinstall
Windowsin the future: for some reason, M icrosoft
doesn t think that anyone would want to use a non-
M icrosoft operating system and so when you install
Windows, liloor anyother boot manager you are
using are overwritten without warning. Because
loadlinisan ordinaryprogram it won t be
How To: Create your own boot menu
ALTERNATIVE
BOOT
JULIAN M OSS
Whe n you i nst a l l Li nux on a PC i t i s usua l l y
st a r t e d usi ng a boot ma na ge r ca l l e d l i l o. Thi s
usua l l y w or k s w e l l ; how e ve r, t he l i l o pr ompt i sn t t he
most use r- f r i e ndl y t hi ng you coul d se e w he n you t ur n
on your comput e r. The r e a r e a l t e r na t i ve s, f or e xa mpl e
gr ub w hi ch i s now use d by t he Li nux- M a ndr a k e
di st r i but i on. But i f Li nux co- e xi st s w i t h Wi ndow s on your
ha r d di sk a nd you st i l l use DOS or Wi ndow s a l ot of t he
t i me a good sol ut i on i s t o use l oa dl i n, w hi ch l e t s you
ma na ge your boot - up
opt i ons usi ng DOS.
099loadlin .qxd 23.10.2000 16:00 Uhr Seite 99
BEGINNERS BOOT-UP
100 LINUX M AGAZINE 3 2000
overwritten (unlessyou format the Windows
partition, of course.)
Even some more experienced Linux userslike to
use loadlin. If you like experimenting with new
Linux kernelsyou can easilycreate a system using
batch filesor a boot menu that letsyou choose
which of manykernelsto use at boot-up. Or you
can specifya different kernel on the command line.
So all in all, if you use DOS at all, loadlinisa very
flexible tool for loading Linux.
Installation
Where can you find loadlin? Well, if you have a set
of CDsfrom a full distribution you ll probablyfind it
on the first disk in a directorycalled something like
/dosutils. If you have a cover CD version like Linux
M andrake 7.1 from our issue 1 cover disk, you may
not. If you can t find it, don t worry. We ve included
a copyon thismonthscover CD for you.
M ost distributionssupplyloadlinuncompressed
in itsown directory, readyto use, but itspossible to
find it asa compressed archive called lodlin16.tgz.
In that case you ll need to extract the filesfrom the
archive first using a command similar to:
tar xzf /mnt/cdrom/dosutils/lodlin16.tgz
Create a directory on your DOS disk called
linux or something equally appropriate. (Keep
the name to eight charactersor lessbecause you
will be running thisunder real-mode DOS where
there isno long filename support.) Copy to this
directory the filesloadlin.exe, linux.bat, and
test.par. You could also copy the docdirectory,
which containsthe full documentation for the
utility. (You can probably manage without the src
directory, which containsthe assembly language
source code! )
Next, place a copyof your current Linux kernel
in the directory. If you are running Linux at the
moment you can do thisbymounting your DOS
drive and copying the kernel directlyfrom its
location in /boot. If you are logged in asroot while
doing this(which you shouldn t be! ) and are using a
graphical file manager be verycareful that you copy
the kernel instead of moving it. You ll also find a
copyof the kernel on the boot floppyyou made
when installing Linux
The kernel usuallyhasa name like vmlinuz-
2.2.15-4mdk, which isone of the stock kernelsfor
Linux-M andrake. The exact name will depend on
both the distribution and the version. When
copying it to the DOS directorygive it a name eight
characterslong or less, such asvmlinuz.
Configuration
Now you must create a loadlinparameter file. It can
be called anything you like, but for the sake of
example we will call it linux.par. The file test.par
that isusuallyincluded with loadlinisan example,
so you could start byediting that.
A simple parameter file will look like this:
C:\Linux\vmlinuz # the first value must be
# the name of the Linux kernel
root=/dev/hda7 # the device which is mounU
ted as root FS
ro # mount root read-only
mem=128M # tell the kernel to use alU
l the memory
The first three parametersare essential, and with
the commentsalmost self-explanatory. The first
value, which you maywant to change, isthe DOS
path to the file containing the Linux kernel. To use a
different kernel you could simplycreate a new
parameter file containing a different filename.
The second value which startswith root=
must specifythe device which ismounted asroot
( / ). If you can t remember what thisisfrom when
you installed Linux you can find out (if you re in
Linux at the moment) byrunning the command
mount. Thiswill list all the mounted filesystems: the
device you want isthe one that islisted as on / .
The third value isstandard, and ensuresthat
root isinitiallymounted read-only. You maynot
need anyparametersafter that. However, a
common one if your system hasmore than 64M B of
RAM isthe mem= parameter which tellsthe
kernel how much memoryit should use. The stock
kernelsin most current distributionsare compiled to
use a maximum of 64M B bydefault, so without this
parameter Linux mayrun a lot more slowlythan it
could. For a full description of the parameters
recognised byloadlinor the kernel see the file
params.docin the docsubdirectoryof the loadlin
package.
Boot manager: The PCs BIOS is designed to boot just one operating system using
program code stored in the first sector (or boot sector) of the first disk partition.
A boot manager is a program that replaces the boot-up code in the boot sector
and presents you with a choice of operating systems to boot from. Depending on
your choice, it then loads the boot-up code from the appropriate partition.
BIOS: This stands for Basic Input-Output System. It is program code stored in
permanent read-only memory which is executed by the computer at start-up and
enables it to access the main peripherals and load the operating systems boot-
up code.
Partition: A hard disk is organised into one or more areas known as partitions. These
partitions are then formatted for use by the operating system you want to use.
Cylinder: A hard disk is made up of one or more disks or platterscoated with
magnetic material, on to which data is recorded on concentric tracks. Although
many modern hard disks have just a single platter, older ones were made up of
several. A surface linking all the same-numbered tracks of all the platters would
form a cylinder. From this the term is derived.
I
099loadlin .qxd 23.10.2000 16:00 Uhr Seite 100
BEGINNERS BOOT-UP
3 2000 3 2000 LINUX M AGAZINE 101
Starting Linux
Having done all this, and making sure that you are
at a real DOS prompt and not a virtual one under
Windows(booting Linux in the middle of a
Windowssession isnot recommended, at least for
the health of Windows) you can start Linux by
executing the command:
LOADLIN @linux.par
assuming that you are in the directorycontaining
both loadlin.exeand the parameter file and that the
latter iscalled linux.par. If not, modifythe paths
accordingly.
In the loadlindirectoryyou should see a batch
file named linux.bat. You can edit thisto contain the
correct invocation of the above command, using full
pathsto both the program and itsparameter file,
and put it somewhere in the DOS search path. This
will enable you to start Linux byjust typing linux.
Boot menu
But theresan even better way. M S-DOS supportsa
facilitythat enablesusersto construct their own
boot-up menususing commandsin the file
config.sys. You can use thisfacilityto create a menu
that letsyou choose between Windowsand Linux
at boot-up. A simple example lookslike this:
[MENU]
MENUITEM=LIN,Linux
MENUITEM=WIN,Windows
MENUDEFAULT=LIN,10
[WIN]
REM OPTIONS NEEDED BY WINDOWS (IF ANY) GO HERE
[LIN]
SHELL=C:\Linux\loadlin.exe @C:\Linux\linux.par
[COMMON]
Thisexample createsa boot menu with just two
options, Windowsand Linux (see Figure 1) and
makesLinux the default (of course.) If Linux is
chosen, DOS executesthe commandsunder the
section headed [LIN] which wasassociated with this
option. The section containsa SHELL command that
runsloadlinwith the appropriate parameter file. As
with the batch file previouslymentioned, you ll
need to change thisline if the pathsand parameter
file name on your system are not the same.
Diehard Linux fansmayobject to the fact that
the M icrosoft Windowsstart-up logo briefly
appears(which can be changed) or the fact that the
menu istitled M icrosoft Windows98 Startup
M enu. But then diehard Linux fanswouldn t be
running Windowsin the first place, would they?
Conclusion
loadlinhasmanymore options. For example, if you
want to experiment with different Linux kernelsyou
can run it using different parameter files. Or you can
override the kernel file name parameter using a
command line argument, like this:
LOADLIN @linux.par image=path_to_kernel
You can even run loadlinwithout a parameter file at
all, specifying all the optionson the command line
(though be warned that DOS command linesare
limited to 128 charactersin length.) For more
information see the loadlindocumentation.
However, the basic method of operation described
here will be sufficient for most peoplesneeds. If
you run Windowsor DOS on your computer aswell
asLinux you will probablyfind loadlinto be a very
useful utility. I
An MS-DOS start-up menu
offering a choice of Linux or
Windows
099loadlin .qxd 23.10.2000 16:00 Uhr Seite 101

Potrebbero piacerti anche