Even though the M1 and M2 chips in modern Macs are based on ARM processor designs, they aren't like any other ARM designs. That has made porting Linux to new Macs a difficult challenge, but there has been some impressive progress recently.

Much of the work around porting desktop Linux to Apple Silicon (M1 & M2) Mac computers has been under the Asahi Linux project, which already offers a desktop distribution that can boot natively on many models. Even though Linux has supported ARM chips for years, largely due to Google's use of Linux for the Android kernel and devices like the Raspberry Pi, making everything work on Apple Silicon has been a challenge.

Related: Apple M1 vs. M2: What's the Difference?

The core operating system and desktop experience has been working on Asahi Linux for a while now, so some developers have moved onto proper graphics support. Alyssa Rosenzweig helped reverse engineer the GPU in the M1 chip to create a user space driver, based on documentation work by Dougall Johnson. However, a kernel-level driver was still missing -- a task taken up by VTuber Asahi Linya.

Asahi Lina explained in a blog post, "just like other parts of the M1 chip, the GPU has a coprocessor called an "ASC" that runs Apple firmware and manages the GPU. This coprocessor is a full ARM64 CPU running an Apple-proprietary real-time OS called RTKit... and it is in charge of everything! It handles power management, command scheduling and preemption, fault recovery, and even performance counters, statistics, and things like temperature measurement! In fact, the macOS kernel driver doesn't communicate with the GPU hardware at all."

Screenshot with Xonotic, a Terminal window, and the KDE desktop
Asahi Linux

Through much trial and error, Asahi Lina developed an M1 GPU driver for the Linux kernel, written in the Rust programming language. Last month, it became stable enough to run the GNOME desktop environment in the Wayland compositor, and ongoing work on the kernel and user drivers allows some games to work, including the classic shooter Quake. The blog post mentions, "since the GPU power management is handled by the firmware, all that just works. I tested Xonotic at 1080p inside a GNOME session, and the estimated battery runtime was over 8 hours!"

It will still be a few weeks (or months) before the new GPU drivers are easily accessible to anyone trying Linux on an M1 or M2 Mac, but work is progressing at an impressive rate -- especially considering Apple hasn't documented most of its CPU and GPU architecture at all.

Source: Asahi Linux