2010年11月30日 星期二

[sheeva plug] compiler..

其實 sheevaplug 上 SD 卡在 uboot 下讀不出來的問題, 困擾了我很久, 有篇文章之前看過卻沒有看到文章裡的重點...
"Are you refer loading kernel give you crc error or compile give you crc error?
my gcc is armv5tel-softfloat-linux-gnueabi-gcc (Gentoo 4.3.3-r2 p1.2, pie-10.1.5) 4.3.3 I am not familiar the one you refer to. (I know nothing about compiler to be honest) what I did notice is that the code seems to be very sensitive what compile is used or toolchain. for example the one posted in this fourms does not work for me, I always get error during loading kernel in both FAT and EXT2 case, however I use the source compile myself it begin work for FAT (as EXT2 have bug in code so it does not work for me)"
我簡單翻譯一下. 如果 u-boot 是用 SDK 內的 arm-mv5sft-linux-gnueabi-??? 編譯的話, SDcard 讀取動作不管是 fat 還是 ext2 通通都會 fail, 但如果換成 armv5tel-softfloat-linux-gnueabi-gcc 的話, 以上的問題就解決了.

這還是後來客戶 email 給我一封信裡提醒了我這點, 但我去找 armv5tel-softfloat-linux-gnueabi-gcc 這個東西, 發現它好像是給 ARMv5 平臺專用的, 沒有看到可以在 x86 上跑的版本. 幾經搜尋我才發現到有這個社群專門在為 ARM 做跨平臺編譯套件, 包括 ARM 版的 fedora. 而使用它們做的 ARM compiler 後, 問題真的解掉了.

於是我講一下我在 CentOS 5.4 上用的做法, 其實很簡單, 比去 google 找那些問題簡單很多..
1.Marvell sdk 裡的 nativefs 跟 devfs 還是最好先編過一遍, 這時可以用 arm-mv5sft-linux-gnueabi- 的編譯器無所謂.
2.照網頁所寫的, 給 yum 安裝的參考網頁路徑.
3.直接 yum -y install armv5tel-redhat-linux-gnueabi-gcc 順路裝一大票亂七八糟相關套件.
4.Marvell 版 u-boot 3.4.27 (原本是 u-boot 1.1.4) 內 Makefile 裡, 搜尋 "arm-mv5sft-linux-gnueabi-" 找第二個前面 label 是 CSL 的 (在 2034 行付近, 不是前面那個) 改成:

CSL = armv5tel-redhat-linux-gnueabi-

這樣就好, 就可以回 u-boot 裡編譯整個 u-boot image. 但原本的 sdk 要留, 因為編譯過程中會 link 到那個 sdk 裡面的東西.

然後其它的套件可以依舊延用原本的 arm-mv5sft-linux-gnueabi-, 只有 u-boot 這個因為 code 的關係要改 compiler...

我還會再追蹤看看 u-boot 中是哪段 source 有問題, 畢竟裝好幾個 compiler 很不胡蘇...

沒有留言: