简体   繁体   English

在ubuntu中导出/安装内核头文件

[英]exporting/ installing Kernel header in ubuntu

when i try to install kernel header in ubuntu it is installed in /usr/src/linux-header-2.6.xy 当我尝试在ubuntu中安装内核头文件时,它安装在/usr/src/linux-header-2.6.xy中

many place in the web (including below) says it should be installed in /usr/include/linux/* 网络上很多地方(包括下面的地方)都说应该将其安装在/ usr / include / linux / *

http://www.mjmwired.net/kernel/Documentation/make/headers_install.txt http://www.mjmwired.net/kernel/Documentation/make/headers_install.txt

why there is a discrepancy in the ubuntu kernel header install? 为什么ubuntu内核头文件安装中存在差异?

also if i want to use these header do i need to use -I switch in gcc? 另外,如果我想使用这些标头,是否需要使用-I在gcc中切换?

Some of the reference also state that files under /usr/include/linux should contain symlink to /usr/src/linux-header-2.6.xy which does not seems to be the case here... 一些参考资料还指出/ usr / include / linux下的文件应包含指向/usr/src/linux-header-2.6.xy的符号链接,在这里似乎不是这种情况。

The headers in /usr/include/linux are the headers of the kernel which glibc and other system libraries depend on. /usr/include/linux中的标头是glibc和其他系统库所依赖的内核的标头。 See to which package they belong: 查看它们属于哪个包:

$ dpkg -S /usr/include/linux/if.h 
linux-libc-dev: /usr/include/linux/if.h

Some of glibc sys/ headers depend on the linux/ headers, and these are usually the same headers (or close to the ones) glibc's binary was compiled against. 一些glibc sys/标头取决于linux/标头,这些标头通常是针对glibc二进制文件的相同标头(或与之接近)。

Therefore, building a custom kernel should not replace those by default, otherwise it can create binary incompatibility. 因此,默认情况下,构建自定义内核不应替换那些内核,否则会导致二进制不兼容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM