Skip to content

Commit f39c6af

Browse files
committed
Add basic experimental aboot support docs.
Signed-off-by: Alexander Larsson <alexl@redhat.com>
1 parent 4a56796 commit f39c6af

3 files changed

Lines changed: 89 additions & 2 deletions

File tree

‎docs/src/SUMMARY.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282

8383
- [bootc image](bootc-experimental-image.7.md)
8484
- [composefs backend](bootc-experimental-composefs.7.md)
85+
- [composefs aboot support](experimental-composefs-aboot.7.md)
8586
- [`man bootc-composefs-finalize-staged`](man/bootc-composefs-finalize-staged.8.md)
8687
- [unified storage](bootc-experimental-unified-storage.7.md)
8788
- [`man bootc-root-setup.service`](man/bootc-root-setup.service.5.md)

‎docs/src/bootc-experimental-composefs.7.md‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ do provide feedback on them.
77

88
The composefs backend is an experimental alternative storage backend that uses [composefs-rs](https://github.com/composefs/composefs-rs) instead of ostree for storing and managing bootc system deployments.
99

10+
For Android A/B boot images and ukiboot on this backend, see
11+
[experimental composefs aboot support](experimental-composefs-aboot.md).
12+
1013
The composefs backend has two independent integrity controls:
1114

1215
- **fs-verity enforcement.** By default every object in the composefs
@@ -95,7 +98,7 @@ Unlike the ostree backend, which keeps its repository at `/ostree/repo`, the com
9598
- `/state/deploy/<deployment-id>/`: Persistent per-deployment state, one directory per deployment (see below for how it is named):
9699
- `etc/`: a writable copy of the deployment's `/etc`, bind-mounted onto the booted root's `/etc`
97100
- `var`: a symlink to the shared `/state/os/default/var`, bind-mounted onto the booted root's `/var`
98-
- `<deployment-id>.origin`: an INI file recording the image reference, boot type (BLS or UKI) and digest, and the OCI manifest digest (the latter is what keeps a deployment's objects alive across garbage collection)
101+
- `<deployment-id>.origin`: an INI file recording the image reference, boot type (BLS, UKI, or aboot) and digest, and the OCI manifest digest (the latter is what keeps a deployment's objects alive across garbage collection)
99102

100103
Although composefs-rs supports other fs-verity hash algorithms, bootc currently hardcodes `SHA-512` for the repository. This is why EROFS image IDs and object identifiers are 128-character hex strings.
101104

@@ -108,7 +111,10 @@ deployment was staged.
108111

109112
There is no `/ostree/repo`; the composefs backend doesn't use the ostree repository at all. A minimal `/ostree` directory is still created, but only to hold a compatibility symlink (`ostree/bootc -> ../composefs/bootc`) so that existing tooling expecting `/usr/lib/bootc/storage` to resolve through `ostree/bootc` keeps working.
110113

111-
Transient, not-yet-finalized deployment state (used while staging an update before reboot) lives under `/run/composefs/staged-deployment` and is never persisted to disk.
114+
The transient view of a staged deployment lives under
115+
`/run/composefs/staged-deployment`. Aboot additionally persists pending and
116+
attempted state so an interrupted A/B update can be reconciled after reboot;
117+
see [aboot update state](experimental-composefs-aboot.md#updates-rollback-and-recovery).
112118

113119
## How Sealed Images Work
114120

@@ -272,6 +278,9 @@ Whenever the container image has a UKI, bootc automatically selects the composef
272278

273279
Composefs installs using a traditional `vmlinuz`/`initramfs.img` layout instead of a UKI can enforce fs-verity, but are never sealed, since nothing authenticates the root digest. They can use either `bootupd` (GRUB) or systemd-boot, the same as the ostree backend. See [bootloaders.md](bootc-bootloaders.7.md) for the general bootloader selection rules. Under the hood, bootc writes standard BLS boot entries for both UKI and traditional kernels; see the [composefs boot module documentation](https://github.com/bootc-dev/bootc/blob/main/crates/lib/src/bootc_composefs/boot.rs) for details on how entry filenames and sort-keys are chosen to sort correctly on both GRUB and systemd-boot.
274280

281+
Android A/B boot images use a separate [aboot boot path](experimental-composefs-aboot.md)
282+
instead of BLS entries; a real aboot install does not have an ESP.
283+
275284
## Installation
276285

277286
There is a `--composefs-backend` option for `bootc install` to explicitly select a composefs backend apart from sealed images; this is not as heavily tested yet.
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Experimental composefs aboot support
2+
3+
This page covers booting the composefs backend with an Android-style A/B boot
4+
image. For the repository layout, fsverity modes, and general composefs
5+
installation model, see [the composefs backend documentation](experimental-composefs.md).
6+
Both the aboot integration and its on-disk state format are experimental.
7+
8+
## Boot layouts
9+
10+
There are two supported ways to consume an `aboot.img` artifact:
11+
12+
| Artifact encoding | Inferred install bootloader | Boot partitions |
13+
| --- | --- | --- |
14+
| Android boot image v2 | `none` | Android `boot_a` and `boot_b`; no ESP |
15+
| ukiboot image | `ukiboot` | ESP with ukiboot, plus A/B boot images |
16+
17+
The real Android layout deliberately has **no ESP**. For that payload, bootc infers
18+
bootloader `none` and does not install an EFI bootloader; the platform firmware and
19+
`aboot-deploy` manage the A/B boot partitions. Both layouts use the composefs backend
20+
for the root filesystem. They cannot be switched in place to or from the BLS/UKI
21+
layouts managed by GRUB or systemd-boot.
22+
23+
## Building an image
24+
25+
`bootc container aboot` computes the V1 and V2 composefs digests of the rootfs,
26+
adds both to the kernel command line, and invokes `aboot-update` to create the
27+
artifact. See [EROFS formats](experimental-composefs.md#erofs-formats) for why
28+
both digests are included. `/etc/aboot.cfg` controls whether `aboot-update`
29+
emits an Android boot image or a ukiboot image (as well as other details). As
30+
with [building a composefs UKI](experimental-composefs.md#building-sealed-images),
31+
split the kernel and initramfs from the rootfs before generating the boot
32+
artifact, then copy the generated `aboot-<kernel-version>.img` into the final
33+
image's `/boot`.
34+
35+
```sh
36+
bootc container aboot --rootfs /target \
37+
--kernel-dir /kernel/KVER --out /out
38+
```
39+
40+
The command checks that the generated artifact contains both expected composefs
41+
arguments. It requires `aboot-update` in the build environment; the installed
42+
system needs `aboot-deploy` for updates and rollbacks. If the root filesystem
43+
cannot enforce fsverity, pass `--allow-missing-verity` when building the artifact.
44+
This produces an **unsealed** image, as explained in
45+
[composefs integrity modes](experimental-composefs.md#overview).
46+
47+
Bootc automatically infers the aboot backend, and bootloader `none` from an Android boot
48+
v2 payload and `ukiboot` from a ukiboot payload. An explicit bootloader setting is
49+
optional, but must agree with the payload.
50+
`bootc container inspect --json` reports `"type": "aboot"` for Android payloads
51+
and `"type": "aboot-efi"` for ukiboot payloads; image-builder uses this to
52+
select UEFI boot mode for ukiboot without a bootloader configuration file.
53+
54+
The disk layout must (in `disk.yaml`) provide the platform's `boot_a` and `boot_b`
55+
partitions and a root filesystem, but not an ESP. Add `vbmeta_a` and `vbmeta_b` if the
56+
platform uses them. The partition names, sizes, payloads, device tree, and
57+
`/etc/aboot.cfg` settings are platform-specific. For ukiboot, provide an ESP
58+
(which will have ukiboot installed on it during bootc install).
59+
60+
## Updates, rollback, and recovery
61+
62+
An update stores the new boot image (and optional vbmeta image) under
63+
`/state/deploy/<deployment-id>/aboot/`. A persistent pending record under
64+
`/state/boot/aboot/` tracks those artifacts and their hashes. Staging does not write
65+
either boot partition. At shutdown, bootc verifies the artifacts, records the attempt, and
66+
calls `aboot-deploy` to flash the inactive slot.
67+
68+
On the next boot, bootc records the observed `androidboot.slot_suffix` kernel commandline
69+
option and reconciles the attempted deployment. The previous slot becomes the rollback
70+
deployment; `bootc rollback` queues it through `aboot-deploy --rollback`. `bootc status`
71+
indicates when a rollback is queued. A failed boot is **not** automatically retried: bootc
72+
retains the attempted update for inspection and will not stage another update until that
73+
state is resolved.
74+
75+
The firmware's slot-selection and success-marking behavior is outside bootc. For example,
76+
the ukiboot enables `ukiboot-set-success.service` to mark a successful boot. Validate that
77+
behavior on the target hardware before relying on automatic fallback.

0 commit comments

Comments
 (0)