Confused about boot.ini

1

I recently read a little bit about boot.ini and I am a little confused. From what I understood, boot.ini works kind of like menu.lst for GRUB (or any of the other files that GRUB needs). So, if boot.ini comes before the computer boots into Windows (or any other operating system), can it be used instead of GRUB? If so, boot.ini is not much of a "Windows-thing", is it? (Since it can be used completely independently of Windows). Maybe I'm missing something and what I said here is complete rubbish. Can someone explain this to me? Thank you!

user1094565

Posted 2012-07-19T15:52:01.743

Reputation: 11

I think the Windows booter which reads boot.ini is always installed at MBR, while GRUB can be installed at MBR or the boot sector in any primary partition. (Well, I'm not sure...) – Xiè Jìléi – 2012-07-19T16:03:50.137

@XièJìléi You can indeed install GRUB to a partition - but you still have a bootloader on the MBR to load GRUB with. So there's not much of a point. – new123456 – 2012-07-19T16:54:39.427

Answers

3

The file boot.ini is part of NTLDR, the bootloader used in Windows NT up to XP and Sever 2003 (i.e. up to NT kernel major version 5). It's very much a 'Windows-thing' in that it is distributed with Windows and designed to be used with Windows. It does, however, have the capability to chainload GRUB and any other bootloader.

More recent versions of Windows (Vista, 7) use BOOTMGR, which relies on a BCD (Boot Configuration Data) store rather than the simple boot.ini text file. It can again be used to chainload GRUB or other bootloaders. In fact, programs such as EasyBCD and Visual BCD Editor provide a very simple process to add an entry for GRUB.

Chainloading can be basically described as the bootloader replacing itself in memory with a different one. If a bootloader supports chainloading, you can basically direct it to load any file it can read (on a FAT/NTFS file system in the case of Windows' bootloaders) and execute it as if the file was the original bootloader. In theory you can actually form a loop, where a bootloader loads another that loads the original, and so on...

There's a very nice description of the startup process at the Wikipedia article here.

Bob

Posted 2012-07-19T15:52:01.743

Reputation: 51 526

1

The Windows boot loader is installed into the Master Boot Record of the first bootable drive by default.

The boot process uses the boot.ini file to configure the options to present when booting.

The Windows boot loader is positively simplistic when compared to GRUB.

Boot.ini does bear a passing resemblance to menu.lst but the similarity is more convergent evolution rather than anything else.

It is possible, though not totally trivial, to get the Windows boot loader to trigger another OS. To acheieve this, you need a copy of the boot records for the other OS's boot drive, you can then add a reference to that in boot.ini that will allow that boot record to be executed to load the other OS. See the last entry in this discussion for more details.

Even GRUB doesn't really attempt to actually boot Windows, it simply hands off (chains) to the Windows boot loader.

Julian Knight

Posted 2012-07-19T15:52:01.743

Reputation: 13 389

Your statement about not being able to boot any other operating system is not 100% accurate. You actually can boot into another operating system. I have to downvote the answer for being incorrect in this regard. – Ramhound – 2012-07-19T17:06:29.253

Hmm, harsh perhaps! I'll edit to clarify. OK, done. It's been a while since I looked at this, obviously the old grey matter was playing up. – Julian Knight – 2012-07-19T17:10:04.843

1

As far as I understand it booting for a IBM compatible PC is as follows:

  1. The computer runs the Power-On Self Test.
  2. The computer BIOS locates the boot device and loads and runs the MBR (Master Boot Record).
    Modern systems might have EUFI rather than BIOS. UEFI can load both MBR and GPT drives. I will ignore those for now.
  3. The MBR contains the partition table for the disk. One of the partitions will be marked as 'active'. The BIOS loads the boot sector from this the active partition into memory and then executes it.
  4. If this was a older windows boot sector then the program in the boot sector will start and initialize the NTLDR file, which is the operating system loader.
  5. NTLDR uses boot.ini to present options

You can point the NT loader (ntldr) to other installation. E.g. if your old boot.ini looks like this:

[boot loader]
timeout=10
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
C:\="MS-DOS"

then you can add a line with C:\bootsect.lnx="Boot Linux and put the linux bootsector in a file c:\bootsect.lnx. Then you can use the same menu to select between windows boot options and linux. Selecting the linux boot option will trigger whatever commands are in that file, which might a GNU/Linux bootloader. That would present you with a second (and possibly unwanted) menu to select from.

This means that nltdr does not really boot anything but windows, but you can let it hand over to boot process to another boot loader.

Hennes

Posted 2012-07-19T15:52:01.743

Reputation: 60 739

UEFI, not EUFI... – Bob – 2012-07-19T19:33:57.597