Porting operating systems to Apple Silicon is more difficult than migrating software
AppleInsider is supported by its audience and can earn commission as an Amazon Associate and Affiliate Partner on qualifying purchases. These affiliate partnerships do not influence our editorial content.
Working directly with Apple Silicon is a difficult task, advises a developer trying to port Linux to run natively on the M1 chip, Apple using a highly customized process to boot the Mac, different from the versions used by d ‘other 64-bit ARM systems.
In its introduction of Apple Silicon to developers, Apple provided assistance to developers to port their Intel-compatible applications to M1. For developers achieving more ambitious feats, such as porting Linux to Apple Silicon, the task is many times more difficult.
In a blog post on the Asahi Linux project, the team discusses their findings while trying to configure an alternate boot kernel on Apple Silicon systems. While most of the functionality has been implemented, the lack of support for a command to install a non-Apple kernel led to an attempt to document the system undocumented.
The main obstacle encountered was that Apple Silicon starts up differently from PCs and works “more like embedded platforms” like Android or iOS devices. There are some differences and a few “tailor-made mechanisms” are used, although Apple has apparently made the boot process “closer” to an Intel Mac.
These differences lead to unexpected behaviors, such as the way Apple Silicon Macs handle booting from external storage. It has also been found that the bootloader cannot display a graphical user interface, and the “Boot Chooser” is a “full screen macOS application, 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 for use as part of the startup process, in part because it is similar to the Apple Device Tree, which Apple Silicon uses. Apple Device Tree and the open DeviceTree standard are both based on the Open Firmware specification, which was used to start older PowerPC Macs.
However, the difference in binary format which cannot be easily converted automatically without high level details of what the data represents is a hurdle for the project to overcome. “Trying to unify Apple and Linux’s ideas on how device trees work would be a nightmare,” the project team says.
To resolve the issue, 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 take, which is based on a minimal environment originally designed to examine the Nintendo Wii’s security processor, the project began documenting Apple’s custom ARM instructions, system registers, and hardware like the Apple interrupt controller.
The Asahi Linux project joins another Corellium effort to port Linux to M1. In January, Corellium mentioned a similar non-traditional boot process and the use of a non-standard controller, as well as allegedly successfully booting Linux.
Working directly with Apple Silicon is a big leap in difficulty from the experience of porting Intel-based macOS applications to the chip.
On March 12, Adobe revealed that it had “smooth experience” converting Photoshop. Along with the initial support for Intel applications using Rosetta 2, the development team has partnered with Apple to refactor and implement features like Context Aware Fill to work with M1.
Praise was also offered for “Apple’s significant investment in the toolchain and developer experience,” things that teams bringing Linux to Apple Silicon just don’t have.
Stay up to date with all Apple news straight from your HomePod. Say “Hey, Siri, play AppleInsider” and you’ll get the latest AppleInsider podcast. Or ask your HomePod mini “AppleInsider Daily” instead and you’ll hear a quick update straight from our press team. And, if you’re interested in Apple-centric home automation, say, “Hey, Siri, play HomeKit Insider,” and you’ll be listening to our latest specialty podcast in just a few moments.