Any way to detect an Omega2+ when running with Omega2 FW?
-
I have a mixed fleet of Omega2S+ (more flash+RAM) and regular Omega2S devices out in the field.
All of these were were flashed with the regular Omega2 firmware, so on the software level all identify as Omega2, as the information about RAM and flash sizes come from the device tree included in the firmware.
Now I am looking for a low-level way to somehow probe the hardware to reliably detect if it is a Omega2 or an Omega2+. Maybe some RAM R/W test with devmem to detect mirrored upper 64M vs real RAM?
Any ideas welcome!
-
@luz try ubus call system board
"system": "MediaTek MT7688 ver:1 eco:2", "model": "Onion Omega2+", "board_name": "omega2p",
I use /proc/cpuinfo to identify Omega2S vs Omega2S+ in my software.
-
@crispyoz ubus just pulls the info from the firmware, which was built for the Omega2 and so reports Omega2 despite running on the 2+...
-
@luz Yes of course. Maybe dmidecode can help.
I track my device configurations using my serial number generator.
-
@crispyoz Having Omega2s in some and Omega2s+ in other devices is something that happened in production out of a supply problem, but the FW flashed and used in the testing and serial number provisioning process was the same (Omega2s) FW for all devices, so there‘s no way to tell from the serial number if its a 2s+ or not.
This was an acceptable workaround back then, and all devices (hundreds) run fine.
But now I‘d like to make use of the extra RAM in those units that have a 2s+, so I need a detection method that only relies on the actual hardware differences in my firmware updater, so it can request a 2s+ FW once it detects a 2s+...
-
@luz It should be possible to use the bootloader command-line to read the version + device info of the SPI flash chip.
-
@luz
How to detect... "locally"?It is fairly easy since there is an Onion Omega2+ / Onion Omega2 sticker on the device
If you don't believe the sticker a
reboot
command and the bootloader messages on the Serial Console can help.
For example - please watch the 'find flash: ' line:# HW Omega2+ # FW v0.3.2 b240 # http://repo.onioniot.com.s3.amazonaws.com/omega2/images/omega2-v0.3.2-b240.bin # U-Boot 1.1.3 (Oct 18 2016 - 17:29:05) root@Omega-5BE1:/# reboot ____ _ ____ / __ \___ (_)__ ___ / __ \__ _ ___ ___ ____ _ / /_/ / _ \/ / _ \/ _ \ / /_/ / ' \/ -_) _ `/ _ `/ \____/_//_/_/\___/_//_/ \____/_/_/_/\__/\_, /\_,_/ W H A T W I L L Y O U I N V E N T ? /___/" Board: Onion Omega2 APSoC DRAM: 128 MB relocate_code Pointer at: 87f60000 ****************************** Software System Reset Occurred ****************************** flash manufacture id: c2, device id 20 19 find flash: MX25L25635E ============================================ Onion Omega2 UBoot Version: 4.3.0.3 --- root@Omega-5BE1:/# ubus call system board { "kernel": "4.14.81", "hostname": "Omega-5BE1", "system": "MediaTek MT7688 ver:1 eco:2", "model": "Onion Omega2", "board_name": "omega2", "release": { "distribution": "OpenWrt", "version": "18.06-SNAPSHOT", "revision": "r0+7471-90181760c3", "target": "ramips\/mt76x8", "description": "OpenWrt 18.06-SNAPSHOT r0+7471-90181760c3" } }
# HW Omega2+ # FW v0.3.2 b240 # http://repo.onioniot.com.s3.amazonaws.com/omega2/images/omega2p-v0.3.2-b240.bin # U-Boot 1.1.3 (Oct 18 2016 - 17:29:05) root@Omega-5BE1:/# reboot ____ _ ____ / __ \___ (_)__ ___ / __ \__ _ ___ ___ ____ _ / /_/ / _ \/ / _ \/ _ \ / /_/ / ' \/ -_) _ `/ _ `/ \____/_//_/_/\___/_//_/ \____/_/_/_/\__/\_, /\_,_/ W H A T W I L L Y O U I N V E N T ? /___/" Board: Onion Omega2 APSoC DRAM: 128 MB relocate_code Pointer at: 87f60000 ****************************** Software System Reset Occurred ****************************** flash manufacture id: c2, device id 20 19 find flash: MX25L25635E ============================================ Onion Omega2 UBoot Version: 4.3.0.3 --- root@Omega-5BE1:/# ubus call system board { "kernel": "4.14.81", "hostname": "Omega-5BE1", "system": "MediaTek MT7688 ver:1 eco:2", "model": "Onion Omega2+", "board_name": "omega2p", "release": { "distribution": "OpenWrt", "version": "18.06-SNAPSHOT", "revision": "r0+7471-90181760c3", "target": "ramips\/mt76x8", "description": "OpenWrt 18.06-SNAPSHOT r0+7471-90181760c3" } }
# HW Omega2 # FW v0.3.2 b240 # http://repo.onioniot.com.s3.amazonaws.com/omega2/images/omega2-v0.3.2-b240.bin # U-Boot 1.1.3 (Oct 18 2016 - 17:30:55) root@Omega-5533:/# reboot ____ _ ____ / __ \___ (_)__ ___ / __ \__ _ ___ ___ ____ _ / /_/ / _ \/ / _ \/ _ \ / /_/ / ' \/ -_) _ `/ _ `/ \____/_//_/_/\___/_//_/ \____/_/_/_/\__/\_, /\_,_/ W H A T W I L L Y O U I N V E N T ? /___/" Board: Onion Omega2 APSoC DRAM: 64 MB relocate_code Pointer at: 83f60000 flash manufacture id: ef, device id 40 18 find flash: W25Q128BV ============================================ Onion Omega2 UBoot Version: 4.3.0.3 --- root@Omega-5533:/# ubus call system board { "kernel": "4.14.81", "hostname": "Omega-5533", "system": "MediaTek MT7688 ver:1 eco:2", "model": "Onion Omega2", "board_name": "omega2", "release": { "distribution": "OpenWrt", "version": "18.06-SNAPSHOT", "revision": "r0+7471-90181760c3", "target": "ramips\/mt76x8", "description": "OpenWrt 18.06-SNAPSHOT r0+7471-90181760c3" } }
How to detect... "remotely"?
That is the question.
-
Two years later: Just in case anyone runs into that problem, I found a solution that work 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).Finally - Solved!