summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
authorJörg Hohensohn <hohensoh@rockbox.org>2005-08-23 07:26:40 +0000
committerJörg Hohensohn <hohensoh@rockbox.org>2005-08-23 07:26:40 +0000
commit13be9f14d7ef8136ea225eaecc5ad17ef203686a (patch)
treec37ab90be55de930005ec79f3ffe0baaa918ef3c /apps/plugins
parent02cfd6a6e92a743460321cd2c42bde10626d73c5 (diff)
downloadrockbox-13be9f14d7ef8136ea225eaecc5ad17ef203686a.zip
rockbox-13be9f14d7ef8136ea225eaecc5ad17ef203686a.tar.gz
rockbox-13be9f14d7ef8136ea225eaecc5ad17ef203686a.tar.bz2
rockbox-13be9f14d7ef8136ea225eaecc5ad17ef203686a.tar.xz
allow the flash plugin to verify the RomBox link address
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7388 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/rockbox_flash.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/apps/plugins/rockbox_flash.c b/apps/plugins/rockbox_flash.c
index 9a40319..4c55262 100644
--- a/apps/plugins/rockbox_flash.c
+++ b/apps/plugins/rockbox_flash.c
@@ -82,6 +82,7 @@ typedef enum
eNotUCL,
eWrongAlgorithm,
eMultiBlocks,
+ eBadRomLink
} tCheckResult;
typedef struct
@@ -438,10 +439,31 @@ tCheckResult CheckImageFile(char* filename, int space, tImageHeader* pHeader,
rb->close(fd);
return eReadErr;
}
- pHeader->execute = reset_vector;
- if (reset_vector != ROCKBOX_EXEC) /* nonstandard address? */
+ if (reset_vector >= (UINT32)FB
+ && reset_vector < (UINT32)FB+512*1024) /* ROM address? */
+ {
/* assume in-place, executing directly in flash */
pHeader->destination = (UINT32)(pos + sizeof(tImageHeader));
+
+ /* for new RomBox, this isn't the reset vector,
+ but the link address, for us to check the position */
+ if(pHeader->destination != reset_vector) /* compare link addr. */
+ {
+ rb->close(fd);
+ return eBadRomLink; /* not matching the start address */
+ }
+
+ /* read the now following reset vector */
+ read = rb->read(fd, &reset_vector, sizeof(reset_vector));
+ fileread += read;
+ if (read != sizeof(reset_vector))
+ {
+ rb->close(fd);
+ return eReadErr;
+ }
+ }
+
+ pHeader->execute = reset_vector;
}
/* check if we can read the whole file */
@@ -737,6 +759,10 @@ void DoUserDialog(char* filename)
rb->lcd_puts(0, 2, "Blocksize");
rb->lcd_puts(0, 3, " too small?");
break;
+ case eBadRomLink:
+ rb->lcd_puts(0, 1, "RomBox mismatch.");
+ rb->lcd_puts(0, 2, "Wrong ROM position");
+ break;
default:
rb->lcd_puts(0, 1, "Check failed.");
break;
@@ -906,6 +932,9 @@ void DoUserDialog(char* filename)
case eMultiBlocks:
rb->lcd_puts_scroll(0, 1, "File invalid. Blocksize too small?");
break;
+ case eBadRomLink:
+ rb->lcd_puts_scroll(0, 1, "BootBox mismatch");
+ break;
default:
rb->lcd_puts_scroll(0, 1, "Check failed.");
break;