Windows 7 EFI & GPT:In both VM and native (Linux as host)

Post Reply
diggy
Posts: 2
Joined: 7. Oct 2013, 00:21
Primary OS: openSUSE
VBox Version: OSE other
Guest OSses: openSuse, Debian, Kubuntu, Ubuntu, Puppy, TinyCore,PC BSD, React OS, Windows 7,XP,98,95,3.11
Location: Naoussa, Imathia, Greece

Windows 7 EFI & GPT:In both VM and native (Linux as host)

Post by diggy »

This guide is based on HOWTO: Windows 7: In both VM and native -- VBox3.x with modifications on booting from an EFI PC on GPT hard disk WITHOUT using virtualbox'es EFI.

Note
This is just a quick write-up and needs some serious cleanup. Also requires high level of skills to fiddle with without breaking your system.
I started trials several weeks ago but just today found some time to make it work, there may be information missing, so bear with me.
Unfortunately I have very little free time to rewrite the whole guide so I'll just point out the differences, where needed and some things you might have to figure out on your own or ask for help on the forum.

1) Follow the original guide up to the point of creating the vmdk.

2) Since Windows expect to find 3 partitions the command to run to create the raw vmdk is modified to:

Code: Select all

sudo VBoxManage internalcommands createrawvmdk -filename raw123.vmdk -rawdisk /dev/sda -partitions 1,2,3 -relative -mbr myMBR.mbr
Notes
The command above assumes the following partition schema:

[*] partition 1 - FAT Boot partition, containing the bootloader
[*] partition 2 - Microsoft reserved partition. Just put it there, I have no idea of it's use.
[*] partition 3 - Windows OS partition. This is the one that has all the files visible from within Windows

If you have your partitions placed in a different order or place, change accordingly.
[/i]

3) Load the vmdk in a SATA controller in the VM (from now on VM_7).

After you've set up successfully the VM_7 you should get started with the bootloading process.
Since EFI for Windows is buggy (if I'm wrong correct me) we won't be using virtualbox'es built-in EFI at all.

We'll use a tool called DUET - rodsbooks(dot)com/bios2uefi/

4) Setup a new VM (from now on VM_DUET) to put DUET into. Using a 200mb virtual disk will be enough. DUET page provides detailed installation instructions.

5) After installation, power down VM_DUET and load the newly created virtual disk (with DUET) to another VM (from now on VM_AUX) as a secondary disk.

6) As root, copy the EFI directory from the host OS (containing Windows bootcode) from it's location to another handy folder preferably in user's home.

Note
To find out where the boot partition is mounted use:

Code: Select all

mount|grep boot
[/i]

7) Make that folder shared to VM_AUX.

8 ) Mount the DUET virtual disk and copy the EFI directory from the host machine.


Note
The directory structure should be like:
/
/EFI
/EFI/Boot
/EFI/Microsoft
etc.


9) Unmount DUET's virtual disk and power down VM_AUX

10) Load DUET to VM_7 in an IDE controller.

11) Continue with the rest of the original guide.

12) Cross your fingers and power up VM_7

Note
There'll be an error message from the Windows bootloader stating: Status 0xc0000225 The boot selection failed because a required device is inaccessible. Just press enter to move on.


General Notes
1) It's risky.
2) You may encounter all problems stated in the original guide.
3) I haven't tried installing Vbox additions.
4) I haven't tried booting Native windows so I don't know if anything is broken.
5) At some point in the beginning I fiddled with the bootloaders BCD and added some extra boot options. I have no idea which option boots. If you can't get it to work with the original one (that came from windows installation) I'll look at the BCD to see what I've changed.
6) Since its my second post forum rules don't let me post urls so you'll have to decode the one for duet (not so hard, is it?)

I hope it'll be usefull to someone, if it works as stated (it did for me).

Regards,

Dimitrios Tanis
RushPL
Posts: 5
Joined: 26. Feb 2012, 19:55

Re: Windows 7 EFI & GPT:In both VM and native (Linux as host

Post by RushPL »

Thank you Dimitrios, I found your post quite accidentally just when I was going to redo my setup without UEFI. It seems to have booted my Windows 7 Pro from VirtualBox on openSUSE. It is now checking the disk. Thank you thank you thank you!
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Windows 7 EFI & GPT:In both VM and native (Linux as host

Post by mpack »

Hmm. I seem to have missed this tutorial when it was written. I'll move this to the tutorials section where it won't get lost but bear in mind that this tutorial is untested by me! Hence there are no guarantees, and please don't bother PMing me for an explanation.

Also note that this tutorial is about get Windows 7 running both natively and as a VM, where the host is using EFI. This is not about getting the Windows guest to use VirtualBox's EFI.
Post Reply