metropolis: prevent printk console pollution

This implements two separate approaches to limit printk pollution of the
new tconsole:

 1. Sets the minimum printk level to EMERG. Everything lower than this
    level will not get blasted to tty0.
 2. Jut in case something does a spurious EMERG printk (or something
    just writes to tty0), we redraw the console. This makes it
    self-healing.

Change-Id: I69370ebf6c3cb3cacc8b6ea1ad3703e758bbf50c
Reviewed-on: https://review.monogon.dev/c/monogon/+/3398
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/node/core/tconsole/tconsole.go b/metropolis/node/core/tconsole/tconsole.go
index bbdca82..bd4bd08 100644
--- a/metropolis/node/core/tconsole/tconsole.go
+++ b/metropolis/node/core/tconsole/tconsole.go
@@ -159,8 +159,13 @@
 
 	// Ticker used to maintain redraws at minimum 10Hz, to eg. update the clock in
 	// the status bar.
-	ticker := time.NewTicker(time.Second / 10)
-	defer ticker.Stop()
+	tickerDraw := time.NewTicker(time.Second / 10)
+	defer tickerDraw.Stop()
+
+	// Ticker used to fully resync the screen every 10 seconds, in case something
+	// scribbled over the TTY.
+	tickerSync := time.NewTicker(time.Second * 10)
+	defer tickerSync.Stop()
 
 	for {
 		// Draw active page.
@@ -174,7 +179,9 @@
 		c.screen.Show()
 
 		select {
-		case <-ticker.C:
+		case <-tickerDraw.C:
+		case <-tickerSync.C:
+			c.screen.Sync()
 		case <-ctx.Done():
 			return ctx.Err()
 		case ev := <-evC: