NOTE: Tested on updater 00.10 and root 01.02 unreleased firmware versions, the process still worked, but may change before production release.
Following these instructions recovered my hub from the Wink.com snafu telling customers to ship the hub in for repair. After re-adding the hub into my iPhone app, it came back online Solid Blue. At no point in time did I have to use the alternate DNS address.
Skip to Step#4 if your hub is already rooted with SSH connectivity.
Code: Select all
[root@flex-dvt database]# cd /database; for i in `ls cf_*`; do echo -n "$i "; cat $i; done
cf_build 00.01
cf_fver0 00.01
cf_fver1 00.08
cf_fver2 00.01
cf_fver3 01.01
[root@flex-dvt database]#
Option #1 [ Try this first, only works on older hubs that did not come pre-updated to 00.89 or greater ]
#### 1. Add SSH key through curl -d command ###
Code: Select all
curl "http://192.168.0.1/set_dev_value.php" -d "nodeId=a&attrId=;mkdir /root/.ssh; echo ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA2nCGCGeaPSWseFqi/ctWeamK56qlBmIcr0L9K0ZaAq43BHfITtLL7mteZMJYSn8PX3JMKNFJiCvvSW8gla2s4aBqb9F1EjazDKJnWKyzzdgEeUqr0T7t2pltvxxoZ/z/wEVMB5AKD9TjjTXRSoEBF7AJ/OfhjKHQiO5TLWPlUtk= rsa_1024_no-plus >> /root/.ssh/authorized_keys;"
#### 2. Connect via SSH
Code: Select all
curl "http://192.168.0.1/index.php" -d '{"ssid":"myssid","pass":"mypassword"}'
#### 3. re-connect via dhcp address ###
Option #2 [ *** AT YOUR OWN RISK ***: Requires a USB to TTL Serial adapter ]
#### 1. Disassemble by removing the four screws
#### 2. Short pin# 29 on the NAND chip to any ground (any of the shields should work)
#### 3. Add "init=/bin/sh" as a kernel argument
NOTE: See http://www.rootwink.com/viewtopic.php?f=6&t=67 for more detailed instructions
#### At this point, you should already have ssh capability as root.
#### 4. Update the updater filesystem to 00.08
Code: Select all
touch /database/ENABLE_SSH
cp /root/.ssh/authorized_keys /database/authorized_keys
sed -i 's/reboot/#reboot/g' /root/platform/*.sh
cp /var/www/set_dev_value.php /database/set_dev_value.php # Save for later
/root/platform/upgrade.sh
NOTE: As of this post, I have never seen the hub-updates.winkapp.com respond. It is normal for it to fail connecting to hub-updates.winkapp.com and continue on to the alternate url of wink-hub-images.s3.amazonaws.com
#### 5. root the 00.05 update partition
Code: Select all
ubiattach -p /dev/mtd2
mkdir /tmp/updater
mount -t ubifs ubi2:rootfs /tmp/updater
sed -i 's/reboot/#reboot/g' /tmp/updater/root/platform/*.sh
cp -r /root/.ssh /tmp/updater/root/
chmod 655 /tmp/updater/root/.ssh
chmod 644 /tmp/updater/root/.ssh/authorized_keys
rm -f /tmp/updater/etc/init.d/S99local
touch /tmp/updater/database_default/ENABLE_SSH
cp /database/authorized_keys /tmp/updater/database_default/
cp /database/set_dev_value.php /tmp/updater/var/www/set_dev_value.php # re-enables the http hack we first used to root
rm -f /tmp/updater/etc/default/dropbear # remove DROPBEAR_ARGS=-sg which disables password logins and for root too
reboot
#### 6. Reboot ####
#Verify you are booted into the updater-rootfs by making sure mtd2 (not mtd5) is being attached to ubi0
Code: Select all
[root@flex-dvt ~]# dmesg | grep ubi0
Kernel command line: noinitrd console=ttyAM0,115200 rootfstype=ubifs ubi.mtd=2 root=ubi0:rootfs rw gpmi
UBI: attaching mtd2 to ubi0
UBI: attached mtd2 to ubi0
#Proceed with rooting the gpmi-nfc-general-use main filesystem
Code: Select all
sed -i 's/reboot/#reboot/g' /root/platform/*.sh # just to be safe, should already be done
/root/platform/upgrade.sh
#Update process should spew out something similar to the following.
Code: Select all
[root@flex-dvt ~]# /root/platform/upgrade.sh
+ echo 'Press enter to cancel update...'
Press enter to cancel update...
+ read -t2 stdin
+ '[' 1 = 0 ']'
+ set_rgb 100 100 0 0 0 0 flash 250000
+ source /root/platform/platform.sh
++ set -x
+++ mount
+++ grep database
++ dbcheck='ubi1:database on /database type ubifs (rw,relatime)'
++ '[' '' == 'ubi1:database on /database type ubifs (rw,relatime)' ']'
+++ cat /proc/cmdline
+++ grep badapp
++ kernel_cmd_line=
++ '[' '' '!=' '' ']'
+++ grep badupdater
+++ cat /proc/cmdline
++ kernel_cmd_line=
++ '[' '' '!=' '' ']'
++ source /root/platform/platform.config
+++ SCRIPT_VERSION=UPDATE
+++ sw_pkg_url=https://hub-updates.winkapp.com
+++ alt_pkg_url=https://wink-hub-images.s3.amazonaws.com
++++ cat /database/cf_url
cat: can't open '/database/cf_url': No such file or directory
+++ eval tmp=
++++ tmp=
+++ '[' '' '!=' '' ']'
++++ cat /database/cf_build
+++ eval build=00.01
++++ build=00.01
+++ '[' 00.01 '!=' '' ']'
+++ board_id=00.01
+++ sw_pkg_url=https://hub-updates.winkapp.com/00.01
+++ alt_pkg_url=https://wink-hub-images.s3.amazonaws.com/00.01
+++ group_id=0
+++ fparts=4
+++ ntpserver1=0.rhel.pool.ntp.org
+++ ntpserver2=1.rhel.pool.ntp.org
+++ '[' UPDATE '!=' APP ']'
+++ canupdate[0]=1
+++ canupdate[1]=1
+++ upgrade_boot=1
+++ app_boot=1
+++ num_bootloaders=2
+++ eth_dev=wlan0
+++ eth_timeout=60
+++ ntpd_retry=3
+++ curl_args='--cacert /etc/ssl/certs/ca-certificates.crt --retry 5'
+ forced_update=0
+ (( idx=0 ))
+ (( idx<fparts ))
+ flash_get 'fver[0]' cf_fver0
++ cat /database/cf_fver0
+ eval 'fver[0]=00.01'
++ fver[0]=00.01
+ '[' 0 '!=' 0 ']'
+ [[ 00.01 != [0-9][0-9].[0-9][0-9] ]]
+ '[' 00.01 = 00.00 ']'
+ (( idx++ ))
+ (( idx<fparts ))
+ flash_get 'fver[1]' cf_fver1
++ cat /database/cf_fver1
+ eval 'fver[1]=00.05'
++ fver[1]=00.05
+ '[' 0 '!=' 0 ']'
+ [[ 00.05 != [0-9][0-9].[0-9][0-9] ]]
+ '[' 00.05 = 00.00 ']'
+ (( idx++ ))
+ (( idx<fparts ))
+ flash_get 'fver[2]' cf_fver2
++ cat /database/cf_fver2
+ eval 'fver[2]=00.01'
++ fver[2]=00.01
+ '[' 0 '!=' 0 ']'
+ [[ 00.01 != [0-9][0-9].[0-9][0-9] ]]
+ '[' 00.01 = 00.00 ']'
+ (( idx++ ))
+ (( idx<fparts ))
+ flash_get 'fver[3]' cf_fver3
++ cat /database/cf_fver3
+ eval 'fver[3]=00.55'
++ fver[3]=00.55
+ '[' 0 '!=' 0 ']'
+ [[ 00.55 != [0-9][0-9].[0-9][0-9] ]]
+ '[' 00.55 = 00.00 ']'
+ (( idx++ ))
+ (( idx<fparts ))
+ cd /tmp
+ '[' '!' -d temp ']'
+ mkdir /tmp/temp
+ rm -rf /tmp/temp/upgrade_00.01.txt
+ wait_on_network
++ ifconfig
++ grep wlan0
+ tmp='wlan0 Link encap:Ethernet HWaddr B4:79:A7:0D:60:3F '
+ '[' '' == 'wlan0 Link encap:Ethernet HWaddr B4:79:A7:0D:60:3F ' ']'
+ (( idx=0 ))
+ (( idx<60 ))
+ sleep 1
++ grep 'inet addr'
++ ifconfig wlan0
+ tmp=' inet addr:192.168.41.164 Bcast:192.168.41.255 Mask:255.255.255.0'
+ '[' '' '!=' ' inet addr:192.168.41.164 Bcast:192.168.41.255 Mask:255.255.255.0' ']'
+ return 0
+ '[' 0 '!=' 0 ']'
+ set_date
+ (( idx=0 ))
+ (( idx<3 ))
++ date
++ grep 1970
+ datecheck=
+ '[' '' '!=' '' ']'
+ return 0
+ '[' 0 '!=' 0 ']'
+ get_update_config
++ grep Content-Length
++ curl --cacert /etc/ssl/certs/ca-certificates.crt --retry 5 -I https://hub-updates.winkapp.com/00.01/upgrade_00.01.txt
++ awk '{print $2}'
Warning: Transient problem: timeout Will retry in 1 seconds. 5 retries left.
Warning: Transient problem: timeout Will retry in 2 seconds. 4 retries left.
Warning: Transient problem: timeout Will retry in 4 seconds. 3 retries left.
Warning: Transient problem: timeout Will retry in 8 seconds. 2 retries left.
Warning: Transient problem: timeout Will retry in 16 seconds. 1 retries left.
curl: (6) Couldn't resolve host 'hub-updates.winkapp.com'
+ file_len=
+ '[' '' = '' ']'
+ echo 'Could not open https://hub-updates.winkapp.com/00.01'
Could not open https://hub-updates.winkapp.com/00.01
++ grep Content-Length
++ awk '{print $2}'
++ curl --cacert /etc/ssl/certs/ca-certificates.crt --retry 5 -I https://wink-hub-images.s3.amazonaws.com/00.01/upgrade_00.01.txt
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 575 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
+ file_len=575
+ '[' '' = 575 ']'
+ curl --cacert /etc/ssl/certs/ca-certificates.crt --retry 5 https://wink-hub-images.s3.amazonaws.com/00.01/upgrade_00.01.txt
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 575 100 575 0 0 1657 0 --:--:-- --:--:-- --:--:-- 1774
+ return 0
+ '[' 0 '!=' 0 ']'
++ cat /tmp/temp/upgrade_00.01.txt
++ grep board_id
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_board_id=00.01
++ grep group_id
++ cat /tmp/temp/upgrade_00.01.txt
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_group_id=0
+ '[' 0 = '' ']'
+ let 'read_group_id = 0'
++ awk -F = '{print $2}'
++ tr -d '\r'
++ cat /tmp/temp/upgrade_00.01.txt
++ grep sw_pkg_url
+ read_sw_pkg_url=https://wink-hub-images.s3.amazonaws.com/00.01
++ cat /tmp/temp/upgrade_00.01.txt
++ grep alt_pkg_url
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_alt_pkg_url=https://hub-updates.winkapp.com/00.01
++ cat /tmp/temp/upgrade_00.01.txt
++ grep fparts
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_fparts=4
+ '[' 4 = '' -o 4 = 0 ']'
+ let 'read_fparts = 4'
+ (( idx=0 ))
+ (( idx<read_fparts ))
++ cat /tmp/temp/upgrade_00.01.txt
++ grep fdest0
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_fdest[$idx]=/dev/mtd1
++ grep fver0
++ cat /tmp/temp/upgrade_00.01.txt
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_fver[$idx]=00.01
+ [[ 00.01 != [0-9][0-9].[0-9][0-9] ]]
++ cat /tmp/temp/upgrade_00.01.txt
++ grep foff0
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_foff[$idx]=0
++ cat /tmp/temp/upgrade_00.01.txt
++ grep ftype0
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_ftype[$idx]=0
++ grep fsrc0
++ awk -F = '{print $2}'
++ cat /tmp/temp/upgrade_00.01.txt
++ tr -d '\r'
+ read_fsrc[$idx]=updater-uImage
++ grep md5sum0
++ cat /tmp/temp/upgrade_00.01.txt
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_md5sum[$idx]=11b29593183c2b94a85b333c03a3b52c
+ (( idx++ ))
+ (( idx<read_fparts ))
++ cat /tmp/temp/upgrade_00.01.txt
++ awk -F = '{print $2}'
++ grep fdest1
++ tr -d '\r'
+ read_fdest[$idx]=/dev/mtd2
++ awk -F = '{print $2}'
++ tr -d '\r'
++ cat /tmp/temp/upgrade_00.01.txt
++ grep fver1
+ read_fver[$idx]=00.05
+ [[ 00.05 != [0-9][0-9].[0-9][0-9] ]]
++ cat /tmp/temp/upgrade_00.01.txt
++ grep foff1
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_foff[$idx]=0
++ grep ftype1
++ cat /tmp/temp/upgrade_00.01.txt
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_ftype[$idx]=1
++ cat /tmp/temp/upgrade_00.01.txt
++ grep fsrc1
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_fsrc[$idx]=updater-rootfs.ubi
++ grep md5sum1
++ cat /tmp/temp/upgrade_00.01.txt
++ tr -d '\r'
++ awk -F = '{print $2}'
+ read_md5sum[$idx]=3b454483039b456ede6d0dbf019ec2c2
+ (( idx++ ))
+ (( idx<read_fparts ))
++ cat /tmp/temp/upgrade_00.01.txt
++ grep fdest2
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_fdest[$idx]=/dev/mtd4
++ cat /tmp/temp/upgrade_00.01.txt
++ grep fver2
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_fver[$idx]=00.01
+ [[ 00.01 != [0-9][0-9].[0-9][0-9] ]]
++ cat /tmp/temp/upgrade_00.01.txt
++ grep foff2
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_foff[$idx]=0
++ cat /tmp/temp/upgrade_00.01.txt
++ grep ftype2
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_ftype[$idx]=0
++ cat /tmp/temp/upgrade_00.01.txt
++ grep fsrc2
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_fsrc[$idx]=app-uImage
++ awk -F = '{print $2}'
++ tr -d '\r'
++ cat /tmp/temp/upgrade_00.01.txt
++ grep md5sum2
+ read_md5sum[$idx]=11b29593183c2b94a85b333c03a3b52c
+ (( idx++ ))
+ (( idx<read_fparts ))
++ grep fdest3
++ awk -F = '{print $2}'
++ cat /tmp/temp/upgrade_00.01.txt
++ tr -d '\r'
+ read_fdest[$idx]=/dev/mtd5
++ grep fver3
++ awk -F = '{print $2}'
++ cat /tmp/temp/upgrade_00.01.txt
++ tr -d '\r'
+ read_fver[$idx]=00.56
+ [[ 00.56 != [0-9][0-9].[0-9][0-9] ]]
++ awk -F = '{print $2}'
++ tr -d '\r'
++ cat /tmp/temp/upgrade_00.01.txt
++ grep foff3
+ read_foff[$idx]=0
++ grep ftype3
++ awk -F = '{print $2}'
++ tr -d '\r'
++ cat /tmp/temp/upgrade_00.01.txt
+ read_ftype[$idx]=1
++ grep fsrc3
++ awk -F = '{print $2}'
++ cat /tmp/temp/upgrade_00.01.txt
++ tr -d '\r'
+ read_fsrc[$idx]=app-rootfs.ubi
++ grep md5sum3
++ cat /tmp/temp/upgrade_00.01.txt
++ awk -F = '{print $2}'
++ tr -d '\r'
+ read_md5sum[$idx]=4be9449d6830538084393c0fd5483b85
+ (( idx++ ))
+ (( idx<read_fparts ))
+ cleanup_update_config
+ rm -rf /tmp/temp
+ '[' 00.01 = 00.01 ']'
+ echo 'Board Ids Match...'
Board Ids Match...
+ '[' 0 -le 0 -o 1 = 0 ']'
+ echo 'Group Ids Pass...'
Group Ids Pass...
+ check_versions
+ didupdate=0
+ (( idx=0 ))
+ (( idx<num_bootloaders ))
+ '[' 00.01 '>' 00.01 ']'
+ (( idx++ ))
+ (( idx<num_bootloaders ))
+ '[' 00.05 '>' 00.05 ']'
+ (( idx++ ))
+ (( idx<num_bootloaders ))
+ '[' UPDATE '!=' APP ']'
+ '[' 1 = 0 ']'
+ (( idx=num_bootloaders ))
+ (( idx<read_fparts ))
+ '[' 00.01 '>' 00.01 ']'
+ (( idx++ ))
+ (( idx<read_fparts ))
+ '[' 00.56 '>' 00.55 ']'
+ '[' UPDATE '!=' APP ']'
+ do_update
+ '[' '' = '' ']'
+ update_func=update1
+ declare -f update1
+ '[' 0 = 0 ']'
+ set_rgb 100 0 0 0 0 0 flash 250000
+ update1
+ success_url=https://wink-hub-images.s3.amazonaws.com/00.01/app-rootfs.ubi
++ curl --cacert /etc/ssl/certs/ca-certificates.crt --retry 5 -I https://wink-hub-images.s3.amazonaws.com/00.01/app-rootfs.ubi
++ grep Content-Length
++ awk '{print $2}'
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 24.5M 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
+ file_len=25690112
+ '[' '' = 25690112 ']'
+ md5pipe /tmp/test.md5
+ ubiformat /dev/mtd5 -y -f - -S 25690112
+ curl --cacert /etc/ssl/certs/ca-certificates.crt --retry 5 https://wink-hub-images.s3.amazonaws.com/00.01/app-rootfs.ubi
ubiformat: mtd5 (nand), size 80740352 bytes (77.0 MiB), 616 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 71 -- 11 % complete rentd Time Time Time Cur
libscan: scanning eraseblock 72 -- 11 % complete Dload Upload Total Spent Left Speed
libscan: scanning eraseblock 615 -- 100 % complete -:--:-- 0:05:57 7463157 0
ubiformat: 616 eraseblocks have valid erase counter, mean value is 9
100 24.5M 100 24.5M 0 0 660k 0 0:00:38 0:00:38 --:--:-- 559k
ubiformat: formatting eraseblock 615 -- 100 % complete
+ '[' 0 '!=' 0 ']'
+ sync
+ sync
+ sync
+ sleep 1
++ cat /tmp/test.md5
+ md5_check=4be9449d6830538084393c0fd5483b85
+ '[' 4be9449d6830538084393c0fd5483b85 '!=' 4be9449d6830538084393c0fd5483b85 ']'
+ flash_set cf_fver3 00.56
+ echo 00.56
+ didupdate=1
+ (( idx++ ))
+ (( idx<read_fparts ))
+ '[' UPDATE '!=' APP ']'
+ set_boot_application
+ flash_set DO_UPDATE 0
+ echo 1
+ set_rgb 0 200 0 0 0 0 flash 500000
+ end 0
+ echo END
END
+ '[' 0 = 1 ']'
+ '[' UPDATE '!=' APP ']'
+ sleep 5
+ exit 0
[root@flex-dvt ~]#
# Now your main gpmi-nfc-general-use filesystem is updated (00.56 in the case of the above), now to root it BEFORE we reboot.
Code: Select all
ubiattach -p /dev/mtd5
mkdir /tmp/rootfs
mount -t ubifs ubi2:rootfs /tmp/rootfs
touch /tmp/rootfs/database_default/ENABLE_SSH
touch /database/ENABLE_SSH #should already exist
touch /database_default/ENABLE_SSH #should already exist
cp /database/authorized_keys /tmp/rootfs/database_default/
cp -r /root/.ssh /tmp/rootfs/root/ # this is necessary
chmod 655 /tmp/rootfs/root/.ssh
chmod 644 /tmp/rootfs/root/.ssh/authorized_keys
sed -i 's/reboot/#reboot/g' /tmp/rootfs/root/platform/*.sh
sed -i 's/^#tty/tty/g' /tmp/rootfs/etc/inittab # this is necessary to re-enable the serial console
cp /database/set_dev_value.php /tmp/rootfs/var/www/set_dev_value.php # re-enables the http hack we first used to root
rm -f /tmp/rootfs/etc/default/dropbear # removes the "DROPBEAR_ARGS=-sg" arguments preventing logins with passwords and root logins
#### 7. Reboot ####
Cross fingers.
Note: If your hub blinks purple and does not connect, re-add it via the Wink app on your device.