This repo has been restructured and is now part of https://github.com/pipcet/pearl.
This is a bootloader for Linux on Apple M1 machines. The idea is to
keep what the actual bootloader does to an absolute minimum, and do as
much as possible in the Linux kernel, which then calls kexec()
to
load the real kernel.
Ordinary bootloaders follow the stay and play strategy, doing a lot of stuff like initializing hardware, having a frame buffer, and parsing and preparing device trees. M1lli follows the load and go strategy: jump into the kernel image with the minimum amount of fuss, telling it we don’t have a device tree yet (all we have are some Apple-specific boot args).
The name is inspired by m1n1.
The idea is that the initial kernel, which is all that we need to interact with MacOS for, will be stable enough so it doesn’t need to be flashed very often.
How small is the minimal bootloader code? My plan is to get it down to 68 bytes, which is all we need to realign an in-memory kernel image to the next 2 MiB boundary.
Stage | stage1 | stage2 | Linux | |
---|---|---|---|---|
SMP | no | no | yes | |
kernel modules | no | yes | yes | |
uses devicetree | no | yes | yes | |
writes devicetree | yes | no | no | |
kexec | yes | yes | no | |
can reboot | no | yes | yes | |
USB | no | sometimes | yes | |
keyboard | no | sometimes | yes | |
framebuffer | no | yes | yes | |
Stage | SMP | modules | uses DT | kexec |
stage1 | no | no | no | yes |
stage2 | no | yes | yes | yes |
Linux | yes | yes | yes | no |