Commit a3bbb1f4 authored by Simon Glass's avatar Simon Glass
Browse files

RFC: 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.

Note: Needs a test updates
Signed-off-by: Simon Glass's avatarSimon Glass <sjg@chromium.org>
parent 8a5abbca
......@@ -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:
......
......@@ -67,7 +67,8 @@ class Entry_section(Entry):
def Pack(self, offset):
"""Pack all entries into the section"""
self._section.PackEntries()
self._section.SetOffset(offset)
if self._section._offset is None:
self._section.SetOffset(offset)
self.size = self._section.GetSize()
return super(Entry_section, self).Pack(offset)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment