binman: Allow listing an image created by a newer version

If an older version of binman is used to list images created by a newer
one, it is possible that it will contain entry types that are not
supported. At present this produces an error.

Adjust binman to use a plain 'blob' entry type to cope with this, so the
image can at least be listed.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2021-11-23 21:09:49 -07:00
parent 7945077f79
commit 858436dfda
5 changed files with 74 additions and 18 deletions

View File

@@ -10,6 +10,7 @@ import sys
import unittest
from binman import entry
from binman.etype.blob import Entry_blob
from dtoc import fdt
from dtoc import fdt_util
from patman import tools
@@ -100,5 +101,13 @@ class TestEntry(unittest.TestCase):
self.assertIn("Unknown entry type 'missing' in node '/binman/u-boot'",
str(e.exception))
def testMissingEtype(self):
"""Test use of a blob etype when the requested one is not available"""
ent = entry.Entry.Create(None, self.GetNode(), 'missing',
missing_etype=True)
self.assertTrue(isinstance(ent, Entry_blob))
self.assertEquals('missing', ent.etype)
if __name__ == "__main__":
unittest.main()