vmware-modconfig on linux kernel 4.6 or above

최근 커널버전을 업데이트후 vmware 실행시 modconfig가 잘안되서 찾아봄
아래는 해당 에러로그

/usr/src/linux-headers-4.6.0-0.bpo.1-common/arch/x86/include/asm/current.h:17:17: warning: passing argument 2 of ‘get_user_pages’ makes integer from pointer without a cast
 #define current get_current()
                 ^
/tmp/modconfig-XSGuvk/vmmon-only/linux/hostif.c:1165:37: note: in expansion of macro ‘current’
    retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
                                     ^
In file included from /tmp/modconfig-XSGuvk/vmmon-only/./include/compat_page.h:23:0,
                 from /tmp/modconfig-XSGuvk/vmmon-only/linux/hostif.c:32:
/usr/src/linux-headers-4.6.0-0.bpo.1-common/include/linux/mm.h:1288:6: note: expected ‘long unsigned int’ but argument is of type ‘struct mm_struct *’
 long get_user_pages(unsigned long start, unsigned long nr_pages,
      ^
/tmp/modconfig-XSGuvk/vmmon-only/linux/hostif.c:1165:13: error: too many arguments to function ‘get_user_pages’
    retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
             ^
In file included from /tmp/modconfig-XSGuvk/vmmon-only/./include/compat_page.h:23:0,
                 from /tmp/modconfig-XSGuvk/vmmon-only/linux/hostif.c:32:
/usr/src/linux-headers-4.6.0-0.bpo.1-common/include/linux/mm.h:1288:6: note: declared here
 long get_user_pages(unsigned long start, unsigned long nr_pages,
      ^
/usr/src/linux-headers-4.6.0-0.bpo.1-common/scripts/Makefile.build:296: recipe for target '/tmp/modconfig-XSGuvk/vmmon-only/linux/hostif.o' failed
make[4]: *** [/tmp/modconfig-XSGuvk/vmmon-only/linux/hostif.o] Error 1

Virtual machine monitor랑 Virtual ethernet모듈이 컴파일중 오류나는것으로 확인
찾아보니 kernel 4.6이후부터 호출 인자가 좀 바꼈나봄
/usr/lib/vmware/modules/source여기에 커널모듈 소스들이 존재함
가서 tar로 vmmon이랑 vmnet을 잘 풀고 ..

diff --git a/vmmon-only/linux/hostif.c b/vmmon-only/linux/hostif.c
--- a/vmmon-only/linux/hostif.c
+++ b/vmmon-only/linux/hostif.c
@@ -1162,8 +1162,13 @@
int retval;

down_read(&current->mm->mmap_sem);
- retval = get_user_pages(current, current->mm, (unsigned long)uvAddr,
- numPages, 0, 0, ppages, NULL);
+ #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
up_read(&current->mm->mmap_sem);
return retval != numPages;
diff --git a/vmnet-only/userif.c b/vmnet-only/userif.c
--- a/vmnet-only/userif.c	2016-04-22 19:19:36.852205070 -0700
+++ b/vmnet-only/userif.c	2016-04-22 19:21:26.317845433 -0700
@@ -113,8 +113,12 @@
int retval;
down_read(&current->mm->mmap_sem);
- retval = get_user_pages(current, current->mm, addr,
-	1, 1, 0, &page, NULL);
+ #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
up_read(&current->mm->mmap_sem);
if (retval != 1) {

를 적용시켜주고 다시 잘 묶은뒤
vmware-modconfig –console –install-all
뙇!

Starting VMware services:
   Virtual machine monitor                                             done
   Virtual machine communication interface                             done
   VM communication interface socket family                            done
   Blocking file system                                                done
   Virtual ethernet                                                    done
   VMware Authentication Daemon                                        done
   Shared Memory Available                                             done

잘된다

KERNEL – 4.6-rc1 Released – OK with Latest VMware, Breaks NVIDIA – and a Possible Fix..

Leave a Reply

Your email address will not be published. Required fields are marked *