From acdcd10c9a39999f608d3af07da367825647dd11 Mon Sep 17 00:00:00 2001 From: stroese Date: Wed, 16 Mar 2005 20:58:31 +0000 Subject: Update for esd auto_update and hh405 board --- board/esd/common/auto_update.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'board/esd/common/auto_update.c') diff --git a/board/esd/common/auto_update.c b/board/esd/common/auto_update.c index d4009b7c4e..0604a4e6fe 100644 --- a/board/esd/common/auto_update.c +++ b/board/esd/common/auto_update.c @@ -224,6 +224,25 @@ int au_do_update(int i, long sz) start = au_image[i].start; end = au_image[i].start + au_image[i].size - 1; + /* + * do not update firmware when image is already in flash. + */ + if (au_image[i].type == AU_FIRMWARE) { + char *orig = (char*)start; + char *new = (char *)((char *)hdr + sizeof(*hdr)); + nbytes = ntohl(hdr->ih_size); + + while(--nbytes) { + if (*orig++ != *new++) { + break; + } + } + if (!nbytes) { + printf("Skipping firmware update - images are identical\n"); + break; + } + } + /* unprotect the address range */ /* this assumes that ONLY the firmware is protected! */ if (au_image[i].type == AU_FIRMWARE) { -- cgit