Mythic Beasts

Resources for turning an Intel Mac Mini into a working Linux desktop machine.

Linux on the Mac

For the impatient here's a walk through of what you need to do to get a booted

Kernel:

nuts

Start with a stock 2.6.16.1 kernel, and apply the patch for Intel macs imac-2.6.16.1.patch or mirrored here My .config file, bear in mind I have a duo and that it references all the other patches below. For the lazy here's a precompiled kernel that has all the patches on this page in it.


Parallel IDE on the southbridge for the CD/DVD

chip

The Intel 82801GBM southbridge, when operating out of legacy IDE mode, requires that the every single ATA interrupt it generates be acknowledged in the same way as a ATA DMA engine interrupt. Here's the patch.


Real time clock and EFI

clock

Linux calls into the EFI runtime services to set the real time clock. This causes a segfault on my mini. The mini has the regular traditional CMOS clock, and this patch tells Linux to use it. Without it ntpd will crash your system on boot.


Marvell Yukon-2 Ethernet

chip

Linux seems to have an old buggy driver for the Ethernet chipset. On my mac it kept falling over. The author has a newer version (or locally) which fixed all the problems for me. You can also get it as a patch against the kernel here.


Intel 945G graphics

video card

Xorg/XFree86 don't seem to know about the version of the Intel 945G in the mini, but they seem quite happy if you lie to them and tell them it's a different 945G chip. This trivial patch fixes that.

However that's only half the problem. The X drivers call into the VESA BIOS to do things like set up video modes. So you need to have this BIOS installed. The Apple firmware only loads and initializes this BIOS if it's booting in legacy mode, which, in turn, prevents access to the EFI interface. The solution is as follows: in the boot loader just before control is transfered to the kernel, some code in the bootloader searches the firmware image for the VGA ROM. It runs this ROM in an emulator where the ROM rewrites itself to include EDID information from the attached monitor monitor (yes it really does), and does all the POST type things. It then does the Linux basic VGA detection steps and writes the results into the kernel's boot parameters, then enables memory at the video ROM address of 0xC0000, copies the ROM from the emulator into that memory, sets up the interrupt vectors to point into the ROM and executes the kernel.

To do this you need to patch elilo (see below under boot), and and make a small patch to the kernel which re-enables legacy VGA under EFI (you'll need to apply this after the main imac patch above)

Once you've done this you mini will behave like a regular PC as regards the video during an after boot. NB: the Intel VGA ROM seems to hang if it can't get any EDID information from the monitor, beware if you're using a KVM switch


Apple remote control

remote control

Here's a patch that adds support for the mini's remote control. It behaves like a standard USB keyboard device, and sends KEY_MENU, KEY_PLAYPAUSE, KEY_NEXTSONG, KEY_PREVIOUSSONG, KEY_VOLUMEUP and KEY_VOLUMEDOWN. The remote itself doesn't send key up events, so this driver emulates them.


Intel High Definition Audio

cans

You'll discover that the audio doesn't appear to work. In fact it's comming out of the line in socket. This patch to the Sigmatel codec driver fixes that. It uses info gleaned from the "Bootcamp" drivers .inf files. However, the internal speaker still doesn't work.


Power

power brick

The mini doesn't remember the last state of power after a power cut and return to it. You can, however, tell the mini to power up when AC power becomes available, but for some unfathomable reason EFI resets this flag on every boot. I set this flag in elilo (see below under boot for a patch). You can either do that, or you can have rc.sysinit (or whatever) run setpci -d 8086:27b9 0xa4.b=0


Booting

boot

EFI on the mini has a baroque method of setting the boot device, which you may or may not be interested in. I use elilo-3.6 (or local copy) to boot. I apply some patches: one to fix a bug in the ext2 handling, another to set the power up with AC behaviour, a third to make elilo switch to text mode so its output is visible, and finally a patch and a tar ball to find and install and query the VGA BIOS before booting the kernel. If you're really lazy you can get a compiled copy of elilo.efi with all of the above patches applied.

About

This page was originally published by James McKenzie at http://www.madingley.org/macmini/. James McKenzie is one of the founders of Mythic Beasts Ltd. In addition to sorting out the Mac Mini he's also done the Linux on Apple TV How to.

Copyright © 2000-2014 Mythic Beasts Ltd. All Rights Reserved.