summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/bootloaderinstallmpio.cpp
diff options
context:
space:
mode:
authorDominik Wenger <domonoky@googlemail.com>2010-06-04 21:43:15 +0000
committerDominik Wenger <domonoky@googlemail.com>2010-06-04 21:43:15 +0000
commitfab86a6a4c8b82f8d1764b4dabc1127e1340f571 (patch)
tree72040d34036d88aee6726f42525ef429d9bebf6f /rbutil/rbutilqt/base/bootloaderinstallmpio.cpp
parent0133a4f0524a4e33a2fa0e929fc2ac18e021ac4b (diff)
downloadrockbox-fab86a6a4c8b82f8d1764b4dabc1127e1340f571.tar.gz
rockbox-fab86a6a4c8b82f8d1764b4dabc1127e1340f571.zip
rbutil: add mpio hd200 as disabled target (all untested)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26561 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/base/bootloaderinstallmpio.cpp')
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallmpio.cpp140
1 files changed, 140 insertions, 0 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstallmpio.cpp b/rbutil/rbutilqt/base/bootloaderinstallmpio.cpp
new file mode 100644
index 0000000000..d6db46f0ae
--- /dev/null
+++ b/rbutil/rbutilqt/base/bootloaderinstallmpio.cpp
@@ -0,0 +1,140 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 *
9 * Copyright (C) 2008 by Dominik Wenger
10 * $Id: bootloaderinstallams.cpp 24778 2010-02-19 23:45:29Z funman $
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 "bootloaderinstallmpio.h"
23
24#include "../mkmpioboot/mkmpioboot.h"
25
26BootloaderInstallMpio::BootloaderInstallMpio(QObject *parent)
27 : BootloaderInstallBase(parent)
28{
29}
30
31QString BootloaderInstallMpio::ofHint()
32{
33 return tr("Bootloader installation requires you to provide "
34 "a firmware file of the original firmware (bin file). "
35 "You need to download this file yourself due to legal "
36 "reasons. Please refer to the "
37 "<a href='http://www.rockbox.org/manual.shtml'>manual</a> and "
38 "the <a href='http://www.rockbox.org/wiki/MPIOHD200Port'>MPIOHD200Port</a> "
39 "wiki page on how to obtain this file.<br/>"
40 "Press Ok to continue and browse your computer for the firmware "
41 "file.");
42}
43
44bool BootloaderInstallMpio::install(void)
45{
46 if(m_offile.isEmpty())
47 return false;
48
49 qDebug() << "[BootloaderInstallMpio] installing bootloader";
50
51 // download firmware from server
52 emit logItem(tr("Downloading bootloader file"), LOGINFO);
53
54 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
55 downloadBlStart(m_blurl);
56
57 return true;
58}
59
60void BootloaderInstallMpio::installStage2(void)
61{
62 qDebug() << "[BootloaderInstallMpio] installStage2";
63
64 int origin = 0xe0000; /* MPIO HD200 bootloader address */
65
66 m_tempfile.open();
67 QString bootfile = m_tempfile.fileName();
68 m_tempfile.close();
69
70 int ret = mkmpioboot(m_offile.toLocal8Bit().data(), bootfile.toLocal8Bit().data(), m_blfile.toLocal8Bit().data(), origin);
71
72 if(ret != 0)
73 {
74 QString error;
75 switch(ret)
76 {
77 case -1:
78 error = tr("Could not open the original firmware.");
79 break;
80 case -2:
81 error = tr("Could not read the original firmware.");
82 break;
83 case -3:
84 error = tr("Loaded firmware file does not look like MPIO OF file.");
85 break;
86 case -4:
87 error = tr("Could not open downloaded bootloader.");
88 break;
89 case -5:
90 error = tr("Place for bootloader in OF file not empty.");
91 break;
92 case -6:
93 error = tr("Could not read the downloaded bootloader.");
94 break;
95 case -7:
96 error = tr("Bootloader checksum error.");
97 break;
98 case -8:
99 error = tr("Could not open outputfile.");
100 break;
101 case -9:
102 error = tr("Could not write outputfile.");
103 break;
104 default:
105 error = tr("Unknown errornumber: %1").arg(ret);
106 break;
107 }
108
109 qDebug() << tr("Patching original firmware failed: %1").arg(error);
110 emit logItem(tr("Patching original firmware failed: %1").arg(error), LOGERROR);
111 emit done(true);
112 return;
113 }
114
115 //end of install
116 qDebug() << "[BootloaderInstallMpio] install successfull";
117 emit logItem(tr("Success: modified firmware file created"), LOGINFO);
118 logInstall(LogAdd);
119 emit done(false);
120 return;
121}
122
123bool BootloaderInstallMpio::uninstall(void)
124{
125 emit logItem(tr("To uninstall, perform a normal upgrade with an unmodified "
126 "original firmware"), LOGINFO);
127 logInstall(LogRemove);
128 return false;
129}
130
131BootloaderInstallBase::BootloaderType BootloaderInstallMpio::installed(void)
132{
133 return BootloaderUnknown;
134}
135
136BootloaderInstallBase::Capabilities BootloaderInstallMpio::capabilities(void)
137{
138 return (Install | NeedsOf);
139}
140