mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 20:55:17 -05:00
rbutilQt: Add downloading of a bootloaders-info file, with md5sums from the bootloaders, to make a version check. Also added the bootloader to the installlog.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14462 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
848abc8037
commit
0aeea5d9a7
5 changed files with 190 additions and 20 deletions
|
|
@ -179,6 +179,108 @@ void BootloaderInstaller::installEnded(bool error)
|
||||||
m_dp->abort();
|
m_dp->abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool BootloaderInstaller::downloadInfo()
|
||||||
|
{
|
||||||
|
// try to get the current build information
|
||||||
|
infodownloader = new HttpGet(this);
|
||||||
|
|
||||||
|
connect(infodownloader, SIGNAL(done(bool)), this, SLOT(infoDownloadDone(bool)));
|
||||||
|
connect(infodownloader, SIGNAL(requestFinished(int, bool)), this, SLOT(infoRequestFinished(int, bool)));
|
||||||
|
|
||||||
|
infodownloader->setProxy(m_proxy);
|
||||||
|
|
||||||
|
qDebug() << "downloading bootloader info";
|
||||||
|
infodownloader->setFile(&bootloaderInfo);
|
||||||
|
infodownloader->getFile(QUrl(m_bootloaderinfoUrl));
|
||||||
|
|
||||||
|
// block until its downloaded
|
||||||
|
qDebug() << "Waiting for Download finished";
|
||||||
|
infoDownloaded=false;
|
||||||
|
infoError = false;
|
||||||
|
while(!infoDownloaded )
|
||||||
|
QApplication::processEvents();
|
||||||
|
return !infoError;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BootloaderInstaller::infoDownloadDone(bool error)
|
||||||
|
{
|
||||||
|
if(error)
|
||||||
|
{
|
||||||
|
qDebug() << "network error:" << infodownloader->error();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
qDebug() << "network status:" << infodownloader->error();
|
||||||
|
|
||||||
|
infoDownloaded = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void BootloaderInstaller::infoRequestFinished(int id, bool error)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(error)
|
||||||
|
{
|
||||||
|
QString errorString;
|
||||||
|
errorString = tr("Network error: %1. Please check your network and proxy settings.")
|
||||||
|
.arg(infodownloader->errorString());
|
||||||
|
if(error) QMessageBox::about(NULL, "Network Error", errorString);
|
||||||
|
qDebug() << "downloadDone:" << id << error;
|
||||||
|
|
||||||
|
infoError = true;
|
||||||
|
infoDownloaded = true;
|
||||||
|
}
|
||||||
|
qDebug() << "infoRequestFinished:" << id << error;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BootloaderInstaller::createInstallLog()
|
||||||
|
{
|
||||||
|
m_dp->addItem(tr("Creating installation log"),LOGINFO);
|
||||||
|
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
|
||||||
|
|
||||||
|
bootloaderInfo.open();
|
||||||
|
QSettings info(bootloaderInfo.fileName(), QSettings::IniFormat, this);
|
||||||
|
bootloaderInfo.close();
|
||||||
|
info.beginGroup(m_device);
|
||||||
|
|
||||||
|
installlog.beginGroup("Bootloader");
|
||||||
|
installlog.setValue("md5sum",info.value("md5sum").toString());
|
||||||
|
installlog.endGroup();
|
||||||
|
installlog.sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void BootloaderInstaller::removeInstallLog()
|
||||||
|
{
|
||||||
|
m_dp->addItem(tr("Editing installation log"),LOGINFO);
|
||||||
|
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
|
||||||
|
installlog.beginGroup("Bootloader");
|
||||||
|
installlog.remove("md5sum");
|
||||||
|
installlog.endGroup();
|
||||||
|
installlog.sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool BootloaderInstaller::uptodate()
|
||||||
|
{
|
||||||
|
QString installedMd5;
|
||||||
|
QString serverMd5;
|
||||||
|
|
||||||
|
QSettings installlog(m_mountpoint + "/.rockbox/rbutil.log", QSettings::IniFormat, 0);
|
||||||
|
installlog.beginGroup("Bootloader");
|
||||||
|
installedMd5 = installlog.value("md5sum").toString();
|
||||||
|
installlog.endGroup();
|
||||||
|
|
||||||
|
bootloaderInfo.open();
|
||||||
|
QSettings info(bootloaderInfo.fileName(), QSettings::IniFormat, this);
|
||||||
|
bootloaderInfo.close();
|
||||||
|
info.beginGroup(m_device);
|
||||||
|
serverMd5 = info.value("md5sum").toString();
|
||||||
|
info.endGroup();
|
||||||
|
|
||||||
|
if(installedMd5 != serverMd5)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
*** gigabeat secific code
|
*** gigabeat secific code
|
||||||
|
|
@ -244,6 +346,8 @@ void BootloaderInstaller::gigabeatPrepare()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeInstallLog();
|
||||||
|
|
||||||
emit done(false); //success
|
emit done(false); //success
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -301,6 +405,8 @@ void BootloaderInstaller::gigabeatFinish()
|
||||||
|
|
||||||
downloadFile.remove();
|
downloadFile.remove();
|
||||||
|
|
||||||
|
createInstallLog();
|
||||||
|
|
||||||
m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK);
|
m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK);
|
||||||
m_dp->addItem(tr("To finish the Bootloader installation, follow the steps below."),LOGINFO);
|
m_dp->addItem(tr("To finish the Bootloader installation, follow the steps below."),LOGINFO);
|
||||||
m_dp->addItem(tr("1. Eject/Unmount your Device."),LOGINFO);
|
m_dp->addItem(tr("1. Eject/Unmount your Device."),LOGINFO);
|
||||||
|
|
@ -357,6 +463,8 @@ void BootloaderInstaller::iaudioFinish()
|
||||||
|
|
||||||
downloadFile.remove();
|
downloadFile.remove();
|
||||||
|
|
||||||
|
createInstallLog();
|
||||||
|
|
||||||
m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK);
|
m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK);
|
||||||
m_dp->addItem(tr("To finish the Bootloader installation, follow the steps below."),LOGINFO);
|
m_dp->addItem(tr("To finish the Bootloader installation, follow the steps below."),LOGINFO);
|
||||||
m_dp->addItem(tr("1. Eject/Unmount your Device."),LOGINFO);
|
m_dp->addItem(tr("1. Eject/Unmount your Device."),LOGINFO);
|
||||||
|
|
@ -448,6 +556,8 @@ void BootloaderInstaller::h10Prepare()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
removeInstallLog();
|
||||||
|
|
||||||
emit done(false); //success
|
emit done(false); //success
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -504,6 +614,8 @@ void BootloaderInstaller::h10Finish()
|
||||||
|
|
||||||
downloadFile.remove();
|
downloadFile.remove();
|
||||||
|
|
||||||
|
createInstallLog();
|
||||||
|
|
||||||
m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK);
|
m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK);
|
||||||
m_dp->abort();
|
m_dp->abort();
|
||||||
|
|
||||||
|
|
@ -639,6 +751,7 @@ void BootloaderInstaller::ipodPrepare()
|
||||||
if (delete_bootloader(&ipod)==0)
|
if (delete_bootloader(&ipod)==0)
|
||||||
{
|
{
|
||||||
m_dp->addItem(tr("Successfully removed Bootloader"),LOGOK);
|
m_dp->addItem(tr("Successfully removed Bootloader"),LOGOK);
|
||||||
|
removeInstallLog();
|
||||||
emit done(false);
|
emit done(false);
|
||||||
ipod_close(&ipod);
|
ipod_close(&ipod);
|
||||||
return;
|
return;
|
||||||
|
|
@ -729,6 +842,7 @@ void BootloaderInstaller::ipodFinish()
|
||||||
if (add_bootloader(&ipod, m_tempfilename.toLatin1().data(), FILETYPE_DOT_IPOD)==0)
|
if (add_bootloader(&ipod, m_tempfilename.toLatin1().data(), FILETYPE_DOT_IPOD)==0)
|
||||||
{
|
{
|
||||||
m_dp->addItem(tr("Successfully added Bootloader"),LOGOK);
|
m_dp->addItem(tr("Successfully added Bootloader"),LOGOK);
|
||||||
|
createInstallLog();
|
||||||
emit done(false);
|
emit done(false);
|
||||||
ipod_close(&ipod);
|
ipod_close(&ipod);
|
||||||
return;
|
return;
|
||||||
|
|
@ -839,6 +953,7 @@ void BootloaderInstaller::sansaPrepare()
|
||||||
if (sansa_delete_bootloader(&sansa)==0)
|
if (sansa_delete_bootloader(&sansa)==0)
|
||||||
{
|
{
|
||||||
m_dp->addItem(tr("Successfully removed Bootloader"),LOGOK);
|
m_dp->addItem(tr("Successfully removed Bootloader"),LOGOK);
|
||||||
|
removeInstallLog();
|
||||||
emit done(false);
|
emit done(false);
|
||||||
sansa_close(&sansa);
|
sansa_close(&sansa);
|
||||||
return;
|
return;
|
||||||
|
|
@ -903,6 +1018,7 @@ void BootloaderInstaller::sansaFinish()
|
||||||
if (sansa_add_bootloader(&sansa, m_tempfilename.toLatin1().data(), FILETYPE_MI4)==0)
|
if (sansa_add_bootloader(&sansa, m_tempfilename.toLatin1().data(), FILETYPE_MI4)==0)
|
||||||
{
|
{
|
||||||
m_dp->addItem(tr("Successfully added Bootloader"),LOGOK);
|
m_dp->addItem(tr("Successfully added Bootloader"),LOGOK);
|
||||||
|
createInstallLog();
|
||||||
emit done(false);
|
emit done(false);
|
||||||
sansa_close(&sansa);
|
sansa_close(&sansa);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1070,7 +1186,10 @@ void BootloaderInstaller::iriverFinish()
|
||||||
dest = m_mountpoint + "/ihp_120.hex";
|
dest = m_mountpoint + "/ihp_120.hex";
|
||||||
else if(series == 300)
|
else if(series == 300)
|
||||||
dest = m_mountpoint + "/H300.hex";
|
dest = m_mountpoint + "/H300.hex";
|
||||||
|
|
||||||
// copy file
|
// copy file
|
||||||
|
QFile destfile(dest);
|
||||||
|
if(destfile.exists()) destfile.remove();
|
||||||
if(!newHex.copy(dest))
|
if(!newHex.copy(dest))
|
||||||
{
|
{
|
||||||
m_dp->addItem(tr("Could not copy: %1 to %2")
|
m_dp->addItem(tr("Could not copy: %1 to %2")
|
||||||
|
|
@ -1082,6 +1201,8 @@ void BootloaderInstaller::iriverFinish()
|
||||||
downloadFile.remove();
|
downloadFile.remove();
|
||||||
newHex.remove();
|
newHex.remove();
|
||||||
|
|
||||||
|
createInstallLog();
|
||||||
|
|
||||||
m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK);
|
m_dp->addItem(tr("Bootloader install finished successfully."),LOGOK);
|
||||||
m_dp->addItem(tr("To finish the Bootloader installation, follow the steps below."),LOGINFO);
|
m_dp->addItem(tr("To finish the Bootloader installation, follow the steps below."),LOGINFO);
|
||||||
m_dp->addItem(tr("1. Eject/Unmount your Device."),LOGINFO);
|
m_dp->addItem(tr("1. Eject/Unmount your Device."),LOGINFO);
|
||||||
|
|
|
||||||
|
|
@ -48,23 +48,31 @@ public:
|
||||||
|
|
||||||
void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
|
void setMountPoint(QString mountpoint) {m_mountpoint = mountpoint;}
|
||||||
void setProxy(QUrl proxy) {m_proxy= proxy;}
|
void setProxy(QUrl proxy) {m_proxy= proxy;}
|
||||||
void setDevice(QString device) {m_device= device;} // the current plattform
|
void setDevice(QString device) {m_device= device;} //!< the current plattform
|
||||||
void setBootloaderMethod(QString method) {m_bootloadermethod= method;}
|
void setBootloaderMethod(QString method) {m_bootloadermethod= method;}
|
||||||
void setBootloaderName(QString name){m_bootloadername= name;}
|
void setBootloaderName(QString name){m_bootloadername= name;}
|
||||||
void setBootloaderBaseUrl(QString baseUrl){m_bootloaderUrlBase = baseUrl;}
|
void setBootloaderBaseUrl(QString baseUrl){m_bootloaderUrlBase = baseUrl;}
|
||||||
void setOrigFirmwarePath(QString path) {m_origfirmware = path;} //for iriver original firmware
|
void setOrigFirmwarePath(QString path) {m_origfirmware = path;} //!< for iriver original firmware
|
||||||
|
void setBootloaderInfoUrl(QString url) {m_bootloaderinfoUrl =url; } //!< the url for the info file
|
||||||
|
bool downloadInfo(); //!< should be called before install/uninstall, blocks until downloaded.
|
||||||
|
bool uptodate(); //!< returns wether the bootloader is uptodate
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done(bool error); //installation finished.
|
void done(bool error); //installation finished.
|
||||||
|
|
||||||
// internal signals. Dont use this from out side.
|
signals: // internal signals. Dont use this from out side.
|
||||||
void prepare();
|
void prepare();
|
||||||
void finish();
|
void finish();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void createInstallLog(); // adds the bootloader entry to the log
|
||||||
|
void removeInstallLog(); // removes the bootloader entry from the log
|
||||||
|
|
||||||
void updateDataReadProgress(int, int);
|
void updateDataReadProgress(int, int);
|
||||||
void downloadDone(bool);
|
void downloadDone(bool);
|
||||||
void downloadRequestFinished(int, bool);
|
void downloadRequestFinished(int, bool);
|
||||||
|
void infoDownloadDone(bool);
|
||||||
|
void infoRequestFinished(int, bool);
|
||||||
void installEnded(bool);
|
void installEnded(bool);
|
||||||
|
|
||||||
// gigabeat specific routines
|
// gigabeat specific routines
|
||||||
|
|
@ -92,9 +100,16 @@ private slots:
|
||||||
void iriverFinish();
|
void iriverFinish();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
HttpGet *infodownloader;
|
||||||
|
QTemporaryFile bootloaderInfo;
|
||||||
|
volatile bool infoDownloaded;
|
||||||
|
volatile bool infoError;
|
||||||
|
|
||||||
QString m_mountpoint, m_device,m_bootloadermethod,m_bootloadername;
|
QString m_mountpoint, m_device,m_bootloadermethod,m_bootloadername;
|
||||||
QString m_bootloaderUrlBase,m_tempfilename,m_origfirmware;
|
QString m_bootloaderUrlBase,m_tempfilename,m_origfirmware;
|
||||||
QUrl m_proxy;
|
QUrl m_proxy;
|
||||||
|
QString m_bootloaderinfoUrl;
|
||||||
bool m_install;
|
bool m_install;
|
||||||
|
|
||||||
int series,table_entry; // for fwpatcher
|
int series,table_entry; // for fwpatcher
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,7 @@ void ZipInstaller::downloadDone(bool error)
|
||||||
installlog.setValue(zipContents.at(i), m_logver);
|
installlog.setValue(zipContents.at(i), m_logver);
|
||||||
}
|
}
|
||||||
installlog.endGroup();
|
installlog.endGroup();
|
||||||
|
installlog.sync();
|
||||||
|
|
||||||
emit cont();
|
emit cont();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ download_url=http://www.rockbox.org/download/
|
||||||
daily_url=http://download.rockbox.org/daily/
|
daily_url=http://download.rockbox.org/daily/
|
||||||
bleeding_url=http://build.rockbox.org/dist/build-
|
bleeding_url=http://build.rockbox.org/dist/build-
|
||||||
server_conf_url=http://www.rockbox.org/daily/build-info
|
server_conf_url=http://www.rockbox.org/daily/build-info
|
||||||
|
#bootloader_info_url=http://download.rockbox.org/bootloader/bootloaders-info
|
||||||
|
bootloader_info_url=http://b23.org/~domonoky/bootloaders-info
|
||||||
bleeding_info=http://build.rockbox.org/cvsmod/build-info
|
bleeding_info=http://build.rockbox.org/cvsmod/build-info
|
||||||
font_url=http://www.rockbox.org/daily/fonts/rockbox-fonts.zip
|
font_url=http://www.rockbox.org/daily/fonts/rockbox-fonts.zip
|
||||||
last_release=2.5
|
last_release=2.5
|
||||||
|
|
|
||||||
|
|
@ -338,6 +338,40 @@ void RbUtilQt::installBl()
|
||||||
|
|
||||||
QString platform = userSettings->value("defaults/platform").toString();
|
QString platform = userSettings->value("defaults/platform").toString();
|
||||||
|
|
||||||
|
// create installer
|
||||||
|
blinstaller = new BootloaderInstaller(this);
|
||||||
|
|
||||||
|
blinstaller->setMountPoint(userSettings->value("defaults/mountpoint").toString());
|
||||||
|
|
||||||
|
blinstaller->setProxy(proxy());
|
||||||
|
blinstaller->setDevice(platform);
|
||||||
|
blinstaller->setBootloaderMethod(devices->value(platform + "/bootloadermethod").toString());
|
||||||
|
blinstaller->setBootloaderName(devices->value(platform + "/bootloadername").toString());
|
||||||
|
blinstaller->setBootloaderBaseUrl(devices->value("bootloader_url").toString());
|
||||||
|
blinstaller->setBootloaderInfoUrl(devices->value("bootloader_info_url").toString());
|
||||||
|
if(!blinstaller->downloadInfo())
|
||||||
|
{
|
||||||
|
logger->addItem(tr("Could not get the bootloader info file!"),LOGERROR);
|
||||||
|
logger->abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(blinstaller->uptodate())
|
||||||
|
{
|
||||||
|
int ret = QMessageBox::question(this, tr("Bootloader Installation"),
|
||||||
|
tr("It seem your Bootloader is already uptodate.\n"
|
||||||
|
"Do really want to install it?"),
|
||||||
|
QMessageBox::Ok | QMessageBox::Cancel,
|
||||||
|
QMessageBox::Cancel);
|
||||||
|
if(ret == QMessageBox::Cancel)
|
||||||
|
{
|
||||||
|
logger->addItem(tr("Bootloader installation Canceled!"),LOGERROR);
|
||||||
|
logger->abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// if fwpatcher , ask for extra file
|
// if fwpatcher , ask for extra file
|
||||||
QString offirmware;
|
QString offirmware;
|
||||||
if(devices->value(platform + "/bootloadermethod").toString() == "fwpatcher")
|
if(devices->value(platform + "/bootloadermethod").toString() == "fwpatcher")
|
||||||
|
|
@ -367,22 +401,11 @@ void RbUtilQt::installBl()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create installer
|
|
||||||
blinstaller = new BootloaderInstaller(this);
|
|
||||||
|
|
||||||
blinstaller->setMountPoint(userSettings->value("defaults/mountpoint").toString());
|
|
||||||
|
|
||||||
blinstaller->setProxy(proxy());
|
|
||||||
blinstaller->setDevice(platform);
|
|
||||||
blinstaller->setBootloaderMethod(devices->value(platform + "/bootloadermethod").toString());
|
|
||||||
blinstaller->setBootloaderName(devices->value(platform + "/bootloadername").toString());
|
|
||||||
blinstaller->setBootloaderBaseUrl(devices->value("bootloader_url").toString());
|
|
||||||
blinstaller->setOrigFirmwarePath(offirmware);
|
blinstaller->setOrigFirmwarePath(offirmware);
|
||||||
|
|
||||||
|
|
||||||
blinstaller->install(logger);
|
blinstaller->install(logger);
|
||||||
|
|
||||||
// connect(blinstaller, SIGNAL(done(bool)), this, SLOT(done(bool)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -507,6 +530,14 @@ void RbUtilQt::uninstallBootloader(void)
|
||||||
blinstaller.setBootloaderMethod(devices->value(plattform + "/bootloadermethod").toString());
|
blinstaller.setBootloaderMethod(devices->value(plattform + "/bootloadermethod").toString());
|
||||||
blinstaller.setBootloaderName(devices->value(plattform + "/bootloadername").toString());
|
blinstaller.setBootloaderName(devices->value(plattform + "/bootloadername").toString());
|
||||||
blinstaller.setBootloaderBaseUrl(devices->value("bootloader_url").toString());
|
blinstaller.setBootloaderBaseUrl(devices->value("bootloader_url").toString());
|
||||||
|
blinstaller.setBootloaderInfoUrl(devices->value("bootloader_info_url").toString());
|
||||||
|
if(!blinstaller.downloadInfo())
|
||||||
|
{
|
||||||
|
logger->addItem(tr("Could not get the bootloader info file!"),LOGERROR);
|
||||||
|
logger->abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
blinstaller.uninstall(logger);
|
blinstaller.uninstall(logger);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue