歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux服務器 >> VMWare在2.6.20內核下編譯出錯的解決方法

VMWare在2.6.20內核下編譯出錯的解決方法

日期:2017/3/2 16:54:03   编辑:Linux服務器

安裝中錯誤信息:

Using 2.6.x kernel build system.make:
Entering directory `/tmp/vmware-config0/vmmon-only'make -C
/lib/modules/2.6.20-5-generic/build/include/..
SUBDIRS=$PWD SRCROOT=$PWD/. modulesmake[1]:
Entering directory `/usr/src/linux-headers-2.6.20-5-generic'
CC [M] /tmp/vmware-config0/vmmon-only/linux/driver.oIn 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]
錯誤 1make[1]: *** [_module_/tmp/vmware-config0/vmmon-only]
錯誤 2make[1]: Leaving directory `/usr/src/linux-headers-2.6.20-5-generic'make:
*** [vmmon.ko] 錯誤 2make: Leaving directory
`/tmp/vmware-config0/vmmon-only'Unable to build the vmmon module.


  以上的compat_kernel.h定義與2.6.20的內核有不兼容的地方,那我們就來修改compat_kernel.h使其與compat_kernel.h與內核兼容就可以了。

  首先備份原始文件,然後解壓vmmon.tar:

  cd /usr/lib/vmware/modules/sourcesudo cp vmmon.tar vmmon.tar.oldsudo tar xvf vmmon.tarsudo gedit vmmon-only/include/compat_kernel.h

  將21行:

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

  替換為:

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

  然後重新打包vmmon.tar:

  tar cvf vmmon.tar vmmon-onlyrm -rf vmmon-only

  繼續編譯,vmmon模塊是編譯通過了,可是vmnet模塊又出現了如下的錯誤:

make[1]: Entering directory
`/usr/src/linux-headers-2.6.20-5-generic' CC [M]
/tmp/vmware-config1/vmnet-only/driver.o CC [M]
/tmp/vmware-config1/vmnet-only/hub.o CC [M]
/tmp/vmware-config1/vmnet-only/userif.
o/tmp/vmware-config1/vmnet-only/userif.c:
In function ‘VNetCopyDatagramToUser’:
/tmp/vmware-config1/vmnet-only/userif.c:629: error:
‘CHECKSUM_HW’ undeclared (first use in this function)
/tmp/vmware-config1/vmnet-only/userif.c:629: error:
(Each undeclared identifier is reported only
once/tmp/vmware-config1/vmnet-only/userif.c:629:
error: for each function it appears in.)make[2]:
*** [/tmp/vmware-config1/vmnet-only/userif.o]
錯誤 1make[1]: *** [_module_/tmp/vmware-config1/vmnet-only]
錯誤 2make[1]: Leaving directory `/usr/src/linux-headers-2.6.20-5-generic'make:
*** [vmnet.ko] 錯誤 2make: Leaving directory
`/tmp/vmware-config1/vmnet-only'Unable to build the vmnet module.


  現在是vmnet的問題,同樣的我們要修改不兼容的代碼,然後重新編譯。

  首先備份原始的vmnet.tar,並解壓:

  cd /usr/lib/vmware/modules/sourcesudo cp vmnet.tar vmnet.tar.oldsudo tar xvf vmnet.tarsudo gedit vmnet-only/userif.c和bridge.c

  將其中的CHECKSUM_HW替換成CHECKSUM_COMPLETE。

  然後重新打包:

  tar cvf vmnet.tar vmmon-onlyrm -rf vmnet-only

Copyright © Linux教程網 All Rights Reserved