boot: a shared UI, and a graphical splash on UEFI
The first piece of the two loaders that is genuinely common code rather than a contract they both honour. It can be, because the difference between the firmwares is entirely in how a framebuffer is *obtained* -- VBE in real mode, or GOP -- and not in what you do with one afterwards. boot/common/ui.c takes a base, a size and a stride and draws; it knows nothing about disks, memory maps or mode setting, which is what lets it compile into a 16/32/64-bit BIOS loader and a PE/COFF UEFI application without either leaking into it. The look is deliberately quiet: dark ground, the mark centred, one thin bar beneath it, nothing on screen that is not load-bearing. The whole group is laid out from the centre outwards rather than from the top down, so it sits identically at 800x600 and at 1600x1200 instead of drifting up the screen as the mode grows. UEFI had no graphical splash at all -- it printed text to a console the QEMU window is usually not even showing. It draws the same screen as the BIOS path now, with the bar tracking bytes of kernel actually written rather than a segment count, which says nothing about how long each takes. Two ordering bugs found by looking at the pixels rather than the code: setup_framebuffer ran *after* the kernel was read, so every progress tick went to a framebuffer that did not exist yet and the splash then painted over the result; and that also put the resolution prompt after the slowest step instead of at the start. The display is set up first now. Verified from the host with screendump: background is exactly SCH_BG, the bar is 4px tall and width/4 wide at y=495 on a 1280x800 screen, which is where centring the group puts it. UEFI still boots to cpu0; BIOS bootcheck 27/27. Not yet shared: the BIOS loader still draws with its own copy of this code. Deleting that copy in favour of this one is the next step and the point of the exercise -- until then this is one loader using shared code and one duplicating it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
879db62379
commit
64e4835524
4 changed files with 378 additions and 4 deletions
6
Makefile
6
Makefile
|
|
@ -390,10 +390,12 @@ kernel: $(BUILD)/kernel/kernel
|
|||
# -----------------------------------------------------------------------
|
||||
UEFI_CFLAGS = --target=x86_64-unknown-windows -ffreestanding -fshort-wchar -mno-red-zone -fno-stack-protector -Wall -Wextra -O1 -I./include
|
||||
|
||||
$(BUILD)/uefi/BOOTX64.EFI: boot/uefi/main.c boot/uefi/efi.h include/schboot.h
|
||||
$(BUILD)/uefi/BOOTX64.EFI: boot/uefi/main.c boot/uefi/efi.h include/schboot.h \
|
||||
boot/common/ui.c boot/common/ui.h
|
||||
@mkdir -p $(BUILD)/uefi
|
||||
clang $(UEFI_CFLAGS) -c boot/uefi/main.c -o $(BUILD)/uefi/main.obj
|
||||
lld-link -subsystem:efi_application -entry:EfiMain -nodefaultlib $(BUILD)/uefi/main.obj -out:$@
|
||||
clang $(UEFI_CFLAGS) -c boot/common/ui.c -o $(BUILD)/uefi/ui.obj
|
||||
lld-link -subsystem:efi_application -entry:EfiMain -nodefaultlib $(BUILD)/uefi/main.obj $(BUILD)/uefi/ui.obj -out:$@
|
||||
|
||||
uefi: $(BUILD)/uefi/BOOTX64.EFI
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue