Abootcrafter
Abootcrafter is a Rust-based tool designed to manipulate android boot images like a real blacksmith. It allows you to display information about boot images, extract their components, update existing boot images, or create new ones based on provided configurations and files.
Features
- Info: Display detailed information about a boot image, including kernel, ramdisk, and second stage sizes, along with configuration details.
- Extract: Extract the kernel, ramdisk, and second stage from a boot image into separate files.
- Update: Update an existing boot image by replacing components (kernel, ramdisk, second stage) and modifying configuration settings.
- Create: Create a new boot image from provided kernel and ramdisk files, with optional second stage and configuration settings.
Installation
-
Clone the Repository:
-
Build the Project:
The binary will be located in
target/release/abootcrafter. -
Run the Program: You can run the program directly from the command line:
Usage
Display Information about a Boot Image
Extract Components from a Boot Image
-ior--input-boot-file: Path to the input boot image file.-oor--output-dir: (Optional) Directory where the extracted components will be saved. Defaults toout.
Update an Existing Boot Image
-ior--input-boot-file: Path to the input boot image file.-Cor--config-file: (Optional) Path to a TOML configuration file.-kor--kernel-file: (Optional) Path to a new kernel image file.-ror--ramdisk-file: (Optional) Path to a new ramdisk image file.-sor--second-file: (Optional) Path to a new second stage image file.--cmdline: (Optional) New command line parameters.
Create a New Boot Image
-oor--output-boot-file: Path to the output boot image file.-kor--kernel-file: Path to the kernel image file.-ror--ramdisk-file: Path to the ramdisk image file.-sor--second-file: (Optional) Path to the second stage image file.-Cor--config-file: (Optional) Path to a TOML configuration file.--cmdline: (Optional) Command line parameters.
Configuration File
The configuration file is a TOML file that can contain various settings for the boot image. Here is an example of a configuration file:
= 10485760
= 2048
= 0x10008000
= 0x11000000
= 0x12000000
= 0x10000100
= "console=ttyMSM0,115200n8 androidboot.hardware=qcom"
boot_size: (Optional) Total size of the boot image.page_size: Page size used in the boot image.kernel_addr: Address where the kernel will be loaded.ramdisk_addr: Address where the ramdisk will be loaded.second_addr: Address where the second stage will be loaded.tags_addr: Address where the tags will be loaded.cmdline: Command line parameters for the boot image.
Examples
-
Display Information:
-
Extract Components:
-
Update Boot Image:
-
Create New Boot Image:
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to open issues or pull requests to improve this tool.