Arduino Bootloaders with AVRISP mkII & Ubuntu

Arduino chips are ATmega8 and ATmega168. There are very little differences between them, besides the different memory sizes. This makes possible a direct exchange between chips and D. Mellis included the possibility to choose processors already since IDE's version 0007.

The bootloader for Arduino using ATmega8 was written by Mellis and Cuartielles based on an original by thanks to a very nice bootloader's code that could communicate using Atmel's STK500 protocol (the original one, and not the v2 one!!).

The bootloader for Arduino using ATmega168 was written again by the same guys based on a revised code from the previous one and was made available the day Ars Electronica Festival 2006 opened. The coders made a special effort in preparing the program to run on the brand new Arduino Minis engineered by G. Martino and M. Banzi (from an original by V. Venkatraman) in the official lauch of those boards for the mentioned Festival.

The AVRISP mkII is a very useful tool by ATMEL that can program most of the chips from that manufacturer over USB, what makes it the perfect tool for development on laptops. Arduino's IDE uses the uploader called uisp to make the transfer of the binary *.hex files from the computer to the boards. However, this uploader doesn't support AVRISP mkII!! Therefore, if you purchase this device you will need to use an alternative.

Windows users count on AVR Studio, which is the official ATMEL programming tool and that allows to program in assembler, C, or C++. Thanks to it, it is possible to compile and upload the bootloader using many different hardware solutions. Among others we could use the AVRISP mkII, the parallel port programmer, or the STK500 professional development board. AVR Studio is Free but not Open Source. There is yet another tool, called WinAVR created by the Open Source community to develop on chips from ATMEL.

Linux users can now use Kontrollerlab, which is a tool based on WinAVR and that has been developed only recently.

Anyway, for burning the bootloader, we only need to use an uploader that can cope with AVRISP mkII. This is avrdude. The way to go for making this work, is to install the program from the source.

In my case, I installed version 5.3.1 that I got from here. But, before you get to compile this code, you have to make sure you have the right usb libraries for you to compile the software with support for this type of port.

As for other unix platforms, libusb is a must. You should get it from here and compile it. After that, you should compile avrdude.

The step-by-step procedure goes as follows:

1) download libusb from sourceforge and compile the source:

go to and get the latest stable version of the source

in my case I get the file libusb-0.1.12.tar.gz

uncompress the file:

 tar xvfz libusb-0.1.12.tar.gz

execute the following:

 cd libusb-0.1.12/
 sudo make install

2) download avrdude from and compile the source:

go to and get the latest stable version of the source

in my case it is avrdude-5.3.1.tar.gz

uncompress the file:

 tar xvfz avrdude-5.3.1.tar.gz

execute the following:

 cd avrdude-5.3.1/
 sudo make install

NOTE: you could run the following to make sure the proper usb library is included:

 ./configure | grep -i lusb

you should get the following:

 checking for usb_get_string_simple in -lusb... yes

if not, you may have made step 1) wrong

3) now avrdude is ready to upload the files, but you need to create two scripts depending if you want to upload the bootloader for the ATmega8 or for the ATmega168. The next files are the binary versions of the bootloaders (already compiled and gzipped):



The scripts to burn each one of the bootloaders are very similar, changing only the fuses for each processor. Fuses are hardware options that determine issues like the size (in memory blocks) that the bootloader is taking in the memory, if the bootloader can or not be overwritten, etc.



You have to make sure those scripts get the right permissions in your system:

 chmod 777 Burn_Bootloader*

After that, the burning commands are either:




20080218: - confirmed to work on Gutsy 7.10 - remember to install: flex, byacc and bison for avrdude's compilation to work