How to compile Busybox using uclibc
Rob Landley
rob at landley.net
Sun Jul 30 19:49:48 UTC 2006
On Thursday 27 July 2006 3:45 am, Meenal Gupta, Noida wrote:
Chroot's first argument is the directory to change to, the rest of the command
line is what gets executed in the new environment. If you want to chroot to
the current directory, use a period as in "chroot . /thing/to/run".
> and also guide me step by step what i have to do to compile busybox
> using uclibc.
Well, what I told people to do in my OLS tutorial
(http://busybox.net/~landley/ols2006), the _easy_ way is to download a
prebuilt binary toolchain. A cut and paste from that...
----------
Here are some prebuilt ones, via my day job:
http://crossdev.timesys.com/download/latest/i686/toolchain/i686-linux-toolchain-fat.tar.gz
Extract into root directory, as root. (Yeah, I know.)
They don't supply an ldd that works with my script. (use readelf -d)
PATH=/opt/timesys/toolchains/i686-linux/bin/:$PATH i686-uclibc-gcc \
hello.c -o hello -Os -s
hello + lib/ld-uClibc.so.0 + lib/libc.so.0
252k: smaller than statically linked hello world from glibc.
Build statically against uClibc (add -static): 7k
----------
To build busybox against it with current -svn, set the environment variable
CROSS_COMPILE=i686-uclibc-
As in:
PATH=/opt/timesys/toolchains/i686-linux/bin:$PATH \
CROSS_COMPILE=i686-uclibc- make
Or:
export PATH=/opt/timesys/toolchains/i686-linux/bin:$PATH
export CROSS_COMPILE=i686-uclibc-
make
(yes, the trailing dash is important. This is the prefix that gets stuck on
the tool names to distinguish them from the native compiler.)
Here's a little file I wrote a few months back that work has reformatted with
a moderately unpleasant stylesheet and removed all mention of my name from,
but at least it finally went public and doesn't require a login to view
anymore:
https://crossdev.timesys.com/documentation/introduction-to-cross-compiling-for-linux/
If you want to build your compiler from source code, see
http://buildroot.uclibc.org
Rob
--
Never bet against the cheap plastic solution.
More information about the busybox
mailing list