Closed hudson-ayers-cruise closed 10 months ago
The problem seems to be that appcode.s32 is a sparse file. genimage treats the sparse, all-zero regions of the file as equivalent to holes, and fills them with 0xff, while the program I am using to sign the image (correctly) treats them as 0x0
bytes. Is this intended behavior?
That's a bug. This was implemented for hd images where the holes in the sparse files are preserved when e.g. a partition image is copied. But part of that code is shared with the flash image and causes this bug.
I'm pretty busy right now, but this should not be hard to fix. In just ignore the holes in insert_image()
if the fill byte is not zero:
if (byte == 0)
map_file_extents(...)
else
whole_file_exent(...)
Thanks for the reply. I'll put together a PR
I am finding that genimage modifies an image (passed as a filepath) by replacing a large chunk of 0s in the middle of the passed file with
0xff
bytes in the generated image.Is this expected behavior for flash images? Is there a way to disable it? This is a reduced version of the config I am using:
appcode.s32
contains a chunk of 0s starting at offset 0x450 and going until 0x78040. In the producednor-mfg.img
, there are 0's from 0x80450 to 0x81000, then all 0xff's from 0x81000 to 0xf8000.This is causing me issues because the passed image is signed.