1 # SPDX-License-Identifier: GPL-2.0+
2 # Copyright (c) 2018 Google, Inc
3 # Written by Simon Glass <sjg@chromium.org>
6 from collections import OrderedDict
8 from entry import Entry, EntryArg
12 class Entry_text(Entry):
13 """An entry which contains text
15 The text can be provided either in the node itself or by a command-line
16 argument. There is a level of indirection to allow multiple text strings
19 Properties / Entry arguments:
20 text-label: The value of this string indicates the property / entry-arg
21 that contains the string to place in the entry
22 <xxx> (actual name is the value of text-label): contains the string to
29 text-label = "message";
34 binman -amessage="this is my message"
36 and binman will insert that string into the entry.
38 It is also possible to put the string directly in the node:
42 text-label = "message";
43 message = "a message directly in the node"
46 The text is not itself nul-terminated. This can be achieved, if required,
47 by setting the size of the entry to something larger than the text.
49 def __init__(self, section, etype, node):
50 Entry.__init__(self, section, etype, node)
51 self.text_label, = self.GetEntryArgsOrProps(
52 [EntryArg('text-label', str)])
53 self.value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)])
55 def ObtainContents(self):
56 self.SetContents(self.value)