【开发工具】VMware安装Fedora17,安装VMware-tools出错无法共享文件的解决办法

来源:互联网 发布:随机红包算法 编辑:程序博客网 时间:2024/06/05 23:38

之前用的VMware7,安装Fedora14,VMware-tools安装出错,无法共享文件夹,打开共享时报错

以为是版本问题,下载了最新的VMware8,Fedora17,安装Vmware-tools仍然出错,打开共享不报错,但/mnt/hgfs下为空。

VMware-tools版本为VMware-Tools-8.8.2,报错如下:

[root@Fedora bin]# ./vmware-config-tools.pl ........#省略Using 2.6.x kernel build system.make: Entering directory `/tmp/vmware-root/modules/vmhgfs-only'make -C /lib/modules/3.4.0-1.fc17.i686/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \  MODULEBUILDDIR= modulesmake[1]: Entering directory `/usr/src/kernels/3.4.0-1.fc17.i686'  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/message.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/request.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/hgfsUtil.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/cpName.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/link.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/tcp.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/rpcout.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/backdoorGcc32.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/hgfsEscape.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/file.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/transport.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/inode.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/super.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/vmci.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/dir.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/bdhandler.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/fsutil.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/hgfsBd.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/cpNameLinux.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/module.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/filesystem.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/stubs.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/backdoor.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/page.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/dentry.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/cpNameLite.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/kernelStubsLinux.o/tmp/vmware-root/modules/vmhgfs-only/file.c:128:4: warning: initialization from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmhgfs-only/file.c:128:4: warning: (near initialization for ‘HgfsFileFileOperations.fsync’) [enabled by default]/tmp/vmware-root/modules/vmhgfs-only/inode.c:121:4: warning: initialization from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmhgfs-only/inode.c:121:4: warning: (near initialization for ‘HgfsDirInodeOperations.create’) [enabled by default]/tmp/vmware-root/modules/vmhgfs-only/inode.c:124:4: warning: initialization from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmhgfs-only/inode.c:124:4: warning: (near initialization for ‘HgfsDirInodeOperations.mkdir’) [enabled by default]/tmp/vmware-root/modules/vmhgfs-only/filesystem.c: In function ‘HgfsGetRootDentry’:/tmp/vmware-root/modules/vmhgfs-only/filesystem.c:379:4: error: implicit declaration of function ‘d_alloc_root’ [-Werror=implicit-function-declaration]/tmp/vmware-root/modules/vmhgfs-only/filesystem.c:379:19: warning: assignment makes pointer from integer without a cast [enabled by default]cc1: some warnings being treated as errorsmake[2]: *** [/tmp/vmware-root/modules/vmhgfs-only/filesystem.o] Error 1make[2]: *** Waiting for unfinished jobs....make[1]: *** [_module_/tmp/vmware-root/modules/vmhgfs-only] Error 2make[1]: Leaving directory `/usr/src/kernels/3.4.0-1.fc17.i686'make: *** [vmhgfs.ko] Error 2make: Leaving directory `/tmp/vmware-root/modules/vmhgfs-only'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, makeand 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 ] Using 2.6.x kernel build system.make: Entering directory `/tmp/vmware-root/modules/vmxnet-only'make -C /lib/modules/3.4.0-1.fc17.i686/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \  MODULEBUILDDIR= modulesmake[1]: Entering directory `/usr/src/kernels/3.4.0-1.fc17.i686'  CC [M]  /tmp/vmware-root/modules/vmxnet-only/vmxnet.o/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:525:4: error: unknown field ‘get_rx_csum’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:525:4: warning: initialization from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:525:4: warning: (near initialization for ‘vmxnet_ethtool_ops.get_eeprom_len’) [enabled by default]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:526:4: error: unknown field ‘set_rx_csum’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:526:4: warning: initialization from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:526:4: warning: (near initialization for ‘vmxnet_ethtool_ops.get_eeprom’) [enabled by default]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:527:4: error: unknown field ‘get_tx_csum’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:527:4: warning: initialization from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:527:4: warning: (near initialization for ‘vmxnet_ethtool_ops.set_eeprom’) [enabled by default]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:528:4: error: unknown field ‘set_tx_csum’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:528:4: warning: initialization from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:528:4: warning: (near initialization for ‘vmxnet_ethtool_ops.get_coalesce’) [enabled by default]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:529:4: error: unknown field ‘get_sg’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:529:27: error: ‘ethtool_op_get_sg’ undeclared here (not in a function)/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:530:4: error: unknown field ‘set_sg’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:530:27: error: ‘ethtool_op_set_sg’ undeclared here (not in a function)/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:532:4: error: unknown field ‘get_tso’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:532:27: error: ‘ethtool_op_get_tso’ undeclared here (not in a function)/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:533:4: error: unknown field ‘set_tso’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:533:4: warning: initialization from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:533:4: warning: (near initialization for ‘vmxnet_ethtool_ops.get_pauseparam’) [enabled by default]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:535:4: error: unknown field ‘get_ufo’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:535:27: error: ‘ethtool_op_get_ufo’ undeclared here (not in a function)/tmp/vmware-root/modules/vmxnet-only/vmxnet.c: In function ‘vmxnet_probe_device’:/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:1008:7: error: unknown field ‘ndo_set_multicast_list’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:1008:7: warning: initialization from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:1008:7: warning: (near initialization for ‘vmxnet_netdev_ops.ndo_vlan_rx_add_vid’) [enabled by default]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c: In function ‘vmxnet_map_pkt’:/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:2085:32: error: incompatible type for argument 2 of ‘pci_map_page’In file included from /usr/src/kernels/3.4.0-1.fc17.i686/arch/x86/include/asm/pci.h:148:0,                 from include/linux/pci.h:1335,                 from /tmp/vmware-root/modules/vmxnet-only/./shared/compat_pci.h:27,                 from /tmp/vmware-root/modules/vmxnet-only/vmxnet.c:31:include/asm-generic/pci-dma-compat.h:43:1: note: expected ‘struct page *’ but argument is of type ‘struct <anonymous>’/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:2104:26: error: incompatible type for argument 2 of ‘pci_map_page’In file included from /usr/src/kernels/3.4.0-1.fc17.i686/arch/x86/include/asm/pci.h:148:0,                 from include/linux/pci.h:1335,                 from /tmp/vmware-root/modules/vmxnet-only/./shared/compat_pci.h:27,                 from /tmp/vmware-root/modules/vmxnet-only/vmxnet.c:31:include/asm-generic/pci-dma-compat.h:43:1: note: expected ‘struct page *’ but argument is of type ‘struct <anonymous>’/tmp/vmware-root/modules/vmxnet-only/vmxnet.c: In function ‘vmxnet_rx_frags’:/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:2599:48: error: incompatible types when assigning to type ‘struct <anonymous>’ from type ‘struct page *’make[2]: *** [/tmp/vmware-root/modules/vmxnet-only/vmxnet.o] Error 1make[1]: *** [_module_/tmp/vmware-root/modules/vmxnet-only] Error 2make[1]: Leaving directory `/usr/src/kernels/3.4.0-1.fc17.i686'make: *** [vmxnet.ko] Error 2make: Leaving directory `/tmp/vmware-root/modules/vmxnet-only'The fast network device driver (vmxnet module) is used only for our fast networking interface. The rest of the software provided by VMware Tools is designed to work independently of this feature.If you wish to have the fast network driver enabled, you can install the driverby 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 ] .......#省略
错误主要在编译vmhgfs模块filesystem.c与vmxnet模块vmxnet.c两个文件时。主要错误如下:

/tmp/vmware-root/modules/vmhgfs-only/filesystem.c: In function ‘HgfsGetRootDentry’:/tmp/vmware-root/modules/vmhgfs-only/filesystem.c:379:4: error: implicit declaration of function ‘d_alloc_root’ [-Werror=implicit-function-declaration]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:525:4: error: unknown field ‘get_rx_csum’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:526:4: error: unknown field ‘set_rx_csum’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:527:4: error: unknown field ‘get_tx_csum’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:528:4: error: unknown field ‘set_tx_csum’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:529:4: error: unknown field ‘get_sg’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:529:27: error: ‘ethtool_op_get_sg’ undeclared here (not in a function)/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:530:4: error: unknown field ‘set_sg’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:530:27: error: ‘ethtool_op_set_sg’ undeclared here (not in a function)/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:532:4: error: unknown field ‘get_tso’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:532:27: error: ‘ethtool_op_get_tso’ undeclared here (not in a function)/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:533:4: error: unknown field ‘set_tso’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:535:4: error: unknown field ‘get_ufo’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:535:27: error: ‘ethtool_op_get_ufo’ undeclared here (not in a function)/tmp/vmware-root/modules/vmxnet-only/vmxnet.c: In function ‘vmxnet_probe_device’:/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:1008:7: error: unknown field ‘ndo_set_multicast_list’ specified in initializer/tmp/vmware-root/modules/vmxnet-only/vmxnet.c: In function ‘vmxnet_map_pkt’:/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:2085:32: error: incompatible type for argument 2 of ‘pci_map_page’In file included from /usr/src/kernels/3.4.0-1.fc17.i686/arch/x86/include/asm/pci.h:148:0,                 from include/linux/pci.h:1335,                 from /tmp/vmware-root/modules/vmxnet-only/./shared/compat_pci.h:27,                 from /tmp/vmware-root/modules/vmxnet-only/vmxnet.c:31:include/asm-generic/pci-dma-compat.h:43:1: note: expected ‘struct page *’ but argument is of type ‘struct <anonymous>’/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:2104:26: error: incompatible type for argument 2 of ‘pci_map_page’In file included from /usr/src/kernels/3.4.0-1.fc17.i686/arch/x86/include/asm/pci.h:148:0,                 from include/linux/pci.h:1335,                 from /tmp/vmware-root/modules/vmxnet-only/./shared/compat_pci.h:27,                 from /tmp/vmware-root/modules/vmxnet-only/vmxnet.c:31:include/asm-generic/pci-dma-compat.h:43:1: note: expected ‘struct page *’ but argument is of type ‘struct <anonymous>’/tmp/vmware-root/modules/vmxnet-only/vmxnet.c: In function ‘vmxnet_rx_frags’:/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:2599:48: error: incompatible types when assigning to type ‘struct <anonymous>’ from type ‘struct page *’
从错误信息可以看出,主要是“类型不匹配”与“未声明的字段”。


原因:

Fedora17内核版本为:3.4.0-1.fc17.i686

[root@Fedora software]# uname -r3.4.0-1.fc17.i686
此版本的一些数据结构定义和函数生命比2.6.*之前的版本有些变化,导致编译不过。

修改filesystem.c与vmxnet.c中出错行,消除错误重新编译可解决这个问题。

相关的几行代码如下:

filesystem.c:

line:528-533   rootDentry = d_alloc_root(rootInode);   if (!rootDentry) {      iput(rootInode);      return -ENOMEM;   }   sb->s_root = rootDentry;
vmxnet.c

line:520-538static struct ethtool_opsvmxnet_ethtool_ops = {   .get_settings        = vmxnet_get_settings,   .get_drvinfo         = vmxnet_get_drvinfo,   .get_link            = ethtool_op_get_link,   .get_rx_csum         = vmxnet_get_rx_csum,   .set_rx_csum         = vmxnet_set_rx_csum,   .get_tx_csum         = vmxnet_get_tx_csum,   .set_tx_csum         = vmxnet_set_tx_csum,   .get_sg              = ethtool_op_get_sg,   .set_sg              = ethtool_op_set_sg,#ifdef VMXNET_DO_TSO   .get_tso             = ethtool_op_get_tso,   .set_tso             = vmxnet_set_tso,#   if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)   .get_ufo             = ethtool_op_get_ufo,#   endif#endif};line:1003-1015   static const struct net_device_ops vmxnet_netdev_ops = {      .ndo_open = &vmxnet_open,      .ndo_start_xmit = &vmxnet_start_tx,      .ndo_stop = &vmxnet_close,      .ndo_get_stats = &vmxnet_get_stats,      .ndo_set_multicast_list = &vmxnet_set_multicast_list,      .ndo_change_mtu = &vmxnet_change_mtu,#   ifdef VMW_HAVE_POLL_CONTROLLER      .ndo_poll_controller = vmxnet_netpoll,#   endif      .ndo_set_mac_address = &vmxnet_set_mac_address,      .ndo_tx_timeout = &vmxnet_tx_timeout,   };line:2081-2085            dma = pci_map_page(lp->pdev,                               frag->page,                               frag->page_offset + offset,                               frag->size - offset,                               PCI_DMA_TODEVICE);line:2100-2104      dma = pci_map_page(lp->pdev,                         frag->page,                         frag->page_offset,                         frag->size,                         PCI_DMA_TODEVICE);line:2598-2603         pci_unmap_page(pdev, rre2->paddr, PAGE_SIZE, PCI_DMA_FROMDEVICE);         skb_shinfo(skb)->frags[numFrags].page = lp->rxPages[dd->rxDriverNext2];         skb_shinfo(skb)->frags[numFrags].page_offset = 0;         skb_shinfo(skb)->frags[numFrags].size = rre2->actualLength;         skb->data_len += rre2->actualLength;         numFrags++;
OK,找到出错行了,看如何修改。


解决方案:

对于filesystem.c,没有找到d_alloc_root函数,此函数在内核版本3.2.11中定义如下:

extern struct dentry * d_alloc_root(struct inode *);
在3.4.0中此函数已更名,变为d_make_root

因此将此函数改为d_make_root即可


对vmxnet.c,错误比较多,一一看来:

先看520-538这几行的问题所在

老版本ethtool.h中结构体ethtool_ops声明如下:

struct ethtool_ops {int(*get_settings)(struct net_device *, struct ethtool_cmd *);int(*set_settings)(struct net_device *, struct ethtool_cmd *);void(*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);int(*get_regs_len)(struct net_device *);void(*get_regs)(struct net_device *, struct ethtool_regs *, void *);void(*get_wol)(struct net_device *, struct ethtool_wolinfo *);int(*set_wol)(struct net_device *, struct ethtool_wolinfo *);u32(*get_msglevel)(struct net_device *);void(*set_msglevel)(struct net_device *, u32);int(*nway_reset)(struct net_device *);u32(*get_link)(struct net_device *);int(*get_eeprom_len)(struct net_device *);int(*get_eeprom)(struct net_device *,      struct ethtool_eeprom *, u8 *);int(*set_eeprom)(struct net_device *,      struct ethtool_eeprom *, u8 *);int(*get_coalesce)(struct net_device *, struct ethtool_coalesce *);int(*set_coalesce)(struct net_device *, struct ethtool_coalesce *);void(*get_ringparam)(struct net_device *, struct ethtool_ringparam *);int(*set_ringparam)(struct net_device *, struct ethtool_ringparam *);void(*get_pauseparam)(struct net_device *,  struct ethtool_pauseparam*);int(*set_pauseparam)(struct net_device *,  struct ethtool_pauseparam*);u32(*get_rx_csum)(struct net_device *);int(*set_rx_csum)(struct net_device *, u32);u32(*get_tx_csum)(struct net_device *);int(*set_tx_csum)(struct net_device *, u32);u32(*get_sg)(struct net_device *);int(*set_sg)(struct net_device *, u32);u32(*get_tso)(struct net_device *);int(*set_tso)(struct net_device *, u32);void(*self_test)(struct net_device *, struct ethtool_test *, u64 *);void(*get_strings)(struct net_device *, u32 stringset, u8 *);int(*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);void(*get_ethtool_stats)(struct net_device *,     struct ethtool_stats *, u64 *);int(*begin)(struct net_device *);void(*complete)(struct net_device *);u32(*get_ufo)(struct net_device *);int(*set_ufo)(struct net_device *, u32);u32(*get_flags)(struct net_device *);int(*set_flags)(struct net_device *, u32);u32(*get_priv_flags)(struct net_device *);int(*set_priv_flags)(struct net_device *, u32);int(*get_sset_count)(struct net_device *, int);int(*get_rxnfc)(struct net_device *,     struct ethtool_rxnfc *, u32 *rule_locs);int(*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);int(*flash_device)(struct net_device *, struct ethtool_flash *);int(*reset)(struct net_device *, u32 *);int(*set_rx_ntuple)(struct net_device *, struct ethtool_rx_ntuple *);int(*get_rxfh_indir)(struct net_device *,  struct ethtool_rxfh_indir *);int(*set_rxfh_indir)(struct net_device *,  const struct ethtool_rxfh_indir *);void(*get_channels)(struct net_device *, struct ethtool_channels *);int(*set_channels)(struct net_device *, struct ethtool_channels *);int(*get_dump_flag)(struct net_device *, struct ethtool_dump *);int(*get_dump_data)(struct net_device *, struct ethtool_dump *, void *);int(*set_dump)(struct net_device *, struct ethtool_dump *);};
报错的几个字段都有,新版本声明如下:

struct ethtool_ops {        int     (*get_settings)(struct net_device *, struct ethtool_cmd *);        int     (*set_settings)(struct net_device *, struct ethtool_cmd *);        void    (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);        int     (*get_regs_len)(struct net_device *);        void    (*get_regs)(struct net_device *, struct ethtool_regs *, void *);        void    (*get_wol)(struct net_device *, struct ethtool_wolinfo *);        int     (*set_wol)(struct net_device *, struct ethtool_wolinfo *);        u32     (*get_msglevel)(struct net_device *);        void    (*set_msglevel)(struct net_device *, u32);        int     (*nway_reset)(struct net_device *);        u32     (*get_link)(struct net_device *);        int     (*get_eeprom_len)(struct net_device *);        int     (*get_eeprom)(struct net_device *,struct ethtool_ops {        int     (*get_settings)(struct net_device *, struct ethtool_cmd *);        int     (*set_settings)(struct net_device *, struct ethtool_cmd *);        void    (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);        int     (*get_regs_len)(struct net_device *);        void    (*get_regs)(struct net_device *, struct ethtool_regs *, void *);        void    (*get_wol)(struct net_device *, struct ethtool_wolinfo *);        int     (*set_wol)(struct net_device *, struct ethtool_wolinfo *);        u32     (*get_msglevel)(struct net_device *);        void    (*set_msglevel)(struct net_device *, u32);        int     (*nway_reset)(struct net_device *);        u32     (*get_link)(struct net_device *);        int     (*get_eeprom_len)(struct net_device *);        int     (*get_eeprom)(struct net_device *,struct ethtool_ops {        int     (*get_settings)(struct net_device *, struct ethtool_cmd *);        int     (*set_settings)(struct net_device *, struct ethtool_cmd *);        void    (*get_drvinfo)(struct net_device *, struct ethtool_drvinfo *);        int     (*get_regs_len)(struct net_device *);        void    (*get_regs)(struct net_device *, struct ethtool_regs *, void *);        void    (*get_wol)(struct net_device *, struct ethtool_wolinfo *);        int     (*set_wol)(struct net_device *, struct ethtool_wolinfo *);        u32     (*get_msglevel)(struct net_device *);        void    (*set_msglevel)(struct net_device *, u32);        int     (*nway_reset)(struct net_device *);        u32     (*get_link)(struct net_device *);        int     (*get_eeprom_len)(struct net_device *);        int     (*get_eeprom)(struct net_device *,                      struct ethtool_eeprom *, u8 *);        int     (*set_eeprom)(struct net_device *,                              struct ethtool_eeprom *, u8 *);        int     (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);        int     (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);        void    (*get_ringparam)(struct net_device *,                                 struct ethtool_ringparam *);        int     (*set_ringparam)(struct net_device *,                                 struct ethtool_ringparam *);        void    (*get_pauseparam)(struct net_device *,                                  struct ethtool_pauseparam*);        int     (*set_pauseparam)(struct net_device *,                                  struct ethtool_pauseparam*);        void    (*self_test)(struct net_device *, struct ethtool_test *, u64 *);        void    (*get_strings)(struct net_device *, u32 stringset, u8 *);        int     (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);        void    (*get_ethtool_stats)(struct net_device *,                                     struct ethtool_stats *, u64 *);        int     (*begin)(struct net_device *);        void    (*complete)(struct net_device *);        u32     (*get_priv_flags)(struct net_device *);                       struct ethtool_eeprom *, u8 *);        int     (*set_eeprom)(struct net_device *,                              struct ethtool_eeprom *, u8 *);        int     (*get_coalesce)(struct net_device *, struct ethtool_coalesce *);        int     (*set_coalesce)(struct net_device *, struct ethtool_coalesce *);        void    (*get_ringparam)(struct net_device *,                                 struct ethtool_ringparam *);        int     (*set_ringparam)(struct net_device *,                                 struct ethtool_ringparam *);        void    (*get_pauseparam)(struct net_device *,                                  struct ethtool_pauseparam*);        int     (*set_pauseparam)(struct net_device *,                                  struct ethtool_pauseparam*);        void    (*self_test)(struct net_device *, struct ethtool_test *, u64 *);        void    (*get_strings)(struct net_device *, u32 stringset, u8 *);        int     (*set_phys_id)(struct net_device *, enum ethtool_phys_id_state);        void    (*get_ethtool_stats)(struct net_device *,                                     struct ethtool_stats *, u64 *);        int     (*begin)(struct net_device *);        void    (*complete)(struct net_device *);        u32     (*get_priv_flags)(struct net_device *);       int     (*get_sset_count)(struct net_device *, int);        int     (*get_rxnfc)(struct net_device *,                             struct ethtool_rxnfc *, u32 *rule_locs);        int     (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);        int     (*flash_device)(struct net_device *, struct ethtool_flash *);        int     (*reset)(struct net_device *, u32 *);        u32     (*get_rxfh_indir_size)(struct net_device *);        int     (*get_rxfh_indir)(struct net_device *, u32 *);        int     (*set_rxfh_indir)(struct net_device *, const u32 *);        void    (*get_channels)(struct net_device *, struct ethtool_channels *);        int     (*set_channels)(struct net_device *, struct ethtool_channels *);        int     (*get_dump_flag)(struct net_device *, struct ethtool_dump *);        int     (*get_dump_data)(struct net_device *,                                 struct ethtool_dump *, void *);        int     (*set_dump)(struct net_device *, struct ethtool_dump *);};

对比可以看出,报错的几个字段都已经不存在了。因此将这几个字段定义删除即可。

1008行的错误也是这个问题。同样的修改方法,删除即可。

其余几行的问题在于结构体skb_frag_struct定义修改了,page成为了结构体,page.p才是指针:

struct skb_frag_struct {    struct {        struct page *p;    } page;#if (BITS_PER_LONG > 32) || (PAGE_SIZE >= 65536)    __u32 page_offset;    __u32 size;#else    __u16 page_offset;    __u16 size;#endif};

将这几处使用page的地方修改为page.p即可。


实施步骤:

1、Vmware安装时会吧文件默认拷贝到/usr/lib/vmware-tools目录下

其中vmhgfs、vmxnet模块在/usr/lib/vmware-tools/modules/source目录下

cd /usr/lib/vmware-tools/modules/source
2、解压vmhgfs.tar

tar -xvf vmhgfs.tar 
解压出vmhgfs-only文件夹

3、修改filesystem.c,用d_make_root替换d_alloc_root

sed -i 's/d_alloc_root/d_make_root/' ./vmhgfs-only/filesystem.c
4、压缩vmhgfs.tar

tar cvf vmhgfs.tar vmhgfs-only
5、解压vmxnet.tar
tar -xvf vmxnet.tar 
解压出vmxnet-only文件夹

6、修改vmxnet.c按照上述几个地方修改

520-538:static struct ethtool_opsvmxnet_ethtool_ops = {   .get_settings        = vmxnet_get_settings,   .get_drvinfo         = vmxnet_get_drvinfo,   .get_link            = ethtool_op_get_link,/*   .get_rx_csum         = vmxnet_get_rx_csum,   .set_rx_csum         = vmxnet_set_rx_csum,   .get_tx_csum         = vmxnet_get_tx_csum,   .set_tx_csum         = vmxnet_set_tx_csum,   .get_sg              = ethtool_op_get_sg,   .set_sg              = ethtool_op_set_sg,#ifdef VMXNET_DO_TSO   .get_tso             = ethtool_op_get_tso,   .set_tso             = vmxnet_set_tso,#   if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)   .get_ufo             = ethtool_op_get_ufo,#   endif#endif */};1008:/*      .ndo_set_multicast_list = &vmxnet_set_multicast_list,*/2081-2085:
            dma = pci_map_page(lp->pdev,                               frag->page.p,                               frag->page_offset + offset,                               frag->size - offset,                               PCI_DMA_TODEVICE);


2100-2104:
      dma = pci_map_page(lp->pdev,
                         frag->page.p,
                         frag->page_offset,
                         frag->size,
                         PCI_DMA_TODEVICE);

2059:
         skb_shinfo(skb)->frags[numFrags].page.p = lp->rxPages[dd->rxDriverNext2];
7、压缩vmxnet.tar
tar cvf vmxnet.tar vmxnet-only

8、修改完成后,重新运行/usr/bin/vmware-config-tools.pl,即可正常安装。

[root@Fedora bin]# ./vmware-config-tools.pl Initializing...Making sure services for VMware Tools are stopped.Stopping vmware-tools (via systemctl):                     [  OK  ]................................................................................省略kernel headers of the running kernelSearching for GCC...Detected GCC binary at "/bin/gcc".The path "/bin/gcc" appears to be a valid path to the gcc binary.Would you like to change it? [no] Searching for a valid kernel header path...Detected the kernel headers at "/lib/modules/3.4.0-1.fc17.i686/build/include".The path "/lib/modules/3.4.0-1.fc17.i686/build/include" appears to be a valid path to the 3.4.0-1.fc17.i686 kernel headers.Would you like to change it? [no] ................................................................................省略The VMware Host-Guest Filesystem allows for shared folders between the host OS and the guest OS in a Fusion or Workstation virtual environment.  Do you wish to enable this feature? [yes] Using 2.6.x kernel build system.make: Entering directory `/tmp/vmware-root/modules/vmci-only'make -C /lib/modules/3.4.0-1.fc17.i686/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \  MODULEBUILDDIR= modulesmake[1]: Entering directory `/usr/src/kernels/3.4.0-1.fc17.i686'  CC [M]  /tmp/vmware-root/modules/vmci-only/linux/driver.o  CC [M]  /tmp/vmware-root/modules/vmci-only/linux/vmciKernelIf.o  CC [M]  /tmp/vmware-root/modules/vmci-only/common/vmciDatagram.o  CC [M]  /tmp/vmware-root/modules/vmci-only/common/vmciDriver.o  CC [M]  /tmp/vmware-root/modules/vmci-only/common/vmciRoute.o  CC [M]  /tmp/vmware-root/modules/vmci-only/common/vmciContext.o  CC [M]  /tmp/vmware-root/modules/vmci-only/common/vmciResource.o  CC [M]  /tmp/vmware-root/modules/vmci-only/common/vmciEvent.o  CC [M]  /tmp/vmware-root/modules/vmci-only/common/vmciHashtable.o  CC [M]  /tmp/vmware-root/modules/vmci-only/common/vmciQPair.o  CC [M]  /tmp/vmware-root/modules/vmci-only/common/vmciQueuePair.o  CC [M]  /tmp/vmware-root/modules/vmci-only/common/vmciDoorbell.o  CC [M]  /tmp/vmware-root/modules/vmci-only/driverLog.o/tmp/vmware-root/modules/vmci-only/linux/driver.c: In function ‘__check_disable_host’:/tmp/vmware-root/modules/vmci-only/linux/driver.c:2498:1: warning: return from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmci-only/linux/driver.c: In function ‘__check_disable_guest’:/tmp/vmware-root/modules/vmci-only/linux/driver.c:2501:1: warning: return from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmci-only/linux/driver.c: In function ‘__check_disable_msi’:/tmp/vmware-root/modules/vmci-only/linux/driver.c:2504:1: warning: return from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmci-only/linux/driver.c: In function ‘__check_disable_msix’:/tmp/vmware-root/modules/vmci-only/linux/driver.c:2507:1: warning: return from incompatible pointer type [enabled by default]  LD [M]  /tmp/vmware-root/modules/vmci-only/vmci.o  Building modules, stage 2.  MODPOST 1 modules  CC      /tmp/vmware-root/modules/vmci-only/vmci.mod.o  LD [M]  /tmp/vmware-root/modules/vmci-only/vmci.komake[1]: Leaving directory `/usr/src/kernels/3.4.0-1.fc17.i686'make -C $PWD SRCROOT=$PWD/. \  MODULEBUILDDIR= postbuildmake[1]: Entering directory `/tmp/vmware-root/modules/vmci-only'make[1]: `postbuild' is up to date.make[1]: Leaving directory `/tmp/vmware-root/modules/vmci-only'cp -f vmci.ko ./../vmci.omake: Leaving directory `/tmp/vmware-root/modules/vmci-only'Using 2.6.x kernel build system.make: Entering directory `/tmp/vmware-root/modules/vmhgfs-only'make -C /lib/modules/3.4.0-1.fc17.i686/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \  MODULEBUILDDIR= modulesmake[1]: Entering directory `/usr/src/kernels/3.4.0-1.fc17.i686'  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/hgfsUtil.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/message.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/request.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/cpName.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/link.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/backdoorGcc32.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/tcp.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/hgfsEscape.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/rpcout.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/file.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/transport.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/inode.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/super.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/bdhandler.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/vmci.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/fsutil.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/dir.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/cpNameLinux.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/hgfsBd.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/filesystem.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/module.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/page.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/backdoor.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/stubs.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/cpNameLite.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/dentry.o  CC [M]  /tmp/vmware-root/modules/vmhgfs-only/kernelStubsLinux.o/tmp/vmware-root/modules/vmhgfs-only/file.c:128:4: warning: initialization from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmhgfs-only/file.c:128:4: warning: (near initialization for ‘HgfsFileFileOperations.fsync’) [enabled by default]/tmp/vmware-root/modules/vmhgfs-only/inode.c:121:4: warning: initialization from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmhgfs-only/inode.c:121:4: warning: (near initialization for ‘HgfsDirInodeOperations.create’) [enabled by default]/tmp/vmware-root/modules/vmhgfs-only/inode.c:124:4: warning: initialization from incompatible pointer type [enabled by default]/tmp/vmware-root/modules/vmhgfs-only/inode.c:124:4: warning: (near initialization for ‘HgfsDirInodeOperations.mkdir’) [enabled by default]  LD [M]  /tmp/vmware-root/modules/vmhgfs-only/vmhgfs.o  Building modules, stage 2.  MODPOST 1 modules  CC      /tmp/vmware-root/modules/vmhgfs-only/vmhgfs.mod.o  LD [M]  /tmp/vmware-root/modules/vmhgfs-only/vmhgfs.komake[1]: Leaving directory `/usr/src/kernels/3.4.0-1.fc17.i686'make -C $PWD SRCROOT=$PWD/. \  MODULEBUILDDIR= postbuildmake[1]: Entering directory `/tmp/vmware-root/modules/vmhgfs-only'make[1]: `postbuild' is up to date.make[1]: Leaving directory `/tmp/vmware-root/modules/vmhgfs-only'cp -f vmhgfs.ko ./../vmhgfs.omake: Leaving directory `/tmp/vmware-root/modules/vmhgfs-only'Using 2.6.x kernel build system.make: Entering directory `/tmp/vmware-root/modules/vmxnet-only'make -C /lib/modules/3.4.0-1.fc17.i686/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. \  MODULEBUILDDIR= modulesmake[1]: Entering directory `/usr/src/kernels/3.4.0-1.fc17.i686'  CC [M]  /tmp/vmware-root/modules/vmxnet-only/vmxnet.o/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:3021:1: warning: ‘vmxnet_set_multicast_list’ defined but not used [-Wunused-function]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:389:1: warning: ‘vmxnet_get_tx_csum’ defined but not used [-Wunused-function]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:411:1: warning: ‘vmxnet_get_rx_csum’ defined but not used [-Wunused-function]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:438:1: warning: ‘vmxnet_set_tx_csum’ defined but not used [-Wunused-function]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:474:1: warning: ‘vmxnet_set_rx_csum’ defined but not used [-Wunused-function]/tmp/vmware-root/modules/vmxnet-only/vmxnet.c:503:1: warning: ‘vmxnet_set_tso’ defined but not used [-Wunused-function]  Building modules, stage 2.  MODPOST 1 modules  CC      /tmp/vmware-root/modules/vmxnet-only/vmxnet.mod.o  LD [M]  /tmp/vmware-root/modules/vmxnet-only/vmxnet.komake[1]: Leaving directory `/usr/src/kernels/3.4.0-1.fc17.i686'make -C $PWD SRCROOT=$PWD/. \  MODULEBUILDDIR= postbuildmake[1]: Entering directory `/tmp/vmware-root/modules/vmxnet-only'make[1]: `postbuild' is up to date.make[1]: Leaving directory `/tmp/vmware-root/modules/vmxnet-only'cp -f vmxnet.ko ./../vmxnet.omake: Leaving directory `/tmp/vmware-root/modules/vmxnet-only' 
................................................................................省略Enjoy,--the VMware team

中间warnning没仔细看,料想无大碍。

OK,在共享文件夹,在/mnt/hgfs下可以看到久违的共享文件了!

其实只是修改vmhgfs.tar中filesystem.c就可以了,vmxnet安装不成功不影响共享文件。这样比较简单些。

修改后的vmhgfs.tar与vmxnet.tar下载地址:

http://download.csdn.net/detail/ceofit/4415017

整个VMware-tools有近60M,不传了。

切忌,只是适用于版本

VMware 8.0.3 build-703057

VMwareTools-8.8.2-590212

其他版本不知道,请确保版本号后使用!最好是自己修改比较放心

	
				
		
原创粉丝点击