AVRdude upload atmega328p code to atmega328pb

I've got some old code from ATMega328p boards, and some newer boards with ATMega328pb chips. I'm not trying to use any of the new features of the pb, I just want to upload my existing code.

I can do this by adding the -F option to force avrdude, but if I'm using the 'Upload Using Programmer' option within the IDE avrdude get's the pb signature and stops.

Ideally I'd just edit boards.txt and add an option for something like '328pb as 328p', but I'm not sure how the toolchain works and how the arduino IDE tells avrdude which chip to look for etc.

Thanks in advance!

The easiest way it to install and use MiniCore- it has support for the 328PB.