summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt
diff options
context:
space:
mode:
authorMaurus Cuelenaere <mcuelenaere@gmail.com>2009-08-16 20:39:00 +0000
committerMaurus Cuelenaere <mcuelenaere@gmail.com>2009-08-16 20:39:00 +0000
commite8c71aa40c3287a7c4a1f0e73fe2bb0eb8985441 (patch)
tree9346bb76341fad344a34b1ee69e1c401ce216266 /rbutil/rbutilqt
parentaaf37656692f57f3b1ce231053c9f2d15d1bea46 (diff)
downloadrockbox-e8c71aa40c3287a7c4a1f0e73fe2bb0eb8985441.tar.gz
rockbox-e8c71aa40c3287a7c4a1f0e73fe2bb0eb8985441.zip
Rockbox Utility: add preliminary support for installing the bootloader (+ dual boot) on ChinaChip targets
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22356 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt')
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallbase.cpp3
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallchinachip.cpp117
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallchinachip.h43
-rw-r--r--rbutil/rbutilqt/rbutil.ini14
-rw-r--r--rbutil/rbutilqt/rbutilqt.cpp5
-rw-r--r--rbutil/rbutilqt/rbutilqt.pro4
6 files changed, 185 insertions, 1 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
index 5ce735a5b7..a4cf22af29 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallbase.cpp
@@ -155,7 +155,8 @@ QString BootloaderInstallBase::postinstallHints(QString model)
155 155
156 msg += "<ol>"; 156 msg += "<ol>";
157 msg += tr("<li>Safely remove your player.</li>"); 157 msg += tr("<li>Safely remove your player.</li>");
158 if(model == "h100" || model == "h120" || model == "h300") { 158 if(model == "h100" || model == "h120" || model == "h300" ||
159 model == "ondavx747") {
159 hint = true; 160 hint = true;
160 msg += tr("<li>Reboot your player into the original firmware.</li>" 161 msg += tr("<li>Reboot your player into the original firmware.</li>"
161 "<li>Perform a firmware upgrade using the update functionality " 162 "<li>Perform a firmware upgrade using the update functionality "
diff --git a/rbutil/rbutilqt/base/bootloaderinstallchinachip.cpp b/rbutil/rbutilqt/base/bootloaderinstallchinachip.cpp
new file mode 100644
index 0000000000..dba2ec8c92
--- /dev/null
+++ b/rbutil/rbutilqt/base/bootloaderinstallchinachip.cpp
@@ -0,0 +1,117 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2009 by Maurus Cuelenaere
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 "bootloaderinstallchinachip.h"
23
24#include "../chinachippatcher/chinachip.h"
25
26BootloaderInstallChinaChip::BootloaderInstallChinaChip(QObject *parent)
27 : BootloaderInstallBase(parent)
28{
29 (void)parent;
30}
31
32QString BootloaderInstallChinaChip::ofHint()
33{
34 return tr("Bootloader installation requires you to provide "
35 "a firmware file of the original firmware (HXF file). "
36 "You need to download this file yourself due to legal "
37 "reasons. Please refer to the "
38 "<a href='http://www.rockbox.org/manual.shtml'>manual</a> and the "
39 "<a href='http://www.rockbox.org/wiki/OndaVX747"
40 "#Download_and_extract_a_recent_ve'>OndaVX747</a> wiki page on "
41 "how to obtain this file.<br/>"
42 "Press Ok to continue and browse your computer for the firmware "
43 "file.");
44}
45
46void BootloaderInstallChinaChip::logString(char* format, va_list args, int type)
47{
48 QString buffer;
49
50 emit logItem(buffer.vsprintf(format, args), type);
51 QCoreApplication::processEvents();
52}
53
54static void info(void* userdata, char* format, ...)
55{
56 BootloaderInstallChinaChip* pThis = (BootloaderInstallChinaChip*) userdata;
57 va_list args;
58
59 va_start(args, format);
60 pThis->logString(format, args, LOGINFO);
61 va_end(args);
62}
63
64static void err(void* userdata, char* format, ...)
65{
66 BootloaderInstallChinaChip* pThis = (BootloaderInstallChinaChip*) userdata;
67 va_list args;
68
69 va_start(args, format);
70 pThis->logString(format, args, LOGERROR);
71 va_end(args);
72}
73
74bool BootloaderInstallChinaChip::install()
75{
76 if(m_offile.isEmpty())
77 return false;
78
79 emit logItem(tr("Downloading bootloader file"), LOGINFO);
80
81 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
82 downloadBlStart(m_blurl);
83
84 return true;
85}
86
87void BootloaderInstallChinaChip::installStage2()
88{
89 m_tempfile.open();
90 QString blfile = m_tempfile.fileName();
91 m_tempfile.close();
92
93 QString backupfile = QFileInfo(m_blfile).absoluteDir().absoluteFilePath("ccpmp.bin");
94
95 int ret = chinachip_patch(m_offile.toLocal8Bit(), blfile.toLocal8Bit(), m_blfile.toLocal8Bit(),
96 backupfile.toLocal8Bit(), &info, &err, (void*)this);
97 qDebug() << "chinachip_patch" << ret;
98
99 emit done(ret);
100}
101
102bool BootloaderInstallChinaChip::uninstall()
103{
104 /* TODO: only way is to restore the OF */
105 return false;
106}
107
108BootloaderInstallBase::BootloaderType BootloaderInstallChinaChip::installed()
109{
110 /* TODO: find a way to figure this out */
111 return BootloaderUnknown;
112}
113
114BootloaderInstallBase::Capabilities BootloaderInstallChinaChip::capabilities()
115{
116 return (Install | IsFile | NeedsOf);
117}
diff --git a/rbutil/rbutilqt/base/bootloaderinstallchinachip.h b/rbutil/rbutilqt/base/bootloaderinstallchinachip.h
new file mode 100644
index 0000000000..292799cc0c
--- /dev/null
+++ b/rbutil/rbutilqt/base/bootloaderinstallchinachip.h
@@ -0,0 +1,43 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2009 by Maurus Cuelenaere
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#ifndef BOOTLOADERINSTALLCCPMP_H
21#define BOOTLOADERINSTALLCCPMP_H
22
23#include <QtCore>
24#include "bootloaderinstallbase.h"
25
26class BootloaderInstallChinaChip : public BootloaderInstallBase
27{
28 Q_OBJECT
29
30 public:
31 BootloaderInstallChinaChip(QObject *parent = 0);
32 bool install(void);
33 bool uninstall(void);
34 BootloaderInstallBase::BootloaderType installed(void);
35 Capabilities capabilities(void);
36 QString ofHint();
37 void logString(char* buffer, va_list args, int type);
38
39 private slots:
40 void installStage2(void);
41};
42
43#endif // BOOTLOADERINSTALLCCPMP_H
diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini
index 739a5d2be4..91770d72b3 100644
--- a/rbutil/rbutilqt/rbutil.ini
+++ b/rbutil/rbutilqt/rbutil.ini
@@ -43,6 +43,7 @@ platform31=iaudiom5
43platform32=iaudiox5v 43platform32=iaudiox5v
44platform33=iaudiom3 44platform33=iaudiom3
45platform40=gigabeatf 45platform40=gigabeatf
46platform44=ondavx747
46platform50=sansae200 47platform50=sansae200
47platform51=sansac200 48platform51=sansac200
48platform52=sansae200v2 49platform52=sansae200v2
@@ -481,6 +482,19 @@ configure_modelname=mrobe100
481targetid=33 482targetid=33
482encoder=rbspeex 483encoder=rbspeex
483 484
485[ondavx747]
486name=VX747
487buildserver_modelname=ondavx747
488bootloadermethod=chinachip
489bootloadername=/onda/vx747/ccpmp.bin
490bootloaderfile=/SG301.HXF
491manualname=
492brand=Onda
493usbid=0x07c4a4a5
494configure_modelname=ondavx747
495targetid=44
496encoder=rbspeex
497
484[smsgyh820] 498[smsgyh820]
485name="YH-820" 499name="YH-820"
486buildserver_modelname=yh820 500buildserver_modelname=yh820
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp
index b0684f7ef7..ec06955eef 100644
--- a/rbutil/rbutilqt/rbutilqt.cpp
+++ b/rbutil/rbutilqt/rbutilqt.cpp
@@ -45,6 +45,7 @@
45#include "bootloaderinstallipod.h" 45#include "bootloaderinstallipod.h"
46#include "bootloaderinstallsansa.h" 46#include "bootloaderinstallsansa.h"
47#include "bootloaderinstallfile.h" 47#include "bootloaderinstallfile.h"
48#include "bootloaderinstallchinachip.h"
48#include "bootloaderinstallams.h" 49#include "bootloaderinstallams.h"
49 50
50 51
@@ -659,6 +660,9 @@ void RbUtilQt::installBootloader()
659 else if(type == "file") { 660 else if(type == "file") {
660 bl = new BootloaderInstallFile(this); 661 bl = new BootloaderInstallFile(this);
661 } 662 }
663 else if(type == "chinachip") {
664 bl = new BootloaderInstallChinaChip(this);
665 }
662 else if(type == "ams") { 666 else if(type == "ams") {
663 bl = new BootloaderInstallAms(this); 667 bl = new BootloaderInstallAms(this);
664 } 668 }
@@ -1213,3 +1217,4 @@ bool RbUtilQt::chkConfig(bool warn)
1213 return error; 1217 return error;
1214} 1218}
1215 1219
1220
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro
index cf7f944824..78c399ebd7 100644
--- a/rbutil/rbutilqt/rbutilqt.pro
+++ b/rbutil/rbutilqt/rbutilqt.pro
@@ -77,6 +77,7 @@ SOURCES += rbutilqt.cpp \
77 base/autodetection.cpp \ 77 base/autodetection.cpp \
78 ../ipodpatcher/ipodpatcher.c \ 78 ../ipodpatcher/ipodpatcher.c \
79 ../sansapatcher/sansapatcher.c \ 79 ../sansapatcher/sansapatcher.c \
80 ../chinachippatcher/chinachip.c \
80 browsedirtree.cpp \ 81 browsedirtree.cpp \
81 themesinstallwindow.cpp \ 82 themesinstallwindow.cpp \
82 base/uninstall.cpp \ 83 base/uninstall.cpp \
@@ -103,6 +104,7 @@ SOURCES += rbutilqt.cpp \
103 base/bootloaderinstallipod.cpp \ 104 base/bootloaderinstallipod.cpp \
104 base/bootloaderinstallsansa.cpp \ 105 base/bootloaderinstallsansa.cpp \
105 base/bootloaderinstallfile.cpp \ 106 base/bootloaderinstallfile.cpp \
107 base/bootloaderinstallchinachip.cpp \
106 base/bootloaderinstallams.cpp \ 108 base/bootloaderinstallams.cpp \
107 ../../tools/mkboot.c \ 109 ../../tools/mkboot.c \
108 ../../tools/iriver.c 110 ../../tools/iriver.c
@@ -129,6 +131,7 @@ HEADERS += rbutilqt.h \
129 ../ipodpatcher/parttypes.h \ 131 ../ipodpatcher/parttypes.h \
130 ../sansapatcher/sansapatcher.h \ 132 ../sansapatcher/sansapatcher.h \
131 ../sansapatcher/sansaio.h \ 133 ../sansapatcher/sansaio.h \
134 ../chinachippatcher/chinachip.h \
132 irivertools/h100sums.h \ 135 irivertools/h100sums.h \
133 irivertools/h120sums.h \ 136 irivertools/h120sums.h \
134 irivertools/h300sums.h \ 137 irivertools/h300sums.h \
@@ -158,6 +161,7 @@ HEADERS += rbutilqt.h \
158 base/bootloaderinstallipod.h \ 161 base/bootloaderinstallipod.h \
159 base/bootloaderinstallsansa.h \ 162 base/bootloaderinstallsansa.h \
160 base/bootloaderinstallfile.h \ 163 base/bootloaderinstallfile.h \
164 base/bootloaderinstallchinachip.h \
161 base/bootloaderinstallams.h \ 165 base/bootloaderinstallams.h \
162 ../../tools/mkboot.h \ 166 ../../tools/mkboot.h \
163 ../../tools/iriver.h 167 ../../tools/iriver.h