如何为“未知"代码生成内核标头?嵌入式ARM系统? [英] How can I generate kernel headers for an "unknown" embedded ARM system?

查看:70
本文介绍了如何为“未知"代码生成内核标头?嵌入式ARM系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个(旧的)嵌入式系统,我想为其编译程序.我没有工具链,所以我想创建一个.

I have an (old) embedded system for which I want to compile programs. I don't have the toolchain, so I want to create one.

嵌入式系统具有一个"ARM926EJ-S修订版5(v5l)" CPU,"cat/proc/version"表示它在GCC 4.0.2上运行"Linux版本2.6.20.7".

The embedded system has an "ARM926EJ-S rev 5 (v5l)" CPU and "cat /proc/version" says that it runs "Linux version 2.6.20.7" with GCC 4.0.2.

我听说我必须在构建过程中包括内核头文件.我从kernel.org下载Linux内核版本2.6.20,解压缩所有文件并运行"make headers_install ARCH = arm INSTALL_HDR_PATH =〜/headers".这是正确的方法还是我需要特定内核的头文件?

I have heard that I have to include the kernel headers in the build process. I download the Linux kernel version 2.6.20 from kernel.org, extract all files and run "make headers_install ARCH=arm INSTALL_HDR_PATH=~/headers". Is this the correct way or do I need the header files of the specific kernel?

推荐答案

在内核之前.

make mrproper

make ARCH=${arch} headers_check

例如make ARCH=arm headers_check

make ARCH=${CLFS_ARCH} INSTALL_HDR_PATH=dest headers_install

这是从内核获取标头的步骤.

This are the steps to get headers from kernel.

内核头文件的目的是-> C库,并且已编译的程序需要与内核进行交互 即适用于可用系统调用及其编号,常量定义,数据结构等. 因此,编译C库需要内核标头,而且许多应用程序也需要它们.

The purpose of kernel headers is -->C library and compiled programs needs to interact with the kernel i.e for Available system calls and their numbers, Constant definitions, Data structures, etc. Therefore, compiling the C library requires kernel headers, and many applications also require them.

do I need the header files of the specific kernel?

kernel-to-userspace ABI向后兼容

-> 1)使用工具链使用内核headers older than the running kernel will work without problem生成的二进制文件,但是使用won't be able等使用new system calls, data structures,内核生成的二进制文件.

--> 1)Binaries generated with a toolchain using kernel headers older than the running kernel will work without problem, but won't be able to use the new system calls, data structures, etc.

-> 2)使用内核头文件newer通过工具链生成的二进制文件 如果正在运行的内核不使用 最新功能,否则为will break.

-->2)Binaries generated with a toolchain using kernel headers newer than the running kernel might work on if they don't use the recent features, otherwise they will break.

---> 3)使用latest内核标头为not necessary,除非访问 需要新的内核功能

--->3)Using the latest kernel headers is not necessary, unless access to the new kernel features is needed

因此,在您的情况下,内核版本为"Linux version 2.6.20.7"

So in your case kernel version is "Linux version 2.6.20.7"

您可以从kernel.org使用Linux内核版本2.6.202.6.21的内核头文件.

You can use kernel headers of Linux kernel version 2.6.20 or 2.6.21 from kernel.org.

在这种情况下不会造成任何问题.

does not create any problem in this case.

这篇关于如何为“未知"代码生成内核标头?嵌入式ARM系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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