Unknown symbol in module : printk_all_partitions
<p>I have compiled this code:</p>

<pre><code>#include &lt;linux/init.h&gt;
#include &lt;linux/kernel.h&gt;
#include &lt;linux/module.h&gt;
#include &lt;linux/genhd.h&gt; // declaration of  printk_all_partitions()


MODULE_LICENSE("GPL");


int __init start (void) {

        printk ("evaluating the module ") ;
        printk_all_partitions();
        printk (" module inserted .. ");

        return 0 ;
}

void __exit x(void) {
        printk ("module unloaded ..");
}

module_init(start);
module_exit (x);

MODULE_LICENSE("GPL");
</code></pre>

<p>makefile is:</p>

<pre><code>EXTRA_CFLAGS += -Wall
obj-m += printk_all_partitions.o

all :
    make -C /lib/modules/$(shell uname -r )/build M=$(PWD) modules

clean :
    make -C /lib/modules/$(shell uname -r )/build M=$(PWD) clean
</code></pre>

<p>when I run make I get </p>

<pre><code>WARNING: "printk_all_partitions" [/root/c++/modulez/multiple_source_files/printk_plm/printk_all_partitions.ko] undefined!
</code></pre>

<p>egrep -w 'printk|printk_all_partitions' /proc/kallsyms :</p>

<pre><code>ffffffff8162f135 T printk
ffffffff81ac7b46 T printk_all_partitions
</code></pre>

<p>Now the only difference between printk and printk_all_partitions is that printk_all_partitions does not exist in the Module.symvers
and printk is:</p>

<pre><code>0x27e1a049  printk  vmlinux EXPORT_SYMBOL
</code></pre>

<p>By the time i finished the writing I found out that a function must be EXPORT_SYMBOL-ed too in order for it to work</p>

<p>but if (somehow) Modules.symvers was deleted , and the kernel sources were not available, both printk and printk_all_partitions are begin with a "T", what other way to know is one is exported or not?</p>