Possible to copy config file to /rom?

Is it possible both (1) after LEDE has been installed and (2) during the build process to copy or create a config file in the /rom directory? My use case is that each device has a unique ID saved in a file that needs to persist over factory resets with jffs2.

If it is possible, how can I accomplish this?

Custom build configs?

/rom can't be changed in a live router

Include the file as a custom file to the firmware during compilation.

That works for a single router build rather easily.

But if you have several routers, you might want to go with anomeome's suggestions of utilising uci-defaults and reading the ID somehow from hardware.

I used a few years ago a script to read MAC address of the router and place that into the wifi config. Something similar might work for you, if you can utilise some unique ID already on the router's permanent flash (like MAC, serial, whatever)
See example at the end of https://forum.openwrt.org/viewtopic.php?pid=185418#p185418

1 Like

Much appreciated @hnyman -- I'll look into that. Do you know if it's possible to use custom files with the "SDK" or "ImageBuilder" available (for example) here: http://downloads.lede-project.org/snapshots/targets/ramips/mt76x8/
Or do I need to use the whole buildsystem?

Trying to piece together how I can get this going. (new to this)

Thank you!

It is possible also with imagebuilder.
That is explained in the imagebuilder wiki page...

1 Like