What must be done to bring Linux to the Apple M1 chip – ZDNet

Everyone loves Apple's new M1 chip Macs. Even Linux's creator Linus Torvalds has said "I'd absolutely love to have one if it just ran Linux." And, recently, Hector Martin, a Tokyo-based IT security consultant and hacker, is leading the crowd-funded Asahi Linux project to bring the Arch Linux distro to Apple's ARM-based M1 architecture. But, in an e-mail interview, Greg Kroah-Hartman (gregkh), the Linux kernel maintainer for the stable branch and leader of the Linux Driver Project, said Asahi's programmers will face "lots of work in figuring out the hardware connected to the CPU (i.e.driver stuff)."

Why would that be so hard you ask? Doesn't Linux run on almost every processor in the world from 80386s to IBM s390x to SPARC? Hasn'tLinux been running on the ARM family since 1995? Yes and yes. But, in earlier cases, Linux developers had access to the chip's firmware, microcode, and documentation. That's not the case with the M1.

Torvalds would love to run Linux on these next-generation Macs. "I've been waiting for an ARM laptop that can run Linux for a long time. The new Air would be almost perfect, except for the OS. And I don't have the time to tinker with it, or the inclination to fight companies that don't want to help."

In an interview, Torvalds told me, "The main problem with the M1 for me is the GPU and other devices around it because that's likely what would hold me off using it because it wouldn't have any Linux support unless Apple opens up."

Apple isn't opening up. So, Linux developers have to do it the hard way. And the hard way is really hard.

Even gregkh, who's long been the Linux driver developer leader, finds the M1 daunting:

"I'm not going to lay out all of the individual things that need to happen here, as the people involved should already know this (hopefully). It's no different from porting Linux to any other hardware platform where we already have CPU support for it. People do it all the time, but usually, they do it with the specs for how the hardware works. Here no one seems to have specs, so it will take a lot more effort on their part."

Can it be done? Sure. The M1 starts from a well-known architecture.

Fortunately, Asahi has Alyssa Rosenzweig to help with the port. Rosenzweig has been working with Collabora on Panfrost, a free and open-source graphics stack for Android Arm Mali GPUs. Her work with these proprietary GPUs will serve her in good stead in dealing with M1's built-in GPU.

Rosenzweig has already been successful in some M1 reverse engineering. While macOS has open-source roots in the BSD Unix variant Darwin and some open-source code, that's not as much help as you might think.

Rosenzweig explained that, for example, "While the standard Linux/BSD system calls do exist on macOS, they are not used for graphics drivers. Instead, Apple's own IOKit framework is used for both kernel and userspace drivers, with the critical entry point of IOConnectCallMethod, an analog of ioctl." In short, no one's porting Linux to this processor over the weekend, or possibly this year.

But it's not impossible either. Martin said: "Apple allows booting unsigned/custom kernels on Apple Silicon macs without a jailbreak! This isn't a hack or an omission, but an actual feature that Apple built into these devices. That means that, unlike iOS devices, Apple does not intend to lock down what OS you can use on Macs (though they probably won't help with the development)."

No, no they won't. But, let us, with gregkh, wish Rosenzweig, Martin, and the rest of the Asahi Linux crew good luck. Macs have long been popular with Linux users. With some luck and a lot of hard work, Linux users may eventually run their favorite operating system on the next-generation of their favorite Apple hardware.

Link:

What must be done to bring Linux to the Apple M1 chip - ZDNet

Related Posts
This entry was posted in $1$s. Bookmark the permalink.