diff options
author | Simon Glass <sjg@chromium.org> | 2023-01-07 14:07:08 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2023-01-18 11:50:01 -0700 |
commit | efddab6c365439b9084ef1ac4750eacb7ba9e889 (patch) | |
tree | 2856c869b25cc877abcf9a10fd47a6b93da19583 /tools/binman/ftest.py | |
parent | 85d87112cb0abedf0d6f1a14422e89d335533157 (diff) |
binman: Allow writing section contents to a file
At present only the image (which is a section) has a filename. Move this
implementation to the entry_Section class so that any section can have a
filename. With this, the section data is written to a file.
This allows parts of an image to be written, along with the entire image.
Make a note that this can be used to include the contents of a section in
one image in another (later) image.
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, 14 insertions, 0 deletions
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 62ee86b9b7..c3cb32dca2 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -6077,5 +6077,19 @@ fdt fdtmap Extract the devicetree blob from the fdtmap 'Cannot write symbols to an ELF file without Python elftools', str(exc.exception)) + def testSectionFilename(self): + """Check writing of section contents to a file""" + data = self._DoReadFile('261_section_fname.dts') + expected = (b'&&' + U_BOOT_DATA + b'&&&' + + tools.get_bytes(ord('!'), 7) + + U_BOOT_DATA + tools.get_bytes(ord('&'), 12)) + self.assertEqual(expected, data) + + sect_fname = tools.get_output_filename('outfile.bin') + self.assertTrue(os.path.exists(sect_fname)) + sect_data = tools.read_file(sect_fname) + self.assertEqual(U_BOOT_DATA, sect_data) + + if __name__ == "__main__": unittest.main() |