読者です 読者をやめる 読者になる 読者になる

Kernel 2.6.35 で VMware Player 3.1.1 のカーネルモジュールがビルドできなかった件

ググってみると、次の 2 つのパッチを当てることで、VineSeed x86_64 上で VMware Player 3.1.1 が一応動くことを確認しました。

VMware vmmon compilation issues on 64-bit kernel 2.6.35
http://www.rrfx.net/2010/06/vmware-vmmon-module-compilation-issues.html

Persuading VMware Workstation 7.1 to cooperate with Linux kernel 2.6.35
http://www.linuxinsight.com/persuading-vmware-workstation-7.1-to-cooperate-with-linux-kernel-2.6.35.html

vsock.patch:

--- /usr/lib/vmware/modules/source/vsock-only/linux/af_vsock.c	2010-05-21 06:17:27.000000000 +0200
+++ af_vsock.c	2010-08-02 16:43:00.138180898 +0200
@@ -3221,7 +3221,7 @@
     * a notification of an error.
     */
    timeout = sock_sndtimeo(sk, flags & O_NONBLOCK);
-   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
 
    while (sk->compat_sk_state != SS_CONNECTED && sk->compat_sk_err == 0) {
       if (timeout == 0) {
@@ -3244,7 +3244,7 @@
          goto outWaitError;
       }
 
-      compat_cont_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+      compat_cont_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
    }
 
    if (sk->compat_sk_err) {
@@ -3256,7 +3256,7 @@
    }
 
 outWait:
-   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
 out:
    release_sock(sk);
    return err;
@@ -3316,7 +3316,7 @@
     * upon connection establishment.
     */
    timeout = sock_sndtimeo(listener, flags & O_NONBLOCK);
-   compat_init_prepare_to_wait(listener->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
 
    while ((connected = VSockVmciDequeueAccept(listener)) == NULL &&
           listener->compat_sk_err == 0) {
@@ -3332,7 +3332,7 @@
          goto outWait;
       }
 
-      compat_cont_prepare_to_wait(listener->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+      compat_cont_prepare_to_wait(compat_sk_sleep(listener), &wait, TASK_INTERRUPTIBLE);
    }
 
    if (listener->compat_sk_err) {
@@ -3366,7 +3366,7 @@
    }
 
 outWait:
-   compat_finish_wait(listener->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(listener), &wait, TASK_RUNNING);
 out:
    release_sock(listener);
    return err;
@@ -3464,7 +3464,7 @@
    sk = sock->sk;
    vsk = vsock_sk(sk);
 
-   poll_wait(file, sk->compat_sk_sleep, wait);
+   poll_wait(file, compat_sk_sleep(sk), wait);
    mask = 0;
 
    if (sk->compat_sk_err) {
@@ -4104,7 +4104,7 @@
       goto out;
    }
 
-   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
 
    while (totalWritten < len) {
       Bool sentWrote;
@@ -4141,7 +4141,7 @@
             goto outWait;
          }
 
-         compat_cont_prepare_to_wait(sk->compat_sk_sleep,
+         compat_cont_prepare_to_wait(compat_sk_sleep(sk),
                                      &wait, TASK_INTERRUPTIBLE);
       }
 
@@ -4194,7 +4194,7 @@
    if (totalWritten > 0) {
       err = totalWritten;
    }
-   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
 out:
    release_sock(sk);
    return err;
@@ -4428,7 +4428,7 @@
       goto out;
    }
 
-   compat_init_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+   compat_init_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
 
    while ((ready = VSockVmciStreamHasData(vsk)) < target &&
           sk->compat_sk_err == 0 &&
@@ -4468,7 +4468,7 @@
          goto outWait;
       }
 
-      compat_cont_prepare_to_wait(sk->compat_sk_sleep, &wait, TASK_INTERRUPTIBLE);
+      compat_cont_prepare_to_wait(compat_sk_sleep(sk), &wait, TASK_INTERRUPTIBLE);
    }
 
    if (sk->compat_sk_err) {
@@ -4534,7 +4534,7 @@
    err = copied;
 
 outWait:
-   compat_finish_wait(sk->compat_sk_sleep, &wait, TASK_RUNNING);
+   compat_finish_wait(compat_sk_sleep(sk), &wait, TASK_RUNNING);
 out:
    release_sock(sk);
    return err;

まとめると、以下の作業になります。

#!/bin/bash

## http://www.rrfx.net/2010/06/vmware-vmmon-module-compilation-issues.html
## the following commands patches the vmmon sources
[ -f /usr/lib/vmware/modules/source/vmmon-original.tar ] || \
    cp /usr/lib/vmware/modules/source/vmmon.tar /usr/lib/vmware/modules/source/vmmon-original.tar
cd /tmp
tar xvf /usr/lib/vmware/modules/source/vmmon.tar -C /tmp
perl -pi -e 's,_range,,' vmmon-only/linux/iommu.c
tar cvf /usr/lib/vmware/modules/source/vmmon.tar vmmon-only
cd -

## http://www.linuxinsight.com/persuading-vmware-workstation-7.1-to-cooperate-with-linux-kernel-2.6.35.html
cd /usr/lib/vmware/modules/source
[ -f vsock-original.tar ] || cp -a vsock.tar vsock-original.tar
tar xf vsock.tar
cd vsock-only/linux
[ -f /path/to/vsock.patch ] && patch -p0 < /path/to/vsock.patch
cd ../..
tar cf vsock.tar vsock-only
rm -rf vsock-only

vmware-modconfig --console --install-all