def __init__(self, section, etype, node): """ Members: _fit: FIT file being built _fit_sections: dict: key: relative path to entry Node (from the base of the FIT) value: Entry_section object comprising the contents of this node """ super().__init__(section, etype, node) self._fit = None self._fit_sections = {} self._fit_props = {} for pname, prop in self._node.props.items(): if pname.startswith('fit,'): self._fit_props[pname] = prop self._fdts = None self._fit_list_prop = self._fit_props.get('fit,fdt-list') if self._fit_list_prop: fdts, = self.GetEntryArgsOrProps( [EntryArg(self._fit_list_prop.value, str)]) if fdts is not None: self._fdts = fdts.split() self._fit_default_dt = self.GetEntryArgsOrProps( [EntryArg('default-dt', str)])[0]
def ReadNode(self): super().ReadNode() for pname, prop in self._node.props.items(): if pname.startswith('fit,'): self._fit_props[pname] = prop self._fit_list_prop = self._fit_props.get('fit,fdt-list') if self._fit_list_prop: fdts, = self.GetEntryArgsOrProps( [EntryArg(self._fit_list_prop.value, str)]) if fdts is not None: self._fdts = fdts.split() self._fit_default_dt = self.GetEntryArgsOrProps( [EntryArg('default-dt', str)])[0]
def __init__(self, section, etype, node): super().__init__(section, etype, node) value = fdt_util.GetString(self._node, 'text') if value: value = tools.to_bytes(value) else: label, = self.GetEntryArgsOrProps([EntryArg('text-label', str)]) self.text_label = label if self.text_label: value, = self.GetEntryArgsOrProps( [EntryArg(self.text_label, str)]) value = tools.to_bytes(value) if value is not None else value self.value = value
def __init__(self, section, etype, node): super().__init__(section, etype, node) self.hardware_id, self.keydir, self.bmpblk = self.GetEntryArgsOrProps( [EntryArg('hardware-id', str), EntryArg('keydir', str), EntryArg('bmpblk', str)]) # Read in the GBB flags from the config self.gbb_flags = 0 flags_node = node.FindNode('flags') if flags_node: for flag, value in gbb_flag_properties.items(): if fdt_util.GetBool(flags_node, flag): self.gbb_flags |= value
def __init__(self, section, etype, node): super().__init__(section, etype, node) (self.keydir, self.keyblock, self.signprivate, self.version, self.kernelkey, self.preamble_flags) = self.GetEntryArgsOrProps([ EntryArg('keydir', str), EntryArg('keyblock', str), EntryArg('signprivate', str), EntryArg('version', int), EntryArg('kernelkey', str), EntryArg('preamble-flags', int) ])
def ReadNode(self): super().ReadNode() self.return_invalid_entry = fdt_util.GetBool(self._node, 'return-invalid-entry') self.return_unknown_contents = fdt_util.GetBool( self._node, 'return-unknown-contents') self.bad_update_contents = fdt_util.GetBool(self._node, 'bad-update-contents') self.bad_shrink_contents = fdt_util.GetBool(self._node, 'bad-shrink-contents') self.return_contents_once = fdt_util.GetBool(self._node, 'return-contents-once') self.bad_update_contents_twice = fdt_util.GetBool( self._node, 'bad-update-contents-twice') self.return_contents_later = fdt_util.GetBool(self._node, 'return-contents-later') # Set to True when the entry is ready to process the FDT. self.process_fdt_ready = False self.never_complete_process_fdt = fdt_util.GetBool( self._node, 'never-complete-process-fdt') self.require_args = fdt_util.GetBool(self._node, 'require-args') # This should be picked up by GetEntryArgsOrProps() self.test_existing_prop = 'existing' self.force_bad_datatype = fdt_util.GetBool(self._node, 'force-bad-datatype') (self.test_str_fdt, self.test_str_arg, self.test_int_fdt, self.test_int_arg, existing) = self.GetEntryArgsOrProps([ EntryArg('test-str-fdt', str), EntryArg('test-str-arg', str), EntryArg('test-int-fdt', int), EntryArg('test-int-arg', int), EntryArg('test-existing-prop', str) ], self.require_args) if self.force_bad_datatype: self.GetEntryArgsOrProps([EntryArg('test-bad-datatype-arg', bool)]) self.return_contents = True self.contents = b'aa' # Set to the required bintool when collecting bintools. self.bintool_for_contents = None self.require_bintool_for_contents = fdt_util.GetString( self._node, 'require-bintool-for-contents') if self.require_bintool_for_contents == '': self.require_bintool_for_contents = '_testing' self.bintool_for_pack = None self.require_bintool_for_pack = fdt_util.GetString( self._node, 'require-bintool-for-pack') if self.require_bintool_for_pack == '': self.require_bintool_for_pack = '_testing'
def __init__(self, section, etype, node): super().__init__(section, etype, node) self.content = fdt_util.GetPhandleList(self._node, 'content') if not self.content: self.Raise("Vblock must have a 'content' property") (self.keydir, self.keyblock, self.signprivate, self.version, self.kernelkey, self.preamble_flags) = self.GetEntryArgsOrProps([ EntryArg('keydir', str), EntryArg('keyblock', str), EntryArg('signprivate', str), EntryArg('version', int), EntryArg('kernelkey', str), EntryArg('preamble-flags', int)])
def __init__(self, section, etype, node, blob_fname, required=False): super().__init__(section, etype, node) filename, = self.GetEntryArgsOrProps( [EntryArg('%s-path' % blob_fname, str)], required=required) if filename: self._filename = filename
def ReadNode(self): super().ReadNode() self.key_path, = self.GetEntryArgsOrProps( [EntryArg('pre-load-key-path', str)]) if self.key_path is None: self.key_path = ''
def __init__(self, section, etype, node, blob_fname): super().__init__(section, etype, node) self._filename, = self.GetEntryArgsOrProps( [EntryArg('%s-path' % blob_fname, str)])