svn commit: r366422 - stable/12/stand/lua

Warner Losh imp at FreeBSD.org
Sun Oct 4 06:12:53 UTC 2020


Author: imp
Date: Sun Oct  4 06:12:52 2020
New Revision: 366422
URL: https://svnweb.freebsd.org/changeset/base/366422

Log:
  MFC: r366228
  
  Report the kernel console on the boot screen
  Report what console the boot loader is telling the kernel to use:
              o Dual (Serial Primary)
              o Dual (Video Primary)
              o Serial
              o Video
  and allow toggling between them.

Modified:
  stable/12/stand/lua/core.lua
  stable/12/stand/lua/menu.lua
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/lua/core.lua
==============================================================================
--- stable/12/stand/lua/core.lua	Sun Oct  4 03:33:05 2020	(r366421)
+++ stable/12/stand/lua/core.lua	Sun Oct  4 06:12:52 2020	(r366422)
@@ -410,6 +410,40 @@ function core.popFrontTable(tbl)
 	return first_value, new_tbl
 end
 
+function core.getConsoleName()
+	if loader.getenv("boot_multicons") ~= nil then
+		if loader.getenv("boot_serial") ~= nil then
+			return "Dual (Serial primary)"
+		else
+			return "Dual (Video primary)"
+		end
+	else
+		if loader.getenv("boot_serial") ~= nil then
+			return "Serial"
+		else
+			return "Video"
+		end
+	end
+end
+
+function core.nextConsoleChoice()
+	if loader.getenv("boot_multicons") ~= nil then
+		if loader.getenv("boot_serial") ~= nil then
+			loader.unsetenv("boot_serial")
+		else
+			loader.unsetenv("boot_multicons")
+			loader.setenv("boot_serial", "YES")
+		end
+	else
+		if loader.getenv("boot_serial") ~= nil then
+			loader.unsetenv("boot_serial")
+		else
+			loader.setenv("boot_multicons", "YES")
+			loader.setenv("boot_serial", "YES")
+		end
+	end
+end
+
 recordDefaults()
 hook.register("config.reloaded", core.clearCachedKernels)
 return core

Modified: stable/12/stand/lua/menu.lua
==============================================================================
--- stable/12/stand/lua/menu.lua	Sun Oct  4 03:33:05 2020	(r366421)
+++ stable/12/stand/lua/menu.lua	Sun Oct  4 06:12:52 2020	(r366422)
@@ -241,6 +241,7 @@ menu.welcome = {
 			boot_entry_2,
 			menu_entries.prompt,
 			menu_entries.reboot,
+			menu_entries.console,
 			{
 				entry_type = core.MENU_SEPARATOR,
 			},
@@ -279,6 +280,16 @@ menu.welcome = {
 				core.boot()
 			end,
 			alias = {"s", "S"},
+		},
+		console = {
+			entry_type = core.MENU_ENTRY,
+			name = function()
+				return color.highlight("C") .. "ons: " .. core.getConsoleName()
+			end,
+			func = function()
+				core.nextConsoleChoice()
+			end,
+			alias = {"c", "C"},
 		},
 		prompt = {
 			entry_type = core.MENU_RETURN,


More information about the svn-src-all mailing list