summaryrefslogtreecommitdiff
path: root/firmware/makefirmware.sh
blob: bd08e6544e8ab0e60695240eeea43a47341f3772 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
#
# makefirmware.sh
# Copyright (C) 2016 Damien Zammit <damien@zamaudio.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#

FIRMWARE=$1

LINES=$(od -t x4 -w4 -v -An --endian=big $FIRMWARE|wc -l)
FWLEN=$(printf "0x%08x," $LINES)
FWHEX=$(od -t x4 -w4 -v -An --endian=big $FIRMWARE|awk '{print "0x"$1","}')
SHA1HASH=$(python ../signsmu.py $1 | awk '{print $1","}')

echo "
/*
 * SMU FIRMWARE (Autogenerated by makefirmware.sh)
 * This firmware for SMU was compiled from source
 * available in 'smutool' by Damien Zammit (2016)
 */

#ifndef _SMUFIRMWARE_H
#define _SMUFIRMWARE_H

UINT32  FirmwareTNHeader[] = {
  0x554D535F,
  0x554D535F,
  0x0000F030,
  0x00002000,
  0x00010000,
  0x7E26E3A5,
  0x00004E54,
  0x00000000,
  0x00000000,
  0x00000000,
  0x00000000,
  0x00000000,
};

UINT32  FirmwareTN[] = {
 0x000a00cb,
 0x00000040,"
echo "$FWLEN"
echo " 0x00010100,"
echo "$SHA1HASH"
echo " 0x00010100, //0x0001d97c,
 0x00010100, //0x0001da8c,
 0x00000000,
 0x00010100, //0x0001daad,
 0x00010100, //0x0001dabc,
 0x00010100, //0x0001d9d0,
 0x00010100, //0x0001dbf4,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0x00000000,
 0xaa55aa55,"
echo "$FWHEX"
echo "};"
echo "#endif"