android kernel 初始化 1
来源:互联网 发布:淘宝卖二手货 编辑:程序博客网 时间:2024/05/22 12:19
The Android boot process from power on
Since mobile platforms and embedded systems has some differences compared to Desktop systems in how they initially start up and boot. This post will discuss the initial boot stages of an Android phone in some detail. Since we have used the Beagle Board as reference in some previous examples any specifics here are related to a similar system.
1. Power on and boot ROM code execution
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. For more information on boot ROM and configurations study the initalization chapter in
the Omap 3530 TRM .
- 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.
- 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.
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. The requirements on a boot loader for Linux running on an ARM system can be found in the Booting document under /Documentation/arm
in the kernel source tree.
- A. The first boot loader stage will detect and set up external 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.
- 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.
- 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.
- 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.
3. The Linux kernel
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.
- 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.
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.
- B. The init process will parse the init script and launch the system service processes.
5. Zygote and Dalvik
The Zygote is launched by the init process and will basically just start executing and and initialize the Dalvik VM.
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.
7. Boot completed
Added this part to the post on 20090831 since it is very useful and something I should not have left out from the beginning. Once the System Server is up and running and the system boot has completed there is a standard broadcast action called ACTION_BOOT_COMPLETED. To start your own service, register an alarm or otherwise make your application perform some action after boot you should register to receive this broadcast intent.
The separate boot steps and possible places to add your own functionality are covered in more detail in separate posts.
- android kernel 初始化 1
- android kernel 初始化 2
- android kernel控制台初始化过程
- android kernel控制台初始化过程
- Android Kernel (1) - Basic
- kernel初始化调试
- linux kernel初始化分析
- Linux kernel 初始化加速
- 内核初始化kernel.asm
- 内核初始化kernel.asm
- Linux Kernel 互斥量初始化
- Linux 学习笔记1 --- kernel初始化以及module_init(x)解析
- Android Kernel (3) - Kernel Bootstrapping Part 1 - Zygote
- kernel中bluetooth的初始化
- kernel中bluetooth的初始化
- osv kernel 内存初始化管理
- kernel网络协议栈初始化
- kernel中efi变量初始化
- 列表 Handler 读取管理者字段
- do…while我是居然这样用!
- How to Convert a Single-Instance ASM to Cluster ASM [ID 452758.1]
- 企业IT应用的优先级甄别
- 防止登陆页面显示到mainFrame窗体里
- android kernel 初始化 1
- 我在名牌大学毕业后的经历
- 如何向Platform builder 添加新的BSP
- PHP 显示页面以及数据库中出现乱码问题的解决方式
- How it works: Linux audio explained--如何工作:Linux音频工作介绍
- 最近辞职了,炒股炒的一沓糊涂,发帖留念!
- Singleton模式
- 页面EnableViewState=false遇到的麻烦与解决办法
- ftp脚本