| 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 that just takes in a kernel partition and outputs a new vblock | 7 # Script that just takes in a kernel partition and outputs a new vblock |
| 8 # signed with the specific keys. For use on signing servers. | 8 # signed with the specific keys. For use on signing servers. |
| 9 | 9 |
| 10 # vbutil_kernel must be in the system path. | 10 # vbutil_kernel must be in the system path. |
| 11 | 11 |
| 12 SCRIPT_DIR=$(dirname $0) |
| 13 |
| 12 # Abort on error | 14 # Abort on error |
| 13 set -e | 15 set -e |
| 14 | 16 |
| 15 # Check arguments | 17 # Check arguments |
| 16 if [ $# -ne 4 ] ; then | 18 if [ $# -lt 4 ] || [ $# -gt 5 ]; then |
| 17 echo "usage: $0 src_kpart dst_vblock kernel_datakey kernel_keyblock" | 19 echo "usage: $0 src_kpart dst_vblock kernel_datakey kernel_keyblock [version]" |
| 18 exit 1 | 20 exit 1 |
| 19 fi | 21 fi |
| 20 | 22 |
| 21 # Make sure the tools we need are available. | 23 # Make sure the tools we need are available. |
| 22 type -P vbutil_kernel &>/dev/null || \ | 24 type -P vbutil_kernel &>/dev/null || \ |
| 23 ( echo "vbutil_kernel tool not found."; exit 1; ) | 25 ( echo "vbutil_kernel tool not found."; exit 1; ) |
| 24 | 26 |
| 25 src_kpart=$1 | 27 SRC_KPART=$1 |
| 26 dst_vblock=$2 | 28 DST_VBLOCK=$2 |
| 27 kernel_datakey=$3 | 29 KERNEL_DATAKEY=$3 |
| 28 kernel_keyblock=$4 | 30 KERNEL_KEYBLOCK=$4 |
| 31 VERSION=$5 |
| 29 | 32 |
| 30 vbutil_kernel \ | 33 if [ -z $VERSION ]; then |
| 31 --repack "${dst_vblock}" \ | 34 VERSION=1 |
| 35 fi |
| 36 echo "Using kernel version: $VERSION" |
| 37 |
| 38 vbutil_kernel --repack "${DST_VBLOCK}" \ |
| 32 --vblockonly \ | 39 --vblockonly \ |
| 33 --keyblock "${kernel_keyblock}" \ | 40 --keyblock "${KERNEL_KEYBLOCK}" \ |
| 34 --signprivate "${kernel_datakey}" \ | 41 --signprivate "${KERNEL_DATAKEY}" \ |
| 35 --oldblob "${src_kpart}" | 42 --version "${VERSION}" \ |
| 43 --oldblob "${SRC_KPART}" |
| 36 | 44 |
| 37 echo "New kernel vblock was output to ${dst_vblock}" | 45 echo "New kernel vblock was output to ${DST_VBLOCK}" |
| 38 | 46 |
| OLD | NEW |