Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: bin/cros_sign_to_ssd

Issue 3273011: fix sign_to_ssd (Closed) Base URL: http://git.chromium.org/git/crosutils.git
Patch Set: rebase Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/bin/bash 1 #!/bin/bash
2 2
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 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 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 # Script to resign the kernel partition generated in the output of build_image 7 # Script to resign the kernel partition generated in the output of build_image
8 # with SSD keys. 8 # with SSD keys.
9 9
10 # Load common constants. This should be the first executable line. 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. 11 # The path to common.sh should be relative to your script's location.
12 . "$(dirname "$0")/../common.sh" 12 . "$(dirname "$0")/../common.sh"
13 13
14 . "$(dirname "$0")/../chromeos-common.sh" # for partoffset and partsize 14 . "$(dirname "$0")/../chromeos-common.sh" # for partoffset and partsize
15 15
16 locate_gpt 16 locate_gpt
17 17
18 DEFINE_string from "chromiumos_image.bin" \ 18 DEFINE_string from "chromiumos_image.bin" \
19 "Input file name of Chrome OS image to re-sign." 19 "Input file name of Chrome OS image to re-sign."
20 20
21 # Parse command line 21 # Parse command line
22 FLAGS "$@" || exit 1 22 FLAGS "$@" || exit 1
23 eval set -- "${FLAGS_ARGV}" 23 eval set -- "${FLAGS_ARGV}"
24 24
25 failure() {
26 echo "SIGNING HAD FAILED"
27 exit 1
28 }
29
25 # Abort on error 30 # Abort on error
26 set -e 31 set -e
27 32
28 if [ -z $FLAGS_from ] || [ ! -f $FLAGS_from ] ; then 33 trap "failure" EXIT
34
35 if [ -z "${FLAGS_from}" ] || [ ! -f "${FLAGS_from}" ] ; then
29 echo "Error: invalid flag --from" 36 echo "Error: invalid flag --from"
30 exit 1 37 exit 1
31 fi 38 fi
32 39
33 # Example commandline is as follows: 40 # Example commandline is as follows:
34 # ./bin/cros_resign_image.sh \ 41 # ./sign_official_build.sh \
35 #--from ../build/images/x86-generic/b903/chromiumos_ssd_image.bin \ 42 # ssd \
36 #--datakey ../platform/vboot_reference/tests/devkeys/kernel_data_key.vbprivk \ 43 # /.../build/images/x86-mario/0.8.68.2/chromiumos_test_image.bin \
37 #--keyblock ../platform/vboot_reference/tests/devkeys/kernel.keyblock \ 44 # ../../tests/devkeys/ \
38 #--vsubkey ../platform/vboot_reference/tests/devkeys/kernel_subkey.vbpubk \ 45 # /.../build/images/x86-mario/0.8.68.2/chromiumos_test_ssd_image.bin
39 #--vbutil_dir /usr/bin/ \
40 #--to ../build/images/x86-generic/b903/chromiumos_ssd_test_image.bin
41 46
47 VBOOT_DIR="$(dirname "$0")/../../platform/vboot_reference"
48 if [ ! -d "${VBOOT_DIR}" ]; then
49 die "VBOOT DIR NOT FOUND at \'${VBOOT_DIR}\' .."
50 fi
42 51
43 TMP_IMAGE=/tmp/image.bin 52 TMP_IMAGE=$(mktemp)
44 VBOOT_KEYS=$(dirname "$0")/../../platform/vboot_reference/tests/devkeys 53 VBOOT_KEYS="${VBOOT_DIR}/tests/devkeys"
45 cp $FLAGS_from $TMP_IMAGE 54 if [ ! -d "${VBOOT_KEYS}" ]; then
55 die "VBOOT KEYS NOT FOUND at \'${VBOOT_KEYS}\' .."
56 fi
46 57
47 $(dirname "$0")/cros_resign_image.sh \ 58 VBOOT_SIGN="${VBOOT_DIR}/scripts/image_signing/sign_official_build.sh"
48 --from $TMP_IMAGE \ 59 if [ ! -x "${VBOOT_SIGN}" ]; then
49 --datakey ${VBOOT_KEYS}/kernel_data_key.vbprivk \ 60 die "VBOOT TOOL sign_official_build.sh NOT FOUND at \'${VBOOT_SIGN}\' .."
50 --keyblock ${VBOOT_KEYS}/kernel.keyblock \ 61 fi
51 --vsubkey ${VBOOT_KEYS}/kernel_subkey.vbpubk \
52 --vbutil_dir /usr/bin/ \
53 --to $FLAGS_from
54 62
55 rm $TMP_IMAGE 63 cp "${FLAGS_from}" "${TMP_IMAGE}"
56 64
65 ${VBOOT_SIGN} ssd "${TMP_IMAGE}" "${VBOOT_KEYS}" "${FLAGS_from}"
66
67 rm "${TMP_IMAGE}"
68
69 set +e
70 trap - EXIT
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698