話說一直忙著其他的事, 我的開發板有好一陣子沒升級了, 有天抽空想把它升級看看, 卻發生了一些烏龍事, 順便把它記下來.
首先要升級 bootcode, 結果發現 bootcode 位置改了. 沒關係, 這小事. 不過把 bootcode load 到 memory 的過程中, 卻把網路驅動打死了, 所以呈現出 tftp 上傳不了的狀態. 其實跟網路一點關係也沒有, 就是位置不對, 像是下面的 BAD ADD2 (R).
tftp 0xBADADD2 my_bootcode.bin
升好了 bootcode, 想練習一下 USB 安裝. 我這邊一直看到 FAE 同仁發 mail 給客戶教學, 但是自己卻沒有實做過. 因為直接按 hot key 升級實在簡單多了! 要從 USB 升級, 首先在 uboot 下打 usb start — 成功! 果然看到很多 USB device, 主要是接 HUB 的關係. 舉例來說 [1], 可能一口氣出現一堆.
=> usb start
(Re)start USB…
USB0: USB EHCI 1.00
scanning bus 0 for devices… cannot reset port 1!?
1 USB Device(s) found
USB1: USB EHCI 1.00
scanning bus 1 for devices… 1 USB Device(s) found
scanning usb for storage devices… 0 Storage Device(s) found
=> usb info
1: Hub, USB Revision 2.0
– u-boot EHCI Host Controller
– Class: Hub
– PacketSize: 64 Configurations: 1
– Vendor: 0x0000 Product 0x0000 Version 1.0
Configuration: 1
– Interfaces: 1 Self Powered 0mA
Interface: 0
– Alternate Setting 0, Endpoints: 1
– Class Hub
– Endpoint 1 In Interrupt MaxPacket 2048 Interval 255ms
2: Hub, USB Revision 2.0
– u-boot EHCI Host Controller
– Class: Hub
– PacketSize: 64 Configurations: 1
– Vendor: 0x0000 Product 0x0000 Version 1.0
Configuration: 1
– Interfaces: 1 Self Powered 0mA
Interface: 0
– Alternate Setting 0, Endpoints: 1
– Class Hub
– Endpoint 1 In Interrupt MaxPacket 2048 Interval 255ms
下一步是 fatload usb 0:1 XXX, 從網路上抓個例子 [2].
fatload usb 0:1 0x1000000 launchu3.exe
也就是想把 launchu3.exe 載入到 0x1000000, 這個動作會失敗. 我想起 FAE 跟客戶說, 那個 0:1 不一定是 0:1, 要試試看別的組合. 到底是什麼組合呢? 第一個參數是 device, 第二個參數是 partition. 我們可以根據 usb start 或是 usb reset, usb info 的結果來決定參數. 我選的指令是這個, 簡簡單單, 就算不下參數都可以, 下參數還可以從 0 開始盲測, 哈!
usb part 0
看到 partition table 之後, 找到 device 也沒問題了. 但是 fatload 依然不成功. Console 無情地吐出:
** Unable to use usb 0:1 for fatload **
** Invalid boot device **
這時我發現 usb part 的結果會有一個 type 的數字. 例如 ref [3] 上說的.
Marvell>> usb part 0
Partition Map for USB device 0 -- Partition Type: DOS
Partition Start Sector Num Sectors Type
1 2048 317440 83
2 319488 3211264 83
3 3532798 499714 5 Extd
5 3532800 499712 82
可以看出每個 partition 都有一個 type, 其中 83h 就是 EXT2/EXT4 的 file system, 82h 是 swap space. 而我的 USB 呈現的是 type 7h, 這表示它的格式是 ExFat. 啊! 難怪認不到, 沒 port driver. 立馬換個 FAT32 的隨身碟, type 變成 bh, 就 OK 了. 至於那一種 type 對應到哪一種 file system 呢? 可以參考 WIKI 上的 partition type [4], WIKI 內容真是豐富啊!
[ref]
1. https://community.freescale.com/thread/327088
2. http://blackfin.uclinux.org/doku.php?id=bootloaders:u-boot:usb
3. http://www.cyrius.com/debian/kirkwood/sheevaplug/troubleshooting/
記得一開始是有實做更簡單的指令的,這樣是不需求自己打usb start和fatload的.
試試看還work不work吧?
> go ru
會找插在U2的FAT大拇哥,記得擺的檔案要跟環境變數中預定義的那4個檔名一模一樣.
哈哈, Stanely 大現身, 明天來試試~~
go ru 可以用, 不過它預設走 NAND, 所以不合用.
>>> go ru 可以用, 不過它預設走 NAND, 所以不合用.
我記得可以改uboot env變數,把裡頭nand的字眼改成emmc就可以囉.
OK! 感謝 Stanely!