Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 52 additions & 3 deletions bin/omamobile
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ load_device() {
fi
done < "$file"
case $DEV_BOOT_METHOD in
android-v4|qcom-abl) ;;
*) die "$file: unsupported BOOT_METHOD=$DEV_BOOT_METHOD; this command supports android-v4 and qcom-abl" ;;
android-v4|android-v0|qcom-abl) ;;
*) die "$file: unsupported BOOT_METHOD=$DEV_BOOT_METHOD; this command supports android-v4, android-v0 and qcom-abl" ;;
esac
[[ $DEV_CODENAME == "$DEVICE" ]] || die "$file: CODENAME=$DEV_CODENAME, expected $DEVICE"
# Safety: the guard's allowlist may name slot B's boot images and userdata
Expand All @@ -143,7 +143,25 @@ load_device() {
done
[[ $seen_rw == *" userdata "* ]] || die "$file: UFS_RW must include userdata"

if [[ $DEV_BOOT_METHOD == qcom-abl ]]; then
if [[ $DEV_BOOT_METHOD == android-v0 ]]; then
# One header-v0 boot.img: a gzip kernel with the board DTB appended, the
# shared initramfs and CMDLINE, at the load offsets the descriptor gives
# (enchilada). No dtbo, no vendor_boot, no device package needed yet:
# images makes it for `fastboot boot`; flash, push, fastboot and the
# installer refuse it until a slot-B install has a CONTRIBUTING.md §3.1
# entry.
for key in CODENAME SOC DTB BOOT_IMAGES UFS_RW INITRAMFS_INIT PANEL_SIZE; do
p="DEV_$key"
[[ -n ${!p:-} ]] || die "$file: $key is missing"
done
for key in PAGESIZE BASE KERNEL_OFFSET RAMDISK_OFFSET SECOND_OFFSET TAGS_OFFSET; do
p="DEV_$key"
[[ ${!p:-} =~ ^(0x[0-9a-f]+|[0-9]+)$ ]] || die "$file: $key is missing or not a number"
done
[[ $DEV_PAGESIZE =~ ^(2048|4096|8192|16384)$ ]] || die "$file: PAGESIZE must be 2048, 4096, 8192 or 16384"
[[ $DEV_BOOT_IMAGES == boot ]] || die "$file: android-v0 BOOT_IMAGES may hold only boot"
slot_b_allowed boot || die "$file: boot_b is not in UFS_RW"
elif [[ $DEV_BOOT_METHOD == qcom-abl ]]; then
for key in CODENAME SOC PACKAGE DTB BOOT_IMAGES UFS_RW INITRAMFS_INIT PANEL_SIZE; do
p="DEV_$key"
[[ -n ${!p:-} ]] || die "$file: $key is missing"
Expand Down Expand Up @@ -781,6 +799,8 @@ cmd_images() {
if [[ $DEV_BOOT_METHOD != qcom-abl ]]; then
[[ -f $tools/mkbootimg.py ]] ||
die "no mkbootimg.py in $tools: run tools/fetch-toolchain, or set SRC_DIR to an Android checkout (or MKBOOTIMG_DIR)"
fi
if [[ $DEV_BOOT_METHOD == android-v4 ]]; then
[[ -f $MKDTBOIMG ]] ||
die "no mkdtboimg.py at $MKDTBOIMG: run tools/fetch-toolchain, or set SRC_DIR to an Android checkout (or MKDTBOIMG)"
fi
Expand All @@ -803,6 +823,26 @@ cmd_images() {
dtb="$img/$DEV_CODENAME-overlaid.dtb"
fi

if [[ $DEV_BOOT_METHOD == android-v0 ]]; then
# This ABL gunzips the kernel and takes the DTB appended to it; the
# ramdisk is the shared initramfs. gzip -n keeps no name or time, so
# the bytes depend only on the inputs.
say "Boot image (header v0, DTB appended to the gzip kernel): $DEV_DTB"
gzip -9 -n -c "$boot/Image" > "$img/Image.gz"
cat "$img/Image.gz" "$dtb" > "$img/Image.gz-dtb"
python3 "$tools/mkbootimg.py" --header_version 0 \
--kernel "$img/Image.gz-dtb" --ramdisk "$KERNEL_OUT/initramfs.cpio.lz4" \
--cmdline "${DEV_CMDLINE:-}" --pagesize "$DEV_PAGESIZE" --base "$DEV_BASE" \
--kernel_offset "$DEV_KERNEL_OFFSET" --ramdisk_offset "$DEV_RAMDISK_OFFSET" \
--second_offset "$DEV_SECOND_OFFSET" --tags_offset "$DEV_TAGS_OFFSET" \
--output "$img/boot.img" || die "mkbootimg failed"
rm -f "$img/Image.gz"
printf '%s\n' "$DEV_CODENAME" > "$img/DEVICE"
ls -lh "$img"/*.img
sha256sum "$img/boot.img"
return 0
fi

say "Kernel: Image.lz4"
lz4 -l -9 -f -q "$boot/Image" "$img/Image.lz4"

Expand Down Expand Up @@ -1058,6 +1098,10 @@ cmd_fastboot() {
# Qualcomm ABL panic path is uncharacterized on dodge (sysrq-c fallthrough
# when reboot-to bootloader is ignored). Refuse before any phone I/O; use
# the buttons instead (see device/$DEVICE/BRINGUP-M1.md).
# android-v0 (enchilada): no slot-B install yet, so a crash here would
# land on whatever the phone's other slot holds; use the buttons.
[[ $DEV_BOOT_METHOD != android-v0 ]] ||
die "fastboot refuses BOOT_METHOD=android-v0 (RAM-only: reach fastboot by the buttons, see device/$DEVICE/NOTES.md)"
[[ $DEV_BOOT_METHOD != qcom-abl ]] ||
die "fastboot refuses BOOT_METHOD=qcom-abl (panic path uncharacterized on this ABL; use the buttons — see device/$DEVICE/BRINGUP-M1.md)"
in_fastboot && { say "Already in fastboot"; return 0; }
Expand Down Expand Up @@ -1093,6 +1137,9 @@ cmd_flash() {
# successful and refill retries; the bit-54 mark has no §3.1 entry yet.
# Refuse here; day-2 updates use push once that path is viable, and the
# installer PR can reopen flash with the rest.
# android-v0: RAM-only until a slot-B install has its §3.1 entry
[[ $DEV_BOOT_METHOD != android-v0 ]] ||
die "flash refuses BOOT_METHOD=android-v0 (RAM-only: fastboot boot \$KERNEL_OUT/images/boot.img)"
[[ $DEV_BOOT_METHOD != qcom-abl ]] ||
die "flash refuses BOOT_METHOD=qcom-abl (no in-tree day-2 update path yet; see device/$DEVICE/BRINGUP-M1.md)"
images_for_device "$img"
Expand Down Expand Up @@ -1130,6 +1177,8 @@ cmd_push() {
# Same class of refusal as flash: boot_b is on sde here, and there is no
# in-tree day-2 rewrite path for qcom-abl yet. Refuse before any phone I/O
# (modules-push would otherwise rewrite the running root's modules).
[[ $DEV_BOOT_METHOD != android-v0 ]] ||
die "push refuses BOOT_METHOD=android-v0 (RAM-only: fastboot boot \$KERNEL_OUT/images/boot.img)"
[[ $DEV_BOOT_METHOD != qcom-abl ]] ||
die "push refuses BOOT_METHOD=qcom-abl (no in-tree day-2 update path yet; see device/$DEVICE/BRINGUP-M1.md)"
images_for_device "$img"
Expand Down
25 changes: 11 additions & 14 deletions device/enchilada/NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ tried yet; it is next.

**Slot A does not hold stock Android.** This is a §3.1 event, recorded
here as the maintainer asked on #432. Putting stock back on slot A is
outside the project: this tree only writes slot B and `userdata`, and
never `vbmeta`. If it is done, it is the owner's own step, with
outside the project ([the maintainer's decision on #432](https://github.com/derekross/omarchy-mobile/issues/432#issuecomment-6708103355)):
this tree only writes slot B and `userdata`, and never `vbmeta`. If it is done, it is the owner's own step, with
OnePlus's own images, and it is recorded on #432 (slot flags before
and after, what was flashed and from which image, then a fresh
read-only radio backup). The owner has decided not to restore it, so
Expand Down Expand Up @@ -66,30 +66,27 @@ three steps of 2026-11-05: that reply was posted at 16:13 (21:13 UTC),
and `flash boot_b` (netfilter kernel), `--set-active=a` and the package
install into `userdata` ran from 16:15 to about 16:20, before I had read
it. Since then the only commands sent to the phone have been the read-only
backup, one `fastboot boot` (2026-11-05 16:35) and `getvar` (below). No
backup, one `fastboot boot` (2026-11-05 16:35), `getvar` and one rescue
boot to read the slot flags again (below). No
slot flag is written again until this phone has a per-device entry in
CONTRIBUTING.md.

**Slot flags** (`fastboot getvar all`, read-only):
**Slot flags** (read-only; `fastboot getvar all`, except the last row):

| Read | `current-slot` | A: successful / unbootable / retry-count | B: successful / unbootable / retry-count |
| --- | --- | --- | --- |
| 2026-11-04, before any write of this port | a | no / no / 6 | yes / no / 7 |
| 2026-11-07, now | a | no / no / 5 | no / no / 7 |
| 2026-11-07 | a | no / no / 5 | no / no / 7 |
| 2026-11-07, after one more rescue boot, read in the rescue from `sde`'s GPT attributes (`sfdisk --dump`) | a | no / no / 5 | no / no / 7 |

Between the two reads, B lost its successful mark (left by the third-party
build; `--set-active=b` clears it and nothing of this port marks a slot)
and A's retry count went from 6 to 5. Neither slot is marked unbootable.

Slot A is not marked successful, so each boot of the rescue may spend one
of its tries. If ABL works as on other Qualcomm phones, `--set-active=a`
on 2026-11-05 reset A's count to 7, and the rescue boots since (including
the reboot after a `fastboot boot` panics with no USB host) took it to 5.
At 0 ABL would switch to slot B and run B's tries down too, and since
nothing here may mark a slot, the phone would then stop in fastboot and
need a `--set-active` to come back. This is not confirmed yet: one more
`getvar` after the next rescue boot will tell. Until then, rescue boots
are kept few.
Slot A is not marked successful, but a rescue boot does not spend one of
its tries here: after one more rescue boot A was still at 5 and B at 7
([#432](https://github.com/derekross/omarchy-mobile/issues/432#issuecomment-6716747930)). What took A from 6 to 5 between the first two reads is not
known. Neither slot is near 0.

**The slot-A rescue.** It is not the shared init and has no initramfs (an
empty ramdisk): the kernel mounts `system_a` from the `root=` that ABL
Expand Down
11 changes: 5 additions & 6 deletions device/enchilada/device.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
#
# RAM-only bring-up: this ABL boots an Android boot image header v0 holding
# a gzip kernel with the DTB appended (no dtbo, no vendor_boot), booted with
# `fastboot boot`, so nothing is written. No packer in this tree makes that
# image yet, so images, flash, push and the installer all refuse
# BOOT_METHOD=android-v0 before touching a phone (tests/boot-method). The
# header-v0 packer is a separate change; flash, push and the installer keep
# refusing it until the slot-B install and its CONTRIBUTING.md §3.1 entry
# are agreed.
# `fastboot boot`, so nothing is written. `omamobile images` packs that
# boot.img from the header fields below (tests/images-layout); fastboot,
# flash, push and the installer refuse BOOT_METHOD=android-v0 before
# touching a phone (tests/boot-method), and keep refusing it until the
# slot-B install and its CONTRIBUTING.md §3.1 entry are agreed.
#
# Storage: userdata is on sda, but boot_* sit on LUN sde, so the shared
# init's sda-only guard keeps boot_b read-only (the same split as dodge).
Expand Down
Loading