A few months ago I wrote an Introduction to the Linux Kernel Message System. As with all software, especially Linux, things get out of date and need updating. The Linux 3.5 kernel contained changes to the kernel message system that are relevant to my previous article. I found coverage of the changes at LWN.net posted in April and May.
The new code transforms the message system into a series of records instead of a stream of characters, and changes the message format to help automated parsers better identify messages.
The key change from what I wrote previously is the function that I recommended to automate log capture, emit_log_char(char c), is now gone. As you may recall, the function received a single argument which was the character to print to the log, and because it was the first function argument it could be found in R0 on the ARM Architecture and easily printed. Here is the new function which can be used:
The new code has a function log_store() which has as an argument named "text" which holds the full message string. Automated logging to help with the system bring-up can now break on (or trace) the log_store() function and print the text argument. The log_buf and log_buf_len variables remain the same as before.
With the previous message system, such as a 3.3 kernel for Zynq, it was possible to do "cat /proc/kmsg" to see the messages with the message priorities in <> in front of them. After the initial cat command the messages are gone so the next cat command prints only the new messages since the last cat command.
The newer kernels for Zynq allow you to cat /dev/kmsg and display the message priority, sequence number, and timestamp followed by semi-colon. The SUBSYSTEM and DEVICE are also printed to help identify where the messages came from. Here is a picture of the cat output:
The VSP klog command has also been updated for the new message system.
Too bad things changed so soon after the previous article, but that's the way it goes with software. Hopefully this will help if you update to a newer Linux kernel and face the dreaded, but common message, "Uncompressing Linux... done, booting the kernel."
Jason Andrews