summaryrefslogtreecommitdiffstats
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.tar.bz2
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)
msg += "<ol>";
msg += tr("<li>Safely remove your player.</li>");
- if(model == "h100" || model == "h120" || model == "h300") {
+ if(model == "h100" || model == "h120" || model == "h300" ||
+ model == "ondavx747") {
hint = true;
msg += tr("<li>Reboot your player into the original firmware.</li>"
"<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 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2009 by Maurus Cuelenaere
+ * $Id$
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include <QtCore>
+#include "bootloaderinstallbase.h"
+#include "bootloaderinstallchinachip.h"
+
+#include "../chinachippatcher/chinachip.h"
+
+BootloaderInstallChinaChip::BootloaderInstallChinaChip(QObject *parent)
+ : BootloaderInstallBase(parent)
+{
+ (void)parent;
+}
+
+QString BootloaderInstallChinaChip::ofHint()
+{
+ return tr("Bootloader installation requires you to provide "
+ "a firmware file of the original firmware (HXF file). "
+ "You need to download this file yourself due to legal "
+ "reasons. Please refer to the "
+ "<a href='http://www.rockbox.org/manual.shtml'>manual</a> and the "
+ "<a href='http://www.rockbox.org/wiki/OndaVX747"
+ "#Download_and_extract_a_recent_ve'>OndaVX747</a> wiki page on "
+ "how to obtain this file.<br/>"
+ "Press Ok to continue and browse your computer for the firmware "
+ "file.");
+}
+
+void BootloaderInstallChinaChip::logString(char* format, va_list args, int type)
+{
+ QString buffer;
+
+ emit logItem(buffer.vsprintf(format, args), type);
+ QCoreApplication::processEvents();
+}
+
+static void info(void* userdata, char* format, ...)
+{
+ BootloaderInstallChinaChip* pThis = (BootloaderInstallChinaChip*) userdata;
+ va_list args;
+
+ va_start(args, format);
+ pThis->logString(format, args, LOGINFO);
+ va_end(args);
+}
+
+static void err(void* userdata, char* format, ...)
+{
+ BootloaderInstallChinaChip* pThis = (BootloaderInstallChinaChip*) userdata;
+ va_list args;
+
+ va_start(args, format);
+ pThis->logString(format, args, LOGERROR);
+ va_end(args);
+}
+
+bool BootloaderInstallChinaChip::install()
+{
+ if(m_offile.isEmpty())
+ return false;
+
+ emit logItem(tr("Downloading bootloader file"), LOGINFO);
+
+ connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
+ downloadBlStart(m_blurl);
+
+ return true;
+}
+
+void BootloaderInstallChinaChip::installStage2()
+{
+ m_tempfile.open();
+ QString blfile = m_tempfile.fileName();
+ m_tempfile.close();
+
+ QString backupfile = QFileInfo(m_blfile).absoluteDir().absoluteFilePath("ccpmp.bin");
+
+ int ret = chinachip_patch(m_offile.toLocal8Bit(), blfile.toLocal8Bit(), m_blfile.toLocal8Bit(),
+ backupfile.toLocal8Bit(), &info, &err, (void*)this);
+ qDebug() << "chinachip_patch" << ret;
+
+ emit done(ret);
+}
+
+bool BootloaderInstallChinaChip::uninstall()
+{
+ /* TODO: only way is to restore the OF */
+ return false;
+}
+
+BootloaderInstallBase::BootloaderType BootloaderInstallChinaChip::installed()
+{
+ /* TODO: find a way to figure this out */
+ return BootloaderUnknown;
+}
+
+BootloaderInstallBase::Capabilities BootloaderInstallChinaChip::capabilities()
+{
+ return (Install | IsFile | NeedsOf);
+}
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 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ *
+ * Copyright (C) 2009 by Maurus Cuelenaere
+ * $Id$
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#ifndef BOOTLOADERINSTALLCCPMP_H
+#define BOOTLOADERINSTALLCCPMP_H
+
+#include <QtCore>
+#include "bootloaderinstallbase.h"
+
+class BootloaderInstallChinaChip : public BootloaderInstallBase
+{
+ Q_OBJECT
+
+ public:
+ BootloaderInstallChinaChip(QObject *parent = 0);
+ bool install(void);
+ bool uninstall(void);
+ BootloaderInstallBase::BootloaderType installed(void);
+ Capabilities capabilities(void);
+ QString ofHint();
+ void logString(char* buffer, va_list args, int type);
+
+ private slots:
+ void installStage2(void);
+};
+
+#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
platform32=iaudiox5v
platform33=iaudiom3
platform40=gigabeatf
+platform44=ondavx747
platform50=sansae200
platform51=sansac200
platform52=sansae200v2
@@ -481,6 +482,19 @@ configure_modelname=mrobe100
targetid=33
encoder=rbspeex
+[ondavx747]
+name=VX747
+buildserver_modelname=ondavx747
+bootloadermethod=chinachip
+bootloadername=/onda/vx747/ccpmp.bin
+bootloaderfile=/SG301.HXF
+manualname=
+brand=Onda
+usbid=0x07c4a4a5
+configure_modelname=ondavx747
+targetid=44
+encoder=rbspeex
+
[smsgyh820]
name="YH-820"
buildserver_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 @@
#include "bootloaderinstallipod.h"
#include "bootloaderinstallsansa.h"
#include "bootloaderinstallfile.h"
+#include "bootloaderinstallchinachip.h"
#include "bootloaderinstallams.h"
@@ -659,6 +660,9 @@ void RbUtilQt::installBootloader()
else if(type == "file") {
bl = new BootloaderInstallFile(this);
}
+ else if(type == "chinachip") {
+ bl = new BootloaderInstallChinaChip(this);
+ }
else if(type == "ams") {
bl = new BootloaderInstallAms(this);
}
@@ -1213,3 +1217,4 @@ bool RbUtilQt::chkConfig(bool warn)
return error;
}
+
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 \
base/autodetection.cpp \
../ipodpatcher/ipodpatcher.c \
../sansapatcher/sansapatcher.c \
+ ../chinachippatcher/chinachip.c \
browsedirtree.cpp \
themesinstallwindow.cpp \
base/uninstall.cpp \
@@ -103,6 +104,7 @@ SOURCES += rbutilqt.cpp \
base/bootloaderinstallipod.cpp \
base/bootloaderinstallsansa.cpp \
base/bootloaderinstallfile.cpp \
+ base/bootloaderinstallchinachip.cpp \
base/bootloaderinstallams.cpp \
../../tools/mkboot.c \
../../tools/iriver.c
@@ -129,6 +131,7 @@ HEADERS += rbutilqt.h \
../ipodpatcher/parttypes.h \
../sansapatcher/sansapatcher.h \
../sansapatcher/sansaio.h \
+ ../chinachippatcher/chinachip.h \
irivertools/h100sums.h \
irivertools/h120sums.h \
irivertools/h300sums.h \
@@ -158,6 +161,7 @@ HEADERS += rbutilqt.h \
base/bootloaderinstallipod.h \
base/bootloaderinstallsansa.h \
base/bootloaderinstallfile.h \
+ base/bootloaderinstallchinachip.h \
base/bootloaderinstallams.h \
../../tools/mkboot.h \
../../tools/iriver.h