Index: contrib/arch/hadlbppp.py
===================================================================
--- contrib/arch/hadlbppp.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ contrib/arch/hadlbppp.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -42,12 +42,12 @@
 	"Print usage syntax"
 	
-	print "%s <--bp|--ebp|--adl|--dot|--nop>+ <OUTPUT>" % prname
-	print
-	print "--bp   Dump original Behavior Protocols (dChecker, BPSlicer)"
-	print "--ebp  Dump Extended Behavior Protocols (bp2promela)"
-	print "--adl  Dump Architecture Description Language (modified SOFA ADL/CDL)"
-	print "--dot  Dump Dot architecture diagram (GraphViz)"
-	print "--nop  Do not dump anything (just input files syntax check)"
-	print
+	print("%s <--bp|--ebp|--adl|--dot|--nop>+ <OUTPUT>" % prname)
+	print()
+	print("--bp   Dump original Behavior Protocols (dChecker, BPSlicer)")
+	print("--ebp  Dump Extended Behavior Protocols (bp2promela)")
+	print("--adl  Dump Architecture Description Language (modified SOFA ADL/CDL)")
+	print("--dot  Dump Dot architecture diagram (GraphViz)")
+	print("--nop  Do not dump anything (just input files syntax check)")
+	print()
 
 def tabs(cnt):
@@ -163,7 +163,7 @@
 						result.append(tokens[i])
 				else:
-					print "%s: Syntax error in tentative statement" % name
+					print("%s: Syntax error in tentative statement" % name)
 			else:
-				print "%s: Expected '{' for tentative statement" % name
+				print("%s: Expected '{' for tentative statement" % name)
 		else:
 			result.append(tokens[i])
@@ -231,11 +231,11 @@
 								result.append(tokens[i])
 						else:
-							print "%s: Syntax error in alternative statement" % name
+							print("%s: Syntax error in alternative statement" % name)
 					else:
-						print "%s: Expected '{' for alternative statement body" % name
+						print("%s: Expected '{' for alternative statement body" % name)
 				else:
-					print "%s: At least one pattern and one replacement required for alternative statement" % name
+					print("%s: At least one pattern and one replacement required for alternative statement" % name)
 			else:
-				print "%s: Expected '(' for alternative statement head" % name
+				print("%s: Expected '(' for alternative statement head" % name)
 		else:
 			result.append(tokens[i])
@@ -269,5 +269,5 @@
 					result.append(tokens[i])
 			else:
-				print "%s: Unexpected end of protocol" % name
+				print("%s: Unexpected end of protocol" % name)
 		
 		i += 1
@@ -349,5 +349,5 @@
 		elif (token == ")"):
 			if (indent < base_indent):
-				print "%s: Too many parentheses" % name
+				print("%s: Too many parentheses" % name)
 			
 			indent -= 1
@@ -358,5 +358,5 @@
 		elif (token == "}"):
 			if (indent < base_indent):
-				print "%s: Too many parentheses" % name
+				print("%s: Too many parentheses" % name)
 			
 			indent -= 1
@@ -370,5 +370,5 @@
 	
 	if (indent > base_indent):
-		print "%s: Missing parentheses" % name
+		print("%s: Missing parentheses" % name)
 	
 	output = output.strip()
@@ -405,5 +405,5 @@
 			result.extend(inherited_protocols(supiface))
 		else:
-			print "%s: Extends unknown interface '%s'" % (iface['name'], iface['extends'])
+			print("%s: Extends unknown interface '%s'" % (iface['name'], iface['extends']))
 	
 	return result
@@ -459,13 +459,13 @@
 						protocols.append(proto)
 			else:
-				print "%s: Provided interface '%s' is undefined" % (frame['name'], provides['iface'])
+				print("%s: Provided interface '%s' is undefined" % (frame['name'], provides['iface']))
 	
 	if (opt_bp):
-		outf = file(outname, "w")
+		outf = open(outname, "w")
 		outf.write(parse_bp(outname, merge_bp(initialization, finalization, protocols), 0))
 		outf.close()
 	
 	if (opt_ebp):
-		outf = file(outname, "w")
+		outf = open(outname, "w")
 		outf.write(parse_ebp(frame['name'], outname, merge_bp(initialization, finalization, protocols), 0))
 		outf.close()
@@ -514,10 +514,10 @@
 	
 	if (opt_bp):
-		outf = file(outname, "w")
+		outf = open(outname, "w")
 		outf.write("NULL")
 		outf.close()
 	
 	if (opt_ebp):
-		outf = file(outname, "w")
+		outf = open(outname, "w")
 		outf.write("component null {\n\tbehavior {\n\t\tNULL\n\t}\n}")
 		outf.close()
@@ -587,5 +587,5 @@
 					insts.append({'var': "%s_%s" % (prefix, inst['var']), 'frame': subframe})
 				else:
-					print "%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type'])
+					print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']))
 	
 	if ('bind' in arch):
@@ -612,5 +612,5 @@
 	
 	if (arch is None):
-		print "Unable to find system architecture"
+		print("Unable to find system architecture")
 		return
 	
@@ -634,5 +634,5 @@
 					insts.append({'var': inst['var'], 'frame': subframe})
 				else:
-					print "%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type'])
+					print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']))
 	
 	if ('bind' in arch):
@@ -642,10 +642,10 @@
 	if ('delegate' in arch):
 		for delegate in arch['delegate']:
-			print "Unable to delegate interface in system architecture"
+			print("Unable to delegate interface in system architecture")
 			break
 	
 	if ('subsume' in arch):
 		for subsume in arch['subsume']:
-			print "Unable to subsume interface in system architecture"
+			print("Unable to subsume interface in system architecture")
 			break
 	
@@ -654,5 +654,5 @@
 	outname = os.path.join(outdir, "%s.archbp" % arch['name'])
 	if ((opt_bp) or (opt_ebp)):
-		outf = file(outname, "w")
+		outf = open(outname, "w")
 	else:
 		outf = None
@@ -709,5 +709,5 @@
 		
 		if (not os.path.isfile(path)):
-			print "%s: Unable to include file %s" % (inname, path)
+			print("%s: Unable to include file %s" % (inname, path))
 			return ""
 	else:
@@ -716,5 +716,5 @@
 		nested_root = root
 	
-	inf = file(path, "r")
+	inf = open(path, "r")
 	
 	raw = preproc_adl(inf.read(), inarg)
@@ -733,5 +733,5 @@
 		if (POST_INC in context):
 			if (token != "]"):
-				print "%s: Expected ]" % inname
+				print("%s: Expected ]" % inname)
 			
 			context.remove(POST_INC)
@@ -774,5 +774,5 @@
 			if (NULL in context):
 				if (token != ";"):
-					print "%s: Expected ';' in frame '%s'" % (inname, frame)
+					print("%s: Expected ';' in frame '%s'" % (inname, frame))
 				else:
 					output += "%s\n" % token
@@ -798,5 +798,5 @@
 						
 						if ('finalization' in frame_properties[frame]):
-							print "%s: Finalization protocol for frame '%s' already defined" % (inname, frame)
+							print("%s: Finalization protocol for frame '%s' already defined" % (inname, frame))
 						else:
 							frame_properties[frame]['finalization'] = bp
@@ -832,5 +832,5 @@
 						
 						if ('initialization' in frame_properties[frame]):
-							print "%s: Initialization protocol for frame '%s' already defined" % (inname, frame)
+							print("%s: Initialization protocol for frame '%s' already defined" % (inname, frame))
 						else:
 							frame_properties[frame]['initialization'] = bp
@@ -866,5 +866,5 @@
 						
 						if ('protocol' in frame_properties[frame]):
-							print "%s: Protocol for frame '%s' already defined" % (inname, frame)
+							print("%s: Protocol for frame '%s' already defined" % (inname, frame))
 						else:
 							frame_properties[frame]['protocol'] = bp
@@ -889,5 +889,5 @@
 					if (FIN in context):
 						if (token != ";"):
-							print "%s: Expected ';' in frame '%s'" % (inname, frame)
+							print("%s: Expected ';' in frame '%s'" % (inname, frame))
 						else:
 							output += "%s" % token
@@ -898,5 +898,5 @@
 					if (VAR in context):
 						if (not identifier(token)):
-							print "%s: Variable name expected in frame '%s'" % (inname, frame)
+							print("%s: Variable name expected in frame '%s'" % (inname, frame))
 						else:
 							if (not frame in frame_properties):
@@ -919,5 +919,5 @@
 					else:
 						if (not identifier(token)):
-							print "%s: Interface name expected in frame '%s'" % (inname, frame)
+							print("%s: Interface name expected in frame '%s'" % (inname, frame))
 						else:
 							arg0 = token
@@ -930,5 +930,5 @@
 					if (FIN in context):
 						if (token != ";"):
-							print "%s: Expected ';' in frame '%s'" % (inname, frame)
+							print("%s: Expected ';' in frame '%s'" % (inname, frame))
 						else:
 							output += "%s" % token
@@ -939,5 +939,5 @@
 					if (VAR in context):
 						if (not identifier(token)):
-							print "%s: Variable name expected in frame '%s'" % (inname, frame)
+							print("%s: Variable name expected in frame '%s'" % (inname, frame))
 						else:
 							if (not frame in frame_properties):
@@ -960,5 +960,5 @@
 					else:
 						if (not identifier(token)):
-							print "%s: Interface name expected in frame '%s'" % (inname, frame)
+							print("%s: Interface name expected in frame '%s'" % (inname, frame))
 						else:
 							arg0 = token
@@ -970,5 +970,5 @@
 				if (token == "}"):
 					if (indent != 2):
-						print "%s: Wrong number of parentheses in frame '%s'" % (inname, frame)
+						print("%s: Wrong number of parentheses in frame '%s'" % (inname, frame))
 					else:
 						indent = 0
@@ -1010,5 +1010,5 @@
 					continue
 				
-				print "%s: Unknown token '%s' in frame '%s'" % (inname, token, frame)
+				print("%s: Unknown token '%s' in frame '%s'" % (inname, token, frame))
 				continue
 			
@@ -1027,10 +1027,10 @@
 					continue
 				
-				print "%s: Unknown token '%s' in frame head '%s'" % (inname, token, frame)
+				print("%s: Unknown token '%s' in frame head '%s'" % (inname, token, frame))
 				
 				continue
 			
 			if (not identifier(token)):
-				print "%s: Expected frame name" % inname
+				print("%s: Expected frame name" % inname)
 			else:
 				frame = token
@@ -1050,5 +1050,5 @@
 			if (NULL in context):
 				if (token != ";"):
-					print "%s: Expected ';' in interface '%s'" % (inname, interface)
+					print("%s: Expected ';' in interface '%s'" % (inname, interface))
 				else:
 					output += "%s\n" % token
@@ -1074,5 +1074,5 @@
 						
 						if ('protocol' in iface_properties[interface]):
-							print "%s: Protocol for interface '%s' already defined" % (inname, interface)
+							print("%s: Protocol for interface '%s' already defined" % (inname, interface))
 						else:
 							iface_properties[interface]['protocol'] = bp
@@ -1094,5 +1094,5 @@
 					if (FIN in context):
 						if (token != ";"):
-							print "%s: Expected ';' in interface '%s'" % (inname, interface)
+							print("%s: Expected ';' in interface '%s'" % (inname, interface))
 						else:
 							output += "%s" % token
@@ -1124,5 +1124,5 @@
 					if (PAR_LEFT in context):
 						if (token != "("):
-							print "%s: Expected '(' in interface '%s'" % (inname, interface)
+							print("%s: Expected '(' in interface '%s'" % (inname, interface))
 						else:
 							output += "%s" % token
@@ -1133,5 +1133,5 @@
 					
 					if (not identifier(token)):
-						print "%s: Method identifier expected in interface '%s'" % (inname, interface)
+						print("%s: Method identifier expected in interface '%s'" % (inname, interface))
 					else:
 						output += "%s" % token
@@ -1142,5 +1142,5 @@
 				if (token == "}"):
 					if (indent != 2):
-						print "%s: Wrong number of parentheses in interface '%s'" % (inname, interface)
+						print("%s: Wrong number of parentheses in interface '%s'" % (inname, interface))
 					else:
 						indent = 0
@@ -1163,5 +1163,5 @@
 					continue
 				
-				print "%s: Unknown token '%s' in interface '%s'" % (inname, token, interface)
+				print("%s: Unknown token '%s' in interface '%s'" % (inname, token, interface))
 				continue
 			
@@ -1183,10 +1183,10 @@
 						continue
 						
-					print "%s: Expected '{' or ';' in interface head '%s'" % (inname, interface)
+					print("%s: Expected '{' or ';' in interface head '%s'" % (inname, interface))
 					continue
 				
 				if (EXTENDS in context):
 					if (not identifier(token)):
-						print "%s: Expected inherited interface name in interface head '%s'" % (inname, interface)
+						print("%s: Expected inherited interface name in interface head '%s'" % (inname, interface))
 					else:
 						output += "%s " % token
@@ -1218,9 +1218,9 @@
 					continue
 				
-				print "%s: Expected 'extends', '{' or ';' in interface head '%s'" % (inname, interface)
+				print("%s: Expected 'extends', '{' or ';' in interface head '%s'" % (inname, interface))
 				continue
 			
 			if (not identifier(token)):
-				print "%s: Expected interface name" % inname
+				print("%s: Expected interface name" % inname)
 			else:
 				interface = token
@@ -1240,5 +1240,5 @@
 			if (NULL in context):
 				if (token != ";"):
-					print "%s: Expected ';' in architecture '%s'" % (inname, architecture)
+					print("%s: Expected ';' in architecture '%s'" % (inname, architecture))
 				else:
 					output += "%s\n" % token
@@ -1254,5 +1254,5 @@
 					if (FIN in context):
 						if (token != ";"):
-							print "%s: Expected ';' in architecture '%s'" % (inname, architecture)
+							print("%s: Expected ';' in architecture '%s'" % (inname, architecture))
 						else:
 							output += "%s" % token
@@ -1264,5 +1264,5 @@
 					if (VAR in context):
 						if (not descriptor(token)):
-							print "%s: Expected interface descriptor in architecture '%s'" % (inname, architecture)
+							print("%s: Expected interface descriptor in architecture '%s'" % (inname, architecture))
 						else:
 							if (not architecture in arch_properties):
@@ -1283,5 +1283,5 @@
 					if (TO in context):
 						if (token != "to"):
-							print "%s: Expected 'to' in architecture '%s'" % (inname, architecture)
+							print("%s: Expected 'to' in architecture '%s'" % (inname, architecture))
 						else:
 							output += "%s " % token
@@ -1292,5 +1292,5 @@
 					
 					if (not identifier(token)):
-						print "%s: Expected interface name in architecture '%s'" % (inname, architecture)
+						print("%s: Expected interface name in architecture '%s'" % (inname, architecture))
 					else:
 						output += "%s " % token
@@ -1303,5 +1303,5 @@
 					if (FIN in context):
 						if (token != ";"):
-							print "%s: Expected ';' in architecture '%s'" % (inname, architecture)
+							print("%s: Expected ';' in architecture '%s'" % (inname, architecture))
 						else:
 							output += "%s" % token
@@ -1313,5 +1313,5 @@
 					if (VAR in context):
 						if (not identifier(token)):
-							print "%s: Expected interface name in architecture '%s'" % (inname, architecture)
+							print("%s: Expected interface name in architecture '%s'" % (inname, architecture))
 						else:
 							if (not architecture in arch_properties):
@@ -1332,5 +1332,5 @@
 					if (TO in context):
 						if (token != "to"):
-							print "%s: Expected 'to' in architecture '%s'" % (inname, architecture)
+							print("%s: Expected 'to' in architecture '%s'" % (inname, architecture))
 						else:
 							output += "%s " % token
@@ -1341,5 +1341,5 @@
 					
 					if (not descriptor(token)):
-						print "%s: Expected interface descriptor in architecture '%s'" % (inname, architecture)
+						print("%s: Expected interface descriptor in architecture '%s'" % (inname, architecture))
 					else:
 						output += "%s " % token
@@ -1352,5 +1352,5 @@
 					if (FIN in context):
 						if (token != ";"):
-							print "%s: Expected ';' in architecture '%s'" % (inname, architecture)
+							print("%s: Expected ';' in architecture '%s'" % (inname, architecture))
 						else:
 							output += "%s" % token
@@ -1362,5 +1362,5 @@
 					if (VAR in context):
 						if (not descriptor(token)):
-							print "%s: Expected second interface descriptor in architecture '%s'" % (inname, architecture)
+							print("%s: Expected second interface descriptor in architecture '%s'" % (inname, architecture))
 						else:
 							if (not architecture in arch_properties):
@@ -1381,5 +1381,5 @@
 					if (TO in context):
 						if (token != "to"):
-							print "%s: Expected 'to' in architecture '%s'" % (inname, architecture)
+							print("%s: Expected 'to' in architecture '%s'" % (inname, architecture))
 						else:
 							output += "%s " % token
@@ -1390,5 +1390,5 @@
 					
 					if (not descriptor(token)):
-						print "%s: Expected interface descriptor in architecture '%s'" % (inname, architecture)
+						print("%s: Expected interface descriptor in architecture '%s'" % (inname, architecture))
 					else:
 						output += "%s " % token
@@ -1401,5 +1401,5 @@
 					if (FIN in context):
 						if (token != ";"):
-							print "%s: Expected ';' in architecture '%s'" % (inname, architecture)
+							print("%s: Expected ';' in architecture '%s'" % (inname, architecture))
 						else:
 							output += "%s" % token
@@ -1411,5 +1411,5 @@
 					if (VAR in context):
 						if (not identifier(token)):
-							print "%s: Expected instance name in architecture '%s'" % (inname, architecture)
+							print("%s: Expected instance name in architecture '%s'" % (inname, architecture))
 						else:
 							if (not architecture in arch_properties):
@@ -1429,5 +1429,5 @@
 					
 					if (not identifier(token)):
-						print "%s: Expected frame/architecture type in architecture '%s'" % (inname, architecture)
+						print("%s: Expected frame/architecture type in architecture '%s'" % (inname, architecture))
 					else:
 						output += "%s " % token
@@ -1439,5 +1439,5 @@
 				if (token == "}"):
 					if (indent != 1):
-						print "%s: Wrong number of parentheses in architecture '%s'" % (inname, architecture)
+						print("%s: Wrong number of parentheses in architecture '%s'" % (inname, architecture))
 					else:
 						indent -= 1
@@ -1468,5 +1468,5 @@
 					continue
 				
-				print "%s: Unknown token '%s' in architecture '%s'" % (inname, token, architecture)
+				print("%s: Unknown token '%s' in architecture '%s'" % (inname, token, architecture))
 				continue
 			
@@ -1487,5 +1487,5 @@
 				
 				if (not word(token)):
-					print "%s: Expected word in architecture head '%s'" % (inname, architecture)
+					print("%s: Expected word in architecture head '%s'" % (inname, architecture))
 				else:
 					output += "%s " % token
@@ -1494,5 +1494,5 @@
 			
 			if (not identifier(token)):
-				print "%s: Expected architecture name" % inname
+				print("%s: Expected architecture name" % inname)
 			else:
 				architecture = token
@@ -1514,5 +1514,5 @@
 		if (SYSTEM in context):
 			if (token != "architecture"):
-				print "%s: Expected 'architecture'" % inname
+				print("%s: Expected 'architecture'" % inname)
 			else:
 				output += "%s " % token
@@ -1541,5 +1541,5 @@
 			continue
 		
-		print "%s: Unknown token '%s'" % (inname, token)
+		print("%s: Unknown token '%s'" % (inname, token))
 	
 	inf.close()
@@ -1575,5 +1575,5 @@
 	
 	if ((output != "") and (opt_adl)):
-		outf = file(outname, "w")
+		outf = open(outname, "w")
 		outf.write(output)
 		outf.close()
@@ -1633,5 +1633,5 @@
 					merge_dot_frame("%s_%s" % (prefix, inst['var']), inst['var'], subframe, outf, indent + 1)
 				else:
-					print "%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type'])
+					print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']))
 	
 	if ('bind' in arch):
@@ -1728,10 +1728,10 @@
 	
 	if (arch is None):
-		print "Unable to find system architecture"
+		print("Unable to find system architecture")
 		return
 	
 	if (opt_dot):
 		outname = os.path.join(outdir, "%s.dot" % arch['name'])
-		outf = file(outname, "w")
+		outf = open(outname, "w")
 		
 		outf.write("digraph {\n")
@@ -1752,5 +1752,5 @@
 						merge_dot_frame("%s" % inst['var'], inst['var'], subframe, outf, 1)
 					else:
-						print "%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type'])
+						print("%s: '%s' is neither an architecture nor a frame" % (arch['name'], inst['type']))
 		
 		if ('bind' in arch):
@@ -1784,10 +1784,10 @@
 		if ('delegate' in arch):
 			for delegate in arch['delegate']:
-				print "Unable to delegate interface in system architecture"
+				print("Unable to delegate interface in system architecture")
 				break
 		
 		if ('subsume' in arch):
 			for subsume in arch['subsume']:
-				print "Unable to subsume interface in system architecture"
+				print("Unable to subsume interface in system architecture")
 				break
 		
@@ -1826,14 +1826,14 @@
 			pass
 		else:
-			print "Error: Unknown command line option '%s'" % arg
+			print("Error: Unknown command line option '%s'" % arg)
 			return
 	
 	if ((opt_bp) and (opt_ebp)):
-		print "Error: Cannot dump both original Behavior Protocols and Extended Behavior Protocols"
+		print("Error: Cannot dump both original Behavior Protocols and Extended Behavior Protocols")
 		return
 	
 	path = os.path.abspath(sys.argv[-1])
 	if (not os.path.isdir(path)):
-		print "Error: <OUTPUT> is not a directory"
+		print("Error: <OUTPUT> is not a directory")
 		return
 	
Index: kernel/tools/amd64/decpt.py
===================================================================
--- kernel/tools/amd64/decpt.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ kernel/tools/amd64/decpt.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -7,5 +7,5 @@
 def main():
     if len(sys.argv) != 2 or not sys.argv[1].startswith('0x'):
-        print "%s 0x..." % sys.argv[0]
+        print("%s 0x..." % sys.argv[0])
         sys.exit(1)
     
@@ -16,9 +16,9 @@
     ptl1 = (address >> 30) & 0x1ff
     ptl0 = (address >> 39) & 0x1ff
-    print "Ptl0:   %3d" % ptl0
-    print "Ptl1:   %3d" % ptl1
-    print "Ptl2:   %3d" % ptl2
-    print "Ptl3:   %3d" % ptl3
-    print "Offset: 0x%x" % offset
+    print("Ptl0:   %3d" % ptl0)
+    print("Ptl1:   %3d" % ptl1)
+    print("Ptl2:   %3d" % ptl2)
+    print("Ptl3:   %3d" % ptl3)
+    print("Offset: 0x%x" % offset)
 
 if __name__ == '__main__':
Index: kernel/tools/genmap.py
===================================================================
--- kernel/tools/genmap.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ kernel/tools/genmap.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -86,6 +86,6 @@
 	obdump = read_obdump(obmapf)
 	
-	def sorter(x,y):
-		return cmp(x[0],y[0])
+	def key_sorter(x):
+		return x[0]
 	
 	for line in kmapf:
@@ -93,9 +93,9 @@
 		res = startfile.match(line)
 		
-		if ((res) and (obdump[res.group(1)].has_key(res.group(3)))):
+		if ((res) and (res.group(3) in obdump[res.group(1)])):
 			offset = int(res.group(2), 16)
 			fname = res.group(3)
 			symbols = obdump[res.group(1)][fname]
-			symbols.sort(sorter)
+			symbols.sort(key = key_sorter)
 			for addr, symbol in symbols:
 				value = fname + ':' + symbol
@@ -107,10 +107,10 @@
 def main():
 	if (len(sys.argv) != 4):
-		print "Usage: %s <kernel.map> <nm dump> <output.bin>" % sys.argv[0]
+		print("Usage: %s <kernel.map> <nm dump> <output.bin>" % sys.argv[0])
 		return 1
 	
 	kmapf = open(sys.argv[1], 'r')
 	obmapf = open(sys.argv[2], 'r')
-	out = open(sys.argv[3], 'w')
+	out = open(sys.argv[3], 'wb')
 	
 	generate(kmapf, obmapf, out)
Index: kernel/tools/ia32/decpt.py
===================================================================
--- kernel/tools/ia32/decpt.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ kernel/tools/ia32/decpt.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -7,5 +7,5 @@
 def main():
     if len(sys.argv) != 2 or not sys.argv[1].startswith('0x'):
-        print "%s 0x..." % sys.argv[0]
+        print("%s 0x..." % sys.argv[0])
         sys.exit(1)
     
@@ -14,7 +14,7 @@
     ptl1 = (address >> 12) & 0x3ff
     ptl0 = (address >> 22) & 0x3ff
-    print "Ptl0:   %3d" % ptl0
-    print "Ptl1:   %3d" % ptl1
-    print "Offset: 0x%x" % offset
+    print("Ptl0:   %3d" % ptl0)
+    print("Ptl1:   %3d" % ptl1)
+    print("Offset: 0x%x" % offset)
 
 if __name__ == '__main__':
Index: tools/autotool.py
===================================================================
--- tools/autotool.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ tools/autotool.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -75,5 +75,5 @@
 	"Read HelenOS build configuration"
 	
-	inf = file(fname, 'r')
+	inf = open(fname, 'r')
 	
 	for line in inf:
@@ -191,5 +191,5 @@
 	check_common(common, "CC")
 	
-	outf = file(PROBE_SOURCE, 'w')
+	outf = open(PROBE_SOURCE, 'w')
 	outf.write(PROBE_HEAD)
 	
@@ -212,5 +212,5 @@
 	if (not os.path.isfile(PROBE_OUTPUT)):
 		sys.stderr.write("failed\n")
-		print output[1]
+		print(output[1])
 		print_error(["Error executing \"%s\"." % " ".join(args),
 		             "The compiler did not produce the output file \"%s\"." % PROBE_OUTPUT,
@@ -221,5 +221,5 @@
 	sys.stderr.write("ok\n")
 	
-	inf = file(PROBE_OUTPUT, 'r')
+	inf = open(PROBE_OUTPUT, 'r')
 	lines = inf.readlines()
 	inf.close()
@@ -343,5 +343,5 @@
 	"Create makefile output"
 	
-	outmk = file(mkname, 'w')
+	outmk = open(mkname, 'w')
 	
 	outmk.write('#########################################\n')
@@ -357,5 +357,5 @@
 	"Create header output"
 	
-	outhd = file(hdname, 'w')
+	outhd = open(hdname, 'w')
 	
 	outhd.write('/***************************************\n')
Index: tools/checkers/clang.py
===================================================================
--- tools/checkers/clang.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ tools/checkers/clang.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -42,5 +42,5 @@
 def usage(prname):
 	"Print usage syntax"
-	print prname + " <ROOT>"
+	print(prname + " <ROOT>")
 
 def clang(root, job):
@@ -50,9 +50,9 @@
 	
 	if (not os.path.isfile(inname)):
-		print "Unable to open %s" % inname
-		print "Did you run \"make precheck\" on the source tree?"
+		print("Unable to open %s" % inname)
+		print("Did you run \"make precheck\" on the source tree?")
 		return False
 	
-	inf = file(inname, "r")
+	inf = open(inname, "r")
 	records = inf.read().splitlines()
 	inf.close()
@@ -64,5 +64,5 @@
 		
 		if (len(arg) < 6):
-			print "Not enought jobfile record arguments"
+			print("Not enought jobfile record arguments")
 			return False
 		
@@ -76,5 +76,5 @@
 		srcfqname = os.path.join(base, srcfname)
 		if (not os.path.isfile(srcfqname)):
-			print "Source %s not found" % srcfqname
+			print("Source %s not found" % srcfqname)
 			return False
 		
@@ -108,6 +108,6 @@
 	
 	if (not os.path.isfile(config)):
-		print "%s not found." % config
-		print "Please specify the path to HelenOS build tree root as the first argument."
+		print("%s not found." % config)
+		print("Please specify the path to HelenOS build tree root as the first argument.")
 		return
 	
@@ -115,9 +115,9 @@
 		if (not clang(rootdir, job)):
 			print
-			print "Failed job: %s" % job
+			print("Failed job: %s" % job)
 			return
 	
 	print
-	print "All jobs passed"
+	print("All jobs passed")
 
 if __name__ == '__main__':
Index: tools/checkers/jobfile.py
===================================================================
--- tools/checkers/jobfile.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ tools/checkers/jobfile.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -54,5 +54,5 @@
 				nil = True
 			else:
-				print "Unexpected '%s'" % record[i]
+				print("Unexpected '%s'" % record[i])
 				return False
 		
Index: tools/checkers/stanse.py
===================================================================
--- tools/checkers/stanse.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ tools/checkers/stanse.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -43,5 +43,5 @@
 def usage(prname):
 	"Print usage syntax"
-	print prname + " <ROOT>"
+	print(prname + " <ROOT>")
 
 def stanse(root, job):
@@ -54,9 +54,9 @@
 	
 	if (not os.path.isfile(inname)):
-		print "Unable to open %s" % inname
-		print "Did you run \"make precheck\" on the source tree?"
+		print("Unable to open %s" % inname)
+		print("Did you run \"make precheck\" on the source tree?")
 		return False
 	
-	inf = file(inname, "r")
+	inf = open(inname, "r")
 	records = inf.read().splitlines()
 	inf.close()
@@ -69,5 +69,5 @@
 		
 		if (len(arg) < 6):
-			print "Not enought jobfile record arguments"
+			print("Not enought jobfile record arguments")
 			return False
 		
@@ -81,5 +81,5 @@
 		srcfqname = os.path.join(base, srcfname)
 		if (not os.path.isfile(srcfqname)):
-			print "Source %s not found" % srcfqname
+			print("Source %s not found" % srcfqname)
 			return False
 		
@@ -90,5 +90,5 @@
 		output.append([srcfname, tgtfname, base, options])
 	
-	outf = file(outname, "w")
+	outf = open(outname, "w")
 	for record in output:
 		outf.write("{%s},{%s},{%s},{%s}\n" % (record[0], record[1], record[2], record[3]))
@@ -121,6 +121,6 @@
 	
 	if (not os.path.isfile(config)):
-		print "%s not found." % config
-		print "Please specify the path to HelenOS build tree root as the first argument."
+		print("%s not found." % config)
+		print("Please specify the path to HelenOS build tree root as the first argument.")
 		return
 	
@@ -128,9 +128,9 @@
 		if (not stanse(rootdir, job)):
 			print
-			print "Failed job: %s" % job
+			print("Failed job: %s" % job)
 			return
 	
 	print
-	print "All jobs passed"
+	print("All jobs passed")
 
 if __name__ == '__main__':
Index: tools/checkers/vcc.py
===================================================================
--- tools/checkers/vcc.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ tools/checkers/vcc.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -49,5 +49,5 @@
 def usage(prname):
 	"Print usage syntax"
-	print prname + " <ROOT> [VCC_PATH]"
+	print(prname + " <ROOT> [VCC_PATH]")
 
 def cygpath(upath):
@@ -72,5 +72,5 @@
 	preproc = subprocess.Popen(args, stdout = subprocess.PIPE).communicate()[0]
 	
-	tmpf = file(tmpfname, "w")
+	tmpf = open(tmpfname, "w")
 	tmpf.write(specification)
 	
@@ -108,9 +108,9 @@
 	
 	if (not os.path.isfile(inname)):
-		print "Unable to open %s" % inname
-		print "Did you run \"make precheck\" on the source tree?"
+		print("Unable to open %s" % inname)
+		print("Did you run \"make precheck\" on the source tree?")
 		return False
 	
-	inf = file(inname, "r")
+	inf = open(inname, "r")
 	records = inf.read().splitlines()
 	inf.close()
@@ -122,5 +122,5 @@
 		
 		if (len(arg) < 6):
-			print "Not enought jobfile record arguments"
+			print("Not enought jobfile record arguments")
 			return False
 		
@@ -134,5 +134,5 @@
 		srcfqname = os.path.join(base, srcfname)
 		if (not os.path.isfile(srcfqname)):
-			print "Source %s not found" % srcfqname
+			print("Source %s not found" % srcfqname)
 			return False
 		
@@ -153,5 +153,5 @@
 		
 		# Run Vcc
-		print " -- %s --" % srcfname		
+		print(" -- %s --" % srcfname)
 		retval = subprocess.Popen([vcc_path, '/pointersize:32', '/newsyntax', cygpath(tmpfqname)]).wait()
 		
@@ -182,6 +182,6 @@
 	
 	if (not os.path.isfile(vcc_path)):
-		print "%s is not a binary." % vcc_path
-		print "Please supply the full Cygwin path to Vcc as the second argument."
+		print("%s is not a binary." % vcc_path)
+		print("Please supply the full Cygwin path to Vcc as the second argument.")
 		return
 	
@@ -189,11 +189,11 @@
 	
 	if (not os.path.isfile(config)):
-		print "%s not found." % config
-		print "Please specify the path to HelenOS build tree root as the first argument."
+		print("%s not found." % config)
+		print("Please specify the path to HelenOS build tree root as the first argument.")
 		return
 	
 	specpath = os.path.join(rootdir, "tools/checkers/vcc.h")
 	if (not os.path.isfile(specpath)):
-		print "%s not found." % config
+		print("%s not found." % config)
 		return
 	
@@ -205,9 +205,9 @@
 		if (not vcc(vcc_path, rootdir, job)):
 			print
-			print "Failed job: %s" % job
+			print("Failed job: %s" % job)
 			return
 	
 	print
-	print "All jobs passed"
+	print("All jobs passed")
 
 if __name__ == '__main__':
Index: tools/config.py
===================================================================
--- tools/config.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ tools/config.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -48,5 +48,5 @@
 	"Read saved values from last configuration run"
 	
-	inf = file(fname, 'r')
+	inf = open(fname, 'r')
 	
 	for line in inf:
@@ -103,5 +103,5 @@
 		condval = res.group(3)
 		
-		if (not defaults.has_key(condname)):
+		if (not condname in defaults):
 			varval = ''
 		else:
@@ -131,5 +131,5 @@
 	"Parse configuration file"
 	
-	inf = file(fname, 'r')
+	inf = open(fname, 'r')
 	
 	name = ''
@@ -219,5 +219,5 @@
 			continue
 		
-		if (not defaults.has_key(varname)):
+		if (not varname in defaults):
 			return False
 	
@@ -232,5 +232,5 @@
 	
 	try:
-		version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0].split(':')
+		version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0].decode().split(':')
 		sys.stderr.write("ok\n")
 	except:
@@ -246,6 +246,6 @@
 		revision = None
 	
-	outmk = file(mkname, 'w')
-	outmc = file(mcname, 'w')
+	outmk = open(mkname, 'w')
+	outmc = open(mcname, 'w')
 	
 	outmk.write('#########################################\n')
@@ -263,5 +263,5 @@
 			continue
 		
-		if (not defaults.has_key(varname)):
+		if (not varname in defaults):
 			default = ''
 		else:
@@ -368,5 +368,5 @@
 			# Cancel out all defaults which have to be deduced
 			for varname, vartype, name, choices, cond in ask_names:
-				if ((vartype == 'y') and (defaults.has_key(varname)) and (defaults[varname] == '*')):
+				if ((vartype == 'y') and (varname in defaults) and (defaults[varname] == '*')):
 					defaults[varname] = None
 			
@@ -385,5 +385,5 @@
 					position = cnt
 				
-				if (not defaults.has_key(varname)):
+				if (not varname in defaults):
 					default = None
 				else:
@@ -428,5 +428,5 @@
 				cnt += 1
 			
-			if (position >= options):
+			if (position != None) and (position >= len(options)):
 				position = None
 			
@@ -449,10 +449,10 @@
 			
 			position = None
-			if (not opt2row.has_key(value)):
+			if (not value in opt2row):
 				raise RuntimeError("Error selecting value: %s" % value)
 			
 			(selname, seltype, name, choices) = opt2row[value]
 			
-			if (not defaults.has_key(selname)):
+			if (not selname in defaults):
 					default = None
 			else:
Index: tools/jobfile.py
===================================================================
--- tools/jobfile.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ tools/jobfile.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -38,5 +38,5 @@
 def usage(prname):
 	"Print usage syntax"
-	print prname + " <JOBFILE> <SOURCE> <TARGET> <TOOL> <CATEGORY> [OPTIONS ...]"
+	print(prname + " <JOBFILE> <SOURCE> <TARGET> <TOOL> <CATEGORY> [OPTIONS ...]")
 
 def main():
@@ -53,5 +53,5 @@
 	options = " ".join(sys.argv[6:])
 	
-	jobfile = file(jobfname, "a")
+	jobfile = open(jobfname, "a")
 	fcntl.lockf(jobfile, fcntl.LOCK_EX)
 	jobfile.write("{%s},{%s},{%s},{%s},{%s},{%s}\n" % (srcfname, tgtfname, toolname, category, cwd, options))
Index: tools/mkfat.py
===================================================================
--- tools/mkfat.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ tools/mkfat.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -46,5 +46,5 @@
 		return size
 	
-	return (((size / alignment) + 1) * alignment)
+	return ((size // alignment) + 1) * alignment
 
 def subtree_size(root, cluster_size, dirent_size):
@@ -79,5 +79,5 @@
 	first = 0
 	
-	inf = file(path, "r")
+	inf = open(path, "rb")
 	rd = 0;
 	while (rd < size):
@@ -92,5 +92,5 @@
 		prev = empty_cluster
 		
-		data = inf.read(cluster_size);
+		data = bytes(inf.read(cluster_size));
 		outf.seek(data_start + (empty_cluster - reserved_clusters) * cluster_size)
 		outf.write(data)
@@ -120,5 +120,5 @@
 		prev = empty_cluster
 		
-		data = ''
+		data = bytes()
 		data_len = 0
 		while ((i < length) and (data_len < cluster_size)):
@@ -343,5 +343,5 @@
 def usage(prname):
 	"Print usage syntax"
-	print prname + " <EXTRA_BYTES> <PATH> <IMAGE>"
+	print(prname + " <EXTRA_BYTES> <PATH> <IMAGE>")
 
 def main():
@@ -351,5 +351,5 @@
 	
 	if (not sys.argv[1].isdigit()):
-		print "<EXTRA_BYTES> must be a number"
+		print("<EXTRA_BYTES> must be a number")
 		return
 	
@@ -358,5 +358,5 @@
 	path = os.path.abspath(sys.argv[2])
 	if (not os.path.isdir(path)):
-		print "<PATH> must be a directory"
+		print("<PATH> must be a directory")
 		return
 	
@@ -372,7 +372,7 @@
 	# Make sure the filesystem is large enought for FAT16
 	size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size + extra_bytes
-	while (size / cluster_size < fat16_clusters):
+	while (size // cluster_size < fat16_clusters):
 		if (cluster_size > sector_size):
-			cluster_size /= 2
+			cluster_size = cluster_size // 2
 			size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size + extra_bytes
 		else:
@@ -381,20 +381,20 @@
 	root_size = align_up(root_entries(path) * dirent_size, cluster_size)
 	
-	fat_size = align_up(align_up(size, cluster_size) / cluster_size * fatent_size, sector_size)
-	
-	sectors = (cluster_size + fat_count * fat_size + root_size + size) / sector_size
+	fat_size = align_up(align_up(size, cluster_size) // cluster_size * fatent_size, sector_size)
+	
+	sectors = (cluster_size + fat_count * fat_size + root_size + size) // sector_size
 	root_start = cluster_size + fat_count * fat_size
 	data_start = root_start + root_size
 	
-	outf = file(sys.argv[3], "w")
+	outf = open(sys.argv[3], "wb")
 	
 	boot_sector = xstruct.create(BOOT_SECTOR)
 	boot_sector.jmp = [0xEB, 0x3C, 0x90]
-	boot_sector.oem = "MSDOS5.0"
+	boot_sector.oem = b'MSDOS5.0'
 	boot_sector.sector = sector_size
-	boot_sector.cluster = cluster_size / sector_size
-	boot_sector.reserved = cluster_size / sector_size
+	boot_sector.cluster = cluster_size // sector_size
+	boot_sector.reserved = cluster_size // sector_size
 	boot_sector.fats = fat_count
-	boot_sector.rootdir = root_size / dirent_size
+	boot_sector.rootdir = root_size // dirent_size
 	if (sectors <= 65535):
 		boot_sector.sectors = sectors
@@ -402,5 +402,5 @@
 		boot_sector.sectors = 0
 	boot_sector.descriptor = 0xF8
-	boot_sector.fat_sectors = fat_size / sector_size
+	boot_sector.fat_sectors = fat_size // sector_size
 	boot_sector.track_sectors = 63
 	boot_sector.heads = 6
@@ -414,6 +414,6 @@
 	boot_sector.extboot_signature = 0x29
 	boot_sector.serial = random.randint(0, 0x7fffffff)
-	boot_sector.label = "HELENOS"
-	boot_sector.fstype = "FAT16   "
+	boot_sector.label = b'HELENOS'
+	boot_sector.fstype = b'FAT16   '
 	boot_sector.boot_signature = [0x55, 0xAA]
 	
@@ -423,21 +423,21 @@
 	
 	# Reserved sectors
-	for i in range(1, cluster_size / sector_size):
+	for i in range(1, cluster_size // sector_size):
 		outf.write(empty_sector.pack())
 	
 	# FAT tables
 	for i in range(0, fat_count):
-		for j in range(0, fat_size / sector_size):
+		for j in range(0, fat_size // sector_size):
 			outf.write(empty_sector.pack())
 	
 	# Root directory
-	for i in range(0, root_size / sector_size):
+	for i in range(0, root_size // sector_size):
 		outf.write(empty_sector.pack())
 	
 	# Data
-	for i in range(0, size / sector_size):
+	for i in range(0, size // sector_size):
 		outf.write(empty_sector.pack())
 	
-	fat = array.array('L', [0] * (fat_size / fatent_size))
+	fat = array.array('L', [0] * (fat_size // fatent_size))
 	fat[0] = 0xfff8
 	fat[1] = 0xffff
@@ -449,5 +449,5 @@
 	for i in range(0, fat_count):
 		outf.seek(cluster_size + i * fat_size)
-		for j in range(0, fat_size / fatent_size):
+		for j in range(0, fat_size // fatent_size):
 			fat_entry.next = fat[j]
 			outf.write(fat_entry.pack())
Index: tools/mkhord.py
===================================================================
--- tools/mkhord.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ tools/mkhord.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -52,5 +52,5 @@
 def usage(prname):
 	"Print usage syntax"
-	print prname + " <ALIGNMENT> <FS_IMAGE> <HORD_IMAGE>" 
+	print(prname + " <ALIGNMENT> <FS_IMAGE> <HORD_IMAGE>")
 
 def main():
@@ -60,19 +60,19 @@
 	
 	if (not sys.argv[1].isdigit()):
-		print "<ALIGNMENT> must be a number"
+		print("<ALIGNMENT> must be a number")
 		return
 	
 	align = int(sys.argv[1], 0)
 	if (align <= 0):
-		print "<ALIGNMENT> must be positive"
+		print("<ALIGNMENT> must be positive")
 		return
 	
 	fs_image = os.path.abspath(sys.argv[2])
 	if (not os.path.isfile(fs_image)):
-		print "<FS_IMAGE> must be a file"
+		print("<FS_IMAGE> must be a file")
 		return
 	
-	inf = file(fs_image, "rb")
-	outf = file(sys.argv[3], "wb")
+	inf = open(fs_image, "rb")
+	outf = open(sys.argv[3], "wb")
 	
 	header = xstruct.create(HEADER)
Index: tools/mktmpfs.py
===================================================================
--- tools/mktmpfs.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ tools/mktmpfs.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -66,5 +66,5 @@
 def usage(prname):
 	"Print usage syntax"
-	print prname + " <PATH> <IMAGE>"
+	print(prname + " <PATH> <IMAGE>")
 
 def recursion(root, outf):
@@ -85,5 +85,5 @@
 			outf.write(dentry.pack())
 			
-			inf = file(canon, "r")
+			inf = open(canon, "rb")
 			rd = 0;
 			while (rd < size):
@@ -116,8 +116,8 @@
 	path = os.path.abspath(sys.argv[1])
 	if (not os.path.isdir(path)):
-		print "<PATH> must be a directory"
+		print("<PATH> must be a directory")
 		return
 	
-	outf = file(sys.argv[2], "w")
+	outf = open(sys.argv[2], "wb")
 	
 	header = xstruct.create(HEADER)
Index: tools/mkuimage.py
===================================================================
--- tools/mkuimage.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ tools/mkuimage.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -72,10 +72,10 @@
 			start_addr = (int)(optarg, 0)
 		else:
-			print base_name + ": Unrecognized option."
+			print(base_name + ": Unrecognized option.")
 			print_syntax(cmd_name)
 			return
 
 	if len(args) < 2:
-		print base_name + ": Argument missing."
+		print(base_name + ": Argument missing.")
 		print_syntax(cmd_name)
 		return
@@ -91,6 +91,6 @@
 
 def mkuimage(inf_name, outf_name, image_name, load_addr, start_addr):
-	inf = file(inf_name, 'rb')
-	outf = file(outf_name, 'wb')
+	inf = open(inf_name, 'rb')
+	outf = open(outf_name, 'wb')
 
 	header = xstruct.create(UIMAGE_HEADER)
@@ -140,5 +140,5 @@
 	signed_crc = zlib.crc32(byteseq, 0)
 	if signed_crc < 0:
-		return (long(signed_crc) + 4294967296L) # 2^32L
+		return (long(signed_crc) + (long(2) ** long(32))) # 2^32L
 	else:
 		return signed_crc
@@ -147,13 +147,13 @@
 #
 def print_syntax(cmd):
-	print "syntax: " + cmd + " [<options>] <raw_image> <uImage>"
+	print("syntax: " + cmd + " [<options>] <raw_image> <uImage>")
 	print
-	print "\traw_image\tInput image name (raw binary data)"
-	print "\tuImage\t\tOutput uImage name (U-Boot image)"
+	print("\traw_image\tInput image name (raw binary data)")
+	print("\tuImage\t\tOutput uImage name (U-Boot image)")
 	print
-	print "options:"
-	print "\t-name <name>\tImage name (default: 'Noname')"
-	print "\t-laddr <name>\tLoad address (default: 0x00000000)"
-	print "\t-saddr <name>\tStart address (default: 0x00000000)"
+	print("options:")
+	print("\t-name <name>\tImage name (default: 'Noname')")
+	print("\t-laddr <name>\tLoad address (default: 0x00000000)")
+	print("\t-saddr <name>\tStart address (default: 0x00000000)")
 
 if __name__ == '__main__':
Index: tools/pack.py
===================================================================
--- tools/pack.py	(revision 458619f79d2015d51ba730dc3853632b671a9005)
+++ tools/pack.py	(revision 28f4adbc5088d8d67ea408f56eb3b35838031e6a)
@@ -43,5 +43,5 @@
 def usage(prname):
 	"Print usage syntax"
-	print "%s <OBJCOPY> <FORMAT> <ARCH> <ARCH_PATH> [COMPONENTS ...]" % prname
+	print("%s <OBJCOPY> <FORMAT> <ARCH> <ARCH_PATH> [COMPONENTS ...]" % prname)
 
 def deflate(data):
@@ -110,7 +110,7 @@
 		symbol = "_binary_%s" % basename.replace(".", "_")
 		
-		print "%s -> %s" % (component, obj)
+		print("%s -> %s" % (component, obj))
 		
-		comp_in = file(component, "rb")
+		comp_in = open(component, "rb")
 		comp_data = comp_in.read()
 		comp_in.close()
@@ -121,5 +121,5 @@
 		
 		try:
-			comp_out = file(basename, "wb")
+			comp_out = open(basename, "wb")
 			comp_out.write(comp_deflate)
 			comp_out.close()
@@ -151,5 +151,5 @@
 		cnt += 1
 	
-	header = file(os.path.join(arch_path, "include", "%s.h" % COMPONENTS), "w")
+	header = open(os.path.join(arch_path, "include", "%s.h" % COMPONENTS), "w")
 	
 	header.write('/***************************************\n')
@@ -173,5 +173,5 @@
 	header.close()
 	
-	data = file(os.path.join(arch_path, "src", "%s.c" % COMPONENTS), "w")
+	data = open(os.path.join(arch_path, "src", "%s.c" % COMPONENTS), "w")
 	
 	data.write('/***************************************\n')
@@ -187,9 +187,9 @@
 	data.close()
 	
-	link_in = file(os.path.join(arch_path, "%s.in" % LINK), "r")
+	link_in = open(os.path.join(arch_path, "%s.in" % LINK), "r")
 	template = link_in.read()
 	link_in.close()
 	
-	link_out = file(os.path.join(arch_path, "%s.comp" % LINK), "w")
+	link_out = open(os.path.join(arch_path, "%s.comp" % LINK), "w")
 	link_out.write(template.replace("[[COMPONENTS]]", "\n".join(link_ctx)))
 	link_out.close()
