Lion + NullCPUPowerManagement.kext, iStat, CPU Temperatures and Sleep

5 Comments

I *slightly* upgraded my processor this week to a new Core 2 Duo E7500 @ 2.93GHz. I am constrained by my LGA 775 board and I don’t really have need for a lower-clocked Core 2 Quad at the same price (and I can’t afford to shell out for a new LGA 1155 board, Core i5 processor and DDR3 memory at the moment).

At its stock voltage, my idle temps were hovering around 46°C– way too high for stock voltage and 2.93GHz.

How do I know? I had previously used Temperature Monitor (with the additional OSx86 plugins) but ditched the application in favor of a simple FakeSMC.kext mod with plugins to monitor various hardware.  This provides the added benefit of iStat being able to read the temps like it would on a standard Mac.

I placed our old friend NullCPUPowerManagement.kext (which I had not been using previously) in the /Extra/Extensions directory and my temperatures dropped about 10°C, but with consequences: The graphics seemed less responsive than usual, typically resulting in a slight delay between graphics-intensive processes (such as activating Mission Control or Launchpad, or even switching between desktops using a two-finger swipe on the Magic Mouse).

Lion also seemingly lost the ability to sleep.

I tried removing AppleIntelCPUPowerManagement.kext and AppleIntelCPUPowerManagementClient.kext from /System/Library/Extensions (as opposed to placing NullCPUPowerManagement.kext in /Extra/Extensions), and the results were the same.  I also re-ran the AppleRTC.kext patch (just in case) and re-compiled my DSDT (I am still not entirely sure if CPU data is stored in the DSDT– I am fairly certain that it only stores chipset data, but just in case…).  This leaves me with three possible culprits:

  1. FakeSMC.kext– I replaced this in order to use the temperature-reader plugins, so I will replace it with the original version of FakeSMC.kext and try to sleep my machine.  I did eliminate the plugin kernel extensions themselves as causes.
  2. AppleRTC.kext– There is a chance that the terminal code that I used to patch AppleRTC.kext is no longer correct for my new Wolfdale 45NM processor.  I will attempt a second, less-used patch and report back.
  3. My processor– Of course, replacing my processor could have caused this technological insomnia, which I hinted at above.  What to do to fix it?  I’m not sure, but I’ll update this post when I figure it out.

I’m running my processor at 3.33GHz (333Mhz FSB  x 10) with RAM running at 1GHz (333MHz FSB x 3).  Temps are around 38°C idle, which is acceptable for now.

EDIT:  I have yet to find the correct “old” FakeSMC.kext to see if it’s the problem.  Until then, I’m just using the SleepEnabler.kext for 10.7.2.

Preparing Lion to Boot Quickly: Create an Extensions.mkext

8 Comments

EDIT 10/18/2011:  This doesn’t seem to be working with 10.7.2 (causes a kernel panic on boot).  Also tried adding <UseKernelCache><Yes> to org.chameleon.boot.plist (Chameleon 2.1 build 1627) and got a different KP.  More updates to follow.

Update: Fix is below in red.

- – -

I’m done with the real-life Lion metaphors after this.  Promise.  If only Apple would quit infusing interface metaphors into every other application it releases.

In other news, my Lion hackintosh never seems quite ready to boot.

It's like the folks at Apple had never even heard Scar's famous song. Isn't Steve Jobs on Disney's Board of Directors?

The Problem

Lion boots sloooooooooooooooowly.  Verbose output from the boot log indicates that Lion is processing every single kernel extension prior to booting (as if the -f flag was used), rather than caching the kernel extensions in a .mkext kernel extension boot cache.  TL;DR: Lion isn’t caching kernel extensions.

The Solution

It’s simple, really: force Lion to rebuild the kextcache and use it to boot.  The solution thread on InsanelyMac.com (one of many like it) contains a good explanation of what’s actually happening, but here’s the code to build the cache (Edit: to make OS X also build a cache for your /Extra/Extensions folder, add “/Extra/Extensions” to the code below):


sudo kextcache -v 1 -a i386 -a x86_64 -m /System/Library/Caches/com.apple.kext.caches/Startup/Extensions.mkext /System/Library/Extensions

This *should* accomplish the same thing as setting the “kernelcache = yes” flag in com.apple.boot.plist.  What does setting this flag do? tonymacx86.com has a very straightforward answer here.  Please note that many a contributor to the InsanelyMac.com forum has reported kernel panics resulting from using this flag, while others have reported Lion booting fine (and quickly) but ignoring the kernel extensions placed in the /Extra/Extensions directory.

I have ONLY created the Extensions.mkext using the terminal code above; I HAVE NOT added the “kernelcache = yes” flag to com.apple.boot.plist.

The result?  My machine now boots in seconds instead of minutes.  That simple.

The Big Picture

What confuses me more than the problem itself (the solution is rather trivial) is why Apple decided to not include kernel extension caching automatically in Lion.  OS X can clearly still read the kextcache– so why doesn’t it write one?

I’m not entirely sure, but it may be hackintosh-specific.  I’m in the process of upgrading my brother’s MacBook Pro at the moment, so I will boot it with verbose logging and check back with the results.

Until then, enjoy the weekend!  And don’t spend your whole weekend playing with your hackintosh… It’s beautiful outside.      :)

Getting Lion to Sleep

11 Comments

My college friend, a zookeeper in St. Louis, confirmed my theory that nobody has really ever had trouble convincing a lion to sleep; it’s essentially all lions do.  In fact, in captivity, they sleep an average of 13.5 hours of the 24-hour day!

Source: http://www.flickr.com/photos/tomsaint/3267923031/sizes/m/in/photostream/

Zzzzzzz

That said, as I mentioned in my post regarding my first impressions of OSx86 Lion, this little kitty’s sleep schedule was an issue right off-the-bat; it became an even bigger problem when we received our electric bill after a month of sleepless nights.

The Problem

Lion would sleep.  It would even wake from sleep– and even better than that, it would wake from sleep with a simple double-click of the (bluetooth) mouse, a commodity not afforded to me whilst running Snow Leopard on the ol’ hackintosh.  The problem arose when rebooting the machine anytime after I put it to sleep: CMOS would reset, indicating a checksum error.  My overclock settings would be lost (I’d have to load them from a saved BIOS configuration), necessitating a second reboot.  Kind of like when I crash hard at about 10:00 AM the day after taking Benadryl before I go to sleep.

The Solution

The dedicated folks at InsanelyMac.com tackled the problem with gusto (as always!) and determined that the AppleRTC.kext was once again to blame (it’s an old foe, if you didn’t know…).  The thread dedicated to this issue is long, but the good news is that the problem can be fixed with a simple terminal command that patches the AppleRTC.kext in /System/Library/Extensions.  I recommend making a copy of the kext before applying the patch.

Note:  You need to have a working DSDT.aml in order for sleep to work at all (at least with Gigabyte motherboards).

Here is the code to run in Terminal:


sudo perl -pi -e 's|\x75\x30\x44\x89\xf8|\xeb\x30\x44\x89\xf8|;
s|\x75\x3d\x8b\x75\x08|\xeb\x3d\x8b\x75\x08|' /System/Library/Extensions/AppleRTC.kext/Contents/MacOS/AppleRTC

Follow it up with these commands that fix permissions on the newly-patched AppleRTC.kext (actually, on the entire /System/Library/Extensions directory):


sudo chown -R 0:0 /System/Library/Extensions
sudo chmod -R 755 /System/Library/Extensions

Voila!  Reboot (so OS X can load the new kernel extension) and put your hackintosh to sleep.  Wake ‘er up and reboot to test whether or not the patch worked.

As a side note, I had  kernel panic when I tried to sleep my machine for the first time.  It pointed to a couple of USB kernel extensions as the cause, so I turned on the Chameleon “USB Fix: option and rebooted.  I’ll do some more research on whether or not the USB drivers actually caused the panic or if it was random (perhaps my iPhone was syncing when I tried to put my box to sleep or something– I know it was connected).  The second try worked like a charm.

As always, thanks to the InsanelyMac.com community for their hard work, specifically BlackOSX.  Job well done!

Lion Hackintosh: Impressions

7 Comments

Getting Started

I used this guide from the OSx86 forums over at InsanelyMac.com to get my OSx86 Lion rig up and running, and I suggest that you pay it a visit.  The author of the guide put lots of time and energy into writing it, so let’s give credit where credit is due.

Disclaimer: I’m not writing my impressions on the OSx86 project in this post.  If you’re deciding whether or not to give it a go, I can only tell you that my experience has been intellectually stimulating and substantially rewarding.

Hardware

My hardware configuration was fairly standard until a couple years ago when the Core i_ processors and their respective MB/RAM configurations went mainstream in the (real) Mac architecture road maps (ditto in the OSx86 community).  While a top-of-the-line system built today will likely have a Sandy Bridge 6-core processor with at least 6GB of DDR3 RAM, my rig weighs in with a modest Core 2 Duo and 8GB of DDR2 RAM.  Still plenty fast for me, but not nearly as bleeding-edge as when I built it.

Motherboard: Gigabyte GA-P35-DS3L R2

RAM*: Hyper-X 800MHz DDR2 SDRAM (4 x 2GB sticks) @ 1066MHz

Processor*:  Intel Core 2 Duo E6550 2.33GHz @ 3.11GHz

Hard Disk: 500GB Western Digital 7200RPM SATA 6GB/s  HDD for main OS and recovery OS; 1.5TB Seagate 7200RPM SATA 6GB/s HDD for media; external 1TB HDD for Time Machine

GPU: NVidia GTX 250 512MB PCIe

Networking: Netgear Wireless-N PCI card (will update later with exact model; chipset is Atheros-based)

*overclocked (not running at stock speed)

Overclocking

One of the main benefits of the OSx86 project is the ability to run OS X on overclocked hardware.  The only components that I chose to overclock are my (slow at stock speed) CPU and, accordingly, the memory.  Below is my motherboard BIOS overclock screen to give you an idea of the voltages I’m running:

BIOS OC Screen

The Overclock/Voltages screen for my GA-P35-DS3L BIOS

Installation

After extracting the OS X Lion installer to a USB drive and installing Chameleon 2 RC4 (build 1083) on it, I booted successfully into the Lion installer.  The image below shows my installation of Lion onto my recover partition, which I named “Lioness.”

Lion Installation

OS X Lion Installer with "Lioness" (recovery) partition selected

I always perform my initial installation without any overclocking so as to eliminate the overclock as a source of installation problems; that said, my second installation to the recovery partition (with the machine overclocked) went surprisingly fast (less than 15 minutes) compared to the 20 or so minutes needed for a “stock” installation.

Post-Installation

The first I noticed when I booted up Lion for the first time is that the “Welcome” animation is gone (this has been blogged about extensively and I am not going to bother offering an opinion).  I moved past the introduction/configuration screens without any difficulty and, once I opted not to promise my first-born to Steve Jobs (see “How to skip sending registration information to Apple”), I was greeted by my virgin Lion desktop.

I made the following tweaks right away:

  • Turned off Natural Scrolling in System Preferences– This may feel “natural” with a Magic Track Pad, but Natural Scrolling started giving me unnatural headaches when paired with my Magic Mouse.
  • Turned off “Put hard disks to sleep when possible” checkbox in System Preferences– Consensus within the OSx86 community is that this may be contributing to the “spinning up  a non-existent DVD” sound coming from my DVD drive.  It’s still too soon to tell if this actually worked.
  • Finder hides the main hard disk by default in its left-side navigation pane; added this back immediately.
  • Used Migration Assistant to import my applications from my Time Machine backup disk (no issues because I didn’t have any apps installed that require Rosetta…)
  • Of course, installed Chameleon 2 RC4 on my new boot disk so that I didn’t have to use the installer USB drive to boot my new Lion hard disk
  • Also installed the Chameleon Preference Pane, which makes modifying your com.apple.boot.plist much more manageable than opening up PlistEditor and guessing at the meaning of each Chameleon plist key.
  • Because I maintain multiple OS X installations (such as my recovery partition as well as my old Snow Leopard hard drive), I immediately turned off Spotlight indexing and Time Machine backup on these drives.

Issues

Although my system was (for the most part) operational, I did encounter the following issues (a * denotes an issue that I fixed):

  • Sleep works (and even wakes with a mouse click!) but resets my CMOS when the machine restarts (Fixed!  See new post, Getting Lion to Sleep).  Unacceptable for now since I routinely reboot.  Here is the InsanelyMac forum discussion on the Lion sleep issues.
  • *I could not log into the Mac App store, and upon further inquiry discovered that this was due to my native ethernet interface not being detected by OS X (if properly detected, it must also be listed as en0 in /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist in order for the App Store to connect properly; if it’s listed as en1, just delete this plist, remove all network interfaces in Network Preferences, reboot, and then add them in the correct order).  This was strange because my DSDT is custom-built to include the motherboard’s built-in ethernet on the PCI0, LAN0 bus; additionally, this worked perfectly in Snow Leopard.  I tried adding “EthernetBuiltIn=Yes” to the com.apple.boot.plist, but to no avail.  Ultimately, I popped the IONetworkingFamily.kext from 10.6.7 (Snow Leopard) into the /Extra/Extensions library on my Lion disk and it did the trick.  Here is the forum response I posted in the Lion Post-Installation Discussion forum on InsanelyMac.com.
  • CPU Speed-Stepping has never worked for me; I haven’t looked into it yet with the Lion installation.
  • Booting is still slow, as Lion is loading every single kernel extension prior to booting.  There are a couple of InsanelyMac forum threads dedicated to this topic, although I have yet to see any confirmed solutions.  I have read that forcing a kext cache is causing Lion to fail to boot.
I’ll keep working towards finding a solution to these issues, but I haven’t had a lot of time recently.  I’ll update the post if I fix anything.

Backup and Recovery

The OSx86 community insists that backup and replication are the key to preventing a rogue Software Update from bricking your hackintosh.  I backup with Time Machine, but I also keep a small, bootable “Lioness” partition (with Chameleon installed) that allows me to boot in an emergency.

As Far as Apple is Concerned…

When Apple released Snow Leopard, I was finally able to purchase a retail installation disc and extract it to a thumb drive for installation on my x86 machine.  For me, this was monumental, as I had previously relied upon customized versions of the OS X installer (containing patched kernels and kernel extensions out-of-the-box) that were only available to download via torrents.

The OSx86 community has made me a bigger customer of Apple than I would have been without it.  Regardless of where your operating system loyalties lay, everyone should recognize that paying a mere $29.99 for a full operating system is a bargain considering all of the work that goes into writing, building and testing it.  I recognize that one of the reasons that Apple is able to offer OS X at such a discounted rate is that part of Apple’s business model involves subsidizing the cost of the operating system with the revenue generated by marking up Mac hardware; as far as I’m concerned, this should be even greater motivation to purchase a legal copy of OS X to install on your hackintosh.

That said, Apple has made purchasing a legal copy of Lion a little more difficult for the average OSx86 user to accomplish, due to its monumental leap into the physical-media-free OS installation model.  In typical Apple fashion, they’ve adopted a “don’t look back” attitude about it, too: either purchase Lion through the App Store from a Mac running Snow Leopard, or wait a few months until they let you purchase a flash drive copy for $69.

Here’s the problem: hackintoshes can’t upgrade to Lion from the App Store directly.  Luckily, InsanelyMac users have found a way to extract a legal App Store Lion purchase to a bootable image.  Installing a legal copy of Lion is the best way to participate in the OSx86 community by standing by well-written software with your dollars, even if you can’t afford to purchase a Mac.

After a successful hackintosh installation, the App Store will indicate that OS X Lion is “Installed”:

Lion Installed (App Store)

The App Store should indicate the OS X Lion is "Installed"

Note: If you install Lion from the developer Golden Master like I did, you will lose the ability to purchase OS X Lion from the App Store unless you purchase it from a machine running Snow Leopard.

OS X Lion Impressions

There are a gazillion Lion reviews out on the interwebs, so I’m not going to re-invent the root:wheel and write an entire technical review.  Here are a few standout impressions:

  1. Lion’s footprint is smaller than any previous OS X installation.  This is due to the removal of Rosetta, Apple’s PowerPC chip emulator for software written prior to Apple’s explicit adoption of the Intel architecture (the very thing that makes OSx86 possible!).  The entire installation took up less than 4GB on my hard drive.
  2. Apple does try to cram some iOS-inspired “features” down the user’s throat, such as the aforementioned Natural Scrolling (not a fan) and the real-life app metaphors like Address Book and iCal (even less of a fan).  Natural Scrolling can be disabled, but I’m stuck with a calendar application that looks like a cork-board.
  3. Multi-touch is much more integrated into Lion, which is a breath of fresh air for Magic Mouse users like myself.  My favorite addition: swipe left or right with one finger in Safari to move forward or backwards, and the page moves along with your finger to uncover the previous web site.  Very spiffy.
  4. Everything is cleaner.  The UI has a more consistent feel (goodbye Aqua!) and the animations are smooth but succinct.
  5. Spaces is gone and replaced by Mission Control, which allows apps to be moved to different “desktops,” each with their own wallpaper should you choose.  Apple got this right; I find it to be much more usable than Spaces.
  6. One thing that Lion borrows from iOS that I love is the invisible scroll bars.  Windows look altogether leaner and cleaner.
That’s all I have for now.  I’ll maintain this post with more thoughts as they crop up in the ol’ brain.  Until then, I’ll leave you with the two screenshots I teased you with a few weeks ago.
Here’s Lion running on my hackintosh; Migration Assistant is transferring my applications from Time Machine, and the inclusion of SMBIOS.plist in the /Extra folder allows my machine to be recognized as an early 2008 Mac Pro:
Lion

Lion running on my hackintosh

Here’s a screenshot of Mission Control:
Mission Conrol

Mission Control

Many thanks go out to the OSx86 community and the folks over at InsanelyMac.com.  This post isn’t meant to be a how-to guide or an editorial on the OSx86 project; however, both of those topics are discussed frequently over at InsanelyMac.

Follow

Get every new post delivered to your Inbox.