LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1123|回复: 9

升级内核问题

[复制链接]
发表于 2008-5-19 18:08:56 | 显示全部楼层 |阅读模式
我机器原来内核是2.6.22-14
从kernel.org上下载2.6.24-6 编译 并升级内核

老内核下vmware使用正常
新内核启动时提示 vmware is installed,but it has not been configured for the running kernel  to configure it invoke the /usr/bin/vmware-config.pl

我遵照上面的提示 启动新内核后 执行/usr/bin/vmware-config.pl
按这个脚本的提示一步步走,走到选择内核头文件那一步出问题了

如果按config.pl的默认选择 使用新内核源码目录下的include 则make出错,退出执行

网上找到方法 使用make headers_install 安装新内核的headers
然后在新内核下执行/usr/bin/vmware-config.pl则提示说 "所选路径下的内核头文件跟正在运行的内核不匹配,即使可以成功编译模块也不能被正确加载"
退出 make不执行

怎么解决,请大侠们指教
发表于 2008-5-19 20:44:56 | 显示全部楼层
Post by updavy;1851927
我遵照提示 新内核下 /usr/bin/vmware-config.pl  

这句话什么意思?是用新内核启动,然后执行/usr/bin/vmware-config.pl?
Post by updavy;1851927
  按提示一步步走,走到选择内核头文件那一步出问题了

如果按config.pl的默认选择 源码目录下的include 则make出错,退出执行

“源码目录下的include”什么意思?老内核的?还是新内核的?
Post by updavy;1851927
  运如果使用 make headers_install 生成的headers 则提示说 所选路径下的内核头文件跟正在行的内核不匹配,即使可以成功编译模块也不能被正确加载 退出 make不执行

”make headers_install 生成的headers“是新内核的吗?放在什么地方?如果新版内核头文件放在/usr/include下,你的gcc八成已经神经错乱了,请重新用老内核头文件覆盖。

理论上,编译内核模块应使用对应运行中内核的头文件。

LFS环境为什么不用开源的qemu、kvm?特别是kvm配置好后,性能不输vmware。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-19 21:34:01 | 显示全部楼层
第一个问题: 新内核启动执行/usr/bin/vmware-config.pl
第二个问题: config.pl 默认使用新内核源码目录下的include文件夹下的头文件
第三个问题:make headers_install 是新内核的,我也没搞清楚这个命令将内核头文件装到什么地方去了... 不过ms是源码目录下的usr文件夹中

最后,这不是lfs系统 是ubuntu 原来就装了vmware 升级内核后不能用了
回复 支持 反对

使用道具 举报

发表于 2008-5-20 08:29:37 | 显示全部楼层
Post by updavy;1852013
第二个问题: config.pl 默认使用新内核源码目录下的include文件夹下的头文件

把这部分屏显帖出来。
新内核源码目录什么状态?
是刚刚解压出来的干净源码,还是已用其编译新内核的源码?
应使用后一种,干净源码目录下没有linux-version.h这个文件,自然编译会失败。
Post by updavy;1852013
第三个问题:make headers_install 是新内核的,我也没搞清楚这个命令将内核头文件装到什么地方去了... 不过ms是源码目录下的usr文件夹中  

直接执行make headers_install会覆盖/usr/include下系统头文件,这是绝对禁止的行为,会破坏原有gcc。
还是上面的话,请用老版内核头文件覆盖。
Post by updavy;1852013
最后,这不是lfs系统 是ubuntu 原来就装了vmware 升级内核后不能用了

这种问题与发行版无关。

BTW,内核没必要一直追新的,现在的稳定版是2.6.25.4,更新前要看一看changlog,看看是不是有自己需要的bug修正、新驱动。更新内核后,受影响的不止vmware,iptables、fuse、alsa……也会受影响。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-20 16:43:18 | 显示全部楼层
使用 编译后的新内核源码

root@pc104:/home/ubuntu# /usr/bin/vmware-config.pl
Making sure services for VMware Workstation are stopped.

Stopping VMware services:
   Virtual machine monitor                                             done
   Blocking file system:                                               done
   Bridged networking on /dev/vmnet0                                   done
   Host network detection                                              done
   DHCP server on /dev/vmnet1                                          done
   Host-only networking on /dev/vmnet1                                 done
   DHCP server on /dev/vmnet8                                          done
   NAT service on /dev/vmnet8                                          done
   Host-only networking on /dev/vmnet8                                 done
   Virtual ethernet                                                    done

Configuring fallback GTK+ 2.4 libraries.

In which directory do you want to install the theme icons?
[/usr/share/icons]

What directory contains your desktop menu entry files? These files have a
.desktop file extension. [/usr/share/applications]

In which directory do you want to install the application's icon?
[/usr/share/pixmaps]

Trying to find a suitable vmmon module for your running kernel.

None of the pre-built vmmon modules for VMware Workstation is suitable for your
running kernel.  Do you want this program to try to build the vmmon module for
your system (you need to have a C compiler installed on your system)? [yes]

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

What is the location of the directory of C header files that match your running
kernel? [/lib/modules/2.6.24.6/build/include]

Extracting the sources of the vmmon module.

Building the vmmon module.

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vmmon-only'
make -C /lib/modules/2.6.24.6/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/opt/linux-2.6.24.6'
  CC [M]  /tmp/vmware-config0/vmmon-only/linux/driver.o
In file included from /tmp/vmware-config0/vmmon-only/./include/vmware.h:25,
                 from /tmp/vmware-config0/vmmon-only/linux/driver.c:83:
/tmp/vmware-config0/vmmon-only/./include/vm_basic_types.h:170: error: conflicting types for ‘uintptr_t’
include/linux/types.h:40: error: previous declaration of ‘uintptr_t’ was here
In file included from /tmp/vmware-config0/vmmon-only/./include/x86.h:23,
                 from /tmp/vmware-config0/vmmon-only/linux/driver.h:15,
                 from /tmp/vmware-config0/vmmon-only/linux/driver.c:84:
/tmp/vmware-config0/vmmon-only/./include/x86cpuid.h:383:1: warning: "BIT_MASK" redefined
In file included from include/linux/kernel.h:15,
                 from /tmp/vmware-config0/vmmon-only/linux/driver.c:11:
include/linux/bitops.h:7:1: warning: this is the location of the previous definition
In file included from /tmp/vmware-config0/vmmon-only/./include/vmci_kernel_defs.h:26,
                 from /tmp/vmware-config0/vmmon-only/./common/vmciContext.h:19,
                 from /tmp/vmware-config0/vmmon-only/linux/driver.h:21,
                 from /tmp/vmware-config0/vmmon-only/linux/driver.c:84:
/tmp/vmware-config0/vmmon-only/./include/compat_wait.h:37:5: warning: "VMW_HAVE_EPOLL" is not defined
/tmp/vmware-config0/vmmon-only/./include/compat_wait.h:43:5: warning: "VMW_HAVE_EPOLL" is not defined
In file included from /tmp/vmware-config0/vmmon-only/./include/vmci_kernel_defs.h:26,
                 from /tmp/vmware-config0/vmmon-only/./common/vmciContext.h:19,
                 from /tmp/vmware-config0/vmmon-only/linux/driver.h:21,
                 from /tmp/vmware-config0/vmmon-only/linux/driver.c:84:
/tmp/vmware-config0/vmmon-only/./include/compat_wait.h:60: error: conflicting types for ‘poll_initwait’
include/linux/poll.h:65: error: previous declaration of ‘poll_initwait’ was here
/tmp/vmware-config0/vmmon-only/linux/driver.c:198: warning: initialization from incompatible pointer type
make[2]: *** [/tmp/vmware-config0/vmmon-only/linux/driver.o] Error 1
make[1]: *** [_module_/tmp/vmware-config0/vmmon-only] Error 2
make[1]: Leaving directory `/opt/linux-2.6.24.6'
make: *** [vmmon.ko] Error 2
make: Leaving directory `/tmp/vmware-config0/vmmon-only'
Unable to build the vmmon module.

For more information on how to troubleshoot module-related problems, please
visit our Web site at "http://www.vmware.com/download/modules/modules.html" and
"http://www.vmware.com/support/reference/linux/prebuilt_modules_linux.html".

Execution aborted.
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-20 16:47:34 | 显示全部楼层
我查看了一下/usr/include 下面的文件的修改时间,发现make headers_install 应该不是将新内核的头文件装到了/usr/include 下  应该是在 内核源码目录/opt/linux-2.6.24.6/usr/include 下面(看修改日期)

然后我手动指定该文件夹,出现下面错误
Configuring fallback GTK+ 2.4 libraries.

In which directory do you want to install the theme icons?
[/usr/share/icons]

What directory contains your desktop menu entry files? These files have a
.desktop file extension. [/usr/share/applications]

In which directory do you want to install the application's icon?
[/usr/share/pixmaps]

Trying to find a suitable vmmon module for your running kernel.

None of the pre-built vmmon modules for VMware Workstation is suitable for your
running kernel.  Do you want this program to try to build the vmmon module for
your system (you need to have a C compiler installed on your system)? [yes]

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

What is the location of the directory of C header files that match your running
kernel? [/lib/modules/2.6.24.6/build/include] /opt/linux-2.6.24.6/usr/include

The directory of kernel headers (version @@VMWARE@@ UTS_RELEASE) does not match
your running kernel (version 2.6.24.6).  Even if the module were to compile
successfully, it would not load into the running kernel.

What is the location of the directory of C header files that match your running
kernel? [/lib/modules/2.6.24.6/build/include]


麻烦您给看看
回复 支持 反对

使用道具 举报

发表于 2008-5-20 17:36:18 | 显示全部楼层
查看内核文档,make headers_install 默认安装内核头文件到源码目录下的usr/include,记错了。

google
vm_basic_types.h:170: error: conflicting types for ‘uintptr_t’
找到
http://ubuntuforums.org/showthread.php?t=613976 vmware-server in hardy
http://communities.vmware.com/thread/113938?tstart=15

看样子是vmware没有及时跟进linux-kernel更新,导致与2.6.23之后内核冲突。

解决办法有三:
1. 老老实实用老版内核
2. 等vmware更新
3. 使用上面连接http://ubuntuforums.org/showthread.php?t=613976十楼给出的补丁,也许能临时解决问题
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-20 19:43:49 | 显示全部楼层
十分感谢
比较惭愧  在很多提示中没有找到types.h的错误,主要是我一开始就先入为主的认为是内核头文件的问题,所以紧盯头文件

不过还是有点不明白,到底如何使用内核头文件,谁才是真正的内核头文件
为什么我用make headers_install 安装的的头文件,vmware认为不是当前内核对应的头文件呢? 这个也是vmware的bug么?
回复 支持 反对

使用道具 举报

发表于 2008-5-20 20:48:46 | 显示全部楼层
Post by updavy;1852468
  What is the location of the directory of C header files that match your running
kernel? [/lib/modules/2.6.24.6/build/include]

默认的内核头文件即可。
升级内核,没必要也不应该升级内核头文件,不需要执行make headers_install。
Post by updavy;1852468
不过还是有点不明白,到底如何使用内核头文件,谁才是真正的内核头文件
为什么我用make headers_install 安装的的头文件,vmware认为不是当前内核对应的头文件呢? 这个也是vmware的bug么?

/usr/include下内核头文件作为系统头文件的一部分,与glibc成对使用,必须是对应生成glibc时的内核头文件,否则gcc在编译用户空间程序期间可能会发生不可预知的问题,即使编译成功,运行时也可能会发生不可预知的问题。

升级内核后,新内核源码目录下的内核头文件,是对应新内核的头文件。编译属于内核空间的内核模块时使用。

请比较一下
/lib/modules/2.6.24.6/build/include/linux/version.h
/opt/linux-2.6.24.6/usr/include/linux/version.h
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-23 08:32:47 | 显示全部楼层
十分感谢,在您的指点下
查看了/usr/include/linux/version.h

/内核源码/usr/include/linux/version.h
/内核源码/include/linux/version.h
后两者相同,并且与前者不同

谢谢指教
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表