#! /usr/bin/env bash ## Get basic compile tools if you don't already got 'em: ## Uncomment the relevant line below before running. # apt-get install flex bison byacc gcc # yum install flex bison byacc gcc ## This is going to be the base install directory mkdir /usr/local/AVR cd /usr/local/AVR ## Get the source files ## Note: you can get an updated version of GCC if you want. ## This one works for me. wget http://ftp.gnu.org/gnu/binutils/binutils-2.17.tar.bz2 wget ftp://ftp.gnu.org/gnu/gcc/gcc-4.0.3/gcc-core-4.0.3.tar.bz2 wget http://download.savannah.gnu.org/releases/avr-libc/avr-libc-1.4.5.tar.bz2 wget http://download.savannah.gnu.org/releases/avrdude/avrdude-5.2.tar.gz ## Unpack them all tar xvjf binutils-2.17.tar.bz2 tar xvjf gcc-core-4.0.3.tar.bz2 tar xvjf avr-libc-1.4.5.tar.bz2 tar xvzf avrdude-5.2.tar.gz ## And start compiling. This takes a while. Go get some tea. # Binutils cd binutils-2.17/ ./configure --prefix=/usr/local/AVR --target=avr make make install cd .. # Update path, b/c GCC needs the avr linker from binutils above export PATH=$PATH:/usr/local/AVR/bin # GCC cd gcc-4.0.3/ # note: if you changed GCC versions above, change this! mkdir avr-gcc # GCC needs a sub-directory to compile into cd avr-gcc ../configure --prefix=/usr/local/AVR \ --target=avr --enable-languages="c" \ --disable-nls make make install cd ../.. # AVR LibC ## Note: build method changed recently -- much cleaner now. cd avr-libc-1.4.5/ ./configure --build=`./config.guess` --host=avr --prefix=/usr/local/AVR make make install cd .. # AVRdude cd avrdude-5.2/ ./configure --prefix=/usr/local/ make make install cd .. ## Now set up paths and we're done echo " ## Added to put avr-gcc and utils in the search path export PATH=\$PATH:/usr/local/AVR/bin" | cat >> /etc/profile