Skip to content
This repository was archived by the owner on Oct 30, 2026. It is now read-only.

Device-generic CLI for the torvalds-based hardware layer - #5

Merged
henrikklee merged 17 commits into
mainfrom
feature/torvalds-base
Oct 28, 2026
Merged

henrikklee merged 17 commits into
mainfrom
feature/torvalds-base

Conversation

@henrikklee

Copy link
Copy Markdown
Contributor

Makes the CLI device-generic for the torvalds-based hardware layer (OrchardLinux/orchard#11).

  • One generic Apple adapter built from hardware's device.toml; the J71b package and the supported-device list are gone. Devices are recognised by DFU chip/board or by their recovery's USB name.
  • Installs require support.install in the descriptor; the installer shows the device's feature matrix and caveats, defaulting to [Y/n].
  • Firmware recipe schema 2: declarative steps (copy, bluetool-hcd, smartio-from-kernelcache, im4p-payload, z2fw-from-mtprops@1/@2, z2fw-from-mtfw@1); later steps take the previous step's result. All J71b outputs verified byte-identical from the IPSW.
  • Touch firmware conversions for the iPhone 7 Plus (mtprops packet array) and iPad 7 (MTFW), ports of Paul Praschl's makez2fw; the iPad 7 output matches makez2fw --dynamic-calibration apart from the calibration records.
  • Each install records which launcher it needs (launcher.json per ECID), so existing installs keep booting through the old launcher.
  • Packaging fix: the wheel no longer lists the removed orchard_cli.j71b; the Adapter protocol declares the descriptor data.

Requires hardware 0.1.11. Version 0.1.11. No release is tagged with this merge.

🤖 Generated with Claude Code

henrikklee and others added 17 commits October 28, 2026 11:55
Hardware now builds one kernel per platform from kernel/series/<platform>; devices name their platform and DTB in devices/<device>/device.toml. The kernel base is cached per platform (kernel-base-apple) and shared by its devices. The device layer selects the DTB from the base and builds external modules only if a device still has any. The patch marker matches kernel/build. Old per-device caches no longer apply, so the compatibility path for them is gone. m1n1 accepts patches shared by all devices.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
apple/kernelcache decodes the installed IMG4/LZFSE kernelcache through Apple's system library, so the in-app installer can extract SmartIO firmware on iPadOS. ipsw imports the release downloader lazily, so the pure firmware selector works on-device without download tooling. Brought over unchanged from the uncommitted work in worktrees/cli-local-firmware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The touch converter writes calibration records instead of baking the unit's calibration into the firmware. apple_z2 fills them from the DT properties m1n1 copies from the ADT at boot. The firmware file is now the same for every J71b (sha256 ec4349481fbdc1e6, validated on device). prepare/mixin, install and launch no longer capture the ADT. The capture-adt command stays as a bring-up tool.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
recipe.py implements the step vocabulary (copy, bluetool-hcd, smartio-from-kernelcache, im4p-payload, z2fw-from-mtprops). It checks a recipe against the hardware schema and refuses unknown steps with a request to update Orchard, before any work. firmware.py extracts only the IPSW inputs that missing outputs need, runs the steps, and caches outputs by their pinned hash; the mixin stages them under their destinations. The J71b-specific acquisition, preparation and staging code is gone; touch conversion (apple/z2fw.py) and SmartIO extraction (apple/smartio.py) are generic, with device facts coming from the recipe.

Verified on J71b's pinned IPSW: all 10 outputs match the recipe, SmartIO and Bluetooth byte-identical to the previous cache.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
supported() confirms the recipe format and that every step is implemented with its parameters, without jsonschema or the hardware package, so the in-app installer can run recipes on iPadOS. check() adds schema validation on the host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
apple/device.py implements the adapter contract from a device descriptor; devices.py lists every device the installed hardware describes and matches the connected one by DFU chip/board or recovery USB product. Installing requires the descriptor's support.install. The per-device package and SUPPORTED list are gone, and nothing defaults to J71b: projects name their device in orchard.toml, resolve takes --profile.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The installer names the device and its status and lists its limitations. For experimental devices it warns that the device has not been tested yet and defaults to No; supported devices keep Yes as the default.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The installer lists every feature that is not working, the device's caveats and, for experimental devices, an untested warning, then asks with Yes as the default. Experimental devices need users to try them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add two conversions from Paul Praschl's (Pauli1Go) GPL makez2fw beside
the J71b one:

- convert_packets(): mtprops whose constructed firmware is an array of
  preconstructed packets (iPhone 7 Plus, D11.mtprops profile C1F5E,2).
  The output is byte-identical to makez2fw --dynamic-calibration.
- convert_mtfw(): an MTFW image listing HBPP load items per personality
  (iPad 7, J171_/J172_Multitouch.im4p profile K1F19,6), including makez2fw's
  OTP preflight register reads (Z2FW command 5). It keeps makez2fw's
  commands, packets, order and configuration words, but emits a
  calibration record (command 6) for each Property item where makez2fw
  bakes SysCfg data. Property names without an apple_z2 provider ID
  are refused.

Add apple_z2's orb-gap, orb-force and shape-accel provider IDs, which
the iPhone 7 Plus calibration sequence uses. J71b's output is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
z2fw-from-mtprops@2 (profile, packet) converts an mtprops whose
constructed firmware is a packet array, as on the iPhone 7 Plus.
z2fw-from-mtfw@1 (profile, otp_preflight) converts an MTFW, the payload
of an iPad 7 multitouch IM4P, after im4p-payload@1. z2fw-from-mtprops@1
keeps its J71b behaviour; the new forms are new steps, so an older CLI
asks for an update instead of misreading their parameters.

STEPS now lists each parameter's type, and supported() checks it before
any work. Booleans and integers do not stand in for each other.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A successful install records the device's launcher (per ECID). orchard launch uses that record; without one, meaning an install made before 0.1.11, it uses the device's pinned legacy launcher, so old installs are not refused by the new kernel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each MTFW Property item now loads its default payload before the
calibration record, as makez2fw --dynamic-calibration does, so a unit
whose ADT lacks the property keeps Apple's default. Map the Firefly P100
(7) and external multi-touch (8) providers apple_z2 now knows.

Without the six calibration records, the J171/J172 K1F19,6 output equals
makez2fw --dynamic-calibration's command for command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ports of makez2fw for the iPhone 7 Plus and iPad 7 touch firmware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only an output's first step names an input. The MTFW conversion after
im4p-payload is the first chain; it no longer repeats an input that run()
ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The wheel still listed orchard_cli.j71b, so installing the CLI failed.
The Adapter protocol now declares the descriptor data the host reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@henrikklee
henrikklee merged commit 20c67e1 into main Oct 28, 2026
3 of 4 checks passed
@henrikklee
henrikklee deleted the feature/torvalds-base branch October 28, 2026 11:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant