Vista booting Linux explained
Edited - 28/4/09 - Tried the MS Windows 7 both 32 and 64 bits which use the same bootmgr and BCDedit as Vista. Thus this thread is also applicable to the new Windows 7.
NT versions of MS Windows can multi-boot Linux by its boot loader NTLDR. The steps are summarized in Task E4 of Just Booting tips.
I have been looking at Vista's new boot manager and use it boot Linux. The basics has not changed. The key features are using the bcdedit.exe to carry out 4 main steps (first 2 are done in Linux).
- The Linux must has a boot loader, either Lilo or Grub, in its root partition.
- The first sector of 512 bytes of the Linux partition is copied into the partition where Vista's bootmgr resides.
- Vista BCDedit is informed of the name of the Linux. An identifier is issued by BCDedit.
- User declares the identifier as a device boot.
- User informs BCDedit the filename of the Linux's first sector.
- User informs BCDedit the booting order of the Linux
In a nutshell Vista chainloads a Linux same as Grub or Lilo. However while Linux chainloads another system at the +1 position (starting from the second sector and load the entire boot sector) Vista only loads the first sector nothing else.
This is more to do with MS attitude towards other operating systems. It is a message saying I don't support you guys and there is no way I would come out to read your partition and fetch your boot loader. If you want me to boot you then place the first sector on a plate and deliver it to my "C" drive.
-----------------------------------------------------------------------------
Implementation
The best Linux for work with a Vista is possibly the current version of Slax which automatically mounts every partition it finds, already shipped with ntfs-3g so writing on ntfs partitions is seamless, offers root privilege to the user and permits user a complete freedom in the graphic desktop.
Thus if Vista is already mounted in /mnt/sda2 one can copy the first sector of any LInux partition, say sda7, to the "C" drive of Vista directly bt terminal command
Code:
dd if=/dev/sda7 of=/mnt/sda2/sda7.bin bs=512 count=1
The binary file used is "sda7.bin".
Thereafter there are 4 steps in Vista to implement the booting. The work is done in Command Prompt but must be run as the adminstrator. Just right click the "command prompt" and select "Run as Adminstrator". Vista will drop you straight into c:\Windows\system32 directory where the control program bcdedit.exe resides.
Step-1 Vista BCDedit is informed of the name of the Linux.
This is done by command
Code:
bcdedit /create /d "Linux_in_sda7" /application BOOTSECTOR
The entry {c4c13df3-7949-11dc-98f8-81e4e48608ff} was successfully created.
In the above only the Green bit is the input. The second line in orange is the response by Vista bcdedit. The entry {c4c13df3-7949-11dc-98f8-81e4e48608ff} is internally generated by bcdedit sequentially as a unique identifer which must be used in the next 3 steps.
Step-2 User declares the identifier as a device boot.
This is by command
Code:
bcdedit /set {c4c13df3-7949-11dc-98f8-81e4e48608ff} device boot
Step-3 User informs BCDedit the filename of the Linux's first sector.
This is by command
Code:
bcdedit /set {c4c13df3-7949-11dc-98f8-81e4e48608ff} PATH \sda7.bin
Step-4 User informs BCDedit the booting order of the Linux
This is by command
Code:
bcdedit /displayorder {c4c13df3-7949-11dc-98f8-81e4e48608ff} /addlast
The complete response the command prompt looks like this
Code:
C:\Windows\system32>bcdedit /create /d "Linux_in_sda7" /application BOOTSECTOR
The entry {c4c13df3-7949-11dc-98f8-81e4e48608ff} was successfully created.
C:\Windows\system32>bcdedit /set {c4c13df3-7949-11dc-98f8-81e4e48608ff} device boot
The operation completed successfully.
C:\Windows\system32>bcdedit /set {c4c13df3-7949-11dc-98f8-81e4e48608ff} PATH \sda7.bin
The operation completed successfully.
C:\Windows\system32>bcdedit /displayorder {c4c13df3-7949-11dc-98f8-81e4e48608ff} /addlast
The operation completed successfully.
C:\Windows\system32>bcdedit /enum
Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=C:
description Windows Boot Manager
locale en-US
inherit {globalsettings}
default {current}
displayorder {current}
{c4c13df3-7949-11dc-98f8-81e4e48608ff}
toolsdisplayorder {memdiag}
timeout 1000
Windows Boot Loader
-------------------
identifier {current}
device partition=C:
path \Windows\system32\winload.exe
description Windows Vista
locale en-US
inherit {bootloadersettings}
osdevice partition=C:
systemroot \Windows
resumeobject {e8709fb7-fa5f-11db-be4d-e219ece5282e}
nx OptOut
Real-mode Boot Sector
---------------------
identifier {c4c13df3-7949-11dc-98f8-81e4e48608ff}
device boot
path \sda7.bin
description Linux_in_sda7
C:\Windows\system32>
Lastly I used the command "bcdedit /enum" to list the booting choices, which are just Vista and the new Linux I added. In the above the blue bits are commands while the rest is response by Vista.
For using Vista to boot more Linux it pays to write a script to automate the process, as I did in here.
--------------------------------------------------------------------------
Disappointments of Vista
(1) I have used a python script to automate booting of 20 Linux (later for 150 Linux) but found only those in the same hard disk as Vista can boot successfully. It would appear bcdedit.exe has not been written to handle booting system in a hard disk other than the one Vista residing.
(2) The location of the Linux first sector file also needs to be in the root directory as the bootmgr.exe. When I placed the same file in a subdirectory the booting failed.
(3) Vista has a scrolling screen but only the top 6 are visible. The highlight key may drop below the 6 booting choices and disappear completely in some instances.