Booting into Windows 98 is simple, as LILO will load and execute the specified Windows drive boot sector, as indicated in lilo.conf. However, LILO cannot directly boot into Windows XP, as Windows XP uses the NT boot loader, NTLDR. To be able to successfully multi-boot Windows XP and Linux with LILO, you will need to tweak NTLDR. This way, you can boot into Windows XP or Linux easily. To boot into Linux, you have to get NTLDR to transfer control to LILO. Remember, this technique works only if you run Windows XP on the FAT32 filesystem; LILO does not work with NTFS.
In our example, Windows XP resides on the /dev/hda1 partition, the /boot partition is /dev/hda2 and the /(root) partition is /dev/hda5.
First, you need to create an image of the Linux boot partition. As root, enter the following
command: dd if=/dev/hda2 of=/bootsect.lnx bs=512 count=1
This command copies the first 512 bytes of the /boot partition into a file—bootsect.lnx, in the /(root) partition.
Next, you need to copy this file to the Windows XP drive. You can do this either by copying the bootsect.lnx file into a floppy, booting into Windows XP and copying it to the ‘C:’ drive, or by mounting the XP filesystem using the ‘mount’
command: mkdir /windowsxp
This creates a directory, a mount point for Windows XP. Now mount the drive using the
command: mount -t vfat /dev/hda1 /windowsxp
Copy bootsect.lnx to the C drive by typing:
Command: cp /bootsect.lnx /windowsxp
Now you need to boot into Windows XP to tweak the NTLDR. You can do this by adding an entry into the boot.ini file—the NTLDR equivalent of the lilo.conf file.
Normally, this is not visible in the C drive. You can edit it by going to Start > Run and typing in cmd.exe, and at the command prompt typing edit boot.ini. Add the following line to the end of the file:
C:\bootsect.lnx=”Linux”
Now, save the file and close it. Do not edit any other settings, or you may not be able to boot into Windows XP. The edited file should look like this:
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS=”Microsoft Windows XP Professional” /fastdetect
C:\bootsect.lnx=”Linux”
Now reboot the system. NTLDR will prompt you to choose between Windows XP—which is default—and Linux. If you choose Linux, LILO will kick into action and present you with its boot menu—this again gives you the option of booting into Linux or DOS. Selecting DOS will take you back to the NTLDR boot menu.