[coreboot-gerrit] New patch to review for coreboot: Exynos7: Bootblock: Update header with size in blocks

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Thu May 19 20:38:29 CEST 2016


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14903

-gerrit

commit d0db2f4b9d72f2f3de799850df01a21bbeeb3682
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 | 23 +++++++++++++++++++----
 1 file changed, 19 insertions(+), 4 deletions(-)

diff --git a/util/exynos/variable_cksum.py b/util/exynos/variable_cksum.py
index 9725261..541e06d 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:
 
@@ -40,16 +40,31 @@ Output:
 import struct
 import sys
 
+# Get the number of byte needed to make _data_ 512 byte alinged
+def alignpos(pos, alignbytes):
+    mask = alignbytes - 1
+    return (pos + mask) & ~mask
+
 def main(argv):
-  if len(argv) != 3:
-    exit('usage: %s IN OUT' % argv[0])
+  if len(argv) < 3 or len(argv) > 4:
+    exit('usage: %s IN OUT <size_in_blocks>' % argv[0])
 
   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 "size_in_blocks" in argv:
+	block_size = 512
+	if ((size % block_size) != 0):
+	    data = data + (alignpos(size, 512) - 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)



More information about the coreboot-gerrit mailing list