# Checking something with Documentation u-boot-fw-utils

**URL:** <https://hub.mender.io/t/checking-something-with-documentation-u-boot-fw-utils/1088>\
**Category:** General Discussions\
**Created:** [October 1, 2019, 4:38pm UTC](https://hub.mender.io/t/checking-something-with-documentation-u-boot-fw-utils/1088 "2019-10-01T16:38:27Z")\
**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:** [October 1, 2019, 4:38pm UTC](https://hub.mender.io/t/checking-something-with-documentation-u-boot-fw-utils/1088/1 "2019-10-01T16:38:27Z")

</div>

Hi,

I’m going through the board integration and have had to add a new recipe for u-boot-fw-utils as the vendor fork we are using doesn’t provide one. I’m following  
[https://docs.mender.io/2.1/devices/yocto-project/bootloader-support/u-boot/manual-u-boot-integration/providing-custom-u-boot-fw-utils#adapting-the-recipe](https://docs.mender.io/2.1/devices/yocto-project/bootloader-support/u-boot/manual-u-boot-integration/providing-custom-u-boot-fw-utils#adapting-the-recipe)

But was surprised to see

```
+do_install () {
+ install -d ${D}${base_sbindir}
+ install -d ${D}${sysconfdir}
+ install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_printenv
+ install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv
+ install -m 0644 ${S}/tools/env/fw_env.config ${D}${sysconfdir}/fw_env.config
+}

```

Where fw\_printenv is installed twice, and the second time it is installed as fw\_setenv. I’m just checking this is correct and that fw\_printenv allows you to set environment variables or is this a typo and should be:  
install -m 755 {S}/tools/env/fw\_setenv {D}${base\_sbindir}/fw\_setenv

Best Regards,  
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:** [October 1, 2019, 5:40pm UTC](https://hub.mender.io/t/checking-something-with-documentation-u-boot-fw-utils/1088/2 "2019-10-01T17:40:41Z")

</div>

> [@martin](#):
>
> Where fw\_printenv is installed twice, and the second time it is installed as fw\_setenv

This is correct, and is a small quirk of the `fw_setenv/fw_getenv` binary as it will look at the name of the binary upon execution and based on that provide the desired functionality.

Also note, depending a bit on which Yocto version you are using. We provide a recipe for this,

[https://github.com/mendersoftware/meta-mender/blob/master/meta-mender-core/recipes-bsp/u-boot/u-boot-fw-utils-mender-auto-provided\_1.0.bb](https://github.com/mendersoftware/meta-mender/blob/master/meta-mender-core/recipes-bsp/u-boot/u-boot-fw-utils-mender-auto-provided_1.0.bb)

That will be used if you do not provide it on your own. This will enabled if you do not have anything set in the following variabels.

```auto
PREFERRED_PROVIDER_u-boot-fw-utils
PREFERRED_RPROVIDER_u-boot-fw-utils

```

---

<div class="post-metadata">

**Author:** ![MarekBelisko](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/marekbelisko/32/33_2.png) [@MarekBelisko](https://hub.mender.io/u/MarekBelisko)\
**Post date:** [October 1, 2019, 5:40pm UTC](https://hub.mender.io/t/checking-something-with-documentation-u-boot-fw-utils/1088/3 "2019-10-01T17:40:47Z")

</div>

Hi @martin yes it’s correct. fw\_setenv and fw\_printenv pointing to same binary and magic is done here: [github](https://github.com/u-boot/u-boot/blob/023ff4b88dcec5faa3f9b841bae4d3d232b58ce2/tools/env/fw_env_main.c#L218)

---

<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:** [October 1, 2019, 6:09pm UTC](https://hub.mender.io/t/checking-something-with-documentation-u-boot-fw-utils/1088/4 "2019-10-01T18:09:44Z")

</div>

Thanks for clearing it up, I can see now that they are using the same codebase. Any reason why one isn’t a symlink to the other?

BTW: The auto-provided recipe compiled fw\_printenv for the target and not the host. I tried to work out what was wrong but in the end I opted for a custom recipe. I had to use the following  
EXTRA\_OEMAKE\_class-target = ‘CROSS\_COMPILE={TARGET\_PREFIX} CC="{CC} {CFLAGS} {LDFLAGS}" HOSTCC="{BUILD\_CC} {BUILD\_CFLAGS} ${BUILD\_LDFLAGS}" V=1’  
to get that to compile correctly. There is something odd about the vendor U-Boot that we are using I never got to the bottom of. Good news is that fw\_printenv seems to be working as expected.

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:** [October 1, 2019, 6:25pm UTC](https://hub.mender.io/t/checking-something-with-documentation-u-boot-fw-utils/1088/5 "2019-10-01T18:25:18Z")

</div>

> Thanks for clearing it up, I can see now that they are using the same codebase. Any reason why one isn’t a symlink to the other?

I believe that a symlink would work just as good.

> The auto-provided recipe compiled fw\_printenv for the target and not the host.

Might relate that you need this patch (or a variant of it) in your custom U-boot fork.

> <https://github.com/mendersoftware/meta-mender-community/blob/22d3c9b600d27d12e07712a98615e69e41487c0d/meta-mender-renesas/recipes-bsp/u-boot/patches/default-gcc.patch>

---

<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:** [October 2, 2019, 12:44pm UTC](https://hub.mender.io/t/checking-something-with-documentation-u-boot-fw-utils/1088/6 "2019-10-02T12:44:56Z")

</div>

Thanks for the heads up on that patch 🙂
