# Uboot\_auto\_configure.sh with ARM floating-point

**URL:** https://hub.mender.io/t/uboot-auto-configure-sh-with-arm-floating-point/2038
**Category:** General Discussions
**Created:** [June 11, 2020, 3:21pm UTC](https://hub.mender.io/t/uboot-auto-configure-sh-with-arm-floating-point/2038 "2020-06-11T15:21:50Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![twoerner](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/twoerner/32/650_2.png) [@twoerner](https://hub.mender.io/u/twoerner)
#### Post date: [June 11, 2020, 3:21pm UTC](https://hub.mender.io/t/uboot-auto-configure-sh-with-arm-floating-point/2038/1 "2020-06-11T15:21:50Z")

</div>

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 `Makefile`s 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:

1. in u-boot-mender-common.inc put `$CROSS_COMPILE` into the environment when calling the `uboot_auto_configure.sh` script
2. just like with U-Boot’s build, don’t use `$CC` to build parts of U-Boot, use `$(CROSS_COMPILE)gcc` instead

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} \
```

---

<div class="post-metadata">

### Author: ![twoerner](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/twoerner/32/650_2.png) [@twoerner](https://hub.mender.io/u/twoerner)
#### Post date: [June 11, 2020, 3:35pm UTC](https://hub.mender.io/t/uboot-auto-configure-sh-with-arm-floating-point/2038/2 "2020-06-11T15:35:58Z")

</div>

Incidentally, I don’t think that

```auto
BUILDCC="${BUILD_CC}" \

```

line in `meta-mender-core/recipes-bsp/u-boot/u-boot-mender-common.inc` is doing anything important. Nowhere in `meta-mender-core/recipes-bsp/u-boot/files/uboot_auto_configure.sh` is there a `BUILDCC` variable.

---

<div class="post-metadata">

### Author: ![drewmoseley](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/drewmoseley/32/47_2.png) [@drewmoseley](https://hub.mender.io/u/drewmoseley)
#### Post date: [June 11, 2020, 5:39pm UTC](https://hub.mender.io/t/uboot-auto-configure-sh-with-arm-floating-point/2038/3 "2020-06-11T17:39:14Z")

</div>

@kacf I think you are the best to address this. Conceptually it seems right but I don’t have a full understanding of the auto configure script.  
Drew

---

<div class="post-metadata">

### Author: ![twoerner](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/twoerner/32/650_2.png) [@twoerner](https://hub.mender.io/u/twoerner)
#### Post date: [June 15, 2020, 8:19pm UTC](https://hub.mender.io/t/uboot-auto-configure-sh-with-arm-floating-point/2038/4 "2020-06-15T20:19:35Z")

</div>

I’ve created the following pull request:

> <https://github.com/mendersoftware/meta-mender/pull/1008>
