User Tools

Site Tools


docs:guide-user:installation:flashing_openwrt_with_wifi_enabled_on_first_boot

Flashing OpenWrt with Wifi enabled on first boot

OpenWrt is configured to have Wifi disabled on first boot. Some upgrade scenarios require that wireless connection is enabled by default, though. There are two sections in this guide: one for upgrading an OpenWrt image, the other is suited for flashing OpenWrt from stock (vendor) firmware.

Upgrading OpenWrt with Wifi enabled on first boot

We use sysupgrade cli tool with a specially prepared restore configuration file. The method can be used for any OpenWrt image. You need to have an OpenWrt already running on the router. It will not work with a vendor ROM.

To flash an OpenWrt image with wifi enabled:

  1. upload the upgrade image to the /tmp directory
  2. create a file: /etc/uci-defaults/xxx_config the name prefix is important! with the following:
    #!/bin/sh
    uci set wireless.@wifi-device[0].disabled=0
    uci set wireless.@wifi-iface[0].disabled=0
    uci set wireless.@wifi-iface[0].ssid='OpenWrt'
    uci set wireless.@wifi-iface[0].key='changemeplox'
    uci set wireless.@wifi-iface[0].encryption='psk2+ccmp'
    uci commit wireless
  3. This sets the initial name to OpenWrt and password to changemeplox for default interface on the first radio. You are strongly encouraged to change this password in the above file or at the very least after the first boot.
  4. change directory to /tmp
  5. run tar -czvf config.tar.gz /etc/uci-defaults/ to create a config file for sysupgrade
  6. run rm /etc/uci-defaults/xxx_config to remove this configuration file from the current image in case it is a dual boot device or sysupgrade fails
  7. run sysupgrade -n -f config.tar.gz image.bin to flash. Note that it will not save the current configuration.

Flashing OpenWrt with Wifi enabled on first boot from vendor ROM

For this you need to build your own image. Follow the beginners guide to building your own firmware. Before make put the xxx_config from the above section in files/etc/uci-defaults directory.

  1. Create files/etc/uci-defaults relative to the main build dir.
    mkdir -p files/etc/uci-defaults
  2. use your favourite editor to create xxx_config
    pico files/etc/uci-defaults/xxx_config
  3. Build - also make sure you read guidelines how to speed up the build process (download all before build and build with -jx)
    make
  4. use factory.img to flash your router

Additional Information

The same method can be used for any other configuration you need on the first boot. For example MAC address override on Wan interface.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
docs/guide-user/installation/flashing_openwrt_with_wifi_enabled_on_first_boot.txt · Last modified: 2020/04/29 20:24 by tmomas