mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
mkamsboot/rbutil/amsinfo : do not try to detect the model of a given Sansa AMS OF
The field we thought was representative of the model is not, it has changed in the past for fuzev1 and fuzev2. For example the value 0x23 is found in 2 old fuzev1 OF versions, and in the c200v2 OF The only reliable way to detect the model of a given OF is by using the built-in list of md5sums. Modify mkamsboot and rbutilqt to load the rockbox bootloader first, and then check if the model in the bootloader corresponds to the model of the known md5sum of the given OF. That way we can continue to present the user with a list of known OF versions in case the OF is unknown to mkamsboot Also explicit the dependency of main.c on mkamsboot.h in case the prototypes change Correct the header's description not updated in r21648 git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26248 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
eae2464e9a
commit
ff6b0425e4
6 changed files with 60 additions and 116 deletions
|
|
@ -72,6 +72,7 @@ void BootloaderInstallAms::installStage2(void)
|
|||
struct md5sums sum;
|
||||
char md5sum[33]; /* 32 hex digits, plus terminating zero */
|
||||
int n;
|
||||
int model;
|
||||
int firmware_size;
|
||||
int bootloader_size;
|
||||
int patchable;
|
||||
|
|
@ -84,33 +85,33 @@ void BootloaderInstallAms::installStage2(void)
|
|||
QString bootfile = m_tempfile.fileName();
|
||||
m_tempfile.close();
|
||||
|
||||
/* Load original firmware file */
|
||||
buf = load_of_file(m_offile.toLocal8Bit().data(), &len,&sum,&firmware_size,
|
||||
&of_packed,&of_packedsize,errstr,sizeof(errstr));
|
||||
if (buf == NULL)
|
||||
{
|
||||
qDebug() << "[BootloaderInstallAms] could not load OF: " << m_offile;
|
||||
emit logItem(errstr, LOGERROR);
|
||||
emit logItem(tr("Could not load %1").arg(m_offile), LOGERROR);
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Load bootloader file */
|
||||
rb_packed = load_rockbox_file(bootfile.toLocal8Bit().data(), sum.model,
|
||||
rb_packed = load_rockbox_file(bootfile.toLocal8Bit().data(), &model,
|
||||
&bootloader_size,&rb_packedsize,
|
||||
errstr,sizeof(errstr));
|
||||
if (rb_packed == NULL)
|
||||
if (rb_packed == NULL)
|
||||
{
|
||||
qDebug() << "[BootloaderInstallAms] could not load bootloader: " << bootfile;
|
||||
emit logItem(errstr, LOGERROR);
|
||||
emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR);
|
||||
free(buf);
|
||||
free(of_packed);
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Load original firmware file */
|
||||
buf = load_of_file(m_offile.toLocal8Bit().data(), model, &len, &sum,
|
||||
&firmware_size, &of_packed ,&of_packedsize,
|
||||
errstr, sizeof(errstr));
|
||||
if (buf == NULL)
|
||||
{
|
||||
qDebug() << "[BootloaderInstallAms] could not load OF: " << m_offile;
|
||||
emit logItem(errstr, LOGERROR);
|
||||
emit logItem(tr("Could not load %1").arg(m_offile), LOGERROR);
|
||||
free(rb_packed);
|
||||
emit done(true);
|
||||
return;
|
||||
}
|
||||
|
||||
/* check total size */
|
||||
patchable = check_sizes(sum.model, rb_packedsize, bootloader_size,
|
||||
of_packedsize, firmware_size, &totalsize, errstr, sizeof(errstr));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue