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 <sjg@chromium.org>
diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py
index b166a71..c376dd5 100644
--- a/tools/binman/etype/_testing.py
+++ b/tools/binman/etype/_testing.py
@@ -10,8 +10,8 @@
 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 10e59e9..16b1e5f 100644
--- a/tools/binman/etype/blob.py
+++ b/tools/binman/etype/blob.py
@@ -10,8 +10,8 @@
 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 39da7f8..cbcabe2 100644
--- a/tools/binman/etype/entry.py
+++ b/tools/binman/etype/entry.py
@@ -19,10 +19,10 @@
 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 @@
     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 @@
         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 @@
             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 @@
 
         # 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 @@
         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 @@
         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 07cad2e..b8621e0 100644
--- a/tools/binman/etype/intel_cmc.py
+++ b/tools/binman/etype/intel_cmc.py
@@ -9,5 +9,5 @@
 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 4e0c85b..0e78655 100644
--- a/tools/binman/etype/intel_descriptor.py
+++ b/tools/binman/etype/intel_descriptor.py
@@ -32,8 +32,8 @@
     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 827bd22..cb80a61 100644
--- a/tools/binman/etype/intel_fsp.py
+++ b/tools/binman/etype/intel_fsp.py
@@ -9,5 +9,5 @@
 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 e02e485..0682ead 100644
--- a/tools/binman/etype/intel_me.py
+++ b/tools/binman/etype/intel_me.py
@@ -9,5 +9,5 @@
 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 7c01b77..305ac98 100644
--- a/tools/binman/etype/intel_mrc.py
+++ b/tools/binman/etype/intel_mrc.py
@@ -9,8 +9,8 @@
 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 4f082c3..d4e8c3f 100644
--- a/tools/binman/etype/intel_vbt.py
+++ b/tools/binman/etype/intel_vbt.py
@@ -8,5 +8,5 @@
 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 277fff1..140dd40 100644
--- a/tools/binman/etype/intel_vga.py
+++ b/tools/binman/etype/intel_vga.py
@@ -9,5 +9,5 @@
 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 fc212d0..b6058bf 100644
--- a/tools/binman/etype/u_boot.py
+++ b/tools/binman/etype/u_boot.py
@@ -9,8 +9,8 @@
 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 f6704db..dd3c5b2 100644
--- a/tools/binman/etype/u_boot_dtb.py
+++ b/tools/binman/etype/u_boot_dtb.py
@@ -9,8 +9,8 @@
 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 bedc398..1e530d6 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 @@
     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 @@
     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 d5f1eb3..6e0b736 100644
--- a/tools/binman/etype/u_boot_img.py
+++ b/tools/binman/etype/u_boot_img.py
@@ -9,8 +9,8 @@
 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 183b897..ca9e53a 100644
--- a/tools/binman/etype/u_boot_nodtb.py
+++ b/tools/binman/etype/u_boot_nodtb.py
@@ -9,8 +9,8 @@
 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 bfcdc49..9edd2da 100644
--- a/tools/binman/etype/u_boot_spl.py
+++ b/tools/binman/etype/u_boot_spl.py
@@ -11,8 +11,8 @@
 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 d14122b..3d2dea2 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 @@
 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 43d2377..eefa1ff 100644
--- a/tools/binman/etype/u_boot_spl_dtb.py
+++ b/tools/binman/etype/u_boot_spl_dtb.py
@@ -9,8 +9,8 @@
 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 5b058b4..99e56eb 100644
--- a/tools/binman/etype/u_boot_spl_nodtb.py
+++ b/tools/binman/etype/u_boot_spl_nodtb.py
@@ -9,8 +9,8 @@
 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 1e3181a..0dfe268 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 @@
     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 10130a2..3a0cff7 100644
--- a/tools/binman/etype/u_boot_ucode.py
+++ b/tools/binman/etype/u_boot_ucode.py
@@ -51,13 +51,13 @@
             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 @@
             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 04b9f7c..41c2ded 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 @@
     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 @@
             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 @@
         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 01e5b8b..23d27f0 100644
--- a/tools/binman/etype/x86_start16.py
+++ b/tools/binman/etype/x86_start16.py
@@ -9,8 +9,8 @@
 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 f0abbf0..176420b 100644
--- a/tools/binman/etype/x86_start16_spl.py
+++ b/tools/binman/etype/x86_start16_spl.py
@@ -9,8 +9,8 @@
 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 4a95a9c..96a5535 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -800,7 +800,7 @@
             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)"""