]>
Commit | Line | Data |
---|---|---|
38ac51bd DM |
1 | #!/usr/bin/perl -w |
2 | ||
3 | use strict; | |
4 | use File::Basename; | |
5 | use File::Path; | |
6 | ||
00557136 | 7 | my $fwsrc0 = "linux-2.6-3.10.0/firmware"; |
38ac51bd | 8 | my $fwsrc1 = "linux-firmware.git"; |
00557136 | 9 | my $fwsrc2 = "dvb-firmware.git"; |
38ac51bd DM |
10 | my $fwsrc3 = "firmware-misc"; |
11 | ||
12 | my $fwlist = shift; | |
13 | die "no firmware list specified" if !$fwlist || ! -f $fwlist; | |
14 | ||
15 | my $target = shift; | |
16 | die "no target directory" if !$target || ! -d $target; | |
17 | ||
18 | my $force_skip = { | |
19 | ||
20 | # not needed, the HBA has burned-in firmware | |
21 | 'ql8100_fw.bin' => 1, | |
22 | }; | |
23 | ||
24 | my $skip = {}; | |
25 | # debian squeeze also misses those files | |
26 | foreach my $fw (qw( | |
00557136 DM |
27 | sms1xxx-stellar-dvbt-01.fw |
28 | sms1xxx-nova-b-dvbt-01.fw | |
29 | sms1xxx-nova-a-dvbt-01.fw | |
30 | mrvl/sd8897_uapsta.bin | |
31 | mrvl/pcie8766_uapsta.bin | |
32 | mrvl/sd8786_uapsta.bin | |
33 | cxgb4/t5fw.bin | |
34 | brcm/brcmfmac-sdio.txt | |
35 | brcm/brcmfmac-sdio.bin | |
36 | brcm/brcmfmac43242a.bin | |
37 | brcm/brcmfmac43143.bin | |
38 | ct2fw-3.1.0.0.bin | |
39 | ctfw-3.1.0.0.bin | |
40 | cbfw-3.1.0.0.bin | |
41 | ||
42 | phanfw-4.0.579.bin | |
43 | ||
44 | ||
38ac51bd DM |
45 | libertas/gspi8385.bin libertas/gspi8385_hlp.bin |
46 | ctfw.bin ct2fw.bin ctfw-3.0.3.1.bin ct2fw-3.0.3.1.bin | |
47 | cbfw.bin cbfw-3.0.3.1.bin | |
48 | tehuti/firmware.bin | |
49 | cyzfirm.bin | |
50 | isi4616.bin | |
51 | isi4608.bin | |
52 | isi616em.bin | |
53 | isi608.bin | |
54 | isi608em.bin | |
55 | c320tunx.cod | |
56 | cp204unx.cod | |
57 | c218tunx.cod | |
58 | isight.fw | |
59 | BT3CPCC.bin | |
60 | bfubase.frm | |
61 | solos-db-FPGA.bin | |
62 | solos-Firmware.bin | |
63 | solos-FPGA.bin | |
64 | pca200e_ecd.bin2 | |
65 | prism2_ru.fw | |
66 | tms380tr.bin | |
67 | FW10 | |
68 | FW13 | |
69 | comedi/jr3pci.idm | |
70 | ||
71 | sd8686.bin | |
72 | sd8686_helper.bin | |
73 | usb8388.bin | |
74 | libertas_cs_helper.fw | |
75 | lbtf_usb.bin | |
76 | ||
77 | wl1271-fw.bin | |
78 | wl1251-fw.bin | |
79 | symbol_sp24t_sec_fw | |
80 | symbol_sp24t_prim_fw | |
81 | prism_ap_fw.bin | |
82 | prism_sta_fw.bin | |
83 | ar9170.fw | |
84 | iwmc3200wifi-lmac-sdio.bin | |
85 | iwmc3200wifi-calib-sdio.bin | |
86 | iwmc3200wifi-umac-sdio.bin | |
87 | iwmc3200top.1.fw | |
88 | zd1201.fw | |
89 | zd1201-ap.fw | |
90 | isl3887usb | |
91 | isl3886usb | |
92 | isl3886pci | |
93 | 3826.arm | |
94 | ||
95 | i2400m-fw-sdio-1.3.sbcf | |
96 | ||
97 | nx3fwmn.bin | |
98 | nx3fwct.bin | |
99 | nxromimg.bin | |
100 | ||
101 | myri10ge_rss_eth_z8e.dat | |
102 | myri10ge_rss_ethp_z8e.dat | |
103 | myri10ge_eth_z8e.dat | |
104 | myri10ge_ethp_z8e.dat | |
105 | ||
106 | i1480-phy-0.0.bin | |
107 | i1480-usb-0.0.bin | |
108 | i1480-pre-phy-0.0.bin | |
109 | ||
110 | go7007fw.bin | |
111 | go7007tv.bin | |
112 | ||
113 | sep/resident.image.bin | |
114 | sep/cache.image.bin | |
115 | b43legacy/ucode4.fw | |
116 | b43legacy/ucode2.fw | |
117 | b43/ucode9.fw | |
118 | b43/ucode5.fw | |
119 | b43/ucode15.fw | |
120 | b43/ucode14.fw | |
121 | b43/ucode13.fw | |
122 | b43/ucode11.fw | |
123 | b43/ucode16_mimo.fw | |
124 | orinoco_ezusb_fw | |
125 | isl3890 | |
126 | isl3886 | |
127 | isl3877 | |
128 | mwl8k/fmimage_8366.fw | |
129 | mwl8k/helper_8366.fw | |
130 | mwl8k/fmimage_8363.fw | |
131 | mwl8k/helper_8363.fw | |
132 | iwlwifi-6000g2a-4.ucode | |
133 | iwlwifi-6000g2a-6.ucode | |
134 | iwlwifi-130-5.ucode | |
135 | iwlwifi-100-6.ucode | |
136 | iwlwifi-1000-6.ucode | |
137 | cxgb4/t4fw.bin | |
138 | cxgb4/t4fw-1.3.10.0.bin | |
139 | ||
140 | )) { | |
141 | $skip->{$fw} = 1; | |
142 | } | |
143 | ||
144 | sub copy_fw { | |
145 | my ($src, $dstfw) = @_; | |
146 | ||
147 | my $dest = "$target/$dstfw"; | |
148 | ||
149 | return if -f $dest; | |
150 | ||
151 | mkpath dirname($dest); | |
152 | system ("cp '$src' '$dest'") == 0 || die "copy $src to $dest failed"; | |
153 | } | |
154 | ||
155 | my $fwdone = {}; | |
156 | ||
157 | open(TMP, $fwlist); | |
158 | while(defined(my $line = <TMP>)) { | |
159 | chomp $line; | |
160 | my ($fw, $mod) = split(/\s+/, $line, 2); | |
161 | ||
162 | next if $mod =~ m|^kernel/sound|; | |
163 | next if $mod =~ m|^kernel/drivers/isdn|; | |
164 | ||
165 | # skip ZyDas usb wireless, use package zd1211-firmware instead | |
166 | next if $fw =~ m|^zd1211/|; | |
167 | ||
168 | # skip atmel at76c50x wireless networking chips. | |
169 | # use package atmel-firmware instead | |
170 | next if $fw =~ m|^atmel_at76c50|; | |
171 | ||
172 | # skip Bluetooth dongles based on the Broadcom BCM203x | |
173 | # use package bluez-firmware instead | |
174 | next if $fw =~ m|^BCM2033|; | |
175 | ||
00557136 DM |
176 | next if $fw =~ m|^xc3028-v27\.fw|; # found twice! |
177 | next if $fw =~ m|.inp|; # where are those files? | |
178 | next if $fw =~ m|^ueagle-atm/|; # where are those files? | |
179 | ||
38ac51bd DM |
180 | next if $force_skip->{$fw}; |
181 | ||
182 | next if $fwdone->{$fw}; | |
183 | $fwdone->{$fw} = 1; | |
184 | ||
185 | my $fwdest = $fw; | |
186 | if ($fw eq 'libertas/gspi8686.bin') { | |
187 | $fw = 'libertas/gspi8686_v9.bin'; | |
188 | } | |
189 | if ($fw eq 'libertas/gspi8686_hlp.bin') { | |
190 | $fw = 'libertas/gspi8686_v9_helper.bin'; | |
191 | } | |
192 | ||
193 | if ($fw eq 'PE520.cis') { | |
194 | $fw = 'cis/PE520.cis'; | |
195 | } | |
196 | ||
197 | # the rtl_nic/rtl8168d-1.fw file is buggy in current kernel tree | |
198 | if (-f "$fwsrc0/$fw" && | |
199 | ($fw ne 'rtl_nic/rtl8168d-1.fw')) { | |
200 | copy_fw("$fwsrc0/$fw", $fwdest); | |
201 | next; | |
202 | } | |
203 | if (-f "$fwsrc1/$fw") { | |
204 | copy_fw("$fwsrc1/$fw", $fwdest); | |
205 | next; | |
206 | } | |
207 | if (-f "$fwsrc3/$fw") { | |
208 | copy_fw("$fwsrc3/$fw", $fwdest); | |
209 | next; | |
210 | } | |
211 | ||
212 | if ($fw =~ m|/|) { | |
213 | next if $skip->{$fw}; | |
00557136 | 214 | |
38ac51bd DM |
215 | die "unable to find firmware: $fw $mod\n"; |
216 | } | |
217 | ||
218 | my $name = basename($fw); | |
219 | ||
220 | my $sr = `find '$fwsrc1' -type f -name '$name'`; | |
221 | chomp $sr; | |
222 | if ($sr) { | |
223 | #print "found $fw in $sr\n"; | |
224 | copy_fw($sr, $fwdest); | |
225 | next; | |
226 | } | |
00557136 DM |
227 | |
228 | $sr = `find '$fwsrc2' -type f -name '$name'`; | |
229 | chomp $sr; | |
230 | if ($sr) { | |
231 | print "found $fw in $sr\n"; | |
232 | copy_fw($sr, $fwdest); | |
233 | next; | |
234 | } | |
235 | ||
38ac51bd DM |
236 | $sr = `find '$fwsrc3' -type f -name '$name'`; |
237 | chomp $sr; | |
238 | if ($sr) { | |
239 | #print "found $fw in $sr\n"; | |
240 | copy_fw($sr, $fwdest); | |
241 | next; | |
242 | } | |
243 | ||
244 | next if $skip->{$fw}; | |
00557136 | 245 | next if $fw =~ m|^dvb-|; |
38ac51bd DM |
246 | |
247 | die "unable to find firmware: $fw $mod\n"; | |
248 | } | |
249 | close(TMP); | |
250 | ||
251 | exit(0); |