Files
ubports_kernel_google_msm/debian/scripts/misc/fw-to-ihex.sh
2014-01-09 07:43:45 -07:00

19 lines
303 B
Bash
Executable File

#!/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
sed -i 's/0x .*$//' $F.c
O="`dirname $F`/`basename $F`.o"
gcc -o $O -c $F.c
objcopy -Oihex $F.o $F.ihex