lkml.org 
[lkml]   [2008]   [Jan]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: serial console _after_ boot ? - was: Redirect kernel console

On Jan 3 2008 13:43, devzero@web.de wrote:
>
>hi !
>
>i was wondering how to make kernel messages appear on /dev/ttyS0 without a reboot, i.e. kernelparam "console=ttyS0"

The solution is simple... the following piece of code is inside
opensuse-10.3/src/sysvinit-2.86-115.src.rpm#showconsole-1.08.tar.bz2#showconsole-1.08/blogd.c

(void)ioctl(0, TIOCCONS, NULL); /* Undo any current map if any */
if (ioctl(pts, TIOCCONS, NULL) < 0)
error("can not set console device to %s: %s\n", ptsname, strerror(errno));

so I suppose that's it. Write up a new program that calls the ioctl
on a tty, and you should be done. IOW:

#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>

int main(void)
{
int fd = open("/dev/ttyS0", O_RDWR);
ioctl(0, TIOCCONS, NULL);
ioctl(fd, TIOCCONS, NULL);
}


\
 
 \ /
  Last update: 2008-01-03 14:31    [W:0.041 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site