Skip to content

Instantly share code, notes, and snippets.

@metaphys
Created November 22, 2011 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save metaphys/1386580 to your computer and use it in GitHub Desktop.
Save metaphys/1386580 to your computer and use it in GitHub Desktop.
imx.ccp
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
*
* Copyright (C) 2008 by Dominik Riebeling
*
* 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 "bootloaderinstallimx.h"
#include "../mkimxboot/mkimxboot.h"
#include "utils.h"
BootloaderInstallImx::BootloaderInstallImx(QObject *parent)
: BootloaderInstallBase(parent)
{
}
QString BootloaderInstallImx::ofHint()
{
return tr("Bootloader installation requires you to provide "
"a copy of the original Sandisk firmware (sb file). "
"This firmware file will be patched and then installed to your "
"player along with the rockbox bootloader. "
"You need to download this file yourself due to legal "
"reasons. Please browse the "
"<a href='http://forums.sandisk.com/sansa/'>Sansa Forums'</a> "
//"or refer to the "
//"<a href='http://www.rockbox.org/manual.shtml'>manual</a> and "
//"the <a href='http://www.rockbox.org/wiki/SansaAMS'>SansaAMS</a> "
//"wiki page on how to obtain this file.<br/>"
"Press Ok to continue and browse your computer for the firmware "
"file.");
}
/** Start bootloader installation.
*/
bool BootloaderInstallImx::install(void)
{
if(m_offile.isEmpty())
return false;
//qDebug() << "[BootloaderInstallImx] installing bootloader";
// download firmware from server
//emit logItem(tr("Downloading bootloader file"), LOGINFO);
//connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
//downloadBlStart(m_blurl);
return true;
}
void BootloaderInstallImx::installStage2(void)
{
qDebug() << "[BootloaderInstallImx] installStage2";
m_tempfile.open();
QString bootfile = m_tempfile.fileName();
m_tempfile.close();
struct imx_option_t opt;
/* default option untill we know how to use the interface :) TODO */
opt.debug = true;
opt.output = IMX_DUALBOOT;
const char* outfile = "firmware.sb";
enum imx_error_t err = mkimxboot(m_offile.toLocal8Bit().data(), bootfile.toLocal8Bit().data(), outfile, opt);
//end of install
if (err == 0)
{
qDebug() << "[BootloaderInstallImx] install successfull";
emit logItem(tr("Success: modified firmware file created"), LOGINFO);
logInstall(LogAdd);
emit done(false);
}
return;
}
bool BootloaderInstallImx::uninstall(void)
{
emit logItem(tr("To uninstall, perform a normal upgrade with an unmodified "
"original firmware"), LOGINFO);
logInstall(LogRemove);
return false;
}
BootloaderInstallBase::BootloaderType BootloaderInstallImx::installed(void)
{
return BootloaderUnknown;
}
BootloaderInstallBase::Capabilities BootloaderInstallImx::capabilities(void)
{
return (Install | NeedsOf);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment