summaryrefslogtreecommitdiff
path: root/tools/binman/etype
diff options
context:
space:
mode:
authorSimon Glass <[email protected]>2019-05-17 22:00:46 -0600
committerSimon Glass <[email protected]>2019-07-10 16:52:58 -0600
commitc6c10e77fb48f3e55857e379be86384fbcdc19d5 (patch)
tree96e378365de845827a346236e1415d63a9b064ad /tools/binman/etype
parent58632a7f44cb0aef2c5cd4ede966c89abc430968 (diff)
binman: Convert to use bytes type
With Python 3 we want to use the 'bytes' type instead of 'str'. Adjust the code accordingly so that it works on both Python 2 and Python 3. Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'tools/binman/etype')
-rw-r--r--tools/binman/etype/_testing.py2
-rw-r--r--tools/binman/etype/u_boot_dtb_with_ucode.py4
-rw-r--r--tools/binman/etype/u_boot_ucode.py4
-rw-r--r--tools/binman/etype/vblock.py2
4 files changed, 6 insertions, 6 deletions
diff --git a/tools/binman/etype/_testing.py b/tools/binman/etype/_testing.py
index 3e345bd9526..ac62d2e2005 100644
--- a/tools/binman/etype/_testing.py
+++ b/tools/binman/etype/_testing.py
@@ -75,7 +75,7 @@ class Entry__testing(Entry):
def ObtainContents(self):
if self.return_unknown_contents or not self.return_contents:
return False
- self.data = 'a'
+ self.data = b'a'
self.contents_size = len(self.data)
if self.return_contents_once:
self.return_contents = False
diff --git a/tools/binman/etype/u_boot_dtb_with_ucode.py b/tools/binman/etype/u_boot_dtb_with_ucode.py
index 444c51b8b72..188888e022b 100644
--- a/tools/binman/etype/u_boot_dtb_with_ucode.py
+++ b/tools/binman/etype/u_boot_dtb_with_ucode.py
@@ -26,7 +26,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
"""
def __init__(self, section, etype, node):
Entry_blob_dtb.__init__(self, section, etype, node)
- self.ucode_data = ''
+ self.ucode_data = b''
self.collate = False
self.ucode_offset = None
self.ucode_size = None
@@ -65,7 +65,7 @@ class Entry_u_boot_dtb_with_ucode(Entry_blob_dtb):
for node in self.ucode.subnodes:
data_prop = node.props.get('data')
if data_prop:
- self.ucode_data += ''.join(data_prop.bytes)
+ self.ucode_data += data_prop.bytes
if self.collate:
node.DeleteProp('data')
return True
diff --git a/tools/binman/etype/u_boot_ucode.py b/tools/binman/etype/u_boot_ucode.py
index a00e530295b..dee8848db7a 100644
--- a/tools/binman/etype/u_boot_ucode.py
+++ b/tools/binman/etype/u_boot_ucode.py
@@ -69,7 +69,7 @@ class Entry_u_boot_ucode(Entry_blob):
if entry and entry.target_offset:
found = True
if not found:
- self.data = ''
+ self.data = b''
return True
# Get the microcode from the device tree entry. If it is not available
# yet, return False so we will be called later. If the section simply
@@ -87,7 +87,7 @@ class Entry_u_boot_ucode(Entry_blob):
if not fdt_entry.collate:
# This binary can be empty
- self.data = ''
+ self.data = b''
return True
# Write it out to a file
diff --git a/tools/binman/etype/vblock.py b/tools/binman/etype/vblock.py
index 334ff9f966a..91fa2f7808f 100644
--- a/tools/binman/etype/vblock.py
+++ b/tools/binman/etype/vblock.py
@@ -51,7 +51,7 @@ class Entry_vblock(Entry):
def ObtainContents(self):
# Join up the data files to be signed
- input_data = ''
+ input_data = b''
for entry_phandle in self.content:
data = self.section.GetContentsByPhandle(entry_phandle, self)
if data is None: