After a lot of research and testing I finally got everything to work as intended
You can now upload Arduino code and burn Optiboot bootloader to the following microcontrollers:
*Atmega1284p *
*Atmega644p *
Atmega324p
Atmega32
Atmega164p
ATmega16
ATmega8535
You can also choose these clock settings:
20MHz external
16MHz external (default)
8MHz internal
1MHz internal
The core can be downloaded from my Github repo: GitHub - MCUdude/MightyCore: Arduino hardware package for ATmega1284, ATmega644, ATmega324, ATmega324PB, ATmega164, ATmega32, ATmega16 and ATmega8535
The pin configuration are all the same on these microcontrollers, and looks like this:
This will only work in the new Arduino IDE 1.6.x (tested with Arduino IDE 1.6.5)