Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

An embedded view of the Mac Mini, Part 2: Free software on a cheap computer

Running Linux and BSD on the Mac Mini

Peter Seebach has been using Macs since the Macintosh SE, and thinks this is the cutest one ever. He denies that his Mac Mini was ever lost in the couch.

Summary:  NetBSD and Yellow Dog Linux have both begun to support the Mac Mini. Peter Seebach looks at open source operating system options on this new contender in the embedded PowerPC platform space.

View more content in this series

Date:  05 Apr 2005
Level:  Introductory

Activity:  12889 views
Comments:  

Apple's native operating system software offers you the best hardware support on Apple hardware, and the Mac Mini is no exception. Some of the hardware works just fine under open source systems; some isn't supported at all, or works only partially.

This article looks at the current state of Linux™ and NetBSD support on the Mini. If you need all the hardware and options fully supported, these open source options won't do it for you ... yet. But, if all you need is a stable kernel, a C compiler, and network support, the code is high-quality and the price is unbeatable.

Before you even think about installing a new operating system, make backups. Conveniently, the Mini's hard drive will be 80GB or smaller, so it's easy to back up everything on the disk. An external FireWire bay and a large enough disk to make backups is a very good investment here. Make backups. Really! Even if you're not going to install another operating system, please make the tech support workers of the world happy and make an extra set of backups right now, just in case.

Backups and system partitions

One of the nuisances of Mac OS X is that the partitioning program takes a very all-or-nothing approach to partitioning. If you alter any aspect of the partition table using Disk Utility, all of the partitions on the disk will be wiped. There are a few third-party programs that can move, copy, or even resize partitions (see Resources). If you want to use native utilities, your options are Disk Utility and pdisk.

As a result, repartitioning your disk to make room for a new operating system will require a reinstall. The only way around this is to make space on a second disk, or move your Mac OS X operating system to the second disk. There's a program called Carbon Copy Cloner which can make a proper and bootable copy of your Mac OS X system disk on an external disk (see Resources). Once you've done that, you can boot from that disk, and repartition the internal disk.

The Mac OS X install disc that comes with the Mini won't let you install directly to an external disk. It says this is because the computer can't boot from an external disk, but in fact, it can. Simply copying files over from your boot disk generally won't give you a bootable disk. This is where a utility like Carbon Copy Cloner can be useful. The Mac is friendly about letting you specify which of several partitions to boot from, once you have installed the OS on them.

The partitioning scheme that will work for you depends a little on what operating systems you want to load, and how much you'll be using each of them. If you're going to run the machine as a dedicated BSD or Linux system, it's a little simpler than if you're planning to dual-boot: you can just dedicate the disk to your operating system of choice. For dual-boot, you'll want multiple partitions, and you may end up reloading a couple of times figuring out how much space to allocate to each system.

Formatting disks on the command line

Partitioning and formatting can also be done from the command line. (DOS/Windows® users will be comfortable thinking of partitioning as what FDISK does, and formatting as what FORMAT does.) Partitioning can be done using the pdisk utility program. Many other things can be done using the diskutil program. The Disk Utility application performs the same kinds of tasks as diskutil; diskutil is less restricted, but Disk Utility is easier, and often safer. No matter what, you will need to boot from another disk (the install CD will work) to repartition the hard disk in your Mac, and you will lose all data on the disk when you do so. Did I mention that you should make backups?


Yellow Dog Linux on Power

Yellow Dog Linux (YDL) is based closely on RedHat's Fedora Core 2 operating system; the installer will be immediately familiar to users who have loaded Fedora recently (and easy to follow even if you haven't). YDL comes on eight CDs: four install CDs, and four source CDs. That's a lot of CDs! There isn't a DVD distribution available, and anyone who is used to the modern Apple single-DVD distributions will find this a little frustrating. Still, the install is easy, simple, and quick. Assuming, that is, you've prepped the disk with some free space for the installer, or plan to overwrite the whole disk. You can install YDL to an external drive, but it requires more configuration and setup. It may be easier to install it on the internal drive, and let Mac OS deal with booting from the external drive. Either way, you're going to be doing some shuffling if you want to keep your Mac OS X install.

If you find yourself thinking that your Mini isn't cute enough, and you want extra cute, YDL provides instructions for repartitioning an iPod and using it as the boot disk (see Resources). This is awfully cool. It's worth noting that Yellow Dog Linux supports HFS+ file systems. This makes it easier to move files around, access your Mac OS X backups, and so on. So, if you don't mind losing a chunk of your iPod's disk to a Linux install, you can use it to test drive Linux. But before you do this, again -- make backups. On the iPod, that means make sure you've backed up all your songs, the firmware, and so on. The instructions on the Yellow Dog site give more information about this (see Resources).

YDL has a bit of experience improving Linux support for PowerPC®, and some Mac-specific fixes as well. These will presumably make it back into the main Linux tree, but they often show up in YDL first. The company has been producing PowerPC Linux for quite a while, and also has versions for the G5 and a number of non-Mac PowerPC boards. As is often the case with non-x86 Linux distros, the source tree is not always completely current, and there's a little bit of drift. But for anyone who is concerned about PowerPC Linux keeping up with other branches, rest assured that the situation has improved a great deal since the first PowerPC patches were made available.

Hardware support

For a machine built from unusual parts, some of them laptop parts, the Mini was surprisingly functional before developers even had time to write any code for it. For instance, the Yellow Dog 4.0 release, which didn't officially support the Mini, installed and booted successfully, although it had some video quirks. On February 9th, Terra Soft announced a new release with support for the Mini. Even without this new release, the Mini was mostly functional. The things lacking were Airport Extreme and audio. The video worked, although it was stuck at 640x480. The hardware support is suspiciously similar to what you get on some laptops.

Support is rapidly evolving. Announcements of test boots and driver patches came out within days of the release of the Mini; the limiting factor seems to have been limited hardware availability, not developer interest. Current releases of Yellow Dog, as well as of Debian and Gentoo (both of which run on the Mini), are stable enough for use.

Of interest to potential desktop users, the 4.0.1 release of Yellow Dog Linux, while it doesn't add support for the Mini's onboard audio, does add support for a USB audio adapter, the Griffin Technologies iMic. Given that the Mini doesn't have an audio-in plug to begin with, this is a reasonable investment. 4.0.1 does fix the video stuff.

The point is, Linux support isn't perfect yet, but it's actively being worked on. It can be fun being a part of an evolving platform; it can also get in the way of work. You will want to base your decision on whether to go with Linux now or wait for later, based on your needs.

The quick summary at the time this article was going to press was that Bluetooth may work (but is not much tested), Airport Extreme isn't supported, audio isn't supported (some people report limited success with audio support, details in Resources).

Unfortunately, Airport Extreme support is probably not coming any time soon, to Linux or any other open source system. Broadcom has not chosen to make the necessary documentation available to open source driver developers, and this leaves developers with no way of providing drivers for the underlying chipset used in the Airport Extreme card.

It's quite possible that a future patch will add audio support. As I found when messing with NetBSD, partial support might be fairly easy. I'd have attempted it on the YDL install as well, but I'm not as experienced with hacking on the Linux kernel. Once audio support happens, YDL will be a pretty reasonable Linux workstation. It's already a perfectly reasonable development platform, or host for compiling PowerPC Linux executables.

Development tools

YDL, assuming you install the developer tools, comes with a fairly large collection of programming tools: Python, Perl, Tcl, and of course GCC (version 3.3.3). No big flashy IDE, but the basic UNIX® development tools are all there; Linux users coming from an x86 background will find it familiar. Mac users will find the underlying tools familiar, but may miss Xcode. Windows developers will want to look at online resources about Linux development. The additional control over the machine is wonderful once you've gotten over the shock, but it takes some getting used to. See Resources for links on getting started with Linux.

This suggests a possible niche for a Mini, as a PowerPC compilation server (or even as a member of a compilation farm -- Resources has more). The Mini is not a dual processor G5, but it's plenty fast to build PowerPC binaries of Linux applications. For instance, a build of the entire gdb+dejagnu package took 11 minutes, 32 seconds, of wall-clock time. That's not incredibly fast, but it's certainly fast enough for building the sorts of applications people normally build. (These numbers were done on a 1.42Ghz Mini. It goes without saying that this is far enough from a meaningful benchmark that any light it sheds won't reach a meaningful benchmark within the next few years.)


NetBSD on Power

NetBSD is, as the name suggests, one of the BSD family of UNIX-like systems, based on the code released by the University of California, Berkeley. It has been active on multiple platforms for a fairly long time. NetBSD is an interesting choice to run on a Mac, simply because there's a lot of NetBSD code (as well as the more widely acknowledged FreeBSD code) in Mac OS X. NetBSD comes both in stable releases (NetBSD 2.0 being the current release) and in the less-stable, but generally usable, NetBSD-current.

From the point of view of a developer, NetBSD's big strength is simply that all NetBSD ports are part of the same source tree. The macppc port of NetBSD isn't tracking the "main" tree -- it's just another part of the main tree. This isn't a branch or a development effort copying in patches.

The NetBSD install doesn't give you much help with partitioning. Open Firmware doesn't know about, and can't boot from, NetBSD's native version of the Berkeley FFS (fast file system). The good news is, NetBSD-current (but not the 2.0 release) supports Apple's UFS, which Disk Utility calls "Unix File System," but which is really just a slightly different version of FFS. You can use such a partition as your NetBSD root file system, and share files with Mac OS X. Or, you can use the native FFS for your root file system. Either way, you will need an HFS+ partition to hold the boot loader. Users coming from x86 platforms will be familiar with the concept of a boot partition used only to work within boot firmware limitations, as will some users of older Macs which could only boot from the first 8GB of a larger disk.

On the downside, NetBSD will require some hackery to get its partition map configured. NetBSD uses a thing called a "BSD disklabel," which is an entirely different way of describing disk partitions than the standard Apple partition map -- but it's the same from one system running NetBSD to another, even on different hardware platforms. NetBSD needs to have its root file system as partition a, and swap partition (if any) on partition b. That means going into the partition editor. By default, it'll have a copy of the Apple partition map. What you need to do is find the partition you chose for your root file system, and change partition a to use the same start and end addresses as that one. Also, mark partition b as unused, unless you're actually making swap space. (You can always create a swap file later, if you didn't allocate a partition.) The installer builds a partition table from the Apple partition map, by default. This behavior is probably the best compromise, although it guarantees that you'll have to do some work.

If you aren't running NetBSD-current, you have to make a new file system in unused space on the disk. If you're running -current, you can use Apple UFS for your NetBSD space. You still need an HFS+ boot partition to hold the actual boot program, ofwboot.xcf, but that program can find the kernel even if it's on a different partition.

This is a nuisance. It's not nearly as bad if you don't have to dual-boot, because then you just need an HFS+ boot partition and your choice of layouts of FFS partitions for your operating system and files.

Hardware support

NetBSD-current runs on the Mini without modifications. The first reports of this said to add the ehci driver, but it was added to the default GENERIC kernel in January, so it works beautifully now. All this does is allow USB 2.0 devices to work at high speed instead of in compatibility mode, so if you don't have that support right away, you can still use the system.

As with Linux, NetBSD has no support for the Airport Extreme card or built-in modem. The video card shows up; the audio does too, if you build a kernel with support for the snapper driver. In a convenient coincidence, the driver doesn't support audio input, but the Mini doesn't have an input plug. NetBSD doesn't automatically configure and start X -- it boots to a console prompt. You can configure XFree86 yourself (run X -configure, which will create a new configuration file, which you can then edit and copy into place) and start it when you log in.

The snapper should work fine. But in case it won't attach to your hardware, go to the the /sys/arch/macppc/dev/snapper.c file, and look for snapper_match(). The last check in that routine is a comparison between the Open Firmware property compatible of the device, and the string "snapper." Remove the check, and the device will start working. If you get error messages trying to use /dev/sound0, try the nearly equivalent /dev/audio0.

Development tools

NetBSD ships with the GNU C compiler. Unlike Linux and Mac OS, it doesn't ship with Perl, Python, and other third-party languages installed. Instead, you build the ones you want from the packages collection. This makes the core system install much, much, smaller, and is one of the reasons that there's not a special "embedded NetBSD" project. On the other hand, you can reasonably expect to spend a while installing "fundamental" utilities after you get the system installed. Of course, which utilities you find fundamental may vary from one person to another, which is why this scheme remains popular.

The package system used on NetBSD is very similar in style and scope to the Fink system popular on Mac OS X (if you are not familiar with Fink, it will be discussed in greater detail in a future installment of this series).


Summary

As of this writing, the hardware support in Linux and BSD isn't complete. Some of it (for instance, Broadcom drivers for Airport Extreme) may never happen. Some of it is coming along swimmingly. In fact, I had to revise substantial chunks of this article after I worked on another project for just three days. The support work involved is often not difficult, and the Mini has attracted a lot of attention.

If you want a friendly graphical install and no hassles with drivers, run the proprietary Mac OS X. If you can live without drivers for some of the hardware in the Mini and want to have complete source for everything you're using -- or insist on an Open Source system -- Linux and BSD are offering real and viable alternatives for getting the most out of your Mini. And, for those following along with the Zork test, it works out of the box on both Linux and BSD.


Resources

About the author

Peter Seebach

Peter Seebach has been using Macs since the Macintosh SE, and thinks this is the cutest one ever. He denies that his Mac Mini was ever lost in the couch.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Multicore acceleration, Linux
ArticleID=57839
ArticleTitle=An embedded view of the Mac Mini, Part 2: Free software on a cheap computer
publish-date=04052005
author1-email=crankyuser@seebs.plethora.net
author1-email-cc=htc@us.ibm.com

IBM SmartCloud trial. No charge.

IBM PureSystems on a kaleideoscope background

Unleash the power of hybrid cloud computing today!


Special offers