How to get X.Org working on an Apple eMac (ATI Radeon 7500)

20 February 2009

About 8 or so months ago, I bought an Apple eMac, which came with a DVD drive, 1GHz PowerPC processor, 1GB of RAM, and an ATI Radeon 7500 video card.

One of the first things I did was attempt to install Linux on it. Ubuntu 8.04 was my first try, and I was annoyed to find that I couldn’t get a picture with Xorg on it — just a blank screen. I also tried Debian Etch, Debian Sid, and Fedora 8, which also had the exact same symptoms.

The only Linux distro that worked was openSUSE 11, but I couldn’t stand openSUSE because it was slow, YaST was painful to use, I hated RPM, and they customised GNOME way too much.

Initially, I thought it was a refresh rate problem. I have gathered that the optimum screen mode for the eMac is 1024×768 @ 89Hz. Because Ubuntu was trying to set the mode to 1280×800 @ 60Hz by default, I added a modeline for the proper mode. However, that didn’t fix my blank screen, and I almost gave up in despair.

I also ran xrandr under a tty, and it was interesting to see that it thought my Mac had DVI hardware — DVI-0 and DVI-1. The eMac most definitely does not support DVI, so this told me the issue was a little more advanced than refresh rates.

On Saturday, while talking to the friendly folks on #gentoo-powerpc, one of them pointed me to this page (Update: the link is an equivalent page, as the original link is now gone), which contained some ConnectorTable hacks. As it turned out, the hacks worked! Both internal and external VGA worked (internal VGA was called VGA-1, and external VGA was called VGA-0), which makes me really happy.

So, to get X.Org working on your eMac, make the following changes to xorg.conf.

First you need to define the Modeline for the video mode:

Section "Monitor"
  Identifier   "Configured Monitor"
  # 1024x768 @ 89.00 Hz (GTF) hsync: 72.00 kHz; pclk: 99.07 MHz
  Modeline "1024x768"  99.07  1024 1088 1200 1376  768 769 772 809  +HSync +Vsync
EndSection

Then, tell it to use the video mode:

Section "Screen"
  Monitor    "Configured Monitor"
  # Fill in self-explanatory data here.
  SubSection "Display"
     Viewport   0 0
     Depth     24
     Modes   "1024x768"
  EndSubSection
EndSection

Fix the broken ConnectorTable:

Section "Device"
  # Fill in device information here.
  Option      "ConnectorTable" "100,1,0,1,108,2,0,1"
EndSection

After you do that, you should have a working X display. If you still get a blank screen, switch to a tty, run export DISPLAY=:0, run xrandr, and check to see that the eMac is using the correct resolution. Make sure DVI is not mentioned.

The photo by Oswald using -HSync +Vsync depicts the eMac with the picture off-centre. This is because -HSync +Vsync (the default) is wrong! Use +HSync +Vsync, and your picture will be in the centre of the screen.

Instead of the ConnectorTable hack above, one user from the Ubuntu forums points out that it is possible to get a picture by adding the following code to the Device section:

Section "Device"
  # Device information goes here.
  Option "monitor-DVI-0" "iMac"
EndSection

This is not as good a solution as setting ConnectorTable, as the external VGA monitor does not work with this set.

If you used this information to try and fix X on your eMac, please let me know in the comments so I know whether it was helpful or not! Thanks!

OSx86

28 October 2007

Much to my surprise, I discovered that my motherboard, ASUS M2NPV-VM, is on the OSx86 project’s HCL for running Mac OS X 10.4.8, meaning I’ve been able to run Mac OS X on my computer! Even more surprising, I have discovered that it also runs on the 4-year-old Compaq Evo N610c that I use!

Now, I’ll spoil the ending right now by stating that I am not switching to Mac OS X. I have every intention of keeping Ubuntu as my primary OS. I :heart: GNOME!

I initially started by attempting to install OS X in VMware, but that didn’t work properly, as I couldn’t get it to boot. Next thing I tried was burning the .iso to a CD and booting from there, but I couldn’t get it to boot all the way — I kept getting stuck about halfway when it was “Still waiting for root device”.

Well, it turns out that “Still waiting for root device” is a common problem, but there wasn’t all that much guidance on what to do. I saw that a lot of the people that were getting the problem had SATA hardware, so that was probably the common denominator. I have an IDE hard drive, but a SATA DVD/CD drive. Dad has a SATA → USB converter kit, so I tried to take SATA out of the equation by hooking up my optical drive via USB and booting the OS X DVD from there, but I made even less progress, when the bootloader complained about not being able to find some “plist” file.

Then, it struck me. I had read something about the optical drive and hard drive needing to be on the same IDE channel. Having an IDE hard drive and a SATA optical drive was a bit of a problem, but luckily I had a partly broken IDE DVD burner in the chest of drawers. I connected this to the same IDE channel that my hard drive was on, and as luck would have it, it booted up successfully!

From then on, it was pretty much hunky-dory. The setup loaded (with compositing and shadows and stuff even in the installer!), I ran Disk Utility, formatted a logical partition I had set aside as HFS+, and proceeded to install OS X. From memory, I had read that OS X will not boot off a logical partition, but I am running my installation from one right now, and it is working fine. After installation, I booted into Ubuntu (as OS X didn’t install a bootloader), and copied OS X’s /usr/standalone/i386/chain0 file to the /boot directory on Ubuntu, and added the following to /boot/grub/menu.lst so I could dual-boot Ubuntu and Mac OS X:

title           Mac OS X
rootnoverify    (hd0,0)
makeactive
chainloader     /boot/chain0

The initial bootup gave me pretty good impressions, but to my dismay, neither my NVIDIA nForce networking nor the 3Com networking card I had installed were working. So, I only had FireWire-based networking. I connected my FireWire to the laptop (in Ubuntu, you can type sudo modprobe eth1394 to enable FireWire-based networking), and set up a NAT, which got my OS X installation onto the Internet pretty easily.

To my surprise, last Friday, I happened to run cat /proc/cpuinfo on the Compaq Evo N610c laptop that I use, and discovered that the Pentium 4 M processor that it uses supports SSE2, one of the requirements to run OS X. So, I stuck in the installation disc, and it actually booted up fine, with none of the jurgle I needed to get it running on my desktop computer. I couldn’t actually install the operating system, because the DVD actually got scratched, because, as I mentioned before, I previously used the same DVD in my faulty DVD drive. The drive was faulty because it made crunching sounds, and actually etched some grooves into the DVD. I was amazed it booted at all.

Well, by this time, after having done one installation already, I had realised that installation via the disc was actually unnecessary. I could connect the laptop hard drive to my computer via USB, and install Mac OS X on the drive using VMware. Getting it to boot via VMware was a bit of work. First, I had to connect grab an ISO of the OS X installation disc, and connect it as a virtual IDE drive on channel 1:0. Then, I had to use qemu-img to convert it to a .vmdk file, and I also connected that as a hard drive on IDE channel 0:1. Yes, the disc was connected on both 1:0 and 0:1. Believe me, you need to do it that way.

The next challenge was getting the laptop’s hard drive that was connected via USB onto the VM’s virtual IDE 0:0. I first told VMware to “Use a physical disk”, and selected /dev/sda (what the USB drive came up as) as the drive to use. Because the USB drive appeared as /dev/sda on my computer, VMware wanted to treat it like it was a SCSI drive, which OS X (or at least OSx86) doesn’t support. So, I went and edited the .vmdk file that VMware created (.vmdk files linked to physical disks are editable with a text editor) and changed where it had “buslogic” written to “ide” (easy as :%s/buslogic/ide in vim). I then edited the .vmx file, and changed all instances of scsi0:0 to ide0:0.

After that, installation went smoothly. Upon booting up for the first time, after putting the hard drive back into the laptop, when it got to the point when it was about to show the GUI, the LCD screen developed horizontal stripes, and the image slowly faded out, to the point where the screen was all white, with black stripes. I removed the Natit.kext file from /System/Library/Extensions/ (the ATI driver) and it booted fine after that. Performance was not as good as on my desktop computer, mainly because the eye candy is being software rendered, as the ATI driver doesn’t work. Also, the in-built networking and PCMCIA slots don’t work.

However, I could get networking working properly without the need for FireWire/NAT jurgle by using my Gigabyte GN-WB01GS wireless USB dongle. Firstly, I downloaded the RT73 driver for OS X from Ralink’s OS X driver page. The driver didn’t initially recognise my USB dongle (“No Device!”), so I had a little hacking to do.

From the forums, I have learned that drivers (called kernel extensions) store the information about what sort of hardware they are activated for in a file called Info.plist. By editing this file, you can enable the driver for different pieces of hardware. I opened up the Info.plist file for RT73 which was stored at /System/Library/Extensions/RT73USBWirelessDriver.kext/Contents/Info.plist. By previously opening the System Profiler application and finding my USB dongle in the list, I knew that the hexadecimal Product ID for my dongle was 0×8008, and the Vendor ID was 0×1044. The Info.plist file stores these numbers as decimal, not hexadecimal, so the aforementioned IDs are 32776 and 4164, respectively.

So, inserted the following chunk into my Info.plist file:

<key>Jeremy</key>
<dict>
    <key>CFBundleIdentifier</key>
    <string>com.Ralink.driver.RT73</string>
    <key>IOClass</key>
    <string>RT2573USBWirelessDriver</string>
    <key>IOProviderClass</key>
    <string>IOUSBDevice</string>
    <key>bcdDevice</key>
    <integer>1</integer>
    <key>idProduct</key>
    <integer>32776</integer>
    <key>idVendor</key>
    <integer>4164</integer>
</dict>

…which I had modified from one of the existing chunks in the file to include my dongle’s Product and Vendor IDs. Upon rebooting and inserting my wireless USB dongle, the Ralink wireless utility popped up and I got onto the network!

Well, as you can see, there has been a lot of hacking getting all this all going, but I have to say that it was worth it. It’s nice to be able to play with OS X and get a real feel for the user interface. It’s one thing to see screenshots and videos, but it’s completely different to experience it for yourself.

Apple to sell DRM-free music

3 April 2007

Apple’s latest press release states EMI Music’s entire digital catalog of music will be available for purchase DRM-free (without digital rights management) from the iTunes® Store worldwide in May.

This is exciting news and comes at a time when Defective by Design was on the verge of sending Steve Jobs a jester hat for not following up what he stated in February. Great work, Defective by Design, for all the campaigning you have done. I’m sure you guys had a part to play in this.

Apple would embrace DRM-free music in a heartbeat?

7 February 2007

Steve Jobs’ Thoughts on Music. ((via Jono Bacon’s post Nice one Steve)) An interesting point he brings out is that while the Big Four global recording companies require Apple to sell their music only with DRM, 90% of their music is still sold on DRM-free CDs.