single internal hard drive in iMac with a single NTFS partition. This is BIOS identifier (hd0,1). In linux, this will be SATA device /dev/sda. The SATA controller is from ICH8M and has PCI identifier 8086:2828. Please change these references to your system configuration.
Don't worry, I still have OS X on an external FW800 drive but that's not relevant here.
First of all, I tried loading Windows 7 on my Intel Mac and then came to a few conclusions:
- BIOS mode boot has the negative side-effect that it disables AHCI mode in the SATA controller. This leads to degraded performance of hard drive access.
- EFI mode boot of Windows 7 requires EFI 2.0 which isn't included in the firmware.
- Macs don't like to boot from external devices. Windows doesn't like to be installed on external drives.
This post is all about getting the SATA controller back into AHCI mode after the compatibility layer in the intel Mac changed it. AHCI gives NCQ and might be somewhat faster so I really wanted to try that after my younger brother nagged me about it during our dayly Mac-vs-PC argues.
I can talk about what I did wrong during those attempts but I will try to keep it short:
- Start regedit and locate the following key: HKLM\System\CurrentControlSet\Services\msahci
Change the "Start" value to "0". This will make Windows attempt to load the AHCI driver stack when it boots. - Download a Linux live-CD with GRUB 1.98. (others might indicate 0.xx as grub and 1.xx as grub2). I decided on the latest Ubuntu live-CD. Older versions just won't do unless you want ugly patches. You want to have the setpci grub module.
- Download the "Rapid Storage Technology" manager software (includes the driver) and the "RST Driver Files for F6 Install" from the Intel website.
In my case the latest version for x64 Windows was iata96enu.exe and f6flpy96x64.zip
The manager software will not install yet but you have to install at least the driver by unpacking it and force a device installation:
Go to Device Manager, select Serial ATA Storage Controller, Update driver software, Browse, Pick from list, Have disk, Ignore the warning. This should be ok since the next time you'll boot Windows, the device will be different anyway. - Boot the Linux CD :-)
Hold option key when booting the Mac to see it as a boot option. Load the System until you can start a terminal. Get root access:
sudo -i - Because it booted from CD, it doesn't know much about the hard drive. Therefore create a device map file that maps (hd0) to /dev/sda.
vi /boot/grub/device.map
i(hd0)[tab]/dev/sda[esc]:wq
If you know some linux, you know what I mean. - Mount your Windows partition in Linux.
mkdir /mnt/win
ntfs-3g /dev/sda1 /mnt/win - Install grub to the MBR and copy the data files too.
grub-install --no-floppy --modules=ntfs --root-directory=/mnt/win /dev/sda
This should report no error. - If you already had a Boot directory on your Windows partition (most likely), you'll now have two boot directories (-.-); Fix it by moving the contents.
mv /mnt/win/boot/grub /mnt/win/Boot
rmdir /mnt/win/boot - reboot
reboot (duh) - At the grub prompt you should now be able to try some commands.
lspci
setpci -d 8086:2828 90.b=40
lspci (should now show 2829 instead of 2828)
root (hd0,1)
chainloader +1
boot - If Windows now boots, it should be in AHCI mode and hopefully go ask for the drivers.
You can install the RST manager or just check the Device Manager to see if it's working as intended. - You can create a C:\Boot\grub\grub.cfg file to automate the booting process. (Note: 'Manual editing of /boot/grub/grub.cfg is not encouraged')
set timeout=10
set default=0
menuentry "Windows 7 with AHCI" {
setpci -d 8086:2828 90.b=40
set root=(hd0,1)
chainloader +1
} - PS: If somehow Windows booting was not working in the first place or you don't want any of this anymore, you can use the Windows 7 DVD. Some recovery commands you then can use:
bootrec /FixBoot
bootrec /RebuildBcd
bootrec /FixMbr (should erase grub again but I don't know why you would want that)