Currently the only option is to reflash the whole image, work is in progress to reflash kernel and rootfs separately, but we need an algorithm to make this work well in a real user upgrade.
Hence this sequence of operations to reflash OpenSlug:
1) Save the existing config from 'Flashdisk' (/initrd), that's:
c) any files configed on the flashdisk from a known list, including passd and the dropbear key.
2) Overwrite the MTD partitions 'Kernel' and 'Flashdisk' with new images.
3) Mount 'Flashdisk' and restore the files from (1)
The algorithm does not ever return to flash, even though it has upgraded it completely. Nevertheless because the upgrade was complete we can be sure the flash image is consistent - only the restoration of the config files can damage it (and we can be pretty sure that the restoration is safe).
Parsing the RedBoot partition table
This is necessary to extract the kernel and 'Flashdisk' partition from an image. The code is not NSLU2 specific - it is in drivers/mtd/redboot.c. The directory is just an array of 256 byte entries, each starts with the name, so parsing it is easy.