Problem when changing BOOTENV_SIZE

Hi,

I’m just debugging a problem where fw_print/set_env from libubootenv weren’t working and it was due to the fw_env.config file having the wrong values for offset and size. Originally I had a BOOTENV_SIZE of 128KiB but then noticed the SPI-NOR device I’m using has a erase block size of 64KiB, so I changed everything including BOOTENV_SIZE to reflect this but found that fw_env.config on the filesystem didn’t change.

Looking at the mender specific code you create a fw_env.config.default file in ${WORKDIR} and then check to see if this exists everytime and only recreate it if it doesn’t which is what has caused me the problems above. I had to completely clean u-boot and libubootenv to get this working.

I was thinking, would it be possible to remove the check to see if this file exists and just re-create it everytime or if this is not possible add a statement to the documentation to say if BOOTENV_SIZE is altered then you must run -ccleanall on the u-boot recipe (and possibly libubootenv although this may get rebuilt anyway).

Cheers,
Martin.

Just for clarify, I believe you are referring to these lines,

and

Which as you describe, can lead to this file not being updated when BOOTENV_SIZE is changed if that file already exists.

I am not sure what the motivation was to actually check if the file exists here, but @kacf might know more and if there are any side-effects to create this file on each build if input changes.

I think the libubootenv one is probably ok as this is checking that u-boot has deployed a fw_env.config.default file and if not create one. The second one for U-Boot is the one that caused the problem I believe. Also you may need a

do_compile[var_deps] = "BOOTENV_SIZE"

to force a recompile when it changes, although I haven’t tested this.

I also haven’t tested it, but I believe you are right @martin, there should be a dependency on BOOTENV_SIZE there, since bitbake is apparently not picking this up on its own.

oops that should have been a ‘+=’

do_compile[var_deps] += "BOOTENV_SIZE"

What do you think about removing the test for file existence in u-boot-mender.inc @kacf ?

I think that makes sense.