Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hd-image: add support for specifying byte value used for filling #274

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Villemoes
Copy link

Today I was fooled by the combination of (1) util.c being quite clever/aggressive with respect to creating sparse images and avoiding writing zeroes explicitly and (2) using bmaptool to populate an SD card, thus being aware of unwritten regions of the image.

Specifically, I had a U-Boot environment partition where I now set "fill = true", so that any trace of the previous environment should be gone, and U-Boot on first boot should just use its default/static environment.

But that was not what I observed: After writing the sd card, the U-Boot partition still has its old content, meaning that the new U-Boot ended up using a completely wrong environment.

In order to be sure that such a partition is definitely overwritten, allow specifiyng the byte value used for filling. Any non-zero value should work fine.

Alternatively/additionally, we could consider relaxing the sparseness, so that, say, the first 4096 bytes of the padding are always explicitly written. But I don't know if bmaptool is so "smart" that it checks whether it has a full 4096 bytes of zeroes and then turning that into a sparse write anyway.

Today I was fooled by the combination of (1) util.c being quite
clever/aggressive with respect to creating sparse images and avoiding
writing zeroes explicitly and (2) using bmaptool to populate an SD
card, thus being aware of unwritten regions of the image.

Specifically, I had a U-Boot environment partition where I now set
"fill = true", so that any trace of the previous environment should be
gone, and U-Boot on first boot should just use its default/static
environment.

But that was not what I observed: After writing the sd card, the
U-Boot partition still has its old content, meaning that the new
U-Boot ended up using a completely wrong environment.

In order to be sure that such a partition is definitely overwritten,
allow specifiyng the byte value used for filling. Any non-zero value
should work fine.

Alternatively/additionally, we could consider relaxing the sparseness,
so that, say, the first 4096 bytes of the padding are always
explicitly written. But I don't know if bmaptool is so "smart" that it
checks whether it has a full 4096 bytes of zeroes and then turning
that into a sparse write anyway.

Signed-off-by: Rasmus Villemoes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants