1 #!/bin/sh
2 #
3 # Script to generate FIT image source for System Firmware (SYSFW) and
4 # associated configuration data based on a given SYSFW binary image plus
5 # multiple domain-specific fragments in binary format all specified via
6 # command line.
7 #
8 # Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/
9 # Andreas Dannenberg <dannenberg@ti.com>
10 #
11 # Redistribution and use in source and binary forms, with or without
12 # modification, are permitted provided that the following conditions
13 # are met:
14 #
15 # Redistributions of source code must retain the above copyright
16 # notice, this list of conditions and the following disclaimer.
17 #
18 # Redistributions in binary form must reproduce the above copyright
19 # notice, this list of conditions and the following disclaimer in the
20 # documentation and/or other materials provided with the
21 # distribution.
22 #
23 # Neither the name of Texas Instruments Incorporated nor the names of
24 # its contributors may be used to endorse or promote products derived
25 # from this software without specific prior written permission.
26 #
27 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #
39 # usage: $0 <soc_name> <config_name> <bin_name> [<bin_name> [<bin_name] ...]
40 #
42 SOC=$1
43 shift
45 CONFIG=$1
46 shift
48 SYSFW_IMG_GEN_REV=`git describe --tags --abbrev=5 --dirty`
50 cat << __HEADER_EOF
51 /dts-v1/;
53 / {
54 description = "SYSFW and Config Fragments";
55 #address-cells = <1>;
57 creator = "SIG $SOC/$CONFIG-$SYSFW_IMG_GEN_REV";
59 images {
60 __HEADER_EOF
62 for bin_name in $*
63 do
64 cat << __CFG_IMAGE_EOF
65 $(basename $bin_name) {
66 description = "$(basename $bin_name .bin)";
67 data = /incbin/("$bin_name");
68 type = "firmware";
69 arch = "arm";
70 compression = "none";
71 };
72 __CFG_IMAGE_EOF
73 done
75 cat << __ITS_EOF
76 };
77 };
78 __ITS_EOF