[v2,1/7] u-boot: inject debian multi-arch config

Message ID 20230211092152.949442-2-felix.moessbauer@siemens.com
State Superseded, archived
Headers show
Series Add BSP for StarFiveTech VisionFive2 Risc-V board | expand

Commit Message

MOESSBAUER, Felix Feb. 11, 2023, 9:21 a.m. UTC
For more complex u-boot configurations, correct debian multi-arch header
paths have to be set for both the host (~ISAR target) as well as the build
architecture (~ISAR host). In addition, the bits per long have to be set for
userspace ABI. For debian, this always corresponds to the
DEB_HOST_ARCH_BITS.

Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
---
 meta/recipes-bsp/u-boot/files/debian/rules.tmpl | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Uladzimir Bely March 16, 2023, 4:49 a.m. UTC | #1
In the email from Saturday, 11 February 2023 12:21:46 +03 user Felix Moessbauer wrote:
> For more complex u-boot configurations, correct debian multi-arch header
> paths have to be set for both the host (~ISAR target) as well as the build
> architecture (~ISAR host). In addition, the bits per long have to be set for
> userspace ABI. For debian, this always corresponds to the
> DEB_HOST_ARCH_BITS.
> 
> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
> ---
>  meta/recipes-bsp/u-boot/files/debian/rules.tmpl | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/meta/recipes-bsp/u-boot/files/debian/rules.tmpl b/meta/recipes-bsp/u-boot/files/debian/rules.tmpl

When running in CI, patch v1 causes build issues with u-boot on some armhf (at least) machines. A piece of `build/tmp/work/debian-bullseye-armhf/u-boot-stm32mp15x/2020.10-r0/temp/log.do_dpkg_build` log:

```
#
# configuration written to .config
#

make[2]: Leaving directory '/<<PKGBUILDDIR>>'

/usr/bin/make -j 8 u-boot.stm32

make[2]: Entering directory '/<<PKGBUILDDIR>>'

scripts/kconfig/conf  --syncconfig Kconfig

  UPD     include/config.h

  CFG     u-boot.cfg

  GEN     include/autoconf.mk.dep

In file included from /usr/arm-linux-gnueabihf/include/features.h:485,
                 from /usr/arm-linux-gnueabihf/include/errno.h:25,
                 from ./include/common.h:17:
/usr/include/arm-linux-gnueabihf/gnu/stubs.h:7:11: fatal error: gnu/stubs-soft.h: No such file or directory
    7 | # include <gnu/stubs-soft.h>
      |           ^~~~~~~~~~~~~~~~~~
compilation terminated.
In file included from /usr/arm-linux-gnueabihf/include/features.h:485,
                 from /usr/arm-linux-gnueabihf/include/errno.h:25,
                 from ./include/common.h:17:

/usr/include/arm-linux-gnueabihf/gnu/stubs.h:7:11: fatal error: gnu/stubs-soft.h: No such file or directory
    7 | # include <gnu/stubs-soft.h>
      |           ^~~~~~~~~~~~~~~~~~
compilation terminated.

make[3]: *** [scripts/Makefile.autoconf:77: u-boot.cfg] Error 1
```
Jan Kiszka March 16, 2023, 7:33 a.m. UTC | #2
On 16.03.23 05:49, Uladzimir Bely wrote:
> In the email from Saturday, 11 February 2023 12:21:46 +03 user Felix Moessbauer wrote:
>> For more complex u-boot configurations, correct debian multi-arch header
>> paths have to be set for both the host (~ISAR target) as well as the build
>> architecture (~ISAR host). In addition, the bits per long have to be set for
>> userspace ABI. For debian, this always corresponds to the
>> DEB_HOST_ARCH_BITS.
>>
>> Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
>> ---
>>  meta/recipes-bsp/u-boot/files/debian/rules.tmpl | 9 +++++++++
>>  1 file changed, 9 insertions(+)
>>
>> diff --git a/meta/recipes-bsp/u-boot/files/debian/rules.tmpl b/meta/recipes-bsp/u-boot/files/debian/rules.tmpl
> 
> When running in CI, patch v1 causes build issues with u-boot on some armhf (at least) machines. A piece of `build/tmp/work/debian-bullseye-armhf/u-boot-stm32mp15x/2020.10-r0/temp/log.do_dpkg_build` log:
> 
> ```
> #
> # configuration written to .config
> #
> 
> make[2]: Leaving directory '/<<PKGBUILDDIR>>'
> 
> /usr/bin/make -j 8 u-boot.stm32
> 
> make[2]: Entering directory '/<<PKGBUILDDIR>>'
> 
> scripts/kconfig/conf  --syncconfig Kconfig
> 
>   UPD     include/config.h
> 
>   CFG     u-boot.cfg
> 
>   GEN     include/autoconf.mk.dep
> 
> In file included from /usr/arm-linux-gnueabihf/include/features.h:485,
>                  from /usr/arm-linux-gnueabihf/include/errno.h:25,
>                  from ./include/common.h:17:
> /usr/include/arm-linux-gnueabihf/gnu/stubs.h:7:11: fatal error: gnu/stubs-soft.h: No such file or directory
>     7 | # include <gnu/stubs-soft.h>
>       |           ^~~~~~~~~~~~~~~~~~
> compilation terminated.
> In file included from /usr/arm-linux-gnueabihf/include/features.h:485,
>                  from /usr/arm-linux-gnueabihf/include/errno.h:25,
>                  from ./include/common.h:17:
> 
> /usr/include/arm-linux-gnueabihf/gnu/stubs.h:7:11: fatal error: gnu/stubs-soft.h: No such file or directory
>     7 | # include <gnu/stubs-soft.h>
>       |           ^~~~~~~~~~~~~~~~~~
> compilation terminated.
> 
> make[3]: *** [scripts/Makefile.autoconf:77: u-boot.cfg] Error 1
> ```
> 

That refreshes my suspicion that we may only cater a special need of
this downstream U-Boot here, given how many other up- and downstream
trees we already built without this change.

Jan

Patch

diff --git a/meta/recipes-bsp/u-boot/files/debian/rules.tmpl b/meta/recipes-bsp/u-boot/files/debian/rules.tmpl
index 806b01fe..be5b9877 100755
--- a/meta/recipes-bsp/u-boot/files/debian/rules.tmpl
+++ b/meta/recipes-bsp/u-boot/files/debian/rules.tmpl
@@ -12,6 +12,15 @@  export CROSS_COMPILE=$(DEB_HOST_GNU_TYPE)-
 SET_CROSS_BUILD_TOOLS=CROSS_BUILD_TOOLS=y
 endif
 
+# inject debian multi-arch include path
+KCFLAGS += -I/usr/include/$(DEB_HOST_MULTIARCH) -I/usr/$(DEB_HOST_MULTIARCH)/include
+HOSTCFLAGS += -I/usr/include/$(DEB_BUILD_MULTIARCH) -I/usr/$(DEB_BUILD_MULTIARCH)/include
+# define host architecture bitwidth
+KCFLAGS += -DBITS_PER_LONG=$(DEB_HOST_ARCH_BITS)
+
+export KCFLAGS
+export HOSTCFLAGS
+
 override_dh_auto_build:
 	$(MAKE) $(PARALLEL_MAKE) ${U_BOOT_CONFIG}
 	$(MAKE) $(PARALLEL_MAKE) ${U_BOOT_BIN}