1#!/bin/bash 2# Copyright 2012 The ChromiumOS Authors 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6# Script to increment firmware version key for firmware updates. 7# Used when revving versions for a firmware update. 8 9# Load common constants and variables. 10# shellcheck source=common.sh 11. "$(dirname "$0")/common.sh" 12 13# Abort on errors. 14set -e 15 16if [ $# -ne 1 ]; then 17 cat <<EOF 18 Usage: $0 <keyset directory> 19 20 Increments the firmware version in the specified keyset. 21EOF 22 exit 1 23fi 24 25KEY_DIR=$1 26 27main() { 28 load_current_versions "${KEY_DIR}" 29 new_firmkey_ver=$(increment_version "${KEY_DIR}" "firmware_key_version") 30 31 cd "${KEY_DIR}" 32 backup_existing_firmware_keys ${CURR_FIRM_VER} ${CURR_FIRMKEY_VER} 33 34 cat <<EOF 35Generating new firmware version key. 36 37New Firmware key version (due to firmware key change): ${new_firmkey_ver}. 38EOF 39 make_pair firmware_data_key ${FIRMWARE_DATAKEY_ALGOID} ${new_firmkey_ver} 40 make_keyblock firmware ${FIRMWARE_KEYBLOCK_MODE} firmware_data_key root_key 41 42 write_updated_version_file ${new_firmkey_ver} ${CURR_FIRM_VER} \ 43 ${CURR_KERNKEY_VER} ${CURR_KERN_VER} 44} 45 46main "$@" 47