Deploying prplMesh on Turris Omnia (prplOS)
Frederik Van Bogaert edited this page 2023-09-29 14:55:57 +00:00

Deploying prplOS

Flash

The instructions below come from the device page.

Note that there is currently an issue with the medkit generated by prplOS/OpenWRT 19.07 when you try to replace TurrisOS with prplOS.

If you get "Unable to determine upgrade device. Image check failed.", use the medkit from the OpenWRT website first.

For that, follow the instructions and when instructed to use the medkit, use the one from the website and not the one you built. After that, you can use sysupgrade with the prplOS image you generated.

USB

Turris Omnia pre-2019

Prepare a USB key with an ext2/3/4 filesystem. Note that not all USB keys are recognized by the device. If the device reboots very quickly after the flashing procedure began, try again with another USB key.

  • Copy the sysupgrade file you generated from bin/targets/mvebu/cortexa9/ to the root of you USB key.

  • Copy the medkit file from the website to the root of you USB key.

    If you choose to rename the medkit file (you don't need to), make sure it still matches "omnia-medkit*.tar.gz".

  • Disconnect every other USB key from the Turris Omnia and plug you USB key in.

  • Power on the device and hold down the reset button until 4 LEDs are on, then release.

  • Wait approximately 2 minutes for the Turris Omnia to flash itself with the temporary image, during which LEDs will change multiple times.

  • Once the flashing is done, connect a computer to the Omnia and apply the sysupgrade:

    ssh root@192.168.1.1
    mount /dev/sda1 /mnt
    sysupgrade /mnt/openwrt-mvebu-turris-omnia-sysupgrade.img.gz
    
  • Wait another minute for the final OpenWrt image to be flashed. The Turris Omnia will reboot itself and you can remove the flash drive.

Turris Omnia 2019/2020

The flashing procedure with the medkit image was not working for Turris Omnia 2019/2020 (silver case) prior to December 2020; if your code base diverged from OpenWrt before that, you would need the changes in these pull requests:

The latest master or openwrt-19.07 branches (or any version of openwrt-21.02 or later) should work without additional patching.

After building image:

  • Gunzip openwrt-mvebu-cortexa9-cznic_turris-omnia-sysupgrade.img.gz, to the root of a USB flash drive
  • Enter a rescue shell via 7-LED reset and the serial console.
  • Insert the USB drive and mount it:
    mkdir /mnt; mount /dev/sda1 /mnt
    
  • Flash the OpenWrt image to eMMC:
    dd if=/mnt/openwrt-mvebu-cortexa9-cznic_turris-omnia-sysupgrade.img of=/dev/mmcblk0 bs=4096 conv=fsync
    
  • Reboot.

TFTP

You need a computer running a dhcp and tftp server connected to the WAN port of the device.

Here is an example tftp configuration file for Debian/Ubuntu:

# /etc/default/tftpd-hpa
TFTPUSERNAME="tftp" TFTPDIRECTORY="/srv/tftp" TFTPADDRESS="0.0.0.0:69" TFTPOPTIONS="--secure"

And here is an example configuration file for dhcpd:

subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.10 192.168.1.20; option routers 192.168.1.254;
subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.10 192.168.1.20; option routers 192.168.1.254;
next-server 192.168.1.254;
    option tftp-server-name "192.168.1.254";
}

In this example, the computer uses the IP 192.168.1.254.

systemctl start isc-dhcp-server
systemctl start tftpd-hpa
  • Connect Turris Omnia WAN port to your dhcp/tftp server.
  • Connect serial console and interrupt U-Boot. To do so you need to get to U-Boot prompt by hitting enter several times early after powering up till you see '⇒' prompt. Once you get there, enter the following commands one at a time:
dhcp
setenv serverip 192.168.1.254
tftpboot 0x01000000 zImage
tftpboot 0x02000000 dtb
bootz 0x01000000 - 0x02000000
  • OpenWrt will now boot from ramdisk. Connect a computer to one of the lan ports (the Omnia will be at 192.168.1.1).
  • Download openwrt-mvebu-turris-omnia-sysupgrade.img.gz (the one you built locally) to /tmp/ via scp (or wget if WAN connection is available):
scp openwrt-mvebu-cortexa9-cznic_turris-omnia-sysupgrade.img.gz root@192.168.1.1:/tmp
  • Do openwrt-mvebu-cortexa9-cznic_turris-omnia-sysupgrade.img.gz
  • Wait another minute for the final OpenWrt image to be flashed. The Turris Omnia will reboot itself.

SSH key

Once you flashed the new image, make sure to add an SSH public key to the list of authorized keys, so that you can later login with SSH. You can do so on the web interface by navigating to System -> Administration -> SSH-Keys.

Deploying prplMesh

prplMesh can be included in the prplOS image. prplMesh being in active development, the version included in prplOS can be outdated compared to what you want to use.

If it's the case, you can deploy prplMesh again after the prplOS was flashed.

See Deploying an ipk.

Copy files to the device in /opt/prplmesh If you can connect to your device through SSH, you can do something like this (replace USER_DEVICE with your username and device IP):

USER_DEVICE=root@192.168.1.1
ssh "$USER_DEVICE"  mkdir -p /opt/prplmesh
scp -r build/out/* "$USER_DEVICE":/opt/prplmesh
scp -r build/out/lib/* "$USER_DEVICE":/usr/lib

Run it on the device

To use prplMesh as a gateway:

/etc/init.d/prplmesh gateway_mode

To use prplMesh as a repeater:

/etc/init.d/prplmesh repeater_mode

Checking that it works

You can check the status with:

/etc/init.d/prplmesh status

It should say "XXX agent operational". If it doesn't, check if you wireless interfaces are up (either through the luci web interface, or with its command-line counterpart uci).

CLI

If you want to use beerocks_cli:

/opt/prplmesh/bin/beerocks_cli

Once you're connected, you can check the content of the connection map by issuing bml_conn_map.

When the agent is started up in a repeater, it should show up in the connection map.

You can also try if connecting a client works by connecting a device to the advertised SSID, then check that it was added on the connection map (it should have been).