Install the BL1 and set up the checksum in the Makefile instead of relying on post processing. Import the exynos checksum script, split it in two and simplify it significantly. Stop putting the CBFS header in the midst of the bootblock so that it can be checksummed before CBFS is put together. Stop saving space for it and leaving an anchor in the bootblock which nobody looks for. BUG=None TEST=Built and booted on pit. Built for snow, but it doesn't boot on ToT so I couldn't test it more than that. BRANCH=None Change-Id: Icbb5a5914ece60b2827433b6dc29d80db996ea6c Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: https://chromium-review.googlesource.com/179229 Reviewed-by: Ronald Minnich <rminnich@chromium.org> Commit-Queue: Gabe Black <gabeblack@chromium.org> Tested-by: Gabe Black <gabeblack@chromium.org>
37 lines
1,018 B
Python
Executable file
37 lines
1,018 B
Python
Executable file
#!/usr/bin/env python
|
|
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
"""
|
|
This utility computes and fills Exynos ROM checksum (for BL1 or BL2).
|
|
(Algorithm from U-Boot: tools/mkexynosspl.c)
|
|
|
|
Input: IN OUT DATA_SIZE
|
|
|
|
Output:
|
|
|
|
IN padded out to DATA_SIZE, checksum at the end, written to OUT.
|
|
"""
|
|
|
|
import struct
|
|
import sys
|
|
|
|
def main(argv):
|
|
if len(argv) != 4:
|
|
exit('usage: %s IN OUT DATA_SIZE' % argv[0])
|
|
|
|
in_name, out_name = argv[1:3]
|
|
size = int(argv[3], 0)
|
|
checksum_format = "<I"
|
|
with open(in_name, "rb") as in_file, open(out_name, "wb") as out_file:
|
|
data = in_file.read()
|
|
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)))
|
|
out_file.write(data + bytearray(data_size - len(data)) + checksum)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main(sys.argv)
|