mooc课程精选,成品人片观看入口众乐乐,久久久久人妻一区精品性色av,苍兰诀大结局是什么,白丝美女被狂躁免费视频网站

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

先來引用一下這篇介紹“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體系結構的CPU的do_bootm_linux()函數的實現就是在arch/arm/lib/bootm.c這個文件當中。

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

其中第101行聲明了這樣一個函數指針kernel_entry:

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

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

接下來第123行就是給這個函數指針賦值:

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

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

后是對內核入口函數的調用,發生在第155行:

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

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

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