Home
Categories
WIKI
Topic
User
LANGUAGE:
中文
English
linux 内核 4.9安装vmware12报错的解决方案
Experiences and Insight
878
views ·
4
replies ·
To
floor
Go
mmseh
deepin
2017-05-18 22:35
Author
本帖最后由 mmseh 于 2017-5-18 16:20 编辑
deepin内核升到了4.9
安装vmware,启动时提示异常
提示查看日志文件
/tmp/vmware-root/vmware-19482.log
发现是编译vmnet.o模块时出错,错误信息如下
/tmp/modconfig-4UP6CG/vmnet-only/userif.c:117:43:
error: passing argument 5 of ‘get_user_pages’
from incompatible pointer type [-Werror=incompatible-pointer-types]retval = get_user_pages(addr, 1, 1, 0, &page, NULL);^In file included
from /usr/src/linux-headers-4.9.0-deepin4-common/include/linux/highmem.h:7:0,
from /tmp/modconfig-4UP6CG/vmnet-only/userif.c:26:
Copy the Code
查看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);
Copy the Code
在/usr/src/linux-headers-4.9.0-deepin4-common/include/linux/mm.h
中找到get_user_pages的定义
long get_user_pages(unsigned long start, unsigned long nr_pages,unsigned int gup_flags, struct page **pages,struct vm_area_struct **vmas);
Copy the Code
参数个数果然和userif.c里面的不一致
难道是linux内核修改了?
根据userif.c里语法的意思,下载了4.6的头文件查看mm.h
发现其定义如下
long get_user_pages(unsigned long start, unsigned long nr_pages,int write, int force, struct page **pages,struct vm_area_struct **vmas);
Copy the Code
果然是改了函数定义
上github看了下变更信息,发现是在4.9中将write与force合并成一个参数了
增加了宏
#define FOLL_WRITE 0x01
#define FOLL_FORCE 0x10
来用与运算得到这两个参数
所以修改userif.c中的相关语句为
#if LINUX_VERSION_CODE>= KERNEL_VERSION(4, 9, 0)
retval = get_user_pages(addr, 1, 1, &page, NULL);
#elif 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
Copy the Code
再次编译后执行vmware
成功执行!
Reply
Like 0
Favorite
View the author
All Replies
comzhong
deepin
2017-05-18 22:56
#1
活捉大神一枚
Reply
Like 0
View the author
泳衡
deepin
2017-05-18 23:27
#2
羡慕。。。。。。。能折腾。
Reply
Like 0
View the author
要讲武德
deepin
2017-05-19 01:02
#3
我只能 666
Reply
Like 0
View the author
139******41
deepin
2017-05-19 01:02
#4
好像没问题呀
我的
Reply
Like 0
View the author
Please
sign
in first
Featured Collection
Change
Nuntia - Modern IMAP/SMTP mail client for Deepin (Beta tester wanted!)
[Tutorial] deepin25 WSL Offline Installation Guide
UOS AI 2.8 Released! Three New Intelligent Agents & Major Evolution
Solid Q&A | deepin 25 Common Questions – The Immutable System Edition
New Thread
Popular Ranking
Change
Four agent skills for laptop power, sleep, and honest bug reports
Installing qemu-user breaks deepin
Adding a Dancing Spectrum Bar to the Deepin Taskbar | deepin-spectrum
Popular Events
More
deepin内核升到了4.9
安装vmware,启动时提示异常
提示查看日志文件
/tmp/vmware-root/vmware-19482.log
发现是编译vmnet.o模块时出错,错误信息如下
查看userif.c文件
发现错误位置代码如下
在/usr/src/linux-headers-4.9.0-deepin4-common/include/linux/mm.h
中找到get_user_pages的定义
参数个数果然和userif.c里面的不一致
难道是linux内核修改了?
根据userif.c里语法的意思,下载了4.6的头文件查看mm.h
发现其定义如下
果然是改了函数定义
上github看了下变更信息,发现是在4.9中将write与force合并成一个参数了
增加了宏
#define FOLL_WRITE 0x01
#define FOLL_FORCE 0x10
来用与运算得到这两个参数
所以修改userif.c中的相关语句为
再次编译后执行vmware
成功执行!