summaryrefslogtreecommitdiff
path: root/tools/binman/cbfs_util.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/binman/cbfs_util.py')
-rw-r--r--tools/binman/cbfs_util.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/binman/cbfs_util.py b/tools/binman/cbfs_util.py
index 9ac38d8e4c1..076768ae839 100644
--- a/tools/binman/cbfs_util.py
+++ b/tools/binman/cbfs_util.py
@@ -42,7 +42,7 @@ HEADER_VERSION2 = 0x31313132
FILE_HEADER_FORMAT = b'>8sIIII'
FILE_HEADER_LEN = 0x18
FILE_MAGIC = b'LARCHIVE'
-FILENAME_ALIGN = 16 # Filename lengths are aligned to this
+ATTRIBUTE_ALIGN = 4 # All attribute sizes must be divisible by this
# A stage header containing information about 'stage' files
# Yes this is correct: this header is in litte-endian format
@@ -186,7 +186,7 @@ def _pack_string(instr):
String with required padding (at least one 0x00 byte) at the end
"""
val = tools.to_bytes(instr)
- pad_len = align_int(len(val) + 1, FILENAME_ALIGN)
+ pad_len = align_int(len(val) + 1, ATTRIBUTE_ALIGN)
return val + tools.get_bytes(0, pad_len - len(val))
@@ -300,7 +300,7 @@ class CbfsFile(object):
CbfsFile object containing the file information
"""
cfile = CbfsFile('', TYPE_EMPTY, b'', None)
- cfile.size = space_to_use - FILE_HEADER_LEN - FILENAME_ALIGN
+ cfile.size = space_to_use - FILE_HEADER_LEN - ATTRIBUTE_ALIGN
cfile.erase_byte = erase_byte
return cfile
@@ -859,8 +859,8 @@ class CbfsReader(object):
"""
val = b''
while True:
- data = fd.read(FILENAME_ALIGN)
- if len(data) < FILENAME_ALIGN:
+ data = fd.read(ATTRIBUTE_ALIGN)
+ if len(data) < ATTRIBUTE_ALIGN:
return None
pos = data.find(b'\0')
if pos == -1: