increment_firmware_data_key.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 firmware version key 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 firmware version 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_firmkey_ver=$(increment_version "${KEY_DIR}" "firmware_key_version")
  22. cd "${KEY_DIR}"
  23. backup_existing_firmware_keys ${CURR_FIRM_VER} ${CURR_FIRMKEY_VER}
  24. cat <<EOF
  25. Generating new firmware version key.
  26. New Firmware key version (due to firmware key change): ${new_firmkey_ver}.
  27. EOF
  28. make_pair firmware_data_key ${FIRMWARE_DATAKEY_ALGOID} ${new_firmkey_ver}
  29. make_keyblock firmware ${FIRMWARE_KEYBLOCK_MODE} firmware_data_key root_key
  30. write_updated_version_file ${new_firmkey_ver} ${CURR_FIRM_VER} \
  31. ${CURR_KERNKEY_VER} ${CURR_KERN_VER}
  32. }
  33. main "$@"