Build twrp.cpp as libtwrp_main (main renamed twrp_main under PAWLET_TWRP_PLUGIN) and call it from PawletTwrpUI::Init(), so recovery gets TWRP's full startup: fstab processing, BCB clearing, recovery-mode command handling, language loading and its own reboot handling. Falls back to the stub UI if TWRP startup fails. Add tw_no_batt_percent / tw_use_legacy_battery_services soong config flags for boards without a battery or a health HAL in recovery.
recovery_toolkit
TWRP's partition manager, backup engine, filesystem/format support, and
scripting/automation tooling — the "standalone additive" bucket from the
TWRP-vs-stock-recovery diff (confirmed via source grep: zero references
either direction between this code and recovery.cpp/install/install.cpp,
so none of it requires forking stock bootable/recovery). See the main
workspace's notes/ota-non-a-ab-research-work.md for the full investigation.
Source copied verbatim from TeamWin's android_bootable_recovery
(android-14.1), the only living copy found (Google removed the equivalent
functionality's siblings — applypatch/updater/edify — from stock AOSP
in 2024; see external_update_binary).
Status: everything builds, pawlet_rpi4 links clean (2026-09-30)
Every subdirectory listed below now has a real Android.bp and compiles.
PAWLET_BUILD_RECOVERY=1 m recoveryimage for pawlet_rpi4 produces a real
recovery.img with the TWRP GUI plugin linked. See notes/recovery-work.md
(main workspace) for the full per-module table, the stock-AOSP patches this
needed, and the (large) section on whole_static_libs pitfalls — read that
before changing any dependency list here, it documents several
non-obvious failure modes found the hard way.
Layout
partitionmanager/—partition.cpp,partitionmanager.cpp,partitions.hpp,BasePartition.cpp.backup/—twrpTar.*,tarWrite.*,twrpDigestDriver.*,twrpAdbBuFifo.*,twrpApex.*,infomanager.*, pluslibtar/,twrpDigest/,adbbu/,twrpTarMain/(each of those four already has its own directory structure from upstream, not yet inspected for existing build files).- Filesystem/format support:
exfat/,dosfstools/,libblkid/,simg2img/,minzip/,openaes/,gpt/,fuse/(+fuse.h),mtp/,crypto/. scripting/(openrecoveryscript.*) +orscmd/+twrpinstall/— TWRP's scripting/automation interface.twrpinstall/is referenced byrecovery_ui/gui/Android.bp'sinclude_dirsalready (this module needs to exist beforerecovery_uican build).helpers/— shared utilities (find_file.*,exclude.*,fixContexts.*,mounts.c,startupArgs.*,progresstracking.*,kernel_module_loader.*,abx-functions.hpp,twrp-functions.*,twrp.cpp), pluslibcrecovery/,libmincrypt/,attr/.
If picking up further work here
Remaining filesystem/format tools (exfat/dosfstools/simg2img/minzip/
fuse/mtp) and the rest of crypto//gpt/ are still source-only —
nothing currently compiled references them (not needed unless a future
feature wants those formats or TW_INCLUDE_CRYPTO). scripting/
(openrecoveryscript) and twrp.cpp itself are already handled — see
notes/recovery-work.md's per-module table for what's built and why
twrp.cpp specifically isn't (only 3 of its globals were needed; they were
moved into partitionmanager.cpp instead).
License
Not uniform — check before assuming GPL-3.0. TeamWin's own code
(partitionmanager/, backup/, helpers/, scripting/) is GPL-3.0, same
as recovery_ui. libblkid/libuuid (in libblkid/) are LGPL-2.1/
public-domain (upstream util-linux), and libtar/ is a separate permissive
BSD-style license (University of Illinois) — each needs its own license
module, not a blanket GPL-3.0 package{}. None of this is added to this
repo yet.