OLD | NEW |
(Empty) | |
| 1 #!/bin/bash |
| 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. |
| 6 |
| 7 # Script to resign the kernel partition generated in the output of build_image |
| 8 # with SSD keys. |
| 9 |
| 10 # Load common constants. This should be the first executable line. |
| 11 # The path to common.sh should be relative to your script's location. |
| 12 . "$(dirname "$0")/../common.sh" |
| 13 |
| 14 . "$(dirname "$0")/../chromeos-common.sh" # for partoffset and partsize |
| 15 |
| 16 locate_gpt |
| 17 |
| 18 DEFINE_string from "chromiumos_image.bin" \ |
| 19 "Input file name of Chrome OS image to re-sign." |
| 20 |
| 21 # Parse command line |
| 22 FLAGS "$@" || exit 1 |
| 23 eval set -- "${FLAGS_ARGV}" |
| 24 |
| 25 # Abort on error |
| 26 set -e |
| 27 |
| 28 if [ -z $FLAGS_from ] || [ ! -f $FLAGS_from ] ; then |
| 29 echo "Error: invalid flag --from" |
| 30 exit 1 |
| 31 fi |
| 32 |
| 33 # Example commandline is as follows: |
| 34 # ./bin/cros_resign_image.sh \ |
| 35 #--from ../build/images/x86-generic/b903/chromiumos_ssd_image.bin \ |
| 36 #--datakey ../platform/vboot_reference/tests/devkeys/kernel_data_key.vbprivk \ |
| 37 #--keyblock ../platform/vboot_reference/tests/devkeys/kernel.keyblock \ |
| 38 #--vsubkey ../platform/vboot_reference/tests/devkeys/kernel_subkey.vbpubk \ |
| 39 #--vbutil_dir /usr/bin/ \ |
| 40 #--to ../build/images/x86-generic/b903/chromiumos_ssd_test_image.bin |
| 41 |
| 42 |
| 43 TMP_IMAGE=/tmp/image.bin |
| 44 VBOOT_KEYS=$(dirname "$0")/../../platform/vboot_reference/tests/devkeys |
| 45 cp $FLAGS_from $TMP_IMAGE |
| 46 |
| 47 $(dirname "$0")/cros_resign_image.sh \ |
| 48 --from $TMP_IMAGE \ |
| 49 --datakey ${VBOOT_KEYS}/kernel_data_key.vbprivk \ |
| 50 --keyblock ${VBOOT_KEYS}/kernel.keyblock \ |
| 51 --vsubkey ${VBOOT_KEYS}/kernel_subkey.vbpubk \ |
| 52 --vbutil_dir /usr/bin/ \ |
| 53 --to $FLAGS_from |
| 54 |
| 55 rm $TMP_IMAGE |
| 56 |
OLD | NEW |