summaryrefslogtreecommitdiff
path: root/tools/binman/ftest.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-10-26 17:40:10 -0600
committerSimon Glass <sjg@chromium.org>2020-10-29 14:42:59 -0600
commit4eec34c91f84d6c3915b300f0688f9b055e04dda (patch)
tree72599858724d4e4b7f7c79c7d26afc0225151403 /tools/binman/ftest.py
parentf90d906a275f85e7077d9a30ab82b20676b54645 (diff)
binman: Expand docs and test for alignment
Alignment does form part of the entry once the image is written out, but within binman the entry contents does not include the padding. Add documentation to make this clear, as well as a test. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r--tools/binman/ftest.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index 35c14206818..c99852d5814 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -785,7 +785,8 @@ class TestFunctional(unittest.TestCase):
def testPackExtra(self):
"""Test that extra packing feature works as expected"""
- data = self._DoReadFile('009_pack_extra.dts')
+ data, _, _, out_dtb_fname = self._DoReadFileDtb('009_pack_extra.dts',
+ update_dtb=True)
self.assertIn('image', control.images)
image = control.images['image']
@@ -844,6 +845,36 @@ class TestFunctional(unittest.TestCase):
self.CheckNoGaps(entries)
self.assertEqual(128, image.size)
+ dtb = fdt.Fdt(out_dtb_fname)
+ dtb.Scan()
+ props = self._GetPropTree(dtb, ['size', 'offset', 'image-pos'])
+ expected = {
+ 'image-pos': 0,
+ 'offset': 0,
+ 'size': 128,
+
+ 'u-boot:image-pos': 0,
+ 'u-boot:offset': 0,
+ 'u-boot:size': 3 + 5 + len(U_BOOT_DATA),
+
+ 'u-boot-align-size-nop:image-pos': 12,
+ 'u-boot-align-size-nop:offset': 12,
+ 'u-boot-align-size-nop:size': 4,
+
+ 'u-boot-align-size:image-pos': 16,
+ 'u-boot-align-size:offset': 16,
+ 'u-boot-align-size:size': 32,
+
+ 'u-boot-align-end:image-pos': 48,
+ 'u-boot-align-end:offset': 48,
+ 'u-boot-align-end:size': 16,
+
+ 'u-boot-align-both:image-pos': 64,
+ 'u-boot-align-both:offset': 64,
+ 'u-boot-align-both:size': 64,
+ }
+ self.assertEqual(expected, props)
+
def testPackAlignPowerOf2(self):
"""Test that invalid entry alignment is detected"""
with self.assertRaises(ValueError) as e: