From nobody Mon Jul 29 16:38:36 2024 X-Original-To: dev-commits-src-all@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 4WXkZN52KBz5RYmY; Mon, 29 Jul 2024 16:38:36 +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 4WXkZN3FJhz4FRD; Mon, 29 Jul 2024 16:38:36 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722271116; 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=QLDatU2oljNUWkm4/Ob4upCQXG3jF05NqE4HtJ/1i9g=; b=GQEi1iPb11TeZU02U/130MAPzd41g/32/TCdvbv2aBgWO/JQyEh5aVGkx7BUHuQNy47tLH Bg63RU4IBdkWbAUEb48FeBSkMad4jZmqIG/PDwYRlDoDXKEsWYEI0XZrcYg8PbbSlecTk/ 1/RQ1/Sy+X67ULzEdUqNxuqeelrCW37+1Df2TeAarYN84hWFEgNx6HSrb6i5x41GcpKMq9 GjsZbTwyae/vU1VtavBJPOt73guzJY9QHdsA9VXPDaK8+kRTSZB2FA01qKu3OvF2AJfqq8 xT09v9ZdMTPMI/mMiTqOgVLHNvrtv1giMz3R3u71EQpV8Om7+YfAblDF3/mA2A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722271116; a=rsa-sha256; cv=none; b=mKl4S+G+pZ5+W1nThKB+2A6V4zwdMUy00c9XWyllxT3QKScM5aSjxTV2eUzpagSme6ksDw iXmq73CUZGcNWFzRnqtDL8BemSqybxQeAWZhsM6QzcF1Z4BR+KpX53+s3GzRD/tbAo0b5s jipVqghJ1T5B5Zlw30ry8hIXl/CnH6EY+Ox4coSJ/JDnmxwRyhEyUseHIyEaNCrJPuO4Zu PPuuF+7b3sphHVnfsb2QAffl1+JJWXFnsrIvWui2g2HqbBc69faWPUQ2ZmoeD/68DydFMg gzvEnodwSzJLusr6ZxweIcnKFWkHKGRkFMf3DWMXX22XLIf9IBK7IwBQo6KiWQ== 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=1722271116; 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=QLDatU2oljNUWkm4/Ob4upCQXG3jF05NqE4HtJ/1i9g=; b=gR5yXQ18jlj69Ux17XSIsm6mhUDP6rb/b1CXre9PRuytGfkgZ/SBCH+D2xPOaeVEQ6p/Rv WruJivQhcUc/SjIFikVIZAeA0mGnvq9zzF9pYcGymDXJeYLyQFfqe4Bk3SRYKmtToV0RpH q3L+/6f8w/jw4+KxFKRXJm4Mk/tPAdl+r34gvia+4LNZzQqDTrlt32vgAPw0C2tuk8OY8q F/ZXTD82Qegr6aoB+ICKsiFnStTYt3MnfLeIWrB8A50w9Ci0ER7XFCH0UY68J+pQjXGVrq JHw5JPPxNdo0KtwN2OblzTL4D6T/lk34sFoLWcQ8OsLKiPEyBL5zcm1RxKZUnw== 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 4WXkZN2sj3zj2x; Mon, 29 Jul 2024 16:38:36 +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 46TGcaXL005141; Mon, 29 Jul 2024 16:38:36 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46TGcaMM005138; Mon, 29 Jul 2024 16:38:36 GMT (envelope-from git) Date: Mon, 29 Jul 2024 16:38:36 GMT Message-Id: <202407291638.46TGcaMM005138@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Emmanuel Vadot Subject: git: 619caaa1b552 - stable/14 - loader: Load a splash screen if "splash" variable is defined List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 619caaa1b5524772ea5e93dec0f558a243503acc Auto-Submitted: auto-generated The branch stable/14 has been updated by manu: URL: https://cgit.FreeBSD.org/src/commit/?id=619caaa1b5524772ea5e93dec0f558a243503acc commit 619caaa1b5524772ea5e93dec0f558a243503acc Author: Emmanuel Vadot AuthorDate: 2024-07-09 12:41:11 +0000 Commit: Emmanuel Vadot 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 #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. */