trick on the Verson Magic number of Linux Kernel
MAR 15TH, 2013 |
COMMENTS
Recently, I was working on building a modified wireless driver for Nexus
7 to support monitor mode. There are quite a few things that are very
Subtle and easy to get confused. I ' ll just write down the steps in case
That I forgot and might need them again.
This
is actually a very good guide for building customized kernel module
Except the issue I'll talk about below.
Kernel vermagic
The version magic number of the kernel that being used to build the
Externel module has to is exactly the same as the kernel on the
Device. It won ' t be a problem if you build the module and kernel, then
Load both of them to the device. However, in the case, I would like to
Avoid to build and replace the whole kernel. The wireless driver is the
Only kernel module-I want to build. Therefore, the kernel version
Magic has to be modified. The vermagic for the device is
"3.1.10-g05b777c SMP preempt mod_unload ARMv7" while my source code
Gives "3.1.10-g22b4fcd-dirty SMP preempt mod_unload ARMv7". So "3.1.10"
is the kernel version, it should match with the version of the kernel
Source. It consists the following four parts which can is found at
The beginning of Makefile:
The Guide
Indicates that modifying the Makefile as shown below and simply use the VC
Number as extraversion which is originaly omitted would solve the
Problem. However, you'll end up with the something like
"3.1.10-g05b777c-g22b4fcd-dirty SMP preempt mod_unload ARMv7".
"-g05b777c" is the number of current version generated by the version
Control system (git, SVN, etc.). After the a little dig into Makefile, it
Turns out version number are stored in the file
Include/config/kernel.release and the local version are generated by the
Script Scripts/setlocalversion. By default, it would check if version
Control system is available. If So, then it would append "dirty" to the local
Version after the commit number if the commit haven ' t been submitted.
Where "-g22b4fcd-dirty" comes from. We could simply supplement a
Parameter as Scripts/setlocalversion–save-scmversion and it won ' t
Generate the local version number.
Kernel source Root Path:makefile