FAQ: How do I detect if the hardware is an Omega2 or Omega2+ from Linux?


  • administrators

    Question

    Looking for a way to probe the hardware to reliably detect if it is a Omega2/2S (64MB MB RAM, 16 MB Flash) or an Omega2+/2S+ (128MB MB RAM, 32 MB Flash)

    Why is this useful?

    If an Omega2+ is flashed with Omega2 firmware, the software (like ubus call system board) will identify it as an Omega2 regardless of the hardware differences.

    We need a way to identify the actual hardware on the device to determine if it is an Omega2 or Omega2+

    Solution that works from Linux Userspace

    In the kernel messages (which can be viewed with the dmesg command), there is a line like:

    [    0.358842] m25p80 spi0.0: w25q128 (16384 Kbytes)
    

    or (in newer OpenWrt versions):

    [    0.639801] spi-nor spi0.0: w25q256 (32768 Kbytes)
    

    This is a message from the spi-nor kernel driver after detecting the actual flash chip. So it is not dependent on the flash size that is baked into the firmware image, but shows the real size of the flash chip. Both of the example lines above are from a firmware made for the Omega2. The first is run on an actual Omega2, the second shows 32M so it is a Omega2+.

    The only gotcha with this is that the dmesg buffer is not infinite and will loose older lines when too many new ones arrive. This means detecting the flash chip size needs to be done shortly after startup.

    So I put the following line into a startup script (e.g. /etc/rc.local) :

    dmesg | sed -n -r -e '/spi0.0: .*w25q/s/.*(w25q.*\))/\1/p' > /tmp/flashchip
    

    With this, the chip name and size is captured and can be read any time later from /tmp/flashchip to detect an Omega2(S)+ vs Omega2(S)+.


    Credit

    Solution found and published by @luz: https://community.onion.io/topic/4212/any-way-to-detect-an-omega2-when-running-with-omega2-fw



Looks like your connection to Community was lost, please wait while we try to reconnect.