2009年9月2日 星期三

Trace U boot 如何載入zImage 與ramdisk 來啓動Linux系統

在U boot中使用bootm(ex:bootm 20008000 20800000)指令來執行kernel

"common/cmd_bootm.c"的do_bootm()為該指令的entry point,其主要的工作如下:

(1) 最主要是取得uImage header (uImage 前0x40 bytes),該header主要紀錄二個重要資訊 OS ID (IH_OS_LINUX)與kernel entry point address (zImage) , 該header是由tools/mkimage產生的:

tools/mkimage -A arm -O linux -T kernel -C none -a 0x20008000 -e
0x20008040 -n "kernel" -d zImage zImage-uboot

tools/mkimage -A arm -O linux -T ramdisk -C none -a 0x20800000 -n
"ramdisk" -d ramdisk.img ramdisk-uboot.img


(2) 再將該header與load address of ramdisk-uboot (argv[2])傳入do_bootm_linux() (lib_arm/bootm.c),由分析header取得 kernel entry point address (function pointer), 再透過boot_get_ramdisk() (common/image.c)取得ramdisk start address(rd_start) (即the load address of ramdisk-uboot+header size(0x40))和 ramdisk end address(rd_end)(rd_start+rd_len, 執行mkimage時會將 rd_len值assign 給image header ( image_header) 的 ih_size ( Image Data Size)) , 一但知道ramdisk start address和ramdisk end address就可以設定ATAG 的INITRD TAG, 再設定其他的ATAG (ex: CMDLINE TAG) , 就可以知道kernel entry point 的 paramters: paramter 1=0 (r0), paramter 2=machine id(r2) , parameter 3=ATAG的位置(r3) , 最後就執行kernel entry point。

4 則留言:

匿名 提到...

[p]Typically, Clarisonic products are [url=http://www.outletclarisonic.com]clarisonic mia[/url] sold to healthcare and beauty establishments . Go through the google . going from freakishly oily to so painfully dry that I needed to buy extra-moisturizing creams that I隆炉d ordinarily never buy because my skin is, you know, freakishly oily) and it is NOT normal for one to [url=http://www.outletclarisonic.com]clarisonic mia 2[/url] 隆掳break out隆卤 after using this product . The Clarisonic Mia wash brush start two weeks report
Last month saw a discussion at the End of the World Post Clarisonic [url=http://www.outletclarisonic.com]clarisonic brush[/url] wash brush, flew grass . A lot of people have got epidermis issues for instance whiteheads which [url=http://www.outletclarisonic.com]clarisonic mia outlet[/url] can be very difficult to be able to get over . In addition, your skin layer tiny holes can look a whole lot more compact . C l a r i s o n i c M i a w a s h b r u s h [url=http://www.outletclarisonic.com]clarisonic mia 2 sale[/url] r e g u l a r e d i t i o n

0P r o d u c t N a m e 0 C l a r i s o n i c M i a ( T M ) S k i n C l e a n s i n g S y s t e m

P r o d u c t C o n f i g u r a t i o n 1 s t a l l s a v a i l a b l e C l a r i s o n i c M i a c l e a n s i n g b r u s h , 1 s e n s i t i v e b r u s h h e a d , 3 0 m l C l e a n s e r a t h e g l o b a l p o r t a b l e c h a r g e r . The benefit? Well-moisturized skin looks younger and healthier than dry skin . 2.[/p]

匿名 提到...

Hey just wаnted to give you a quick heaԁs
up. The text in your content seem to be running off thе scгeen in Ϲhrome.
I'm not sure if this is a format issue or something to do with internet browser compatibility but I figured I'd post to let уou
κnow. Thе design anԁ style look great thоugh!
Ηοpe уou get the problem fixed
soon. Kudos

my page: resistor color code calculator

匿名 提到...

At thіs time іt loοks like Worԁpresѕ is the preferred blοgging platform available right noω.
(fгom what ӏ've read) Is that what you'rе
using on youг blog?

Also visit my web-ѕite: http://www.Buscoachaustralia.com.Au/acceptance_of_terms.html

匿名 提到...

Hаving read this I thought it was extremеlу еnlightenіng.
I аpprecіatе you tаking the time and enеrgy to put thіs informative artіcle together.

I onсe again fіnԁ myself ѕрending way tοо muсh tіmе both reading and commenting.
But sо ωhat, it ωas ѕtіll worthwhіlе!


my wеb ѕite; varistors