This article uses the GNU Compiler Collection (GCC) [11] version 3.3.5, eventhough the C++ features are not needed at this time. The standard GNU C library (glibc) takes up to much memory for this embedded platform. Instead this HOWTO uses the small footprint uClibc [12] library.
Start by installing the SVN version of the toolchain on the compile host using the commands below. If you experience problems, try checking out the same version (16376, was 10888) that I used.
mkdir -p $PRJ_DIR $ROOTFS_DIR svn co svn://uclibc.org/trunk/buildroot $PRJ_DIR/buildroot tar -C $PRJ_DIR -cvjf $DL_DIR/buildroot-svn.tar.bz2 buildroot # for later cd $PRJ_DIR/buildroot
The command below will first download uClibc, libc-headers and gcc.
It then starts the compile. An example .config
can be found at Example A.1, “buildroot .config”.
When finished
$TOOLCHAIN_DIR will contain the GNU C Compiler,
uClibc libraries and Linux header files.
cd $PRJ_DIR/buildroot unset CC unset CCX make oldconfig # 4=CONFIG_586 make <<EOF 4 EOF
Note that GCC 4.0.2 expects the relax_type definition in
gas/as.h instead of gas/tc.h.
Example A.2, “binutils-2.15.94.0.2.2-with-gcc-4.0.2.patch” lists a patch to move this
definition. The typical error message is
suffix or operands invalid for `mov'
in aarch/i386/kernel/process.o. Apply the
patch mentioned in http://lkml.org/lkml/2005/6/3/241.
patch -p1 < $PRJ_DIR/examples/patch/binutils-2.15.94.0.2.2-with-gcc-4.0.2.patch
Copy the relevant dynamic libraries to a location that later will be written to the target's initial ramdisk (rootfs).
mkdir -p $ROOTFS_DIR/lib cd $ROOTFS_DIR/lib install -m 755 $TOOLCHAIN_DIR/lib/libgcc_s.so.1 . ln -sf libgcc_s.so.1 libgcc_s.so install -m 755 $TOOLCHAIN_DIR/lib/ld-uClibc-0.9.28.so . ln -sf ld-uClibc-0.9.28.so ld-uClibc.so.0 install -m 755 $TOOLCHAIN_DIR/lib/libcrypt-0.9.28.so . ln -sf libcrypt-0.9.28.so libcrypt.so.0 ln -sf libcrypt.so.0 libcrypt.so install -m 755 $TOOLCHAIN_DIR/lib/libdl-0.9.28.so . ln -sf libdl-0.9.28.so libdl.so.0 ln -sf libdl.so.0 libdl.so install -m 755 $TOOLCHAIN_DIR/lib/libuClibc-0.9.28.so . ln -sf libuClibc-0.9.28.so libc.so.0 install -m 755 $TOOLCHAIN_DIR/lib/libutil-0.9.28.so . ln -sf libutil-0.9.28.so libutil.so.0 ln -sf libutil.so.0 libutil.so install -m 755 $TOOLCHAIN_DIR/lib/libresolv-0.9.28.so . ln -sf libresolv-0.9.28.so libresolv.so.0 ln -sf libresolv.so.0 libresolv.so install -m 755 $TOOLCHAIN_DIR/lib/libm-0.9.28.so . ln -sf libm-0.9.28.so libm.so.0 ln -sf libm.so.0 libm.so