I would like to add support for using sysupgrade with RB493G, but input from somebody who has done it before will probably save me a lot of time. Check out the wiki-page on RB493G here: http://wiki.openwrt.org/toh/mikrotik/rb493g

I have already spent some hours familiarizing myself with various parts involved, and it doesn't seem too intimidating. More specifically a sysupgrade is performed by the script package/base-files/files/sbin/sysupgrade which again relies on functions in package/base-files/files/lib/functions.sh and package/base-files/files/lib/upgrade/common.sh However, I have not been able to find documentation for these scripts. Scripts are generally challenging to read when there are little or no code comments, and function names are not always self-explanatory. Is there any documentation available for these scripts? Any recipe as to what quirks one should think of when attempting to use them on a new device?

Superficially I believe I have a fairly good overview of how sysupgrade works, it seems to go like this:
-create a root filesystem in ram, copying over all files need to run the router
-change root directory from flash-chip to the new root folder in router's ram using pivot_root
-write new firmware image to router's flash-chip

These operations are probably quite easy put into a tailored script for RB493G, so I don't think adding sysupgrade support is a hard task once familiar with the details of the scripts. First up is that RB493G uses the yaffs2 filesystem, will that just work automagically in sysupgrade, or will it need tailoring? Second is the flash layout, here it seems this should work since the kernel and rootfs partitions are already present from factory with appropriate naming (although they have the more unusual numbers 5 and 6).

Second is the bin-file. Users would want the kernel and the rootfs packaged together in a bin file. Building a bin file will need to be included in OpenWrt's buildroot environment. Is there any documentation with regard to this, or will I need to look at how it is done for routers and try to mimick?

(Last edited by Del on 13 Jan 2013, 20:06)