2 # DVB firmware extractor
4 # (c) 2004 Andrew de Quincey
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 use File
::Temp qw
/ tempdir /;
24 @components = ( "sp8870", "sp887x", "tda10045", "tda10046",
25 "tda10046lifeview", "av7110", "dec2000t", "dec2540t",
26 "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004",
27 "or51211", "or51132_qam", "or51132_vsb", "bluebird");
30 syntax
() if (scalar(@ARGV) != 1);
34 for ($i=0; $i < scalar(@components); $i++) {
35 if ($cid eq $components[$i]) {
36 $outfile = eval($cid);
39 Firmware $outfile extracted successfully.
40 Now copy it to either /usr/lib/hotplug/firmware or /lib/firmware
41 (depending on configuration of firmware hotplug).
47 # If we get here, it wasn't found
48 print STDERR
"Unknown component \"$cid\"\n";
54 # ---------------------------------------------------------------
55 # Firmware-specific extraction subroutines
58 my $sourcefile = "tt_Premium_217g.zip";
59 my $url = "http://www.technotrend.de/new/217g/$sourcefile";
60 my $hash = "53970ec17a538945a6d8cb608a7b3899";
61 my $outfile = "dvb-fe-sp8870.fw";
62 my $tmpdir = tempdir
(DIR
=> "/tmp", CLEANUP
=> 1);
66 wgetfile
($sourcefile, $url);
67 unzip
($sourcefile, $tmpdir);
68 verify
("$tmpdir/software/OEM/HE/App/boot/SC_MAIN.MC", $hash);
69 copy
("$tmpdir/software/OEM/HE/App/boot/SC_MAIN.MC", $outfile);
75 my $sourcefile = "Dvbt1.3.57.6.zip";
76 my $url = "http://www.avermedia.com/software/$sourcefile";
77 my $cabfile = "DVBT Net Ver1.3.57.6/disk1/data1.cab";
78 my $hash = "237938d53a7f834c05c42b894ca68ac3";
79 my $outfile = "dvb-fe-sp887x.fw";
80 my $tmpdir = tempdir
(DIR
=> "/tmp", CLEANUP
=> 1);
85 wgetfile
($sourcefile, $url);
86 unzip
($sourcefile, $tmpdir);
87 unshield
("$tmpdir/$cabfile", $tmpdir);
88 verify
("$tmpdir/ZEnglish/sc_main.mc", $hash);
89 copy
("$tmpdir/ZEnglish/sc_main.mc", $outfile);
95 my $sourcefile = "tt_budget_217g.zip";
96 my $url = "http://www.technotrend.de/new/217g/$sourcefile";
97 my $hash = "2105fd5bf37842fbcdfa4bfd58f3594a";
98 my $outfile = "dvb-fe-tda10045.fw";
99 my $tmpdir = tempdir
(DIR
=> "/tmp", CLEANUP
=> 1);
103 wgetfile
($sourcefile, $url);
104 unzip
($sourcefile, $tmpdir);
105 extract
("$tmpdir/software/OEM/PCI/App/ttlcdacc.dll", 0x37ef9, 30555, "$tmpdir/fwtmp");
106 verify
("$tmpdir/fwtmp", $hash);
107 copy
("$tmpdir/fwtmp", $outfile);
113 my $sourcefile = "tt_budget_217g.zip";
114 my $url = "http://www.technotrend.de/new/217g/$sourcefile";
115 my $hash = "6a7e1e2f2644b162ff0502367553c72d";
116 my $outfile = "dvb-fe-tda10046.fw";
117 my $tmpdir = tempdir
(DIR
=> "/tmp", CLEANUP
=> 1);
121 wgetfile
($sourcefile, $url);
122 unzip
($sourcefile, $tmpdir);
123 extract
("$tmpdir/software/OEM/PCI/App/ttlcdacc.dll", 0x3f731, 24478, "$tmpdir/fwtmp");
124 verify
("$tmpdir/fwtmp", $hash);
125 copy
("$tmpdir/fwtmp", $outfile);
130 sub tda10046lifeview
{
131 my $sourcefile = "Drv_2.11.02.zip";
132 my $url = "http://www.lifeview.com.tw/drivers/pci_card/FlyDVB-T/$sourcefile";
133 my $hash = "1ea24dee4eea8fe971686981f34fd2e0";
134 my $outfile = "dvb-fe-tda10046.fw";
135 my $tmpdir = tempdir
(DIR
=> "/tmp", CLEANUP
=> 1);
139 wgetfile
($sourcefile, $url);
140 unzip
($sourcefile, $tmpdir);
141 extract
("$tmpdir/LVHybrid.sys", 0x8b088, 24602, "$tmpdir/fwtmp");
142 verify
("$tmpdir/fwtmp", $hash);
143 copy
("$tmpdir/fwtmp", $outfile);
149 my $sourcefile = "dvb-ttpci-01.fw-261d";
150 my $url = "http://www.linuxtv.org/downloads/firmware/$sourcefile";
151 my $hash = "603431b6259715a8e88f376a53b64e2f";
152 my $outfile = "dvb-ttpci-01.fw";
156 wgetfile
($sourcefile, $url);
157 verify
($sourcefile, $hash);
158 copy
($sourcefile, $outfile);
164 my $sourcefile = "dec217g.exe";
165 my $url = "http://hauppauge.lightpath.net/de/$sourcefile";
166 my $hash = "bd86f458cee4a8f0a8ce2d20c66215a9";
167 my $outfile = "dvb-ttusb-dec-2000t.fw";
168 my $tmpdir = tempdir
(DIR
=> "/tmp", CLEANUP
=> 1);
172 wgetfile
($sourcefile, $url);
173 unzip
($sourcefile, $tmpdir);
174 verify
("$tmpdir/software/OEM/STB/App/Boot/STB_PC_T.bin", $hash);
175 copy
("$tmpdir/software/OEM/STB/App/Boot/STB_PC_T.bin", $outfile);
181 my $sourcefile = "dec217g.exe";
182 my $url = "http://hauppauge.lightpath.net/de/$sourcefile";
183 my $hash = "53e58f4f5b5c2930beee74a7681fed92";
184 my $outfile = "dvb-ttusb-dec-2540t.fw";
185 my $tmpdir = tempdir
(DIR
=> "/tmp", CLEANUP
=> 1);
189 wgetfile
($sourcefile, $url);
190 unzip
($sourcefile, $tmpdir);
191 verify
("$tmpdir/software/OEM/STB/App/Boot/STB_PC_X.bin", $hash);
192 copy
("$tmpdir/software/OEM/STB/App/Boot/STB_PC_X.bin", $outfile);
198 my $sourcefile = "dec217g.exe";
199 my $url = "http://hauppauge.lightpath.net/de/$sourcefile";
200 my $hash = "b013ececea83f4d6d8d2a29ac7c1b448";
201 my $outfile = "dvb-ttusb-dec-3000s.fw";
202 my $tmpdir = tempdir
(DIR
=> "/tmp", CLEANUP
=> 1);
206 wgetfile
($sourcefile, $url);
207 unzip
($sourcefile, $tmpdir);
208 verify
("$tmpdir/software/OEM/STB/App/Boot/STB_PC_S.bin", $hash);
209 copy
("$tmpdir/software/OEM/STB/App/Boot/STB_PC_S.bin", $outfile);
215 my $sourcefile = "2.422.zip";
216 my $url = "http://www.twinhan.com/files/driver/USB-Ter/$sourcefile";
217 my $hash = "e88c9372d1f66609a3e7b072c53fbcfe";
218 my $outfile = "dvb-vp7041-2.422.fw";
219 my $tmpdir = tempdir
(DIR
=> "/tmp", CLEANUP
=> 1);
223 wgetfile
($sourcefile, $url);
224 unzip
($sourcefile, $tmpdir);
225 extract
("$tmpdir/VisionDTV/Drivers/Win2K&XP/UDTTload.sys", 12503, 3036, "$tmpdir/fwtmp1");
226 extract
("$tmpdir/VisionDTV/Drivers/Win2K&XP/UDTTload.sys", 2207, 10274, "$tmpdir/fwtmp2");
228 my $CMD = "\000\001\000\222\177\000";
229 my $PAD = "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000";
231 open $FW, ">$tmpdir/fwtmp3";
232 print $FW "$CMD\001$PAD";
233 print $FW "$CMD\001$PAD";
234 appendfile
($FW, "$tmpdir/fwtmp1");
235 print $FW "$CMD\000$PAD";
236 print $FW "$CMD\001$PAD";
237 appendfile
($FW, "$tmpdir/fwtmp2");
238 print $FW "$CMD\001$PAD";
239 print $FW "$CMD\000$PAD";
242 verify
("$tmpdir/fwtmp3", $hash);
243 copy
("$tmpdir/fwtmp3", $outfile);
249 my $url = "http://www.linuxtv.org/downloads/firmware/dvb-usb-dibusb-5.0.0.11.fw";
250 my $outfile = "dvb-dibusb-5.0.0.11.fw";
251 my $hash = "fa490295a527360ca16dcdf3224ca243";
255 wgetfile
($outfile, $url);
256 verify
($outfile,$hash);
262 my $sourcefile = "Technisat_DVB-PC_4_4_COMPACT.zip";
263 my $url = "http://www.bbti.us/download/windows/$sourcefile";
264 my $hash = "476befae8c7c1bb9648954060b1eec1f";
265 my $outfile = "dvb-fe-nxt2002.fw";
266 my $tmpdir = tempdir
(DIR
=> "/tmp", CLEANUP
=> 1);
270 wgetfile
($sourcefile, $url);
271 unzip
($sourcefile, $tmpdir);
272 verify
("$tmpdir/SkyNET.sys", $hash);
273 extract
("$tmpdir/SkyNET.sys", 331624, 5908, $outfile);
279 my $sourcefile = "AVerTVHD_MCE_A180_Drv_v1.2.2.16.zip";
280 my $url = "http://www.aver.com/support/Drivers/$sourcefile";
281 my $hash = "111cb885b1e009188346d72acfed024c";
282 my $outfile = "dvb-fe-nxt2004.fw";
283 my $tmpdir = tempdir
(DIR
=> "/tmp", CLEANUP
=> 1);
287 wgetfile
($sourcefile, $url);
288 unzip
($sourcefile, $tmpdir);
289 verify
("$tmpdir/3xHybrid.sys", $hash);
290 extract
("$tmpdir/3xHybrid.sys", 465304, 9584, $outfile);
296 my $fwfile = "dvb-fe-or51211.fw";
297 my $url = "http://linuxtv.org/downloads/firmware/$fwfile";
298 my $hash = "d830949c771a289505bf9eafc225d491";
302 wgetfile
($fwfile, $url);
303 verify
($fwfile, $hash);
309 my $fwfile = "dvb-fe-or51132-qam.fw";
310 my $url = "http://linuxtv.org/downloads/firmware/$fwfile";
311 my $hash = "7702e8938612de46ccadfe9b413cb3b5";
315 wgetfile
($fwfile, $url);
316 verify
($fwfile, $hash);
322 my $fwfile = "dvb-fe-or51132-vsb.fw";
323 my $url = "http://linuxtv.org/downloads/firmware/$fwfile";
324 my $hash = "c16208e02f36fc439a557ad4c613364a";
328 wgetfile
($fwfile, $url);
329 verify
($fwfile, $hash);
335 my $url = "http://www.linuxtv.org/download/dvb/firmware/dvb-usb-bluebird-01.fw";
336 my $outfile = "dvb-usb-bluebird-01.fw";
337 my $hash = "658397cb9eba9101af9031302671f49d";
341 wgetfile
($outfile, $url);
342 verify
($outfile,$hash);
347 # ---------------------------------------------------------------
351 if (system("which unzip > /dev/null 2>&1")) {
352 die "This firmware requires the unzip command - see ftp://ftp.info-zip.org/pub/infozip/UnZip.html\n";
354 if (system("which md5sum > /dev/null 2>&1")) {
355 die "This firmware requires the md5sum command - see http://www.gnu.org/software/coreutils/\n";
357 if (system("which wget > /dev/null 2>&1")) {
358 die "This firmware requires the wget command - see http://wget.sunsite.dk/\n";
363 if (system("which unshield > /dev/null 2>&1")) {
364 die "This firmware requires the unshield command - see http://sourceforge.net/projects/synce/\n";
369 my ($sourcefile, $url) = @_;
371 if (! -f
$sourcefile) {
372 system("wget -O \"$sourcefile\" \"$url\"") and die "wget failed - unable to download firmware";
377 my ($sourcefile, $todir) = @_;
379 $status = system("unzip -q -o -d \"$todir\" \"$sourcefile\" 2>/dev/null" );
380 if ((($status >> 8) > 2) || (($status & 0xff) != 0)) {
381 die ("unzip failed - unable to extract firmware");
386 my ($sourcefile, $todir) = @_;
388 system("unshield x -d \"$todir\" \"$sourcefile\" > /dev/null" ) and die ("unshield failed - unable to extract firmware");
392 my ($filename, $hash) = @_;
395 open(CMD
, "md5sum \"$filename\"|");
397 $testhash =~ /([a-zA-Z0-9]*)/;
400 die "Hash of extracted file does not match!\n" if ($testhash ne $hash);
404 my ($from, $to) = @_;
406 system("cp -f \"$from\" \"$to\"") and die ("cp failed");
410 my ($infile, $offset, $length, $outfile) = @_;
411 my ($chunklength, $buf, $rcount);
413 open INFILE
, "<$infile";
414 open OUTFILE
, ">$outfile";
415 sysseek(INFILE
, $offset, SEEK_SET
);
419 $chunklength = $length if ($chunklength > $length);
421 $rcount = sysread(INFILE
, $buf, $chunklength);
422 die "Ran out of data\n" if ($rcount != $chunklength);
423 syswrite(OUTFILE
, $buf);
431 my ($FH, $infile) = @_;
434 open INFILE
, "<$infile";
436 $rcount = sysread(INFILE
, $buf, 2048);
437 last if ($rcount == 0);
444 print STDERR
"syntax: get_dvb_firmware <component>\n";
445 print STDERR
"Supported components:\n";
446 for($i=0; $i < scalar(@components); $i++) {
447 print STDERR
"\t" . $components[$i] . "\n";
This page took 0.048125 seconds and 6 git commands to generate.