boot: one UI for both firmwares, and a metal look
The BIOS loader drew its own splash and the UEFI loader drew a different
one, which is how two implementations of a single screen end up looking
nothing alike: only one of them ever got a change. stage2main.c's
fourteen drawing functions are deleted and it calls boot/common/ui.c,
which is what the UEFI loader already used. There is one splash now.
What changed in the look, in order of how much it mattered:
- No product name under the mark. The name is *in* the mark, and
setting it again underneath read as a placeholder nobody removed.
- The mark is scaled to the bar's width and sits directly above it, so
the two are one object rather than a large logo with an unrelated
line beneath. Box-filtered down from the source mask, never up:
point-sampling a coverage mask drops half the edge pixels and puts
holes in the thin strokes.
- Metal rather than flat grey. A vertical gradient with a knee near the
top where a highlight falls, applied to the mark, the bar fill and
panel headings. A single colour on a dark ground looks printed; the
knee is what makes it look lit. No texture -- at this size noise
reads as dirt.
- The boot manager is a panel with a lit selected row, replacing a
screen laid out in literals with a magic y of 340 that only ever
looked right at 800x600.
Three defects found by reading pixels rather than code:
- the UEFI loader kept calling print() after the splash, and ConOut on
a graphical firmware renders into the same framebuffer -- a
screenshot showed firmware text across our mark from the left edge.
Diagnostics go to COM1 directly now, which is where they were being
read from anyway, and the console is cleared before drawing so the
firmware has nothing to put back.
- SPLASH_UP was declared and read but never assigned, so that redirect
was dead code and the "serial works" reading was OVMF's own console.
- stage2 overflowed its allocation -- 25440 bytes against 24576 -- and
the build did not stop. The kernel is written at sector
1 + STAGE2_SECTORS, so a stage2 past its allocation is overwritten by
the kernel it is loading. STAGE2_SECTORS is 64 now, and the padding
tool's check does fire; it had simply not been re-run.
Verified from the host on both: BIOS 800x600 and UEFI 1280x800 both draw
a centred group with zero stray pixels, UEFI's spanning x 576-703 which
is exactly the mark width centred. bootcheck 108 [ok], iso builds.
Still text-mode: the resolution menu. On BIOS it necessarily is -- it
runs in real mode before any framebuffer exists, which is the whole
reason it can set one. On UEFI it could be graphical and is not yet.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
64e4835524
commit
799abbc19a
5 changed files with 375 additions and 298 deletions
14
Makefile
14
Makefile
|
|
@ -542,7 +542,13 @@ qemu-iso: schos.iso
|
|||
# binary overflows the budget, rather than truncating it -- a short stage2 would
|
||||
# shift the kernel's start sector and fail in a way that looks nothing like its
|
||||
# cause.
|
||||
STAGE2_SECTORS = 48
|
||||
# 64, not 48. stage2 carries the shared UI now -- which means the 8x16 font and
|
||||
# the logo mask -- and it is 64-bit code since the long-mode climb moved here.
|
||||
# At 48 it came to 25440 bytes against a 24576 limit and the build did not stop,
|
||||
# which is worse than the overflow: the kernel is written at sector
|
||||
# 1 + STAGE2_SECTORS, so a stage2 that runs past its allocation is overwritten
|
||||
# by the very kernel it is loading.
|
||||
STAGE2_SECTORS = 64
|
||||
STAGE2_DEF = -DSTAGE2_SECTORS=$(STAGE2_SECTORS)
|
||||
# Byte budget is computed in the recipe with shell arithmetic, not $(shell expr
|
||||
# ... \* 512): make hands the backslash through untouched, sh then treats the
|
||||
|
|
@ -569,12 +575,14 @@ $(BUILD)/boot/cdboot: boot/bios/cdboot.S
|
|||
$(OBJCOPY) -S -O binary -j .text $(BUILD)/boot/cdboottmp.o $@
|
||||
./tools/sign.pl $@
|
||||
|
||||
$(BUILD)/boot/stage2: boot/bios/stage2.S boot/bios/stage2main.c include/logo.h
|
||||
$(BUILD)/boot/stage2: boot/bios/stage2.S boot/bios/stage2main.c include/logo.h \
|
||||
boot/common/ui.c boot/common/ui.h
|
||||
@mkdir -p $(BUILD)/boot
|
||||
$(CC) $(STAGE2_DEF) -fno-builtin -fno-pic -nostdinc -I./include -c boot/bios/stage2.S -o $(BUILD)/boot/stage2asm.o
|
||||
$(CC) $(STAGE2_DEF) -fno-builtin -fno-pic -O -nostdinc -mno-red-zone -mno-sse -mcmodel=small -I./include -c boot/bios/stage2main.c -o $(BUILD)/boot/stage2main.o
|
||||
$(CC) -fno-builtin -fno-pic -O -nostdinc -mno-red-zone -mno-sse -mcmodel=small -I./include -c boot/common/ui.c -o $(BUILD)/boot/ui.o
|
||||
$(LD) -m elf_x86_64 -nostdlib $(LD_LOWBASE) -n -N -e stage2start -Ttext 0x7E00 \
|
||||
-o $(BUILD)/boot/stage2tmp.o $(BUILD)/boot/stage2asm.o $(BUILD)/boot/stage2main.o
|
||||
-o $(BUILD)/boot/stage2tmp.o $(BUILD)/boot/stage2asm.o $(BUILD)/boot/stage2main.o $(BUILD)/boot/ui.o
|
||||
$(OBJCOPY) -S -O binary -j .text -j .rodata -j .data $(BUILD)/boot/stage2tmp.o $(BUILD)/boot/stage2
|
||||
./tools/padstage2.pl $(BUILD)/boot/stage2 $(STAGE2_BYTES)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue