sansapatcher: factor out handling of bundled bootloaders.

Instead of handling bundled bootloaders in the sansapatcher functions leave
that to the caller. This removes the need to have Rockbox Utility specific
parts in sansapatcher. sansa_add_bootloader() now operates on an already loaded
bootloader. For loading a convenience function sansa_read_bootloader() is
added. This also introduces a new check on loading to prevent installing an
e200 bootloader on a c200 (and vice versa).

These changes will allow building a libsansapatcher for linking with Rockbox
Utility later.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31144 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2011-12-04 19:40:43 +00:00
parent 38890ac6dc
commit 38f03d4eae
4 changed files with 80 additions and 66 deletions

View file

@ -96,6 +96,8 @@ bool BootloaderInstallSansa::install(void)
void BootloaderInstallSansa::installStage2(void)
{
struct sansa_t sansa;
unsigned char* buf = NULL;
unsigned int len;
emit logItem(tr("Installing Rockbox bootloader"), LOGINFO);
QCoreApplication::processEvents();
@ -130,8 +132,8 @@ void BootloaderInstallSansa::installStage2(void)
return;
}
if(sansa_add_bootloader(&sansa, blfile.toLatin1().data(),
FILETYPE_MI4) == 0) {
len = sansa_read_bootloader(&sansa, blfile.toLatin1().data(), &buf);
if(sansa_add_bootloader(&sansa, buf, len) == 0) {
emit logItem(tr("Successfully installed bootloader"), LOGOK);
sansa_close(&sansa);
#if defined(Q_OS_MACX)