2018-06-02 00:38:16 +09:00
|
|
|
# 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)
|
|
|
|
|
2018-07-07 01:27:40 +09:00
|
|
|
def ProcessFdt(self, fdt):
|
|
|
|
return self._section.ProcessFdt(fdt)
|
|
|
|
|
2018-07-07 01:27:41 +09:00
|
|
|
def AddMissingProperties(self):
|
|
|
|
Entry.AddMissingProperties(self)
|
|
|
|
self._section.AddMissingProperties()
|
|
|
|
|
2018-06-02 00:38:16 +09:00
|
|
|
def ObtainContents(self):
|
2018-07-07 01:27:17 +09:00
|
|
|
return self._section.GetEntryContents()
|
2018-06-02 00:38:16 +09:00
|
|
|
|
|
|
|
def GetData(self):
|
|
|
|
return self._section.GetData()
|
|
|
|
|
2018-08-02 06:22:37 +09:00
|
|
|
def GetOffsets(self):
|
|
|
|
"""Handle entries that want to set the offset/size of other entries
|
2018-06-02 00:38:16 +09:00
|
|
|
|
2018-08-02 06:22:37 +09:00
|
|
|
This calls each entry's GetOffsets() method. If it returns a list
|
2018-06-02 00:38:16 +09:00
|
|
|
of entries to update, it updates them.
|
|
|
|
"""
|
2018-08-02 06:22:37 +09:00
|
|
|
self._section.GetEntryOffsets()
|
2018-06-02 00:38:16 +09:00
|
|
|
return {}
|
|
|
|
|
2018-08-02 06:22:37 +09:00
|
|
|
def Pack(self, offset):
|
2018-06-02 00:38:16 +09:00
|
|
|
"""Pack all entries into the section"""
|
|
|
|
self._section.PackEntries()
|
|
|
|
self.size = self._section.CheckSize()
|
2018-08-02 06:22:37 +09:00
|
|
|
return super(Entry_section, self).Pack(offset)
|
2018-06-02 00:38:16 +09:00
|
|
|
|
|
|
|
def WriteSymbols(self, section):
|
|
|
|
"""Write symbol values into binary files for access at run time"""
|
|
|
|
self._section.WriteSymbols()
|
|
|
|
|
2018-07-07 01:27:41 +09:00
|
|
|
def SetCalculatedProperties(self):
|
|
|
|
Entry.SetCalculatedProperties(self)
|
|
|
|
self._section.SetCalculatedProperties()
|
|
|
|
|
2018-06-02 00:38:16 +09:00
|
|
|
def ProcessContents(self):
|
|
|
|
self._section.ProcessEntryContents()
|
|
|
|
super(Entry_section, self).ProcessContents()
|
|
|
|
|
2018-08-02 06:22:37 +09:00
|
|
|
def CheckOffset(self):
|
2018-06-02 00:38:16 +09:00
|
|
|
self._section.CheckEntries()
|
2018-06-02 00:38:20 +09:00
|
|
|
|
|
|
|
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)
|