android boot process from power on

來源:互聯網
上載者:User

聲明:

  原文地址: http://www.androidenea.com/2009/06/android-boot-process-from-power-on.html ,本文章是在基於該文章的翻譯,翻譯的不好,請笑納 -):

 

1. Power on and boot ROM code execution      
    開機並執行 boot ROM 代碼

    

At power on the CPU will be in a state where no initializations have been done. Internal clocks are not set up and the only memory available is the internal RAM. 
When power supplies are stable the execution will start with the Boot ROM code. This is a small piece of code that is hardwired in the CPU ASIC. 

才開機時,CPU 處於未初始化狀態,還沒有設定內部時鐘,僅僅只有內部 RAM 可用。當電源穩定後會開始執行 BOOT ROM 代碼,這是一小塊代碼被寫入程式碼在 CPU ASIC 中。

  • A. The Boot ROM code will detect the boot media using a system register that maps to some physical balls on the asic. 
        This is to determine where to find the first stage of the boot loader.
        Boot ROM 代碼會引導 boot 媒介使用系統寄存器映射到 ASIC 中一些物理地區,這是為了確定哪裡能找到 boot loader 的第一階段

  • B. Once the boot media sequence is established the boot ROM will try to load the first stage boot loader to internal RAM. 
        Once the boot loader is in place the boot ROM code will perform a jump and execution continues in the boot loader.
        一旦 boot 媒介順序確定,boot ROM 會試著裝載 boot loader 的第一階段到內部 RAM 中,一旦 boot loader 就位,boot ROM 代碼會跳到並執行 boot loader

 

2. The boot loader

The boot loader is a special program separate from the Linux kernel that is used to set up initial memories and load the kernel to RAM. 
On desktop systems the boot loaders are programs like GRUB and in embedded Linux uBoot is often the boot loader of choice. 
Device manufacturers often use their own proprietary boot loaders. 

boot loader 是一個特殊的獨立於 Linux 核心的程式,它用來初始化記憶體和裝載核心到 RAM 中,案頭系統的 boot loader 程式有 GRUB,嵌入式系統常用 uBoot,
裝置製造商常常使用自己專有的 boot loader 程式。

 

  • A. The first boot loader stage will detect and set up external RAM.
        boot loader 第一階段會檢測和設定外部 RAM

  • B. Once external RAM is available and the system is ready the to run something more significant the first stage will load the main boot loader and place it in external RAM.
        一旦外部 RAM 可用,系統會準備裝載主 boot loader,把它放到外部 RAM 中

  • C. The second stage of the boot loader is the first major program that will run. This may contain code to set up file systems, additional memory, 
        network support and other things.On a mobile phone it may also be responsible for loading code for the modem CPU and setting up low level memory 
        protections and security options.

        boot loader 第二階段是啟動並執行第一個重要程式,它包含了設定檔案系統,記憶體,網路支援和其他的代碼。在一個行動電話上,
        也可能是負責載入數據機的CPU代碼和設定低層級的記憶體保護和安全選項

  • D. Once the boot loader is done with any special tasks it will look for a Linux kernel to boot. It will load this from the boot media 
        (or some other source depending on system configuration) and place it in the RAM. 
        It will also place some boot parameters in memory for the kernel to read when it starts up.
        一旦 boot loader 完成這些特殊任務,開始尋找 linux 核心,它會從 boot 媒介上裝載 linux 核心(或者其他地方,這取決於系統配置),把它放到 RAM 中,
       它也會在記憶體中為核心替換一些在核心啟動時讀取的啟動參數

  • E. Once the boot loader is done it will perform a jump to the Linux kernel, usually some decompression routine, and the kernel assumes system responsibility.
        一旦 boot loader 完成會跳到 linux 核心,通常通過解壓程式解壓核心檔案,核心將取得系統許可權

     

3. The Linux kernel
  linux 核心

The Linux kernel starts up in a similar way on Android as on other systems. It will set up everything that is needed for the system to run. Initialize interrupt controllers,
set up memory protections, caches and scheduling.
linux 核心在 android 上跟在其他系統上的啟動方式一樣,它將設定系統運行需要的一切,初始化中斷控制器,設定記憶體保護,快取和調度

  • A. Once the memory management units and caches have been initialized the system will be able to use virtual memory and launch user space processes.
      一旦記憶體管理單元和快取初始化完成,系統將可以使用虛擬記憶體和啟動使用者空間進程

  • B. The kernel will look in the root file system for the init process (found under system/core/init in the Android open source tree) and launch it as the initial user space process.
      核心在根目錄尋找初始化程式(代碼對應 android source tree: /system/core/init ),啟動它作為初始化使用者空間進程

     

4. The init process
  初始化進程

The init process is the "grandmother" of all system processes. Every other process in the system will be launched from this process or one of its descendants.
初始化進程是所有其他系統進程的 “祖母 ”,系統的每一個其他進程將從該進程中或者該進程的子進程中啟動

 

  • A. The init process in Android will look for a file called init.rc. This is a script that describes the system services, file system and other parameters that need to be set up. 
        The init.rc script is placed in system/core/rootdir in the Android open source project. 
        初始化進程會尋找 init.rc 檔案,init.rc 指令檔描述了系統服務,檔案系統和其他需要設定的參數,該檔案在代碼:system/core/rootdir

  • B. The init process will parse the init script and launch the system service processes.
        初始化進程解析 init 指令碼,啟動系統服務進程

     

5. Zygote and Dalvik

The Zygote is launched by the init process and will basically just start executing and and initialize the Dalvik VM.
Zygote 被初始化進程啟動,開始運行和初始化 dalvik 虛擬機器

6. The system server
    系統服務
The system server is the first java component to run in the system. It will start all the Android services such as telephony manager and bluetooth. 
Start up of each service is currently written directly into the run method of the system server. The system server source can be found in the file :
frameworks/base/services/java/com/android/server/SystemServer.java in the open source project.

系統服務是在系統中啟動並執行第一個 java 組件,它會啟動所有的 android 服務,比如:電話語音,藍芽服務,每個服務的啟動被直接寫在 SystemServer.java 這個類的 run 方法裡面
代碼: frameworks/base/services/java/com/android/server/SystemServer.java

7. Boot completed
  啟動完成

 Once the System Server is up and running and the system boot has completed there is a standard broadcast action called ACTION_BOOT_COMPLETED. 
  一旦系統服務啟動並運行,android 系統啟動就完成了,同時發出 ACTION_BOOT_COMPLETED 廣播

 

 

 

 

 

 

 

 

 

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.