linux :vmware kernel update導致vmware無法打開,解決

kernel 4.7 and VMWare Workstation 12.1.

# cd /usr/lib/vmware/modules/source
# tar xf vmnet.tar
# mv vmnet.tar vmnet.old.tar
# sed -i -e 's/dev->trans_start = jiffies/netif_trans_update\(dev\)/g' vmnet-only/netif.c
# tar cf vmnet.tar vmnet-only
# vmware-modconfig --console --install-all

3.13 kernel vmnet fails to build

$ curl http://pastie.org/pastes/8672356/download -o /tmp/vmware-netfilter.patch
$ cd /usr/lib/vmware/modules/source
# tar -xvf vmnet.tar
# patch -p0 -i /tmp/vmware-netfilter.patch
# tar -cf vmnet.tar vmnet-only
# rm -r vmnet-only
# vmware-modconfig --console --install-all

3.17 kernel vmnet fails to build

# - as root user
$ cd /usr/lib/vmware/modules/source
$ tar -xvf vmnet.tar
# - edit the file vmnet-only/netif.c and replace the line that looks like
    dev = alloc_netdev(sizeof *netIf, deviceName, VNetNetIfSetup);
to
    dev = alloc_netdev(sizeof *netIf, deviceName, NET_NAME_UNKNOWN, VNetNetIfSetup);
$ tar -cvf vmnet.tar vmnet-only/
$ rm -rf vmnet-only/
$ vmware-modconfig --console --install-all

Kernel – 4.9-rc3

編輯vmnet-only/userif.c,修改下面內容:

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)    retval = get_user_pages(addr, 1, 1, 0, &page, NULL);#else    retval = get_user_pages(current, current->mm, addr,                1, 1, 0, &page, NULL);#endif

改爲:

    

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)     retval = get_user_pages(addr, 1, 0, &page, NULL);#else#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)     retval = get_user_pages(addr, 1, 1, 0, &page, NULL);#else     retval = get_user_pages(current, current->mm, addr,                 1, 1, 0, &page, NULL);#endif#endif

編輯vmmon-only/linux/hostif.c,修改以下內容:

        

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)   retval = get_user_pages((unsigned long)uvAddr, numPages, 0, 0, ppages, NULL);#else   retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,                           numPages, 0, 0, ppages, NULL);#endif

改爲:


#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)   retval = get_user_pages((unsigned long)uvAddr, numPages, 0, ppages, NULL);#else#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)   retval = get_user_pages((unsigned long)uvAddr, numPages, 0, 0, ppages, NULL);#else   retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,                           numPages, 0, 0, ppages, NULL);#endif#endif

重新打包文件

tar cf vmnet.tar vmnet-only
tar cf vmmon.tar vmmon-only

執行命令:

 vmware-modconfig --console --install-all

執行結果:

[root@localhost source]# vmware-modconfig --console --install-all
Stopping vmware (via systemctl):                           [  OK  ]
make: Entering directory '/tmp/modconfig-vbVNzr/vmmon-only'
Using kernel build system.
/bin/make -C /lib/modules/4.9.5-200.fc25.x86_64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= modules
make[1]: Entering directory '/usr/src/kernels/4.9.5-200.fc25.x86_64'
  CC [M]  /tmp/modconfig-vbVNzr/vmmon-only/linux/driverLog.o
  CC [M]  /tmp/modconfig-vbVNzr/vmmon-only/linux/driver.o
  CC [M]  /tmp/modconfig-vbVNzr/vmmon-only/linux/hostif.o
  CC [M]  /tmp/modconfig-vbVNzr/vmmon-only/common/memtrack.o
  CC [M]  /tmp/modconfig-vbVNzr/vmmon-only/common/apic.o
  CC [M]  /tmp/modconfig-vbVNzr/vmmon-only/common/vmx86.o
  CC [M]  /tmp/modconfig-vbVNzr/vmmon-only/common/cpuid.o
  CC [M]  /tmp/modconfig-vbVNzr/vmmon-only/common/task.o
/tmp/modconfig-vbVNzr/vmmon-only/linux/driver.c:1283:1: warning: always_inline function might not be inlinable [-Wattributes]
 LinuxDriverSyncReadTSCs(uint64 *delta) // OUT: TSC max - TSC min
 ^~~~~~~~~~~~~~~~~~~~~~~
  CC [M]  /tmp/modconfig-vbVNzr/vmmon-only/common/hashFunc.o
/tmp/modconfig-vbVNzr/vmmon-only/common/task.o: warning: objtool: .text: unexpected end of section
  CC [M]  /tmp/modconfig-vbVNzr/vmmon-only/common/comport.o
  CC [M]  /tmp/modconfig-vbVNzr/vmmon-only/common/phystrack.o
  CC [M]  /tmp/modconfig-vbVNzr/vmmon-only/vmcore/moduleloop.o
/tmp/modconfig-vbVNzr/vmmon-only/common/phystrack.o: warning: objtool: PhysTrack_Free() falls through to next function PhysTrack_Add()
/tmp/modconfig-vbVNzr/vmmon-only/common/phystrack.o: warning: objtool: PhysTrack_Add() falls through to next function PhysTrack_Remove()
/tmp/modconfig-vbVNzr/vmmon-only/common/phystrack.o: warning: objtool: PhysTrack_Remove() falls through to next function PhysTrack_Test()
  LD [M]  /tmp/modconfig-vbVNzr/vmmon-only/vmmon.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /tmp/modconfig-vbVNzr/vmmon-only/vmmon.mod.o
  LD [M]  /tmp/modconfig-vbVNzr/vmmon-only/vmmon.ko
make[1]: Leaving directory '/usr/src/kernels/4.9.5-200.fc25.x86_64'
/bin/make -C $PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= postbuild
make[1]: Entering directory '/tmp/modconfig-vbVNzr/vmmon-only'
make[1]: 'postbuild' is up to date.
make[1]: Leaving directory '/tmp/modconfig-vbVNzr/vmmon-only'
cp -f vmmon.ko ./../vmmon.o
make: Leaving directory '/tmp/modconfig-vbVNzr/vmmon-only'
make: Entering directory '/tmp/modconfig-vbVNzr/vmnet-only'
Using kernel build system.
/bin/make -C /lib/modules/4.9.5-200.fc25.x86_64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= modules
make[1]: Entering directory '/usr/src/kernels/4.9.5-200.fc25.x86_64'
  CC [M]  /tmp/modconfig-vbVNzr/vmnet-only/driver.o
  CC [M]  /tmp/modconfig-vbVNzr/vmnet-only/hub.o
  CC [M]  /tmp/modconfig-vbVNzr/vmnet-only/userif.o
  CC [M]  /tmp/modconfig-vbVNzr/vmnet-only/netif.o
In file included from ./include/linux/pci.h:35:0,
                 from /tmp/modconfig-vbVNzr/vmnet-only/compat_netdevice.h:27,
                 from /tmp/modconfig-vbVNzr/vmnet-only/netif.c:43:
./include/linux/pci_ids.h:2253:0: warning: "PCI_VENDOR_ID_VMWARE" redefined
 #define PCI_VENDOR_ID_VMWARE  0x15ad
 
In file included from /tmp/modconfig-vbVNzr/vmnet-only/net.h:38:0,
                 from /tmp/modconfig-vbVNzr/vmnet-only/vnetInt.h:26,
                 from /tmp/modconfig-vbVNzr/vmnet-only/netif.c:42:
/tmp/modconfig-vbVNzr/vmnet-only/vm_device_version.h:56:0: note: this is the location of the previous definition
 #define PCI_VENDOR_ID_VMWARE                    0x15AD
 
  CC [M]  /tmp/modconfig-vbVNzr/vmnet-only/bridge.o
  CC [M]  /tmp/modconfig-vbVNzr/vmnet-only/procfs.o
  CC [M]  /tmp/modconfig-vbVNzr/vmnet-only/smac_compat.o
  CC [M]  /tmp/modconfig-vbVNzr/vmnet-only/smac.o
  CC [M]  /tmp/modconfig-vbVNzr/vmnet-only/vnetEvent.o
  CC [M]  /tmp/modconfig-vbVNzr/vmnet-only/vnetUserListener.o
In file included from /tmp/modconfig-vbVNzr/vmnet-only/net.h:38:0,
                 from /tmp/modconfig-vbVNzr/vmnet-only/vnetInt.h:26,
                 from /tmp/modconfig-vbVNzr/vmnet-only/bridge.c:52:
/tmp/modconfig-vbVNzr/vmnet-only/vm_device_version.h:56:0: warning: "PCI_VENDOR_ID_VMWARE" redefined
 #define PCI_VENDOR_ID_VMWARE                    0x15AD
 
In file included from ./include/linux/pci.h:35:0,
                 from /tmp/modconfig-vbVNzr/vmnet-only/compat_netdevice.h:27,
                 from /tmp/modconfig-vbVNzr/vmnet-only/bridge.c:51:
./include/linux/pci_ids.h:2253:0: note: this is the location of the previous definition
 #define PCI_VENDOR_ID_VMWARE  0x15ad
 
  LD [M]  /tmp/modconfig-vbVNzr/vmnet-only/vmnet.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /tmp/modconfig-vbVNzr/vmnet-only/vmnet.mod.o
  LD [M]  /tmp/modconfig-vbVNzr/vmnet-only/vmnet.ko
make[1]: Leaving directory '/usr/src/kernels/4.9.5-200.fc25.x86_64'
/bin/make -C $PWD SRCROOT=$PWD/. \
  MODULEBUILDDIR= postbuild
make[1]: Entering directory '/tmp/modconfig-vbVNzr/vmnet-only'
make[1]: 'postbuild' is up to date.
make[1]: Leaving directory '/tmp/modconfig-vbVNzr/vmnet-only'
cp -f vmnet.ko ./../vmnet.o
make: Leaving directory '/tmp/modconfig-vbVNzr/vmnet-only'
Starting vmware (via systemctl):                           [  OK  ]


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章