如何提取内核头文件以供以后编译内核模块 [英] How to extract kernel headers for compiling kernel module later

查看:337
本文介绍了如何提取内核头文件以供以后编译内核模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从git仓库编译了各种Linux内核.有时候,我将内核复制到其他系统,并且需要内核头文件来编译外部模块.

I compiled various Linux kernel from git repositories. There are times when I copied the kernel to other system and need the kernel header to compile external module.

我试图运行"make headers_install",但它仅生成一个include/文件夹.当我尝试将外部模块指向该文件夹时,它抱怨找不到Makefile.

I tried to run "make headers_install" but it only generated a include/ folder. When I tried to point external module to that folder, it complains it cannot find Makefile.

打包用于部署的内核标头的正确方法是什么?

What is the proper way to package kernel-header for deployment?

谢谢.

推荐答案

请改为创建内核程序包,对于基于dpkg的发行版为"make deb-pkg",对于基于RPM的发行版为"make rpm-pkg".它们创建了多个软件包,其中一个是可用于构建外部模块的软件包.对于Debian软件包,应该是linux-headers- *;对于RPM版本,应该是"devel"软件包.

Create kernel packages instead, that's "make deb-pkg" for dpkg based distros and "make rpm-pkg" for RPM based ones. These create multiple packages, one of those is a package usable for external modules building. That should be linux-headers-* for the Debian packages and a "devel" package for he RPM versions.

这篇关于如何提取内核头文件以供以后编译内核模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆