1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-09-03 09:42:22 +02:00

binman: Use super() instead of specifying parent type

It is easier and less error-prone to use super() when the parent type is
needed. Update binman to remove the type names.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass
2020-07-09 18:39:35 -06:00
parent 73bc9e2e21
commit 34861d506c
57 changed files with 86 additions and 87 deletions

View File

@@ -41,10 +41,10 @@ class Entry__testing(Entry):
data type (generating an error) data type (generating an error)
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node) super().__init__(section, etype, node)
def ReadNode(self): def ReadNode(self):
Entry.ReadNode(self) super().ReadNode()
self.return_invalid_entry = fdt_util.GetBool(self._node, self.return_invalid_entry = fdt_util.GetBool(self._node,
'return-invalid-entry') 'return-invalid-entry')
self.return_unknown_contents = fdt_util.GetBool(self._node, self.return_unknown_contents = fdt_util.GetBool(self._node,

View File

@@ -31,7 +31,7 @@ class Entry_blob(Entry):
data. data.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node) super().__init__(section, etype, node)
self._filename = fdt_util.GetString(self._node, 'filename', self.etype) self._filename = fdt_util.GetString(self._node, 'filename', self.etype)
self.compress = fdt_util.GetString(self._node, 'compress', 'none') self.compress = fdt_util.GetString(self._node, 'compress', 'none')

View File

@@ -20,13 +20,13 @@ class Entry_blob_dtb(Entry_blob):
global state global state
from binman import state from binman import state
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def ObtainContents(self): def ObtainContents(self):
"""Get the device-tree from the list held by the 'state' module""" """Get the device-tree from the list held by the 'state' module"""
self._filename = self.GetDefaultFilename() self._filename = self.GetDefaultFilename()
self._pathname, _ = state.GetFdtContents(self.GetFdtEtype()) self._pathname, _ = state.GetFdtContents(self.GetFdtEtype())
return Entry_blob.ReadBlobContents(self) return super().ReadBlobContents()
def ProcessContents(self): def ProcessContents(self):
"""Re-read the DTB contents so that we get any calculated properties""" """Re-read the DTB contents so that we get any calculated properties"""
@@ -57,7 +57,7 @@ class Entry_blob_dtb(Entry_blob):
return {self.GetFdtEtype(): [self, fname]} return {self.GetFdtEtype(): [self, fname]}
def WriteData(self, data, decomp=True): def WriteData(self, data, decomp=True):
ok = Entry_blob.WriteData(self, data, decomp) ok = super().WriteData(data, decomp)
# Update the state module, since it has the authoritative record of the # Update the state module, since it has the authoritative record of the
# device trees used. If we don't do this, then state.GetFdtContents() # device trees used. If we don't do this, then state.GetFdtContents()

View File

@@ -29,6 +29,6 @@ class Entry_blob_named_by_arg(Entry_blob):
See cros_ec_rw for an example of this. See cros_ec_rw for an example of this.
""" """
def __init__(self, section, etype, node, blob_fname): def __init__(self, section, etype, node, blob_fname):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
self._filename, = self.GetEntryArgsOrProps( self._filename, = self.GetEntryArgsOrProps(
[EntryArg('%s-path' % blob_fname, str)]) [EntryArg('%s-path' % blob_fname, str)])

View File

@@ -167,7 +167,7 @@ class Entry_cbfs(Entry):
global state global state
from binman import state from binman import state
Entry.__init__(self, section, etype, node) super().__init__(section, etype, node)
self._cbfs_arg = fdt_util.GetString(node, 'cbfs-arch', 'x86') self._cbfs_arg = fdt_util.GetString(node, 'cbfs-arch', 'x86')
self._cbfs_entries = OrderedDict() self._cbfs_entries = OrderedDict()
self._ReadSubnodes() self._ReadSubnodes()
@@ -226,7 +226,7 @@ class Entry_cbfs(Entry):
Args: Args:
image_pos: Position of this entry in the image image_pos: Position of this entry in the image
""" """
Entry.SetImagePos(self, image_pos) super().SetImagePos(image_pos)
# Now update the entries with info from the CBFS entries # Now update the entries with info from the CBFS entries
for entry in self._cbfs_entries.values(): for entry in self._cbfs_entries.values():
@@ -238,7 +238,7 @@ class Entry_cbfs(Entry):
entry.uncomp_size = cfile.memlen entry.uncomp_size = cfile.memlen
def AddMissingProperties(self): def AddMissingProperties(self):
Entry.AddMissingProperties(self) super().AddMissingProperties()
for entry in self._cbfs_entries.values(): for entry in self._cbfs_entries.values():
entry.AddMissingProperties() entry.AddMissingProperties()
if entry._cbfs_compress: if entry._cbfs_compress:
@@ -250,7 +250,7 @@ class Entry_cbfs(Entry):
def SetCalculatedProperties(self): def SetCalculatedProperties(self):
"""Set the value of device-tree properties calculated by binman""" """Set the value of device-tree properties calculated by binman"""
Entry.SetCalculatedProperties(self) super().SetCalculatedProperties()
for entry in self._cbfs_entries.values(): for entry in self._cbfs_entries.values():
state.SetInt(entry._node, 'offset', entry.offset) state.SetInt(entry._node, 'offset', entry.offset)
state.SetInt(entry._node, 'size', entry.size) state.SetInt(entry._node, 'size', entry.size)
@@ -260,7 +260,7 @@ class Entry_cbfs(Entry):
def ListEntries(self, entries, indent): def ListEntries(self, entries, indent):
"""Override this method to list all files in the section""" """Override this method to list all files in the section"""
Entry.ListEntries(self, entries, indent) super().ListEntries(entries, indent)
for entry in self._cbfs_entries.values(): for entry in self._cbfs_entries.values():
entry.ListEntries(entries, indent + 1) entry.ListEntries(entries, indent + 1)
@@ -268,12 +268,12 @@ class Entry_cbfs(Entry):
return self._cbfs_entries return self._cbfs_entries
def ReadData(self, decomp=True): def ReadData(self, decomp=True):
data = Entry.ReadData(self, True) data = super().ReadData(True)
return data return data
def ReadChildData(self, child, decomp=True): def ReadChildData(self, child, decomp=True):
if not self.reader: if not self.reader:
data = Entry.ReadData(self, True) data = super().ReadData(True)
self.reader = cbfs_util.CbfsReader(data) self.reader = cbfs_util.CbfsReader(data)
reader = self.reader reader = self.reader
cfile = reader.files.get(child.name) cfile = reader.files.get(child.name)

View File

@@ -18,5 +18,4 @@ class Entry_cros_ec_rw(Entry_blob_named_by_arg):
updating the EC on startup via software sync. updating the EC on startup via software sync.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob_named_by_arg.__init__(self, section, etype, node, super().__init__(section, etype, node, 'cros-ec-rw')
'cros-ec-rw')

View File

@@ -85,7 +85,7 @@ class Entry_fdtmap(Entry):
from binman import state from binman import state
from dtoc.fdt import Fdt from dtoc.fdt import Fdt
Entry.__init__(self, section, etype, node) super().__init__(section, etype, node)
def _GetFdtmap(self): def _GetFdtmap(self):
"""Build an FDT map from the entries in the current image """Build an FDT map from the entries in the current image

View File

@@ -32,7 +32,7 @@ class Entry_files(Entry_section):
global state global state
from binman import state from binman import state
Entry_section.__init__(self, section, etype, node) super().__init__(section, etype, node)
self._pattern = fdt_util.GetString(self._node, 'pattern') self._pattern = fdt_util.GetString(self._node, 'pattern')
if not self._pattern: if not self._pattern:
self.Raise("Missing 'pattern' property") self.Raise("Missing 'pattern' property")

View File

@@ -22,10 +22,10 @@ class Entry_fill(Entry):
byte value of a region. byte value of a region.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node) super().__init__(section, etype, node)
def ReadNode(self): def ReadNode(self):
Entry.ReadNode(self) super().ReadNode()
if self.size is None: if self.size is None:
self.Raise("'fill' entry must have a size property") self.Raise("'fill' entry must have a size property")
self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0) self.fill_value = fdt_util.GetByte(self._node, 'fill-byte', 0)

View File

@@ -32,7 +32,7 @@ class Entry_fmap(Entry):
the sub-entries are ignored. the sub-entries are ignored.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node) super().__init__(section, etype, node)
def _GetFmap(self): def _GetFmap(self):
"""Build an FMAP from the entries in the current image """Build an FMAP from the entries in the current image

View File

@@ -54,7 +54,7 @@ class Entry_gbb(Entry):
README.chromium for how to obtain the required keys and tools. README.chromium for how to obtain the required keys and tools.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node) super().__init__(section, etype, node)
self.hardware_id, self.keydir, self.bmpblk = self.GetEntryArgsOrProps( self.hardware_id, self.keydir, self.bmpblk = self.GetEntryArgsOrProps(
[EntryArg('hardware-id', str), [EntryArg('hardware-id', str),
EntryArg('keydir', str), EntryArg('keydir', str),

View File

@@ -57,7 +57,7 @@ class Entry_image_header(Entry):
first/last in the entry list. first/last in the entry list.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node) super().__init__(section, etype, node)
self.location = fdt_util.GetString(self._node, 'location') self.location = fdt_util.GetString(self._node, 'location')
def _GetHeader(self): def _GetHeader(self):
@@ -101,7 +101,7 @@ class Entry_image_header(Entry):
else: else:
offset = image_size - IMAGE_HEADER_LEN offset = image_size - IMAGE_HEADER_LEN
offset += self.section.GetStartOffset() offset += self.section.GetStartOffset()
return Entry.Pack(self, offset) return super().Pack(offset)
def ProcessContents(self): def ProcessContents(self):
"""Write an updated version of the FDT map to this entry """Write an updated version of the FDT map to this entry

View File

@@ -20,4 +20,4 @@ class Entry_intel_cmc(Entry_blob):
See README.x86 for information about x86 binary blobs. See README.x86 for information about x86 binary blobs.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)

View File

@@ -45,14 +45,14 @@ class Entry_intel_descriptor(Entry_blob):
See README.x86 for information about x86 binary blobs. See README.x86 for information about x86 binary blobs.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
self._regions = [] self._regions = []
def Pack(self, offset): def Pack(self, offset):
"""Put this entry at the start of the image""" """Put this entry at the start of the image"""
if self.offset is None: if self.offset is None:
offset = self.section.GetStartOffset() offset = self.section.GetStartOffset()
return Entry_blob.Pack(self, offset) return super().Pack(offset)
def GetOffsets(self): def GetOffsets(self):
offset = self.data.find(FD_SIGNATURE) offset = self.data.find(FD_SIGNATURE)

View File

@@ -19,11 +19,11 @@ class Entry_intel_fit(Entry_blob):
At present binman only supports a basic FIT with no microcode. At present binman only supports a basic FIT with no microcode.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def ReadNode(self): def ReadNode(self):
"""Force 16-byte alignment as required by FIT pointer""" """Force 16-byte alignment as required by FIT pointer"""
Entry_blob.ReadNode(self) super().ReadNode()
self.align = 16 self.align = 16
def ObtainContents(self): def ObtainContents(self):

View File

@@ -16,7 +16,7 @@ class Entry_intel_fit_ptr(Entry_blob):
0xffffffc0 in the image. 0xffffffc0 in the image.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
if self.HasSibling('intel-fit') is False: if self.HasSibling('intel-fit') is False:
self.Raise("'intel-fit-ptr' section must have an 'intel-fit' sibling") self.Raise("'intel-fit-ptr' section must have an 'intel-fit' sibling")
@@ -38,4 +38,4 @@ class Entry_intel_fit_ptr(Entry_blob):
def Pack(self, offset): def Pack(self, offset):
"""Special pack method to set the offset to the right place""" """Special pack method to set the offset to the right place"""
return Entry_blob.Pack(self, 0xffffffc0) return super().Pack(0xffffffc0)

View File

@@ -24,4 +24,4 @@ class Entry_intel_fsp(Entry_blob):
See README.x86 for information about x86 binary blobs. See README.x86 for information about x86 binary blobs.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)

View File

@@ -24,4 +24,4 @@ class Entry_intel_fsp_m(Entry_blob):
See README.x86 for information about x86 binary blobs. See README.x86 for information about x86 binary blobs.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)

View File

@@ -24,4 +24,4 @@ class Entry_intel_fsp_s(Entry_blob):
See README.x86 for information about x86 binary blobs. See README.x86 for information about x86 binary blobs.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)

View File

@@ -23,4 +23,4 @@ class Entry_intel_fsp_t(Entry_blob):
See README.x86 for information about x86 binary blobs. See README.x86 for information about x86 binary blobs.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)

View File

@@ -45,13 +45,13 @@ class Entry_intel_ifwi(Entry_blob):
See README.x86 for information about x86 binary blobs. See README.x86 for information about x86 binary blobs.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
self._convert_fit = fdt_util.GetBool(self._node, 'convert-fit') self._convert_fit = fdt_util.GetBool(self._node, 'convert-fit')
self._ifwi_entries = OrderedDict() self._ifwi_entries = OrderedDict()
def ReadNode(self): def ReadNode(self):
self._ReadSubnodes() self._ReadSubnodes()
Entry_blob.ReadNode(self) super().ReadNode()
def _BuildIfwi(self): def _BuildIfwi(self):
"""Build the contents of the IFWI and write it to the 'data' property""" """Build the contents of the IFWI and write it to the 'data' property"""

View File

@@ -27,4 +27,4 @@ class Entry_intel_me(Entry_blob):
See README.x86 for information about x86 binary blobs. See README.x86 for information about x86 binary blobs.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)

View File

@@ -21,7 +21,7 @@ class Entry_intel_mrc(Entry_blob):
See README.x86 for information about x86 binary blobs. See README.x86 for information about x86 binary blobs.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'mrc.bin' return 'mrc.bin'

View File

@@ -21,7 +21,7 @@ class Entry_intel_refcode(Entry_blob):
See README.x86 for information about x86 binary blobs. See README.x86 for information about x86 binary blobs.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'refcode.bin' return 'refcode.bin'

View File

@@ -19,4 +19,4 @@ class Entry_intel_vbt(Entry_blob):
See README.x86 for information about Intel binary blobs. See README.x86 for information about Intel binary blobs.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)

View File

@@ -22,4 +22,4 @@ class Entry_intel_vga(Entry_blob):
See README.x86 for information about Intel binary blobs. See README.x86 for information about Intel binary blobs.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)

View File

@@ -33,7 +33,7 @@ class Entry_mkimage(Entry):
binman. binman.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node) super().__init__(section, etype, node)
self._args = fdt_util.GetString(self._node, 'args').split(' ') self._args = fdt_util.GetString(self._node, 'args').split(' ')
self._mkimage_entries = OrderedDict() self._mkimage_entries = OrderedDict()
self._ReadSubnodes() self._ReadSubnodes()

View File

@@ -19,7 +19,7 @@ class Entry_powerpc_mpc85xx_bootpg_resetvec(Entry_blob):
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'u-boot-br.bin' return 'u-boot-br.bin'

View File

@@ -43,7 +43,7 @@ class Entry_section(Entry):
""" """
def __init__(self, section, etype, node, test=False): def __init__(self, section, etype, node, test=False):
if not test: if not test:
Entry.__init__(self, section, etype, node) super().__init__(section, etype, node)
self._entries = OrderedDict() self._entries = OrderedDict()
self._pad_byte = 0 self._pad_byte = 0
self._sort = False self._sort = False
@@ -52,7 +52,7 @@ class Entry_section(Entry):
def ReadNode(self): def ReadNode(self):
"""Read properties from the image node""" """Read properties from the image node"""
Entry.ReadNode(self) super().ReadNode()
self._pad_byte = fdt_util.GetInt(self._node, 'pad-byte', 0) self._pad_byte = fdt_util.GetInt(self._node, 'pad-byte', 0)
self._sort = fdt_util.GetBool(self._node, 'sort-by-offset') self._sort = fdt_util.GetBool(self._node, 'sort-by-offset')
self._end_4gb = fdt_util.GetBool(self._node, 'end-at-4gb') self._end_4gb = fdt_util.GetBool(self._node, 'end-at-4gb')
@@ -126,13 +126,13 @@ class Entry_section(Entry):
a section containing a list of files. Process these entries so that a section containing a list of files. Process these entries so that
this information is added to the device tree. this information is added to the device tree.
""" """
Entry.ExpandEntries(self) super().ExpandEntries()
for entry in self._entries.values(): for entry in self._entries.values():
entry.ExpandEntries() entry.ExpandEntries()
def AddMissingProperties(self): def AddMissingProperties(self):
"""Add new properties to the device tree as needed for this entry""" """Add new properties to the device tree as needed for this entry"""
Entry.AddMissingProperties(self) super().AddMissingProperties()
for entry in self._entries.values(): for entry in self._entries.values():
entry.AddMissingProperties() entry.AddMissingProperties()
@@ -168,14 +168,14 @@ class Entry_section(Entry):
def ResetForPack(self): def ResetForPack(self):
"""Reset offset/size fields so that packing can be done again""" """Reset offset/size fields so that packing can be done again"""
Entry.ResetForPack(self) super().ResetForPack()
for entry in self._entries.values(): for entry in self._entries.values():
entry.ResetForPack() entry.ResetForPack()
def Pack(self, offset): def Pack(self, offset):
"""Pack all entries into the section""" """Pack all entries into the section"""
self._PackEntries() self._PackEntries()
return Entry.Pack(self, offset) return super().Pack(offset)
def _PackEntries(self): def _PackEntries(self):
"""Pack all entries into the image""" """Pack all entries into the image"""
@@ -232,12 +232,12 @@ class Entry_section(Entry):
entry.WriteSymbols(self) entry.WriteSymbols(self)
def SetCalculatedProperties(self): def SetCalculatedProperties(self):
Entry.SetCalculatedProperties(self) super().SetCalculatedProperties()
for entry in self._entries.values(): for entry in self._entries.values():
entry.SetCalculatedProperties() entry.SetCalculatedProperties()
def SetImagePos(self, image_pos): def SetImagePos(self, image_pos):
Entry.SetImagePos(self, image_pos) super().SetImagePos(image_pos)
for entry in self._entries.values(): for entry in self._entries.values():
entry.SetImagePos(image_pos + self.offset) entry.SetImagePos(image_pos + self.offset)

View File

@@ -57,7 +57,7 @@ class Entry_text(Entry):
by setting the size of the entry to something larger than the text. by setting the size of the entry to something larger than the text.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node) super().__init__(section, etype, node)
value = fdt_util.GetString(self._node, 'text') value = fdt_util.GetString(self._node, 'text')
if value: if value:
value = tools.ToBytes(value) value = tools.ToBytes(value)

View File

@@ -26,7 +26,7 @@ class Entry_u_boot(Entry_blob):
in the binman README for more information. in the binman README for more information.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'u-boot.bin' return 'u-boot.bin'

View File

@@ -22,7 +22,7 @@ class Entry_u_boot_dtb(Entry_blob_dtb):
binman to know which entries contain a device tree. binman to know which entries contain a device tree.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob_dtb.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'u-boot.dtb' return 'u-boot.dtb'

View File

@@ -28,7 +28,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
global state global state
from binman import state from binman import state
Entry_blob_dtb.__init__(self, section, etype, node) super().__init__(section, etype, node)
self.ucode_data = b'' self.ucode_data = b''
self.collate = False self.collate = False
self.ucode_offset = None self.ucode_offset = None
@@ -78,7 +78,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
def ObtainContents(self): def ObtainContents(self):
# Call the base class just in case it does something important. # Call the base class just in case it does something important.
Entry_blob_dtb.ObtainContents(self) super().ObtainContents()
if self.ucode and not self.collate: if self.ucode and not self.collate:
for node in self.ucode.subnodes: for node in self.ucode.subnodes:
data_prop = node.props.get('data') data_prop = node.props.get('data')

View File

@@ -21,7 +21,7 @@ class Entry_u_boot_elf(Entry_blob):
relocated to any address for execution. relocated to any address for execution.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
self._strip = fdt_util.GetBool(self._node, 'strip') self._strip = fdt_util.GetBool(self._node, 'strip')
def ReadBlobContents(self): def ReadBlobContents(self):
@@ -31,7 +31,7 @@ class Entry_u_boot_elf(Entry_blob):
tools.WriteFile(out_fname, tools.ReadFile(self._pathname)) tools.WriteFile(out_fname, tools.ReadFile(self._pathname))
tools.Run('strip', out_fname) tools.Run('strip', out_fname)
self._pathname = out_fname self._pathname = out_fname
Entry_blob.ReadBlobContents(self) super().ReadBlobContents()
return True return True
def GetDefaultFilename(self): def GetDefaultFilename(self):

View File

@@ -21,7 +21,7 @@ class Entry_u_boot_img(Entry_blob):
applications. applications.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'u-boot.img' return 'u-boot.img'

View File

@@ -21,7 +21,7 @@ class Entry_u_boot_nodtb(Entry_blob):
U-Boot and the device tree). U-Boot and the device tree).
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'u-boot-nodtb.bin' return 'u-boot-nodtb.bin'

View File

@@ -32,7 +32,7 @@ class Entry_u_boot_spl(Entry_blob):
binman uses that to look up symbols to write into the SPL binary. binman uses that to look up symbols to write into the SPL binary.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
self.elf_fname = 'spl/u-boot-spl' self.elf_fname = 'spl/u-boot-spl'
def GetDefaultFilename(self): def GetDefaultFilename(self):

View File

@@ -31,7 +31,7 @@ class Entry_u_boot_spl_bss_pad(Entry_blob):
binman uses that to look up the BSS address. binman uses that to look up the BSS address.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def ObtainContents(self): def ObtainContents(self):
fname = tools.GetInputFilename('spl/u-boot-spl') fname = tools.GetInputFilename('spl/u-boot-spl')

View File

@@ -19,7 +19,7 @@ class Entry_u_boot_spl_dtb(Entry_blob_dtb):
to activate. to activate.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob_dtb.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'spl/u-boot-spl.dtb' return 'spl/u-boot-spl.dtb'

View File

@@ -18,7 +18,7 @@ class Entry_u_boot_spl_elf(Entry_blob):
be relocated to any address for execution. be relocated to any address for execution.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'spl/u-boot-spl' return 'spl/u-boot-spl'

View File

@@ -22,7 +22,7 @@ class Entry_u_boot_spl_nodtb(Entry_blob):
both SPL and the device tree). both SPL and the device tree).
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'spl/u-boot-spl-nodtb.bin' return 'spl/u-boot-spl-nodtb.bin'

View File

@@ -18,7 +18,7 @@ class Entry_u_boot_spl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr):
process. process.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_u_boot_with_ucode_ptr.__init__(self, section, etype, node) super().__init__(section, etype, node)
self.elf_fname = 'spl/u-boot-spl' self.elf_fname = 'spl/u-boot-spl'
def GetDefaultFilename(self): def GetDefaultFilename(self):

View File

@@ -32,7 +32,7 @@ class Entry_u_boot_tpl(Entry_blob):
binman uses that to look up symbols to write into the TPL binary. binman uses that to look up symbols to write into the TPL binary.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
self.elf_fname = 'tpl/u-boot-tpl' self.elf_fname = 'tpl/u-boot-tpl'
def GetDefaultFilename(self): def GetDefaultFilename(self):

View File

@@ -19,7 +19,7 @@ class Entry_u_boot_tpl_dtb(Entry_blob_dtb):
to activate. to activate.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob_dtb.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'tpl/u-boot-tpl.dtb' return 'tpl/u-boot-tpl.dtb'

View File

@@ -16,7 +16,7 @@ class Entry_u_boot_tpl_dtb_with_ucode(Entry_u_boot_dtb_with_ucode):
process. process.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_u_boot_dtb_with_ucode.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'tpl/u-boot-tpl.dtb' return 'tpl/u-boot-tpl.dtb'

View File

@@ -18,7 +18,7 @@ class Entry_u_boot_tpl_elf(Entry_blob):
be relocated to any address for execution. be relocated to any address for execution.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'tpl/u-boot-tpl' return 'tpl/u-boot-tpl'

View File

@@ -20,7 +20,7 @@ class Entry_u_boot_tpl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr):
process. process.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_u_boot_with_ucode_ptr.__init__(self, section, etype, node) super().__init__(section, etype, node)
self.elf_fname = 'tpl/u-boot-tpl' self.elf_fname = 'tpl/u-boot-tpl'
def GetDefaultFilename(self): def GetDefaultFilename(self):

View File

@@ -58,7 +58,7 @@ class Entry_u_boot_ucode(Entry_blob):
contents of this entry. contents of this entry.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def ObtainContents(self): def ObtainContents(self):
# If the section does not need microcode, there is nothing to do # If the section does not need microcode, there is nothing to do

View File

@@ -29,7 +29,7 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob):
complicated. Otherwise it is the same as the u_boot entry. complicated. Otherwise it is the same as the u_boot entry.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
self.elf_fname = 'u-boot' self.elf_fname = 'u-boot'
self.target_offset = None self.target_offset = None

View File

@@ -36,7 +36,7 @@ class Entry_vblock(Entry):
and kernel are genuine. and kernel are genuine.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node) super().__init__(section, etype, node)
self.content = fdt_util.GetPhandleList(self._node, 'content') self.content = fdt_util.GetPhandleList(self._node, 'content')
if not self.content: if not self.content:
self.Raise("Vblock must have a 'content' property") self.Raise("Vblock must have a 'content' property")

View File

@@ -23,7 +23,7 @@ class Entry_x86_reset16(Entry_blob):
For 64-bit U-Boot, the 'x86_reset16_spl' entry type is used instead. For 64-bit U-Boot, the 'x86_reset16_spl' entry type is used instead.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'u-boot-x86-reset16.bin' return 'u-boot-x86-reset16.bin'

View File

@@ -23,7 +23,7 @@ class Entry_x86_reset16_spl(Entry_blob):
For 32-bit U-Boot, the 'x86_reset_spl' entry type is used instead. For 32-bit U-Boot, the 'x86_reset_spl' entry type is used instead.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'spl/u-boot-x86-reset16-spl.bin' return 'spl/u-boot-x86-reset16-spl.bin'

View File

@@ -23,7 +23,7 @@ class Entry_x86_reset16_tpl(Entry_blob):
For 32-bit U-Boot, the 'x86_reset_tpl' entry type is used instead. For 32-bit U-Boot, the 'x86_reset_tpl' entry type is used instead.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'tpl/u-boot-x86-reset16-tpl.bin' return 'tpl/u-boot-x86-reset16-tpl.bin'

View File

@@ -25,7 +25,7 @@ class Entry_x86_start16(Entry_blob):
For 64-bit U-Boot, the 'x86_start16_spl' entry type is used instead. For 64-bit U-Boot, the 'x86_start16_spl' entry type is used instead.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'u-boot-x86-start16.bin' return 'u-boot-x86-start16.bin'

View File

@@ -25,7 +25,7 @@ class Entry_x86_start16_spl(Entry_blob):
For 32-bit U-Boot, the 'x86-start16' entry type is used instead. For 32-bit U-Boot, the 'x86-start16' entry type is used instead.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'spl/u-boot-x86-start16-spl.bin' return 'spl/u-boot-x86-start16-spl.bin'

View File

@@ -26,7 +26,7 @@ class Entry_x86_start16_tpl(Entry_blob):
may be used instead. may be used instead.
""" """
def __init__(self, section, etype, node): def __init__(self, section, etype, node):
Entry_blob.__init__(self, section, etype, node) super().__init__(section, etype, node)
def GetDefaultFilename(self): def GetDefaultFilename(self):
return 'tpl/u-boot-x86-start16-tpl.bin' return 'tpl/u-boot-x86-start16-tpl.bin'

View File

@@ -45,7 +45,7 @@ class Image(section.Entry_section):
we create a section manually. we create a section manually.
""" """
def __init__(self, name, node, copy_to_orig=True, test=False): def __init__(self, name, node, copy_to_orig=True, test=False):
section.Entry_section.__init__(self, None, 'section', node, test=test) super().__init__(None, 'section', node, test=test)
self.copy_to_orig = copy_to_orig self.copy_to_orig = copy_to_orig
self.name = 'main-section' self.name = 'main-section'
self.image_name = name self.image_name = name
@@ -57,7 +57,7 @@ class Image(section.Entry_section):
self.ReadNode() self.ReadNode()
def ReadNode(self): def ReadNode(self):
section.Entry_section.ReadNode(self) super().ReadNode()
filename = fdt_util.GetString(self._node, 'filename') filename = fdt_util.GetString(self._node, 'filename')
if filename: if filename:
self._filename = filename self._filename = filename
@@ -116,11 +116,11 @@ class Image(section.Entry_section):
def PackEntries(self): def PackEntries(self):
"""Pack all entries into the image""" """Pack all entries into the image"""
section.Entry_section.Pack(self, 0) super().Pack(0)
def SetImagePos(self): def SetImagePos(self):
# This first section in the image so it starts at 0 # This first section in the image so it starts at 0
section.Entry_section.SetImagePos(self, 0) super().SetImagePos(0)
def ProcessEntryContents(self): def ProcessEntryContents(self):
"""Call the ProcessContents() method for each entry """Call the ProcessContents() method for each entry
@@ -139,7 +139,7 @@ class Image(section.Entry_section):
def WriteSymbols(self): def WriteSymbols(self):
"""Write symbol values into binary files for access at run time""" """Write symbol values into binary files for access at run time"""
section.Entry_section.WriteSymbols(self, self) super().WriteSymbols(self)
def BuildImage(self): def BuildImage(self):
"""Write the image to a file""" """Write the image to a file"""
@@ -161,7 +161,7 @@ class Image(section.Entry_section):
with open(fname, 'w') as fd: with open(fname, 'w') as fd:
print('%8s %8s %8s %s' % ('ImagePos', 'Offset', 'Size', 'Name'), print('%8s %8s %8s %s' % ('ImagePos', 'Offset', 'Size', 'Name'),
file=fd) file=fd)
section.Entry_section.WriteMap(self, fd, 0) super().WriteMap(fd, 0)
return fname return fname
def BuildEntryList(self): def BuildEntryList(self):