Programming new Atmega328-PU

I have not tried optiboot but I have used the 328-PU in place of the 328P. The only significant issue is that it has a different signature byte. Functionally it's the same chip but AVRdude won't recognise it for burning the bootloader.

You can use your existing Arduino as an ISP with the new chip on a breadboard (use a crystal & caps too). However, you will initially get an error from ARVdude saying that it doesn't get the expected signature byte.

The easiest fix is to find your avrdude.conf file and in the entry under ATmega328, edit the line:

signature = 0x1e 0x95 0x0F;

to read:

signature = 0x1e 0x95 0x14;

The former is the sig for a 328P the latter for a 328.

Once the bootloader is added, you can re-program the 328 in exactly the same way as the usual 328P. So once you have the bootloaders burned onto the chips you can set your AVRdude config file back again.