From 4ff446b493e8a74804fd00082119681f768d366a Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Fri, 14 Feb 2014 09:00:34 +0800 Subject: set_gbb_flags: Aborts only if HW & SW WP are both enabled. Early proto devices (for testers and developers) may have hardware write protection enabled and software disabled. They can still flash SPI ROM in that case, and no need to disable hardware WP switch. BRANCH=none BUG=chromium:341242 TEST=./set_gbb_flags.sh 0x39 # see WP messages. Change-Id: Id320410795a162a009b80360c2225c7510337591 Reviewed-on: https://chromium-review.googlesource.com/186336 Tested-by: Hung-Te Lin Reviewed-by: Shawn Nematbakhsh Commit-Queue: Hung-Te Lin Reviewed-by: Randall Spangler --- scripts/image_signing/set_gbb_flags.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/scripts/image_signing/set_gbb_flags.sh b/scripts/image_signing/set_gbb_flags.sh index 157913aa..f114d413 100755 --- a/scripts/image_signing/set_gbb_flags.sh +++ b/scripts/image_signing/set_gbb_flags.sh @@ -51,19 +51,20 @@ FLASHROM_WRITE_OPT="$FLASHROM_COMMON_OPT -i GBB --fast-verify -w" # Check write protection # ---------------------------------------------------------------------------- check_write_protection() { - local ret=$FLAGS_TRUE + local hw_wp="" sw_wp="" if ! crossystem "wpsw_boot?0"; then - echo "Hardware write protection must be disabled." - ret=$FLAGS_FALSE + hw_wp="on" fi local wp_states="$(flashrom --wp-status 2>/dev/null | grep WP)" local wp_disabled="$(echo "$wp_states" | grep "WP:.*is disabled.")" local wp_zero_len="$(echo "$wp_states" | grep "WP:.*, len=0x00000000")" if [ -z "$wp_disabled" -a -z "$wp_zero_len" ]; then - echo "Software write protection must be disabled." - ret=$FLAGS_FALSE + sw_wp="on" fi - return $ret + if [ -n "$hw_wp" -a -n "$sw_wp" ]; then + return $FLAGS_FALSE + fi + return $FLAGS_TRUE } # Main -- cgit v1.2.1