mailing list of musl libc
 help / color / mirror / code / Atom feed
* Compiling latest busybox with latest musl
@ 2014-08-08 20:30 Tim Tassonis
  2014-08-08 20:51 ` Rich Felker
  2014-08-09  6:45 ` u-igbb
  0 siblings, 2 replies; 5+ messages in thread
From: Tim Tassonis @ 2014-08-08 20:30 UTC (permalink / raw)
  To: musl

Hi

Firstly, thanks for musl. I chose it to create fully-working statically
linked binaries for a system without any glibc stuff on it and did not
want to create a whole toolchain first, as required with uClibc.

When I wanted to create s statically linked busybox (1.22.1), I looked
in the wiki and found the page:

http://wiki.musl-libc.org/wiki/Building_Busybox


This put me off a bit, as I did not want to modify my kernel headers
just to compile a static busybox.

But I found a less intrusive way to achieve my goal, maybe you might
want to add this to the next release or document it somewhere. Or of
course tell me that this is absolutely not the way to go....

1. Step: Download, compile and install musl-1.1.14

MUSL_BASE=$HOME/local/musl
KHDR_BASE=/usr
./configurre --prefix=$MUSL_BASE
make
make install
PATH=$MUSL_BASE/bin export PATH

2. Step: Make some headers and program names available for busybox

cd $MUSL_BASE/bin
ln -s `which ar` musl-ar
ln -s `which strip` musl-strip
cd $MUSL_BASE/include
ln -s $KHDR_BASE/include/linux linux
ln -s /tools/include/mtd mtd
if [ -d $KHDR_BASE/include/asm ]
then
	ln -s $KHDR_BASE/include/asm asm
else
	ln -s $KHDR_BASE/include/asm-generic asm
fi
ln -s $KHDR_BASE/include/asm-generic asm-generic

3. Step: Compile busybox

make defconfig
make menuconfig
under build options, i chose:

CONFIG_STATIC=y
CONFIG_CROSS_COMPILER_PREFIX="musl-"

and then
make V=1

The following applets failed to compile:

#CONFIG_IFPLUGD
#CONFIG_INETD


Otherwise everything compiled and I got an almost fully-featured,
statically linked busybox without ever having to change one header,
source or makefile, let alone become root. Size: 911096

Host system was Ubuntu Server 13.10 64 bit
Toolchain was the temporary build system of LFS 7.5:

- gcc 4.8.2
- binutuils 2.24
- Kernel headers of linux-3.13.3

I tried also with the ubuntu kernel headers (3.11.0-26), worked as well.

Kind regards
Tim

-- 
decentral.ch - IT Stuff
Tim Tassonis
Dennlerstasse 36
8047 Zürich

stuff@decentral.ch
+41 79 229 36 17


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

* Re: Compiling latest busybox with latest musl
  2014-08-08 20:30 Compiling latest busybox with latest musl Tim Tassonis
@ 2014-08-08 20:51 ` Rich Felker
  2014-08-08 21:12   ` Tim Tassonis
  2014-08-09  6:45 ` u-igbb
  1 sibling, 1 reply; 5+ messages in thread
From: Rich Felker @ 2014-08-08 20:51 UTC (permalink / raw)
  To: musl

On Fri, Aug 08, 2014 at 10:30:32PM +0200, Tim Tassonis wrote:
> Hi
> 
> Firstly, thanks for musl. I chose it to create fully-working statically
> linked binaries for a system without any glibc stuff on it and did not
> want to create a whole toolchain first, as required with uClibc.
> 
> When I wanted to create s statically linked busybox (1.22.1), I looked
> in the wiki and found the page:
> 
> http://wiki.musl-libc.org/wiki/Building_Busybox
> 
> 
> This put me off a bit, as I did not want to modify my kernel headers
> just to compile a static busybox.

In order to compile Busybox (at least the applets that need kernel
headers), you have to have a copy of the kernel headers in your musl
include path anyway; if the host system is glibc-based, /usr/include
will not be used. So this isn't as big a burden as it sounds like.
You're not modifying "your kernel headers" but just the copy installed
with musl. This does not need root.

Rich


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

* Re: Compiling latest busybox with latest musl
  2014-08-08 20:51 ` Rich Felker
@ 2014-08-08 21:12   ` Tim Tassonis
  2014-08-08 21:15     ` Rich Felker
  0 siblings, 1 reply; 5+ messages in thread
From: Tim Tassonis @ 2014-08-08 21:12 UTC (permalink / raw)
  To: musl

On 08/08/2014 10:51 PM, Rich Felker wrote:
> On Fri, Aug 08, 2014 at 10:30:32PM +0200, Tim Tassonis wrote:
>> Hi
>>
>> When I wanted to create s statically linked busybox (1.22.1), I looked
>> in the wiki and found the page:
>>
>> http://wiki.musl-libc.org/wiki/Building_Busybox
>>
>>
>> This put me off a bit, as I did not want to modify my kernel headers
>> just to compile a static busybox.
> 
> In order to compile Busybox (at least the applets that need kernel
> headers), you have to have a copy of the kernel headers in your musl
> include path anyway; if the host system is glibc-based, /usr/include
> will not be used. So this isn't as big a burden as it sounds like.
> You're not modifying "your kernel headers" but just the copy installed
> with musl. This does not need root.

The way I installed musl-1.1.14, there were no kernel headers installed.
I just did the

./configurre --prefix=$MUSL_BASE
make
make install

without any toolchain. So, the kernel headers were not found like this.
Linking them into the include directory of musl seems to be the least
expensive in this case.

Kind regards
Tim



> 
> Rich
> 


-- 
decentral.ch - IT Stuff
Tim Tassonis
Dennlerstasse 36
8047 Zürich

stuff@decentral.ch
+41 79 229 36 17


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

* Re: Compiling latest busybox with latest musl
  2014-08-08 21:12   ` Tim Tassonis
@ 2014-08-08 21:15     ` Rich Felker
  0 siblings, 0 replies; 5+ messages in thread
From: Rich Felker @ 2014-08-08 21:15 UTC (permalink / raw)
  To: musl

On Fri, Aug 08, 2014 at 11:12:23PM +0200, Tim Tassonis wrote:
> On 08/08/2014 10:51 PM, Rich Felker wrote:
> > On Fri, Aug 08, 2014 at 10:30:32PM +0200, Tim Tassonis wrote:
> >> Hi
> >>
> >> When I wanted to create s statically linked busybox (1.22.1), I looked
> >> in the wiki and found the page:
> >>
> >> http://wiki.musl-libc.org/wiki/Building_Busybox
> >>
> >>
> >> This put me off a bit, as I did not want to modify my kernel headers
> >> just to compile a static busybox.
> > 
> > In order to compile Busybox (at least the applets that need kernel
> > headers), you have to have a copy of the kernel headers in your musl
> > include path anyway; if the host system is glibc-based, /usr/include
> > will not be used. So this isn't as big a burden as it sounds like.
> > You're not modifying "your kernel headers" but just the copy installed
> > with musl. This does not need root.
> 
> The way I installed musl-1.1.14, there were no kernel headers installed.

Yes, musl does not need kernel headers. They're only needed if you
want to compile applications which user kernel headers, which are
mostly limited to low-level utilities for network configuration,
device access, etc. and in that case it's up to you to provide them.

> I just did the
> 
> ../configurre --prefix=$MUSL_BASE
> make
> make install
> 
> without any toolchain. So, the kernel headers were not found like this.
> Linking them into the include directory of musl seems to be the least
> expensive in this case.

Yes, linking them should work, and in that case you probably have a
good system for getting Busybox to work without modifying them. I
haven't looked at it in detail yet though.

Rich


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

* Re: Compiling latest busybox with latest musl
  2014-08-08 20:30 Compiling latest busybox with latest musl Tim Tassonis
  2014-08-08 20:51 ` Rich Felker
@ 2014-08-09  6:45 ` u-igbb
  1 sibling, 0 replies; 5+ messages in thread
From: u-igbb @ 2014-08-09  6:45 UTC (permalink / raw)
  To: musl

Thanks for the hint Tim,

On Fri, Aug 08, 2014 at 10:30:32PM +0200, Tim Tassonis wrote:
> http://wiki.musl-libc.org/wiki/Building_Busybox
> 
> This put me off a bit, as I did not want to modify my kernel headers

The information there led me to delay moving busybox to musl.
Good that the unpatched kernel headers seem to play nicely along.

Rune



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

end of thread, other threads:[~2014-08-09  6:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-08 20:30 Compiling latest busybox with latest musl Tim Tassonis
2014-08-08 20:51 ` Rich Felker
2014-08-08 21:12   ` Tim Tassonis
2014-08-08 21:15     ` Rich Felker
2014-08-09  6:45 ` u-igbb

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).