• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
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 "${KEY_DIR}"
28  new_firmkey_ver=$(increment_version "${KEY_DIR}" "firmware_key_version")
29
30  cd "${KEY_DIR}"
31  backup_existing_firmware_keys ${CURR_FIRM_VER} ${CURR_FIRMKEY_VER}
32
33  cat <<EOF
34Generating new firmware version key.
35
36New Firmware key version (due to firmware key change): ${new_firmkey_ver}.
37EOF
38  make_pair firmware_data_key ${FIRMWARE_DATAKEY_ALGOID} ${new_firmkey_ver}
39  make_keyblock firmware ${FIRMWARE_KEYBLOCK_MODE} firmware_data_key root_key
40
41  write_updated_version_file ${new_firmkey_ver} ${CURR_FIRM_VER} \
42    ${CURR_KERNKEY_VER} ${CURR_KERN_VER}
43}
44
45main "$@"
46