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

lunar의 이미지

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

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

sangheon의 이미지

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

--

Minimalist Programmer

송지석의 이미지

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

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
지리즈의 이미지

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

There is no spoon. Neo from the Matrix 1999.

eyefree의 이미지

Quote:
$ cat /var/log/message

가 아니라

Quote:
$ cat /var/log/messages

로 해야 할 듯 하군요. ^^

... Do It Now!!!

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.