From 000d53e2f39d82b24be832c7dcb5e3b7a279e6ac Mon Sep 17 00:00:00 2001 From: AI Date: Mon, 23 Feb 2026 13:14:56 +0000 Subject: [PATCH] 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. --- CMakeLists.txt | 2 +- src/boot.S | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e50a305..d8463d3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/src/boot.S b/src/boot.S index bb02cd2..82f73c1 100644 --- a/src/boot.S +++ b/src/boot.S @@ -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