1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 # T2 SDE: package/.../grub/grub-0.95-graphics.patch
5 # Copyright (C) 2004 - 2008 The T2 SDE Project
7 # More information can be found in the files COPYING and README.
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
15 # --- T2-COPYRIGHT-NOTE-END ---
16 --- grub-0.95/stage2/asm.S.graphics 2004-06-18 17:35:51.932054040 -0400
17 +++ grub-0.95/stage2/asm.S 2004-06-18 17:35:52.473971656 -0400
18 @@ -2215,6 +2215,156 @@
23 +/* graphics mode functions */
24 +#ifdef SUPPORT_GRAPHICS
29 +VARIABLE(cursorCount)
32 +.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
36 + * int set_videomode(mode)
37 + * BIOS call "INT 10H Function 0h" to set video mode
38 + * Call with %ah = 0x0
40 + * Returns old videomode.
47 + movb 0x10(%esp), %cl
49 + call EXT_C(prot_to_real)
54 + int $0x10 /* Get Current Video mode */
58 + int $0x10 /* Set Video mode */
60 + DATA32 call EXT_C(real_to_prot)
73 + * unsigned char * graphics_get_font()
74 + * BIOS call "INT 10H Function 11h" to set font
75 + * Call with %ah = 0x11
77 +ENTRY(graphics_get_font)
83 + call EXT_C(prot_to_real)
87 + movb $6, %bh /* font 8x16 */
92 + DATA32 call EXT_C(real_to_prot)
109 + * graphics_set_palette(index, red, green, blue)
110 + * BIOS call "INT 10H Function 10h" to set individual dac register
111 + * Call with %ah = 0x10
112 + * %bx = register number
113 + * %ch = new value for green (0-63)
114 + * %cl = new value for blue (0-63)
115 + * %dh = new value for red (0-63)
118 +ENTRY(graphics_set_palette)
125 + movw $0x3c8, %bx /* address write mode register */
127 + /* wait vertical retrace */
130 +l1b: inb %dx, %al /* wait vertical active display */
134 +l2b: inb %dx, %al /* wait vertical retrace */
139 + movb 0x18(%esp), %al /* index */
143 + movb 0x1c(%esp), %al /* red */
146 + movb 0x20(%esp), %al /* green */
149 + movb 0x24(%esp), %al /* blue */
152 + movw 0x18(%esp), %bx
154 + call EXT_C(prot_to_real)
161 + DATA32 call EXT_C(real_to_prot)
171 +#endif /* SUPPORT_GRAPHICS */
175 --- grub-0.97/stage2/stage2.c.vanilla 2008-08-19 22:52:18.000000000 +0000
176 +++ grub-0.97/stage2/stage2.c 2008-08-19 22:52:52.000000000 +0000
178 run_menu (char *menu_entries, char *config_entries, int num_entries,
179 char *heap, int entryno)
181 + struct term_entry *prev_term = NULL;
182 int c, time1, time2 = -1, first_entry = 0;
184 char shortcut_buf[5];
189 + /* if our terminal needed initialization, we should shut it down
190 + * before booting the kernel, but we want to save what it was so
191 + * we can come back if needed */
192 + prev_term = current_term;
193 + if (current_term->shutdown)
195 + (*current_term->shutdown)();
196 + current_term = term_table; /* assumption: console is first */
205 + /* if we get back here, we should go back to what our term was before */
206 + current_term = prev_term;
207 + if (current_term->startup)
208 + /* if our terminal fails to initialize, fall back to console since
209 + * it should always work */
210 + if ((*current_term->startup)() == 0)
211 + current_term = term_table; /* we know that console is first */
215 @@ -1082,6 +1099,10 @@
219 + /* go ahead and make sure the terminal is setup */
220 + if (current_term->startup)
221 + (*current_term->startup)();
225 /* If no acceptable config file, goto command-line, starting
226 --- grub-0.95/stage2/builtins.c.graphics 2004-06-18 17:35:52.370987312 -0400
227 +++ grub-0.95/stage2/builtins.c 2004-06-18 17:35:52.482970288 -0400
228 @@ -858,6 +858,138 @@
230 #endif /* SUPPORT_NETBOOT */
232 +static int terminal_func (char *arg, int flags);
234 +#ifdef SUPPORT_GRAPHICS
236 +static int splashimage_func(char *arg, int flags) {
237 + char splashimage[64];
240 + /* filename can only be 64 characters due to our buffer size */
241 + if (strlen(arg) > 63)
243 + if (flags == BUILTIN_CMDLINE) {
244 + if (!grub_open(arg))
249 + strcpy(splashimage, arg);
251 + /* get rid of TERM_NEED_INIT from the graphics terminal. */
252 + for (i = 0; term_table[i].name; i++) {
253 + if (grub_strcmp (term_table[i].name, "graphics") == 0) {
254 + term_table[i].flags &= ~TERM_NEED_INIT;
259 + graphics_set_splash(splashimage);
261 + if (flags == BUILTIN_CMDLINE && graphics_inited) {
267 + /* FIXME: should we be explicitly switching the terminal as a
268 + * side effect here? */
269 + terminal_func("graphics", flags);
274 +static struct builtin builtin_splashimage =
278 + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
279 + "splashimage FILE",
280 + "Load FILE as the background image when in graphics mode."
286 +foreground_func(char *arg, int flags)
288 + if (grub_strlen(arg) == 6) {
289 + int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2;
290 + int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2;
291 + int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2;
293 + foreground = (r << 16) | (g << 8) | b;
294 + if (graphics_inited)
295 + graphics_set_palette(15, r, g, b);
303 +static struct builtin builtin_foreground =
307 + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
308 + "foreground RRGGBB",
309 + "Sets the foreground color when in graphics mode."
310 + "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
316 +background_func(char *arg, int flags)
318 + if (grub_strlen(arg) == 6) {
319 + int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2;
320 + int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2;
321 + int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2;
323 + background = (r << 16) | (g << 8) | b;
324 + if (graphics_inited)
325 + graphics_set_palette(0, r, g, b);
332 +static struct builtin builtin_background =
336 + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
337 + "background RRGGBB",
338 + "Sets the background color when in graphics mode."
339 + "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
342 +#endif /* SUPPORT_GRAPHICS */
349 + if (current_term->cls)
350 + current_term->cls();
355 +static struct builtin builtin_clear =
359 + BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
367 @@ -4090,7 +4222,7 @@
371 -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES)
372 +#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS)
375 terminal_func (char *arg, int flags)
376 @@ -4249,17 +4381,21 @@
378 current_term = term_table + default_term;
379 current_term->flags = term_flags;
385 - /* 24 would be a good default value. */
388 + max_lines = current_term->max_lines;
390 /* If the interface is currently the command-line,
391 restart it to repaint the screen. */
392 - if (current_term != prev_term && (flags & BUILTIN_CMDLINE))
393 + if ((current_term != prev_term) && (flags & BUILTIN_CMDLINE)){
394 + if (prev_term->shutdown)
395 + prev_term->shutdown();
396 + if (current_term->startup)
397 + current_term->startup();
398 grub_longjmp (restart_cmdline_env, 0);
403 @@ -4269,7 +4405,7 @@
406 BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
407 - "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules]",
408 + "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules] [graphics]",
409 "Select a terminal. When multiple terminals are specified, wait until"
410 " you push any key to continue. If both console and serial are specified,"
411 " the terminal to which you input a key first will be selected. If no"
412 @@ -4281,7 +4417,7 @@
413 " seconds. The option --lines specifies the maximum number of lines."
414 " The option --silent is used to suppress messages."
416 -#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */
417 +#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */
420 #ifdef SUPPORT_SERIAL
421 @@ -4809,6 +4945,9 @@
422 /* The table of builtin commands. Sorted in dictionary order. */
423 struct builtin *builtin_table[] =
425 +#ifdef SUPPORT_GRAPHICS
426 + &builtin_background,
430 #ifdef SUPPORT_NETBOOT
431 @@ -4816,6 +4955,7 @@
432 #endif /* SUPPORT_NETBOOT */
434 &builtin_chainloader,
439 @@ -4835,6 +4975,9 @@
443 +#ifdef SUPPORT_GRAPHICS
444 + &builtin_foreground,
449 @@ -4878,9 +5021,12 @@
450 #endif /* SUPPORT_SERIAL */
453 -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES)
454 +#ifdef SUPPORT_GRAPHICS
455 + &builtin_splashimage,
456 +#endif /* SUPPORT_GRAPHICS */
457 +#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS)
459 -#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */
460 +#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */
461 #ifdef SUPPORT_SERIAL
463 #endif /* SUPPORT_SERIAL */
464 --- /dev/null 2004-02-23 16:02:56.000000000 -0500
465 +++ grub-0.95/stage2/graphics.c 2004-06-18 17:35:52.488969376 -0400
467 +/* graphics.c - graphics mode support for GRUB */
468 +/* Implemented as a terminal type by Jeremy Katz <katzj@redhat.com> based
469 + * on a patch by Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
472 + * GRUB -- GRand Unified Bootloader
473 + * Copyright (C) 2001,2002 Red Hat, Inc.
474 + * Portions copyright (C) 2000 Conectiva, Inc.
476 + * This program is free software; you can redistribute it and/or modify
477 + * it under the terms of the GNU General Public License as published by
478 + * the Free Software Foundation; either version 2 of the License, or
479 + * (at your option) any later version.
481 + * This program is distributed in the hope that it will be useful,
482 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
483 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
484 + * GNU General Public License for more details.
486 + * You should have received a copy of the GNU General Public License
487 + * along with this program; if not, write to the Free Software
488 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
493 +#ifdef SUPPORT_GRAPHICS
497 +#include <graphics.h>
499 +int saved_videomode;
500 +unsigned char *font8x16;
502 +int graphics_inited = 0;
503 +static char splashimage[64];
505 +#define VSHADOW VSHADOW1
506 +unsigned char VSHADOW1[38400];
507 +unsigned char VSHADOW2[38400];
508 +unsigned char VSHADOW4[38400];
509 +unsigned char VSHADOW8[38400];
511 +/* constants to define the viewable area */
517 +/* text buffer has to be kept around so that we can write things as we
518 + * scroll and the like */
519 +unsigned short text[80 * 30];
521 +/* why do these have to be kept here? */
522 +int foreground = (63 << 16) | (63 << 8) | (63), background = 0, border = 0;
524 +/* current position */
525 +static int fontx = 0;
526 +static int fonty = 0;
528 +/* global state so that we don't try to recursively scroll or cursor */
529 +static int no_scroll = 0;
532 +static int graphics_standard_color = A_NORMAL;
533 +static int graphics_normal_color = A_NORMAL;
534 +static int graphics_highlight_color = A_REVERSE;
535 +static int graphics_current_color = A_NORMAL;
536 +static color_state graphics_color_state = COLOR_STATE_STANDARD;
539 +/* graphics local functions */
540 +static void graphics_setxy(int col, int row);
541 +static void graphics_scroll();
543 +/* FIXME: where do these really belong? */
544 +static inline void outb(unsigned short port, unsigned char val)
546 + __asm __volatile ("outb %0,%1"::"a" (val), "d" (port));
549 +static void MapMask(int value) {
551 + outb(0x3c5, value);
554 +/* bit mask register */
555 +static void BitMask(int value) {
557 + outb(0x3cf, value);
562 +/* Set the splash image */
563 +void graphics_set_splash(char *splashfile) {
564 + grub_strcpy(splashimage, splashfile);
567 +/* Get the current splash image */
568 +char *graphics_get_splash(void) {
569 + return splashimage;
572 +/* Initialize a vga16 graphics display with the palette based off of
573 + * the image in splashimage. If the image doesn't exist, leave graphics
577 + if (!graphics_inited) {
578 + saved_videomode = set_videomode(0x12);
581 + if (!read_image(splashimage)) {
582 + set_videomode(saved_videomode);
583 + grub_printf("failed to read image\n");
587 + font8x16 = (unsigned char*)graphics_get_font();
589 + graphics_inited = 1;
591 + /* make sure that the highlight color is set correctly */
592 + graphics_highlight_color = ((graphics_normal_color >> 4) |
593 + ((graphics_normal_color & 0xf) << 4));
598 +/* Leave graphics mode */
599 +void graphics_end(void)
601 + if (graphics_inited) {
602 + set_videomode(saved_videomode);
603 + graphics_inited = 0;
607 +/* Print ch on the screen. Handle any needed scrolling or the like */
608 +void graphics_putchar(int ch) {
611 + graphics_cursor(0);
614 + if (fonty + 1 < y1)
615 + graphics_setxy(fontx, fonty + 1);
618 + graphics_cursor(1);
620 + } else if (ch == '\r') {
621 + graphics_setxy(x0, fonty);
622 + graphics_cursor(1);
626 + graphics_cursor(0);
628 + text[fonty * 80 + fontx] = ch;
629 + text[fonty * 80 + fontx] &= 0x00ff;
630 + if (graphics_current_color & 0xf0)
631 + text[fonty * 80 + fontx] |= 0x100;
633 + graphics_cursor(0);
635 + if ((fontx + 1) >= x1) {
636 + graphics_setxy(x0, fonty);
637 + if (fonty + 1 < y1)
638 + graphics_setxy(x0, fonty + 1);
642 + graphics_setxy(fontx + 1, fonty);
645 + graphics_cursor(1);
648 +/* get the current location of the cursor */
649 +int graphics_getxy(void) {
650 + return (fontx << 8) | fonty;
653 +void graphics_gotoxy(int x, int y) {
654 + graphics_cursor(0);
656 + graphics_setxy(x, y);
658 + graphics_cursor(1);
661 +void graphics_cls(void) {
663 + unsigned char *mem, *s1, *s2, *s4, *s8;
665 + graphics_cursor(0);
666 + graphics_gotoxy(x0, y0);
668 + mem = (unsigned char*)VIDEOMEM;
669 + s1 = (unsigned char*)VSHADOW1;
670 + s2 = (unsigned char*)VSHADOW2;
671 + s4 = (unsigned char*)VSHADOW4;
672 + s8 = (unsigned char*)VSHADOW8;
674 + for (i = 0; i < 80 * 30; i++)
676 + graphics_cursor(1);
682 + grub_memcpy(mem, s1, 38400);
686 + grub_memcpy(mem, s2, 38400);
690 + grub_memcpy(mem, s4, 38400);
694 + grub_memcpy(mem, s8, 38400);
700 +void graphics_setcolorstate (color_state state) {
702 + case COLOR_STATE_STANDARD:
703 + graphics_current_color = graphics_standard_color;
705 + case COLOR_STATE_NORMAL:
706 + graphics_current_color = graphics_normal_color;
708 + case COLOR_STATE_HIGHLIGHT:
709 + graphics_current_color = graphics_highlight_color;
712 + graphics_current_color = graphics_standard_color;
716 + graphics_color_state = state;
719 +void graphics_setcolor (int normal_color, int highlight_color) {
720 + graphics_normal_color = normal_color;
721 + graphics_highlight_color = highlight_color;
723 + graphics_setcolorstate (graphics_color_state);
726 +void graphics_setcursor (int on) {
727 + /* FIXME: we don't have a cursor in graphics */
731 +/* Read in the splashscreen image and set the palette up appropriately.
732 + * Format of splashscreen is an xpm (can be gzipped) with 16 colors and
734 +int read_image(char *s)
736 + char buf[32], pal[16];
737 + unsigned char c, base, mask, *s1, *s2, *s4, *s8;
738 + unsigned i, len, idx, colors, x, y, width, height;
744 + if (!grub_read((char*)&buf, 10) || grub_memcmp(buf, "/* XPM */\n", 10)) {
750 + while (grub_read(&c, 1)) {
755 + while (grub_read(&c, 1) && (c == ' ' || c == '\t'))
760 + while (grub_read(&c, 1)) {
761 + if (c >= '0' && c <= '9')
762 + width = width * 10 + c - '0';
766 + while (grub_read(&c, 1) && (c == ' ' || c == '\t'))
770 + while (grub_read(&c, 1)) {
771 + if (c >= '0' && c <= '9')
772 + height = height * 10 + c - '0';
776 + while (grub_read(&c, 1) && (c == ' ' || c == '\t'))
780 + while (grub_read(&c, 1)) {
781 + if (c >= '0' && c <= '9')
782 + colors = colors * 10 + c - '0';
788 + while (grub_read(&c, 1) && c != '"')
792 + for (i = 0, idx = 1; i < colors; i++) {
795 + while (grub_read(&c, 1) && c != '"')
797 + grub_read(&c, 1); /* char */
799 + grub_read(buf, 4); /* \t c # */
801 + while (grub_read(&c, 1) && c != '"') {
802 + if (len < sizeof(buf))
806 + if (len == 6 && idx < 15) {
807 + int r = ((hex(buf[0]) << 4) | hex(buf[1])) >> 2;
808 + int g = ((hex(buf[2]) << 4) | hex(buf[3])) >> 2;
809 + int b = ((hex(buf[4]) << 4) | hex(buf[5])) >> 2;
812 + graphics_set_palette(idx, r, g, b);
819 + s1 = (unsigned char*)VSHADOW1;
820 + s2 = (unsigned char*)VSHADOW2;
821 + s4 = (unsigned char*)VSHADOW4;
822 + s8 = (unsigned char*)VSHADOW8;
824 + for (i = 0; i < 38400; i++)
825 + s1[i] = s2[i] = s4[i] = s8[i] = 0;
827 + /* parse xpm data */
828 + while (y < height) {
830 + if (!grub_read(&c, 1)) {
838 + while (grub_read(&c, 1) && c != '"') {
839 + for (i = 1; i < 15; i++)
845 + mask = 0x80 >> (x & 7);
847 + s1[len + (x >> 3)] |= mask;
849 + s2[len + (x >> 3)] |= mask;
851 + s4[len + (x >> 3)] |= mask;
853 + s8[len + (x >> 3)] |= mask;
867 + graphics_set_palette(0, (background >> 16), (background >> 8) & 63,
869 + graphics_set_palette(15, (foreground >> 16), (foreground >> 8) & 63,
871 + graphics_set_palette(0x11, (border >> 16), (border >> 8) & 63,
878 +/* Convert a character which is a hex digit to the appropriate integer */
881 + if (v >= 'A' && v <= 'F')
882 + return (v - 'A' + 10);
883 + if (v >= 'a' && v <= 'f')
884 + return (v - 'a' + 10);
889 +/* move the graphics cursor location to col, row */
890 +static void graphics_setxy(int col, int row) {
891 + if (col >= x0 && col < x1) {
893 + cursorX = col << 3;
895 + if (row >= y0 && row < y1) {
897 + cursorY = row << 4;
901 +/* scroll the screen */
902 +static void graphics_scroll() {
905 + /* we don't want to scroll recursively... that would be bad */
910 + /* move everything up a line */
911 + for (j = y0 + 1; j < y1; j++) {
912 + graphics_gotoxy(x0, j - 1);
913 + for (i = x0; i < x1; i++) {
914 + graphics_putchar(text[j * 80 + i]);
918 + /* last line should be blank */
919 + graphics_gotoxy(x0, y1 - 1);
920 + for (i = x0; i < x1; i++)
921 + graphics_putchar(' ');
922 + graphics_setxy(x0, y1 - 1);
928 +void graphics_cursor(int set) {
929 + unsigned char *pat, *mem, *ptr, chr[16 << 2];
930 + int i, ch, invert, offset;
932 + if (set && no_scroll)
935 + offset = cursorY * 80 + fontx;
936 + ch = text[fonty * 80 + fontx] & 0xff;
937 + invert = (text[fonty * 80 + fontx] & 0xff00) != 0;
938 + pat = font8x16 + (ch << 4);
940 + mem = (unsigned char*)VIDEOMEM + offset;
943 + for (i = 0; i < 16; i++) {
944 + unsigned char mask = pat[i];
947 + chr[i ] = ((unsigned char*)VSHADOW1)[offset];
948 + chr[16 + i] = ((unsigned char*)VSHADOW2)[offset];
949 + chr[32 + i] = ((unsigned char*)VSHADOW4)[offset];
950 + chr[48 + i] = ((unsigned char*)VSHADOW8)[offset];
952 + /* FIXME: if (shade) */
954 + if (ch == DISP_VERT || ch == DISP_LL ||
955 + ch == DISP_UR || ch == DISP_LR) {
956 + unsigned char pmask = ~(pat[i] >> 1);
959 + chr[16 + i] &= pmask;
960 + chr[32 + i] &= pmask;
961 + chr[48 + i] &= pmask;
963 + if (i > 0 && ch != DISP_VERT) {
964 + unsigned char pmask = ~(pat[i - 1] >> 1);
967 + chr[16 + i] &= pmask;
968 + chr[32 + i] &= pmask;
969 + chr[48 + i] &= pmask;
970 + if (ch == DISP_HORIZ || ch == DISP_UR || ch == DISP_LR) {
971 + pmask = ~pat[i - 1];
974 + chr[16 + i] &= pmask;
975 + chr[32 + i] &= pmask;
976 + chr[48 + i] &= pmask;
981 + chr[16 + i] |= mask;
982 + chr[32 + i] |= mask;
983 + chr[48 + i] |= mask;
989 + chr[16 + i] = mask;
990 + chr[32 + i] = mask;
991 + chr[48 + i] = mask;
998 + for (i = 0; i < 16; i++, ptr += 80) {
999 + cursorBuf[i] = pat[i];
1006 + for (i = 1; i < 16; i <<= 1, offset += 16) {
1011 + for (j = 0; j < 16; j++, ptr += 80)
1012 + *ptr = chr[j + offset];
1018 +#endif /* SUPPORT_GRAPHICS */
1019 --- grub-0.95/stage2/Makefile.am.graphics 2004-06-13 13:57:27.000000000 -0400
1020 +++ grub-0.95/stage2/Makefile.am 2004-06-18 17:36:58.289966104 -0400
1022 fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \
1023 imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \
1024 nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \
1025 - terminfo.h tparm.h nbi.h ufs2.h vstafs.h xfs.h
1026 + terminfo.h tparm.h nbi.h ufs2.h vstafs.h xfs.h graphics.h
1027 EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS)
1031 disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \
1032 fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs2.c \
1033 fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \
1034 - terminfo.c tparm.c
1035 + terminfo.c tparm.c graphics.c
1036 libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
1037 -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
1038 -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
1043 +if GRAPHICS_SUPPORT
1044 +GRAPHICS_FLAGS = -DSUPPORT_GRAPHICS=1
1049 STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
1050 - $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS)
1051 + $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) $(GRAPHICS_FLAGS)
1053 STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
1054 STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1
1056 cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \
1057 fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
1058 fsys_reiserfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c gunzip.c \
1059 - hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c
1060 + hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c \
1062 pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
1063 pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
1064 pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
1065 --- grub-0.95/stage2/term.h.graphics 2003-07-09 07:45:53.000000000 -0400
1066 +++ grub-0.95/stage2/term.h 2004-06-18 17:35:52.496968160 -0400
1069 /* The feature flags defined above. */
1070 unsigned long flags;
1071 + /* Default for maximum number of lines if not specified */
1072 + unsigned short max_lines;
1073 /* Put a character. */
1074 void (*putchar) (int c);
1075 /* Check if any input character is available. */
1077 void (*setcolor) (int normal_color, int highlight_color);
1078 /* Turn on/off the cursor. */
1079 int (*setcursor) (int on);
1081 + /* function to start a terminal */
1082 + int (*startup) (void);
1083 + /* function to use to shutdown a terminal */
1084 + void (*shutdown) (void);
1087 /* This lists up available terminals. */
1088 @@ -124,4 +131,23 @@
1089 int hercules_setcursor (int on);
1092 +#ifdef SUPPORT_GRAPHICS
1093 +extern int foreground, background, border, graphics_inited;
1095 +void graphics_set_splash(char *splashfile);
1096 +int set_videomode (int mode);
1097 +void graphics_putchar (int c);
1098 +int graphics_getxy(void);
1099 +void graphics_gotoxy(int x, int y);
1100 +void graphics_cls(void);
1101 +void graphics_setcolorstate (color_state state);
1102 +void graphics_setcolor (int normal_color, int highlight_color);
1103 +void graphics_setcursor (int on);
1104 +int graphics_init(void);
1105 +void graphics_end(void);
1108 +void graphics_set_palette(int idx, int red, int green, int blue);
1109 +#endif /* SUPPORT_GRAPHICS */
1111 #endif /* ! GRUB_TERM_HEADER */
1112 --- /dev/null 2004-02-23 16:02:56.000000000 -0500
1113 +++ grub-0.95/stage2/graphics.h 2004-06-18 17:35:52.490969072 -0400
1115 +/* graphics.h - graphics console interface */
1117 + * GRUB -- GRand Unified Bootloader
1118 + * Copyright (C) 2002 Free Software Foundation, Inc.
1120 + * This program is free software; you can redistribute it and/or modify
1121 + * it under the terms of the GNU General Public License as published by
1122 + * the Free Software Foundation; either version 2 of the License, or
1123 + * (at your option) any later version.
1125 + * This program is distributed in the hope that it will be useful,
1126 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1127 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1128 + * GNU General Public License for more details.
1130 + * You should have received a copy of the GNU General Public License
1131 + * along with this program; if not, write to the Free Software
1132 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1138 +/* magic constant */
1139 +#define VIDEOMEM 0xA0000
1141 +/* function prototypes */
1142 +char *graphics_get_splash(void);
1144 +int read_image(char *s);
1145 +void graphics_cursor(int set);
1147 +/* function prototypes for asm functions */
1148 +void * graphics_get_font();
1149 +void graphics_set_palette(int idx, int red, int green, int blue);
1150 +void set_int1c_handler();
1151 +void unset_int1c_handler();
1153 +extern short cursorX, cursorY;
1154 +extern char cursorBuf[16];
1156 +#endif /* GRAPHICS_H */
1157 --- grub-0.95/stage2/shared.h.graphics 2004-06-18 17:35:52.372987008 -0400
1158 +++ grub-0.95/stage2/shared.h 2004-06-18 17:35:52.492968768 -0400
1160 int grub_tolower (int c);
1161 int grub_isspace (int c);
1162 int grub_strncat (char *s1, const char *s2, int n);
1163 +void grub_memcpy(void *dest, const void *src, int len);
1164 void *grub_memmove (void *to, const void *from, int len);
1165 void *grub_memset (void *start, int c, int len);
1166 int grub_strncat (char *s1, const char *s2, int n);
1167 --- grub-0.95/stage2/char_io.c.graphics 2004-05-23 12:45:43.000000000 -0400
1168 +++ grub-0.95/stage2/char_io.c 2004-06-18 17:35:52.485969832 -0400
1179 console_setcolorstate,
1182 + console_setcursor,
1186 #ifdef SUPPORT_SERIAL
1189 /* A serial device must be initialized. */
1197 serial_setcolorstate,
1203 #endif /* SUPPORT_SERIAL */
1214 hercules_setcolorstate,
1216 - hercules_setcursor
1217 + hercules_setcursor,
1221 #endif /* SUPPORT_HERCULES */
1222 +#ifdef SUPPORT_GRAPHICS
1224 + TERM_NEED_INIT, /* flags */
1225 + 30, /* number of lines */
1226 + graphics_putchar, /* putchar */
1227 + console_checkkey, /* checkkey */
1228 + console_getkey, /* getkey */
1229 + graphics_getxy, /* getxy */
1230 + graphics_gotoxy, /* gotoxy */
1231 + graphics_cls, /* cls */
1232 + graphics_setcolorstate, /* setcolorstate */
1233 + graphics_setcolor, /* setcolor */
1234 + graphics_setcursor, /* nocursor */
1235 + graphics_init, /* initialize */
1236 + graphics_end /* shutdown */
1238 +#endif /* SUPPORT_GRAPHICS */
1239 /* This must be the last entry. */
1240 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
1242 @@ -1046,13 +1072,15 @@
1243 the following grub_printf call will print newlines. */
1246 + grub_printf("\n");
1247 if (current_term->setcolorstate)
1248 current_term->setcolorstate (COLOR_STATE_HIGHLIGHT);
1250 - grub_printf ("\n[Hit return to continue]");
1251 + grub_printf ("[Hit return to continue]");
1253 if (current_term->setcolorstate)
1254 current_term->setcolorstate (COLOR_STATE_NORMAL);
1259 @@ -1090,7 +1118,7 @@
1262 /* If the terminal is dumb, there is no way to clean the terminal. */
1263 - if (current_term->flags & TERM_DUMB)
1264 + if (current_term->flags & TERM_DUMB)
1265 grub_putchar ('\n');
1267 current_term->cls ();
1268 @@ -1214,6 +1242,16 @@
1273 +grub_memcpy(void *dest, const void *src, int len)
1276 + register char *d = (char*)dest, *s = (char*)src;
1278 + for (i = 0; i < len; i++)
1283 grub_memmove (void *to, const void *from, int len)
1285 --- grub-0.95/configure.ac.graphics 2004-06-18 17:35:52.211011632 -0400
1286 +++ grub-0.95/configure.ac 2004-06-18 17:35:52.498967856 -0400
1287 @@ -595,6 +595,11 @@
1288 [ --enable-diskless enable diskless support])
1289 AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes)
1291 +dnl Graphical splashscreen support
1292 +AC_ARG_ENABLE(graphics,
1293 + [ --disable-graphics disable graphics terminal support])
1294 +AM_CONDITIONAL(GRAPHICS_SUPPORT, test "x$enable_graphics" != xno)
1296 dnl Hercules terminal
1297 AC_ARG_ENABLE(hercules,
1298 [ --disable-hercules disable hercules terminal support])