MCPcopy Create free account
hub / github.com/coreboot/coreboot / main

Function main

util/exynos/fixed_cksum.py:19–32  ·  view source on GitHub ↗
(argv)

Source from the content-addressed store, hash-verified

17import sys
18
19def main(argv):
20 if len(argv) != 4:
21 exit('usage: %s IN OUT DATA_SIZE' % argv[0])
22
23 in_name, out_name = argv[1:3]
24 size = int(argv[3], 0)
25 checksum_format = "<I"
26 with open(in_name, "rb") as in_file, open(out_name, "wb") as out_file:
27 data = in_file.read()
28 checksum_size = struct.calcsize(checksum_format)
29 data_size = size - checksum_size
30 assert len(data) <= data_size
31 checksum = struct.pack(checksum_format, sum(data))
32 out_file.write(data + bytearray(data_size - len(data)) + checksum)
33
34
35if __name__ == '__main__':

Callers 1

fixed_cksum.pyFile · 0.70

Calls 2

exitFunction · 0.85
readMethod · 0.80

Tested by

no test coverage detected