[질문] Linux Kernel Module Programming Guide에 있는 소스 에?

naraping의 이미지

[root@NARAPING modulePrograms]# make
gcc -O2 -DMODULE -D__KERNEL__-W -Wall -Wstrict-prototypes -Wmissing-prototypes-i
system /lib/modules/'uname -r'/build/include -c -o hello-1.o hello-1.c
gcc: cannot specify -o with -c or -S and multiple compilations
make: *** [hello-1.o] 오류 1

문서에 있는 그대로 쳤는데 에러가 나네요. 어떻게 하면 되나요?

---------------------------------------------------------------------------------
hello-1.c
---------------------------------------------------------------------------------

#include <linux/module.h>   //모든 모듈에 필요
#include <linux/kernel.h>   //kern_alert에 필요

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

        return 0;
}

void cleanup_module(void)
{
        printk(KERN_ALERT "Goodbye world \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

clean:
    rm -rf {TARGET}.o
---------------------------------------------------------------------------------
맹고이의 이미지

INCLUDE := -isystem /lib/modules/'uname -r'/build/include INCLUDE := -isystem /lib/modules/`uname -r`/build/include 이렇게...

naraping의 이미지

초보라서 처음이 힘드네요.
경험이 싸이기 전에는 계속 이럴꺼 같은데....

수정해준신데로 했습니다.

그런데 이번에 이런 오류가...
make
gcc -O2 -DMODULE -D__KERNEL__-W -Wall -Wstrict-prototypes -Wmissing-prototypes-i
system /lib/modules/`uname -r`/build/include -c -o hello-1.o hello-1.c
gcc: cannot specify -o with -c or -S and multiple compilations
make: *** [hello-1.o] 오류 1

음..... 정말 초보기는 초보네요.