old-www/LDP/LG/issue36/larriera.html

204 lines
8.8 KiB
HTML

<!--startcut ==========================================================-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<title>Booting Linux with the NT Loader LG #36</title>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#A000A0"
ALINK="#FF0000">
<!--endcut ============================================================-->
<H4>
"Linux Gazette...<I>making Linux just a little more fun!</I>"
</H4>
<P> <HR> <P>
<!--===================================================================-->
<center>
<H1><font color="maroon">Booting Linux with the NT Loader</font></H1>
<H4>By <a href="mailto:glarrier@ei.edu.uy">Gustavo Larriera</a></H4>
</center>
<P> <HR> <P>
On these days technical professionals like you and me often
must deal with the following scenario: To make Linux and NT
peacefully coexist on the same machine. Many HOW-TOs have been
written -and it's a good advice to give them a look- about how to
configure LILO (The Linux Loader) to do the task. Unfortunately,
classic documentation have little references about the NT Loader.
Yes, I know for some people there's some kind of religious war
between Linux and NT out there :-) But from the point of view of
a IT professional, the main objective is to have the job well
done. </p>
<p>In many real-life situations we must tackle with a
installation where it is not desirable to alter the NT boot
process. May be it is your machine's boss and he/she prefers to
keep on booting the same way for ever ;-) In this article I will
focus on how to configure the NT Loader so as to boot Linux (and
continue booting NT also!). </p>
<p>I hope these tips will help Linux users to successfully boot
Linux through the NT Loader the easiest way. The procedure I will
explain works for NT Server 4 and NT Workstation 4 running on
Intel-compatible PC. </p>
<h2>The Scenario </h2>
<p>After long conversation you have convinced your boss to put
Linux on her computer machine. She is a happy NT user, she loves
Word and Excel and such. She also is a clever person and has
decided to give Linux a try. So she wants to have Linux
installed. Just a moment: She prefers to keep booting with her
familiar loading menu, from where she can choose to boot NT or
DOS. Her wishes are your wishes, so you decide not to use LILO to
dual-boot her computer. </p>
<h2>The MBR considered useful </h2>
<p>The most important thing you must always remember is that many
software products sit on your unique precious hard disk's Master
Boot Record (MBR). So does NT without asking and so optionally
does LILO if you want to. The machine's BIOS executes code stored
on the active partition to initiate your preferred OS. </p>
<p>When NT is installed, the MBR is modified to load a program
called NTLDR from the active partition's root directory. The
original MBR is saved on a small file called BOOTSECT.DOS. After
a NT installation, be careful never overwrite the MBR, because
the NT will no longer boot. To fix this problem, a NT user needs
the NT's Emergency Repair Disk (ERD). </p>
<p>With those things in mind, take note you must be careful to
configure LILO *not* to install on MBR. Instead you will need to
configure LILO on the root partition of Linux. That's safe for NT
and Linux can live without the MBR. </p>
<h2>NT loading process </h2>
<p>Once the NTLDR program launchs the NT user watch the &quot;OS
Loader V4.xx&quot; message. Then NTLDR shifts the processor to
386 mode and starts a very simple file system. After that, it
reads the file BOOT.INI to find out if there are other operating
systems and prompts the user with a menu. A typical BOOT.INI
looks like this: </p>
<pre>
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(2)\WINNT
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINNT=&quot;NT V4 is here&quot;
multi(0)disk(0)rdisk(0)partition(2)\WINNT=&quot;NT V4 VGAMODE&quot; /basevideo /sos
C:\=&quot;DOS is here&quot;
</pre>
<p>The BOOT.INI file has two sections. The &quot;boot loader
section&quot; specifies how long in seconds will be the menu on
screen and the default menu choice. The &quot;opearating systems
section&quot; specifies the different OSs the user can choose. We
can read the machine boots NT (either in normal mode or in VGA
diagnosing mode) and also can boot DOS. We can deduce from this
example that DOS boots from the partition C: (first partition on
first disk) and NT boots from the second partition. Typical
installations have a C: partition formatted with DOS's FAT file
system and NT on another partition formatted with its NTFS (NT
File System). </p>
<p>If the user chooses to load NT, another program NTDETECT.COM
runs to check the existent hardware. If everything was okay, the
NT kernel is loaded and that's all we need to know. </p>
<p>Let's examine what happens if the user decide to choose other
OS rather than NT. In this situation, NTLDR needs to know which
is the boot sector required to load the non-NT OS. The appropiate
boot sector image must exists on a small 512-byte file. For
instance, to load DOS, NTLDR searches for a boot sector image
file called BOOTSECT.DOS. This image was created by the NT
installation. </p>
<p>So, what if I want to load Linux? It's quite simple, all we
need is a boot sector image file, let's name it BOOTSECT.LIN
(later we'll see how to obtain this file). You must put
BOOTSECT.LIN on C: and edit BOOT.INI, the &quot;operating systems
section&quot; now looking something like this: </p>
<pre>
[operating systems]
multi(0)disk(0)rdisk(0)partition(2)\WINNT=&quot;NT V4 is here&quot;
multi(0)disk(0)rdisk(0)partition(2)\WINNT=&quot;NT V4 VGAMODE&quot; /basevideo /sos
C:\=&quot;DOS is here&quot;
C:\BOOTSECT.LIN=&quot;Now Linux is here&quot;
</pre>
<p>The BOOT.INI can be edited with any plain ASCII text editor.
Normally this file has system-hidden-readonly attributes, so you
must change them using the 'attrib' DOS command or within NT,
from the file's property dialogbox. </p>
<h2>The Linux side of the story </h2>
<p>Now let's concentrate on the Linux shore. We need to install
Linux, configure LILO and create the BOOTSECT.LIN file. </p>
<p>The first step is to have Linux installed. We all know how to
do that: Choose appropiate partitions for Linux system, swap and
user's stuff, run installation program, etc. Easy cake, first
step is completed okay in less than 45 minutes. </p>
<p>Then we must configure LILO. We also know how to do that, but
be careful *not* to install LILO on the MBR (unless you hate NT
too much :-)) When configuring LILO, choose to install it on your
Linux root partition. If you don't know how to configure LILO,
spend some minutes reading the HOW-TOs or use some of the useful
setup programs most modern Linux distributions have. My
installation is S.u.S.E., so I use the 'yast' (Yet Another Setup
Tool). </p>
<p>Once LILO is configured (let's asume the Linux root partition
is /dev/hda3) we must use 'dd' to create the boot record image.
Login as root and do the following: </p>
<pre>
# dd if=/dev/hda3 bs=512 count=1 of=/dosc/bootsect.lin
</pre>
<p>Prior you have mounted the FAT C: partition as /dosc. Just in
case you cannot access to this partition, for instance if it's
formatted with NTFS, just write BOOTSECT.LIN to a DOS-formatted
diskette or some partition where NT can read from. If you put
BOOTSECT.LIN in a place othet than C:\ remember to modify the
BOOT.INI file accordingly. </p>
<p>Now your boss can choose Linux from her NT Loader's menu. The
NTLDR will load the BOOTSECT.INI and she'll see the LILO prompt.
Then she'll plunge into her new Linux box. Finally, if you
configured LILO to load Linux and also the DOS on C: when LILO
prompts, your boss will reload from the active C: partition,
again into NT Loader. The procedure described may be repeated if
you wish to boot several Linuxes, you must just create
appropiated boot sector image files for each of your Linuxes.</p>
<!--===================================================================-->
<P> <hr> <P>
<center><H5>Copyright &copy; 1999, Gustavo Larriera<BR>
Published in Issue 36 of <i>Linux Gazette</i>, January 1999</H5></center>
<!--===================================================================-->
<P> <hr> <P>
<A HREF="./index.html"><IMG ALIGN=BOTTOM SRC="../gx/indexnew.gif"
ALT="[ TABLE OF CONTENTS ]"></A>
<A HREF="../index.html"><IMG ALIGN=BOTTOM SRC="../gx/homenew.gif"
ALT="[ FRONT PAGE ]"></A>
<A HREF="./lg_answer36.html"><IMG SRC="../gx/back2.gif"
ALT=" Back "></A>
<A HREF="./defurne1.html"><IMG SRC="../gx/fwd.gif" ALT=" Next "></A>
<P> <hr> <P>
<!--startcut ==========================================================-->
</BODY>
</HTML>
<!--endcut ============================================================-->