OpenWrt Forum Archive

Topic: How to change configuration files in image before flashing

The content of this topic has been archived on 12 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I have several same routers and I would like to be able to maintain the configuration files for hardware [network, wireless] and software [openvpn, firewall] on my build environment, so that when flashed it will work out of the box, without the need for me to go and change stuff in every one of them.

Although I can find software config under:
/staging_dir/target-mips_r2_uClibc-0.9.31/root-ar71xx/etc/config/firewall
[I hope this one is maintained through the builds if I don't do make clean]
for firewall for example, I have no clue where to find network and wireless configuration files.

This info would save me hours of manual config.
Creating archives of configuration and then copying it over to every router to unpack it is a pain in the a.. butt.

Thanks,
Krystian

1)
The initial config files are either with 'base-files' package, the device profile defconfig or with individual package sources.
E.g. /etc/config/network is firstly in /package/base-files/files/etc/config and then for most devices also in the device profile that overrides the base-files package. (In my case in Backfire branch that is /target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network )

In my own build, I have modified e.g.
/package/block-mount/files/fstab.config
/package/base-files/files/etc/openwrt_release
/package/base-files/files/etc/config/system
/package/base-files/files/etc/sysctl.conf
/package/firewall/files/firewall.user
/feeds/packages/ipv6/aiccu/files/aiccu.conf

So, the files are pretty much scattered around. Finding them takes some time.

2)
The other option (that I have not tested) is to create an new /files directory in your svn root, then create /etc/config there and place the config files there. These files should overwrite the ones generated in the individual packages.
https://forum.openwrt.org/viewtopic.php … 01#p119001
http://wiki.openwrt.org/doc/howto/imagebuilder#files

(Advantage of the first method is that the possible changes in the default files' format get better reflected later. for example, the radvd module was upgraded a few days ago and its config files changed somewhat. If I had just overridden the new files with old ones, the changes would have gone unnoticed.)

EDIT: added note about device profile defconfig.

(Last edited by hnyman on 29 Jan 2011, 14:24)

Thanks hnyman,

I've found network under base-files/files/etc/config directory but it is very much different from what I get in the end in my image.
Is it changed somewhere along the line?
I think I will try with the /files approach and see where I'll get with that.

Just that example file that I used, /etc/config/network comes actually in my case from the device profile that overrides the base-files package...

In my case in Backfire branch that is:
/target/linux/ar71xx/base-files/etc/defconfig/wndr3700/network

Looks like I erred in my first message.

Use the files directory in the build-system's toplevel dir.

E.g. files/etc/config/network goes into the final image at /etc/config/network

Thanks,

that's what I'm going to do!

Ahhh...
One thing missing!
After adding stuff to /etc/init.d/ I have to create a symlink in /etc/rc.d/ and I'm not quite sure how to do this.
Damn.

Any thoughts?

[EDIT]
nope... I just forgot to to chmod +x on the init.d script. link created automatically after that.

(Last edited by krystian on 30 Jan 2011, 11:29)

The discussion might have continued from here.