Reflashing OBLO DOC400

Hello!

I require help with flashing an OBLO DOC400 with some decent openwrt version, unlike the stock one. Please excuse me if I got some things wrong, as I am a total noob with openwrt development.

The device is an IOT z-wave gateway, to which I have SSH access. It's a Qualcomm Atheros QCA9533. After trying to use a D-Link DCH-G020 A1 sysupgrade image, I got some disturbing output.

root@OpenWrt:/tmp# sysupgrade -v /tmp/openwrt-ath79-generic-dlink_dch-g020-a1-squashfs-sysupgrade.bin 
Saving config files...
etc/config/dhcp
etc/config/dropbear
etc/config/firewall
etc/config/fstab
etc/config/mcproxy
etc/config/network
etc/config/pppoe
etc/config/sysstat
etc/config/system
etc/config/uhttpd
etc/config/wireless
etc/dnsmasq.conf
etc/dropbear/dropbear_rsa_host_key
etc/firewall.user
etc/group
etc/hosts
etc/inittab
etc/iproute2/rt_tables
etc/mcproxy.conf
etc/opkg.conf
etc/opkg/customfeeds.conf
etc/opkg/keys/240dfbb5d80a4c9
etc/opkg/keys/53bad1233d4c98c5
etc/opkg/keys/de98a2dd1d0f8a07
etc/passwd
etc/ppp/chap-secrets
etc/ppp/filter
etc/ppp/options
etc/profile
etc/protocols
etc/rc.local
etc/services
etc/shadow
etc/shells
etc/ssl/openssl.cnf
etc/sysctl.conf
etc/sysstat/sysstat
etc/sysstat/sysstat.ioconf
etc/sysupgrade.conf
killall: watchdog: no process killed
Sending TERM to remaining processes ... ntpd S99dosm systemManager oblomb oblomanager netifd sleep ubusd 
Sending KILL to remaining processes ... oblomanager 
Switching to ramdisk...
Performing system upgrade...
ash: fw_printenv: not found
ash: ubidetach: not found
Unlocking /dev/mtd12 ...
Erasing /dev/mtd12 ...
ash: nandwrite: not found
ash: ubiattach: not found
/dev/mtdblock14
/tmp/sysupgrade.tgz
tar: can't remove old file etc/config/dhcp: Read-only file system
Upgrade completed
Rebooting system...

I believe that not being able to find nandwrite or ubiattach is a bad thing. After this attempt the device wasn't able to boot, so I've attached a serial console, after some soldering. I might be able to do something with u-boot, as it's flashing capabilities seems promising. It also let me unbrick the device with mtd backups I've made earlier.

This info, from u-boot env, might be useful, as it contain some memory addresses descriptions.

le=tftp 0x80060000 uboot-env.bin&&erase 0x9f040000 +$filesize&&cp.b $fileaddr 0x9f040000 $filesize
lu=tftp 0x80060000 u-boot.bin&&erase 0x9f000000 +$filesize&&cp.b $fileaddr 0x9f000000 $filesize
lk=tftp 0x80060000 vmlinux.lzma.uImage&&nand erase 0x0 0x200000&&nand write $fileaddr 0x0 $filesize
lf=tftp 0x80060000 cus531-nand-jffs2&&nand erase 0x200000 0x1600000&&nand write $fileaddr 0x200000 $filesize
lgk=tftp 0x80060000 g-vmlinux.lzma.uImage&&nand erase 0x1800000 0x200000&&nand write $fileaddr 0x1800000 $filesize
lgf=tftp 0x80060000 g-cus531-nand-jffs2&&nand erase 0x1a00000 0x1600000&&nand write $fileaddr 0x1a00000 $filesize
luk=tftp 0x80060000 vmlinux.lzma.uImage&&nand erase 0x3000000 0x200000&&nand write $fileaddr 0x3000000 $filesize
luf=tftp 0x80060000 cus531-nand-jffs2&&nand erase 0x3200000 0x1600000&&nand write $fileaddr 0x3200000 $filesize
ldata=tftp 0x80060000 data.ubi&&nand erase 0x4820000&&nand write $fileaddr 0x4820000 $filesize
lsec=tftp 0x80060000 security.txt&&nand erase 0x4800000 0x20000&&nand write $fileaddr 0x4800000 $filesize

I believe that flashing from u-boot is not a standard procedure, or at least I didn't find the docs I need. Maybe a good soul could please redirect me to a proper doc, or tell me what to do instead.

I want to flash the device, because I don't like that my gateway is sending my house sensors data to an external server. I would like it to collect and send it over mqtt (or something else) to an openhab server. Maybe even upgrade the device with a zigbee dongle, as there might be a way to solder a usb port on to the board.

I have collected the relevant data.

root@OpenWrt:~# dmesg                          # log buffer might be to small, see note 1.
dmesg: klogctl: Function not implemented
root@OpenWrt:~# cat /proc/cmdline
board=CUS531-NAND console=ttyS0,115200 ubi.mtd=5,2048 ubi.mtd=11,2048 root=/dev/mtdblock13 mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),128k(reserved),64k(art);spi0.1:2m(kernel),22m(rootfs),2m(gold-kernel),22m(gold-rootfs),2m(upgrade-kernel),22m(upgrade-rootfs),128k(security),57216k(data),28m@0x0(firmware) rootfstype=squashfs,jffs2 noinitrd mem=67104768 rootfstype=squashfs,jffs2 noinitrd
root@OpenWrt:~# cat /proc/cpuinfo
system type             : Qualcomm Atheros QCA9533 ver 2 rev 0
machine                 : Qualcomm Atheros CUS531 nand reference board
processor               : 0
cpu model               : MIPS 24Kc V7.4
BogoMIPS                : 432.53
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 16
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa                     : mips1 mips2 mips32r1 mips32r2
ASEs implemented        : mips16
shadow register sets    : 1
kscratch registers      : 0
package                 : 0
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

root@OpenWrt:~# cat /proc/meminfo
MemTotal:          60720 kB
MemFree:            1504 kB
MemAvailable:      32060 kB
Buffers:            7632 kB
Cached:            24332 kB
SwapCached:            0 kB
Active:            22324 kB
Inactive:          17520 kB
Active(anon):       7908 kB
Inactive(anon):       28 kB
Active(file):      14416 kB
Inactive(file):    17492 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:          7896 kB
Mapped:            18464 kB
Shmem:                56 kB
Slab:               8584 kB
SReclaimable:       2204 kB
SUnreclaim:         6380 kB
KernelStack:        1576 kB
PageTables:          560 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:       30360 kB
Committed_AS:     307004 kB
VmallocTotal:    1048372 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
root@OpenWrt:~# cat /proc/devices
Character devices:
  1 mem
  4 ttyS
  5 /dev/tty
  5 /dev/console
  5 /dev/ptmx
 10 misc
 13 input
 89 i2c
 90 mtd
108 ppp
128 ptm
136 pts
166 ttyACM
180 usb
189 usb_device
253 ubi1
254 ubi0

Block devices:
259 blkext
  8 sd
 31 mtdblock
 65 sd
 66 sd
 67 sd
 68 sd
 69 sd
 70 sd
 71 sd
128 sd
129 sd
130 sd
131 sd
132 sd
133 sd
134 sd
135 sd
root@OpenWrt:~# ls /sys/devices/platform
ag71xx-mdio.0     ag71xx.1          ath79-spi         gpio-keys-polled  qca953x_wmac      serial8250.0
ag71xx-mdio.1     alarmtimer        ath79-wdt         i2c-gpio.0        regulatory.0      uevent
ag71xx.0          ath79-gpio        ehci-platform     leds-gpio         serial8250
root@OpenWrt:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00010000 "u-boot"
mtd1: 00010000 00010000 "u-boot-env"
mtd2: 00020000 00010000 "reserved"
mtd3: 00010000 00010000 "art"
mtd4: 00200000 00020000 "kernel"
mtd5: 01600000 00020000 "rootfs"
mtd6: 00200000 00020000 "gold-kernel"
mtd7: 01600000 00020000 "gold-rootfs"
mtd8: 00200000 00020000 "upgrade-kernel"
mtd9: 01600000 00020000 "upgrade-rootfs"
mtd10: 00020000 00020000 "security"
mtd11: 037e0000 00020000 "data"
mtd12: 01c00000 00020000 "firmware"
mtd13: 00e88000 0001f000 "rootfs"
mtd14: 003e0000 0001f000 "rootfs_data"
root@OpenWrt:~# cat /sys/class/mtd/mtd*/offset # Linux 4.1 and newer, see note 2.
0
262144
75497472
75628544
0
327680
458752
0
2097152
25165824
27262976
50331648
52428800
root@OpenWrt:~# ifconfig -a
eth0      Link encap:Ethernet  HWaddr C8:3D:D4:my:ma:cc 
          inet addr:192.168.0.65  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::ca3d:d4ff:fe0f:97b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1256 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1639 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:127082 (124.1 KiB)  TX bytes:257494 (251.4 KiB)
          Interrupt:4 

eth1      Link encap:Ethernet  HWaddr C6:08:92:my:ma:cc
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:5 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1101 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1101 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:114780 (112.0 KiB)  TX bytes:114780 (112.0 KiB)

wlan0     Link encap:Ethernet  HWaddr C8:3D:D4:my:ma:cc  
          inet6 addr: fe80::ca3d:d4ff:fe0f:97a/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:395 (395.0 B)  TX bytes:682 (682.0 B)

root@OpenWrt:~# ls /sys/class/net
eth0   eth1   lo     wlan0
root@OpenWrt:~# brctl show
-ash: brctl: not found
root@OpenWrt:~# cat /sys/kernel/debug/gpio     # GPIO information
GPIOs 0-17, platform/ath79-gpio, ath79:
 gpio-0   (                    |Power type input    ) in  lo    
 gpio-2   (                    |Reset button        ) in  hi    
 gpio-3   (                    |Front button        ) in  hi    
 gpio-4   (                    |sysfs               ) out lo    
 gpio-15  (                    |WPS button          ) in  lo    
 gpio-16  (                    |scl                 ) in  hi    
 gpio-17  (                    |sda                 ) in  hi    
root@OpenWrt:~# 

Best wishes!

Bump... anyone?