blob: 0e80199f31948920fda75c22082242318aeb627f [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)
Summer Qin80726782017-04-20 16:28:39 +010031 --tos-fw-extra1 FILENAME Secure Payload BL32 Extra1 (Trusted OS Extra1)
32 --tos-fw-extra2 FILENAME Secure Payload BL32 Extra2 (Trusted OS Extra2)
dp-arm4972ec52016-05-25 16:20:20 +010033 --nt-fw FILENAME Non-Trusted Firmware BL33
34 --rot-cert FILENAME Root Of Trust key certificate
35 --trusted-key-cert FILENAME Trusted key certificate
36 --scp-fw-key-cert FILENAME SCP Firmware key certificate
37 --soc-fw-key-cert FILENAME SoC Firmware key certificate
38 --tos-fw-key-cert FILENAME Trusted OS Firmware key certificate
39 --nt-fw-key-cert FILENAME Non-Trusted Firmware key certificate
40 --tb-fw-cert FILENAME Trusted Boot Firmware BL2 certificate
41 --scp-fw-cert FILENAME SCP Firmware content certificate
42 --soc-fw-cert FILENAME SoC Firmware content certificate
43 --tos-fw-cert FILENAME Trusted OS Firmware content certificate
44 --nt-fw-cert FILENAME Non-Trusted Firmware content certificate
45EOF
46 exit
47}
48
49echo "!! The fip_create tool is deprecated. Use the new fiptool. !!"
50basedir="$(dirname $0)/../fiptool"
51fiptool_args=
52while :; do
53 case "$1" in
54 -h | --help )
55 usage
56 break ;;
57 -d | --dump )
58 fiptool_args="info $fiptool_args"
59 shift ;;
60 -u | --unpack )
61 fiptool_args="unpack $fiptool_args"
62 shift ;;
63 -f | --force )
64 fiptool_args="$fiptool_args --force"
65 shift ;;
66 --scp-fwu-cfg | \
67 --ap-fwu-cfg | \
68 --fwu | \
69 --fwu-cert | \
70 --tb-fw | \
71 --scp-fw | \
72 --soc-fw | \
73 --tos-fw | \
Summer Qin80726782017-04-20 16:28:39 +010074 --tos-fw-extra1 | \
75 --tos-fw-extra2 | \
dp-arm4972ec52016-05-25 16:20:20 +010076 --nt-fw | \
77 --rot-cert | \
78 --trusted-key-cert | \
79 --scp-fw-key-cert | \
80 --soc-fw-key-cert | \
81 --tos-fw-key-cert | \
82 --nt-fw-key-cert | \
83 --tb-fw-cert | \
84 --scp-fw-cert | \
85 --soc-fw-cert | \
86 --tos-fw-cert | \
87 --nt-fw-cert )
88 fiptool_args="$fiptool_args $1"
89 shift
90 if test -z $1; then
91 usage
92 fi
93 fiptool_args="$fiptool_args $1"
94 shift ;;
95 * )
96 break ;;
97 esac
98done
99
100# expect a FIP filename
101if test -z $1; then
102 usage
103fi
104
105is_pack_cmd=1
106for arg in $fiptool_args; do
107 case "$arg" in
108 unpack )
109 is_pack_cmd=0
110 break ;;
111 info )
112 is_pack_cmd=0
113 break ;;
114 * )
115 esac
116done
117
118# if --unpack and --dump were not specified
119# the default action is to pack
120if test "$is_pack_cmd" -eq 1; then
121 fiptool_args="update $fiptool_args"
122fi
123
124# append FIP filename
125fiptool_args="$fiptool_args $1"
126echo "Invoking fiptool with args: $fiptool_args"
127"$basedir/fiptool" $fiptool_args