]>
Commit | Line | Data |
---|---|---|
1cfff965 DM |
1 | #!/usr/bin/perl -w |
2 | ||
3 | use strict; | |
4 | use File::Basename; | |
5 | use File::Path; | |
6 | ||
7 | my $fwsrc0 = "linux-2.6-2.6.32/firmware"; | |
8 | my $fwsrc1 = "linux-firmware.git"; | |
9 | my $fwsrc2 = "linux-firmware-from-kernel.git"; | |
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( | |
27 | libertas/gspi8385.bin libertas/gspi8385_hlp.bin | |
28 | cbfw.bin ctfw.bin | |
29 | tehuti/firmware.bin | |
30 | cyzfirm.bin | |
31 | isi4616.bin | |
32 | isi4608.bin | |
33 | isi616em.bin | |
34 | isi608.bin | |
35 | isi608em.bin | |
36 | c320tunx.cod | |
37 | cp204unx.cod | |
38 | c218tunx.cod | |
39 | isight.fw | |
40 | BT3CPCC.bin | |
41 | bfubase.frm | |
42 | solos-db-FPGA.bin | |
43 | solos-Firmware.bin | |
44 | solos-FPGA.bin | |
45 | pca200e_ecd.bin2 | |
46 | prism2_ru.fw | |
47 | tms380tr.bin | |
48 | FW10 | |
49 | FW13 | |
50 | comedi/jr3pci.idm | |
51 | ||
52 | sd8686.bin | |
53 | sd8686_helper.bin | |
54 | usb8388.bin | |
55 | libertas_cs_helper.fw | |
56 | lbtf_usb.bin | |
57 | ||
58 | wl1271-fw.bin | |
59 | wl1251-fw.bin | |
60 | symbol_sp24t_sec_fw | |
61 | symbol_sp24t_prim_fw | |
62 | prism_ap_fw.bin | |
63 | prism_sta_fw.bin | |
64 | ar9170.fw | |
65 | iwmc3200wifi-lmac-sdio.bin | |
66 | iwmc3200wifi-calib-sdio.bin | |
67 | iwmc3200wifi-umac-sdio.bin | |
68 | iwmc3200top.1.fw | |
69 | zd1201.fw | |
70 | zd1201-ap.fw | |
71 | isl3887usb | |
72 | isl3886usb | |
73 | isl3886pci | |
74 | 3826.arm | |
75 | ||
76 | rtl8168d-1.fw | |
77 | rtl8168d-2.fw | |
78 | ||
79 | i2400m-fw-sdio-1.3.sbcf | |
80 | ||
81 | nx3fwmn.bin | |
82 | nx3fwct.bin | |
83 | nxromimg.bin | |
84 | ||
85 | myri10ge_rss_eth_z8e.dat | |
86 | myri10ge_rss_ethp_z8e.dat | |
87 | myri10ge_eth_z8e.dat | |
88 | myri10ge_ethp_z8e.dat | |
89 | ||
90 | i1480-phy-0.0.bin | |
91 | i1480-usb-0.0.bin | |
92 | i1480-pre-phy-0.0.bin | |
93 | ||
94 | go7007fw.bin | |
95 | go7007tv.bin | |
96 | ||
97 | sep/resident.image.bin | |
98 | sep/cache.image.bin | |
99 | b43legacy/ucode4.fw | |
100 | b43legacy/ucode2.fw | |
101 | b43/ucode9.fw | |
102 | b43/ucode5.fw | |
103 | b43/ucode15.fw | |
104 | b43/ucode14.fw | |
105 | b43/ucode13.fw | |
106 | b43/ucode11.fw | |
107 | orinoco_ezusb_fw | |
108 | isl3890 | |
109 | isl3886 | |
110 | isl3877 | |
111 | mwl8k/fmimage_8366.fw | |
112 | mwl8k/helper_8366.fw | |
113 | mwl8k/fmimage_8363.fw | |
114 | mwl8k/helper_8363.fw | |
115 | iwlwifi-6000g2a-4.ucode | |
116 | iwlwifi-130-5.ucode | |
117 | cxgb4/t4fw.bin | |
118 | ||
119 | )) { | |
120 | $skip->{$fw} = 1; | |
121 | } | |
122 | ||
123 | sub copy_fw { | |
124 | my ($src, $dstfw) = @_; | |
125 | ||
126 | my $dest = "$target/$dstfw"; | |
127 | ||
128 | return if -f $dest; | |
129 | ||
130 | mkpath dirname($dest); | |
131 | system ("cp '$src' '$dest'") == 0 || die "copy $src to $dest failed"; | |
132 | } | |
133 | ||
134 | my $fwdone = {}; | |
135 | ||
136 | open(TMP, $fwlist); | |
137 | while(defined(my $line = <TMP>)) { | |
138 | chomp $line; | |
139 | my ($fw, $mod) = split(/\s+/, $line, 2); | |
140 | ||
141 | next if $mod =~ m|^kernel/sound|; | |
142 | next if $mod =~ m|^kernel/drivers/isdn|; | |
143 | ||
144 | # skip ZyDas usb wireless, use package zd1211-firmware instead | |
145 | next if $fw =~ m|^zd1211/|; | |
146 | ||
147 | # skip atmel at76c50x wireless networking chips. | |
148 | # use package atmel-firmware instead | |
149 | next if $fw =~ m|^atmel_at76c50|; | |
150 | ||
151 | # skip Bluetooth dongles based on the Broadcom BCM203x | |
152 | # use package bluez-firmware instead | |
153 | next if $fw =~ m|^BCM2033|; | |
154 | ||
155 | next if $force_skip->{$fw}; | |
156 | ||
157 | next if $fwdone->{$fw}; | |
158 | $fwdone->{$fw} = 1; | |
159 | ||
160 | my $fwdest = $fw; | |
161 | if ($fw eq 'libertas/gspi8686.bin') { | |
162 | $fw = 'libertas/gspi8686_v9.bin'; | |
163 | } | |
164 | if ($fw eq 'libertas/gspi8686_hlp.bin') { | |
165 | $fw = 'libertas/gspi8686_v9_helper.bin'; | |
166 | } | |
167 | ||
168 | if ($fw eq 'PE520.cis') { | |
169 | $fw = 'cis/PE520.cis'; | |
170 | } | |
171 | ||
172 | if (-f "$fwsrc0/$fw") { | |
173 | copy_fw("$fwsrc0/$fw", $fwdest); | |
174 | next; | |
175 | } | |
176 | if (-f "$fwsrc1/$fw") { | |
177 | copy_fw("$fwsrc1/$fw", $fwdest); | |
178 | next; | |
179 | } | |
180 | if (-f "$fwsrc2/$fw") { | |
181 | copy_fw("$fwsrc2/$fw", $fwdest); | |
182 | next; | |
183 | } | |
184 | if (-f "$fwsrc3/$fw") { | |
185 | copy_fw("$fwsrc3/$fw", $fwdest); | |
186 | next; | |
187 | } | |
188 | ||
189 | if ($fw =~ m|/|) { | |
190 | next if $skip->{$fw}; | |
191 | die "unable to find firmware: $fw $mod\n"; | |
192 | } | |
193 | ||
194 | my $name = basename($fw); | |
195 | ||
196 | my $sr = `find '$fwsrc1' -name '$name'`; | |
197 | chomp $sr; | |
198 | if ($sr) { | |
199 | #print "found $fw in $sr\n"; | |
200 | copy_fw($sr, $fwdest); | |
201 | next; | |
202 | } | |
203 | $sr = `find '$fwsrc2' -name '$name'`; | |
204 | chomp $sr; | |
205 | if ($sr) { | |
206 | #print "found $fw in $sr\n"; | |
207 | copy_fw($sr, $fwdest); | |
208 | next; | |
209 | } | |
210 | $sr = `find '$fwsrc3' -name '$name'`; | |
211 | chomp $sr; | |
212 | if ($sr) { | |
213 | #print "found $fw in $sr\n"; | |
214 | copy_fw($sr, $fwdest); | |
215 | next; | |
216 | } | |
217 | ||
218 | next if $skip->{$fw}; | |
219 | ||
220 | die "unable to find firmware: $fw $mod\n"; | |
221 | } | |
222 | close(TMP); | |
223 | ||
224 | exit(0); |