디바이스 드라이버 예제를 처음 올려볼려고 하는데...

atablom의 이미지

이제 막 디바이스 드라이버 공부를 해볼려고 ㅡ.ㅡa

여기 저기 뒤져서 간단한 예제를 실행해봤는데.. 에러가..

#include <linux/module.h>

int init_module()
{
printk ("hello\n");
return 0;
}

void cleanup_module()
{
printk ("end\n");
}

이걸 컴파일하게 되면

gcc -o hello.o -c -D__KERNEL__ -DMODULE -O -Wall -I/usr/include/linux hello.c

이렇게 하게 되니까

#error incorrectly using glibc headers for a kernel module 이라고 에러가 나네요..

/usr/include/linux 요기에 module.h 파일이 있는데
여러가지 질답을 보고 다 바꿔서 해봤는데 같은 에러가 나더라구요

커널은 2.6.11 이구요

아.. 그리고 makefile 만드는 법이 그냥 vi에서 Makefile이란
화일명으로 저장을 하면 되는건가요 ?

그럼 답변 부탁 드립니다 ( __)

pcmgod의 이미지

2005년 글이네요;;;