From nobody Thu Jul 11 06:50:43 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WKQNM6jG4z5QQtS; Thu, 11 Jul 2024 06:50:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WKQNM68P8z4CMY; Thu, 11 Jul 2024 06:50:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720680643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WCiH0voPQ6DXaQYq0HLcnGdcBmz1UU1jjqu602qHbQ4=; b=pn9IR+lJ6+8pu4e/4rtSptNhnp877iLvoHGnVoFbKnT4NYe6ghE1c4NjtC2cS8jItgNlEX zWYvZH78SUiVnOvN6GcK3MJx6IEzzOj5wCtZyLwmhXv68lcrWW6DllD0zkCzLWVRcqEsXT SI+84nUXd+CY4y9SOlgEs7R0rg3AQ5dqM6IJWXsTNI/ZGZL43+Hp2BDsNelnNarV7lyoN5 S4qchD6rKLIwDwfdoZFxy0SBxv8w6GrUOdTl6OtKGE6XoEru/BldtKTImaKkSyc7mYT1Va fSKSKUNgaUlkNxEsCxW5Mh1MudETEE7LqX17pcbKropyC2SjMa0omhWPlZ1n0w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720680643; a=rsa-sha256; cv=none; b=CWVnu10CWCcefGHBBCXnLJaAy6T+nME8bQDcQLTweXxCaQ0tKCOrVEx7zM55zIAXiIIlKs vaS6KHjak+I3am5rlb2G9E3fiJ8ss6rpzR4qNOfDEhDw/ypT1CJnBmhGGFAu4gp2BHSskw QqCTu2afvxx/n8SlMyNJXqje07Ypg/zJJXz2M89WZ+JZMthbQRFYWxfA7VTArT3Z4JKvfg rskW8t/7oXFCifLipjy+EV/Yuk/mpKTkpY+Lh2ecN/1XGNRmyyvRACjwCS2K6M6XWhBDtN lojIELxKEvXWctQ2lIKD2l78q21O8kV9Ayrv5O7uR9EEYmPsGJ2X1DKa69CodQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720680643; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=WCiH0voPQ6DXaQYq0HLcnGdcBmz1UU1jjqu602qHbQ4=; b=D5m2r01kKY5DquWgnDcWfSSkFYFYhWK0CtDczKXdinXjxG8LzrbPXBc/e9wldUJR3s9XBa 9OJRMb/znFb1Rx3dPvNh/i/3+mu6GzN3dX/VYcs1iTMZrr7jBpCCirJ9IHuCThNYtPuHGh 97lvs1Y5pyy0gvjdd/y7DlNKL5x+DXPoSLBZpnyxPWL8LIVYf6sGmREWJEaBV6ClhJw86+ afvCimuOKiRb7BySh7VglXunLAwrKiAYVBc2cwwjr9aML1lU61/pkUwmWdXG5zPsE1O64N EB7V0pgQjLZagyIi2IVLyVDGtoVPdroG33DISFX+sewaBXSif/J0zXjDLdyDRQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WKQNM56CbzqwR; Thu, 11 Jul 2024 06:50:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46B6ohJk073636; Thu, 11 Jul 2024 06:50:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46B6ohc4073633; Thu, 11 Jul 2024 06:50:43 GMT (envelope-from git) Date: Thu, 11 Jul 2024 06:50:43 GMT Message-Id: <202407110650.46B6ohc4073633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Emmanuel Vadot Subject: git: 00460cc8c5ad - main - loader: Load a splash screen if "splash" variable is defined List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: manu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 00460cc8c5ad02b628e81eec9e493a1df8393d36 Auto-Submitted: auto-generated The branch main has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=00460cc8c5ad02b628e81eec9e493a1df8393d36 commit 00460cc8c5ad02b628e81eec9e493a1df8393d36 Author: Emmanuel Vadot AuthorDate: 2024-07-09 12:41:11 +0000 Commit: Emmanuel Vadot CommitDate: 2024-07-11 06:47:30 +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 --- 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 79ce0b023b7a..09c4832f5855 100644 --- a/stand/common/bootstrap.h +++ b/stand/common/bootstrap.h @@ -282,6 +282,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 #include #include +#include #include #include #include @@ -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. */