Who will copy /etc/config/* into /overlay at first time boot up?

Hi All,

On my device, we follow standard and mount_root will help on overlay mounting, like

root@OpenWrt:/# mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup on /sys/fs/cgroup type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,hugetlb)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/ubi0_0 on /overlay type ubifs (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
/dev/mtdblock3 on /etc/factory type ext4 (ro,noatime,block_validity,delalloc,nojournal_checksum,barrier,user_xattr)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)

When I do "jffs2reset -y" to remove /overlay data and reboot and I will see this

root@OpenWrt:/# ls /overlay/upper/etc/config/
audiod           firewall         openvpn-opkg     ucitrack
ddns             fstab            openvpn_recipes  upnpd
dhcp             luci             rpcd             videod
dropbear         network          system           wireless
factory          openvpn          ttyd

My question is who will help to copy/modify the files in /etc/config/?
Please help. Thanks.

You typically use build time (ib or br) FILES and/or /etc/uci-defaults scripts to handle firstboot defaults...

1 Like

Hi Wulfy23,

Thanks. There are some files at /etc/config, we don't want to modify it, like the firmware version, but we would like use UCI interface to read it.

Something bother me is we don't modify the file(ipcam) at /etc/config, but the file(ipcam) will be saved at /overlay, I don't know why!!! Do you know?

Thanks.

chances are it has it's own uci-defaults script that gets restored/re-run at firstboot... ( or is it just the default config file? /rom/etc/config/? )

is there something in /rom/etc/uci-defaults/?

some service init scripts... /etc/init.d/ABC are also known to self uci-fy...

1 Like

Hi Wulfy23,

No, at /rom/etc/uci-defaults/ and /etc/init.d/XXX, we don't have any script to change default value of /etc/config/ipcam.

If you are building your firmware from source, you can place your custom /etc/config files in the ./files/etc/config directory in your buildroot.

2 Likes

Hi Grommish,

Yes, I know the way you mentioned.

But, I use a package to install my config, because I need to put some global env into config as default config for the device.

Thanks.

Hi All,

Looks like we should not put static UCI file at /etc/config, because 'uci commit' will update/touch all configs at /etc/config.

So, I put config at /etc/xxx/ipcam and use 'uci get /etc/xxx/ipcam.firmware.version' to get what I want.
Thanks.

Not really, it overwrites only modified configs, see:

uci changes
1 Like

Hi Vgaetera,

Yes, you are right. I need to check it again. Thanks.

1 Like