Subversion Repositories freemyipod

Rev

Rev 427 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 427 Rev 524
Line 24... Line 24...
24
import sys
24
import sys
25
import libemcorebootcfg
25
import libemcorebootcfg
26
from optparse import *
26
from optparse import *
27
 
27
 
28
parser = OptionParser("usage: %prog [options] <emcorebin> <emcoreapp> <outfile>")
28
parser = OptionParser("usage: %prog [options] <emcorebin> <emcoreapp> <outfile>")
29
parser.add_option("--run-from", type = "int", metavar = "ADDR",
-
 
30
                  help = "Ensures that the app is executed from memory address ADDR")
-
 
31
parser.add_option("--compressed", action = "store_true", default = False,
-
 
32
                  help = "Specify this if the executable is compressed")
-
 
33
(options, args) = parser.parse_args()
29
(options, args) = parser.parse_args()
34
if len(args) != 3: parser.error("incorrect number of arguments")
30
if len(args) != 3: parser.error("incorrect number of arguments")
35
 
31
 
36
file = open(args[0], "rb")
32
file = open(args[0], "rb")
37
data = file.read()
33
data = file.read()
Line 39... Line 35...
39
 
35
 
40
file = open(args[1], "rb")
36
file = open(args[1], "rb")
41
app = file.read()
37
app = file.read()
42
file.close()
38
file.close()
43
 
39
 
44
config = {"reset": True, "trymmap": True}
-
 
45
config["mmapaddr"] = 0x08000000 + len(data)
-
 
46
config["mmapsize"] = len(app)
-
 
47
if options.compressed: config["mmapcomp"] = True
-
 
48
if options.run_from:
-
 
49
    config["mmapcopy"] = True
-
 
50
    config["mmapdest"] = options.run_from
-
 
51
 
-
 
52
data = libemcorebootcfg.configure(data, **config)
40
data = libemcorebootcfg.configure(data, (1, app, None, None))
53
 
41
 
54
file = open(args[2], "wb")
42
file = open(args[2], "wb")
55
file.write(data + app)
43
file.write(data)
56
file.close()
44
file.close()