3 # b43 firmware file squasher
4 # Removes unnecessary firmware files
6 # Copyright (c) 2009 Michael Buesch <mb@bu3sch.de>
8 # Licensed under the GNU/GPL version 2 or (at your option) any later version.
15 print("Usage: %s PHYTYPES COREREVS /path/to/extracted/firmware" % sys
.argv
[0])
17 print("PHYTYPES is a comma separated list of:")
19 print("AG => Dual A-PHY G-PHY")
24 print("COREREVS is a comma separated list of core revision numbers.")
26 if len(sys
.argv
) != 4:
30 phytypes
= sys
.argv
[1]
31 corerevs
= sys
.argv
[2]
34 phytypes
= phytypes
.split(',')
36 corerevs
= map(lambda r
: int(r
), corerevs
.split(','))
38 print("ERROR: \"%s\" is not a valid COREREVS string\n" % corerevs
)
43 fwfiles
= os
.listdir(fwpath
)
44 fwfiles
= filter(lambda str: str.endswith(".fw"), fwfiles
)
46 print("ERROR: No firmware files found in %s" % fwpath
)
51 def revs_match(revs_a
, revs_b
):
57 def phytypes_match(types_a
, types_b
):
59 type = type.strip().upper()
67 "ucode5.fw" : (5,6,7,8,9,10,),
68 "ucode11.fw" : (11,12,),
72 "ucode16_mimo.fw" : (16,),
73 "ucode24_mimo.fw" : (24,),
74 "ucode29_mimo.fw" : (29,),
75 "pcm4.fw" : (1,2,3,4,),
76 "pcm5.fw" : (5,6,7,8,9,10,),
80 "a0g1initvals5.fw" : ( (5,6,7,8,9,10,), ("AG",), ),
81 "a0g0initvals5.fw" : ( (5,6,7,8,9,10,), ("A", "AG",), ),
82 "b0g0initvals2.fw" : ( (2,4,), ("G",), ),
83 "b0g0initvals5.fw" : ( (5,6,7,8,9,10,), ("G",), ),
84 "b0g0initvals13.fw" : ( (13,), ("G",), ),
85 "n0initvals11.fw" : ( (11,12,), ("N",), ),
86 "n0initvals16.fw" : ( (16,), ("N",), ),
87 "lp0initvals13.fw" : ( (13,), ("LP",), ),
88 "lp0initvals14.fw" : ( (14,), ("LP",), ),
89 "lp0initvals15.fw" : ( (15,), ("LP",), ),
90 "a0g1bsinitvals5.fw" : ( (5,6,7,8,9,10,), ("AG",), ),
91 "a0g0bsinitvals5.fw" : ( (5,6,7,8,9,10,), ("A", "AG"), ),
92 "b0g0bsinitvals5.fw" : ( (5,6,7,8,9,10,), ("G",), ),
93 "n0bsinitvals11.fw" : ( (11,12,), ("N",), ),
94 "n0bsinitvals16.fw" : ( (16,), ("N",), ),
95 "lp0bsinitvals13.fw" : ( (13,), ("LP",), ),
96 "lp0bsinitvals14.fw" : ( (14,), ("LP",), ),
97 "lp0bsinitvals15.fw" : ( (15,), ("LP",), ),
98 "lcn0initvals24.fw" : ( (24,), ("LNC",), ),
99 "ht0initvals29.fw" : ( (29,), ("HT",), ),
104 if revs_match(corerevs
, revmapping
[f
]):
105 required_fwfiles
+= [f
]
107 if f
in initvalmapping
:
108 if revs_match(corerevs
, initvalmapping
[f
][0]) and\
109 phytypes_match(phytypes
, initvalmapping
[f
][1]):
110 required_fwfiles
+= [f
]
112 print("WARNING: Firmware file %s not found in the mapping lists" % f
)
115 if f
not in required_fwfiles
:
116 print("Deleting %s" % f
)
117 os
.unlink(fwpath
+ '/' + f
)
This page took 0.052702 seconds and 5 git commands to generate.