All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] glibc: install glibc utils to target
@ 2019-11-20 12:16 Nikita Sobolev
  2019-11-20 13:49 ` Thomas Petazzoni
  0 siblings, 1 reply; 2+ messages in thread
From: Nikita Sobolev @ 2019-11-20 12:16 UTC (permalink / raw)
  To: buildroot

With this patch we introduce an option for glibc, which
installs getconf, ldconfig and ldd utilities on target, that
may be useful in debugging. By default these utilities are
built, but not installed to the target.
ldd is a bash script, so it has bash dependency.

Signed-off-by: Nikita Sobolev <Nikita.Sobolev@synopsys.com>
---
 package/glibc/Config.in | 15 +++++++++++++++
 package/glibc/glibc.mk  |  7 +++++++
 2 files changed, 22 insertions(+)

diff --git a/package/glibc/Config.in b/package/glibc/Config.in
index 7821251087..43d6445177 100644
--- a/package/glibc/Config.in
+++ b/package/glibc/Config.in
@@ -8,3 +8,18 @@ config BR2_PACKAGE_GLIBC
 	help
 	  https://www.gnu.org/software/libc/
 endif
+
+if BR2_TOOLCHAIN_BUILDROOT_GLIBC
+
+config BR2_PACKAGE_GLIBC_UTILS
+	bool "Compile and install glibc utilities"
+	depends on BR2_PACKAGE_GLIBC
+	depends on BR2_PACKAGE_BASH
+	help
+	  Enabling this option will compile and install the getconf,
+	  ldconfig and ldd glibc utilities for the target.
+
+comment "Glibc utilities need bash"
+	depends on !BR2_PACKAGE_BASH
+
+endif
diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk
index 68c6670007..db82792c2e 100644
--- a/package/glibc/glibc.mk
+++ b/package/glibc/glibc.mk
@@ -143,10 +143,17 @@ ifeq ($(BR2_PACKAGE_GDB),y)
 GLIBC_LIBS_LIB += libthread_db.so.*
 endif
 
+ifeq ($(BR2_PACKAGE_GLIBC_UTILS),y)
+GLIBC_TARGET_UTILS_BIN = /build/posix/getconf /build/elf/ldconfig /build/elf/ldd
+endif
+
 define GLIBC_INSTALL_TARGET_CMDS
 	for libpattern in $(GLIBC_LIBS_LIB); do \
 		$(call copy_toolchain_lib_root,$$libpattern) ; \
 	done
+	for util in $(GLIBC_TARGET_UTILS_BIN); do \
+		$(INSTALL) -D -m 0755 $(@D)/$$util $(TARGET_DIR)/bin/ ;\
+	done
 endef
 
 $(eval $(autotools-package))
-- 
2.16.2

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

* [Buildroot] [PATCH] glibc: install glibc utils to target
  2019-11-20 12:16 [Buildroot] [PATCH] glibc: install glibc utils to target Nikita Sobolev
@ 2019-11-20 13:49 ` Thomas Petazzoni
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2019-11-20 13:49 UTC (permalink / raw)
  To: buildroot

Hello Nikita,

Thanks for the patch!

On Wed, 20 Nov 2019 15:16:43 +0300
Nikita Sobolev <Nikita.Sobolev@synopsys.com> wrote:

> diff --git a/package/glibc/Config.in b/package/glibc/Config.in
> index 7821251087..43d6445177 100644
> --- a/package/glibc/Config.in
> +++ b/package/glibc/Config.in
> @@ -8,3 +8,18 @@ config BR2_PACKAGE_GLIBC
>  	help
>  	  https://www.gnu.org/software/libc/
>  endif
> +
> +if BR2_TOOLCHAIN_BUILDROOT_GLIBC

This condition is redundant, since glibc/Config.in already starts with:

if BR2_TOOLCHAIN_BUILDROOT_GLIBC


> +config BR2_PACKAGE_GLIBC_UTILS
> +	bool "Compile and install glibc utilities"

Just:

	bool "Install glibc utilities"

> +	depends on BR2_PACKAGE_GLIBC

This is not needed.

> +	depends on BR2_PACKAGE_BASH
> +	help
> +	  Enabling this option will compile and install the getconf,
> +	  ldconfig and ldd glibc utilities for the target.
> +
> +comment "Glibc utilities need bash"

Glibc -> glibc

> +	depends on !BR2_PACKAGE_BASH
> +
> +endif
> diff --git a/package/glibc/glibc.mk b/package/glibc/glibc.mk
> index 68c6670007..db82792c2e 100644
> --- a/package/glibc/glibc.mk
> +++ b/package/glibc/glibc.mk
> @@ -143,10 +143,17 @@ ifeq ($(BR2_PACKAGE_GDB),y)
>  GLIBC_LIBS_LIB += libthread_db.so.*
>  endif
>  
> +ifeq ($(BR2_PACKAGE_GLIBC_UTILS),y)
> +GLIBC_TARGET_UTILS_BIN = /build/posix/getconf /build/elf/ldconfig /build/elf/ldd

Drop the leading slash in each entry, and maybe the build/ as well, so:

GLIBC_TARGET_UTILS_BIN = posix/getconf elf/ldconfig elf/ldd

> +endif
> +
>  define GLIBC_INSTALL_TARGET_CMDS
>  	for libpattern in $(GLIBC_LIBS_LIB); do \
>  		$(call copy_toolchain_lib_root,$$libpattern) ; \
>  	done
> +	for util in $(GLIBC_TARGET_UTILS_BIN); do \
> +		$(INSTALL) -D -m 0755 $(@D)/$$util $(TARGET_DIR)/bin/ ;\
> +	done

Please use a make foreach loop instead, and a full destination path for
the target:

	$(foreach util,$(GLIBC_TARGET_UTILS_BIN), \
		$(INSTALL) -D -m 0755 $(@D)/build/$(util) $(TARGET_DIR)/bin/$(notdir $(util))
	)

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2019-11-20 13:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20 12:16 [Buildroot] [PATCH] glibc: install glibc utils to target Nikita Sobolev
2019-11-20 13:49 ` Thomas Petazzoni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.