久久婷婷香蕉热狠狠综合,精品无码国产自产拍在线观看蜜,寡妇房东在做爰3,中文字幕日本人妻久久久免费,国产成人精品三上悠亚久久

Hi,歡迎來到嵌入式培訓高端品牌 - 華清遠見教育科技集團<北京總部官網>,專注嵌入式工程師培養15年!
當前位置: > 華清遠見教育科技集團 > 嵌入式學習 > 講師博文 > U-Boot啟動內核分析
U-Boot啟動內核分析
時間:2017-01-09作者(zhe):華清(qing)遠見

先來引用一下這篇介紹“ARM Linux內核啟動要求”的文章ARM Linux Kernel Boot Requirements,是ARM Linux內核的維護者Russell King寫的。 
         CPU register settings 
        o r0 = 0. 
        o r1 = machine type number. 
        o r2 = physical address of tagged list in system RAM. ? CPU mode 
        o All forms of interrupts must be disabled (IRQs and FIQs.) 
        o The CPU must be in SVC mode. (A special exception exists for ?Angel.)

Caches, MMUs 
        o The MMU must be off. 
        o Instruction cache may be on or off. 
        o Data cache must be off and must not contain any stale data. ? Devices 
        o DMA to/from devices should be quiesced. ? The boot loader is expected to call the kernel image by jumping directly to the first instruction of the kernel image.

U-boot針對arm體系結(jie)構(gou)的CPU的do_bootm_linux()函數(shu)的實現就是(shi)在(zai)arch/arm/lib/bootm.c這個文(wen)件當中。

可以看到從arch/arm/lib/bootm.c中的第96 行開始就是do_bootm_linux()函數的實(shi)現。

其(qi)中第101行聲明(ming)了(le)這樣一個函數指針kernel_entry:

void (*kernel_entry)(int zero, int arch, uint params);

看(kan)看(kan)它的(de)名字和參(can)數的(de)命(ming)名我(wo)們 也可(ke)以猜到這個其實就是(shi)內(nei)核(he)的(de)入(ru)口函(han)數的(de)指針了。幾個參(can)數的(de)命(ming)名也說明了上文提到的(de)ARM Linux內(nei)核(he)啟(qi)動要求的(de)第一(yi)條,因為根據ACPS(ARM/Thumb Procedure Call Standard)的(de)規定,這三個參(can)數就是(shi)依次使用r0,r1和r2來(lai)傳遞的(de)。

接(jie)下(xia)來(lai)第123行就是(shi)給這個(ge)函數指(zhi)針賦(fu)值:

kernel_entry= (void (*)(int, int, uint))images->ep;

可以看到kernel_entry被 賦值為images->ep,即內核的入口(kou)點(Entry Point)。

后是(shi)對內核入口函數(shu)的調用(yong),發(fa)生在第(di)155行:

kernel_entry(0, machid, bd->bi_boot_params);

這(zhe)里machid = bd->bi_arch_number調用的時候對參數進行賦(fu)值(zhi),r0=0,r1=bd->bi_arch_number,r2=bd->bi_boot_params,一個都不(bu)少。至此U-Boot的使命完成,開始進入ARM Linux的地(di)盤。

發表評論
評論列表(網友評論僅供網友表達個人看法,并不表明本站同意其觀點或證實其描述)