• 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。

     1 #include <common.h>
     2 #include <config.h>
     3 
     4 /*
     5  *************************************************************************
     6  *
     7  * Jump vector table as in table 3.1 in [1]
     8  *
     9  *************************************************************************
    10  */
    11 
    12 
    13 .globl _start
    14 _start:    b    start_code
    15     ldr    pc, _undefined_instruction
    16     ldr    pc, _software_interrupt
    17     ldr    pc, _prefetch_abort
    18     ldr    pc, _data_abort
    19     ldr    pc, _not_used
    20     ldr    pc, _irq
    21     ldr    pc, _fiq
    22 
    23 _undefined_instruction:    .word undefined_instruction
    24 _software_interrupt:    .word software_interrupt
    25 _prefetch_abort:    .word prefetch_abort
    26 _data_abort:        .word data_abort
    27 _not_used:        .word not_used
    28 _irq:            .word irq
    29 _fiq:            .word fiq
    30 
    31     .balignl 16,0xdeadbeef

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

     1 /*
     2  * the actual start code
     3  */
     4 
     5 start_code:
     6     /*
     7      * set the cpu to SVC32 mode
     8      */
     9     mrs    r0, cpsr
    10     bic    r0, r0, #0x1f
    11     orr    r0, r0, #0xd3
    12     msr    cpsr, r0
    13 
    14     bl    coloured_LED_init
    15     bl    red_LED_on

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

     1 /* turn off the watchdog */
     2 
     3 # if defined(CONFIG_S3C2400)
     4 #  define pWTCON    0x15300000
     5 #  define INTMSK    0x14400008    /* Interupt-Controller base addresses */
     6 #  define CLKDIVN    0x14800014    /* clock divisor register */
     7 #else
     8 #  define pWTCON    0x53000000
     9 #  define INTMSK    0x4A000008    /* Interupt-Controller base addresses */
    10 #  define INTSUBMSK    0x4A00001C
    11 #  define CLKDIVN    0x4C000014    /* clock divisor register */
    12 # endif
    13 
    14     ldr    r0, =pWTCON
    15     mov    r1, #0x0
    16     str    r1, [r0]

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

     1 /*
     2      * mask all IRQs by setting all bits in the INTMR - default
     3      */
     4     mov    r1, #0xffffffff
     5     ldr    r0, =INTMSK
     6     str    r1, [r0]
     7 # if defined(CONFIG_S3C2410)
     8     ldr    r1, =0x3ff
     9     ldr    r0, =INTSUBMSK
    10     str    r1, [r0]
    11 # endif

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

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

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

    1 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
    2     bl    cpu_init_crit
    3 #endif

            6.relocate函数

     1 #ifndef CONFIG_SKIP_RELOCATE_UBOOT
     2 relocate:                /* relocate U-Boot to RAM        */
     3     adr    r0, _start        /* r0 <- current position of code   */
     4     ldr    r1, _TEXT_BASE        /* test if we run from flash or RAM */
     5     cmp    r0, r1            /* don't reloc during debug         */
     6     beq    stack_setup
     7 
     8     ldr    r2, _armboot_start
     9     ldr    r3, _bss_start
    10     sub    r2, r3, r2        /* r2 <- size of armboot            */
    11     add    r2, r0, r2        /* r2 <- source end address         */
    12 
    13 copy_loop:
    14     ldmia    r0!, {r3-r10}        /* copy from source address [r0]    */
    15     stmia    r1!, {r3-r10}        /* copy to   target address [r1]    */
    16     cmp    r0, r2            /* until source end addreee [r2]    */
    17     ble    copy_loop
    18 #endif    /* CONFIG_SKIP_RELOCATE_UBOOT */

            7.初始化堆栈

     1 /* Set up the stack                            */
     2 stack_setup:
     3     ldr    r0, _TEXT_BASE        /* upper 128 KiB: relocated uboot   */
     4     sub    r0, r0, #CONFIG_SYS_MALLOC_LEN    /* malloc area              */
     5     sub    r0, r0, #CONFIG_SYS_GBL_DATA_SIZE /* bdinfo                 */
     6 #ifdef CONFIG_USE_IRQ
     7     sub    r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
     8 #endif
     9     sub    sp, r0, #12        /* leave 3 words for abort-stack    */
    10 
    11 clear_bss:
    12     ldr    r0, _bss_start        /* find start of bss segment        */
    13     ldr    r1, _bss_end        /* stop here                        */
    14     mov    r2, #0x00000000        /* clear                            */
    15 
    16 clbss_l:str    r2, [r0]        /* clear loop...                    */
    17     add    r0, r0, #4
    18     cmp    r0, r1
    19     ble    clbss_l

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

     1 #ifndef CONFIG_SKIP_LOWLEVEL_INIT
     2 cpu_init_crit:
     3     /*
     4      * flush v4 I/D caches
     5      */
     6     mov    r0, #0
     7     mcr    p15, 0, r0, c7, c7, 0    /* flush v3/v4 cache */
     8     mcr    p15, 0, r0, c8, c7, 0    /* flush v4 TLB */
     9 
    10     /*
    11      * disable MMU stuff and caches
    12      */
    13     mrc    p15, 0, r0, c1, c0, 0
    14     bic    r0, r0, #0x00002300    @ clear bits 13, 9:8 (--V- --RS)
    15     bic    r0, r0, #0x00000087    @ clear bits 7, 2:0 (B--- -CAM)
    16     orr    r0, r0, #0x00000002    @ set bit 2 (A) Align
    17     orr    r0, r0, #0x00001000    @ set bit 12 (I) I-Cache
    18     mcr    p15, 0, r0, c1, c0, 0
    19 
    20     /*
    21      * before relocating, we have to setup RAM timing
    22      * because memory timing is board-dependend, you will
    23      * find a lowlevel_init.S in your board directory.
    24      */
    25     mov    ip, lr
    26 
    27     bl    lowlevel_init
    28 
    29     mov    lr, ip
    30     mov    pc, lr
    31 #endif /* CONFIG_SKIP_LOWLEVEL_INIT */

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

    1 ldr    pc, _start_armboot
    2 
    3 _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一样

    1 #if defined(CONFIG_BOOTDELAY) && (CONFIG_BOOTDELAY >= 0)
    2     s = getenv ("bootdelay");
    3     bootdelay = s ? (int)simple_strtol(s, NULL, 10) : CONFIG_BOOTDELAY;
    4 
    5     debug ("### main_loop entered: bootdelay=%d
    
    ", bootdelay);

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

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

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

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

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

     1 int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
     2 {
     3     bd_t    *bd = gd->bd;
     4     char    *s;
     5     int    machid = bd->bi_arch_number;
     6     void    (*theKernel)(int zero, int arch, uint params);
     7     int    ret;
     8 
     9 #ifdef CONFIG_CMDLINE_TAG
    10     char *commandline = getenv ("bootargs");
    11 #endif
    12 
    13     if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
    14         return 1;
    15 
    16     theKernel = (void (*)(int, int, uint))images->ep;
    17 
    18     s = getenv ("machid");
    19     if (s) {
    20         machid = simple_strtoul (s, NULL, 16);
    21         printf ("Using machid 0x%x from environment
    ", machid);
    22     }
    23     
    24     ret = boot_get_ramdisk(argc, argv, images, IH_ARCH_ARM, 
    25             &(images->rd_start), &(images->rd_end));
    26     if(ret)
    27         printf("[err] boot_get_ramdisk
    ");
    28 
    29     show_boot_progress (15);
    30 
    31     debug ("## Transferring control to Linux (at address %08lx) ...
    ",
    32            (ulong) theKernel);
    33 
    34 #if defined (CONFIG_SETUP_MEMORY_TAGS) || 
    35     defined (CONFIG_CMDLINE_TAG) || 
    36     defined (CONFIG_INITRD_TAG) || 
    37     defined (CONFIG_SERIAL_TAG) || 
    38     defined (CONFIG_REVISION_TAG) || 
    39     defined (CONFIG_LCD) || 
    40     defined (CONFIG_VFD)
    41     setup_start_tag (bd);
    42 #ifdef CONFIG_SERIAL_TAG
    43     setup_serial_tag (&params);
    44 #endif
    45 #ifdef CONFIG_REVISION_TAG
    46     setup_revision_tag (&params);
    47 #endif
    48 #ifdef CONFIG_SETUP_MEMORY_TAGS
    49     setup_memory_tags (bd);
    50 #endif
    51 #ifdef CONFIG_CMDLINE_TAG
    52     setup_commandline_tag (bd, commandline);
    53 #endif
    54 #ifdef CONFIG_INITRD_TAG
    55     if (images->rd_start && images->rd_end)
    56         setup_initrd_tag (bd, images->rd_start, images->rd_end);
    57 #endif
    58 #if defined (CONFIG_VFD) || defined (CONFIG_LCD)
    59     setup_videolfb_tag ((gd_t *) gd);
    60 #endif
    61     setup_end_tag (bd);
    62 #endif
    63 
    64     /* we assume that the kernel is in place */
    65     printf ("
    Starting kernel ...
    
    ");
    66 
    67 #ifdef CONFIG_USB_DEVICE
    68     {
    69         extern void udc_disconnect (void);
    70         udc_disconnect ();
    71     }
    72 #endif
    73 
    74     cleanup_before_linux ();
    75 
    76     theKernel (0, machid, bd->bi_boot_params);
    77     /* does not return */
    78 
    79     return 1;
    80 }

    附上BootLoader启动时的调试信息

    OK
      
    U-Boot 2010.03 (Jul 14 2015 - 00:08:57) for iTOP-4412 Android
                                                                 
    
    CPU:    SMDK4412-AP1.1 [e4412211]
            APLL = 1000MHz, MPLL = 800MHz
            ARM_CLOCK = 1000MHz          
    PMIC:   S5M8767(VER5.0)    
    Board:  iTOP-4412-Quad 
    POP type: POP for C220
    DRAM:   1023 MB       
    MMC:   Count: 100
    max_emmc_clock:40 MHZ
    Set CLK to 400 KHz   
    EMMC CLOCK OUTPUT:: 400KHz -[div:50]
    response timeout error : 00000104 cmd 8
    response timeout error : 00000104 cmd 55
    max_emmc_clock:40 MHZ                   
    Input CLK [ 50 MHz] is higher than limit [40 MHZ]
    Set CLK to 40000 KHz                             
    EMMC clock output: 40000 KHz
    max_emmc_clock:40 MHZ       
    Input CLK [ 50 MHz] is higher than limit [40 MHZ]
    Set CLK to 40000 KHz                             
    EMMC clock output: 40000 KHz
    MMC0:   3728 MB             
    SD sclk_mmc is 400K HZ
    raise: Signal # 8 caught
    raise: Signal # 8 caught
    MMC1:   0 MB            
    0 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 # 0, block # 48, count 16 ...16 blocks read: OK
    eMMC CLOSE Success.!!                                        
                         
    
    Checking Boot Mode ... EMMC4.41
    SYSTEM ENTER NORMAL BOOT MODE  
    Hit any key to stop autoboot:  0 
    reading kernel.. 1120, 12288     
    MMC read: dev # 0, block # 1120, count 12288 ...12288 blocks read: OK
    completed                                                            
    reading RFS.. 13408, 2048 
    MMC read: dev # 0, block # 13408, count 2048 ...2048 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:    921950 Bytes = 900.3 kB               
       Load Address: 40800000               
       Entry Point:  40800000
                             
    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)

     1 ENTRY(_start)
     2 SECTIONS
     3 {
     4   . = 0;
     5   .text : {
     6    _stext = .;
     7    *(.start)
     8    *(.text)
     9    initrd_size = initrd_end - initrd_start;
    10    _etext = .;
    11   }

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

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

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

        2.Kernel的汇编启动阶段

          第二阶段的代码是从archarmkernelhead.S开始的

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

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

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

              (2) 另一个结构体是描述开发板或者说机器信息的结构体struct machine_desc,定义在archarmincludeasmmacharch.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()函数去继续执行

      1 asmlinkage void __init start_kernel(void)
      2 {
      3     char * command_line;
      4     extern const struct kernel_param __start___param[], __stop___param[];
      5 
      6     smp_setup_processor_id();
      7 
      8     /*
      9      * Need to run as early as possible, to initialize the
     10      * lockdep hash:
     11      */
     12     lockdep_init();
     13     debug_objects_early_init();
     14 
     15     /*
     16      * Set up the the initial canary ASAP:
     17      */
     18     boot_init_stack_canary();
     19 
     20     cgroup_init_early();
     21 
     22     local_irq_disable();
     23     early_boot_irqs_disabled = true;
     24 
     25 /*
     26  * Interrupts are still disabled. Do necessary setups, then
     27  * enable them
     28  */
     29     tick_init();
     30     boot_cpu_init();
     31     page_address_init();
     32     printk(KERN_NOTICE "%s", linux_banner);
     33     setup_arch(&command_line);
     34     mm_init_owner(&init_mm, &init_task);
     35     mm_init_cpumask(&init_mm);
     36     setup_command_line(command_line);
     37     setup_nr_cpu_ids();
     38     setup_per_cpu_areas();
     39     smp_prepare_boot_cpu();    /* arch-specific boot-cpu hooks */
     40 
     41     build_all_zonelists(NULL);
     42     page_alloc_init();
     43 
     44     printk(KERN_NOTICE "Kernel command line: %s
    ", boot_command_line);
     45     parse_early_param();
     46     parse_args("Booting kernel", static_command_line, __start___param,
     47            __stop___param - __start___param,
     48            &unknown_bootoption);
     49     /*
     50      * These use large bootmem allocations and must precede
     51      * kmem_cache_init()
     52      */
     53     setup_log_buf(0);
     54     pidhash_init();
     55     vfs_caches_init_early();
     56     sort_main_extable();
     57     trap_init();
     58     
     59 
     60     //memblock_reserve((phys_addr_t)0x50000000,(phys_addr_t)0x100000);
     61 
     62     mm_init();
     63 
     64     /*
     65      * Set up the scheduler prior starting any interrupts (such as the
     66      * timer interrupt). Full topology setup happens at smp_init()
     67      * time - but meanwhile we still have a functioning scheduler.
     68      */
     69     sched_init();
     70     /*
     71      * Disable preemption - early bootup scheduling is extremely
     72      * fragile until we cpu_idle() for the first time.
     73      */
     74     preempt_disable();
     75     if (!irqs_disabled()) {
     76         printk(KERN_WARNING "start_kernel(): bug: interrupts were "
     77                 "enabled *very* early, fixing it
    ");
     78         local_irq_disable();
     79     }
     80     idr_init_cache();
     81     perf_event_init();
     82     rcu_init();
     83     radix_tree_init();
     84     /* init some links before init_ISA_irqs() */
     85     early_irq_init();
     86     init_IRQ();
     87     prio_tree_init();
     88     init_timers();
     89     hrtimers_init();
     90     softirq_init();
     91     timekeeping_init();
     92     time_init();
     93     profile_init();
     94     call_function_init();
     95     if (!irqs_disabled())
     96         printk(KERN_CRIT "start_kernel(): bug: interrupts were "
     97                  "enabled early
    ");
     98     early_boot_irqs_disabled = false;
     99     local_irq_enable();
    100 
    101     /* Interrupts are enabled now so all GFP allocations are safe. */
    102     gfp_allowed_mask = __GFP_BITS_MASK;
    103 
    104     kmem_cache_init_late();
    105 
    106     /*
    107      * HACK ALERT! This is early. We're enabling the console before
    108      * we've done PCI setups etc, and console_init() must be aware of
    109      * this. But we do want output early, in case something goes wrong.
    110      */
    111     console_init();
    112     if (panic_later)
    113         panic(panic_later, panic_param);
    114 
    115     lockdep_info();
    116 
    117     /*
    118      * Need to run this when irqs are enabled, because it wants
    119      * to self-test [hard/soft]-irqs on/off lock inversion bugs
    120      * too:
    121      */
    122     locking_selftest();
    123 
    124 #ifdef CONFIG_BLK_DEV_INITRD
    125     if (initrd_start && !initrd_below_start_ok &&
    126         page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) {
    127         printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - "
    128             "disabling it.
    ",
    129             page_to_pfn(virt_to_page((void *)initrd_start)),
    130             min_low_pfn);
    131         initrd_start = 0;
    132     }
    133 #endif
    134     page_cgroup_init();
    135     enable_debug_pagealloc();
    136     debug_objects_mem_init();
    137     kmemleak_init();
    138     setup_per_cpu_pageset();
    139     numa_policy_init();
    140     if (late_time_init)
    141         late_time_init();
    142     sched_clock_init();
    143     calibrate_delay();
    144     pidmap_init();
    145     anon_vma_init();
    146 #ifdef CONFIG_X86
    147     if (efi_enabled)
    148         efi_enter_virtual_mode();
    149 #endif
    150     thread_info_cache_init();
    151     cred_init();
    152     fork_init(totalram_pages);
    153     proc_caches_init();
    154     buffer_init();
    155     key_init();
    156     security_init();
    157     dbg_late_init();
    158     vfs_caches_init(totalram_pages);
    159     signals_init();
    160     /* rootfs populating might need page-writeback */
    161     page_writeback_init();
    162 #ifdef CONFIG_PROC_FS
    163     proc_root_init();
    164 #endif
    165     cgroup_init();
    166     cpuset_init();
    167     taskstats_init_early();
    168     delayacct_init();
    169 
    170     check_bugs();
    171 
    172     acpi_early_init(); /* before LAPIC and SMP init */
    173     sfi_init_late();
    174 
    175     ftrace_init();
    176 
    177     /* Do the rest non-__init'ed, we're now alive */
    178     //printk(KERN_INFO "[mjdbg]MEM Check4:0x%x : 0x%x.
    ", (int *)(phys_to_virt(0x50000000)),*(int *)(phys_to_virt(0x50000000)));
    179     rest_init();
    180 }

              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 ", 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) >> 18) & 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_task1号进程kernel_init,其中kernel_init进程也是刚刚被创建的。

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

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

     1 static noinline void __init_refok rest_init(void)
     2 {
     3     int pid;
     4     //printk("**********************************************************
    ");
     5     //printk(" rest_init: 0x%x!!!
    ",(*(int *)phys_to_virt(0x50000000)));
     6     //printk("**********************************************************
    ");
     7 
     8 #ifdef CONFIG_KERNEL_PANIC_DUMP
     9     panic_dump_test();
    10 #endif    
    11 
    12 
    13     rcu_scheduler_starting();
    14     /*
    15      * We need to spawn init first so that it obtains pid 1, however
    16      * the init task will end up wanting to create kthreads, which, if
    17      * we schedule it before we create kthreadd, will OOPS.
    18      */
    19     kernel_thread(kernel_init, NULL, CLONE_FS | CLONE_SIGHAND);
    20     numa_default_policy();
    21     pid = kernel_thread(kthreadd, NULL, CLONE_FS | CLONE_FILES);
    22     rcu_read_lock();
    23     kthreadd_task = find_task_by_pid_ns(pid, &init_pid_ns);
    24     rcu_read_unlock();
    25     complete(&kthreadd_done);
    26 
    27     /*
    28      * The boot idle thread must execute schedule()
    29      * at least once to get things moving:
    30      */
    31     init_idle_bootup_task(current);
    32     preempt_enable_no_resched();
    33     schedule();
    34     preempt_disable();
    35 
    36     /* Call into cpu_idle with preempt disabled */
    37     cpu_idle();
    38 }

              13. kernel_init 1号线程初始化

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

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

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

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

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

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

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

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

     1 static noinline int init_post(void)
     2 {
     3     /* need to finish all async __init code before freeing the memory */
     4     async_synchronize_full();
     5     free_initmem();
     6     mark_rodata_ro();
     7     system_state = SYSTEM_RUNNING;
     8     numa_default_policy();
     9 
    10     current->signal->flags |= SIGNAL_UNKILLABLE;
    11 
    12     if (ramdisk_execute_command) {
    13         run_init_process(ramdisk_execute_command);
    14         printk(KERN_WARNING "Failed to execute %s
    ",
    15                 ramdisk_execute_command);
    16     }
    17 
    18     /*
    19      * We try each of these until one succeeds.
    20      *
    21      * The Bourne shell can be used instead of init if we are
    22      * trying to recover a really broken machine.
    23      */
    24     if (execute_command) {
    25         run_init_process(execute_command);
    26         printk(KERN_WARNING "Failed to execute %s.  Attempting "
    27                     "defaults...
    ", execute_command);
    28     }
    29     run_init_process("/sbin/init");
    30     run_init_process("/etc/init");
    31     run_init_process("/bin/init");
    32     run_init_process("/bin/sh");
    33 
    34     panic("No init found.  Try passing init= option to kernel. "
    35           "See Linux Documentation/init.txt for guidance.");
    36 }

          关于更多函数解释可以参考: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.15 (root@ubuntu) (gcc version 4.4.1 (Sourcery G++ Lite 2009q3-67) ) #33 SMP PREEMPT Mon Jul 20 20:44:16 PDT 2015
    [    0.000000] CPU: ARMv7 Processor [413fc090] revision 0 (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 2004 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=1000000000, M=800000000, E=96000000 V=350000000
    [    0.000000] EXYNOS4: ARMCLK=1000000000, DMC=400000000, ACLK200=24000000
    [    0.000000] ACLK160=160000000, ACLK133=133333333, ACLK100=100000000
    [    0.000000] EXYNOS4: ACLK400=24000000 ACLK266=800000000
    [    0.000000] uclk1: source is mout_mpll_user (6), rate is 100000000
    [    0.000000] uclk1: source is mout_mpll_user (6), rate is 100000000
    [    0.000000] uclk1: source is mout_mpll_user (6), rate is 100000000
    [    0.000000] uclk1: source is mout_mpll_user (6), rate is 100000000
    [    0.000000] sclk_csis: source is xusbxti (1), rate is 1500000
    [    0.000000] sclk_csis: source is xusbxti (1), rate is 1500000
    [    0.000000] sclk_cam0: source is xusbxti (1), rate is 1500000
    [    0.000000] sclk_cam1: source is xusbxti (1), rate is 1500000
    [    0.000000] sclk_fimc: source is xusbxti (1), rate is 1500000
    [    0.000000] sclk_fimc: source is xusbxti (1), rate is 1500000
    [    0.000000] sclk_fimc: source is xusbxti (1), rate is 1500000
    [    0.000000] sclk_fimc: source is xusbxti (1), rate is 1500000
    [    0.000000] sclk_fimd: source is xusbxti (1), rate is 1500000
    [    0.000000] sclk_fimd: source is xusbxti (1), rate is 1500000
    [    0.000000] sclk_mfc: source is mout_mfc0 (0), rate is 200000000
    [    0.000000] sclk_g3d: source is mout_g3d0 (0), rate is 41666666
    [    0.000000] sclk_pwi: source is xusbxti (1), rate is 1500000
    [    0.000000] PERCPU: Embedded 7 pages/cpu @c0dc8000 s6752 r8192 d13728 u32768
    [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 259842
    [    0.000000] Kernel command line: console=ttySAC2,115200                //--------------------------------------------------------
    [    0.000000] log_buf_len: 524288
    [    0.000000] early log buf free: 127784(97%)
    [    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
    [    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
    [    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 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   (   4 kB)
    [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    [    0.000000]     DMA     : 0xfea00000 - 0xffe00000   (  20 MB)
    [    0.000000]     vmalloc : 0xee800000 - 0xf6000000   ( 120 MB)
    [    0.000000]     lowmem  : 0xc0000000 - 0xee000000   ( 736 MB)
    [    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    [    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
    [    0.000000]       .init : 0xc0008000 - 0xc003f000   ( 220 kB)
    [    0.000000]       .text : 0xc003f000 - 0xc08db000   (8816 kB)
    [    0.000000]       .data : 0xc08dc000 - 0xc0981a40   ( 663 kB)
    [    0.000000]        .bss : 0xc0981d30 - 0xc09beff0   ( 245 kB)
    [    0.000000] SLUB: Genslabs=13, HWalign=32, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
    [    0.000000] Preemptible hierarchical RCU implementation.
    [    0.000000] NR_IRQS:456
    [    0.000000] Calibrating delay loop... 1992.29 BogoMIPS (lpj=4980736)
    [    0.045000] pid_max: default: 32768 minimum: 301
    [    0.045000] Mount-cache hash table entries: 512
    [    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: 16 ways, CACHE_ID 0x4100c4c8, AUX_CTRL 0x7e470001, Cache size: 1048576 B
    [    0.075000] CPU1: Booted secondary processor
    [    0.095000] CPU2: Booted secondary processor
    [    0.115000] CPU3: Booted secondary processor
    [    0.115000] Brought up 4 CPUs
    [    0.115000] SMP: Total of 4 processors activated (7969.17 BogoMIPS).
    [    0.120000] print_constraints: dummy: 
    [    0.120000] NET: Registered protocol family 16
    [    0.120000] value1 = 0, value2 = 1, type = 0x1
    [    0.120000] value1 = 0, value2 = 1, type = 0x1
    [    0.135000] exynos4_pmu_init: PMU supports 4412(96)
    [    0.135000] S3C Power Management, Copyright 2004 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.0: power domain registered
    [    0.135000] samsung-pd samsung-pd.1: power domain registered
    [    0.135000] samsung-pd samsung-pd.2: power domain registered
    [    0.135000] samsung-pd samsung-pd.5: power domain registered
    [    0.135000] samsung-pd samsung-pd.4: power domain registered
    [    0.135000] samsung-pd samsung-pd.6: power domain registered
    [    0.135000] samsung-pd samsung-pd.7: power domain registered
    [    0.135000] s3c24xx-pwm s3c24xx-pwm.1: tin at 100000000, tdiv at 100000000, tin=divclk, base 8
    [    0.135000] UMP: UMP device driver  loaded
    [    0.155000] bio: create slab <bio-0> at 0
    [    0.155000] SCSI subsystem initialized
    [    0.155000] s3c64xx_spi_probe(969)
    [    0.155000] s3c64xx_spi_probe(1092)
    [    0.155000] s3c64xx_spi_probe(1113)
    [    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.0: using pins 42 (SDA) and 43 (SCL)
    [    0.160000] +s5m8767_pmic_probe()
    [    0.160000] print_constraints: vdd_mif range: 900 <--> 1100 mV at 1100 mV 
    [    0.160000] print_constraints: vdd_arm range: 850 <--> 1450 mV at 1200 mV 
    [    0.160000] print_constraints: vdd_int range: 875 <--> 1200 mV at 1000 mV 
    [    0.160000] print_constraints: vdd_g3d range: 750 <--> 1500 mV at 1100 mV 
    [    0.165000] print_constraints: vdd_m12 range: 750 <--> 1500 mV at 1200 mV 
    [    0.165000] print_constraints: vdd12_5m range: 750 <--> 1500 mV at 1200 mV 
    [    0.165000] print_constraints: vddf28_emmc range: 750 <--> 3000 mV at 2850 mV 
    [    0.170000] print_constraints: VDDQ_M12: 1200 mV 
    [    0.170000] print_constraints: VDD18_2M: 1800 mV 
    [    0.170000] print_constraints: VDD10_MIPI: 1000 mV 
    [    0.185000] print_constraints: VDD33_LCD: 3300 mV 
    [    0.185000] print_constraints: VDD18_MIPI: 1800 mV 
    [    0.195000] print_constraints: VDD33_UOTG: 3300 mV 
    [    0.200000] print_constraints: VDD10_USH: 1000 mV 
    [    0.200000] print_constraints: VDD18_HSIC: 1800 mV 
    [    0.200000] print_constraints: VDDIOPERI_28: 3300 mV 
    [    0.215000] print_constraints: DC33V_TP: 3300 mV 
    [    0.215000] print_constraints: VDD28_CAM: 1800 mV 
    [    0.215000] print_constraints: VDD28_AF: 2800 mV 
    [    0.215000] print_constraints: VDDA28_2M: 2800 mV 
    [    0.220000] print_constraints: VDD28_TF: 2800 mV 
    [    0.230000] print_constraints: VDD33_A31: 3300 mV 
    [    0.255000] print_constraints: VDD18_CAM: 1800 mV 
    [    0.255000] print_constraints: VDD18_A31: 1800 mV 
    [    0.255000] print_constraints: GPS_1V8: 1800 mV 
    [    0.260000] print_constraints: DVDD12: 1200 mV 
    [    0.260000] -s5m8767_pmic_probe()
    [    0.260000] s5m87xx 1-0066: S5M87xx MFD probe done!!! 
    [    0.260000] s3c-i2c s3c2440-i2c.1: i2c-1: S3C I2C adapter
    [    0.260000] s3c-i2c s3c2440-i2c.3: i2c-3: S3C I2C adapter
    [    0.260000] s3c-i2c s3c2440-i2c.4: i2c-4: S3C I2C adapter
    [    0.260000] s3c-i2c s3c2440-i2c.5: i2c-5: S3C I2C adapter
    [    0.260000] s3c-i2c s3c2440-i2c.7: i2c-7: S3C I2C adapter
    [    0.260000] Advanced Linux Sound Architecture Driver Version 1.0.24.
    [    0.260000] Bluetooth: Core ver 2.16
    [    0.260000] NET: Registered protocol family 31
    [    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
    [    0.260640] Switched to NOHz mode on CPU #2
    [    0.260646] Switched to NOHz mode on CPU #3
    [    0.260653] Switched to NOHz mode on CPU #1
    [    0.261840] NET: Registered protocol family 2
    [    0.262015] IP route cache hash table entries: 32768 (order: 5, 131072 bytes)
    [    0.262642] TCP established hash table entries: 131072 (order: 8, 1048576 bytes)
    [    0.264143] TCP bind hash table entries: 65536 (order: 7, 786432 bytes)
    [    0.264947] TCP: Hash tables configured (established 131072 bind 65536)
    [    0.264963] TCP reno registered
    [    0.264978] UDP hash table entries: 512 (order: 2, 16384 bytes)
    [    0.265039] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
    [    0.265305] NET: Registered protocol family 1
    [    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
    [    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-0 s3c-pl330
    [    0.318470]  DBUFF-64x8bytes Num_Chans-8 Num_Peri-1 Num_Events-32
    [    0.318767] Loaded driver for PL330 DMAC-1 s3c-pl330
    [    0.318782]  DBUFF-32x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32
    [    0.318879] Loaded driver for PL330 DMAC-2 s3c-pl330
    [    0.318894]  DBUFF-32x4bytes Num_Chans-8 Num_Peri-32 Num_Events-32
    [    0.326370] highmem bounce pool size: 64 pages
    [    0.326563] ashmem: initialized
    [    0.334795] fuse init (API version 7.16)
    [    0.335137] msgmni has been set to 688
    [    0.335776] io scheduler noop registered
    [    0.335789] io scheduler deadline registered
    [    0.335845] io scheduler cfq registered (default)
    [    0.336711] value1 = 0, value2 = 1, type = 0x1
    [    0.590044] (s3cfb_cfg_gpio, 96): BK_VDD_ON
    [    0.695084] (s3cfb_cfg_gpio, 118): 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启动时串口调试信息如下:

    [    0.700601]  CPU type: 
    [    0.700612]  Exynos 4412
    [    0.700623] value1 = 0, value2 = 1, type = 0x1
    [    0.710886] parent clock: 800000000, vclk: 62496000, vclk div: 13
    [    0.960563] (s3cfb_backlight_on, 361): LCD_PWM_ON
    [    0.965577] (s3cfb_backlight_on, 430): VGA_EN_ON
    [    0.965596] s3cfb s3cfb.0: registered successfully
    [    0.966251] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
    [    1.290258] s5pv210-uart.0: ttySAC0 at MMIO 0x13800000 (irq = 16) is a S3C6400/10
    [    1.370063] s5pv210-uart.1: ttySAC1 at MMIO 0x13810000 (irq = 20) is a S3C6400/10
    [    1.450061] s5pv210-uart.2: ttySAC2 at MMIO 0x13820000 (irq = 24) is a S3C6400/10
    [    2.465477] console [ttySAC2] enabled
    [    2.510061] s5pv210-uart.3: ttySAC3 at MMIO 0x13830000 (irq = 28) is a S3C6400/10
    [    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, 124
    [    4.211617] exynos_adc_probe, 134
    [    4.215024] exynos_adc_probe, 136
    [    4.218198] adc      initialized
    [    4.221242] relay_ctl        initialized
    [    4.230393] brd: module loaded
    [    4.235021] loop: module loaded
    [    4.236723] pmem: 0 init
    [    4.239498] pmem_gpu1: 0 init
    [    4.248745] CAN device driver interface
    [    4.251129] PPP generic driver version 2.4.2
    [    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 1
    [    4.292721] s5p-ehci s5p-ehci: irq 134, 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=0002, bcdDevice=0300
    [    4.317143] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [    4.324344] usb usb1: New USB device Class: Class=9, SubClass=0, Protocol=0
    [    4.331287] usb usb1: Product: S5P EHCI Host Controller
    [    4.336494] usb usb1: Manufacturer: Linux 3.0.15 ehci_hcd
    [    4.341874] usb usb1: SerialNumber: s5p-ehci
    [    4.346608] hub 1-0:1.0: USB hub found
    [    4.349858] hub 1-0:1.0: 3 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 (1-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) 2008-2009 Samsung Electronics
    [    4.409785] s3c-udc : version 15 March 2009
    [    4.423369] android_usb gadget: Mass Storage Function, version: 2009/09/11
    [    4.428783] android_usb gadget: Number of LUNs=3
    [    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: -16
    [    4.458726] mousedev: PS/2 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.2:USB Acecad Flair tablet driver
    [    4.495119] usbcore: registered new interface driver aiptek
    [    4.500564] aiptek: v2.3 (May 2, 2007):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.0006
    [    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.52:USB Wacom tablet driver
    [    4.552801] tsc2007 7-0048: i2c io error: -6
    [    4.556950] tsc2007 7-0048: i2c io error: -6
    [    4.561192] tsc2007 7-0048: i2c io error: -6
    [    4.565445] tsc2007 7-0048: i2c io error: -6
    [    4.569685] tsc2007 7-0048: i2c io error: -6
    [    4.573952] tsc2007 7-0048: i2c io error: -6
    [    4.578984] S3C24XX RTC, (c) 2004,2006 Simtec Electronics
    [    4.583514] s3c-rtc s3c64xx-rtc: rtc disabled, re-enabling
    [    4.588958] Begin gettime...................
    [    4.593183] s3c_rtc_gettime() 2064-25-44 45:85:59
    [    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: 2018/2/20 4:44:44(2)
    [    8.617588] Alrm-----------------s5m_rtc_read_alarm: 2000/0/1 0:0:0(-1)
    [    8.624267] -----time:s5m_rtc_read_time: 2018/2/20 4:44:45(2)
    [    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
    [   10.650947] lirc_dev: IR Remote Control driver registered, major 251 
    [   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.00
    [   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-0: 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) 2009 Samsung Electronics
    [   10.751176] S5P CEC Driver, (c) 2009 Samsung Electronics
    [   10.756939] MFC(Multi Function Codec - FIMV v5.x) registered successfully
    [   10.763337] Samsung Graphics 2D driver, (c) 2011 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) 2004 Simtec Electronics
    [   10.810135] s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
    [   10.818121] device-mapper: uevent: version 1.0.3
    [   10.822360] device-mapper: ioctl: 4.20.0-ioctl (2011-02-02) 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) 2011 Samsung Electronics Co., Ltd
    [   10.874644] clock source 0: sclk_dwmci (160000000 Hz)
    [   10.879605] dw_mmc dw_mmc: clock source 0: sclk_dwmci (160000000 Hz)
    [   10.886164] mmc0: Version ID 0x5342240a.
    [   10.889830] mjdbg: cmu_max_clcok:800000000
    [   10.893921] mjdbg: host->max_clk: 800000000
    [   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, 400000@ration:4,11[mjdbg] cmu_set_clock: 400000
    [   10.929332] s3c-sdhci s3c-sdhci.2: clock source 0: sclk_mmc (10666666 Hz)
    [   10.936047] mmc1: no vmmc regulator found
    [   10.940037] *******mmc0: inserted!!!!!******
    [   10.940190] mmc1: SDHCI controller on samsung-hsmmc [s3c-sdhci.2] using ADMA
    [   10.940203] wake enabled for irq 359
    [   10.940446] s3c-sdhci s3c-sdhci.3: clock source 0: sclk_mmc (10666666 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.3] 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: 1
    [   10.948369] GPS: mt3326_gps_probe: Registering chardev
    [   10.948376] GPS: mt3326_gps_probe: major: 249, minor: 0
    [   10.948631] GPS: mt3326_gps_probe: Done
    [   10.949893] Samsung Audio Subsystem Driver, (c) 2011 Samsung Electronics
    [   10.949953] audss_init: RCLK SRC[busclk]
    [   11.053233] mmc0: cmd 52 response timeout error
    [   11.059167] mmc0: cmd 52 response timeout error
    [   11.074324] mmc0: cmd 8 response timeout error
    [   11.079400] asoc: wm8960-hifi <-> samsung-i2s.0 mapping ok
    [   11.083424] mmc0: cmd 5 response timeout error
    [   11.089454] Samsung SRP driver, (c) 2010 Samsung Electronics
    [   11.093650] mmc0: cmd 5 response timeout error
    [   11.099873] mmc0: cmd 5 response timeout error
    [   11.104647] mmc0: cmd 5 response timeout error
    [   11.109435] mmc0: cmd 55 response timeout error
    [   11.114312] mmc0: cmd 55 response timeout error
    [   11.119184] mmc0: cmd 55 response timeout error
    [   11.124052] mmc0: cmd 55 response timeout error
    [   11.132033] SRP: Driver successfully probed
    [   11.134928] ALSA device list:
    [   11.137710]   #0: 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.30.
    [   11.158777] nf_conntrack version 0.5.0 (10100 buckets, 40400 max)
    [   11.165613] ctnetlink v0.93: registering with nfnetlink.
    [   11.170138] NF_TPROXY: Transparent proxy support initialized, version 4.1.0
    [   11.177066] NF_TPROXY: Copyright (c) 2006-2007 BalaBit IT Ltd.
    [   11.183099] xt_time: kernel timezone is -0000
    [   11.188633] ip_tables: (C) 2000-2006 Netfilter Core Team
    [   11.192655] arp_tables: (C) 2002 David S. Miller
    [   11.197162] TCP cubic registered
    [   11.201199] NET: Registered protocol family 10
    [   11.203347] mmc0:mshci_set_clock, 50000000@ration:4,11[mjdbg] cmu_set_clock: 50000000
    [   11.215858] Mobile IPv6
    [   11.216850] ip6_tables: (C) 2000-2006 Netfilter Core Team
    [   11.222463] IPv6 over IPv4 tunneling driver
    [   11.230913] NET: Registered protocol family 17
    [   11.231511] mmc0: new high speed DDR MMC card at address 0001
    [   11.239693] NET: Registered protocol family 15
    [   11.244078] can: controller area network core (rev 20090105 abi 8)
    [   11.244112] mmcblk0: mmc0:0001 4YMD3R 3.64 GiB 
    [   11.254848] NET: Registered protocol family 29
    [   11.259204] can: raw protocol (rev 20090105)
    [   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 35
    [   11.295062] *******mmc2: inserted!!!!!******
    [   11.300641] EXYNOS4X12: Adaptive Support Voltage init
    [   11.304623] EXYNOS4X12: IDS : 9 HPM : 16 RESULT : 2
    [   11.309501] ************ exynos4x12_set_abb:0x0, 0x0, 0x0, 0x0, 0x80000088
    [   11.316355] VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
    [   11.323999] Registering SWP/SWPB emulation handler
    [   11.328769] DVFS : VDD_ARM Voltage table set with 2 Group
    [   11.334145] exynos4x12_cpufreq_init:topeet pop
    [   11.338949] DVFS : VDD_INT Voltage table set with 2 Group
    [   11.340080] *******mmc2: inserted!!!!!******
    [   11.385093] *******mmc2: inserted!!!!!******
    [   11.410199] exynos4_integrated_dvfs_hotplug_init, max(1400000),min(200000)
    [   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 = 0, value2 = 1, type = 0x1
    [   11.491830] ==ft5x0x_ts_init: reset==
    [   11.820044] usb 1-3: new high speed USB device number 2 using s5p-ehci
    [   11.955411] usb 1-3: New USB device found, idVendor=0424, idProduct=3503, bcdDevice=a1a0
    [   11.962042] usb 1-3: New USB device strings: Mfr=0, Product=0, SerialNumber=0
    [   11.969160] usb 1-3: New USB device Class: Class=9, SubClass=0, Protocol=2
    [   11.976587] hub 1-3:1.0: USB hub found
    [   11.979889] hub 1-3:1.0: 3 ports detected
    [   12.025303] input: ft5x0x_ts as /devices/virtual/input/input2
    [   12.035634] ft5x0x_ts 3-0038: Firmware version 0x06
    [   12.039038] ft5x0x_ts 3-0038: FocalTech ft5x0x TouchScreen initialized
    [   12.046790] -----time:s5m_rtc_read_time: 2018/2/20 4:44:48(2)
    [   12.265183] usb 1-3.2: new high speed USB device number 3 using s5p-ehci
    [   12.375383] usb 1-3.2: config 1 interface 0 altsetting 0 endpoint 0x83 has an invalid bInterval 0, changing to 9
    [   12.467776] usb 1-3.2: New USB device found, idVendor=0a46, idProduct=9621, bcdDevice=0101
    [   12.474586] usb 1-3.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    [   12.495019] usb 1-3.2: New USB device Class: Class=0, SubClass=0, Protocol=0
    [   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.2] 0xF2, D[7] 0 OK
    [   12.529941] dm962x:  [Analysis.2] 0xF2, D[6] 0 OK
    [   12.534639] dm962x:  [Analysis.2] 0xF2, D[5] 0 EP1: Empty
    [   12.540022] dm962x:  [Analysis.2] 0xF2, D[3] 0 OK
    [   12.544697] dm962x:  [Analysis.2] 0xF2, D[2] 0 OK
    [   12.549395] dm962x:  [Analysis.2] 0xF2, D[1] 0 OK
    [   12.554082] dm962x:  [Analysis.2] 0xF2, D[0] 0 Status: TX buffer 0 pkts
    [   12.566384] dm962x: ethernet MAC address 00:00:ff:ff:00:00 (chip)
    [   12.571383] dm962x: 9620 Mode = 128
    [   12.588122] dm9620 1-3.2:1.0: eth0: register 'dm9620' at usb-s5p-ehci-3.2, Davicom DM9620 USB Ethernet, 00:00:ff:ff:00:00
    [   13.087605] Begin settime.......................................................................
    [   13.094937] s3c_rtc_settime() 2018-2-20 4:44:48
    [   13.099450] writeb is Over.................
    [   13.103447] settime---------s5m_rtc_set_time: 2018/2/20 4:44:48(2)
    [   13.135058] s5m-rtc s5m-rtc: setting system clock to 2018-02-20 04:44:48 UTC (1519101888)
    [   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.0 (c) 2010 Samsung Electronics
    [   13.189955] Freeing init memory: 220K
    [   13.201285] init: init.wireless.rc: 136: invalid option 'chmod'
    [   13.205801] init: init.wireless.rc: 172: ignored duplicate definition of service 'hfag'
    [   13.213739] init: init.wireless.rc: 178: ignored duplicate definition of service 'hsag'
    [   13.221725] init: init.wireless.rc: 184: ignored duplicate definition of service 'opush'
    [   13.229797] init: init.wireless.rc: 190: ignored duplicate definition of service 'pbap'
    [   13.237890] init: /init.smdk4x12.rc: 16: ignored duplicate definition of service 'console'
    [   13.246148] init (1): /proc/1/oom_adj is deprecated, please use /proc/1/oom_score_adj instead.
    [   13.264185] MFC F/W loaded successfully (size: 360008)
    [   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=0
    [   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.0 DATE=2012/08/16
    [   13.773093] [PSM][I]stp_psm_init: psm init (0xbf0330e4, 5128)
    [   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 190) installed 
    [   13.800682] [WMT-DEV][I]wmt_dev_read_file:open (/system/etc/firmware/WMT.cfg) O_RDONLY, 0
    [   13.814102] [WMT-CONF][I]wmt_conf_read_file:get full file name(/system/etc/firmware/WMT.cfg) buf(0xefec3000) size(673)
    [   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(0)rst(0)on(0)off(0)rtc(0)
    [   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 (100), LDO (100), RST(30), OFF(10), ON(30)
    [   13.862180] [WMT-PLAT][I]wmt_plat_init:set g_bgf_irq(372)
    [   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 191) 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:193:0
    [   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: 1       
    [   13.955871] [D_INIT]***freq_min:     875     
    [   13.959503] [D_INIT]***freq_max:     1080    
    [   13.963248] [D_INIT]***scan_tbl:     40      
    [   13.966806] [D_INIT]***space:        1       
    [   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 194) 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 190 minor 0 (pid 1257)
    [   14.402289] [WMT-DEV][I]WMT_open:1st call (400)
    [   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:0, fcCtrl:0, baud:921600, fm:2 
    [   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 1 opened.
    [   15.673835] s3cfb s3cfb.0: [fb0] dma: 0x690c4000, cpu: 0xf0cff000, size: 0x007d0000
    [   15.686073] s3cfb s3cfb.0: [fb1] dma: 0x69894000, cpu: 0xf14d0000, size: 0x007d0000
    [   15.699196] s3c-fimc3: FIMC3 2 opened.
    [   16.775048] Mali: :::exynos_result_of_asv : 2
    [   16.777929] Mali: mali_dvfs[0].vol = 900000
    [   16.782265] Mali: :::exynos_result_of_asv : 2
    [   16.787742] Mali: mali_dvfs[1].vol = 925000
    [   16.790639] Mali: :::exynos_result_of_asv : 2
    [   16.794945] Mali: mali_dvfs[2].vol = 1000000
    [   16.794954] Mali: :::exynos_result_of_asv : 2
    [   16.794960] Mali: mali_dvfs[3].vol = 1050000
    [   23.461949] request_suspend_state: wakeup (3->0) at 23461915637 (2018-02-20 04:44: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内核上的巨大的一个应用程序!

  • 相关阅读:
    wu
    Win10编译cuda版OpenCV
    Windows编译OpenCV可能下载失败的文件
    20220419Servlet和HTTP请求协议
    20220418Tomcat
    比 Navicat 还要好用、功能更强大的工具!
    Java 8的18个常用日期处理
    Oracle 执行存储过程五种方法(带参数& 不带参数)
    帆软设置浏览内容宽度为屏幕宽度
    帆软参数为空查询全部
  • 原文地址:https://www.cnblogs.com/pngcui/p/4665106.html
Copyright © 2020-2023  润新知