dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 3 | # This script implements the old fip_create tool on top of |
| 4 | # the new fiptool. |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 5 | # |
| 6 | # SPDX-License-Identifier: BSD-3-Clause |
| 7 | # |
dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 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 | --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 |
| 43 | EOF |
| 44 | exit |
| 45 | } |
| 46 | |
| 47 | echo "!! The fip_create tool is deprecated. Use the new fiptool. !!" |
| 48 | basedir="$(dirname $0)/../fiptool" |
| 49 | fiptool_args= |
| 50 | while :; 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 |
| 94 | done |
| 95 | |
| 96 | # expect a FIP filename |
| 97 | if test -z $1; then |
| 98 | usage |
| 99 | fi |
| 100 | |
| 101 | is_pack_cmd=1 |
| 102 | for 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 |
| 112 | done |
| 113 | |
| 114 | # if --unpack and --dump were not specified |
| 115 | # the default action is to pack |
| 116 | if test "$is_pack_cmd" -eq 1; then |
| 117 | fiptool_args="update $fiptool_args" |
| 118 | fi |
| 119 | |
| 120 | # append FIP filename |
| 121 | fiptool_args="$fiptool_args $1" |
| 122 | echo "Invoking fiptool with args: $fiptool_args" |
| 123 | "$basedir/fiptool" $fiptool_args |