public inbox for buildroot@busybox.net
 help / color / mirror / Atom feed
From: Romain Naour via buildroot <buildroot@buildroot.org>
To: "Alex Bennée" <alex.bennee@linaro.org>, buildroot@buildroot.org
Cc: Giulio Benetti <giulio.benetti@benettiengineering.com>,
	Romain Naour <romain.naour@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [Buildroot] [PATCH v6 1/6] toolchain/external: allow installing of libc utils
Date: Tue, 10 Mar 2026 22:53:02 +0100	[thread overview]
Message-ID: <37fab77c-8ff6-4bdf-8546-ea194ee478ef@smile.fr> (raw)
In-Reply-To: <20260225105537.1420002-2-alex.bennee@linaro.org>

Hello Alex, All,

Le 25/02/2026 à 11:55, Alex Bennée a écrit :
> For buildroot's own tools we have BR2_PACKAGE_GLIBC_UTILS (and similar
> for ulibc). As we need the tools for somethings we should also support
> this for external toolchains.
> 
> Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
> ---
>  toolchain/toolchain-external/Config.in        |  7 ++++++
>  .../pkg-toolchain-external.mk                 | 24 +++++++++++++++++++
>  2 files changed, 31 insertions(+)
> 
> diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
> index 831387bc4e..e79dafa365 100644
> --- a/toolchain/toolchain-external/Config.in
> +++ b/toolchain/toolchain-external/Config.in
> @@ -125,4 +125,11 @@ config BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
>  	  Copy the gdbserver provided by the external toolchain to the
>  	  target.
>  
> +config BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY
> +	bool "Install libc utilities"
> +	depends on BR2_TOOLCHAIN_EXTERNAL

depends on BR2_TOOLCHAIN_EXTERNAL_GLIBC

> +	help
> +	  Enabling this option will compile and install the getconf,

Since its an external toolchain, nothing is actually built, just imported into
Buildroot.

> +	  ldd and locale gibc utilities for the target.                         ^^^^
                         glibc

Since it's based on BR2_PACKAGE_GLIBC_UTILS, this option should only appear when
a glibc based external toolchain is selected.

If you want to make this option available for musl and uClibc-ng toolchain we
have to take care that:

  - getconf is not avaible with musl toolchains
  - locales is optional with uClibc-ng toolchains
  - ldd script is specific to glibc
  - uClibc-ng sometime "pretend" to be glibc lookalike

I'm fine if we only do that for glibc toolchain for now (in order to move
forward on KVM topic)

We already have an option BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY that is glibc
specific.

> +
>  endif # BR2_TOOLCHAIN_EXTERNAL
> diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
> index 270cf814ed..b84abb6106 100644
> --- a/toolchain/toolchain-external/pkg-toolchain-external.mk
> +++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
> @@ -446,6 +446,29 @@ define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER
>  endef
>  endif
>  
> +ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LIBC_UTILS_COPY),y)
> +define TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBC_UTILS
> +	$(Q)$(call MESSAGE,"Copying libc utils")
> +	$(Q)ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> +	utils_found=0 ; \
> +	for d in $${ARCH_SYSROOT_DIR} \
> +	         $${ARCH_SYSROOT_DIR}/usr \
> +		 $(TOOLCHAIN_EXTERNAL_INSTALL_DIR); do \
> +		if test -f $${d}/bin/getconf ; then \
> +			for f in getconf ldd locale; do \

It probably better to do the for loop for each tools and test one by one if they
are available otherwise error out. Custom toolchains content may be surprising.

BR2_PACKAGE_GLIBC_UTILS also handle 'ldconfig' copy to sbin. (If we want to have
something similar).

> +				install -m 0755 -D $${d}/bin/$${f} $(TARGET_DIR)/usr/bin ; \
> +			done ; \
> +			utils_found=1 ; \
> +			break ; \
> +		fi ; \
> +	done ; \
> +	if [ $${utils_found} -eq 0 ] ; then \
> +		echo "Could not find libc utils in external toolchain" ; \

It would be better to error out with the missing tool instead.

Best regards,
Romain


> +		exit 1 ; \
> +	fi
> +endef
> +endif
> +
>  define TOOLCHAIN_EXTERNAL_INSTALL_SYSROOT_LIBS
>  	$(Q)SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
>  	ARCH_SYSROOT_DIR="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
> @@ -627,6 +650,7 @@ endef
>  define $(2)_INSTALL_TARGET_CMDS
>  	$$(TOOLCHAIN_EXTERNAL_CREATE_TARGET_LIB_SYMLINK)
>  	$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBS)
> +	$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LIBC_UTILS)
>  	$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_GDBSERVER)
>  	$$(TOOLCHAIN_EXTERNAL_FIXUP_UCLIBCNG_LDSO)
>  	$$(TOOLCHAIN_EXTERNAL_INSTALL_TARGET_LDD)

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

  reply	other threads:[~2026-03-10 21:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-25 10:55 [Buildroot] [PATCH v6 0/6] kvm-unit-tests: update deps and fine tune qemu Alex Bennée
2026-02-25 10:55 ` [Buildroot] [PATCH v6 1/6] toolchain/external: allow installing of libc utils Alex Bennée
2026-03-10 21:53   ` Romain Naour via buildroot [this message]
2026-02-25 10:55 ` [Buildroot] [PATCH v6 2/6] package/kvm-unit-tests: update dependencies Alex Bennée
2026-03-10 22:02   ` Romain Naour via buildroot
2026-03-10 22:07     ` Romain Naour via buildroot
2026-02-25 10:55 ` [Buildroot] [PATCH v6 3/6] package/kvm-unit-tests: bump to v2025-07-31 Alex Bennée
2026-03-10 22:09   ` Romain Naour via buildroot
2026-02-25 10:55 ` [Buildroot] [PATCH v6 4/6] package/kvm-unit-tests: honour BR2_ARM64_PAGE_SIZE Alex Bennée
2026-03-10 22:16   ` Romain Naour via buildroot
2026-02-25 10:55 ` [Buildroot] [PATCH v6 5/6] support/testing: add test for kvm-unit-tests Alex Bennée
2026-03-10 22:31   ` Romain Naour via buildroot
2026-02-25 10:55 ` [Buildroot] [PATCH v6 6/6] package/kvm-unit-tests: allow kvmtool to be used Alex Bennée
2026-03-10 22:44   ` Romain Naour via buildroot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=37fab77c-8ff6-4bdf-8546-ea194ee478ef@smile.fr \
    --to=buildroot@buildroot.org \
    --cc=alex.bennee@linaro.org \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=romain.naour@gmail.com \
    --cc=romain.naour@smile.fr \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox