This article is more than 1 year old

Asahi's plan for Linux on Apple's new silicon shows Cupertino has gone back to basics with iOS booting

Open source project shows Apple has done some funky stuff with M1

The Asahi Linux project has published the first progress report detailing its effort to port Linux to the Apple Silicon platform.

The lengthy blog post describes in extensive detail the challenges faced by the project in understanding how Apple’s home-grown proprietary chippery works on a fundamental level, as well as the circumventing the various non-standard quirks that limit the ability to boot third-party operating systems.

The report, written by kernel hacker and Asahi Linux co-founder Hector Martin, unfortunately doesn’t conclude with a link to a fully working Linux distro. It does, however, illustrate how widely Apple Silicon-based Macs diverge from standards you might typically see.

The boot process, for example, isn’t what you’d expect to see on a conventional ARM64 system, but rather “a bespoke Apple mechanism” originating from the early days of iOS, with design elements derived from the Open Firmware specification as seen with the New World ROM Macs.

This has forced the Asahi Linux project to develop a bespoke bootloader for Apple Silicon machines called m1n1, which aims to take care of as many ‘Apple-isms’ as possible. But it’s a bit more than that.

The origins of m1n1 lie in mini, a project created by Martin as part of his research into jailbreaking the Nintendo Wii. While it supports the booting of third-party code, it also allows researchers to control the machine in real-time from a development computer. By using its interactive shell, or writing simple Python scripts, you can enumerate how the Apple Silicon processor works on a low, bare-metal level.

This has allowed the Asahi Linux team to identify features that are distinct to the Apple Silicon M1 processor, such as configuration bits designed to improve performance when running x86 code in Rosetta.

“Using m1n1, we’ve been hard at work documenting Apple’s custom Arm instructions, Apple-specific system registers, hardware such as the Apple Interrupt Controller, and more,” Martin wrote.

Asahi Linux logo

Crowdfunded Asahi project aims for 'polished' Linux experience on Apple Silicon

READ MORE

This enumeration came in handy because, as noted, Apple Silicon is a completely distinct and proprietary system. There is almost no documentation on how it works, and its behaviour diverges from other ARM64 chips.

Martin notes that when the chip idles, there’s a chance it may choose to “power gate,” which sees parts of the CPU switched off to reduce energy consumption. This has the nasty side effect of wiping the contents of registers, save for the stack pointer and program counter, causing Linux to crash.

Fortunately, the Asahi Linux team was able to identify a way to disable this particular functionality by providing a specific value to an Apple-proprietary hardware register, allowing their work to continue. Other “Apple-isms” that proved frustrating included a completely bespoke approach to exceptions and the system timer.

Reading the report, the biggest surprise about the Apple Silicon platform is how much of its lineage stems from older products. The boot process, as noted, is derived from that first used on iOS. The UART chip, used for serial communications, was made by Samsung – a company which, Martin notes, provided the SoC for the first iPhones. The I2C hardware was originally designed by now-Apple-owned PA Semi, with the design based on a PWRficient chip also used in the AmigaOne X1000.

This led to an unusual situation where an Amiga clone from 2010, running a derivative of an OS that reached its peak popularity in the late 1980s, played a role in documenting the internal machinations of the newest Macs.

Through painstaking investigative work, the Asahi Linux project has been able to bring a limited Linux environment to the Apple Silicon M1 platform. It’s far removed from being a workable, fully-fledged system, however. There’s no real display driver, for example, with the project instead using the basic firmware-provided framebuffer.

“As it is not a proper display driver, there is no way to change resolutions, handle display hotplug, or even put displays to sleep. It is sufficient for development and demos, but we will have to write a proper display controller driver in due course,” Martin wrote. Meanwhile, the GPU remains a black box, with reverse engineering work still in-process.

The Asahi Linux project isn’t the only effort to bring Linux to the Apple M1, with Corellium managing to boot a port of Ubuntu on the latest-and-greatest Mac Mini. This too is in early days, with support for graphics acceleration and networking conspicuously absent. ®

More about

TIP US OFF

Send us news


Other stories you might like