Repository navigation
Turn on the M3 Air's native display, and load the PMP driver before unlock - #58
Conversation
m1n1 hands the display coprocessor to Linux on an M3 Air (T8122, J613 and J615) only when /etc/m1n1.conf sets chosen.asahi,t8122-dcp=1, which update-m1n1 copies into boot.bin. setup-boot's new last leaf, setup/m1n1-display.sh, appends that line and runs update-m1n1. With an m1n1-aurora that lacks the T8122 opt-in gate the line black-screens the Mac (m1n1-aurora 1.6.1.aurora20-3 does), so the leaf writes nothing below m1n1_t8122_dcp_minimum, a constant left empty until omarchy-pkgs publishes the fixed m1n1-aurora. An owner's own line for either value and their other lines are kept. A failed update-m1n1 puts m1n1.conf's original bytes back, so the boot check still matches boot.bin, and warns without failing the setup, which deferred image setup would otherwise retry every boot. It runs only on a booted Mac: 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. Other T8122 Macs are left alone. setup-boot runs at install and on a hardware rerun only, so the manual's hardware page tells existing M3 Air edge testers how to add the line once their m1n1-aurora has the fix. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
On an encrypted root, a kernel with apple_pmp as a module times out "PMP driver did not bind within 20000 ms" before the passphrase prompt, since apple-pmp.ko is still on the locked root. 92-omarchy-mac-pmp.conf adds apple_pmp to MODULES when modinfo names a module of the target kernel, the way 92-omarchy-mac-hid.conf adds the input drivers, so a built-in or missing driver never fails mkinitcpio. It is its own drop-in so it does not collide with #31's change to the input list, and the initramfs hook rebuilds when it changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
[Medium impact] No blocking code issues were found in the changes since the previous review. SummaryAdds the M3 MacBook Air display default and includes
|
maralcbr
left a comment
There was a problem hiding this comment.
Thanks @scottjones, gating the display line on the m1n1-aurora version and shipping it inert until omacom/m1n1#14 is packaged is the right way to land this. CI is green at 7ae9147, and omarchy-mac-boot/test/all passes for me in the CI Arch image: 236 ok, with all four display cases, the PMP drop-in and the setup-boot order. On the kernel side, apple_pmp is CONFIG_APPLE_PMP=m in linux-aurora's asahi.config:103, and the 20 s wait is pmp-report.c:752-758, so the drop-in targets the right module.
One fix before merge:
- The version gate fails open.
setup/m1n1-display.sh:38isif (( $(vercmp "$installed" "$minimum_m1n1") < 0 )). Ifvercmpfails or prints nothing, the arithmetic is a syntax error, theifis false and the leaf carries on and writes the line. That's the gate that keeps an older m1n1 from black-screening the Mac, so it should fail closed. Suggested fix:result=$(vercmp "$installed" "$minimum_m1n1") && [[ $result =~ ^-?[0-9]+$ ]] || { echo "m1n1-display: cannot compare m1n1-aurora $installed with $minimum_m1n1; leaving $config alone"; exit 0; }, thenif (( result < 0 )). Please add test cases with avercmpstub that fails and one that prints garbage.
Smaller things:
- Not every guard has a test that fails without it. The predicate stub always succeeds (
test/m1n1-display-test.sh:12), no case setsOMARCHY_MAC_IMAGE_BUILD=1, and the M2 case (:79) fails the board check as well as the SoC one, so removing the Apple predicate, the image-build guard or theapple,t8122check passes the suite. Could you add a failingomarchy-hw-apple-silicon, an image-build case, andapple,j613withoutapple,t8122? - Upstream fixtures. CONTRIBUTING asks for the copies omacom/omarchy keeps of the drop-ins to be updated with them, and
check-fixture-driftonly warns. Please open that PR for92-omarchy-mac-pmp.confand link it here. - A failed first write isn't rolled back. If
sudo installat:57fails, the leaf exits without puttingm1n1.confback, andinstallcan unlink the destination before it copies. Running the same restore as theupdate-m1n1branch would cover it.
Nits, fine as follow-ups:
:43: the.inchosen.asahiis a regex wildcard.grep -Eq "^[[:space:]]*${key//./\\.}="would make it literal.- README
:13says a failedupdate-m1n1leavesboot.binand the boot check in agreement. update-m1n1 can fail after it has moved the newboot.bininto place (unmounting the ESP, say), and then the restoredm1n1.confno longer matches. The next update's boot check catches it, so I'd soften the wording rather than change the code. - Manual
12-hardware.md:67appends without checking, so it duplicates on a second run and adds a second line after an owner's=0. Something likegrep -q '^chosen.asahi,t8122-dcp=' /etc/m1n1.conf || printf ...would avoid both. Once the minimum is known, the manual should name the version too. - The PR body says filling in the version "is the only change it needs".
test/m1n1-display-test.sh:80-81asserts the constant is empty, so that test changes in the same follow-up.
For release (not this merge): the PMP drop-in goes to every Mac's initramfs, so an encrypted cold boot on an M1 or M2 as well as the M3 Air before the omarchy-mac-boot release that carries it. The display line needs the plain and encrypted M3 Air cold boots you listed once the minimum is filled, including whether t8122-dcp=1 alone lights the panel.
With the vercmp fix in, this is good to merge from my side.
| echo "m1n1-display: m1n1-aurora is not installed; leaving $config alone" | ||
| exit 0 | ||
| fi | ||
| if (( $(vercmp "$installed" "$minimum_m1n1") < 0 )); then |
There was a problem hiding this comment.
If vercmp fails or prints nothing, this (( )) is a syntax error, the if is false and the line gets written. Please capture the result, check it's an integer, and exit 0 otherwise.
There was a problem hiding this comment.
Good catch, thanks. Fixed in 879ff9e: we capture the vercmp result, require an integer (negative included), and leave m1n1.conf alone with a message otherwise. The test now runs a vercmp stub that fails, one that prints garbage and one that prints nothing, and each writes nothing. Reverting the check makes those cases fail.
| exit 0 | ||
| fi | ||
| # A line the owner wrote, for either value, is theirs to keep. | ||
| if [[ -r $config ]] && grep -Eq "^[[:space:]]*$key=" "$config"; then |
There was a problem hiding this comment.
nit: the . in the key is a regex wildcard here; ${key//./\\.} makes it literal.
There was a problem hiding this comment.
Done in 879ff9e with ${key//./\\.}, plus a near-miss test (chosenXasahi,t8122-dcp=0 doesn't count as the owner's line).
| [[ ! -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" | ||
| if ! sudo install -D -m 0644 "$staged/new" "$config"; then |
There was a problem hiding this comment.
A failed install here exits without restoring m1n1.conf, and install can unlink the destination first. The restore from the update-m1n1 branch would cover it.
There was a problem hiding this comment.
Fixed in 879ff9e. A failed install now goes through the same restore as a failed update-m1n1: the original bytes go back, or the file is removed if there wasn't one. The test's sudo stub unlinks the target before failing, and m1n1.conf comes back byte for byte with no rebuild.
| machine apple,j504 apple,t8122 apple,arm-platform | ||
| check_untouched 'another T8122 Mac is left alone' | ||
| machine apple,j414c apple,t6021 apple,arm-platform | ||
| check_untouched 'an M2 Max is left alone' |
There was a problem hiding this comment.
This M2 case also fails the board check, so dropping the apple,t8122 check still passes. An apple,j613 without apple,t8122 would isolate it, and the Apple predicate and OMARCHY_MAC_IMAGE_BUILD=1 need cases of their own.
There was a problem hiding this comment.
Added in 879ff9e: a failing omarchy-hw-apple-silicon, an OMARCHY_MAC_IMAGE_BUILD=1 run, and apple,j613 on another SoC. We removed each guard in turn, and its case fails each time.
| 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 once its `m1n1-aurora` can use it. An M3 Air installed before that keeps its old boot setup. Once `pacman -Q m1n1-aurora` reports the version with the M3 display fix, add the line yourself and rebuild m1n1's boot image, then reboot: | ||
|
|
||
| ```bash | ||
| printf '\nchosen.asahi,t8122-dcp=1\n' | sudo tee -a /etc/m1n1.conf |
There was a problem hiding this comment.
nit: this appends on every run, and after an owner's =0 too. A grep -q '^chosen.asahi,t8122-dcp=' /etc/m1n1.conf || guard would avoid both.
There was a problem hiding this comment.
Done in 4444376: the step only adds the line when m1n1.conf has none, so a second run or an owner's =0 is left alone. We'll put the version in that paragraph when we fill in the minimum.
The version gate read `(( $(vercmp …) < 0 ))`: when vercmp failed or printed something other than a number, the arithmetic was an error, the if was false and the line was written, which black-screens a Mac whose m1n1-aurora predates the opt-in gate. The result is now captured and must be an integer; otherwise the leaf leaves m1n1.conf alone. A failed first write now restores m1n1.conf too, since install can unlink it before it copies, and the owner-line match takes the key's dot literally. Tests now fail without each guard: a vercmp that fails, prints garbage or prints nothing; a failing Apple predicate; an image build; a J613 board name on another SoC; a failed first write; and a near-miss key. From Marcelo's review of #58. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…tep idempotent update-m1n1 can fail after it has moved the new boot.bin into place, so restoring m1n1.conf keeps them matching only otherwise; the README now says so, and that the next update's boot check reports it. The manual's step for existing M3 Airs appended on every run and after an owner's =0; it now adds the line only when m1n1.conf has none. From Marcelo's review of #58. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Brings in #59 (save runtime EFI variables at shutdown, keep Omarchy's Limine timeout). The only conflict was omarchy-mac-boot/README.md: main's Limine paragraph and its provenance paragraph are kept as they are, with this branch's setup/m1n1-display.sh leaf added to the setup-boot list and its M3 Air display and apple_pmp paragraphs after them. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Thanks for the review. The vercmp fix and the guard tests are in 879ff9e, and the README wording and the manual step are in 4444376. The README now says a restored m1n1.conf keeps boot.bin matching unless update-m1n1 failed after it had moved the new boot.bin into place, and that the next update's boot check reports that case. On the PR body's "only change" line: you're right, filling in the minimum also flips the test that asserts it's empty. The body now says so. The fixtures PR for omacom/omarchy is ready and we'll open it and link it here once this merges, so the copy matches main. For release we'll do the encrypted cold boots on an M1 or M2 as well as the M3 Air for the PMP drop-in, and the plain and encrypted M3 Air boots once the minimum is set, including whether |
omarchy-pkgs#1564 packaged omacom/m1n1#14 as m1n1-aurora 1.6.1.aurora20-4, which reserves the T8122 external DCP firmware only with its own opt-in, so chosen.asahi,t8122-dcp=1 no longer black-screens an M3 Air. m1n1_t8122_dcp_minimum is that version, pkgrel included: 1.6.1.aurora20-3 is the black-screen build and compares lower only through its pkgrel. The test that asserted the constant was empty now asserts the version, and checks the packaged constant itself: 20-3 writes nothing, and 20-4, 20-10 and 21-1 write the line. The README and the manual's note for existing M3 Airs name the version, as Marcelo asked on #58, and the manual says external displays stay off. Reverting #1564 by re-pinning the old m1n1 commit would ship the black-screen build under a higher pkgrel, which passes this gate, so such a revert must also raise or empty m1n1_t8122_dcp_minimum. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
maralcbr
left a comment
There was a problem hiding this comment.
Thanks @scottjones, every point from my last review is in: the vercmp gate fails closed (failing, garbage and empty stubs), each guard has a case that fails without it, a failed first install restores, the key is escaped, the README wording is softened, and the manual step is idempotent. The minimum matches what omarchy-pkgs ships now (pkgver=1.6.1.aurora20, pkgrel=4, no epoch), and chosen.asahi,t8122-dcp is the key omacom/m1n1#14 reads. I also checked that mkinitcpio resolves KERNELVERSION before it sources mkinitcpio.conf.d, so modinfo -k in 92-omarchy-mac-pmp.conf looks at the target kernel, and -k none adds nothing. The comment line the leaf writes is skipped by update-m1n1.
Approving and merging. Follow-ups, none blocking:
- Staging appends aren't checked (
setup/m1n1-display.sh:59,61). If/tmpis full, the livem1n1.confgets no line or a truncated one and the leaf still says "enabled". It can't black-screen (update-m1n1 drops a line without=, and m1n1 needs"1"), but checking the appends and leaving the live file alone on failure would make the message honest.m1n1_display_failedis defined after them, so a plain|| { echo ...; exit 0; }is simplest. :73still says "the native display stays off" after a rollback, which isn't true when update-m1n1 had already moved the newboot.bininto place. Same softening as the README.- Downgrade/revert. With the line in place, a downgrade below 20-4, or the old m1n1 commit re-pinned under a higher pkgrel, black-screens the Air, and raising the minimum then only stops new lines. Worth a line in omarchy-pkgs' m1n1-aurora README so whoever touches that pin knows, and a decision on whether omarchy-mac-boot should
conflicts=('m1n1-aurora<1.6.1.aurora20-4'). - Installs from today's image (m1n1-aurora 20-3) never get the line, since setup-boot doesn't run again on upgrade. The next image build fixes new installs and the manual covers the rest; just flagging it for the edge testers' notes.
- Restore always writes mode 0644 rather than the original mode; fine for this file.
- Please open the omacom/omarchy fixtures PR for
92-omarchy-mac-pmp.confonce this lands and link it here.
For release, as you said: apple_pmp reaches every Mac's initramfs on upgrade through the alpm hook, so an encrypted cold boot on an M1 or M2, plus plain and encrypted M3 Air cold boots (including whether t8122-dcp=1 alone lights the panel), before the omarchy-mac-boot release that carries this.
| # 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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
| } | ||
| 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 |
There was a problem hiding this comment.
"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?
There was a problem hiding this comment.
Also in #60: it now says boot.bin is unchanged unless update-m1n1 failed after replacing it, matching the README.
|
The two notes are in #60. The m1n1-aurora README line about downgrades and re-pins is a good idea and we'll send it to omarchy-pkgs. We'd rather not add |
Brings in #58 (the M3 Air display default); no conflicts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ck leaves The appends that build the new m1n1.conf in the staging directory were unchecked, so a full /tmp installed m1n1.conf without the display line, or with part of it, and still reported it enabled. Each staging write now leaves m1n1.conf alone and says so. After a failed write or rebuild the message no longer promises the display stays off, since update-m1n1 may have replaced boot.bin before failing, matching the README. The manual says an M3 Air installed with an older m1n1-aurora, today's edge image included, has to add the line itself. From Marcelo's review of omacom#58. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Summary
A fresh install on an M3 MacBook Air (J613, J615) now gets its native display, and an encrypted M3 root no longer waits 20 s for the PMP driver:
The display line is written only when the installed
m1n1-aurorais at leastm1n1_t8122_dcp_minimum, 1.6.1.aurora20-4: older m1n1 (1.6.1.aurora20-3) black-screens an M3 Air with it, because it always reserves the external display controller's firmware and the internal one then crashes. 20-4 is omacom/m1n1#14, packaged in omarchy-pkgs#1564, which stops reserving that firmware by default (t8122-dcpext). The pkgrel is part of the minimum, since 20-3 and 20-4 share a pkgver. It writes onlyt8122-dcp=1, the internal display handoff, so USB-C displays stay off on M3 Airs for now. An owner's ownt8122-dcpline and their otherm1n1.conflines are kept, and a failed write orupdate-m1n1putsm1n1.conf's original bytes back and warns without failing the setup. That keepsboot.binmatching unlessupdate-m1n1failed after moving the new one into place, which the next update's boot check reports. It runs only on a booted Mac, never in an image build's chroot. Existing M3 Airs aren't migrated; the hardware page tells their owners how to add the line themselves once their m1n1-aurora is 1.6.1.aurora20-4 or newer.Evidence
t8122-dcp=1on m1n1-aurora 1.6.1.aurora20-3 it black-screens.After:
m1n1-display-test.sh: J613 and J615 get the line and oneupdate-m1n1, a rerun changes nothing, the packaged minimum (20-3 gets nothing; 20-4, 20-10 and 21-1 get the line), an older or missing m1n1-aurora, a vercmp that fails or prints garbage, an empty minimum, an image build's chroot, a non-Apple machine, a J613 name on another SoC, another T8122 Mac and an M2 get nothing, an owner's line wins, a failed write or rebuild restoresm1n1.confbyte for byte.mac-pmp-initramfs-test.sh:apple_pmpjoins only as a module of the target kernel.omarchy-mac-boot/test/all(244 ok),omarchy-mac/test/allandtest/integration/allpass.Merge Danger
Door: two-way
Boot-critical for M3 Airs. Follow-ups outside this repo:
check-fixture-driftwarns);t8122-dcp=1alone lights the panel is what the cold boot checks.Reverting omarchy-pkgs#1564 by re-pinning the old m1n1 commit would ship the black-screen build under a higher pkgrel, which passes this gate, so that revert must also raise or empty the minimum here. Nothing stops a later downgrade of m1n1-aurora below the minimum with the line in place, which would black-screen the Mac; whether the package should also require that m1n1-aurora is still open.
Blast Radius: M3 Airs (display); every Mac's initramfs gains
apple_pmpwhere it's a module🤖 Generated with Claude Code