I’m doing a board integration with Yocto and U-Boot. The board uses an old ARM SoC with floating point (armv5tehf-vfp). I’m working on the warrior branch, but the problem I describe should also occur on master since the parts of the mender code I’ll be discussing are the same on master as they are on warrior.
Your meta-mender-core/recipes-bsp/u-boot/files/uboot_auto_configure.sh script uses the cross compiler to compile cmd/version.o so it can generate a list of files to patch. When it does so, it invokes $CC. My $CC variable includes flags for floating-point (-mfpu=vfp -mfloat-abi=hard). U-Boot can’t be built with floating-point, so my do_mender_uboot_auto_configure task fails.
The Yocto U-Boot build gets around this by not using $CC. Yocto passes in the CROSS_COMPILE variable (populated with ${TARGET_PREFIX}) and U-Boot’s Makefiles create their own $CC based on CROSS_COMPILE and their own flags.
Your meta-mender-core/recipes-bsp/u-boot/files/uboot_auto_configure.sh script tries to use $CROSS_COMPILE if $CC is not set, but, first of all, $CC is set therefore CROSS_COMPILE won’t be considered, but secondly, even if $CC was not set, $CROSS_COMPILE won’t get set because the place where meta-mender-core/recipes-bsp/u-boot/files/uboot_auto_configure.sh is called (line 339 of recipes-bsp/u-boot/u-boot-mender-common.inc) doesn’t set CROSS_COMPILE in the environment before calling the uboot_auto_configure.sh script.
My recommendations are:
- in u-boot-mender-common.inc put
$CROSS_COMPILEinto the environment when calling theuboot_auto_configure.shscript - just like with U-Boot’s build, don’t use
$CCto build parts of U-Boot, use$(CROSS_COMPILE)gccinstead
I’d like to suggest the following patch:
diff --git a/meta-mender-core/recipes-bsp/u-boot/files/uboot_auto_configure.sh b/meta-mender-core/recipes-bsp/u-boot/files/uboot_auto_configure.sh
index 18bc707..023263e 100755
--- a/meta-mender-core/recipes-bsp/u-boot/files/uboot_auto_configure.sh
+++ b/meta-mender-core/recipes-bsp/u-boot/files/uboot_auto_configure.sh
@@ -4,7 +4,7 @@ set -e
BUILD_AR="${BUILD_AR:-ar}"
BUILD_CC="${BUILD_CC:-gcc}"
-CC=${CC:-${CROSS_COMPILE}gcc}
+CC="${CROSS_COMPILE}gcc"
MAKE="${MAKE:-make}"
MAKEFLAGS="${MAKEFLAGS:-}"
MAYBE_UBI=
diff --git a/meta-mender-core/recipes-bsp/u-boot/u-boot-mender-common.inc b/meta-mender-core/recipes-bsp/u-boot/u-boot-mender-common.inc
index bc17e7c..179df60 100644
--- a/meta-mender-core/recipes-bsp/u-boot/u-boot-mender-common.inc
+++ b/meta-mender-core/recipes-bsp/u-boot/u-boot-mender-common.inc
@@ -338,6 +338,7 @@ do_mender_uboot_auto_configure() {
env \
BUILDCC="${BUILD_CC}" \
+ CROSS_COMPILE="${TARGET_PREFIX}" \
./uboot_auto_configure.sh \
--config=$MENDER_UBOOT_MACHINE \
--src-dir=${S} \