[질문] 아직 Module Programming 기초적인 오류 해결 못하고

naraping의 이미지

밑에서 답변해주신분들 너무 감사합니다.
제가 무엇을 잘못했는지 조금씩 알게된거 같습니다.

그러나 아직 2% 부족하네요.

소스코드는 다음과 같습니다.

/*  hello-1.c - The simplest kernel module.  */
#include <linux/module.h>  /* 모든 모듈에 필요 */
#include <linux/kernel.h>  /* KERN_ALERT에 필요 */


int init_module(void)
{
    printk("<1>Hello world 1.\n");

    return 0;
}
void cleanup_module(void)
{
    printk(KERN_ALERT "Goodbye world 1.\n");
}

이것을 문서에 있는 그대로 긁어서 Makefile을 만들라고 하는 것도 긁었는데

TARGET  := hello-1
WARN    := -W -Wall -Wstrict-prototypes -Wmissing-prototypes
INCLUDE := -isystem /lib/modules/`uname -r`/build/include
CFLAGS  := -O2 -DMODULE -D__KERNEL__ ${WARN} ${INCLUDE}
CC      := gcc
	
${TARGET}.o: ${TARGET}.c

.PHONY: clean

all: 
     ${CC} ${CFLAGS} -c ${TARGET}.c -o ${TARGET}.o

clean:
    rm -rf *.o

이렇게 하면

[root@NARAPING modulePrograms]# make 
gcc -O2 -DMODULE -D__KERNEL__ -W -Wall -Wstrict-prototypes -Wmissing-prototypes 
-isystem /lib/modules/`uname -r`/build/include -c hello-1.c -o hello-1.o 
In file included from /lib/modules/2.4.18-4/build/include/linux/config.h:4, 
                 from /lib/modules/2.4.18-4/build/include/linux/module.h:10, 
                 from hello-1.c:3: 
/usr/include/linux/autoconf.h:1: #error Invalid kernel header included in usersp 
ace 
make: *** [all] 오류 1

라는 메시지만 출력될뿐 실질적인 *.o 파일은 만들어 지지 않고 있습니다.
오류만 계속 생기네요.

Makefile에 추가해야하는 내용이 더 있는건가요?
아니면 잘못된 부분이라도 있는건가요?

회원님들게 부탁합니다.
한번 실행해보시고 오류 고쳐주시면 안될까요.

naraping의 이미지

음....위의 문제는 시스템에 있네요.
어디가 잘못됫어서 그런지는 모르겠지만, 다른 컴에서는 동작잘되네요.

그럼 지금 까지 답변 달아 주신분들 감사합니다.