Toolchains
To use uClibc, you need to have a toolchain. A toolchain consists
of GNU binutils,
the gcc compiler, and uClibc, all
built to produce binaries for your target system linked with uClibc.
You can build your own native uClibc toolchain using the
uClibc buildroot system.
To build your own uClibc toolchain, follow the following simple
steps:
- Point your web browser here,
- Click on "Download tarball"
- Unpack the tarball on your Linux system somewhere
- Edit the Makefile as needed if you wish to change anything.
- run 'unset CC'. Then run 'unset CXX'. Some Linux systems
(i.e. Gentoo) set variables such as 'CC' in the system environment
which really messes things up when cross compiling.
- run 'make menuconfig'
- Select the things you want to build. If you only want a
toolchain, leave everything except the toolchain disabled.
- save your buildroot configuration.
- run 'make'
- go eat a nice wholesome sandwich, drink a pop, call a friend,
play a video game, and generally find something to do. While you
are waiting, buildroot will download all the needed source code and
then compile things up for you.
- You should now have a shiny new toolchain, and maybe even a shiny
new uClibc based root filesystem or development system, depending on
the options you selected.
If you want to be really lazy and start using uClibc right away
without needing to compile your own toolchain or anything, you can grab a
pre-compiled uClibc development system. These are currently available for
arm,
armeb,
i386,
mips,
mipsel,
powerpc, and
sh4.
These are bzip2 compressed ext2 filesystems containing all the development
software you need to build your own uClibc applications, including: bash, awk,
make, gcc, g++, autoconf, automake, ncurses, zlib, openssl, openssh, gdb,
strace, busybox, GNU coreutils, GNU tar, GNU grep, etc.
Each of these uClibc development systems was created using
buildroot, specifically,
buildroot.tar.bz2
along with these sources.
These development systems should provide pretty much everything you need to get
started building your own applications with uClibc. Once you download one of
these systems, you can then boot into it, loop mount it, dd it to a spare drive
and use a tool such as resize2fs to make it fill a partition... Whatever works
best for you.
The quickest way to get started using a root_fs image (using the i386
platform as an example) is:
- Download root_fs_i386.bz2 from kernel.org
- bunzip2 root_fs_i386.bz2
- mkdir root_fs
- su root
- mount -o loop root_fs_i386 root_fs
- chroot root_fs /bin/su -
Type "exit" to end the chroot session and return to your host system.