util/exynos: Port *_cksum.py to python3
BUG=chromium:1023662 TEST=1. Create a tiny file `in.txt` as input 2. Run `fixed_cksum.py in.txt out.txt 20` with py2 and py3 version, the output is the same 3. Run `variable_cksum.py in.txt out.txt` with py2 and py3 version, the output is the same Signed-off-by: Yilin Yang <kerker@google.com> Change-Id: I9428269dfb826a3a95fffef9ea3f7c1a7107ef84 Reviewed-on: https://review.coreboot.org/c/coreboot/+/45460 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
@@ -28,7 +28,7 @@ def main(argv):
|
||||
checksum_size = struct.calcsize(checksum_format)
|
||||
data_size = size - checksum_size
|
||||
assert len(data) <= data_size
|
||||
checksum = struct.pack(checksum_format, sum(map(ord, data)))
|
||||
checksum = struct.pack(checksum_format, sum(data))
|
||||
out_file.write(data + bytearray(data_size - len(data)) + checksum)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user