Magisk/native/src/boot/lib.rs

36 lines
809 B
Rust
Raw Normal View History

#![feature(format_args_nl)]
2023-06-09 13:43:26 +00:00
#![feature(btree_drain_filter)]
2022-07-01 11:53:41 +00:00
pub use base;
2023-06-20 21:29:09 +00:00
use cpio::*;
use payload::*;
2023-05-05 01:49:33 +00:00
2023-06-09 13:43:26 +00:00
mod cpio;
2023-05-05 01:49:33 +00:00
mod payload;
2023-06-20 21:29:09 +00:00
// Suppress warnings in generated code
#[allow(warnings)]
2023-06-20 16:22:48 +00:00
mod proto;
2023-06-09 13:43:26 +00:00
mod ramdisk;
#[cxx::bridge]
2023-05-05 01:49:33 +00:00
pub mod ffi {
unsafe extern "C++" {
2023-05-19 22:16:54 +00:00
include!("compress.hpp");
2023-06-09 13:43:26 +00:00
include!("magiskboot.hpp");
fn decompress(buf: &[u8], fd: i32) -> bool;
2023-06-11 00:11:02 +00:00
fn patch_encryption(buf: &mut [u8]) -> usize;
fn patch_verity(buf: &mut [u8]) -> usize;
}
#[namespace = "rust"]
extern "Rust" {
unsafe fn extract_boot_from_payload(
partition: *const c_char,
in_path: *const c_char,
out_path: *const c_char,
) -> bool;
2023-06-09 13:43:26 +00:00
unsafe fn cpio_commands(argc: i32, argv: *const *const c_char) -> bool;
}
}