Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] boot/barebox: Fix building of internal scripts
@ 2023-07-21  6:37 Alexander Shiyan
  2023-07-21 20:55 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Shiyan @ 2023-07-21  6:37 UTC (permalink / raw)
  To: buildroot; +Cc: Alexander Shiyan

Some barebox targets need to use internal scripts, for example rockchip64
uses scripts/rkimage which requires the pkg-config package to look up the
openssl options. Since the buildroot uses its own pkkconf package for this
purpose, the scripts cannot be built correctly.
To fix this situation, let's use the CONFIGURATOR_MAKE_ENV wrapper.

  HOSTCC  scripts/rkimage
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openssl', required by 'virtual:world', not found
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/ccN8Xyaj.o: in function `main':
rkimage.c:(.text.startup+0x218): undefined reference to `SHA256_Init'
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: rkimage.c:(.text.startup+0x22b): undefined reference to `SHA256_Update'
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: rkimage.c:(.text.startup+0x23e): undefined reference to `SHA256_Final'
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: rkimage.c:(.text.startup+0x253): undefined reference to `SHA256_Init'
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: rkimage.c:(.text.startup+0x265): undefined reference to `SHA256_Update'
/usr/lib/gcc/x86_64-pc-linux-gnu/12/../../../../x86_64-pc-linux-gnu/bin/ld: rkimage.c:(.text.startup+0x275): undefined reference to `SHA256_Final'
collect2: error: ld returned 1 exit status
make[2]: *** [scripts/Makefile.host:107: scripts/rkimage] Error 1
make[1]: *** [Makefile:976: scripts] Error 2

Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
---
 boot/barebox/Config.in  | 1 +
 boot/barebox/barebox.mk | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in
index 3961c69c56..9a8291c944 100644
--- a/boot/barebox/Config.in
+++ b/boot/barebox/Config.in
@@ -1,5 +1,6 @@
 config BR2_TARGET_BAREBOX
 	bool "Barebox"
+	select BR2_PACKAGE_HOST_PKGCONF
 	help
 	  The Barebox bootloader, formerly known as U-Boot v2.
 
diff --git a/boot/barebox/barebox.mk b/boot/barebox/barebox.mk
index d7bcafe436..a521887cca 100644
--- a/boot/barebox/barebox.mk
+++ b/boot/barebox/barebox.mk
@@ -128,7 +128,9 @@ endef
 
 define $(1)_BUILD_CMDS
 	$$($(1)_BUILD_BAREBOXENV_CMDS)
-	$$($(1)_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
+# In order to compile some barebox target tools we need to use pkg-config,
+# so lets always use CONFIGURATOR_MAKE_ENV wrapper.
+	$$($(1)_CONFIGURATOR_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
 	$$($(1)_BUILD_CUSTOM_ENV)
 endef
 
-- 
2.39.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] boot/barebox: Fix building of internal scripts
  2023-07-21  6:37 [Buildroot] [PATCH] boot/barebox: Fix building of internal scripts Alexander Shiyan
@ 2023-07-21 20:55 ` Thomas Petazzoni via buildroot
  2023-07-23 18:33   ` Alexander Shiyan
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-07-21 20:55 UTC (permalink / raw)
  To: Alexander Shiyan; +Cc: buildroot

Hello Alexander,

On Fri, 21 Jul 2023 09:37:55 +0300
Alexander Shiyan <eagle.alexander923@gmail.com> wrote:

> diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in
> index 3961c69c56..9a8291c944 100644
> --- a/boot/barebox/Config.in
> +++ b/boot/barebox/Config.in
> @@ -1,5 +1,6 @@
>  config BR2_TARGET_BAREBOX
>  	bool "Barebox"
> +	select BR2_PACKAGE_HOST_PKGCONF

Strictly speaking, this is not needed.

However, one issue with your patch is that you don't add host-pkgconf
in BAREBOX_DEPENDENCIES, so there is nothing that ensures host-pkgconf
will be built before barebox.

Another issue is that Barebox is looking for host OpenSSL, and you have
no guarantee that OpenSSL is installed system-wide on the build
machine. Therefore, a dependency on host-openssl is also needed. I
think this calls for an option like BR2_TARGET_UBOOT_NEEDS_OPENSSL, but
for Barebox.

> +# In order to compile some barebox target tools we need to use pkg-config,
> +# so lets always use CONFIGURATOR_MAKE_ENV wrapper.
> +	$$($(1)_CONFIGURATOR_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
>  	$$($(1)_BUILD_CUSTOM_ENV)
>  endef

I don't think <pkg>_CONFIGURATOR_MAKE_ENV is intended to be used here.
It is indeed to be used for the steps related to the configuration of
kconfig-package, to run make menuconfig, make xconfig, etc.

In U-Boot, we're doing this:

        $(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)

So probably we need something similar here.

Best regards,

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH] boot/barebox: Fix building of internal scripts
  2023-07-21 20:55 ` Thomas Petazzoni via buildroot
@ 2023-07-23 18:33   ` Alexander Shiyan
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Shiyan @ 2023-07-23 18:33 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: buildroot

Thanks for the comments, I will do v2.

пт, 21 июл. 2023 г. в 23:55, Thomas Petazzoni <thomas.petazzoni@bootlin.com>:
>
> Hello Alexander,
>
> On Fri, 21 Jul 2023 09:37:55 +0300
> Alexander Shiyan <eagle.alexander923@gmail.com> wrote:
>
> > diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in
> > index 3961c69c56..9a8291c944 100644
> > --- a/boot/barebox/Config.in
> > +++ b/boot/barebox/Config.in
> > @@ -1,5 +1,6 @@
> >  config BR2_TARGET_BAREBOX
> >       bool "Barebox"
> > +     select BR2_PACKAGE_HOST_PKGCONF
>
> Strictly speaking, this is not needed.
>
> However, one issue with your patch is that you don't add host-pkgconf
> in BAREBOX_DEPENDENCIES, so there is nothing that ensures host-pkgconf
> will be built before barebox.
>
> Another issue is that Barebox is looking for host OpenSSL, and you have
> no guarantee that OpenSSL is installed system-wide on the build
> machine. Therefore, a dependency on host-openssl is also needed. I
> think this calls for an option like BR2_TARGET_UBOOT_NEEDS_OPENSSL, but
> for Barebox.
>
> > +# In order to compile some barebox target tools we need to use pkg-config,
> > +# so lets always use CONFIGURATOR_MAKE_ENV wrapper.
> > +     $$($(1)_CONFIGURATOR_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
> >       $$($(1)_BUILD_CUSTOM_ENV)
> >  endef
>
> I don't think <pkg>_CONFIGURATOR_MAKE_ENV is intended to be used here.
> It is indeed to be used for the steps related to the configuration of
> kconfig-package, to run make menuconfig, make xconfig, etc.
>
> In U-Boot, we're doing this:
>
>         $(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)
>
> So probably we need something similar here.
>
> Best regards,
>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-23 18:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-21  6:37 [Buildroot] [PATCH] boot/barebox: Fix building of internal scripts Alexander Shiyan
2023-07-21 20:55 ` Thomas Petazzoni via buildroot
2023-07-23 18:33   ` Alexander Shiyan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox