mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-08-20 08:58:52 +09:00
![Simon Glass](/assets/img/avatar_default.png)
At present only the more complex entries are documented. It is useful to have documentation for all entries in one place. As a first step, add and expand the documentation to cover all entries. Signed-off-by: Simon Glass <sjg@chromium.org>
58 lines
1.7 KiB
Python
58 lines
1.7 KiB
Python
# SPDX-License-Identifier: GPL-2.0+
|
|
# Copyright (c) 2018 Google, Inc
|
|
# Written by Simon Glass <sjg@chromium.org>
|
|
#
|
|
|
|
from collections import OrderedDict
|
|
|
|
from entry import Entry, EntryArg
|
|
import fdt_util
|
|
|
|
|
|
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. 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
|
|
<xxx> (actual name is the value of text-label): contains the string to
|
|
place in the entry.
|
|
|
|
Example node:
|
|
|
|
text {
|
|
size = <50>;
|
|
text-label = "message";
|
|
};
|
|
|
|
You can then use:
|
|
|
|
binman -amessage="this is my message"
|
|
|
|
and binman will insert that string into the entry.
|
|
|
|
It is also possible to put the string directly in the node:
|
|
|
|
text {
|
|
size = <8>;
|
|
text-label = "message";
|
|
message = "a message 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)])
|
|
|
|
def ObtainContents(self):
|
|
self.SetContents(self.value)
|
|
return True
|