Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
Hi,

Does anyone have the EFI script for the :

iMac11,1 ("Core i5" 2.66 27-Inch Late 2009 with ATI Radeon HD 4850) ;
MacBook6,11 ("Core 2 Duo" 2.26 13" Uni/Late 09 with geforce 9400) ;

Thanks in advance ...
 
Some old macbook does not understand script in that way.
That stupid script took me a long time to figure out.

Code:
mm 0010003E 1 ;PCI :8
mm 02000004 1 ;PCI :7
fs0:
EFI\Microsoft\Boot\Bootmgfw.efi

this is my code but you should be able to write your own based on mine.

Whew, thanks for that. Was a bit of a pain manually typing in the commands on every boot up. I also added:

mm 0750 1 ;IO :2

to disable the discrete Nvidia card; that works as well.
 
Ok guys I'm still having a small issue here. I was able to install Windows with an unattended install. I have EFI shell loaded via USB. I run the following commands and I do verify the settings are actually changed:

Code:
1. Let's expand the shell:

Shell> mode 160 42

2. Let's check default values. and enable VGA:

Shell> pci -i 00 10 00 (Bridge Control(3E) - Register 03 =  0)
Shell> mm 0010003E -PCI 8
Shell> pci -i 00 10 00 (Register 03: 1)

The following command enables I/O access and sets Bus master. Verify:
Shell> pci -i 02 00 00 (Command(4) Register 00: 0. Register 02: 0)
Shell> mm 02000004 -PCI 7
Shell> pci -i 02 00 00 (Register 00: 1, Register 02: 1)

Shell> fs0:
Shell > EFI\Microsoft\Boot\Bootmgfw.efi

I am only typing what comes after Shell and nothing inside parenthesis. I am able to see Windows say it did not start properly. I select boot Windows normally. Then my macbook just loads, and I hear nothing and it reboots a minute later. I have a Macbook Pro 2009 with only one GPU (Nvidia 9400M). I think I am really close to getting this, but I feel I am missing something. I have a feeling I am enabling VGA on the wrong PCI bridge. Please help. You guys have been amazing.
 
little guide to find registers and values: (values shown are for my macbook pro 3,1, gf8600m gt only)

1) start efi shell

2) find the vga controller: (the -b flag reduces output to one page)
Code:
pci -b
here you can see all devices, find the display (vga) controller, in my case:
Code:
00 01 00 00

3) check the device config:
Code:
pci -i 00 01 00 -b

a) on page 1 (in my case) i can see the values for the Command Register (4),
the bits (00) I/O space enabled and (02) bus master are set to 1, so nothing to change here.

b) on page 3 (in my case) i can see the values for the Bridge Control Register (3E), the bit (03) VGA Enable is set to 0, this should be 1

4) set the bit mentioned in 3b):
Code:
mm 0001003E -PCI 8
explanation:
a) device is on 000100 (see 2))
b) the Bridge Control Register is 3E (see 3b))
c) the VGA Enable bit is (03), so if you imagine an 8 bit register (00001000 = Bit (07) to Bit (00)) and you want to set bit (03) to 1, you have to feed the register with 00001000 binary, which is 8 decimal).

5) check pci device config again (same code as for 3)) and you should see that the VGA Enable bit (03) in register (3E) is now set to 1.

Hope this helps someone out there ;)
 
Last edited:
  • Like
Reactions: remaker and Teutone
little guide to find registers and values: (values shown are for my macbook pro 3,1, gf8600m gt only)

Hope this helps someone out there ;)

I think this should be very helpful to a lot of people, I know that when I was starting out, I was tearing my hair out in confusion until all the hex-dec conversion business started to make sense.

Ironic that the point of UEFI is to do away with all of this hassle for end-users :D
 
Well just checking in, I managed to get this working on my Macbook Pro.



I am not having very much success reproducing this on my Mac Pro. However, I believe this is because I integrated all boot camp drivers into my install.wim file and not just the Nvidia drivers. I will check back sometime tomorrow with my findings.
 
I see quite a lot of people succeed installing Windows 7 in EFI mode.

However, I am not sure how many people having problem with Brightness button.

Is it just me that having this function not working? or others already fixed it??
 
I see quite a lot of people succeed installing Windows 7 in EFI mode.

However, I am not sure how many people having problem with Brightness button.

Is it just me that having this function not working? or others already fixed it??

No, the brightness doesn't work. away8907 had some success modifying the brightness from the efi shell by modifying the 0x774 I/O register, but not in Windows. An app would probably need to be written to control brightness once we can get that I/O register to modify in Windows.
 
I have a successful install on my Mac Pro. I was able to duplicate the procedure to boot both Windows 7 and Windows Server 2008 R2. :) Thanks guys.
 
I see a lot of people with successful installations and I am very glad this is working perfectly :)
Will we be able to install Windows alongside OSX on the same hard drive? It seems to me that entire drive format is needed if you want to have this type of configuration.
 
I see a lot of people with successful installations and I am very glad this is working perfectly :)
Will we be able to install Windows alongside OSX on the same hard drive? It seems to me that entire drive format is needed if you want to have this type of configuration.

I am working on this now.
 
Status update

Don't rely on Apple "fixing" anything with regards to running/installing Windows on their computers. For starters, they need to start following the UEFI standard. I doubt Microsoft will do anything with regards to this either, since any effort from their side can be rendered useless if Apple doesn't agree to follow standards.

It's not only about following UEFI. The fact that Macs don't implement UEFI only impacts the BCD creation. Windows only needs RS->QueryVariableInfo for editing the startup environment.

The part with the VGA emulation is a Microsoft requirement and it's a real doozie on their side.

The part with the VGA registers is a problem with the display drivers from NVidia and AMD (Intel gets it right though).

It's mostly a split fault issue. I've solved the VGA registers a long time ago and here's the status on the other two:

VGA emulation
==========
1) Search for viable option ROMs in the firmware, PCI BAR, FileSystem - DONE
2) Match viable option ROMs to the active video cards - DONE
3) Load the viable option ROM - DONE
4) POST the viable option ROM - still working on it
I've tried porting the SCITECH X86Emu to MSVC and that proved more difficult than expected. So I've decided to port my application to Tiano Core GCC. I'm now (this upcoming week) attempting to post the video card using the SciTech X86emu.

RS->QueryVariableInfo
==============
1) Identify the Flash Firmware Volume that contains the NVRAM Storage - DONE
2) Create a and install a new Runtime Services Table that also contains a pointer to my version of QueryRuntimeServices - DONE
3) Install the driver as a runtime driver - DONE
4) When SetVirtualAddressMap is ran by the OS loader, I have a handler that converts the pointers. However I don't know which pointers need converting. Apple's RuntimeServicesDxe also converts some pointers and I don't know if in my RS table or in the old one. Converting pointers twice is not really going to fly. Unfortunately here is where I'm lost. The code works perfectly in boot mode, but it fails in Runtime and I have no idea how to debug it. If anyone wants to give it a show, I can send you a copy of it.

So, just like one month ago, I'm stuck in the same places but at least the VGA emulation is going somewhere (for now).
 
It's not only about following UEFI. The fact that Macs don't implement UEFI only impacts the BCD creation. Windows only needs RS->QueryVariableInfo for editing the startup environment.

The part with the VGA emulation is a Microsoft requirement and it's a real doozie on their side.

The part with the VGA registers is a problem with the display drivers from NVidia and AMD (Intel gets it right though).

It's mostly a split fault issue. I've solved the VGA registers a long time ago and here's the status on the other two:

VGA emulation
==========
1) Search for viable option ROMs in the firmware, PCI BAR, FileSystem - DONE
2) Match viable option ROMs to the active video cards - DONE
3) Load the viable option ROM - DONE
4) POST the viable option ROM - still working on it
I've tried porting the SCITECH X86Emu to MSVC and that proved more difficult than expected. So I've decided to port my application to Tiano Core GCC. I'm now (this upcoming week) attempting to post the video card using the SciTech X86emu.

RS->QueryVariableInfo
==============
1) Identify the Flash Firmware Volume that contains the NVRAM Storage - DONE
2) Create a and install a new Runtime Services Table that also contains a pointer to my version of QueryRuntimeServices - DONE
3) Install the driver as a runtime driver - DONE
4) When SetVirtualAddressMap is ran by the OS loader, I have a handler that converts the pointers. However I don't know which pointers need converting. Apple's RuntimeServicesDxe also converts some pointers and I don't know if in my RS table or in the old one. Converting pointers twice is not really going to fly. Unfortunately here is where I'm lost. The code works perfectly in boot mode, but it fails in Runtime and I have no idea how to debug it. If anyone wants to give it a show, I can send you a copy of it.

So, just like one month ago, I'm stuck in the same places but at least the VGA emulation is going somewhere (for now).

Nice Job D3vi1. We eagerly await your app as it would make messing with unattended installs entirely unnecessary.

I see a lot of people with successful installations and I am very glad this is working perfectly
Will we be able to install Windows alongside OSX on the same hard drive? It seems to me that entire drive format is needed if you want to have this type of configuration.

Your best bet is to install OS X on an external drive and any other OSes as well. Windows needs to be on a physical device inside the computer. I am having some issues with installation. For some reason, it only recognized a DiskID of 0 in the Autounattend file. It creates the partitions but errors out on all other operations. I suspect a BCD error. I am still working on this. I have had ZERO problems with a concurrent installation of OS X, Linux, and FreeBSD. If I only put Windows on one drive, I have no problems installing Windows and Windows Server 2008 R2. I'm trying to have a 5 boot system. Still actively working on this.
 
So, basically, not having possibility to install two OS’s (OSX and Windows) on same drive is Windows installation problem?
 
So, basically, not having possibility to install two OS’s (OSX and Windows) on same drive is Windows installation problem?

I have yet to be able to get this to work. I am still working on this, but it is really tough to see what the actual error is, since you don't have any video throughout the entire installer phase. I can't say it isn't possible. However, I have noticed that it appears you must install Lion first due to the 200MB esp that it creates.
 
So, basically, not having possibility to install two OS’s (OSX and Windows) on same drive is Windows installation problem?

It is perfectly possible to install a Windows next to Mac OS X, as long as:

1) You don't have a hybrid GPT partition table.
2) You don't use unattended install (currently the only way, subject to change soon enough hopefully)

For point 1:
Remove the other MBR partitions and make the EFI Protective Partition occupy the while disk as follows. In the example below, we remove the 2-4 MBR partitions and resize the EFI Protective Partition to occupy the whole disk (same start sector as initially and maximum sector for the end sector).

Without this, Windows sees this as an MBR disk and will refuse to install. If it is a GPT disk, even if you have pre-existing partitions with other OSs, Windows will install without a hitch.

Code:
iMac:~ razvan$ sudo fdisk -e /dev/disk0
Enter 'help' for information
fdisk: 1> p
Disk: /dev/disk0	geometry: 77825/255/63 [1250263728 sectors]
Offset: 0	Signature: 0xAA55
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 -     409639] <Unknown ID>
 2: AF 1023 254  63 - 1023 254  63 [    409640 - 1181779440] HFS+        
 3: AB 1023 254  63 - 1023 254  63 [1182189080 -    1278440] Darwin Boot 
*4: 07 1023 254  63 - 1023 254  63 [1183467520 -   66795520] HPFS/QNX/AUX
fdisk: 1> edit 2
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 2: AF 1023 254  63 - 1023 254  63 [    409640 - 1181779440] HFS+        
Partition id ('0' to disable)  [0 - FF]: [AF] (? for help) 0
Partition 2 is disabled.
fdisk:*1> edit 3
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 3: AB 1023 254  63 - 1023 254  63 [1182189080 -    1278440] Darwin Boot 
Partition id ('0' to disable)  [0 - FF]: [AB] (? for help) 0
Partition 3 is disabled.
fdisk:*1> edit 4
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
*4: 07 1023 254  63 - 1023 254  63 [1183467520 -   66795520] HPFS/QNX/AUX
Partition id ('0' to disable)  [0 - FF]: [7] (? for help) 0
Partition 4 is disabled.
fdisk:*1> edit 1
         Starting       Ending
 #: id  cyl  hd sec -  cyl  hd sec [     start -       size]
------------------------------------------------------------------------
 1: EE 1023 254  63 - 1023 254  63 [         1 -     409639] <Unknown ID>
Partition id ('0' to disable)  [0 - FF]: [EE] (? for help) 
Do you wish to edit in CHS mode? [n] n
Partition offset [0 - 1250263728]: [63] 1
Partition size [1 - 1250263727]: [1250263727] 
fdisk:*1> write
Device could not be accessed exclusively.
A reboot will be needed for changes to take effect. OK? [n] y
Writing MBR at offset 0.
fdisk: 1> quit
iMac:~ razvan$

For point 2, in case of Windows 8 you need a Mac with RS->QueryVariableInfo (MBP5,x only until now). In case of Windows 7, only my "in the works" application will solve this until Apple does something about it. So there isn't much you can do about point 2 unless you're planning to install Windows 8 (and only Windows 8 for now) on MBP5,x.
 
I didn't manage to boot win7 in EFI mode, for me it's only possible to boot windows 8 so I'm wondering:

If I boot win8's setup and launch win7's setup by the command line ?

Does someone test it ?
 
Windows 8 Beta is probably going to be released in February. Therefore, I will concentrate on getting it to work with Windows 8. And as far as I understand it, it is much simpler getting Windows 8 to boot in EFI then Windows 7. I think you only need to do the "RS->QueryVariableInfo". Am I right?
 
Maybee it's seems to be easy to someone but I don't understand how to do that.
Start a Terminal (/Application/Utilities/Terminal.app)

In the terminal, type "sudo fdisk -e /dev/disk0". You will be prompted for your password and you will be able to edit the partition table from there like in the "text screenshot" from my previous post. The goal is to delete partitions 2,3,4 and leave only the 1st partition with a slight change. The first partition should begin at the same sector as it currently begins, but should end at the last sector of the disk. If you want, I can add some syntax coloring on the "text screenshot" from above to highlight what you have to write on your computer.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.