summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-07-06 19:36:39 +0300
committerSimon Glass <sjg@chromium.org>2021-07-21 19:27:35 +0300
commit43332d881baa2d66a18e80ec636e0e0da5623c46 (patch)
tree418394e7489b1ab383e4acb344a18df979009be1 /tools
parentedd4b6ea41075b34619e774dba3d232b12c1ea53 (diff)
downloadu-boot-43332d881baa2d66a18e80ec636e0e0da5623c46.tar.xz
binman: Use bytearray instead of string
This is faster if data is being concatenated. Update the section and collection etypes. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/binman/etype/collection.py2
-rw-r--r--tools/binman/etype/section.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/tools/binman/etype/collection.py b/tools/binman/etype/collection.py
index 1625575fe9..442b40b48b 100644
--- a/tools/binman/etype/collection.py
+++ b/tools/binman/etype/collection.py
@@ -40,7 +40,7 @@ class Entry_collection(Entry):
"""
# Join up all the data
self.Info('Getting contents, required=%s' % required)
- data = b''
+ data = bytearray()
for entry_phandle in self.content:
entry_data = self.section.GetContentsByPhandle(entry_phandle, self,
required)
diff --git a/tools/binman/etype/section.py b/tools/binman/etype/section.py
index 92d3f3add4..e2949fc916 100644
--- a/tools/binman/etype/section.py
+++ b/tools/binman/etype/section.py
@@ -166,7 +166,7 @@ class Entry_section(Entry):
pad_byte = (entry._pad_byte if isinstance(entry, Entry_section)
else self._pad_byte)
- data = b''
+ data = bytearray()
# Handle padding before the entry
if entry.pad_before:
data += tools.GetBytes(self._pad_byte, entry.pad_before)
@@ -200,7 +200,7 @@ class Entry_section(Entry):
Returns:
Contents of the section (bytes)
"""
- section_data = b''
+ section_data = bytearray()
for entry in self._entries.values():
entry_data = entry.GetData(required)