printk("Hello...") 을 했는데.. /var/log/message..

0
points

흐흐.. 계속 무대뽀로 .. 해보는 중입니다..
버전은 -f옵션을 주닝.. 경고가 떠고 .. 올라가긴 하네요..
그런데 문서를 보면.. /var/log/message에 보면.. 출력 내용이 나온다고 하는데요..
아무것도 안나와여..
tail로 봐도 .. 그렇고.. 그래서 .. 아예통채로 봐도 없네여..
lsmod 하면 올라가긴 한거 같아요..

^^ 계속 질문드려서 귀찮으시더라도 ..
가르쳐주세요..^^ :oops:

bookworm의 이미지
3735
points

추측하는 겁니다만.....

0
points

혹시 커널을 hacking mode 로 컴파일 해야만 되는거 아닐까요? 8)

송지석의 이미지
7290
points

모듈 프로그래밍 하시거나 드라이버 연습하시려는 것 맞죠?tail

0
points

모듈 프로그래밍 하시거나 드라이버 연습하시려는 것 맞죠?

tail -f /var/log/message를 보시는 것은

콘솔에서 직접 보시는 것과 같은 효과를 내기 위해서입니다. 만약에 message에전달되지 않는 것이 의심되시면 직접 콘솔에서 작업하세요.

ctrl+alt+F1 하시면 콘솔 모드로 로긴할 수 있습니다. (다시 이전 화면으로 가려면 ctrl+alt+F7을 누르면 될 겁니다.)

거기서 루트로 로긴하신 담에 insmod해보시면 printk 메시지가 바로 보입니다.

다음은 제 실행 결과를 보여드릴께요..

[root@song55 drvtest]# insmod hello.o
hello.o: The module you are trying to load (hello.o) is compiled with a gcc
version 2 compiler, while the kernel you are running is compiled with
a gcc version 3 compiler. This is known to not work.
[root@song55 drvtest]# insmod -f hello.o
Warning: The module you are trying to load (hello.o) is compiled with a gcc
version 2 compiler, while the kernel you are running is compiled with
a gcc version 3 compiler. This is known to not work.
Warning: kernel-module version mismatch
        hello.o was compiled for kernel version 2.4.2-3
        while this kernel is version 2.4.18-14
Warning: loading hello.o will taint the kernel: no license
  See http://www.tux.org/lkml/#export-tainted for information about tainted modules
Warning: loading hello.o will taint the kernel: forced load
Module hello loaded, with warnings
[root@song55 drvtest]# ls
Makefile  hello.c  hello.o

같은 시간에 tail -f로 본 화면

[root@song55 rommance]# tail -f /var/log/messages
....
Feb  4 11:53:36 song55 kernel:  Hello, world

//hello.c
#define MODULE
#include <linux/module.h>

int init_module(void)
{
        printk("<1> Hello, world\n");
        return 0;
}

void cleanup_module(void)
{
        printk("<1> Goodbye cruel world\n");
}

Makefile
all:
        $(CC) $(CFLAGS) hello.c -c

지리즈의 이미지
23118
points

가볍게 .. dmesg해주셔도.. -_-

0
points

가볍게 .. dmesg
해주셔도.. -_-

[quote]$ cat /var/log/message [/quote]

0
points

인용:
$ cat /var/log/message

가 아니라

인용:
$ cat /var/log/messages

로 해야 할 듯 하군요. ^^

댓글 보기 옵션

원하시는 댓글 전시 방법을 선택한 다음 "설정 저장"을 누르셔서 적용하십시오.