Installing the Arduino software on Gentoo Linux

Author: Jonny Stutters
Last updated: 21 April 2006


Before we get started be aware that some of this guide needs to be executed with root privileges so be careful. If you break your system I'm not responsible. Ok, let's get on with it. First you need to do some emerging to get the necessary packages:

emerge -pv --noreplace blackdown-jre crossdev jikes uisp rxtx subversion

Note that emerge might try to pull in Apache so you may want to edit make.conf or package.use first to prevent this.

Once you're happy with what will be emerged:

emerge --noreplace blackdown-jre crossdev jikes uisp rxtx subversion

Maybe get a cup of coffee because that lot can take a while. Once emerge has finished you need to build the development tools for the AVR processor. To do this you need to enter:

crossdev -t avr

Once crossdev has finished check to see if you have avr-g++:

ls /usr/bin/avr-g++

If that was ok then skip this bit. On my system crossdev didn't build the C++ tools by default. To fix that:

USE='-nocxx' emerge cross-avr/gcc

After that you should have a full set of gcc tools for the AVR. Switch back to your normal user for the next couple of steps.

Now to checkout the Arduino source. First create a directory where you want to do the build. I used ~/src/arduino but anywhere you have write access will be fine. cd to your chosen directory and execute:

svn checkout svn://svn.berlios.de/arduino/trunk

Once you've got the source cd to trunk/build/linux, su to root and execute:

export CLASSPATH=/opt/blackdown-jre-[some version]/bin:/opt/blackdown-jre-[some version]/lib/rt.jar
./make.sh

The compile throws quite a lot of errors but it should finish with "done" if it worked. Switch back to your normal user and do:

cd work
mkdir -p tools/avr/bin
cd tools/avr/bin
ln -s /usr/bin/avr-gcc avr-gcc
ln -s /usr/bin/avr-objcopy avr-objcopy
ln -s /usr/bin/avr-objdump avr-objdump
ln -s /usr/bin/avr-size avr-size
ln -s /usr/bin/avr-g++ avr-g++
ln -s /usr/bin/uisp uisp

Next tell RXTX to use the correct serial port back-end. Switch to root and do:

echo Driver=gnu.io.RXTXCommDriver > /opt/bin/blackdown-jre-[some version]/lib/javax.comm.properties

The next step is to get the USB to serial adapter working. To save some time later I suggest that you first add your user to the tty and uucp groups. I did this by modifying /etc/group with a text editor but you may want to use usermod instead (at some point you'll need to logout and login again to apply this change). Then you need to enable support for the FTDI in the kernel by setting:

Device Drivers -> USB support -> USB Serial Converter support -> USB FTDI Single Port Serial Driver (EXPERIMENTAL)

It should work as either a module or rolled into the kernel. To save myself some typing I'll assume as a Gentoo user you'll know how to go about doing this. Once you've rebooted into the new kernel and loaded the necessary modules connect the Arduino board to the computer using a USB cable. Next run dmesg. You should see something like:

usb 2-1: FTDI USB Serial Device converter now attached to ttyUSB0

The next step is to create a symlink to (for example) ttyUSB0 in a place where the Arduino software can find it. To do this switch to root and run:

ln -s /dev/ttyUSB0 /dev/ttyS8

If dmesg showed that the serial converter was placed at a different ttyUSB then modify the above command as necessary.

Hopefully at this stage you should be set to go. First switch back to your normal user and cd to the directory where you placed the arduino source. Then execute:

cd trunk/build/linux
./run.sh

With any luck the editor comes up without any error messages. Go to the tools menu and select ttyS8 as your serial port then try to upload one of the example sketches. If you get an error about the bootloader not responding then quit the editor and check in ~/.arduino/preferences.txt to make sure that serial.download_rate is set to the correct value for your board.

A final nice touch is to get the help working. First set the browser and browser.linux options in ~/.arduino/preferences.txt to the correct value for your system. In my case this was:

browser.linux=firefox
browser=firefox

After that run:

cd [arduino code folder]/trunk/build/linux/work
unzip reference.zip

If you have problems with any of those steps then the best places to ask for help are forums.gentoo.org for problems with emerging and Java and the Arduino forum for help with the editor. If there are any errors or points that need clarifying please email me.


Valid XHTML 1.0 Strict