Skip to content

bin/omamobile: pack header-v0 boot images for android-v0 - #507

Merged
derekross merged 1 commit into
derekross:mainfrom
matthewjaybarr-png:enchilada-header-v0-packer
Nov 8, 2026
Merged

derekross merged 1 commit into
derekross:mainfrom
matthewjaybarr-png:enchilada-header-v0-packer

Conversation

@matthewjaybarr-png

Copy link
Copy Markdown
Contributor

What and why

The OnePlus 6 (enchilada) ABL boots a header-v0 boot image: a gzip kernel with the DTB appended, no dtbo, no vendor_boot. Nothing in the tree could make one, so this adds it to omamobile images for BOOT_METHOD=android-v0.

  • load_device accepts android-v0 and checks the six header fields (PAGESIZE, BASE, the offsets) as numbers. BOOT_IMAGES must be boot alone, and boot_b must be on UFS_RW.
  • images packs boot.img with the pinned mkbootimg.py: gzip Image + DTB, the shared initramfs, CMDLINE, the descriptor's offsets.
  • Still RAM-only: fastboot, flash and push refuse android-v0 and point at fastboot boot, and the installer still refuses it.

It also includes the two notes from #445 and the retry-count correction from #432: a link to the decision on restoring stock, the firewall failure booted from boot_b after --set-active=b, and the dropped guess that each rescue boot spends a try. docs/RELEASES.md lists the new keys.

Refs #432 (the "packer" PR named there).

Device and build

  • Phone: OnePlus 6 (enchilada)
  • Kernel release (uname -r): 7.1.0-rc1-sdm845 (the first-light build in device/enchilada/NOTES.md)
  • Packages changed, with versions: none

Checks (no phone needed)

  • tools/pr-check origin/main passes
  • tests/all passes
  • tests/packages passes (or the packages I touched: none touched)
  • Each changed package has its version bumped, and the new version is in the commit subject (no packages)
  • Commits have area prefixes and bodies that say why; any AI help is a Co-Authored-By: or Assisted-by: trailer, never a Signed-off-by:

tests/boot-method covers the refusals and bad header fields. tests/images-layout adds an android-v0 layout test: one boot.img, header v0, page size, load addresses, kernel = gzip Image + DTB, ramdisk = initramfs, same bytes on a second run. The gs201/gs101 images still match 1e7a998 byte for byte.

On the phone

  • I ran this on my own phone, booted into this build: nothing was sent to the phone for this PR. Run against the 7.1.0-rc1-sdm845 kernel output, images gives a boot.img byte-identical to the one fastboot booted at first light on 2026-11-04 (sha256 78d7bd1a…0d98c, the NOTES entry).
  • Runbook steps passed: none, no phone step
  • What I did not test: a new fastboot boot of an image from this exact commit (it is the same bytes as above); linux-omarchy-mobile on this phone
  • Nothing in this change writes outside slot B and userdata, weakens the storage guard, or reads registers from userspace (AGENTS.md §1)

🤖 Generated with Claude Code

The OnePlus 6 (enchilada) ABL boots an Android boot image header v0:
a gzip kernel with the DTB appended, no dtbo and no vendor_boot. Until
now nothing in the tree could make one, so every path refused
BOOT_METHOD=android-v0 and the port's first-light image was built by
hand.

load_device now accepts android-v0 with its own required keys and the
six header fields (PAGESIZE, BASE and the offsets), checked as numbers;
BOOT_IMAGES must be boot alone and boot_b must be on UFS_RW. images
packs boot.img with the pinned mkbootimg.py: gzip -9n of Image with the
(overlaid) DTB appended, the shared initramfs as the ramdisk, CMDLINE
and the descriptor's offsets. mkdtboimg is only required for android-v4.

The port stays RAM-only: fastboot, flash and push refuse android-v0 and
point at `fastboot boot`, and the installer still refuses the method,
until the slot-B install and its CONTRIBUTING.md 3.1 entry are agreed.

Also in device/enchilada/NOTES.md and docs/DEVICES.md, from review on
derekross#445 and derekross#432: link the maintainer's decision on restoring stock; say
the firewall failure booted from boot_b after --set-active=b; and drop
the guess that each rescue boot spends one of slot A's tries (after one
more rescue boot A was still at 5 and B at 7).

Tested: tests/boot-method (enchilada images reach the kernel check;
fastboot, flash, push and both installer modes refuse; bad header
fields refused; no phone access) and tests/images-layout, which gains
an android-v0 layout test (one boot.img, header v0, page size and load
addresses, kernel = gzip Image + DTB, ramdisk = initramfs,
deterministic) while the gs201/gs101 baseline still matches 1e7a998
byte for byte.
Against the 7.1.0-rc1-sdm845 build used for first light on 2026-11-04,
images gives a boot.img byte-identical to the one that was booted then
with `fastboot boot` (sha256 78d7bd1a...0d98c). Nothing was sent to the
phone for this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@derekross

Copy link
Copy Markdown
Owner

Thank you, Matt. This is the packer #432 was waiting for, and it's careful in the right places. The new method gets its own checked keys, fastboot, flash and push refuse it before touching the phone, the installer still refuses it, and the tests cover both the image layout and every refusal. Thanks too for folding in the #445 and #432 notes. The retry-count correction with the sfdisk --dump read is just what the record needed.

What I ran:

  • tools/pr-check, tests/boot-method and tests/images-layout all pass here, including your new header-v0 layout test.
  • The Pixel 7 Pro's six images come out byte-identical with main's bin/omamobile and with yours, built from the same kernel output, so nothing changes for the reference phone.
  • DEVICE=enchilada bin/omamobile initramfs-config now works too. It packs boot_b userdata as the allowlist, and boot_b stays read-only in the init because it sits on sde, as your descriptor says.

One thing for later, not for this PR: #505 (the Xiaomi Mi 8, also an SDM845) packs a header-v1 image with its own script. I'll ask there whether it can use this path, so the tree keeps one packer.

I'll merge it as is. Thanks again.

@derekross
derekross merged commit 25611e9 into derekross:main Nov 8, 2026
2 checks passed
@matthewjaybarr-png

Copy link
Copy Markdown
Contributor Author

Thanks, Derek, and thanks for checking the Pixel 7 Pro images and initramfs-config.

On #505: going from header v0 to v1 should only take a header-version key in the descriptor plus the recovery-dtbo fields v1 adds, so I'm happy to help fit the Mi 8 into this path if that's useful there.

Next from me is the LUN-aware UFS_RW, with the Pixels unchanged and new tests/storage-guard cases.

robertzas pushed a commit to robertzas/omarchy-mobile that referenced this pull request Nov 14, 2026
The OnePlus 6 (enchilada) ABL boots an Android boot image header v0:
a gzip kernel with the DTB appended, no dtbo and no vendor_boot. Until
now nothing in the tree could make one, so every path refused
BOOT_METHOD=android-v0 and the port's first-light image was built by
hand.

load_device now accepts android-v0 with its own required keys and the
six header fields (PAGESIZE, BASE and the offsets), checked as numbers;
BOOT_IMAGES must be boot alone and boot_b must be on UFS_RW. images
packs boot.img with the pinned mkbootimg.py: gzip -9n of Image with the
(overlaid) DTB appended, the shared initramfs as the ramdisk, CMDLINE
and the descriptor's offsets. mkdtboimg is only required for android-v4.

The port stays RAM-only: fastboot, flash and push refuse android-v0 and
point at `fastboot boot`, and the installer still refuses the method,
until the slot-B install and its CONTRIBUTING.md 3.1 entry are agreed.

Also in device/enchilada/NOTES.md and docs/DEVICES.md, from review on
derekross#445 and derekross#432: link the maintainer's decision on restoring stock; say
the firewall failure booted from boot_b after --set-active=b; and drop
the guess that each rescue boot spends one of slot A's tries (after one
more rescue boot A was still at 5 and B at 7).

Tested: tests/boot-method (enchilada images reach the kernel check;
fastboot, flash, push and both installer modes refuse; bad header
fields refused; no phone access) and tests/images-layout, which gains
an android-v0 layout test (one boot.img, header v0, page size and load
addresses, kernel = gzip Image + DTB, ramdisk = initramfs,
deterministic) while the gs201/gs101 baseline still matches 45e7109
byte for byte.
Against the 7.1.0-rc1-sdm845 build used for first light on 2026-11-04,
images gives a boot.img byte-identical to the one that was booted then
with `fastboot boot` (sha256 78d7bd1a...0d98c). Nothing was sent to the
phone for this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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