aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/printk.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/kernel/printk.c b/kernel/printk.c
index 41fe60995530..668df351e6a9 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -1240,22 +1240,14 @@ void register_console(struct console *newcon)
1240 if (!(newcon->flags & CON_ENABLED)) 1240 if (!(newcon->flags & CON_ENABLED))
1241 return; 1241 return;
1242 1242
1243 if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV)) { 1243 /*
1244 /* we need to iterate through twice, to make sure we print 1244 * If we have a bootconsole, and are switching to a real console,
1245 * everything out, before we unregister the console(s) 1245 * don't print everything out again, since when the boot console, and
1246 */ 1246 * the real console are the same physical device, it's annoying to
1247 printk(KERN_INFO "console handover:"); 1247 * see the beginning boot messages twice
1248 for_each_console(bcon) 1248 */
1249 printk("boot [%s%d] ", bcon->name, bcon->index); 1249 if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV))
1250 printk(" -> real [%s%d]\n", newcon->name, newcon->index);
1251 for_each_console(bcon)
1252 unregister_console(bcon);
1253 newcon->flags &= ~CON_PRINTBUFFER; 1250 newcon->flags &= ~CON_PRINTBUFFER;
1254 } else {
1255 printk(KERN_INFO "%sconsole [%s%d] enabled\n",
1256 (newcon->flags & CON_BOOT) ? "boot" : "" ,
1257 newcon->name, newcon->index);
1258 }
1259 1251
1260 /* 1252 /*
1261 * Put this console in the list - keep the 1253 * Put this console in the list - keep the
@@ -1281,6 +1273,28 @@ void register_console(struct console *newcon)
1281 spin_unlock_irqrestore(&logbuf_lock, flags); 1273 spin_unlock_irqrestore(&logbuf_lock, flags);
1282 } 1274 }
1283 release_console_sem(); 1275 release_console_sem();
1276
1277 /*
1278 * By unregistering the bootconsoles after we enable the real console
1279 * we get the "console xxx enabled" message on all the consoles -
1280 * boot consoles, real consoles, etc - this is to ensure that end
1281 * users know there might be something in the kernel's log buffer that
1282 * went to the bootconsole (that they do not see on the real console)
1283 */
1284 if (bcon && ((newcon->flags & (CON_CONSDEV | CON_BOOT)) == CON_CONSDEV)) {
1285 /* we need to iterate through twice, to make sure we print
1286 * everything out, before we unregister the console(s)
1287 */
1288 printk(KERN_INFO "console [%s%d] enabled, bootconsole disabled\n",
1289 newcon->name, newcon->index);
1290 for_each_console(bcon)
1291 if (bcon->flags & CON_BOOT)
1292 unregister_console(bcon);
1293 } else {
1294 printk(KERN_INFO "%sconsole [%s%d] enabled\n",
1295 (newcon->flags & CON_BOOT) ? "boot" : "" ,
1296 newcon->name, newcon->index);
1297 }
1284} 1298}
1285EXPORT_SYMBOL(register_console); 1299EXPORT_SYMBOL(register_console);
1286 1300