2.4의 소스대로 2.6에서 컴파일을 하니까 rmmod로 모듈이 내려오지가 않았다.
알고보니까 2.6에서는 아래처럼 해줘야한다.
기본소스
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
static int test_init(void)
{
printk("Hello World\n");
return 0;
}
static int test_exit(void)
{
printk("Bye Bye\n");
}
module_init(test_init);
module_exit(test_exit);
MODULE_LICENSE("TEST");
#include <linux/kernel.h>
#include <linux/init.h>
static int test_init(void)
{
printk("Hello World\n");
return 0;
}
static int test_exit(void)
{
printk("Bye Bye\n");
}
module_init(test_init);
module_exit(test_exit);
MODULE_LICENSE("TEST");
root@nocode:~/ca# insmod test.ko
root@nocode:~/ca# cat /var/log/messages
....
Jan 13 10:02:59 nocode kernel: [59541.228159] Hello World
root@nocode:~/ca#
root@nocode:~/ca# rmmod test
root@nocode:~/ca# cat /var/log/messages
....
Jan 13 10:04:30 nocode kernel: [59631.677166] Bye Bye
root@nocode:~/ca#
root@nocode:~/ca# cat /var/log/messages
....
Jan 13 10:02:59 nocode kernel: [59541.228159] Hello World
root@nocode:~/ca#
root@nocode:~/ca# rmmod test
root@nocode:~/ca# cat /var/log/messages
....
Jan 13 10:04:30 nocode kernel: [59631.677166] Bye Bye
root@nocode:~/ca#






