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 "Running test to validate that RO can update the RW firmware" 12 13readonly DEV_FW_FILE="${1}" 14readonly RB0_FW_FILE="${2}" 15 16check_file_exists "${DEV_FW_FILE}" 17check_file_exists "${RB0_FW_FILE}" 18 19echo "Making sure all write protect is enabled" 20enable_sw_write_protect 21check_hw_and_sw_write_protect_enabled 22 23echo "Validating initial state" 24check_has_dev_rw_firmware 25check_has_dev_ro_firmware 26check_running_rw_firmware 27check_is_rollback_set_to_initial_val 28 29echo "Flashing RB0 firmware" 30flash_rw_firmware "${RB0_FW_FILE}" 31 32echo "Validating we're running RB0 as RW" 33check_has_dev_ro_firmware 34check_has_rb0_rw_firmware 35check_running_rw_firmware 36check_is_rollback_set_to_initial_val 37 38echo "Flashing dev firmware" 39flash_rw_firmware "${DEV_FW_FILE}" 40check_has_dev_rw_firmware 41check_has_dev_ro_firmware 42check_running_rw_firmware 43check_is_rollback_set_to_initial_val 44