linux 核心 4.9安裝vmware12報錯的解決方案

來源:互聯網
上載者:User

標籤:錯誤   val   header   ror   修改   poi   個數   vmware   模組   

inux上安裝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:

查看userif.c檔案
發現錯誤位置代碼如下

#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 6, 0)retval = get_user_pages(addr, 1, 1, 0, &page, NULL);#elseretval = get_user_pages(current, current->mm, addr,1, 1, 0, &page, NULL);

在

/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);

參數個數果然和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);

果然是改了函數定義

上github看了下變更資訊,發現是在4.9中將write與force合并成一個參數了
增加了宏
#define FOLL_WRITE0x01
#define FOLL_FORCE0x10
來用與運算得到這兩個參數
所以修改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

再次編譯後執行vmware

成功執行!

linux 核心 4.9安裝vmware12報錯的解決方案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.