Creating kernel header/include files

Sometimes when cross-compiling a kernel, the host machine requires the header files to compile programs locally.

To create them, go to your kernel source and:

make headers_install INSTALL_HDR_PATH=/destination

For example:

mkdir /tmp/header
make headers_install ARCH=arm INSTALL_HDR_PATH=/tmp/header

More information is available at your_kernel_source/Documentation/make/headers_install.txt

  1. #1 by Andrejs Cainikovs on October 7, 2011 - 7:48 pm

    My 0.02$:
    – “cross-compiling a kernel” and “to compile programs locally” are different things;
    – Kernel AFAIK don’t need any external headers;
    – Building the cross-compiler itself requires the kernel headers, and later they are reused. So basically (please correct me if I’m wrong) kernel headers needs to be specified only in case if they are obsolete.

    • #2 by hvera1981 on October 8, 2011 - 4:31 pm

      Hi Andrejs , thanks for your comment.

      In my scenario the kernel headers are not used to cross compile the kernel, I need them in the target machine to compile some software locally.

      In some projects we use a modified kernel in a standard debian squeeze (in fact we use only the debian “filesystem”, could be any linux flavor you want , of course compiled for ARM), so the headers files from Debian repository are pretty much different from the one we use, specially when we are creating our own drivers (our patches are not automatically approved by the mainline kernel)

      Thanks for making my post more clear.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: