- Timestamp:
- 2010-11-25T13:42:50Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8df8415
- Parents:
- a93d79a (diff), eb667613 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- tools
- Files:
-
- 13 edited
-
autotool.py (modified) (13 diffs)
-
checkers/clang.py (modified) (6 diffs)
-
checkers/jobfile.py (modified) (1 diff)
-
checkers/stanse.py (modified) (7 diffs)
-
checkers/vcc.py (modified) (9 diffs)
-
config.py (modified) (11 diffs)
-
jobfile.py (modified) (2 diffs)
-
mkfat.py (modified) (13 diffs)
-
mkhord.py (modified) (2 diffs)
-
mktmpfs.py (modified) (3 diffs)
-
mkuimage.py (modified) (4 diffs)
-
pack.py (modified) (6 diffs)
-
toolchain.sh (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
tools/autotool.py
ra93d79a r8fb1bf82 49 49 50 50 PACKAGE_BINUTILS = "usually part of binutils" 51 PACKAGE_GCC = "preferably version 4. 4.3or newer"51 PACKAGE_GCC = "preferably version 4.5.1 or newer" 52 52 PACKAGE_CROSS = "use tools/toolchain.sh to build the cross-compiler toolchain" 53 53 54 54 COMPILER_FAIL = "The compiler is probably not capable to compile HelenOS." 55 55 56 PROBE_HEAD = """#define AUTOTOOL_DECLARE(category, subcategory, tag, name, value) \\56 PROBE_HEAD = """#define AUTOTOOL_DECLARE(category, subcategory, tag, name, strc, conc, value) \\ 57 57 asm volatile ( \\ 58 "AUTOTOOL_DECLARE\\t" category "\\t" subcategory "\\t" tag "\\t" name "\\t %[val]\\n" \\58 "AUTOTOOL_DECLARE\\t" category "\\t" subcategory "\\t" tag "\\t" name "\\t" strc "\\t" conc "\\t%[val]\\n" \\ 59 59 : \\ 60 60 : [val] "n" (value) \\ 61 61 ) 62 62 63 #define DECLARE_INTSIZE(tag, type ) \\64 AUTOTOOL_DECLARE("intsize", "unsigned", tag, #type, s izeof(unsigned type)); \\65 AUTOTOOL_DECLARE("intsize", "signed", tag, #type, s izeof(signed type))63 #define DECLARE_INTSIZE(tag, type, strc, conc) \\ 64 AUTOTOOL_DECLARE("intsize", "unsigned", tag, #type, strc, conc, sizeof(unsigned type)); \\ 65 AUTOTOOL_DECLARE("intsize", "signed", tag, #type, strc, conc, sizeof(signed type)); 66 66 67 67 int main(int argc, char *argv[]) … … 75 75 "Read HelenOS build configuration" 76 76 77 inf = file(fname, 'r')77 inf = open(fname, 'r') 78 78 79 79 for line in inf: … … 191 191 check_common(common, "CC") 192 192 193 outf = file(PROBE_SOURCE, 'w')193 outf = open(PROBE_SOURCE, 'w') 194 194 outf.write(PROBE_HEAD) 195 195 196 196 for typedef in sizes: 197 outf.write("\tDECLARE_INTSIZE(\"%s\", %s );\n" % (typedef['tag'], typedef['type']))197 outf.write("\tDECLARE_INTSIZE(\"%s\", %s, %s, %s);\n" % (typedef['tag'], typedef['type'], typedef['strc'], typedef['conc'])) 198 198 199 199 outf.write(PROBE_TAIL) … … 212 212 if (not os.path.isfile(PROBE_OUTPUT)): 213 213 sys.stderr.write("failed\n") 214 print output[1]214 print(output[1]) 215 215 print_error(["Error executing \"%s\"." % " ".join(args), 216 216 "The compiler did not produce the output file \"%s\"." % PROBE_OUTPUT, … … 221 221 sys.stderr.write("ok\n") 222 222 223 inf = file(PROBE_OUTPUT, 'r')223 inf = open(PROBE_OUTPUT, 'r') 224 224 lines = inf.readlines() 225 225 inf.close() … … 231 231 signed_tags = {} 232 232 233 unsigned_strcs = {} 234 signed_strcs = {} 235 236 unsigned_concs = {} 237 signed_concs = {} 238 233 239 for j in range(len(lines)): 234 240 tokens = lines[j].strip().split("\t") … … 236 242 if (len(tokens) > 0): 237 243 if (tokens[0] == "AUTOTOOL_DECLARE"): 238 if (len(tokens) < 5):244 if (len(tokens) < 7): 239 245 print_error(["Malformed declaration in \"%s\" on line %s." % (PROBE_OUTPUT, j), COMPILER_FAIL]) 240 246 … … 243 249 tag = tokens[3] 244 250 name = tokens[4] 245 value = tokens[5] 251 strc = tokens[5] 252 conc = tokens[6] 253 value = tokens[7] 246 254 247 255 if (category == "intsize"): … … 263 271 unsigned_sizes[name] = value_int 264 272 unsigned_tags[tag] = value_int 273 unsigned_strcs[strc] = value_int 274 unsigned_concs[conc] = value_int 265 275 elif (subcategory == "signed"): 266 276 signed_sizes[name] = value_int 267 277 signed_tags[tag] = value_int 278 signed_strcs[strc] = value_int 279 signed_concs[conc] = value_int 268 280 else: 269 281 print_error(["Unexpected keyword \"%s\" in \"%s\" on line %s." % (subcategory, PROBE_OUTPUT, j), COMPILER_FAIL]) 270 282 271 return {'unsigned_sizes' : unsigned_sizes, 'signed_sizes' : signed_sizes, 'unsigned_tags': unsigned_tags, 'signed_tags': signed_tags}283 return {'unsigned_sizes': unsigned_sizes, 'signed_sizes': signed_sizes, 'unsigned_tags': unsigned_tags, 'signed_tags': signed_tags, 'unsigned_strcs': unsigned_strcs, 'signed_strcs': signed_strcs, 'unsigned_concs': unsigned_concs, 'signed_concs': signed_concs} 272 284 273 285 def detect_uints(probe, bytes): … … 279 291 for b in bytes: 280 292 fnd = False 281 newtype = "uint%s_t" % (b * 8)282 283 293 for name, value in probe['unsigned_sizes'].items(): 284 294 if (value == b): 285 oldtype = "unsigned %s" % name 286 typedefs.append({'oldtype' : oldtype, 'newtype' : newtype}) 287 fnd = True 288 break 289 290 if (not fnd): 291 print_error(['Unable to find appropriate integer type for %s' % newtype, 295 typedefs.append({'oldtype': "unsigned %s" % name, 'newtype': "uint%u_t" % (b * 8)}) 296 fnd = True 297 break 298 299 if (not fnd): 300 print_error(['Unable to find appropriate unsigned integer type for %u bytes' % b, 292 301 COMPILER_FAIL]) 293 302 294 303 295 304 fnd = False 296 newtype = "int%s_t" % (b * 8)297 298 305 for name, value in probe['signed_sizes'].items(): 299 306 if (value == b): 300 oldtype = "signed %s" % name 301 typedefs.append({'oldtype' : oldtype, 'newtype' : newtype}) 302 fnd = True 303 break 304 305 if (not fnd): 306 print_error(['Unable to find appropriate integer type for %s' % newtype, 307 typedefs.append({'oldtype': "signed %s" % name, 'newtype': "int%u_t" % (b * 8)}) 308 fnd = True 309 break 310 311 if (not fnd): 312 print_error(['Unable to find appropriate signed integer type for %u bytes' % b, 313 COMPILER_FAIL]) 314 315 316 fnd = False 317 for name, value in probe['unsigned_strcs'].items(): 318 if (value == b): 319 macros.append({'oldmacro': "\"%so\"" % name, 'newmacro': "PRIo%u" % (b * 8)}) 320 macros.append({'oldmacro': "\"%su\"" % name, 'newmacro': "PRIu%u" % (b * 8)}) 321 macros.append({'oldmacro': "\"%sx\"" % name, 'newmacro': "PRIx%u" % (b * 8)}) 322 macros.append({'oldmacro': "\"%sX\"" % name, 'newmacro': "PRIX%u" % (b * 8)}) 323 fnd = True 324 break 325 326 if (not fnd): 327 print_error(['Unable to find appropriate unsigned printf formatter for %u bytes' % b, 328 COMPILER_FAIL]) 329 330 331 fnd = False 332 for name, value in probe['signed_strcs'].items(): 333 if (value == b): 334 macros.append({'oldmacro': "\"%sd\"" % name, 'newmacro': "PRId%u" % (b * 8)}) 335 fnd = True 336 break 337 338 if (not fnd): 339 print_error(['Unable to find appropriate signed printf formatter for %u bytes' % b, 340 COMPILER_FAIL]) 341 342 343 fnd = False 344 for name, value in probe['unsigned_concs'].items(): 345 if (value == b): 346 if ((name.startswith('@')) or (name == "")): 347 macros.append({'oldmacro': "c ## U", 'newmacro': "UINT%u_C(c)" % (b * 8)}) 348 else: 349 macros.append({'oldmacro': "c ## U%s" % name, 'newmacro': "UINT%u_C(c)" % (b * 8)}) 350 fnd = True 351 break 352 353 if (not fnd): 354 print_error(['Unable to find appropriate unsigned literal macro for %u bytes' % b, 355 COMPILER_FAIL]) 356 357 358 fnd = False 359 for name, value in probe['signed_concs'].items(): 360 if (value == b): 361 if ((name.startswith('@')) or (name == "")): 362 macros.append({'oldmacro': "c", 'newmacro': "INT%u_C(c)" % (b * 8)}) 363 else: 364 macros.append({'oldmacro': "c ## %s" % name, 'newmacro': "INT%u_C(c)" % (b * 8)}) 365 fnd = True 366 break 367 368 if (not fnd): 369 print_error(['Unable to find appropriate unsigned literal macro for %u bytes' % b, 307 370 COMPILER_FAIL]) 308 371 … … 343 406 "Create makefile output" 344 407 345 outmk = file(mkname, 'w')408 outmk = open(mkname, 'w') 346 409 347 410 outmk.write('#########################################\n') … … 357 420 "Create header output" 358 421 359 outhd = file(hdname, 'w')422 outhd = open(hdname, 'w') 360 423 361 424 outhd.write('/***************************************\n') … … 508 571 probe = probe_compiler(common, 509 572 [ 510 {'type': 'char', 'tag': 'CHAR' },511 {'type': 'short int', 'tag': 'SHORT' },512 {'type': 'int', 'tag': 'INT' },513 {'type': 'long int', 'tag': 'LONG' },514 {'type': 'long long int', 'tag': 'LLONG' }573 {'type': 'char', 'tag': 'CHAR', 'strc': '"hh"', 'conc': '"@@"'}, 574 {'type': 'short int', 'tag': 'SHORT', 'strc': '"h"', 'conc': '"@"'}, 575 {'type': 'int', 'tag': 'INT', 'strc': '""', 'conc': '""'}, 576 {'type': 'long int', 'tag': 'LONG', 'strc': '"l"', 'conc': '"L"'}, 577 {'type': 'long long int', 'tag': 'LLONG', 'strc': '"ll"', 'conc': '"LL"'} 515 578 ] 516 579 ) -
tools/checkers/clang.py
ra93d79a r8fb1bf82 42 42 def usage(prname): 43 43 "Print usage syntax" 44 print prname + " <ROOT>"44 print(prname + " <ROOT>") 45 45 46 46 def clang(root, job): … … 50 50 51 51 if (not os.path.isfile(inname)): 52 print "Unable to open %s" % inname53 print "Did you run \"make precheck\" on the source tree?"52 print("Unable to open %s" % inname) 53 print("Did you run \"make precheck\" on the source tree?") 54 54 return False 55 55 56 inf = file(inname, "r")56 inf = open(inname, "r") 57 57 records = inf.read().splitlines() 58 58 inf.close() … … 64 64 65 65 if (len(arg) < 6): 66 print "Not enought jobfile record arguments"66 print("Not enough jobfile record arguments") 67 67 return False 68 68 … … 76 76 srcfqname = os.path.join(base, srcfname) 77 77 if (not os.path.isfile(srcfqname)): 78 print "Source %s not found" % srcfqname78 print("Source %s not found" % srcfqname) 79 79 return False 80 80 … … 108 108 109 109 if (not os.path.isfile(config)): 110 print "%s not found." % config111 print "Please specify the path to HelenOS build tree root as the first argument."110 print("%s not found." % config) 111 print("Please specify the path to HelenOS build tree root as the first argument.") 112 112 return 113 113 … … 115 115 if (not clang(rootdir, job)): 116 116 print 117 print "Failed job: %s" % job117 print("Failed job: %s" % job) 118 118 return 119 119 120 120 print 121 print "All jobs passed"121 print("All jobs passed") 122 122 123 123 if __name__ == '__main__': -
tools/checkers/jobfile.py
ra93d79a r8fb1bf82 54 54 nil = True 55 55 else: 56 print "Unexpected '%s'" % record[i]56 print("Unexpected '%s'" % record[i]) 57 57 return False 58 58 -
tools/checkers/stanse.py
ra93d79a r8fb1bf82 43 43 def usage(prname): 44 44 "Print usage syntax" 45 print prname + " <ROOT>"45 print(prname + " <ROOT>") 46 46 47 47 def stanse(root, job): … … 54 54 55 55 if (not os.path.isfile(inname)): 56 print "Unable to open %s" % inname57 print "Did you run \"make precheck\" on the source tree?"56 print("Unable to open %s" % inname) 57 print("Did you run \"make precheck\" on the source tree?") 58 58 return False 59 59 60 inf = file(inname, "r")60 inf = open(inname, "r") 61 61 records = inf.read().splitlines() 62 62 inf.close() … … 69 69 70 70 if (len(arg) < 6): 71 print "Not enought jobfile record arguments"71 print("Not enough jobfile record arguments") 72 72 return False 73 73 … … 81 81 srcfqname = os.path.join(base, srcfname) 82 82 if (not os.path.isfile(srcfqname)): 83 print "Source %s not found" % srcfqname83 print("Source %s not found" % srcfqname) 84 84 return False 85 85 … … 90 90 output.append([srcfname, tgtfname, base, options]) 91 91 92 outf = file(outname, "w")92 outf = open(outname, "w") 93 93 for record in output: 94 94 outf.write("{%s},{%s},{%s},{%s}\n" % (record[0], record[1], record[2], record[3])) … … 121 121 122 122 if (not os.path.isfile(config)): 123 print "%s not found." % config124 print "Please specify the path to HelenOS build tree root as the first argument."123 print("%s not found." % config) 124 print("Please specify the path to HelenOS build tree root as the first argument.") 125 125 return 126 126 … … 128 128 if (not stanse(rootdir, job)): 129 129 print 130 print "Failed job: %s" % job130 print("Failed job: %s" % job) 131 131 return 132 132 133 133 print 134 print "All jobs passed"134 print("All jobs passed") 135 135 136 136 if __name__ == '__main__': -
tools/checkers/vcc.py
ra93d79a r8fb1bf82 49 49 def usage(prname): 50 50 "Print usage syntax" 51 print prname + " <ROOT> [VCC_PATH]"51 print(prname + " <ROOT> [VCC_PATH]") 52 52 53 53 def cygpath(upath): … … 72 72 preproc = subprocess.Popen(args, stdout = subprocess.PIPE).communicate()[0] 73 73 74 tmpf = file(tmpfname, "w")74 tmpf = open(tmpfname, "w") 75 75 tmpf.write(specification) 76 76 … … 108 108 109 109 if (not os.path.isfile(inname)): 110 print "Unable to open %s" % inname111 print "Did you run \"make precheck\" on the source tree?"110 print("Unable to open %s" % inname) 111 print("Did you run \"make precheck\" on the source tree?") 112 112 return False 113 113 114 inf = file(inname, "r")114 inf = open(inname, "r") 115 115 records = inf.read().splitlines() 116 116 inf.close() … … 122 122 123 123 if (len(arg) < 6): 124 print "Not enought jobfile record arguments"124 print("Not enough jobfile record arguments") 125 125 return False 126 126 … … 134 134 srcfqname = os.path.join(base, srcfname) 135 135 if (not os.path.isfile(srcfqname)): 136 print "Source %s not found" % srcfqname136 print("Source %s not found" % srcfqname) 137 137 return False 138 138 … … 153 153 154 154 # Run Vcc 155 print " -- %s --" % srcfname155 print(" -- %s --" % srcfname) 156 156 retval = subprocess.Popen([vcc_path, '/pointersize:32', '/newsyntax', cygpath(tmpfqname)]).wait() 157 157 … … 182 182 183 183 if (not os.path.isfile(vcc_path)): 184 print "%s is not a binary." % vcc_path185 print "Please supply the full Cygwin path to Vcc as the second argument."184 print("%s is not a binary." % vcc_path) 185 print("Please supply the full Cygwin path to Vcc as the second argument.") 186 186 return 187 187 … … 189 189 190 190 if (not os.path.isfile(config)): 191 print "%s not found." % config192 print "Please specify the path to HelenOS build tree root as the first argument."191 print("%s not found." % config) 192 print("Please specify the path to HelenOS build tree root as the first argument.") 193 193 return 194 194 195 195 specpath = os.path.join(rootdir, "tools/checkers/vcc.h") 196 196 if (not os.path.isfile(specpath)): 197 print "%s not found." % config197 print("%s not found." % config) 198 198 return 199 199 … … 205 205 if (not vcc(vcc_path, rootdir, job)): 206 206 print 207 print "Failed job: %s" % job207 print("Failed job: %s" % job) 208 208 return 209 209 210 210 print 211 print "All jobs passed"211 print("All jobs passed") 212 212 213 213 if __name__ == '__main__': -
tools/config.py
ra93d79a r8fb1bf82 48 48 "Read saved values from last configuration run" 49 49 50 inf = file(fname, 'r')50 inf = open(fname, 'r') 51 51 52 52 for line in inf: … … 103 103 condval = res.group(3) 104 104 105 if (not defaults.has_key(condname)):105 if (not condname in defaults): 106 106 varval = '' 107 107 else: … … 131 131 "Parse configuration file" 132 132 133 inf = file(fname, 'r')133 inf = open(fname, 'r') 134 134 135 135 name = '' … … 219 219 continue 220 220 221 if (not defaults.has_key(varname)):221 if (not varname in defaults): 222 222 return False 223 223 … … 232 232 233 233 try: 234 version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0]. split(':')234 version = subprocess.Popen(['bzr', 'version-info', '--custom', '--template={clean}:{revno}:{revision_id}'], stdout = subprocess.PIPE).communicate()[0].decode().split(':') 235 235 sys.stderr.write("ok\n") 236 236 except: … … 246 246 revision = None 247 247 248 outmk = file(mkname, 'w')249 outmc = file(mcname, 'w')248 outmk = open(mkname, 'w') 249 outmc = open(mcname, 'w') 250 250 251 251 outmk.write('#########################################\n') … … 263 263 continue 264 264 265 if (not defaults.has_key(varname)):265 if (not varname in defaults): 266 266 default = '' 267 267 else: … … 368 368 # Cancel out all defaults which have to be deduced 369 369 for varname, vartype, name, choices, cond in ask_names: 370 if ((vartype == 'y') and ( defaults.has_key(varname)) and (defaults[varname] == '*')):370 if ((vartype == 'y') and (varname in defaults) and (defaults[varname] == '*')): 371 371 defaults[varname] = None 372 372 … … 385 385 position = cnt 386 386 387 if (not defaults.has_key(varname)):387 if (not varname in defaults): 388 388 default = None 389 389 else: … … 428 428 cnt += 1 429 429 430 if (position >= options):430 if (position != None) and (position >= len(options)): 431 431 position = None 432 432 … … 449 449 450 450 position = None 451 if (not opt2row.has_key(value)):451 if (not value in opt2row): 452 452 raise RuntimeError("Error selecting value: %s" % value) 453 453 454 454 (selname, seltype, name, choices) = opt2row[value] 455 455 456 if (not defaults.has_key(selname)):456 if (not selname in defaults): 457 457 default = None 458 458 else: -
tools/jobfile.py
ra93d79a r8fb1bf82 38 38 def usage(prname): 39 39 "Print usage syntax" 40 print prname + " <JOBFILE> <SOURCE> <TARGET> <TOOL> <CATEGORY> [OPTIONS ...]"40 print(prname + " <JOBFILE> <SOURCE> <TARGET> <TOOL> <CATEGORY> [OPTIONS ...]") 41 41 42 42 def main(): … … 53 53 options = " ".join(sys.argv[6:]) 54 54 55 jobfile = file(jobfname, "a")55 jobfile = open(jobfname, "a") 56 56 fcntl.lockf(jobfile, fcntl.LOCK_EX) 57 57 jobfile.write("{%s},{%s},{%s},{%s},{%s},{%s}\n" % (srcfname, tgtfname, toolname, category, cwd, options)) -
tools/mkfat.py
ra93d79a r8fb1bf82 46 46 return size 47 47 48 return (( (size / alignment) + 1) * alignment)48 return ((size // alignment) + 1) * alignment 49 49 50 50 def subtree_size(root, cluster_size, dirent_size): … … 79 79 first = 0 80 80 81 inf = file(path, "r")81 inf = open(path, "rb") 82 82 rd = 0; 83 83 while (rd < size): … … 92 92 prev = empty_cluster 93 93 94 data = inf.read(cluster_size);94 data = bytes(inf.read(cluster_size)); 95 95 outf.seek(data_start + (empty_cluster - reserved_clusters) * cluster_size) 96 96 outf.write(data) … … 120 120 prev = empty_cluster 121 121 122 data = ''122 data = bytes() 123 123 data_len = 0 124 124 while ((i < length) and (data_len < cluster_size)): … … 343 343 def usage(prname): 344 344 "Print usage syntax" 345 print prname + " <EXTRA_BYTES> <PATH> <IMAGE>"345 print(prname + " <EXTRA_BYTES> <PATH> <IMAGE>") 346 346 347 347 def main(): … … 351 351 352 352 if (not sys.argv[1].isdigit()): 353 print "<EXTRA_BYTES> must be a number"353 print("<EXTRA_BYTES> must be a number") 354 354 return 355 355 … … 358 358 path = os.path.abspath(sys.argv[2]) 359 359 if (not os.path.isdir(path)): 360 print "<PATH> must be a directory"360 print("<PATH> must be a directory") 361 361 return 362 362 … … 370 370 reserved_clusters = 2 371 371 372 # Make sure the filesystem is large enough tfor FAT16372 # Make sure the filesystem is large enough for FAT16 373 373 size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size + extra_bytes 374 while (size / cluster_size < fat16_clusters):374 while (size // cluster_size < fat16_clusters): 375 375 if (cluster_size > sector_size): 376 cluster_size /=2376 cluster_size = cluster_size // 2 377 377 size = subtree_size(path, cluster_size, dirent_size) + reserved_clusters * cluster_size + extra_bytes 378 378 else: … … 381 381 root_size = align_up(root_entries(path) * dirent_size, cluster_size) 382 382 383 fat_size = align_up(align_up(size, cluster_size) / cluster_size * fatent_size, sector_size)384 385 sectors = (cluster_size + fat_count * fat_size + root_size + size) / sector_size383 fat_size = align_up(align_up(size, cluster_size) // cluster_size * fatent_size, sector_size) 384 385 sectors = (cluster_size + fat_count * fat_size + root_size + size) // sector_size 386 386 root_start = cluster_size + fat_count * fat_size 387 387 data_start = root_start + root_size 388 388 389 outf = file(sys.argv[3], "w")389 outf = open(sys.argv[3], "wb") 390 390 391 391 boot_sector = xstruct.create(BOOT_SECTOR) 392 392 boot_sector.jmp = [0xEB, 0x3C, 0x90] 393 boot_sector.oem = "MSDOS5.0"393 boot_sector.oem = b'MSDOS5.0' 394 394 boot_sector.sector = sector_size 395 boot_sector.cluster = cluster_size / sector_size396 boot_sector.reserved = cluster_size / sector_size395 boot_sector.cluster = cluster_size // sector_size 396 boot_sector.reserved = cluster_size // sector_size 397 397 boot_sector.fats = fat_count 398 boot_sector.rootdir = root_size / dirent_size398 boot_sector.rootdir = root_size // dirent_size 399 399 if (sectors <= 65535): 400 400 boot_sector.sectors = sectors … … 402 402 boot_sector.sectors = 0 403 403 boot_sector.descriptor = 0xF8 404 boot_sector.fat_sectors = fat_size / sector_size404 boot_sector.fat_sectors = fat_size // sector_size 405 405 boot_sector.track_sectors = 63 406 406 boot_sector.heads = 6 … … 414 414 boot_sector.extboot_signature = 0x29 415 415 boot_sector.serial = random.randint(0, 0x7fffffff) 416 boot_sector.label = "HELENOS"417 boot_sector.fstype = "FAT16 "416 boot_sector.label = b'HELENOS' 417 boot_sector.fstype = b'FAT16 ' 418 418 boot_sector.boot_signature = [0x55, 0xAA] 419 419 … … 423 423 424 424 # Reserved sectors 425 for i in range(1, cluster_size / sector_size):425 for i in range(1, cluster_size // sector_size): 426 426 outf.write(empty_sector.pack()) 427 427 428 428 # FAT tables 429 429 for i in range(0, fat_count): 430 for j in range(0, fat_size / sector_size):430 for j in range(0, fat_size // sector_size): 431 431 outf.write(empty_sector.pack()) 432 432 433 433 # Root directory 434 for i in range(0, root_size / sector_size):434 for i in range(0, root_size // sector_size): 435 435 outf.write(empty_sector.pack()) 436 436 437 437 # Data 438 for i in range(0, size / sector_size):438 for i in range(0, size // sector_size): 439 439 outf.write(empty_sector.pack()) 440 440 441 fat = array.array('L', [0] * (fat_size / fatent_size))441 fat = array.array('L', [0] * (fat_size // fatent_size)) 442 442 fat[0] = 0xfff8 443 443 fat[1] = 0xffff … … 449 449 for i in range(0, fat_count): 450 450 outf.seek(cluster_size + i * fat_size) 451 for j in range(0, fat_size / fatent_size):451 for j in range(0, fat_size // fatent_size): 452 452 fat_entry.next = fat[j] 453 453 outf.write(fat_entry.pack()) -
tools/mkhord.py
ra93d79a r8fb1bf82 52 52 def usage(prname): 53 53 "Print usage syntax" 54 print prname + " <ALIGNMENT> <FS_IMAGE> <HORD_IMAGE>"54 print(prname + " <ALIGNMENT> <FS_IMAGE> <HORD_IMAGE>") 55 55 56 56 def main(): … … 60 60 61 61 if (not sys.argv[1].isdigit()): 62 print "<ALIGNMENT> must be a number"62 print("<ALIGNMENT> must be a number") 63 63 return 64 64 65 65 align = int(sys.argv[1], 0) 66 66 if (align <= 0): 67 print "<ALIGNMENT> must be positive"67 print("<ALIGNMENT> must be positive") 68 68 return 69 69 70 70 fs_image = os.path.abspath(sys.argv[2]) 71 71 if (not os.path.isfile(fs_image)): 72 print "<FS_IMAGE> must be a file"72 print("<FS_IMAGE> must be a file") 73 73 return 74 74 75 inf = file(fs_image, "rb")76 outf = file(sys.argv[3], "wb")75 inf = open(fs_image, "rb") 76 outf = open(sys.argv[3], "wb") 77 77 78 78 header = xstruct.create(HEADER) -
tools/mktmpfs.py
ra93d79a r8fb1bf82 66 66 def usage(prname): 67 67 "Print usage syntax" 68 print prname + " <PATH> <IMAGE>"68 print(prname + " <PATH> <IMAGE>") 69 69 70 70 def recursion(root, outf): … … 85 85 outf.write(dentry.pack()) 86 86 87 inf = file(canon, "r")87 inf = open(canon, "rb") 88 88 rd = 0; 89 89 while (rd < size): … … 116 116 path = os.path.abspath(sys.argv[1]) 117 117 if (not os.path.isdir(path)): 118 print "<PATH> must be a directory"118 print("<PATH> must be a directory") 119 119 return 120 120 121 outf = file(sys.argv[2], "w")121 outf = open(sys.argv[2], "wb") 122 122 123 123 header = xstruct.create(HEADER) -
tools/mkuimage.py
ra93d79a r8fb1bf82 72 72 start_addr = (int)(optarg, 0) 73 73 else: 74 print base_name + ": Unrecognized option."74 print(base_name + ": Unrecognized option.") 75 75 print_syntax(cmd_name) 76 76 return 77 77 78 78 if len(args) < 2: 79 print base_name + ": Argument missing."79 print(base_name + ": Argument missing.") 80 80 print_syntax(cmd_name) 81 81 return … … 91 91 92 92 def mkuimage(inf_name, outf_name, image_name, load_addr, start_addr): 93 inf = file(inf_name, 'rb')94 outf = file(outf_name, 'wb')93 inf = open(inf_name, 'rb') 94 outf = open(outf_name, 'wb') 95 95 96 96 header = xstruct.create(UIMAGE_HEADER) … … 140 140 signed_crc = zlib.crc32(byteseq, 0) 141 141 if signed_crc < 0: 142 return (long(signed_crc) + 4294967296L) # 2^32L142 return (long(signed_crc) + (long(2) ** long(32))) # 2^32L 143 143 else: 144 144 return signed_crc … … 147 147 # 148 148 def print_syntax(cmd): 149 print "syntax: " + cmd + " [<options>] <raw_image> <uImage>"149 print("syntax: " + cmd + " [<options>] <raw_image> <uImage>") 150 150 print 151 print "\traw_image\tInput image name (raw binary data)"152 print "\tuImage\t\tOutput uImage name (U-Boot image)"151 print("\traw_image\tInput image name (raw binary data)") 152 print("\tuImage\t\tOutput uImage name (U-Boot image)") 153 153 print 154 print "options:"155 print "\t-name <name>\tImage name (default: 'Noname')"156 print "\t-laddr <name>\tLoad address (default: 0x00000000)"157 print "\t-saddr <name>\tStart address (default: 0x00000000)"154 print("options:") 155 print("\t-name <name>\tImage name (default: 'Noname')") 156 print("\t-laddr <name>\tLoad address (default: 0x00000000)") 157 print("\t-saddr <name>\tStart address (default: 0x00000000)") 158 158 159 159 if __name__ == '__main__': -
tools/pack.py
ra93d79a r8fb1bf82 43 43 def usage(prname): 44 44 "Print usage syntax" 45 print "%s <OBJCOPY> <FORMAT> <ARCH> <ARCH_PATH> [COMPONENTS ...]" % prname45 print("%s <OBJCOPY> <FORMAT> <ARCH> <ARCH_PATH> [COMPONENTS ...]" % prname) 46 46 47 47 def deflate(data): … … 110 110 symbol = "_binary_%s" % basename.replace(".", "_") 111 111 112 print "%s -> %s" % (component, obj)112 print("%s -> %s" % (component, obj)) 113 113 114 comp_in = file(component, "rb")115 comp_data = comp_in.read() ;114 comp_in = open(component, "rb") 115 comp_data = comp_in.read() 116 116 comp_in.close() 117 117 … … 121 121 122 122 try: 123 comp_out = file(basename, "wb")123 comp_out = open(basename, "wb") 124 124 comp_out.write(comp_deflate) 125 125 comp_out.close() … … 151 151 cnt += 1 152 152 153 header = file(os.path.join(arch_path, "include", "%s.h" % COMPONENTS), "w")153 header = open(os.path.join(arch_path, "include", "%s.h" % COMPONENTS), "w") 154 154 155 155 header.write('/***************************************\n') … … 173 173 header.close() 174 174 175 data = file(os.path.join(arch_path, "src", "%s.c" % COMPONENTS), "w")175 data = open(os.path.join(arch_path, "src", "%s.c" % COMPONENTS), "w") 176 176 177 177 data.write('/***************************************\n') … … 187 187 data.close() 188 188 189 link_in = file(os.path.join(arch_path, "%s.in" % LINK), "r")189 link_in = open(os.path.join(arch_path, "%s.in" % LINK), "r") 190 190 template = link_in.read() 191 191 link_in.close() 192 192 193 link_out = file(os.path.join(arch_path, "%s.comp" % LINK), "w")193 link_out = open(os.path.join(arch_path, "%s.comp" % LINK), "w") 194 194 link_out.write(template.replace("[[COMPONENTS]]", "\n".join(link_ctx))) 195 195 link_out.close() -
tools/toolchain.sh
ra93d79a r8fb1bf82 62 62 echo " ia32 IA-32 (x86, i386)" 63 63 echo " ia64 IA-64 (Itanium)" 64 echo " mips32 MIPS little-endian" 65 echo " mips32eb MIPS big-endian" 64 echo " mips32 MIPS little-endian 32b" 65 echo " mips32eb MIPS big-endian 32b" 66 echo " mips64 MIPS little-endian 64b" 66 67 echo " ppc32 32-bit PowerPC" 67 68 echo " ppc64 64-bit PowerPC" … … 303 304 build_target "mips32eb" "mips-linux-gnu" 304 305 ;; 306 "mips64") 307 build_target "mips64" "mips64el-linux-gnu" 308 ;; 305 309 "ppc32") 306 310 build_target "ppc32" "ppc-linux-gnu" … … 320 324 build_target "mips32" "mipsel-linux-gnu" 321 325 build_target "mips32eb" "mips-linux-gnu" 326 build_target "mips64" "mips64el-linux-gnu" 322 327 build_target "ppc32" "ppc-linux-gnu" 323 328 build_target "ppc64" "ppc64-linux-gnu"
Note:
See TracChangeset
for help on using the changeset viewer.
