boot1 is too early to be deciding a good resolution. Console modes don't map cleanly/predictably to actual screen resolutions, and GOP does not reflect the actual screen resolution after a console mode change. Rip it out. Add an efi-autoresizecons command to loader to choose an optimal screen resolution based on the current environment. We'll explicitly execute this later, preferably before we draw anything of value but after we load config and pick up any tunables we may need to decide where we're going. This method also allows us to actually pass the correct framebuffer information on to the kernel. UGA autoresizing is not implemented because it doesn't have the kind of mode enumeration that GOP does. If an interested person with relevant hardware could get in contact, we can take a look at implementing UGA autoresize. This effectively "fixes" the breakage caused by r327058, but doesn't actually set the resolution correctly until the interpreter calls efi-autoresizcons. The lualoader version of this has been included for reference; the forth equivalent will follow. Reviewed by: imp (with some hestitation), manu Differential Revision: https://reviews.freebsd.org/D14788
69 lines
2.5 KiB
Lua
69 lines
2.5 KiB
Lua
--
|
|
-- SPDX-License-Identifier: BSD-2-Clause-FreeBSD
|
|
--
|
|
-- Copyright (c) 2015 Pedro Souza <pedrosouza@freebsd.org>
|
|
-- Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
|
|
-- All rights reserved.
|
|
--
|
|
-- Redistribution and use in source and binary forms, with or without
|
|
-- modification, are permitted provided that the following conditions
|
|
-- are met:
|
|
-- 1. Redistributions of source code must retain the above copyright
|
|
-- notice, this list of conditions and the following disclaimer.
|
|
-- 2. Redistributions in binary form must reproduce the above copyright
|
|
-- notice, this list of conditions and the following disclaimer in the
|
|
-- documentation and/or other materials provided with the distribution.
|
|
--
|
|
-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
-- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
-- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
-- ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
-- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
-- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
-- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
-- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
-- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
-- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
-- SUCH DAMAGE.
|
|
--
|
|
-- $FreeBSD$
|
|
--
|
|
|
|
-- The cli module should be included first here. Some of the functions that it
|
|
-- defines are necessary for the Lua-based loader to operate in general.
|
|
-- Other modules will also need some of the functions it defines to safely
|
|
-- execute loader commands.
|
|
require("cli")
|
|
local color = require("color")
|
|
local core = require("core")
|
|
local config = require("config")
|
|
local menu
|
|
if not core.isMenuSkipped() then
|
|
menu = require("menu")
|
|
end
|
|
local password = require("password")
|
|
|
|
local result = lfs.attributes("/boot/lua/local.lua")
|
|
-- Effectively discard any errors; we'll just act if it succeeds.
|
|
if result ~= nil then
|
|
require("local")
|
|
end
|
|
|
|
config.load()
|
|
if core.isUEFIBoot() then
|
|
loader.perform("efi-autoresizecons")
|
|
end
|
|
-- Our console may have been setup for a different color scheme before we get
|
|
-- here, so make sure we set the default.
|
|
if color.isEnabled() then
|
|
printc(color.default())
|
|
end
|
|
password.check()
|
|
-- menu might be disabled
|
|
if menu ~= nil then
|
|
menu.run()
|
|
else
|
|
-- Load kernel/modules before we go
|
|
config.loadelf()
|
|
end
|