Customising the build-root

Hello community,
I have been using build-root and often need to customize the build, like putting my own network or system config. This has been ad-hoc so far; I search different files and edit them as required. Sometimes it's uci-defaults.sh, config_generate, 02_network etc etc.

My question:
Is there a known standard method to it? Because I am facing difficulties in doing this across different releases of OpenWRT, as files-to-be-changed apparently keep changing. Any pointer is appreciated.

1 Like

Apply only incremental changes to the default config:
https://openwrt.org/docs/guide-developer/uci-defaults

2 Likes

You can put any file in the files/ folder and it will get copied to the root of the install tree, overwriting whatever is there.

If it's a simple custom config file you want to install, then I find it easiest to put my customizations off the file/ hierarchy, such as files/etc/config/network.

I use uci-defaults to do custom configurations at runtime, such as disabling a service or setting up some new folders you might need.

If you need to modify the code for a package, then I have my own commits on top of the base repo. So I have my own local git repo for the base openwrt repo and for the packages, luci, routing, telephony feeds. The feeds.conf points to the local repos.

To make this easier to manage, my workflow is to fetch and merge upstream into my local repo and then rebase so that all my commits are on top of the commit stack. The rebase makes it tidier and the merge commits get eliminated.

Others may have their own workflow to suggest....

3 Likes

I fear it might get tricky when you need to build for the different arch (like ar71xx, mt, x86 to name a few I use).
Having said that, the below comment on the given page seems to indicate uci-defaults is the right way. Seems more programmatical than copying different config files for the different arch in files/ dir.

Blockquote
the Freifunk Ulm community does all its configuration in a huge uci-defaults script

1 Like

yeah, the optimal workflow really depends whether you want to build for multiple architectures or not. I build for one only. so making a a uci-defaults to copy a network config script is overkill when I can just dump it in the right folder.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.