summaryrefslogtreecommitdiffstats
path: root/bootloader
diff options
context:
space:
mode:
authorBarry Wardell <rockbox@barrywardell.net>2007-03-20 12:35:45 +0000
committerBarry Wardell <rockbox@barrywardell.net>2007-03-20 12:35:45 +0000
commitbada0b7190d657f2032d333bb8431cf0a713c2cb (patch)
tree575ee3abcb638fb617ecee53593fb4f238951bdb /bootloader
parent101ec7eb9a5574da3bb5c362215a281a5f1d315d (diff)
downloadrockbox-bada0b7190d657f2032d333bb8431cf0a713c2cb.tar.gz
rockbox-bada0b7190d657f2032d333bb8431cf0a713c2cb.tar.bz2
rockbox-bada0b7190d657f2032d333bb8431cf0a713c2cb.zip
Hopefully fix CRC32 errors when loading the Sansa OF from the firmware partition.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12852 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader')
-rw-r--r--bootloader/main-pp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c
index 9ee3b84b8f..8f4a6e619d 100644
--- a/bootloader/main-pp.c
+++ b/bootloader/main-pp.c
@@ -176,9 +176,9 @@ int load_mi4(unsigned char* buf, char* firmware, unsigned int buffer_size)
return EINVALID_FORMAT;
/* MI4 file size */
- printf("mi4 size: %x", mi4header.length);
+ printf("mi4 size: %x", mi4header.mi4size);
- if (mi4header.length > buffer_size)
+ if ((mi4header.mi4size-MI4_HEADER_SIZE) > buffer_size)
return EFILE_TOO_BIG;
/* CRC32 */
@@ -230,13 +230,13 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, unsigned int buffe
+ (ppmi_header.length/512), MI4_HEADER_SECTORS, &mi4header);
/* We don't support encrypted mi4 files yet */
- if( (mi4header.plaintext + MI4_HEADER_SIZE) != mi4header.mi4size)
+ if( (mi4header.plaintext) != (mi4header.mi4size-MI4_HEADER_SIZE))
return EINVALID_FORMAT;
/* MI4 file size */
- printf("OF mi4 size: %x", mi4header.length);
+ printf("OF mi4 size: %x", mi4header.mi4size);
- if (mi4header.length > buffer_size)
+ if ((mi4header.mi4size-MI4_HEADER_SIZE) > buffer_size)
return EFILE_TOO_BIG;
/* CRC32 */
@@ -251,7 +251,7 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, unsigned int buffe
/* Load firmware */
ata_read_sectors(pinfo->start + PPMI_SECTOR_OFFSET + PPMI_SECTORS
+ (ppmi_header.length/512) + MI4_HEADER_SECTORS,
- (mi4header.length-MI4_HEADER_SIZE)/512, buf);
+ (mi4header.mi4size-MI4_HEADER_SIZE)/512, buf);
/* Check CRC32 to see if we have a valid file */
sum = chksum_crc32 (buf,mi4header.mi4size-MI4_HEADER_SIZE);