Where do initial /etc/config/network and /etc/config/wireless come from?

I'm building from source and want to customize multiple config files. I'm guessing that network and wireless are created dynamically? If so, where does that happen?

What's the easiest way to build multiple images where only the configuration files differ? I currently use <buildroot>/files. I'm now looking at etc/uci-defaults.

UCI would allow me to put all the defaults in a single file. However, I'm not sold on the incremental approach. It seems that I'd either have to remove a bunch of defaults I don't want or just start over with a blank slate.

I get rid of unwanted defaults by undoing in uci-defaults. Or delete the settings in /etc/config completely, and only use "native" config files, i.e. for nginx or squid. Editing the relevant Make files even omits the /etc/config/file directly.

1 Like

network config is generated by /bin/config_generate
wireless config is generated by /sbin/wifi

Such as? Sure, there's a few defaults in network and wireless that wouldn't match everyone's usecase, that's the nature of a default. But "a bunch", really?

2 Likes

There's actually nothing in network that I need. I could massage my 'dumb access point' config to reuse some entries, but the names would not match actual use.

The only things I need from wireless are path, band, and type. I don't think those could ever change?

With your script clues, I can now see how the missing config files are generated. I was looking for some static copies. It looks like the scripts only do 'work' if the target files are missing. Does this mean that including static config in <buildroot>/files will essentially short-circuit the scripts? If that's the case, then I'll just stick with the static config.

This is a classic case of pulling the loose thread. I started messing with the AP3935 source because they included USB libraries without enabling the USB phy in the .dts file. Once I got the build environment to work, I started looking at other things I could tweak. I already had a script to generate all my network config (lots of different SSIDs, passwords, and VLANs), so looking for the most efficient way to integrate without copying files before every build or after FLASHing initial firmware.

I think I'm going to bake multiple config profiles into the image and then use symlinks to select the active config.

Thanks for your help. I'm still interested in ways to automate the build process. Right now, I basically have to replace most of <buildroot>/files between builds in order to get my custom config included in the image. I can either modify the build scripts or create more scaffolding around.

Really? No ethernet ports defined and at least put into a lan bridge? No ULA prefix? Not even a loopback interface? Interesting.

I can see, and personally have, scenarios where I don't need a wan interface and want to have my lan interface on dhcp. But that's about the beginning and end of possibly unneccesary defaults in network. And it's "solved" by two or three UCI commands.

Sure. You don't even need to go full-on Buildroot for that, the Image Builder can also take a FILES parameter pointing at a directory. Been there, done that, eventually went back to using the intended way, uci-defaults. IMHO statically supplied config files are more work than adjusting the defaults. They are also more prone to breakage, and unless you have console access you need to get it right the first time as there's no fallback on failsafe.

But as usual, there's more than one way to strip a CAT6. If it works for you, it works for you. Good luck.

1 Like

Don't need anything ipv6. Yes, I could reuse the loopback, but that's completely deterministic and already included in my own config-file generator. The Extreme APs have a dedicated external console port and I include full-blown nano in my images. Whenever possible, whether AP, router or switch, I always configure an Ethernet rescue port with either default static IP or DHCP server enabled. The build's bin folder is accessible via either TFTP or HTTP. Each U-Boot environment is preconfigured to allow a simple run boot_net to start over if I'm too lazy to edit a broken config. The only things I worry about are a corrupt bootloader or used-up FLASH. In that case, I'd pull another $4 ~ $8 AP from my stash.

why not use uci-defaults ? I believe this is intended to do exactly what you are trying to achieve.

here the info --> https://openwrt.org/docs/guide-developer/uci-defaults

Once upon a time, I was administrating a fleet of ath79 devices, I used 1 script in

/etc/uci-defaults/100-ath79_defaults

From the script, I used board_info to set defaults, on a per board basis.

1 file to edit ...easy peezy

1 Like