From 1062a17992d50cc362a0b7662bae75342fb69037 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sun, 20 May 2007 03:08:00 +0000 Subject: Add the database rebuild byte for the PP5022AF-05.51-S301-00.12-S301.00.12A-D OF version. Dont output the sector count so often when doing the partition dump. CAUTION: don't upgrade to this bootloader as the buttons still are not working in the bootloader (USB will be the only access to the OF if you do) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13438 a1c6a512-1295-4272-9138-f99709370657 --- bootloader/main-pp.c | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c index 86e9868554..b95b7a10f4 100644 --- a/bootloader/main-pp.c +++ b/bootloader/main-pp.c @@ -406,6 +406,17 @@ int load_mi4(unsigned char* buf, char* firmware, unsigned int buffer_size) } #ifdef SANSA_E200 +struct OFDB_info { + char *version; + int version_length; + int sector; + int offset; +} OFDatabaseOffsets[] = { + { "PP5022AF-05.51-S301-01.11-S301.01.11A-D", 39, 0x3c08, 0xe1 }, + { "PP5022AF-05.51-S301-00.12-S301.00.12E-D", 39, 0x3c5c, 0x2 }, + { "PP5022AF-05.51-S301-00.12-S301.00.12A-D", 39, 0x3c08, 0xe1 }, +}; + /* Load mi4 firmware from a hidden disk partition */ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, unsigned int buffer_size, bool disable_rebuild) @@ -464,27 +475,26 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, { char block[512]; int sector = 0, offset = 0; - + unsigned int i; /* check which known version we have */ /* These are taken from the PPPS section, 0x00780240 */ ata_read_sectors(pinfo->start + 0x3C01, 1, block); - if (!memcmp(&block[0x40], - "PP5022AF-05.51-S301-01.11-S301.01.11A-D", 39)) - { /* American e200, OF version 1.01.11A */ - sector = pinfo->start + 0x3c08; - offset = 0xe1; + for (i=0; istart + OFDatabaseOffsets[i].sector; + offset = OFDatabaseOffsets[i].offset; + break; + } } - else if (!memcmp(&block[0x40], - "PP5022AF-05.51-S301-00.12-S301.00.12E-D", 39)) - { /* European e200, OF version 1.00.12 */ - sector = pinfo->start + 0x3c5c; - offset = 0x2; + if (sector && offset) + { + ata_read_sectors(sector, 1, block); + block[offset] = 0; + ata_write_sectors(sector, 1, block); } - else - return EOK; - ata_read_sectors(sector, 1, block); - block[offset] = 0; - ata_write_sectors(sector, 1, block); } return EOK; } @@ -628,8 +638,10 @@ void* main(void) fd = open("/part.bin", O_CREAT|O_RDWR); char sector[512]; for(i=0; i<40960; i++){ - printf("dumping sector %d", i); - lcd_update(); + if (!(i%100)) + { + printf("dumping sector %d", i); + } ata_read_sectors(pinfo->start + i,1 , sector); write(fd,sector,512); } -- cgit v1.2.3