Finding default config for a device I do not have

I do not have a TL-WDR3500, but I want to see the default config files in order to build an appropriate custom image for a friend who has this device. My friend does not have enough skill to do anything besides uploading the image to flash the router when I send it to them. I'm using Linux, and I can use a Windows VM if for some reason that is helpful. My thoughts so far:

The build system can create a tar of the rootfs then you can examine it. But the network and wireless /etc/config files are created by scripts during the first boot, they do not exist in the ROM. So you almost have to run on an actual device to prepare a build for remote deployment.

Once you have config files, create a files subtree in your buildroot, (i.e. $BUILD_DIR/files/etc/config) and place the files there, they will be present ready to use in the ROM and the scripts will not replace them.

Thanks for your reply :slightly_smiling_face:

Are there options to select or commands to pass that specify "create a tar of the rootsfs"?

My recent attempt with the build system failed, maybe due to this bug which says "solved" but doesn't work for me. I could open a new thread if needed.

Is it practical to read the scripts and understand what the result will be?

Does it make a difference whether I put my new config in as a script or as config files? It seems that with a script, I don't have to know the internal identifier for the wifi-device in order to change the SSIDs on it, but for a config file I must know the internal ID?

I see

The most important settings I want to define are these. (EDIT: Can I define these safely without knowing the default config created by the first-boot init scripts?):

  • root password
config 'user'
  option 'enabled' '1'
  option 'name' 'root'
  option 'password' 'magic_password'
  • WiFi SSID (same on 2.4 GHz and 5 GHz)
  • WiFi password
config 'wifi-iface'
	option 'device'     'wl0' # can I skip this in order to apply the settings to both devices?
	option 'network'    'lan'
	option 'mode'       'ap'
	option 'ssid'       'MyWifiAP'
	option 'encryption' 'psk2'
	option 'key'        'secret passphrase'

Bonus would be:

  • create a separate user that only has permission to change WiFi password, nothing else. I see how to create a user, but I don't see how to limit their permissions.
config 'user'
  option 'enabled' '1'
  option 'name' 'changewifi'
  option 'password' 'magic_password'
  • create a way for me to access the router remotely. Given there is no static IP, I'm guessing SSH won't work unless I setup WireGuard, ZeroTier, babel, tinc, or something like that.

@mk24, thank you very much, this worked perfectly. Also, by looking in /etc/uci-defaults, I see the startup scripts. Something strange: documentation says:

Once the script has run successfully and exited cleanly (exit status 0), it will be removed from /etc/uci-defaults. You can still consult the original in /rom/etc/uci-defaults if needed.

But /rom does not have the /etc/uci-defaults files, though the file I put in uci-defaults is present.

$ ls -a rom
.  ..  note

Also, after making .config using config.buildinfo from the repo, make menuconfig and make defconfig, I see these lines, and I wonder what might happen if I change them by hand in .config before running make? Maybe this is dangerous, and it's safer to use uci scripts and config files?

CONFIG_TARGET_PREINIT_IFNAME=""
CONFIG_TARGET_PREINIT_IP="192.168.1.1"
CONFIG_TARGET_PREINIT_NETMASK="255.255.255.0"
CONFIG_TARGET_PREINIT_BROADCAST="192.168.1.255"