summaryrefslogtreecommitdiff
path: root/build_tools
diff options
context:
space:
mode:
Diffstat (limited to 'build_tools')
-rwxr-xr-xbuild_tools/make_firmware_object12
1 files changed, 12 insertions, 0 deletions
diff --git a/build_tools/make_firmware_object b/build_tools/make_firmware_object
new file mode 100755
index 0000000..1aadde3
--- /dev/null
+++ b/build_tools/make_firmware_object
@@ -0,0 +1,12 @@
+#!/bin/sh -e
+
+# make an object file from a raw binary firmware file
+# arguments:
+# 1 - firmware file
+# 2 - output file
+# 3 - template output file (used to learn desired format)
+
+bfdname=`objdump -f ${3} | grep -e "${3}:" | sed "s/.*file format \(.*\)/\1/"`
+bfdarch=`objdump -f ${3} | grep -e "architecture:" | sed "s/.*ture: \(.*\),.*/\1/"`
+
+objcopy -I binary ${1} -B ${bfdarch} -O ${bfdname} ${2}