1#!/bin/bash 2 3# Copyright 2019 The Chromium OS Authors. All rights reserved. 4# Use of this source code is governed by a BSD-style license that can be 5# found in the LICENSE file. 6 7set -e 8 9. $(dirname "$(readlink -f "${0}")")/common.sh 10 11echo "Make sure all write protect is enabled" 12enable_sw_write_protect 13check_hw_and_sw_write_protect_enabled 14 15echo "Validate initial state" 16check_has_mp_rw_firmware 17check_has_mp_ro_firmware 18check_running_rw_firmware 19check_is_rollback_set_to_initial_val 20 21echo "Reading from flash while running RW firmware should fail" 22if (read_from_flash "test.bin"); then 23 echo "Should not be able to read from flash" 24 exit 1 25fi 26 27echo "Reboot to RO" 28reboot_ec_to_ro 29check_has_mp_rw_firmware 30check_has_mp_ro_firmware 31check_running_ro_firmware 32 33echo "Reading from flash while running RO firmware should fail" 34if (read_from_flash "test.bin"); then 35 echo "Should not be able to read from flash while running RO" 36 exit 1 37fi 38 39echo "Reboot to RW" 40reboot_ec 41check_has_mp_rw_firmware 42check_has_mp_ro_firmware 43check_running_rw_firmware 44