diff options
author | Simon Glass <sjg@chromium.org> | 2018-06-01 18:38:21 +0300 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-06-07 22:25:08 +0300 |
commit | c8d48efb2b373dc6893e7e9f2f6aaefe5d194719 (patch) | |
tree | 6f3b8315fc2e6fc02c1eede703a804162e7d044e /tools/binman/entry.py | |
parent | 3b0c3821d6401106cc873a6c27a8ee31a8d466a4 (diff) | |
download | u-boot-c8d48efb2b373dc6893e7e9f2f6aaefe5d194719.tar.xz |
binman: Add support for adding a name prefix to entries
Sometimes we have several sections which repeat the same entries (e.g. for
a read-only and read-write version of the same section). It is useful to
be able to tell these entries apart by name.
Add a new 'name-prefix' property for sections, which causes all entries
within that section to have a given name prefix.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/binman/entry.py')
-rw-r--r-- | tools/binman/entry.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/binman/entry.py b/tools/binman/entry.py index 3811d33e42..e4d688c91f 100644 --- a/tools/binman/entry.py +++ b/tools/binman/entry.py @@ -48,11 +48,11 @@ class Entry(object): pad_after: Number of pad bytes after the contents, 0 if none data: Contents of entry (string of bytes) """ - def __init__(self, section, etype, node, read_node=True): + def __init__(self, section, etype, node, read_node=True, name_prefix=''): self.section = section self.etype = etype self._node = node - self.name = node and node.name or 'none' + self.name = node and (name_prefix + node.name) or 'none' self.pos = None self.size = None self.contents_size = 0 @@ -129,6 +129,15 @@ class Entry(object): self.align_end = fdt_util.GetInt(self._node, 'align-end') self.pos_unset = fdt_util.GetBool(self._node, 'pos-unset') + def SetPrefix(self, prefix): + """Set the name prefix for a node + + Args: + prefix: Prefix to set, or '' to not use a prefix + """ + if prefix: + self.name = prefix + self.name + def ObtainContents(self): """Figure out the contents of an entry. |