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
22 text-label = "message";
27 binman -amessage="this is my message"
29 and binman will insert that string into the entry.
31 It is also possible to put the string directly in the node:
35 text-label = "message";
36 message = "a message directly in the node"
39 The text is not itself nul-terminated. This can be achieved, if required,
40 by setting the size of the entry to something larger than the text.
42 def __init__(self, section, etype, node):
43 Entry.__init__(self, section, etype, node)
44 self.text_label, = self.GetEntryArgsOrProps(
45 [EntryArg('text-label', str)])
46 self.value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)])
48 def ObtainContents(self):
49 self.SetContents(self.value)