From: Simon Glass Date: Fri, 1 Jun 2018 15:38:14 +0000 (-0600) Subject: binman: Rename Entry property to 'section' X-Git-Tag: v2018.07-rc2~75^2~8 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=25ac0e61fe5612d28cbc98654fb325d762f4411b;p=u-boot binman: Rename Entry property to 'section' Entries are now passed a Section object rather than an Image. Rename this property to avoid confusion. Signed-off-by: Simon Glass --- diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py index b166a71c4a..c376dd5c9c 100644 --- a/tools/binman/etype/_testing.py +++ b/tools/binman/etype/_testing.py @@ -10,8 +10,8 @@ import fdt_util import tools class Entry__testing(Entry): - def __init__(self, image, etype, node): - Entry.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry.__init__(self, section, etype, node) def ObtainContents(self): self.data = 'a' diff --git a/tools/binman/etype/blob.py b/tools/binman/etype/blob.py index 10e59e980d..16b1e5f64d 100644 --- a/tools/binman/etype/blob.py +++ b/tools/binman/etype/blob.py @@ -10,8 +10,8 @@ import fdt_util import tools class Entry_blob(Entry): - def __init__(self, image, etype, node): - Entry.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry.__init__(self, section, etype, node) self._filename = fdt_util.GetString(self._node, "filename", self.etype) def ObtainContents(self): diff --git a/tools/binman/etype/entry.py b/tools/binman/etype/entry.py index 39da7f8602..cbcabe2058 100644 --- a/tools/binman/etype/entry.py +++ b/tools/binman/etype/entry.py @@ -19,10 +19,10 @@ import tools modules = {} class Entry(object): - """An Entry in the image + """An Entry in the section An entry corresponds to a single node in the device-tree description - of the image. Each entry ends up being a part of the final image. + of the section. Each entry ends up being a part of the final section. Entries can be placed either right next to each other, or with padding between them. The type of the entry determines the data that is in it. @@ -30,9 +30,9 @@ class Entry(object): Entry. Attributes: - image: The image containing this entry + section: The section containing this entry node: The node that created this entry - pos: Absolute position of entry within the image, None if not known + pos: Absolute position of entry within the section, None if not known size: Entry size in bytes, None if not known contents_size: Size of contents in bytes, 0 by default align: Entry start position alignment, or None @@ -42,8 +42,8 @@ class Entry(object): pad_after: Number of pad bytes after the contents, 0 if none data: Contents of entry (string of bytes) """ - def __init__(self, image, etype, node, read_node=True): - self.image = image + def __init__(self, section, etype, node, read_node=True): + self.section = section self.etype = etype self._node = node self.pos = None @@ -59,11 +59,11 @@ class Entry(object): self.ReadNode() @staticmethod - def Create(image, node, etype=None): + def Create(section, node, etype=None): """Create a new entry for a node. Args: - image: Image object containing this node + section: Image object containing this node node: Node object containing information about the entry to create etype: Entry type to use, or None to work it out (used for tests) @@ -94,7 +94,7 @@ class Entry(object): # Call its constructor to get the object we want. obj = getattr(module, 'Entry_%s' % module_name) - return obj(image, etype, node) + return obj(section, etype, node) def ReadNode(self): """Read entry information from the node @@ -127,7 +127,7 @@ class Entry(object): return True def Pack(self, pos): - """Figure out how to pack the entry into the image + """Figure out how to pack the entry into the section Most of the time the entries are not fully specified. There may be an alignment but no size. In that case we take the size from the @@ -139,10 +139,10 @@ class Entry(object): entry will be know. Args: - Current image position pointer + Current section position pointer Returns: - New image position pointer (after this entry) + New section position pointer (after this entry) """ if self.pos is None: if self.pos_unset: diff --git a/tools/binman/etype/intel_cmc.py b/tools/binman/etype/intel_cmc.py index 07cad2eecc..b8621e0cc5 100644 --- a/tools/binman/etype/intel_cmc.py +++ b/tools/binman/etype/intel_cmc.py @@ -9,5 +9,5 @@ from entry import Entry from blob import Entry_blob class Entry_intel_cmc(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) diff --git a/tools/binman/etype/intel_descriptor.py b/tools/binman/etype/intel_descriptor.py index 4e0c85b92a..0e7865521e 100644 --- a/tools/binman/etype/intel_descriptor.py +++ b/tools/binman/etype/intel_descriptor.py @@ -32,8 +32,8 @@ class Entry_intel_descriptor(Entry_blob): size of the ME region, allowing us to place the ME binary in the right place. """ - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) self._regions = [] def GetPositions(self): diff --git a/tools/binman/etype/intel_fsp.py b/tools/binman/etype/intel_fsp.py index 827bd22ca0..cb80a617c3 100644 --- a/tools/binman/etype/intel_fsp.py +++ b/tools/binman/etype/intel_fsp.py @@ -9,5 +9,5 @@ from entry import Entry from blob import Entry_blob class Entry_intel_fsp(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) diff --git a/tools/binman/etype/intel_me.py b/tools/binman/etype/intel_me.py index e02e485987..0682ead943 100644 --- a/tools/binman/etype/intel_me.py +++ b/tools/binman/etype/intel_me.py @@ -9,5 +9,5 @@ from entry import Entry from blob import Entry_blob class Entry_intel_me(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) diff --git a/tools/binman/etype/intel_mrc.py b/tools/binman/etype/intel_mrc.py index 7c01b77a6f..305ac98888 100644 --- a/tools/binman/etype/intel_mrc.py +++ b/tools/binman/etype/intel_mrc.py @@ -9,8 +9,8 @@ from entry import Entry from blob import Entry_blob class Entry_intel_mrc(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) def GetDefaultFilename(self): return 'mrc.bin' diff --git a/tools/binman/etype/intel_vbt.py b/tools/binman/etype/intel_vbt.py index 4f082c3c2c..d4e8c3f797 100644 --- a/tools/binman/etype/intel_vbt.py +++ b/tools/binman/etype/intel_vbt.py @@ -8,5 +8,5 @@ from entry import Entry from blob import Entry_blob class Entry_intel_vbt(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) diff --git a/tools/binman/etype/intel_vga.py b/tools/binman/etype/intel_vga.py index 277fff15fd..140dd40dda 100644 --- a/tools/binman/etype/intel_vga.py +++ b/tools/binman/etype/intel_vga.py @@ -9,5 +9,5 @@ from entry import Entry from blob import Entry_blob class Entry_intel_vga(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) diff --git a/tools/binman/etype/u_boot.py b/tools/binman/etype/u_boot.py index fc212d0300..b6058bf6b5 100644 --- a/tools/binman/etype/u_boot.py +++ b/tools/binman/etype/u_boot.py @@ -9,8 +9,8 @@ from entry import Entry from blob import Entry_blob class Entry_u_boot(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) def GetDefaultFilename(self): return 'u-boot.bin' diff --git a/tools/binman/etype/u_boot_dtb.py b/tools/binman/etype/u_boot_dtb.py index f6704db742..dd3c5b2790 100644 --- a/tools/binman/etype/u_boot_dtb.py +++ b/tools/binman/etype/u_boot_dtb.py @@ -9,8 +9,8 @@ from entry import Entry from blob import Entry_blob class Entry_u_boot_dtb(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) def GetDefaultFilename(self): return 'u-boot.dtb' diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py index bedc39805d..1e530d6570 100644 --- a/tools/binman/etype/u_boot_dtb_with_ucode.py +++ b/tools/binman/etype/u_boot_dtb_with_ucode.py @@ -16,8 +16,8 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob): See Entry_u_boot_ucode for full details of the 3 entries involved in this process. """ - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) self.ucode_data = '' self.collate = False self.ucode_offset = None @@ -29,10 +29,12 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob): def ObtainContents(self): Entry_blob.ObtainContents(self) - # If the image does not need microcode, there is nothing to do - ucode_dest_entry = self.image.FindEntryType('u-boot-spl-with-ucode-ptr') + # If the section does not need microcode, there is nothing to do + ucode_dest_entry = self.section.FindEntryType( + 'u-boot-spl-with-ucode-ptr') if not ucode_dest_entry or not ucode_dest_entry.target_pos: - ucode_dest_entry = self.image.FindEntryType('u-boot-with-ucode-ptr') + ucode_dest_entry = self.section.FindEntryType( + 'u-boot-with-ucode-ptr') if not ucode_dest_entry or not ucode_dest_entry.target_pos: return True diff --git a/tools/binman/etype/u_boot_img.py b/tools/binman/etype/u_boot_img.py index d5f1eb3057..6e0b736af1 100644 --- a/tools/binman/etype/u_boot_img.py +++ b/tools/binman/etype/u_boot_img.py @@ -9,8 +9,8 @@ from entry import Entry from blob import Entry_blob class Entry_u_boot_img(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) def GetDefaultFilename(self): return 'u-boot.img' diff --git a/tools/binman/etype/u_boot_nodtb.py b/tools/binman/etype/u_boot_nodtb.py index 183b897bee..ca9e53a094 100644 --- a/tools/binman/etype/u_boot_nodtb.py +++ b/tools/binman/etype/u_boot_nodtb.py @@ -9,8 +9,8 @@ from entry import Entry from blob import Entry_blob class Entry_u_boot_nodtb(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) def GetDefaultFilename(self): return 'u-boot-nodtb.bin' diff --git a/tools/binman/etype/u_boot_spl.py b/tools/binman/etype/u_boot_spl.py index bfcdc499c2..9edd2dad03 100644 --- a/tools/binman/etype/u_boot_spl.py +++ b/tools/binman/etype/u_boot_spl.py @@ -11,8 +11,8 @@ from entry import Entry from blob import Entry_blob class Entry_u_boot_spl(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) self.elf_fname = 'spl/u-boot-spl' def GetDefaultFilename(self): diff --git a/tools/binman/etype/u_boot_spl_bss_pad.py b/tools/binman/etype/u_boot_spl_bss_pad.py index d14122b435..3d2dea2e0d 100644 --- a/tools/binman/etype/u_boot_spl_bss_pad.py +++ b/tools/binman/etype/u_boot_spl_bss_pad.py @@ -14,8 +14,8 @@ from blob import Entry_blob import tools class Entry_u_boot_spl_bss_pad(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) def ObtainContents(self): fname = tools.GetInputFilename('spl/u-boot-spl') diff --git a/tools/binman/etype/u_boot_spl_dtb.py b/tools/binman/etype/u_boot_spl_dtb.py index 43d23778ec..eefa1ff53a 100644 --- a/tools/binman/etype/u_boot_spl_dtb.py +++ b/tools/binman/etype/u_boot_spl_dtb.py @@ -9,8 +9,8 @@ from entry import Entry from blob import Entry_blob class Entry_u_boot_spl_dtb(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) def GetDefaultFilename(self): return 'spl/u-boot-spl.dtb' diff --git a/tools/binman/etype/u_boot_spl_nodtb.py b/tools/binman/etype/u_boot_spl_nodtb.py index 5b058b4c72..99e56ebe3b 100644 --- a/tools/binman/etype/u_boot_spl_nodtb.py +++ b/tools/binman/etype/u_boot_spl_nodtb.py @@ -9,8 +9,8 @@ from entry import Entry from blob import Entry_blob class Entry_u_boot_spl_nodtb(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) def GetDefaultFilename(self): return 'spl/u-boot-spl-nodtb.bin' diff --git a/tools/binman/etype/u_boot_spl_with_ucode_ptr.py b/tools/binman/etype/u_boot_spl_with_ucode_ptr.py index 1e3181a944..0dfe268a56 100644 --- a/tools/binman/etype/u_boot_spl_with_ucode_ptr.py +++ b/tools/binman/etype/u_boot_spl_with_ucode_ptr.py @@ -19,8 +19,8 @@ class Entry_u_boot_spl_with_ucode_ptr(Entry_u_boot_with_ucode_ptr): See Entry_u_boot_ucode for full details of the entries involved in this process. """ - def __init__(self, image, etype, node): - Entry_u_boot_with_ucode_ptr.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_u_boot_with_ucode_ptr.__init__(self, section, etype, node) self.elf_fname = 'spl/u-boot-spl' def GetDefaultFilename(self): diff --git a/tools/binman/etype/u_boot_ucode.py b/tools/binman/etype/u_boot_ucode.py index 10130a2811..3a0cff7c3a 100644 --- a/tools/binman/etype/u_boot_ucode.py +++ b/tools/binman/etype/u_boot_ucode.py @@ -51,13 +51,13 @@ class Entry_u_boot_ucode(Entry_blob): the Entry_u_boot_dtb_with_ucode entry, and uses it as the contents of this entry. """ - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) def ObtainContents(self): - # If the image does not need microcode, there is nothing to do - ucode_dest_entry = self.image.FindEntryType('u-boot-with-ucode-ptr') - ucode_dest_entry_spl = self.image.FindEntryType( + # If the section does not need microcode, there is nothing to do + ucode_dest_entry = self.section.FindEntryType('u-boot-with-ucode-ptr') + ucode_dest_entry_spl = self.section.FindEntryType( 'u-boot-spl-with-ucode-ptr') if ((not ucode_dest_entry or not ucode_dest_entry.target_pos) and (not ucode_dest_entry_spl or not ucode_dest_entry_spl.target_pos)): @@ -65,12 +65,12 @@ class Entry_u_boot_ucode(Entry_blob): return True # Get the microcode from the device tree entry - fdt_entry = self.image.FindEntryType('u-boot-dtb-with-ucode') + fdt_entry = self.section.FindEntryType('u-boot-dtb-with-ucode') if not fdt_entry or not fdt_entry.ucode_data: return False if not fdt_entry.collate: - # This section can be empty + # This binary can be empty self.data = '' return True diff --git a/tools/binman/etype/u_boot_with_ucode_ptr.py b/tools/binman/etype/u_boot_with_ucode_ptr.py index 04b9f7cf7f..41c2ded2fe 100644 --- a/tools/binman/etype/u_boot_with_ucode_ptr.py +++ b/tools/binman/etype/u_boot_with_ucode_ptr.py @@ -20,8 +20,8 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob): See Entry_u_boot_ucode for full details of the 3 entries involved in this process. """ - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) self.elf_fname = 'u-boot' self.target_pos = None @@ -45,24 +45,24 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob): return # Get the position of the microcode - ucode_entry = self.image.FindEntryType('u-boot-ucode') + ucode_entry = self.section.FindEntryType('u-boot-ucode') if not ucode_entry: self.Raise('Cannot find microcode region u-boot-ucode') - # Check the target pos is in the image. If it is not, then U-Boot is + # Check the target pos is in the section. If it is not, then U-Boot is # being linked incorrectly, or is being placed at the wrong position - # in the image. + # in the section. # - # The image must be set up so that U-Boot is placed at the + # The section must be set up so that U-Boot is placed at the # flash address to which it is linked. For example, if # CONFIG_SYS_TEXT_BASE is 0xfff00000, and the ROM is 8MB, then - # the U-Boot region must start at position 7MB in the image. In this + # the U-Boot region must start at position 7MB in the section. In this # case the ROM starts at 0xff800000, so the position of the first - # entry in the image corresponds to that. + # entry in the section corresponds to that. if (self.target_pos < self.pos or self.target_pos >= self.pos + self.size): self.Raise('Microcode pointer _dt_ucode_base_size at %08x is ' - 'outside the image ranging from %08x to %08x' % + 'outside the section ranging from %08x to %08x' % (self.target_pos, self.pos, self.pos + self.size)) # Get the microcode, either from u-boot-ucode or u-boot-dtb-with-ucode. @@ -72,7 +72,7 @@ class Entry_u_boot_with_ucode_ptr(Entry_blob): if ucode_entry.size: pos, size = ucode_entry.pos, ucode_entry.size else: - dtb_entry = self.image.FindEntryType('u-boot-dtb-with-ucode') + dtb_entry = self.section.FindEntryType('u-boot-dtb-with-ucode') if not dtb_entry: self.Raise('Cannot find microcode region u-boot-dtb-with-ucode') pos = dtb_entry.pos + dtb_entry.ucode_offset diff --git a/tools/binman/etype/x86_start16.py b/tools/binman/etype/x86_start16.py index 01e5b8bc38..23d27f0704 100644 --- a/tools/binman/etype/x86_start16.py +++ b/tools/binman/etype/x86_start16.py @@ -9,8 +9,8 @@ from entry import Entry from blob import Entry_blob class Entry_x86_start16(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) def GetDefaultFilename(self): return 'u-boot-x86-16bit.bin' diff --git a/tools/binman/etype/x86_start16_spl.py b/tools/binman/etype/x86_start16_spl.py index f0abbf038b..176420ba88 100644 --- a/tools/binman/etype/x86_start16_spl.py +++ b/tools/binman/etype/x86_start16_spl.py @@ -9,8 +9,8 @@ from entry import Entry from blob import Entry_blob class Entry_x86_start16_spl(Entry_blob): - def __init__(self, image, etype, node): - Entry_blob.__init__(self, image, etype, node) + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) def GetDefaultFilename(self): return 'spl/u-boot-x86-16bit-spl.bin' diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index 4a95a9c430..96a5535626 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -800,7 +800,7 @@ class TestFunctional(unittest.TestCase): self._DoReadFile('40_x86_ucode_not_in_image.dts', True) self.assertIn("Node '/binman/u-boot-with-ucode-ptr': Microcode " "pointer _dt_ucode_base_size at fffffe14 is outside the " - "image ranging from 00000000 to 0000002e", str(e.exception)) + "section ranging from 00000000 to 0000002e", str(e.exception)) def testWithoutMicrocode(self): """Test that we can cope with an image without microcode (e.g. qemu)"""