7 def create_header(args
, size
):
8 header
= struct
.pack('32s32s32s32s32s',
9 args
.part_name
.encode('ascii'),
10 str(size
).encode('ascii'),
11 args
.part_version
.encode('ascii'),
13 args
.rootfs_version
.encode('ascii'))
17 def create_output(args
):
18 in_st
= os
.stat(args
.input_file
)
19 in_size
= in_st
.st_size
21 header
= create_header(args
, in_size
)
24 in_f
= open(args
.input_file
, 'r+b')
25 in_bytes
= in_f
.read(in_size
)
28 out_f
= open(args
.output_file
, 'w+b')
36 parser
= argparse
.ArgumentParser(description
='')
38 parser
.add_argument('--input-file',
44 parser
.add_argument('--output-file',
50 parser
.add_argument('--part-name',
54 help='Partition Name')
56 parser
.add_argument('--part-version',
60 help='Partition Version')
62 parser
.add_argument('--rootfs-version',
63 dest
='rootfs_version',
66 help='RootFS lib version')
68 args
= parser
.parse_args()
70 if not args
.rootfs_version
:
71 args
.rootfs_version
= ""
73 if ((not args
.input_file
) or
74 (not args
.output_file
) or
75 (not args
.part_name
) or
76 (not args
.part_version
)):