c - how #Include works when I compile a linux kernel -


i need compile 2.6.28 linux kernel arm-linux-gcc embeded system.i'm running ubuntu 12.10 x86. viewed 2.6 kernel source code , found this:

#include <linux/errno.h> #include <linux/kernel.h> #include <linux/input.h> #include <asm/io.h> #include <asm/irq.h> ... 

will gcc compiler include these files /usr/include /usr/local/include or linux_2.6.28 source folder?

the kernel self-contained. means not allowed have external dependency. in other words, kernel source tree contains all material needed build kernel. there no point code anywhere else.

as suggested in comments, take glance @ main makefile. you'll find under root of source tree. little ctrl+f "include" , here's interesting quotes can feed :

# make include files relative root of kernel src makeflags += --include-dir=$(srctree) # .... other stuff # use userinclude when must reference uapi directories only. userinclude    := \     -i$(srctree)/arch/$(hdr-arch)/include/uapi \     -iarch/$(hdr-arch)/include/generated/uapi \     -i$(srctree)/include/uapi \     -iinclude/generated/uapi \     -include $(srctree)/include/linux/kconfig.h  # use linuxinclude when must reference include/ directory. # needed compatible o= option linuxinclude    := \     -i$(srctree)/arch/$(hdr-arch)/include \     -iarch/$(hdr-arch)/include/generated \     $(if $(kbuild_src), -i$(srctree)/include) \     -iinclude \     $(userinclude) 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -