Welcome to the internal source code documentation for Bootly. This guide breaks down the architectural modules, class diagrams, and cross-platform logic designed to make Android Boot/Recovery image handling seamless locally on a desktop environment.
Bootly-Dev/
│
├── main.py # Primary Entry Point & PyQt6 GUI Application
├── requirements.txt # Python Package Dependencies
├── README.md # Public-facing Documentation
│
├── core/ # Internal Logic Engine
│ ├── image_manager.py # Binary Execution & AVB Cryptography
│ └── utils.py # Cross-Platform Handlers & Workspace Cleaners
│
├── bin/ # Platform-specific binaries
│ ├── scripts/ # AOSP Python Scripts (e.g., avbtool.py)
│ ├── mkbootimg.exe # Windows Binaries for repacking
│ └── unpackbootimg.exe # Windows Binaries for unpacking
│
├── Documentation/ # Developer and architecture documents
├── input/ # Raw images dropped by User
└── output/ # Processed/Repacked target images
Bootly leverages PyQt6 for a scalable "Glassmorphism" / "Sleek Dark" interface.
BootlyApp(QMainWindow): The core state machine of the app. It manages aQStackedWidgetto seamlessly transition between virtual pages:- Dashboard: Image selection, live metadata viewing, and primary processing (Unpack/Repack).
- Workspace Explorer: Grid-based layout checking the localized
input/andoutput/folders to manage projects. - AVB Master Tool: Dedicated suite for generating custom VBMeta images, applying RSA signatures, and verifying integrity.
- Knowledge Base: Internal lookup database viewer.
WorkerThread(QThread): PyQt GUI applications lock up strictly if heavy operations block the main thread. We utilizeWorkerThreadto run IO tasks (like heavy image unpacking/repacking) entirely in the background, continuously emittinglog_signalandfinishedevents back to the synchronous UI console.
Responsible for directly interacting with .img files and spawning subprocesses to utilize internal bin/ tools.
unpack(): Dissects an Android image format (identifying QCOM or Mediatek headers), usesunpackbootimg, and intercepts STDOUT streams for live-console rendering.repack(): Analyzes modified workspace directories, securely packages a new ramdisk and kernel utilizingmkbootimg, and applies custom image descriptors.- God-Tier Security Bypass: In
repack(), custom regex logic (_patch_security_flags) scans the localfstaband activevbmeta.imgfiles to forcefully stripdm-verityandavbverification flags directly from the ramdisk. - AVB Wrappers: Higher order wrappers (
avb_verify_image,avb_add_hash_footer,generate_empty_vbmeta) dynamically pass custom command line arguments to the localizedbin/scripts/avbtool.py. Uses python'sos.urandom()to pass cryptographic salts, avoiding dependency on missing OS-specific randomizer nodes.
Because Bootly acts as a generalized tool, finding exact dependencies dynamically on the local machine is critical.
get_bin_path(): Maps binary executions properly. On Windows, it automatically searches and appends.exe.get_os(): Recognizes Linux vs macOS vs Windows to properly map internal OS execution chains without relying on external paths.- Directory Managers: Exposes
ensure_dir()andclear_dir()functions to securely route unzipped ramdisk folders and wipe isolated tool caches automatically.
- User drops
boot.img-> Clicks "Repack" + "Patch VBMeta". BootlyAppspawnsWorkerThread(ImageManager.repack).ImageManagerrecompresses the active local ramdisk.- Spawns system python targeting the internal
/bin/scripts/avbtool.pyscript. - Issues command:
patch_vbmeta --flags 2directly onto the local output files to forcibly override verification bits. - Passes STDOUT cleanly to PyQt UI via Thread Signal Slots. Emits final
[SUCCESS]directly to the user dashboard.