日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux 内核入口地址,linux内核的加载地址和入口地址

發布時間:2025/3/12 linux 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux 内核入口地址,linux内核的加载地址和入口地址 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

編譯完內核之后,會產生zImage,而把它直接導入0x30008000,會出現Bad Magic Number.

查明是需要將內核加一個0x40大小的頭,由mkimage工具來添加.mkimage在編譯u-boot時在u-boot-1.1.6/tools下生成,可以為編譯的內核添加頭信息的.在bootm命令中會解析這個頭,獲得參數.zImage在編譯內核時,在arch/arm/boot目錄下生成。我們需要把zImage用mkimage工具處理一下。

mkimage參數的意義如下:

-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目錄下,在此目錄下,執行如下命令:

./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引導的地址是同一個地址,且是mkimage的參數 -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

入口地址和加載地址一樣的時候,

我在做這個嘗試的時候,導致開發板重啟……。

現在能正確引導內核啦,但是GEC2410的網卡芯片是CS8900A的芯片,要能正確的啟動Linux系統,還必須添加CS8900A的驅動……

總結

以上是生活随笔為你收集整理的linux 内核入口地址,linux内核的加载地址和入口地址的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。