plan44 / omega2flash

bash script to flash a fresh-from-factory Omega2(+) or Omega2S(+) via ethernet without user intervention
1 stars 0 forks source link

omega2flash - flash custom firmware to Omega2/2S(+)

About

This bash script can be used to flash Onion Omega2(+) or Omega2S(+) factory state devices with custom firmware with no manual intervention except for connecting power and Ethernet.

The key is that the factory firmware of the Omega2(S) has IPv6 running on the ethernet by default, with a link local address derived from the Omega2's MAC. And as IPv6 easily allows to discover device's IPv6 on the local link (e.g. ping6 ff02::1%en7), the script can find the devices, send firmware via scp, and launch sysupgrade via ssh.

The script detects Omega2S from an early production batch which don't have a valid ethernet MAC programmed and automatically provisions the correct MAC address.

The script also allows to provision the uboot environment. This only works if the flashed custom firmware includes the fw_setenv utility and have a writable uboot environment partition.

As it is now, the script only programs one device at a time. It can be run in a loop, as it remembers programmed device's IPv6 to avoid programming the same device twice.

The script can also program Omega2 found on wireless network segments, however it can not automatically connect to Omega2 hotspots.

Usage

omega2flash <ethernet-if> <auto|wait|omega2_ipv6|list|ping> [<firmware.bin> [<uboot-env-file>] [<extra-conf-files-dir]]"

Where:

Note: The script generates ANSI colored output when run from a terminal. Set NO_COLOR environment variable to prevent colors, or set FORCE_COLOR to output color even if stdout is not a terminal (e.g. to create logfiles with color included).

Contributions

...are welcome! There's a lot that could be improved. Pull requests and comments can be posted on github

License

The omega2flash script is MIT licensed.

Copyright

(c) 2017-2022 by plan44.ch/luz