Last year, Apple unveiled the Apple M1, its first desktop-class System-on-a-Chip design based on the same ARM architecture as most smartphones and tablets. While Linux has long worked well on ARM devices (such as the Raspberry Pi), Apple’s hardware is highly customized and necessitates specialized software support. We are, thankfully, one step closer to running Linux on Apple silicon.
Asahi Linux has been working on bringing “a polished Linux experience” to Apple Silicon Macs and has submitted its code to the Linux project for inclusion in the official Linux kernel. The group’s preliminary work has been merged into the Linux SoC codebase and will most likely be included in the upcoming Linux 5.13 update.
It’s exciting to see initial support for Apple’s new hardware appear in the Linux kernel only a few months after the first hardware shipped, but the keyword here is “initial.” While Linux technically boots on M1, we’re still a long way from inserting a Live USB drive and pressing the install button. Support for basic low-level functionality, such as symmetric multiprocessing via spin-tables, IRQ handling, serial connections, and a frame buffer, is included in the current code. Linux can boot to a command prompt, but not much else — full graphics support isn’t even available yet.
While official kernel support for M1 hardware continues to improve, some users have managed to get closer to a true desktop experience through various hacks. Corellium, an ARM virtualization development firm, was able to create a usable Ubuntu desktop on the M1 Mac Mini. The team created its own kernel patches and drivers, which, like the recently-merged code from the Asahi Linux project, are in various stages of being upstreamed to the Linux kernel.
In a blog post, Corellium discussed how M1’s architecture differs from other ARM designs. “The bootloader, traditionally known as iBoot, loads an executable object file in the Mach-O format, which can be compressed and wrapped in a signed ASN.1-based wrapper format known as IMG4. In comparison, standard Linux on 64-bit ARM begins as a flat binary image.” “If that wasn’t enough, Apple designed their own interrupt controller, the Apple Interrupt Controller (AIC), which is incompatible with either of the major ARM GIC standards,” the group continued. Not only that but the timer interrupts, which are normally connected to a regular per-CPU interrupt on ARM, are instead routed to the FIQ, an obscure architectural feature that was more common in the old 32-bit ARM days.”
Apple’s M1 chipset is now available in the MacBook Air, MacBook Pro, and Mac Mini. It’s a 5nm chip with eight cores in total, four of which are high-performance and four of which are power-efficient. A Neural Engine and an eight-core GPU are also included for machine learning tasks. Apple promised that the M1 would outperform previous Intel CPUs while using one-fourth of the power, and subsequent real-world testing confirmed those claims. Fortunately, the M1 fully supports booting unsigned/custom kernels, so running Linux does not necessitate any security exploits that could later be patched.
Although Apple’s own macOS is a fantastic operating system, having desktop Linux as an option could be a strong selling point for some potential MacBook and Mac Mini buyers. Over the years, Apple has been chastised for restricting some aspects of macOS or abandoning cross-platform standards in favor of proprietary alternatives. For example, macOS continues to lack support for the cross-platform Vulkan API for graphics, instead of relying on the company’s own Metal API.