X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Fbinman%2Fetype%2Fu_boot_dtb_with_ucode.py;h=aec145533eb5a0045d9091dacc1b229e04bc71be;hb=04da42770b0cc3bea8841972bfc9568299ece826;hp=285a28dd1e7437c5cf0ae574687b227a96124983;hpb=a30691a538b0894dfc0076150b8a3a7326b9e45a;p=platform%2Fkernel%2Fu-boot.git diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py index 285a28d..aec1455 100644 --- a/tools/binman/etype/u_boot_dtb_with_ucode.py +++ b/tools/binman/etype/u_boot_dtb_with_ucode.py @@ -5,12 +5,11 @@ # Entry-type module for U-Boot device tree with the microcode removed # -import control -from entry import Entry -from blob import Entry_blob -import tools +from binman.entry import Entry +from binman.etype.blob_dtb import Entry_blob_dtb +from patman import tools -class Entry_u_boot_dtb_with_ucode(Entry_blob): +class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb): """A U-Boot device tree file, with the microcode removed Properties / Entry arguments: @@ -25,8 +24,12 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob): it available to u_boot_ucode. """ def __init__(self, section, etype, node): - Entry_blob.__init__(self, section, etype, node) - self.ucode_data = '' + # Put this here to allow entry-docs and help to work without libfdt + global state + from binman import state + + Entry_blob_dtb.__init__(self, section, etype, node) + self.ucode_data = b'' self.collate = False self.ucode_offset = None self.ucode_size = None @@ -36,25 +39,31 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob): def GetDefaultFilename(self): return 'u-boot.dtb' + def GetFdtEtype(self): + return 'u-boot-dtb' + def ProcessFdt(self, fdt): # So the module can be loaded without it - import fdt + from dtoc import fdt # 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_offset: ucode_dest_entry = self.section.FindEntryType( + 'u-boot-tpl-with-ucode-ptr') + if not ucode_dest_entry or not ucode_dest_entry.target_offset: + ucode_dest_entry = self.section.FindEntryType( 'u-boot-with-ucode-ptr') if not ucode_dest_entry or not ucode_dest_entry.target_offset: return True # Remove the microcode - fname = self.GetDefaultFilename() - fdt = control.GetFdt(fname) + etype = self.GetFdtEtype() + fdt = state.GetFdtForEtype(etype) self.ucode = fdt.GetNode('/microcode') if not self.ucode: - raise self.Raise("No /microcode node found in '%s'" % fname) + raise self.Raise("No /microcode node found in '%s'" % etype) # There's no need to collate it (move all microcode into one place) # if we only have one chunk of microcode. @@ -62,22 +71,22 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob): for node in self.ucode.subnodes: data_prop = node.props.get('data') if data_prop: - self.ucode_data += ''.join(data_prop.bytes) + self.ucode_data += data_prop.bytes if self.collate: node.DeleteProp('data') return True 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: + Entry_blob_dtb.ObtainContents(self) + if self.ucode and not self.collate: for node in self.ucode.subnodes: data_prop = node.props.get('data') - if data_prop and not self.collate: + if data_prop: # 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 + self.ready = True + else: + self.ready = True + return self.ready