<div dir="ltr"><div><div><div><div>Hi Michael,<br><br></div>You can use binary utils like nm or objdump to exam your vmlinux.<br><br></div>Linker collects initcall functions and puts them in initcall section.<br></div>Kernel can find all initcall functions in initcall section.<br>
<br></div>Regards,<br>MH<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 10, 2014 at 3:00 AM, m silverstri <span dir="ltr"><<a href="mailto:michael.j.silverstri@gmail.com" target="_blank">michael.j.silverstri@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks. The vmlinx is a binary file, I don't see what you show in<br>
your response.<br>
<br>
I have another question is where does the kernel find these driver<br>
modules for it to load?<br>
>From the make file, a driver will compile into a .o file?<br>
<br>
As an example<br>
<br>
$ more Makefile<br>
s5p-jpeg-objs := jpeg-core.o<br>
obj-$(CONFIG_VIDEO_SAMSUNG_S5P_JPEG) += s5p-jpeg.o<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On Thu, Jan 9, 2014 at 8:15 AM, Miles MH Chen <<a href="mailto:orca.chen@gmail.com">orca.chen@gmail.com</a>> wrote:<br>
> Hello Michael,<br>
><br>
> The module_init call is defined as device_initcall, which is one of kernel<br>
> inicalls.<br>
> All initcalls are put to initcall section and kernel calls all initcalls at<br>
> boot time.<br>
><br>
> You can check this in your vmlinux:<br>
><br>
> ffffffff81765ed8 T __initcall_start<br>
> ffffffff81765ed8 T __setup_end<br>
> ffffffff81765ee0 t __initcall_trace_init_flags_sys_exitearly<br>
> ffffffff81765ee8 t __initcall_trace_init_flags_sys_enterearly<br>
> ffffffff81765ef0 t __initcall_init_hw_perf_eventsearly<br>
> ffffffff81765ef8 t __initcall_register_trigger_all_cpu_backtraceearly<br>
> ffffffff81765f00 t __initcall_spawn_ksoftirqdearly<br>
> ffffffff81765f08 t __initcall_init_workqueuesearly<br>
> ffffffff81765f10 t __initcall_check_cpu_stall_initearly<br>
> ffffffff81765f18 t __initcall_migration_initearly<br>
> ...<br>
><br>
> kernel calls do_initcalls in do_basic_setup<br>
><br>
> 783 static void __init do_basic_setup(void)<br>
> 784 {<br>
> 785 cpuset_init_smp();<br>
> 786 usermodehelper_init();<br>
> 787 shmem_init();<br>
> 788 driver_init();<br>
> 789 init_irq_proc();<br>
> 790 do_ctors();<br>
> 791 usermodehelper_enable();<br>
> 792 do_initcalls();<br>
> 793 random_int_secret_init();<br>
> 794 }<br>
><br>
> Regards,<br>
> MH<br>
><br>
><br>
><br>
> On Thu, Jan 9, 2014 at 10:25 AM, m silverstri<br>
> <<a href="mailto:michael.j.silverstri@gmail.com">michael.j.silverstri@gmail.com</a>> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> In a kernel driver code, I see it has 'module_init(jpeg_init)' and<br>
>> 'module_exit(jpeg_exit)'. I would like how know how will<br>
>> jpeg_init(void) gets call during kernel bring up.<br>
>><br>
>> As an example:<br>
>> static int __init jpeg_init(void)<br>
>> {<br>
>> printk(KERN_CRIT "Initialize JPEG driver\n");<br>
>><br>
>> platform_driver_register(&jpeg_driver);<br>
>><br>
>> return 0;<br>
>> }<br>
>><br>
>> static void __exit jpeg_exit(void)<br>
>> {<br>
>> platform_driver_unregister(&jpeg_driver);<br>
>> }<br>
>><br>
>> module_init(jpeg_init);<br>
>> module_exit(jpeg_exit);<br>
>><br>
>> Thank you.<br>
>><br>
>> _______________________________________________<br>
>> Kernelnewbies mailing list<br>
>> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
>> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
><br>
><br>
</div></div></blockquote></div><br></div>