Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2644)

Unified Diff: scripts/image_signing/make_dev_firmware.sh

Issue 5987010: vboot_reference/make_dev_firmware: check write protection status before making changes (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git@master
Patch Set: fix param checking Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/image_signing/make_dev_firmware.sh
diff --git a/scripts/image_signing/make_dev_firmware.sh b/scripts/image_signing/make_dev_firmware.sh
index f4e7d49d7052c013f91c1bbd371859119c7534ae..e07ea8ef0f48646ed7ad2588d953a92dcbd3a046 100755
--- a/scripts/image_signing/make_dev_firmware.sh
+++ b/scripts/image_signing/make_dev_firmware.sh
@@ -62,6 +62,21 @@ debug_msg() {
fi
}
+# Disables write protection status registers
+disable_write_protection() {
+ # No need to change WP status in file mode
+ if [ -n "$FLAGS_to" ]; then
+ return $FLAGS_TRUE
+ fi
+
+ # --wp-disable command may return success even if WP is still enabled,
+ # so we should use --wp-status to verify the results.
+ echo "Disabling system software write protection status..."
+ (flashrom --wp-disable && flashrom --wp-status) 2>&1 |
+ tee "$EXEC_LOG" |
+ grep -q '^WP: .* is disabled\.$'
+}
+
# Reads $IMAGE from $FLAGS_from
read_image() {
if [ -z "$FLAGS_from" ]; then
@@ -141,7 +156,14 @@ main() {
ensure_files_exist "$FLAGS_from"
fi
- # TODO(hungte) check if GPIO.3 (WP) is enabled
+ debug_msg "Checking software write protection status"
+ disable_write_protection ||
+ if is_debug_mode; then
+ err_die "Failed to disable WP. Diagnose Message: $(cat "$EXEC_LOG")"
+ else
+ err_die "Write protection is still enabled. " \
+ "Please verify that hardware write protection is disabled."
+ fi
debug_msg "Pulling image to $IMAGE"
(read_image && [ -s "$IMAGE" ]) ||
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698