Upload code using serial and bootloader from raspberry pi

Hi! The arduino IDE uploads code to the atmel using serial port and the bootloader. I have a circuit in wich a raspberry pi is connected to an arduino using the serial port.

What I'd like to do is to update the code in the arduino from the Raspberry Pi. My idea would be sending the HEX file compiled in my PC to the raspberry, and through the serial port, update the arduino.

I'v seen some guides with something similar, using the ICSP, but I would prefer to do it using the bootloader and the serial port. I didn't find any guide on how to do it, I guess it is possible to do it but I didn't find any guide on how to do it.

Does anybody know how to do it?

Thanks in advance

i hope these posts will help you Upload of sketch via RS232 serial (pin 0) - Installation & Troubleshooting - Arduino Forum as you uses the rs232 protocol