Bryan Mayland
TVWBB Hall of Fame
I'm thinking the easiest way to do this would be to do dump the 1MB that includes the end of the image. The image file should end with 128KB of zeros.
The standard openwrt-rpi image should end like this:
The addresses should be the exact same, so if the * starts before 0x0002c1f0 that means that a shortened image is ending up on the card. That would mean a corrupted squashfs. One could also hexdump the entire first 29MB (no skip, count=29) and diff them to see where changes start. If they start after 0x1c00000+0x0004c1f2 (28MB+offset) that would indicate a complete good image copy.
What I might do is calculate how many 64KB blocks the squashfs is, add 1 to make sure the overlayfs is blanked out, then round up to the next 1MB and make sure all that extra space is filled with zeros in the image file. That might just fix any issues with all microsd image writers?
Code:
dd if=(image file or /dev/sdX of sd card) bs=1M skip=28 count=1 | hexdump -C > image.hex
The standard openwrt-rpi image should end like this:
Code:
0002c1b0 8c 28 35 a8 38 00 00 00 96 4e 38 88 00 01 b2 02 |.(5.8....N8.....|
0002c1c0 f0 07 00 00 e1 35 be 6d 3e 30 0d 8b 02 00 00 00 |.....5.m>0......|
0002c1d0 00 01 59 5a 6c b9 42 00 00 00 00 00 7a c0 42 00 |..YZl.B.....z.B.|
0002c1e0 00 00 00 00 04 80 00 00 00 00 e4 c1 42 00 00 00 |............B...|
0002c1f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
0004c1f2
311794 bytes (312 kB, 304 KiB) copied, 0.145617 s, 2.1 MB/s
The addresses should be the exact same, so if the * starts before 0x0002c1f0 that means that a shortened image is ending up on the card. That would mean a corrupted squashfs. One could also hexdump the entire first 29MB (no skip, count=29) and diff them to see where changes start. If they start after 0x1c00000+0x0004c1f2 (28MB+offset) that would indicate a complete good image copy.
What I might do is calculate how many 64KB blocks the squashfs is, add 1 to make sure the overlayfs is blanked out, then round up to the next 1MB and make sure all that extra space is filled with zeros in the image file. That might just fix any issues with all microsd image writers?
Last edited: