~nicktux/utappia/optimus-kernel

« back to all changes in this revision

Viewing changes to debian/scripts/misc/fw-to-ihex.sh

  • Committer: NickTh
  • Date: 2015-10-15 08:11:04 UTC
  • Revision ID: nick-athens30@ubuntu.com-20151015081104-cr4qwkh27u0mw0e2
Creating Initial Project

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
F=$1
 
4
if [ "$F" = "" ]
 
5
then
 
6
        echo You must supply a firmware file.
 
7
        exit 1
 
8
fi
 
9
 
 
10
echo "unsigned char d[] = {" > $F.c
 
11
hexdump -v -e '"\t" 8/1 "0x%02x, " "\n"' $F >> $F.c
 
12
echo "};" >> $F.c
 
13
sed -i 's/0x .*$//' $F.c
 
14
 
 
15
O="`dirname $F`/`basename $F`.o"
 
16
gcc -o $O -c $F.c
 
17
objcopy -Oihex $F.o $F.ihex
 
18