summaryrefslogtreecommitdiff
path: root/build/tools
diff options
context:
space:
mode:
authorNicolas Schodet2013-05-01 12:30:06 +0200
committerNicolas Schodet2019-10-07 00:01:14 +0200
commitb248612634e76d1537f275e1b125f488b263df45 (patch)
tree44e152e996e4072e8dfd82a813d46b5e2871ccc8 /build/tools
parent996aca5612de78239a01f52bc79d75a5e403d5c7 (diff)
build: compute CRC32 when building a .bin
Diffstat (limited to 'build/tools')
-rwxr-xr-xbuild/tools/crc13
1 files changed, 13 insertions, 0 deletions
diff --git a/build/tools/crc b/build/tools/crc
new file mode 100755
index 0000000..cb85a7f
--- /dev/null
+++ b/build/tools/crc
@@ -0,0 +1,13 @@
+#!/usr/bin/python
+"""Output CRC32 of files."""
+import optparse
+import zlib
+
+parser = optparse.OptionParser(usage='%prog [options] files...')
+options, args = parser.parse_args()
+
+for f in args:
+ with open(f) as fd:
+ content = fd.read()
+ crc = zlib.crc32(content) & 0xffffffff
+ print '%08x %s' % (crc, f)