From owner-svn-src-head@freebsd.org Sun Oct 7 15:28:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F42010C4BAC; Sun, 7 Oct 2018 15:28:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B77788652; Sun, 7 Oct 2018 15:28:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 183E315B24; Sun, 7 Oct 2018 15:28:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w97FSoot054073; Sun, 7 Oct 2018 15:28:50 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w97FSotK054072; Sun, 7 Oct 2018 15:28:50 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201810071528.w97FSotK054072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 7 Oct 2018 15:28:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339222 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 339222 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Oct 2018 15:28:51 -0000 Author: kevans Date: Sun Oct 7 15:28:50 2018 New Revision: 339222 URL: https://svnweb.freebsd.org/changeset/base/339222 Log: lualoader: Honor boot_* variables at lua init For non-UEFI systems, boot.config(5) may have -s or -v specified for single-user and verbose boot respectively. These were not being properly taken into account and reflected in the "Boot Options" submenu. When we initialize core.lua, we'll record boot_single and boot_verbose as we do ACPI and consider these the system defaults. Reported by: David Wolfskill Approved by: re (kib) Modified: head/stand/lua/core.lua Modified: head/stand/lua/core.lua ============================================================================== --- head/stand/lua/core.lua Sun Oct 7 15:13:47 2018 (r339221) +++ head/stand/lua/core.lua Sun Oct 7 15:28:50 2018 (r339222) @@ -34,6 +34,10 @@ local hook = require("hook") local core = {} +local default_safe_mode = false +local default_single_user = false +local default_verbose = false + local function composeLoaderCmd(cmd_name, argstr) if argstr ~= nil then cmd_name = cmd_name .. " " .. argstr @@ -41,6 +45,26 @@ local function composeLoaderCmd(cmd_name, argstr) return cmd_name end +local function recordDefaults() + -- On i386, hint.acpi.0.rsdp will be set before we're loaded. On !i386, + -- it will generally be set upon execution of the kernel. Because of + -- this, we can't (or don't really want to) detect/disable ACPI on !i386 + -- reliably. Just set it enabled if we detect it and leave well enough + -- alone if we don't. + local boot_acpi = core.isSystem386() and core.getACPIPresent(false) + local boot_single = loader.getenv("boot_single") or "no" + local boot_verbose = loader.getenv("boot_verbose") or "no" + default_single_user = boot_single:lower() ~= "no" + default_verbose = boot_verbose:lower() ~= "no" + + if boot_acpi then + core.setACPI(true) + end + core.setSingleUser(default_single_user) + core.setVerbose(default_verbose) +end + + -- Globals -- try_include will return the loaded module on success, or nil on failure. -- A message will also be printed on failure, with one exception: non-verbose @@ -268,9 +292,9 @@ end function core.setDefaults() core.setACPI(core.getACPIPresent(true)) - core.setSafeMode(false) - core.setSingleUser(false) - core.setVerbose(false) + core.setSafeMode(default_safe_mode) + core.setSingleUser(default_single_user) + core.setVerbose(default_verbose) end function core.autoboot(argstr) @@ -367,13 +391,6 @@ function core.popFrontTable(tbl) return first_value, new_tbl end --- On i386, hint.acpi.0.rsdp will be set before we're loaded. On !i386, it will --- generally be set upon execution of the kernel. Because of this, we can't (or --- don't really want to) detect/disable ACPI on !i386 reliably. Just set it --- enabled if we detect it and leave well enough alone if we don't. -if core.isSystem386() and core.getACPIPresent(false) then - core.setACPI(true) -end - +recordDefaults() hook.register("config.reloaded", core.clearCachedKernels) return core