OLD | NEW |
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 keys of our choosing. | 8 # with keys of our choosing. |
9 | 9 |
10 # Load common constants. This should be the first executable line. | 10 # --- BEGIN COMMON.SH BOILERPLATE --- |
11 # The path to common.sh should be relative to your script's location. | 11 # Load common CrOS utilities. Inside the chroot this file is installed in |
12 . "$(dirname "$0")/../common.sh" | 12 # /usr/lib/crosutils. Outside the chroot we find it relative to the script's |
| 13 # location. |
| 14 find_common_sh() { |
| 15 local common_paths=(/usr/lib/crosutils "$(dirname "$(readlink -f "$0")")/..") |
| 16 local path |
13 | 17 |
14 . "$(dirname "$0")/../chromeos-common.sh" # for partoffset and partsize | 18 SCRIPT_ROOT= |
| 19 for path in "${common_paths[@]}"; do |
| 20 if [ -r "${path}/common.sh" ]; then |
| 21 SCRIPT_ROOT=${path} |
| 22 break |
| 23 fi |
| 24 done |
| 25 } |
| 26 |
| 27 find_common_sh |
| 28 . "${SCRIPT_ROOT}/common.sh" || (echo "Unable to load common.sh" && exit 1) |
| 29 # --- END COMMON.SH BOILERPLATE --- |
| 30 |
| 31 # Need to be inside the chroot to load chromeos-common.sh |
| 32 assert_inside_chroot |
| 33 |
| 34 # Load functions and constants for chromeos-install |
| 35 . "/usr/lib/installer/chromeos-common.sh" || \ |
| 36 die "Unable to load /usr/lib/installer/chromeos-common.sh" |
15 | 37 |
16 locate_gpt | 38 locate_gpt |
17 | 39 |
18 DEFINE_string from "chromiumos_image.bin" \ | 40 DEFINE_string from "chromiumos_image.bin" \ |
19 "Input file name of Chrome OS image to re-sign." | 41 "Input file name of Chrome OS image to re-sign." |
20 DEFINE_string datakey "" \ | 42 DEFINE_string datakey "" \ |
21 "Private Kernel Data Key (.vbprivk) to use for re-signing." | 43 "Private Kernel Data Key (.vbprivk) to use for re-signing." |
22 DEFINE_string keyblock "" \ | 44 DEFINE_string keyblock "" \ |
23 "Kernel Keyblock (.keyblock) to use for generating the vblock" | 45 "Kernel Keyblock (.keyblock) to use for generating the vblock" |
24 DEFINE_string to "" \ | 46 DEFINE_string to "" \ |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if [ ! -z $FLAGS_vsubkey ]; then | 109 if [ ! -z $FLAGS_vsubkey ]; then |
88 ${FLAGS_vbutil_dir}load_kernel_test "${FLAGS_to}" "${FLAGS_vsubkey}" \ | 110 ${FLAGS_vbutil_dir}load_kernel_test "${FLAGS_to}" "${FLAGS_vsubkey}" \ |
89 ${FLAGS_bootflags} | 111 ${FLAGS_bootflags} |
90 fi | 112 fi |
91 | 113 |
92 echo "New signed image was output to ${FLAGS_to}" | 114 echo "New signed image was output to ${FLAGS_to}" |
93 | 115 |
94 # Clean up temporary files | 116 # Clean up temporary files |
95 rm -f ${temp_kimage} | 117 rm -f ${temp_kimage} |
96 rm -f ${temp_out_vb} | 118 rm -f ${temp_out_vb} |
OLD | NEW |