binman: Replace FILENAME_ALIGN 16 with ATTRIBUTE_ALIGN 4
cbfsutil changed to 4-byte alignment for filenames instead of 16.
Adjust the binman implementation to do the same.
This mirrors commit 5779ca718c in coreboot.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/tools/binman/cbfs_util.py b/tools/binman/cbfs_util.py
index 9ac38d8..076768a 100644
--- a/tools/binman/cbfs_util.py
+++ b/tools/binman/cbfs_util.py
@@ -42,7 +42,7 @@
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 @@
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 @@
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 @@
"""
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: