Next Previous Contents  

Reference


In here, we will learn how to install cross-compiler by sources. Already in MIZI Linux SDK, RPMs for constructing cross-compiler are applied. If you want to make cross-compiler, follow below steps.
Before compiling sources, remove existing cross-compiler. If the cross-compiler was installed by SDK, you can remove this by the down commands.

# rpm -qa | grep cross : It shows RPMs used for constructing cross-compile environment.
# rpm -e cross-armv4l-binutils-2.10-3mz cross-armv4l-kernel-headers-2.4.5_rmk7_np2-1mz cross-armv4l-gcc-2.95.2-10mz cross-armv4l-glibc-2.2.1s-3mz cross-armv4l-gcc-c++-2.95.2-10mz : It removes RPMs related to tool chain.

We use the following sources for constructing cross-compiler.

linux-2.4.9.tar.gz, patch-2.4.9-ac9.gz, patch-2.4.9-ac9-rmk1.bz2, diff-2.4.9-ac9-rmk1-np1.gz,
binutils-2.11.2.tar.gz, gcc-2.95.3.tar.gz, glibc-2.2.4.tar.gz, glibc-linuxthreads-2.2.4.tar.gz

Be sure that sources of different version can generate error when you compile or install those.

We will install the cross-compiler at /opt/host/armv41 directory. Follow below steps.

(1) Installing binutils

You can get all source files except kernel from ftp://ftp.gnu.org, and sources related to kernel are uploaded from ftp://ftp.arm.linux.org.uk (kernel patch sources in here.) and
http://www.kernel.org/pub (kernel sources in here.)
Go above sites and download kernel source and kernel patch source at /tmp directory.

# cd /tmp
# tar zxvf binutils-2.11.2.tar.gz
# cd binutils-2.11.2
# ./configure --target=armv4l-unknown-linux --prefix=/opt/host/armv4l
# make
# make install

The naxt steps have to use the binary utilities made in front step, so include the binary utilities to ¡°PATH¡±.

# export PATH=/opt/host/armv4l/bin:$PATH

(2) Installing gcc(c compiler)

To link header files of kernel sources to /opt/host/armv41/armv41-unknown-linux/include directory, patch to linux-2.4.9 kernel source. Kernel version that we make to develop is ¡°linux-2.4.9-ac9-rmk1-np1¡±. For convenience, change the directory name to ¡°linux-2.4.9-ac9-rmk1-np1¡±.

# cd /tmp
# tar zxvf linux-2.4.9.tar.gz
# mv linux linux-2.4.9-ac9-rmk1-np1
# mv patch-2.4.9-ac9.gz patch-2.4.9-ac9-rmk1.bz2 diff-2.4.9-ac9-rmk1-np1.gz ./linux-2.4.9-ac9-rmk1-np1

# cd linux-2.4.9-ac9-rmk1-np1 : kernel 2.4.9
# gzip -cd patch-2.4.9-ac9.gz | patch -p1 : Alan Cox patch
# bzip2 -cd patch-2.4.9-ac9-rmk1.bz2 | patch -p1 : Russell King patch
# gzip -cd diff-2.4.9-ac9-rmk1-np1.gz | patch -p1 : Nicholas Pitre patch
# make menuconfig : Do to create ARM header files. When you exit, select save item.
# make dep : Also do to create header files.

Now header files of the development version kernel are created at /usr/include directory.
Link /usr/include directory to /opt/host/armv41/armv41-unknown-linux/include by symbolic link.

# cd /opt/host/armv4l/armv4l-unknown-linux
# cd include : If not existing, make include directory.
# cp -a /usr/include/* . : Copy all header files under /usr/include dir to current dir.
# ln -s /tmp/linux-2.4.9-ac9-rmk1-np1/include/asm-arm asm
# ln -s /tmp/linux-2.4.9-ac9-rmk1-np1/include/linux linux

Then, install GCC C compiler as following.

# cd gcc-2.95.3
# ./configure --target=armv4l-unknown-linux --prefix=/opt/host/armv4l
# make LANGUAGES=c
# make LANGUAGES=c install

(3) Installing glibc

When compiling glibc, some packages will need to update. If you want more details, refer ¡°INSTALL¡± file under glibc directory.

# cd /tmp
# tar zxvf glibc-2.2.4.tar.gz
# mv glibc-linuxthreads-2.2.4.tar.gz ./glibc-2.2.4
# cd glibc-2.2.4
# tar zxvf glibc-linuxthreads-2.2.4.tar.gz
# CC=armv4l-unknown-linux-gcc ./configure arm-linux --enable-add-ons
--build=i686-pc-linux-gnu --disable-iconv --with-headers=/tmp/linux-2.4.9-ac9-rmk1-np1/include
--prefix=/opt/host/armv4l
# make
# make install

(4) Installing gcc(c++ compiler)

# cd /tmp/gcc-2.95.3
# ./configure --target=armv4l-unknown-linux --with-libs=/opt/host/armv4l/lib
--with-headers=/opt/host/armv4l/include --prefix=/opt/host/armv4l
# make LANGUAGES="c c++"
# make LANGUAGES="c c++" install

Modify Makefile that is below kernel directory as following. This step needs for compiling ARM kernel.

# cd /tmp/linux-2.4.9-ac9-rmk1-np1
# vi Makefile : Modify the part ¡°CROSS_COMPILE¡± like this.
CROSS_COMPILE = /opt/host/armv4l/bin/armv4l-unknown-linux-



Next Previous Contents