summaryrefslogtreecommitdiffhomepage
path: root/digital/ucoolib/build/tools
diff options
context:
space:
mode:
authorNicolas Schodet2013-05-01 12:30:06 +0200
committerNicolas Schodet2013-05-01 12:51:45 +0200
commit13aa76d23158b33a375f87479ffe6d0f577e5d2c (patch)
treec77a01b941ba6de72c857dcde198118182f468e7 /digital/ucoolib/build/tools
parent69d243f0b5f6be4d0df1310ae5752b46dfddb955 (diff)
digital/ucoolib/build: compute CRC32 when building a .bin
Diffstat (limited to 'digital/ucoolib/build/tools')
-rwxr-xr-xdigital/ucoolib/build/tools/crc13
1 files changed, 13 insertions, 0 deletions
diff --git a/digital/ucoolib/build/tools/crc b/digital/ucoolib/build/tools/crc
new file mode 100755
index 00000000..cb85a7ff
--- /dev/null
+++ b/digital/ucoolib/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)