亲爱的 Ubuntu 专家们,
我在一台旧的 32 位上网本上使用 Ubuntu 14.04。现在我安装了 VMWare 3.1.6,因为这是最后一个真正的 32 位 VMWare Player(尽管似乎有较新版本的 Player 宣布为 Linux 的 32 位版本)。我可以安装 3.1.6 Player,但当我启动它时,我收到以下消息:
“VMWare 内核模块更新程序 在运行 VMWare 之前,必须编译几个模块并将其加载到正在运行的内核中。
内核头文件 3.13.0-46-generic
未找到版本 3.13.0-46-generic 的内核头文件。如果您将它们安装在非默认路径中,则可以指定以下路径。否则,请参阅您的发行版文档以获取安装说明,然后单击“刷新”以在默认位置中搜索。"
单击消息窗口中的“浏览”按钮时,文件夹 usr/src 将打开并显示以下 4 个文件夹:
- linux-headers-3.13.0.45
- Linux 标头-3.13.0.45-通用
- linux-headers-3.13.0.46
- Linux 标头-3.13.0.46-通用
因为我是 Linux 的新手,所以我很乐意接受任何提示!
谢谢
答案1
你说得对:VMWare 3.1.6 是最后一款真正的 32 位 VMWare Player!这太可悲了!
尽管如此,我还是花了几个小时对“weltall”的 716 补丁做了一些修改:
diff -r -u source-original/vmblock-only/linux/dentry.c source/vmblock-only/linux/dentry.c
--- source-original/vmblock-only/linux/dentry.c 2012-06-10 01:03:20.000000000 +0200
+++ source/vmblock-only/linux/dentry.c 2012-06-14 11:28:25.093911963 +0200
@@ -104,7 +104,11 @@
return actualDentry->d_op->d_revalidate(actualDentry, nd);
}
- if (path_lookup(iinfo->name, 0, &actualNd)) {
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
+ if (compat_path_lookup(iinfo->name, 0, &actualNd)) {
+#else
+ if (kern_path(iinfo->name, 0, &(actualNd.path))) {
+#endif
LOG(4, "DentryOpRevalidate: [%s] no longer exists\n", iinfo->name);
return 0;
}
diff -r -u source-original/vmblock-only/linux/filesystem.c source/vmblock-only/linux/filesystem.c
--- source-original/vmblock-only/linux/filesystem.c 2012-06-10 01:03:20.000000000 +0200
+++ source/vmblock-only/linux/filesystem.c 2015-03-19 23:32:04.000000000 +0100
@@ -44,9 +44,14 @@
/* File system operations */
#if defined(VMW_GETSB_2618)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
static int FsOpGetSb(struct file_system_type *fsType, int flags,
const char *devName, void *rawData, struct vfsmount *mnt);
#else
+static struct dentry *FsOpMount(struct file_system_type *fsType, int flags,
+ const char *devName, void *rawData);
+#endif
+#else
static struct super_block *FsOpGetSb(struct file_system_type *fsType, int flags,
const char *devName, void *rawData);
#endif
@@ -66,7 +71,11 @@
static struct file_system_type fsType = {
.owner = THIS_MODULE,
.name = VMBLOCK_FS_NAME,
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
.get_sb = FsOpGetSb,
+ #else
+ .mount = FsOpMount,
+ #endif
.kill_sb = kill_anon_super,
};
@@ -336,7 +345,11 @@
goto error_inode;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39)
if (compat_path_lookup(iinfo->name, 0, &actualNd)) {
+#else
+ if (kern_path(iinfo->name, 0, &(actualNd.path))) {
+#endif
/*
* This file does not exist, so we create an inode that doesn't know
* about its underlying file. Operations that create files and
@@ -553,7 +566,7 @@
*-----------------------------------------------------------------------------
*/
-static int
+/*static int
FsOpGetSb(struct file_system_type *fs_type, // IN: file system type of mount
int flags, // IN: mount flags
const char *dev_name, // IN: device mounting on
@@ -561,7 +574,7 @@
struct vfsmount *mnt) // IN: vfs mount
{
return get_sb_nodev(fs_type, flags, rawData, FsOpReadSuper, mnt);
-}
+}*/
#else
/*
*-----------------------------------------------------------------------------
diff -r -u source-original/vmci-only/linux/driver.c source/vmci-only/linux/driver.c
--- source-original/vmci-only/linux/driver.c 2012-06-10 03:23:58.000000000 +0200
+++ source/vmci-only/linux/driver.c 2012-06-14 11:33:13.813197965 +0200
@@ -42,7 +42,6 @@
#include <linux/miscdevice.h>
#include <linux/poll.h>
#include <linux/smp.h>
-#include <linux/smp_lock.h>
#include "compat_file.h"
#include "compat_highmem.h"
diff -r -u source-original/vmmon-only/linux/driver.c source/vmmon-only/linux/driver.c
--- source-original/vmmon-only/linux/driver.c 2012-06-10 03:23:55.000000000 +0200
+++ source/vmmon-only/linux/driver.c 2012-06-14 10:26:33.505000591 +0200
@@ -785,7 +785,7 @@
#define POLLQUEUE_MAX_TASK 1000
-static spinlock_t pollQueueLock __attribute__((unused)) = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(pollQueueLock);
static void *pollQueue[POLLQUEUE_MAX_TASK];
static unsigned int pollQueueCount = 0;
@@ -1046,7 +1046,8 @@
* but unfortunately there is no way how to detect that
* we are building for RedHat's kernel...
*/
- static spinlock_t timerLock = SPIN_LOCK_UNLOCKED;
+
+ static DEFINE_SPINLOCK(timerLock);
spin_lock(&timerLock);
mod_timer(&linuxState.pollTimer, jiffies + 1);
diff -r -u source-original/vmmon-only/linux/hostif.c source/vmmon-only/linux/hostif.c
--- source-original/vmmon-only/linux/hostif.c 2012-06-10 03:23:54.000000000 +0200
+++ source/vmmon-only/linux/hostif.c 2012-06-14 10:35:41.671455630 +0200
@@ -46,7 +46,6 @@
#include <linux/mman.h>
#include <linux/smp.h>
-#include <linux/smp_lock.h>
#include <asm/io.h>
#include <linux/mc146818rtc.h>
diff -r -u source-original/vmmon-only/linux/iommu.c source/vmmon-only/linux/iommu.c
--- source-original/vmmon-only/linux/iommu.c 2012-06-10 03:23:54.000000000 +0200
+++ source/vmmon-only/linux/iommu.c 2012-06-14 10:34:34.493160044 +0200
@@ -35,6 +35,11 @@
#define PCI_BDF_SLOTFUNC(bdf) PCI_DEVFN(PCI_SLOT(bdf), PCI_FUNC(bdf))
#define PCI_BDF_BUS(bdf) (((bdf) >> 8) & 0xff)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 42, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) || LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+#include <linux/pci.h>
+#define iommu_found() iommu_present(&pci_bus_type)
+#define iommu_domain_alloc() iommu_domain_alloc(&pci_bus_type)
+#endif
typedef struct PassthruDevice {
struct pci_dev *pdev;
@@ -44,7 +49,7 @@
static LIST_HEAD(passthruDeviceList);
-static spinlock_t passthruDeviceListLock = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(passthruDeviceListLock);
static void *pciHolePage = NULL;
/*
diff -r -u source-original/vmnet-only/compat_netdevice.h source/vmnet-only/compat_netdevice.h
--- source-original/vmnet-only/compat_netdevice.h 2012-06-10 03:23:56.000000000 +0200
+++ source/vmnet-only/compat_netdevice.h 2012-06-14 11:04:48.318105972 +0200
@@ -47,6 +47,20 @@
# define net_device device
#endif
+/* it looks like these have been removed from the kernel 3.1
+ * probably because the "transition" is considered complete.
+ * so to keep this source compatible we just redefine them like they were
+ * previously
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 41, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) || LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0)
+#define HAVE_ALLOC_NETDEV /* feature macro: alloc_xxxdev
+ functions are available. */
+#define HAVE_FREE_NETDEV /* free_netdev() */
+#define HAVE_NETDEV_PRIV /* netdev_priv() */
+#define HAVE_NETIF_QUEUE
+#define HAVE_NET_DEVICE_OPS
+#endif
+
/*
* SET_MODULE_OWNER appeared sometime during 2.3.x. It was setting
diff -r -u source-original/vmnet-only/driver.c source/vmnet-only/driver.c
--- source-original/vmnet-only/driver.c 2012-06-10 03:23:56.000000000 +0200
+++ source/vmnet-only/driver.c 2012-06-14 10:44:17.628702772 +0200
@@ -28,7 +28,6 @@
#include <linux/poll.h>
#include <linux/smp.h>
-#include <linux/smp_lock.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
@@ -105,7 +104,7 @@
* not have vnetStructureMutex already acquired,
* it is most certainly a bug.
*/
-static rwlock_t vnetPeerLock = RW_LOCK_UNLOCKED;
+static DEFINE_RWLOCK(vnetPeerLock);
/*
* All concurrent changes to the network structure are
@@ -115,6 +114,7 @@
* vnetStructureMutex and vnetPeerLock for write.
*/
compat_define_mutex(vnetStructureMutex);
+compat_define_mutex(vnetMutex);
#if defined(VM_X86_64) && !defined(HAVE_COMPAT_IOCTL)
/*
@@ -264,11 +264,11 @@
struct file * filp) // IN:
{
int ret = -ENOTTY;
- lock_kernel();
+ compat_mutex_lock(&vnetMutex);
if (filp && filp->f_op && filp->f_op->ioctl == VNetFileOpIoctl) {
ret = VNetFileOpIoctl(filp->f_dentry->d_inode, filp, iocmd, ioarg);
}
- unlock_kernel();
+ compat_mutex_unlock(&vnetMutex);
return ret;
}
@@ -1134,9 +1134,9 @@
if (filp && filp->f_dentry) {
inode = filp->f_dentry->d_inode;
}
- lock_kernel();
+ compat_mutex_lock(&vnetMutex);
err = VNetFileOpIoctl(inode, filp, iocmd, ioarg);
- unlock_kernel();
+ compat_mutex_unlock(&vnetMutex);
return err;
}
#endif
diff -r -u source-original/vmnet-only/filter.c source/vmnet-only/filter.c
--- source-original/vmnet-only/filter.c 2012-06-10 03:23:55.000000000 +0200
+++ source/vmnet-only/filter.c 2012-06-14 11:07:27.433702814 +0200
@@ -40,6 +40,9 @@
#include "vnetFilterInt.h"
#include "vnetInt.h"
#include "vmnetInt.h"
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+#include <linux/export.h>
+#endif
// VNet_FilterLogPacket.action for dropped packets
#define VNET_FILTER_ACTION_DRP (1)
@@ -85,7 +88,7 @@
* callbacks can be concurrently executing on multiple threads on multiple
* CPUs, so we should revisit locking for allowing for that in the future.
*/
-spinlock_t activeRuleLock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(activeRuleLock);
/*
* Logging.
diff -r -u source-original/vmnet-only/hub.c source/vmnet-only/hub.c
--- source-original/vmnet-only/hub.c 2012-06-10 03:23:55.000000000 +0200
+++ source/vmnet-only/hub.c 2012-06-14 10:46:12.983201426 +0200
@@ -81,7 +81,7 @@
* so we use __attribute__((unused)) to quiet the compiler.
*/
-static spinlock_t vnetHubLock __attribute__((unused)) = SPIN_LOCK_UNLOCKED;
+static DEFINE_SPINLOCK(vnetHubLock);
/*
diff -r -u source-original/vmnet-only/netif.c source/vmnet-only/netif.c
--- source-original/vmnet-only/netif.c 2012-06-10 03:23:55.000000000 +0200
+++ source/vmnet-only/netif.c 2012-06-14 10:58:15.294677818 +0200
@@ -62,7 +62,9 @@
static int VNetNetifStartXmit(struct sk_buff *skb, struct net_device *dev);
static struct net_device_stats *VNetNetifGetStats(struct net_device *dev);
static int VNetNetifSetMAC(struct net_device *dev, void *addr);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 42, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) || LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
static void VNetNetifSetMulticast(struct net_device *dev);
+#endif
#if 0
static void VNetNetifTxTimeout(struct net_device *dev);
#endif
@@ -131,7 +133,9 @@
.ndo_stop = VNetNetifClose,
.ndo_get_stats = VNetNetifGetStats,
.ndo_set_mac_address = VNetNetifSetMAC,
+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 2, 0)
.ndo_set_multicast_list = VNetNetifSetMulticast,
+#endif
/*
* We cannot stuck... If someone will report problems under
* low memory conditions or some such, we should enable it.
@@ -620,11 +624,12 @@
*
*----------------------------------------------------------------------
*/
-
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 42, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) || LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
void
VNetNetifSetMulticast(struct net_device *dev) // IN: unused
{
}
+#endif
/*
diff -r -u source-original/vmnet-only/userif.c source/vmnet-only/userif.c
--- source-original/vmnet-only/userif.c 2012-06-10 03:23:55.000000000 +0200
+++ source/vmnet-only/userif.c 2012-06-14 10:53:49.212819374 +0200
@@ -572,10 +572,19 @@
unsigned int tmpCsum;
const void *vaddr;
- vaddr = kmap(frag->page);
- tmpCsum = csum_and_copy_to_user(vaddr + frag->page_offset,
- curr, frag->size, 0, &err);
- kunmap(frag->page);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 42, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) || LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+vaddr = kmap(skb_frag_page(frag));
+#else
+vaddr = kmap(frag->page);
+#endif
+tmpCsum = csum_and_copy_to_user(vaddr + frag->page_offset,
+curr, frag->size, 0, &err);
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 42, 0) && LINUX_VERSION_CODE < KERNEL_VERSION(3, 0, 0)) || LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0)
+kunmap(skb_frag_page(frag));
+#else
+kunmap(frag->page);
+#endif
+
if (err) {
return err;
}
diff -r -u source-original/vsock-only/linux/af_vsock.c source/vsock-only/linux/af_vsock.c
--- source-original/vsock-only/linux/af_vsock.c 2012-06-10 01:03:21.000000000 +0200
+++ source/vsock-only/linux/af_vsock.c 2012-06-14 11:36:10.596974749 +0200
@@ -102,7 +102,6 @@
#include <linux/miscdevice.h>
#include <linux/poll.h>
#include <linux/smp.h>
-#include <linux/smp_lock.h>
#include <asm/io.h>
#if defined(__x86_64__) && LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 12)
# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
diff -r -u source-original/vsock-only/linux/util.c source/vsock-only/linux/util.c
--- source-original/vsock-only/linux/util.c 2012-06-10 01:03:21.000000000 +0200
+++ source/vsock-only/linux/util.c 2012-06-14 11:36:48.302138890 +0200
@@ -34,7 +34,7 @@
struct list_head vsockBindTable[VSOCK_HASH_SIZE + 1];
struct list_head vsockConnectedTable[VSOCK_HASH_SIZE];
-spinlock_t vsockTableLock = SPIN_LOCK_UNLOCKED;
+DEFINE_SPINLOCK(vsockTableLock);
/*
* snprintf() wasn't exported until 2.4.10: fall back on sprintf in those
启动计算机时,您必须使用“Shift”来选择内核 3.2!!!如果您使用原始的“patch-modules_3.4.0”和我修改过的模块,它也应该适合您。
如果您甚至找到内核 3.13 的解决方案,那就太好了!
祝你好运,克劳斯