I am wondering if there is a pre-made self-modifying bootloader already written and in the public domain.
I have a bootloader that is used to download regular programs so I don't need to hook up an ISP programmer. But what if I want to modify the bootloader itself?!
I suppose this is solved by having a secondary bootloader which is installed closer to the end of memory than the regular bootloader.
The primary bootloade can download a program and EEPROM data. The EEPROM data is the file for the new primary bootloader, and the program simply jumps to the secondary bootloader code in the bootloader section. The secondary bootloader then uses SPM to modify the primary bootloader.
Would this work? Is there already something out there that does this?