Android系统启动过程-uBoot+Kernel+Android

摘要:本文是参考大量网上资源在结合自己查看源代码总结出来的,让自己同时也让大家加深对Android系统启动过程有一个更加深入的了解!再次强调,本文的大多数功劳应归功于那些原创者们,同时一些必要的参考链接我会一一附上。

注:由于本人采用Exynos4412开发板学习,所以本文大部分资料都是基于此处理器的

简介:对于整个Android系统的启动总的来说分为三个阶段:

    BootLoader引导即uBoot.bin

    linux内核启动即zImage

    Android系统启动即ramdisk.img与system.img

    以上四个文件都是经过自己编译后生成的且通过烧写测试,接下来开始说这三大部分的启动过程。

目录:一、BootLoader的启动

     1.汇编部分

     2.c部分

     二、Kernel的启动

      1.zImage解压缩

      2.kernel的汇编启动阶段

      3.kernel的c启动阶段

   三、Android的启动

      1.init进程

      2.init启动的各种服务

      3.android启动图示

第一部分:BootLoader的启动流程

    uBoot的第一条指令从cpu/arm920t/start.S文件开始

      1. 设置CPU进入SVC模式(系统管理模式),cpsr[4:0]=0xd3。

 #include <common.h>
#include <config.h> /*
*************************************************************************
*
* Jump vector table as in table 3.1 in [1]
*
*************************************************************************
*/ .globl _start
_start: b start_code
ldr pc, _undefined_instruction
ldr pc, _software_interrupt
ldr pc, _prefetch_abort
ldr pc, _data_abort
ldr pc, _not_used
ldr pc, _irq
ldr pc, _fiq _undefined_instruction: .word undefined_instruction
_software_interrupt: .word software_interrupt
_prefetch_abort: .word prefetch_abort
_data_abort: .word data_abort
_not_used: .word not_used
_irq: .word irq
_fiq: .word fiq .balignl ,0xdeadbeef

        接着进入Start_code中:设置CPU进入SVC模式。

 /*
* the actual start code
*/ start_code:
/*
* set the cpu to SVC32 mode
*/
mrs r0, cpsr
bic r0, r0, #0x1f
orr r0, r0, #0xd3
msr cpsr, r0 bl coloured_LED_init
bl red_LED_on

        2.关看门狗,WTCON=0x0,并设置寄存器地址。

 /* turn off the watchdog */

 # if defined(CONFIG_S3C2400)
# define pWTCON 0x15300000
# define INTMSK 0x14400008 /* Interupt-Controller base addresses */
# define CLKDIVN 0x14800014 /* clock divisor register */
#else
# define pWTCON 0x53000000
# define INTMSK 0x4A000008 /* Interupt-Controller base addresses */
# define INTSUBMSK 0x4A00001C
# define CLKDIVN 0x4C000014 /* clock divisor register */
# endif ldr r0, =pWTCON
mov r1, #0x0
str r1, [r0]

        3.关中断,INTMSK=0xFFFFFFFF, INTSUBMSK=0x3FF。

 /*
* mask all IRQs by setting all bits in the INTMR - default
*/
mov r1, #0xffffffff
ldr r0, =INTMSK
str r1, [r0]
# if defined(CONFIG_S3C2410)
ldr r1, =0x3ff
ldr r0, =INTSUBMSK
str r1, [r0]
# endif

        4.时钟设置CLKDIVN=0x3 , FCLK:HCLK:PCLK = 1:2:4

 /* FCLK:HCLK:PCLK = 1:2:4 */
/* default FCLK is 120 MHz ! */
ldr r0, =CLKDIVN
mov r1, #
str r1, [r0]
#endif /* CONFIG_S3C24X0 */

        5.询问是否进行CPU初始化

 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
bl cpu_init_crit
#endif

        6.relocate函数

 #ifndef CONFIG_SKIP_RELOCATE_UBOOT
relocate: /* relocate U-Boot to RAM */
adr r0, _start /* r0 <- current position of code */
ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
cmp r0, r1 /* don't reloc during debug */
beq stack_setup ldr r2, _armboot_start
ldr r3, _bss_start
sub r2, r3, r2 /* r2 <- size of armboot */
add r2, r0, r2 /* r2 <- source end address */ copy_loop:
ldmia r0!, {r3-r10} /* copy from source address [r0] */
stmia r1!, {r3-r10} /* copy to target address [r1] */
cmp r0, r2 /* until source end addreee [r2] */
ble copy_loop
#endif /* CONFIG_SKIP_RELOCATE_UBOOT */

        7.初始化堆栈

 /* Set up the stack                            */
stack_setup:
ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
sub r0, r0, #CONFIG_SYS_MALLOC_LEN /* malloc area */
sub r0, r0, #CONFIG_SYS_GBL_DATA_SIZE /* bdinfo */
#ifdef CONFIG_USE_IRQ
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
#endif
sub sp, r0, # /* leave 3 words for abort-stack */ clear_bss:
ldr r0, _bss_start /* find start of bss segment */
ldr r1, _bss_end /* stop here */
mov r2, #0x00000000 /* clear */ clbss_l:str r2, [r0] /* clear loop... */
add r0, r0, #
cmp r0, r1
ble clbss_l

        8.CPU的初始化,即cpu_init_crit函数,完成以后回到主函数

 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
cpu_init_crit:
/*
* flush v4 I/D caches
*/
mov r0, #
mcr p15, , r0, c7, c7, /* flush v3/v4 cache */
mcr p15, , r0, c8, c7, /* flush v4 TLB */ /*
* disable MMU stuff and caches
*/
mrc p15, , r0, c1, c0,
bic r0, r0, #0x00002300 @ clear bits , : (--V- --RS)
bic r0, r0, #0x00000087 @ clear bits , : (B--- -CAM)
orr r0, r0, #0x00000002 @ set bit (A) Align
orr r0, r0, #0x00001000 @ set bit (I) I-Cache
mcr p15, , r0, c1, c0, /*
* before relocating, we have to setup RAM timing
* because memory timing is board-dependend, you will
* find a lowlevel_init.S in your board directory.
*/
mov ip, lr bl lowlevel_init mov lr, ip
mov pc, lr
#endif /* CONFIG_SKIP_LOWLEVEL_INIT */

        9.从这里跳转到第二阶段C代码中去

 ldr    pc, _start_armboot

 _start_armboot:    .word start_armboot

     C部分从文件/lib_arm/board.c的start_armboot()函数开始

        1.定义一个struct global_data结构体指针gd,struct global_data结构体对象gd_data,

          定义一个struct bd_info结构体对象bd_data,定义一个指向函数的二级指针init_fnc_ptr,定义的全局结构体对象都是放在堆栈中的,gd是放在寄存器中的。

        2. gd=&gd_data,gd->bd = &bd_data,并且全部空间清0。

        3.init_fnc_ptr = init_sequence(一个初始化函数指针数组)。将会在接下来的for循环中提取出每一个函数来依次执行完。

        4.配置可用的flash空间,并且打印出相关信息,flash_init()和display_flash_config()。

        5.mem_malloc_init()函数,分配堆空间.

        6.env_relocate该函数的作用是将0x33ef0000开始16K的环境参数拷贝到堆空间中去。

        7.gd->bd->bi_ip_addr = getenv_IPaddr ("ipaddr")通过这中方式获得环境变量列表中的ipaddr参数(开发板ip),获得环境变量中的MAC地址,设置到gd->bd->bi_enetaddr[reg]中。

        8.devices_init函数,创建了devlist,但是只有一个串口设备注册在内。

        9.console_init_r函数:控制台完全初始化,此后可以使用函数serial_getc和serial_putc或者putc和getc来输出log。

        10.使能中断,如果有网卡设备,设置网卡MAC和IP地址。

        11.main_loop ();定义于common/main.c。到此所有的初始化工作已经完成,main_loop在标准输入设备中接受命令,然后分析,查找和执行。

        12.在上面的main_loop函数中,通常在开发完成的阶段都会设置一个bootcmd的环境变量,然后将延时bootdelay设置成0,这样当u-boot跑到这里的时候就不会因为用户按下了任意键就进入了命令行模式,

          可以直接运行bootcmd的命令来直接加载kernel的Image然后移交控制权。如果进入了命令行模式,我们也可以手动输入命令来启动系统,输入的命令也是基本和bootcmd一样

 #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
s = getenv ("bootdelay");
bootdelay = s ? (int)simple_strtol(s, NULL, ) : CONFIG_BOOTDELAY; debug ("### main_loop entered: bootdelay=%d\n\n", bootdelay);

    这个地方时设置bootdelay的地方,即在引导kernel时等待用户命令,进入命令行模式,进行分区,格式化等操作。

        13.uBoot 引导内核启动的最后一步是:通过一个函数指针 thekernel()带三个参数跳转到内核( zImage )入口点开始执行,此时, u-boot 的任务已经完成,控制权完全交给内核( zImage )。

          在 uBoot 的文件lib_arm\bootm.c中定义了 thekernel, 并在 do_bootm_linux 的最后执行 thekernel。

            定义thekernel函数指针,获取bootargs参数给commandline指针。

            theKernel (0, machid, bd->bi_boot_params);第一个参数必须为0,第二个参数为机器类型ID,第三个参数为传递给内核参数的起始地址0x30000100

 int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
{
bd_t *bd = gd->bd;
char *s;
int machid = bd->bi_arch_number;
void (*theKernel)(int zero, int arch, uint params);
int ret; #ifdef CONFIG_CMDLINE_TAG
char *commandline = getenv ("bootargs");
#endif if ((flag != ) && (flag != BOOTM_STATE_OS_GO))
return ; theKernel = (void (*)(int, int, uint))images->ep; s = getenv ("machid");
if (s) {
machid = simple_strtoul (s, NULL, 16);
printf ("Using machid 0x%x from environment\n", machid);
} ret = boot_get_ramdisk(argc, argv, images, IH_ARCH_ARM,
&(images->rd_start), &(images->rd_end));
if(ret)
printf("[err] boot_get_ramdisk\n"); show_boot_progress (); debug ("## Transferring control to Linux (at address %08lx) ...\n",
(ulong) theKernel); #if defined (CONFIG_SETUP_MEMORY_TAGS) || \
defined (CONFIG_CMDLINE_TAG) || \
defined (CONFIG_INITRD_TAG) || \
defined (CONFIG_SERIAL_TAG) || \
defined (CONFIG_REVISION_TAG) || \
defined (CONFIG_LCD) || \
defined (CONFIG_VFD)
setup_start_tag (bd);
#ifdef CONFIG_SERIAL_TAG
setup_serial_tag (&params);
#endif
#ifdef CONFIG_REVISION_TAG
setup_revision_tag (&params);
#endif
#ifdef CONFIG_SETUP_MEMORY_TAGS
setup_memory_tags (bd);
#endif
#ifdef CONFIG_CMDLINE_TAG
setup_commandline_tag (bd, commandline);
#endif
#ifdef CONFIG_INITRD_TAG
if (images->rd_start && images->rd_end)
setup_initrd_tag (bd, images->rd_start, images->rd_end);
#endif
#if defined (CONFIG_VFD) || defined (CONFIG_LCD)
setup_videolfb_tag ((gd_t *) gd);
#endif
setup_end_tag (bd);
#endif /* we assume that the kernel is in place */
printf ("\nStarting kernel ...\n\n"); #ifdef CONFIG_USB_DEVICE
{
extern void udc_disconnect (void);
udc_disconnect ();
}
#endif cleanup_before_linux (); theKernel (, machid, bd->bi_boot_params);
/* does not return */ return ;
}

附上BootLoader启动时的调试信息

OK

U-Boot 2010.03 (Jul   - ::) for iTOP- Android

CPU:    SMDK4412-AP1. [e4412211]
APLL = 1000MHz, MPLL = 800MHz
ARM_CLOCK = 1000MHz
PMIC: S5M8767(VER5.)
Board: iTOP--Quad
POP type: POP for C220
DRAM: MB
MMC: Count:
max_emmc_clock: MHZ
Set CLK to KHz
EMMC CLOCK OUTPUT:: 400KHz -[div:]
response timeout error : cmd
response timeout error : cmd
max_emmc_clock: MHZ
Input CLK [ MHz] is higher than limit [ MHZ]
Set CLK to KHz
EMMC clock output: KHz
max_emmc_clock: MHZ
Input CLK [ MHz] is higher than limit [ MHZ]
Set CLK to KHz
EMMC clock output: KHz
MMC0: MB
SD sclk_mmc is 400K HZ
raise: Signal # caught
raise: Signal # caught
MMC1: MB
MB
*** Warning - using default environment In: serial
Out: serial
Err: serial
eMMC OPEN Success.!!
!!!Notice!!!
!You must close eMMC boot Partition after all image writing!
!eMMC boot partition has continuity at image writing time.!
!So, Do not close boot partition, Before, all images is written.! MMC read: dev # , block # , count ... blocks read: OK
eMMC CLOSE Success.!! Checking Boot Mode ... EMMC4.
SYSTEM ENTER NORMAL BOOT MODE
Hit any key to stop autoboot:
reading kernel.. ,
MMC read: dev # , block # , count ... blocks read: OK
completed
reading RFS.. ,
MMC read: dev # , block # , count ... blocks read: OK
completed
Boot with zImage
## Loading init Ramdisk from Legacy Image at 40df0000 ...
Image Name: ramdisk
Image Type: ARM Linux RAMDisk Image (uncompressed)
Data Size: Bytes = 900.3 kB
Load Address:
Entry Point: Starting kernel ...

    C部分我没有仔细去研究了,参考链接:http://blog.sina.com.cn/s/blog_533074eb0101ew0s.html

        汇编代码分析:http://blog.csdn.net/hygzxf/article/details/7477609

总结:BootLoader就是为操作系统启动之前做的准备,初始化硬件设备以及给内核传递必要的数据。

二、Linux内核的启动

  通用寄存器的作用

    r0 :在函数开始时使用
    r1 :存放堆栈指针,相当于ia32架构中的esp寄存器
    r2 :存放当前进程的描述符的地址
    r3 :存放第一个参数和返回地址
    r4-r10 :存放函数的参数
    r11 :用在指针的调用和当前一些语言的环境指针
    r12 :用于存放异常处理
    r13 :保留做为系统线程ID
    r14-r31 :作为本地变量,具有非易失性

    

    1.zImage解压缩

       内核启动引导地址由bootp.lds决定。 (arch/arm/boot/bootp)

 ENTRY(_start)
SECTIONS
{
. = ;
.text : {
_stext = .;
*(.start)
*(.text)
initrd_size = initrd_end - initrd_start;
_etext = .;
}

      .= 0可以确定解压代码运行的开始地址在0x0的位置。

      内核启动的执行的第一条的代码:arch/arm/boot/compressed /head.S文件中,Head.S文件主要功能是实现压缩内核的解压和跳转到内核vmlinux内核的入口。

      这里不做具体介绍了,可参考:http://blog.chinaunix.net/uid-25909619-id-3380535.html

    2.Kernel的汇编启动阶段

      第二阶段的代码是从\arch\arm\kernel\head.S开始的

      内核启动第二阶段主要完成的工作有,cpu ID检查,machine ID(也就是开发板ID)检查,创建初始化页表,设置C代码运行环境,跳转到内核第一个真正的C函数startkernel开始执行。

        这一阶段涉及到两个重要的结构体:

          (1) 一个是struct proc_info_list 主要描述CPU相关的信息,定义在文件arch\arm\include\asm\procinfo.h中,与其相关的函数及变量在文件arch/arm/mm/proc_arm920.S中被定义和赋值。

          (2) 另一个结构体是描述开发板或者说机器信息的结构体struct machine_desc,定义在\arch\arm\include\asm\mach\arch.h文件中。

            其函数的定义和变量的赋值在板极相关文件arch/arm/mach-s3c2410/mach-smdk2410.c中实现,这也是内核移植非常重要的一个文件。

          具体分析请参考:http://blog.chinaunix.net/uid-25909619-id-3380544.html

                  http://www.cnblogs.com/innost/archive/2011/11/08/2241653.html

                  http://blog.163.com/sxc_1985921@126/blog/static/50073349200822733247214/

    3.Kernel的C启动阶段(Linux version 3.0.15)

      经过解压缩和汇编启动两个阶段,将会进入init/Main.c中的start_kernel()函数去继续执行

 asmlinkage void __init start_kernel(void)
{
char * command_line;
extern const struct kernel_param __start___param[], __stop___param[]; smp_setup_processor_id(); /*
* Need to run as early as possible, to initialize the
* lockdep hash:
*/
lockdep_init();
debug_objects_early_init(); /*
* Set up the the initial canary ASAP:
*/
boot_init_stack_canary(); cgroup_init_early(); local_irq_disable();
early_boot_irqs_disabled = true; /*
* Interrupts are still disabled. Do necessary setups, then
* enable them
*/
tick_init();
boot_cpu_init();
page_address_init();
printk(KERN_NOTICE "%s", linux_banner);
setup_arch(&command_line);
mm_init_owner(&init_mm, &init_task);
mm_init_cpumask(&init_mm);
setup_command_line(command_line);
setup_nr_cpu_ids();
setup_per_cpu_areas();
smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */ build_all_zonelists(NULL);
page_alloc_init(); printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
parse_early_param();
parse_args("Booting kernel", static_command_line, __start___param,
__stop___param - __start___param,
&unknown_bootoption);
/*
* These use large bootmem allocations and must precede
* kmem_cache_init()
*/
setup_log_buf();
pidhash_init();
vfs_caches_init_early();
sort_main_extable();
trap_init(); //memblock_reserve((phys_addr_t)0x50000000,(phys_addr_t)0x100000); mm_init(); /*
* Set up the scheduler prior starting any interrupts (such as the
* timer interrupt). Full topology setup happens at smp_init()
* time - but meanwhile we still have a functioning scheduler.
*/
sched_init();
/*
* Disable preemption - early bootup scheduling is extremely
* fragile until we cpu_idle() for the first time.
*/
preempt_disable();
if (!irqs_disabled()) {
printk(KERN_WARNING "start_kernel(): bug: interrupts were "
"enabled *very* early, fixing it\n");
local_irq_disable();
}
idr_init_cache();
perf_event_init();
rcu_init();
radix_tree_init();
/* init some links before init_ISA_irqs() */
early_irq_init();
init_IRQ();
prio_tree_init();
init_timers();
hrtimers_init();
softirq_init();
timekeeping_init();
time_init();
profile_init();
call_function_init();
if (!irqs_disabled())
printk(KERN_CRIT "start_kernel(): bug: interrupts were "
"enabled early\n");
early_boot_irqs_disabled = false;
local_irq_enable(); /* Interrupts are enabled now so all GFP allocations are safe. */
gfp_allowed_mask = __GFP_BITS_MASK; kmem_cache_init_late(); /*
* HACK ALERT! This is early. We're enabling the console before
* we've done PCI setups etc, and console_init() must be aware of
* this. But we do want output early, in case something goes wrong.
*/
console_init();
if (panic_later)
panic(panic_later, panic_param); lockdep_info(); /*
* Need to run this when irqs are enabled, because it wants
* to self-test [hard/soft]-irqs on/off lock inversion bugs
* too:
*/
locking_selftest(); #ifdef CONFIG_BLK_DEV_INITRD
if (initrd_start && !initrd_below_start_ok &&
page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) {
printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - "
"disabling it.\n",
page_to_pfn(virt_to_page((void *)initrd_start)),
min_low_pfn);
initrd_start = ;
}
#endif
page_cgroup_init();
enable_debug_pagealloc();
debug_objects_mem_init();
kmemleak_init();
setup_per_cpu_pageset();
numa_policy_init();
if (late_time_init)
late_time_init();
sched_clock_init();
calibrate_delay();
pidmap_init();
anon_vma_init();
#ifdef CONFIG_X86
if (efi_enabled)
efi_enter_virtual_mode();
#endif
thread_info_cache_init();
cred_init();
fork_init(totalram_pages);
proc_caches_init();
buffer_init();
key_init();
security_init();
dbg_late_init();
vfs_caches_init(totalram_pages);
signals_init();
/* rootfs populating might need page-writeback */
page_writeback_init();
#ifdef CONFIG_PROC_FS
proc_root_init();
#endif
cgroup_init();
cpuset_init();
taskstats_init_early();
delayacct_init(); check_bugs(); acpi_early_init(); /* before LAPIC and SMP init */
sfi_init_late(); ftrace_init(); /* Do the rest non-__init'ed, we're now alive */
//printk(KERN_INFO "[mjdbg]MEM Check4:0x%x : 0x%x.\n", (int *)(phys_to_virt(0x50000000)),*(int *)(phys_to_virt(0x50000000)));
rest_init();
}

          1.打印版本信息,如内核、编译器、作者、日期。

          2.setup_arch()主要做一些板级初始化,cpu初始化,tag参数解析,u-boot传递的cmdline解析,建立mmu工作页表(memtable_init),初始化内存布局,

            调用mmap_io建立GPIO,IRQ,MEMCTRL,UART,及其他外设的静态映射表,对时钟,定时器,uart进行初始化,

            cpu_init():打印一些关于cpu的信息,比如cpu id,cache 大小等。另外重要的是设置了IRQ、ABT、UND三种模式的stack空间,分别都是12个字节。最后将系统切换到svc模式。

          3.build_all_zonelists():建立系统内存页区(zone)链表

          4.printk(KERN_NOTICE "Kernel command line: %s\n", saved_command_line);打印出从uboot传递过来的command_line字符串,在setup_arch函数中获得的。

          5.parse_early_param():这里分析的是系统能够辨别的一些早期参数(这个函数甚至可以去掉,__setup的形式的参数),

             而且在分析的时候并不是以setup_arch(&command_line)传出来的command_line为基础,而是以最原生态的saved_command_line为基础的。

          6.parse_args("Booting kernel", command_line, __start___param, __stop___param - __start___param,&unknown_bootoption);

            对于比较新的版本真正起作用的函数,与parse_early_param()相比,此处对解析列表的处理范围加大了,解析列表中除了包括系统以setup定义的启动参数,

              还包括模块中定义的param参数以及系统不能辨别的参数。

            __start___param是param参数的起始地址,在System.map文件中能看到

            __stop___param - __start___param是参数个数

            unknown_bootoption是对应与启动参数不是param的相应处理函数(查看parse_one()就知道怎么回事)。

           7.sched_init():初始化每个处理器的可运行队列,设置系统初始化进程即0号进程。

          8.init_IRQ():初始化系统中所有的中断描述结构数组:irq_desc[NR_IRQS]。接着执行init_arch_irq函数,

            该函数是在setup_arch函数最后初始化的一个全局函数指针,指向了smdk2410_init_irq函数(in mach-smdk2410.c),

            实际上是调用了s3c24xx_init_irq函数。在该函数中,首先清除所有的中断未决标志,之后就初始化中断的触发方式和屏蔽位,还有中断句柄初始化,

            这里不是最终用户的中断函数,而是do_level_IRQ或者do_edge_IRQ函数,在这两个函数中都使用过__do_irq函数来找到真正最终驱动程序注册在系统中的中断处理函数。

          9.softirq_init():内核的软中断机制初始化函数。

          10.console_init():初始化系统的控制台结构,该函数执行后调用printk函数将log_buf中所有符合打印级别的系统信息打印到控制台上。

          11.profile_init():

            profile是用来对系统剖析的,在系统调试的时候有用

            需要打开内核选项,并且在bootargs中有profile这一项才能开启这个功能

.phys_io    = S3C2410_PA_UART,

    .io_pg_offst    = (((u32)S3C24XX_VA_UART) >> ) & 0xfffc,

    .boot_params    = S3C2410_SDRAM_PA + 0x100,

    .map_io     = smdk2410_map_io,

    .init_irq   = s3c24xx_init_irq,

    .init_machine   = smdk2410_init,

    .timer      = &s3c24xx_timer,

MACHINE_END

          所有devices的注册都是在smdk2410_init()函数中调用函数:platform_add_devices(smdk2410_devices, ARRAY_SIZE(smdk2410_devices));来完成,

            所以drivers的注册就放在后面了。不过这样注册是有一个坏处的,就是不能准确地控制driver代码中probe的执行先后顺序。

            现在mtk平台上的devices和drivers注册顺序想法,也就是先注册上drivers,然后再注册devices,这样的话,就可以控制probe函数的执行先后。

              include/linux/init.h文件中有这些优先级的定义。

            稍后介绍怎么修改设备初始化顺序:http://www.cnblogs.com/pngcui/p/4666707.html

          12.rest_init():

            调用kernel_thread()创建1号内核线程。

            调用kernel_thread()创建kthreadd内核线程。尚不明作用。

            init_idle_bootup_task():当前0号进程init_task最终会退化成idle进程,所以这里调用init_idle_bootup_task()函数,让init_task进程隶属到idle调度类中。即选择idle的调度相关函数。

            调用schedule()函数切换当前进程,在调用该函数之前,Linux系统中只有两个进程,即0号进程init_task和1号进程kernel_init,其中kernel_init进程也是刚刚被创建的。

              调用该函数后,1号进程kernel_init将会运行!

            调用cpu_idle(),0号线程进入idle函数的循环,在该循环中会周期性地检查。

 static noinline void __init_refok rest_init(void)
{
int pid;
//printk("**********************************************************\n");
//printk(" rest_init: 0x%x!!!\n",(*(int *)phys_to_virt(0x50000000)));
//printk("**********************************************************\n"); #ifdef CONFIG_KERNEL_PANIC_DUMP
panic_dump_test();
#endif rcu_scheduler_starting();
/*
* We need to spawn init first so that it obtains pid 1, however
* the init task will end up wanting to create kthreads, which, if
* we schedule it before we create kthreadd, will OOPS.
*/
kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
numa_default_policy();
pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
rcu_read_lock();
kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
rcu_read_unlock();
complete(&kthreadd_done); /*
* The boot idle thread must execute schedule()
* at least once to get things moving:
*/
init_idle_bootup_task(current);
preempt_enable_no_resched();
schedule();
preempt_disable(); /* Call into cpu_idle with preempt disabled */
cpu_idle();
}

          13. kernel_init 1号线程初始化

         最后对Linux应用程序进行初始化。

          1号kernel_init进程完成linux的各项配置(包括启动AP)后,就会在/sbin,/etc,/bin寻找init程序来运行。

          该init程序会替换kernel_init进程(注意:并不是创建一个新的进程来运行init程序,而是一次变身,使用sys_execve函数改变核心进程的正文段,将核心进程kernel_init转换成用户进程init),

          此时处于内核态的1号kernel_init进程将会转换为用户空间内的1号进程init。

          父进程init将根据/etc/inittab中提供的信息完成应用程序的初始化调用。

          然后init进程会执行/bin/sh产生shell界面提供给用户来与Linux系统进行交互。

          调用init_post()创建用户模式1号进程。

          在init_post()中最终调用下面的任何一个入口(按顺序,第一个执行成功后将不返回)

 static noinline int init_post(void)
{
/* need to finish all async __init code before freeing the memory */
async_synchronize_full();
free_initmem();
mark_rodata_ro();
system_state = SYSTEM_RUNNING;
numa_default_policy(); current->signal->flags |= SIGNAL_UNKILLABLE; if (ramdisk_execute_command) {
run_init_process(ramdisk_execute_command);
printk(KERN_WARNING "Failed to execute %s\n",
ramdisk_execute_command);
} /*
* We try each of these until one succeeds.
*
* The Bourne shell can be used instead of init if we are
* trying to recover a really broken machine.
*/
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. "
"See Linux Documentation/init.txt for guidance.");
}

      关于更多函数解释可以参考:http://blog.chinaunix.net/uid-27052262-id-3404074.html

至此Linux内核初始化完成,终于开始加载Android系统了。。

Linux启动串口调试信息

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Linux version 3.0. (root@ubuntu) (gcc version 4.4. (Sourcery G++ Lite 2009q3-) ) # SMP PREEMPT Mon Jul :: PDT
[ 0.000000] CPU: ARMv7 Processor [413fc090] revision (ARMv7), cr=10c5387d
[ 0.000000] CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
[ 0.000000] Machine: SMDK4X12
[ 0.000000] **************************
[ 0.000000] reserve_panic_dump_area!!
[ 0.000000] **************************
[ 0.000000] Memory policy: ECC disabled, Data cache writealloc
[ 0.000000] CPU EXYNOS4412 (id 0xe4412211)
[ 0.000000] S3C24XX Clocks, Copyright Simtec Electronics
[ 0.000000] s3c_register_clksrc: clock audiocdclk has no registers set
[ 0.000000] audiocdclk: no parent clock specified
[ 0.000000] s3c_register_clksrc: clock armclk has no registers set
[ 0.000000] EXYNOS4: PLL settings, A=, M=, E= V=
[ 0.000000] EXYNOS4: ARMCLK=, DMC=, ACLK200=
[ 0.000000] ACLK160=, ACLK133=, ACLK100=
[ 0.000000] EXYNOS4: ACLK400= ACLK266=
[ 0.000000] uclk1: source is mout_mpll_user (), rate is
[ 0.000000] uclk1: source is mout_mpll_user (), rate is
[ 0.000000] uclk1: source is mout_mpll_user (), rate is
[ 0.000000] uclk1: source is mout_mpll_user (), rate is
[ 0.000000] sclk_csis: source is xusbxti (), rate is
[ 0.000000] sclk_csis: source is xusbxti (), rate is
[ 0.000000] sclk_cam0: source is xusbxti (), rate is
[ 0.000000] sclk_cam1: source is xusbxti (), rate is
[ 0.000000] sclk_fimc: source is xusbxti (), rate is
[ 0.000000] sclk_fimc: source is xusbxti (), rate is
[ 0.000000] sclk_fimc: source is xusbxti (), rate is
[ 0.000000] sclk_fimc: source is xusbxti (), rate is
[ 0.000000] sclk_fimd: source is xusbxti (), rate is
[ 0.000000] sclk_fimd: source is xusbxti (), rate is
[ 0.000000] sclk_mfc: source is mout_mfc0 (), rate is
[ 0.000000] sclk_g3d: source is mout_g3d0 (), rate is
[ 0.000000] sclk_pwi: source is xusbxti (), rate is
[ 0.000000] PERCPU: Embedded pages/cpu @c0dc8000 s6752 r8192 d13728 u32768
[ 0.000000] Built zonelists in Zone order, mobility grouping on. Total pages:
[ 0.000000] Kernel command line: console=ttySAC2, //--------------------------------------------------------
[ 0.000000] log_buf_len:
[ 0.000000] early log buf free: (%)
[ 0.000000] PID hash table entries: (order: , bytes)
[ 0.000000] Dentry cache hash table entries: (order: , bytes)
[ 0.000000] Inode-cache hash table entries: (order: , bytes)
[ 0.000000] Memory: 1023MB = 1023MB total
[ 0.000000] Memory: 645528k/645528k available, 402024k reserved, 293888K highmem
[ 0.000000] Virtual kernel memory layout:
[ 0.000000] vector : 0xffff0000 - 0xffff1000 ( kB)
[ 0.000000] fixmap : 0xfff00000 - 0xfffe0000 ( kB)
[ 0.000000] DMA : 0xfea00000 - 0xffe00000 ( MB)
[ 0.000000] vmalloc : 0xee800000 - 0xf6000000 ( MB)
[ 0.000000] lowmem : 0xc0000000 - 0xee000000 ( MB)
[ 0.000000] pkmap : 0xbfe00000 - 0xc0000000 ( MB)
[ 0.000000] modules : 0xbf000000 - 0xbfe00000 ( MB)
[ 0.000000] .init : 0xc0008000 - 0xc003f000 ( kB)
[ 0.000000] .text : 0xc003f000 - 0xc08db000 ( kB)
[ 0.000000] .data : 0xc08dc000 - 0xc0981a40 ( kB)
[ 0.000000] .bss : 0xc0981d30 - 0xc09beff0 ( kB)
[ 0.000000] SLUB: Genslabs=, HWalign=, Order=-, MinObjects=, CPUs=, Nodes=
[ 0.000000] Preemptible hierarchical RCU implementation.
[ 0.000000] NR_IRQS:
[ 0.000000] Calibrating delay loop... 1992.29 BogoMIPS (lpj=)
[ 0.045000] pid_max: default: minimum:
[ 0.045000] Mount-cache hash table entries:
[ 0.045000] Initializing cgroup subsys debug
[ 0.045000] Initializing cgroup subsys cpuacct
[ 0.045000] Initializing cgroup subsys freezer
[ 0.045000] CPU: Testing write buffer coherency: ok
[ 0.045000] **********panic_dump_test****************
[ 0.045000] There is no valid panic information in memory
[ 0.045000] **************************
[ 0.045000] L310 cache controller enabled
[ 0.045000] l2x0: ways, CACHE_ID 0x4100c4c8, AUX_CTRL 0x7e470001, Cache size: B
[ 0.075000] CPU1: Booted secondary processor
[ 0.095000] CPU2: Booted secondary processor
[ 0.115000] CPU3: Booted secondary processor
[ 0.115000] Brought up CPUs
[ 0.115000] SMP: Total of processors activated (7969.17 BogoMIPS).
[ 0.120000] print_constraints: dummy:
[ 0.120000] NET: Registered protocol family
[ 0.120000] value1 = , value2 = , type = 0x1
[ 0.120000] value1 = , value2 = , type = 0x1
[ 0.135000] exynos4_pmu_init: PMU supports ()
[ 0.135000] S3C Power Management, Copyright Simtec Electronics
[ 0.135000] EXYNOS4: Initializing architecture
[ 0.135000] panic_file create OK !!
[ 0.135000] s3c-adc exynos4412-adc: attached adc driver
[ 0.135000] samsung-pd samsung-pd.: power domain registered
[ 0.135000] samsung-pd samsung-pd.: power domain registered
[ 0.135000] samsung-pd samsung-pd.: power domain registered
[ 0.135000] samsung-pd samsung-pd.: power domain registered
[ 0.135000] samsung-pd samsung-pd.: power domain registered
[ 0.135000] samsung-pd samsung-pd.: power domain registered
[ 0.135000] samsung-pd samsung-pd.: power domain registered
[ 0.135000] s3c24xx-pwm s3c24xx-pwm.: tin at , tdiv at , tin=divclk, base
[ 0.135000] UMP: UMP device driver loaded
[ 0.155000] bio: create slab <bio-> at
[ 0.155000] SCSI subsystem initialized
[ 0.155000] s3c64xx_spi_probe()
[ 0.155000] s3c64xx_spi_probe()
[ 0.155000] s3c64xx_spi_probe()
[ 0.155000] usbcore: registered new interface driver usbfs
[ 0.155000] usbcore: registered new interface driver hub
[ 0.155000] usbcore: registered new device driver usb
[ 0.155000] i2c-gpio i2c-gpio.: using pins (SDA) and (SCL)
[ 0.160000] +s5m8767_pmic_probe()
[ 0.160000] print_constraints: vdd_mif range: <--> mV at mV
[ 0.160000] print_constraints: vdd_arm range: <--> mV at mV
[ 0.160000] print_constraints: vdd_int range: <--> mV at mV
[ 0.160000] print_constraints: vdd_g3d range: <--> mV at mV
[ 0.165000] print_constraints: vdd_m12 range: <--> mV at mV
[ 0.165000] print_constraints: vdd12_5m range: <--> mV at mV
[ 0.165000] print_constraints: vddf28_emmc range: <--> mV at mV
[ 0.170000] print_constraints: VDDQ_M12: mV
[ 0.170000] print_constraints: VDD18_2M: mV
[ 0.170000] print_constraints: VDD10_MIPI: mV
[ 0.185000] print_constraints: VDD33_LCD: mV
[ 0.185000] print_constraints: VDD18_MIPI: mV
[ 0.195000] print_constraints: VDD33_UOTG: mV
[ 0.200000] print_constraints: VDD10_USH: mV
[ 0.200000] print_constraints: VDD18_HSIC: mV
[ 0.200000] print_constraints: VDDIOPERI_28: mV
[ 0.215000] print_constraints: DC33V_TP: mV
[ 0.215000] print_constraints: VDD28_CAM: mV
[ 0.215000] print_constraints: VDD28_AF: mV
[ 0.215000] print_constraints: VDDA28_2M: mV
[ 0.220000] print_constraints: VDD28_TF: mV
[ 0.230000] print_constraints: VDD33_A31: mV
[ 0.255000] print_constraints: VDD18_CAM: mV
[ 0.255000] print_constraints: VDD18_A31: mV
[ 0.255000] print_constraints: GPS_1V8: mV
[ 0.260000] print_constraints: DVDD12: mV
[ 0.260000] -s5m8767_pmic_probe()
[ 0.260000] s5m87xx -: S5M87xx MFD probe done!!!
[ 0.260000] s3c-i2c s3c2440-i2c.: i2c-: S3C I2C adapter
[ 0.260000] s3c-i2c s3c2440-i2c.: i2c-: S3C I2C adapter
[ 0.260000] s3c-i2c s3c2440-i2c.: i2c-: S3C I2C adapter
[ 0.260000] s3c-i2c s3c2440-i2c.: i2c-: S3C I2C adapter
[ 0.260000] s3c-i2c s3c2440-i2c.: i2c-: S3C I2C adapter
[ 0.260000] Advanced Linux Sound Architecture Driver Version 1.0..
[ 0.260000] Bluetooth: Core ver 2.16
[ 0.260000] NET: Registered protocol family
[ 0.260000] Bluetooth: HCI device and connection manager initialized
[ 0.260000] Bluetooth: HCI socket layer initialized
[ 0.260000] Bluetooth: L2CAP socket layer initialized
[ 0.260000] Bluetooth: SCO socket layer initialized
[ 0.260000] cfg80211: Calling CRDA to update world regulatory domain
[ 0.260000] Switching to clocksource mct-frc
[ 0.260428] Switched to NOHz mode on CPU #
[ 0.260640] Switched to NOHz mode on CPU #
[ 0.260646] Switched to NOHz mode on CPU #
[ 0.260653] Switched to NOHz mode on CPU #
[ 0.261840] NET: Registered protocol family
[ 0.262015] IP route cache hash table entries: (order: , bytes)
[ 0.262642] TCP established hash table entries: (order: , bytes)
[ 0.264143] TCP bind hash table entries: (order: , bytes)
[ 0.264947] TCP: Hash tables configured (established bind )
[ 0.264963] TCP reno registered
[ 0.264978] UDP hash table entries: (order: , bytes)
[ 0.265039] UDP-Lite hash table entries: (order: , bytes)
[ 0.265305] NET: Registered protocol family
[ 0.265443] Trying to unpack rootfs image as initramfs...
[ 0.316627] Freeing initrd memory: 900K
[ 0.316732] PMU: registered new PMU device of type
[ 0.316901] Exynos4 : ARM Clock down on idle mode is enabled
[ 0.317816] regulator_consumer_probe: loading tc4-regulator-consumer
[ 0.317836] Register vdd_consumer_early_suspend done
[ 0.318454] Loaded driver for PL330 DMAC- s3c-pl330
[ 0.318470] DBUFF-64x8bytes Num_Chans- Num_Peri- Num_Events-
[ 0.318767] Loaded driver for PL330 DMAC- s3c-pl330
[ 0.318782] DBUFF-32x4bytes Num_Chans- Num_Peri- Num_Events-
[ 0.318879] Loaded driver for PL330 DMAC- s3c-pl330
[ 0.318894] DBUFF-32x4bytes Num_Chans- Num_Peri- Num_Events-
[ 0.326370] highmem bounce pool size: pages
[ 0.326563] ashmem: initialized
[ 0.334795] fuse init (API version 7.16)
[ 0.335137] msgmni has been set to
[ 0.335776] io scheduler noop registered
[ 0.335789] io scheduler deadline registered
[ 0.335845] io scheduler cfq registered (default)
[ 0.336711] value1 = , value2 = , type = 0x1
[ 0.590044] (s3cfb_cfg_gpio, ): BK_VDD_ON
[ 0.695084] (s3cfb_cfg_gpio, ): LCD_PWDN ON

第三部分:Android部分启动

    Android的启动过程是从进程init开始的,所以它是后续所有进程的祖先进程。(system/core/init)

      1.重新设置子进程终止时信号SIGCHLD的处理函数。

      2. 将kernel启动过程中建立好的文件系统框架mount到相应目录。

      3.open_devnull_stdio(),将init进程的标准输入、输出、出错设备设置为新建的设备节点/dev/__null__。

      4.log_init(),创建并打开设备节点/dev/__kmsg__。

      5.读取并解析rc配置文件。

        先从文件/sys/class/BOOT/BOOT/boot/boot_mode读出启动方式:Factory Mode, '4';ATE Factory Mode, '6'。看是否是facatory模式。

        如果是的话,需要读取并解析两个文件:init.factory.rc和init.rc。

        如果是正常启动,则暂时先读取init.rc。

        这里在读取解析文件的时候,是以行为最小可执行单位在解析。关于书写init.rc文件的初始化脚本语言的规则,可以上网查找。

        解析之后并不会马上执行,而是在init进入服务循环之前统一根据其命令本身所带的条件来执行。

      6.导入kernel的cmdline,也就是u-boot传递给kernel的参数

        查看其中是否具有androidboot.xxx(androidboot.mode、androidboot.hardware等)参数,

        如果有,将其保存在同名字的xxx(mode、hardware)全局变量中。

        这里特别说明的是hardware这个参数,从kernel中导出一部分之后,又要从/proc/cpuinfo中导出一部分来组合成完整的hardware参数,因为后面接下来会读取并解析以特定平台的rc文件。

      7.读取特定平台相关的initrc文件,如:init.mt6516.rc。

        对于service,这里会给每个服务建立一个struct service的结构体,全部挂入链表service_list之中,在init最后才启动。

      8.检查解析出来的所有命令行当中是否有属于early-init的,如果有,将其提出来加入到链表action_queue之中,马上将其执行掉。

      9.device_init()函数将会打开uevent的netlink socket,遍历/sys/class、/sys/block、/sys/devices目录,

        检查各级目录的uevent文件,处理在vold服务起来之前由kernel所发出来的device add, remove等事件。

      10.property_init(), 顾名思义,是属性初始化。首先创建一个名字为system_properties的匿名共享内存区域,对并本init进程做mmap读写映射,其余共享它的进程只有读的权限。

        然后将这个prop_area结构体通过全局变量__system_property_area__传递给property services。

        接着调用函数load_properties_from_file(PROP_PATH_RAMDISK_DEFAULT)从/default.prop文件中加载编译时生成的属性。

      11.如果在root目录下有initlogo.rle文件存在,这个是两张android字样的缕空图片,将其读入fb中显示到LCD上。同时也要往串口上输出"

      12.设置相应的属性。

      13.开始执行以init为trigger的命令行。

      14.启动属性服务:property_set_fd = start_property_service();

      15.创建一对socket,用来做信号方面的处理。

      16.执行eraly-boot和boot为trigger的命令。

      17.执行init.rc中以property:开头的属性设置语句,同时使能属性触发方式。

      18.利用poll机制监听前面创建的几个fd的动态。

      19.nit中启动的各种服务

        详细请参考:http://blog.csdn.net/lizhiguo0532/article/details/7028910

Android启动图示:

Android系统启动过程-uBoot+Kernel+Android

Android启动时串口调试信息如下:

[    0.700601]  CPU type:
[ 0.700612] Exynos
[ 0.700623] value1 = , value2 = , type = 0x1
[ 0.710886] parent clock: , vclk: , vclk div:
[ 0.960563] (s3cfb_backlight_on, ): LCD_PWM_ON
[ 0.965577] (s3cfb_backlight_on, ): VGA_EN_ON
[ 0.965596] s3cfb s3cfb.: registered successfully
[ 0.966251] Serial: / driver, ports, IRQ sharing disabled
[ 1.290258] s5pv210-uart.: ttySAC0 at MMIO 0x13800000 (irq = ) is a S3C6400/
[ 1.370063] s5pv210-uart.: ttySAC1 at MMIO 0x13810000 (irq = ) is a S3C6400/
[ 1.450061] s5pv210-uart.: ttySAC2 at MMIO 0x13820000 (irq = ) is a S3C6400/
[ 2.465477] console [ttySAC2] enabled
[ 2.510061] s5pv210-uart.: ttySAC3 at MMIO 0x13830000 (irq = ) is a S3C6400/
[ 2.591003] SI GPS Initialize
[ 2.592759] max485_ctl Initialize
[ 2.596064] leds Initialize
[ 2.598692] leds:register device success!
[ 2.602577] leds_test_delay_run
[ 4.203173] leds_test_delay_over
[ 4.205188] buzzer_ctl initialized
[ 4.208437] exynos_adc_probe,
[ 4.211617] exynos_adc_probe,
[ 4.215024] exynos_adc_probe,
[ 4.218198] adc initialized
[ 4.221242] relay_ctl initialized
[ 4.230393] brd: module loaded
[ 4.235021] loop: module loaded
[ 4.236723] pmem: init
[ 4.239498] pmem_gpu1: init
[ 4.248745] CAN device driver interface
[ 4.251129] PPP generic driver version 2.4.
[ 4.255735] usbcore: registered new interface driver dm9601
[ 4.261062] usbcore: registered new interface driver dm9620
[ 4.266636] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[ 4.273105]
[ 4.273108]
[ 4.273111] [usb_host_phy_init]++++++++++++++
[ 4.280546] s5p-ehci s5p-ehci: S5P EHCI Host Controller
[ 4.285597] s5p-ehci s5p-ehci: new USB bus registered, assigned bus number
[ 4.292721] s5p-ehci s5p-ehci: irq , io mem 0x12580000
[ 4.305040] s5p-ehci s5p-ehci: USB 0.0 started, EHCI 1.00
[ 4.309067] usb usb1: New USB device found, idVendor=1d6b, idProduct=, bcdDevice=
[ 4.317143] usb usb1: New USB device strings: Mfr=, Product=, SerialNumber=
[ 4.324344] usb usb1: New USB device Class: Class=, SubClass=, Protocol=
[ 4.331287] usb usb1: Product: S5P EHCI Host Controller
[ 4.336494] usb usb1: Manufacturer: Linux 3.0. ehci_hcd
[ 4.341874] usb usb1: SerialNumber: s5p-ehci
[ 4.346608] hub -:1.0: USB hub found
[ 4.349858] hub -:1.0: ports detected
[ 4.354415] usbcore: registered new interface driver cdc_acm
[ 4.359496] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
[ 4.367480] Initializing USB Mass Storage driver...
[ 4.372471] usbcore: registered new interface driver usb-storage
[ 4.378331] USB Mass Storage support registered.
[ 4.383157] usbcore: registered new interface driver usbserial
[ 4.388747] usbserial: USB Serial Driver core
[ 4.393181] USB Serial support registered for GSM modem (-port)
[ 4.399222] usbcore: registered new interface driver option
[ 4.404632] option: v0.7.2:USB Driver for GSM modems
[ 4.409779] s3c-udc : S3C HS USB OTG Device Driver,(c) - Samsung Electronics
[ 4.409785] s3c-udc : version March
[ 4.423369] android_usb gadget: Mass Storage Function, version: //
[ 4.428783] android_usb gadget: Number of LUNs=
[ 4.433381] lun0: LUN: removable file: (no medium)
[ 4.438241] lun1: LUN: removable file: (no medium)
[ 4.443101] lun2: LUN: removable file: (no medium)
[ 4.448211] android_usb gadget: android_usb ready
[ 4.452833] mousedev: could not register psaux device, error: -
[ 4.458726] mousedev: PS/ mouse device common for all mice
[ 4.464915] input: gpio-keys as /devices/platform/gpio-keys/input/input0
[ 4.471583] input: samsung-keypad as /devices/platform/samsung-keypad/input/input1
[ 4.478872] usbcore: registered new interface driver xpad
[ 4.484008] usbcore: registered new interface driver usb_acecad
[ 4.489800] acecad: v3.:USB Acecad Flair tablet driver
[ 4.495119] usbcore: registered new interface driver aiptek
[ 4.500564] aiptek: v2. (May , ):Aiptek HyperPen USB Tablet Driver (Linux 2.6.x)
[ 4.508460] aiptek: Bryan W. Headley/Chris Atenasio/Cedric Brun/Rene van Paassen
[ 4.515943] usbcore: registered new interface driver gtco
[ 4.521238] GTCO usb driver version: 2.00.
[ 4.525580] usbcore: registered new interface driver hanwang
[ 4.531397] usbcore: registered new interface driver kbtab
[ 4.536759] kbtab: v0.0.2:USB KB Gear JamStudio Tablet driver
[ 4.542593] usbcore: registered new interface driver wacom
[ 4.547960] wacom: v1.:USB Wacom tablet driver
[ 4.552801] tsc2007 -: i2c io error: -
[ 4.556950] tsc2007 -: i2c io error: -
[ 4.561192] tsc2007 -: i2c io error: -
[ 4.565445] tsc2007 -: i2c io error: -
[ 4.569685] tsc2007 -: i2c io error: -
[ 4.573952] tsc2007 -: i2c io error: -
[ 4.578984] S3C24XX RTC, (c) , Simtec Electronics
[ 4.583514] s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
[ 4.588958] Begin gettime...................
[ 4.593183] s3c_rtc_gettime() -- ::
[ 4.598222] using rtc device, s3c, for alarms
[ 4.602053] s3c-rtc s3c64xx-rtc: rtc core: registered s3c as rtc0
[ 4.608466] I found You!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
[ 7.613770] -----time:s5m_rtc_read_time: // ::()
[ 8.617588] Alrm-----------------s5m_rtc_read_alarm: // ::(-)
[ 8.624267] -----time:s5m_rtc_read_time: // ::()
[ 9.627158] s5m-rtc s5m-rtc: rtc core: registered s5m-rtc as rtc1
[ 9.632180] s5m-rtc s5m-rtc: RTC CHIP NAME: s5m-rtc
[ 9.636650] The Over-------------------------------------------------------------------------------------
[ 10.644544] i2c /dev entries driver
[ 10.647643] Linux media interface: v0.
[ 10.650947] lirc_dev: IR Remote Control driver registered, major
[ 10.657063] IR NEC protocol handler initialized
[ 10.661573] IR RC5(x) protocol handler initialized
[ 10.666347] IR RC6 protocol handler initialized
[ 10.670860] IR JVC protocol handler initialized
[ 10.675373] IR Sony protocol handler initialized
[ 10.679964] IR RC5 (streamzap) protocol handler initialized
[ 10.685531] IR LIRC bridge handler initialized
[ 10.689946] Linux video capture interface: v2.
[ 10.694645] ov5640_module_init
[ 10.698359] s3c-csis: Samsung MIPI-CSIS0 driver probed successfully
[ 10.703872] s3c-csis: Samsung MIPI-CSIS1 driver probed successfully
[ 10.710206] Initialize JPEG driver
[ 10.713717] s5p-jpeg s5p-jpeg: JPEG driver is registered to /dev/video12
[ 10.720302] s5p-jpeg s5p-jpeg: JPEG driver is registered to /dev/video11
[ 10.727039] i2c i2c-: attached s5p_ddc into i2c adapter successfully
[ 10.733369] i2c-core: driver [s5p_ddc] using legacy suspend method
[ 10.739435] i2c-core: driver [s5p_ddc] using legacy resume method
[ 10.745514] S5P HPD Driver, (c) Samsung Electronics
[ 10.751176] S5P CEC Driver, (c) Samsung Electronics
[ 10.756939] MFC(Multi Function Codec - FIMV v5.x) registered successfully
[ 10.763337] Samsung Graphics 2D driver, (c) Samsung Electronics
[ 10.769689] Mali: init_mali_clock mali_clock c08f6cc4
[ 10.777020] Mali: failed to get cpufreq level for 1200MHzMali: Mali device driver loaded
[ 10.794227] usbcore: registered new interface driver uvcvideo
[ 10.799744] USB Video Class driver (v1.1.0)
[ 10.804024] S3C2410 Watchdog Timer, (c) Simtec Electronics
[ 10.810135] s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
[ 10.818121] device-mapper: uevent: version 1.0.
[ 10.822360] device-mapper: ioctl: 4.20.-ioctl (--) initialised: dm-devel@redhat.com
[ 10.830495] Bluetooth: HCI UART driver ver 2.2
[ 10.834886] Bluetooth: HCI H4 protocol initialized
[ 10.839672] Bluetooth: HCI BCSP protocol initialized
[ 10.844618] Bluetooth: HCILL protocol initialized
[ 10.849305] Bluetooth: HCIATH3K protocol initialized
[ 10.854881] cpuidle: using governor ladder
[ 10.859233] cpuidle: using governor menu
[ 10.862337] mshci: Mobile Storage Host Controller Interface driver
[ 10.868402] mshci: Copyright (c) Samsung Electronics Co., Ltd
[ 10.874644] clock source : sclk_dwmci ( Hz)
[ 10.879605] dw_mmc dw_mmc: clock source : sclk_dwmci ( Hz)
[ 10.886164] mmc0: Version ID 0x5342240a.
[ 10.889830] mjdbg: cmu_max_clcok:
[ 10.893921] mjdbg: host->max_clk:
[ 10.898303] mmc0: FIFO WMARK FOR RX 0x11 WX 0x1. ###########
[ 10.906124] mmc0: MSHCI controller on samsung-mshci [dw_mmc] using IDMA
[ 10.911462] sdhci: Secure Digital Host Controller Interface driver
[ 10.917435] sdhci: Copyright(c) Pierre Ossman
[ 10.922782] mmc0:mshci_set_clock, @ration:,[mjdbg] cmu_set_clock:
[ 10.929332] s3c-sdhci s3c-sdhci.: clock source : sclk_mmc ( Hz)
[ 10.936047] mmc1: no vmmc regulator found
[ 10.940037] *******mmc0: inserted!!!!!******
[ 10.940190] mmc1: SDHCI controller on samsung-hsmmc [s3c-sdhci.] using ADMA
[ 10.940203] wake enabled for irq
[ 10.940446] s3c-sdhci s3c-sdhci.: clock source : sclk_mmc ( Hz)
[ 10.940471] sdhci_s3c_probe: set MMC_PM_IGNORE_PM_NOTIFY for mmc2 pm_flags
[ 10.940478] sdhci_s3c_probe: set MMC_PM_KEEP_POWER | MMC_PM_WAKE_SDIO_IRQ for mmc2 pm_caps
[ 10.940498] mmc2: no vmmc regulator found
[ 10.940689] mmc2: SDHCI controller on samsung-hsmmc [s3c-sdhci.] using ADMA
[ 10.946509] usbcore: registered new interface driver usbhid
[ 10.946516] usbhid: USB HID core driver
[ 10.947321] logger: created 256K log 'log_main'
[ 10.947461] logger: created 256K log 'log_events'
[ 10.947606] logger: created 256K log 'log_radio'
[ 10.947753] logger: created 256K log 'log_system'
[ 10.948354] GPS: mt3326_gps_power: Switching GPS device on
[ 10.948362] GPS: mt3326_gps_power: ignore power control:
[ 10.948369] GPS: mt3326_gps_probe: Registering chardev
[ 10.948376] GPS: mt3326_gps_probe: major: , minor:
[ 10.948631] GPS: mt3326_gps_probe: Done
[ 10.949893] Samsung Audio Subsystem Driver, (c) Samsung Electronics
[ 10.949953] audss_init: RCLK SRC[busclk]
[ 11.053233] mmc0: cmd response timeout error
[ 11.059167] mmc0: cmd response timeout error
[ 11.074324] mmc0: cmd response timeout error
[ 11.079400] asoc: wm8960-hifi <-> samsung-i2s. mapping ok
[ 11.083424] mmc0: cmd response timeout error
[ 11.089454] Samsung SRP driver, (c) Samsung Electronics
[ 11.093650] mmc0: cmd response timeout error
[ 11.099873] mmc0: cmd response timeout error
[ 11.104647] mmc0: cmd response timeout error
[ 11.109435] mmc0: cmd response timeout error
[ 11.114312] mmc0: cmd response timeout error
[ 11.119184] mmc0: cmd response timeout error
[ 11.124052] mmc0: cmd response timeout error
[ 11.132033] SRP: Driver successfully probed
[ 11.134928] ALSA device list:
[ 11.137710] #: TOPEET-WM8960
[ 11.140947] GACT probability NOT on
[ 11.144297] Mirror/redirect action on
[ 11.147953] u32 classifier
[ 11.150639] Actions configured
[ 11.154016] Netfilter messages via NETLINK v0..
[ 11.158777] nf_conntrack version 0.5. ( buckets, max)
[ 11.165613] ctnetlink v0.: registering with nfnetlink.
[ 11.170138] NF_TPROXY: Transparent proxy support initialized, version 4.1.
[ 11.177066] NF_TPROXY: Copyright (c) - BalaBit IT Ltd.
[ 11.183099] xt_time: kernel timezone is -
[ 11.188633] ip_tables: (C) - Netfilter Core Team
[ 11.192655] arp_tables: (C) David S. Miller
[ 11.197162] TCP cubic registered
[ 11.201199] NET: Registered protocol family
[ 11.203347] mmc0:mshci_set_clock, @ration:,[mjdbg] cmu_set_clock:
[ 11.215858] Mobile IPv6
[ 11.216850] ip6_tables: (C) - Netfilter Core Team
[ 11.222463] IPv6 over IPv4 tunneling driver
[ 11.230913] NET: Registered protocol family
[ 11.231511] mmc0: new high speed DDR MMC card at address
[ 11.239693] NET: Registered protocol family
[ 11.244078] can: controller area network core (rev abi )
[ 11.244112] mmcblk0: mmc0: 4YMD3R 3.64 GiB
[ 11.254848] NET: Registered protocol family
[ 11.259204] can: raw protocol (rev )
[ 11.259226] mmcblk0: p1 p2 p3 p4
[ 11.266785] Bluetooth: RFCOMM TTY layer initialized
[ 11.271605] Bluetooth: RFCOMM socket layer initialized
[ 11.276685] Bluetooth: RFCOMM ver 1.11
[ 11.280417] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[ 11.285710] Bluetooth: BNEP filters: protocol multicast
[ 11.290944] NET: Registered protocol family
[ 11.295062] *******mmc2: inserted!!!!!******
[ 11.300641] EXYNOS4X12: Adaptive Support Voltage init
[ 11.304623] EXYNOS4X12: IDS : HPM : RESULT :
[ 11.309501] ************ exynos4x12_set_abb:0x0, 0x0, 0x0, 0x0, 0x80000088
[ 11.316355] VFP support v0.: implementor architecture part variant rev
[ 11.323999] Registering SWP/SWPB emulation handler
[ 11.328769] DVFS : VDD_ARM Voltage table set with Group
[ 11.334145] exynos4x12_cpufreq_init:topeet pop
[ 11.338949] DVFS : VDD_INT Voltage table set with Group
[ 11.340080] *******mmc2: inserted!!!!!******
[ 11.385093] *******mmc2: inserted!!!!!******
[ 11.410199] exynos4_integrated_dvfs_hotplug_init, max(),min()
[ 11.419158] regulator_init_complete: VDD18_MIPI: incomplete constraints, leaving on
[ 11.427135] regulator_init_complete: VDD10_MIPI: incomplete constraints, leaving on
[ 11.433795] regulator_init_complete: VDD18_2M: incomplete constraints, leaving on
[ 11.435150] *******mmc2: inserted!!!!!******
[ 11.451794] regulator_init_complete: vdd_int range: incomplete constraints, leaving on
[ 11.458720] regulator_init_complete: vdd_arm range: incomplete constraints, leaving on
[ 11.466619] regulator_init_complete: vdd_mif range: incomplete constraints, leaving on
[ 11.474585] USB_DEVICE_ATTACHED
[ 11.478484] exynos_usb_Device: Exynos USB Device Driver
[ 11.482408] value1 = , value2 = , type = 0x1
[ 11.491830] ==ft5x0x_ts_init: reset==
[ 11.820044] usb -: new high speed USB device number using s5p-ehci
[ 11.955411] usb -: New USB device found, idVendor=, idProduct=, bcdDevice=a1a0
[ 11.962042] usb -: New USB device strings: Mfr=, Product=, SerialNumber=
[ 11.969160] usb -: New USB device Class: Class=, SubClass=, Protocol=
[ 11.976587] hub -:1.0: USB hub found
[ 11.979889] hub -:1.0: ports detected
[ 12.025303] input: ft5x0x_ts as /devices/virtual/input/input2
[ 12.035634] ft5x0x_ts -: Firmware version 0x06
[ 12.039038] ft5x0x_ts -: FocalTech ft5x0x TouchScreen initialized
[ 12.046790] -----time:s5m_rtc_read_time: // ::()
[ 12.265183] usb -3.2: new high speed USB device number using s5p-ehci
[ 12.375383] usb -3.2: config interface altsetting endpoint 0x83 has an invalid bInterval , changing to
[ 12.467776] usb -3.2: New USB device found, idVendor=0a46, idProduct=, bcdDevice=
[ 12.474586] usb -3.2: New USB device strings: Mfr=, Product=, SerialNumber=
[ 12.495019] usb -3.2: New USB device Class: Class=, SubClass=, Protocol=
[ 12.505883] dm962x: dm_read_reg() 0x29 0x0a
[ 12.508757] dm962x: dm_read_reg() 0x28 0x46
[ 12.512884] dm962x: dm_read_reg() 0x2b 0x96
[ 12.517008] dm962x: dm_read_reg() 0x2a 0x21
[ 12.521260] dm962x: dm_read_reg() 0xF2 0x00
[ 12.525266] dm962x: [Analysis.] 0xF2, D[] OK
[ 12.529941] dm962x: [Analysis.] 0xF2, D[] OK
[ 12.534639] dm962x: [Analysis.] 0xF2, D[] EP1: Empty
[ 12.540022] dm962x: [Analysis.] 0xF2, D[] OK
[ 12.544697] dm962x: [Analysis.] 0xF2, D[] OK
[ 12.549395] dm962x: [Analysis.] 0xF2, D[] OK
[ 12.554082] dm962x: [Analysis.] 0xF2, D[] Status: TX buffer pkts
[ 12.566384] dm962x: ethernet MAC address ::ff:ff:: (chip)
[ 12.571383] dm962x: Mode =
[ 12.588122] dm9620 -3.2:1.0: eth0: register 'dm9620' at usb-s5p-ehci-3.2, Davicom DM9620 USB Ethernet, ::ff:ff::
[ 13.087605] Begin settime.......................................................................
[ 13.094937] s3c_rtc_settime() -- ::
[ 13.099450] writeb is Over.................
[ 13.103447] settime---------s5m_rtc_set_time: // ::()
[ 13.135058] s5m-rtc s5m-rtc: setting system clock to -- :: UTC ()
[ 13.142183] FIMC0 registered successfully
[ 13.146186] FIMC1 registered successfully
[ 13.150028] FIMC2 registered successfully
[ 13.154005] FIMC3 registered successfully
[ 13.157928] S5P TVOUT Driver v3. (c) Samsung Electronics
[ 13.189955] Freeing init memory: 220K
[ 13.201285] init: init.wireless.rc: : invalid option 'chmod'
[ 13.205801] init: init.wireless.rc: : ignored duplicate definition of service 'hfag'
[ 13.213739] init: init.wireless.rc: : ignored duplicate definition of service 'hsag'
[ 13.221725] init: init.wireless.rc: : ignored duplicate definition of service 'opush'
[ 13.229797] init: init.wireless.rc: : ignored duplicate definition of service 'pbap'
[ 13.237890] init: /init.smdk4x12.rc: : ignored duplicate definition of service 'console'
[ 13.246148] init (): /proc//oom_adj is deprecated, please use /proc//oom_score_adj instead.
[ 13.264185] MFC F/W loaded successfully (size: )
[ 13.411506] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[ 13.591579] EXT4-fs (mmcblk0p3): warning: checktime reached, running e2fsck is recommended
[ 13.600903] EXT4-fs (mmcblk0p3): recovery complete
[ 13.606571] EXT4-fs (mmcblk0p3): mounted filesystem with ordered data mode. Opts: discard,noauto_da_alloc,nodelalloc
[ 13.645873] EXT4-fs (mmcblk0p4): warning: checktime reached, running e2fsck is recommended
[ 13.655171] EXT4-fs (mmcblk0p4): recovery complete
[ 13.660863] EXT4-fs (mmcblk0p4): mounted filesystem with ordered data mode. Opts: nomblk_io_submit
[ 13.698460] [HIF-SDIO][I]hif_sdio_init:start!
[ 13.701609] [HIF-SDIO][I]hif_sdio_init:sdio_register_driver() ret=
[ 13.738137] mtk_stp_wmt: module license 'Proprietary' taints kernel.
[ 13.743099] Disabling lock debugging due to kernel taint
[ 13.766663] [WMT-DEV][I]WMT_init:WMT Version= Combo WMT Driver - v4. DATE=//
[ 13.773093] [PSM][I]stp_psm_init: psm init (0xbf0330e4, )
[ 13.778931] [PSM][I]_stp_psm_init_monitor: init monitor
[ 13.784188] [STPDbg]stp_dbg_init: stp-dbg init
[ 13.788474] [STP-C][I]mtk_wcn_stp_dbg_enable:STP dbg mode is turned on
[ 13.794958] [WMT-DEV][I]WMT_init:driver(major ) installed
[ 13.800682] [WMT-DEV][I]wmt_dev_read_file:open (/system/etc/firmware/WMT.cfg) O_RDONLY,
[ 13.814102] [WMT-CONF][I]wmt_conf_read_file:get full file name(/system/etc/firmware/WMT.cfg) buf(0xefec3000) size()
[ 13.823821] [WMT-CONF][I]wmt_conf_read_file:&gDevWmt.rWmtGenConf=bf02f9bc
[ 13.830275] [WMT-LIB][I]wmt_lib_init:set pwr on seq par to hw conf
[ 13.836332] [WMT-LIB][I]wmt_lib_init:ldo()rst()on()off()rtc()
[ 13.842506] [WMT-CMB-HW][I]mtk_wcn_cmb_hw_init:use default hw init sequence parameters
[ 13.850382] [WMT-CMB-HW][I]mtk_wcn_cmb_hw_dmp_seq:combo chip power on sequence time, RTC (), LDO (), RST(), OFF(), ON()
[ 13.862180] [WMT-PLAT][I]wmt_plat_init:set g_bgf_irq()
[ 13.867554] [WMT-LIB][I]wmtd_thread:wmtd thread starts
[ 13.872695] [WMT-DEV][I]WMT_init:success
[ 13.882238] [STP-U][I]mtk_wcn_stp_uart_init:MTK STP UART driver
[ 13.891842] mtk_stp_GPS_chrdev driver(major ) installed.
[ 13.905334] [HCI-STP][I]hci_stp_init:HCI STP driver ver 2.0, hdev(0xd485c800), init done
[ 13.930665] [D_INIT]mt_fm_probe()
[ 13.932515] [D_MAIN]alloc fm::
[ 13.936064] [D_INIT]create_proc_entry success
[ 13.940255] [D_INIT]create_config_entry success
[ 13.944747] [D_INIT]******fm config info******
[ 13.949188] [D_INIT]***chip: MT6620
[ 13.952747] [D_INIT]***band:
[ 13.955871] [D_INIT]***freq_min:
[ 13.959503] [D_INIT]***freq_max:
[ 13.963248] [D_INIT]***scan_tbl:
[ 13.966806] [D_INIT]***space:
[ 13.970022] [D_INIT]***rssi_long: 0x0301
[ 13.973999] [D_INIT]***rssi_short: 0x02e0
[ 13.978091] [D_INIT]***CQI: 0x00e9
[ 13.981562] [D_INIT]******fm config end******
[ 13.990254] [D_INIT]mtk_fm_probe, FM probe ...
[ 13.993229] [D_INIT]fm_priv_register(), [pri=0xd6041ed8][op=0xbf0afd84]
[ 13.999852] [D_INIT]init, FM init ok
[ 14.003396] [D_INIT]mtk_fm_probe, FM probe ok
[ 14.012069] [MTK-WIFI] WIFI_init: mtk_wmt_WIFI_chrdev driver(major ) installed.
[ 14.239239] [HIF-SDIO][I]mtk_wcn_hif_sdio_client_reg:start!
[ 14.258310] init: cannot find '/system/etc/install-recovery.sh', disabling 'flash_recovery'
[ 14.267461] adb_bind_config
[ 14.270339] adb_open
[ 14.271089] ADB open:/system/bin/sh: No controlling tty (open /dev/tty: No such device or
[ 14.396445] [WMT-DEV][I]WMT_open:major minor (pid )
[ 14.402289] [WMT-DEV][I]WMT_open:1st call ()
[ 14.407010] [mtk_wcn_stp_set_if_tx_type] set STP_IF_TX to UART.
address)
/syst[ 14.413789] [WMT-LIB][I]wmt_lib_set_hif:new hifType:, fcCtrl:, baud:, fm:
[ 14.422109] [WMT-C][I]opfunc_hif_conf:WMT HIF info added
em/bin/sh: warning: won't have full job control
[ 14.516143] warning: `rild' uses 32-bit capabilities (legacy support in use)
root@android:/ # [ 15.041107] s3c-fimc3: FIMC3 opened.
[ 15.673835] s3cfb s3cfb.: [fb0] dma: 0x690c4000, cpu: 0xf0cff000, size: 0x007d0000
[ 15.686073] s3cfb s3cfb.: [fb1] dma: 0x69894000, cpu: 0xf14d0000, size: 0x007d0000
[ 15.699196] s3c-fimc3: FIMC3 opened.
[ 16.775048] Mali: :::exynos_result_of_asv :
[ 16.777929] Mali: mali_dvfs[].vol =
[ 16.782265] Mali: :::exynos_result_of_asv :
[ 16.787742] Mali: mali_dvfs[].vol =
[ 16.790639] Mali: :::exynos_result_of_asv :
[ 16.794945] Mali: mali_dvfs[].vol =
[ 16.794954] Mali: :::exynos_result_of_asv :
[ 16.794960] Mali: mali_dvfs[].vol =
[ 23.461949] request_suspend_state: wakeup (->) at (-- ::58.817585256 UTC)
[ 23.723250] acc_open
[ 23.723969] acc_release
[ 28.460143] CPU1: shutdown
[ 28.958936] CPU2: shutdown
[ 31.157062] CPU3: shutdown

至此Android已成功启动,可以说Android系统是跑在Linux内核上的巨大的一个应用程序!

上一篇:国内经典BI系统架构分析


下一篇:理解 Ceph:一个开源的分布式存储平台