summaryrefslogtreecommitdiff
path: root/rbutil/rbutilqt/base/bootloaderinstallams.cpp
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@gmail.com>2010-05-24 10:06:52 +0000
committerRafaël Carré <rafael.carre@gmail.com>2010-05-24 10:06:52 +0000
commitff6b0425e438add8d12393f90fdbfe93e1fb4746 (patch)
treeb8ac1a3254a8e01051a5d7f2c5c94e61bacd5c02 /rbutil/rbutilqt/base/bootloaderinstallams.cpp
parenteae2464e9a93dc3a8918abcc62348af6c8d9bc9b (diff)
downloadrockbox-ff6b0425e438add8d12393f90fdbfe93e1fb4746.tar.gz
rockbox-ff6b0425e438add8d12393f90fdbfe93e1fb4746.zip
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
Diffstat (limited to 'rbutil/rbutilqt/base/bootloaderinstallams.cpp')
-rw-r--r--rbutil/rbutilqt/base/bootloaderinstallams.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/rbutil/rbutilqt/base/bootloaderinstallams.cpp b/rbutil/rbutilqt/base/bootloaderinstallams.cpp
index b1f47eda93..3bdd084c60 100644
--- a/rbutil/rbutilqt/base/bootloaderinstallams.cpp
+++ b/rbutil/rbutilqt/base/bootloaderinstallams.cpp
@@ -72,6 +72,7 @@ void BootloaderInstallAms::installStage2(void)
72 struct md5sums sum; 72 struct md5sums sum;
73 char md5sum[33]; /* 32 hex digits, plus terminating zero */ 73 char md5sum[33]; /* 32 hex digits, plus terminating zero */
74 int n; 74 int n;
75 int model;
75 int firmware_size; 76 int firmware_size;
76 int bootloader_size; 77 int bootloader_size;
77 int patchable; 78 int patchable;
@@ -84,33 +85,33 @@ void BootloaderInstallAms::installStage2(void)
84 QString bootfile = m_tempfile.fileName(); 85 QString bootfile = m_tempfile.fileName();
85 m_tempfile.close(); 86 m_tempfile.close();
86 87
87 /* Load original firmware file */
88 buf = load_of_file(m_offile.toLocal8Bit().data(), &len,&sum,&firmware_size,
89 &of_packed,&of_packedsize,errstr,sizeof(errstr));
90 if (buf == NULL)
91 {
92 qDebug() << "[BootloaderInstallAms] could not load OF: " << m_offile;
93 emit logItem(errstr, LOGERROR);
94 emit logItem(tr("Could not load %1").arg(m_offile), LOGERROR);
95 emit done(true);
96 return;
97 }
98
99 /* Load bootloader file */ 88 /* Load bootloader file */
100 rb_packed = load_rockbox_file(bootfile.toLocal8Bit().data(), sum.model, 89 rb_packed = load_rockbox_file(bootfile.toLocal8Bit().data(), &model,
101 &bootloader_size,&rb_packedsize, 90 &bootloader_size,&rb_packedsize,
102 errstr,sizeof(errstr)); 91 errstr,sizeof(errstr));
103 if (rb_packed == NULL) 92 if (rb_packed == NULL)
104 { 93 {
105 qDebug() << "[BootloaderInstallAms] could not load bootloader: " << bootfile; 94 qDebug() << "[BootloaderInstallAms] could not load bootloader: " << bootfile;
106 emit logItem(errstr, LOGERROR); 95 emit logItem(errstr, LOGERROR);
107 emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR); 96 emit logItem(tr("Could not load %1").arg(bootfile), LOGERROR);
108 free(buf);
109 free(of_packed);
110 emit done(true); 97 emit done(true);
111 return; 98 return;
112 } 99 }
113 100
101 /* Load original firmware file */
102 buf = load_of_file(m_offile.toLocal8Bit().data(), model, &len, &sum,
103 &firmware_size, &of_packed ,&of_packedsize,
104 errstr, sizeof(errstr));
105 if (buf == NULL)
106 {
107 qDebug() << "[BootloaderInstallAms] could not load OF: " << m_offile;
108 emit logItem(errstr, LOGERROR);
109 emit logItem(tr("Could not load %1").arg(m_offile), LOGERROR);
110 free(rb_packed);
111 emit done(true);
112 return;
113 }
114
114 /* check total size */ 115 /* check total size */
115 patchable = check_sizes(sum.model, rb_packedsize, bootloader_size, 116 patchable = check_sizes(sum.model, rb_packedsize, bootloader_size,
116 of_packedsize, firmware_size, &totalsize, errstr, sizeof(errstr)); 117 of_packedsize, firmware_size, &totalsize, errstr, sizeof(errstr));