]> git.proxmox.com Git - pve-firmware.git/blame - assemble-firmware.pl
buildsys: use dpkg-dev makefile helpers for pkg info
[pve-firmware.git] / assemble-firmware.pl
CommitLineData
7bbca2e6
FG
1#!/usr/bin/perl -w
2
3use strict;
4use File::Basename;
5use File::Path;
6
7my $fwsrc0 = "linux-2.6-3.10.0/firmware";
8my $fwsrc1 = "linux-firmware.git";
9my $fwsrc2 = "dvb-firmware.git";
10my $fwsrc3 = "firmware-misc";
11
12my $fwlist = shift;
13die "no firmware list specified" if !$fwlist || ! -f $fwlist;
14
15my $target = shift;
16die "no target directory" if !$target || ! -d $target;
17
18my $force_skip = {
19
20 # not needed, the HBA has burned-in firmware
21 'ql2600_fw.bin' => 1,
22 'ql2700_fw.bin' => 1,
23 'ql8100_fw.bin' => 1,
24 'ql8300_fw.bin' => 1,
25};
26
27my $skip = {};
28# debian squeeze also misses those files
29foreach my $fw (qw(
11262e92
TL
303826.arm
31BT3CPCC.bin
32FW10
33FW13
34RTL8192U/boot.img
35RTL8192U/data.img
36RTL8192U/main.img
b3bdbd58 37amdgpu/vega20_ta.bin
11262e92
TL
38ar9170.fw
39ast_dp501_fw.bin
11262e92 40ath10k/QCA6174/hw2.1/firmware-4.bin
11262e92 41ath10k/QCA6174/hw3.0/firmware-5.bin
11262e92
TL
42ath10k/QCA9887/hw1.0/board-2.bin
43ath10k/QCA988X/hw2.0/board-2.bin
11262e92
TL
44ath10k/QCA988X/hw2.0/firmware-2.bin
45ath10k/QCA988X/hw2.0/firmware-3.bin
11262e92
TL
46ath10k/QCA988X/hw2.0/firmware.bin
47ath6k/AR6003/hw2.0/bdata.bin
48ath6k/AR6003/hw2.1.1/bdata.bin
49ath6k/AR6004/hw1.0/bdata.DB132.bin
50ath6k/AR6004/hw1.0/bdata.bin
51ath6k/AR6004/hw1.0/fw.ram.bin
52ath6k/AR6004/hw1.1/bdata.DB132.bin
53ath6k/AR6004/hw1.1/bdata.bin
54ath6k/AR6004/hw1.1/fw.ram.bin
55ath6k/AR6004/hw1.2/fw.ram.bin
56ath6k/AR6004/hw1.3/fw.ram.bin
57b43/ucode11.fw
58b43/ucode13.fw
59b43/ucode14.fw
60b43/ucode15.fw
61b43/ucode16_lp.fw
62b43/ucode16_mimo.fw
63b43/ucode24_lcn.fw
64b43/ucode25_lcn.fw
65b43/ucode25_mimo.fw
66b43/ucode26_mimo.fw
67b43/ucode29_mimo.fw
68b43/ucode30_mimo.fw
69b43/ucode33_lcn40.fw
70b43/ucode40.fw
71b43/ucode42.fw
72b43/ucode5.fw
73b43/ucode9.fw
74b43legacy/ucode2.fw
75b43legacy/ucode4.fw
76bfubase.frm
7bbca2e6 77brcm/brcmfmac-sdio.bin
11262e92 78brcm/brcmfmac-sdio.txt
b3bdbd58 79brcm/brcmfmac43012-sdio.bin
11262e92 80brcm/brcmfmac43143-sdio.txt
7bbca2e6 81brcm/brcmfmac43241b0-sdio.txt
11262e92
TL
82brcm/brcmfmac43241b4-sdio.txt
83brcm/brcmfmac43241b5-sdio.txt
11262e92
TL
84brcm/brcmfmac4329-sdio.txt
85brcm/brcmfmac4330-sdio.txt
86brcm/brcmfmac4334-sdio.txt
87brcm/brcmfmac43340-sdio.txt
88brcm/brcmfmac4335-sdio.txt
89brcm/brcmfmac43362-sdio.txt
11262e92 90brcm/brcmfmac4339-sdio.txt
11262e92 91brcm/brcmfmac43430-sdio.txt
11262e92
TL
92brcm/brcmfmac43455-sdio.txt
93brcm/brcmfmac4350-pcie.txt
94brcm/brcmfmac4354-pcie.bin
95brcm/brcmfmac4354-pcie.txt
96brcm/brcmfmac4354-sdio.txt
7bbca2e6 97brcm/brcmfmac4356-pcie.txt
11262e92 98brcm/brcmfmac43570-pcie.txt
11262e92
TL
99brcm/brcmfmac4358-pcie.txt
100brcm/brcmfmac4359-pcie.bin
101brcm/brcmfmac43602-pcie.txt
102brcm/brcmfmac4365b-pcie.bin
103brcm/brcmfmac4365b-pcie.txt
104brcm/brcmfmac4365c-pcie.bin
105brcm/brcmfmac4366b-pcie.txt
11262e92
TL
106brcm/brcmfmac4371-pcie.txt
107c218tunx.cod
108c320tunx.cod
433982b1
TL
109cbfw-3.0.3.1.bin
110cbfw.bin
11262e92
TL
111comedi/jr3pci.idm
112cp204unx.cod
433982b1
TL
113ct2fw-3.0.3.1.bin
114ct2fw.bin
115ctfw-3.0.3.1.bin
116ctfw.bin
11262e92 117cxgb4/t4fw-1.3.10.0.bin
7bbca2e6 118cyzfirm.bin
11262e92
TL
119daqboard2000_firmware.bin
120fw.ram.bin
11262e92
TL
121i1480-phy-0.0.bin
122i1480-pre-phy-0.0.bin
123i1480-usb-0.0.bin
124i2400m-fw-sdio-1.3.sbcf
7bbca2e6 125isi4608.bin
11262e92 126isi4616.bin
7bbca2e6
FG
127isi608.bin
128isi608em.bin
11262e92 129isi616em.bin
7bbca2e6 130isight.fw
7bbca2e6 131isl3886pci
11262e92
TL
132isl3886usb
133isl3887usb
7bbca2e6
FG
134iwlwifi-100-6.ucode
135iwlwifi-1000-6.ucode
11262e92 136iwlwifi-130-5.ucode
11262e92
TL
137iwlwifi-3165-10.ucode
138iwlwifi-3168-26.ucode
139iwlwifi-6000-6.ucode
b3bdbd58 140iwlwifi-6000g2b-IWL6000G2B_UCODE_API_MAX.ucode
11262e92
TL
141iwlwifi-7265D-26.ucode
142iwlwifi-8000-10.ucode
143iwlwifi-8000-12.ucode
144iwlwifi-8000-13.ucode
7bbca2e6 145iwlwifi-8000-8.ucode
11262e92
TL
146iwlwifi-8000C-26.ucode
147iwlwifi-8000C-33.ucode
148iwlwifi-8265-26.ucode
149iwlwifi-8265-33.ucode
150iwlwifi-9000-pu-a0-jf-a0--26.ucode
151iwlwifi-9000-pu-a0-jf-a0--33.ucode
152iwlwifi-9000-pu-a0-jf-a0-34.ucode
b3bdbd58 153iwlwifi-9000-pu-a0-jf-a0-43.ucode
11262e92
TL
154iwlwifi-9000-pu-a0-jf-b0--33.ucode
155iwlwifi-9000-pu-a0-jf-b0-34.ucode
b3bdbd58 156iwlwifi-9000-pu-a0-jf-b0-43.ucode
11262e92
TL
157iwlwifi-9000-pu-a0-lc-a0--26.ucode
158iwlwifi-9260-th-a0-jf-a0--26.ucode
159iwlwifi-9260-th-a0-jf-a0--33.ucode
160iwlwifi-9260-th-a0-jf-a0-34.ucode
b3bdbd58 161iwlwifi-9260-th-a0-jf-a0-43.ucode
11262e92
TL
162iwlwifi-9260-th-b0-jf-b0--33.ucode
163iwlwifi-Qu-a0-hr-a0--33.ucode
164iwlwifi-Qu-a0-hr-a0-34.ucode
b3bdbd58 165iwlwifi-Qu-a0-hr-a0-43.ucode
11262e92
TL
166iwlwifi-Qu-a0-jf-b0--26.ucode
167iwlwifi-Qu-a0-jf-b0--33.ucode
168iwlwifi-Qu-a0-jf-b0-34.ucode
b3bdbd58
TL
169iwlwifi-Qu-a0-jf-b0-43.ucode
170iwlwifi-Qu-b0-hr-b0-43.ucode
171iwlwifi-Qu-b0-jf-b0-43.ucode
11262e92 172iwlwifi-QuQnj-a0-hr-a0-34.ucode
b3bdbd58 173iwlwifi-QuQnj-a0-hr-a0-43.ucode
11262e92 174iwlwifi-QuQnj-a0-jf-b0-34.ucode
b3bdbd58
TL
175iwlwifi-QuQnj-a0-jf-b0-43.ucode
176iwlwifi-QuQnj-b0-hr-b0-43.ucode
11262e92 177iwlwifi-QuQnj-f0-hr-a0-34.ucode
b3bdbd58
TL
178iwlwifi-QuQnj-f0-hr-a0-43.ucode
179iwlwifi-su-z0-43.ucode
11262e92
TL
180iwmc3200wifi-calib-sdio.bin
181iwmc3200wifi-lmac-sdio.bin
182iwmc3200wifi-umac-sdio.bin
183ks7010sd.rom
b3bdbd58
TL
184lantiq/xrx200_phy11g_a14.bin
185lantiq/xrx200_phy11g_a22.bin
186lantiq/xrx200_phy22f_a14.bin
187lantiq/xrx200_phy22f_a22.bin
188lantiq/xrx300_phy11g_a21.bin
189lantiq/xrx300_phy22f_a21.bin
11262e92 190lattice-ecp3.bit
11262e92 191libertas/cf8305.bin
433982b1 192libertas/gspi8385.bin
11262e92 193libertas/gspi8385_helper.bin
433982b1 194libertas/gspi8385_hlp.bin
11262e92
TL
195libertas/usb8388.bin
196libertas_cs.fw
197libertas_cs_helper.fw
198liquidio/lio_210nv.bin
199liquidio/lio_210sv.bin
200liquidio/lio_23xx.bin
201liquidio/lio_410nv.bin
7bbca2e6
FG
202me2600_firmware.bin
203me4000_firmware.bin
11262e92
TL
204mrvl/pcie8766_uapsta.bin
205mrvl/pcie8997_uapsta.bin
206mrvl/sd8786_uapsta.bin
11262e92 207mrvl/sd8997_uapsta.bin
11262e92 208mrvl/usb8997_uapsta.bin
11262e92 209mwl8k/fmimage_8363.fw
11262e92 210mwl8k/helper_8363.fw
11262e92
TL
211ni6534a.bin
212niscrb01.bin
213niscrb02.bin
214nx3fwct.bin
215nx3fwmn.bin
216nxromimg.bin
217orinoco_ezusb_fw
218pca200e_ecd.bin2
219phanfw-4.0.579.bin
220prism2_ru.fw
221prism_ap_fw.bin
222prism_sta_fw.bin
b3bdbd58
TL
223rtl_bt/rtl8723b_config.bin
224rtl_bt/rtl8723bs_config.bin
225rtl_bt/rtl8723ds_config.bin
226rtl_bt/rtl8723ds_fw.bin
227rtl_bt/rtl8761a_config.bin
228rtl_bt/rtl8821a_config.bin
7bbca2e6 229rtlwifi/rtl8723bu_bt.bin
11262e92
TL
230rtlwifi/rtl8723efw.bin
231sd8686.bin
232sd8686_helper.bin
11262e92
TL
233softing-4.6/bcard.bin
234softing-4.6/bcard2.bin
235softing-4.6/cancard.bin
236softing-4.6/cancrd2.bin
237softing-4.6/cansja.bin
238softing-4.6/ldcard.bin
239softing-4.6/ldcard2.bin
240solos-FPGA.bin
241solos-Firmware.bin
242solos-db-FPGA.bin
243symbol_sp24t_prim_fw
244symbol_sp24t_sec_fw
245tehuti/firmware.bin
246ti-connectivity/wl18xx-conf.bin
247tms380tr.bin
248usb8388.bin
249wd719x-risc.bin
250wd719x-wcs.bin
faefccd2 251wil6210_sparrow_plus.fw
b3bdbd58
TL
252wil6436.brd
253wil6436.fw
11262e92
TL
254wlan/prima/WCNSS_qcom_wlan_nv.bin
255zd1201-ap.fw
256zd1201.fw
7bbca2e6
FG
257)) {
258 $skip->{$fw} = 1;
259}
260
261sub copy_fw {
262 my ($src, $dstfw) = @_;
263
264 my $dest = "$target/$dstfw";
265
266 return if -f $dest;
267
268 mkpath dirname($dest);
269 system ("cp '$src' '$dest'") == 0 || die "copy $src to $dest failed";
270}
271
272my $fwdone = {};
273
6bc6bdcb
FG
274my $error = 0;
275
7bbca2e6
FG
276open(TMP, $fwlist);
277while(defined(my $line = <TMP>)) {
278 chomp $line;
279 my ($fw, $mod) = split(/\s+/, $line, 2);
280
281 next if $mod =~ m|^kernel/sound|;
282 next if $mod =~ m|^kernel/drivers/isdn|;
283
284 # skip ZyDas usb wireless, use package zd1211-firmware instead
285 next if $fw =~ m|^zd1211/|;
286
287 # skip atmel at76c50x wireless networking chips.
288 # use package atmel-firmware instead
289 next if $fw =~ m|^atmel_at76c50|;
290
291 # skip Bluetooth dongles based on the Broadcom BCM203x
292 # use package bluez-firmware instead
293 next if $fw =~ m|^BCM2033|;
294
295 next if $fw =~ m|^xc3028-v27\.fw|; # found twice!
296 next if $fw =~ m|.inp|; # where are those files?
297 next if $fw =~ m|^ueagle-atm/|; # where are those files?
298
299 next if $force_skip->{$fw};
300
301 next if $fwdone->{$fw};
302 $fwdone->{$fw} = 1;
303
304 my $fwdest = $fw;
305 if ($fw eq 'libertas/gspi8686.bin') {
306 $fw = 'libertas/gspi8686_v9.bin';
307 }
308 if ($fw eq 'libertas/gspi8686_hlp.bin') {
309 $fw = 'libertas/gspi8686_v9_helper.bin';
310 }
311
312 if ($fw eq 'PE520.cis') {
313 $fw = 'cis/PE520.cis';
314 }
315
316 # the rtl_nic/rtl8168d-1.fw file is buggy in current kernel tree
317 if (-f "$fwsrc0/$fw" &&
318 ($fw ne 'rtl_nic/rtl8168d-1.fw')) {
319 copy_fw("$fwsrc0/$fw", $fwdest);
320 next;
321 }
322 if (-f "$fwsrc1/$fw") {
323 copy_fw("$fwsrc1/$fw", $fwdest);
324 next;
325 }
326 if (-f "$fwsrc3/$fw") {
327 copy_fw("$fwsrc3/$fw", $fwdest);
328 next;
329 }
330
331 if ($fw =~ m|/|) {
332 next if $skip->{$fw};
333
6bc6bdcb
FG
334 warn "unable to find firmware: $fw $mod\n";
335 $error++;
336 next;
7bbca2e6
FG
337 }
338
339 my $name = basename($fw);
340
341 my $sr = `find '$fwsrc1' -type f -name '$name'`;
342 chomp $sr;
343 if ($sr) {
33e03db5 344 print "found $fw in $sr\n";
7bbca2e6
FG
345 copy_fw($sr, $fwdest);
346 next;
347 }
348
349 $sr = `find '$fwsrc2' -type f -name '$name'`;
350 chomp $sr;
351 if ($sr) {
352 print "found $fw in $sr\n";
353 copy_fw($sr, $fwdest);
354 next;
355 }
356
357 $sr = `find '$fwsrc3' -type f -name '$name'`;
358 chomp $sr;
359 if ($sr) {
33e03db5 360 print "found $fw in $sr\n";
7bbca2e6
FG
361 copy_fw($sr, $fwdest);
362 next;
363 }
364
365 next if $skip->{$fw};
366 next if $fw =~ m|^dvb-|;
367
6bc6bdcb
FG
368 warn "unable to find firmware: $fw $mod\n";
369 $error++;
370 next;
7bbca2e6
FG
371}
372close(TMP);
373
6bc6bdcb 374exit($error);