Date: Fri, 03 Apr 2026 07:49:57 +0000 From: Ahmad Khalifa <vexeduxr@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Quent=?utf-8?Q?in Th=C3=A9?=bault <quentin.thebault@defenso.fr> Subject: git: 4b862c713ac5 - main - splash: add shutdown splash Message-ID: <69cf7125.25ecc.6ef7c1f8@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by vexeduxr: URL: https://cgit.FreeBSD.org/src/commit/?id=4b862c713ac5556ab4bd1828b47c5eb9cb28e067 commit 4b862c713ac5556ab4bd1828b47c5eb9cb28e067 Author: Quentin Thébault <quentin.thebault@defenso.fr> AuthorDate: 2026-04-02 16:38:47 +0000 Commit: Ahmad Khalifa <vexeduxr@FreeBSD.org> CommitDate: 2026-04-03 07:15:29 +0000 splash: add shutdown splash This commit adds a shutdown splash to the existing kernel startup splash(4) screen feature. It can be customized by providing a PNG image to the shutdown_splash directive loader.conf(5). Sponsored by: Defenso MFC after: 2 weeks Reviewed by: vexeduxr, ziaee, manu Differential Revision: https://reviews.freebsd.org/D55140 --- share/man/man4/splash.4 | 14 +++++++++++--- stand/common/bootstrap.h | 4 +++- stand/common/gfx_fb.c | 20 ++++++++++++++++---- stand/defaults/loader.conf | 4 +++- stand/efi/loader/bootinfo.c | 7 ++++++- sys/dev/vt/vt_core.c | 20 +++++++++++++++++++- sys/kern/subr_module.c | 5 +++++ sys/sys/linker.h | 1 + 8 files changed, 64 insertions(+), 11 deletions(-) diff --git a/share/man/man4/splash.4 b/share/man/man4/splash.4 index 0e52d9eb83c4..0985385f5e08 100644 --- a/share/man/man4/splash.4 +++ b/share/man/man4/splash.4 @@ -24,14 +24,14 @@ .\" (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 09, 2024 +.Dd April 03, 2026 .Dt SPLASH 4 .Os .Sh NAME .Nm splash .Nd splash screen / screen saver interface .Sh SYNOPSIS -.Cd "device splash" +.Cd device splash .Sh DESCRIPTION The .Nm @@ -254,6 +254,12 @@ and include the following lines: splash="/boot/images/freebsd-logo-rev.png" boot_mute="YES" .Ed +.Pp +A splash screen to be displayed at shutdown time can be specified with: +.Bd -literal -offset indent +shutdown_splash="/boot/images/freebsd-logo-rev.png" +boot_mute="YES" +.Ed .\".Sh DIAGNOSTICS .Sh SEE ALSO .Xr vidcontrol 1 , @@ -308,7 +314,9 @@ modules were written by png support for .Xr vt 4 was written by -.An Emmanuel Vadot Aq Mt manu@FreeBSD.org . +.An Emmanuel Vadot Aq Mt manu@FreeBSD.org +and extended for shutdown by +.An Quentin Thébault Aq Mt quentin.thebault@defenso.fr . .Sh CAVEATS The screen saver works with .Xr syscons 4 diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h index 17887919089c..7be1d6897a9a 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -282,7 +282,9 @@ 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); +#define SPLASH_STARTUP 1 +#define SPLASH_SHUTDOWN 2 +vm_offset_t build_splash_module(vm_offset_t, int); /* MI module loaders */ #ifdef __elfN diff --git a/stand/common/gfx_fb.c b/stand/common/gfx_fb.c index d99d9b7a868f..103833070a21 100644 --- a/stand/common/gfx_fb.c +++ b/stand/common/gfx_fb.c @@ -3098,7 +3098,7 @@ build_font_module(vm_offset_t addr) } vm_offset_t -build_splash_module(vm_offset_t addr) +build_splash_module(vm_offset_t addr, int type) { struct preloaded_file *fp; struct splash_info si; @@ -3118,7 +3118,11 @@ build_splash_module(vm_offset_t addr) if (fp == NULL) panic("can't find kernel file"); - splash = getenv("splash"); + if (type == SPLASH_STARTUP) + splash = getenv("splash"); + if (type == SPLASH_SHUTDOWN) + splash = getenv("shutdown_splash"); + if (splash == NULL) return (addr); @@ -3137,7 +3141,15 @@ build_splash_module(vm_offset_t addr) /* 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); + if (type == SPLASH_STARTUP) { + printf("Loading splash ok\n"); + file_addmetadata(fp, MODINFOMD_SPLASH, + sizeof(splashp), &splashp); + } + if (type == SPLASH_SHUTDOWN) { + printf("Loading shutdown splash ok\n"); + file_addmetadata(fp, MODINFOMD_SHTDWNSPLASH, + sizeof(splashp), &splashp); + } return (addr); } diff --git a/stand/defaults/loader.conf b/stand/defaults/loader.conf index a10c65f28eaf..bbabc5fb66a3 100644 --- a/stand/defaults/loader.conf +++ b/stand/defaults/loader.conf @@ -27,7 +27,9 @@ vesa_load="NO" # Set this to YES to load the vesa module bitmap_load="NO" # Set this to YES if you want splash screen! bitmap_name="splash.bmp" # Set this to the name of the file bitmap_type="splash_image_data" # and place it on the module_path -splash="/boot/images/freebsd-logo-rev.png" # Set boot_mute=YES to load it +# Set boot_mute=YES to load these +splash="/boot/images/freebsd-logo-rev.png" +shutdown_splash="/boot/images/freebsd-logo-rev.png" ### Screen saver modules ################################### # This is best done in rc.conf diff --git a/stand/efi/loader/bootinfo.c b/stand/efi/loader/bootinfo.c index 151ac34dd08e..fc87a0bf52fb 100644 --- a/stand/efi/loader/bootinfo.c +++ b/stand/efi/loader/bootinfo.c @@ -396,7 +396,12 @@ bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp, bool exit_bs) /* Pad to a page boundary. */ addr = md_align(addr); - addr = build_splash_module(addr); + addr = build_splash_module(addr, SPLASH_STARTUP); + + /* Pad to a page boundary. */ + addr = md_align(addr); + + addr = build_splash_module(addr, SPLASH_SHUTDOWN); /* Pad to a page boundary. */ addr = md_align(addr); diff --git a/sys/dev/vt/vt_core.c b/sys/dev/vt/vt_core.c index b9159a73ad79..0ca4bb8d4d49 100644 --- a/sys/dev/vt/vt_core.c +++ b/sys/dev/vt/vt_core.c @@ -1684,8 +1684,13 @@ vtterm_splash(struct vt_device *vd) uintptr_t image; vt_axis_t top, left; - si = MD_FETCH(preload_kmdp, MODINFOMD_SPLASH, struct splash_info *); if (!(vd->vd_flags & VDF_TEXTMODE) && (boothowto & RB_MUTE)) { + if (rebooting == 1) { + si = MD_FETCH(preload_kmdp, MODINFOMD_SHTDWNSPLASH, struct splash_info *); + vd->vd_driver->vd_blank(vd, TC_BLACK); + } else { + si = MD_FETCH(preload_kmdp, MODINFOMD_SPLASH, struct splash_info *); + } if (si == NULL) { top = (vd->vd_height - vt_logo_height) / 2; left = (vd->vd_width - vt_logo_width) / 2; @@ -1832,6 +1837,15 @@ vt_init_font_static(void) vt_font_assigned = font; } +#ifdef DEV_SPLASH +static int +vt_shutdown_splash(struct vt_window *vw) +{ + vtterm_splash(vw->vw_device); + return (0); +} +#endif + static void vtterm_cnprobe(struct terminal *tm, struct consdev *cp) { @@ -3177,6 +3191,10 @@ vt_upgrade(struct vt_device *vd) /* For existing console window. */ EVENTHANDLER_REGISTER(shutdown_pre_sync, vt_window_switch, vw, SHUTDOWN_PRI_DEFAULT); +#ifdef DEV_SPLASH + EVENTHANDLER_REGISTER(shutdown_pre_sync, + vt_shutdown_splash, vw, SHUTDOWN_PRI_DEFAULT); +#endif } } } diff --git a/sys/kern/subr_module.c b/sys/kern/subr_module.c index ab1eefab30b1..92f22206f8cf 100644 --- a/sys/kern/subr_module.c +++ b/sys/kern/subr_module.c @@ -307,6 +307,7 @@ preload_bootstrap_relocate(vm_offset_t offset) case MODINFO_ADDR: case MODINFO_METADATA|MODINFOMD_FONT: case MODINFO_METADATA|MODINFOMD_SPLASH: + case MODINFO_METADATA|MODINFOMD_SHTDWNSPLASH: case MODINFO_METADATA|MODINFOMD_SSYM: case MODINFO_METADATA|MODINFOMD_ESYM: ptr = (vm_offset_t *)(curp + (sizeof(uint32_t) * 2)); @@ -439,6 +440,9 @@ preload_modinfo_type(struct sbuf *sbp, int type) case MODINFOMD_SPLASH: sbuf_cat(sbp, "MODINFOMD_SPLASH"); break; + case MODINFOMD_SHTDWNSPLASH: + sbuf_cat(sbp, "MODINFOMD_SHTDWNSPLASH"); + break; #ifdef MODINFOMD_BOOT_HARTID case MODINFOMD_BOOT_HARTID: sbuf_cat(sbp, "MODINFOMD_BOOT_HARTID"); @@ -503,6 +507,7 @@ preload_modinfo_value(struct sbuf *sbp, uint32_t *bptr, int type, int len) #endif case MODINFO_METADATA | MODINFOMD_FONT: case MODINFO_METADATA | MODINFOMD_SPLASH: + case MODINFO_METADATA | MODINFOMD_SHTDWNSPLASH: sbuf_print_vmoffset(sbp, *(vm_offset_t *)bptr); break; case MODINFO_METADATA | MODINFOMD_HOWTO: diff --git a/sys/sys/linker.h b/sys/sys/linker.h index 85c50be6c969..f8a5dda06512 100644 --- a/sys/sys/linker.h +++ b/sys/sys/linker.h @@ -259,6 +259,7 @@ void linker_kldload_unbusy(int flags); #define MODINFOMD_KEYBUF 0x000d /* Crypto key intake buffer */ #define MODINFOMD_FONT 0x000e /* Console font */ #define MODINFOMD_SPLASH 0x000f /* Console splash screen */ +#define MODINFOMD_SHTDWNSPLASH 0x0010 /* Console shutdown splash screen */ #define MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */ #define MODINFOMD_DEPLIST (0x4001 | MODINFOMD_NOCOPY) /* depends on */home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69cf7125.25ecc.6ef7c1f8>
