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>
lime2-spi
Simon Glass 6 years ago
parent f55382b5e5
commit 25ac0e61fe
  1. 4
      tools/binman/etype/_testing.py
  2. 4
      tools/binman/etype/blob.py
  3. 24
      tools/binman/etype/entry.py
  4. 4
      tools/binman/etype/intel_cmc.py
  5. 4
      tools/binman/etype/intel_descriptor.py
  6. 4
      tools/binman/etype/intel_fsp.py
  7. 4
      tools/binman/etype/intel_me.py
  8. 4
      tools/binman/etype/intel_mrc.py
  9. 4
      tools/binman/etype/intel_vbt.py
  10. 4
      tools/binman/etype/intel_vga.py
  11. 4
      tools/binman/etype/u_boot.py
  12. 4
      tools/binman/etype/u_boot_dtb.py
  13. 12
      tools/binman/etype/u_boot_dtb_with_ucode.py
  14. 4
      tools/binman/etype/u_boot_img.py
  15. 4
      tools/binman/etype/u_boot_nodtb.py
  16. 4
      tools/binman/etype/u_boot_spl.py
  17. 4
      tools/binman/etype/u_boot_spl_bss_pad.py
  18. 4
      tools/binman/etype/u_boot_spl_dtb.py
  19. 4
      tools/binman/etype/u_boot_spl_nodtb.py
  20. 4
      tools/binman/etype/u_boot_spl_with_ucode_ptr.py
  21. 14
      tools/binman/etype/u_boot_ucode.py
  22. 20
      tools/binman/etype/u_boot_with_ucode_ptr.py
  23. 4
      tools/binman/etype/x86_start16.py
  24. 4
      tools/binman/etype/x86_start16_spl.py
  25. 2
      tools/binman/ftest.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'

@ -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):

@ -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:

@ -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)

@ -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):

@ -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)

@ -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)

@ -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'

@ -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)

@ -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)

@ -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'

@ -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'

@ -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

@ -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'

@ -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'

@ -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):

@ -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')

@ -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'

@ -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'

@ -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):

@ -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

@ -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

@ -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'

@ -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'

@ -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)"""

Loading…
Cancel
Save