Index: tools/mkfat.py
===================================================================
--- tools/mkfat.py	(revision 14f21007dc0cf82ed243c0420406da06d1dd6c47)
+++ tools/mkfat.py	(revision f4057f59dc2ae6d05e70003152cce8b9adde9242)
@@ -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
 	
@@ -370,9 +370,9 @@
 	reserved_clusters = 2
 	
-	# Make sure the filesystem is large enought for FAT16
+	# Make sure the filesystem is large enough 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())
