Skip to content

usb: Keep each iPad's USB serial number the same across boots - #110

Merged
henrikklee merged 1 commit into
OrchardLinux:mainfrom
brkosebay:j71t/usb-stable-serial
Nov 12, 2026
Merged

henrikklee merged 1 commit into
OrchardLinux:mainfrom
brkosebay:j71t/usb-stable-serial

Conversation

@brkosebay

@brkosebay brkosebay commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Part 7 of 23 of the iPad 5 (J71t) series in this repository; merge after #108.

Problem

The USB serial number changed between installed boots and RAM sessions, so the host saw a new device every boot and could not keep its SSH known_hosts entry or serial console name.

Change

Share one BOARD/hashed-ID serial format between installed boots and RAM sessions (usb-identity), and get the per-boot SSH identity through the existing ACM console. Documented in docs/device-protocol.md, with tests.

Testing

  • Hardware: iPad 5 Wi-Fi (J71t). Hands-on testing on 2026-11-11 with an integrated build of this series, made before the final failure-path fixes, covered USB serial and SSH across boots.
  • 2026-11-12: no further hardware test of this change beyond the above. The top of this series applies to the same kernel tree as the release build tested on J71t that day (20+ warm restarts without a freeze).
  • Host: the Linux test suite passes at this branch's head, and the kernel and m1n1 patch series apply on apple-16k and apple-4k. At the top of the series the applied kernel tree is identical to the one in the built release image.
  • Other boards that share these drivers or compatibles have not been tested.

Dependencies

Depends on #108.

This branch is stacked on the PRs it depends on and carries their commits; the change of this PR is its last commit, "usb: Keep per-device system and RAM serials stable across boots".

This update keeps the branch's earlier history: it merges the current base into the branch and adds the reworked change as a new commit on top.

🤖 Generated with Claude Code

@brkosebay brkosebay changed the title usb: keep per-device system and RAM serials stable across boots usb: Keep per-device system and RAM serials stable across boots Nov 12, 2026
henrikklee pushed a commit to brkosebay/hardware that referenced this pull request Nov 12, 2026
Installed systems and RAM payloads told the host a new USB serial
number on every boot (BOOT:<boot id>), so the Mac saw a new device each
time: macOS asked again whether to allow the accessory, and the serial
console got a new name. Both now use BOARD:<board> ID:<12 hex>, the ID
being SHA-256 over "orchard-" and the device-tree serial-number that
m1n1 copies from Apple's tree, so the hardware serial is not
published. A RAM payload's boot and SSH host key are read over the
serial console on every connection instead of from the USB name.

Trees without a serial number, or a helper that fails, keep the
per-boot BOOT: serial, so USB serial and SSH always come up. Recovery,
install and the install-to-system handoff keep their serials.

From orchard PR OrchardLinux#110 (commit bbe62ba), the stable serial part. The
same PR also embedded every board's device tree in each initrd and a
feature table in the platform layer, for warm restart and the feature
registry; those are not part of this topic. The empty or malformed
hash fallback and the init fallback are additions.
@henrikklee
henrikklee force-pushed the j71t/usb-stable-serial branch from bbe62ba to 39d86cb Compare November 12, 2026 21:17
@henrikklee henrikklee changed the title usb: Keep per-device system and RAM serials stable across boots usb: Keep each iPad's USB serial number the same across boots Nov 12, 2026
@henrikklee
henrikklee marked this pull request as ready for review November 12, 2026 21:17
Installed systems and RAM payloads told the host a new USB serial
number on every boot (BOOT:<boot id>), so the Mac saw a new device each
time: macOS asked again whether to allow the accessory, and the serial
console got a new name. Both now use BOARD:<board> ID:<12 hex>, the ID
being SHA-256 over "orchard-" and the device-tree serial-number that
m1n1 copies from Apple's tree, so the hardware serial is not
published. A RAM payload's boot and SSH host key are read over the
serial console on every connection instead of from the USB name.

Trees without a serial number, or a helper that fails, keep the
per-boot BOOT: serial, so USB serial and SSH always come up. Recovery,
install and the install-to-system handoff keep their serials.

From orchard PR OrchardLinux#110 (commit bbe62ba), the stable serial part. The
same PR also embedded every board's device tree in each initrd and a
feature table in the platform layer, for warm restart and the feature
registry; those are not part of this topic. The empty or malformed
hash fallback and the init fallback are additions.
@henrikklee
henrikklee force-pushed the j71t/usb-stable-serial branch from 39d86cb to 498ef45 Compare November 12, 2026 21:23
@henrikklee

Copy link
Copy Markdown
Contributor

Landing the stable serial part as your commit: one USB serial per unit (BOARD: ID:) for installed systems and RAM payloads, and the RAM boot and host key read over ACM on every connection. Added on top: a fallback to the per-boot BOOT: serial when the hash cannot be made, in both the initrd and usb-session, so USB serial and SSH always come up. Not in this topic: the per-board pristine DTBs in the initrd and device-features.json (warm restart and the feature registry). Your previous head is kept as tag contrib/brkosebay-j71t-usb-stable-serial. Please check on the next nightly that the Mac keeps recognising the J71t across reboots.

@henrikklee
henrikklee merged commit 023634f into OrchardLinux:main Nov 12, 2026
11 checks passed
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in drivers/usb are renumbered to follow
main's.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, drivers/base and drivers/usb
are renumbered to follow main's.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, drivers/base and drivers/usb
are renumbered to follow main's.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, drivers/base,
drivers/pmdomain and drivers/usb are renumbered to follow main's.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
From OrchardLinux#110, the part main did not take with the stable USB serial: the
platform layer embeds each supported board's pristine DTB and a
compatible-to-file map in the initrd. Before switching root, the initrd
copies the running board's tree to /run/orchard-kexec/pristine.dtb, or,
after a warm restart, the retained tree the previous kernel named with
orchard_warm.dtb=, and records the boot ID next to it. Warm restart
boots the next kernel with that tree, never with one rebuilt from an
updated /boot.

No feature table is added: whether warm restart is offered is decided
from the mechanisms it uses, not from a feature state.

Assisted-by: LLM
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, drivers/base,
drivers/pmdomain and drivers/usb are renumbered to follow main's.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, devices/t8010, drivers/base,
drivers/media, drivers/pmdomain, drivers/power and drivers/usb are
renumbered to follow main's.

Main's versions apply first now, so 0011 in drivers/media keep their
change with a diff regenerated for the new context.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, devices/s8003,
devices/t8010, drivers/base, drivers/media, drivers/pmdomain,
drivers/power and drivers/usb are renumbered to follow main's.

Main's versions apply first now, so 0011 in drivers/media keep their
change with a diff regenerated for the new context.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, devices/s8003,
devices/t8010, drivers/base, drivers/media, drivers/pmdomain,
drivers/power and drivers/usb are renumbered to follow main's.

Main's versions apply first now, so 0011 in drivers/media keep their
change with a diff regenerated for the new context.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, devices/s8003,
devices/t8010, drivers/base, drivers/media, drivers/pmdomain,
drivers/power, drivers/soc-apple and drivers/usb are renumbered to
follow main's.

Main's versions apply first now, so 0011 in drivers/media keep their
change with a diff regenerated for the new context.
brkosebay added a commit to brkosebay/hardware that referenced this pull request Nov 13, 2026
Bring this branch onto current main. Main has since merged OrchardLinux#124, OrchardLinux#122,
OrchardLinux#118, OrchardLinux#121, OrchardLinux#110, OrchardLinux#127, OrchardLinux#101, OrchardLinux#126, OrchardLinux#108 and OrchardLinux#111, several in part or
reworked, and OrchardLinux#123 and OrchardLinux#128 were closed. Where main carries a topic,
main's version is kept; the left-out parts that warm restart and
suspend need come back in OrchardLinux#107 and OrchardLinux#117.

This branch's own patches in devices/s8000, devices/s8003,
devices/t8010, drivers/base, drivers/media, drivers/pmdomain,
drivers/power, drivers/soc-apple and drivers/usb are renumbered to
follow main's.

Main's versions apply first now, so 0011 in drivers/media keep their
change with a diff regenerated for the new context.
@brkosebay

Copy link
Copy Markdown
Contributor Author

Checked on an iPad 5 (J71t) on 2026-11-13 with a user install image built from main 8ea3182 plus the open 0.4 PRs (top j71t/gpu-handover), installed with orchard install from DFU, then a cold boot from DFU and a warm restart (kexec) from the desktop.

Confirmed: the Mac keeps recognising the J71t, with the same BOARD:j71t ID:… serial and the same cu.usbmodem/NCM interface after the cold boot, the warm restart and a replug. No Allow prompt appeared.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants