Win7 x64 booting natively via EFI (no BIOS emulation)

Discussion in 'Windows, Linux & Others on the Mac' started by VirtualRain, May 4, 2009.

  1. dotga macrumors newbie

    Joined:
    Sep 7, 2011
    #76
    Hi,

    I am reading this post with a lot of attention.
    Regarding this post, windows 7 efi boot is only supported on a full gpt harddrive with no other partition on it.

    http://www.insanelymac.com/forum/index.php?showtopic=184349#2

    From what I read, you need oscdimg.exe in order to boot efi mode. Have you ever gave a try to this solution ?

    In efi loaded windows, do you have full access to both discret and dedicated gpu on windows ?
     
  2. d3vi1 macrumors member

    Joined:
    May 18, 2011
    Location:
    Frankfurt am Main, Germany
    #77
    Hello,
    False! Booting has nothing to do with GPT or MBR. Installing on a disk requires that the target disk for the installation is GPT. However, Windows still works with MBR disks, just not for the boot disk. I suspect that booting would still work if the installer wouldn't oppose it.
    Furthermore, one of the roles of EFI/GPT is to get out of the whole 4 partitions/4 operating systems issue. Windows, on EFI systems works perfectly with Mac OS X, Linux and other Windows installations in parallel. In theory, on a 256GB SSD you should be able to get almost 25 Windows 7 SP1 x64 installations in parallel. There is almost no reason to do that, but you can!

    The mode for creating an EFI boot DVD or USB stick is irrelevant to this thread. One of the assumptions in the thread is that you already have this, done according to your needs and hardware and just want to be able to successfully boot windows beyond the boot loader, which is where most people think they are stuck. Windows actually boots on EFI64 Macs, it just doesn't have any video capabilities, which is the whole point of the thread at this point.

    Yes and no! While Windows sees both of them, it's able to use only one for two, the one which you enable with the VGAE patch before booting Windows. There are two problems:

    1) Windows drivers require VGA. Even if not int10h, most of them require the static memory mappings associated with VGA.
    2) You don't have a Windows driver for the graphics Mux (google Apple gMux) which enables you to switch the monitor and LCD panel connections between the two cards.

    As such, what can be done by a pre-OS application is to enable the Video card that you like out of the two (or more), optionally disable the other one (for most models, I didn't figure out some of them), connect the LCD panel and monitor connections to the enabled one. You might not want to disable the secondary card if you want to use it for GPU computing (OpenCL, DirectCompute, CUDA, etc.).

    Right now the application is stuck in the variations between the different Mac models. I am trying to identify the active video card pci device based on the GOP or EdidActive protocol being present on the same EFI_HANDLE, but on some Macs this is not the case. On other Macs, we even have multiple GOP Protocols.
     
  3. mark1234 macrumors member

    Joined:
    Sep 2, 2011
    Location:
    Amsterdam, the Netherlands
    #78
    I finally got some time to test the Windows pre-Beta 8 on my Mac Mini Model 2011 with Intel HD3000 Graphics.

    First, I tried to install Windows 8 next to the OS-X Lion which already was installed on the harddisk. The Windows 8 install DVD nicely boots into EFI and after installing to the harddisk, the systems reboots with a vague error. Probably the same error as d3vi1 already reported.

    So then I tried installing it again, but this time I removed all partitions on the harddisk including the OS-X EFI 200 MB partition. The Installation goes well until I get the question:

    Where do you want to install Windows?
    Disk 0 Unallocated Space

    The Disk 0 Unallocated Space is selected, but there is also an error message below in the screen reporting the following:

    "Windows cannot be installed to this disk. This computer's hardware may not support booting to this disk. Ensure that the disk's controller is enabled in the computer's BIOS menu."

    Apparently, the harddisk is not recognized by the EFI?

    Anyway, I select the Disk 0 Unallocated Space and click on the Next button. The installation continues. But after the reboot, I again get a vague error message and it does not start up.

    So, I have not succeeded to install EFI Windows 8.
     
  4. d3vi1 macrumors member

    Joined:
    May 18, 2011
    Location:
    Frankfurt am Main, Germany
    #79
    In my $WINDOWS.~BT/Sources/Panther/setupact.log I have the following:
    2011-09-15 09:18:15, Info IBSLIB Unable to open file \\?\GLOBALROOT\Device\HarddiskVolume1\EFI\Microsoft\Boot\bootmgfw.efi for read because the file or path does not exist
    2011-09-15 09:18:15, Info IBSLIB Copying boot files from E:\Windows\Boot\EFI to \\?\GLOBALROOT\Device\HarddiskVolume1\EFI\Microsoft\Boot...
    2011-09-15 09:18:15, Info IBSLIB Unable to open file \\?\GLOBALROOT\Device\HarddiskVolume1\EFI\Microsoft\Boot\bootmgfw.efi for read because the file or path does not exist
    2011-09-15 09:18:15, Info IBSLIB Unable to open file \\?\GLOBALROOT\Device\HarddiskVolume1\EFI\Microsoft\Boot\bootmgr.efi for read because the file or path does not exist
    2011-09-15 09:18:15, Info IBSLIB Copying files from E:\Windows\Boot\EFI\cs-CZ to \\?\GLOBALROOT\Device\HarddiskVolume1\EFI\Microsoft\Boot\cs-CZ...
    ...(SNIP)...

    This goes on forever with all the files for EFI boot since apparently Windows 8 Beta has a bug in UEFI mode that is Setup related, not kernel related.

    It works to install on a System that already has all the boot files on the EFI System Partition.

    That can be safely ignored. Windows Setup doesn't make heads or tails of the Boot00?? NVRAM variables on your Mac. The problem is that setup fails to copy those files on the hard-drive. I will also try to clean the hard-drive, except for the binaries in the EFI System partition and do another install.
     
  5. mark1234 macrumors member

    Joined:
    Sep 2, 2011
    Location:
    Amsterdam, the Netherlands
    #80
    I have re-installed OS-X Lion again to the harddrive. Hereafter, I removed all the partitions except the EFI partition. Then I went to install Windows 8. The installation went fine except for one of the last steps before completion. In one of the last steps, Windows 8 automatically tries to replace the basic VGA driver with an accelerated VGA driver for my Intel HD 3000. This will lead to a uniform colored green screen.
     
  6. dotga macrumors newbie

    Joined:
    Sep 7, 2011
    #81
    Thanks for your detail answer d3vi1. This is an interesting topic.

    So I have read you are able to boot windows in EFI. Have you tried on a macbook pro 2011 ?
    What are the step to follow precisely ?

    Thanks in advance
     
  7. d3vi1 macrumors member

    Joined:
    May 18, 2011
    Location:
    Frankfurt am Main, Germany
    #82
    I've tried on MBP6,2 which is quite similar from a hardware perspective to the 2011 MBPs.

    Basically you need to do a completely unattended install with the video drivers slipstreamed. After the install is done, in the EFI shell copy the application (I can send it via email) in the EFI System Partition as efi\boot\bootx64.efi. As you do that, it will boot before the Windows loader, set the correct PCI regisers and chain load the Windows boot loader afterwards.
     
  8. Nopstnz8 macrumors member

    Nopstnz8

    Joined:
    Mar 22, 2010
    #83
    So does this actually work yet on like a MacBook Pro 2010? If I was to wipe my hard drive and install Win 7 via UEFI, would I be able to then partition the disk to install OSX and Ubuntu? Are we still keeping the EFI from Apple, and just forcing Win 7 to use it, or will your Mac run off UEFI so we wouldn't have to use rEFIt to install Ubuntu or however many partitions we want?
     
  9. zwaldowski macrumors member

    Joined:
    Aug 15, 2009
    #84
    You don't need to keep reformatting. Apple only uses the 200 MB EFI partition for firmware updates; their tools, however, always create it because it's part of the GPT standard.
     
  10. dotga macrumors newbie

    Joined:
    Sep 7, 2011
    #85
    When you say "Do a completely unattended install", do you mean one loaded with the bios or efi ? Are you talking about a full EFI installation or an update from bios install to efi boot loader ?

    Thanks for your help.

    Note : I don't have an optical drive so I'm installing windows form a partition on my hard drive. When I try to launch bootx64.efi from the efi partition of my hard drive, the computer is stuck on the shell doing nothing.
     
  11. mark1234, Sep 22, 2011
    Last edited: Sep 22, 2011

    mark1234 macrumors member

    Joined:
    Sep 2, 2011
    Location:
    Amsterdam, the Netherlands
    #86
    what d3v1l means is a completely unattended install in EFI mode. When you boot your Mac and you have your Windows 7 DVD inserted, and you press the Option key on your Mac keyboard, you will get two options for starting the Windows 7, one is the BIOS mode, the other is the EFI mode. Select the EFI mode. Windows 7 will then install completely in EFI mode. You have to wait a while, because you will not see anything because Windows relies on an old VGA BIOS which is not available in the Mac. The reason you have to do an unattended install is because the screen is black and you cannot see anything. The installation however goes well underwater.

    If you do not have a DVD drive, then you have to install from an USB stick. But with this USB stick you have to make sure you boot in EFI mode from the USB stick. In order to do that, you have to copy the harddisk bootloader bootmgfw.efi in efi\microsoft\boot. Furthermore, you must have a bootable FAT32 formatted USB stick. You can create this with diskpart (use google).
     
  12. dotga macrumors newbie

    Joined:
    Sep 7, 2011
    #87
    Ok, I thought the unattended installation was only necessary because of the drivers. But I won't be able to see anything from the beginning from what you say. I won't see the partition creation screen on windows 7 install for instance ?

    Macbook pro are not able to boot windows from any external device like usb stick or external optical drive. I guess it is the same in efi mode ?
     
  13. mark1234 macrumors member

    Joined:
    Sep 2, 2011
    Location:
    Amsterdam, the Netherlands
    #88
    Your MacBook Pro has an USB port I think. Put in the Windows USB stick and while rebooting hold down the Option button on your keyboard. You will get a "boot menu" in which you can select.

    And no, you won't get the partition screen in Windows Setup. You should install Windows to a blank harddisk without any partitions.

    After installation of Windows, you can then install OS - X.

    In all, it's a complex time-consuming procedure and you have to think twice.

    I myself haven't done it yet, because I do not have the time yet to create an unattended Windows install image with slipstreamed graphics driver.
     
  14. mende1 macrumors member

    Joined:
    Aug 9, 2010
    Location:
    Toledo, Spain
    #89
    And how I select the Windows partition if the screen does not show nothing? :confused:
     
  15. dotga macrumors newbie

    Joined:
    Sep 7, 2011
    #90
    Ok so I don't think I will be able to make it. As I told you, macbook air are able to boot usb stick but macbook pro 2011 are not. It seems to be a efi firmware issue on the macbook pro (see refit topic). The macbook air comes with a different version of bootcamp which support usb stick (bootcamp 4.0.1), but it is not the case for the macbook pro.

    I'm will wait for the next efi firmware update...
     
  16. d3vi1 macrumors member

    Joined:
    May 18, 2011
    Location:
    Frankfurt am Main, Germany
    #91
    Well, in EFI mode, all Macs can boot from CDROM, HDD, USB, SD-Card and Firewire without a problem. In CSM/BootCamp mode, it's usually CDROM and HDD only unless you have a new Mac.

    Since we're talking about EFI here, this is not an issue.

    ----------

    You don't at this stage. You could personalize the AutoUnattend.xml file to install to a certain partition, our you can install Windows, shrink it and install MacOS afterwards.

    Cheers,
    R.
     
  17. dotga, Sep 23, 2011
    Last edited: Sep 24, 2011

    dotga macrumors newbie

    Joined:
    Sep 7, 2011
    #92
    Good to know !
    So it means I have another problem.
    I booted from the dvd with efi and nothing happen. My MacBookPro 8,2 (Early 2011) is stuck to the efi selector menu and the MAJ key does not work anymore after that.
    I will test your efi program d3vi1, thanks.
     
  18. pesos macrumors 6502a

    pesos

    Joined:
    Mar 30, 2006
    #93
    watching this with great excitement. i have a 2010 mba and 2011 mbp i can use to help test with.
     
  19. mende1 macrumors member

    Joined:
    Aug 9, 2010
    Location:
    Toledo, Spain
    #94
    I tested three Windows versions:

    1. Windows 7 Home Premium x64 DVD without SP1 (retail version). Simply, I cannot see anything because the screen does not show anything.

    2. Windows 7 Home Premium SP1 x64 USB. In EFI Shell, I try to run EFISetVGARegs.efi file and the EFI Specification changes to 2.10 version. Then, I run bootmgfw.efi and the screen does not show anything.

    3. Windows 8 Developer Preview. Boots perfectly in EFI mode! But, at the partition stage, Windows detects that my Mac uses MBR table :eek:!? If my Mac has got a GPT hard disk, why Windows detects that my Mac has got a MBR hard disk?

    My Mac is a 21'5-inch iMac (Late 2009) (model: iMac10,1) with 256 MB ATI Radeon HD 4670 graphic card.
     
  20. mark1234 macrumors member

    Joined:
    Sep 2, 2011
    Location:
    Amsterdam, the Netherlands
    #95
    1. Windows 7 relies on old VGA BIOS in order to see anything. Since your MAC does not have a VGA BIOS you will not see anything. However, installation continues. But remember: you will need an unattended (i.e. non-interrupted) version of Windows. Google "unattended Windows" for more info.

    2. The EFISetVGARegs.efi calls automatically bootmgfw.efi. The fact that you do not see anything, see point 1.

    3. You are trying to install to an MBR partition, probably because you had Windows running via Bootcamp. Best thing is to wipe the complete harddisk (including OS X) and then try to install.
     
  21. mende1 macrumors member

    Joined:
    Aug 9, 2010
    Location:
    Toledo, Spain
    #96
    Ok. I don't know that EFISetVGARegs.efi calls automatically bootmgfw.efi ;). I will try the unattended installation soon :). Thanks!
     
  22. cbruckne macrumors newbie

    Joined:
    Sep 28, 2011
    #97
    I managed to install Windows 8 DP on my MBP 15 Early 2011.

    I had working Video with the EFI-Installer booted off an USB-Drive (boot-animation + setup) without fiddling with the efi-shell, mapping memory and registers, but at the end it failed to setup the BCD store on the EFI-Partition, so i set up the file myself.

    Now "EFI-Boot" shows up correctly in the Apple Bootpicker and loads Windows. I can see the boot-animation, also video in safe-mode works. But in safe-mode Windows doesn't let me setup the system, and in normal boot i don't have graphics output.

    -> d3vi1
    Maybe you want me as tester for your efi-application ;)
     
  23. Dragorth macrumors newbie

    Joined:
    Oct 3, 2011
    #98
    Stuck at the bcd stage

    Hi, I am installing Windows Dev Preview in UEFI mode on a MacBook Pro Early 2011 model, and get stuck at the bcd stage. I have manually copied the files to the efi partition. I cannot edit the BCD store. I have no entries in it, and cannot get the windows commands to open the bcd store.

    I have tried mounting the System partition, and still no go with

    bcdboot C:\windows /s f: /f UEFI

    where f: is the efi partition.

    If anyone has suggestions, I would appreciate it. Also, I am willing to test for anyone needing it. I plan on releasing a full guide after this is over, as I can't find a complete one anywhere, that deals directly with the MacBook.

    Thanks in advance.

    Dragorth.
     
  24. d3vi1 macrumors member

    Joined:
    May 18, 2011
    Location:
    Frankfurt am Main, Germany
    #99
    I've made a bug report at Microsoft regarding the issue, it should 'just work' (TM), as it does work correctly in Windows 7 and Vista SP1.

    Christoph took another path and tried to work around the bug. I am reproducing (shamelessly and without permission) the relevant parts:
    And part 2:
    Maybe you should ask him for some details on the registry tinkering.

    What I can't understand is how I managed to install it without any problems on an empty hard drive on MBP5,3. It took a few tries, but I can't remember what did it. There was a disk partitioning combination that managed to install it perfectly. It still fails with the same error on my MBP6,2. I'll try to debug it and reproduce the failure.

    Cheers,
    R.

    P.S.: Christoph, hope you don't mind me reproducing some details of your work.
     
  25. cbruckne macrumors newbie

    Joined:
    Sep 28, 2011
    #100
    Hi Dragorth,

    here are the steps i did to get windows to boot off the efi partition:

    - install windows until the bcd error pops up
    - DON'T CLICK the button!
    - shift+f10 to open the shell
    - mount the efi partition if it isn't already mounted (f: in my case)
    - there should already be a folder "F:\EFI\Microsoft\Boot" with bootmgfw.efi, BCD and some other files in it
    - the BCD-Store is empty (8K filesize)
    - delete the BCD file and copy over the template (C:\Windows\system32\Config\BCD-Template) and rename it to "BCD"
    - modify the template (bcdedit /store F:\EFI\Microsoft\Boot\BCD /set .....) so that the bootmanager object has the device and path set to the efi partition's "F:\EFI\Microsoft\Boot\bootmgfw.efi"
    - add an osloader application object with the device and osdevice set to "partition=C:" and path set to "\Windows\System32\winload.efi"
    - copy some crap over to the EFI partition, so the BCD file is not in the disk cache, and delete it again. (I encountered strange behaviour, because windows doesn't safely unmount the partitions when shutting down from the installer)
    - exit the shell and press the power button until the mac is shut down. (so windows doesn't rollback changes)
    -> the bootloader should now work, but you will not have graphics output, because there is an issue when both cards are enabled (if you use a 15" or 17" mbp with additional discrete graphics)

    get graphics in normal mode:
    - in safe mode you will have basic video output, so hold f8 while clicking "EFI Boot" in Apple's bootpicker and select Safe Mode.
    - wait for the "Windows can't be setup in Safe Mode" error
    - shift+f10
    - compmgmt.msc
    - go down to device manager and disable the intel graphics adapter (the one with vendor id 8086, if the names aren't shown)
    -> you would now have graphics when normal-booting windows, but the next bcd error isn't far ahead...
    (it would be like "installer can't set up windows on this computer's hardware" or so)
    - modify the "C:\Windows\system32\Sysprep\ActionFiles\Specialize.xml" file with notepad
    -> delete the the two "imaging" entries (<imaging ....>...bcd....</imaging>) with bcd in it (strg+f will do)
    - safe
    - press the OK button of the error message in the background to reboot

    -> windows now installs device drivers and halts with an error about the bootconfig.
    - time for shift+f10!
    - regedit
    - i found a setup related folder in HKLM with some keys for the various setup actions "...done" in it or so, and set them to 1, also there is a key which determines, if the current system state is setup, and set it to 0. don't know exactly, maybe you find out yourself.
    - i then wanted to sysprep my system to start then with the oobe phase (sysprep /oobe), but that gave me an error, so this step may not be necessary
    - then i started "windows welcome" (C:\Windows\system32\oobe\msoobe.exe)
    -> that should take you to the assistant for setting up hostname and user.
    - when logging in, the hard drive worked for a minute or so, and then nothing.
    - i powered off my mac and booted into safe mode, and logging in worked.
    - restart -> and voila, login works, windows setup complete ;)

    i installed the bootcamp drivers with compatibility mode set to windows7, so most of the hardware works. but graphics uses only the windows basic drivers. maybe anyone can find out more on that issue.

    good luck! (i know you'll need it ^^)

    Here are my BCD and specialize.xml files: download
    you need to set osdevice and device of the boot manager and loader objects via bcdedit to your partition, if you use my file!

    The Technet article for modifying the BCD template and setting the EFI-relevant options: Article
     

Share This Page