1 #!/bin/sh 2 # 3 # This script implements the old fip_create tool on top of 4 # the new fiptool. 5 # 6 # SPDX-License-Identifier: BSD-3-Clause 7 # 8 9 usage() { 10 cat << EOF 11 This tool is used to create a Firmware Image Package. 12 13 Usage: 14 fip_create [options] FIP_FILENAME 15 16 Options: 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 22 Components 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 --tos-fw-extra1 FILENAME Secure Payload BL32 Extra1 (Trusted OS Extra1) 32 --tos-fw-extra2 FILENAME Secure Payload BL32 Extra2 (Trusted OS Extra2) 33 --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 45 EOF 46 exit 47 } 48 49 echo "!! The fip_create tool is deprecated. Use the new fiptool. !!" 50 basedir="$(dirname $0)/../fiptool" 51 fiptool_args= 52 while :; 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 | \ 74 --tos-fw-extra1 | \ 75 --tos-fw-extra2 | \ 76 --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 98 done 99 100 # expect a FIP filename 101 if test -z $1; then 102 usage 103 fi 104 105 is_pack_cmd=1 106 for 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 116 done 117 118 # if --unpack and --dump were not specified 119 # the default action is to pack 120 if test "$is_pack_cmd" -eq 1; then 121 fiptool_args="update $fiptool_args" 122 fi 123 124 # append FIP filename 125 fiptool_args="$fiptool_args $1" 126 echo "Invoking fiptool with args: $fiptool_args" 127 "$basedir/fiptool" $fiptool_args 128