Skip to content

fix A/B partition flags to match ABL#120

Merged
adeebshihadeh merged 3 commits intocommaai:masterfrom
andiradulescu:fix/gpt-bits
Mar 8, 2026
Merged

fix A/B partition flags to match ABL#120
adeebshihadeh merged 3 commits intocommaai:masterfrom
andiradulescu:fix/gpt-bits

Conversation

@andiradulescu
Copy link
Copy Markdown
Contributor

@andiradulescu andiradulescu commented Feb 11, 2026

I noticed this on Void, since abctl was using the incorrect bits and after a number of reboots I was getting "Failed to boot". On serial:

Slot _a is unbootable, trying alternate slot
Err: line:1522 FindBootableSlot() status: Load Error
Err: line:1060 LoadImageAndAuth() status: Load E

The problem is that setActiveSlot() and getActiveSlot() wrote and read A/B partition flags at wrong bit positions, 6 bits too high. This rewrites both to match ABL's SetActiveSlot().

PR #92 misinterpreted edl's AB_FLAG_OFFSET = 6 (a byte offset into the 8-byte attributes field) as a bit offset added to 48, making AB_FLAG_OFFSET = 54 instead of 48. All flag writes landed at bits 56+ which ABL ignores.

This appeared to work because after the precedence fix (6ff8067), bits 48-55 from GPT images were preserved untouched, and ABL booted from those pre-set flags. But with retry=7, successful=0 from the GPT image, the device relies on mark_boot_successful — if that also writes to the wrong bit, the device bricks after exactly 7 reboots.

Supersedes #118 which fixes precedence but not the offset.


Full research:
ab-flag-comparison.md
ab-flag-readings.md

@andiradulescu andiradulescu changed the title fix: A/B partition flags to match ABL fix A/B partition flags to match ABL Feb 12, 2026
@andiradulescu andiradulescu marked this pull request as ready for review March 8, 2026 18:55
@adeebshihadeh adeebshihadeh merged commit d1e0683 into commaai:master Mar 8, 2026
4 checks passed
@andiradulescu andiradulescu deleted the fix/gpt-bits branch March 9, 2026 05:46
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