[coreboot-gerrit] Patch set updated for coreboot: Exynos7: Bootblock: Update header with size in blocks
Chris Ching (chingcodes@google.com)
gerrit at coreboot.org
Thu Jun 9 22:46:54 CEST 2016
Chris Ching (chingcodes at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14903
-gerrit
commit ef40972eec0b242e140a358be0e962450d39d944
Author: Akshay Saraswat <akshay.s at samsung.com>
Date: Fri Sep 5 16:18:01 2014 +0530
Exynos7: Bootblock: Update header with size in blocks
BL1 may not always ask for bootblock binary's size in number of bytes
rather it may find reading size in number of blocks easier sometimes.
Doing modifications in header populating script to mention bootblock
size in number of blocks instead of number of bytes whenever asked.
BUG=None
BRANCH=None
TEST=Compiled and booted Coreboot over Jazz mainboard
with this series
Change-Id: Ic8895d7142c70a92a658cba56367231d36908b61
Signed-off-by: Alim Akhtar <alim.akhtar at samsung.com>
Signed-off-by: Akshay Saraswat <akshay.s at samsung.com>
---
util/exynos/variable_cksum.py | 43 ++++++++++++++++++++++++++++++++++++-------
1 file changed, 36 insertions(+), 7 deletions(-)
diff --git a/util/exynos/variable_cksum.py b/util/exynos/variable_cksum.py
index 9725261..2847467 100755
--- a/util/exynos/variable_cksum.py
+++ b/util/exynos/variable_cksum.py
@@ -29,7 +29,7 @@
This utility computes and fills Exynos ROM checksum (for BL1 or BL2).
(Algorithm from U-Boot: tools/mkexynosspl.c)
-Input: IN OUT
+Input: IN OUT <size_in_blocks>
Output:
@@ -39,21 +39,50 @@ Output:
import struct
import sys
+import argparse
-def main(argv):
- if len(argv) != 3:
- exit('usage: %s IN OUT' % argv[0])
+# Get the number of byte needed to make _data_ 512 byte alinged
+def alignpos(pos, alignbytes):
+ mask = alignbytes - 1
+ return (pos + mask) & ~mask
+
+def parseargs():
+ """Parses arguments and returns results"""
+ parser = argparse.ArgumentParser()
+ parser.add_argument("IN", type=str, help="Input file")
+ parser.add_argument("OUT", type=str, help="Output file")
+
+ parser.add_argument("--blocks", action='store_true', help="Use block as size")
+ parser.add_argument("--bsize", type=int, help="Size of block to use, default=512", default=512)
+
+ return parser.parse_args()
+
+def main():
+
+ args = parseargs()
+
+ in_name = args.IN
+ out_name = args.OUT
- in_name, out_name = argv[1:3]
header_format = "<IIII"
with open(in_name, "rb") as in_file, open(out_name, "wb") as out_file:
data = in_file.read()
+ size = struct.calcsize(header_format) + len(data)
+
+ if args.blocks:
+ block_size = args.bsize
+ if ((size % block_size) != 0):
+ data = data + (alignpos(size, block_size) - size) * '\0'
+ count = len(data)
+ else:
+ size = (size / block_size)
+
header = struct.pack(header_format,
- struct.calcsize(header_format) + len(data),
+ size,
sum(map(ord, data)),
0, 0)
out_file.write(header + data)
if __name__ == '__main__':
- main(sys.argv)
+ main()
More information about the coreboot-gerrit
mailing list