Setup the Environment

apt-get install gpp g++


From a terminal be root, I am already, if you need to use the 'su' command.
Whoami will tell you which username you are.



Make a directory for the programs and add the 'bin' path for the AVR tools to your PATH environment variable:

mkdir /usr/local/avr
mkdir /usr/local/avr/bin
PATH="$PATH:/usr/local/avr/bin"
export PATH




You may additionally want to add that path to your /etc/profile file:
vi /etc/profile
i
(move down to something like PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", change to
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/avr/bin"
)
Esc:wq
(if anything goes wrong, the abort sequence is Esc:q! )


Binary Utilities

Download the most recent release of the Binary Utilities from http://ftp.gnu.org/gnu/binutils/ (binutils-2.16.tar.gz).

cd /usr/src
wget http://ftp.gnu.org/gnu/binutils/binutils-2.20.tar.gz
ls -l


Extract binutils archive:

tar -xvzf binutils-2.20.tar.gz
cd binutils-2.20

Configure and install binutils:

./configure --target=avr --prefix=/usr/local/avr --program-prefix="avr-"

checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... avr-unknown-none
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... no
checking for mawk... mawk
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for version 0.10 of PPL... no
checking for correct version of CLooG... no
checking for bison... no
checking for byacc... no
checking for yacc... no
checking for bison... no
checking for gm4... no
checking for gnum4... no
checking for m4... no
checking for flex... no
checking for lex... no
checking for flex... no
checking for makeinfo... no
checking for expect... no
checking for runtest... no
checking for ar... ar
checking for as... as
checking for dlltool... no
checking for ld... ld
checking for lipo... no
checking for nm... nm
checking for ranlib... ranlib
checking for strip... strip
checking for windres... no
checking for windmc... no
checking for objcopy... objcopy
checking for objdump... objdump
checking for avr-cc... no
checking for avr-gcc... no
checking for avr-c++... no
checking for avr-g++... no
checking for avr-cxx... no
checking for avr-gxx... no
checking for avr-gcc... no
checking for avr-gcj... no
checking for avr-gfortran... no
checking for avr-ar... no
checking for avr-as... no
checking for avr-dlltool... no
checking for avr-ld... no
checking for avr-lipo... no
checking for avr-nm... no
checking for avr-objdump... no
checking for avr-ranlib... no
checking for avr-strip... no
checking for avr-windres... no
checking for avr-windmc... no
checking where to find the target ar... just compiled
checking where to find the target as... just compiled
checking where to find the target cc... pre-installed
checking where to find the target c++... pre-installed
checking where to find the target c++ for libstdc++... pre-installed
checking where to find the target dlltool... just compiled
checking where to find the target gcc... pre-installed
checking where to find the target gcj... pre-installed
checking where to find the target gfortran... pre-installed
checking where to find the target ld... just compiled
checking where to find the target lipo... pre-installed
checking where to find the target nm... just compiled
checking where to find the target objdump... just compiled
checking where to find the target ranlib... just compiled
checking where to find the target strip... just compiled
checking where to find the target windres... just compiled
checking where to find the target windmc... just compiled
checking whether to enable maintainer-specific portions of Makefiles... no
checking whether -fkeep-inline-functions is supported... yes
configure: creating ./config.status
config.status: creating Makefile


make
make install

GNU C Compiler

Download most recent release of the GNU C Compiler (gcc) from ftp://ftp.gnu.org/gnu/gcc/ (gcc-core-4.0.2.tar.bz2).

cd /usr/src
wget http://ftp.gnu.org/gnu/gcc/gcc-4.4.3/gcc-core-4.4.3.tar.gz

Extract gcc-core archive:

tar -xzvf gcc-core-4.4.3.tar.gz
cd gcc-4.4.3

Configure and install gcc:

mkdir obj
cd obj
../configure --target=avr --prefix=/usr/local/avr --enable-language=c --program-prefix="avr-"

"configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.2+."
apt-get install libgmp3-dev
then rerun the configure command again
"checking for correct version of mpfr.h... no
 configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.2+.
Try the --with-gmp and/or --with-mpfr options to specify their locations."
ok, so we install that too :)
apt-get install libmpfr-dev
technically, that version wont work, but it accepted it....
 
make
make install

NOTES:
In this step, configure was run from a directory ('obj') that does not reside in the same directory as the source files. This is required. If you do not do this, you will get the following error:
configure: error: Building in the source directory is not supported in this release. See http://gcc.gnu.org/install/configure.html for more details.

If you get the following error, then you did not correctly get /usr/local/avr into you PATH variable (step 1):
make[2]: avr-ar: Command not found

AVR C Library

Download most recent release of the AVR C Library from http://download.savannah.gnu.org/releases/avr-libc/ (avr-libc-1.4.3.tar.bz2).

cd /usr/src
wget http://mirror.csclub.uwaterloo.ca/nongnu/avr-libc/avr-libc-1.6.8.tar.bz2
you need to install bunzip for this
apt-get install bzip2

Extract the avr-libc archive:

tar -xjvf avr-libc-1.6.8.tar.bz2
cd avr-libc-1.6.8

Configure and install avr-libc:

./configure --build=`./config.guess` --host=avr --prefix=/usr/local/avr
make
make install

GNU Debugger

Download the most recent release of the GNU Debugger from http://www.gnu.org/software/gdb/download/ (gdb-6.4.tar.gz).

cd /usr/src
wget http://ftp.gnu.org/gnu/gdb/gdb-7.0.tar.gz

Extract the gdb archive:

tar -xvzf gdb-7.0.tar.gz
cd gdb-7.0

Configure and install gdb:

./configure --prefix=/usr/local/avr --program-prefix="avr-"
make

configure: WARNING: no enhanced curses library found; disabling TUI
checking for library containing tgetent... no
configure: error: no termcap library found
apt-get install ncurses-dev
and rerun make...

make install