summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2004-11-24 00:11:18 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2004-11-24 00:11:18 +0000
commit6fa25709d17e7530a137d355e48c7ec2881fe73f (patch)
tree89bcff6eccb4874d72a59ddbdf13421891037743
parentf05dec570289ef9ebd84deaba1e08d960eadabf9 (diff)
downloadrockbox-6fa25709d17e7530a137d355e48c7ec2881fe73f.tar.gz
rockbox-6fa25709d17e7530a137d355e48c7ec2881fe73f.zip
checksum calculation was wrong (must be the sum of unscrambled), thanks Jens
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5462 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--flash/extract/extract.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/flash/extract/extract.c b/flash/extract/extract.c
index 31e223a546..2a8a7b3ec7 100644
--- a/flash/extract/extract.c
+++ b/flash/extract/extract.c
@@ -113,7 +113,12 @@ int main(int argc, char* argv[])
113 113
114 // generate checksum 114 // generate checksum
115 for (i=0; i<uiSize; i++) 115 for (i=0; i<uiSize; i++)
116 usChecksum += aImage[uiStart + i]; 116 {
117 UINT8 byte;
118 byte = aImage[uiStart + i];
119 byte = ~((byte >> 1) | ((byte << 7) & 0x80)); /* poor man's ROR */
120 usChecksum += byte;
121 }
117 122
118 // make header 123 // make header
119 Write32(aHeader + 2, usChecksum); // checksum in 5th and 6th byte 124 Write32(aHeader + 2, usChecksum); // checksum in 5th and 6th byte