Home | History | Annotate | Download | only in image_signing
      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
      8 set -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
     19 SRC_FD=$1
     20 DST_FD=$2
     21 FIRMWARE_DATAKEY=$3
     22 FIRMWARE_KEYBLOCK=$4
     23 DEV_FIRMWARE_DATAKEY=$5
     24 DEV_FIRMWARE_KEYBLOCK=$6
     25 KERNEL_SUBKEY=$7
     26 # optional
     27 VERSION=$8
     28 PREAMBLE_FLAG=$9
     29 LOEM_OUTPUT_DIR=${10}
     30 LOEMID=${11}
     31 
     32 if [ ! -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"
     36 fi
     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 
     44 exec ${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 
     57 echo UNABLE TO EXEC FUTILITY 1>&2
     58 exit 1
     59