linux 内核入口地址,linux内核的加载地址和入口地址
編譯完內(nèi)核之后,會(huì)產(chǎn)生zImage,而把它直接導(dǎo)入0x30008000,會(huì)出現(xiàn)Bad Magic Number.
查明是需要將內(nèi)核加一個(gè)0x40大小的頭,由mkimage工具來添加.mkimage在編譯u-boot時(shí)在u-boot-1.1.6/tools下生成,可以為編譯的內(nèi)核添加頭信息的.在bootm命令中會(huì)解析這個(gè)頭,獲得參數(shù).zImage在編譯內(nèi)核時(shí),在arch/arm/boot目錄下生成。我們需要把zImage用mkimage工具處理一下。
mkimage參數(shù)的意義如下:
-A == set architecture to 'arch'
-O == set operating system to 'os'
-T == set image type to 'type'
-C == set compression type 'comp'
-a == set load address to 'addr' (hex)
-e == set entry point to 'ep' (hex)
-n == set image name to 'name'
-d == use image data from 'datafile'
-x == set XIP (execute in place)
首先可以把zImage拷貝到u-boot-1.1.6/tools目錄下,在此目錄下,執(zhí)行如下命令:
./mkimage -n 'linux-2.6.26' -A arm -O linux -T kernel -C none -a 0x30007fc0 -e 0x30008000 -d zImage uImage
輸出信息如下:
Image Name:linux-2.6.26
Created:Tue Jul 28 18:50:26 2009
Image Type:ARM Linux Kernel Image (uncompressed)
Data Size:1655648 Bytes = 1616.84 kB = 1.58 MB
Load Address: 0x30007FC0
Entry Point:0x30008000
可以看出加載地址是0x30007fc0,而入口地址是0x30008000.
GEC2410 #tftp 30008000 uImage
TFTP from server 192.168.0.50; our IP address is 192.168.0.100
Filename 'uImage'.
Load address: 0x30008000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
################################################################
done
Bytes transferred = 1655712 (1943a0 hex)
GEC2410 #bootm 30008000
## Booting image at 30008000 ...
Image Name:linux-2.6.26
Created:2009-07-2810:50:26 UTC
Image Type:ARM Linux Kernel Image (uncompressed)
Data Size:1655648 Bytes =1.6 MB
Load Address: 30007fc0
Entry Point:30008000
Verifying Checksum ... OK
OK
Starting kernel ...(卡死在這兒了)
GEC2410 #tftp 30008000 uImage
TFTP from server 192.168.0.50; our IP address is 192.168.0.100
Filename 'uImage'.
Load address: 0x30008000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
################################################################
done
Bytes transferred = 1655712 (1943a0 hex)
GEC2410 #bootm 30007fc0
## Booting image at 30007fc0 ...
Bad Magic Number
GEC2410 #tftp 30007fc0 uImage
TFTP from server 192.168.0.50; our IP address is 192.168.0.100
Filename 'uImage'.
Load address: 0x30007fc0
Loading: #################################################################
#################################################################
#################################################################
#################################################################
################################################################
done
Bytes transferred = 1655712 (1943a0 hex)
GEC2410 #bootm 30008000
## Booting image at 30008000 ...
Bad Magic Number
GEC2410 #
GEC2410 # tftp 0x30007fc0 uImage
TFTP from server 192.168.0.50; our IP address is 192.168.0.100
Filename 'uImage'.
Load address: 0x30007fc0
Loading: #################################################################
#################################################################
#################################################################
#################################################################
################################################################
done
Bytes transferred = 1655712 (1943a0 hex)
GEC2410 #bootm 30007fc0
## Booting image at 30007fc0 ...
Image Name:linux-2.6.26
Created:2009-07-2810:50:26 UTC
Image Type:ARM Linux Kernel Image (uncompressed)
Data Size:1655648 Bytes =1.6 MB
Load Address: 30007fc0
Entry Point:30008000
Verifying Checksum ... OK
XIP Kernel Image ... OK
Starting kernel ...
Uncompressing Linux............................................................................................................ done, booting the kernel.
………………….
(一大堆信息)
從上面可以看出,tftp下載的地址和bootm引導(dǎo)的地址是同一個(gè)地址,且是mkimage的參數(shù) -a 的地址,即加載地址,而不是入口地址。
./mkimage -n 'linux-2.6.26' -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d zImage uImage
Created:Tue Jul 28 19:21:15 2009
Image Type:ARM Linux Kernel Image (uncompressed)
Data Size:1655648 Bytes = 1616.84 kB = 1.58 MB
Load Address: 0x30008000
Entry Point:0x30008000
入口地址和加載地址一樣的時(shí)候,
我在做這個(gè)嘗試的時(shí)候,導(dǎo)致開發(fā)板重啟……。
現(xiàn)在能正確引導(dǎo)內(nèi)核啦,但是GEC2410的網(wǎng)卡芯片是CS8900A的芯片,要能正確的啟動(dòng)Linux系統(tǒng),還必須添加CS8900A的驅(qū)動(dòng)……
總結(jié)
以上是生活随笔為你收集整理的linux 内核入口地址,linux内核的加载地址和入口地址的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: xss挖掘思路分享_新手指南 | per
- 下一篇: mysql timestamp类型比较_