Repository navigation
kboot: M3 graphics on by default (J613, J615, J514S, J516S) - #18
Conversation
The M3 Airs (J613, J615) and the M3 Pros (J514S, J516S) now hand the
internal display and the GPU to the OS on every boot, as M1 and M2 Macs
do, with no boot.bin config line. Before, each switch had to be armed
by a chosen.<switch>=1 line that the boot package wrote into
/etc/m1n1.conf on a booted Mac, so a fresh image's first boot kept the
boot framebuffer and a disabled GPU node.
dt_set_m3_defaults() runs before dt_set_chosen() and puts each switch
in /chosen as "1" unless a config line set it already:
J613, J615 (T8122): asahi,t8122-dcp, asahi,t8122-gpu,
asahi,t8122-gpu-power-standin,
asahi,t8122-gpu-fuse-leakage
J514S, J516S (T6030): asahi,t6030-dcp, asahi,t6030-gpu
The Air set is the recipe the boot package wrote (stand-in power model
with this Mac's leakage fuse); asahi,t8122-dcpext stays off. The Pro
external display handoffs (t6030-dcpext, t6030-dispext) keep their own
lines. The root compatible must name both the SoC and the board; the
M3 Max (T6031) and every other board are untouched.
Each preparation first removes the defaults an earlier one added
(chosen_is_default marks them; any other kboot_set_chosen() of an entry
clears its flag), so a proxy re-preparation after a config change, or
with another device tree, never inherits an earlier default, and an
owner's later value is kept. A board gets all of its missing switches
or none: a short table or a failed allocation adds nothing, never half
of the Air recipe. kboot_set_chosen() now allocates the new value
before it touches the table, so a failure leaves an existing entry
(an owner's =0) exactly as it was. If any chosen entry could not be
stored this session (full table, failed allocation), an owner's =0
may be the one lost, so no default goes in at all (fail closed).
Turning it off: chosen.<switch>=0 in /etc/m1n1.conf still turns that
switch off, and chosen.asahi,m3-defaults=0 turns all of them off. Only
the switch changes: every check behind it (board, firmware,
reservations, PMP values, resources) still runs, and a failed check
still leaves the boot framebuffer and a disabled GPU node.
tests/python/test_m3_graphics_defaults.py runs dt_set_m3_defaults()
against real libfdt trees: the four boards, Max and other boards,
explicit =0 and =1, the master switch before and after a first
preparation, another device tree in the same process, an owner's later
value, a short chosen table, allocation failure at every step, a
failed overwrite of an owner's =0, an owner's =0 that could not be
stored (allocation and full table), and the
call order before every reader. test_payload_cpu_policy's chosen
harness declares the new flag.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Hardware test: M3 Pro 16" (J516S, T6030), 2026-10-26 One boot with a On that boot (kernel 7.2.11-lab7876c8e8-cc71):
The original Not tested on hardware: the M3 Air defaults (J613/J615, T8122), the M3 Pro J514S, and a fresh install's first boot. Those are covered by the offline tests only. Validation detail: the first baseline check ran on the original setup before anything was changed (boot 42fe01e7, up 1h46m). It failed only its kernel-fault check: the AOP co-processor firmware crashed 3.7 s into that boot, a known intermittent crash on this kernel that predates the test. GL, Vulkan, display and file checks all passed. The Mac was then rebooted once on the unchanged original. That boot had no faults and passed the baseline, and the test continued from there. Neither the candidate boot nor the restored boot had the AOP crash or any other fault. |
[Medium impact] The changes appear safe to merge; no new blocking issue was found. SummaryEnables default display and GPU handoff for J613, J615, J514S, and J516S.
No new actionable issues were found in the changes since the previous review. Tests and hardware boots were not run during this review.
|
Two cases let the M3 graphics defaults turn on against the owner's config. An owner's chosen.<switch>=0 could be lost before kboot saw it while the defaults still went in. payload.c keeps 16 chosen lines and ignored any more, and a line it could not read (no newline, a name or value too long) stopped the scan with the kernel already loaded. The scan now records a lost chosen line: chosen[] full, a chosen. line it cannot read, a line without '=' that took the next one into its name, or a stop at unknown data after the kernel or a config line. payload_run() then adds chosen.asahi,m3-defaults=0 after every other chosen line, so the defaults stay off. A chainloaded stage reads it after its own config, so they stay off there too. A new slot carries it, and nvme.adopt keeps its own. On the M3 Airs, chosen.asahi,t8122-dcp=0 no longer kept the GPU off. The boot package wrote the GPU lines only beside a display line of 1, but the defaults added them anyway. The Air's GPU switches now get a default only while its display switch is 1 or unset. The owner's own lines, a GPU line included, stay as written. The M3 Pro is unchanged. tests/python/test_m3_defaults_optout.py runs the real payload scan, payload_run()'s chosen handling and transfer loop, kboot and the T8122 GPU selector on the host, in plain and CHAINLOADING builds. Its 35 defect cases fail on 8f816ea and pass here; its 18 controls pass on both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8d71541 kept the M3 defaults off when the payload scan lost a config line, but a value the config set earlier still stood. With chosen.asahi,t8122-gpu=1, then lines that fill chosen[], then chosen.asahi,t8122-gpu=0, the =0 was dropped and the GPU started. payload_run() now boots and chainloads nothing when a config line is lost: a chosen. line past the end of chosen[]; a line of a variable m1n1 knows (chosen., chainload=, boot=, nvme.adopt=, display=, mitigations=, tso=) without its newline or with a name or value too long; such a line taken into the name of a line without '='; or a stop at unknown data after the kernel or a config line. The zero and img4 ends and the payload probes are unchanged. A chainloading stage 1 refuses before it chainloads, and stage 2 refuses on its own scan. The transfer loop also stops the boot when kboot_set_chosen() fails: that keeps the entry's old value, so a failed =0 left an earlier =1 in force. This replaces the chosen.asahi,m3-defaults=0 marker and its extra chosen[] slot. Explicit =1 lines and the Air display rule are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omacom/m1n1#18 gained two fixes after review. m1n1 no longer boots when it loses a config line, so an earlier chosen.<switch>=1 cannot stand in for a lost =0. On the M3 Airs, chosen.asahi,t8122-dcp=0 keeps the default GPU switches off again. Pin its head a1ab5ff0 (8f816ea8, 8d715414, a1ab5ff0). pkgver stays 1.6.1.aurora21-1, which was never published. build-qualification.json pins the new source and stays hardware_tested false; its checksum is updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
a1ab5ff refuses the boot when the scan stops at unknown data after a config line. check_var() was tried before the end check, so an img4 image after the config whose header bytes read as "=" and a newline (30 83 3d 0a ...) was taken as a junk line, the scan stopped inside the image, and the boot was refused although the end check matches it. Check for the zero and img4 ends right after the payload magic checks and before check_var(). Config text never starts with four zero bytes or carries the img4 magic at offset 5, so no config line changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scan prints a variable name as it finds it. Run against older sources, bytes after the config can print as a name that is not UTF-8, and the test then failed on decoding instead of on what the boot did. Decode with backslashreplace so it reports the outcome. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omacom/m1n1#18 added two commits after a1ab5ff0. The scan now sees the zero and img4 ends before it reads a config line, so an img4 header whose bytes look like a line no longer stops the boot; a test-only commit follows. Pin its head af6f0d62. pkgver stays 1.6.1.aurora21-1, never published; build-qualification.json pins the new source, stays hardware_tested false, and its checksum is updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
maralcbr
left a comment
There was a problem hiding this comment.
Reviewed at af6f0d62. Requesting changes on the opt-out fix; the Air fix is good.
Keep: the Air dcp=0 fix. rest_need_first (src/kboot.c:399–401, 470–475) applies only to T8122, an owner's chosen.asahi,t8122-dcp other than 1 keeps the default GPU switches off, and an owner's own GPU lines stay. That matches what omarchy-mac-boot used to write.
Change: lost config now refuses to boot on every Mac. config_lost (src/payload.c) is set on chosen overflow, an unreadable known line (no =, no newline, name > 64 or value > 1024), a line swallowing the next, or unknown data after the kernel/config, and payload_run() then boots and chainloads nothing (payload.c ~414). A kboot_set_chosen() failure now aborts too (~497). None of this checks the board, and it is compiled into the stage 1 (CHAINLOADING) build as well. Before this PR those inputs were skipped or ended the scan, and the Mac still booted. Now an M1/M2/M3/Neo owner gets "No valid payload found" and the proxy wait (main.c:193–227), and Linux does not boot until someone repairs it from another environment. That is a much bigger change than the M3 defaults need.
Please replace the boot refusal with a parser-loss flag that only suppresses the M3 defaults: set it wherever config_lost is set now, feed it into the existing chosen_lost gate in dt_set_m3_defaults(), and carry it from stage 1 to stage 2 (e.g. as a forwarded chosen variable), so a line stage 1 lost also keeps stage 2's defaults off. Everything else should boot as before.
Your counterexample stands: an earlier explicit gpu=1 survives a lost later gpu=0, and suppressing defaults doesn't remove it. If that case matters, scope it to the graphics switches (for example, drop explicit M3 graphics switches too when the loss flag is set) rather than refusing boot everywhere.
Two notes for the opt-out guarantee:
update-m1n1drops an unterminated last line. asahi-scriptsupdate-m1n1(20261023, lines 35–63) reads/etc/m1n1.confwithwhile read line, so a final line without a newline is never copied intoboot.bin. A lastchosen.asahi,m3-defaults=0typed without a trailing newline silently disappears and the defaults apply, with noconfig_losteither. This predates the PR, but the docs and theomarchy-mac-bootleaf (omacom/omarchy-mac-pkgs#70) should cover it, or the updater should read the last line too.- The overflow is closer than 16.
MAX_CHOSEN_VARSis 16 and theCHAINLOADINGbuild starts at 1 (payload.c:176–191). Stage 1 also forwards its own chosen variables (the stage 1 version and the ESP), and stage 2 counts lines, duplicates included, not unique names. So roughly 14 ownerchosen.lines already overflow stage 2.
Tests: test_m3_defaults_optout.py exercises extracted parts of payload_run() on a zero-filled buffer. Please add a case through the real chain: updater output → stage 1 chainload assembly (chainload.c:177–188 appends the forwarded variables) → stage 2 parse, with forwarded entries and an overflowing config. Check that the defaults stay off and the Mac still boots.
omacom/omarchy-pkgs#1676 and omacom/omarchy-mac-pkgs#70 stay held until this lands; #1676 needs a repin to the final merge commit.
a1ab5ff refused to boot or chainload on every Mac when the payload scan lost a config line. That was too broad: M1, M2, the Neo and stage 1 builds stopped in the proxy over a config only the M3 defaults need to distrust. The Macs boot again. On the four with M3 graphics defaults (J613, J615, J514S, J516S), a lost line now means no graphics handoff: no default goes in, and every graphics line of the board is dropped from /chosen, the owner's own =1 included, because a lost =0 may have followed it. They boot on the boot framebuffer. Other Macs keep their lines as before. The loss is sticky. The payload scan still finds it (a chosen line past the end of chosen[], an unreadable or swallowed line of a variable m1n1 knows, unknown data after the kernel or a config line); payload_run() hands it to kboot (kboot_set_config_lost()), and a failed kboot_set_chosen() sets the same flag. A chainloading stage 1 passes m1n1.config-lost=1 to stage 2 as its last line, in a chosen[] slot of its own, so a full chosen[] cannot keep it out. Stage 2 takes any m1n1.config-lost= line as a loss and nothing clears it. The test now runs the whole payload_run() with the real loaders (gzip through tinf, device tree ranking, the kernel loader), stage 1's chainload_image() loop and, when one is available, update-m1n1 itself. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
omacom/m1n1#18's a1ab5ff0 refused to boot every Mac when a config line was lost. 7ea16980 replaces that: the Macs boot, and on the four with M3 graphics defaults a lost line means no graphics handoff. Pin it. pkgver stays 1.6.1.aurora21-1, never published; build-qualification.json pins the new source, stays hardware_tested false, and its checksum is updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
maralcbr
left a comment
There was a problem hiding this comment.
Reviewed at 7ea16980. Approving: this addresses my changes request.
- Lost config no longer stops the boot. M1, M2 and the Neo behave as before (the stage 1 ESP-slot refusal is pre-existing at dcb5726).
- On J613/J615/J514S/J516S a lost line drops the board's graphics lines and adds no defaults, so they boot on the framebuffer. That also covers an earlier
=1surviving a lost=0. m1n1.config-lost=1from stage 1 gets its own slot; worst case is 16 + 1 + nvme.adopt = 18 of 18. An old stage 2 ignores it without using a chosen slot.- The Air
dcp=0fix is unchanged.
Nit, non-blocking: config_lost reaches kboot only inside the kernel && fdt branch (src/payload.c:509). If the payload fails and m1n1 falls back to proxy, a host's P_KBOOT_PREPARE_DT (proxy.c:434) still gets the defaults. Proxy skips the owner's chosen lines anyway, so only developers hit it; calling kboot_set_config_lost() right after the payload scan would close it.
Tracked separately: update-m1n1 (asahi-scripts) drops an unterminated last line before m1n1 sees it, as your test records.
Merging with a merge commit so the history stays as is; omacom/omarchy-pkgs#1676 gets repinned to the merge.
* m1n1-aurora: 1.6.1.aurora21 with the M3 graphics defaults Pin omacom/m1n1 8f816ea8 (integration/aurora dcb5726f plus omacom/m1n1#18). Its stage 2 hands the internal display and the GPU of the M3 Airs (J613, J615) and M3 Pros (J514S, J516S) to Linux on every boot, without chosen.asahi,* lines in /etc/m1n1.conf; chosen.<switch>=0 or chosen.asahi,m3-defaults=0 still turns them off. The M3 Max and other boards are unchanged. pkgver 1.6.1.aurora21 (pkgrel 1) sorts above 1.6.1.aurora20-4, and omarchy-mac-boot keys its M3 Air leaf on that version: from it on the leaf writes no switch lines. build-qualification.json pins the new source and stays hardware_tested false; its checksum is updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * m1n1-aurora: say the m1n1 provide follows pkgver The README still named m1n1=1.6.1.aurora20, but the PKGBUILD provides m1n1=$pkgver, now 1.6.1.aurora21. Describe it as the package's own pkgver, so the text cannot drift again on the next bump. Documentation only: the README is not a package source, so the PKGBUILD and every packaged file are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * m1n1-aurora: pin omacom/m1n1 a1ab5ff0 with the opt-out fixes omacom/m1n1#18 gained two fixes after review. m1n1 no longer boots when it loses a config line, so an earlier chosen.<switch>=1 cannot stand in for a lost =0. On the M3 Airs, chosen.asahi,t8122-dcp=0 keeps the default GPU switches off again. Pin its head a1ab5ff0 (8f816ea8, 8d715414, a1ab5ff0). pkgver stays 1.6.1.aurora21-1, which was never published. build-qualification.json pins the new source and stays hardware_tested false; its checksum is updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * m1n1-aurora: pin omacom/m1n1 af6f0d62, the reviewed #18 head omacom/m1n1#18 added two commits after a1ab5ff0. The scan now sees the zero and img4 ends before it reads a config line, so an img4 header whose bytes look like a line no longer stops the boot; a test-only commit follows. Pin its head af6f0d62. pkgver stays 1.6.1.aurora21-1, never published; build-qualification.json pins the new source, stays hardware_tested false, and its checksum is updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * m1n1-aurora: pin omacom/m1n1 7ea16980, graphics off instead of no boot omacom/m1n1#18's a1ab5ff0 refused to boot every Mac when a config line was lost. 7ea16980 replaces that: the Macs boot, and on the four with M3 graphics defaults a lost line means no graphics handoff. Pin it. pkgver stays 1.6.1.aurora21-1, never published; build-qualification.json pins the new source, stays hardware_tested false, and its checksum is updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Chris Kearney <chris@kearneymail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
We did a fresh install on a 13" M3 MacBook Air (J613), and the GPU and internal display came up on the first boot with no m1n1 config at all.
Not tested: J615, or other firmware versions. Thanks Chris, it's great to have this working out of the box. |
M3 graphics on by default (J613, J615, J514S, J516S)
The M3 MacBook Airs (J613, J615) and M3 Pro MacBook Pros (J514S, J516S) now hand the internal display and the GPU to Linux on every boot, as M1 and M2 Macs do. No
boot.binconfig line is needed.Until now each switch had to be armed by a
chosen.<switch>=1line, and the boot package wrote those lines into/etc/m1n1.confonly on a booted Mac. So a fresh image's first boot kept the boot framebuffer and a disabled GPU node. From reading the source, that matches the symptom reported on an M3 Air's first boot. We didn't inspect that image's bytes or first boot, so this isn't a proven root cause for that device.What changes
dt_set_m3_defaults()runs inkboot_prepare_dt()right beforedt_set_chosen(). It applies only when the root compatible names both the SoC and the board, and adds each missing switch to/chosenas"1":apple,t8122+apple,j613/apple,j615asahi,t8122-dcp,asahi,t8122-gpu,asahi,t8122-gpu-power-standin,asahi,t8122-gpu-fuse-leakageapple,t6030+apple,j514s/apple,j516sasahi,t6030-dcp,asahi,t6030-gpuomarchy-mac-bootwrote: the stand-in power model with this Mac's leakage fuse. Like that recipe, it adds the three GPU switches only while the display switch is 1 or unset.asahi,t8122-dcpextstays off.asahi,t6030-dcpext,asahi,t6030-dispext) keep their own lines.Turning it off
chosen.<switch>=0in/etc/m1n1.confturns that switch off.chosen.asahi,t8122-dcp=0also keeps the default GPU switches off, asomarchy-mac-boot's lines did. A GPU line the owner wrote still counts. For example,dcp=0withchosen.asahi,t8122-gpu=1starts the GPU without the stand-in power model.chosen.asahi,m3-defaults=0turns them all off.kboot_set_chosen()allocates the new value before it touches the table, so a failure leaves an existing entry, such as an owner's=0, as it was.When m1n1 loses a config line
If m1n1 loses a config line, the owner's
=0may be the line lost while an earlier=1still stands. So on these four boards, a lost line means no graphics handoff: no default goes in, and every graphics line of the board is dropped from/chosen, the owner's own=1included. A lost line no longer stops the boot; Linux starts on the boot framebuffer. On other Macs a lost line is handled as it was before this PR, and their lines are kept.m1n1 counts a line as lost when:
chosen.line doesn't fit;=takes such a line into its name;kboot_set_chosen()cannot store a line.The zero and img4 ends are checked first, so neither counts as a loss.
A chainloading stage 1 that loses a line passes
m1n1.config-lost=1to stage 2 as its last line, in a slot of its own, so a full table can't hold it back. Stage 2 takes any such line as a loss, and nothing after it clears it.Known limits. These are outside this PR:
update-m1n1(asahi-scripts) skips a last line without a newline, so m1n1 never sees it. This predates this PR. A one-line read-loop fix belongs in the updater, and the tests show it works./etc/m1n1.conflines live in stage 2'sboot.bin, which stage 2 parses itself.Review fixes
8f816ea8had two defects, found after it was marked ready:chosen.asahi,t8122-dcp=0no longer kept the GPU off.How the follow-up commits handled them:
8d715414: fixed the Air rule.a1ab5ff0toaf6f0d62: refused to boot whenever a line was lost. That was too broad: it stopped every Mac, M1, M2, the Neo and stage 1 included.7ea16980: replaces the refusal with the scoped rule above.No commit was rewritten.
Tests
tests/python/test_m3_defaults_optout.py: compiles the wholepayload_run()on the host with the real payload scan and loaders: gzip through tinf, device tree ranking and the kernel loader. It also uses kboot's chosen table,dt_set_m3_defaults()and the T8122 GPU selector.chainload_image()'s own loop.M1N1_TEST_UPDATE_M1N1points at anupdate-m1n1,boot.bincomes from running it.update-m1n1(b6f72e6c): 70 passed, plus the expected end-of-file failure.af6f0d62(refused boots) and 36 times on8f816ea8(graphics armed after a loss).tests/python/test_m3_graphics_defaults.py: coversdt_set_m3_defaults()against real libfdt trees, including the graphics drop after a loss and other boards keeping their lines.8f816ea8; all need aarch64 binutils.tests/run-*scripts passed is withdrawn.tests/run-kboot-gpu-g15.shreproducibly fails att8122-j613-standin-10on the unchanged kboot: M3 graphics on by default (J613, J615, J514S, J516S) #18 merge tree and on kboot: hand the J516C M3 Max display and GPU over by default #19; this inherited failure is retained separately. Them1n1-aurorarecipe's stage 1 and ESP stage 2 make lines build7ea16980with the same warnings as8f816ea8.Kernel
No kernel change is needed for these boards on their standard DTBs. linux-aurora
d13466ebalready starts the display and the GPU once m1n1 publishes the handoff:gate_requesteddefaults to true;The kernel's own off switches are unchanged:
apple_t6030_display.enable=0,apple_t8122_display.enable=0,asahi.t8122_start=0andnomodeset.Hardware (historical:
8f816ea8)On 2026-10-26, one J516S (M3 Pro 16") booted the
8f816ea8stage 2 fromm1n1-aurora1.6.1.aurora21-1(sha256c424f7d0…). The config trailer had not6030-dcp/t6030-gpulines.boot.binwas restored afterwards. The results comment has the details.No later commit has run on hardware. Not tested on hardware:
7ea16980, J613/J615, J514S, and a fresh install's first boot.Related
Merge order:
7ea16980. Repin_committo the merge if the history changes.🤖 Generated with Claude Code