ksud: use boot partition when replace kernel

This commit is contained in:
weishu
2024-01-18 16:27:11 +08:00
parent 1e676e5dc2
commit 2fec279de3

View File

@@ -66,7 +66,9 @@ pub fn patch(
ensure_gki_kernel()?; ensure_gki_kernel()?;
} }
if kernel.is_some() { let is_replace_kernel = kernel.is_some();
if is_replace_kernel {
ensure!( ensure!(
init.is_none() && kmod.is_none(), init.is_none() && kmod.is_none(),
"init and module must not be specified." "init and module must not be specified."
@@ -101,7 +103,7 @@ pub fn patch(
let init_boot_exist = let init_boot_exist =
Path::new(&format!("/dev/block/by-name/init_boot{slot_suffix}")).exists(); Path::new(&format!("/dev/block/by-name/init_boot{slot_suffix}")).exists();
let boot_partition = if init_boot_exist { let boot_partition = if !is_replace_kernel && init_boot_exist {
format!("/dev/block/by-name/init_boot{slot_suffix}") format!("/dev/block/by-name/init_boot{slot_suffix}")
} else { } else {
format!("/dev/block/by-name/boot{slot_suffix}") format!("/dev/block/by-name/boot{slot_suffix}")