Commit bf4e5d92979c5f7b0b5e5d0a261954aa87f02ac1
Committed by
Anthony Liguori
1 parent
07323531
Handle vga= in -append
Here is a patch I had sent twice to the list 2 years ago. Hopefuly this time someone will be interested It adds support for passing vga mode to linux kernel through vga= option in -append Signed-off-by: Pascal Terjan <pterjan@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
1 changed file
with
19 additions
and
0 deletions
hw/pc.c
| @@ -825,6 +825,7 @@ static void load_linux(void *fw_cfg, | @@ -825,6 +825,7 @@ static void load_linux(void *fw_cfg, | ||
| 825 | uint8_t header[8192]; | 825 | uint8_t header[8192]; |
| 826 | target_phys_addr_t real_addr, prot_addr, cmdline_addr, initrd_addr = 0; | 826 | target_phys_addr_t real_addr, prot_addr, cmdline_addr, initrd_addr = 0; |
| 827 | FILE *f, *fi; | 827 | FILE *f, *fi; |
| 828 | + char *vmode; | ||
| 828 | 829 | ||
| 829 | /* Align to 16 bytes as a paranoia measure */ | 830 | /* Align to 16 bytes as a paranoia measure */ |
| 830 | cmdline_size = (strlen(kernel_cmdline)+16) & ~15; | 831 | cmdline_size = (strlen(kernel_cmdline)+16) & ~15; |
| @@ -900,6 +901,24 @@ static void load_linux(void *fw_cfg, | @@ -900,6 +901,24 @@ static void load_linux(void *fw_cfg, | ||
| 900 | stw_p(header+0x22, cmdline_addr-real_addr); | 901 | stw_p(header+0x22, cmdline_addr-real_addr); |
| 901 | } | 902 | } |
| 902 | 903 | ||
| 904 | + /* handle vga= parameter */ | ||
| 905 | + vmode = strstr(kernel_cmdline, "vga="); | ||
| 906 | + if (vmode) { | ||
| 907 | + unsigned int video_mode; | ||
| 908 | + /* skip "vga=" */ | ||
| 909 | + vmode += 4; | ||
| 910 | + if (!strncmp(vmode, "normal", 6)) { | ||
| 911 | + video_mode = 0xffff; | ||
| 912 | + } else if (!strncmp(vmode, "ext", 3)) { | ||
| 913 | + video_mode = 0xfffe; | ||
| 914 | + } else if (!strncmp(vmode, "ask", 3)) { | ||
| 915 | + video_mode = 0xfffd; | ||
| 916 | + } else { | ||
| 917 | + video_mode = strtol(vmode, NULL, 0); | ||
| 918 | + } | ||
| 919 | + stw_p(header+0x1fa, video_mode); | ||
| 920 | + } | ||
| 921 | + | ||
| 903 | /* loader type */ | 922 | /* loader type */ |
| 904 | /* High nybble = B reserved for Qemu; low nybble is revision number. | 923 | /* High nybble = B reserved for Qemu; low nybble is revision number. |
| 905 | If this code is substantially changed, you may want to consider | 924 | If this code is substantially changed, you may want to consider |