aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorTim Gardner <tim.gardner@canonical.com>2012-07-19 16:30:47 -0600
committerJohn Rigby <john.rigby@linaro.org>2012-08-15 23:46:08 -0600
commitbf78c5f9b3f284bea21db66aa242f40651d08775 (patch)
treece606740f366d9f6d11b043dc13273835dd0aee8 /scripts
parent0242fcdea664fc9a2ab2af09cc8275b014eb6fcf (diff)
UBUNTU: SAUCE: Add script to convert firmware to ihex format
Upstream firmware is typically distributed as binary files(s), but are commited to the repo in ihex format. For example, scripts/fw-to-ihex.sh firmware/bnx2x/bnx2x-e1h-7.2.51.0.fw will create bnx2x-e1h-7.2.51.0.fw.ihex in the current directory. Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/fw-to-ihex.sh16
1 files changed, 16 insertions, 0 deletions
diff --git a/scripts/fw-to-ihex.sh b/scripts/fw-to-ihex.sh
new file mode 100755
index 00000000000..91a88fd6a1c
--- /dev/null
+++ b/scripts/fw-to-ihex.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+F=$1
+if [ "$F" = "" ]
+then
+ echo You must supply a firmware file.
+ exit 1
+fi
+
+echo "unsigned char d[] = {" > $F.c
+hexdump -v -e '"\t" 8/1 "0x%02x, " "\n"' $F >> $F.c
+echo "};" >> $F.c
+
+gcc -c $F.c
+objcopy -Oihex $F.o $F.ihex
+