ICPUG Home Page

 

Previous Page
PREVIOUS PAGE

 


Lin'N'WinNewB Page List
Lin'N'WinNewB
PAGE LIST

 

Next Page
NEXT PAGE

 

Lin'N'WinNewB Page List


17th May 2015

HOOKING THE LINUX BOOTLOADER INTO THE WINDOWS 7 BOOTLOADER

Brian Grainger


 

You are going to edit the Boot Configuration Data (BCD) source. This is a very important database and you must take great care to get the editing correct. Any mistakes that cause Windows to stop working are not easily corrected - especially if you bought your PC with Windows 7 pre-installed.

That being said, the editing will be done with the default tool supplied with Windows 7 and, despite the complexity of the instructions, it is very hard to get it wrong in a way that will cause Windows to stop working. Every editing instruction makes use of a UUID. This is a 32 digit hexadecimal number. If you type this incorrectly then you will be given an error message to say so and the editing instruction will not be carried out. Every instruction regarding the Linux bootloading uses a DIFFERENT UUID than the UUID for Windows so it is very hard to alter the Windows boot by mistake! I have often wondered why UUIDs are used rather than simpler aliases. I have now found an advantage of UUIDs - to avoid catastrophic errors! For this reason, I consider the editing required for Windows 7 to be far safer than that required for Windows 9x or Windows XP.

I am very grateful to noryb009 on the Puppy Linux forum, who was the first to extend the Lin'N'Win NewB Project approach to Windows 7 in his Windows Installer tool. I am also grateful to Superchook on the forum, who provided clear simple instructions for me to use as a base for what is provided here.

I shall mention that it is possible to obtain, free of charge, graphical tools to edit the BCD source. I am not going to use them because the default tool for Windows 7 will do the job with the required level of safety for me. The default tool is bcdedit which is run from a Command Prompt with administrator privileges. To open up Command Prompt in this way carry out the following:

  • Click the Windows Orb, (Start Menu), and select All Programs

  • Now select the Accessories folder

  • Right click the Command Prompt and select Run as administrator

  • You will be asked if you want to allow the Windows Command Processor program to make changes to the computer.
    Click the Yes button.

  • A Command Prompt window will appear with the cursor flashing next to c:\Windows\system32>

You are now ready to start up the bcdedit tool and issue editing commands as follows:

  • Type the following carefully, including quote marks, spaces and upper case letters, followed by the enter key:

    bcdedit /create /d "Boot using Grub4DOS" /application BOOTSECTOR

  • Provided you have typed the instruction correctly, you will be told the operation was successful and you will be given a UUID for the new menu item. This will be something like:

    {e25f890c-2d84-11df-b4a8-d580eb35e514}

    The UUID you are given, including curly braces and hyphens, should be substituted for {Grub4DOS UUID} in all that follows.

  • Type the following carefully, including quote marks, spaces and upper case letters, followed by the enter key.
    Remember to substitute your given UUID for {Grub4DOS UUID}!

    bcdedit /set {Grub4DOS UUID} device partition=C:

    Provided you have typed the instruction correctly, you will be told the operation was successful.

  • Type the following carefully, including quote marks, spaces and upper case letters, followed by the enter key.
    Remember to substitute your given UUID for {Grub4DOS UUID}!

    bcdedit /set {Grub4DOS UUID} PATH \grldr.mbr

    Provided you have typed the instruction correctly, you will be told the operation was successful.

  • Type the following carefully, including quote marks, spaces and upper case letters, followed by the enter key.
    Remember to substitute your given UUID for {Grub4DOS UUID}!

    bcdedit /displayorder {Grub4DOS UUID} /addlast

    Provided you have typed the instruction correctly, you will be told the operation was successful.

  • Type the following carefully, including quote marks, spaces and upper case letters, followed by the enter key.
    Remember to substitute your given UUID for {Grub4DOS UUID}!

    bcdedit /timeout 13

    Provided you have typed the instruction correctly, you will be told the operation was successful.

    This timeout value defines how long, in seconds, the menu is shown before the default automatically starts. I have found with my computer system that 3 has to be added to the actual value required. I do not know why. You may have to add more or less. The timeout value chosen is a matter of personal choice. The smaller the value, the quicker the default, usually Windows, will boot. The larger the value, the longer you have to select Grub4DOS. I suggest newbies start with a value of 13 to give plenty of time to make a selection. As you gain experience you may find this too slow when booting the default system. For this reason, I use a value of 5 and when I want to choose Grub4DOS I get ready with my finger on the keyboard! You can always change the value later if you don't get it right first time.

That's all the editing complete. If you want to see what the BCD contains now then type the following carefully, including spaces, followed by the enter key:

bcdedit /v

Use the scroll bar to see all the output.

You should end up with something like the following, which is how it appears on my PC.

Windows Boot Manager
--------------------
identifier              {9dea862c-5cdd-4e70-acc1-f32b344d4795}
device                  partition=\Device\HarddiskVolume1
description             Windows Boot Manager
locale                  en-US
inherit                 {7ea2e1ac-2e61-4728-aaa3-896d9d0a9f0e}
default                 {e25f8909-2d84-11df-b4a8-d580eb35e514}
resumeobject            {e25f8908-2d84-11df-b4a8-d580eb35e514}
displayorder            {e25f8909-2d84-11df-b4a8-d580eb35e514}
                        {e25f890c-2d84-11df-b4a8-d580eb35e514}
toolsdisplayorder       {b2721d73-1db4-4c62-bf78-c548a880142d}
timeout                 5

Windows Boot Loader
-------------------
identifier              {e25f8909-2d84-11df-b4a8-d580eb35e514}
device                  partition=C:
path                    \Windows\system32\winload.exe
description             Windows 7
locale                  en-US
inherit                 {6efb52bf-1766-41db-a6b3-0ee5eff72bd7}
recoverysequence        {e25f890a-2d84-11df-b4a8-d580eb35e514}
recoveryenabled         Yes
osdevice                partition=C:
systemroot              \Windows
resumeobject            {e25f8908-2d84-11df-b4a8-d580eb35e514}
nx                      OptIn

Real-mode Boot Sector
---------------------
identifier              {e25f890c-2d84-11df-b4a8-d580eb35e514}
device                  partition=C:
path                    \grldr.mbr
description             Boot using Grub4DOS

The bit that has been added is the Real-mode Boot Sector section at the end.

You can now close the Command Prompt window and the menu will be displayed the next time you boot up your PC.

That's the end of Step 2

IMPORTANT NOTES FOR WINDOWS 7

  • In the upcoming step 4 about adding the Linux to the boot menu it is assumed that Linux files are stored on the Windows partition for Windows 9x and Windows XP, which is the first partition. With Windows 7 the Windows partition is usually the SECOND partition. Certain references in the edits of menu.lst need to be modified for Windows 7 according to the following:

      Reference       Reference
    (Windows XP)     (Windows 7)
       (hd0,0)         (hd0,1)
        hda1            hda2
        sda1            sda2

  • In the upcoming step 4 you will need to make changes to menu.lst. In order to save edits to menu.lst, located in the c:\ folder, Windows 7 demands that you run your editing tool with administrator privileges. Open up Notepad or Wordpad in exactly the same way as Command Prompt was opened at the beginning of this page.

  • Click HERE to proceed to Step 3


 

 

 

 

Top
TOP