10 def create_header(args
, size
):
11 header
= struct
.pack('>III', args
.entry_addr
, args
.load_addr
, size
)
14 def create_output(args
):
15 in_st
= os
.stat(args
.input_file
)
16 in_size
= in_st
.st_size
18 header
= create_header(args
, in_size
)
21 in_f
= open(args
.input_file
, 'r+b')
22 in_bytes
= in_f
.read(in_size
)
25 out_f
= open(args
.output_file
, 'w+b')
33 parser
= argparse
.ArgumentParser(description
='')
35 parser
.add_argument('--entry-addr',
41 parser
.add_argument('--input-file',
47 parser
.add_argument('--load-addr',
53 parser
.add_argument('--output-file',
59 args
= parser
.parse_args()
61 if (not args
.input_file
) or (not args
.output_file
):
64 if not args
.entry_addr
:
65 args
.entry_addr
= 0x80010000
67 if not args
.load_addr
:
68 args
.load_addr
= 0x80010000