U-Boot启动内核分析
来源:互联网 发布:axure rp8 mac 注册码 编辑:程序博客网 时间:2024/04/28 20:32
U-Boot启动内核分析
先来引用一下这篇介绍“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的地盘。
- U-Boot启动内核分析
- U-Boot启动内核分析
- U-Boot启动内核分析
- U-Boot启动内核分析
- U-Boot启动内核分析
- U-Boot启动内核分析
- U-Boot启动内核分析
- U-Boot启动内核分析
- U-Boot启动内核分析
- U-Boot启动内核分析
- U-Boot启动引导内核分析(一)
- U-Boot启动引导内核分析(二)
- U-Boot启动引导内核分析(三)
- 转: U-Boot启动引导内核分析
- U-Boot启动引导内核分析
- U-boot 2011.09 启动内核分析
- <Linux>u-boot启动Linux内核分析
- u-boot启动内核
- vs2010 快捷键大全
- FAT12文件系统之引导扇区结构
- 最大公约数算法解析
- Xcode下用函数操作文本文件
- MongoDB组合索引的优化
- U-Boot启动内核分析
- StringTokenizer使用
- 欢迎大家的光临
- 详解Java反射机制实例
- 获取office版本
- 错误票据 - 蓝桥杯
- 电脑包的奇妙出现
- java性能优化笔记 - 03
- Porting Tp 问题总结