increment_kernel_subkey.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. # Script to increment kernel subkey for firmware updates.
  6. # Used when revving versions for a firmware update.
  7. # Load common constants and variables.
  8. . "$(dirname "$0")/common.sh"
  9. # Abort on errors.
  10. set -e
  11. if [ $# -ne 1 ]; then
  12. cat <<EOF
  13. Usage: $0 <keyset directory>
  14. Increments the kernel subkey in the specified keyset.
  15. EOF
  16. exit 1
  17. fi
  18. KEY_DIR=$1
  19. main() {
  20. load_current_versions "${KEY_DIR}"
  21. new_firm_ver=$(increment_version "${KEY_DIR}" "firmware_version")
  22. cd "${KEY_DIR}"
  23. backup_existing_kernel_subkeys ${CURR_FIRM_VER} ${CURR_KERNKEY_VER}
  24. cat <<EOF
  25. Generating new kernel subkey and new kernel keyblock.
  26. New Firmware version (due to kernel subkey change): ${new_firm_ver}.
  27. EOF
  28. make_pair kernel_subkey ${KERNEL_SUBKEY_ALGOID} ${new_firm_ver}
  29. make_keyblock kernel $KERNEL_KEYBLOCK_MODE kernel_data_key kernel_subkey
  30. write_updated_version_file ${CURR_FIRMKEY_VER} ${new_firm_ver} \
  31. ${CURR_KERNKEY_VER} ${CURR_KERN_VER}
  32. }
  33. main "$@"