• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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"
12check_hw_and_sw_write_protect_enabled
13
14echo "Validate initial state"
15check_has_mp_rw_firmware
16check_has_mp_ro_firmware
17check_running_rw_firmware
18check_is_rollback_set_to_initial_val
19
20echo "Reading from flash while running RW firmware should fail"
21if (read_from_flash "test.bin"); then
22  echo "Should not be able to read from flash"
23  exit 1
24fi
25
26echo "Reboot to RO"
27reboot_ec_to_ro
28check_has_mp_rw_firmware
29check_has_mp_ro_firmware
30check_running_ro_firmware
31
32echo "Reading from flash while running RO firmware should fail"
33if (read_from_flash "test.bin"); then
34  echo "Should not be able to read from flash while running RO"
35  exit 1
36fi
37
38echo "Reboot to RW"
39reboot_ec
40check_has_mp_rw_firmware
41check_has_mp_ro_firmware
42check_running_rw_firmware
43