Skip to content

bundle-manifest: write only slot B's boot images and userdata - #841

Merged
derekross merged 2 commits into
derekross:mainfrom
only21mil:build/bundle-manifest-protected-partitions
Nov 18, 2026
Merged

derekross merged 2 commits into
derekross:mainfrom
only21mil:build/bundle-manifest-protected-partitions

Conversation

@only21mil

@only21mil only21mil commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

What and why

On main c462357, tools/make-bundle builds a release bundle whose install plan writes a partition AGENTS.md §1 rules out, if device.conf lists it. tools/bundle-manifest checks its five-image list (IMAGES_ACTIVE) only for format 2 (INSTALL_SLOT=active, no device yet). For format 1 it only checks that each BOOT_IMAGES entry's _b partition is on the descriptor's own UFS_RW. So modem in BOOT_IMAGES with modem_b in UFS_RW gives a signed manifest.json whose install.writes holds modem_b, beside a never list naming modem. UFS_RW alone also puts modem_b in storage_guard_allowlist. The bundle's own install refuses that descriptor, but the plan is still signed. No descriptor in the tree does this.

tools/bundle-manifest now runs the same two checks, unchanged, for both formats: BOOT_IMAGES only from boot, init_boot, vendor_boot, vendor_kernel_boot and dtbo, and UFS_RW only from their _b partitions and userdata. Format 2's checks and messages stay as they are. It runs before tools/make-bundle moves the new bundle in, so a refusal names the entry and the earlier bundle stays. All quoted, non-empty BOOT_IMAGES descriptors still bundle.

The branch is daeb6c5 with main c462357 merged in (a36ed70).

AI agents made every run below. Reproduction: the real tools/make-bundle --unsigned from a git archive of each commit, with tests/make-bundle's stand-in images and one made-up descriptor per case. On c462357 all three cases build; on a36ed70 each stops.

Regression test (a stand-in, not the reproduction): a new tests/make-bundle case. Descriptors naming modem, vbmeta, or modem_b in UFS_RW alone are refused with the name, and the earlier bundle's SHA256SUMS stays the same. It fails on main's tool, and moving the checks back under INSTALL_SLOT=active fails it.

Device and build

  • Phone: none: a laptop tool only
  • Kernel release (uname -r): no phone
  • Packages changed, with versions: none

Checks (no phone needed)

  • tools/pr-check origin/main passes (AI agent)
  • tests/all passes (AI agent)
  • tests/packages passes (or the packages I touched: none, so not run)
  • Each changed package has its version bumped, and the new version is in the commit subject: no package changed
  • 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:

On the phone

  • I ran this on my own phone, booted into this build: no: a laptop tool
  • Runbook steps passed (plan, step, result): none, no plan step
  • What I did not test: a signed bundle; tools/install-phone, the desktop installer or the web page reading such a manifest; anything on a phone
  • Nothing in this change writes outside slot B and userdata, weakens the storage guard, or reads registers from userspace (AGENTS.md §1)
tools/phone-smoke report

Not applicable: a laptop tool that never runs on a phone (CONTRIBUTING.md §6.5).

AI agents made every run in this description, on an x86_64 desktop running Ubuntu 26.04. The tests and checks ran on a36ed70: tools/pr-check origin/main, tests/make-bundle, tests/make-bundle-keys, tests/install-phone, tests/install-slot-descriptor and tests/all, the last two with a stand-in fastboot that exits 1 on PATH (this machine has none). Each transcript below names its own commit.

Setup: Ubuntu 26.04 on x86_64, bash 5.3, Python 3.14; a fresh git archive of each commit per case, made its own git repository with one empty commit, as tests/make-bundle does.

The driver replaces the owner and group names in make-bundle's closing ls -l with user and group, and drops the colour codes of its ==> and error: lines; nothing else is edited.

Steps: write the case's device/testdev/device.conf → stand-in kernel-out/ (kernel.release, images/DEVICE, one .img per BOOT_IMAGES entry) and root image with its .sha256 and .MANIFEST → DEVICE=testdev KERNEL_OUT=kernel-out KERNEL_DIR=. tools/make-bundle --unsigned --version 2026.11.01 --rootfs out/...img.zst → print the exit code and manifest.json's install writes, allowlist and never list

Before, on main c4623572:

ref: origin/main (c4623572be1c)

=== case 1: modem in BOOT_IMAGES and modem_b in UFS_RW
--- device/testdev/device.conf
CODENAME=testdev
NAME="Test device"
BOOT_IMAGES="boot dtbo modem"
UFS_RW="boot_b dtbo_b modem_b userdata"
--- $ DEVICE=testdev KERNEL_OUT=kernel-out KERNEL_DIR=. tools/make-bundle --unsigned --version 2026.11.01 --rootfs out/omamobile-rootfs-testdev-2026.11.01-aarch64.img.zst
==> Assembling out/bundle/omamobile-testdev-2026.11.01
==> Unsigned bundle (--unsigned): install needs --unsigned too
==> Writing out/bundle/omamobile-testdev-2026.11.01.tar (the bundle and the root image, one download)
out/bundle:
total 528
-rw-r--r-- 2 user group     76 Nov 16 16:41 omamobile-rootfs-testdev-2026.11.01-aarch64.MANIFEST
-rw-r--r-- 2 user group      4 Nov 16 16:41 omamobile-rootfs-testdev-2026.11.01-aarch64.img.zst
-rw-r--r-- 2 user group    118 Nov 16 16:41 omamobile-rootfs-testdev-2026.11.01-aarch64.img.zst.sha256
drwxr-xr-x 4 user group    179 Nov 16 16:41 omamobile-testdev-2026.11.01
-rw-r--r-- 1 user group 522240 Nov 16 16:41 omamobile-testdev-2026.11.01.tar
-rw-r--r-- 1 user group     99 Nov 16 16:41 omamobile-testdev-2026.11.01.tar.sha256

out/bundle/omamobile-testdev-2026.11.01:
total 136
-rw-r--r-- 1 user group 23714 Nov 16 16:41 INSTALL.md
-rw-r--r-- 1 user group   654 Nov 16 16:41 MANIFEST
-rw-r--r-- 1 user group  3219 Nov 16 16:41 README.txt
-rw-r--r-- 1 user group  1862 Nov 16 16:41 SHA256SUMS
-rw-r--r-- 1 user group   106 Nov 16 16:41 device.conf
drwxr-xr-x 2 user group    55 Nov 16 16:41 images
-rwxr-xr-x 1 user group 78483 Nov 16 16:41 install
-rw-r--r-- 1 user group  5233 Nov 16 16:41 manifest.json
-rw-r--r-- 1 user group  1140 Nov 16 16:41 omamobile.gpg
drwxr-xr-x 2 user group  4096 Nov 16 16:41 tools
--- exit code: 0
--- out/bundle/omamobile-testdev-2026.11.01/manifest.json, install:
writes: boot_b dtbo_b modem_b userdata
storage_guard_allowlist: boot_b dtbo_b modem_b userdata
never: slot A (any *_a partition); an unsuffixed partition name; bootloader; radio; persist; efs; modem; devinfo; vbmeta; fastboot -w; fastboot --slot; fastboot flashing; fastboot erase; fastboot format; fastboot oem

=== case 2: vbmeta in BOOT_IMAGES and vbmeta_b in UFS_RW
--- device/testdev/device.conf
CODENAME=testdev
NAME="Test device"
BOOT_IMAGES="boot dtbo vbmeta"
UFS_RW="boot_b dtbo_b vbmeta_b userdata"
--- $ DEVICE=testdev KERNEL_OUT=kernel-out KERNEL_DIR=. tools/make-bundle --unsigned --version 2026.11.01 --rootfs out/omamobile-rootfs-testdev-2026.11.01-aarch64.img.zst
==> Assembling out/bundle/omamobile-testdev-2026.11.01
==> Unsigned bundle (--unsigned): install needs --unsigned too
==> Writing out/bundle/omamobile-testdev-2026.11.01.tar (the bundle and the root image, one download)
out/bundle:
total 528
-rw-r--r-- 2 user group     76 Nov 16 16:41 omamobile-rootfs-testdev-2026.11.01-aarch64.MANIFEST
-rw-r--r-- 2 user group      4 Nov 16 16:41 omamobile-rootfs-testdev-2026.11.01-aarch64.img.zst
-rw-r--r-- 2 user group    118 Nov 16 16:41 omamobile-rootfs-testdev-2026.11.01-aarch64.img.zst.sha256
drwxr-xr-x 4 user group    179 Nov 16 16:41 omamobile-testdev-2026.11.01
-rw-r--r-- 1 user group 522240 Nov 16 16:41 omamobile-testdev-2026.11.01.tar
-rw-r--r-- 1 user group     99 Nov 16 16:41 omamobile-testdev-2026.11.01.tar.sha256

out/bundle/omamobile-testdev-2026.11.01:
total 136
-rw-r--r-- 1 user group 23714 Nov 16 16:41 INSTALL.md
-rw-r--r-- 1 user group   655 Nov 16 16:41 MANIFEST
-rw-r--r-- 1 user group  3220 Nov 16 16:41 README.txt
-rw-r--r-- 1 user group  1863 Nov 16 16:41 SHA256SUMS
-rw-r--r-- 1 user group   108 Nov 16 16:41 device.conf
drwxr-xr-x 2 user group    56 Nov 16 16:41 images
-rwxr-xr-x 1 user group 78483 Nov 16 16:41 install
-rw-r--r-- 1 user group  5237 Nov 16 16:41 manifest.json
-rw-r--r-- 1 user group  1140 Nov 16 16:41 omamobile.gpg
drwxr-xr-x 2 user group  4096 Nov 16 16:41 tools
--- exit code: 0
--- out/bundle/omamobile-testdev-2026.11.01/manifest.json, install:
writes: boot_b dtbo_b vbmeta_b userdata
storage_guard_allowlist: boot_b dtbo_b vbmeta_b userdata
never: slot A (any *_a partition); an unsuffixed partition name; bootloader; radio; persist; efs; modem; devinfo; vbmeta; fastboot -w; fastboot --slot; fastboot flashing; fastboot erase; fastboot format; fastboot oem

=== case 3: modem_b in UFS_RW only
--- device/testdev/device.conf
CODENAME=testdev
NAME="Test device"
BOOT_IMAGES="boot dtbo"
UFS_RW="boot_b dtbo_b modem_b userdata"
--- $ DEVICE=testdev KERNEL_OUT=kernel-out KERNEL_DIR=. tools/make-bundle --unsigned --version 2026.11.01 --rootfs out/omamobile-rootfs-testdev-2026.11.01-aarch64.img.zst
==> Assembling out/bundle/omamobile-testdev-2026.11.01
==> Unsigned bundle (--unsigned): install needs --unsigned too
==> Writing out/bundle/omamobile-testdev-2026.11.01.tar (the bundle and the root image, one download)
out/bundle:
total 532
-rw-r--r-- 2 user group     76 Nov 16 16:41 omamobile-rootfs-testdev-2026.11.01-aarch64.MANIFEST
-rw-r--r-- 2 user group      4 Nov 16 16:41 omamobile-rootfs-testdev-2026.11.01-aarch64.img.zst
-rw-r--r-- 2 user group    118 Nov 16 16:41 omamobile-rootfs-testdev-2026.11.01-aarch64.img.zst.sha256
drwxr-xr-x 4 user group   4096 Nov 16 16:41 omamobile-testdev-2026.11.01
-rw-r--r-- 1 user group 522240 Nov 16 16:41 omamobile-testdev-2026.11.01.tar
-rw-r--r-- 1 user group     99 Nov 16 16:41 omamobile-testdev-2026.11.01.tar.sha256

out/bundle/omamobile-testdev-2026.11.01:
total 136
-rw-r--r-- 1 user group 23714 Nov 16 16:41 INSTALL.md
-rw-r--r-- 1 user group   578 Nov 16 16:41 MANIFEST
-rw-r--r-- 1 user group  3211 Nov 16 16:41 README.txt
-rw-r--r-- 1 user group  1779 Nov 16 16:41 SHA256SUMS
-rw-r--r-- 1 user group   100 Nov 16 16:41 device.conf
drwxr-xr-x 2 user group    50 Nov 16 16:41 images
-rwxr-xr-x 1 user group 78483 Nov 16 16:41 install
-rw-r--r-- 1 user group  4949 Nov 16 16:41 manifest.json
-rw-r--r-- 1 user group  1140 Nov 16 16:41 omamobile.gpg
drwxr-xr-x 2 user group  4096 Nov 16 16:41 tools
--- exit code: 0
--- out/bundle/omamobile-testdev-2026.11.01/manifest.json, install:
writes: boot_b dtbo_b userdata
storage_guard_allowlist: boot_b dtbo_b modem_b userdata
never: slot A (any *_a partition); an unsuffixed partition name; bootloader; radio; persist; efs; modem; devinfo; vbmeta; fastboot -w; fastboot --slot; fastboot flashing; fastboot erase; fastboot format; fastboot oem

After, on a36ed701:

ref: HEAD (a36ed701635c)

=== case 1: modem in BOOT_IMAGES and modem_b in UFS_RW
--- device/testdev/device.conf
CODENAME=testdev
NAME="Test device"
BOOT_IMAGES="boot dtbo modem"
UFS_RW="boot_b dtbo_b modem_b userdata"
--- $ DEVICE=testdev KERNEL_OUT=kernel-out KERNEL_DIR=. tools/make-bundle --unsigned --version 2026.11.01 --rootfs out/omamobile-rootfs-testdev-2026.11.01-aarch64.img.zst
==> Assembling out/bundle/omamobile-testdev-2026.11.01
bundle-manifest: BOOT_IMAGES may hold only boot init_boot vendor_boot vendor_kernel_boot dtbo, not modem
error: writing manifest.json failed
--- exit code: 1
--- no out/bundle/omamobile-testdev-2026.11.01/manifest.json

=== case 2: vbmeta in BOOT_IMAGES and vbmeta_b in UFS_RW
--- device/testdev/device.conf
CODENAME=testdev
NAME="Test device"
BOOT_IMAGES="boot dtbo vbmeta"
UFS_RW="boot_b dtbo_b vbmeta_b userdata"
--- $ DEVICE=testdev KERNEL_OUT=kernel-out KERNEL_DIR=. tools/make-bundle --unsigned --version 2026.11.01 --rootfs out/omamobile-rootfs-testdev-2026.11.01-aarch64.img.zst
==> Assembling out/bundle/omamobile-testdev-2026.11.01
bundle-manifest: BOOT_IMAGES may hold only boot init_boot vendor_boot vendor_kernel_boot dtbo, not vbmeta
error: writing manifest.json failed
--- exit code: 1
--- no out/bundle/omamobile-testdev-2026.11.01/manifest.json

=== case 3: modem_b in UFS_RW only
--- device/testdev/device.conf
CODENAME=testdev
NAME="Test device"
BOOT_IMAGES="boot dtbo"
UFS_RW="boot_b dtbo_b modem_b userdata"
--- $ DEVICE=testdev KERNEL_OUT=kernel-out KERNEL_DIR=. tools/make-bundle --unsigned --version 2026.11.01 --rootfs out/omamobile-rootfs-testdev-2026.11.01-aarch64.img.zst
==> Assembling out/bundle/omamobile-testdev-2026.11.01
bundle-manifest: UFS_RW may hold only slot B boot images and userdata, not modem_b
error: writing manifest.json failed
--- exit code: 1
--- no out/bundle/omamobile-testdev-2026.11.01/manifest.json

Links: main c4623572, the change daeb6c5a and the merge a36ed701, the regression test tests/make-bundle, and the allowlist the maintainer described on #567.

Not shown:

  • a signed bundle (the release key is the maintainer's)
  • tools/install-phone, the desktop installer or the web page reading such a manifest
  • tests/all in CI's Arch Linux image
  • a format 2 bundle from a real device (none sets INSTALL_SLOT=active); main's format 2 cases in tests/make-bundle pass
  • anything on a phone

Generated with Claude Opus 5.5 in T3 Code Nightly

only21mil and others added 2 commits November 16, 2026 04:31
A bundle's install plan (manifest.json, which tools/install-phone and
the desktop and web installers follow) took BOOT_IMAGES and UFS_RW from
the descriptor checking only a name pattern and that each image's _b
partition is on the descriptor's own UFS_RW. So a descriptor naming
modem in BOOT_IMAGES with modem_b in UFS_RW gave a bundle whose
install.writes held modem_b, beside a "never" list naming modem; the
same for vbmeta, and UFS_RW alone could carry modem_b into the
storage-guard allowlist. tools/make-bundle --unsigned finished with
exit 0 in each case.

Only slot B's five boot images and userdata are ours (AGENTS.md §1).
bundle-manifest now accepts BOOT_IMAGES only from boot, init_boot,
vendor_boot, vendor_kernel_boot and dtbo, and UFS_RW only from their
_b partitions and userdata, each list on its own: the set
bin/omamobile's load_device and initramfs/init's ufs_rw_load already
hold. It replaces the name-pattern check. make-bundle runs it before
the new bundle is moved in, so a refusal keeps the earlier bundle.

Tested on the laptop only, no phone: tests/make-bundle gains a case
(modem, vbmeta and modem_b descriptors refused with the name, the
earlier bundle unchanged) that fails on main's tool and passes here;
removing either new check fails it.
tools/pr-check, tests/make-bundle, tests/make-bundle-keys and
tests/all pass. Every descriptor in device/ is inside the set.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's format 2 work (c462357) conflicted in tools/bundle-manifest and
tests/make-bundle. The resolution runs main's five-image check for both
formats instead of keeping a second list.

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

Copy link
Copy Markdown
Owner

Thank you, @only21mil, and thank you for merging main in after #848 landed: that made this easy to read. What is left is exactly right. #848 put the two checks under INSTALL_SLOT=active, which no device sets yet, so every bundle we build today is format 1 and went without them; with your change bundle-manifest holds both formats to the same five images and their slot-form names, as bin/omamobile, tools/install-phone and omamobile-boot-update already do.

I ran tests/make-bundle and tests/make-bundle-keys on your head, moved the checks back under the format 2 branch and saw your new case fail with "it wrote boot_b dtbo_b modem_b userdata", and checked every descriptor in device/: all are inside the set, so nothing that builds today stops.

Merging. I'll write the squash message myself, because the first commit's text describes the change as it was before #848 (it says the name-pattern check is replaced, and main's is still there).

@derekross
derekross merged commit 3222094 into derekross:main Nov 18, 2026
2 checks passed
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