racerrehabman

Just some techie stuff

Yosemite/Haswell Kernel Patch for Early Reboot

with 46 comments

Just a quick update as I’m quite busy at the moment.

This is an update for Yosemite for an issue which was described for Mavericks in a previous post: https://racerrehabman.wordpress.com/2013/11/25/maverickshaswell-kernel-patch-for-early-reboot/

Since Yosemite has been released, we need a new patch for the OS X kernel to avoid early reboot on computers with locked CPU MSR 0xE2. The kernel has now moved to /System/Library/Kernels/kernel.

The code has changed slightly and now it is only necessary to change the data tables such that any table writing to register 0xE2 is changed to 0x00. I’ll explain more if I find time.

Here are the new patches required for 10.10.x:


perl -pi -e 's|\xe2\x00\x00\x00\x02\x00\x00\x00|\x00\x00\x00\x00\x00\x00\x00\x00|g' kernel
perl -pi -e 's|\xe2\x00\x00\x00\x4c\x00\x00\x00|\x00\x00\x00\x00\x00\x00\x00\x00|g' kernel
perl -pi -e 's|\xe2\x00\x00\x00\x90\x01\x00\x00|\x00\x00\x00\x00\x00\x00\x00\x00|g' kernel

Those using Clover do not need to patch the kernel manually as this same patch is provided with the KernelAndKextPatches/KernelPm option in config.plist.

Update 2015-01-26

As pointed out by Zenith432 (thanks!), the original published patch would write to MSR 0x0 after the 0xE2 values were zeroed. Although this did not appear to cause any problems and I already knew about it, it is probably a good idea to avoid it. The patches have been updated to account for this based on the information provided by Zenith432.

Advertisements

Written by racerrehabman

2014/10/18 at 17:38

Posted in Computers

Tagged with , , ,

46 Responses

Subscribe to comments with RSS.

  1. Works great for patching the kernel…but getting kernel panic during installation :(

    Akhil

    2014/10/19 at 00:14

    • Not the same problem.

      racerrehabman

      2014/10/19 at 15:08

      • Is there any way to resolve my problem? I am able to start the installation, but it freezes due to KP

        Akhil

        2014/10/19 at 15:37

      • This is not a general troubleshooting forum, and you provided no information about your issue anyway.

        There are entire websites that are dedicated to that sort of thing.

        racerrehabman

        2014/10/20 at 16:40

    • Can you send me your patched kernel file… im in a reboot loop with my haswell i7 4702MQ
      but i have NO idea HOW to patch the file

      Svenator

      2014/10/29 at 06:31

  2. Hello, i have problem with kernel haswell 10.10, when I boot to usb, then my computer auto restart, can you upload kernel haswell patched

    Koi

    2014/10/22 at 05:33

    • No. Instructions for patching are in my blog.

      racerrehabman

      2014/10/29 at 12:50

      • Hi! When I was writing the patch in terminal, it had some problem with the -e flag and spat out “Substitution pattern not terminated at -e line 1.” Is there a typo in my code?

        Eli

        2015/08/26 at 04:11

      • It means you did it incorrectly.

        racerrehabman

        2015/08/26 at 05:19

  3. Hi Rehabman, I have instant reboot on the MSI Z77-GD65 motherboard so I tried the above patch but it didn’t work. The md5 checksum is matches yours. However, the weird thing is that I can boot into Yosemite using the Unibeast USB. Any ideas?

    LiLrYu

    2014/10/26 at 00:08

    • You have some other issue. Use a video camera to determine where the reboot happens.

      racerrehabman

      2014/10/29 at 12:49

  4. Rehabman, I managed to get it to work. Had to patch the bios using PMpatch/UEFItool. Thanks!

    lilryu

    2014/10/26 at 02:04

  5. Hi,

    Thanks for your post but that did not solve the early reboot problem on my side :(

    – I first verified that md5 hash value is 9f1768fddec369e545d938f0f4f76350
    – Then executed the 3 perl commands above
    – At last verified that now the md5 hash is eb21ca4bd7aba97d5e7b080a481fc173
    – Reboot and the behaviour is still the same.

    I use the following boot options to be able to boot at all:

    -v UseKernelCache=No Kernel=/System/Library/Kernels/kernel

    Babak

    2014/10/27 at 10:17

    • You could have some other issue. For example, “Local APIC” panic can also cause early reboot. So can failing to enable DEP.

      racerrehabman

      2014/10/29 at 12:48

  6. rehabman, it’s me from insanelymac. thanks for the patch, it works

    franknitty

    2014/10/27 at 23:36

  7. When i type in the first command in the instructions, cp /Volumes…. I get Input/Output error. The file shows up on the desktop but I don’t know what that error means?

    Faizan

    2014/10/31 at 06:01

  8. Hi, first of all thanks for this article.
    I read this and the”Mavericks/Haswell Kernel Patch for Early Reboot” one but I want to see if I have got this write. I want to install yosemite on my laptop that has a core i5 processer and I have the early reboot problem. After using unibeast, should I run terminal and use cp /Volumes/Installer/System/Library/Kernels/kernel~/Desktop/mach_kernel_backup
    cp /Volumes/Installer/System/Library/Kernels/kernel. ~/Desktop/mach_kernel
    cd ~/Desktop then type perl -pi -e ‘s|\xe2\x00\x00\x00\x02\x00\x00\x00|\x00\x00\x00\x00\x02\x00\x00\x00|g’ kernel mach_kernel
    perl -pi -e ‘s|\xe2\x00\x00\x00\x4c\x00\x00\x00|\x00\x00\x00\x00\x4c\x00\x00\x00|g’ kernel mach_kernel
    perl -pi -e ‘s|\xe2\x00\x00\x00\x90\x01\x00\x00|\x00\x00\x00\x00\x90\x01\x00\x00|g’ kernel mach_kernel
    and then sudo cp mach_kernel /Volumes/Installer//System/Library/Kernels/kernel and after that use the usb to install it?
    Thanks again for you blog

    Pirooz

    2014/11/08 at 20:34

  9. Any patch for 10.10.1?

    Jordan Tse

    2014/11/26 at 07:03

  10. Any patch for 10.10.2?

    superbub

    2015/01/29 at 11:38

    • Yes.

      racerrehabman

      2015/01/29 at 12:43

      • where? (patch for 10.10.02)
        after update the niresh yosemite 10.10.01 …they good old early reboot (haswell ) is back again.
        How can I patch the new kernel …is it possible to patch from the usb installation tool, with terminal?

        Or what would u advise me.

        subdata187

        2015/01/31 at 09:58

      • You can patch from Terminal by booting the OS X installer from USB (eg. USB patched previously).

        I use Clover now, so there is no issue. Anyone with UEFI boot capability (pretty much all Haswell machines with this issue), should be using Clover.

        racerrehabman

        2015/02/14 at 12:55

      • where can we find the 10.10.2 patch? I can’t see it in that link. Thanks

        wins

        2015/02/11 at 12:07

      • Same patch for all 10.10.x.

        racerrehabman

        2015/02/14 at 11:09

  11. I was able to patch 10.10.1 and it is working great.

    I just updated to 10.10.2 and when I reboot I get a kernel panic. It does not early reboot, it just stays on the apple loading screen and shows the panic verbose.

    jcharles12

    2015/02/01 at 02:29

    • The kernel was updated, so you’ll have to reapply the patch. I believe the reboot is caused by an early KP.

      racerrehabman

      2015/02/14 at 12:54

  12. A humble contribution to your Lenovo x220 laptop battery patch – small change needed for the Thinkpad T61: http://www.insanelymac.com/forum/topic/298992-big-problem-with-x3100-mac-os/?p=2105984

    Gringo Vermelho

    2015/02/09 at 20:21

    • Off-topic for here, but… I’ve replied at that thread. I’ll get the change into the repo if you test it.

      racerrehabman

      2015/02/14 at 12:53

  13. I was using this patch for 10.10.2. I updated to 10.10.3 and applied the same patch. It’s still getting early reboot. The only diff this time is i used paragon HFS + to collect the kernel from 10.10.3 partition and then patched that kernel on my other laptop and copied back to 10.10.3 partition with paragon HFS+

    Sudhir Singh

    2015/04/14 at 09:00

    • The patch works for 10.10.3 as well. You must have a different problem or have applied the patch incorrectly. Do yourself a favor and use Clover instead, which has my patch built-in with KernelPm.

      racerrehabman

      2015/04/21 at 06:43

      • Does the patch work for 10.10.5?

        Eli

        2015/08/26 at 04:19

      • Yes.

        And in case someone asks, it also works on 10.11 beta (so far).

        Side note: Surprised people are still patching manually, when Clover has the patch built-in with config.plist/KernelAndKextPatches/KernelPm=true.

        racerrehabman

        2015/08/26 at 05:18

  14. pleas how to use it can you preper this patch i cant understand that

    elomda

    2015/05/27 at 11:55

  15. With Unibeast 5.2, I’m getting an instant reboot. In verbose mode, the last lines are Starting Darwin x86_64
    Boot Args: kext-dev-mode=1 -no -zp -v npci=0x2000. I think the problem is that my CPU is unsupported (it’s a 6950x). Tried this kernel patch. Any ideas?

    Elliott Balsley

    2016/07/16 at 23:30

    • Broadwell-E requires additional patching. You should be using Clover. You might use google for details…

      racerrehabman

      2016/07/17 at 05:34

      • Right you are. I got it working by using fakecpuid=0x0306F2 and SMBIOS Mac Pro 5,1.

        Elliott Balsley

        2016/07/27 at 11:25


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: