Before I also encountered this problem, and later I solved, but did not record, and now met, I was the whole day, so now recorded, for later reference;
I started to load the module when reported such an error:
Hello:module_layout:kernel tainted. Disabling lock debugging due to kernel tainthello:version magic ' 2.6.32-504.el6.i686 SMP mod_unload 686 ' should is ' 2.6. 32-504.el6.i686 SMP mod_unload modversions 686 '
The first two lines of error are kernel contamination, which is usually not passed during validation, or there is no simply no write Module_license () validation. I started writing about Module_license ("Dual BSD/GPL"); Verification Pass but later I changed to: Module_license ("GPL"); It is possible (in fact, the sense of the beginning of the verification is also possible, and then I experimented with the next).
As for the second error, your kernel tree version is inconsistent with the version of the kernel you are running. Can refer to this man's: http://blog.sina.com.cn/s/blog_752fa65f0100p6wc.html; and this man's: Http://blog.sina.com.cn/s/blog_ 6e5e78bf010105jj.html
I will share my solution and steps here (in fact, as the man mentioned);
The first step, look at the version of the kernel you are running: ls/usr/src/kernels/2.6.32-504.12.2.el6.i686/, which is stored in the corresponding version of your kernel source code, which I personally understand. Since there is nothing in the starting/usr/src/kernel/directory, I am through the command: Yum install kernel-headers kernel-devel gcc gets to. Available through Rpm-qa | grep ' kernel ' command to view these kernel-related packages, or you can use the Uname-r command to view the information of your kernel version, but it is strange that the version information I get with uname-r is not the same as/usr/src/kernel/, The brother who wished to know was told. (It is possible that Uname-r displays the run version number, not the kernel detail version number);
Below is Rpm-qa | The grep ' kernel ' command displays:
Kernel-2.6.32-504.el6.i686kernel-headers-2.6.32-504.12.2.el6.i686kernel-firmware-2.6.32-504.el6.noarchdracut-kernel-004-3 56.el6.noarchkernel-devel-2.6.32-504.12.2.el6.i686
The second step, look under your kernel source tree, ls/lib/modules/2.6.32-504.el6.i686/-l; paste only two soft-connected files below
lrwxrwxrwx. 1 root, 09:52 build,/home/kernel/linux-2.6.32lrwxrwxrwx. 1 root root 09:52 Source-/home/kernel/linux-2.6.32
I do the kernel of the source tree is: linux-2.6.32;
The third step, modify the configuration in the makefile file, modify the following:
obj-m:=hello.o#kerdir=/lib/modules/$ (shell uname-r)/buildkerdir=/usr/src/kernels/2.6.32-504.12.2.el6.i686curdir =$ (shell pwd) All: make-c $ (kerdir) m=$ (CURDIR) Modulesclean: make-c $ (kerdir) m=$ (CURDIR) Clean
Now basically, the other solution is to look at the link to the man above;
If there are errors, please correct them and grow together. Thank you!!
Loading module Error: Version magic ' 2.6.32-504.el6.i686 SMP mod_unload 686 ' should