Upgrade Firmware ms14

From Wiki for Dragino Project
Jump to: navigation, search

Introduction and suitable products

There are several ways to upgrade firmware into products base on Dragino Ar9331 solution, such as MS14, MS14-N, PAN, HE, Yun Shield.

Upgrade Firmware via GUI

The easiest way for upgrade is through GUI, make sure you are using squashfs-sysupgrade.bin file for upgrade here. This upgrade method is useful when the firmware is compiled in the same enviroment set up.

Upgrade via Web GUI



Upgrade Firmware via SSH access

This upgrade method works when the firmware is compiled in the same enviroment set up.

SCP your firmware to the system /var directory and then run

root@OpenWrt:~# /sbin/sysupgrade /var/openwrt-ar71xx-generic-dragino2-squashfs-sysupgrade.bin
or add -n option to erase the current settings. 
root@OpenWrt:~# /sbin/sysupgrade -n /var/openwrt-ar71xx-generic-dragino2-squashfs-sysupgrade.bin

note: if you have a big sysupgrade firmware(such as Yun Sysupgrade firmware which has 15MB), the best is to put it into the /var directory to make sure there is enough room

Upgrade Firmware via Web FailSafe mode

Web Failsafe mode is a useful mode for fast upgrade a firmware to IoT firmware' or an Barrier Breaker Dragino Firmware from OpenWrt official site.

It can be also used to switch the Dragino MS14 or HE from Yun Firmware above two firmwares. Instruction is here.

Upgrade Firmware in U-boot or U-boot Netconsole mode

No matter what firmware you have in the MS14, HE or Yun Shield, you can still upgrade the firmware via u-boot commands. This method is normally used to recover firmware or switch firmware between Mesh IoT firmware and Arduino Yun Firmware.

Upgrade to Mesh IoT Firmware -- use Sysupgrade file

Below commands can be use to upgrade MS14 , HE or Yun Shield in u-boot or u-boot netconsole mode.

Commands in u-boot and u-boot netconsole mode are the same, Note when typing command in Hercules: user must add <CR>at the end of each command; $ is a special char in Hercules, user should double it (key two $$) when typing.

Set up your tftp server with ip 192.168.255.2 and put the squashfs-sysupgrade.bin firmware on tftp server root.

in u-boot console: run below command

upgrade to IoT firmware and change boot address to boot from IoT firmware

dr_boot>run firmware_upg
dr_boot>setenv bootcmd bootm 0x9f040000
dr_boot>saveenv

Output Example:

dr_boot> run firmware_upg
Using eth0 device

Ping OK, host 192.168.255.2 is alive!

TFTP from IP: 192.168.255.2
     Our IP: 192.168.255.1
   Filename: 'firmware.bin'
Load address: 0x80800000
      Using: eth0

    Loading: ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ########################################
             ####################################

TFTP transfer complete!

Bytes transferred: 5505028 (0x540004)
Erase FLASH from 0x9F040000 to 0x9F58FFFF in bank #1
Erasing: #######################################
        #######################################
        #######

Erased sectors: 85

Copying to FLASH...
Writting at address: 0x9F040000

Done!

OK!



Upgrade to Mesh IoT Firmware -- use seperate kernel and rootfs files

Set up your tftp server with ip 192.168.255.2 and put the kernel.bin and rootfs-squashfs.bin files on tftp server root.

in u-boot console: run below command

upgrade to IoT firmware and change boot address to boot from IoT firmware

tftp 0x81000000 openwrt-ar71xx-generic-dragino2-kernel.bin
erase 0x9f040000 +0x100000
cp.b 0x81000000 0x9f040000 $filesize
 
tftp 0x81000000 openwrt-ar71xx-generic-dragino2-rootfs-squashfs.bin
erase 0x9f140000 +0xea0000
cp.b 0x81000000 0x9f140000 $filesize
 
setenv bootcmd bootm 0x9f040000
saveenv
reset



Upgrade to Dragino Yun (Arduino Yun) Firmware

Below commands can be use to upgrade MS14 , HE or Yun Shield in u-boot or u-boot netconsole mode.

Commands in u-boot and u-boot netconsole mode are the same, Note when typing command in Hercules: user must add <CR>at the end of each command; $ is a special char in Hercules, user should double it (key two $$) when typing.

Set up your tftp server with ip 192.168.255.2 and put the firmware(two files: kernel.bin and root-squashfs.bin) on tftp server root.

Both kernel and rootfs need to be upgraded.

Upgrade Kernel to flash

dr_boot>tftpboot 0x81000000 dragino2-yun-common-xxx-kernel.bin
dr_boot>erase 0x9fea0000 +0x140000 
dr_boot>cp.b 0x81000000 0x9fea0000 $filesize

Upgrade rootfs to flash

dr_boot>tftpboot 0x81000000 dragino2-yun-common-xxx-rootfs-squashfs.bin
dr_boot>erase 0x9f050000 +0xe50000    
dr_boot>cp.b 0x81000000 0x9f050000 $filesize

change boot address for to boot to Arduino firmware

dr_boot> setenv bootcmd bootm 0x9fea0000
dr_boot> saveenv
dr_boot> reset

Notice After Upgrade to Arduino Yun Firmware

The Arduino Bridge Library use Baud Rate 250000 for UART communication. So in Arduino Yun Firmware, the kernel will switch the baud rate to 250000 during the booting process. Because u-boot used runs Baud Rate 115200, if use serial monitor to see the boot up process in 115200 baud rate mode, you can see messy code in UART after kernel chande the baud rate.

A typical output as below:

U-Boot 1.1.4 (Aug 12 2012 - 20:14:51)
 
AP121-2MB (ar9330) U-boot
DRAM: #### TAP VALUE 1 = f, 2 = 10
64 MB
Top of RAM usable for U-Boot at: 84000000
Reserving 212k for U-Boot at: 83fc8000
Reserving 192k for malloc() at: 83f98000
Reserving 44 Bytes for Board Info at: 83f97fd4
Reserving 36 Bytes for Global Data at: 83f97fb0
Reserving 128k for boot params() at: 83f77fb0
Stack Pointer at: 83f77f98
Now running in RAM - U-Boot at: 83fc8000
id read 0x100000ff
flash size 16777216, sector count = 256
Flash: 16 MB
In: serial
Out: serial
Err: serial
Net: ag7240_enet_initialize...
No valid address in Flash. Using fixed address
No valid address in Flash. Using fixed address
: cfg1 0x5 cfg2 0x7114
eth0: 00:03:7f:09:0b:ad
eth0 up
: cfg1 0xf cfg2 0x7214
eth1: 00:03:7f:09:0b:ad
athrs26_reg_init_lan
ATHRS26: resetting s26
ATHRS26: s26 reset done
eth1 up
eth0, eth1
Hit any key to stop autoboot: 4     3     2     1     0 
## Booting image at 9fea0000 ...
Image Name: MIPS OpenWrt Linux-3.8.3
Created: 2014-02-12 3:16:34 UTC
Image Type: MIPS Linux Kernel Image (lzma compressed)
Data Size: 1172210 Bytes = 1.1 MB
Load Address: 80060000
Entry Point: 80060000
Verifying Checksum at 0x9fea0040 ...OK
Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80060000) ...
## Giving linux memsize in bytes, 67108864
 
Starting kernel ...
 
[ 0.000000] Linux version 3.8.3 (edwin@edwin-test) (gcc version 4.6.4 20121210 (prerelease) (Linaro GCC 4.6-2012.12) ) #17 Wed Feb 12 11:15:36 CST 2014
[ 0.000000] bootconsole [early0] enabled
[ 0.000000] CPU revision is: 00019374 (MIPS 24Kc)
[ 0.000000] SoC: Atheros AR9330 rev 1
[ 0.000000] Clocks: CPU:400.000MHz, DDR:400.000MHz, AHB:200.000MHz, Ref:25.000MHz
[ 0.000000] Determined physical RAM map:
[ 0.000000] memory: 04000000 @ 00000000 (usable)
[ 0.000000] Initrd not found or empty - disabling initrd
[ 0.000000] Zone ranges:
[ 0.000000] Normal [mem 0x00000000-0x03ffffff]
[ 0.000000] Movable zone start for each node
[ 0.000000] Early memory node ranges
[ 0.000000] node 0: [mem 0x00000000-0x03ffffff]
[ 0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[ 0.000000] Primary data cache 32kB, 4-way, VIPT, cache aliases, linesize 32 bytes
[ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
[ 0.000000] Kernel command line: board=Linino console=ttyATH0,250000 mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,14656k(rootfs),1280k(kernel),64k(nvram),64k(art),15936k@0x50000(firmware) rootfstype=squashfs,jffs2 noinitrd
[ 0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[ 0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[ 0.000000] __ex_table already sorted, skipping sort
[ 0.000000] Writing ErrCtl register=00000000
[ 0.000000] Readback ErrCtl register=00000000
[ 0.000000] Memory: 60900k/65536k available (2569k kernel code, 4636k reserved, 651k data, 232k init, 0k highmem)
[ 0.000000] SLUB: Genslabs=9, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[ 0.000000] NR_IRQS:51
[ 0.000000] Calibrating delay loop... 265.42 BogoMIPS (lpj=1327104)
[ 0.080000] pid_max: default: 32768 minimum: 301
[ 0.080000] Mount-cache hash table entries: 512
[ 0.090000] NET: Registered protocol family 16
[ 0.090000] MIPS: machine is Arduino Yun
[ 0.540000] Setting DogStick2 GPIO
[ 0.560000] bio: create slab at 0
[ 0.560000] SCSI subsystem initialized
[ 0.570000] usbcore: registered new interface driver usbfs
[ 0.570000] usbcore: registered new interface driver hub
[ 0.570000] usbcore: registered new device driver usb
[ 0.580000] Switching to clocksource MIPS
[ 0.580000] NET: Registered protocol family 2
[ 0.590000] TCP established hash table entries: 512 (order: 0, 4096 bytes)
[ 0.590000] TCP bind hash table entries: 512 (order: -1, 2048 bytes)
[ 0.590000] TCP: Hash tables configured (established 512 bind 512)
[ 0.600000] TCP: reno registered
[ 0.600000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[ 0.610000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[ 0.620000] NET: Registered protocol family 1
[ 0.640000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[ 0.640000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[ 0.650000] msgmni has been set to 118
[ 0.660000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[ 0.660000] io scheduler noop registered
[ 0.670000] io scheduler deadline registered (default)
[ 0.670000] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[ 0.680000] ar933x-uart: ttyATH0 at MMIO 0x18020000 (irq = 11) is  
-q  
侤塈%堃| 8c ?M? 鸮\贛嚬]? H篔劝my o7^:H筣
J泑艉h.靥O j ?雀z酨辿,鵻.NA衜 .岺摶&
霳 j  @L圝 
&癐¬?(Q蠳 泋AJ侤塝圝ba擷&坸釘J菿僼瀇   j ?
}+~淣(渓> }7?
 沑凕j ' j
??僪 )N6?Q﨨 j ?垟JH欽孨圸圝圚& 蘋 j ?垟J圝圛擩H汮圚嚮L 霴 j ?,L8  屆>a~a怇N j ? @L圝 
&癐¬?(' 5i?萀a MH i?駤Hq榅?' ja?萀醥?A塏6堷J坖寽kL? ? j%?I塏>媬Io%k} h (菻¬?鵜? 
¬萂℉z黓埜 桄O j%? 鴒a?H j?a E'bMy鳱 O j=?J竘b榐 踍 篘x樭|良籡a埞L ` j=?K\&cn?X &閮t搸H塝 壜?J岌綹凁餗摴Mj淿z9 H麶?
8瀄j贜&
l  k=?f? 擬~訫?j8 H8圝 q X&¬m6??-x H 圝'圸怞? P¬麿狪吿厅O k-?B?d達?h?tX67? ¬8OH 舭%凫O j-?偤l 歗儤歁¬烗H閄淢呣jb躭懈~



Upgrade firmware from IoT firmware to Yun firmware via WiFi

The Yun firmware and IoT mesh firmware has different flash layout and boot address. Switch between these firmware can't be complete via Web UI.

Below is the instruction of how to upgrade the device from Dragino Yun firmware to IoT Mesh Firmware:

Step 1: upgrade IoT firmware to Middle firmware.

the middleware can be downloaded here.

Download the Sysupgrade firmware and upgrade it to the device via Web UI.

Step 2: Switch to the Yun firmware common-v2.0.7

After the device is running the middleware. download below files. download link

  • common-2.0.7.u-boot
  • common-2.0.7.firmware
  • common-2.0.7.config
  • switch_firmware_from_IoT_to_Yun.sh

and transfer them to the device's /var directory. Make sure to put them in the /var directory of the device. If you put them in other directory. your device will be hung because out of space.

then run:

cd /var
chmod +x switch_firmware_from_IoT_to_Yun.sh 
./switch_firmware_from_IoT_to_Yun.sh

then the device will reboot to the Yun firmware

Below is the output after running the command

 root@dragino-1449b0:/tmp# ./switch_firmware_from_IoT_to_Yun.sh 
 Start Flashing, Don't power off the device until it finish !!!
 Unlocking u-boot ...
 
 Writing from common-2.0.7.u-boot to u-boot ...      
 Unlocking firmware ...
 
 Writing from common-2.0.7.firmware to firmware ...     
 Unlocking config ...
 
 Writing from common-2.0.7.config to config ...     
 
 Flashing finish. Device will be reboot to Yun firmware.



Step 2: Upgrade to a higher Yun firmware version

The device will then reboot to the v2.0.7 Yun firmware version. User can check if there is higher firmware from this LINK. If there is higher version, user can upgrade to that version via Web GUI now.




Upgrade firmware from Yun firmware to IoT Mesh firmware via WiFi

The Yun firmware and IoT mesh firmware has different flash layout and boot address. Switch between these firmware can't be complete via Web UI.

Below is the instruction of how to upgrade the device from Dragino Yun firmware to IoT Mesh Firmware:

  1. Upgrade the device to the middleware(download) via the Web UI (don't check keep settings).
  2. Access to the linux system and run: switch_firmware_from_Yun_to_IoT . Device will upgrade and reboot to Version: Dragino-v2 IoT-1.3.4. After that, user can continue to use other IoT Mesh Firmware by upgrade in Web UI.

output of this command is as below:

root@dragino:~# switch_firmware_from_Yun_to_IoT 
Start Flashing, Don't power off the device until it finish !!!
Unlocking u-boot-env ...

Writing from /var/IoT_firmware_part1 to u-boot-env ...     
Unlocking rootfs ...

Writing from /var/IoT_firmware_part2 to rootfs ...     
Flashing finish. Reboot the device to boot to IoT firmware.

The device will then reboot to a old IoT firmware version. User can then upgrade to the latest firmware version via Web GUI. the latest version and changelog is here.