Implementing new board type

Hello,

I'm currenty in the process of implementing the ATmega8535 to the Arduino IDE, I've successfully ported the Optiboot bootloader, I've downloaded to the board and I've even successfully programmed it by serial (with FTDIfriend)... once.

The first problem is that there are some lock bits issues, I tried my best to get the right values with a fuse bit calculator, but I get this message at the end of the bootloader downloading sequence:

Reading | ################################################## | 100% 8.60s

avrdude: verifying ...
avrdude: 8192 bytes of flash verified
avrdude: reading input file "0xcf"
avrdude: writing lock (1 bytes):

Writing | CMD: [58 00 00 00] [04 58 00 ff]
CMD: [ac e0 00 cf] [00 ac e0 00]
CMD: [58 00 00 00] [cf 58 00 ff]
CMD: [58 00 00 00] [00 58 00 cf]
CMD: [58 00 00 00] [00 58 00 cf]
CMD: [58 00 00 00] [00 58 00 cf]
CMD: [58 00 00 00] [00 58 00 cf]
CMD: [58 00 00 00] [00 58 00 cf]
 ***failed;  
################################################## | 100% 0.02s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0xcf:
avrdude: load data lock data from input file 0xcf:
avrdude: input file 0xcf contains 1 bytes
avrdude: reading on-chip lock data:

Reading | CMD: [58 00 00 00] [00 58 00 cf]
################################################## | 100% 0.00s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0xcf != 0x0f
avrdude: verification error; content mismatch

avrdude done.  Thank you.

First: Optiboot should be 512bytes, avrdude writes 8192 bytes... did I miss something?
Second: I think it has trouble writing the lock bits, but I don't quite know what to do. This is how my boards.txt looks:

##############################################################

robot.name=Robot8535
robot.upload.protocol=arduino
robot.upload.maximum_size=8192
robot.upload.speed=115200
robot.bootloader.low_fuses=0xd4
robot.bootloader.high_fuses=0xcd
robot.bootloader.path=optiboot
robot.bootloader.file=optiboot_atmega8535.hex
robot.bootloader.unlock_bits=0xcf
robot.bootloader.lock_bits=0x0f
robot.build.mcu=atmega8535
robot.build.f_cpu=8000000L
robot.build.core=robot
robot.build.variant=standard

Another problem is that I can only program it once (it's a LED blinking loop), after that no matter what I try I cannot reprogram it by serial, I have to download the bootloader again.

I don't have auto-reset, I have to click on a reset button on the board itself. I click "upload" and then mash the reset button until I see pretty gibberish appear in the IDE (I enabled verbose). Is there a more elegant way to do this, such as make the IDE ask for reset somehow, or add a delay to let me time my reset button clicking?