mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-24 17:44:17 +01:00
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
This commit is contained in:
parent
f6e8b0e850
commit
00460cc8c5
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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. */
|
||||
|
Loading…
Reference in New Issue
Block a user