next up previous contents index
Next: Rebuilding the cross compiler Up: Setting up an initial Previous: Setting up the Linux   Contents   Index


Building a runtime library

This section describes the necessary steps for building a C - library. This library contains many essential functions such as printf() for C - sources:

$ cd ../..
$ cd BUILD
$ tar -xvzf ../SRC/glibc-2.2.4.tar.gz -C .
$ patch -p0 < ../SRC/glibc-2.2.4-sh-linux.diff
$ mkdir build-glibc
$ cd build-glibc
$ mkdir $PREFIX/$TARGET/include

Now, we copy the Linux kernel header files and assembly files to this include directory:

$ cp -r ../../KERNEL/linux/include/linux \
  $PREFIX/$TARGET/include
$ cp -r ../../KERNEL/linux/include/asm-sh \
  $PREFIX/$TARGET/include/asm

Now, we're ready to configure and compile this C - library. The configure - script configures the sources for the SEGA Dreamcast, looks for kernel header files in the directory $PREFIX/$TARGET/include, dispenses with profiling informationen build in along with debug information and disables examinations of the build programs (you remeber chapter one, common cross compiling problems?):

$ CC=sh4-linux-gcc ../glibc-2.2.4/configure \
  --host=$TARGET --prefix=$PREFIX \
  --disable-debug --disable-profile \
  --disable-sanity-checks \
  --with-headers=$PREFIX/$TARGET/include
$ make

The next command saves time by bluffing the glibc of having already build unnecessary programs:

$ touch iconv/iconv_prog login/pt_chown
$ make install_root=$PREFIX/$TARGET prefix="" install
$ echo "GROUP ( libc.so.6 libc_nonshared.a )" \
  > $PREFIX/$TARGET/lib/libc.so



Christian Berger 2004-10-19