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>
25 files changed:
import tools
class Entry__testing(Entry):
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'
def ObtainContents(self):
self.data = 'a'
import tools
class Entry_blob(Entry):
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):
self._filename = fdt_util.GetString(self._node, "filename", self.etype)
def ObtainContents(self):
modules = {}
class Entry(object):
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
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.
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.
- image: The image containing this entry
+ section: The section containing this entry
node: The node that created 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
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
pad_after: Number of pad bytes after the contents, 0 if none
data: Contents of entry (string of bytes)
"""
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
self.etype = etype
self._node = node
self.pos = None
self.ReadNode()
@staticmethod
self.ReadNode()
@staticmethod
- def Create(image, node, etype=None):
+ def Create(section, node, etype=None):
"""Create a new entry for a node.
Args:
"""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)
node: Node object containing information about the entry to create
etype: Entry type to use, or None to work it out (used for tests)
# Call its constructor to get the object we want.
obj = getattr(module, 'Entry_%s' % module_name)
# 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
def ReadNode(self):
"""Read entry information from the node
return True
def Pack(self, pos):
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
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
entry will be know.
Args:
entry will be know.
Args:
- Current image position pointer
+ Current section position pointer
- New image position pointer (after this entry)
+ New section position pointer (after this entry)
"""
if self.pos is None:
if self.pos_unset:
"""
if self.pos is None:
if self.pos_unset:
from blob import Entry_blob
class Entry_intel_cmc(Entry_blob):
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)
size of the ME region, allowing us to place the ME binary in the right
place.
"""
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):
self._regions = []
def GetPositions(self):
from blob import Entry_blob
class Entry_intel_fsp(Entry_blob):
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)
from blob import Entry_blob
class Entry_intel_me(Entry_blob):
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)
from blob import Entry_blob
class Entry_intel_mrc(Entry_blob):
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'
def GetDefaultFilename(self):
return 'mrc.bin'
from blob import Entry_blob
class Entry_intel_vbt(Entry_blob):
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)
from blob import Entry_blob
class Entry_intel_vga(Entry_blob):
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)
from blob import Entry_blob
class Entry_u_boot(Entry_blob):
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'
def GetDefaultFilename(self):
return 'u-boot.bin'
from blob import Entry_blob
class Entry_u_boot_dtb(Entry_blob):
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'
def GetDefaultFilename(self):
return 'u-boot.dtb'
See Entry_u_boot_ucode for full details of the 3 entries involved in this
process.
"""
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
self.ucode_data = ''
self.collate = False
self.ucode_offset = None
def ObtainContents(self):
Entry_blob.ObtainContents(self)
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:
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
if not ucode_dest_entry or not ucode_dest_entry.target_pos:
return True
from blob import Entry_blob
class Entry_u_boot_img(Entry_blob):
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'
def GetDefaultFilename(self):
return 'u-boot.img'
from blob import Entry_blob
class Entry_u_boot_nodtb(Entry_blob):
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'
def GetDefaultFilename(self):
return 'u-boot-nodtb.bin'
from blob import Entry_blob
class Entry_u_boot_spl(Entry_blob):
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):
self.elf_fname = 'spl/u-boot-spl'
def GetDefaultFilename(self):
import tools
class Entry_u_boot_spl_bss_pad(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')
def ObtainContents(self):
fname = tools.GetInputFilename('spl/u-boot-spl')
from blob import Entry_blob
class Entry_u_boot_spl_dtb(Entry_blob):
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'
def GetDefaultFilename(self):
return 'spl/u-boot-spl.dtb'
from blob import Entry_blob
class Entry_u_boot_spl_nodtb(Entry_blob):
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'
def GetDefaultFilename(self):
return 'spl/u-boot-spl-nodtb.bin'
See Entry_u_boot_ucode for full details of the entries involved in this
process.
"""
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):
self.elf_fname = 'spl/u-boot-spl'
def GetDefaultFilename(self):
the Entry_u_boot_dtb_with_ucode entry, and uses it as the
contents of this entry.
"""
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):
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)):
'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)):
return True
# Get the microcode from the device tree entry
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:
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
self.data = ''
return True
See Entry_u_boot_ucode for full details of the 3 entries involved in this
process.
"""
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
self.elf_fname = 'u-boot'
self.target_pos = None
return
# Get the position of the microcode
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')
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
# being linked incorrectly, or is being placed at the wrong position
- # 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
# 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
# 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 '
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.
(self.target_pos, self.pos, self.pos + self.size))
# Get the microcode, either from u-boot-ucode or u-boot-dtb-with-ucode.
if ucode_entry.size:
pos, size = ucode_entry.pos, ucode_entry.size
else:
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
if not dtb_entry:
self.Raise('Cannot find microcode region u-boot-dtb-with-ucode')
pos = dtb_entry.pos + dtb_entry.ucode_offset
from blob import Entry_blob
class Entry_x86_start16(Entry_blob):
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'
def GetDefaultFilename(self):
return 'u-boot-x86-16bit.bin'
from blob import Entry_blob
class Entry_x86_start16_spl(Entry_blob):
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'
def GetDefaultFilename(self):
return 'spl/u-boot-x86-16bit-spl.bin'
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 "
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)"""
def testWithoutMicrocode(self):
"""Test that we can cope with an image without microcode (e.g. qemu)"""