ksud: Add boot restore

This commit is contained in:
weishu
2024-04-11 23:13:12 +08:00
parent 2d86c8bbfc
commit 3010ed89c0
2 changed files with 191 additions and 70 deletions

View File

@@ -79,7 +79,7 @@ enum Commands {
#[arg(short, long, default_value = None)]
out: Option<PathBuf>,
/// magiskboot path, if not specified, will use builtin one
/// magiskboot path, if not specified, will search from $PATH
#[arg(long, default_value = None)]
magiskboot: Option<PathBuf>,
@@ -88,6 +88,21 @@ enum Commands {
kmi: Option<String>,
},
/// Restore boot or init_boot images patched by KernelSU
BootRestore {
/// boot image path, if not specified, will try to find the boot image automatically
#[arg(short, long)]
boot: Option<PathBuf>,
/// Flash it to boot partition after patch
#[arg(short, long, default_value = "false")]
flash: bool,
/// magiskboot path, if not specified, will search from $PATH
#[arg(long, default_value = None)]
magiskboot: Option<PathBuf>,
},
/// Show boot information
BootInfo {
#[command(subcommand)]
@@ -352,6 +367,11 @@ pub fn run() -> Result<()> {
return Ok(());
}
},
Commands::BootRestore {
boot,
magiskboot,
flash,
} => crate::boot_patch::restore(boot.unwrap(), magiskboot, flash),
};
if let Err(e) = &result {