Date: Mon, 29 Jul 2024 16:38:36 GMT From: Emmanuel Vadot <manu@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 619caaa1b552 - stable/14 - loader: Load a splash screen if "splash" variable is defined Message-ID: <202407291638.46TGcaMM005138@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=619caaa1b5524772ea5e93dec0f558a243503acc commit 619caaa1b5524772ea5e93dec0f558a243503acc Author: Emmanuel Vadot <manu@FreeBSD.org> AuthorDate: 2024-07-09 12:41:11 +0000 Commit: Emmanuel Vadot <manu@FreeBSD.org> CommitDate: 2024-07-29 16:37:44 +0000 loader: Load a splash screen if "splash" variable is defined Load a splash screen that vt(4) can use if the "splash" env variable is defined. For now only png is supported and decoding is done in loader and not in kernel compared to splash screen support in sc(4). For using this add: boot_mute="YES" splash="/boot/images/freebsd-logo-rev.png" in loader.conf Differential Revision: https://reviews.freebsd.org/D45932 Reviewed by: imp, tsoome Sponsored by: Beckhoff Automation GmbH & Co. KG (cherry picked from commit 00460cc8c5ad02b628e81eec9e493a1df8393d36) --- stand/common/bootstrap.h | 1 + stand/common/gfx_fb.c | 48 +++++++++++++++++++++++++++++++++++++++++++++ stand/efi/loader/bootinfo.c | 5 +++++ 3 files changed, 54 insertions(+) diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h index b7d6e538f9be..2dcc6eda47ba 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -281,6 +281,7 @@ int tslog_init(void); int tslog_publish(void); vm_offset_t build_font_module(vm_offset_t); +vm_offset_t build_splash_module(vm_offset_t); /* MI module loaders */ #ifdef __elfN diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index 0a88a166089b..9942c629d124 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -87,6 +87,7 @@ #include <teken.h> #include <gfx_fb.h> #include <sys/font.h> +#include <sys/splash.h> #include <sys/linker.h> #include <sys/module.h> #include <sys/stdint.h> @@ -3007,3 +3008,50 @@ build_font_module(vm_offset_t addr) file_addmetadata(fp, MODINFOMD_FONT, sizeof(fontp), &fontp); return (addr); } + +vm_offset_t +build_splash_module(vm_offset_t addr) +{ + struct preloaded_file *fp; + struct splash_info si; + const char *splash; + png_t png; + uint64_t splashp; + int error; + + /* We can't load first */ + if ((file_findfile(NULL, NULL)) == NULL) { + printf("Can not load splash module: %s\n", + "the kernel is not loaded"); + return (addr); + } + + fp = file_findfile(NULL, "elf kernel"); + if (fp == NULL) + fp = file_findfile(NULL, "elf64 kernel"); + if (fp == NULL) + panic("can't find kernel file"); + + splash = getenv("splash"); + if (splash == NULL) + return (addr); + + /* Parse png */ + if ((error = png_open(&png, splash)) != PNG_NO_ERROR) { + return (addr); + } + + si.si_width = png.width; + si.si_height = png.height; + si.si_depth = png.bpp; + splashp = addr; + addr += archsw.arch_copyin(&si, addr, sizeof (struct splash_info)); + addr = roundup2(addr, 8); + + /* Copy the bitmap. */ + addr += archsw.arch_copyin(png.image, addr, png.png_datalen); + + printf("Loading splash ok\n"); + file_addmetadata(fp, MODINFOMD_SPLASH, sizeof(splashp), &splashp); + return (addr); +} diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index b55c2184d9fe..0a53422142e2 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -390,6 +390,11 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs) /* Pad to a page boundary. */ addr = roundup(addr, PAGE_SIZE); + + addr = build_splash_module(addr); + + /* Pad to a page boundary. */ + addr = roundup(addr, PAGE_SIZE); #endif /* Copy our environment. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407291638.46TGcaMM005138>