《Linux内核编程》第八章:模块魔术字

本文基于mstar801平台Linux2.6.35.11内核版本。

1.kernel2.6.35.11/include/linux/vermagic.h && kernel2.6.35.11/include/generated/utsrelease.h  && kernel2.6.35.11/include/config/kernel.release 

2.modinfo *.ko

3.去掉魔术字所带svn信息

.config

CONFIG_LOCALVERSION_AUTO = n (svn版本信息)

或:

make menuconfig

General setup-->Audomatically append version information to the version string

LOCALVERSION =

====================================================================
分析:
1.顶层kernel2.6.35.11/Makefile

......
include/config/kernel.release: include/config/auto.conf FORCE
        $(Q)rm -f $@
        $(Q)echo "$(KERNELVERSION)$$($(CONFIG_SHELL) $(srctree)/scripts/setlocalversion $(srctree))" > $@
......

2.生成工具kernel2.6.35.11/scripts/setlocalversion

......
# scm version string if not at a tagged commit
if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
        # full scm version string
        res="$res$(scm_version)"
else
        # apped a plus sign if the repository is not in a clean tagged
        # state and  LOCALVERSION= is not specified
        if test "${LOCALVERSION+set}" != "set"; then
                scm=$(scm_version --short)
                res="$res${scm:++}"
        fi
fi
......


你可能感兴趣的:(《Linux内核编程》第八章:模块魔术字)