Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top