Working with Apple Silicon directly is a tough task, a developer attempting to port Linux to run natively on the M1 chip advises, with Apple using a highly customized process to boot the Mac that is different from versions used by other 64-bit ARM systems.
In its introduction of Apple Silicon to developers, Apple has provided assistance to developers to port their Intel-compatible apps over to M1. For developers performing more ambitious feats, such as porting Linux over to Apple Silicon, the task is multiple times harder.
In a blog post about the Asahi Linux project, the team discusses its findings in trying to set up an alternative boot kernel on Apple Silicon systems. While most of the feature has been implemented, the lack of support for a command that allows the installation of a non-Apple kernel led to an attempt to document the undocumented system.
The main hurdle faced was that Apple Silicon boots differently from PCs, and works "more akin to embedded platforms" like Android or iOS devices. There are differences and a "few bespoke mechanisms" in use, though Apple apparently made the boot process "feel closer" to an Intel Mac.
These differences result in some behaviors that were unexpected, such as how Apple Silicon Macs handles booting from external storage. It was also found the bootloader cannot show a graphical user interface and that the "Boot Picker" is a "full-screen macOS app, not part of the bootloader."
The developers believe the boot process is "not based on any existing standard" and instead uses "a bespoke Apple mechanism that has slowly evolved from the early days of iOS."
DeviceTree was selected to be used as part of the boot process, in part because it is similar to Apple Device Tree, which Apple Silicon uses. Both Apple Device Tree and the open DeviceTree standard are based on the Open Firmware specification, which was used for booting older PowerPC Macs.
However, the difference in binary format that cannot be easily converted automatically without high-level details about what the data represents is a hurdle for the project to cross. "Trying to unify Apple's and Linux's ideas of how device trees should work would be a nightmare," the project team claims.
To solve the problem, the team worked on "m1n1," a bootloader for Apple Silicon to "take care of as many Apple-isms' as possible" for anyone developing their own Linux or other OS ports. Using the took, which is based on a minimal environment originally made to examine the Nintendo Wii's security CPU, the project has started to document Apple's custom ARM instructions, system registers, and hardware like the Apple Interrupt Controller.
The Asahi Linux project joins another effort by Corellium to port Linux to M1. In January, Corellium mentioned a similar untraditional boot process and the use of a non-standard controller, as well as allegedly managing to boot Linux.
Directly working with Apple Silicon is a big jump in difficulty from the experience of porting Intel-based macOS apps over to the chip.
On March 12, Adobe revealed it had a "smooth experience" in converting Photoshop over. Along with initial Intel app support using Rosetta 2, the development team partnered with Apple to refactor and implement features such as Context Aware Fill to work with M1.
Praise was also offered for Apple's "significant investment in the developer toolchain and experience," elements that teams porting Linux to Apple Silicon simply do not have.
Stay on top of all Apple news right from your HomePod. Say, "Hey, Siri, play AppleInsider," and you'll get latest AppleInsider Podcast. Or ask your HomePod mini for "AppleInsider Daily" instead and you'll hear a fast update direct from our news team. And, if you're interested in Apple-centric home automation, say "Hey, Siri, play HomeKit Insider," and you'll be listening to our newest specialized podcast in moments.
30 Comments
That's why I cannot use M1 Macs for work. I must have Intel compatibility to run VMs at near native speed. Unfortunately, I will have to buy Intel laptop.