U-Boot build fails in Yocto for STM32MP1 with “work-shared source is not clean” error
I am building a custom Yocto image for STM32MP1 (STM32MP157) using ST OpenSTLinux (dunfell-based) and I am facing a persistent U-Boot build failure.
Environment:
SoC: STM32MP157 (custom board)
Yocto: ST OpenSTLinux (dunfell)
U-Boot: v2020.10-stm32mp-r2.2
Recipe: u-boot-stm32mp
Machine: stm32mp1
Issue:
During bitbake u-boot-stm32mp, the build fails in do_compile with the following error:
.../tmp-glibc/work-shared/stm32mp1/uboot-source is not clean,
please run 'make mrproper'
This error is triggered by U-Boot’s internal check that aborts when generated files are found in the shared source tree.
Observations:
The error occurs even after running:
bitbake -c clean u-boot-stm32mp
The failure persists until I manually remove:
tmp-glibc/work-shared/stm32mp1/uboot-source
and then run:
bitbake -c cleansstate u-boot-stm32mp
At some point earlier, I ran make menuconfig manually in the U-Boot source to inspect SPI configuration, which may have introduced .config or include/config/* into the shared tree.
I also attempted to add SPI-related configuration, but I now understand that adding invalid symbols like CONFIG_SPI directly is not correct for U-Boot ≥2020.
Questions:
Is manually deleting work-shared/stm32mp1/uboot-source the correct and recommended recovery method once the shared tree is polluted?
Is there a Yocto-sanctioned way to reset or protect the shared U-Boot source tree from accidental manual builds?
For enabling SPI / SPI NOR on STM32MP1, what is the recommended approach:
defconfig fragment only?
DTS-only enablement?
specific ST-supported Kconfig symbols?
Are there any ST guidelines or best practices to avoid this class of failure when customizing U-Boot for STM32MP platforms?
Any guidance from ST or Yocto maintainers would be appreciated.
