mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] Makefile: allow setting pkg-config binary via PKG_CONFIG
@ 2023-07-27  8:48 Ahmad Fatoum
  2023-07-27  8:48 ` [PATCH 2/2] kbuild: Add environment variables for userprogs flags Ahmad Fatoum
  2023-07-28  5:51 ` [PATCH 1/2] Makefile: allow setting pkg-config binary via PKG_CONFIG Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-07-27  8:48 UTC (permalink / raw)
  To: barebox; +Cc: Masahiro Yamada, Ahmad Fatoum

Unlike Linux, barebox build system does build both host and
target tools in the same build, each using a different pkg-config.

This is done by using `pkg-config` for the host tools and
`$CROSS_PKG_CONFIG` for the target tools. In Yocto, `pkg-config` is for
target tools and `pkg-config-native` is for host tools, which we can't
represent with the current scheme.

The usual work around that Yocto employs for the kernel is to
override PKG_CONFIG_PATH to always point into the native sysroot and
resetting PKG_CONFIG_SYSROOT_DIR, but this breaks build of target tools
that use pkg-config.

Fix this by providing a PKG_CONFIG variable that can be overridden
when necessary.

This intentionally skips the scripts/kconfig directory to make it easier
to sync with the kernel. While we should eventually switch that over to
use PKG_CONFIG as well, Yocto will set PKG_CONFIG_PATH and
PKG_CONFIG_SYSROOT_DIR appropriately in cm1.bbclass' do_menuconfig, so
this can wait until the change is done to the kernel and synced back.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Documentation/user/barebox.rst | 21 +++++++++++++++------
 Makefile                       |  3 ++-
 arch/sandbox/Makefile          |  4 ++--
 arch/sandbox/os/Makefile       |  4 ++--
 scripts/Makefile               | 22 +++++++++++-----------
 scripts/imx/Makefile           |  6 +++---
 6 files changed, 35 insertions(+), 25 deletions(-)

diff --git a/Documentation/user/barebox.rst b/Documentation/user/barebox.rst
index 7b37ddba77a9..c95adb78bb83 100644
--- a/Documentation/user/barebox.rst
+++ b/Documentation/user/barebox.rst
@@ -300,16 +300,25 @@ so it may be loaded by the boot ROM of the relevant SoCs.
 
 In addition to these barebox also builds host and target tools that are useful
 outside of barebox build: e.g. to manipulate the environment or to load an
-image over a boot ROM's USB recovery protocol.
+image over a boot ROM's USB recovery protocol. These tools may link against
+libraries, which are detected using ``PKG_CONFIG`` and ``CROSS_PKG_CONFIG``
+for native and cross build respectively. Their default values are::
 
-There are two ``ARCH=sandbox`` to make this more straight forward:
+  PKG_CONFIG=pkg-config
+  CROSS_PKG_CONFIG=${CROSS_COMPILE}pkg-config
+
+These can be overridden using environment or make variables.
+
+As use of pkg-config both for host and target tool in the same build can
+complicate build system integration. There are two ``ARCH=sandbox`` configuration
+to make this more straight forward:
 
 Host Tools
 ^^^^^^^^^^
 
 The ``hosttools_defconfig`` will compile standalone host tools for the
-host (build) system. To build the USB loaders, ``pkg-config`` needs to know
-about ``libusb-1.0``.
+host (build) system. To build the USB loaders, ``PKG_CONFIG`` needs to know
+about ``libusb-1.0``. This config won't build any target tools.
 
 .. code-block:: console
 
@@ -322,9 +331,9 @@ Target Tools
 
 The ``targettools_defconfig`` will cross-compile standalone target tools for the
 target system.  To build the USB loaders, ``CROSS_PKG_CONFIG`` needs to know
-about ``libusb-1.0``. This config won't built any host tools, so it's ok to
+about ``libusb-1.0``. This config won't build any host tools, so it's ok to
 set ``CROSS_PKG_CONFIG=pkg-config`` if ``pkg-config`` is primed for target
-use. The default is ``CROSS_PKG_CONFIG=$(CROSS_COMPILE)pkg-config``. Example:
+use. Example:
 
 .. code-block:: console
 
diff --git a/Makefile b/Makefile
index dd9bd86de03e..acf7b2006765 100644
--- a/Makefile
+++ b/Makefile
@@ -369,9 +369,10 @@ endif
 
 KCONFIG_CONFIG	?= .config
 
+PKG_CONFIG ?= pkg-config
 CROSS_PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
 
-export KCONFIG_CONFIG CROSS_PKG_CONFIG
+export KCONFIG_CONFIG CROSS_PKG_CONFIG PKG_CONFIG
 
 # SHELL used by kbuild
 CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
index d5ba05ba866f..04fa426b1a61 100644
--- a/arch/sandbox/Makefile
+++ b/arch/sandbox/Makefile
@@ -42,11 +42,11 @@ archprepare: maketools
 PHONY += maketools
 
 ifeq ($(CONFIG_SDL),y)
-SDL_LIBS := $(shell pkg-config sdl2 --libs)
+SDL_LIBS := $(shell $(PKG_CONFIG) sdl2 --libs)
 endif
 
 ifeq ($(CONFIG_GPIO_LIBFTDI1),y)
-FTDI1_LIBS := $(shell pkg-config libftdi1 --libs)
+FTDI1_LIBS := $(shell $(PKG_CONFIG) libftdi1 --libs)
 endif
 
 ifeq ($(CONFIG_ASAN),y)
diff --git a/arch/sandbox/os/Makefile b/arch/sandbox/os/Makefile
index ebcbe5833b26..055ce1a316a7 100644
--- a/arch/sandbox/os/Makefile
+++ b/arch/sandbox/os/Makefile
@@ -20,8 +20,8 @@ endif
 obj-y = common.o tap.o setjmp.o
 obj-$(CONFIG_MALLOC_LIBC) += libc_malloc.o
 
-CFLAGS_sdl.o = $(shell pkg-config sdl2 --cflags)
+CFLAGS_sdl.o = $(shell $(PKG_CONFIG) sdl2 --cflags)
 obj-$(CONFIG_SDL) += sdl.o
 
-CFLAGS_ftdi.o = $(shell pkg-config libftdi1 --cflags)
+CFLAGS_ftdi.o = $(shell $(PKG_CONFIG) libftdi1 --cflags)
 obj-$(CONFIG_GPIO_LIBFTDI1) += ftdi.o
diff --git a/scripts/Makefile b/scripts/Makefile
index 72ad9ad7a648..01b21a61692c 100644
--- a/scripts/Makefile
+++ b/scripts/Makefile
@@ -12,8 +12,8 @@ hostprogs-always-y					+= bareboxcrc32
 hostprogs-always-y					+= kernel-install
 hostprogs-always-$(CONFIG_QOICONV)			+= qoiconv
 hostprogs-always-$(CONFIG_CRYPTO_RSA_BUILTIN_KEYS)	+= rsatoc
-HOSTCFLAGS_rsatoc = `pkg-config --cflags openssl`
-HOSTLDLIBS_rsatoc = `pkg-config --libs openssl`
+HOSTCFLAGS_rsatoc = `$(PKG_CONFIG) --cflags openssl`
+HOSTLDLIBS_rsatoc = `$(PKG_CONFIG) --libs openssl`
 hostprogs-always-$(CONFIG_IMD)				+= bareboximd
 hostprogs-always-$(CONFIG_KALLSYMS)			+= kallsyms
 hostprogs-always-$(CONFIG_MIPS)				+= mips-relocs
@@ -28,18 +28,18 @@ hostprogs-always-$(CONFIG_LAYERSCAPE_PBLIMAGE)		+= pblimage
 hostprogs-always-$(CONFIG_STM32_IMAGE)			+= stm32image
 hostprogs-always-$(CONFIG_RISCV)			+= prelink-riscv
 hostprogs-always-$(CONFIG_RK_IMAGE)			+= rkimage
-HOSTCFLAGS_rkimage = `pkg-config --cflags openssl`
-HOSTLDLIBS_rkimage = `pkg-config --libs openssl`
+HOSTCFLAGS_rkimage = `$(PKG_CONFIG) --cflags openssl`
+HOSTLDLIBS_rkimage = `$(PKG_CONFIG) --libs openssl`
 KBUILD_HOSTCFLAGS += -I$(srctree)/scripts/include/
-HOSTLDLIBS_mxsimage  = `pkg-config --libs openssl`
-HOSTCFLAGS_omap3-usb-loader.o = `pkg-config --cflags libusb-1.0`
-HOSTLDLIBS_omap3-usb-loader  = `pkg-config --libs libusb-1.0`
+HOSTLDLIBS_mxsimage  = `$(PKG_CONFIG) --libs openssl`
+HOSTCFLAGS_omap3-usb-loader.o = `$(PKG_CONFIG) --cflags libusb-1.0`
+HOSTLDLIBS_omap3-usb-loader  = `$(PKG_CONFIG) --libs libusb-1.0`
 hostprogs-always-$(CONFIG_OMAP3_USB_LOADER)		+= omap3-usb-loader
-HOSTCFLAGS_omap4_usbboot.o = `pkg-config --cflags libusb-1.0`
-HOSTLDLIBS_omap4_usbboot = -lpthread `pkg-config --libs libusb-1.0`
+HOSTCFLAGS_omap4_usbboot.o = `$(PKG_CONFIG) --cflags libusb-1.0`
+HOSTLDLIBS_omap4_usbboot = -lpthread `$(PKG_CONFIG) --libs libusb-1.0`
 hostprogs-always-$(CONFIG_OMAP4_HOSTTOOL_USBBOOT)	+= omap4_usbboot
-HOSTCFLAGS_rk-usb-loader.o = `pkg-config --cflags libusb-1.0`
-HOSTLDLIBS_rk-usb-loader  = `pkg-config --libs libusb-1.0`
+HOSTCFLAGS_rk-usb-loader.o = `$(PKG_CONFIG) --cflags libusb-1.0`
+HOSTLDLIBS_rk-usb-loader  = `$(PKG_CONFIG) --libs libusb-1.0`
 hostprogs-always-$(CONFIG_RK_USB_LOADER)		+= rk-usb-loader
 
 userprogs-always-$(CONFIG_BAREBOXENV_TARGET)		+= bareboxenv-target
diff --git a/scripts/imx/Makefile b/scripts/imx/Makefile
index d0d1f17e10bd..9544974d523f 100644
--- a/scripts/imx/Makefile
+++ b/scripts/imx/Makefile
@@ -3,8 +3,8 @@
 hostprogs-always-$(CONFIG_ARCH_IMX_IMXIMAGE)	+= imx-image
 hostprogs-always-$(CONFIG_ARCH_IMX_USBLOADER)	+= imx-usb-loader
 
-HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0` -include $(objtree)/include/generated/utsrelease.h
-HOSTLDLIBS_imx-usb-loader  = `pkg-config --libs libusb-1.0`
+HOSTCFLAGS_imx-usb-loader.o = `$(PKG_CONFIG) --cflags libusb-1.0` -include $(objtree)/include/generated/utsrelease.h
+HOSTLDLIBS_imx-usb-loader  = `$(PKG_CONFIG) --libs libusb-1.0`
 
 imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0` -include $(objtree)/include/generated/utsrelease.h
 imx-usb-loader-target-userldlibs += `$(CROSS_PKG_CONFIG) --libs libusb-1.0`
@@ -16,7 +16,7 @@ HOSTCFLAGS_imx-usb-loader.o += -I$(srctree) -I$(srctree)/include/mach
 imx-usb-loader-target-userccflags += -I$(srctree) -I$(srctree)/include/mach
 ifdef CONFIG_ARCH_IMX_IMXIMAGE_SSL_SUPPORT
 HOSTCFLAGS_imx-image.o += -DIMXIMAGE_SSL_SUPPORT
-HOSTLDLIBS_imx-image  = `pkg-config --libs openssl`
+HOSTLDLIBS_imx-image  = `$(PKG_CONFIG) --libs openssl`
 endif
 
 imx-usb-loader-objs := imx-usb-loader.o imx.o
-- 
2.39.2




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

* [PATCH 2/2] kbuild: Add environment variables for userprogs flags
  2023-07-27  8:48 [PATCH 1/2] Makefile: allow setting pkg-config binary via PKG_CONFIG Ahmad Fatoum
@ 2023-07-27  8:48 ` Ahmad Fatoum
  2023-07-28  5:51 ` [PATCH 1/2] Makefile: allow setting pkg-config binary via PKG_CONFIG Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-07-27  8:48 UTC (permalink / raw)
  To: barebox; +Cc: Masahiro Yamada, Ahmad Fatoum

From: Elliot Berman <quic_eberman@quicinc.com>

Build systems integrating barebox may want to pass compiler and linker
options for when barebox is building target tools. This is especially
important when the compiler toolchain is configured without a sysroot
like in Yocto and the --sysroot option must be used. As there was no
option explicitly meant for this, userccflags is sometimes abused and
set in the environment[1][2].

While this appears to work, it breaks when setting userccflags as make
option instead of an environment variable. Let's just provide USERCFLAGS
and USERLDFLAGS explicitly for this use case.

This is an adaptation of Linux commit:

    | commit f67695c9962e5f444549b3437fb8d840ec6222c8
    | Author: Elliot Berman <quic_eberman@quicinc.com>
    | Date:   Tue Feb 1 13:35:42 2022 -0800
    |
    | Allow additional arguments be passed to userprogs compilation.
    | Reproducible clang builds need to provide a sysroot and gcc path to
    | ensure the same toolchain is used across hosts. KCFLAGS is not currently
    | used for any user programs compilation, so add new USERCFLAGS and
    | USERLDFLAGS which serves similar purpose as HOSTCFLAGS/HOSTLDFLAGS.
    |
    | Clang might detect GCC installation on hosts which have it installed
    | to a default location in /. With addition of these environment
    | variables, you can specify flags such as:
    |
    | $ make USERCFLAGS=--sysroot=/path/to/sysroot
    |
    | This can also be used to specify different sysroots such as musl or
    | bionic which may be installed on the host in paths that the compiler
    | may not search by default.
    |
    | Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>

[1]: https://github.com/pengutronix/meta-ptx/blob/38ada68c70/recipes-bsp/barebox/barebox.inc#L91
[2]: https://lore.kernel.org/all/20230331104025.1478393-3-ejo@pengutronix.de/

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index acf7b2006765..f935fd2604b2 100644
--- a/Makefile
+++ b/Makefile
@@ -386,11 +386,12 @@ HOST_LFS_LIBS := $(shell getconf LFS_LIBS 2>/dev/null)
 HOSTCC       = gcc
 HOSTCXX      = g++
 
-export KBUILD_USERCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
+KBUILD_USERHOSTCFLAGS := -Wall -Wmissing-prototypes -Wstrict-prototypes \
 			      -O2 -fomit-frame-pointer -std=gnu89
-export KBUILD_USERLDFLAGS :=
+KBUILD_USERCFLAGS  := $(KBUILD_USERHOSTCFLAGS) $(USERCFLAGS)
+KBUILD_USERLDFLAGS := $(USERLDFLAGS)
 
-KBUILD_HOSTCFLAGS   := $(KBUILD_USERCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
+KBUILD_HOSTCFLAGS   := $(KBUILD_USERHOSTCFLAGS) $(HOST_LFS_CFLAGS) $(HOSTCFLAGS)
 KBUILD_HOSTCXXFLAGS := -Wall -O2 $(HOST_LFS_CFLAGS) $(HOSTCXXFLAGS)
 KBUILD_HOSTLDFLAGS  := $(HOST_LFS_LDFLAGS) $(HOSTLDFLAGS)
 KBUILD_HOSTLDLIBS   := $(HOST_LFS_LIBS) $(HOSTLDLIBS)
@@ -475,6 +476,7 @@ export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL PYTHON3 UTS_MACHIN
 export LEX YACC
 export HOSTCXX CHECK CHECKFLAGS
 export KBUILD_HOSTCXXFLAGS KBUILD_HOSTLDFLAGS KBUILD_HOSTLDLIBS LDFLAGS_MODULE
+export KBUILD_USERCFLAGS KBUILD_USERLDFLAGS
 
 export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS KBUILD_LDFLAGS
 export KBUILD_CFLAGS CFLAGS_KERNEL CFLAGS_MODULE
-- 
2.39.2




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

* Re: [PATCH 1/2] Makefile: allow setting pkg-config binary via PKG_CONFIG
  2023-07-27  8:48 [PATCH 1/2] Makefile: allow setting pkg-config binary via PKG_CONFIG Ahmad Fatoum
  2023-07-27  8:48 ` [PATCH 2/2] kbuild: Add environment variables for userprogs flags Ahmad Fatoum
@ 2023-07-28  5:51 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-07-28  5:51 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, Masahiro Yamada

On Thu, Jul 27, 2023 at 10:48:11AM +0200, Ahmad Fatoum wrote:
> Unlike Linux, barebox build system does build both host and
> target tools in the same build, each using a different pkg-config.
> 
> This is done by using `pkg-config` for the host tools and
> `$CROSS_PKG_CONFIG` for the target tools. In Yocto, `pkg-config` is for
> target tools and `pkg-config-native` is for host tools, which we can't
> represent with the current scheme.
> 
> The usual work around that Yocto employs for the kernel is to
> override PKG_CONFIG_PATH to always point into the native sysroot and
> resetting PKG_CONFIG_SYSROOT_DIR, but this breaks build of target tools
> that use pkg-config.
> 
> Fix this by providing a PKG_CONFIG variable that can be overridden
> when necessary.
> 
> This intentionally skips the scripts/kconfig directory to make it easier
> to sync with the kernel. While we should eventually switch that over to
> use PKG_CONFIG as well, Yocto will set PKG_CONFIG_PATH and
> PKG_CONFIG_SYSROOT_DIR appropriately in cm1.bbclass' do_menuconfig, so
> this can wait until the change is done to the kernel and synced back.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  Documentation/user/barebox.rst | 21 +++++++++++++++------
>  Makefile                       |  3 ++-
>  arch/sandbox/Makefile          |  4 ++--
>  arch/sandbox/os/Makefile       |  4 ++--
>  scripts/Makefile               | 22 +++++++++++-----------
>  scripts/imx/Makefile           |  6 +++---
>  6 files changed, 35 insertions(+), 25 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/Documentation/user/barebox.rst b/Documentation/user/barebox.rst
> index 7b37ddba77a9..c95adb78bb83 100644
> --- a/Documentation/user/barebox.rst
> +++ b/Documentation/user/barebox.rst
> @@ -300,16 +300,25 @@ so it may be loaded by the boot ROM of the relevant SoCs.
>  
>  In addition to these barebox also builds host and target tools that are useful
>  outside of barebox build: e.g. to manipulate the environment or to load an
> -image over a boot ROM's USB recovery protocol.
> +image over a boot ROM's USB recovery protocol. These tools may link against
> +libraries, which are detected using ``PKG_CONFIG`` and ``CROSS_PKG_CONFIG``
> +for native and cross build respectively. Their default values are::
>  
> -There are two ``ARCH=sandbox`` to make this more straight forward:
> +  PKG_CONFIG=pkg-config
> +  CROSS_PKG_CONFIG=${CROSS_COMPILE}pkg-config
> +
> +These can be overridden using environment or make variables.
> +
> +As use of pkg-config both for host and target tool in the same build can
> +complicate build system integration. There are two ``ARCH=sandbox`` configuration
> +to make this more straight forward:
>  
>  Host Tools
>  ^^^^^^^^^^
>  
>  The ``hosttools_defconfig`` will compile standalone host tools for the
> -host (build) system. To build the USB loaders, ``pkg-config`` needs to know
> -about ``libusb-1.0``.
> +host (build) system. To build the USB loaders, ``PKG_CONFIG`` needs to know
> +about ``libusb-1.0``. This config won't build any target tools.
>  
>  .. code-block:: console
>  
> @@ -322,9 +331,9 @@ Target Tools
>  
>  The ``targettools_defconfig`` will cross-compile standalone target tools for the
>  target system.  To build the USB loaders, ``CROSS_PKG_CONFIG`` needs to know
> -about ``libusb-1.0``. This config won't built any host tools, so it's ok to
> +about ``libusb-1.0``. This config won't build any host tools, so it's ok to
>  set ``CROSS_PKG_CONFIG=pkg-config`` if ``pkg-config`` is primed for target
> -use. The default is ``CROSS_PKG_CONFIG=$(CROSS_COMPILE)pkg-config``. Example:
> +use. Example:
>  
>  .. code-block:: console
>  
> diff --git a/Makefile b/Makefile
> index dd9bd86de03e..acf7b2006765 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -369,9 +369,10 @@ endif
>  
>  KCONFIG_CONFIG	?= .config
>  
> +PKG_CONFIG ?= pkg-config
>  CROSS_PKG_CONFIG ?= $(CROSS_COMPILE)pkg-config
>  
> -export KCONFIG_CONFIG CROSS_PKG_CONFIG
> +export KCONFIG_CONFIG CROSS_PKG_CONFIG PKG_CONFIG
>  
>  # SHELL used by kbuild
>  CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
> diff --git a/arch/sandbox/Makefile b/arch/sandbox/Makefile
> index d5ba05ba866f..04fa426b1a61 100644
> --- a/arch/sandbox/Makefile
> +++ b/arch/sandbox/Makefile
> @@ -42,11 +42,11 @@ archprepare: maketools
>  PHONY += maketools
>  
>  ifeq ($(CONFIG_SDL),y)
> -SDL_LIBS := $(shell pkg-config sdl2 --libs)
> +SDL_LIBS := $(shell $(PKG_CONFIG) sdl2 --libs)
>  endif
>  
>  ifeq ($(CONFIG_GPIO_LIBFTDI1),y)
> -FTDI1_LIBS := $(shell pkg-config libftdi1 --libs)
> +FTDI1_LIBS := $(shell $(PKG_CONFIG) libftdi1 --libs)
>  endif
>  
>  ifeq ($(CONFIG_ASAN),y)
> diff --git a/arch/sandbox/os/Makefile b/arch/sandbox/os/Makefile
> index ebcbe5833b26..055ce1a316a7 100644
> --- a/arch/sandbox/os/Makefile
> +++ b/arch/sandbox/os/Makefile
> @@ -20,8 +20,8 @@ endif
>  obj-y = common.o tap.o setjmp.o
>  obj-$(CONFIG_MALLOC_LIBC) += libc_malloc.o
>  
> -CFLAGS_sdl.o = $(shell pkg-config sdl2 --cflags)
> +CFLAGS_sdl.o = $(shell $(PKG_CONFIG) sdl2 --cflags)
>  obj-$(CONFIG_SDL) += sdl.o
>  
> -CFLAGS_ftdi.o = $(shell pkg-config libftdi1 --cflags)
> +CFLAGS_ftdi.o = $(shell $(PKG_CONFIG) libftdi1 --cflags)
>  obj-$(CONFIG_GPIO_LIBFTDI1) += ftdi.o
> diff --git a/scripts/Makefile b/scripts/Makefile
> index 72ad9ad7a648..01b21a61692c 100644
> --- a/scripts/Makefile
> +++ b/scripts/Makefile
> @@ -12,8 +12,8 @@ hostprogs-always-y					+= bareboxcrc32
>  hostprogs-always-y					+= kernel-install
>  hostprogs-always-$(CONFIG_QOICONV)			+= qoiconv
>  hostprogs-always-$(CONFIG_CRYPTO_RSA_BUILTIN_KEYS)	+= rsatoc
> -HOSTCFLAGS_rsatoc = `pkg-config --cflags openssl`
> -HOSTLDLIBS_rsatoc = `pkg-config --libs openssl`
> +HOSTCFLAGS_rsatoc = `$(PKG_CONFIG) --cflags openssl`
> +HOSTLDLIBS_rsatoc = `$(PKG_CONFIG) --libs openssl`
>  hostprogs-always-$(CONFIG_IMD)				+= bareboximd
>  hostprogs-always-$(CONFIG_KALLSYMS)			+= kallsyms
>  hostprogs-always-$(CONFIG_MIPS)				+= mips-relocs
> @@ -28,18 +28,18 @@ hostprogs-always-$(CONFIG_LAYERSCAPE_PBLIMAGE)		+= pblimage
>  hostprogs-always-$(CONFIG_STM32_IMAGE)			+= stm32image
>  hostprogs-always-$(CONFIG_RISCV)			+= prelink-riscv
>  hostprogs-always-$(CONFIG_RK_IMAGE)			+= rkimage
> -HOSTCFLAGS_rkimage = `pkg-config --cflags openssl`
> -HOSTLDLIBS_rkimage = `pkg-config --libs openssl`
> +HOSTCFLAGS_rkimage = `$(PKG_CONFIG) --cflags openssl`
> +HOSTLDLIBS_rkimage = `$(PKG_CONFIG) --libs openssl`
>  KBUILD_HOSTCFLAGS += -I$(srctree)/scripts/include/
> -HOSTLDLIBS_mxsimage  = `pkg-config --libs openssl`
> -HOSTCFLAGS_omap3-usb-loader.o = `pkg-config --cflags libusb-1.0`
> -HOSTLDLIBS_omap3-usb-loader  = `pkg-config --libs libusb-1.0`
> +HOSTLDLIBS_mxsimage  = `$(PKG_CONFIG) --libs openssl`
> +HOSTCFLAGS_omap3-usb-loader.o = `$(PKG_CONFIG) --cflags libusb-1.0`
> +HOSTLDLIBS_omap3-usb-loader  = `$(PKG_CONFIG) --libs libusb-1.0`
>  hostprogs-always-$(CONFIG_OMAP3_USB_LOADER)		+= omap3-usb-loader
> -HOSTCFLAGS_omap4_usbboot.o = `pkg-config --cflags libusb-1.0`
> -HOSTLDLIBS_omap4_usbboot = -lpthread `pkg-config --libs libusb-1.0`
> +HOSTCFLAGS_omap4_usbboot.o = `$(PKG_CONFIG) --cflags libusb-1.0`
> +HOSTLDLIBS_omap4_usbboot = -lpthread `$(PKG_CONFIG) --libs libusb-1.0`
>  hostprogs-always-$(CONFIG_OMAP4_HOSTTOOL_USBBOOT)	+= omap4_usbboot
> -HOSTCFLAGS_rk-usb-loader.o = `pkg-config --cflags libusb-1.0`
> -HOSTLDLIBS_rk-usb-loader  = `pkg-config --libs libusb-1.0`
> +HOSTCFLAGS_rk-usb-loader.o = `$(PKG_CONFIG) --cflags libusb-1.0`
> +HOSTLDLIBS_rk-usb-loader  = `$(PKG_CONFIG) --libs libusb-1.0`
>  hostprogs-always-$(CONFIG_RK_USB_LOADER)		+= rk-usb-loader
>  
>  userprogs-always-$(CONFIG_BAREBOXENV_TARGET)		+= bareboxenv-target
> diff --git a/scripts/imx/Makefile b/scripts/imx/Makefile
> index d0d1f17e10bd..9544974d523f 100644
> --- a/scripts/imx/Makefile
> +++ b/scripts/imx/Makefile
> @@ -3,8 +3,8 @@
>  hostprogs-always-$(CONFIG_ARCH_IMX_IMXIMAGE)	+= imx-image
>  hostprogs-always-$(CONFIG_ARCH_IMX_USBLOADER)	+= imx-usb-loader
>  
> -HOSTCFLAGS_imx-usb-loader.o = `pkg-config --cflags libusb-1.0` -include $(objtree)/include/generated/utsrelease.h
> -HOSTLDLIBS_imx-usb-loader  = `pkg-config --libs libusb-1.0`
> +HOSTCFLAGS_imx-usb-loader.o = `$(PKG_CONFIG) --cflags libusb-1.0` -include $(objtree)/include/generated/utsrelease.h
> +HOSTLDLIBS_imx-usb-loader  = `$(PKG_CONFIG) --libs libusb-1.0`
>  
>  imx-usb-loader-target-userccflags += `$(CROSS_PKG_CONFIG) --cflags libusb-1.0` -include $(objtree)/include/generated/utsrelease.h
>  imx-usb-loader-target-userldlibs += `$(CROSS_PKG_CONFIG) --libs libusb-1.0`
> @@ -16,7 +16,7 @@ HOSTCFLAGS_imx-usb-loader.o += -I$(srctree) -I$(srctree)/include/mach
>  imx-usb-loader-target-userccflags += -I$(srctree) -I$(srctree)/include/mach
>  ifdef CONFIG_ARCH_IMX_IMXIMAGE_SSL_SUPPORT
>  HOSTCFLAGS_imx-image.o += -DIMXIMAGE_SSL_SUPPORT
> -HOSTLDLIBS_imx-image  = `pkg-config --libs openssl`
> +HOSTLDLIBS_imx-image  = `$(PKG_CONFIG) --libs openssl`
>  endif
>  
>  imx-usb-loader-objs := imx-usb-loader.o imx.o
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2023-07-28  5:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-27  8:48 [PATCH 1/2] Makefile: allow setting pkg-config binary via PKG_CONFIG Ahmad Fatoum
2023-07-27  8:48 ` [PATCH 2/2] kbuild: Add environment variables for userprogs flags Ahmad Fatoum
2023-07-28  5:51 ` [PATCH 1/2] Makefile: allow setting pkg-config binary via PKG_CONFIG Sascha Hauer

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