我本仁慈,奈何苍天不许
分类: LINUX
2013-12-17 14:58:28
内核的启动第一条代码:
zImage Image
Image的第一条代码在哪个文件中:arch/arm/kernel/head.S
setmode PSR_F_BIT | PSR_I_BIT | SVC_MODE, r9
1)、ARM进入到SVC模式
2)、get processor id 检验Image内核是否支持该CPU,如果不支持,error 'p'
3)、lookup_machine_type 检验Image内核是否支持该machine,如果不支持,error 'a'
4)、创建MMU
5)、跳到C语言初始化内核的代码
init/main.c : start_kernel()
***************************************
if (mdesc->map_io)
mdesc->map_io(mdesc, tags, &from, &meminfo);
***************************************
--------------------------------------------------
ARM的CPU启动要求:
This is normally called from the decompressor code. The requirements
* are: MMU = off, D-cache = off, I-cache = dont care, r0 = 0,
* r1 = machine nr, r2 = atags pointer.
---------------------------------------------------
配置:选板子
在mach-s5pc100.c
MACHINE_START(SMDKC100, "SMDKC100")
/* Maintainer: Byungho Min <> */
.phys_io = S3C_PA_UART & 0xfff00000,
.io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc,
.boot_params = S5P_PA_SDRAM + 0x100,
.init_irq = s5pc100_init_irq,
.map_io = smdkc100_map_io,
.init_machine = smdkc100_machine_init,
.timer = &s3c24xx_timer,
MACHINE_END
#define MACHINE_START(_type,_name) \
static const struct machine_desc __mach_desc_##_type \
__used \
__attribute__((__section__(".arch.info.init"))) = { \
.nr = MACH_TYPE_##_type, \
.name = _name,
#define MACHINE_END \
};
static const struct machine_desc __mach_desc_SMDKC100 = {
.nr = MACH_TYPE_SMDKC100,
.name = "SMDKC100",
#define MACH_TYPE_SMDKC100 1826
vi :
ctrl+] jump
ctrl+t back
vi -t symbol
start_kernel();
setup_arch(&command_line);
bootloader的go命令修改了什么
参数传递
struct tag : new
struct param_struct : old
内核 : 虚拟地址
y = f(x) x : 虚拟地址 y : 物理地址 f : mmu
table :
分页方式