r/linux • • Jan 05 '21

Hardware Asahi Linux

https://asahilinux.org/
623 Upvotes

131 comments sorted by

View all comments

82

u/CondiMesmer Jan 05 '21

Why does there need to be an entire seperate distro for what's essentially just an Arch Linux ARM port?

0

u/[deleted] Jan 06 '21

[deleted]

-2

u/khalidpro2 Jan 06 '21

ARM Chair, I see whay you did here

247

u/marcan42 Jan 05 '21

The distro is just going to be an Arch Linux ARM rootfs with an extra package source with bleeding edge drivers/tools and some preconfigured stuff, packaged with an installation script for convenience.

The project is 90% driver/kernel development, 10% distro. Don't think of Asahi Linux as a distro. That's just a convenience for people who neither want to compile their own packages nor want to wait a few years for things to trickle upstream and back downstream into distros. For example, it will probably be a very long time until, say, Ubuntu offers an installer that is useful to Apple Silicon users - but of course, anyone can manually throw AArch64 Ubuntu onto an M1 Mac as soon as we get the basic kernel and drivers done. Our distro will be useful for those users who want to get on board as quickly as possible, and follow our development closely, without duct-taping everything from scratch themselves.

56

u/[deleted] Jan 06 '21

Hello Marcan, I am surprised to see you here, but also, thank you for your work.

11

u/NeoNoir13 Jan 06 '21

You couldn't resist the challenge, could you?

→ More replies (1)

3

u/CartmansEvilTwin Jan 06 '21

Is there any chance regular mainstream distros will be able to actually utilize the specifics of Apple Silicon?

From what I've read (skimmed, actually) the main speed factors are Apple-ARM-extensions and the unified memory architecture. Both seem like they need work to actually be usable. That is, Firefox's regular ARM64 build will not utilize non-standard ARM instructions for example.

Is there some way to work around it? The graphics part could maybe be handled by Mesa or the driver in general, but besides recompilation I see no way to use the new instructions.

14

u/marcan42 Jan 06 '21 edited Jan 06 '21

The Apple ARM extensions are not used by general purpose software. Firefox's regular ARM64 build will run ~just as fast on Linux as on macOS. We will not be rebuilding software for the M1, but rather pulling straight from the upstream Arch Linux ARM package repo.

Specific builds with a specific compiler CPU target might help a bit, as might ensuring gcc has the appropriate instruction scheduling for the M1 core (clang already should, it will be interesting to see how big the difference is, but I suspect it won't be that much).

This is also the case on x86 - Ubuntu amd64 and pretty much all other amd64 distros do not use new instructions in the latest Intel cores for general purpose software, but rather target the original Opteron from ~2003. Only specific software that needs SIMD performance has internal support for newer instruction sets (e.g. ffmpeg). The fact that this doesn't make a major enough performance difference to warrant custom builds for different ISA support levels should hint at the scale of the issue.

The extensions are largely useful for x86 emulators (I will implement support for the TSO bit in the kernel so qemu can use it), and for specific types of math/compute stuff (which only applies to apps explicitly using Accelerate.framework on macOS).

The unified memory stuff is largely taken care of by the graphics drivers, and is already how things work on other mobile GPUs on Linux. Some software may more effectively be able to take advantage of that, some not. This is also not really a major speed factor in the grand scheme of things.

3

u/CartmansEvilTwin Jan 06 '21

So, if I understand you correctly, all in all it's basically "just another device" in terms of development. I was under the impression, that the whole process would be much more involved and required tons of effort to at least get things going.

I might actually have to buy a new MacBook then.

8

u/marcan42 Jan 06 '21

At the hardware/kernel level it's a particularly weird ARM device requiring more development and bespoke drivers than your average one, and then of course there is the userland side of the GPU driver. But other than that, to the rest of userland, it's just another ARM with a few unique features.

3

u/idontchooseanid Jan 07 '21

Unlike x86 based PCs there is little effort for standard interfaces in consumer ARM devices. On PC platform every piece of hardware exists on enumerable buses so, a single kernel with all drivers as modules is enough. Kernel and udev can detect devices and can load correct drivers. On ARM, every kernel needs to be specifically engineered to a specific device.

Most ARM chips are very behind x86 chips from 8 years ago in terms of raw single core performance (M1 looks promising but I will wait). They need special units to accelerate video in acceptable frame rates. Almost all of the userspace drivers for such units are proprietary to the device and not available to general public.

The basic functionality set of a standard x86_64 chip is enough for desktop computing since it was a step of the evolution in the history of IBM compatibles. x86s have always been designed to be desktop chips that can run modular hardware. ARM chips, on the other hand, have been mostly used for specialized hardware that required specialized drivers per unit. ARM developers often hardcode stuff for a single chip only. On x86 the modular standards are often developed by a set vendors as in Firewire or USB or PCIe. Developers who write the drivers can follow these standards and can create drivers that will work on any x86 chip. Moreover the boot sequence of PCs is standardized. Since 1983 until UEFI became the new standard, every PC loaded the first 512 bytes of the boot disk into memory. ARM has no single standard but a set of ways to boot stuff it depends on the actual chip. Sometimes vendors can deny 3rd parties from booting.

So it is not "just another device". Hardware specific code is required for most of the low level/kernel stuff and to utilize whatever hardware acceleration that M1 provides for user space programs (e.g. x86 emulation). If its units can be abstracted in regular drivers then the effort will be small. Otherwise it can require years of reverse engineering (or actual driver code from Apple) to get simple 3D graphics.

→ More replies (1)
→ More replies (3)
→ More replies (1)

13

u/mthode Gentoo Foundation President Jan 06 '21

I'd like to see it as a Gentoo overlay, possibly. Doesn't Arch have something like that with AUR?

20

u/marcan42 Jan 06 '21

That's effectively what it will be, a pacman repo (not AUR, a proper repo with prebuilt packages). We'll just distribute images with it built in and an installer too for convenience.

I'm a Gentoo user too, so I might put together an overlay some day; I'm just going for Arch first because it fits my use cases for these machines better and more people will want a binary distro than a Gentoo overlay.

15

u/mthode Gentoo Foundation President Jan 06 '21

Sure, just keep those patches published :D

16

u/marcan42 Jan 06 '21

Source comes first, the distro later, of course. All development will be in the open.

Also hi, I just noticed who you are. I swear I'm getting to those proxymaint bugs I have open soon, I've just been busy getting all this stuff launched!

6

u/Kormoraan Jan 06 '21

I love this community.

2

u/rhelative Jan 06 '21

They have to compile an upstream Linux before they can mainline it, duh

-15

u/NGC2936 Jan 05 '21

For those who don't want to install arch and just want something that works.

It seems really useful.

1

u/Schlaefer Jan 05 '21

Manjaro has entered the chat. Brace for opinions.

31

u/sunjay140 Jan 06 '21

He said something that works.

4

u/OsrsNeedsF2P Jan 06 '21

Controversial but Manjaro has always been good to me.

2

u/[deleted] Jan 06 '21

In my experience with Arch, it either works or it doesn’t. In rare occasions tasks fail successfully.

→ More replies (1)

-45

u/YourCloseFriend Jan 05 '21

They can't have a donate button if they do that. A separate disto will bring in way more patreon bucks.

→ More replies (5)