Build the gcc4 toolchain

From Altera Wiki
Jump to: navigation, search

0. You need a 32-bit Linux system to build the toolchain.

you need gcc3 and makeinfo to build. On OpenSUSE:

yum install compat-gcc-34 texinfo tetex*

On Ubuntu:

sudo apt-get install texinfo texlive

On Ubuntu, you will need to find gcc-3.4, gcc-3.4-base, and cpp-3.4 packages from Ubuntu 9.04.

Some versions of Ubuntu use mawk instead of gawk. You will nee to install gawk.

1. get the source:

2. get the patches: 

REAME (this file)

3. untar the source

tar jxf wrs-linux-4.1-176-nios2-wrs-linux-gnu.src.tar.bz2

4. in the wrs-linux-4.1-176-nios2-wrs-linux-gnu dir, there are source tarballs. extract them to build dir, /opt/nios2gcc4/src.

cd wrs-linux-4.1-176-nios2-wrs-linux-gnu

tar jxf binutils-4.1-176.tar.bz2 -C /opt/nios2gcc4/src
tar jxf expat-4.1-176.tar.bz2  -C /opt/nios2gcc4/src
tar jxf gcc-4.1-176.tar.bz2  -C /opt/nios2gcc4/src
tar jxf gdb-4.1-176.tar.bz2  -C /opt/nios2gcc4/src
tar jxf glibc-4.1-176.tar.bz2  -C /opt/nios2gcc4/src
tar jxf glibc_localedef-4.1-176.tar.bz2 -C /opt/nios2gcc4/src
tar jxf glibc_ports-4.1-176.tar.bz2 -C /opt/nios2gcc4/src
tar jxf linux-4.1-176.tar.bz2  -C /opt/nios2gcc4/src

5. apply the patches

cd /opt/nios2gcc4/src/binutils-2.17.50
patch -p1 < 0001-binutils-fix-makeinfo-version-check-in-configure.patch
cd /opt/nios2gcc4/src/gcc-4.1
patch -p1 < 0001-gcc-fix-makeinfo-version-check-in-configure.patch
cd /opt/nios2gcc4/src/gdb-wrs
patch -p1 < 0001-gdb-fix-makeinfo-version-check-in-configure.patch
cd /opt/nios2gcc4/src/linux-2.6.21-wrs-nios2
patch -p1 < 0001-kbuild-fix-C-libary-confusion-in-unifdef.c-due-to-g.patch

6. run the build script, you can change the build dir, /opt/nios2gcc4 and install dir /opt/nios2.


7. you will need mkimage of u-boot or install it from debian/ubuntu package uboot-mkinage.

Personal tools