Where Do You Send The Kernel Console on an Embedded System

Where do you send the kernel console on an embedded system?

If you just want to read kernel printk messages from the console, and not actually run getty or a shell on it, you can use netconsole. You can supply the following to your bootloader kernel options (or to modprobe netconsole):

netconsole=4444@10.0.0.1/eth1,9353@10.0.0.2/12:34:56:78:9a:bc

where 4444 is the local port, 10.0.0.1 is the local ip, eth1 is the local interface to send the messages out of. 9353 is the remote port, 10.0.0.2 is the remote ip to send the messages to, and the final argument is your remote (eg: your desktop) system's mac address.

Then to view the messages run:

netcat -u -l -p 9353

You can read more about this in Documentation/networking/netconsole.txt

How do I turn off the console on an embedded system built with Yocto?

For kernel versions 5.11 and newer:

In the submenu "Character devices" under "Device Drivers" from make menuconfig, there is an option called "Null TTY driver" (CONFIG_NULL_TTY) that you can enable and add console=ttynull to the kernel boot cmdline so that all console output will be simply discarded.

You can also disable CONFIG_VT and CONFIG_UNIX98_PTYS, since you don't need to interact with your program via console at all.

For older kernels (like my 4.14):
You can add this support with the diffs at: https://lore.kernel.org/lkml/20190403131213.GA4246@kroah.com/T/ and then follow the instructions above.

Which serial port does linux kernel use for console?

/proc/consoles will show you what devices are used for the system console. See the Linux Kernel documentation for details. Below is sample output from my system.

/ # cat /proc/consoles
ttyS0 -W- (EC p a) 4:64
/ #

You can also look at /proc/cmdline to see what arguments were given to the Kernel when it was loaded (e.g. from u-boot). Below is some sample output.

/ # cat /proc/cmdline
console=ttyS0,115200 earlyprintk root=/dev/mmcblk1p3 rootwait
/ #

howto send data to (linux based) embedded system

It's depends on your at91 controller. Most at91 has two UARTS (some at91 has also Ethernet port). You can use second UART to send your data.

How can I find which physical device /dev/console connects to?

I think /sys/devices/virtual/tty/console/active is what you're looking for.

Where do you draw the line between what is embedded and what is not?

I would say "embedded" is any device on which the end user doesn't normally install custom software of their choice. So PCs, laptops and smartphones are out, while XM radios, robot controllers, alarm clocks, pacemakers, hearing aids, the doohickey in your engine that regulates fuel injection etc. are in.

how to send a break when debuging embeded system?

From the documentation, it looks like Control-\ B will send a break in C-Kermit.

Other ways...

One way to send a break is to:

  1. Switch to a lower speed
  2. Send a Nul (0) or an @ (4016) -- a character with many contiguous 0 bits will produce the framing error called a BREAK.
  3. Switch back to the original speed

As you noted, the other way is to use the <termios.h> line control
functions.

#include <termios.h>

int tcsendbreak(int fildes, int duration); // "duration" is ignored


Related Topics



Leave a reply



Submit