|
Booting Linux with the Win 2k Boot Loader
Tired of typing boot labels at LILO to get into Windows 2000? Here’s how to get Linux as an option in the Win 2k boot menu
Vinod Unny
Tuesday, August 01, 2000
Booting up a PC is a complex process. When a PC starts up,
instructions in the BIOS make it look at the first sector (Sector #0) of the
primary hard disk, assuming that the primary hard disk is the first boot device,
and loads the data residing there into memory. The data consists of the
partition table and the Master Boot Record (MBR). The MBR contains a small, but
important program called the Master Boot Code (MBC). This contains instructions
on where to find the rest of the operating system—that is, the location of the
rest of the OS on the physical hard disk. This address is nothing but the
partition on which the rest of the operating system kernel resides. Once the MBC
points to the correct location, the BIOS starts executing the code for the OS
from there.
Every operating system has its own MBC. The code can be a
simple set of instructions that point to one particular location, like in DOS or
Win 9x; or a more interactive one that presents a menu of selections or allows
you to type in a command, like the ones in Win NT/2000 and Linux. Every time you
install a new operating system, it overwrites the current MBR with its own MBC
that points to the new OS.
If you’ve installed Linux while retaining an existing
Windows installation, you know you can switch between the Windows and Linux OSs
by typing in the correct label at the LILO: prompt. For example, if your Windows
installation was named "dos" (which it is by default), type in
"dos" at the LILO: prompt and you can boot into Windows without any
problem. This is nothing but the Linux boot loader at work.
However, for those of you who’ve used Win NT/2000, you have
a different boot loader. NT shows a menu of currently installed operating
systems and lets you switch between them by using the arrow keys and pressing
"Enter" on the highlighted choice. Win 2000 doesn’t show you a list
of choices by default, although you have the option to see if you wish.
If you’re only an occasional user of Linux, playing around
and experimenting during your free time, but use NT/2000 much more often, you’d
like to have Linux on the NT boot menu rather than the other way around.
Unfortunately, this doesn’t recognize the Linux boot partition at all. So we’ll
have to do some tweaking to get this to work.
This article will show you how to get Linux as an option in
the Win 2000 boot menu under three different configurations—when Win 2000 is
already installed and you want to install Linux, when Linux is already installed
and you want to install Win 2000, and finally when both are installed and LILO
is the boot loader. Most of these instructions should work with NT 4 too, but
haven’t been tested with it.
Windows 2000 installed
This is the configuration that might be most common. Here, I
assume you have enough unpartitioned space left on the drive to install Red Hat
Linux 6.2 given on the PC Quest June 2000 CD, and that you know how to install
Linux as well as Windows 2000.
First, create an Emergency Boot Disk for your Win 2000
installation by going to Start>Programs>Accessories>System
Tools>Backup and clicking the Emergency Repair Disk. Insert a new, blank
floppy when prompted. You should always do this.
Now boot off the PCQ Red Hat 6.2 CD and start the install
process as usual. When you reach Disk Druid, don’t touch the Win 2000
partition(s). Simply add as many partitions as you want for the Linux install on
the remaining free space. Continue till the point where you’re asked where to
install LILO, the Linux boot loader.
The next two steps are very important. Don’t choose the
Master Boot Record in this step; instead choose the first sector of the root
partition. And when prompted to create a Boot Disk, do so. I can’t stress this
point enough. Create the Boot Disk right now, or you may not be able to access
your Linux installation without reinstalling it.
Once the Linux installation is complete, let the system
reboot. If you’ve followed the instructions correctly, you should be booting
into Win 2000 as usual, as if there were no Linux around. Put in the Linux boot
floppy and reboot. This will show you the LILO prompt. Press "Enter"
and get into your Linux installation.
Now take a look at /etc/lilo.conf. This is the boot
configuration file that contains the name of the partition that holds the boot
information. Look for a line that says: boot=/dev/hdxy. This line informs the OS
loader which device to use for booting up. The "hd" stands for hard
disk, the "x" is the physical device on your system and the
"y" is the partition number on that physical device. So, if your Linux
boot partition was on the third partition of your first hard disk, your boot
device would be /dev/hda3. If it were on the second partition of the second
physical hard disk, it would be /dev/hdb2.
After you make a note of the correct device, su as root and
issue the following command:
dd if=/dev/hdxy of=/tmp/LiloBoot. bin bs=512 count=1
Remember to change the hdxy to the entry in your lilo.conf.
This line creates a 512-byte file called LiloBoot.bin in the
/tmp directory (you can name this file anything you want). Copy this file to a
DOS floppy using mcopy or by mounting it. Reboot into Win 2000 now.
Copy the Liloboot.bin file to the C:\ folder and make its
attributes Read-Only and Hidden. Now open a command prompt and give the command:
attrib –r –s –h c:\boot.ini
After this, open the boot.ini file in Notepad. You should see
a few lines similar to this:
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0) partition(1)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\ WINNT="Microsoft Windows 2000
Professional" /fastdetect
Add a line to the end of the file, which looks like this:
c:\LiloBoot.bin="PCQ RedHat Linux 6.2 (Kernel 2.2.14-12)".
The first part specifies which file to use for booting and
the second part is the label in the menu. You can use whatever you feel like
here. Save the boot.ini file and reset its default attributes to Read-Only,
Hidden, and System.
Boot your PC again, and see the label entry you made appear
in the Win 2000 boot menu. Select it and press "Enter". You should
immediately see the LILO prompt. Continue as you would normally.
Linux pre-installed
If you have a system where Linux has already been installed
and you wish to install Win 2000 in some unpartitioned space, it isn’t much of
a problem. Make sure you have a boot disk handy for Linux. If not, create one
using the mkbootdisk command. Assuming you’re using the PCQ June 2000 Red Hat
installation (Kernel 2.2.14-12) use the following command, with a floppy in the
drive:
mkbootdisk –-device /dev/fd0 2.2.14-12
Open /etc/lilo.conf in your favorite editor and look for the
line that says boot=/dev/hda. This line is the one that says where the boot
loader is installed (hda is the MBR). Change this to the partition where the
/boot is installed. This is again a very important step. To see which partitions
exist, run the fdisk command and type "p" to view the partition table.
Note the partition where /boot is installed (not /, unless you installed
everything on a single partition) and enter that in lilo.conf. For example, if
your /boot is installed on /dev/hda3, lilo.conf should have the entry
boot=/dev/hda3. Save the file and issue the command lilo –v. This will write
the new LILO.
Now install Win 2000 normally and it’ll overwrite LILO. You
can boot into Win 2000 and play around. To get the Linux menu option, boot into
Linux using the boot floppy and create the disk image for Windows using dd as
given in the previous part. The remaining steps are the same to install the
menu.
Page(s):
1
2
|