linux的头文件下载,Linux内核头文件(linux headers)

更新 Linux 内核头文件(linux headers)

三 8th, 2013 2,474 views | 发表评论 | Trackback 一般来说,如果不是自己编译 kernel,那么更新头文件是比较容易的事情,在 Ubuntu/Fedora 等操作系 统上,可以直接安装相应的 linux-headers 软件包,下面就演示了在 Ubuntu 上安装内核头文件的过程。

View Code BASH

1 2 3 4 5 6 7 8 9 master@jay-intel:~/workspace/c-study$ uname -r 3.2.0-33-generic master@jay-intel:~/workspace/c-study$ apt-get install linux-headers-$(uname -r) Reading package lists... Done Building dependency tree Reading state information... Done linux-headers-3.2.0-33-generic is already the newest version. linux-headers-3.2.0-33-generic set to manually installed. 0 upgraded, 0 newly installed, 0 to remove and 331 not upgraded.

然而,如果自己编译 Linux kernel 并用它启动了系统,然后为了让本地程序基于当前 kernel 的 headers 来编译,就需要自己手动更新内核的头文件了。手动更新 linux headers 的步骤如下: 1. 在 Linux kernel 目录中,执行“make headers_install”命令,将 headers 安装到当前目录的 usr/include/下面。 2. 将以前的 headers 备份:包括/usr/include/目录下的 asm,asm-generic,linux 等目录。 3. 将刚才生成的当前编译内核目录下的 usr/include/中的 asm,asm-generic,linux 等目录复制到 /usr/include/目录下即可。 (当然如果还需要更新其他的目录的头文件,也都可以一起复制过去。) 操作演示如下:

View Code BASH

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 [root@jay-linux kvm.git]# make headers_install CHK WRAP include/generated/uapi/linux/version.h arch/x86/include/generated/asm/clkdev.h

SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h SYSHDR arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_32.h SYSHDR arch/x86/syscalls/../include/generated/asm/unistd_32_ia32.h SYSHDR arch/x86/syscalls/../include/generated/asm/unistd_64_x32.h SYSTBL arch/x86/syscalls/../include/generated/asm/syscalls_64.h HOSTCC arch/x86/tools/relocs HOSTCC scripts/unifdef INSTALL include/asm-generic (35 files) INS

TALL include/drm (15 files) INSTALL include/linux/byteorder (2 files) INSTALL include/linux/caif (2 files) INSTALL include/linux/can (5 files)

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值