OpenWrt SoM. Developers guide. Part 1.

Once you decided to use OpenWrt driven NetSoM development board as starting point of development your own custom hardware first of all you should choose one of the available image configuration that feets your needs closely. Full list of available configurations can be found here. Here is simple selection algorithm:

As you noted there are pairs of configs (endings with _ethernet and _wifi) supporting double ethernet and double ethernet + wifi interfaces respectively.

Image compilation

So after choosing one of the config it is time to compile image:

$ git clone
$ cd imx6ull-openwrt.git

and start build process by calling script with configuration name you choose as argument. For example:

$ ./ flexcan_wifi

to get full list of available configurations run:

$ ./ list
Available board names:
amazon_voice_service   amazon_voice_service_wifi   audio_stream_ethernet   audio_stream_wifi   flexcan_ethernet
flexcan_wifi   lorawan_gateway_ethernet   lorawan_gateway_wifi   video_stream_ethernet   video_stream_wifi

In script you may find typical steps to build OpenWrt image described here.

After build process completed in bin/targets/imx6ull/cortexa7/ directory you may find built images:

  • openwrt-imx6ull-cortexa7-flexcan_wifi-squashfs.sdcard.bin — image to run from SD card;
  • openwrt-imx6ull-cortexa7-flexcan_wifi-squashfs.mtd-sysupgrade.bin — image to update firmware using sysupgrade utility;
  • openwrt-imx6ull-cortexa7-wirelessroad_gw-imx6ull-squashfs.mtd-factory.bin — image to update SPI flash.
  • openwrt-imx6ull-cortexa7-flexcan_wifi-squashfs.u-boot.bin — u-boot image;

Firmware update

Next time to update firmware. Easiest way to do it — using sysupgrade utility. For doing this copy built on previous step image to device:

# scp user@hostname_or_address:/path_to_imx6ull_openwrt_repo/bin/targets/imx6ull/cortexa7/openwrt-imx6ull-cortexa7-flexcan_wifi-squashfs.mtd-sysupgrade.bin /tmp

and start firmware update process:

# sysupgrade -c /tmp/openwrt-imx6ull-cortexa7-flexcan_wifi-squashfs.mtd-sysupgrade.bin

it takes about 3-5 minutes to complete FW update process and boot from new one.

If you will face error message looking like this:

Device lorawan_gateway_wifi not supported by this image
Supported devices: wirelessroad_stream-imx6ull flexcan_wifi
Image check failed.

don’t worry. It notes you that currently flashed firmware is different rather the one you are trying to flash.
You may get around this just by replacing current configuration name in /tmp/sysinfo/board_name file:

# cat /tmp/sysinfo/board_name

replace it with configuration name from the error message (flexcan_wifi, not wirelessroad_stream-imx6ull which is deprecated):

# vi /tmp/sysinfo/board_name

press to enter inser mode and replace config name. Then press ESC and :wq to exit vi.

Now you should be able to update firmware. Try running

# sysupgrade -c /tmp/openwrt-imx6ull-cortexa7-flexcan_wifi-squashfs.mtd-sysupgrade.bin


Note! You may do it without worrying in a case of using configurations from master branch as all of them uses same booting device (onboard SPI flash IC) and same console. But if you changed something in source code — everything might happens.

But not worry. another possible way to update firmware — using u-boot.

Fimrware update from u-boot

To make upgrade through uboot you’ll need serial connection to board, tftp-server installed on laptop/PC and direct ethernet connection between them.

Herel we use tftp-server IPv4 address, board IPv4 address and firmware upgrade file (sysupgrade, not factory) fw.bin

  1. Hit any key while uboot running.
  2. Setup addresses for uboot:
# setenv serverip
# setenv ipaddr
# setenv ethaddr 00:11:22:33:44:55
# saveenv
  1. Execute load to memory to loadaddr (default 0x82000000)
# tftpboot fw.bin
  1. Probe SPI flash
# sf probe
  1. Erase block before writing (it can take a while)
# sf erase 0x100000 0xf00000
  1. Write firmware to flash
# sf write 0x82000000 0x100000 0xf00000
  1. At this point firmware is loaded and you can restart board by executing:
# reset

command or simply powering it off and on.


After executing command tftpboot fw.bin on success you will get line like this:

Bytes transferred = 7864606 (78011e hex)

You can use HEX number in sf erase and sf write command as last argument (instead of 0xf00000) to make things faster. For erase we need to round up this number in higher order. So in this example we can use this commands:

# sf erase 0x100000 0x790000
# sf write 0x82000000 0x100000 0x78011e

Keep following as here at our telegram channel.