I was sure that Linux would eventually run on Apple's ARM-based M1 CPU. After all, Linux has been ported to essentially every processor on the planet. Even without Apple's co-operation, it would only be a matter of time. I'd assumed it would take a year or so. I was wrong. Correllium, a company specializing in ARM virtualization and developer tools, has successfully ported Linux to Apple's new M1-powered Mac mini.
Chris Wade, Corellium's CTO, announced on Twitter that "Linux is now completely usable on the Mac mini M1." Mind you, it's not perfect yet. For example, you can't use the M1's built-in machine-learning (ML) cores or, more importantly, its graphic cores. So, advanced users aren't going to be running ML or Linux games on M1 machines anytime soon. But this is still an impressive achievement.
While Correllium is known for its Corellium Hypervisor on ARM (CHARM), a type 1 hypervisor that can be used to run Linux in a virtual machine on bare metal, that's not what the company has done here.
In a brief interview, Wade explained it doesn't run on CHARM. "The M1 Linux port runs on bare metal."
For now, only people who really know Linux should be trying this out. Wade said that binary files and a how-to document are being worked on. For the moment, you must still compile the linux-M1 code yourself.
That done, you can boot your M1 Mac mini from a USB stick into a full Ubuntu Linux desktop. For networking, you'll also need a USB-C dongle. More work is being done, even as I write this, to include better USB and I2C serial communications protocol.
In short, although the M1 is a new chip, with its work on iPhone chipsets Corellium was already digging the foundations for Linux on M1. That's because "many of the devices on the SoC [System on a Chip] didn't change from the programmers' perspective."
Thus, while much of what's going on inside the M1 is still a mystery, the Corellium code is able to work with the following hardware interfaces:
Apple AIC interrupt controller
Apple UART driver
PMGR support (power gating)
DART support (Apple IOMMU)
USB Type-C controller adaptation
USB (on the Type C ports only)
That was enough to boot and run desktop Ubuntu. This initial Linux M1 Mac code has been pushed upstream to the Linux kernel developers.
More work, much more work, needs to be done. As one of the programmers tweeted, "It'll take a while to upstream, it's a very promising port though." That's "because of the SoC being atypical, more invasive kernel changes are needed."
Corellium is also happy to work with the developers behind the crowd-funded Asahi Linux project. This group is attempting to bring the Arch Linux distro to Apple's M1 architecture. With the help of crack developer Alyssa Rosenzweig Asahi has already made some progress on the M1's proprietary GPU architecture.
Looking ahead, to get Linux to boot directly from an M1 Mac, the developers are considering several options. The approach that, for now, is getting the most attention is to use pongoOS, a customized boot loader. This works in concert with Apple's native iBoot2. A typical boot path would look like: iBoot2 -> pongoOS -> Linux.
As for the code's license, Wade tweeted that "All of Corellium's code for Linux for M1 code will be released under a permissive open-source license and we are actively looking to upstream it into Linux." Since Linux is licensed under the GPLv2 that may prove troublesome, but that's a problem for another day.
Another more pressing problem may be that Apple has no love whatsoever for Corellium. Apple sued Corellium last year for copyright violations for its program, which enabled researchers to spin up a virtualized ARM iOS device in a browser to look for potential security bugs. Apple's early efforts have failed, but the suit goes on.
All that said, even though the M1 Linux port is alpha code, it still shows you can get a working Linux on the proprietary M1 CPU. For users who want to run Linux on Macs -- and that's many of them, I've seen more Mac hardware at Linux tradeshows and developer conferences than any other single type of laptop -- this is great news.
Heck, if they can crack the GPU problem, even Linus Torvalds will want to give it a try.