blob: f1e1f451906e994fe72e9e80dae97b643be77b71 [file] [log] [blame]
dp-arm4972ec52016-05-25 16:20:20 +01001#!/bin/sh
2#
dp-arm4972ec52016-05-25 16:20:20 +01003# This script implements the old fip_create tool on top of
4# the new fiptool.
dp-armfa3cf0b2017-05-03 09:38:09 +01005#
6# SPDX-License-Identifier: BSD-3-Clause
7#
dp-arm4972ec52016-05-25 16:20:20 +01008
9usage() {
10 cat << EOF
11This tool is used to create a Firmware Image Package.
12
13Usage:
14 fip_create [options] FIP_FILENAME
15
16Options:
17 -h,--help: Print this help message and exit
18 -d,--dump: Print contents of FIP after update
19 -u,--unpack: Unpack images from an existing FIP
20 -f,--force: Overwrite existing files when unpacking images
21
22Components that can be added/updated:
23 --scp-fwu-cfg FILENAME SCP Firmware Updater Configuration FWU SCP_BL2U
24 --ap-fwu-cfg FILENAME AP Firmware Updater Configuration BL2U
25 --fwu FILENAME Firmware Updater NS_BL2U
26 --fwu-cert FILENAME Non-Trusted Firmware Updater certificate
27 --tb-fw FILENAME Trusted Boot Firmware BL2
28 --scp-fw FILENAME SCP Firmware SCP_BL2
29 --soc-fw FILENAME EL3 Runtime Firmware BL31
30 --tos-fw FILENAME Secure Payload BL32 (Trusted OS)
31 --nt-fw FILENAME Non-Trusted Firmware BL33
32 --rot-cert FILENAME Root Of Trust key certificate
33 --trusted-key-cert FILENAME Trusted key certificate
34 --scp-fw-key-cert FILENAME SCP Firmware key certificate
35 --soc-fw-key-cert FILENAME SoC Firmware key certificate
36 --tos-fw-key-cert FILENAME Trusted OS Firmware key certificate
37 --nt-fw-key-cert FILENAME Non-Trusted Firmware key certificate
38 --tb-fw-cert FILENAME Trusted Boot Firmware BL2 certificate
39 --scp-fw-cert FILENAME SCP Firmware content certificate
40 --soc-fw-cert FILENAME SoC Firmware content certificate
41 --tos-fw-cert FILENAME Trusted OS Firmware content certificate
42 --nt-fw-cert FILENAME Non-Trusted Firmware content certificate
43EOF
44 exit
45}
46
47echo "!! The fip_create tool is deprecated. Use the new fiptool. !!"
48basedir="$(dirname $0)/../fiptool"
49fiptool_args=
50while :; do
51 case "$1" in
52 -h | --help )
53 usage
54 break ;;
55 -d | --dump )
56 fiptool_args="info $fiptool_args"
57 shift ;;
58 -u | --unpack )
59 fiptool_args="unpack $fiptool_args"
60 shift ;;
61 -f | --force )
62 fiptool_args="$fiptool_args --force"
63 shift ;;
64 --scp-fwu-cfg | \
65 --ap-fwu-cfg | \
66 --fwu | \
67 --fwu-cert | \
68 --tb-fw | \
69 --scp-fw | \
70 --soc-fw | \
71 --tos-fw | \
72 --nt-fw | \
73 --rot-cert | \
74 --trusted-key-cert | \
75 --scp-fw-key-cert | \
76 --soc-fw-key-cert | \
77 --tos-fw-key-cert | \
78 --nt-fw-key-cert | \
79 --tb-fw-cert | \
80 --scp-fw-cert | \
81 --soc-fw-cert | \
82 --tos-fw-cert | \
83 --nt-fw-cert )
84 fiptool_args="$fiptool_args $1"
85 shift
86 if test -z $1; then
87 usage
88 fi
89 fiptool_args="$fiptool_args $1"
90 shift ;;
91 * )
92 break ;;
93 esac
94done
95
96# expect a FIP filename
97if test -z $1; then
98 usage
99fi
100
101is_pack_cmd=1
102for arg in $fiptool_args; do
103 case "$arg" in
104 unpack )
105 is_pack_cmd=0
106 break ;;
107 info )
108 is_pack_cmd=0
109 break ;;
110 * )
111 esac
112done
113
114# if --unpack and --dump were not specified
115# the default action is to pack
116if test "$is_pack_cmd" -eq 1; then
117 fiptool_args="update $fiptool_args"
118fi
119
120# append FIP filename
121fiptool_args="$fiptool_args $1"
122echo "Invoking fiptool with args: $fiptool_args"
123"$basedir/fiptool" $fiptool_args