# Problem when changing BOOTENV\_SIZE

**URL:** <https://hub.mender.io/t/problem-when-changing-bootenv-size/2936>\
**Category:** General Discussions\
**Tags:** yocto, u-boot\
**Created:** [December 3, 2020, 6:32pm UTC](https://hub.mender.io/t/problem-when-changing-bootenv-size/2936 "2020-12-03T18:32:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![martin](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@martin](https://hub.mender.io/u/martin)\
**Post date:** [December 3, 2020, 6:32pm UTC](https://hub.mender.io/t/problem-when-changing-bootenv-size/2936/1 "2020-12-03T18:32:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mirzak](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/mirzak/32/2056_2.png) [@mirzak](https://hub.mender.io/u/mirzak)\
**Post date:** [December 4, 2020, 8:18am UTC](https://hub.mender.io/t/problem-when-changing-bootenv-size/2936/2 "2020-12-04T08:18:34Z")

</div>

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

> <https://github.com/mendersoftware/meta-mender/blob/2a7c3df62ff450782c5721bd5d9580b1af57cf38/meta-mender-core/recipes-bsp/u-boot/libubootenv_%25.bbappend#L14-L18>

and

> <https://github.com/mendersoftware/meta-mender/blob/86ecd224c869e9a58228503d02a0de065869fbfd/meta-mender-core/recipes-bsp/u-boot/u-boot-mender.inc#L38-L43>

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.

---

<div class="post-metadata">

**Author:** ![martin](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@martin](https://hub.mender.io/u/martin)\
**Post date:** [December 4, 2020, 8:52am UTC](https://hub.mender.io/t/problem-when-changing-bootenv-size/2936/3 "2020-12-04T08:52:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [December 4, 2020, 9:20am UTC](https://hub.mender.io/t/problem-when-changing-bootenv-size/2936/4 "2020-12-04T09:20:25Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![martin](https://avatars.discourse-cdn.com/v4/letter/m/73ab20/32.png) [@martin](https://hub.mender.io/u/martin)\
**Post date:** [December 4, 2020, 9:44am UTC](https://hub.mender.io/t/problem-when-changing-bootenv-size/2936/5 "2020-12-04T09:44:43Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![kacf](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/kacf/32/146_2.png) [@kacf](https://hub.mender.io/u/kacf)\
**Post date:** [December 7, 2020, 7:20am UTC](https://hub.mender.io/t/problem-when-changing-bootenv-size/2936/6 "2020-12-07T07:20:30Z")

</div>

I think that makes sense.
