리눅스 커널에 적재될 모듈을 하나 만들려고 하는데,
예제 프로그램 따라하는 데서 부터 에러가 나네요.. ㅠ.ㅠ
참고 문헌은 Linux Kernel Module Programming Guide 입니다.
여기서 hello.c 라는 파일을 만들었는데, #include <linux/modversions.h> 라는
부분이
있습니다.
#if CONFIG_MODVERSIONS==1
#define MODVERSIONS
#include <linux/modversions.h>
#endif
위에 내용이 들어 있는데 컴팔 해보면,
gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c start.c
In file included from
start.c:19: /usr/include/linux/modversions.h:1:2: #error Modules should never
use kernel-headers system headers,
/usr/include/linux/modversions.h:2:2: #error but headers from an appropriate
kernel-source
make: *** [start.o] 오류 1
이런 에러를 내면서 hello.o 를 만들어 내지 못하네요.
그래서 modversions.h 내용을 보니까,
#error Modules should never use kernel-headers system headers,
#error but headers from an appropriate kernel-source
요곳 밖에 없네요.. 그러니 당연히 이 내용이 찍힌 것 같습니다..
그래서 modversions.h 를 include 하는 부분을 comment out 시키고 돌려보니
컴팔은 되는데..
다음과 같은 워닝 메세지가 뜹니다.
/tmp/cc0RbNBa.s: Assembler messages:
/tmp/cc0RbNBa.s:8: Warning: Ignoring changed section attributes for .modinfo
이것까진 괜찮은데.. 실제로 만들어진 hello.o 를 로드해 볼려고..
insmod hello.o 를 해 보니
hello.o: kernel-module version mismatch
hello.o was compiled for kernel version 2.4.0-0.26
while this kernel is version 2.4.5.
이런 에러가 나면서 안되네요..
헐..
얼케해야 하는지 좀 알려 주세요~ ㅠ.ㅠ
커널 수정해야 하는데, 여기서 부터 막히니 암담하네요. ^^;;
그럼~