• 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# shellcheck source=./common.sh
10. "$(dirname "$(readlink -f "${0}")")/common.sh"
11
12echo "Running test to verify that RW cannot update RO"
13
14readonly fw_file="${1}"
15
16check_file_exists "${fw_file}"
17
18echo "Making sure all write protect is enabled"
19check_hw_and_sw_write_protect_enabled
20
21echo "Validating initial state"
22check_has_mp_rw_firmware
23check_has_mp_ro_firmware
24check_running_rw_firmware
25check_is_rollback_set_to_initial_val
26
27echo "Flashing RO firmware (expected to fail)"
28flash_ro_cmd="flashrom --noverify-all -V -p ec:type=fp -i EC_RO -w ${fw_file}"
29if ${flash_ro_cmd}; then
30  echo "Expected flashing of read-only firmware to fail"
31  exit 1
32fi
33