Search This Blog

2010-09-16

Adding Ubuntu to Windows 7 bootloader

This is a tutorial to add Ubuntu to the Windows 7 bootloader and the tool bcdedit which is native to Windows. This requires Windows 7 to be installed first.
NOTE: When installing Ubuntu, install GRUB on the partition you are installing Ubuntu on, and NOT on the Windows partition.

Step 1:

Create a backup folder for your bootloader entries incase of emergencies or errors under C:\BCD

At the command prompt enter(Press Windows Key + R and type "cmd" and hit enter):
Bcdedit /export "C:\BCD\bcdBackup"

Step 2:

Now create an entry to the boot loader:
Enter the following Commands
bcdedit /create /d "Title for Ubuntu" /application bootsector
Notes:
-/create create the entry
-/d is the descrption command
-/application bootsector is the type of entry to create
-Also the entry is not automatically added to the boot list menu

The following output will appear. Note copy your entry id (your unquie id is string of characters that has {..})
The entry {bfa3653c-8d1e-11de-9d35-ed9cb53ede31} was successfully created.

Step 3:

Now we have to point the boot entry to a boot loader file. (This file will be created later)
bcdedit /set {id of your entry} path \ubuntu.bin
You should get the output message if it is properly created.
The operation completed successfully.

Step 4:

We need to set the partition where the bootloader can find the file we referred to in the previous step. Since this is a Windows bootloader, it has to point towards a readable Windows partition (ie NTFS or FAT32).
bcdedit /set {id of your entry} device partition=C:
You should get the output message below if it is properly created
The operation completed successfully.

Step 5:

Now we add the entry to the bootmenu list. The following command will add it to the bottom of the list.
bcdedit /displayorder {id of your entry} /addlast
Again, you should get the same output message.
The operation completed successfully.

Step 6:

Restart the computer and Install Ubuntu but stop at the "Ready to install" which is the last screen with the "Install" button.
Make note of the partition you are installing the Ubuntu OS on (ie sda2 or hda2).

Once at the "Ready to install" screen, click on the Advanced button and select the partition you are installing Ubuntu in

Step 7:

click OK to continue and then Install button to proceed installing.

Step 8:

In terminal (Applications > Accessories > Terminal) type:
dd if=/dev/ [the partition of the Ubuntu installation partition] of=/media/[the partition you set to store the ubuntu.bin file in the bootloader entry]ubuntu.bin bs=512 count=1

Example:
dd if=/dev/hda2 of=/media/C/ubuntu.bin bs=512 count=1

And once you restart you can boot into your Windows and Ubuntu with the Windows bootloader.

3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete

Note: Only a member of this blog may post a comment.