Thoughts on single firmware, conf.json and factory reset button configuration

Hi all,

I have some questions around good practices when dealing with single firmware, multiple devices with different configs, and a factory reset button. Reading the MOS documentation on config I feel like I’m missing something.

I’d like my setup to have:

  1. Single firmware that I can deploy to multiple devices
  2. Some custom config per device like mdash device id, etc.
  3. Some user config that is changed per device like WiFi, update frequency, endpoints to hit etc
  4. Factory reset button that would keep custom device config, but wipe user config

Up until now I’ve only really had one device so I’ve used firmware with a conf8.json file that contains my mdash device ID and some other settings, and a bunch of parameters defined in my mos.yml that I’m pretty sure get written to conf9.json. The mos.yml setting would get changed if I flashed.

With the addition of second device I am using OTA update instead of flash to write new config without overwriting the stuff in conf9.json, but I need to recompile the firmware with a new conf8.json to match the device I want to OTA update.

The only idea I have that I’d like to test is having a file on each device that contains some unique info that is read at boot, but I haven’t tested yet it this would get wiped on boot or OTA update.

Any suggestions on how this should be done?

Thanks.

According to the document you linked, the vendor layers are not wiped out by factory reset and should not be included in firmware.
Once you uploaded your conf1 to conf8, according to the OTA doc, they will be preserved on OTA updates.
In my understanding, your procedure should be something like

  • flash
  • customize (conf1 to conf8)
  • apply user settings
  • apply ota updates
  • factory reset will restore user settings to defaults but not affect customization
  • if customization has to change, either upload a new one or reflash

In some corner cases you could try deriving your customizable info from the ID (the MAC), for example, on startup.

1 Like

I see it talking about conf9.json never to be part of fw but no mention of other layers.
But combining with your comment on OTA I think you are right.

Just saw this on the configuration page:

Note that a vendor configuration layer is not present by default. It is to facilitate post-production configuration: devices can be customised by uploading a single file (e.g. via HTTP POST to /upload ) instead of performing a full reflash. Vendor configuration is not reset by the “factory reset”, whether via GPIO or web.

This makes a lot of sense now that I re-read it.

I missed this completely!
Your right @scaprile, what I’ll try is:

  1. Build FW with conf0.json, but no conf1.json - conf8.json
  2. Flash a new device
  3. Copy my device specific configuration to the device in conf1.json - conf8.json
  4. User setting will be saved in conf9.json
  5. ONLY use OTA updates from this point (to not erase my conf1.json - conf8.json file)

Thanks