免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4117 | 回复: 3
打印 上一主题 下一主题

基于arm的start_kernel()在哪里? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-03-05 21:01 |只看该作者 |倒序浏览
本帖最后由 letmego163 于 2010-03-05 21:11 编辑

如题。谢谢。我的内核是linux-2.6.32.2
以下是我用sourceinsight搜索出来的。我不敢确定是哪个。
  1. ---- start_kernel Matches (49 in 30 files) ----
  2. Boot.c (arch\x86\lguest):#include <linux/start_kernel.h>
  3. Boot.c (arch\x86\lguest):         * start_kernel, so we have to do, too:
  4. Bootp.c (arch\alpha\boot):start_kernel(void)
  5. Bootpz.c (arch\alpha\boot):start_kernel(void)
  6. Core.c (drivers\lguest\x86):#include <linux/start_kernel.h>
  7. Debug-stub.c (arch\frv\kernel):#include <linux/start_kernel.h>
  8. Debug-stub.c (arch\frv\kernel):                __debug_frame->pc = (unsigned long) start_kernel;
  9. Debug.c (arch\m68k\mac): * that is called from start_kernel() before setup_arch() and just registers
  10. Debugging390.txt (documentation\s390):00014a78 T start_kernel  
  11. Debugging390.txt (documentation\s390):so 0014CA6 is start_kernel+some hex number I can't add in my head.
  12. Enlighten.c (arch\x86\xen):#include <linux/start_kernel.h>
  13. Gdb-stub.c (arch\mn10300\kernel):                regs->pc = (unsigned long) start_kernel;
  14. Gdbstub.txt (documentation\frv):      the beginning of start_kernel() in init/main.c.
  15. Gdbstub.txt (documentation\frv):        start_kernel () at init/main.c:395
  16. head-common.S (arch\arm\kernel):        b        start_kernel
  17. head-nommu.S (arch\arm\kernel):                                                @ to start_kernel
  18. Head32.c (arch\x86\kernel):#include <linux/start_kernel.h>
  19. Head32.c (arch\x86\kernel):        start_kernel();
  20. Head64.c (arch\x86\kernel):#include <linux/start_kernel.h>
  21. Head64.c (arch\x86\kernel):        start_kernel();
  22. Init.c (arch\sh\kernel\cpu): * CPU prior to calling start_kernel(). For SMP, a combination of this and
  23. Init.c (arch\sh\kernel\cpu): * caches, FPU, DSP, kicking the UBC, etc. By the time start_kernel() is
  24. Irq.c (arch\cris\arch-v10\kernel):/* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and
  25. Irq.c (arch\cris\arch-v32\kernel): * This is called by start_kernel. It fixes the IRQ masks and setup the
  26. Lockdep.c (kernel):         * Some architectures have their own start_kernel()
  27. Lockdep.c (kernel):         * call lockdep_init() from the start_kernel() itself,
  28. Main.c (arch\alpha\boot):void start_kernel(void)
  29. Main.c (init):#include <linux/start_kernel.h>
复制代码
  1. Main.c (init): * between the root thread and the init thread may cause start_kernel to
  2. Main.c (init):asmlinkage void __init start_kernel(void)
  3. Main.c (init):                printk(KERN_WARNING "start_kernel(): bug: interrupts were "
  4. Main.c (init):                printk(KERN_CRIT "start_kernel(): bug: interrupts were "
  5. Paravirt_ops.txt (documentation\ia64):Those structures must be initialized very early before start_kernel.
  6. Process.c (arch\um\kernel\skas):extern void start_kernel(void);
  7. Process.c (arch\um\kernel\skas):        start_kernel();
  8. Sched.h (include\linux): * Reset by start_kernel()->sched_init()->init_idle().
  9. Setup.c (arch\ia64\kernel):        /* start_kernel() requires this... */
  10. Setup.c (arch\ia64\sn\kernel): * for bringup.  See start_kernel() in init/main.c.
  11. Setup.c (arch\parisc\kernel):        ** called by start_kernel(). In other words, this code can't
  12. Setup.c (arch\parisc\kernel):        ** start_kernel().
  13. Setup.c (arch\parisc\kernel):        extern void start_kernel(void);
  14. Setup.c (arch\parisc\kernel):        start_kernel();
  15. Setup_64.c (arch\powerpc\kernel): * Called into from start_kernel, after lock_kernel has been called.
  16. Smp.c (arch\parisc\kernel): * Do what start_kernel() and main() do for boot strap processor (aka monarch)
  17. Start_kernel.h (include\linux):/* Define the prototype for start_kernel here, rather than cluttering
  18. Start_kernel.h (include\linux):extern asmlinkage void __init start_kernel(void);
  19. UserModeLinux-HOWTO.txt (documentation\uml):  to gdb which will leave it stopped at the beginning of start_kernel.
  20. UserModeLinux-HOWTO.txt (documentation\uml):  it when it stops in start_kernel and make it crash.  Now ^C gdb and
  21. UserModeLinux-HOWTO.txt (documentation\uml):       #4  0x100ec18f in start_kernel () at init/main.c:592
复制代码

论坛徽章:
0
2 [报告]
发表于 2010-03-05 21:10 |只看该作者
我认为是这个 Main.c (init):asmlinkage void __init start_kernel(void)


init/main.c
  1. asmlinkage void __init start_kernel(void)
  2. {
  3.         char * command_line;
  4.         extern struct kernel_param __start___param[], __stop___param[];

  5.         smp_setup_processor_id();

  6.         /*
  7.          * Need to run as early as possible, to initialize the
  8.          * lockdep hash:
  9.          */
  10.         lockdep_init();
  11.         debug_objects_early_init();

  12.         /*
  13.          * Set up the the initial canary ASAP:
  14.          */
  15.         boot_init_stack_canary();

  16.         cgroup_init_early();

  17.         local_irq_disable();
  18.         early_boot_irqs_off();
  19.         early_init_irq_lock_class();

  20. /*
  21. * Interrupts are still disabled. Do necessary setups, then
  22. * enable them
  23. */
  24.         lock_kernel();
  25.         tick_init();
  26.         boot_cpu_init();
  27.         page_address_init();
  28.         printk(KERN_NOTICE "%s", linux_banner);
  29.         setup_arch(&command_line);
  30.         mm_init_owner(&init_mm, &init_task);
  31.         setup_command_line(command_line);
  32.         setup_nr_cpu_ids();
  33.         setup_per_cpu_areas();
  34.         smp_prepare_boot_cpu();        /* arch-specific boot-cpu hooks */

  35.         build_all_zonelists();
  36.         page_alloc_init();

  37.         printk(KERN_NOTICE "Kernel command line: %s\n", boot_command_line);
  38.         parse_early_param();
  39.         parse_args("Booting kernel", static_command_line, __start___param,
  40.                    __stop___param - __start___param,
  41.                    &unknown_bootoption);
  42.         /*
  43.          * These use large bootmem allocations and must precede
  44.          * kmem_cache_init()
  45.          */
  46.         pidhash_init();
  47.         vfs_caches_init_early();
  48.         sort_main_extable();
  49.         trap_init();
  50.         mm_init();
  51.         /*
  52.          * Set up the scheduler prior starting any interrupts (such as the
  53.          * timer interrupt). Full topology setup happens at smp_init()
  54.          * time - but meanwhile we still have a functioning scheduler.
  55.          */
  56.         sched_init();
  57.         /*
  58.          * Disable preemption - early bootup scheduling is extremely
  59.          * fragile until we cpu_idle() for the first time.
  60.          */
  61.         preempt_disable();
  62.         if (!irqs_disabled()) {
  63.                 printk(KERN_WARNING "start_kernel(): bug: interrupts were "
  64.                                 "enabled *very* early, fixing it\n");
  65.                 local_irq_disable();
  66.         }
  67.         rcu_init();
  68.         /* init some links before init_ISA_irqs() */
  69.         early_irq_init();
  70.         init_IRQ();
  71.         prio_tree_init();
  72.         init_timers();
  73.         hrtimers_init();
  74.         softirq_init();
  75.         timekeeping_init();
  76.         time_init();
  77.         profile_init();
  78.         if (!irqs_disabled())
  79.                 printk(KERN_CRIT "start_kernel(): bug: interrupts were "
  80.                                  "enabled early\n");
  81.         early_boot_irqs_on();
  82.         local_irq_enable();

  83.         /* Interrupts are enabled now so all GFP allocations are safe. */
  84.         set_gfp_allowed_mask(__GFP_BITS_MASK);

  85.         kmem_cache_init_late();

  86.         /*
  87.          * HACK ALERT! This is early. We're enabling the console before
  88.          * we've done PCI setups etc, and console_init() must be aware of
  89.          * this. But we do want output early, in case something goes wrong.
  90.          */
  91.         console_init();
  92.         if (panic_later)
  93.                 panic(panic_later, panic_param);

  94.         lockdep_info();

  95.         /*
  96.          * Need to run this when irqs are enabled, because it wants
  97.          * to self-test [hard/soft]-irqs on/off lock inversion bugs
  98.          * too:
  99.          */
  100.         locking_selftest();

  101. #ifdef CONFIG_BLK_DEV_INITRD
  102.         if (initrd_start && !initrd_below_start_ok &&
  103.             page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) {
  104.                 printk(KERN_CRIT "initrd overwritten (0x%08lx < 0x%08lx) - "
  105.                     "disabling it.\n",
  106.                     page_to_pfn(virt_to_page((void *)initrd_start)),
  107.                     min_low_pfn);
  108.                 initrd_start = 0;
  109.         }
  110. #endif
  111.         page_cgroup_init();
  112.         enable_debug_pagealloc();
  113.         kmemtrace_init();
  114.         kmemleak_init();
  115.         debug_objects_mem_init();
  116.         idr_init_cache();
  117.         setup_per_cpu_pageset();
  118.         numa_policy_init();
  119.         if (late_time_init)
  120.                 late_time_init();
  121.         sched_clock_init();
  122.         calibrate_delay();
  123.         pidmap_init();
  124.         anon_vma_init();
  125. #ifdef CONFIG_X86
  126.         if (efi_enabled)
  127.                 efi_enter_virtual_mode();
  128. #endif
  129.         thread_info_cache_init();
  130.         cred_init();
  131.         fork_init(totalram_pages);
  132.         proc_caches_init();
  133.         buffer_init();
  134.         key_init();
  135.         security_init();
  136.         vfs_caches_init(totalram_pages);
  137.         radix_tree_init();
  138.         signals_init();
  139.         /* rootfs populating might need page-writeback */
  140.         page_writeback_init();
  141. #ifdef CONFIG_PROC_FS
  142.         proc_root_init();
  143. #endif
  144.         cgroup_init();
  145.         cpuset_init();
  146.         taskstats_init_early();
  147.         delayacct_init();

  148.         check_bugs();

  149.         acpi_early_init(); /* before LAPIC and SMP init */
  150.         sfi_init_late();

  151.         ftrace_init();

  152.         /* Do the rest non-__init'ed, we're now alive */
  153.         rest_init();
  154. }
复制代码

论坛徽章:
0
3 [报告]
发表于 2010-03-05 21:34 |只看该作者
楼上正解。至少2.4.x内核是这个函数。

论坛徽章:
0
4 [报告]
发表于 2010-03-05 22:59 |只看该作者
呵呵
一般都是 init/main.c里的start_kernel
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP