2016/04/10

Arduino Yún:更新OpenWrt-Yun映像檔

之前已成功設定Yún並可無線燒錄,不過Yun出廠時安裝的OpenWrt-Yun,版本可能過於老舊,這篇記錄一下更新步驟。注意,更新後原先建立的檔案與組態設定都會消失不見。

更新之前,可先燒錄無作用的草稿碼到Yun,因為有些草稿碼會影響開機程序,致使Yun無回應;官方網站建議「檔案」-「範例」-「Bridge」-「YunSerialTerminal」,若出問題,還可經由USB線試試能否登入OpenWrt-Yun。

首先下載Arduino官方網站釋出的OpenWrt-Yun映像檔,下載網址在此,我下載的是「OpenWrt-Yún 1.5.3 Upgrade Image」,檔名是YunSysupgradeImage_v1.5.3.zip,解壓縮後得到openwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade.bin,大小約16 MB。

把映像檔放進micro SD卡裡,插入Yún的記憶卡插槽,然後通電啟動。更新映像檔(韌體)的介面有兩個:網頁介面與命令列介面。

首先是網頁介面,從瀏覽器登入Yún後,它會自動偵測記憶卡裡有無更新映像檔,並且顯示如下的畫面。

按下「RESET」就會開始更新,大約需3分鐘,更新過程中WLAN LED會閃爍,請耐心等待。

第二種更新介面是命令列介面,從SSH登入,手動下指令更新。

首先透過SSH安全連線登入。(請把192.168.1.161換成你的Yún的IP位址。)
$ ssh root@192.168.1.161

第一次SSH連線時,會詢問你認不認識該主機,請輸入yes、按Enter。
The authenticity of host '192.168.1.161 (192.168.1.161)' can't be established.
RSA key fingerprint is SHA256:zjUI8S3VXbPDA2yr/tilWjisYIvpMvTinejFkP8N60k.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.161' (RSA) to the list of known hosts.


然後輸入設定的密碼,預設是「arduino」。
root@192.168.1.161's password:

BusyBox v1.19.4 (2014-11-13 19:03:47 CET) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------

root@ArduinoYun:~#


哇,登入成功囉。先檢查一下Linino映像檔。
root@ArduinoYun:~# ls /mnt/sda1
openwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade.bin

然後執行更新指令run-sysupgrade,參數是映像檔的路徑。
root@ArduinoYun:~# run-sysupgrade /mnt/sda1/openwrt-ar71xx-generic-yun-16M-squashfs-sysupgrade.bin

Sending TERM to remaining processes ... uhttpd dbus-daemon dnsmasq thd ntpd uSDaemon sleep syslogd klogd hotplug2 ubusd netifd
Sending KILL to remaining processes ... uhttpd
Switching to ramdisk...
Performing system upgrade...
Unlocking firmware ...

Writing from to firmware ...
Upgrade completed
Rebooting system...


LED USB會亮起,等待約3分鐘後即可完成更新。


參考資料:

No comments:

Post a Comment