git: a934ad15516b - stable/14 - lualoader: allow graphical bits to be disabled with loader_gfx
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 21 Jul 2025 02:13:47 UTC
The branch stable/14 has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=a934ad15516b47ff2018141381ddabab55061a56
commit a934ad15516b47ff2018141381ddabab55061a56
Author: Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2025-06-06 14:44:14 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2025-07-21 02:12:25 +0000
lualoader: allow graphical bits to be disabled with loader_gfx
Some people prefer the old ASCII art look and it's good to have a way
to confirm that the fallbacks still work right on systems that have a
functional framebuffer available. Add a loader_gfx loader.conf(5)
variable to disable the eager use of graphics for these use-cases.
While we're here, clean up the style in the area a little bit; the early
porting that I did to lualoader did a lot of redundant ~= nil that has
carried over into some of the later work. We can drop some of that, and
also re-organize some of these variables to improve readability.
ziaee notes that the positioning of the orb is a bit off; this is due to
a change in positioning that happened in
1b4e1171315398dec ("loader: Fix orb position") to account for the image
dimensions. This should be partially reverted to get it right; we
shouldn't assume that we can use the same shift in gfx-* definitions for
both the ASCII art and the associated image -- the {image, image_rl}
pair should be converted to something more like an fbimg or gfx table
that has the image, image width and a shift override to avoid messing
up the ASCII positioning when disabled (or with no graphics available).
Reviewed by: imp, manu, ziaee (manpages)
(cherry picked from commit bef6d85b6de55e0e7adcfa1fd2e4abdcecbf9564)
---
stand/defaults/loader.conf | 1 +
stand/defaults/loader.conf.5 | 8 +++++++-
stand/lua/drawer.lua | 30 +++++++++++++++---------------
3 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/stand/defaults/loader.conf b/stand/defaults/loader.conf
index 7397082ac29b..610f4e3be4f9 100644
--- a/stand/defaults/loader.conf
+++ b/stand/defaults/loader.conf
@@ -104,6 +104,7 @@ efi_max_resolution="1x1" # Set the max resolution for EFI loader to use:
# WidthxHeight (e.g. 1920x1080)
#kernels="kernel kernel.old" # Kernels to display in the boot menu
kernels_autodetect="YES" # Auto-detect kernel directories in /boot
+#loader_gfx="YES" # Use graphical images when available
#loader_logo="orbbw" # Desired logo: orbbw, orb, fbsdbw, beastiebw, beastie, none
#comconsole_speed="115200" # Set the current serial console speed
#console="vidconsole" # A comma separated list of console(s)
diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5
index 1e302172af46..2f1ced192857 100644
--- a/stand/defaults/loader.conf.5
+++ b/stand/defaults/loader.conf.5
@@ -21,7 +21,7 @@
.\" 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.
-.Dd July 8, 2024
+.Dd July 3, 2025
.Dt LOADER.CONF 5
.Os
.Sh NAME
@@ -410,6 +410,12 @@ be displayed.
If set to
.Dq YES ,
the beastie boot menu will be skipped.
+.It Va loader_gfx
+If set to
+.Dq NO ,
+the ASCII art version of the brand and logo will be used even if graphical
+versions are available.
+Additionally, the menu frame will be drawn with ASCII art as well.
.It Va loader_logo Pq Dq Li orbbw
Selects a desired logo in the beastie boot menu.
Possible values are:
diff --git a/stand/lua/drawer.lua b/stand/lua/drawer.lua
index 1bf741b2373e..013e7b43e126 100644
--- a/stand/lua/drawer.lua
+++ b/stand/lua/drawer.lua
@@ -213,6 +213,13 @@ local function defaultframe()
return "double"
end
+local function gfxenabled()
+ return (loader.getenv("loader_gfx") or "yes"):lower() ~= "no"
+end
+local function gfxcapable()
+ return core.isFramebufferConsole() and gfx.term_putimage
+end
+
local function drawframe()
local x = menu_position.x - 3
local y = menu_position.y - 1
@@ -238,7 +245,7 @@ local function drawframe()
x = x + shift.x
y = y + shift.y
- if core.isFramebufferConsole() and gfx.term_drawrect ~= nil then
+ if gfxenabled() and gfxcapable() then
gfx.term_drawrect(x, y, x + w, y + h)
return true
end
@@ -324,11 +331,9 @@ local function drawbrand()
y = y + branddef.shift.y
end
- if core.isFramebufferConsole() and
- gfx.term_putimage ~= nil and
- branddef.image ~= nil then
- if gfx.term_putimage(branddef.image, x, y, 0, 7, 0)
- then
+ local gfx_requested = branddef.image and gfxenabled()
+ if gfx_requested and gfxcapable() then
+ if gfx.term_putimage(branddef.image, x, y, 0, 7, 0) then
return true
end
end
@@ -375,16 +380,11 @@ local function drawlogo()
y = y + logodef.shift.y
end
- if core.isFramebufferConsole() and
- gfx.term_putimage ~= nil and
- logodef.image ~= nil then
- local y1 = 15
+ local gfx_requested = logodef.image and gfxenabled()
+ if gfx_requested and gfxcapable() then
+ local y1 = logodef.image_rl or 15
- if logodef.image_rl ~= nil then
- y1 = logodef.image_rl
- end
- if gfx.term_putimage(logodef.image, x, y, 0, y + y1, 0)
- then
+ if gfx.term_putimage(logodef.image, x, y, 0, y + y1, 0) then
return true
end
end