Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

printk() to X-Windows

4 views
Skip to first unread message

Phong Ho

unread,
Feb 6, 2002, 11:15:29 PM2/6/02
to
Hi everyone,

Whenever I use printk() to debug my kernel device driver, I have to be
on console mode (without X-windows).

The problem is I use xemacs to write my driver, xemacs needs to run
on X-windows. Every time I need to debug my driver using printk(), I
have to get out of KDE to see my printk() statements output. This is
not practical.

I understand that printk() is in kernel space, so printk can't output
to
a process in user land.

Is there a technical solution to get the printk() output to a
KDE console? Anyone ever tries to solve this problem?
Thanks

Frank Sweetser

unread,
Feb 6, 2002, 11:18:34 PM2/6/02
to
Phong Ho <peter...@yahoo.com> wrote:
> Hi everyone,
>
> Whenever I use printk() to debug my kernel device driver, I have to be on
> console mode (without X-windows).
>
> The problem is I use xemacs to write my driver, xemacs needs to run on
> X-windows. Every time I need to debug my driver using printk(), I have to get
> out of KDE to see my printk() statements output. This is not practical.
>
> I understand that printk() is in kernel space, so printk can't output to a
> process in user land.

Actually, the klogd process shuffles the kernel log messages out to syslog,
which you can then configure to put all kernel messages to a specific file
you can monitor.

--
Frank Sweetser fs at wpi.edu, fs at suave.net | $ x 16
Full-time WPI Network Tech, Part time Linux/Perl guy |
"I'm an idiot.. At least this one [bug] took about 5 minutes to find.."
(Linus Torvalds in response to a bug report.)

ken_yap_65...@yooha.uxyoxc.com

unread,
Feb 6, 2002, 11:20:23 PM2/6/02
to
|Is there a technical solution to get the printk() output to a
|KDE console? Anyone ever tries to solve this problem?

Can't you log kernel messages using klogd and then do a tail -f on the
log file?

Kaz Kylheku

unread,
Feb 6, 2002, 11:26:01 PM2/6/02
to
In article <6530a40c.02020...@posting.google.com>, Phong Ho wrote:
>Hi everyone,
>
>Whenever I use printk() to debug my kernel device driver, I have to be
>on console mode (without X-windows).

There isn't any way to make kernel output under X *synchronous*.
Output going to a terminal emulator travels through sockets. If your
driver crashes your system, you will not be able to see the crucial last
portions of your output, and any diagnostic messages about the crash.

>The problem is I use xemacs to write my driver, xemacs needs to run
>on X-windows.

Boo hoo! :(

Josh Jones

unread,
Feb 6, 2002, 11:33:09 PM2/6/02
to
In comp.os.linux.development.system Phong Ho <peter...@yahoo.com> wrote:
>
> Is there a technical solution to get the printk() output to a
> KDE console? Anyone ever tries to solve this problem?
> Thanks

why don't you just switch between x-windows on one terminal (maybe tty1)
and another virtual terminal (say, tty2)...? printk() will print to
a console. that would be a solution. or, better yet, just use regular
emacs or vi in a console. why do you need xemacs? just learn a few
basic open, save, copy, paste, etc.. commands for emacs, and you're good
to go. the latest version of emacs even has syntax highlighting for the
console.

--
J o s h u a J o n e s / www.intmain.net / jajones(at)cc.gatech.edu
__ .~.
College of Computing at the | / / _ _ _ _ _ __ __ /V\
Georgia Institue of Technology | / /__ / / / \// //_// \ \/ / // \\
Atlanta, Georgia, U.S. | /____/ /_/ /_/\/ /___/ /_/\_\ /( )\
*Debian GNU/Linux* ^^-^^

Philip Armstrong

unread,
Feb 7, 2002, 6:23:48 AM2/7/02
to
In article <6530a40c.02020...@posting.google.com>,

Phong Ho <peter...@yahoo.com> wrote:
>Whenever I use printk() to debug my kernel device driver, I have to be
>on console mode (without X-windows).

You can use xconsole to view the system console in X. Or run an xterm
with "tail -f /var/log/kern.log" running in it.

This isn't necessarily a good idea though. If you're kernel hacking
and something goes wrong, then if your in X, the system is likely to
die before you ever get to see any output, as it has to pass through
so many different processes before it gets onto the screen. If you're
in console mode, the kernel writes directly to the console, and you're
much more likely to see the final output of the kernel before things
grind to a halt.

>The problem is I use xemacs to write my driver, xemacs needs to run
>on X-windows. Every time I need to debug my driver using printk(), I
>have to get out of KDE to see my printk() statements output. This is
>not practical.

Why not use emacs in console mode? If you want syntax highlighting,
then both Xemacs and emacs will do so in the console. Note that the X
in Xemacs has nothing to do with X the graphical system; Xemacs will
run quite happily in a linux console.

cheers,

Phil


--
http://www.kantaka.co.uk/ .oOo. public key: http://www.kantaka.co.uk/gpg.txt

Kasper Dupont

unread,
Feb 8, 2002, 5:14:35 AM2/8/02
to

Kasper Dupont

unread,
Feb 8, 2002, 5:18:51 AM2/8/02
to
Philip Armstrong wrote:
>
> In article <6530a40c.02020...@posting.google.com>,
> Phong Ho <peter...@yahoo.com> wrote:
> >Whenever I use printk() to debug my kernel device driver, I have to be
> >on console mode (without X-windows).
>
> You can use xconsole to view the system console in X. Or run an xterm
> with "tail -f /var/log/kern.log" running in it.

Which distributions use /var/log/kern.log?

0 new messages