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 # Standalone version of cros_resign_image.sh script from | 7 # Standalone version of cros_resign_image.sh script from |
8 # from chromeos/src/scripts/bin/ for use on signing servers. | 8 # from chromeos/src/scripts/bin/ for use on signing servers. |
9 | 9 |
10 # Both the cgpt tool and vbutil_kernel should be in the system path. | 10 # Both the cgpt tool and vbutil_kernel should be in the system path. |
11 | 11 |
| 12 # Abort on error |
| 13 set -e |
| 14 |
12 # Check arguments | 15 # Check arguments |
13 if [ $# -ne 4 ] ; then | 16 if [ $# -ne 4 ] ; then |
14 echo "usage: $0 src_bin dst_bin kernel_datakey kernel_keyblock" | 17 echo "usage: $0 src_bin dst_bin kernel_datakey kernel_keyblock" |
15 exit 1 | 18 exit 1 |
16 fi | 19 fi |
17 | 20 |
18 # Make sure the tools we need are available. | 21 # Make sure the tools we need are available. |
19 type -P cgpt &>/dev/null || \ | 22 type -P cgpt &>/dev/null || \ |
20 { echo "cgpt tool not found."; exit 1; } | 23 { echo "cgpt tool not found."; exit 1; } |
21 type -P vbutil_kernel &>/dev/null || \ | 24 type -P vbutil_kernel &>/dev/null || \ |
(...skipping 25 matching lines...) Expand all Loading... |
47 --signprivate "${kernel_datakey}" \ | 50 --signprivate "${kernel_datakey}" \ |
48 --oldblob "${temp_kimage}" | 51 --oldblob "${temp_kimage}" |
49 | 52 |
50 # Create a copy of the input image and put in the new vblock | 53 # Create a copy of the input image and put in the new vblock |
51 cp "${src_bin}" "${dst_bin}" | 54 cp "${src_bin}" "${dst_bin}" |
52 dd if="${temp_out_vb}" of="${dst_bin}" seek=$koffset bs=$sector_size \ | 55 dd if="${temp_out_vb}" of="${dst_bin}" seek=$koffset bs=$sector_size \ |
53 count=$num_sectors_vb conv=notrunc | 56 count=$num_sectors_vb conv=notrunc |
54 | 57 |
55 echo "New signed image was output to ${dst_bin}" | 58 echo "New signed image was output to ${dst_bin}" |
56 | 59 |
57 # Clean up temporary files | |
58 rm -f ${temp_kimage} | |
59 rm -f ${temp_out_vb} | |
OLD | NEW |