This repo will contains modified RootFS and files used to convert UF-INSTANT SFP GPON stick from *Vendor Lock-in on UFiber products* to an open solution
that can interact with 3rd party OLT.
Please note that on the market there are ready OOB (out-of-the-box) alternatives, you can take a lot at [Anime4000](https://github.com/Anime4000/RTL960x/) repo with all other information and compatible sticks.
GUI on the modded firmware was made by Anime4000 :)
The stick with original firmware and without any other modification, use an u-Boot env called `bootlimit` that is configured with a value of `10`. There is another variable called `bootcount`, this one is increased on each CPU reset. When `bootlimit == bootcount`, u-Boot format partition `mtd3` and tries to download new configuration from tftpboot. With the modified firmware, that is using `mtd3` for configuration, create a little headache.
I prefer first approach, because if you screw up the `mtd3` partition with wrongs values, doing a fast swap for ten times (avoiding full Linux OS boot) will erase config partition and after OS boot, all parameters return to factory defaults
If you have stick with stock firmware, you can login using ssh\telnet to IP `192.168.1.1` with these credentials `ubnt/ubnt`\
Verify with this command the installed images:
`nv getenv | grep sw_ver`
You should have an output like this:
```
sw_version0=v4.3.1.913-d48.210415.0811
sw_version1=v4.3.1.913-d48.210415.0811
```
So in this case the stick has already version `4.3.1` onboard (we will just need to preserv k0/k1 partitions). Now verify which boot bank are you using with this command:
`nv getenv | egrep "sw_active=|sw_commit="`
You should have an output like this:
```
sw_active=0
sw_commit=0
```
We are currently running `image0` on `mtd4/5` (refer to partition layout)
Now make sure you have `nc` command on your computer and follow this steps to write custom image on `image1` partition
- on the telnet\ssh session on UF-INSTANT, go to `cd /tmp`
- run this command: `nc -l -p 1234 > mtd7` (if you are on `image1`, use `mtd5` as name)
- on your computer, go where the custom root fs is downloaded `rootfs_MOD_UFINST_220505` (you can found it under folder *Modified RootFS* - md5 4ae50a56f5c4768ea5ac95d4298a01ba)
- run this command: `nc 192.168.1.1 1234 < rootfs_MOD_UFINST_220505`
- when done, on the telnet\ssh session your `nc` command has exited, you have a file called `mtd7` (or `mtd5`), run an md5sum on that file and compare the md5 with the original one, ONLY IF these are equal proceed with the next step
- now we need to erase `mtd3` (config) and `mtd7` (rootfs of image1) with these commands: `flash_eraseall mtd3`&&`flash_eraseall mtd7` (replace with `mtd5` if you are doing from `image1`)
- after each erase complete, you should still into `/tmp` directory and run this command: `cat mtd7 > /dev/mtd7` (replace with `mtd5` if you are doing from `image1`)
- if there is no output error, we can activate the new rootfs and reboot on it. To do this run these commands: `nv setenv sw_active 1`&&`nv setenv sw_commit 1`&&`reboot`
- after about 2 minutes you should reach the stick via WebUI or telnet at IP `192.168.1.1`. NOTE: WebUI doesn't work if there is no fiber attached
If everything is working (obviously you have to setup the stick in the right way, I mean change GPON s/n, OLT mode and so on), you can follow the same proceedure for the other bank, or leave untouched. This will give you a fast way to restore the stick to its factory default just doing a `cat` of original rootFS to the modified one. Please rember that if you go back to stock firmware, it's mandatory to erase `mtd3` partion BEFORE rebooting.
If you want, you can unsquash the custom RootFS and customized as you like (may be you want change WebUI colors or something else).
Remember to unsquash the file with `root` users because there are some special files that need super user permission, here is the two commands to extract/repack the file that then can be flashed on the stick:
*extract*
`unsquashfs rootfs_MOD_UFINST_220505`
this will create a folder called `squashfs-root` where you will find all the OS files inside