博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
linux的kernel是怎样工作的(TI_DM36X_ARM系统)(1)
阅读量:4598 次
发布时间:2019-06-09

本文共 5098 字,大约阅读时间需要 16 分钟。

嵌入式系统DM36X的kernel函数从/init/main.c中开始执行,程序如下:

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_off();/* * 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);        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()         */        pidhash_init();        vfs_caches_init_early();        sort_main_extable();        trap_init();        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();        }        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();        if (!irqs_disabled())                printk(KERN_CRIT "start_kernel(): bug: interrupts were "                                 "enabled early\n");        early_boot_irqs_on();        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 = 0;        }#endif        page_cgroup_init();        enable_debug_pagealloc();        kmemleak_init();        debug_objects_mem_init();        idr_init_cache();        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 */        rest_init();}

 具体的过程见后续分析

转载于:https://www.cnblogs.com/gangsaleisi/archive/2013/01/08/2851715.html

你可能感兴趣的文章
再谈iOS 7的手势滑动返回功能
查看>>
Jmeter测试dubbo接口填坑
查看>>
python小练——找出指定目录下小于指定字节的文件,输出到文本文件
查看>>
渐渐磨砺--16年11月封闭总结
查看>>
[zz]GDB调试精粹及使用实例
查看>>
数据库的创建和删除
查看>>
【消息队列MQ】各类MQ比较
查看>>
最简单的三层实例【插入据
查看>>
设计模式学习笔记——Prototype原型模式
查看>>
pom.xml里有红叉报错的解决办法
查看>>
Perl last和next的用法区别
查看>>
Selenium 管理 Cookies
查看>>
exceptionfunction[LeetCode]Permutations
查看>>
Linux(2)_常用命令2
查看>>
自定义分页
查看>>
[转]DELPHI——调试(1)
查看>>
JS秒数转成分秒时间格式
查看>>
xp_cmdshell 命令的开启与关闭,和状态查询
查看>>
Linux sudoers
查看>>
MySQL详解(18)-----------分页方法总结
查看>>