increment_kernel_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 kernel data 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 kernel data key 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_kernkey_ver=$(increment_version "${KEY_DIR}" "kernel_key_version")
  22. cd "${KEY_DIR}"
  23. backup_existing_kernel_data_keys ${CURR_FIRM_VER} ${CURR_KERNKEY_VER}
  24. cat <<EOF
  25. Generating new kernel data version, and new kernel keyblock.
  26. New Kernel data key version: ${new_kernkey_ver}.
  27. EOF
  28. make_pair kernel_data_key ${KERNEL_DATAKEY_ALGOID} ${new_kernkey_ver}
  29. make_keyblock kernel ${KERNEL_KEYBLOCK_MODE} kernel_data_key kernel_subkey
  30. write_updated_version_file ${CURR_FIRMKEY_VER} ${CURR_FIRM_VER} \
  31. ${new_kernkey_ver} ${CURR_KERN_VER}
  32. }
  33. main "$@"