Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions mac-manual/content/10-boot.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ There is one kernel, `linux-aurora`, built in omarchy-pkgs from a pinned commit
The initramfs is systemd-based. Omarchy sets the platform's baseline of mkinitcpio hooks, and `omarchy-mac-boot` adds Apple fragments on top, in order, rather than overwriting it. The fragments only apply on an Apple Silicon Mac:

- `MODULES` entries for the Apple keyboard and trackpad drivers, added only when the running kernel really has them as modules, so a kernel that builds a driver in does not break a later `mkinitcpio -P`;
- `apple_pmp`, the power management coprocessor's driver, on the same terms, so an encrypted root does not wait 20 seconds for it before the passphrase prompt;
- a vendor firmware service that copies Apple firmware onto the root, and a second copy before `cryptsetup-pre.target` on encrypted Macs, so Wi-Fi and input work at the passphrase prompt;
- a Plymouth drop-in, so the passphrase prompt is graphical;
- the `kmod-static-nodes` ordering fix that btrfs roots need on Apple hardware.
Expand Down
12 changes: 12 additions & 0 deletions mac-manual/content/12-hardware.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ Everything below the desktop is the Asahi Linux project's work, and the authorit
- [M2 feature support](https://asahilinux.org/docs/platform/feature-support/m2/)
- [Overview across chips](https://asahilinux.org/docs/platform/feature-support/overview/)

### M3 MacBook Air (edge testers)

M3 Macs are not part of the first release. On an M3 MacBook Air installed from an edge image, the native display needs the line `chosen.asahi,t8122-dcp=1` in `/etc/m1n1.conf`, and a fresh install writes it when its `m1n1-aurora` is 1.6.1.aurora20-4 or newer. An M3 Air installed before that keeps its old boot setup. Once `pacman -Q m1n1-aurora` reports 1.6.1.aurora20-4 or newer, add the line yourself, unless `/etc/m1n1.conf` already has one, and rebuild m1n1's boot image, then reboot:

```bash
grep -Eq '^[[:space:]]*chosen\.asahi,t8122-dcp=' /etc/m1n1.conf 2>/dev/null ||
printf '\nchosen.asahi,t8122-dcp=1\n' | sudo tee -a /etc/m1n1.conf
sudo update-m1n1
```

USB-C and DisplayPort external displays stay off on an M3 Air for now, since the line hands over only the built-in one. With an older `m1n1-aurora`, 1.6.1.aurora20-3 included, the line black-screens the Mac at boot. If that happens, remove it from `/etc/m1n1.conf` and run `sudo update-m1n1` again from a shell on this install that doesn't need the display, such as SSH if you set it up beforehand.

Anything marked work in progress there, Thunderbolt device support among them, is work in progress here too. The Aurora kernel adds the display, camera and USB4 work described above.

## Reporting a problem
Expand Down
6 changes: 5 additions & 1 deletion omarchy-mac-boot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ While first boot keeps the splash up, a laptop with its lid open shows it on the

The Limine menu is Omarchy's, timeout and quiet mode included: `setup/limine-boot.sh` keeps the template's, and `/usr/lib/omarchy/mac-boot/limine-menu-defaults` gives a menu that still carries the `timeout: 3` earlier Mac activations wrote the template's timeout and `quiet:` line, leaving any other menu to Omarchy's migrations. U-Boot keeps EFI variables the OS sets at runtime in RAM (`EFI_RT_VOLATILE_STORE`): `omarchy-mac-efi-vars.service` writes them to the variable file U-Boot names (`RTStorageVolatile`, from `VarToFile`) as the Mac shuts down, so `systemctl reboot --boot-loader-menu`, `bootctl` and `efibootmgr` changes reach the next boot as on x86. It does nothing where U-Boot names no file. multi-user.target pulls it in only from the next boot, so the recipe's scriptlet starts it on install and upgrade, and on upgrade also runs `limine-menu-defaults` on the live menu, since activation does not run again.

The implementation was moved from runtime integration `e82fe3c8850b184dfa22eefd571646ad85446122`, preserving Marcelo's provenance recorded in the runtime source-port ledger. The payload in `files/` comes from the boot recipe paired with #503 (omarchy-mac/omarchy-pkgs-aarch64#65 at `617a907f99a1`) with maralcbr/omarchy-pkgs#202 applied (omarchy-mac-boot 20260921-10: the owner's keyboard layout and dock keyboards at the disk prompt). The owner wizard, recovery-slot operations, journal/retry handling and shared Limine menu/hash operations remain core code. Hardware setup reaches its setup leaves through `omarchy-lifecycle-dispatch setup-boot [image-first-boot]` (`entrypoints/setup-boot`: `setup/grub-console.sh`, then `setup/limine-boot.sh`, which on an image's first boot keys the image's identity-less Limine entry to the Mac's machine-id and asks for the deferred rebuild instead of building the UKI); the image builder sources them directly. `entrypoints/update-takeover <path>...` answers an update that wants to move aside files no package owns (the step 6 seam asks before it moves anything): read-only, it refuses the whole takeover when any path is the Mac's boot chain, `/usr/lib/initcpio` or pacman configuration, which its image and this package write, or an mkinitcpio file whose own `HOOKS` carry the `asahi` or busybox `encrypt` hook (a legacy Mac's unlock), and lets anything else go, including the memory, USB and mkinitcpio drop-ins omarchy-settings ships on aarch64 too. Owner provisioning, factory reset and `omarchy-drive-password` reach this package only through `omarchy-lifecycle-dispatch`, which runs the `entrypoints/` staged in `/usr/lib/omarchy/mac-boot` and fails on Apple Silicon when they are missing.
The implementation was moved from runtime integration `e82fe3c8850b184dfa22eefd571646ad85446122`, preserving Marcelo's provenance recorded in the runtime source-port ledger. The payload in `files/` comes from the boot recipe paired with #503 (omarchy-mac/omarchy-pkgs-aarch64#65 at `617a907f99a1`) with maralcbr/omarchy-pkgs#202 applied (omarchy-mac-boot 20260921-10: the owner's keyboard layout and dock keyboards at the disk prompt). The owner wizard, recovery-slot operations, journal/retry handling and shared Limine menu/hash operations remain core code. Hardware setup reaches its setup leaves through `omarchy-lifecycle-dispatch setup-boot [image-first-boot]` (`entrypoints/setup-boot`: `setup/grub-console.sh`, then `setup/limine-boot.sh`, which on an image's first boot keys the image's identity-less Limine entry to the Mac's machine-id and asks for the deferred rebuild instead of building the UKI, then `setup/m1n1-display.sh`); the image builder sources them directly. `entrypoints/update-takeover <path>...` answers an update that wants to move aside files no package owns (the step 6 seam asks before it moves anything): read-only, it refuses the whole takeover when any path is the Mac's boot chain, `/usr/lib/initcpio` or pacman configuration, which its image and this package write, or an mkinitcpio file whose own `HOOKS` carry the `asahi` or busybox `encrypt` hook (a legacy Mac's unlock), and lets anything else go, including the memory, USB and mkinitcpio drop-ins omarchy-settings ships on aarch64 too. Owner provisioning, factory reset and `omarchy-drive-password` reach this package only through `omarchy-lifecycle-dispatch`, which runs the `entrypoints/` staged in `/usr/lib/omarchy/mac-boot` and fails on Apple Silicon when they are missing.

On an M3 MacBook Air (`apple,t8122` with `apple,j613` or `apple,j615`), `setup/m1n1-display.sh` turns the native display on: it appends `chosen.asahi,t8122-dcp=1` to `/etc/m1n1.conf`, which update-m1n1 copies into `boot.bin`, and runs `update-m1n1` so the next boot has it. Only an `m1n1-aurora` at or above the leaf's `m1n1_t8122_dcp_minimum`, 1.6.1.aurora20-4 (omacom/m1n1#14, which reserves the external DCP firmware only on its own opt-in), hands the display over on that line; 1.6.1.aurora20-3 and older black-screen the Mac with it, so with an older `m1n1-aurora` the leaf writes nothing. The pkgrel is part of the minimum. An owner's own `chosen.asahi,t8122-dcp=` line, for either value, is kept, as are their other lines. If writing `m1n1.conf` or `update-m1n1` fails, `m1n1.conf` is put back byte for byte and the leaf warns without failing the setup. That keeps `boot.bin` matching unless `update-m1n1` failed after it had already moved the new `boot.bin` into place; the next update's boot check reports that. It runs only on a booted Mac (`/run/systemd/system`): setup-boot clears the environment, so `OMARCHY_MAC_IMAGE_BUILD` never reaches it, and a chroot (an image build's or an installer's) has no booted systemd. The other T8122 Macs are left alone. `setup-boot` runs at install and on a hardware rerun only, so an M3 Air installed before this does not get it on update (see the manual's hardware page).

`92-omarchy-mac-pmp.conf` adds `apple_pmp`, the power management coprocessor's driver, to the initramfs when the target kernel has it as a module. Without it an encrypted root waits out "PMP driver did not bind within 20000 ms" before unlock, since the module is still on that root.

## Device tree overlays

Expand Down
10 changes: 6 additions & 4 deletions omarchy-mac-boot/entrypoints/setup-boot
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
# omarchy-lifecycle-dispatch setup-boot [image-first-boot]. The platform setup
# leaf runs this at the end of hardware setup, before omarchy-mac's
# setup-system: the GRUB console settings, then the Limine activation on a Mac
# that opted in. On an image's first boot the Limine leaf asks for the boot
# rebuild the deferred setup does once after its last step, rather than
# building the UKI itself. Both leaves re-check the platform.
# that opted in, then the M3 Air display default in m1n1.conf. On an image's
# first boot the Limine leaf asks for the boot rebuild the deferred setup does
# once after its last step, rather than building the UKI itself. Every leaf
# re-checks the platform.

set -euo pipefail

Expand All @@ -18,7 +19,7 @@ if (( EUID == 0 )); then
# Root takes nothing from its caller's environment.
exec /usr/bin/env -i PATH=/usr/local/sbin:/usr/local/bin:/usr/bin OMARCHY_PATH=/usr/share/omarchy \
${1:+OMARCHY_IMAGE_BOOT_REBUILD=/var/lib/omarchy/image/boot-rebuild} \
/bin/bash -euo pipefail -c 'source "$1/grub-console.sh" || exit 1; source "$1/limine-boot.sh" || exit 1' setup-boot "$setup"
/bin/bash -euo pipefail -c 'source "$1/grub-console.sh" || exit 1; source "$1/limine-boot.sh" || exit 1; source "$1/m1n1-display.sh" || exit 1' setup-boot "$setup"
else
# Unprivileged tests stage the package under a fixture root.
root=${OMARCHY_MAC_BOOT_ROOT:-}
Expand All @@ -28,4 +29,5 @@ else
fi
source "$root$setup/grub-console.sh" || exit 1
source "$root$setup/limine-boot.sh" || exit 1
source "$root$setup/m1n1-display.sh" || exit 1
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# The power management coprocessor's driver, before the root is unlocked: an
# encrypted root otherwise waits out "PMP driver did not bind within 20000 ms"
# with apple-pmp.ko still on that root. Added only when modinfo names a module.
_omarchy_mac_pmp_path=$(modinfo -k "${KERNELVERSION:-$(uname -r)}" -F filename apple_pmp 2>/dev/null) &&
[[ $_omarchy_mac_pmp_path == /* ]] && MODULES+=(apple_pmp)
unset _omarchy_mac_pmp_path
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Operation = Upgrade
Target = etc/mkinitcpio.conf.d/90-omarchy-mac.conf
Target = etc/mkinitcpio.conf.d/91-omarchy-mac-encrypt.conf
Target = etc/mkinitcpio.conf.d/92-omarchy-mac-hid.conf
Target = etc/mkinitcpio.conf.d/92-omarchy-mac-pmp.conf
Target = etc/mkinitcpio.conf.d/93-omarchy-mac-plymouth.conf
Target = etc/mkinitcpio.conf.d/94-omarchy-mac-vconsole.conf
Target = etc/initcpio/install/*
Expand Down
83 changes: 83 additions & 0 deletions omarchy-mac-boot/setup/m1n1-display.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# The M3 Airs' native display: m1n1 hands the display coprocessor to Linux only
# when /etc/m1n1.conf sets chosen.asahi,t8122-dcp=1, which update-m1n1 copies
# into boot.bin. An m1n1 without its opt-in gate black-screens these Macs with it.
omarchy-hw-apple-silicon || return 0
[[ ${OMARCHY_MAC_IMAGE_BUILD:-} != "1" ]] || return 0
# setup-boot clears the environment, so only a booted systemd tells the leaf it
# is not in a chroot (an image build's or an installer's).
[[ -d ${OMARCHY_SYSTEMD_RUN:-/run/systemd/system} ]] || return 0

(
set -uo pipefail
# The first m1n1-aurora that reserves the external DCP firmware only on its
# own opt-in (omacom/m1n1#14, omarchy-pkgs#1564); 20-3 black-screens. Keep the pkgrel.
m1n1_t8122_dcp_minimum=1.6.1.aurora20-4
minimum_m1n1=${OMARCHY_M1N1_T8122_DCP_MINIMUM-$m1n1_t8122_dcp_minimum}
compatible=${OMARCHY_DEVICE_TREE_COMPATIBLE:-/proc/device-tree/compatible}
config=${OMARCHY_M1N1_CONF:-/etc/m1n1.conf}
key=chosen.asahi,t8122-dcp

machine=
[[ ! -r $compatible ]] || machine=$(tr '\0' '\n' <"$compatible")
m1n1_display_has() { [[ $'\n'$machine$'\n' == *$'\n'"$1"$'\n'* ]]; }

m1n1_display_has apple,t8122 || exit 0
# The M3 Airs (J613, J615); the other T8122 Macs' displays are untested.
m1n1_display_has apple,j613 || m1n1_display_has apple,j615 || exit 0
if [[ -z $minimum_m1n1 ]]; then
echo "m1n1-display: no m1n1-aurora with the T8122 display opt-in is known yet; leaving $config alone"
exit 0
fi
# pacman -Q also answers for a package that only provides the name.
name= installed=
read -r name installed < <(pacman -Q m1n1-aurora 2>/dev/null) || true
if [[ $name != "m1n1-aurora" || -z $installed ]]; then
echo "m1n1-display: m1n1-aurora is not installed; leaving $config alone"
exit 0
fi
# Fail closed: a comparison that cannot be made writes nothing.
if ! order=$(vercmp "$installed" "$minimum_m1n1" 2>/dev/null) || [[ ! $order =~ ^-?[0-9]+$ ]]; then
echo "m1n1-display: cannot compare m1n1-aurora $installed with $minimum_m1n1; leaving $config alone"
exit 0
fi
if (( order < 0 )); then
echo "m1n1-display: m1n1-aurora $installed predates the T8122 display opt-in ($minimum_m1n1); leaving $config alone"
exit 0
fi
# A line the owner wrote, for either value, is theirs to keep.
if [[ -r $config ]] && grep -Eq "^[[:space:]]*${key//./\\.}=" "$config"; then
exit 0
fi

staged=$(mktemp -d) || { echo "m1n1-display: could not stage $config; leaving it alone" >&2; exit 0; }
trap 'rm -rf "$staged"' EXIT
: >"$staged/new"
if [[ -e $config ]]; then
cp "$config" "$staged/original" && cp "$config" "$staged/new" ||
{ echo "m1n1-display: could not stage $config; leaving it alone" >&2; exit 0; }
# Keep a last line without its newline from swallowing ours.
[[ ! -s $staged/new || $(tail -c 1 "$staged/new" | od -An -c | tr -d ' ') == '\n' ]] || printf '\n' >>"$staged/new"
fi
printf '# omarchy-mac-boot: the M3 Air native display. Set it to 0 to keep m1n1 from handing it over.\n%s=1\n' "$key" >>"$staged/new"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These appends (and the newline one at :59) aren't checked, so a full /tmp installs m1n1.conf without the line, or with a truncated one, and still says "enabled". Not dangerous, but checking them before the install would keep the message honest. m1n1_display_failed is defined below, so a plain || { echo ...; exit 0; } works.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, fixed in #60 since this had merged. Every staging write is checked now, and a failure leaves m1n1.conf alone and says "could not stage". The test caps the file size so the copy fits and the appends don't, with and without a trailing newline, and m1n1.conf comes back byte for byte with nothing rebuilt.


# Put the original bytes back (install can unlink the file before copying).
m1n1_display_restore() {
if [[ -e $staged/original ]]; then
sudo install -m 0644 "$staged/original" "$config"
else
sudo rm -f "$config"
fi
}
m1n1_display_failed() {
if m1n1_display_restore; then
echo "m1n1-display: $1; $config is back as it was, and the native display stays off" >&2

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"the native display stays off" isn't true when update-m1n1 failed after moving the new boot.bin into place. Same softening as the README?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also in #60: it now says boot.bin is unchanged unless update-m1n1 failed after replacing it, matching the README.

else
echo "m1n1-display: $1, and $config could not be put back; the next update-m1n1 takes its $key line" >&2
fi
exit 0
}
sudo install -D -m 0644 "$staged/new" "$config" || m1n1_display_failed "could not write $config"
# boot.bin only takes m1n1.conf when update-m1n1 builds it.
sudo update-m1n1 || m1n1_display_failed "update-m1n1 failed"
echo "m1n1-display: enabled the native display in $config"
)
Loading
Loading