self._fdts = fdts.split()
self._fit_default_dt = self.GetEntryArgsOrProps([EntryArg('default-dt',
str)])[0]
+ self.mkimage = None
def ReadNode(self):
self.ReadEntries()
tools.WriteFile(input_fname, data)
tools.WriteFile(output_fname, data)
- args = []
+ args = {}
ext_offset = self._fit_props.get('fit,external-offset')
if ext_offset is not None:
- args += ['-E', '-p', '%x' % fdt_util.fdt32_to_cpu(ext_offset.value)]
- tools.Run('mkimage', '-t', '-F', output_fname, *args)
+ args = {
+ 'external': True,
+ 'pad': fdt_util.fdt32_to_cpu(ext_offset.value)
+ }
+ if self.mkimage.run(reset_timestamp=True, output_fname=output_fname,
+ **args) is not None:
+ self.SetContents(tools.ReadFile(output_fname))
+ else:
+ # Bintool is missing; just use empty data as the output
+ self.record_missing_bintool(self.mkimage)
+ self.SetContents(tools.GetBytes(0, 1024))
- self.SetContents(tools.ReadFile(output_fname))
return True
def _BuildInput(self, fdt):
def SetAllowMissing(self, allow_missing):
for section in self._fit_sections.values():
section.SetAllowMissing(allow_missing)
+
+ def AddBintools(self, tools):
+ self.mkimage = self.AddBintool(tools, 'mkimage')
input_fname = tools.GetOutputFilename('mkimage.%s' % uniq)
tools.WriteFile(input_fname, data)
output_fname = tools.GetOutputFilename('mkimage-out.%s' % uniq)
- tools.Run('mkimage', '-d', input_fname, *self._args, output_fname)
- self.SetContents(tools.ReadFile(output_fname))
+ if self.mkimage.run_cmd('-d', input_fname, *self._args,
+ output_fname) is not None:
+ self.SetContents(tools.ReadFile(output_fname))
+ else:
+ # Bintool is missing; just use the input data as the output
+ self.record_missing_bintool(self.mkimage)
+ self.SetContents(data)
+
return True
def ReadEntries(self):
"""
for entry in self._mkimage_entries.values():
entry.CheckFakedBlobs(faked_blobs_list)
+
+ def AddBintools(self, tools):
+ self.mkimage = self.AddBintool(tools, 'mkimage')