fix: request text mode in multiboot2 header for VGA output

When using multiboot2, GRUB may set a graphical framebuffer instead
of text mode, causing VGA text writes to 0xB8000 to be invisible.

- Add MULTIBOOT_HEADER_TAG_FRAMEBUFFER to multiboot2 header requesting
  80x25 text mode (depth=0)
- Add 'set gfxpayload=text' to grub.cfg as additional safeguard

This fixes blank display when running under UTM/QEMU with certain
VGA device configurations.
This commit is contained in:
AI
2026-02-23 13:14:56 +00:00
parent c25ba1fccd
commit 000d53e2f3
2 changed files with 10 additions and 2 deletions

View File

@@ -38,7 +38,7 @@ add_custom_command(
add_custom_target(initrd DEPENDS ${INITRD_FILE})
# Create grub.cfg for ISO - includes module2 for the initrd
file(WRITE ${CMAKE_BINARY_DIR}/isodir/boot/grub/grub.cfg "set timeout=0\nset default=0\nsearch --set=root --file /boot/kernel.bin\nmenuentry \"ClaudeOS\" { multiboot2 /boot/kernel.bin\n module2 /boot/initrd.cpio }")
file(WRITE ${CMAKE_BINARY_DIR}/isodir/boot/grub/grub.cfg "set timeout=0\nset default=0\nsearch --set=root --file /boot/kernel.bin\nmenuentry \"ClaudeOS\" {\n set gfxpayload=text\n multiboot2 /boot/kernel.bin\n module2 /boot/initrd.cpio\n}")
# ISO Generation

View File

@@ -26,9 +26,17 @@ multiboot_header:
/* checksum */
.long -(MULTIBOOT2_HEADER_MAGIC + MULTIBOOT_ARCHITECTURE_I386 + (multiboot_header_end - multiboot_header))
/* Tags here */
/* Framebuffer tag: request 80x25 EGA text mode */
.align 8
.short MULTIBOOT_HEADER_TAG_FRAMEBUFFER
.short 0 /* flags: required (not optional) */
.long 20 /* size of this tag */
.long 80 /* width */
.long 25 /* height */
.long 0 /* depth: 0 = text mode */
/* End tag */
.align 8
.short MULTIBOOT_HEADER_TAG_END
.short 0
.long 8