How can I generate kernel headers for an “unknown” embedded ARM system?

心已入冬 提交于 2019-12-19 04:10:27

问题


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.

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.

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?


回答1:


untar the kernel.

make mrproper

make ARCH=${arch} headers_check

e.g make ARCH=arm headers_check

make ARCH=${CLFS_ARCH} INSTALL_HDR_PATH=dest headers_install

This are the steps to get headers from kernel.

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?

The kernel-to-userspace ABI is backward compatible

--> 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)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)Using the latest kernel headers is not necessary, unless access to the new kernel features is needed

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

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.




回答2:


That should be fine if you're using the headers to build a libc

You should probably run make ARCH=arm headers_check beforehand too.



来源:https://stackoverflow.com/questions/21740619/how-can-i-generate-kernel-headers-for-an-unknown-embedded-arm-system

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!