Make sure you have the proper letters after the chip name also, as the "signature bytes" vary.
For example, the 1284 & 1284P (with 16K of SRAM, the most of Any of the 8 byte AVRs) have
ATmega1284 0x1E 0x97 0x06
ATmega1284P 0x1E 0x97 0x05
Same with the 328/328P:
ATmega328 0x1E 0x95 0x14
ATmega328P 0x1E 0x95 0x0F
Sometimes the hardware difference is small, like drawing a little less power, or having additional brownout selections.
A part like the 644 has bigger differences besides the signature bytes - '644 has 1 hardware USART, while '644P has two.
I believe Nick Gammon's bootloader sketch covers several of the varieties, more so than the unmodified Arduino installation does.