feat: Use bitmaps for boot logo replacement (#537)

This commit is contained in:
Kroese
2026-08-02 23:45:22 +02:00
committed by GitHub
parent baa76ccfdf
commit 1deba62354
+25 -25
View File
@@ -2,10 +2,10 @@
set -Eeuo pipefail
# Docker environment variables
: "${PICKER:="N"}" # Show picker
: "${SMM:=""}" # Enable SMM
: "${LOGO:=""}" # Enable logo
: "${CLEAR:=""}" # Clear NVRAM
: "${PICKER:="N"}" # Show picker
BOOT_DESC=""
BOOT_OPTS=""
@@ -35,7 +35,7 @@ selectOvmfFiles() {
return 0
}
prepareOvmfRom() {
prepareUefiRom() {
if [ -e "$DEST.rom" ] && [ ! -f "$DEST.rom" ]; then
error "UEFI boot path \"$DEST.rom\" is not a regular file!"
@@ -44,29 +44,28 @@ prepareOvmfRom() {
[ -s "$DEST.rom" ] && return 0
[ ! -s "$OVMF/$ROM" ] && error "UEFI boot file ($OVMF/$ROM) not found!" && exit 44
local rom="$OVMF/$ROM"
[ ! -s "$rom" ] && error "UEFI boot file ($rom) not found!" && exit 44
local logo="/var/www/img/${PROCESS,,}.ffs"
[ ! -s "$logo" ] && logo="/var/www/img/qemu.ffs"
[ ! -s "$logo" ] && LOGO="N"
local logo="/var/www/img/${PROCESS,,}.bmp"
[ ! -s "$logo" ] && logo="/var/www/img/qemu.bmp"
if ! disabled "$LOGO" && [ ! -s "$logo" ]; then
LOGO="N"
warn "boot logo file ($logo) not found!"
fi
rm -f "$DEST.tmp"
if disabled "${LOGO:-}"; then
if ! cp "$OVMF/$ROM" "$DEST.tmp"; then
rm -f "$DEST.tmp"
error "Failed to copy UEFI boot file to $DEST.tmp" && exit 44
fi
else
if ! /run/utk.bin "$OVMF/$ROM" replace_ffs LogoDXE "$logo" save "$DEST.tmp"; then
warn "failed to add custom logo to BIOS!"
rm -f "$DEST.tmp"
if ! disabled "$LOGO" &&
! /run/boot-logo "$logo" "$rom" --output "$DEST.tmp" -q; then
warn "failed to add custom logo ($logo) to UEFI firmware!"
rm -f "$DEST.tmp"
fi
if ! cp "$OVMF/$ROM" "$DEST.tmp"; then
rm -f "$DEST.tmp"
error "Failed to copy UEFI boot file to $DEST.tmp" && exit 44
fi
fi
if [[ ! -f "$DEST.tmp" ]] && ! cp "$rom" "$DEST.tmp"; then
rm -f "$DEST.tmp"
error "Failed to copy UEFI boot file to $DEST.tmp" && exit 44
fi
if ! mv "$DEST.tmp" "$DEST.rom"; then
@@ -79,7 +78,7 @@ prepareOvmfRom() {
return 0
}
prepareOvmfVars() {
prepareUefiVars() {
if [ -e "$DEST.vars" ] && [ ! -f "$DEST.vars" ]; then
error "UEFI vars path \"$DEST.vars\" is not a regular file!"
@@ -88,11 +87,12 @@ prepareOvmfVars() {
[ -s "$DEST.vars" ] && return 0
[ ! -s "$OVMF/$VARS" ] && error "UEFI vars file ($OVMF/$VARS) not found!" && exit 45
local vars="$OVMF/$VARS"
[ ! -s "$vars" ] && error "UEFI vars file ($vars) not found!" && exit 45
rm -f "$DEST.tmp"
if ! cp "$OVMF/$VARS" "$DEST.tmp"; then
if ! cp "$vars" "$DEST.tmp"; then
rm -f "$DEST.tmp"
error "Failed to copy UEFI vars file to $DEST.tmp" && exit 45
fi
@@ -466,8 +466,8 @@ osk=$(echo "bheuneqjbexolgurfrjbeqfthneqrqcyrnfrqbagfgrny(p)NccyrPbzchgreVap" |
BOOT_OPTS+=" -device isa-applesmc,osk=$osk"
# OVMF
prepareOvmfRom
prepareOvmfVars
prepareUefiRom
prepareUefiVars
addOvmfOptions
prepareOpenCoreImage