summaryrefslogtreecommitdiff
path: root/board/mpl/common/common_util.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-06-04 15:05:30 +0000
committerwdenk <wdenk>2003-06-04 15:05:30 +0000
commitf3e0de60a6dfa2bedd99bda257841a22b5153f42 (patch)
tree0dde9b4b5335d5889587fc19f7870db1034b636e /board/mpl/common/common_util.c
parent682011ff6968198da14b89e40d9f55b00f6d91f7 (diff)
downloadu-boot-imx-f3e0de60a6dfa2bedd99bda257841a22b5153f42.zip
u-boot-imx-f3e0de60a6dfa2bedd99bda257841a22b5153f42.tar.gz
u-boot-imx-f3e0de60a6dfa2bedd99bda257841a22b5153f42.tar.bz2
* Patch by Denis Peter, 04 June 2003:
add support for the MIP405T board
Diffstat (limited to 'board/mpl/common/common_util.c')
-rw-r--r--board/mpl/common/common_util.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c
index 48ffbee..aa2ba6f 100644
--- a/board/mpl/common/common_util.c
+++ b/board/mpl/common/common_util.c
@@ -59,6 +59,7 @@ int mpl_prg(unsigned long src,unsigned long size)
flash_info_t *info;
int i,rc;
#if defined(CONFIG_PIP405) || defined(CONFIG_MIP405)
+ char *copystr = (char *)src;
unsigned long *magic = (unsigned long *)src;
#endif
@@ -69,8 +70,25 @@ int mpl_prg(unsigned long src,unsigned long size)
printf("Bad Magic number\n");
return -1;
}
-
- start = 0 - size;
+ /* some more checks before we delete the Flash... */
+ /* Checking the ISO_STRING prevents to program a
+ * wrong Firmware Image into the flash.
+ */
+ i=4; /* skip Magic number */
+ while(1) {
+ if(strncmp(&copystr[i],"MEV-",4)==0)
+ break;
+ if(i++>=0x100) {
+ printf("Firmware Image for unknown Target\n");
+ return -1;
+ }
+ }
+ /* we have the ISO STRING, check */
+ if(strncmp(&copystr[i],CONFIG_ISO_STRING,sizeof(CONFIG_ISO_STRING)-1)!=0) {
+ printf("Wrong Firmware Image: %s\n",&copystr[i]);
+ return -1;
+ }
+ start = 0 - size;
for(i=info->sector_count-1;i>0;i--)
{
info->protect[i] = 0; /* unprotect this sector */