Skip to contentSkip to conversation

boot/uboot: fix uboot building host tools on x86 architecture

PATCH In review Kory Maincent 3 participants 4 messages Jun 30, 2021 – Aug 3, 2021

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 boot/uboot: fix uboot building host tools on x86 architecture

The make all command run the tools/makefile on the process. This makefile use "pkg-config" command to support static link. The issue is the use of pkg-config configured for crosscompiling to build binaries tools for host architecture.
To fix it, I add pkg-config environment variable to configure it for host.

Add a test to avoid future regress on the build of U-boot.

---
 boot/uboot/uboot.mk                           |  5 +++++
 .../package/test_uboot_openssl_pkgconfig.py   | 20 +++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100644 support/testing/tests/package/test_uboot_openssl_pkgconfig.py
boot/uboot/uboot.mk +5 -0
index dbe82e65b1..5186e6071e 100644
@@ -307,6 +307,11 @@ define UBOOT_BUILD_CMDS
 		cp -f $(UBOOT_CUSTOM_DTS_PATH) $(@D)/arch/$(UBOOT_ARCH)/dts/
 	)
 	$(TARGET_CONFIGURE_OPTS) \
+	        PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
+		PKG_CONFIG_SYSROOT_DIR="/" \
+	        PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
+	        PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
+	        PKG_CONFIG_LIBDIR="$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig" \
 		$(UBOOT_MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \
 		$(UBOOT_MAKE_TARGET)
 	$(if $(BR2_TARGET_UBOOT_FORMAT_SD),
support/testing/tests/package/test_uboot_openssl_pkgconfig.py new file +20 -0
new file mode 100644
index 0000000000..557b665b26
@@ -0,0 +1,20 @@
+import os
+
+import infra.basetest
+
+
+class TestUbootOpensslPkgConfig(infra.basetest.BRTest):
+    config = infra.basetest.MINIMAL_CONFIG + \
+        """
+        BR2_x86_64=y
+        BR2_x86_atom=y
+        BR2_PACKAGE_OPENSSL=y
+        BR2_TARGET_UBOOT=y
+        BR2_TARGET_UBOOT_BOARD_DEFCONFIG="efi-x86_payload64"
+        BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
+        BR2_PACKAGE_HOST_PKGCONF=y
+        """
+    def test_run(self):
+        img = os.path.join(self.builddir, "images", "u-boot.bin")
+        self.assertTrue(os.path.exists(img))
+
Signature · 1 line
2.25.1
#1 lore raw

PATCH v2 1/1 boot/uboot: fix uboot building host tools on x86 architecture

K?ry, All,

On 2021-06-30 11:02 +0200, Kory Maincent spake thusly:

Quoted 20 lines

The make all command run the tools/makefile on the process. This makefile use "pkg-config" command to support static link. The issue is the use of pkg-config configured for crosscompiling to build binaries tools for host architecture.
To fix it, I add pkg-config environment variable to configure it for host.

Add a test to avoid future regress on the build of U-boot.

---
 boot/uboot/uboot.mk                           |  5 +++++
 .../package/test_uboot_openssl_pkgconfig.py   | 20 +++++++++++++++++++
 2 files changed, 25 insertions(+)
 create mode 100644 support/testing/tests/package/test_uboot_openssl_pkgconfig.py
boot/uboot/uboot.mk +0 -0
index dbe82e65b1..5186e6071e 100644

boot/uboot/uboot.mk define UBOOT_BUILD_CMDS · line 314

Quoted 8 lines
boot/uboot/uboot.mk +5 -0
@@ -307,6 +307,11 @@ define UBOOT_BUILD_CMDS
 		cp -f $(UBOOT_CUSTOM_DTS_PATH) $(@D)/arch/$(UBOOT_ARCH)/dts/
 	)
 	$(TARGET_CONFIGURE_OPTS) \
+	        PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
+		PKG_CONFIG_SYSROOT_DIR="/" \
+	        PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
+	        PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
+	        PKG_CONFIG_LIBDIR="$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig" \

Mixed TABs-n-spaces indentation, I've fixed that when applying.

Weird that 'make check-package' did not catch it...

Quoted 19 lines
boot/uboot/uboot.mk +0 -0
 		$(UBOOT_MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \
 		$(UBOOT_MAKE_TARGET)
 	$(if $(BR2_TARGET_UBOOT_FORMAT_SD),
support/testing/tests/package/test_uboot_openssl_pkgconfig.py new file +10 -0
new file mode 100644
index 0000000000..557b665b26
@@ -0,0 +1,20 @@
+import os
+
+import infra.basetest
+
+
+class TestUbootOpensslPkgConfig(infra.basetest.BRTest):
+    config = infra.basetest.MINIMAL_CONFIG + \
+        """
+        BR2_x86_64=y
+        BR2_x86_atom=y

support/testing/tests/package/test_uboot_openssl_pkgconfig.py line 20

Quoted 10 lines
support/testing/tests/package/test_uboot_openssl_pkgconfig.py new file +10 -0
+        BR2_PACKAGE_OPENSSL=y
+        BR2_TARGET_UBOOT=y
+        BR2_TARGET_UBOOT_BOARD_DEFCONFIG="efi-x86_payload64"
+        BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
+        BR2_PACKAGE_HOST_PKGCONF=y
+        """
+    def test_run(self):
+        img = os.path.join(self.builddir, "images", "u-boot.bin")
+        self.assertTrue(os.path.exists(img))
+
    $ make check-package
    support/testing/tests/package/test_uboot_openssl_pkgconfig.py:17:5: E301 expected 1 blank line, found 0
    support/testing/tests/package/test_uboot_openssl_pkgconfig.py:20:1: W391 blank line at end of file
    1     E301 expected 1 blank line, found 0
    1     W391 blank line at end of file

I've also fixed those, and applied to master, thanks.

Regards,
Yann E. MORIN.

Quoted 7 lines
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH v2 1/1 boot/uboot: fix uboot building host tools on x86 architecture

Quoted 19 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

K?ry, All,
On 2021-06-30 11:02 +0200, Kory Maincent spake thusly:

Quoted 15 lines

The make all command run the tools/makefile on the process. This makefile use "pkg-config" command to support static link. The issue is the use of pkg-config configured for crosscompiling to build binaries tools for host architecture.
To fix it, I add pkg-config environment variable to configure it for host.

Add a test to avoid future regress on the build of U-boot.

---
boot/uboot/uboot.mk | 5 +++++
.../package/test_uboot_openssl_pkgconfig.py | 20 +++++++++++++++++++

2 files changed, 25 insertions(+)

create mode 100644 support/testing/tests/package/test_uboot_openssl_pkgconfig.py

Quoted 15 lines

boot/uboot/uboot.mk define UBOOT_BUILD_CMDS · line 314

Quoted 13 lines
boot/uboot/uboot.mk +0 -0
index dbe82e65b1..5186e6071e 100644
@@ -307,6 +307,11 @@ define UBOOT_BUILD_CMDS

cp -f $(UBOOT_CUSTOM_DTS_PATH) $(@D)/arch/$(UBOOT_ARCH)/dts/ )
$(TARGET_CONFIGURE_OPTS) \

boot/uboot/uboot.mk +5 -0
+	        PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
+		PKG_CONFIG_SYSROOT_DIR="/" \
+	        PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 \
+	        PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 \
+	        PKG_CONFIG_LIBDIR="$(HOST_DIR)/lib/pkgconfig:$(HOST_DIR)/share/pkgconfig" \

Mixed TABs-n-spaces indentation, I've fixed that when applying.

Hmm, shouldn't we then add host-pkgconf to UBOOT_DEPENDENCIES so things are not broken when it isn't available?

Quoted 10 lines

boot/uboot/uboot.mk

Quoted 10 lines
boot/uboot/uboot.mk +10 -0
+class TestUbootOpensslPkgConfig(infra.basetest.BRTest):
+    config = infra.basetest.MINIMAL_CONFIG + \
+        """
+        BR2_x86_64=y
+        BR2_x86_atom=y
+        BR2_PACKAGE_OPENSSL=y
+        BR2_TARGET_UBOOT=y
+        BR2_TARGET_UBOOT_BOARD_DEFCONFIG="efi-x86_payload64"
+        BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
+        BR2_PACKAGE_HOST_PKGCONF=y

And then drop it from here?

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw
In reply to Kory Maincent
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Kory" == Kory Maincent <[email protected]> writes:

The make all command run the tools/makefile on the process. This makefile use "pkg-config" command to support static link. The issue is the use of pkg-config configured for crosscompiling to build binaries tools for host architecture.
To fix it, I add pkg-config environment variable to configure it for host.

Add a test to avoid future regress on the build of U-boot.

Committed to 2021.02.x and 2021.05.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/buildroot