xref: /aosp_15_r20/external/vboot_reference/scripts/image_signing/resign_firmwarefd.sh (revision 8617a60d3594060b7ecbd21bc622a7c14f3cf2bc)
1#!/bin/sh
2
3# Copyright 2014 The ChromiumOS Authors
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
23KERNEL_SUBKEY=$5
24# optional
25VERSION=$6
26PREAMBLE_FLAG=$7
27LOEM_OUTPUT_DIR=$8
28LOEMID=$9
29
30# pass optional args
31[ -n "$VERSION" ] && VERSION="--version $VERSION"
32[ -n "$PREAMBLE_FLAG" ] && PREAMBLE_FLAG="--flags $PREAMBLE_FLAG"
33[ -n "$LOEM_OUTPUT_DIR" ] && LOEM_OUTPUT_DIR="--loemdir $LOEM_OUTPUT_DIR"
34[ -n "$LOEMID" ] && LOEMID="--loemid $LOEMID"
35
36exec ${FUTILITY} sign \
37  --signprivate $FIRMWARE_DATAKEY \
38  --keyblock $FIRMWARE_KEYBLOCK \
39  --kernelkey $KERNEL_SUBKEY \
40  $VERSION \
41  $PREAMBLE_FLAG \
42  $LOEM_OUTPUT_DIR \
43  $LOEMID \
44  $SRC_FD \
45  $DST_FD
46
47echo UNABLE TO EXEC FUTILITY 1>&2
48exit 1
49