diff options
| -rw-r--r-- | Documentation/admin-guide/kernel-parameters.txt | 14 | ||||
| -rw-r--r-- | kernel/printk/printk.c | 23 |
2 files changed, 36 insertions, 1 deletions
diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 62436bd5f34a..af614995b71d 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt | |||
| @@ -640,6 +640,20 @@ | |||
| 640 | console=brl,ttyS0 | 640 | console=brl,ttyS0 |
| 641 | For now, only VisioBraille is supported. | 641 | For now, only VisioBraille is supported. |
| 642 | 642 | ||
| 643 | console_msg_format= | ||
| 644 | [KNL] Change console messages format | ||
| 645 | default | ||
| 646 | By default we print messages on consoles in | ||
| 647 | "[time stamp] text\n" format (time stamp may not be | ||
| 648 | printed, depending on CONFIG_PRINTK_TIME or | ||
| 649 | `printk_time' param). | ||
| 650 | syslog | ||
| 651 | Switch to syslog format: "<%u>[time stamp] text\n" | ||
| 652 | IOW, each message will have a facility and loglevel | ||
| 653 | prefix. The format is similar to one used by syslog() | ||
| 654 | syscall, or to executing "dmesg -S --raw" or to reading | ||
| 655 | from /proc/kmsg. | ||
| 656 | |||
| 643 | consoleblank= [KNL] The console blank (screen saver) timeout in | 657 | consoleblank= [KNL] The console blank (screen saver) timeout in |
| 644 | seconds. A value of 0 disables the blank timer. | 658 | seconds. A value of 0 disables the blank timer. |
| 645 | Defaults to 0. | 659 | Defaults to 0. |
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 5d81206a572d..568729e0dc2c 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c | |||
| @@ -277,6 +277,13 @@ EXPORT_SYMBOL(console_set_on_cmdline); | |||
| 277 | /* Flag: console code may call schedule() */ | 277 | /* Flag: console code may call schedule() */ |
| 278 | static int console_may_schedule; | 278 | static int console_may_schedule; |
| 279 | 279 | ||
| 280 | enum con_msg_format_flags { | ||
| 281 | MSG_FORMAT_DEFAULT = 0, | ||
| 282 | MSG_FORMAT_SYSLOG = (1 << 0), | ||
| 283 | }; | ||
| 284 | |||
| 285 | static int console_msg_format = MSG_FORMAT_DEFAULT; | ||
| 286 | |||
| 280 | /* | 287 | /* |
| 281 | * The printk log buffer consists of a chain of concatenated variable | 288 | * The printk log buffer consists of a chain of concatenated variable |
| 282 | * length records. Every record starts with a record header, containing | 289 | * length records. Every record starts with a record header, containing |
| @@ -1913,6 +1920,17 @@ static int __add_preferred_console(char *name, int idx, char *options, | |||
| 1913 | c->index = idx; | 1920 | c->index = idx; |
| 1914 | return 0; | 1921 | return 0; |
| 1915 | } | 1922 | } |
| 1923 | |||
| 1924 | static int __init console_msg_format_setup(char *str) | ||
| 1925 | { | ||
| 1926 | if (!strcmp(str, "syslog")) | ||
| 1927 | console_msg_format = MSG_FORMAT_SYSLOG; | ||
| 1928 | if (!strcmp(str, "default")) | ||
| 1929 | console_msg_format = MSG_FORMAT_DEFAULT; | ||
| 1930 | return 1; | ||
| 1931 | } | ||
| 1932 | __setup("console_msg_format=", console_msg_format_setup); | ||
| 1933 | |||
| 1916 | /* | 1934 | /* |
| 1917 | * Set up a console. Called via do_early_param() in init/main.c | 1935 | * Set up a console. Called via do_early_param() in init/main.c |
| 1918 | * for each "console=" parameter in the boot command line. | 1936 | * for each "console=" parameter in the boot command line. |
| @@ -2215,7 +2233,10 @@ skip: | |||
| 2215 | goto skip; | 2233 | goto skip; |
| 2216 | } | 2234 | } |
| 2217 | 2235 | ||
| 2218 | len += msg_print_text(msg, false, text + len, sizeof(text) - len); | 2236 | len += msg_print_text(msg, |
| 2237 | console_msg_format & MSG_FORMAT_SYSLOG, | ||
| 2238 | text + len, | ||
| 2239 | sizeof(text) - len); | ||
| 2219 | if (nr_ext_console_drivers) { | 2240 | if (nr_ext_console_drivers) { |
| 2220 | ext_len = msg_print_ext_header(ext_text, | 2241 | ext_len = msg_print_ext_header(ext_text, |
| 2221 | sizeof(ext_text), | 2242 | sizeof(ext_text), |
