2012-02-20 68 views
2

我有一個將內核從舊SH4移植到新SH4的問題。請讓我展示他們之間的差異。Linux內核啓動在Uncompressing Linux中停止...好吧,啓動內核

[老SH4]
引導加載程序:2.0的RedBoot
內核版本:2.4

[新SH4]
引導加載程序:u-boot的v2009.03
內核版本:2.6

在舊的SH4中,很多源代碼是基於內核2.4開發的,因此將內核2.4移植到新的SH4比在內核2.6中重新編譯源代碼更容易。所以我將mkimage應用於爲舊SH4開發的zImage,如下所示。

mkimage -A sh -O linux -T kernel -C none -a 0x8c210000 -e 0x8c210000 -n 'Old kernel' -d zImage uImage 

此圖像在新SH4上加載,如下所示。

tftpboot 8c800000 uImage 
cp.b $(fileaddr) a0100000 $(filesize) 
bootm a0100000 

但是,在「解壓Linux ...好,啓動內核」並掛起後,啓動停止。我發現無限循環發生在kernel/head.S的下面幾行,但是我認爲這些行沒有問題,因爲kernel/head.S不是自定義的,它可以在舊的SH4上運行。

!    Clear BSS area 
    mov.l 3f, r1 ! __bss_start 
    add  #4, r1 
    mov.l 4f, r2 ! _end 
    mov  #0, r0 
9: cmp/hs r2, r1 
    bf/s 9b  ! while (r1 < r2) 
    mov.l  r0,@-r2 

因此,我猜這個問題來自舊的和新的SH4之間的環境差異。在舊的SH4中,我執行fconfig命令並設置變量,如下所示。

Load Linux Kernel & File System: true 
Linux Kernel Destination address: 0x8c210000 
Linux Kernel Source address: 0x80140000 
Linux Kernel Size: 0x100000 
RAM disk Destination address: 0x8c360000 
RAM disk Source address: 0x80140000 
RAM disk Size: 0x400000 
Modify Linux Kernel Parameter: true 
Linux Kernel base address: 0x8c001000 
Linux Kernel ENTRY address: 0x8c210000 
Linux Kernel INITRD size: 0xc00000 
Linux Kernel INITRD start address: 0x360000 
Linux Kernel loader type: 1 
Linux Kernel mount root read only: 1 
Linux Kernel original root device: 0x100 
Linux Kernel RAM disk flags: 0 
Linux Kernel Enable Virtual Terminal Console: false 

我想我可以在新的SH4上設置這些參數,雖然u-boot沒有fconfig命令。但是我找不到如何設置Linux Kernel Source地址和Linux內核基址的參數。這與掛起問題有關嗎?或者關於接下來應該檢查什麼的建議將會很有幫助,因爲我是Linux嵌入式系統的新手。

感謝您的幫助。

[編輯]
下面的信息被添加來顯示u-boot上的printenv結果。

bootcmd =上
bootm a0100000
的bootdelay = 2
波特率= 115200
網絡掩碼255.255.255.0 =
IPADDR = 192.168.1.2
SERVERIP = 192.168.1.1
gatewayip = 0.0.0.0
ICACHE bootargs = console = ttySC1,115200,N,8 mem = 32M ether = 8,0x1300,0,0,eth0 video = e1356fb:system:ms104sh4,display:crt,bpp:8,800x600 @ 60
stdin = serial
stdout = serial
標準錯誤=串行

+0

如果你有機會到預引導envirnoment,你可以使用的uboot'setenv'命令設置這些。見http://www.denx.de/wiki/view/DULG/UBootEnvVariables – 2012-02-21 01:30:34

+1

你確定它是一個無限循環?什麼是寄存器值?您發佈的代碼是清除RAM區域。如果內核加載地址不正確,則可能會擦除代碼正在運行的內存位置。儘管在PowerPC平臺上我有類似的問題。我的問題原來是Linux配置文件中的不正確的基地址。 – 2012-02-21 04:52:01

+0

致J-16 SDiZ:感謝您的評論。首先,我認爲我可以通過u-boot環境變量設置LINUX基地址和源地址,但沒有找到變量。也許我必須以不同於env變量的方式設置它們。 – 2012-02-21 12:23:23

回答

1

我從來沒有與SH4工作,但是這有助於我過去:http://www.denx.de/wiki/view/DULG/LinuxPostMortemAnalysis

+0

謝謝你的回答。我在新的SH4上檢查了log_buf地址,發現了一些錯誤。它說像「RedBoot分區解析不可用」。看起來舊的SH4內核依賴於redboot,並且我在drivers/mtd/maps上找到它。我不知道這個錯誤是否與掛起有關,但這可能是我必須處理下一個以及Linux基址設置的地方。 – 2012-02-21 12:40:10

+0

實際上,你應該可以編輯UBoot將要使用的Linux基地址,試着使用'printenv'命令並查找'bootcmd'參數,它在我的一個系統中看起來像這樣:'bootcmd = bootm fc080000 - fc060000','bootm'的第一個參數是映像的地址,你的'bootcmd'看起來不一樣。但是,由於您收到RedBoot錯誤,因此基址可能不是問題:)如果運行'printenv'併發布結果,那可能會有所幫助。 – mikhail 2012-02-21 15:10:41

+0

感謝您的回覆。這是printenv的結果。 bootargs(和一些ip相關的變量)被修改爲使其與舊的SH4相同environment.bootcmd = icache on; bootm a0100000 bootdelay = 2 baudrate = 115200 netmask = 255.255.255.0 ipaddr = 192.168.1.2 serverip = 192.168.1.1 gatewayip = 0.0.0.0 bootargs = console = ttySC1,115200,N,8 mem = 32M ether = 8,0x1300,0, 0,eth0 video = e1356fb:system:ms104sh4,display:crt,bpp:8,800x600 @ 60 stdin = serial stdout = serial
stderr = serial – 2012-02-23 02:11:24