abootimg-oxide

Crates.ioabootimg-oxide
lib.rsabootimg-oxide
version0.2.2
created_at2024-09-05 22:14:36.194901+00
updated_at2025-07-30 02:48:57.079942+00
descriptionAndroid boot image (boot.img) parser
homepage
repositoryhttps://github.com/axelkar/abootimg-oxide
max_upload_size
id1365225
size55,318
Axel Karjalainen (axelkar)

documentation

README

abootimg-oxide

Crates.io Documentation Crates.io MSRV Crates.io License Crates.io Total Downloads

Android boot image (boot.img) parser written in Rust

unpack_bootimg has been fully reimplemented using this library. Try it by running cargo run --package=unpack_bootimg -- --boot_img <path to boot.img>.

TODO: reimplement mkbootimg

Examples

use std::fs::File;
use abootimg_oxide::{BufReader, Header};

let mut r = BufReader::new(File::open("boot_a.img").unwrap());
let hdr = Header::parse(&mut r).unwrap();
println!("{hdr:#?}");

// Extract the kernel
use std::io::{self, BufWriter, Read, Seek, SeekFrom};

let mut w = BufWriter::new(File::create("boot_a_kernel").unwrap());
let r = r.get_mut();
r.seek(SeekFrom::Start(hdr.kernel_position() as u64))
    .unwrap();
io::copy(&mut r.take(hdr.kernel_size().into()), w.get_mut()).unwrap();

License

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 10

cargo fmt