dp-arm | 4972ec5 | 2016-05-25 16:20:20 +0100 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. |
| 4 | # |
| 5 | # Redistribution and use in source and binary forms, with or without |
| 6 | # modification, are permitted provided that the following conditions are met: |
| 7 | # |
| 8 | # Redistributions of source code must retain the above copyright notice, this |
| 9 | # list of conditions and the following disclaimer. |
| 10 | # |
| 11 | # Redistributions in binary form must reproduce the above copyright notice, |
| 12 | # this list of conditions and the following disclaimer in the documentation |
| 13 | # and/or other materials provided with the distribution. |
| 14 | # |
| 15 | # Neither the name of ARM nor the names of its contributors may be used |
| 16 | # to endorse or promote products derived from this software without specific |
| 17 | # prior written permission. |
| 18 | # |
| 19 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 20 | # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 | # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 | # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 23 | # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 24 | # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 25 | # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 26 | # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 27 | # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 28 | # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 | # POSSIBILITY OF SUCH DAMAGE. |
| 30 | # |
| 31 | # This script implements the old fip_create tool on top of |
| 32 | # the new fiptool. |
| 33 | |
| 34 | usage() { |
| 35 | cat << EOF |
| 36 | This tool is used to create a Firmware Image Package. |
| 37 | |
| 38 | Usage: |
| 39 | fip_create [options] FIP_FILENAME |
| 40 | |
| 41 | Options: |
| 42 | -h,--help: Print this help message and exit |
| 43 | -d,--dump: Print contents of FIP after update |
| 44 | -u,--unpack: Unpack images from an existing FIP |
| 45 | -f,--force: Overwrite existing files when unpacking images |
| 46 | |
| 47 | Components that can be added/updated: |
| 48 | --scp-fwu-cfg FILENAME SCP Firmware Updater Configuration FWU SCP_BL2U |
| 49 | --ap-fwu-cfg FILENAME AP Firmware Updater Configuration BL2U |
| 50 | --fwu FILENAME Firmware Updater NS_BL2U |
| 51 | --fwu-cert FILENAME Non-Trusted Firmware Updater certificate |
| 52 | --tb-fw FILENAME Trusted Boot Firmware BL2 |
| 53 | --scp-fw FILENAME SCP Firmware SCP_BL2 |
| 54 | --soc-fw FILENAME EL3 Runtime Firmware BL31 |
| 55 | --tos-fw FILENAME Secure Payload BL32 (Trusted OS) |
| 56 | --nt-fw FILENAME Non-Trusted Firmware BL33 |
| 57 | --rot-cert FILENAME Root Of Trust key certificate |
| 58 | --trusted-key-cert FILENAME Trusted key certificate |
| 59 | --scp-fw-key-cert FILENAME SCP Firmware key certificate |
| 60 | --soc-fw-key-cert FILENAME SoC Firmware key certificate |
| 61 | --tos-fw-key-cert FILENAME Trusted OS Firmware key certificate |
| 62 | --nt-fw-key-cert FILENAME Non-Trusted Firmware key certificate |
| 63 | --tb-fw-cert FILENAME Trusted Boot Firmware BL2 certificate |
| 64 | --scp-fw-cert FILENAME SCP Firmware content certificate |
| 65 | --soc-fw-cert FILENAME SoC Firmware content certificate |
| 66 | --tos-fw-cert FILENAME Trusted OS Firmware content certificate |
| 67 | --nt-fw-cert FILENAME Non-Trusted Firmware content certificate |
| 68 | EOF |
| 69 | exit |
| 70 | } |
| 71 | |
| 72 | echo "!! The fip_create tool is deprecated. Use the new fiptool. !!" |
| 73 | basedir="$(dirname $0)/../fiptool" |
| 74 | fiptool_args= |
| 75 | while :; do |
| 76 | case "$1" in |
| 77 | -h | --help ) |
| 78 | usage |
| 79 | break ;; |
| 80 | -d | --dump ) |
| 81 | fiptool_args="info $fiptool_args" |
| 82 | shift ;; |
| 83 | -u | --unpack ) |
| 84 | fiptool_args="unpack $fiptool_args" |
| 85 | shift ;; |
| 86 | -f | --force ) |
| 87 | fiptool_args="$fiptool_args --force" |
| 88 | shift ;; |
| 89 | --scp-fwu-cfg | \ |
| 90 | --ap-fwu-cfg | \ |
| 91 | --fwu | \ |
| 92 | --fwu-cert | \ |
| 93 | --tb-fw | \ |
| 94 | --scp-fw | \ |
| 95 | --soc-fw | \ |
| 96 | --tos-fw | \ |
| 97 | --nt-fw | \ |
| 98 | --rot-cert | \ |
| 99 | --trusted-key-cert | \ |
| 100 | --scp-fw-key-cert | \ |
| 101 | --soc-fw-key-cert | \ |
| 102 | --tos-fw-key-cert | \ |
| 103 | --nt-fw-key-cert | \ |
| 104 | --tb-fw-cert | \ |
| 105 | --scp-fw-cert | \ |
| 106 | --soc-fw-cert | \ |
| 107 | --tos-fw-cert | \ |
| 108 | --nt-fw-cert ) |
| 109 | fiptool_args="$fiptool_args $1" |
| 110 | shift |
| 111 | if test -z $1; then |
| 112 | usage |
| 113 | fi |
| 114 | fiptool_args="$fiptool_args $1" |
| 115 | shift ;; |
| 116 | * ) |
| 117 | break ;; |
| 118 | esac |
| 119 | done |
| 120 | |
| 121 | # expect a FIP filename |
| 122 | if test -z $1; then |
| 123 | usage |
| 124 | fi |
| 125 | |
| 126 | is_pack_cmd=1 |
| 127 | for arg in $fiptool_args; do |
| 128 | case "$arg" in |
| 129 | unpack ) |
| 130 | is_pack_cmd=0 |
| 131 | break ;; |
| 132 | info ) |
| 133 | is_pack_cmd=0 |
| 134 | break ;; |
| 135 | * ) |
| 136 | esac |
| 137 | done |
| 138 | |
| 139 | # if --unpack and --dump were not specified |
| 140 | # the default action is to pack |
| 141 | if test "$is_pack_cmd" -eq 1; then |
| 142 | fiptool_args="update $fiptool_args" |
| 143 | fi |
| 144 | |
| 145 | # append FIP filename |
| 146 | fiptool_args="$fiptool_args $1" |
| 147 | echo "Invoking fiptool with args: $fiptool_args" |
| 148 | "$basedir/fiptool" $fiptool_args |