From 2fec279de373758b4ea965b488dac533fd0ab3f0 Mon Sep 17 00:00:00 2001 From: weishu Date: Thu, 18 Jan 2024 16:27:11 +0800 Subject: [PATCH] ksud: use boot partition when replace kernel --- userspace/ksud/src/boot_patch.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/userspace/ksud/src/boot_patch.rs b/userspace/ksud/src/boot_patch.rs index 619d095327dd..caf0cbdcad52 100644 --- a/userspace/ksud/src/boot_patch.rs +++ b/userspace/ksud/src/boot_patch.rs @@ -66,7 +66,9 @@ pub fn patch( ensure_gki_kernel()?; } - if kernel.is_some() { + let is_replace_kernel = kernel.is_some(); + + if is_replace_kernel { ensure!( init.is_none() && kmod.is_none(), "init and module must not be specified." @@ -101,7 +103,7 @@ pub fn patch( let init_boot_exist = 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}") } else { format!("/dev/block/by-name/boot{slot_suffix}")