diff options
author | Simon Glass <sjg@chromium.org> | 2022-02-08 11:49:50 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2022-02-22 10:05:44 -0700 |
commit | bc116029c0ad25b2631629062a70a4d36157d43c (patch) | |
tree | a3b0077787d02615613999e33b8ed548f2266dd0 /tools/dtoc/fdt.py | |
parent | 38c04d8e065c42254dbaca760a9e6d200321c15b (diff) |
dtoc: Support adding a string list to a device tree
Add a new function to add a string list.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/fdt.py')
-rw-r--r-- | tools/dtoc/fdt.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index 7e13757a1be..026f7a273f9 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -501,6 +501,24 @@ class Node: val = bytes(val, 'utf-8') return self.AddData(prop_name, val + b'\0') + def AddStringList(self, prop_name, val): + """Add a new string-list property to a node + + The device tree is marked dirty so that the value will be written to + the blob on the next sync. + + Args: + prop_name: Name of property to add + val (list of str): List of strings to add + + Returns: + Prop added + """ + out = b'' + for string in val: + out += bytes(string, 'utf-8') + b'\0' + return self.AddData(prop_name, out) + def AddInt(self, prop_name, val): """Add a new integer property to a node |