--- qemu-0.9.0/hw/pc.c.kernel-option-vga 2007-02-13 14:41:12.000000000 +0100 +++ qemu-0.9.0/hw/pc.c 2007-02-14 17:01:57.000000000 +0100 @@ -567,6 +567,7 @@ static void pc_init1(int ram_size, int v if (linux_boot) { uint8_t bootsect[512]; uint8_t old_bootsect[512]; + char *vmode; if (bs_table[0] == NULL) { fprintf(stderr, "A disk image must be given for 'hda' when booting a Linux kernel\n"); @@ -618,6 +619,25 @@ static void pc_init1(int ram_size, int v KERNEL_CMDLINE_ADDR - KERNEL_PARAMS_ADDR); /* loader type */ stw_raw(phys_ram_base + KERNEL_PARAMS_ADDR + 0x210, 0x01); + + /* handle vga= parameter */ + vmode = strstr(kernel_cmdline, "vga="); + if (vmode) { + char *space; + unsigned int video_mode; + /* skip "vga=" */ + vmode += 4; + if (!strncmp(vmode, "normal", 6)) { + video_mode = 0xffff; + } else if (!strncmp(vmode, "ext", 3)) { + video_mode = 0xfffe; + } else if (!strncmp(vmode, "ask", 3)) { + video_mode = 0xfffd; + } else { + video_mode = strtol(vmode, NULL, 0); + } + stw_raw(phys_ram_base + KERNEL_PARAMS_ADDR + 0x1fa, video_mode); + } } if (pci_enabled) {