]> git.ipfire.org Git - thirdparty/u-boot.git/blob - tools/binman/etype/section.py
b90b80e4ce75b3bb1e3c294fcc22af7e3e549322
[thirdparty/u-boot.git] / tools / binman / etype / section.py
1 # SPDX-License-Identifier: GPL-2.0+
2 # Copyright (c) 2018 Google, Inc
3 # Written by Simon Glass <sjg@chromium.org>
4 #
5 # Entry-type module for sections, which are entries which can contain other
6 # entries.
7 #
8
9 from entry import Entry
10 import fdt_util
11 import tools
12
13 import bsection
14
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)
19
20 def ProcessFdt(self, fdt):
21 return self._section.ProcessFdt(fdt)
22
23 def AddMissingProperties(self):
24 Entry.AddMissingProperties(self)
25 self._section.AddMissingProperties()
26
27 def ObtainContents(self):
28 return self._section.GetEntryContents()
29
30 def GetData(self):
31 return self._section.GetData()
32
33 def GetOffsets(self):
34 """Handle entries that want to set the offset/size of other entries
35
36 This calls each entry's GetOffsets() method. If it returns a list
37 of entries to update, it updates them.
38 """
39 self._section.GetEntryOffsets()
40 return {}
41
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)
48
49 def SetImagePos(self, image_pos):
50 Entry.SetImagePos(self, image_pos)
51 self._section.SetImagePos(image_pos + self.offset)
52
53 def WriteSymbols(self, section):
54 """Write symbol values into binary files for access at run time"""
55 self._section.WriteSymbols()
56
57 def SetCalculatedProperties(self):
58 Entry.SetCalculatedProperties(self)
59 self._section.SetCalculatedProperties()
60
61 def ProcessContents(self):
62 self._section.ProcessEntryContents()
63 super(Entry_section, self).ProcessContents()
64
65 def CheckOffset(self):
66 self._section.CheckEntries()
67
68 def WriteMap(self, fd, indent):
69 """Write a map of the section to a .map file
70
71 Args:
72 fd: File to write the map to
73 """
74 self._section.WriteMap(fd, indent)