blob: facd776df2ce3ddae81d532d41e7d63f51a3ec9b [file] [log] [blame]
Kris Rambish40d86512012-09-06 15:58:37 -07001#!/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.
13set -e
14
15if [ $# -ne 1 ]; then
16 cat <<EOF
17 Usage: $0 <keyset directory>
18
19 Increments the firmware version in the specified keyset.
20EOF
21 exit 1
22fi
23
24KEY_DIR=$1
25
26main() {
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
33Generating new firmware version key.
34
35New Firmware key version (due to firmware key change): ${new_firmkey_ver}.
36EOF
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
44main "$@"