国产成人精品三级麻豆,色综合天天综合高清网,亚洲精品夜夜夜,国产成人综合在线女婷五月99播放,色婷婷色综合激情国产日韩

Hi,歡迎來到嵌入式培訓(xùn)高端品牌 - 華清遠(yuǎn)見教育科技集團(tuán)<北京總部官網(wǎng)>,專注嵌入式工程師培養(yǎng)15年!
當(dāng)前位置: > 華清遠(yuǎn)見教育科技集團(tuán) > 嵌入式學(xué)習(xí) > 講師博文 > U-Boot啟動(dòng)內(nèi)核分析
U-Boot啟動(dòng)內(nèi)核分析
時(shí)間:2017-01-09作者:華清遠(yuǎn)見

先來引用一下這篇介紹“ARM Linux內(nèi)核啟動(dòng)要求”的文章ARM Linux Kernel Boot Requirements,是ARM Linux內(nèi)核的維護(hù)者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針對(duì)arm體系結(jié)構(gòu)的CPU的do_bootm_linux()函數(shù)的實(shí)現(xiàn)就是在arch/arm/lib/bootm.c這個(gè)文件當(dāng)中。

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

其中第101行聲明了這樣一個(gè)函數(shù)指針kernel_entry:

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

看看它的名字和參數(shù)的命名我們 也可以猜到這個(gè)其實(shí)就是內(nèi)核的入口函數(shù)的指針了。幾個(gè)參數(shù)的命名也說明了上文提到的ARM Linux內(nèi)核啟動(dòng)要求的第一條,因?yàn)楦鶕?jù)ACPS(ARM/Thumb Procedure Call Standard)的規(guī)定,這三個(gè)參數(shù)就是依次使用r0,r1和r2來傳遞的。

接下來第123行就是給這個(gè)函數(shù)指針賦值:

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

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

后是對(duì)內(nèi)核入口函數(shù)的調(diào)用,發(fā)生在第155行:

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

這里machid = bd->bi_arch_number調(diào)用的時(shí)候?qū)?shù)進(jìn)行賦值,r0=0,r1=bd->bi_arch_number,r2=bd->bi_boot_params,一個(gè)都不少。至此U-Boot的使命完成,開始進(jìn)入ARM Linux的地盤。

發(fā)表評(píng)論
評(píng)論列表(網(wǎng)友評(píng)論僅供網(wǎng)友表達(dá)個(gè)人看法,并不表明本站同意其觀點(diǎn)或證實(shí)其描述)