1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
9 * Copyright (C) 2008 by Dominik Wenger
10 * $Id: bootloaderinstallams.cpp 24778 2010-02-19 23:45:29Z funman $
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.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
21 #include "bootloaderinstallbase.h"
22 #include "bootloaderinstallmpio.h"
24 #include "../mkmpioboot/mkmpioboot.h"
26 BootloaderInstallMpio::BootloaderInstallMpio(QObject
*parent
)
27 : BootloaderInstallBase(parent
)
31 QString
BootloaderInstallMpio::ofHint()
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 "
44 bool BootloaderInstallMpio::install(void)
46 if(m_offile
.isEmpty())
49 qDebug() << "[BootloaderInstallMpio] installing bootloader";
51 // download firmware from server
52 emit
logItem(tr("Downloading bootloader file"), LOGINFO
);
54 connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
55 downloadBlStart(m_blurl
);
60 void BootloaderInstallMpio::installStage2(void)
62 qDebug() << "[BootloaderInstallMpio] installStage2";
64 int origin
= 0xe0000; /* MPIO HD200 bootloader address */
67 QString bootfile
= m_tempfile
.fileName();
70 int ret
= mkmpioboot(m_offile
.toLocal8Bit().data(),
71 bootfile
.toLocal8Bit().data(), m_blfile
.toLocal8Bit().data(), origin
);
79 error
= tr("Could not open the original firmware.");
82 error
= tr("Could not read the original firmware.");
85 error
= tr("Loaded firmware file does not look like MPIO original firmware file.");
88 error
= tr("Could not open downloaded bootloader.");
91 error
= tr("Place for bootloader in OF file not empty.");
94 error
= tr("Could not read the downloaded bootloader.");
97 error
= tr("Bootloader checksum error.");
100 error
= tr("Could not open output file.");
103 error
= tr("Could not write output file.");
106 error
= tr("Unknown error number: %1").arg(ret
);
110 qDebug() << "[BootloaderInstallMpio] Patching original firmware failed:" << error
;
111 emit
logItem(tr("Patching original firmware failed: %1").arg(error
), LOGERROR
);
117 qDebug() << "[BootloaderInstallMpio] install successful";
118 emit
logItem(tr("Success: modified firmware file created"), LOGINFO
);
124 bool BootloaderInstallMpio::uninstall(void)
126 emit
logItem(tr("To uninstall, perform a normal upgrade with an unmodified "
127 "original firmware"), LOGINFO
);
128 logInstall(LogRemove
);
132 BootloaderInstallBase::BootloaderType
BootloaderInstallMpio::installed(void)
134 return BootloaderUnknown
;
137 BootloaderInstallBase::Capabilities
BootloaderInstallMpio::capabilities(void)
139 return (Install
| NeedsOf
);