커널 컴파일시 "unresolved..."라는 메시지가 뜹니다.

midasyoo의 이미지

초보라서 고수님들께 여쭤봅니다.

일반 리눅스 PC상에서 hello_world.c라는 파일을 만들어서 Makefile을 실행시켰더니 아래와 같은 메시지가 뜹니다.

- 아래 -

hello_world.c 파일 내용입니다.

/*
 *      Hello, world module
*/

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

/* init_module function */
static int module_begin(void)
{
   printk("Hello, world\n");
   return 0;
}

/* cleanup_module function */
static void module_end(void)
{
   printk("Goodbye cruel world\n");
}

EXPORT_NO_SYMBOLS;
module_init (module_begin);
module_exit (module_end);

Makefile의 내용입니다.

# Makefile for a basic kernel module

CROSS_COMPILE=gcc

# Modify this statement to your kernel directory
INCLUDEDIR = /include

MODCFLAGS := -Wall -o2 -DMODULE -D__KERNEL__ -DLINUX -I$(INCLUDEDIR)

hello_word.o: hello_world.c
              $(CROSS_COMPILE) $(MODCFLAGS) -c hello_world.c

컴파일 명령은 아래와 같이 했습니다. 그리고, 다음과 같이 메시지가 뜹니다.

[root@linux kernel]# insmod hello_world.o
hello_world.o: unresolved symbol printk
hello_world.o: 
Hint: You are trying to load a module without a GPL compatible license
      and it has unresolved symbols.  Contact the module supplier for
      assistance, only they can help you.

무엇이 문제인지 모르겠습니다.

고수님들의 지도 부탁드립니다.