一、前提条件:
本人在Window XP 专业版上安装了vmware workstation-5.5.6-80404, 然后在虚拟机上安装了ubuntu8.04 hardy。
ps: 以前一直用vmware 5.5.3,就是因为不能完全安装vmware tools,才更新到5.5.6版本,但还好这两个版本都在100M以内,6.X版本就无法忍受了,实在太大了。
二、错误提示:
如果直接在ubuntu8.04上安装vmware 5.5.6,在安装到vmhgfs和vmxnet这两个模块时,会提示如下错误:
代码: 全选
What is the location of the directory of C header files that match your running
kernel? [/lib/modules/2.6.24-16-generic/build/include]
Extracting the sources of the vmhgfs module.
Building the vmhgfs module.
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmhgfs-only'
make -C /lib/modules/2.6.24-16-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.24-16-generic'
CC [M] /tmp/vmware-config0/vmhgfs-only/cpName.o
In file included from include/linux/string.h:11,
from /tmp/vmware-config0/vmhgfs-only/cpName.h:18,
from /tmp/vmware-config0/vmhgfs-only/cpName.c:18:
include/linux/types.h:40: 错误: 与‘uintptr_t’类型冲突
/tmp/vmware-config0/vmhgfs-only/vm_basic_types.h:160: 错误: ‘uintptr_t’的上一个声明在此
make[2]: *** [/tmp/vmware-config0/vmhgfs-only/cpName.o] 错误 1
make[1]: *** [_module_/tmp/vmware-config0/vmhgfs-only] 错误 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.24-16-generic'
make: *** [vmhgfs.ko] 错误 2
make: Leaving directory `/tmp/vmware-config0/vmhgfs-only'
Unable to build the vmhgfs module.
The filesystem driver (vmhgfs module) is used only for the shared folder
feature. The rest of the software provided by VMware Tools is designed to work
independently of this feature.
If you wish to have the shared folders feature, you can install the driver by
running vmware-config-tools.pl again after making sure that gcc, binutils, make
and the kernel sources for your running kernel are installed on your machine.
These packages are available on your distribution's installation CD.
[ Press Enter key to continue ]
pcnet32 34820 0
Unloading pcnet32 module
Trying to find a suitable vmxnet module for your running kernel.
None of the pre-built vmxnet modules for VMware Tools is suitable for your
running kernel. Do you want this program to try to build the vmxnet module for
your system (you need to have a C compiler installed on your system)? [yes]
Extracting the sources of the vmxnet module.
Building the vmxnet module.
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config1/vmxnet-only'
make -C /lib/modules/2.6.24-16-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.24-16-generic'
CC [M] /tmp/vmware-config1/vmxnet-only/vmxnet.o
In file included from /tmp/vmware-config1/vmxnet-only/vmxnet.c:35:
/tmp/vmware-config1/vmxnet-only/vm_basic_types.h:160: 错误: 与‘ uintptr_t’类型冲突
include/linux/types.h:40: 错误: ‘uintptr_t’的上一个声明在此
/tmp/vmware-config1/vmxnet-only/vmxnet.c: 在函数‘vmxnet_probe_device’中:
/tmp/vmware-config1/vmxnet-only/vmxnet.c:476: 错误: 隐式声明函数‘SET_MODULE_OWNER’
/tmp/vmware-config1/vmxnet-only/vmxnet.c: 在函数‘vmxnet_open’中:
/tmp/vmware-config1/vmxnet-only/vmxnet.c:674: 错误: ‘SA_SHIRQ’未声明 (在此函数内第一次使用)
/tmp/vmware-config1/vmxnet-only/vmxnet.c:674: 错误: (即使在一个函数内多次出现,每个未声明的标识符在其
/tmp/vmware-config1/vmxnet-only/vmxnet.c:674: 错误: 所在的函数内也只报告一次。)
/tmp/vmware-config1/vmxnet-only/vmxnet.c: 在函数‘vmxnet_netpoll’中:
/tmp/vmware-config1/vmxnet-only/vmxnet.c:1058: 错误: 提供给函数‘vmxnet_interrupt’的实参太多
make[2]: *** [/tmp/vmware-config1/vmxnet-only/vmxnet.o] 错误 1
make[1]: *** [_module_/tmp/vmware-config1/vmxnet-only] 错误 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.24-16-generic'
make: *** [vmxnet.ko] 错误 2
make: Leaving directory `/tmp/vmware-config1/vmxnet-only'
Unable to build the vmxnet module.
既然遇到了这些声明错误等,就直接去调试代码。vmware tools的各个模块放在下面这个文件夹里:
代码: 全选
/<...>/vmware-tools-distrib/lib/modules/source/
vmdesched.tar vmxnet.tar vmhgfs.tar vmmemctl.tar
其中vmxnet.tar和vmhgfs.tar就是我们需要修改的代码包。具体要修改什么地方,我就不多说了,我把修改好的代码包放在附件中,你们下载下来,并用新的这两个包替换原来的这两个文件,就可以正常安装了。
我只修改了这两个包里的这些文件:vm_basic_types.h(vmhgfs及vmxnet包都有这个文件)、vmxnet.c(vmxnet包)。具体修改了什么地方,你们用diff命令,与原文件比较就知道了。
三、附件:
再次说明一下使用方法:
第一、把这两个附件:vmhgfs.tar、vmxnet.tar替换“/<...>/vmware-tools-distrib/lib/modules/source/”目录下的同名文件。
第二、在命令行下,进入“/<...>/vmware-tools-distrib/”目录,执行以下命令:
代码: 全选
zyk@ubuntu:/<...>/vmware-tools-distrib$ sudo ./vmware-install.pl
四、2楼说的问题解决了:
原因:调试后发现不是新版linux内核头文件的问题,而是我的代码包中,没有清除掉在旧版的内核头文件下生成的.o文件(导致make命令没能生成最新的.o文件)。新上传的vmhgfs.tar、vmxnet.tar已经清理了这些object文件,可以正确安装了!
五、成功安装过程:
代码: 全选
zyk@ubuntu:/usr/local/src/vmware-tools-distrib$ sudo ./vmware-install.pl
A previous installation of VMware software has been detected.
The previous installation was made by the tar installer (version 3).
Keeping the tar3 installer database format.
Uninstalling the tar installation of VMware Tools.
Stopping VMware Tools services in the virtual machine:
Guest operating system daemon:-ne done
Guest filesystem driver:-ne done
The removal of VMware Tools 5.5.6 build-80404 for Linux completed successfully.
Thank you for having tried this software.
Installing the content of the package.
In which directory do you want to install the binary files?
[/usr/bin]
What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc]
What is the directory that contains the init scripts?
[/etc/init.d]
In which directory do you want to install the daemon files?
[/usr/sbin]
In which directory do you want to install the library files?
[/usr/lib/vmware-tools]
The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]
In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]
The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes]
The installation of VMware Tools 5.5.6 build-80404 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".
Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes]
Stopping VMware Tools services in the virtual machine:
Guest operating system daemon:-ne done
Guest filesystem driver:-ne done
Trying to find a suitable vmhgfs module for your running kernel.
None of the pre-built vmhgfs modules for VMware Tools is suitable for your
running kernel. Do you want this program to try to build the vmhgfs module for
your system (you need to have a C compiler installed on your system)? [yes]
Using compiler "/usr/bin/gcc". Use environment variable CC to override.
What is the location of the directory of C header files that match your running
kernel? [/lib/modules/2.6.24-17-generic/build/include]
Extracting the sources of the vmhgfs module.
Building the vmhgfs module.
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmhgfs-only'
make -C /lib/modules/2.6.24-17-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.24-17-generic'
CC [M] /tmp/vmware-config0/vmhgfs-only/cpName.o
CC [M] /tmp/vmware-config0/vmhgfs-only/cpNameLinux.o
CC [M] /tmp/vmware-config0/vmhgfs-only/dev.o
CC [M] /tmp/vmware-config0/vmhgfs-only/driver.o
/tmp/vmware-config0/vmhgfs-only/driver.c:3994: 璀﹀憡锛?浠庝笉鍏煎鐨勬寚閽堢被鍨嬪垵濮嬪寲
CC [M] /tmp/vmware-config0/vmhgfs-only/hgfsUtil.o
CC [M] /tmp/vmware-config0/vmhgfs-only/main.o
CC [M] /tmp/vmware-config0/vmhgfs-only/staticEscape.o
LD [M] /tmp/vmware-config0/vmhgfs-only/vmhgfs.o
Building modules, stage 2.
MODPOST 1 modules
CC /tmp/vmware-config0/vmhgfs-only/vmhgfs.mod.o
LD [M] /tmp/vmware-config0/vmhgfs-only/vmhgfs.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.24-17-generic'
cp -f vmhgfs.ko ./../vmhgfs.o
make: Leaving directory `/tmp/vmware-config0/vmhgfs-only'
The module loads perfectly in the running kernel.
pcnet32 34820 0
Unloading pcnet32 module
Extracting the sources of the vmxnet module.
Building the vmxnet module.
Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmxnet-only'
make -C /lib/modules/2.6.24-17-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.24-17-generic'
CC [M] /tmp/vmware-config0/vmxnet-only/vmxnet.o
Building modules, stage 2.
MODPOST 1 modules
CC /tmp/vmware-config0/vmxnet-only/vmxnet.mod.o
LD [M] /tmp/vmware-config0/vmxnet-only/vmxnet.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.24-17-generic'
cp -f vmxnet.ko ./../vmxnet.o
make: Leaving directory `/tmp/vmware-config0/vmxnet-only'
The module loads perfectly in the running kernel.
Detected X.org version 0.0.0.
No drivers for X.org version: 0.0.0.
Do you want to change your guest X resolution? (yes/no) [no]
Starting VMware Tools services in the virtual machine:
Switching to guest configuration:-ne done
Guest filesystem driver:-ne done
DMA setup:-ne done
Guest operating system daemon:-ne done
The configuration of VMware Tools 5.5.6 build-80404 for Linux for this running
kernel completed successfully.
You must restart your X session before any mouse or graphics changes take
effect.
You can now run VMware Tools by invoking the following command:
"/usr/bin/vmware-toolbox" during an XFree86 session.
To use the vmxnet driver, restart networking using the following commands:
/etc/init.d/networking stop
rmmod pcnet32
rmmod vmxnet
depmod -a
modprobe vmxnet
/etc/init.d/networking start
Enjoy,
--the VMware team