u-boot-brain/tools/binman/etype/section.py
Simon Glass 736bb0aec8 binman: Correct operation of ObtainContents()
This method is supposed to return the contents of an entry. However at
present there is no check that it actually does. Also some implementations
do not return 'True' to indicate success, as required.

Add a check for things working as expected, and correct the
implementations.

This requires some additional test cases to cover things which were missed
originally. Add these at the same time.

Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09 09:11:00 -06:00

60 lines
1.7 KiB
Python

# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2018 Google, Inc
# Written by Simon Glass <sjg@chromium.org>
#
# Entry-type module for sections, which are entries which can contain other
# entries.
#
from entry import Entry
import fdt_util
import tools
import bsection
class Entry_section(Entry):
def __init__(self, image, etype, node):
Entry.__init__(self, image, etype, node)
self._section = bsection.Section(node.name, node)
def ObtainContents(self):
return self._section.GetEntryContents()
def GetData(self):
return self._section.GetData()
def GetPositions(self):
"""Handle entries that want to set the position/size of other entries
This calls each entry's GetPositions() method. If it returns a list
of entries to update, it updates them.
"""
self._section.GetEntryPositions()
return {}
def Pack(self, pos):
"""Pack all entries into the section"""
self._section.PackEntries()
self.size = self._section.CheckSize()
return super(Entry_section, self).Pack(pos)
def WriteSymbols(self, section):
"""Write symbol values into binary files for access at run time"""
self._section.WriteSymbols()
def ProcessContents(self):
self._section.ProcessEntryContents()
super(Entry_section, self).ProcessContents()
def CheckPosition(self):
self._section.CheckEntries()
def WriteMap(self, fd, indent):
"""Write a map of the section to a .map file
Args:
fd: File to write the map to
"""
super(Entry_section, self).WriteMap(fd, indent)
self._section.WriteMap(fd, indent + 1)