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>
diff --git a/tools/binman/image.py b/tools/binman/image.py
index 232e752..970d33f 100644
--- a/tools/binman/image.py
+++ b/tools/binman/image.py
@@ -50,9 +50,13 @@
self.fdtmap_dtb = None
self.fdtmap_data = None
if not test:
- filename = fdt_util.GetString(self._node, 'filename')
- if filename:
- self._filename = filename
+ self.ReadNode()
+
+ def ReadNode(self):
+ section.Entry_section.ReadNode(self)
+ filename = fdt_util.GetString(self._node, 'filename')
+ if filename:
+ self._filename = filename
@classmethod
def FromFile(cls, fname):