1
0
Fork 0
forked from len0rd/rockbox

Clean up bootloader installation debug output a bit.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22219 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2009-08-09 10:57:33 +00:00
parent 7aaa544f09
commit 63ba647ee0
7 changed files with 40 additions and 35 deletions

View file

@ -50,8 +50,8 @@ void BootloaderInstallBase::downloadBlStart(QUrl source)
void BootloaderInstallBase::downloadReqFinished(int id, bool error) void BootloaderInstallBase::downloadReqFinished(int id, bool error)
{ {
qDebug() << __FILE__ << "::" << __func__ << id << error; qDebug() << "[BootloaderInstallBase] Download Request" << id
qDebug() << "error:" << m_http.errorString(); << "finished, error:" << m_http.errorString();
downloadBlFinish(error); downloadBlFinish(error);
} }
@ -59,7 +59,8 @@ void BootloaderInstallBase::downloadReqFinished(int id, bool error)
void BootloaderInstallBase::downloadBlFinish(bool error) void BootloaderInstallBase::downloadBlFinish(bool error)
{ {
qDebug() << __FILE__ << "::" << __func__ << ": error =" << error; qDebug() << "[BootloaderInstallBase] Downloading bootloader finished, error:"
<< error;
// update progress bar // update progress bar
emit logProgress(100, 100); emit logProgress(100, 100);
@ -88,7 +89,7 @@ void BootloaderInstallBase::downloadBlFinish(bool error)
void BootloaderInstallBase::installBlfile(void) void BootloaderInstallBase::installBlfile(void)
{ {
qDebug() << __FILE__ << __func__; qDebug() << "[BootloaderInstallBase]" << __func__;
} }
@ -98,7 +99,7 @@ void BootloaderInstallBase::installBlfile(void)
bool BootloaderInstallBase::backup(QString to) bool BootloaderInstallBase::backup(QString to)
{ {
qDebug() << __func__; qDebug() << "[BootloaderInstallBase] Backing up bootloader file";
QDir targetDir("."); QDir targetDir(".");
emit logItem(tr("Creating backup of original firmware file."), LOGINFO); emit logItem(tr("Creating backup of original firmware file."), LOGINFO);
if(!targetDir.mkpath(to)) { if(!targetDir.mkpath(to)) {
@ -106,7 +107,7 @@ bool BootloaderInstallBase::backup(QString to)
return false; return false;
} }
QString tofile = to + "/" + QFileInfo(m_blfile).fileName(); QString tofile = to + "/" + QFileInfo(m_blfile).fileName();
qDebug() << "trying to backup" << m_blfile << "to" << tofile; qDebug() << "[BootloaderInstallBase] trying to backup" << m_blfile << "to" << tofile;
if(!QFile::copy(resolvePathCase(m_blfile), tofile)) { if(!QFile::copy(resolvePathCase(m_blfile), tofile)) {
emit logItem(tr("Creating backup copy failed."), LOGERROR); emit logItem(tr("Creating backup copy failed."), LOGERROR);
return false; return false;
@ -128,7 +129,8 @@ int BootloaderInstallBase::logInstall(LogMode mode)
if(mode == LogAdd) { if(mode == LogAdd) {
s.setValue("Bootloader/" + section, m_blversion.toString(Qt::ISODate)); s.setValue("Bootloader/" + section, m_blversion.toString(Qt::ISODate));
qDebug() << m_blversion.toString(Qt::ISODate); qDebug() << "[BootloaderInstallBase] Writing log, version:"
<< m_blversion.toString(Qt::ISODate);
} }
else { else {
s.remove("Bootloader/" + section); s.remove("Bootloader/" + section);

View file

@ -49,7 +49,7 @@ class BootloaderInstallBase : public QObject
virtual BootloaderType installed(void)=0; virtual BootloaderType installed(void)=0;
//! returns the capabilities of the bootloader class //! returns the capabilities of the bootloader class
virtual Capabilities capabilities(void)=0; virtual Capabilities capabilities(void)=0;
//! returns a OF Firmware hint or empty if there is none //! returns a OF Firmware hint or empty if there is none
virtual QString ofHint() {return QString();} virtual QString ofHint() {return QString();}
@ -66,8 +66,9 @@ class BootloaderInstallBase : public QObject
void setOfFile(QString f) void setOfFile(QString f)
{m_offile = f;} {m_offile = f;}
//! returns a port Install Hint or empty if there is none //! returns a port Install Hint or empty if there is none
//! static and in the base class, so the installer classes dont need to be modified for new targets //! static and in the base class, so the installer classes dont need to
// be modified for new targets
static QString postinstallHints(QString model); static QString postinstallHints(QString model);
protected slots: protected slots:

View file

@ -33,7 +33,7 @@ BootloaderInstallFile::BootloaderInstallFile(QObject *parent)
bool BootloaderInstallFile::install(void) bool BootloaderInstallFile::install(void)
{ {
emit logItem(tr("Downloading bootloader"), LOGINFO); emit logItem(tr("Downloading bootloader"), LOGINFO);
qDebug() << __func__; qDebug() << "[BootloaderInstallFile] installing bootloader";
downloadBlStart(m_blurl); downloadBlStart(m_blurl);
connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
return true; return true;
@ -48,7 +48,7 @@ void BootloaderInstallFile::installStage2(void)
QString fwfile(resolvePathCase(m_blfile)); QString fwfile(resolvePathCase(m_blfile));
if(!fwfile.isEmpty()) { if(!fwfile.isEmpty()) {
QString moved = resolvePathCase(m_blfile) + ".ORIG"; QString moved = resolvePathCase(m_blfile) + ".ORIG";
qDebug() << "renaming" << fwfile << "->" << moved; qDebug() << "[BootloaderInstallFile] renaming" << fwfile << "to" << moved;
QFile::rename(fwfile, moved); QFile::rename(fwfile, moved);
} }
@ -82,7 +82,7 @@ void BootloaderInstallFile::installStage2(void)
// place (new) bootloader // place (new) bootloader
m_tempfile.open(); m_tempfile.open();
qDebug() << "renaming" << m_tempfile.fileName() << "->" << fwfile; qDebug() << "[BootloaderInstallFile] renaming" << m_tempfile.fileName() << "to" << fwfile;
m_tempfile.close(); m_tempfile.close();
m_tempfile.rename(fwfile); m_tempfile.rename(fwfile);
@ -95,7 +95,7 @@ void BootloaderInstallFile::installStage2(void)
bool BootloaderInstallFile::uninstall(void) bool BootloaderInstallFile::uninstall(void)
{ {
qDebug() << __func__; qDebug() << "[BootloaderInstallFile] Uninstalling bootloader";
emit logItem(tr("Removing Rockbox bootloader"), LOGINFO); emit logItem(tr("Removing Rockbox bootloader"), LOGINFO);
// check if a .ORIG file is present, and allow moving it back. // check if a .ORIG file is present, and allow moving it back.
QString origbl = resolvePathCase(m_blfile + ".ORIG"); QString origbl = resolvePathCase(m_blfile + ".ORIG");
@ -127,7 +127,7 @@ bool BootloaderInstallFile::uninstall(void)
//! @return BootloaderRockbox, BootloaderOther or BootloaderUnknown. //! @return BootloaderRockbox, BootloaderOther or BootloaderUnknown.
BootloaderInstallBase::BootloaderType BootloaderInstallFile::installed(void) BootloaderInstallBase::BootloaderType BootloaderInstallFile::installed(void)
{ {
qDebug("%s()", __func__); qDebug() << "[BootloaderInstallFile] checking installed bootloader";
if(!resolvePathCase(m_blfile).isEmpty() if(!resolvePathCase(m_blfile).isEmpty()
&& !resolvePathCase(m_blfile + ".ORIG").isEmpty()) && !resolvePathCase(m_blfile + ".ORIG").isEmpty())
return BootloaderRockbox; return BootloaderRockbox;
@ -140,7 +140,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallFile::installed(void)
BootloaderInstallBase::Capabilities BootloaderInstallFile::capabilities(void) BootloaderInstallBase::Capabilities BootloaderInstallFile::capabilities(void)
{ {
qDebug() << __func__; qDebug() << "[BootloaderInstallFile] getting capabilities";
return Install | IsFile | CanCheckInstalled | Backup; return Install | IsFile | CanCheckInstalled | Backup;
} }

View file

@ -74,7 +74,7 @@ bool BootloaderInstallHex::install(void)
file.close(); file.close();
QString hash = QCryptographicHash::hash(filedata, QString hash = QCryptographicHash::hash(filedata,
QCryptographicHash::Md5).toHex(); QCryptographicHash::Md5).toHex();
qDebug() << "hexfile hash:" << hash; qDebug() << "[BootloaderInstallHex] hexfile hash:" << hash;
if(file.error() != QFile::NoError) { if(file.error() != QFile::NoError) {
emit logItem(tr("Could not verify original firmware file"), LOGERROR); emit logItem(tr("Could not verify original firmware file"), LOGERROR);
emit done(true); emit done(true);
@ -112,7 +112,7 @@ bool BootloaderInstallHex::install(void)
int result; int result;
result = iriver_decode(m_offile.toAscii().data(), result = iriver_decode(m_offile.toAscii().data(),
m_descrambled.fileName().toAscii().data(), FALSE, STRIP_NONE); m_descrambled.fileName().toAscii().data(), FALSE, STRIP_NONE);
qDebug() << "iriver_decode" << result; qDebug() << "[BootloaderInstallHex] iriver_decode" << result;
if(result < 0) { if(result < 0) {
emit logItem(tr("Error in descramble: %1").arg(scrambleError(result)), LOGERROR); emit logItem(tr("Error in descramble: %1").arg(scrambleError(result)), LOGERROR);
@ -200,7 +200,7 @@ void BootloaderInstallHex::installStage2(void)
targethex.close(); targethex.close();
QString hash = QCryptographicHash::hash(filedata, QString hash = QCryptographicHash::hash(filedata,
QCryptographicHash::Md5).toHex(); QCryptographicHash::Md5).toHex();
qDebug() << "created hexfile hash:" << hash; qDebug() << "[BootloaderInstallHex] created hexfile hash:" << hash;
emit logItem(tr("Checking modified firmware file"), LOGINFO); emit logItem(tr("Checking modified firmware file"), LOGINFO);
if(hash != QString(md5sums[m_hashindex].patched)) { if(hash != QString(md5sums[m_hashindex].patched)) {

View file

@ -140,7 +140,7 @@ void BootloaderInstallIpod::installStage2(void)
emit done(true); emit done(true);
return; return;
} }
qDebug() << "version installed:" << m_blversion.toString(Qt::ISODate); qDebug() << "[BootloaderInstallIpod] version installed:" << m_blversion.toString(Qt::ISODate);
} }
@ -203,17 +203,17 @@ BootloaderInstallBase::BootloaderType BootloaderInstallIpod::installed(void)
BootloaderInstallBase::BootloaderType result = BootloaderRockbox; BootloaderInstallBase::BootloaderType result = BootloaderRockbox;
if(!ipodInitialize(&ipod)) { if(!ipodInitialize(&ipod)) {
qDebug() << "BootloaderInstallIpod::installed(): BootloaderUnknown"; qDebug() << "[BootloaderInstallIpod] installed: BootloaderUnknown";
result = BootloaderUnknown; result = BootloaderUnknown;
} }
else { else {
read_directory(&ipod); read_directory(&ipod);
if(ipod.ipod_directory[0].entryOffset == 0) { if(ipod.ipod_directory[0].entryOffset == 0) {
qDebug() << "BootloaderInstallIpod::installed(): BootloaderOther"; qDebug() << "[BootloaderInstallIpod] installed: BootloaderOther";
result = BootloaderOther; result = BootloaderOther;
} }
else { else {
qDebug() << "BootloaderInstallIpod::installed(): BootloaderRockbox"; qDebug() << "[BootloaderInstallIpod] installed: BootloaderRockbox";
} }
} }
ipod_close(&ipod); ipod_close(&ipod);
@ -243,7 +243,8 @@ bool BootloaderInstallIpod::ipodInitialize(struct ipod_t *ipod)
qPrintable(Autodetection::resolveDevicename(m_blfile) qPrintable(Autodetection::resolveDevicename(m_blfile)
.remove(QRegExp("[0-9]+$")))); .remove(QRegExp("[0-9]+$"))));
#endif #endif
qDebug() << "ipodpatcher: overriding scan, using" << ipod->diskname; qDebug() << "[BootloaderInstallIpod] ipodpatcher: overriding scan, using"
<< ipod->diskname;
} }
else { else {
ipod_scan(ipod); ipod_scan(ipod);

View file

@ -32,7 +32,7 @@ BootloaderInstallMi4::BootloaderInstallMi4(QObject *parent)
bool BootloaderInstallMi4::install(void) bool BootloaderInstallMi4::install(void)
{ {
emit logItem(tr("Downloading bootloader"), LOGINFO); emit logItem(tr("Downloading bootloader"), LOGINFO);
qDebug() << __func__; qDebug() << "[BootloaderInstallMi4] installing bootloader";
downloadBlStart(m_blurl); downloadBlStart(m_blurl);
connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2()));
return true; return true;
@ -49,17 +49,17 @@ void BootloaderInstallMi4::installStage2(void)
QString moved = QFileInfo(resolvePathCase(m_blfile)).absolutePath() QString moved = QFileInfo(resolvePathCase(m_blfile)).absolutePath()
+ "/OF.mi4"; + "/OF.mi4";
if(!QFileInfo(moved).exists()) { if(!QFileInfo(moved).exists()) {
qDebug() << "renaming" << fwfile << "->" << moved; qDebug() << "[BootloaderInstallMi4] renaming" << fwfile << "to" << moved;
oldbl.rename(moved); oldbl.rename(moved);
} }
else { else {
qDebug() << "OF.mi4 already present, not renaming again."; qDebug() << "[BootloaderInstallMi4] OF.mi4 already present, not renaming again.";
oldbl.remove(); oldbl.remove();
} }
// place new bootloader // place new bootloader
m_tempfile.open(); m_tempfile.open();
qDebug() << "renaming" << m_tempfile.fileName() << "->" << fwfile; qDebug() << "[BootloaderInstallMi4] renaming" << m_tempfile.fileName() << "to" << fwfile;
m_tempfile.close(); m_tempfile.close();
m_tempfile.rename(fwfile); m_tempfile.rename(fwfile);
@ -72,7 +72,7 @@ void BootloaderInstallMi4::installStage2(void)
bool BootloaderInstallMi4::uninstall(void) bool BootloaderInstallMi4::uninstall(void)
{ {
qDebug() << __func__; qDebug() << "[BootloaderInstallMi4] Uninstalling bootloader";
// check if it's actually a Rockbox bootloader // check if it's actually a Rockbox bootloader
emit logItem(tr("Checking for Rockbox bootloader"), LOGINFO); emit logItem(tr("Checking for Rockbox bootloader"), LOGINFO);
@ -117,7 +117,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallMi4::installed(void)
QString resolved; QString resolved;
resolved = resolvePathCase(m_blfile); resolved = resolvePathCase(m_blfile);
if(resolved.isEmpty()) { if(resolved.isEmpty()) {
qDebug("%s: BootloaderNone", __func__); qDebug() << "[BootloaderInstallMi4] installed: BootloaderNone";
return BootloaderNone; return BootloaderNone;
} }
@ -129,11 +129,11 @@ BootloaderInstallBase::BootloaderType BootloaderInstallMi4::installed(void)
f.close(); f.close();
if(!memcmp(magic, "RBBL", 4)) { if(!memcmp(magic, "RBBL", 4)) {
qDebug("%s: BootloaderRockbox", __func__); qDebug() << "[BootloaderInstallMi4] installed: BootloaderRockbox";
return BootloaderRockbox; return BootloaderRockbox;
} }
else { else {
qDebug("%s: BootloaderOther", __func__); qDebug() << "[BootloaderInstallMi4] installed: BootloaderOther";
return BootloaderOther; return BootloaderOther;
} }
} }
@ -141,7 +141,7 @@ BootloaderInstallBase::BootloaderType BootloaderInstallMi4::installed(void)
BootloaderInstallBase::Capabilities BootloaderInstallMi4::capabilities(void) BootloaderInstallBase::Capabilities BootloaderInstallMi4::capabilities(void)
{ {
qDebug() << __func__; qDebug() << "[BootloaderInstallMi4] getting capabilities";
return Install | Uninstall | Backup | IsFile | CanCheckInstalled | CanCheckVersion; return Install | Uninstall | Backup | IsFile | CanCheckInstalled | CanCheckVersion;
} }

View file

@ -125,7 +125,7 @@ void BootloaderInstallSansa::installStage2(void)
m_tempfile.close(); m_tempfile.close();
if(memcmp(sansa.targetname, magic, 4) != 0) { if(memcmp(sansa.targetname, magic, 4) != 0) {
emit logItem(tr("Bootloader mismatch! Aborting."), LOGERROR); emit logItem(tr("Bootloader mismatch! Aborting."), LOGERROR);
qDebug("[BL-Sansa] Targetname: %s, mi4 magic: %c%c%c%c", qDebug("[BootloaderInstallSansa] Targetname: %s, mi4 magic: %c%c%c%c",
sansa.targetname, magic[0], magic[1], magic[2], magic[3]); sansa.targetname, magic[0], magic[1], magic[2], magic[3]);
emit done(true); emit done(true);
sansa_close(&sansa); sansa_close(&sansa);
@ -230,7 +230,8 @@ bool BootloaderInstallSansa::sansaInitialize(struct sansa_t *sansa)
sprintf(sansa->diskname, sprintf(sansa->diskname,
qPrintable(Autodetection::resolveDevicename(m_blfile).remove(QRegExp("[0-9]+$")))); qPrintable(Autodetection::resolveDevicename(m_blfile).remove(QRegExp("[0-9]+$"))));
#endif #endif
qDebug() << "sansapatcher: overriding scan, using" << sansa->diskname; qDebug() << "[BootloaderInstallSansa] sansapatcher: overriding scan, using"
<< sansa->diskname;
} }
else if(sansa_scan(sansa) != 1) { else if(sansa_scan(sansa) != 1) {
emit logItem(tr("Can't find Sansa"), LOGERROR); emit logItem(tr("Can't find Sansa"), LOGERROR);