1
0
mirror of https://github.com/antonblanchard/microwatt.git synced 2026-01-11 23:43:15 +00:00
Benjamin Herrenschmidt a9178ed0c1 bin2hex: Make sure to generate little endian files
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2020-06-02 19:56:08 +10:00

18 lines
461 B
Python
Executable File

#!/usr/bin/python3
import sys
import subprocess
import struct
with open(sys.argv[1], "rb") as f:
while True:
word = f.read(8)
if len(word) == 8:
print("%016x" % struct.unpack('<Q', word));
elif len(word) == 4:
print("00000000%08x" % struct.unpack('<I', word));
elif len(word) == 0:
exit(0);
else:
raise Exception("Bad length")