scripts: gen_hashed_bin.py Python 3.x support

Signed-off-by: Joakim Bech <joakim.bech@linaro.org>
Reviewed-by: Jerome Forissier <jerome.forissier@linaro.org>
diff --git a/scripts/gen_hashed_bin.py b/scripts/gen_hashed_bin.py
index d4bce71..e39cc13 100755
--- a/scripts/gen_hashed_bin.py
+++ b/scripts/gen_hashed_bin.py
@@ -47,7 +47,7 @@
 def append_to(outf, start_offs, in_fname, max_bytes=0xffffffff):
 	#print "Appending %s@0x%x 0x%x bytes at position 0x%x" % \
 		#( in_fname, start_offs, max_bytes, int(outf.tell()) )
-	inf = open(in_fname, 'r');
+	inf = open(in_fname, 'rb');
 	inf.seek(start_offs)
 	while True :
 		nbytes = min(16 * 1024, max_bytes)
@@ -74,7 +74,7 @@
 		elif len(page) == 0 :
 			break
 		else :
-			print "Error: short read, got " + repr(len(page))
+			print("Error: short read, got " + repr(len(page)))
 			sys.exit(1)
 
 	inf.close()
@@ -117,7 +117,7 @@
 		help='The input tee_pageable.bin')
 
 	parser.add_argument('--out', \
-		required=True, type=argparse.FileType('w'), \
+		required=True, type=argparse.FileType('wb'), \
 		help='The output tee.bin')
 
 	return parser.parse_args();