제가 arm tool chain을 받아서 설치 후에 아래와 같이 컴파일을 하려고 하니..헤더를 찾을 수 없다고 나오더군요..ㅠㅠ

왜 이런 문제가 발생했을까 생각해보니...제 toolchain에서 해당 헤더 파일을 찾을 수 없다는 것이겠죠..

 

root@devpc-laptop:/home/nfsroot# ls
hello.c  Makefile  modules.order  Module.symvers
root@devpc-laptop:/home/nfsroot# arm-angstrom-linux-gnueabi-gcc -o hello hello.c
hello.c:1:24: error: linux/init.h: No such file or directory
hello.c:2:26: error: linux/module.h: No such file or directory
hello.c:16: warning: data definition has no type or storage class
hello.c:16: warning: parameter names (without types) in function declaration
hello.c:17: warning: data definition has no type or storage class
hello.c:17: warning: parameter names (without types) in function declaration
hello.c:19: error: expected declaration specifiers or ‘...’ before string constant
hello.c:19: warning: data definition has no type or storage class
root@devpc-laptop:/home/nfsroot#

 

 

그럼 제가 짠 간단한 코드는 아래와 같습니다.

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>

static int hello_init(void)
{
 printk("Hello World\n");
 return 0;
}
static void hello_exit(void)
{
 printk("Goodbyte\n");
}


module_init(hello_init);
module_exit(hello_exit);

MODULE_LICENSE("GPL");

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

 

제가 갖고 있는 toolchain의 버전은 아래와 같습니다.

 

root@devpc-laptop:/usr/local/angstrom/arm/bin# arm-angstrom-linux-gnueabi-gcc -vUsing built-in specs.
Target: arm-angstrom-linux-gnueabi
Configured with: /disk/d1/oe/build_multi_dev/work/i686-armv4t-sdk-angstrom-linux-gnueabi/gcc-cross-sdk-4.3.3-r3.1/gcc-4.3.3/configure --build=i686-linux --host=i686-linux --target=arm-angstrom-linux-gnueabi --prefix=/usr/local/angstrom/arm --exec_prefix=/usr/local/angstrom/arm --bindir=/usr/local/angstrom/arm/bin --sbindir=/usr/local/angstrom/arm/bin --libexecdir=/usr/local/angstrom/arm/libexec --datadir=/usr/local/angstrom/arm/share --sysconfdir=/usr/local/angstrom/arm/etc --sharedstatedir=/usr/local/angstrom/arm/share/com --localstatedir=/usr/local/angstrom/arm/var --libdir=/usr/local/angstrom/arm/lib --includedir=/usr/local/angstrom/arm/include --oldincludedir=/usr/local/angstrom/arm/include --infodir=/usr/local/angstrom/arm/share/info --mandir=/usr/local/angstrom/arm/share/man --with-gnu-ld --enable-shared --enable-target-optspace --enable-languages=c,c++,objc,fortran --enable-threads=posix --enable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=arm-angstrom-linux-gnueabi- --enable-cheaders=c_std --enable-libssp --disable-bootstrap --disable-libgomp --disable-libmudflap --with-float=soft --with-sysroot=/usr/local/angstrom/arm/arm-angstrom-linux-gnueabi --with-build-time-tools=/disk/d1/oe/build_multi_dev/cross/armv4t/arm-angstrom-linux-gnueabi/bin --with-build-sysroot=/disk/d1/oe/build_multi_dev/staging/armv4t-angstrom-linux-gnueabi --disable-libunwind-exceptions --disable-libssp --disable-libgomp --disable-libmudflap --with-mpfr=/disk/d1/oe/build_multi_dev/staging/i686-linux/usr --enable-__cxa_atexit
Thread model: posix
gcc version 4.3.3 (GCC)

결론적으로 헤더 파일의 주소를 어떻게 지정해야 이 문제를 해결할 수 있을까요? 또한 제 toolchain이 참조하는 #include <linux/module.h>의 위치는 어디로 가야 하는지 알고 싶습니다. 제가 #include <linux/module.h>라고 했다면 제 toolchain은 이 위치를 찾을 텐데 어떤 설정이 되어 있어야 toolchain에서 해당 위치를 찾을 수 있는게 아닌가여? 이 toolchain에서 경로는 어디에서 설정이 되는 것인가요?