diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2009-08-16 20:39:00 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2009-08-16 20:39:00 +0000 |
commit | e8c71aa40c3287a7c4a1f0e73fe2bb0eb8985441 (patch) | |
tree | 9346bb76341fad344a34b1ee69e1c401ce216266 /rbutil/rbutilqt/base | |
parent | aaf37656692f57f3b1ce231053c9f2d15d1bea46 (diff) | |
download | rockbox-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/base')
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallbase.cpp | 3 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallchinachip.cpp | 117 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/bootloaderinstallchinachip.h | 43 |
3 files changed, 162 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 | |||
26 | BootloaderInstallChinaChip::BootloaderInstallChinaChip(QObject *parent) | ||
27 | : BootloaderInstallBase(parent) | ||
28 | { | ||
29 | (void)parent; | ||
30 | } | ||
31 | |||
32 | QString 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 | |||
46 | void 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 | |||
54 | static 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 | |||
64 | static 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 | |||
74 | bool 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 | |||
87 | void 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 | |||
102 | bool BootloaderInstallChinaChip::uninstall() | ||
103 | { | ||
104 | /* TODO: only way is to restore the OF */ | ||
105 | return false; | ||
106 | } | ||
107 | |||
108 | BootloaderInstallBase::BootloaderType BootloaderInstallChinaChip::installed() | ||
109 | { | ||
110 | /* TODO: find a way to figure this out */ | ||
111 | return BootloaderUnknown; | ||
112 | } | ||
113 | |||
114 | BootloaderInstallBase::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 | |||
26 | class 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 | ||