binman: Support default alignment for sections

Sometimes it is useful to specify the default alignment for all entries
in a section, such as when word-alignment is necessary, for example. It
is tedious and error-prone to specify this individually for each section.

Add a property to control this for a section.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2021-03-21 18:24:33 +13:00
parent 631f752de5
commit 5ff9fedc9b
8 changed files with 58 additions and 0 deletions

View File

@@ -4496,6 +4496,18 @@ class TestFunctional(unittest.TestCase):
section + tools.GetBytes(0xfe, 3) + U_BOOT_DATA,
data)
def testAlignDefault(self):
"""Test that default alignment works on sections"""
data = self._DoReadFile('200_align_default.dts')
expected = (U_BOOT_DATA + tools.GetBytes(0, 8 - len(U_BOOT_DATA)) +
U_BOOT_DATA)
# Special alignment for section
expected += tools.GetBytes(0, 32 - len(expected))
# No alignment within the nested section
expected += U_BOOT_DATA + U_BOOT_NODTB_DATA;
# Now the final piece, which should be default-aligned
expected += tools.GetBytes(0, 88 - len(expected)) + U_BOOT_NODTB_DATA
self.assertEqual(expected, data)
if __name__ == "__main__":
unittest.main()