Working with Apple Silicon directly is a difficult task, advises a developer trying to port Linux to run natively on the M1 chip, and Apple uses a highly custom process to boot the Mac that is different from the versions used by other systems. 64-bit ARM.
At its Apple Silicon presentation to developers, Apple assisted developers in migrating their Intel-compatible applications to M1. For developers performing more ambitious feats, such as moving Linux to Apple Silicon, the task is several times more difficult.
In a blog post on the Asahi Linux project, the team discusses their findings when trying to configure an alternate 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 it faced was that Apple Silicon boots differently from PCs and works “more like embedded platforms” like Android or iOS devices. There are differences and some “custom mechanisms” in use, although Apple apparently made the boot process “feel closer” to an Intel Mac.
These differences result in some unexpected behaviors, such as the way Apple Silicon Macs handles booting from external storage. It was also discovered that the boot loader cannot display a graphical user interface and that the “Boot Selector” is a “full screen macOS application, not part of the boot loader”.
The developers believe that the boot process “is not based on any existing standards” and instead uses “a mechanism from Apple as it has slowly evolved since the early days of iOS.”
DeviceTree was selected to be used as part of the boot process, in part because it is similar to the Apple Device Tree, which is used by Apple Silicon. Both Apple Device Tree and the open DeviceTree standard are based on the Open Firmware specification, which was used to boot older PowerPC Macs.
However, the difference in the binary format that cannot be easily converted automatically without high-level details on what the data represents is an obstacle that the project must cross. “Trying to unify the ideas of Apple and Linux about how device trees should work would be a nightmare,” says the project team.
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 socket, which is based on a minimal environment originally created to examine the Nintendo Wii’s security CPU, the project has begun documenting Apple’s custom ARM instructions, system registers, and hardware like the Apple Switch 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 use of a non-standard driver, as well as supposedly managing to boot Linux.
Working directly with Apple Silicon is a huge leap in the difficulty of the experience of porting Intel-based macOS applications to the chip.
On March 12, Adobe revealed that it had a “smooth experience” with the Photoshop conversion. Along with initial Intel application support using Rosetta 2, the development team partnered with Apple to refactor and implement features like Context Aware Fill to work with M1.
Also praised was Apple’s “significant investment in the toolchain and developer expertise,” elements that teams bringing 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 the latest AppleInsider podcast. Or ask your HomePod mini “AppleInsider Daily” instead and you’ll hear a quick update straight from our news team. And, if you’re interested in Apple-centric home automation, say “Hey Siri, play HomeKit Insider” and you’ll hear our new specialized podcast in a few moments.