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 kernel subkey 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 kernel subkey in the specified keyset. 20 EOF 21 exit 1 22 fi 23 24 KEY_DIR=$1 25 26 main() { 27 load_current_versions "${KEY_DIR}" 28 new_firm_ver=$(increment_version "${KEY_DIR}" "firmware_version") 29 30 cd "${KEY_DIR}" 31 backup_existing_kernel_subkeys ${CURR_FIRM_VER} ${CURR_KERNKEY_VER} 32 33 cat <<EOF 34 Generating new kernel subkey and new kernel keyblock. 35 36 New Firmware version (due to kernel subkey change): ${new_firm_ver}. 37 EOF 38 make_pair kernel_subkey ${KERNEL_SUBKEY_ALGOID} ${new_firm_ver} 39 make_keyblock kernel $KERNEL_KEYBLOCK_MODE kernel_data_key kernel_subkey 40 41 write_updated_version_file ${CURR_FIRMKEY_VER} ${new_firm_ver} \ 42 ${CURR_KERNKEY_VER} ${CURR_KERN_VER} 43 } 44 45 main "$@" 46