After try some trial and error i buildI have built a simple binary to upload into the Leonardo bootloader. This binary openopens serial inat 1200 baud then closecloses it, and wrapwraps the avrdude binary to write .hex.hex into flash.
In arduinoArduino core CDC.cppCDC.cpp we can see that CDC not only waiting baudrate 1200, but CDC checkchecking DTR value. If DTR gogoes high, CDC cancelcancels to jump into the bootloader. That's why i clearI cleared DTR value. I trytried this in ubuntuUbuntu 16.04.
https://github.com/vanbwodonk/leonardoUploader
Only use this simple command.:
leonardoUploader /dev/ttyACM0 Blink.ino.hex
leonardoUploader /dev/ttyACM0 Blink.ino.hex
I hope it helphelps other people searching for this. Sorry for my bad english.