summaryrefslogtreecommitdiff
path: root/tools/binman/image.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-01-07 07:35:16 +0300
committerSimon Glass <sjg@chromium.org>2021-01-31 00:25:41 +0300
commit939d1062d05fb4990ca7898613bcc753574f7c56 (patch)
tree7e7ac0cb10123e23424ec8c1acc8577806516f88 /tools/binman/image.py
parent870a9ead569ce8ee1f9fc03d178b56e012465582 (diff)
downloadu-boot-939d1062d05fb4990ca7898613bcc753574f7c56.tar.xz
binman: Support reading an image with entry args
Normally when an entry is created, any entry arguments it has are required to be provided, so it can actually generate its contents correctly. However when an existing image is read, Entry objects are created for each of the entries in the image. This happens as part of the process of reading the image into binman. In this case we don't need the entry arguments, since we do not intend to regenerate the entries, or at least not unless requested. So there is no sense in reporting an error for missing entry arguments. Add a new property for the Image to handle this case. Update the error reporting to be conditional on this property. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/image.py')
-rw-r--r--tools/binman/image.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 3622efc686..3c2fe5ea62 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -43,8 +43,13 @@ class Image(section.Entry_section):
test: True if this is being called from a test of Images. This this case
there is no device tree defining the structure of the section, so
we create a section manually.
+ ignore_missing: Ignore any missing entry arguments (i.e. don't raise an
+ exception). This should be used if the Image is being loaded from
+ a file rather than generated. In that case we obviously don't need
+ the entry arguments since the contents already exists.
"""
- def __init__(self, name, node, copy_to_orig=True, test=False):
+ def __init__(self, name, node, copy_to_orig=True, test=False,
+ ignore_missing=False):
super().__init__(None, 'section', node, test=test)
self.copy_to_orig = copy_to_orig
self.name = 'main-section'
@@ -53,6 +58,7 @@ class Image(section.Entry_section):
self.fdtmap_dtb = None
self.fdtmap_data = None
self.allow_repack = False
+ self._ignore_missing = ignore_missing
if not test:
self.ReadNode()
@@ -100,7 +106,7 @@ class Image(section.Entry_section):
# Return an Image with the associated nodes
root = dtb.GetRoot()
- image = Image('image', root, copy_to_orig=False)
+ image = Image('image', root, copy_to_orig=False, ignore_missing=True)
image.image_node = fdt_util.GetString(root, 'image-node', 'image')
image.fdtmap_dtb = dtb