Asahi's plan for Linux on Apple's new silicon shows Cupertino has gone back to basics with iOS booting

Open source project shows Apple has done some funky stuff with M1

The Asahi Linux project has published the first progress report detailing its effort to port Linux to the Apple Silicon platform.

The lengthy blog post describes in extensive detail the challenges faced by the project in understanding how Apple’s home-grown proprietary chippery works on a fundamental level, as well as the circumventing the various non-standard quirks that limit the ability to boot third-party operating systems.

The report, written by kernel hacker and Asahi Linux co-founder Hector Martin, unfortunately doesn’t conclude with a link to a fully working Linux distro. It does, however, illustrate how widely Apple Silicon-based Macs diverge from standards you might typically see.

The boot process, for example, isn’t what you’d expect to see on a conventional ARM64 system, but rather “a bespoke Apple mechanism” originating from the early days of iOS, with design elements derived from the Open Firmware specification as seen with the New World ROM Macs.

This has forced the Asahi Linux project to develop a bespoke bootloader for Apple Silicon machines called m1n1, which aims to take care of as many ‘Apple-isms’ as possible. But it’s a bit more than that.

The origins of m1n1 lie in mini, a project created by Martin as part of his research into jailbreaking the Nintendo Wii. While it supports the booting of third-party code, it also allows researchers to control the machine in real-time from a development computer. By using its interactive shell, or writing simple Python scripts, you can enumerate how the Apple Silicon processor works on a low, bare-metal level.

This has allowed the Asahi Linux team to identify features that are distinct to the Apple Silicon M1 processor, such as configuration bits designed to improve performance when running x86 code in Rosetta.

“Using m1n1, we’ve been hard at work documenting Apple’s custom Arm instructions, Apple-specific system registers, hardware such as the Apple Interrupt Controller, and more,” Martin wrote.

Asahi Linux logo

Crowdfunded Asahi project aims for 'polished' Linux experience on Apple Silicon


This enumeration came in handy because, as noted, Apple Silicon is a completely distinct and proprietary system. There is almost no documentation on how it works, and its behaviour diverges from other ARM64 chips.

Martin notes that when the chip idles, there’s a chance it may choose to “power gate,” which sees parts of the CPU switched off to reduce energy consumption. This has the nasty side effect of wiping the contents of registers, save for the stack pointer and program counter, causing Linux to crash.

Fortunately, the Asahi Linux team was able to identify a way to disable this particular functionality by providing a specific value to an Apple-proprietary hardware register, allowing their work to continue. Other “Apple-isms” that proved frustrating included a completely bespoke approach to exceptions and the system timer.

Reading the report, the biggest surprise about the Apple Silicon platform is how much of its lineage stems from older products. The boot process, as noted, is derived from that first used on iOS. The UART chip, used for serial communications, was made by Samsung – a company which, Martin notes, provided the SoC for the first iPhones. The I2C hardware was originally designed by now-Apple-owned PA Semi, with the design based on a PWRficient chip also used in the AmigaOne X1000.

This led to an unusual situation where an Amiga clone from 2010, running a derivative of an OS that reached its peak popularity in the late 1980s, played a role in documenting the internal machinations of the newest Macs.

Through painstaking investigative work, the Asahi Linux project has been able to bring a limited Linux environment to the Apple Silicon M1 platform. It’s far removed from being a workable, fully-fledged system, however. There’s no real display driver, for example, with the project instead using the basic firmware-provided framebuffer.

“As it is not a proper display driver, there is no way to change resolutions, handle display hotplug, or even put displays to sleep. It is sufficient for development and demos, but we will have to write a proper display controller driver in due course,” Martin wrote. Meanwhile, the GPU remains a black box, with reverse engineering work still in-process.

The Asahi Linux project isn’t the only effort to bring Linux to the Apple M1, with Corellium managing to boot a port of Ubuntu on the latest-and-greatest Mac Mini. This too is in early days, with support for graphics acceleration and networking conspicuously absent. ®

Similar topics

Other stories you might like

  • GPL legal battle: Vizio told by judge it will have to answer breach-of-contract claims
    Fine-print crucially deemed contractual agreement as well as copyright license in smartTV source-code case

    The Software Freedom Conservancy (SFC) has won a significant legal victory in its ongoing effort to force Vizio to publish the source code of its SmartCast TV software, which is said to contain GPLv2 and LGPLv2.1 copyleft-licensed components.

    SFC sued Vizio, claiming it was in breach of contract by failing to obey the terms of the GPLv2 and LGPLv2.1 licenses that require source code to be made public when certain conditions are met, and sought declaratory relief on behalf of Vizio TV owners. SFC wanted its breach-of-contract arguments to be heard by the Orange County Superior Court in California, though Vizio kicked the matter up to the district court level in central California where it hoped to avoid the contract issue and defend its corner using just federal copyright law.

    On Friday, Federal District Judge Josephine Staton sided with SFC and granted its motion to send its lawsuit back to superior court. To do so, Judge Staton had to decide whether or not the federal Copyright Act preempted the SFC's breach-of-contract allegations; in the end, she decided it didn't.

    Continue reading
  • US brings first-of-its-kind criminal charges of Bitcoin-based sanctions-busting
    Citizen allegedly moved $10m-plus in BTC into banned nation

    US prosecutors have accused an American citizen of illegally funneling more than $10 million in Bitcoin into an economically sanctioned country.

    It's said the resulting criminal charges of sanctions busting through the use of cryptocurrency are the first of their kind to be brought in the US.

    Under the United States' International Emergency Economic Powers Act (IEEA), it is illegal for a citizen or institution within the US to transfer funds, directly or indirectly, to a sanctioned country, such as Iran, Cuba, North Korea, or Russia. If there is evidence the IEEA was willfully violated, a criminal case should follow. If an individual or financial exchange was unwittingly involved in evading sanctions, they may be subject to civil action. 

    Continue reading
  • Meta hires network chip guru from Intel: What does this mean for future silicon?
    Why be a customer when you can develop your own custom semiconductors

    Analysis Here's something that should raise eyebrows in the datacenter world: Facebook parent company Meta has hired a veteran networking chip engineer from Intel to lead silicon design efforts in the internet giant's infrastructure hardware engineering group.

    Jon Dama started as director of silicon in May for Meta's infrastructure hardware group, a role that has him "responsible for several design teams innovating the datacenter for scale," according to his LinkedIn profile. In a blurb, Dama indicated that a team is already in place at Meta, and he hopes to "scale the next several doublings of data processing" with them.

    Though we couldn't confirm it, we think it's likely that Dama is reporting to Alexis Bjorlin, Meta's vice president of infrastructure hardware who previously worked with Dama when she was general manager of Intel's Connectivity group before serving a two-year stint at Broadcom.

    Continue reading

Biting the hand that feeds IT © 1998–2022