bool BootloaderInstallMi4::install(void) { emit logItem(tr("Downloading bootloader"), LOGINFO); qDebug() << "[BootloaderInstallMi4] installing bootloader"; downloadBlStart(m_blurl); connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); return true; }
bool BootloaderInstallTcc::install(void) { if(m_offile.isEmpty()) return false; // Download firmware from server emit logItem(tr("Downloading bootloader file"), LOGINFO); connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); downloadBlStart(m_blurl); return true; }
/** Start bootloader installation. */ bool BootloaderInstallSansa::install(void) { if(sansa_sectorbuf == NULL) { emit logItem(tr("Error: can't allocate buffer memory!"), LOGERROR); return false; emit done(true); } emit logItem(tr("Searching for Sansa"), LOGINFO); struct sansa_t sansa; int n = sansa_scan(&sansa); if(n == -1) { emit logItem(tr("Permission for disc access denied!\n" "This is required to install the bootloader"), LOGERROR); emit done(true); return false; } if(n == 0) { emit logItem(tr("No Sansa detected!"), LOGERROR); emit done(true); return false; } if(sansa.hasoldbootloader) { emit logItem(tr("OLD ROCKBOX INSTALLATION DETECTED, ABORTING.\n" "You must reinstall the original Sansa firmware before running\n" "sansapatcher for the first time.\n" "See http://www.rockbox.org/wiki/SansaE200Install\n"), LOGERROR); emit done(true); return false; } emit logItem(tr("Downloading bootloader file"), LOGINFO); downloadBlStart(m_blurl); connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); return true; }
bool BootloaderInstallHex::install(void) { if(m_offile.isEmpty()) return false; m_hashindex = -1; // md5sum hex file emit logItem(tr("checking MD5 hash of input file ..."), LOGINFO); QByteArray filedata; // read hex file into QByteArray QFile file(m_offile); file.open(QIODevice::ReadOnly); filedata = file.readAll(); file.close(); QString hash = QCryptographicHash::hash(filedata, QCryptographicHash::Md5).toHex(); qDebug() << "[BootloaderInstallHex] hexfile hash:" << hash; if(file.error() != QFile::NoError) { emit logItem(tr("Could not verify original firmware file"), LOGERROR); emit done(true); return false; } // check hash and figure model from md5sum int i = sizeof(md5sums) / sizeof(struct md5s); m_model = 4; // 3: h300, 2: h120, 1: h100, 0:invalid while(i--) { if(md5sums[i].orig == 0) m_model--; if(!qstrcmp(md5sums[i].orig, hash.toAscii())) break; } if(i < 0) { emit logItem(tr("Firmware file not recognized."), LOGERROR); return false; } else { emit logItem(tr("MD5 hash ok"), LOGOK); m_hashindex = i; } // check model agains download link. QString match[] = {"", "h100", "h120", "h300"}; if(!m_blurl.path().contains(match[m_model])) { emit logItem(tr("Firmware file doesn't match selected player."), LOGERROR); return false; } emit logItem(tr("Descrambling file"), LOGINFO); m_descrambled.open(); int result; result = iriver_decode(m_offile.toAscii().data(), m_descrambled.fileName().toAscii().data(), FALSE, STRIP_NONE); qDebug() << "[BootloaderInstallHex] iriver_decode" << result; if(result < 0) { emit logItem(tr("Error in descramble: %1").arg(scrambleError(result)), LOGERROR); return false; } // download firmware from server emit logItem(tr("Downloading bootloader file"), LOGINFO); connect(this, SIGNAL(downloadDone()), this, SLOT(installStage2())); downloadBlStart(m_blurl); return true; }