|
| 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