2010-11-28

Upgraded SleepEnabler.kext to 10.6.5

The SleepEnabler.kext I used with 10.6.4 caused kernel panics with 10.6.5. I learned that this kext is kernel version specific so I grabbed one that was supposed to work with 10.6.5 from kexts.com, but I still got kernel panics. I then decided to build the SleepEnabler.kext from source myself and patch whatever has to be patched.

The main motivation was simply to find out how to do stuff like this. I understand that sleep would also work with a properly patched DSDT, but I leave for some other time.

Prerequisites

Install the Mercurial client and download the xnu-sleep-enabler sources

$ sudo port install mercurial

$ hg clone https://xnu-sleep-enabler.googlecode.com/hg/ xnu-sleep-enabler

Get version specific operating system header files

$ uname -v
Darwin Kernel Version 10.5.0: Fri Nov  5 23:20:39 PDT 2010; root:xnu-1504.9.17~1/RELEASE_I386

This tells you exactly which version of the xnu kernel to download. Navigate to www.opensource.apple.com, click on Mac OS X 10.6.5 and scroll down. Near the bottom of the page you will find this link http://www.opensource.apple.com/tarballs/xnu/xnu-1504.9.17.tar.gz. Download and install next to the sleep enabler.

Patching

The sleep enabler has version specific directories called Headers_10.x.y for the different kernel versions 10.x.y. I created a new one called Headers_10.5.0. There are two files called pmCPU.h and cpu_topology.h in the existing directories:

$ ls -l Headers_10.3.0
total 40
-rw-r--r--  1 macfiets  macfiets  9615 Nov 28 15:56 cpu_topology.h
-rw-r--r--  1 macfiets  macfiets  5208 Nov 28 15:56 pmCPU.h

In the xnu kernel source, those files reside in the osfmk/i386 directory so I copied them from ../xnu-1504.9.17/osfmk/i386 to Headers_10.5.0. It turned out that pmCPU.h also needs rtclock.h so I copied this one too.

$ ls -l Headers_10.5.0
total 56
-rw-r--r-- 1 macfiets  macfiets  9747 Nov 28 15:56 cpu_topology.h
-rw-r--r-- 1 macfiets  macfiets  5634 Nov 28 15:56 pmCPU.h
-rw-r--r-- 1 macfiets  macfiets  4211 Nov 28 15:56 rtclock.h

Next, I fixed the references in pmCPU.h to the two other files.

$ diff ../xnu-1504.9.17/osfmk/i386/pmCPU.h Headers_10.5.0/pmCPU.h
32,33c32,34
< #include <i386/cpu_topology.h>
< #include <i386/rtclock.h>
---
> #include "cpu_topology.h"
> #include "rtclock.h"
>

Building

The last step before actually building this project was to create a new Xcode configuration that would tell Xcode to use the include files from Headers_10.5.0. I copied the Debug configuration to "Debug 10.6.5" and change the KERNEL_VERSION.

sleepenabler 10.6.5.jpg

Now you can build from the Xcode gui or alternatively from the command line

$ xcodebuild -configuration 'Debug 10.6.5'

Check that the resulting binaries contains code for both 32 and 64-bit:

$ file build/Debug\ 10.6.5/SleepEnabler.kext/Contents/MacOS/SleepEnabler
build/Debug 10.6.5/SleepEnabler.kext/Contents/MacOS/SleepEnabler: Mach-O universal binary with 2 architectures
build/Debug 10.6.5/SleepEnabler.kext/Contents/MacOS/SleepEnabler (for architecture x86_64):     Mach-O 64-bit kext bundle x86_64
build/Debug 10.6.5/SleepEnabler.kext/Contents/MacOS/SleepEnabler (for architecture i386):       Mach-O object i386

Done. Install the SleepEnabler.kext in /System/Library/Extensions and reboot.

My Mercurial clone on googlecode.com

I have created a Mercurial clone of the xnu-sleep-enabler project and pushed my changed. If you would like to check it out:

$ hg clone https://macfiets-10-6-5.googlecode.com/hg/ macfiets-10-6-5

- MacFiets

 

2010-11-21

Updating the BIOS of a gigabyte board without the help of Windows

GIGABYTE's support is pretty good. There have been a number of BIOS upgrades since I bought the board for my first hackintosh. However, the BIOS files all come as self-extracing Windows .exe files. I don't have a Windows machine anywhere in my house. Honest.

I found two programs to uncompress those files on a Mac though. Zipeg has has a simple gui and works a treat.

download.zipeg.free.256x82.png

If you prefer to use the command line, then there is http://p7zip.sourceforge.net. If you have the MacPorts installed, then it's simply

sudo port install p7zip

This will install the 7z program in /opt/local/bin.

How to upgrade the BIOS

  1. Download the BIOS from gigabyte.com
  2. Download either zipeg or p7zip
  3. Unpack the .exe file and put the BIOS file on a MS-DOS formatted USB stick
  4. Restart your computer and hit the "end key". In case you have an Apple keyboard, then you may not have a key labelled "end". It's the one to the right of the "delete".
  5. This will start the Q-Flash utility. Select the file you want and let it do its job

CIMG0658.JPG

Success. The "F6" version is installed.

CIMG0663.JPG

 

 

 

iBoot + Multibeast

I still enjoy my first hackintosh, but I completely underestimated the amount of "hack" necessary to keep a hackintosh current. On my real Macs I never had problems installing whatever the "Software Update" deemed necessary. Yep, install, sometimes reboot. Works. Not so running a hackintosh. I kept using 10.6.2 for some time, because I could not upgrade in the same simply way.

When I came across How to Build a Hackintosh Mac and Install OS X in Eight Easy Steps on liferhacker.com, I started over and invested some more time to re-install Snow Leopard, upgraded to 10.6.4, a day later 10.6.5 came out. All works fine now. Many thanks to 

Screen shot 2010-11-21 at 12.03.03 AM.png

2010-11-20

Garageband 1.2 GB download

I bought iLife '11 last weekend. As soon as I installed it from DVD, Garageband wants to download another 1.2 GB of instruments and loops. Rats! Not many people seem to mind - it only takes a couple of minutes or so, right? With my DSL connection it's going to take hours .... and I cannot even download it from the Apple website for any future installations.

Screen shot 2010-11-20 at 11.38.21 PM.png

 

 

My First Hackintosh

My previous desktop Mac was a PowerMac G5 bought in 2006. There are two things I do not like about it. First, it is slow and second, it is as loud as a hoover. My very first Mac was the original 1.25GHz Mac Mini. This was the Mac I liked the most so far. The truly stunning Mac operating system running on absolutely quiet hardware.

When the PowerMac began to show its age to the point where it was no longer bearable I looked for a new desktop Mac. The Mac Pro has become far too expensive and the iMacs are nice, but come with glossy screens only. Early 2010 I came across Cindori Custom: Building an i7 Hackintosh on the macrumors.com forums. An i7 based Mac for about the half the price of an original Mac Pro. This I had to try it out.

My shopping list:

The virgin case

DSC_2482.JPG

Most parts assembled

DSC_2532.JPG

Booting ...

DSC_2551.JPG

 

 

 

 

Mouse Modding

Coming from a UNIX background using X11 with a 3 button mouse for years, I tried a regular Apple single button mouse for a while when I got my first Mac. This didn't work for me. I wanted "right clicking" back.

I could have gone for one of those fancy wireless ubermice or alternatively a notebook mouse with a retractable cable. Being cheap I opted for one with cables and built my own. Parts needed:

  • Microsoft Comfort Optical Mouse 1000
  • Retractable USB cable from dealextreme.com

The original mouse

CIMG0505.JPG

The remedy for $2.50 or so from dealextreme.com

CIMG0515.JPG

The modded mouse

CIMG0523.JPG

Looks really neat and tidy

CIMG0520.JPG

 

Useful Mac Software

The web is full of useless top ten lists of must have Mac applications. But it's fun to make one. So here is mine - in no particular order.

  • MarsEdit 3 - this is what I use to write this blog
  • SuperDuper! - essential for copying stuff around
  • iTerm - terminal replacement
  • MacPorts - the FreeBSD ports system ported to the Mac
  • Dropbox - this is simply awesome
  • VirtualBox - for when you need something other than OS X

There is nothing really new on my list. I would like to here about cool hidden gems that the masses have not yet discovered.

You will find hackintosh specific links on the right hand side of this blog.

 

2010-11-14

This software cannot be installed on this computer

Did you ever try using the grey installation disks that came with your new and shiny Mac to update your older Macs too? This won't work, because the Apple supplied installation discs are locked down to only work with the hardware model that they came with. However, if you are comfortable with the UNIX command line and a text editor, then it's pretty simple to unlock it. Here's how it works for Leopard.

  1. Use xar to unpack the file /System/Installation/Packages/OSInstall.mpkg from "Mac OS X Install Disc 1". From 10.5 onwards, xar is part of the base install. If you don't have it, you can get it from MacPorts.


    mkdir /tmp/unlock
    cd /tmp/unlock
    xar -xvf "/Volumes/Mac OS X Install Disc 1/System/Installation/Packages/OSInstall.mpkg"

  2. Open /tmp/unlock/Distribution in a text editor.
  3. Change function checkSupportedMachine. You can simply replace the function body from the first opening brace { to the last closing } with "return true;".

    function checkSupportedMachine() { return true; }
  4. Change function hwbeModelCheck

    function hwbeModelCheck() { return true; }
  5. Save the file and exit the editor
  6. Put the file Distribution back into the OSInstall.mpkg archive file


    cd /tmp; xar -cvf /tmp/OSInstall.mpkg *

  7. Copy /tmp/OSInstall.mpkg back onto your install DVD. Actually, this does not work of course. You have two options. Create a disk image of the DVD, replace OSInstall.mpkg with the "unlocked" version, and burn a new DVD. Alternatively, make a copy of install DVD on an external firewire disk. Place the unlocked file on your copy on the external disk and boot off it.