Yocto u-boot build "is not clean, please run 'make mrproper' error

I’m trying to build Mender under Yocto gatesgarth for a Variscite board. I realize that gatesgarth is not supported, but Variscite is not supporting dunfell. So, I’m attempting to build the dunfell meta-mender under gatesgarth.
I have everything configured (I believe properly) and am able to successfully build if I remove a certain line of code from the meta-mender script. I’m looking for clarification on what things are doing to better understand if what I’m seeing is an isolated issue, or something that will be appearing as an issue in future releases of Yocto.
I should also point out that I’m building au-boot bases build without grub.

I will try and explain what I’m observing and hopefully someone has seen this previously and can provide guidance on how to navigate around this issue.

When attempting to build mender with uboot I’m encountering a build issue that I have tracked down to the following. I get the following error when building:

ed/version_autogenerated.h.tmp include/generated/version_autogenerated.h; fi
|   .. is not clean, please run 'make mrproper'
|   in the '..' directory.
| make[1]: *** [/home/user/bsp-platform/build/tmp/work/imx8mp-fslc-linux/u-boot-variscite/1.0-r4/git/Makefile:1764: prepare3] Error 1

This issue looks to be caused by the following line in Mender recipe function

do_configure_prepend_mender-uboot():
    # Calling this here is slightly evil, but we need its results, and we cannot
    # wait until after the do_configure stage is done. The reason is a bug in
    # poky. At the time of writing, the cml1_do_configure() is called from the
    # uboot build, and contains the following: `yes '' | oe_runmake
    # oldconfig`. The problem with this statement is that if the configuration
    # fails to converge, which can happen if a configuration option doesn't have
    # a default (CONFIG_ENV_OFFSET), then this will loop forever, filling up the
    # log, and all the memory of the build host. Therefore this check, which
    # detects such options being missing, needs to run before do_configure.
    if [ ! -e ${B}/.config ]; then
        bbwarn "U-Boot configuration ****(I added this line for debugging **********************"
        oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE}
    fi

If I comment out the “oe_runmake” line Yocto will build, a bootable image is created and Mender appears to work as expected. I tested an image update and it worked as expected.

So, my question is given the ominous comment provided in the Mender script I’m wondering if this section needs renewed scrutiny? I looked at poky and did see that changes were made to do_configure() in u-boot.inc

My questions are:

  1. Has anyone seen this error before?
  2. Is it OK to remove the oe_runmake line?
  3. What would be the best way to patch around this issue??

I don’t know if this is an issue that should be corrected in the mender git repo, or if this is an isolated issue that I should just patch locally.

Any insight or help would be greatly appreciated.Preformatted text

You can actually remove the entire function! The function is only doing sanity checking, it has no practical effect on the final image (except for the apparently unintended side effect from the “evil” section you mentioned).

I can’t really comment on whether or not this section should change in the meta-mender layer. The section is correct for dunfell, at the moment the meta-mender/master branch is still using poky/dunfell as its base, and the next LTS release from Yocto is still more than six months away. If this is a problem which affects post-dunfell branches in general, then I suspect we will hit it once the porting work to the next LTS branch begins.

Thank you for the quick response. This is very helpful to know that the function is not needed.
For now I will proceed with my fix of commenting the oe_runmake, and assume it is an isolated issue that just I’m seeing.
Once again thank you for the quick response.

This is still a problem as I work on ‘kirkstone’ support.

One possible solution is to run mrproper after the needed .config check has been performed.

diff --git a/meta-mender-core/recipes-bsp/u-boot/u-boot-mender.inc b/meta-mender-core/recipes-bsp/u-boot/u-boot-mender.inc
index 07f7f076..da38e360 100644
--- a/meta-mender-core/recipes-bsp/u-boot/u-boot-mender.inc
+++ b/meta-mender-core/recipes-bsp/u-boot/u-boot-mender.inc
@@ -266,6 +266,10 @@ do_configure:prepend:mender-uboot() {
         fi
     done
     unset IFS
+
+    # For variscite at least, the "dirty" .config causes a failure in do_compile
+    # https://hub.mender.io/t/yocto-u-boot-build-is-not-clean-please-run-make-mrproper-error/4022
+    oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE} mrproper
 }
 
 do_compile:append:mender-uboot:mender-ubi() {

1 Like