[U-Boot] [PATCH] tools: default image: use ih_size for checking data size

Peter Korsgaard jacmet at sunsite.dk
Tue May 7 17:16:24 CEST 2013


>>>>> "Jonas" == Jonas Gorski <jogo at openwrt.org> writes:

 Jonas> Common image usage is uImage + appended rootfs, so the the uImage data
 Jonas> is only part of the total image. So read out and use the header's
 Jonas> ih_size field instead of the total file size.

 Jonas> To prevent reading over the end of the buffer, check that the image file
 Jonas> is big enough to contain the data before calculating its checksum.

 Jonas> Before:
 Jonas> ~# mkimage -l dir665_fw_100NA.bin
 Jonas> mkimage: ERROR: "dir665_fw_100NA/dir665_fw_100NA.bin" has corrupted data!

A related usecase is checking the version info of whatever is written to
flash - E.G.

mkimage -l /dev/mtdN

But that already fails as stat returns st_size=0 for devices.

-- 
Bye, Peter Korsgaard


More information about the U-Boot mailing list