diff options
Diffstat (limited to 'rbutil')
-rw-r--r-- | rbutil/mkamsboot/mkamsboot.c | 5 | ||||
-rw-r--r-- | rbutil/mkamsboot/mkamsboot.h | 13 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallams.cpp | 176 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallams.h | 43 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutil.ini | 72 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 5 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.pro | 18 |
7 files changed, 324 insertions, 8 deletions
diff --git a/rbutil/mkamsboot/mkamsboot.c b/rbutil/mkamsboot/mkamsboot.c index fb0e3cb034..71bc4868ad 100644 --- a/rbutil/mkamsboot/mkamsboot.c +++ b/rbutil/mkamsboot/mkamsboot.c | |||
@@ -216,6 +216,11 @@ static struct md5sums sansasums[] = { | |||
216 | 216 | ||
217 | #define NUM_MD5S (sizeof(sansasums)/sizeof(sansasums[0])) | 217 | #define NUM_MD5S (sizeof(sansasums)/sizeof(sansasums[0])) |
218 | 218 | ||
219 | int firmware_revision(int model) | ||
220 | { | ||
221 | return fw_revisions[model]; | ||
222 | } | ||
223 | |||
219 | static off_t filesize(int fd) | 224 | static off_t filesize(int fd) |
220 | { | 225 | { |
221 | struct stat buf; | 226 | struct stat buf; |
diff --git a/rbutil/mkamsboot/mkamsboot.h b/rbutil/mkamsboot/mkamsboot.h index a14b320685..3e58341884 100644 --- a/rbutil/mkamsboot/mkamsboot.h +++ b/rbutil/mkamsboot/mkamsboot.h | |||
@@ -139,4 +139,17 @@ void patch_firmware( | |||
139 | 139 | ||
140 | int total_size(int model, int rb_packedsize, int of_packedsize); | 140 | int total_size(int model, int rb_packedsize, int of_packedsize); |
141 | 141 | ||
142 | /* firmware_revision() | ||
143 | * | ||
144 | * returns the firmware revision for a particular model | ||
145 | * | ||
146 | * ARGUMENTS | ||
147 | * | ||
148 | * model : firmware model (MODEL_XXX) | ||
149 | * | ||
150 | * RETURN VALUE | ||
151 | * firmware version | ||
152 | */ | ||
153 | int firmware_revision(int model); | ||
154 | |||
142 | #endif | 155 | #endif |
diff --git a/rbutil/rbutilqt/base/bootloaderinstallams.cpp b/rbutil/rbutilqt/base/bootloaderinstallams.cpp new file mode 100644 index 0000000000..9b357aedb6 --- /dev/null +++ b/rbutil/rbutilqt/base/bootloaderinstallams.cpp | |||
@@ -0,0 +1,176 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2008 by Dominik Wenger | ||
10 | * $Id$ | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | #include <QtCore> | ||
21 | #include "bootloaderinstallbase.h" | ||
22 | #include "bootloaderinstallams.h" | ||
23 | |||
24 | extern "C" | ||
25 | { | ||
26 | #include "../mkamsboot/mkamsboot.h" | ||
27 | }; | ||
28 | |||
29 | BootloaderInstallAms::BootloaderInstallAms(QObject *parent) | ||
30 | : BootloaderInstallBase(parent) | ||
31 | { | ||
32 | } | ||
33 | |||
34 | QString BootloaderInstallAms::ofHint() | ||
35 | { | ||
36 | return tr("Bootloader installation requires you to provide " | ||
37 | "a firmware file of the original firmware (bin file). " | ||
38 | "You need to download this file yourself due to legal " | ||
39 | "reasons." | ||
40 | "Press Ok to continue and browse your computer for the firmware " | ||
41 | "file."); | ||
42 | } | ||
43 | |||
44 | bool BootloaderInstallAms::install(void) | ||
45 | { | ||
46 | if(m_offile.isEmpty()) | ||
47 | return false; | ||
48 | |||
49 | // download firmware from server | ||
50 | emit logItem(tr("Downloading bootloader file"), LOGINFO); | ||
51 | |||
52 | connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); | ||
53 | downloadBlStart(m_blurl); | ||
54 | |||
55 | return true; | ||
56 | } | ||
57 | |||
58 | void BootloaderInstallAms::installStage2(void) | ||
59 | { | ||
60 | unsigned char* buf; | ||
61 | unsigned char* of_packed; | ||
62 | int of_packedsize; | ||
63 | unsigned char* rb_packed; | ||
64 | int rb_packedsize; | ||
65 | off_t len; | ||
66 | struct md5sums sum; | ||
67 | char md5sum[33]; /* 32 hex digits, plus terminating zero */ | ||
68 | int n; | ||
69 | int firmware_size; | ||
70 | int bootloader_size; | ||
71 | int totalsize; | ||
72 | char errstr[200]; | ||
73 | |||
74 | sum.md5 = md5sum; | ||
75 | |||
76 | m_tempfile.open(); | ||
77 | QString bootfile = m_tempfile.fileName(); | ||
78 | m_tempfile.close(); | ||
79 | |||
80 | /* Load original firmware file */ | ||
81 | buf = load_of_file(m_offile.toLocal8Bit().data(), &len,&sum,&firmware_size, | ||
82 | &of_packed,&of_packedsize,errstr,sizeof(errstr)); | ||
83 | if (buf == NULL) | ||
84 | { | ||
85 | emit logItem(errstr, LOGERROR); | ||
86 | emit logItem(tr("Could not load %1").arg(m_offile), LOGERROR); | ||
87 | emit done(true); | ||
88 | return; | ||
89 | } | ||
90 | |||
91 | /* Load bootloader file */ | ||
92 | rb_packed = load_rockbox_file(bootfile.toLocal8Bit().data(), sum.model, &bootloader_size,&rb_packedsize, | ||
93 | errstr,sizeof(errstr)); | ||
94 | if (rb_packed == NULL) | ||
95 | { | ||
96 | emit logItem(errstr, LOGERROR); | ||
97 | emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR); | ||
98 | free(buf); | ||
99 | free(of_packed); | ||
100 | emit done(true); | ||
101 | return; | ||
102 | } | ||
103 | |||
104 | /* check total size */ | ||
105 | totalsize = total_size(sum.model,rb_packedsize,of_packedsize); | ||
106 | if (totalsize > firmware_size) | ||
107 | { | ||
108 | emit logItem("No room to insert bootloader, try another firmware version",LOGERROR); | ||
109 | free(buf); | ||
110 | free(of_packed); | ||
111 | free(rb_packed); | ||
112 | emit done(true); | ||
113 | return; | ||
114 | } | ||
115 | |||
116 | /* patch the firmware */ | ||
117 | emit logItem(tr("Patching Firmware..."), LOGINFO); | ||
118 | |||
119 | patch_firmware(sum.model,firmware_revision(sum.model),firmware_size,buf,len,of_packed,of_packedsize,rb_packed,rb_packedsize); | ||
120 | |||
121 | /* construct path for write out. combine path of m_blfile with filename from of */ | ||
122 | QString outfilename = QFileInfo(m_blfile).absolutePath() + "/" +QFileInfo(m_offile).fileName(); | ||
123 | /* write out file*/ | ||
124 | QFile out(outfilename); | ||
125 | |||
126 | if(!out.open(QIODevice::WriteOnly | QIODevice::Truncate)) | ||
127 | { | ||
128 | emit logItem(tr("Could not open %1 for writing").arg(m_blfile),LOGERROR); | ||
129 | free(buf); | ||
130 | free(of_packed); | ||
131 | free(rb_packed); | ||
132 | emit done(true); | ||
133 | return; | ||
134 | } | ||
135 | |||
136 | n = out.write((char*)buf, len); | ||
137 | |||
138 | if (n != len) | ||
139 | { | ||
140 | emit logItem(tr("Could not write firmware file"),LOGERROR); | ||
141 | free(buf); | ||
142 | free(of_packed); | ||
143 | free(rb_packed); | ||
144 | emit done(true); | ||
145 | return; | ||
146 | } | ||
147 | |||
148 | out.close(); | ||
149 | |||
150 | free(buf); | ||
151 | free(of_packed); | ||
152 | free(rb_packed); | ||
153 | |||
154 | //end of install | ||
155 | emit logItem(tr("Success: modified firmware file created"), LOGINFO); | ||
156 | logInstall(LogAdd); | ||
157 | emit done(false); | ||
158 | return; | ||
159 | } | ||
160 | |||
161 | bool BootloaderInstallAms::uninstall(void) | ||
162 | { | ||
163 | emit logItem("To uninstall, perform a normal upgrade with an unmodified original firmware", LOGINFO); | ||
164 | logInstall(LogRemove); | ||
165 | return false; | ||
166 | } | ||
167 | |||
168 | BootloaderInstallBase::BootloaderType BootloaderInstallAms::installed(void) | ||
169 | { | ||
170 | return BootloaderUnknown; | ||
171 | } | ||
172 | |||
173 | BootloaderInstallBase::Capabilities BootloaderInstallAms::capabilities(void) | ||
174 | { | ||
175 | return (Install | NeedsOf); | ||
176 | } | ||
diff --git a/rbutil/rbutilqt/base/bootloaderinstallams.h b/rbutil/rbutilqt/base/bootloaderinstallams.h new file mode 100644 index 0000000000..05ae576afe --- /dev/null +++ b/rbutil/rbutilqt/base/bootloaderinstallams.h | |||
@@ -0,0 +1,43 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * | ||
9 | * Copyright (C) 2008 by Dominik Wenger | ||
10 | * $Id$ | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef BOOTLOADERINSTALLAMS_H | ||
20 | #define BOOTLOADERINSTALLAMS_H | ||
21 | |||
22 | #include <QtCore> | ||
23 | #include "bootloaderinstallbase.h" | ||
24 | |||
25 | //! bootloader installation derivate based on mkamsboot | ||
26 | class BootloaderInstallAms : public BootloaderInstallBase | ||
27 | { | ||
28 | Q_OBJECT | ||
29 | public: | ||
30 | BootloaderInstallAms(QObject *parent); | ||
31 | bool install(void); | ||
32 | bool uninstall(void); | ||
33 | BootloaderInstallBase::BootloaderType installed(void); | ||
34 | Capabilities capabilities(void); | ||
35 | QString ofHint(); | ||
36 | |||
37 | private: | ||
38 | |||
39 | private slots: | ||
40 | void installStage2(void); | ||
41 | }; | ||
42 | |||
43 | #endif | ||
diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini index f82b36d78a..3148bc78d2 100644 --- a/rbutil/rbutilqt/rbutil.ini +++ b/rbutil/rbutilqt/rbutil.ini | |||
@@ -45,11 +45,14 @@ platform33=iaudiom3 | |||
45 | platform40=gigabeatf | 45 | platform40=gigabeatf |
46 | platform50=sansae200 | 46 | platform50=sansae200 |
47 | platform51=sansac200 | 47 | platform51=sansac200 |
48 | platform57=smsgyh820 | 48 | platform52=sansae200v2 |
49 | platform58=smsgyh920 | 49 | platform53=sansafuze |
50 | platform59=smsgyh925 | 50 | platform54=sansam200v4 |
51 | platform55=sansaclip | ||
51 | platform60=mrobe100 | 52 | platform60=mrobe100 |
52 | 53 | platform70=smsgyh820 | |
54 | platform71=smsgyh920 | ||
55 | platform72=smsgyh925 | ||
53 | 56 | ||
54 | 57 | ||
55 | [player] | 58 | [player] |
@@ -441,6 +444,67 @@ configure_modelname=c200 | |||
441 | targetid=30 | 444 | targetid=30 |
442 | encoder=rbspeex | 445 | encoder=rbspeex |
443 | 446 | ||
447 | [sansae200v2] | ||
448 | name="Sansa e200v2 series" | ||
449 | buildserver_modelname=sansae200v2 | ||
450 | bootloadermethod=ams | ||
451 | bootloadername=/sandisk-sansa/e200v2/bootloader-e200v2.sansa | ||
452 | bootloaderfile=/e200pa.bin | ||
453 | resolution=176x220x16 | ||
454 | manualname= | ||
455 | brand=Sandisk | ||
456 | usbid=0x078174c1 | ||
457 | usberror=0x07810722 | ||
458 | configure_modelname=e200v2 | ||
459 | targetid=51 | ||
460 | encoder=rbspeex | ||
461 | |||
462 | [sansafuze] | ||
463 | name="Sansa Fuze" | ||
464 | buildserver_modelname=sansafuze | ||
465 | bootloadermethod=ams | ||
466 | bootloadername=/sandisk-sansa/fuze/bootloader-fuze.sansa | ||
467 | bootloaderfile=/fuzea.bin | ||
468 | resolution=220x176x16 | ||
469 | manualname= | ||
470 | brand=Sandisk | ||
471 | usbid=0x07817423 | ||
472 | usberror=0x078174c0 | ||
473 | configure_modelname=fuze | ||
474 | targetid=53 | ||
475 | encoder=rbspeex | ||
476 | |||
477 | [sansam200v4] | ||
478 | name="Sansa m200v4" | ||
479 | buildserver_modelname=sansam200v4 | ||
480 | bootloadermethod=ams | ||
481 | bootloadername=/sandisk-sansa/m200v4/bootloader-m200v4.sansa | ||
482 | bootloaderfile=/m200a.bin | ||
483 | resolution=128x64x1 | ||
484 | manualname= | ||
485 | brand=Sandisk | ||
486 | usbid= | ||
487 | usberror= | ||
488 | configure_modelname=m200v4 | ||
489 | targetid=52 | ||
490 | encoder=rbspeex | ||
491 | |||
492 | [sansaclip] | ||
493 | name="Sansa Clip" | ||
494 | buildserver_modelname=sansaclip | ||
495 | bootloadermethod=ams | ||
496 | bootloadername=/sandisk-sansa/clip/bootloader-clip.sansa | ||
497 | bootloaderfile=/m300a.bin | ||
498 | resolution=128x64x1 | ||
499 | manualname= | ||
500 | brand=Sandisk | ||
501 | usbid=0x07817433 | ||
502 | usberror=0x07817432 | ||
503 | configure_modelname=clip | ||
504 | targetid=50 | ||
505 | encoder=rbspeex | ||
506 | |||
507 | |||
444 | [mrobe100] | 508 | [mrobe100] |
445 | name="m:robe100" | 509 | name="m:robe100" |
446 | buildserver_modelname=mrobe100 | 510 | buildserver_modelname=mrobe100 |
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index dff0395bc1..af79f2edef 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp | |||
@@ -44,6 +44,8 @@ | |||
44 | #include "bootloaderinstallipod.h" | 44 | #include "bootloaderinstallipod.h" |
45 | #include "bootloaderinstallsansa.h" | 45 | #include "bootloaderinstallsansa.h" |
46 | #include "bootloaderinstallfile.h" | 46 | #include "bootloaderinstallfile.h" |
47 | #include "bootloaderinstallams.h" | ||
48 | |||
47 | 49 | ||
48 | #if defined(Q_OS_LINUX) | 50 | #if defined(Q_OS_LINUX) |
49 | #include <stdio.h> | 51 | #include <stdio.h> |
@@ -650,6 +652,9 @@ void RbUtilQt::installBootloader() | |||
650 | else if(type == "file") { | 652 | else if(type == "file") { |
651 | bl = new BootloaderInstallFile(this); | 653 | bl = new BootloaderInstallFile(this); |
652 | } | 654 | } |
655 | else if(type == "ams") { | ||
656 | bl = new BootloaderInstallAms(this); | ||
657 | } | ||
653 | else { | 658 | else { |
654 | logger->addItem(tr("No install method known."), LOGERROR); | 659 | logger->addItem(tr("No install method known."), LOGERROR); |
655 | logger->setFinished(); | 660 | logger->setFinished(); |
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro index 31b07bf068..07f05669e2 100644 --- a/rbutil/rbutilqt/rbutilqt.pro +++ b/rbutil/rbutilqt/rbutilqt.pro | |||
@@ -42,9 +42,17 @@ QMAKE_EXTRA_TARGETS += lrelease | |||
42 | PRE_TARGETDEPS += lrelease | 42 | PRE_TARGETDEPS += lrelease |
43 | } | 43 | } |
44 | 44 | ||
45 | #custum rules for libmkamsboot.a | ||
46 | libucl.commands = @$(MAKE) -C ../../tools/ucl/src libucl.a | ||
47 | QMAKE_EXTRA_TARGETS += libucl | ||
48 | PRE_TARGETDEPS += libucl | ||
49 | |||
50 | libmkamsboot.commands = @$(MAKE) -C ../mkamsboot libmkamsboot.a | ||
51 | QMAKE_EXTRA_TARGETS += libmkamsboot | ||
52 | PRE_TARGETDEPS += libmkamsboot | ||
45 | 53 | ||
46 | SOURCES += rbutilqt.cpp \ | 54 | SOURCES += rbutilqt.cpp \ |
47 | main.cpp \ | 55 | main.cpp \ |
48 | install.cpp \ | 56 | install.cpp \ |
49 | base/httpget.cpp \ | 57 | base/httpget.cpp \ |
50 | configure.cpp \ | 58 | configure.cpp \ |
@@ -83,6 +91,7 @@ SOURCES += rbutilqt.cpp \ | |||
83 | base/bootloaderinstallipod.cpp \ | 91 | base/bootloaderinstallipod.cpp \ |
84 | base/bootloaderinstallsansa.cpp \ | 92 | base/bootloaderinstallsansa.cpp \ |
85 | base/bootloaderinstallfile.cpp \ | 93 | base/bootloaderinstallfile.cpp \ |
94 | base/bootloaderinstallams.cpp \ | ||
86 | ../../tools/mkboot.c \ | 95 | ../../tools/mkboot.c \ |
87 | ../../tools/iriver.c | 96 | ../../tools/iriver.c |
88 | 97 | ||
@@ -136,14 +145,15 @@ HEADERS += rbutilqt.h \ | |||
136 | base/bootloaderinstallipod.h \ | 145 | base/bootloaderinstallipod.h \ |
137 | base/bootloaderinstallsansa.h \ | 146 | base/bootloaderinstallsansa.h \ |
138 | base/bootloaderinstallfile.h \ | 147 | base/bootloaderinstallfile.h \ |
148 | base/bootloaderinstallams.h \ | ||
139 | ../../tools/mkboot.h \ | 149 | ../../tools/mkboot.h \ |
140 | ../../tools/iriver.h | 150 | ../../tools/iriver.h |
141 | 151 | ||
142 | # Needed by QT on Win | 152 | # Needed by QT on Win |
143 | INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex ../../tools | 153 | INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex ../../tools |
144 | INCLUDEPATH += base | 154 | INCLUDEPATH += base |
145 | 155 | ||
146 | LIBS += -L../../tools/rbspeex -lrbspeex | 156 | LIBS += -L../../tools/rbspeex -lrbspeex -L../mkamsboot -lmkamsboot -L../../tools/ucl/src/ -lucl |
147 | 157 | ||
148 | TEMPLATE = app | 158 | TEMPLATE = app |
149 | dbg { | 159 | dbg { |