Custom bootloader for ATmega328P
First of all you will need to set the BOOTSZx fuses according to your bootloader size, the boot reset address is not fixed and changes with that. (page 282 of the datasheet
, top). You will then need to tell the linker where to put your bootloader code, and this depends on what you are using to write code. In assembly what you need is the .org statement, with AVR studio you should mess around with the "memory settings" and put ".text=0x1234" under flash. Of course 0x1234 should be the right address as per page 282, i.e. 0x3800, 0x3c00, 0x3e00 or 0x3f00.