Linux on Apple Silicon (ARM CPU)
Preface: why ARM?
ARM has always fascinated me as a CPU architecture (ISA). It is a more efficient RISC architecture than the common CISC x86. I believe complex optimization should be handled by the compiler, and everything else (source code, CPU ISA) should be left as simple as possible for compilers to handle due to how incredible they are at optimizing code. ARM is an efficient low-power architecture, meaning it will generally use less wattage for a given task in a controlled environment compared to x86. This gives us multiple benefits:
Less power needed to complete a task, therefore better battery life
Less heat output, allowing most low and mid-range devices (such as laptops, phones, embedded devices, all-in-one computers) to be passively cooled with only a heatsink and no CPU fan
Due to having no CPU fan, these devices use even less power, and can fit into smaller form factors
On the workstation/server side, smaller power use is often paramount
Unfortunately, today in 2024 most ARM desktop/laptop solutions use low-range mobile chips (mostly from Qualcomm) which aren't well suited for much desktop use aside of web browsing. In 2020, Apple switched all their modern Macintosh series computers to an in-house ARM-powered platform, the first generation of which was the M1-series. The M1 is a much more powerful CPU than most off-the-shelf ARM chips, making it a suitable competitor to x86 in the desktop/laptop market.
Not long after Apple released the first M1 computers, an effort to port the Linux kernel to Apple Silicon had started. Asahi Linux is a project that focuses on making Linux usable on Apple Silicon (including the complex Mac boot process, reverse-engineered 3D-accelerated GPU drivers) and they have made incredible progress in just years. The Asahi kernel is, in my experience, nearly as stable as a regular x86 computer running Linux.
Installing Linux on an M1 MacBook
Debian GNU/Linux can be installed via booting into Recovery Mode and running a Bash script which will partition and install a headless version of Debian with the m1n1 bootloader (special shim bootloader for initializing Apple Silicon hardware and then loading U-Boot or GRUB). Thereafter, GRUB can be used to boot into the headless Debian, after which network settings are configured, a standard user account can be made, and a Desktop Environment (such as GNOME or KDE) can be installed.
Bash terminal on MacBook Recovery Mode
Debian for M1 net-installer loaded via curl
Debian now appears among the boot options in Recovery Mode
After installing the KDE desktop environment
The Results
From the GRUB bootloader to the KDE desktop in seconds
systemd reports a total boot time of 1.5 seconds for the vanilla install, an exceptional record
This is the M1 Mac running Debian today as a daily driver with remarkable computing power and outstanding battery life
An additional benefit of many ARM devices is the big.little architecture, where rather than having multiple identical CPU cores like in x86 processors, the CPU will have multiple weak power-saving cores and multiple high-performance cores. In this case, there are 4 "ice" cores and 4 "fire" cores. Most of the time the computer is running, it will use only the "ice" cores to remain power efficient, however if a more power-intensive task is called upon, the kernel will assign a fire core to that process. In the above screenshot of htop, the ice cores are seen on the top left (enumerated 1-4) and the fire cores are seen on the top right (enumerated 5-8).