1 # SPDX-License-Identifier: GPL-2.0+
2 # Copyright (c) 2018 Google, Inc
3 # Written by Simon Glass <sjg@chromium.org>
5 # Entry-type module for sections, which are entries which can contain other
9 from entry import Entry
15 class Entry_section(Entry):
16 def __init__(self, image, etype, node):
17 Entry.__init__(self, image, etype, node)
18 self._section = bsection.Section(node.name, node)
20 def ProcessFdt(self, fdt):
21 return self._section.ProcessFdt(fdt)
23 def AddMissingProperties(self):
24 Entry.AddMissingProperties(self)
25 self._section.AddMissingProperties()
27 def ObtainContents(self):
28 return self._section.GetEntryContents()
31 return self._section.GetData()
34 """Handle entries that want to set the offset/size of other entries
36 This calls each entry's GetOffsets() method. If it returns a list
37 of entries to update, it updates them.
39 self._section.GetEntryOffsets()
42 def Pack(self, offset):
43 """Pack all entries into the section"""
44 self._section.PackEntries()
45 self._section.SetOffset(offset)
46 self.size = self._section.GetSize()
47 return super(Entry_section, self).Pack(offset)
49 def SetImagePos(self, image_pos):
50 Entry.SetImagePos(self, image_pos)
51 self._section.SetImagePos(image_pos + self.offset)
53 def WriteSymbols(self, section):
54 """Write symbol values into binary files for access at run time"""
55 self._section.WriteSymbols()
57 def SetCalculatedProperties(self):
58 Entry.SetCalculatedProperties(self)
59 self._section.SetCalculatedProperties()
61 def ProcessContents(self):
62 self._section.ProcessEntryContents()
63 super(Entry_section, self).ProcessContents()
65 def CheckOffset(self):
66 self._section.CheckEntries()
68 def WriteMap(self, fd, indent):
69 """Write a map of the section to a .map file
72 fd: File to write the map to
74 self._section.WriteMap(fd, indent)