X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Fbinman%2Fetype%2Ftext.py;h=3577135adbe39ab17fc50df0a2d5c9bed1cbcdde;hb=04da42770b0cc3bea8841972bfc9568299ece826;hp=1c69afa72ef7b586ee4280df0217a4b365267510;hpb=bb74837c9a32e51187d843c2469f0176d674c5f9;p=platform%2Fkernel%2Fu-boot.git diff --git a/tools/binman/etype/text.py b/tools/binman/etype/text.py index 1c69afa..3577135 100644 --- a/tools/binman/etype/text.py +++ b/tools/binman/etype/text.py @@ -5,15 +5,25 @@ from collections import OrderedDict -from entry import Entry, EntryArg -import fdt_util +from binman.entry import Entry, EntryArg +from dtoc import fdt_util +from patman import tools class Entry_text(Entry): """An entry which contains text The text can be provided either in the node itself or by a command-line - argument. + argument. There is a level of indirection to allow multiple text strings + and sharing of text. + + Properties / Entry arguments: + text-label: The value of this string indicates the property / entry-arg + that contains the string to place in the entry + (actual name is the value of text-label): contains the string to + place in the entry. + : The text to place in the entry (overrides the above mechanism). + This is useful when the text is constant. Example node: @@ -36,15 +46,33 @@ class Entry_text(Entry): message = "a message directly in the node" }; + or just: + + text { + size = <8>; + text = "some text directly in the node" + }; + The text is not itself nul-terminated. This can be achieved, if required, by setting the size of the entry to something larger than the text. """ def __init__(self, section, etype, node): Entry.__init__(self, section, etype, node) - self.text_label, = self.GetEntryArgsOrProps( - [EntryArg('text-label', str)]) - self.value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)]) + value = fdt_util.GetString(self._node, 'text') + if value: + value = tools.ToBytes(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.ToBytes(value) if value is not None else value + self.value = value def ObtainContents(self): + if not self.value: + self.Raise("No value provided for text label '%s'" % + self.text_label) self.SetContents(self.value) return True