Opening up the Apple
- Article 14 of 16
- LinuxUser & Developer, July 2006
With Apple’s conversion to Intel chips well under way, the possibility of running standard Linux distributions on Macs is proving enticing. Rob Buckley investigates to see whether Linux on Mactel is as easy as it sounds
Page 1 | Page 2 | Page 3 | All 3 Pages
Linux is everywhere. From embedded chips to PDAs to mainframes, Linux and Linux distributions can run on almost anything. Of course, most users tend to run Linux on a server or on a PC – and by PC, most people tend to mean x86-based personal computers. That used to mean anything that was also capable of running Windows, but with Apple now firmly on the Intel bandwagon, Macs could be running standard Linux distributions as well. So what’s stopping them?
Mac and Linux users tend to run neck-and-neck in competitions to find people who love their computers the most. For Linux users, there’s the power and the principles of open source and the Linux kernel. For Mac users, there’s the ease of use of the OS X operating system and the quality of Apple’s hardware. Combining Linux and Apple hardware should give almost all the best elements of both worlds.
Running Linux on Apple hardware is not a new idea. For most of the Mac’s history, it used Motorola’s ‘68k’ range of processors, before switching to IBM and Motorola’s PowerPC processors in the early 90s. There are ports of Debian Linux and other distributions that run on bothh 68k and PowerPC processors. Among the first distributions for the PowerPC Mac was Yellow Dog Linux from Terrasoft. To this date, it remains the only distribution that Apple endorses for installation on its XServe server line.
While these distributions were recognisably Linux, they suffered from a number of problems. The first was the familiar problem of drivers. Apple’s closed hardware spec and unwillingness to support other operating system developers has meant that developers have had to work out for themselves the necessary hardware outputs and controls for Macs. With far more resources being committed to the Linux on x86 processors and far fewer Linux developers with access to Macs, this meant progress was far slower in developing the necessary drivers. Indeed, even today, support for Mac wireless networking is virtually non-existent in PowerPC Linuxes, although some success has finally been achieved in developing drivers for the Broadcom chipsets used. Perhaps the only thing in favour of the PowerPC Macs at this point is the far smaller potential number of hardware configurations that Macs offer, compared with x86-based PCs from the numerous hardware manufacturers around the world.
The second problem is the relatively unoptimised state of the gcc compilers on PowerPC. While both Apple and IBM committed considerable resources to improving the state of gcc, the code it produces is still slower than the code produced for x86 chips.
Lastly, binaries compiled for x86 Linux distributions won’t run on PowerPC Linux, making it harder to ship commercial software. And although most source code for Linux apps will compile on PowerPC, disparities between gcc on x86 and PowerPC would result in software not running because of problems with libraries or bugs in gcc.
The result has been that Linux on PowerPC is very much an orphaned child left behind the rest of the Linux mainstream.
The announcement last July that Apple was going to migrate all its PC product lines to Intel chips was clearly an exciting prospect for Linux users as well as Mac users. Finally, there would be the chance to run standard Linux distributions such as Red Hat, Gentoo and SuSE on Macs.
Of course, the devil is always in the details and when Apple released its first Intel-powered desktop computer in January, it soon became clear that getting Linux to run a Mactel wasn’t just going to be a matter of repartitioning the hard drive and booting off a Linux installer CD.
The first problem was the lack of BIOS in the new iMac Dual Cores as they were called. For years, Intel has been plugging EFI (Extensible Firmware Interface) as a more advanced alternative to the standard PC BIOS. Few hardware vendors had really taken the bait, with Gateway being the only big recruit to EFI’s cause. The problem that EFI faced was lack of operating system support. PC manufacturers weren’t going to use a non-standard BIOS if operating systems weren’t going to take advantage of any of the features. With the only Windows OS capable of using EFI being 64-bit Windows, that meant no OSes at all, as far as most vendors were concerned.
The other problem EFI presents is lack of support for old BIOS interfaces. Any x86 operating system that expects to be able to make standard BIOS calls to an EFI-equipped PC would find itself not getting the right responses. While it’s possible to wrap an EFI chip with layers that support BIOS calls, this isn’t a mandatory requirement for using EFI and makes the effort required to use EFI even greater.
However, Apple and its customers had been used to the similarly advanced capabilities offered by the PowerPC equivalent of EFI, Open Firmware. To switch to a BIOS-based PC after years of Open Firmware would be a technological step backwards as well as disincentive for customers right from the outset.
With complete control of its own operating system and no other legacy operating systems to support, Apple plumped for a motherboard equipped with an EFI chip – and no BIOS wrapper.
Linux, however, didn’t suffer the same problems as Windows. Linux has been capable of booting using Elilo from an EFI-equipped PC for several years so chances of Linux being able to boot from a Mac were substantially greater. However, Apple had removed all access to standard EFI configuration tools in favour of its own simpler, user-friendly, unconfigurable booter. It wasn’t actually possible to boot from a Linux disk.
It was only a short period of time before hackers at osxbook.com were able to circumvent some of the problems. By downloading Intel’s own EFI tools and using various command line tools, it was possible to convince the iMac’s EFI chip to recognise Linux installer disks. In conjunction with a hacked version of Elilo and the Linux kernel, Knoppix and Ubuntu were soon up and running on an iMac, although only in a minimal and slightly buggy state.
There were still some problems with this. By playing with the EFI chips in this way, it was actually possible to hose the iMac completely. Various hackers actually had to return their iMacs to Apple for replacement as a result of their endeavours, making it unlikely their solution would enter into common usage among Mac users. It also requires heavy technical understanding on the part of the user.
Meanwhile, a similar project was underway at OnMac.net to get Windows XP running on the iMac. Fuelled by a potential reward of $13,000 provided by a group of Mac users, the OnMac team were eventually able to get Windows XP running on their Macs, albeit without graphics acceleration and support for other pieces of Mac hardware, such as the built-in iSight webcam.
At the start of April, however, Apple did the unexpected. It released a tool for installing Windows XP on Intel-based Macs, complete with Windows drivers for most of the Mac hardware. Bootcamp, as it’s called, consisted of several pieces of software. The first and most important was a firmware upgrade. This upgrade installed BIOS support into the Mactel’s EFI chips – at a stroke, this made Linux and Windows XP viable operating systems on the Mac and made their installer disks recognisable as boot options. The next was a dynamic repartitioning tool, included as part of OS X’s diskutil command line program, that took advantage of the switch from the PowerPC disk partition map scheme to Intel’s new GPT scheme to allow Mac users to re-partition their disks without reformatting. Since Windows XP can’t cope with GPT, requiring an old-style MBR partitioning system, Bootcamp also adds an MBR scheme for Windows’ benefit. The third was a tool for automatically burning a set of Windows XP drivers to a CD to provide graphics acceleration, wireless and wired networking and Bluetooth support.
Some hackers have been able to use Bootcamp to install Linux on Mactels without the need for installing or adding EFI support to Linux. Gentoo and Ubuntu have already been installed. A triple boot solution using the EFI support of Bootcamp has proven elusive. Other than diskutil, there is no partitioning software available that can create dual GPT/MBR partition system drives. GPT-based partitioning software wipes the MBR partition, whereas MBR partitioning software can't edit GPT.
Even worse, MBR only supports four primary partitions and GPT does not support extended partitions. Combining these two limitations means that a dual partition system disk can have a maximum of four primary partitions. In addition, Apple reserves the first primary partition for its Bootcamp bootloader. That leaves only three partitions, one for each OS. Hence, it’s not possible to have a Linux swap partition; instead a swapfile is needed. Lastly, Bootcamp expects the Windows “c:” drive to be the last partition present on the drive. If it isn't, Windows setup will crash with a “cannot find hall.dll” error after the first reboot.
A triple boot option is still possible, however, thanks to OnMac’s members. This method involves chainloading the Lilo bootloader from the Windows XP (NTLDR) bootloader (Grub does not work with Bootcamp, since it tries to install the stage 1.5 code into the same section of disk reserved for the primary GPT record. Apple's firmware prevents this from occurring.).
While chainloading isn’t the most user-friendly of options, it does at least allow Linux to run natively on a Mac. Apart from making it easier to use and developing an EFI-native option for using Linux, the next step is to develop or locate drivers that will provide full hardware support for the Mactel under Linux.
There are also options for running Linux in virtualised and emulated environments on the Mactels. The Q emulator, based on the open source QEMU, provides probably the most sophisticated emulation environment. This is still relatively slow, because it is effectively a translation of the PowerPC version of QEMU for the Intel chip (in Apple’s terminology, a “Universal Binary”), so still converts the emulated OS’s Intel calls to PowerPC calls and then back again; once these unnecessary steps are removed it should run much faster. For long-time Mac users, it has the advantage of being able to use disk images from Virtual PC, the Microsoft-owned Intel PC emulator for PowerPC Mac. There are also fewer driver problems since Qemu emulates hardware for which most operating systems already have drivers.
A new arrival on the market is the Parallels Workstation virtualisation software. This avoids emulation, giving the hosted operating systems almost direct access to hardware. While far faster than emulation and providing support for far more operating systems than the various native schemes that have been developed so far – including various old Windows operating systems as well as OpenStep, Linux and FreeBSD – this does suffer from many of the driver problems of the native approach. Parallels’ software is still in beta and improvements to emulate various different pieces of hardware are still being included.
It remains to be seen in a native triple-boot solution can be developed. It also remains to be seen who will produce it – the hacking community or Apple. Although Apple has not shown much interest in Linux, often regarding it as a competitor rather than a potential ally, most of OS X is open source and the potential to run Linux-based desktop and server solutions may make Apple hardware more attractive to various businesses.
The Bootcamp software is seen by many as a way to get Apple hardware and software into markets previously closed to the company or that are flagging. For example, many schools in the US have been swapping to Windows-based PCs for a variety of reasons, even though they were once loyal Apple customers. However, with the option of being able to swap between XP and OS X, schools could reconsider this choice. Even more, particularly those with strong computer science courses, would reconsider if a triple or even multiple boot Mac were available that could load Linux with a simple restart.
The Bootcamp software is in beta at the moment so its full range of planned capabilities isn’t known as yet. Certain pieces of Apple hardware, such as its Bluetooth keyboard and mouse, aren’t supported by Bootcamp yet and so clearly these will be priorities for Apple before the final release is made available. But Bootcamp is actually planned for final release as part of the next paid-for upgrade to the OS X operating system: OS X 10.5, codenamed Leopard. This is due to go on sale by the end of the year. There’s a strong possibility that the final version of Bootcamp will include options for booting Linux as well as Windows XP and potentially Windows Vista. While Apple may not go to the lengths of developing its own drivers for Linux, with the access to a far greater pool of developers that the switch to Intel has given Apple, a community-derived set of drivers could well arise far more quickly than they did for PowerPC Macs. There is at least circumstantial evidence that Apple is heading in the right direction: the diskutil command line tool in OS X now includes an additional disk format option – “Linux”.
Equally possible is that corporate developers, even potentially IBM, might well decide that having a triple boot machine for their developers would be the ultimate combined money-saver and market-opener. If all it would take to do this is to produce some drivers for Mactels, they might well develop them themselves – as might the companies, such as ATI, that developed the hardware Apple uses in its Mactels. There’s already an ATI driver for the Macbook Pro laptop’s graphics card. However, as of yet, no one, not even Linux distributors Novell and Red Hat, have committed themselves to the endeavour.
Linux on Mactel is here already and is a viable option, just a few months after the Mactel’s first release. Within a few more months, Linux could be an equal partner with other operating systems on the Mactel. The cachet of Apple’s hardware combined with the power of Linux could be a powerful thing indeed.
Page 1 | Page 2 | Page 3 | All 3 Pages
