Adding custom hardware to Arduino 1.0

How do I go about adding custom hardware support to the Arduino IDE?

I have created a ATmega32u4 based board that has a different pinout then Leonardo but should work with the Leonardo boot loader. How can I add it as a board to the IDE? I have a ATmega1284p based design on the drawing board. It will require a lot more customization within the IDE then the other board. How do I go about that?

I looked at the mighty-1284p files. It appears it is possible to build a self contained package to support new hardware. By all means that would be ideal an much preferred over hacking the original files in place. But I have yet to find any concrete information on it.

I know of boards.txt and the file defining io pins. I think I understand both to some degree. I also see how boards.txt refers to the boot loader. But I have no idea where to start with core files.

Any suggestions where to start looking?

http://code.google.com/p/arduino/wiki/Platforms

Also... Your life will be way easier on 1284P when the Arduino team commits my patch on Issue 736. With that in place, all the support for 1284P will be in the Arduino core, and then you just need to worry about your pin mappings. It will make mighty-1284p much smaller because it won't have to duplicate the Arduino core.