Note: Do not modify the boards.txt in your Arduino sketch folder (eg. ...\My Documents\Arduino\hardware\...boardx.txt), it will not work.

Using an Arduino board to burn the bootloaderIf your ATMega8/ATmega328 already configured to use external clock, then wire up the Arduino board & microcontroller as show in figure 1, otherwise (microcontroller configured to use internal clock) you can follow either figure 1 or figure 2.

Upload the ArduinoISP sketch onto your Arduino board.

From Tools>Board menu, select ATmega328 Optiboot (8MHz internal clock) if you want to burn the bootloader on ATMega328 microcontroller

From Tools>Board menu, select ATmega8 Optiboot (8MHz internal clock) if you want to burn the bootloader on ATMega8 microcontroller

Burning sketches to the Arduino board with an AVRISP MKII programmer without using the bootloader. This allows you to use the full program space (flash) of the chip on the Arduino board. So with an ATmega328, you will get 32KB instead of 30KB of space. It also avoids the bootloader delay when you power or reset your board.

// Detect which type of boot loader is present, using a fixed built-in table// 2012-03-06 <This email address is being protected from spambots. You need JavaScript enabled to view it.; http://opensource.org/licenses/mit-license.php