In some configuration it may be required or desirable for Linux and Window NT to co-exist on the same system. Presuming Windows NT has been initially installed then the system will boot through the Windows NT Boot Loader. Assuming that a Linux system has been added to a spare partition or additional disk then the requirement is to add an option to the NT Boot Loader such that either Windows NT or Linux may be booted.
The following example shows the procedures required to create a boot sector file from a Linux system and how to modify the NT Boot Loader configuration to add an option to boot Linux. This example assumes that Windows NT has been loaded onto the first partition on the hard disk ( C: ). The disk has been partitioned such that Linux is loaded onto the second partion ( /dev/hda2 ) with a Linux swap partition on a third ( /dev/hda3 ).
It is advisable to ensure you have Windows NT repair disks for the system before proceeding.
Linux Details
Assuming Linux has been loaded and configured it is advisable , before starting this process , to test the system by creating a boot floppy and checking that the system boots OK before continuing. Also check at this stage that you can still boot Windows NT. We now need to prepare a boot sector for Linux from the system. The best way of doing this is to use the Linux Loader (LILO). For this example configuration, Windows NT owns the system’s Master Boot Record (MBR) and we do not wish to overwrite this with LILO. Modify the LILO configuration file /etc/lilo.conf so that it looks something like :
delay=5 boot=/dev/hda2 map=/boot/map install=/boot/boot.b linear image=/boot/vmlinuz-2.4.7-10 label=linux initrd=/boot/initrd-2.4.7-10.img read-only root=/dev/hda2
The main things to check are that the boot-device and root device are both set to point to your Linux installation ( /dev/hda2 in this example ). This ensured that LILO will create the boot sector on our second partition and will not touch the Master Boot Record.The other items are system specific. You may find that you need the linear or the lba32 option when using a large capacity harddisk. Now run LILO and check that there are no errors. We can now strip the bootsector from our second partition with the command.
dd if=/dev/hda2 of=bootsect.lnx bs=512 count=1
Now copy this file to the Windows NT partition either by mounting the partition or by using an MS-DOS formatted floppy.
Windows NT Details
The Windows NT Boot Loader is controlled by the file C:BOOT.INI. This file will have attributes set so that it is read-only and hidden. In order to change this file then you will need to issue the command:
attrib -s -h -r c:boot.ini
The file should look something like :
[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="Windows NT Workstation Version 4.00" multi(0)disk(0)rdisk(0)partition(1)WINNT="Windows NT Workstation Version 4.00 [VGA mode]" /basevideo /sos
You can now edit the file using a suitable text editor such as notepad. Assuming we have copied the Linux bootsector file we created above to C: then modify this file to add the option to boot Linux.
[boot loader] timeout=30 default=C:BOOTSECT.LNX [operating systems] multi(0)disk(0)rdisk(0)partition(1)WINNT="Windows NT Workstation Version 4.00" multi(0)disk(0)rdisk(0)partition(1)WINNT="Windows NT Workstation Version 4.00 [VGA mode]" /basevideo /sos C:BOOTSECT.LNX="PROTOR (Linux)"
Note that we have also changed the default line so that the system boots Linux by default.
You now need to set back the attributes on the boot.ini file.
attrib +s +h +r c:boot.ini
When the system next boots then you should see the NT Boot Loader menu which will contain three options. Booting Linux will be the third option and will also be the default if no action is taken within 30 seconds.