• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2
3# Copyright (c) 2014 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# Abort on error
8set -e
9
10# This script is obsolete. The required functionality is now provided by the
11# compiled futility executable, so all this does is invoke that. This wrapper
12# should go away Real Soon Now.
13
14
15# Which futility to run?
16[ -z "$FUTILITY" ] && FUTILITY=futility
17
18# required
19SRC_FD=$1
20DST_FD=$2
21FIRMWARE_DATAKEY=$3
22FIRMWARE_KEYBLOCK=$4
23DEV_FIRMWARE_DATAKEY=$5
24DEV_FIRMWARE_KEYBLOCK=$6
25KERNEL_SUBKEY=$7
26# optional
27VERSION=$8
28PREAMBLE_FLAG=$9
29LOEM_OUTPUT_DIR=${10}
30LOEMID=${11}
31
32if [ ! -e $DEV_FIRMWARE_KEYBLOCK ] || [ ! -e $DEV_FIRMWARE_DATAKEY ] ; then
33  echo "No dev firmware keyblock/datakey found. Reusing normal keys."
34  DEV_FIRMWARE_KEYBLOCK="$FIRMWARE_KEYBLOCK"
35  DEV_FIRMWARE_DATAKEY="$FIRMWARE_DATAKEY"
36fi
37
38# pass optional args
39[ -n "$VERSION" ] && VERSION="--version $VERSION"
40[ -n "$PREAMBLE_FLAG" ] && PREAMBLE_FLAG="--flags $PREAMBLE_FLAG"
41[ -n "$LOEM_OUTPUT_DIR" ] && LOEM_OUTPUT_DIR="--loemdir $LOEM_OUTPUT_DIR"
42[ -n "$LOEMID" ] && LOEMID="--loemid $LOEMID"
43
44exec ${FUTILITY} sign \
45  --signprivate $FIRMWARE_DATAKEY \
46  --keyblock $FIRMWARE_KEYBLOCK \
47  --devsign $DEV_FIRMWARE_DATAKEY \
48  --devkeyblock $DEV_FIRMWARE_KEYBLOCK \
49  --kernelkey $KERNEL_SUBKEY \
50  $VERSION \
51  $PREAMBLE_FLAG \
52  $LOEM_OUTPUT_DIR \
53  $LOEMID \
54  $SRC_FD \
55  $DST_FD
56
57echo UNABLE TO EXEC FUTILITY 1>&2
58exit 1
59