# Verson Magic problem

2015/07/28 13:56

The version magic number of the kernel that being used to build the externel module has to be exactly the same as the kernel running 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 this case, I would like to avoid to build and replace the whole kernel. The wireless driver is the only kernel module that 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 of the following four parts which can be found at the beginning of Makefile:

VERSION = 3
PATCHLEVEL = 1
SUBLEVEL = 10
EXTRAVERSION =

The guide indicates that modifying the Makefile as shown below, simply use the VC number as EXTRAVERSION which is originaly omitted will solve the problem. However, you will end up with something like “3.1.10-g05b777c-g22b4fcd-dirty SMP preempt mod_unload ARMv7”.

VERSION = 3
PATCHLEVEL = 1
SUBLEVEL = 10
EXTRAVERSION = -g05b777c

“-g05b777c” is the number of current version generated by the version control system(git, svn, etc.). After a little dig into Makefile, it turns out version number is stored in the file include/config/kernel.release and the local version is generated by the script scripts/setlocalversion. By default, it will check if version control system is available. If so, then it will append “dirty” to local version after the commit number if the commit haven’t been submitted. That is 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.

0
0 收藏

0 评论
0 收藏
0