]> git.sur5r.net Git - u-boot/blobdiff - tools/dtoc/fdt_util.py
dtoc: Decode strings for struct.unpack on python 3.x
[u-boot] / tools / dtoc / fdt_util.py
index 3a108381099e613a81fdf62e2f4727b8fb034b31..e6d523b9de65699ec08ebf863b1e614699d16b9c 100644 (file)
@@ -8,6 +8,7 @@
 
 import os
 import struct
+import sys
 import tempfile
 
 import command
@@ -22,6 +23,8 @@ def fdt32_to_cpu(val):
     Return:
         A native-endian integer value
     """
+    if sys.version_info > (3, 0):
+        val = val.encode('raw_unicode_escape')
     return struct.unpack('>I', val)[0]
 
 def EnsureCompiled(fname):