diff options
author | Simon Glass <sjg@chromium.org> | 2019-07-20 12:23:45 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2019-07-29 09:38:05 -0600 |
commit | c6bd6e235ac6d6a35e9ad8f3db49db7ba27f7650 (patch) | |
tree | 9b33ebb2abaac9fb99e6efa541f6555427dbd7fb /tools/binman/entry.py | |
parent | 1411ac8d162eaf97714b17848a2da7be1f01fa98 (diff) | |
download | u-boot-c6bd6e235ac6d6a35e9ad8f3db49db7ba27f7650.zip u-boot-c6bd6e235ac6d6a35e9ad8f3db49db7ba27f7650.tar.gz u-boot-c6bd6e235ac6d6a35e9ad8f3db49db7ba27f7650.tar.bz2 |
binman: Adjust Entry to read the node in a separate call
At present the Entry constructor sets up the object and then immediately
reads its device-tree node to obtain its properties.
This breaks a convention that constructors should not do any processing.
A consequence is that we must pass all arguments to the constructor and
cannot have the node-reading proceed in a different way unless we pass
flags to that constructor. We already have a 'test' flag in a few cases,
and now need to control whether the 'orig_offset' and 'orig_size'
properties are set or not.
Adjust the code to require a separate call to ReadNode() after
construction. The Image class remains as it was.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/entry.py')
-rw-r--r-- | tools/binman/entry.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 6436384..c4ddb43 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -70,7 +70,7 @@ class Entry(object): orig_offset: Original offset value read from node orig_size: Original size value read from node """ - def __init__(self, section, etype, node, read_node=True, name_prefix=''): + def __init__(self, section, etype, node, name_prefix=''): self.section = section self.etype = etype self._node = node @@ -89,8 +89,6 @@ class Entry(object): self.image_pos = None self._expand_size = False self.compress = 'none' - if read_node: - self.ReadNode() @staticmethod def Lookup(node_path, etype): @@ -155,6 +153,8 @@ class Entry(object): def ReadNode(self): """Read entry information from the node + This must be called as the first thing after the Entry is created. + This reads all the fields we recognise from the node, ready for use. """ if 'pos' in self._node.props: |