First boot / scripts / config files / best solution to have a configuration at first boot

Hello,

In order to discover openwt, I try to use it with a raspberry pi4.

I got the last version, and I succeed to create an image with my own /etc/config/network file. On the linux computer, I can check that the image has my IP address like 192.168.2.121. Then I write the image on the SD disk.

I boot the PI with the openwrt image. ssh login fails. Extract the card and check on the linux computer, the /etc/config/network contains 192.168.1.1 address. Of course if I boot again on the raspberry pi, it is possible to do ssh at 192.168.1.1 . I change the address to 192.168.2.121 in /etc/config/network, then on next boot ssh is possible on 192.168.2.121.

So the conclusion is that the first boot, overwrite the file in /etc/config/.

Nevertheless, the openwrt documentation says that I can add my yow configuration file in /etc/config.I dont understand why there are overwritten at the firs boot.

So what is the best solution to have my own configuration at the boot tile, even the first boor time ?

  • Modify (How to do that ?) the first boot mechanism to avoid the overwriting of my config files, so my configuration files in etc/config/ will be the one I need

  • Add in the first boot mechanism (How to do that ?) a script that create the configuration file with a list of uci command and then the /etc/config files Wille be overwritten

  • Add in the first boot mechanism (How to do that ,) a script that copy the configuration file into /etc/config ?

  • Is it possible to suppress the first boot mechanism ? What does the first boot mechanism do ?

  • Have any pointer to understand the first boot mechanism ?

Thanks
PHL

Follow the Developer guide to build your own image.
Add custom files for Image builder or Build system.
And use UCI defaults to customize your configs.

3 Likes

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