]> git.sur5r.net Git - u-boot/blob - tools/binman/etype/section.py
binman: Add a ProcessFdt() method
[u-boot] / 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 ObtainContents(self):
24         return self._section.GetEntryContents()
25
26     def GetData(self):
27         return self._section.GetData()
28
29     def GetPositions(self):
30         """Handle entries that want to set the position/size of other entries
31
32         This calls each entry's GetPositions() method. If it returns a list
33         of entries to update, it updates them.
34         """
35         self._section.GetEntryPositions()
36         return {}
37
38     def Pack(self, pos):
39         """Pack all entries into the section"""
40         self._section.PackEntries()
41         self.size = self._section.CheckSize()
42         return super(Entry_section, self).Pack(pos)
43
44     def WriteSymbols(self, section):
45         """Write symbol values into binary files for access at run time"""
46         self._section.WriteSymbols()
47
48     def ProcessContents(self):
49         self._section.ProcessEntryContents()
50         super(Entry_section, self).ProcessContents()
51
52     def CheckPosition(self):
53         self._section.CheckEntries()
54
55     def WriteMap(self, fd, indent):
56         """Write a map of the section to a .map file
57
58         Args:
59             fd: File to write the map to
60         """
61         super(Entry_section, self).WriteMap(fd, indent)
62         self._section.WriteMap(fd, indent + 1)