Skip to content

Commit 9d01271

Browse files
committed
--flash-ec: Fail if verify failed
The whole operation should fail Signed-off-by: Daniel Schaefer <[email protected]>
1 parent ac269af commit 9d01271

File tree

1 file changed

+6
-3
lines changed
  • framework_lib/src/chromium_ec

1 file changed

+6
-3
lines changed

framework_lib/src/chromium_ec/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ impl CrosEc {
704704
/// | 40000 | 3C000 | 39000 | RO Region |
705705
/// | 79000 | 79FFF | 01000 | Flash Flags |
706706
pub fn reflash(&self, data: &[u8], ft: EcFlashType) -> EcResult<()> {
707+
let mut res = Ok(());
707708
if ft == EcFlashType::Full || ft == EcFlashType::Ro {
708709
if let Some(version) = ec_binary::read_ec_version(data, true) {
709710
println!("EC RO Version in File: {:?}", version.version);
@@ -753,7 +754,8 @@ impl CrosEc {
753754
if rw_data == flash_rw_data {
754755
println!(" RW verify success");
755756
} else {
756-
println!("RW verify fail");
757+
error!("RW verify fail!");
758+
res = Err(EcError::DeviceError("RW verify fail!".to_string()));
757759
}
758760
}
759761

@@ -773,7 +775,8 @@ impl CrosEc {
773775
if ro_data == flash_ro_data {
774776
println!(" RO verify success");
775777
} else {
776-
println!("RO verify fail");
778+
error!("RO verify fail!");
779+
res = Err(EcError::DeviceError("RW verify fail!".to_string()));
777780
}
778781
}
779782

@@ -784,7 +787,7 @@ impl CrosEc {
784787
println!("Flashing EC done. You can reboot the EC now");
785788
// TODO: Should we force a reboot if currently running one was reflashed?
786789

787-
Ok(())
790+
res
788791
}
789792

790793
/// Write a big section of EC flash. Must be unlocked already

0 commit comments

Comments
 (0)