1. An apparatus for updating firmware running on nodes in a wireless mesh network, the apparatus comprising a processor configured to embody a plurality of functional units including: a code image database (DB) for storing a code image running on each node in the mesh network, and a version of the code image; and an update script generator for generating, if a code image running on a target node in the mesh network needs to be updated, a code update script with reference to the code images of the target node and its neighboring nodes stored in the code image DB, and performing an update of the target node using the code update script, wherein the update script generator is configured to: generate respective differential scripts between the currently running code image of the target node and the respectively currently running code images of the neighboring nodes, and generate the code update script with reference to the differential scripts and the distance to the neighboring nodes to which the code images are referenced, and transmit the code update script to the target node for performing the update.