Friday, September 17, 2010

A long way to OS X

One beautiful morning I decided to try out Mac OS X on my laptop (MSI EX625). There were several reasons:

  1. Apple hardware is too expensive.
  2. The OS quality is outstanding, while the price is just 40$.
  3. Need to try developing for Apple's mobile devices.
First facts I discovered was: "it is possible" and "there is TonyMac boot loader". Alright, I ordered a disk from eBay for 30$, starting to prepare myself mentally for a change.When the disk arrived, I was eager to try out tony's boot loader. Chameleon appeared on the screen, inviting me to start the installation. The first try failed - it couldn't reach the installer window, hanging half the way through.

I searched forums and started trying different boot options. Nothing actually helped. There were several errors on the screen, what confused me a lot, especially because an actual error causing the hang was not mentioned... I tried all possible ATI versions of iBoot (4+) and even PcEfi with no result. I've posted on the forums, waited, searched, but hadn't gotten any replies...

After heavy surfing I found out the actual reason - ATI Radeon Mobility video-cards are not supported! There was a chance that drivers could be released soon, but I couldn't wait, especially an undefined amount of time. I decided to exchange laptops with my wife, leaving old hard-drives. She didn't stop me, so I started to disassemble both laptops immediately, with a help of a small screwdriver. My new laptop was ASUS M51SN, with ultra-compatible GeForce 9500M on board.

Both Linuxes survived this change with honor: my Arch required to change the video driver, while Dina's Ubuntu worked perfectly like nothing changed (though, she updated the driver later). Mac OS X still didn't run out of the box, but required the following options: '-x' for safe mode, 'cpus=1' for proper cpu cores detection. That was sufficient, but I patched the BIOS using a custom version to enable proper CPU detection (the BIOS built-in update utility is awesome!).

Hello, the freaking installer! It wasn't easy at all to get you on the screen! I was happy for a short moment - the installer didn't like my MBR disk at all... Apple supports only GUID & Apple partition tables, intentionally ignoring MBR. There was a solution - to use the external USB disk/flash: to install on it first, and copy the partition to the hard drive directly. My 4Gb flash wasn't enough, and the official website states 5Gb requirements. Borrowing a 8gb USB flash was not enough as well, because the minimum installed configuration took 8.2Gb, what a surprise!

That was a time to sacrifice my precious 1Tb external USB drive. There was no space to backup to, so I decided to trick the installer a bit. I moved the actual data partition +20Gb from the start of the disk, leaving the empty space for the Mac OS image. I backed up the MBR together with first 100Mb of the FAT32, just to make sure the file system structure is saved. In the installer, I re-partitioned the drive into GUID 2 partitions : first 20G for Mac OS and all the rest. The installation went successful, yaw!

I copied the partition to the hard drive and was even able to boot from it: in a safe mode, using the same cd loader. Moreover, putting the old MBR back on the external HDD recovered it instantly, leaving me with a feeling of the epic win :) However, the OS X file system became corrupted each time I booted, forcing me to rewrite it from the image and look forums for an answer...  Posting again and asking for help in the OSX-86 IRC didn't help, leaving me in frustration again...

The sorting of my MBR seemed to be a good idea, if not for the corruption problem, but at least to make the boot loader work on the HDD. Fdisk did the job, but MBR was somehow damaged after that. I looked for a rescue and accidentally issued 'dd' command on the saved 100Mb file from my external drive backup... That was a bi-i-ig mistake, and it seemed to be the worst situation ever: the partition table together with my ext4 file systems were destroyed, so I had no OS to boot and no data to operate!

That's where smart hackers come into play. Asking again on the IRC, I attracted the attention of 'aschar', who listened to my problems and described the way out, in detail. The solution was to use a much less known Nawcom boot loader, that recently gained MBR support. In a day I managed to rebuild the partition table, entering some numbers by hand and using a couple of hack tools (look at testdisk!).

Using the PartedMagic liveCD I prepared the case-sensitive HFS+ partition and started Nawcom's boot loader. From now on, everything was smooth. The boot loader didn't require the safe mode, allowing me to install OS X right into the MBR partition I provided. After reboot, the OS loaded correctly, allowed me to update it to 10.6.4 and install MyHack tools from the same CD. No file system corruption, good driver support (though, sound & wifi are in progress) - and now I'm a happy owner of the Mac OS X laptop!

The end of story. The moral is:
  • Always look for alternatives! What is more popular is not always of better quality.
  • Always backup, at least MBR! Be careful with 'dd' and 'sudo' in general. Think, then do.
  • Don't give up!