compiling x86 busybox with uclibc support

Dec 20, 2007 4 Replies

Hi there,



this is supposed to be a FAQ, but unfortunately it is not.



How would I configure busybox to get linked against my custom Version of uclibc insted of the system glibc?



Unfortunately recent Versions of busybox are no longer statically linkable against glibc.



Sven


.. this message has been created using an outdated OS (UNIX-like) with an outdated mail- or newsreader (text-only) :-P /me is giggls@ircnet, http://sven.gegg.us/ on the Web

Set Makefile CROSS_COMPILE variable to gcc which link with uclibc. There are at least 3 possibilities to get such gcc.

1) Build custom GNU toolchain 2) Use debian uclibc-toolchain wrapper 3) Create custom gcc wrapper

AFAIK Option 1) is a must if you plan to use floating point. I use 3) option with below script but it's unreliable (I show it only for reference)

#!/bin/sh

uclibc=/usr/src/uClibc-0.9.29 gccdir="/usr/lib/gcc-lib/i486-linux/3.3.5/" gccinc="${gccdir}/include" gcclib="${gccdir}" lnxinc="/usr/src/linux-2.6.16.y/include/"

linking="yes" static="no" busybox="no" for opt in $* ; do case $opt in -c|-S|-E) linking="no" ;; -static) static="yes" ;; busybox_unstripped) busybox="yes" ;; # FIXME esac done

ldopts= suffix= if [ "$linking" == "yes" ] ; then ldir="${uclibc}/lib/" if [ "$static" == "yes" ] ; then crt1= if [ "$busybox" == "no" ] ; then crt1="${ldir}/Scrt1.o" fi ld_dyn= ld_libs="-L${ldir} -lc -lgcc"

suffix="${ldir}/libc.a ${gcclib}/libgcc.a" else crt1= if [ "$busybox" == "no" ] ; then crt1="${ldir}/crt1.o" fi ld_dyn="-Wl,-rpath,${uclibc}/lib,--dynamic-linker ${uclibc}/lib/ld-uClibc.so" ld_libs="-L${ldir} -lc -lgcc" fi ldopts="$ld_dyn $crt1 $ld_libs" fi incopts="-nostdinc -I${uclibc}/include -I$lnxinc -isystem $gccinc" libopts="-nostdlib -nodefaultlibs"

exec gcc $incopts $libopts $ldopts $* $suffix

hm, sound complicated...

unfortunately Im unable to backport the debian uclibc package for debian etch.

Hm, this could probable be the way to go. All I need is a static busybox binary after all.

Sven

Threading is a performance hack. (The Art of Unix Programming by Eric S. Raymond) /me is giggls@ircnet, http://sven.gegg.us/ on the Web

What is an "debian etch" ?

Debian GNU/Linux 4.0 usually know by its codename "etch" :)

Sven

-- The main thing to note is that when you choose open source you don't get a Windows operating system. (from

formatting link
/me is giggls@ircnet,
formatting link
on the Web

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required