커널 모듈 예제를 작성했는데 printk 가 찍히지 않습니다.
글쓴이: trymp / 작성시간: 월, 2017/12/11 - 4:11오후
/* callee.c */
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
int jj_add(int a, int b) {
printk("[callee] jj_add called...\n");
return a + b;
}
int jj_sub(int a, int b) {
printk("[callee] jj_sub called...\n");
return a - b;
}
EXPORT_SYMBOL(jj_add);
EXPORT_SYMBOL(jj_sub);
MODULE_LICENSE("GPL");/* caller */
#include <linux/init.h>
#include <linux/module.h>
int jj_add(int, int);
int jj_sub(int, int);
int __init init_caller(void) {
int x, y;
printk("[caller] I'll call jj_add(), jj_sub() from callee.\n");
x = jj_add(3, 2);
y = jj_sub(3, 2);
printk("[caller] jj_add: %d\n", x);
printk("[caller] jj_sub: %d\n", y);
return 0;
}
void __exit exit_caller(void) {
printk("jj exit \n");
}
module_init(init_caller);
module_exit(exit_caller);
MODULE_LICENSE("GPL");위의 두개의 소스로 빌드를 해서 caller.ko 로 insmod 를 하였는데 printk 가 안찍힙니다.
jj_add(), jj_sub() 를 호출안하게 하면 윗줄 printk 는 찍히는데요.
무었이 문제인지 모르겟습니다.
아시는 분 조언 주시면 감사하겠습니다.
Forums:


댓글 달기