[Q] module programming - printk 출력

익명 사용자의 이미지

module programming를 하고 있습니다.
tty 상에서 결과를 출력하질 않내요
왜일까요?

K 2.4.7-10
L redhat 7.2

==================================
[ source code ]

.......
.......
.......

int init_moudle(void)
{
printk("<1> hello module");
return 0;
}
.......
.......
.......
==================================

컴파일 에러없구, 경고 없구
X 터미널 상이아닌 곳에서 출력 메시지를 할 수 없네요.
=======================================================

익명 사용자의 이미지

해당 모듈이 실제로 로딩될때 출력합니다...

즉, 컴파일한 커널이 메모리에 올라왔어도
해당 모듈이 사용되지 않으면 메모리에 올라가지 않져

그래서 터미널에 출력하지 않는 것입니다..

modprobe 또는 insmod 등으로 모듈을 올려보세여...

그럼...

vitiaz wrote..
module programming를 하고 있습니다.
tty 상에서 결과를 출력하질 않내요
왜일까요?



K 2.4.7-10
L redhat 7.2

==================================
[ source code ]

.......
.......
.......

int init_moudle(void)
{
printk("<1> hello module");
return 0;
}
.......
.......
.......
==================================

컴파일 에러없구, 경고 없구
X 터미널 상이아닌 곳에서 출력 메시지를 할 수 없네요.
=======================================================

익명 사용자의 이미지


insmod 했는데 나타나잘 않내요 ^^!

/* [source] Filen_Name hello.c */

#include
#include

int init_module(void)
{
printk("<1> HELLO");
return 0;
}

void cleanup_module(void)
{
printk("<1> bye hello");
}
/* end source */

NO ERROR

=======[command]===========
command #> insmod hello.o
command #>
command #> rmmod hello
command #>
command #>
===========================

아무런 메시지가 없어요. ^^! 도와주세요.

익명 사용자의 이미지

모듈 삽입하고 dmesg | tail -n1 해보세요.