Kernel module: how to get console ouput?

Jens Nyman picture Jens Nyman · Feb 22, 2012 · Viewed 10.2k times · Source

I am writing a kernel module, and I want to be able to print something on the console output when loading it using insmod module.ko.

I tried using

printk(KERN_EMERG "test kernel emergency\n");

but nothing appears on my console. It does however appear in dmesg.

Extra info:
I am using an Intel x86 32 bit with linux-3.0.0

and cat /proc/sys/kernel/printk gives4 4 1 7

Answer

Varda Elentári picture Varda Elentári · Apr 13, 2012

1- make sure you're in full terminal mode( press Alt+Ctrl+f1)

2- instead of printk(KERN_EMERG "test kernel emergency\n"); try

printk(KERN_ALERT "test kernel alert\n");