diff options
author | Simon Glass <sjg@chromium.org> | 2019-08-24 07:23:05 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2019-10-15 08:40:02 -0600 |
commit | b87064c2496785dde9e33fcdf84175d64163db57 (patch) | |
tree | 56de0dcd05c98a0d616d7a20b8511e3b896559dc /tools/binman/ftest.py | |
parent | eb0086fa59e61561a5eca61b9ab8323d8a0cbf9c (diff) |
binman: Allow support for writing a size symbol to binaries
It is useful to be able to access the size of an image in SPL, with
something like:
binman_sym_declare(unsigned long, u_boot_any, size);
...
ulong u_boot_size = binman_sym(ulong, u_boot_any, size);
Add support for this and update the tests.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/ftest.py')
-rw-r--r-- | tools/binman/ftest.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 5433c80e8e0..6d59fa4874e 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -1236,10 +1236,10 @@ class TestFunctional(unittest.TestCase): self._SetupSplElf('u_boot_binman_syms') data = self._DoReadFile('053_symbols.dts') - sym_values = struct.pack('<LQL', 0, 28, 24) - expected = (sym_values + U_BOOT_SPL_DATA[16:] + + sym_values = struct.pack('<LQLL', 0, 28, 24, 4) + expected = (sym_values + U_BOOT_SPL_DATA[20:] + tools.GetBytes(0xff, 1) + U_BOOT_DATA + sym_values + - U_BOOT_SPL_DATA[16:]) + U_BOOT_SPL_DATA[20:]) self.assertEqual(expected, data) def testPackUnitAddress(self): @@ -3305,20 +3305,20 @@ class TestFunctional(unittest.TestCase): self._SetupSplElf('u_boot_binman_syms') self._SetupTplElf('u_boot_binman_syms') data = self._DoReadFile('149_symbols_tpl.dts') - sym_values = struct.pack('<LQL', 4, 0x1c, 0x34) + sym_values = struct.pack('<LQLL', 4, 0x1c, 0x34, 4) upto1 = 4 + len(U_BOOT_SPL_DATA) - expected1 = tools.GetBytes(0xff, 4) + sym_values + U_BOOT_SPL_DATA[16:] + expected1 = tools.GetBytes(0xff, 4) + sym_values + U_BOOT_SPL_DATA[20:] self.assertEqual(expected1, data[:upto1]) upto2 = upto1 + 1 + len(U_BOOT_SPL_DATA) - expected2 = tools.GetBytes(0xff, 1) + sym_values + U_BOOT_SPL_DATA[16:] + expected2 = tools.GetBytes(0xff, 1) + sym_values + U_BOOT_SPL_DATA[20:] self.assertEqual(expected2, data[upto1:upto2]) upto3 = 0x34 + len(U_BOOT_DATA) expected3 = tools.GetBytes(0xff, 1) + U_BOOT_DATA self.assertEqual(expected3, data[upto2:upto3]) - expected4 = sym_values + U_BOOT_TPL_DATA[16:] + expected4 = sym_values + U_BOOT_TPL_DATA[20:] self.assertEqual(expected4, data[upto3:]) def testPackX86RomIfwiSectiom(self): |