Dream finally becomes reality: use vanilla OS X kernel on normal PCs.
This might not be sth. new to some readers as the patch was initially released few days ago. The newest version as of today is v5.1, which includes various bug fixes and multiboot support. Again, as the previous installation guide, this is also based my very own experience and not a simple duplication of the readme.
All credits go to netkas(who made this patch), def(for multiboot), Turbo and everyone works on the osx86 scene.
Update 1: Fixed a mistake in the tutorial which will cause “endless reboot loop”. Sorry for everyone who encounter this issue!
Update 2: The EFI patch has been confirmed to work with current 10.4.11/10.5.1 update. Many hackintosh users have enjoyed the same update experience as genuine MAC users.
Update 3: Download in this guide updates to the latest pc_efi version, which is v5.1 as of today(11/17). Link to ToH kernel is also updated.
What is EFI and why is this “patch”?
The Extensible Firmware Interface (EFI) is a specification that defines a software interface between an operating system and platform firmware.
EFI is intended as a significantly improved replacement of the old legacy BIOS firmware interface historically used by all IBM PC compatible PCs. But as of today, most PCs running Microsoft Windows still rely on BIOS, while Intel based Macs, since the day one, are using EFI. Despite the technical advantage, this is more like an artificial barrier to prevent normal PCs running OS X.
Ironically, Microsoft Windows support BIOS only, and Apple makes Boot camp to fill the gap. The EFI patch works in a similar approach: it emulates EFI data for normal BIOS-based PCs and let OS X treat them as genuine EFI-based Macs.
The EFI emulation is a long dream in OSX86 community, but prior to this, thanks the Apple’s open source Darwin Project and those Hackintosh gurus, we can still enjoy OS X on normal PCs, with patched kernels/kernel modules which just bypass EFI. Now with the EFI patch, the hackintosh can boot off VANILLA UNMODIFIED OS X kernel and use vanilla kexts, which gives a more clean room and great peace of mind for future system updates.
Prerequisite for EFI patch
- Hardware: this EFI loader supports Intel SSE3 processors, include but does not limit to Core Duo, Core 2 Duo, Coro Solo, Pentium D and motherboards with Intel chipset(not necessarily to be Intel brand, just chipset. 915 and later are fine) ONLY. If you’re not sure, download cpu-z and run the test.
- A working OS X installation. I assume you’ve got OSX working and just want to try out the new EFI. Otherwise, install one first. This guide is based on 10.5 Leopard, but most part also applies to 10.4 Tiger.
- Some basic knowledge of UNIX shell. This shouldn’t be a problem as I’ll try to make the guide accurate and easy to follow
- The Leopard installation DVD and USB flash drive, just in case of error recovery. I hope we’ll never need them.
Prepare the Installation
Actual installation is really fast and easy, but before that, lets get all the necessary files in place.
1. Get the EFI patch
Download pc_efi_v51.zip. This is a repack of the original EFI patch and two necessary kext: AppleSMBIOS and dsmos.
2. Get the original kernel and modules
Here is the original kernel and some original kexts, please note that they are for Leopard 10.5.0 only(Download Leopard_Vanilla_Kernel_Kexts.zip). Tiger users may use Pacifist to extract them from System/Installation/Packages/BaseSystem.pkg in original DVD.
3. Place the EFI patch:
Extract pc_efi_v51.zip to your desktop, let’s say, a folder named pc_efi_v51 and launch Terminal.app from Application->Utilities in Finder, then type:
sudo mkdir /iamefi
sudo cp /Users/xxx/Desktop/pc_efi_v51/* /iamefi/
when promoted, input your password, and don’t forget to replace xxx with your user name.
This will copy all the necessary files for EFI patch in /iamefi directory.
4. Restore vanilla kernel:
For Leopard, there are currently two popular releases, namely BrazilMac and ToH. They all should work with the EFI patch. Anyway, let try to use the vanilla kernel first:
Extract Leopard_Vanilla_Kernel_Kexts.zip on Desktop and again, do this in the terminal:
sudo mv /mach_kernel /mach_kernel.patched
After back up the patched kernel(comes with your installation), type
sudo cp /Users/xxx/Desktop/Leopard_Vanilla_Kernel_Kexts/mach_kernel /
to install the new kernel. Don’t forget to repair permissions:
sudo chmod 644 /mach_kernel && sudo chown root:wheel /mach_kernel
sudo chmod 644 /mach_kernel.patched && sudo chown root:wheel /mach_kernel.patched
Optional but highly recommend: Get the latest ToH kernel as well, as it works with or without EFI. Download and place it in root directory,
sudo cp /Users/xxx/Desktop/mach_sleep/mach_sleep /mach_kernel.toh
sudo chmod 644 /mach_kernel.toh && sudo chown 0:0 /mach_kernel.toh
5. Add necessary kexts:
Speak of necessary, I mean the minimal requirement to boot off the EFI+vanilla kernel. Some installation might miss dsmos.kext(an EFI module for page decryption, also made by Netkas), as its not necessary for patched kernel. But it’s a must for vanilla kernel. The dsmos.kext is included in pc_efi_v51.zip. So install it if its not in your system:
sudo cp -R /Users/xxx/Desktop/pc_efi_v51/dsmos.kext /System/Library/Extensions/
sudo chmod -R 755 /System/Library/Extensions/dsmos.kext
sudo chown -R root:wheel /System/Library/Extensions/dsmos.kext
Optional: the newest efi patch is supposed to work with AppleEFIRuntime.kext but some users still have trouble there. So just remove(back it up) for safety. Do the same for AppleIntelCPUManagement.kext
sudo mv AppleEFIRuntime.kext AppleEFIRuntime.kext.vanilla
sudo mv AppleIntelCPUPowerManagement.kext AppleIntelCPUPowerManagement.kext.vanilla
Delete kext cache so the change will take effect on next boot.
sudo rm /System/Library/Extensions.mkext.*
you might want to put more vanilla kexts back but let’s install EFI patch and get it working first.
6. Find your disk id
You’ll need this shortly, type
and check the output. Write down the disk id matching your installation, its in the format of diskXsY and can be easily identified by volume name.
Install EFI Patch
There are two approach for EFI installation, the “old good” startuptool and grub(since v4 and later come with multiboot support)
1. Use startuptool
By using startuptool, we alternative the boot loader comes with OS X to the EFI patched one. It’s easy and most time, should be safe.
Reboot the OS X and press F8 during boot up which will take you to the Darwin loader option, select the destination OS X partition, type
and press enter to boot into single user mode using the old patched kernel. Type the following commands right after system loads, don’t run “mount -uw /” as it will mount the target partition on read-write mode and startupfiletools will fail. Just proceed to the EFI installation straight:
There are several files you can choose from, booti386, boot_v3, boot_v4(and boot_v5), booti386 is original Darwin loader and can be used to reverse the installation. The rest are various versions of efi loaders. Just use the latest here:
./startupfiletool /dev/rdiskXsY ./boot_v5
replace rdiskXsY with disk id you get in previous step. For example, you get disk0s2, so put rdisk0s2 here, don’t forget the leading r
You’ll get prompt like “HFS+ partition detected, write xxx bytes”, which means that the EFI loader is successfully installed(hopefully). Now type reboot and enjoy the new EFI.
2. Use grub
By during this, the OS X installation keeps untouched and the EFI patch process is done before the actual Darwin loader. This is what “multiboot” for.
If you have grub setup already, just copy boot_v5 to any place on fat32/reiserfs/xfs/ext2/ext3/ntfs/any partition supported by grub. To make life easier, just put it in the root directory. And add entry to your menu.lst like this one
where hd0,0 is a partition where your boot_v5 resides(not the OSX partition!)
after that, load grub and will choose Darwin and press enter – you have 5 secs to choose the hard drive with OS X , 80 – first, 81 – second, 82 – third and etc , if you will not press any key during 5 sec, it will start working with default drive.
For those Windows-only user, you can use grub4dos to load the boot_v5. Download this grldr.zip, extract, put it to your C:(yes, do this in Windows). Then add an entry for this grldr in your XP or Vista loader. Please refer to my previous installation guide, the last part about install tboot. Use exactly the same way to install this grldr, then create a file name menu.lst with following content:
find –set-root /bootmgr
If you don’t have Vista installed, change the first line to “find –set-root /ntldr” instead.
The EFI patch is still in early stage so it’s a big YMMV. The most common error is, EFI and vanilla kernel don’t work together.
1. Restore old patched kernel
Again, press F8 when Darwin loads, and type the kernel name in option line, in our case, is “mach_kernel.patched“(without quotes). And you might want to further locate the issue, so type
If you have ToH kernel backup, use it instead
This will boot OS X with patched kernel and in verbose mode. After that, remove the vanilla kernel and restore the old one.
sudo mv /mach_kernel /mach_kernel.vanilla && sudo mv /mach_kernel.patched /mach_kernel
sudo chmod 644 /mach_kernel && sudo chown root:wheel /mach_kernel
sudo chmod 644 /mach_kernel.vanilla && sudo chown root:wheel /mach_kernel.vanilla
2. Verify if EFI actually works
If the system boot up with vanilla kernel, you’re quite confident that EFI is working and the system is running the SAME kernel as those genuine MACs. As said before, EFI patch also works with some patched kernels. So to be sure, just download Geekbench and if EFI works, it will detect the system as “Mac” instead of “Hackintosh“.
3. Vanilla kext “compatibility”
If your hardware supports, the current EFI patch does work with vanilla kernel and all vanilla kexts, but there is still something worth mention:
- Don’t forget to put dsmos.kext if you use vanilla kernel. In fact, it’s never hurt to just leave it there even you’re about to use patched ones. Also, you still need Natit/NVinject for your video card and ALCinject for sound card etc. since EFI patch wouldn’t take care of them.
- You can’t expect a system with all vanilla, unmodified kexts, as we always need to edit some(Info.plist) and add device id, which is safe and wouldn’t affect system stability or anything. So get to know the kext before you restore it.
- Power management(reboot/shutdown/sleep) is YMMV. For most users, three items matters: the kernel, AppleACPIPlatform.kext and AppleSMBIOS.kext.I highly suggest to use the AppleSMBIOS.kext comes with the efi patch(in pc_efi_v51.zip) as it fix the error/crash on “About This Mac” and system profile. And for the rest two, you may need to try and find the working combination(patched vs. vanilla).
Also, depends on the video cards, NVidia and GMA950 users are reported to have better luck here.
- Using vanilla AppleACPIPlatform.kext will lost all PS2 ports but if you’re on an all USB setup, that’s fine.
- Optional: A new IONetworkingFamily.kext fix is also available which enables the time machine as well as address the infamous “_CFGetHostUUIDString: unable to determine UUID for host. Error: 35″ bug. This is Leopard only and you can get it here.
Remove the EFI Patch
If you don’t like it, just boot into single user mode(-s) and restore the vanilla boot loader and/or the old (patched) kernel. Refer to the previous installation/trouble shooting part for more info.
./startupfiletool /dev/rdiskXsY ./booti386
Please leave your comment if you have any questions or suggestions.