Topic: The content of /etc/config/network is wrong

I had set network configurations in /openwrt12.09/target/linux/ar71xx/base-files/etc/config/network as below:

config interface 'loopback'
    option ifname 'lo'
    option proto 'static'
    option ipaddr '127.0.0.1'
    option netmask '255.0.0.0'

config interface 'lan'
    option ifname 'eth1'
    option type 'bridge'
    option proto 'static'
    option ipaddr '192.168.1.1'
    option netmask '255.255.255.0'

config interface 'wan'
    option ifname 'usb0'
    option proto 'dhcp'

config interface 'vpn'
    option buffering '1'
    option ifname 'ppp0'
    option server ''
    option username ''
    option password ''
    option proto 'pptp-w'

But when I downloaded the image into my AR9341 board, the network part did not run as expected.
Here is the console output:
root@Linkpower:~# cat /etc/config/network

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config interface 'lan'
        option ifname 'eth0'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'

config interface 'wan'
        option ifname 'eth1'
        option proto 'dhcp'


Why does  /openwrt12.09/target/linux/ar71xx/base-files/etc/config/network take no effect? is it corrupted by something?

Re: The content of /etc/config/network is wrong

Total 4 files of network configuration.

openwrt12.09/target/linux/ar71xx/base-files/etc/uci-defaults/network
openwrt12.09/target/linux/ar71xx/base-files/etc/config/network
openwrt12.09/target/linux/ar71xx/base-files/etc/init.d/network
openwrt12.09/package/base-files/files/etc/config/network

How do those 4 souce files convert to the target board file of /etc/config/network?

Re: The content of /etc/config/network is wrong

I monitored the process of compiling/making. found etc/config/network is deleted:

make[3]: Entering directory '/home/leaf/openwrt/package/base-files'
mkdir -p /home/leaf/openwrt/build_dir/linux-ar71xx_generic/base-files
touch /home/leaf/openwrt/build_dir/linux-ar71xx_generic/base-files/.prepared_67ffe06b5071460bfaeff677ae629f5b
......
chmod 1777 /home/leaf/openwrt/build_dir/linux-ar71xx_generic/base-files/ipkg-ar71xx/base-files/tmp
rm -f /home/leaf/openwrt/build_dir/linux-ar71xx_generic/base-files/ipkg-ar71xx/base-files/etc/config/network

Re: The content of /etc/config/network is wrong

I found "/etc/config/network" is deleted in such commands in the file of "openwrt12.09/package/base-files/Makefile" as below:

    $(call ImageConfigOptions,$(1))
    $(call Package/base-files/install-target,$(1))

Is there any suggestions to prevent deleting  "/etc/config/network"  in compiling?

5 (edited by hostle19 2017-10-21 23:14:00)

Re: The content of /etc/config/network is wrong

See the documentation about custom files here hxxps://wiki.openwrt.org/doc/howto/build

Basically just add a "files" directory in the  top directory and included the path to your custom file. . ie "openwrt

mkdir files
mkdir files/etc   
mkdir files/etc/config/

then just put your custom network file inside the above directory

Hostle

Re: The content of /etc/config/network is wrong

Thank hostle19!

I tried and got a solution by myself. It is so simple:

#        $(call Package/base-files/install-target,$(1))

Just comment that phase in the file of "openwrt12.09/package/base-files/Makefile" .

But I cannot find the file of "openwrt12.09/package/base-files/install-target", where does it come from?