Kris Rambish | 40d8651 | 2012-09-06 15:58:37 -0700 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 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 | . "$(dirname "$0")/common.sh" |
| 11 | |
| 12 | # Abort on errors. |
| 13 | set -e |
| 14 | |
| 15 | if [ $# -ne 1 ]; then |
| 16 | cat <<EOF |
| 17 | Usage: $0 <keyset directory> |
| 18 | |
| 19 | Increments the firmware version in the specified keyset. |
| 20 | EOF |
| 21 | exit 1 |
| 22 | fi |
| 23 | |
| 24 | KEY_DIR=$1 |
| 25 | |
| 26 | main() { |
| 27 | load_current_versions |
| 28 | new_firmkey_ver=$(increment_version "${KEY_DIR}" "firmware_key_version") |
| 29 | |
| 30 | backup_existing_firmware_keys ${CURR_FIRM_VER} ${CURR_FIRMKEY_VER} |
| 31 | |
| 32 | cat <<EOF |
| 33 | Generating new firmware version key. |
| 34 | |
| 35 | New Firmware key version (due to firmware key change): ${new_firmkey_ver}. |
| 36 | EOF |
| 37 | make_pair firmware_data_key ${FIRMWARE_DATAKEY_ALGOID} ${new_firmkey_ver} |
| 38 | make_keyblock firmware ${FIRMWARE_KEYBLOCK_MODE} firmware_data_key root_key |
| 39 | |
| 40 | write_updated_version_file ${new_firmkey_ver} ${CURR_FIRM_VER} \ |
| 41 | ${CURR_KERNKEY_VER} ${CURR_KERN_VER} |
| 42 | } |
| 43 | |
| 44 | main "$@" |