diff options
Diffstat (limited to 'board/esd/common/auto_update.c')
| -rw-r--r-- | board/esd/common/auto_update.c | 19 | 
1 files changed, 19 insertions, 0 deletions
| diff --git a/board/esd/common/auto_update.c b/board/esd/common/auto_update.c index d4009b7c4..0604a4e6f 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) { |