14 CRC32: Ethernet (Poly 0x04C11DB7)
17 0x00005700: Any version
18 0x00005731: NAND 1MB data partition
19 0x00005732: Normal version
39 0x00000002: Secure BootROM
52 def create_tag(args
, in_bytes
):
53 # JAM CRC32 is bitwise not and unsigned
54 crc
= (~binascii
.crc32(in_bytes
) & 0xFFFFFFFF)
55 tag
= struct
.pack('>IIIII', crc
, args
.tag_version
, args
.chip_id
, args
.flash_type
, args
.flags
)
58 def create_output(args
):
59 in_st
= os
.stat(args
.input_file
)
60 in_size
= in_st
.st_size
62 in_f
= open(args
.input_file
, 'r+b')
63 in_bytes
= in_f
.read(in_size
)
66 tag
= create_tag(args
, in_bytes
)
68 out_f
= open(args
.output_file
, 'w+b')
76 parser
= argparse
.ArgumentParser(description
='')
78 parser
.add_argument('--input-file',
84 parser
.add_argument('--output-file',
90 parser
.add_argument('--version',
94 help='WFI Tag Version')
96 parser
.add_argument('--chip-id',
102 parser
.add_argument('--flash-type',
106 help='WFI Flash Type')
108 parser
.add_argument('--flags',
114 args
= parser
.parse_args()
119 if ((not args
.input_file
) or
120 (not args
.output_file
) or
121 (not args
.tag_version
) or
122 (not args
.chip_id
) or
123 (not args
.flash_type
)):