예제 #1
0
 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_size = None
     self.ucode = None
     self.ready = False
예제 #2
0
    def WriteData(self, data, decomp=True):
        ok = Entry_blob.WriteData(self, data, decomp)

        # Update the state module, since it has the authoritative record of the
        # device trees used. If we don't do this, then state.GetFdtContents()
        # will still return the old contents
        state.UpdateFdtContents(self.GetFdtEtype(), data)
        return ok
예제 #3
0
 def ReadBlobContents(self):
     if self._strip:
         uniq = self.GetUniqueName()
         out_fname = tools.GetOutputFilename('%s.stripped' % uniq)
         tools.WriteFile(out_fname, tools.ReadFile(self._pathname))
         tools.Run('strip', out_fname)
         self._pathname = out_fname
     Entry_blob.ReadBlobContents(self)
     return True
    def ObtainContents(self):
        # Figure out where to put the microcode pointer
        fname = tools.GetInputFilename(self.elf_fname)
        sym = elf.GetSymbolAddress(fname, '_dt_ucode_base_size')
        if sym:
            self.target_pos = sym
        elif not fdt_util.GetBool(self._node, 'optional-ucode'):
            self.Raise('Cannot locate _dt_ucode_base_size symbol in u-boot')

        return Entry_blob.ObtainContents(self)
    def ObtainContents(self):
        # Figure out where to put the microcode pointer
        fname = tools.GetInputFilename(self.elf_fname)
        args = [['nm', fname], ['grep', '-w', '_dt_ucode_base_size']]
        out = (command.RunPipe(args, capture=True,
                               raise_on_error=False).stdout.splitlines())
        if len(out) == 1:
            self.target_pos = int(out[0].split()[0], 16)
        elif not fdt_util.GetBool(self._node, 'optional-ucode'):
            self.Raise('Cannot locate _dt_ucode_base_size symbol in u-boot')

        return 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 not ucode_dest_entry or not ucode_dest_entry.target_pos:
            ucode_dest_entry = self.image.FindEntryType(
                'u-boot-with-ucode-ptr')
        if not ucode_dest_entry or not ucode_dest_entry.target_pos:
            return True

        # Create a new file to hold the copied device tree
        dtb_name = 'u-boot-dtb-with-ucode.dtb'
        fname = tools.GetOutputFilename(dtb_name)
        with open(fname, 'wb') as fd:
            fd.write(self.data)

        # Remove the microcode
        fdt = fdt_select.FdtScan(fname)
        fdt.Scan()
        ucode = fdt.GetNode('/microcode')
        if not ucode:
            raise self.Raise("No /microcode node found in '%s'" % fname)

        # There's no need to collate it (move all microcode into one place)
        # if we only have one chunk of microcode.
        self.collate = len(ucode.subnodes) > 1
        for node in ucode.subnodes:
            data_prop = node.props.get('data')
            if data_prop:
                self.ucode_data += ''.join(data_prop.bytes)
                if not self.collate:
                    poffset = data_prop.GetOffset()
                    if poffset is None:
                        # We cannot obtain a property offset. Collate instead.
                        self.collate = True
                    else:
                        # Find the offset in the device tree of the ucode data
                        self.ucode_offset = poffset + 12
                        self.ucode_size = len(data_prop.bytes)
                if self.collate:
                    prop = node.DeleteProp('data')
        if self.collate:
            fdt.Pack()
            fdt.Flush()

            # Make this file the contents of this entry
            self._pathname = fname
            self.ReadContents()
        return True
예제 #7
0
 def ObtainContents(self):
     # Call the base class just in case it does something important.
     Entry_blob.ObtainContents(self)
     self._pathname = control.GetFdtPath(self._filename)
     self.ReadBlobContents()
     if self.ucode:
         for node in self.ucode.subnodes:
             data_prop = node.props.get('data')
             if data_prop and not self.collate:
                 # Find the offset in the device tree of the ucode data
                 self.ucode_offset = data_prop.GetOffset() + 12
                 self.ucode_size = len(data_prop.bytes)
     self.ready = True
     return True
예제 #8
0
 def __init__(self, section, etype, node):
     Entry_blob.__init__(self, section, etype, node)
     self.elf_fname = 'tpl/u-boot-tpl'
예제 #9
0
 def __init__(self, section, etype, node):
     Entry_blob.__init__(self, section, etype, node)
     self._regions = []
예제 #10
0
 def __init__(self, section, etype, node):
     Entry_blob.__init__(self, section, etype, node)
     self._regions = []
 def __init__(self, image, etype, node):
     Entry_blob.__init__(self, image, etype, node)
     self.elf_fname = 'u-boot'
     self.target_pos = None
예제 #12
0
 def __init__(self, image, etype, node):
     Entry_blob.__init__(self, image, etype, node)
예제 #13
0
 def ObtainContents(self):
     """Get the device-tree from the list held by the 'state' module"""
     self._filename = self.GetDefaultFilename()
     self._pathname, _ = state.GetFdtContents(self.GetFdtEtype())
     return Entry_blob.ReadBlobContents(self)
예제 #14
0
 def __init__(self, section, etype, node, blob_fname):
     Entry_blob.__init__(self, section, etype, node)
     self._filename, = self.GetEntryArgsOrProps(
         [EntryArg('%s-path' % blob_fname, str)])
예제 #15
0
 def ReadNode(self):
     self._ReadSubnodes()
     Entry_blob.ReadNode(self)
예제 #16
0
 def __init__(self, section, etype, node):
     Entry_blob.__init__(self, section, etype, node)
     self._convert_fit = fdt_util.GetBool(self._node, 'convert-fit')
     self._ifwi_entries = OrderedDict()
예제 #17
0
    def __init__(self, section, etype, node):
        # Put this here to allow entry-docs and help to work without libfdt
        global state
        import state

        Entry_blob.__init__(self, section, etype, node)
예제 #18
0
 def __init__(self, section, etype, node):
     Entry_blob.__init__(self, section, etype, node)
     self._strip = fdt_util.GetBool(self._node, 'strip')
예제 #19
0
 def __init__(self, section, etype, node):
     Entry_blob.__init__(self, section, etype, node)
     self.elf_fname = 'u-boot'
     self.target_offset = None
예제 #20
0
 def __init__(self, section, etype, node):
     Entry_blob.__init__(self, section, etype, node)
     if self.HasSibling('intel-fit') is False:
         self.Raise(
             "'intel-fit-ptr' section must have an 'intel-fit' sibling")
예제 #21
0
 def __init__(self, image, etype, node):
     Entry_blob.__init__(self, image, etype, node)
     self._regions = []
예제 #22
0
 def __init__(self, section, etype, node):
     Entry_blob.__init__(self, section, etype, node)
예제 #23
0
 def Pack(self, offset):
     """Put this entry at the start of the image"""
     if self.offset is None:
         offset = self.section.GetStartOffset()
     return Entry_blob.Pack(self, offset)
예제 #24
0
 def __init__(self, section, etype, node):
     Entry_blob.__init__(self, section, etype, node)
     self.elf_fname = 'u-boot'
     self.target_offset = None
예제 #25
0
 def __init__(self, image, etype, node):
     Entry_blob.__init__(self, image, etype, node)
     self.elf_fname = 'u-boot'
     self.target_pos = None
 def __init__(self, image, etype, node):
     Entry_blob.__init__(self, image, etype, node)
     self.elf_fname = 'spl/u-boot-spl'
예제 #27
0
 def Pack(self, offset):
     """Special pack method to set the offset to the right place"""
     return Entry_blob.Pack(self, 0xffffffc0)
 def __init__(self, image, etype, node):
     Entry_blob.__init__(self, image, etype, node)
     self.ucode_data = ''
     self.collate = False
     self.ucode_offset = None
     self.ucode_size = None
예제 #29
0
 def __init__(self, image, etype, node):
     Entry_blob.__init__(self, image, etype, node)
     self.ucode_data = ''
     self.collate = False
     self.ucode_offset = None
     self.ucode_size = None
예제 #30
0
 def __init__(self, image, etype, node):
     Entry_blob.__init__(self, image, etype, node)
     self._regions = []
예제 #31
0
 def __init__(self, section, etype, node):
     Entry_blob.__init__(self, section, etype, node)
예제 #32
0
 def __init__(self, section, etype, node):
     Entry_blob.__init__(self, section, etype, node)
     self.elf_fname = 'spl/u-boot-spl'
예제 #33
0
 def __init__(self, image, etype, node):
     Entry_blob.__init__(self, image, etype, node)
예제 #34
0
 def __init__(self, section, etype, node):
     Entry_blob.__init__(self, section, etype, node)
     self._regions = []
     if self.offset is None:
         self.offset = self.section.GetStartOffset()