Skip to content

fix A/B partition flags to match ABL#120

Draft
andiradulescu wants to merge 2 commits intocommaai:masterfrom
andiradulescu:fix/gpt-bits
Draft

fix A/B partition flags to match ABL#120
andiradulescu wants to merge 2 commits intocommaai:masterfrom
andiradulescu:fix/gpt-bits

Conversation

@andiradulescu
Copy link
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.

Probably keeping this as draft until Void is ready to review.


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

1 participant