Apple revealed its first desktop-class System-on-a-Chip design last year, the Apple M1, based on the same ARM architecture as most smartphones and tablets. While Linux has worked well on ARM devices (like the Raspberry Pi) for years, Apple’s hardware is heavily customized and requires specific software support. Thankfully, we’re now one step closer to running Linux on Apple Silicon.
Asahi Linux has been working to bring “a polished Linux experience” to Apple Silicon Macs and has been submitting its code to the Linux project for inclusion in the official Linux kernel. The group’s initial work has been merged into the Linux SoC codebase, and will likely arrive as part of the upcoming Linux 5.13 update.
Initial M1 support has been merged into the Linux SoC tree and will be coming to Linux 5.13! 🎉https://t.co/azZwZ2XoLE
— Asahi Linux (@AsahiLinux) April 9, 2021
It’s exciting to see initial support for Apple’s new hardware arrive in the Linux kernel only a few months after the first hardware started shipping, but the keyword there is ‘initial.’ While Linux technically boots on M1, we’re still a long ways off from plugging in a Live USB drive and clicking an install button. The current code includes support for basic low-level functionality, such as symmetric multiprocessing via spin-tables, IRQ handling, serial connections, and a framebuffer. Linux can boot to a command prompt, but not much else — there’s not even full graphics support yet.
While official kernel support for M1 hardware progresses at a steady pace, some people have managed to come closer to a true desktop experience with various hacks. Corellium, a development firm that specializes in ARM virtualization, was able to create a usable Ubuntu desktop on the M1 Mac Mini. The team developed its own kernel patches and drivers, which are in various stages of being upstreamed to the Linux kernel, like the recently-merged code from the Asahi Linux project.
Corellium wrote about how the M1’s architecture differs from other ARM designs in a blog post. “The bootloader, traditionally called iBoot, loads an executable object file in a format called Mach-O, optionally compressed and wrapped in a signed ASN.1 based wrapper format called IMG4. For comparison, normal Linux on 64-bit ARM starts as a flat binary image.” The group went on to say, “if that wasn’t enough, Apple designed their own interrupt controller, the Apple Interrupt Controller (AIC), not compatible with either of the major ARM GIC standards. And not only that: the timer interrupts – normally connected to a regular per-CPU interrupt on ARM – are instead routed to the FIQ, an abstruse architectural feature, seen more frequently in the old 32-bit ARM days.”
Apple’s M1 chipset is currently shipping on the MacBook Air, MacBook Pro, and Mac Mini. It’s a 5nm chip with eight cores in total: four high-performance cores, and four power-efficient cores. There’s also a Neural Engine for machine learning tasks, as well as an eight-core GPU. Apple promised the M1 would deliver better performance than the previously-used Intel CPUs while only using around one-fourth of the power, and later real-world testing backed up those claims. Thankfully, the M1 fully supports booting unsigned/custom kernels, so running Linux doesn’t require any security exploits that could be patched later.
Apple’s own macOS is already a great operating system, but having desktop Linux as an option could be a strong selling point for some potential MacBook and Mac Mini buyers. Apple has faced criticism over the years for locking down some aspects of macOS or abandoning cross-platform standards in favor of proprietary alternatives. For example, macOS still doesn’t support the cross-platform Vulkan API for graphics, only the company’s own Metal API.