0769 发表于 2013-1-15 03:15:21

U-Boot启动分析C语言部分

                        U-Boot启动分析C语言部分
                                                                                                                                                                                      <div width="100%" style="margin: 15px;">                                                <div width="100%" style="margin: 15px;">最近由于在做u-boot-1.1.4到深圳优龙的ST2410开发板的移植,想通过修改U-Boot的源代码来让它支持从NAND Flash的启动。现在移植已经做得有点眉目了,还存在一些问题。在这个过程中,最近遇到的问题是启动ARM Linux的必备条件和U-Boot的go命令和bootm命令的一些区别,有所体会,在此记录一下。
                        
                        先来引用一下这篇介绍“ARM Linux内核启动要求”的文章ARM Linux Kernel Boot Requirements,是ARM Linux内核的维护者Russell King写的。                        
                           
[*]CPU register settings
                              
[*]r0 = 0.                              
[*]r1 = machine type number.                              
[*]r2 = physical address of tagged list in system RAM.                           
                                                      
[*]CPU mode
                              
[*]All forms of interrupts must be disabled (IRQs and FIQs.)                              
[*]The CPU must be in SVC mode. (A special exception exists for Angel.)                           
                                                      
[*]Caches, MMUs
                              
[*]The MMU must be off.                              
[*]Instruction cache may be on or off.                              
[*]Data cache must be off and must not contain any stale data.                           
                                                      
[*]Devices
                              
[*]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的go命令和bootm命令之间的本质区别所在了。先来看看bootm命令的实现,在common/cmd_bootm.c的第119行开始有:                                                                                                                                                                                    #ifdef CONFIG_PPC
                                    static boot_os_Fcn do_bootm_linux;
                                    #else
                                    extern boot_os_Fcn do_bootm_linux;
                                    #endif
                                                                                                                     
页: [1]
查看完整版本: U-Boot启动分析C语言部分