让 VMWare Workstation 5.5.3 能够在 Ubuntu 7.04 (Feisty Fawn)中正常运行!

来源:互联网 发布:c语言中关键字是什么 编辑:程序博客网 时间:2024/06/05 15:18

今天查看Linux Kernel modules,忽然发现/lib/modules下面有一个旧内核的目录,好奇之下进去看看,结果有了新发现,里面还有一些残存的配置,从名称看来应该是VMWare相关的,难不成是当初安装的时候,安装程序放的一些共享库在kernel modules目录中的?看看
新内核的module目录,什么都没有

[xport@ubuntu misc] $ pwd
/lib/modules/2.6.17-11-generic/misc

[xport@ubuntu misc] $ ls -l
总用量 1380
lrwxrwxrwx 1 root root 43 2007-04-21 01:33 vmmon.ko -> /lib/modules/2.6.17-11-generic/misc/vmmon.o
-rw-r--r-- 1 root root 487101 2007-04-21 01:33 vmmon.o
lrwxrwxrwx 1 root root 43 2007-04-21 01:34 vmnet.ko -> /lib/modules/2.6.17-11-generic/misc/vmnet.o
-rw-r--r-- 1 root root 913781 2007-04-21 01:34 vmnet.o


念及*NIX的好处,直接mv过去好了,应该可以直接用吧?!

[xport@ubuntu ~] $ sudo cp /lib/modules/2.6.17-11-generic/misc/*.o /lib/modules/2.6.20-15-generic/misc/
[xport@ubuntu ~] $ cd /lib/modules/2.6.17-11-generic/misc
[xport@ubuntu misc] $ sudo ln -s vmmon.o vmmon.ko
[xport@ubuntu misc] $ sudo ln -s vmnet.o vmnet.ko

但是这样运行vmware的网络服务却不成功,提示说:

[xport@ubuntu ~] $ sudo /etc/init.d/vmware start
vmware is installed, but it has not been (correctly) configured
for this system. To (re-)configure it, invoke the following command:
/usr/bin/vmware-config.pl.


运行vmware-config.pl又出来这个错误提示:

[xport@ubuntu ~] $ sudo /usr/bin/vmware-config.pl

...
... 省略 ...
...

None of the pre-built vmmon modules for VMware Server is suitable for your
running kernel. Do you want this program to try to build the vmmon 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.20-15-generic/build/include]

Extracting the sources of the vmmon module.

Building the vmmon module.

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmmon-only'
make -C /lib/modules/2.6.20-15-generic/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.20-15-generic'
CC [M] /tmp/vmware-config0/vmmon-only/linux/driver.o
In file included from /tmp/vmware-config0/vmmon-only/linux/driver.c:80:
/tmp/vmware-config0/vmmon-only/./include/compat_kernel.h:21: error: expected declaration specifiers or ‘...’ before ‘compat_exit’
/tmp/vmware-config0/vmmon-only/./include/compat_kernel.h:21: error: expected declaration specifiers or ‘...’ before ‘exit_code’
/tmp/vmware-config0/vmmon-only/./include/compat_kernel.h:21: warning: type defaults to ‘int’ in declaration of ‘_syscall1’
make[2]: *** [/tmp/vmware-config0/vmmon-only/linux/driver.o] Error 1
make[1]: *** [_module_/tmp/vmware-config0/vmmon-only] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.20-15-generic'
make: *** [vmmon.ko] Error 2
make: Leaving directory `/tmp/vmware-config0/vmmon-only'
Unable to build the vmmon module.

For more information on how to troubleshoot module-related problems, please
visit our Web site at "http://www.vmware.com/download/modules/modules.html" and
"http://www.vmware.com/support/reference/linux/prebuilt_modules_linux.html".

Execution aborted.


原来是build modules的时候出现了错误!

要解决此问题,需要修改VMWare的module source,所有的source都是一个tar文件:

[xport@ubuntu ~] $ ls -l /usr/lib/vmware/modules/source/
总用量 1824
-r--r--r-- 1 root root 706560 2007-04-21 01:33 vmmon.tar <--- 我们需要修改这个tar文件中的 compat_kernel.h
-r--r--r-- 1 root root 378880 2007-02-17 16:37 vmnet.tar
-r--r--r-- 1 root root 51200 2007-02-17 16:37 vmppuser.tar


修改内容如下,即把第21行的代码给注释掉后,把此文件再写回原来的vmmon.tar档案中:

/*

* static inline _syscall1(int, compat_exit, int, exit_code);
*/

这个做完以后,就可以再次运行vmware-config.pl去编译生成kernel modules了!

*** 补遗 ***

后来在论坛闲逛的时候,看到了更好的解决办法,我的手法有些暴力+粗糙了!

修改如下(原来是VMWare与2.6.19之后的内核有不兼容的地方):

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
static inline _syscall1(int, compat_exit, int, exit_code);
#endif

原创粉丝点击