How to configure a serial console for a QEMU kvm guest

If you have some plans to debug a kernel you may need to use a serial console as you do it in a real host system. To solve this task you need to tell to qemu how to redirect data from a serial port to outside of the guest system. To do it we need to specify the -serial option with arguments:

-serial telnet:host:port[,server][,nowait][,nodelay]
The keyword telnet tells qemu to use the telnet protocol instead of TCP-sockets. If you skip the server option qemu will send the data to specified host:port as a telnet client, otherwise it will act as a telnet server. For example:
qemu ... -serial telnet:,server,nowait
and then somewhere from a host system:
telnet 4444

That's all, so easy.