Porting an operating system as complex as Linux to a system-on-a-chip as closed as the Apple Silicon wasn’t going to be a walk in the park. The project’s first detailed progress report gives a glimpse of Apple’s unique boot process, and the challenges it presents to getting another operating system to run on the hardware.
“The way they [Apple Silicon Macs] work is more akin to embedded platforms (like Android phones, or, of course, iOS devices), but with quite a few bespoke mechanisms thrown in. However, Apple has taken a few steps to make this boot process feel closer to that of an Intel Mac, so there has been a lot of confusion around how things actually work,” wrote Asahi’s founder and lead developer, Hector Martin.
Long road ahead
Prolific Linux porter Martin officially began work on the Apple Silicon port in January this year. His first target is the M1 Mac Mini, though he intends to eventually get Linux to run on all M1 macs.
The first big challenge, Martin writes, is the boot process of the M1 Macs, which he says is different from anything you’d find in the traditional Arm ecosystem. For instance, you cannot boot Apple Silicon Macs from external storage in the same way as you can on other computers.
So Martin set out to get a lay of the land to understand not just how the boot process works, but also how the partitions were laid out in the disk, and how this compares to a standard PC environment. Very thoughtfully Martin has documented his learnings in great detail on Asahi’s GitHub page.
Working with mainline
In terms of concrete progress, Martin has been able to use his knowledge of the boot process to write a custom bootloader named m1n1 that bridges the Apple peculiarities with the standard way of booting an OS on 64-bit ARM.
Asahi’s progress might appear slow, being as it is security startup Corellium have managed to get to a working Ubuntu desktop on top of the M1.
However, as Martin explains that his intention isn’t just to get Linux running on the M1, but to do so while upstreaming his work to the mainline Linux kernel, for everyone to benefit.
“Our approach is to upstream early, and work with the overall community from day 1. To this end, we have been working with the upstream Linux maintainers, and in fact several key Linux folks now hang around in the Asahi Linux IRC channels,” says Martin.
Via: The Register