제가 짠 소스입니다.
(현재 HaanLinux2005를 쓰고 커널버젼은 2.6.9-71hs입니다)
#include <linux/kernel.h>
#include <linux/module.h>
int init_module(void)
{
printk("Hello!!!\n");
return 0;
}
void cleanup_module(void)
{
printk("Good Bye!!!\n");
}
hello.c로 저장 후 저장후 컴파일 했습니다.
gcc -o hello.o -c hello.c -D__KERNEL__ -DMODULE -O2 -Wall -I/usr/include
컴파일 후 출력 결과는 아래와 같습니다.
In file included from /usr/include/linux/module.h:10,
from hello.c:2: