[OpenWrt-Devel] Setting uci defaults in trunk

micke.prag at telldus.se micke.prag at telldus.se
Fri Feb 26 09:54:00 EST 2016

2016-02-26 15:35 skrev Felix Fietkau:

> On 2016-02-26 15:27, micke.prag at telldus.sewrote:
>> Hi I have a board config for a device that I am about to commit to
>> OpenWRT. I am rebasing my work against trunk but some things have
>> changed since I made the config. My code was written against r46120 
>> but
>> somethings doesn't work on r48800. My question is how I should 
>> update
>> my code to "proper OpenWRT standard"? First, network. The board has
>> only one network port (it is not a router). This should be 
>> configured
>> using DHCP. The board also has Wifi and should be configured as a
>> client but disabled as default. In -r46120 I put this in
>> /etc/uci-defaults/02_network: ucidef_set_interface_raw "lan" "eth0"
>> "dhcp" ucidef_set_interface_raw "wlan" "wlan0" "dhcp" uci batch 
>> <<EOF
>> set network.lan.hostname='TellStick-ZNet-Lite' set
>> wireless.radio0.disabled=0 set 
>> wireless. at wifi-iface[0].network='wlan'
>> set wireless. at wifi-iface[0].mode='sta' set
>> wireless. at wifi-iface[0].encryption=psk2 EOF uci commit wireless In
>> r48800 this file seems to have been replaced by 
>> /etc/board.d/02_network
>> instead. Unfortunately "raw" uci commands does not work since its
>> generating /etc/board.json instead? Am I correct? If I do this then
>> "dhcp" is ignored and the interface is set to static anyway:
>> ucidef_set_interface_lan "eth0" "dhcp" How to convert the wireless 
>> and
>> the hostname I have no idea? Next is led. I had this in
>> /etc/uci-defaults/02_network: ucidef_set_led_netdev "lan_act" 
>> "tellstick:green:lan" "eth0" ucidef_set_led_netdev "lan_link" 
>> "tellstick:orange:lan" "eth0" uci set system.led_lan_act.mode='tx 
>> rx'
>> uci set system.led_lan_link.mode='link' The first two lines work in
>> r48800 but how do I convert the last two lines? How do I set the 
>> mode?
> To change the defaults, you shouldn't just modify the existing files.
> You can simply create a new file in /etc/uci-defaults which runs your
> uci batch command as usual. It will run after /etc/board.d has been
> processed and the default config has been generated, so you should be
> able to override any parameter you want.

The file /etc/uci-defaults/02_network was (re)moved in r47534. Is it 
really the right way to go to reintroduce this file again?
My thougs was that this should be implemented in /etc/board.json 
instead, maybe I was wrong?

Please note that my goal is to have the board config sent upstream, not 
only for my local build.
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list