asmlinkage void __init start_kernel(void)

김태훈80 2008.02.02 18:17 조회 수 : 7205 추천:73

asmlinkage void __init start_kernel(void)
{
        char * command_line;
        extern struct kernel_param __start___param[], __stop___param[];

        smp_setup_processor_id();



        /*
         * Need to run as early as possible, to initialize the
         * lockdep hash:
         */
        unwind_init();
        lockdep_init();
                /*K lockdep은, runtime에 lock들의 correctness를
                 * 보장해 주기 위한 도구이다.
                 *  이 도구는 lock들의 '클래스'에 대해 작동한다.
                 * 여기서 클래스란 locking rules 라는 면에 있어서
                 * 동일한 lock들의 그룹이다.
                 *  이 도구는 lock 클래스들의 상태(state)와 의존성
                 * (dependency)를 track한다. 그리고 이 상태와 의존성
                 * 들이 올바름을 확인한다.
                 *  자세한 것은 Documentation/lockdep-design.txt
                 * 를 참고할 것. CONFIG_LOCKDEP이 정의되어 있지 않으면
                 * lockdep 관련 기능들은 컴파일되지 않는다. */

        local_irq_disable();
        early_boot_irqs_off();
        early_init_irq_lock_class();

/*
* Interrupts are still disabled. Do necessary setups, then
* enable them
*/
        lock_kernel();
        boot_cpu_init();
        page_address_init();
        printk(KERN_NOTICE);
        printk(linux_banner);
        setup_arch(&command_line);


        /////////////////////////////// 1

        unwind_setup();
        setup_per_cpu_areas();
        smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */

        /*
         * 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();
        build_all_zonelists();
        page_alloc_init();
        printk(KERN_NOTICE "Kernel command line: %sn", saved_command_line);
        parse_early_param();
        parse_args("Booting kernel", command_line, __start___param,
                   __stop___param - __start___param,
                   &unknown_bootoption);
        if (!irqs_disabled()) {
                printk(KERN_WARNING "start_kernel(): bug: interrupts were "
                                "enabled *very* early, fixing itn");
                local_irq_disable();
        }

        //////////////////////////// 2

        sort_main_extable();
        trap_init();
        rcu_init();
        init_IRQ();
        pidhash_init();

        ///////////////////////////// 3

        init_timers();
        hrtimers_init();
        softirq_init();
        timekeeping_init();
        time_init();
        profile_init();
        if (!irqs_disabled())
                printk("start_kernel(): bug: interrupts were enabled earlyn");
        early_boot_irqs_on();
        local_irq_enable();

        //////////////////////////// 4

        /*
         * 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 &&
                        initrd_start < min_low_pfn << PAGE_SHIFT) {
                printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - "
                    "disabling it.n",initrd_start,min_low_pfn << PAGE_SHIFT);
                initrd_start = 0;
        }
#endif
        vfs_caches_init_early();
        cpuset_init_early();
        mem_init();
        kmem_cache_init();

        ////////////////////////////// 5

        setup_per_cpu_pageset();
        numa_policy_init();
        if (late_time_init)
                late_time_init();
        calibrate_delay();
        pidmap_init();
        pgtable_cache_init();
        prio_tree_init();
        anon_vma_init();
#ifdef CONFIG_X86
        if (efi_enabled)
                efi_enter_virtual_mode();
#endif
        fork_init(num_physpages);
        proc_caches_init();
        buffer_init();
        unnamed_dev_init();
        key_init();
        security_init();
        vfs_caches_init(num_physpages);

        ////////////////////////////// 6

        radix_tree_init();
        signals_init();
        /* rootfs populating might need page-writeback */
        page_writeback_init();
#ifdef CONFIG_PROC_FS
        proc_root_init();
#endif
        cpuset_init();
        taskstats_init_early();
        delayacct_init();

        check_bugs();

        acpi_early_init(); /* before LAPIC and SMP init */

        /* Do the rest non-__init'ed, we're now alive */
        rest_init();

        //////////////////////////////////// 7
}
번호 제목 글쓴이 날짜 조회 수
공지 [공지] 커널 스터디 관련 Q&A 게시판 입니다. [5] woos 2016.04.09 2194
1565 안녕하세요, 반장입니다.^^ [12] file 조은지 2010.04.05 7620
1564 powerpc 레지스터 용도에 대한 결과 [1] 김종화 2007.05.19 7581
1563 세그멘테이션에 관하여. [12] 홍문화 2011.07.22 7531
1562 메모리 모델에서 페이지 디렉토리와 페이지 테이블 [3] 무명 2011.05.01 7432
1561 [ARM중] . (점)과 : (라벨)을 이용한 주소 변환 [7] file 홍문화 2011.10.05 7426
1560 리눅스 커널소스 분석 사이트 [2] 이 종인 2012.05.08 7394
1559 ARM system developer's guide 요약본 [1] file 이수연 2007.11.11 7372
1558 이번주(10/23) 스터디장소 변경합니다. [3] 서기원 2010.10.23 7363
1557 [잡담] 한주의 시작입니다.. ^^ [4] 홍순민 2010.04.05 7339
1556 asmlinkage의 의미 [4] 홍문화 2011.04.12 7323
1555 설치 & 컴파일 방법 [5] 최문규 2010.06.20 7310
1554 첫째날에 공부한 내용 정리한번 해보는게 어떨까요?? 여러분의 의견을 묻습니다. [8] file 김정수 2007.02.26 7255
1553 안녕하세요~ [4] 조선근 2010.11.11 7248
1552 mini USB 케이블을 수배합니다. [1] 권기봉 2010.04.03 7238
1551 아키텍쳐에 관련된 내용입니다. [6] file 원민수 2007.02.25 7234
1550 uboot 관련소스 및 s3c2440 data sheet file 이수연 2007.11.19 7228
1549 엇 너무 조용하네. [2] 서정민 2010.04.05 7223
1548 [제안] 커널 스터디 병행 관련 제안해 봅니다. [12] 장병남 2010.04.12 7216
» asmlinkage void __init start_kernel(void) [7] 김태훈80 2008.02.02 7205
1546 setup.S 전반부 정리 자료 [1] file 이종우 2007.05.19 7190
XE Login