Products > Embedded Computing

How do I disable or redirect the console (UART0) output to a file?


Hello all,

I thought I'd fine clear information online how to do it, but I admit all this u-boot and linux kernel stuff has me confused in some things. Some other, not so much... it's a learning process.

I built a Cyclone V Linux image with Uboot using Buildroot and was able to customize a bunch of things to my liking. Most of it going very well.

Now, after start up, I'd like to either:
- Disable the Console output
- Move to Console output to ttyUSB0 (which in some cases may or may not be connected...)
- Redirect the Console or dmesg outputs to a file, so I can have a look at them after a reboot.

Thing is I want to use UART0 and UART1 for my own purposes and the additional ports (ttyUSB for example) in case I need the console. I can always log into the unit via SSH, so I don't necessarily need the console output.

Is it possible to do any of the three above? I guess. Where do I find information about /dev/console, which at the moment is the same as /dev/ttyS0 ?

Any pointers are very welcome.



A bit late to the party ::)

Apparently there is an IOCTL for changing the console device at run time, or if you want it changed right at the beginning of the boot process set the console= kernel parameter. For saving kernel log to a file, simply run dmesg >file.txt at the beginning of your init scripts.

The dmesg utility can disable printing kernel messages to the console, but any program can open /dev/console and print something there. On some systems all software may run with its stdout and stderr pointed to /dev/console.

I read the man page and I'm not sure if the IOCTL changes the console device or just redicects kernel messages elsewhere. Maybe the boot parameter is the only way.

Do you have /var/log/syslog and /var/log/dmesg files?


[0] Message Index

There was an error while thanking
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod