VMware在Linux上安裝時內核頭文件的問題

VMware的作用不用介紹了,像 dorainm這種自己擺弄系統底層的,經常用 vmware弄個freeBSD、linux-2.4.x、linux-2.6.x之類的玩!

  大家在安裝vmware後,運行vmware-config.pl,經常會卡在內核頭文件這裏

None of the pre-built vmmon modulesforVMware Workstation is suitableforyour running kernel.Doyou want this program to try to build the vmmon moduleforyoursystem(you need to have a C compiler installed on yoursystem)?[yes]

Using compiler"/usr/bin/gcc".Useenvironment variable CC to override.

What is the location of the directory of C header files that match your running kernel?[/usr/src/linux/include]

The path"/usr/src/linux/include"isnotan existing directory.

What is the location of the directory of C header files that match your running kernel?[/usr/src/linux/include
] /root/sources/linux-2.6.22.2/include

The directory of kernel headers(version@@VMWARE@@UTS_RELEASE)doesnotmatch your running kernel(version 2.6.22.2).Evenifthe module were to compile successfully,it wouldnotload into the running kernel.

What is the location of the directory of C header files that match your running kernel?[/usr/src/linux/include]


  可氣吧!明明修改指向我自己編譯用過了的linux內核文件夾了,但是提示還是錯誤(dorainm使用的內核是2.6.22.2)

The directory of kernel headers(version@@VMWARE@@UTS_RELEASE)doesnotmatch your running kernel(version 2.6.22.2).Evenifthe module were to compile successfully,it wouldnotload into the running kernel.


    打開 linux/version.h 一看,內容是

#defineLINUX_VERSION_CODE 132630
#defineKERNEL_VERSION(a,b,c)(((a)<<16)+((b)<<8)+(c))


  2.6.22內核 = 2<<16 + 6<<8 + 22 = 2*65536 + 6*256 + 22 =132630
爲什麼說版本不對阿?!難道版本算法不同?!(bc:誰在掐我的指頭!)

  再次看,vmware讀取的版本,UTS_RELEASE!我們往 linux/version.h 裏面添加一行:

#defineUTS_RELEASE"2.6.22.2"
#defineLINUX_VERSION_CODE 132630
#defineKERNEL_VERSION(a,b,c)(((a)<<16)+((b)<<8)+(c))


  這次 vmware終於相信 dorainm提供給它的內核頭文件的版本是匹配的。

  dorainm現在使用的 linux系統是自己編譯的,如果安裝的是發行版本,應該有相關的安裝內核頭文件的方法,比如 redhat/fedora系列的 yum, debian/ubuntu系列的 apt等
    如果沒有,可以到 www.kernel.org上下載對應的內核,然後:

make mrproper
make oldconfig
make

  來編譯內核頭文件,再就按照文中的方法,讓 vmware歡快得跑起來。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章