去掉SVN管理kernel编译后版本自动变化

由于版本变化导致wifi驱动insmod检测时出错退出,提示:

# insmod unifi_sdio.ko

unifi_sdio: version magic '2.6.27 mod_unload ARMv6 ' should be '2.6.27-svn53 mod_unload ARMv6 '

insmod: init_module 'unifi_sdio.ko' failed (Exec format error)

 

查找到"2.6.27-svn53"是在$(srctree)/inlucde/linux/utsrelease.h中定义的,按$(srctree)/Makefile中

kernelrelease = $(KERNELVERSION)$(localver-full)

KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)

localver-full = $(localver)$(localver-auto)

ifdef CONFIG_LOCALVERSION_AUTO

_localver-auto = $(shell $(CONFIG_SHELL) /

                 $(srctree)/scripts/setlocalversion $(srctree))

localver-auto  = $(LOCALVERSION)$(_localver-auto)

endif

 

再到$(srctree)/scripts/setlocalversion查找,看到有

# Check for svn and a svn repo.

if rev=`svn info 2>/dev/null | grep '^Revision'`; then

rev=`echo $rev | awk '{print $NF}'`

changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l`

 

# Are there uncommitted changes?

if [ $changes != 0 ]; then

printf -- '-svn%s%s%s' "$rev" -dirty "$changes"

else

printf -- '-svn%s' "$rev"

fi

 

# All done with svn

exit

fi

原来是这里! 检测svn的版本信息,然后加入到_localver-auto,最终连接到kernelrelease。

注释掉这部分,编译后就可以正常加载了。

你可能感兴趣的:(SVN,shell,Module)