It can be easily done using Linux. This procedure is for the 328p processor. It can easily be adapted for a 168 processor. You will need an ICSP. First, make sure that avrdude is installed. It can be installed by issuing the command:
sudo apt-get install avrdude
You will need to retrieve the bootloader. It can be found in the hardware/arduino/bootloaders/atmega directory in the 1.0.5 Arduino IDE download. It is named ATmegaBOOT_168_atmega328.hex.
/usr/bin/avrdude -c avrispv2 -p m328p -P /dev/ttyACM0 -e
/usr/bin/avrdude -c avrispv2 -p m328p -P /dev/ttyACM0 -U flash:w:ATmegaBOOT_168_atmega328.hex