Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] The external toolchain can be used statically.
@ 2010-12-07 15:48 Serj Kalichev
  2010-12-08  0:08 ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Serj Kalichev @ 2010-12-07 15:48 UTC (permalink / raw)
  To: buildroot

I tried to build minimal busybox-only project for using as initramfs. I use
external buildroot toolchain. The buildroot copy the .so libraries from
external toolchain to the target dir unconditionally. But I build busybox
statically and don't need shared libraries (the size of resulted image is too
big with unneeded libraries).

The patch use BR2_PREFER_STATIC_LIB to find out if the project prefer
static linking and if the static linking is preferred don't copy shared
libraries to the target dir.

Signed-off-by: Serj Kalichev <serj.kalichev@gmail.com>
---
 toolchain/toolchain-external/ext-tool.mk |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/toolchain/toolchain-external/ext-tool.mk b/toolchain/toolchain-external/ext-tool.mk
index 7e4645d..895ef5f 100644
--- a/toolchain/toolchain-external/ext-tool.mk
+++ b/toolchain/toolchain-external/ext-tool.mk
@@ -99,6 +99,7 @@ else
 	$(Q)$(call check_glibc,$(SYSROOT_DIR))
 endif
 	mkdir -p $(TARGET_DIR)/lib
+ifneq ($(BR2_PREFER_STATIC_LIB),y)
 	@echo "Copy external toolchain libraries to target..."
 	$(Q)for libs in $(LIB_EXTERNAL_LIBS); do \
 		$(call copy_toolchain_lib_root,$(ARCH_SYSROOT_DIR),$$libs,/lib,$(BR2_TOOLCHAIN_EXTERNAL_STRIP)); \
@@ -106,6 +107,7 @@ endif
 	$(Q)for libs in $(USR_LIB_EXTERNAL_LIBS); do \
 		$(call copy_toolchain_lib_root,$(ARCH_SYSROOT_DIR),$$libs,/usr/lib,$(BR2_TOOLCHAIN_EXTERNAL_STRIP)); \
 	done
+endif
 	@echo "Copy external toolchain sysroot to staging..."
 	$(Q)$(call copy_toolchain_sysroot,$(SYSROOT_DIR),$(ARCH_SYSROOT_DIR),$(ARCH_SUBDIR))
 	# Create lib64 symbolic links if needed
-- 
1.7.3.3

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

* [Buildroot] [PATCH] The external toolchain can be used statically.
  2010-12-07 15:48 [Buildroot] [PATCH] The external toolchain can be used statically Serj Kalichev
@ 2010-12-08  0:08 ` Mike Frysinger
       [not found]   ` <AANLkTikFg6m92-ovN5cf6E29-owMVLY_K20twJ1eqy66@mail.gmail.com>
  2010-12-08 10:40   ` [Buildroot] " Pkun
  0 siblings, 2 replies; 7+ messages in thread
From: Mike Frysinger @ 2010-12-08  0:08 UTC (permalink / raw)
  To: buildroot

On Tuesday, December 07, 2010 10:48:14 Serj Kalichev wrote:
> I tried to build minimal busybox-only project for using as initramfs. I use
> external buildroot toolchain. The buildroot copy the .so libraries from
> external toolchain to the target dir unconditionally. But I build busybox
> statically and don't need shared libraries (the size of resulted image is
> too big with unneeded libraries).

this isnt entirely correct.  glibc will still load shared libs on the fly such 
as nss and iconv.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101207/c4ca3415/attachment.pgp>

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

* [Buildroot] Fwd: [PATCH] The external toolchain can be used statically.
       [not found]   ` <AANLkTikFg6m92-ovN5cf6E29-owMVLY_K20twJ1eqy66@mail.gmail.com>
@ 2010-12-08  7:21     ` Pkun
  0 siblings, 0 replies; 7+ messages in thread
From: Pkun @ 2010-12-08  7:21 UTC (permalink / raw)
  To: buildroot

---------- Forwarded message ----------
From: Pkun <serj.kalichev@gmail.com>
Date: 2010/12/8
Subject: Re: [Buildroot] [PATCH] The external toolchain can be used
statically.
To: Mike Frysinger <vapier@gentoo.org>


Ok.
May be the right way is to copy only
"/usr/lib/libnss*.so*" and
"/usr/lib/gconv"
when the static is preferred?

Or make the shared libraries copying optional in Config.in?
Or make checkboxes especially for libnss and conv libraries to force
copying?

2010/12/8 Mike Frysinger <vapier@gentoo.org>

On Tuesday, December 07, 2010 10:48:14 Serj Kalichev wrote:
> > I tried to build minimal busybox-only project for using as initramfs. I
> use
> > external buildroot toolchain. The buildroot copy the .so libraries from
> > external toolchain to the target dir unconditionally. But I build busybox
> > statically and don't need shared libraries (the size of resulted image is
> > too big with unneeded libraries).
>
> this isnt entirely correct.  glibc will still load shared libs on the fly
> such
> as nss and iconv.
> -mike
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101208/515f01fa/attachment.html>

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

* [Buildroot] [PATCH] The external toolchain can be used statically.
  2010-12-08  0:08 ` Mike Frysinger
       [not found]   ` <AANLkTikFg6m92-ovN5cf6E29-owMVLY_K20twJ1eqy66@mail.gmail.com>
@ 2010-12-08 10:40   ` Pkun
  2010-12-08 10:48     ` Mike Frysinger
  1 sibling, 1 reply; 7+ messages in thread
From: Pkun @ 2010-12-08 10:40 UTC (permalink / raw)
  To: buildroot

Ok.
May be the right way is to copy only
"/usr/lib/libnss*.so*" and
"/usr/lib/gconv"
when the static is preferred?

Or make the shared libraries copying optional in Config.in?
Or make checkboxes especially for libnss and conv libraries to force
copying?

P.S. Sorry for message duplication. Send this message to get to thread.




2010/12/8 Mike Frysinger <vapier@gentoo.org>

> On Tuesday, December 07, 2010 10:48:14 Serj Kalichev wrote:
> > I tried to build minimal busybox-only project for using as initramfs. I
> use
> > external buildroot toolchain. The buildroot copy the .so libraries from
> > external toolchain to the target dir unconditionally. But I build busybox
> > statically and don't need shared libraries (the size of resulted image is
> > too big with unneeded libraries).
>
> this isnt entirely correct.  glibc will still load shared libs on the fly
> such
> as nss and iconv.
> -mike
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101208/4824d582/attachment.html>

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

* [Buildroot] [PATCH] The external toolchain can be used statically.
  2010-12-08 10:40   ` [Buildroot] " Pkun
@ 2010-12-08 10:48     ` Mike Frysinger
  2010-12-08 11:26       ` Pkun
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2010-12-08 10:48 UTC (permalink / raw)
  To: buildroot

On Wednesday, December 08, 2010 05:40:17 Pkun wrote:
> Ok.

please dont top post

> May be the right way is to copy only
> "/usr/lib/libnss*.so*" and
> "/usr/lib/gconv"
> when the static is preferred?

no, because that wont pull in the libraries that those libraries need.  like 
libc.so, libresolv.so, ld-linux.so, ......  at which point you might as well 
leave them alone.

> Or make the shared libraries copying optional in Config.in?
> Or make checkboxes especially for libnss and conv libraries to force
> copying?

i think the only safe way would be to let end users remove the files they know 
they wont need at runtime.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101208/098ded21/attachment.pgp>

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

* [Buildroot] [PATCH] The external toolchain can be used statically.
  2010-12-08 10:48     ` Mike Frysinger
@ 2010-12-08 11:26       ` Pkun
  2010-12-08 11:31         ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Pkun @ 2010-12-08 11:26 UTC (permalink / raw)
  To: buildroot

What about checkbox "Don't copy toolchain libraries to the target dir" that
depends on PREFERRED_STATIC. So users who use dynamic linking don't see this
checkbox at all. But users who use static linking can manually choose to
copy or don't copy shared libraries. It's usefull to create initramfs images
at least. It's unlikely that someone make initramfs with complex soft.
Usually it will be a static busybox.

2010/12/8 Mike Frysinger <vapier@gentoo.org>

> On Wednesday, December 08, 2010 05:40:17 Pkun wrote:
> > Ok.
>
> please dont top post
>
> > May be the right way is to copy only
> > "/usr/lib/libnss*.so*" and
> > "/usr/lib/gconv"
> > when the static is preferred?
>
> no, because that wont pull in the libraries that those libraries need.
>  like
> libc.so, libresolv.so, ld-linux.so, ......  at which point you might as
> well
> leave them alone.
>
> > Or make the shared libraries copying optional in Config.in?
> > Or make checkboxes especially for libnss and conv libraries to force
> > copying?
>
> i think the only safe way would be to let end users remove the files they
> know
> they wont need at runtime.
> -mike
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101208/6595aa47/attachment.html>

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

* [Buildroot] [PATCH] The external toolchain can be used statically.
  2010-12-08 11:26       ` Pkun
@ 2010-12-08 11:31         ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2010-12-08 11:31 UTC (permalink / raw)
  To: buildroot

On Wednesday, December 08, 2010 06:26:52 Pkun wrote:

again, please do not top post

> What about checkbox "Don't copy toolchain libraries to the target dir" that
> depends on PREFERRED_STATIC. So users who use dynamic linking don't see
> this checkbox at all. But users who use static linking can manually choose
> to copy or don't copy shared libraries. It's usefull to create initramfs
> images at least. It's unlikely that someone make initramfs with complex
> soft.

that's up to Peter, but anything you add will need to include warnings such as 
ive already spewed

> Usually it will be a static busybox.

even a static busybox could try to load those libraries depending on the nss 
configuration.  nss handles simple things like user/group look ups in 
/etc/passwd and /etc/group to more complicated like host resolving.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20101208/faca16d7/attachment-0001.pgp>

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

end of thread, other threads:[~2010-12-08 11:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-07 15:48 [Buildroot] [PATCH] The external toolchain can be used statically Serj Kalichev
2010-12-08  0:08 ` Mike Frysinger
     [not found]   ` <AANLkTikFg6m92-ovN5cf6E29-owMVLY_K20twJ1eqy66@mail.gmail.com>
2010-12-08  7:21     ` [Buildroot] Fwd: " Pkun
2010-12-08 10:40   ` [Buildroot] " Pkun
2010-12-08 10:48     ` Mike Frysinger
2010-12-08 11:26       ` Pkun
2010-12-08 11:31         ` Mike Frysinger

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