If you have put some printk()
statements in the kernel module to debug and trying to capture the outputs as they are printk'ed, what you are looking for is klogd
. Perform a man klogd
for more detains and options.
Here's a wrapper script for klogd
that I coded a while back to ease some quick debugging pain:
#!/bin/bash
function bashtrap()
{
echo
echo -n "[+] stopping klogd ... "
pids=`ps aux | grep klogd | awk '{print $2}'`
for pid in $pids
do
kill SIGTERM $pid 2> /dev/null
done
echo "done"
if [ $1 ]
then
exit;
fi
}
sync
bashtrap
klogd -x -f - -n -c 8 2>&1 1 | tee klog.txt & klog_pid=$!;
echo "[+] klogd started"
echo "[+] press ctrl+c to exit ... $klog_pid"
sync
trap "bashtrap 1" SIGINT
while [ 1 ]
do
sleep 3
echo -n "."
done
ps aux | grep klogd