VMware在Linux上安装时内核头文件的问题

VMware的作用不用介绍了,像 dorainm这种自己摆弄系统底层的,经常用 vmware弄个freeBSD、linux-2.4.x、linux-2.6.x之类的玩!

  大家在安装vmware后,运行vmware-config.pl,经常会卡在内核头文件这里

None of the pre-built vmmon modulesforVMware Workstation is suitableforyour running kernel.Doyou want this program to try to build the vmmon moduleforyoursystem(you need to have a C compiler installed on yoursystem)?[yes]

Using compiler"/usr/bin/gcc".Useenvironment variable CC to override.

What is the location of the directory of C header files that match your running kernel?[/usr/src/linux/include]

The path"/usr/src/linux/include"isnotan existing directory.

What is the location of the directory of C header files that match your running kernel?[/usr/src/linux/include
] /root/sources/linux-2.6.22.2/include

The directory of kernel headers(version@@VMWARE@@UTS_RELEASE)doesnotmatch your running kernel(version 2.6.22.2).Evenifthe module were to compile successfully,it wouldnotload into the running kernel.

What is the location of the directory of C header files that match your running kernel?[/usr/src/linux/include]


  可气吧!明明修改指向我自己编译用过了的linux内核文件夹了,但是提示还是错误(dorainm使用的内核是2.6.22.2)

The directory of kernel headers(version@@VMWARE@@UTS_RELEASE)doesnotmatch your running kernel(version 2.6.22.2).Evenifthe module were to compile successfully,it wouldnotload into the running kernel.


    打开 linux/version.h 一看,内容是

#defineLINUX_VERSION_CODE 132630
#defineKERNEL_VERSION(a,b,c)(((a)<<16)+((b)<<8)+(c))


  2.6.22内核 = 2<<16 + 6<<8 + 22 = 2*65536 + 6*256 + 22 =132630
为什么说版本不对阿?!难道版本算法不同?!(bc:谁在掐我的指头!)

  再次看,vmware读取的版本,UTS_RELEASE!我们往 linux/version.h 里面添加一行:

#defineUTS_RELEASE"2.6.22.2"
#defineLINUX_VERSION_CODE 132630
#defineKERNEL_VERSION(a,b,c)(((a)<<16)+((b)<<8)+(c))


  这次 vmware终于相信 dorainm提供给它的内核头文件的版本是匹配的。

  dorainm现在使用的 linux系统是自己编译的,如果安装的是发行版本,应该有相关的安装内核头文件的方法,比如 redhat/fedora系列的 yum, debian/ubuntu系列的 apt等
    如果没有,可以到 www.kernel.org上下载对应的内核,然后:

make mrproper
make oldconfig
make

  来编译内核头文件,再就按照文中的方法,让 vmware欢快得跑起来。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值