No description
  • C 85.8%
  • Shell 9.6%
  • Makefile 4.6%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-07-28 18:18:54 +02:00
lib bctltool: Initial commit 2026-07-28 18:18:54 +02:00
scripts bctltool: Initial commit 2026-07-28 18:18:54 +02:00
.gitignore bctltool: Initial commit 2026-07-28 18:18:54 +02:00
bctltool.c bctltool: Initial commit 2026-07-28 18:18:54 +02:00
LICENSE.BSD bctltool: Initial commit 2026-07-28 18:18:54 +02:00
LICENSE.GPL bctltool: Initial commit 2026-07-28 18:18:54 +02:00
Makefile bctltool: Initial commit 2026-07-28 18:18:54 +02:00
README.md bctltool: Initial commit 2026-07-28 18:18:54 +02:00

bctltool

Reads and writes the A/B boot control block that Android keeps in the misc partition.

Works on a device over adb/recovery shell, or on a dumped misc image on your host.

Building

make

For Android:

make android

Usage

Without -f the tool looks for misc in the usual by-name locations.

bctltool dump                    # decode the whole block
bctltool get active
bctltool set active b
bctltool mark a unbootable
bctltool mark b successful
bctltool -f misc.img dump        # work on a dump instead

dump gives you the whole picture at once:

BootControl [Magic: BCAB | Ver: 1 | CRC: 0xaf100e51 (valid)]
  suffix:           _a
  slot_count:       2
  recovery_tries:   0
  merge_status:     0 (none)

  Slot A (_a) [active]
    priority:         15
    tries_remaining:  7
    successful_boot:  no
    verity_corrupted: no
  Slot B (_b)
    priority:         14
    tries_remaining:  7
    successful_boot:  no
    verity_corrupted: no

Individual fields, if you need finer control:

bctltool get a priority
bctltool set a tries 7
bctltool set merge none

License

Dual-licensed, BSD-3-Clause or GPL-2.0-or-later, your choice.