1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Maurus Cuelenaere 2009-08-16 20:39:00 +00:00
parent aaf3765669
commit e8c71aa40c
9 changed files with 544 additions and 1 deletions

View file

@ -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 "

View file

@ -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);
}

View file

@ -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