view history edit print login register

Arduino on Gentoo Linux

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 -av --noreplace sun-jre-bin crossdev

If you want to use an Arduino Mini (or an ATmega168 in another board), you'll need a custom version of uisp. Remove uisp from the command above (remove what???) and instead download and build this file: uisp-20050207-m168.zip

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. Firstly ensure that /etc/make.conf has the following line:

PORTDIR_OVERLAY="/usr/local/portage" (You may have to create this directory if not present).

Next, enter this into the terminal:

crossdev -t avr -s4 -S (<< "-S" ensures you use stable package versions )

If crossdev fails when emerging cross-avr-libc-headers and the error log reports Failed to locate 'avr-gcc' in $PATH. restart the crossdev process with the --without-headers option. This is due to the fact that crossdev enables --with-headers by default, which breaks a lot of targets.

Now download the source from the software page. Extract it somewhere.

Then create a symlink so that arduino will find ldscripts (if this symlink is not present you will get errors about missing .hex files when you try to upload your code to the board):

ln -s /usr/lib/binutils/avr/2.19.1/ldscripts/ ~/arduino/ldscripts << the value "2.19.1" may differ on your box as avr is upgraded in portage

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 either as a module or built into the kernel. Just for convenience its easiest to compile it as a module.

Once selected as [M] run this command to compile and install the driver:

make && make modules_install && modprobe ftdi_sio

If you want it to load automatically on boot, add it to /etc/modules.autoload.d/kernel-2.6

Next 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

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:

./arduino

With any luck the editor comes up without any error messages. Go to the tools menu and select /dev/ttyUSB0 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.

NOTE: for AMD64 Gentoo users see this helpful link

The above link may now be old information for ver-0017. However, no symlinking is required to avrdude.

You need to install rxtx (anything older the ver-2.2_pre2 is unlikely to work) and locate librxtxSerial.so so you can create a symlink to this in $(arduino_dir)/lib/librxtxSerial.so There is a file of this name already present so delete it first. However, this is only needed to use the serial-comms tool in the IDE.

Originally by Jonny Stutters, Modified by Nick Stallman and Jon Noble