1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-02 01:02:19 +02:00

binman: Allow sections to have an offset

At present sections are always placed automatically. Even if an 'offset'
property is provided it is ignored. Update the logic to support an offset
for sections.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass
2019-04-25 21:58:39 -06:00
committed by Bin Meng
parent 0b96f6ecbe
commit 9481c80f55
5 changed files with 67 additions and 5 deletions

View File

@@ -1783,6 +1783,24 @@ class TestFunctional(unittest.TestCase):
data = self._DoReadFile('100_intel_refcode.dts')
self.assertEqual(REFCODE_DATA, data[:len(REFCODE_DATA)])
def testSectionOffset(self):
"""Tests use of a section with an offset"""
data, _, map_data, _ = self._DoReadFileDtb('101_sections_offset.dts',
map=True)
self.assertEqual('''ImagePos Offset Size Name
00000000 00000000 00000038 main-section
00000004 00000004 00000010 section@0
00000004 00000000 00000004 u-boot
00000018 00000018 00000010 section@1
00000018 00000000 00000004 u-boot
0000002c 0000002c 00000004 section@2
0000002c 00000000 00000004 u-boot
''', map_data)
self.assertEqual(data,
4 * chr(0x26) + U_BOOT_DATA + 12 * chr(0x21) +
4 * chr(0x26) + U_BOOT_DATA + 12 * chr(0x61) +
4 * chr(0x26) + U_BOOT_DATA + 8 * chr(0x26))
if __name__ == "__main__":
unittest.main()