攀升·Uranus


Something Different,Something New
数据加载中……

Linux Kernel Image: initialize

1. 编译kernel  
      编译linux时其实会又很多产物,因为android让我接触了linux 内核的一些资料。

贴最后一段make的Log
$ make ARCH=arm CROSS_COMPILE=/dev/.....
...   < many build steps omitted for clarity>
  LD          vmlinux                                                  Kernel proper,EFL format,最原始的kernel
  SYSMAP      System.map                                 
  OBJCOPY     arch/arm/boot/Image                     去掉 symbols, notes, and comments.
  Kernel:     arch/arm/boot/Image is ready                objcopy to generate a binary file, Image   
  AS          arch/arm/boot/compressed/head.o         ARM-specific startup code generic to ARM processors,与arm相关的一些重要的启动时要用
  GZIP        arch/arm/boot/compressed/piggy.gz      gzip打包
  AS          arch/arm/boot/compressed/piggy.o        加载piggy.S,initializes the processor,required memory regions
  CC          arch/arm/boot/compressed/misc.o        Routines used for decompressing the kernel image 
  AS          arch/arm/boot/compressed/head-xscale.o   
  AS          arch/arm/boot/compressed/big-endian.o
  LD          arch/arm/boot/compressed/vmlinux         这容易搞乱,这个vmlinux和第一个Kernel proper是不一样的。
  OBJCOPY     arch/arm/boot/zImage                     Final composite kernel image,loaded by bootload.
  Kernel:     arch/arm/boot/zImage is ready
boot-strap Loader :misc.o head-xscale.o big-endian.o

2. Initialization
    Power on-> bootloader ->head-xscale.o(boot-strap )-> head.o(vmlinux)->main.o(kernel)

3. start_kernel();
   启动Init()process.init初始化之前注册的函数,最后释放资源。内核级别启动常报的错就是“No init found.  Try passing init= option to kernel”
这主要是因为通过run_init_process执行系统级别的/init时失败,返回。如果成功,该函数不会返回。
if (execute_command) {
run_init_process(execute_command);
printk(KERN_WARNING "Failed to execute %s.  Attempting "
"defaults...\n", execute_command);
}
run_init_process("/sbin/init");
run_init_process("/etc/init");
run_init_process("/bin/init");
run_init_process("/bin/sh");
panic("No init found.  Try passing init= option to kernel.");

PS:
start_kernel(): .../init/main.c 
Most of the Linux kernel initialization takes place in this routine
setup_arch(&command_line):  start_kernel() function is the call to setup_arch(), .../arch/arm/kernel/setup.c

posted on 2009-07-11 17:40 攀升 阅读(1582) 评论(2)  编辑 收藏 引用 所属分类: Linux

评论

# re: Linux Kernel Image: initialize  回复  更多评论   

bucuo,收藏一下啦
2009-07-11 18:40 | 99网上书城

# re: Linux Kernel Image: initialize  回复  更多评论   

楼上的不要起哄!
2009-07-12 23:50 | 小米

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理