Repository navigation
Conversation
Use a CRC-checked LwVM header to generate a read-only dm-linear map in the boot arguments. The shared initrd matches the mapping by the root PARTUUID, verifies the LwVM header checksum of the backing disk before mounting (a valid primary takes precedence over a stale backup), and starts the system with an opt-in tmpfs overlay, so writes do not reach the flash. If the device-mapper root cannot boot, it offers a serial-only USB rescue shell. Assisted-by: LLM Signed-off-by: Alexandre Figueiredo <17xande@gmail.com>
CONFIG_MD, CONFIG_BLK_DEV_DM and CONFIG_DM_INIT are built into the armv7 kernel, merged in OrchardLinux/linux and taken into orchard's lock. Document the generic boot contract and rescue path. The shared initrd's device-mapper path has not yet booted on a device (one RAM boot is pending), so no hardware evidence is claimed. Assisted-by: LLM Signed-off-by: Alexandre Figueiredo <17xande@gmail.com>
Contributor
|
Thank you, @17xande! linux#89 now does this in the kernel for every 32-bit board: a Linux partition that iOS scattered over the flash shows up as a normal partition with its own PARTUUID, so it boots like any other root, writable too, without an initrd step. orchard main builds that kernel. If your 16 GB iPad mini 1 still doesn't boot its root through m1n1 with it, please reopen this (or comment) with the log, and we pick it up from there. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The shared initrd finds its root by
root=PARTUUID=, which needs a partition the kernel registers. The kernel's LwVM reader registers only contiguous partitions. The 16 GB iPad mini 1's Linux partition, which iOS laid out, is scattered over three runs of flash chunks, so the system cannot boot it from orchard's initrd. Until now it booted through a hand-typeddm-mod.createtable and a private init.Changes
src/orchard/lwvm_root.py(python -m orchard.lwvm_root): from a 4096-byte LwVM header (primary, copy, disk image or block device) and the Linux partition's GUID, derives the boot options:root=PARTUUID=… ro orchard.root=dm orchard.overlay=tmpfs orchard.lwvm_crc=… dm-mod.create="…". It checks the header CRC, descriptor count, unencrypted Linux type, chunk coverage and the armv7 1023-byte command-line limit, and merges contiguous chunks into runs.boot/initramfs/root/init: withorchard.root=dmit waits up to 30 s for the read-only mapper device whose dm UUID isorchard-lwvm-<PARTUUID>, re-reads the backing disk's LwVM header (primary first, backup only if the primary is invalid), checks its CRC and medium size againstorchard.lwvm_crc=, mounts read-only and starts the system on a tmpfs overlay (required withorchard.root=dm). On failure it stops and offers a serial-only USB (ACM) rescue shell besides the console, only for this path. Other boots behave as before.docs/boot-contract.md,docs/device-protocol.md: the contract, the options and the rescue behaviour;tests/fixtures/p105-scattered-lwvm.binis a header of that layout.The kernel options it needs (
CONFIG_MD,CONFIG_BLK_DEV_DM,CONFIG_DM_INIT, all=y) are already inkernel/configs/apple-armv7/config.Testing
bin/orchard python -m unittest discover -s tests: 510 tests, OK (1 skipped), includingtests/test_lwvm_root.pyand the init script's behaviour under test doubles.Offline, against the captured header of the 16 GB iPad's Linux partition (GUID
1746a46a-ffc1-4a28-844f-0b168b79185f): the generated table is0 19529728 linear /dev/applesftl0 8978432,19529728 163840 … 30048256,19693568 532840 … 30474240, identical to the hand-typed table that booted Omarchy A from that flash on 2026-11-30.On the device, 16 GB iPad mini 1 (P105, iOS 9.3.5), 2026-12-02, kDFU then
orchard run --autogowith the reader fix of mtd: apple-sftl: accept iOS 9's flag-1 records on 16 GB media (fixes the -74 refusal) linux#87 and the options frompython -m orchard.lwvm_root:dm-0orchard-rootread-only (dm UUIDorchard-lwvm-1746a46a-…) at 9.7 s, then/initstopped before mounting. Cause: the LwVM header check made its temporary file under/newroot/, whichmount_rootonly creates later. The host test had created/newrootitself, so it never failed. The stop took the serial rescue path (USB05ac:4144), which worked. The temporary file is now made under/dev, and the test sandbox no longer has/newroot: the new test fails on the old code with the device's message.dm-0,ro=1) with the tmpfs overlay (overlay rw,…lowerdir=/root-lower,upperdir=/root-overlay/upper),switch_rootran and Omarchy A came up (session ready, system running, no failed units).Not covered
Written with LLM assistance (
Assisted-by: LLM).