By generic i mean my own implementation, with some known application as base ground (perhaps some example code of a ZigBee application). If you have any documentation though it would be very nice to have it, with special emphasize in the bootloader implementation and if it uses internal or external flash to store the image.
The general idea of the ZigBee OTAU protocol is not bad, so you may want to implement something similar.
General idea is this:
1. All devices send new image requests to the gateway once an hour or so.
2. Gateway can ask device (or all devices) to request new image.
3. If device asked, and gateway responded that the new image is available, device starts requesting chunks of that image. It is important that device sends requests and gateway sends responses. This way gateway does not need to keep track of all current downloads. This makes gateway salable. Depending on the load, gateway may ask devices to slow down their requests.
4. Once download is complete and image is verified, device notifies the gateway and gateway tells it to wait, or update immediately. It is important to be able to wait, in case you are switching to an incompatible protocol.
Whether you use external of internal flash depends on your device architecture and memory already used by the application. If you can fit two images in the internal flash, then this would be the simpler approach.
In my application all nodes report to one coordinator, so i was thinking of some implementation where once a node has completed the over the air upgrade, it can take the role of an OTA server (in order to improve the whole process, as it would take less time and prevent bottlenecks).
If you have less than 100 nodes, then I would stick with the central gateway providing the updates.