summaryrefslogtreecommitdiff
path: root/tools/binman/bsection.py
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2019-04-25 21:58:39 -0600
committerBin Meng <[email protected]>2019-05-08 12:44:07 +0800
commit9481c80f55260fa2b2c37445fb2a30811b136ed3 (patch)
tree7ac1d0265c52f660145b4d628ff887fbd374a157 /tools/binman/bsection.py
parent0b96f6ecbe8f68232adeb4340883aaeee5d63bd5 (diff)
binman: Allow sections to have an offset
At present sections are always placed automatically. Even if an 'offset' property is provided it is ignored. Update the logic to support an offset for sections. Signed-off-by: Simon Glass <[email protected]> Reviewed-by: Bin Meng <[email protected]>
Diffstat (limited to 'tools/binman/bsection.py')
-rw-r--r--tools/binman/bsection.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index ccf2920c5bd..0ba542ee987 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -57,7 +57,7 @@ class Section(object):
self._name = name
self._node = node
self._image = image
- self._offset = 0
+ self._offset = None
self._size = None
self._align_size = None
self._pad_before = 0
@@ -75,6 +75,7 @@ class Section(object):
def _ReadNode(self):
"""Read properties from the section node"""
+ self._offset = fdt_util.GetInt(self._node, 'offset')
self._size = fdt_util.GetInt(self._node, 'size')
self._align_size = fdt_util.GetInt(self._node, 'align-size')
if tools.NotPowerOfTwo(self._align_size):
@@ -130,7 +131,7 @@ class Section(object):
entry.AddMissingProperties()
def SetCalculatedProperties(self):
- state.SetInt(self._node, 'offset', self._offset)
+ state.SetInt(self._node, 'offset', self._offset or 0)
state.SetInt(self._node, 'size', self._size)
image_pos = self._image_pos
if self._parent_section:
@@ -424,8 +425,8 @@ class Section(object):
Args:
fd: File to write the map to
"""
- Entry.WriteMapLine(fd, indent, self._name, self._offset, self._size,
- self._image_pos)
+ Entry.WriteMapLine(fd, indent, self._name, self._offset or 0,
+ self._size, self._image_pos)
for entry in self._entries.values():
entry.WriteMap(fd, indent + 1)