Ubiquiti USG support patch flash layout/menuconfig help

Hi All,

Some years ago, I wrote a patch to add support for the ubiquiti USG (the small one), at the time i really didnt follow through with the patch and never really used the USG. Recently i've decided to revisit this and the kernel patch I wrote still works just fine and i now have USG running openwrt (and is now my home gateway).

But, I had a couple of questions about supporting the device in the code tree. The USG is basically idential to the small edgerouter lite (same chipset, same memory, similar flash but i dont have one to compare, different board id - which is the only thing my patch adds to the kernel). Ubiquiti seem to have taken a similar route to juniper here and given it dual root partitions. The edgerouter lite wiki entry suggests theres only one root partition on the edge router, but in the wiki entry that partition is deleted and immediately re-created (not sure i understand what the point of that would be as it literally does nothing).

In any case, it has to work with the ext4 image, which is all good, but how do sysugrades work in that scenario? obviously theres only 2 partitions here (or 3 on the USG, but the third can be erased), one is fat32 for storing the kernel image and the other is the root, so the config and the rootfs are on the same disk, presumably, if you sysupgrade it would either fail or zero the config on the router. Is there a way to add a third partition here as an overlay (i couldn't find another device in the opoenwrt tree where a similar situation occurs)?

Second question is how i now add it as a target in the menuconfig, when i wrote the original patch it was based on either 12.x or 14.x, and its changed enough that i cant quite see how thats working, and neither the "ne device" or "new platform" wiki entries really talk much about that. Technically it has no need of being its own target as (with my current patch), i just compile for the edgerouter lite and use its ext4, so just changing the entry to read "Edgerouter Lite/USG" would be sufficient, but is that appropriate?

@takigama -
Sorry to resurrect an ancient thread, but did you ever get this working? I cannot find anything about the USG being supported. If you have a working patch, I think many people would be interested.
Thanks!