OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1298 lines
34 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../grub/grub-0.95-graphics.patch
  5. # Copyright (C) 2004 - 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  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
  14. # version.
  15. # --- SDE-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 @@
  19. pop %ebx
  20. pop %ebp
  21. ret
  22. +
  23. +/* graphics mode functions */
  24. +#ifdef SUPPORT_GRAPHICS
  25. +VARIABLE(cursorX)
  26. +.word 0
  27. +VARIABLE(cursorY)
  28. +.word 0
  29. +VARIABLE(cursorCount)
  30. +.word 0
  31. +VARIABLE(cursorBuf)
  32. +.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
  33. +
  34. +
  35. +/*
  36. + * int set_videomode(mode)
  37. + * BIOS call "INT 10H Function 0h" to set video mode
  38. + * Call with %ah = 0x0
  39. + * %al = video mode
  40. + * Returns old videomode.
  41. + */
  42. +ENTRY(set_videomode)
  43. + push %ebp
  44. + push %ebx
  45. + push %ecx
  46. +
  47. + movb 0x10(%esp), %cl
  48. +
  49. + call EXT_C(prot_to_real)
  50. + .code16
  51. +
  52. + xorw %bx, %bx
  53. + movb $0xf, %ah
  54. + int $0x10 /* Get Current Video mode */
  55. + movb %al, %ch
  56. + xorb %ah, %ah
  57. + movb %cl, %al
  58. + int $0x10 /* Set Video mode */
  59. +
  60. + DATA32 call EXT_C(real_to_prot)
  61. + .code32
  62. +
  63. + xorb %ah, %ah
  64. + movb %ch, %al
  65. +
  66. + pop %ecx
  67. + pop %ebx
  68. + pop %ebp
  69. + ret
  70. +
  71. +
  72. +/*
  73. + * unsigned char * graphics_get_font()
  74. + * BIOS call "INT 10H Function 11h" to set font
  75. + * Call with %ah = 0x11
  76. + */
  77. +ENTRY(graphics_get_font)
  78. + push %ebp
  79. + push %ebx
  80. + push %ecx
  81. + push %edx
  82. +
  83. + call EXT_C(prot_to_real)
  84. + .code16
  85. +
  86. + movw $0x1130, %ax
  87. + movb $6, %bh /* font 8x16 */
  88. + int $0x10
  89. + movw %bp, %dx
  90. + movw %es, %cx
  91. +
  92. + DATA32 call EXT_C(real_to_prot)
  93. + .code32
  94. +
  95. + xorl %eax, %eax
  96. + movw %cx, %ax
  97. + shll $4, %eax
  98. + movw %dx, %ax
  99. +
  100. + pop %edx
  101. + pop %ecx
  102. + pop %ebx
  103. + pop %ebp
  104. + ret
  105. +
  106. +
  107. +
  108. +/*
  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)
  116. + */
  117. +
  118. +ENTRY(graphics_set_palette)
  119. + push %ebp
  120. + push %eax
  121. + push %ebx
  122. + push %ecx
  123. + push %edx
  124. +
  125. + movw $0x3c8, %bx /* address write mode register */
  126. +
  127. + /* wait vertical retrace */
  128. +
  129. + movw $0x3da, %dx
  130. +l1b: inb %dx, %al /* wait vertical active display */
  131. + test $8, %al
  132. + jnz l1b
  133. +
  134. +l2b: inb %dx, %al /* wait vertical retrace */
  135. + test $8, %al
  136. + jnz l2b
  137. +
  138. + mov %bx, %dx
  139. + movb 0x18(%esp), %al /* index */
  140. + outb %al, %dx
  141. + inc %dx
  142. +
  143. + movb 0x1c(%esp), %al /* red */
  144. + outb %al, %dx
  145. +
  146. + movb 0x20(%esp), %al /* green */
  147. + outb %al, %dx
  148. +
  149. + movb 0x24(%esp), %al /* blue */
  150. + outb %al, %dx
  151. +
  152. + movw 0x18(%esp), %bx
  153. +
  154. + call EXT_C(prot_to_real)
  155. + .code16
  156. +
  157. + movb %bl, %bh
  158. + movw $0x1000, %ax
  159. + int $0x10
  160. +
  161. + DATA32 call EXT_C(real_to_prot)
  162. + .code32
  163. +
  164. + pop %edx
  165. + pop %ecx
  166. + pop %ebx
  167. + pop %eax
  168. + pop %ebp
  169. + ret
  170. +
  171. +#endif /* SUPPORT_GRAPHICS */
  172. /*
  173. * getrtsecs()
  174. --- grub-0.95/stage2/stage2.c.graphics 2004-06-18 17:35:52.314995824 -0400
  175. +++ grub-0.95/stage2/stage2.c 2004-06-18 17:35:52.494968464 -0400
  176. @@ -233,6 +233,7 @@
  177. {
  178. int c, time1, time2 = -1, first_entry = 0;
  179. char *cur_entry = 0;
  180. + struct term_entry *prev_term = NULL;
  181. /*
  182. * Main loop for menu UI.
  183. @@ -807,6 +808,15 @@
  184. cls ();
  185. setcursor (1);
  186. + /* if our terminal needed initialization, we should shut it down
  187. + * before booting the kernel, but we want to save what it was so
  188. + * we can come back if needed */
  189. + prev_term = current_term;
  190. + if (current_term->shutdown)
  191. + {
  192. + (*current_term->shutdown)();
  193. + current_term = term_table; /* assumption: console is first */
  194. + }
  195. while (1)
  196. {
  197. @@ -838,6 +848,13 @@
  198. break;
  199. }
  200. + /* if we get back here, we should go back to what our term was before */
  201. + current_term = prev_term;
  202. + if (current_term->startup)
  203. + /* if our terminal fails to initialize, fall back to console since
  204. + * it should always work */
  205. + if ((*current_term->startup)() == 0)
  206. + current_term = term_table; /* we know that console is first */
  207. show_menu = 1;
  208. goto restart;
  209. }
  210. @@ -1082,6 +1099,10 @@
  211. while (is_preset);
  212. }
  213. + /* go ahead and make sure the terminal is setup */
  214. + if (current_term->startup)
  215. + (*current_term->startup)();
  216. +
  217. if (! num_entries)
  218. {
  219. /* If no acceptable config file, goto command-line, starting
  220. --- grub-0.95/stage2/builtins.c.graphics 2004-06-18 17:35:52.370987312 -0400
  221. +++ grub-0.95/stage2/builtins.c 2004-06-18 17:35:52.482970288 -0400
  222. @@ -858,6 +858,138 @@
  223. };
  224. #endif /* SUPPORT_NETBOOT */
  225. +static int terminal_func (char *arg, int flags);
  226. +
  227. +#ifdef SUPPORT_GRAPHICS
  228. +
  229. +static int splashimage_func(char *arg, int flags) {
  230. + char splashimage[64];
  231. + int i;
  232. +
  233. + /* filename can only be 64 characters due to our buffer size */
  234. + if (strlen(arg) > 63)
  235. + return 1;
  236. + if (flags == BUILTIN_CMDLINE) {
  237. + if (!grub_open(arg))
  238. + return 1;
  239. + grub_close();
  240. + }
  241. +
  242. + strcpy(splashimage, arg);
  243. +
  244. + /* get rid of TERM_NEED_INIT from the graphics terminal. */
  245. + for (i = 0; term_table[i].name; i++) {
  246. + if (grub_strcmp (term_table[i].name, "graphics") == 0) {
  247. + term_table[i].flags &= ~TERM_NEED_INIT;
  248. + break;
  249. + }
  250. + }
  251. +
  252. + graphics_set_splash(splashimage);
  253. +
  254. + if (flags == BUILTIN_CMDLINE && graphics_inited) {
  255. + graphics_end();
  256. + graphics_init();
  257. + graphics_cls();
  258. + }
  259. +
  260. + /* FIXME: should we be explicitly switching the terminal as a
  261. + * side effect here? */
  262. + terminal_func("graphics", flags);
  263. +
  264. + return 0;
  265. +}
  266. +
  267. +static struct builtin builtin_splashimage =
  268. +{
  269. + "splashimage",
  270. + splashimage_func,
  271. + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
  272. + "splashimage FILE",
  273. + "Load FILE as the background image when in graphics mode."
  274. +};
  275. +
  276. +
  277. +/* foreground */
  278. +static int
  279. +foreground_func(char *arg, int flags)
  280. +{
  281. + if (grub_strlen(arg) == 6) {
  282. + int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2;
  283. + int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2;
  284. + int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2;
  285. +
  286. + foreground = (r << 16) | (g << 8) | b;
  287. + if (graphics_inited)
  288. + graphics_set_palette(15, r, g, b);
  289. +
  290. + return (0);
  291. + }
  292. +
  293. + return (1);
  294. +}
  295. +
  296. +static struct builtin builtin_foreground =
  297. +{
  298. + "foreground",
  299. + foreground_func,
  300. + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
  301. + "foreground RRGGBB",
  302. + "Sets the foreground color when in graphics mode."
  303. + "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
  304. +};
  305. +
  306. +
  307. +/* background */
  308. +static int
  309. +background_func(char *arg, int flags)
  310. +{
  311. + if (grub_strlen(arg) == 6) {
  312. + int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2;
  313. + int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2;
  314. + int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2;
  315. +
  316. + background = (r << 16) | (g << 8) | b;
  317. + if (graphics_inited)
  318. + graphics_set_palette(0, r, g, b);
  319. + return (0);
  320. + }
  321. +
  322. + return (1);
  323. +}
  324. +
  325. +static struct builtin builtin_background =
  326. +{
  327. + "background",
  328. + background_func,
  329. + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
  330. + "background RRGGBB",
  331. + "Sets the background color when in graphics mode."
  332. + "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
  333. +};
  334. +
  335. +#endif /* SUPPORT_GRAPHICS */
  336. +
  337. +
  338. +/* clear */
  339. +static int
  340. +clear_func()
  341. +{
  342. + if (current_term->cls)
  343. + current_term->cls();
  344. +
  345. + return 0;
  346. +}
  347. +
  348. +static struct builtin builtin_clear =
  349. +{
  350. + "clear",
  351. + clear_func,
  352. + BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
  353. + "clear",
  354. + "Clear the screen"
  355. +};
  356. +
  357. /* displayapm */
  358. static int
  359. @@ -4090,7 +4222,7 @@
  360. };
  361. -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES)
  362. +#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS)
  363. /* terminal */
  364. static int
  365. terminal_func (char *arg, int flags)
  366. @@ -4249,17 +4381,21 @@
  367. end:
  368. current_term = term_table + default_term;
  369. current_term->flags = term_flags;
  370. -
  371. +
  372. if (lines)
  373. max_lines = lines;
  374. else
  375. - /* 24 would be a good default value. */
  376. - max_lines = 24;
  377. -
  378. + max_lines = current_term->max_lines;
  379. +
  380. /* If the interface is currently the command-line,
  381. restart it to repaint the screen. */
  382. - if (current_term != prev_term && (flags & BUILTIN_CMDLINE))
  383. + if ((current_term != prev_term) && (flags & BUILTIN_CMDLINE)){
  384. + if (prev_term->shutdown)
  385. + prev_term->shutdown();
  386. + if (current_term->startup)
  387. + current_term->startup();
  388. grub_longjmp (restart_cmdline_env, 0);
  389. + }
  390. return 0;
  391. }
  392. @@ -4269,7 +4405,7 @@
  393. "terminal",
  394. terminal_func,
  395. BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
  396. - "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules]",
  397. + "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules] [graphics]",
  398. "Select a terminal. When multiple terminals are specified, wait until"
  399. " you push any key to continue. If both console and serial are specified,"
  400. " the terminal to which you input a key first will be selected. If no"
  401. @@ -4281,7 +4417,7 @@
  402. " seconds. The option --lines specifies the maximum number of lines."
  403. " The option --silent is used to suppress messages."
  404. };
  405. -#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */
  406. +#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */
  407. #ifdef SUPPORT_SERIAL
  408. @@ -4809,6 +4945,9 @@
  409. /* The table of builtin commands. Sorted in dictionary order. */
  410. struct builtin *builtin_table[] =
  411. {
  412. +#ifdef SUPPORT_GRAPHICS
  413. + &builtin_background,
  414. +#endif
  415. &builtin_blocklist,
  416. &builtin_boot,
  417. #ifdef SUPPORT_NETBOOT
  418. @@ -4816,6 +4955,7 @@
  419. #endif /* SUPPORT_NETBOOT */
  420. &builtin_cat,
  421. &builtin_chainloader,
  422. + &builtin_clear,
  423. &builtin_cmp,
  424. &builtin_color,
  425. &builtin_configfile,
  426. @@ -4835,6 +4975,9 @@
  427. &builtin_embed,
  428. &builtin_fallback,
  429. &builtin_find,
  430. +#ifdef SUPPORT_GRAPHICS
  431. + &builtin_foreground,
  432. +#endif
  433. &builtin_fstest,
  434. &builtin_geometry,
  435. &builtin_halt,
  436. @@ -4878,9 +5021,12 @@
  437. #endif /* SUPPORT_SERIAL */
  438. &builtin_setkey,
  439. &builtin_setup,
  440. -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES)
  441. +#ifdef SUPPORT_GRAPHICS
  442. + &builtin_splashimage,
  443. +#endif /* SUPPORT_GRAPHICS */
  444. +#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS)
  445. &builtin_terminal,
  446. -#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */
  447. +#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */
  448. #ifdef SUPPORT_SERIAL
  449. &builtin_terminfo,
  450. #endif /* SUPPORT_SERIAL */
  451. --- /dev/null 2004-02-23 16:02:56.000000000 -0500
  452. +++ grub-0.95/stage2/graphics.c 2004-06-18 17:35:52.488969376 -0400
  453. @@ -0,0 +1,552 @@
  454. +/* graphics.c - graphics mode support for GRUB */
  455. +/* Implemented as a terminal type by Jeremy Katz <katzj@redhat.com> based
  456. + * on a patch by Paulo C�sar Pereira de Andrade <pcpa@conectiva.com.br>
  457. + */
  458. +/*
  459. + * GRUB -- GRand Unified Bootloader
  460. + * Copyright (C) 2001,2002 Red Hat, Inc.
  461. + * Portions copyright (C) 2000 Conectiva, Inc.
  462. + *
  463. + * This program is free software; you can redistribute it and/or modify
  464. + * it under the terms of the GNU General Public License as published by
  465. + * the Free Software Foundation; either version 2 of the License, or
  466. + * (at your option) any later version.
  467. + *
  468. + * This program is distributed in the hope that it will be useful,
  469. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  470. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  471. + * GNU General Public License for more details.
  472. + *
  473. + * You should have received a copy of the GNU General Public License
  474. + * along with this program; if not, write to the Free Software
  475. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  476. + */
  477. +
  478. +
  479. +
  480. +#ifdef SUPPORT_GRAPHICS
  481. +
  482. +#include <term.h>
  483. +#include <shared.h>
  484. +#include <graphics.h>
  485. +
  486. +int saved_videomode;
  487. +unsigned char *font8x16;
  488. +
  489. +int graphics_inited = 0;
  490. +static char splashimage[64];
  491. +
  492. +#define VSHADOW VSHADOW1
  493. +unsigned char VSHADOW1[38400];
  494. +unsigned char VSHADOW2[38400];
  495. +unsigned char VSHADOW4[38400];
  496. +unsigned char VSHADOW8[38400];
  497. +
  498. +/* constants to define the viewable area */
  499. +const int x0 = 0;
  500. +const int x1 = 80;
  501. +const int y0 = 0;
  502. +const int y1 = 30;
  503. +
  504. +/* text buffer has to be kept around so that we can write things as we
  505. + * scroll and the like */
  506. +unsigned short text[80 * 30];
  507. +
  508. +/* why do these have to be kept here? */
  509. +int foreground = (63 << 16) | (63 << 8) | (63), background = 0, border = 0;
  510. +
  511. +/* current position */
  512. +static int fontx = 0;
  513. +static int fonty = 0;
  514. +
  515. +/* global state so that we don't try to recursively scroll or cursor */
  516. +static int no_scroll = 0;
  517. +
  518. +/* color state */
  519. +static int graphics_standard_color = A_NORMAL;
  520. +static int graphics_normal_color = A_NORMAL;
  521. +static int graphics_highlight_color = A_REVERSE;
  522. +static int graphics_current_color = A_NORMAL;
  523. +static color_state graphics_color_state = COLOR_STATE_STANDARD;
  524. +
  525. +
  526. +/* graphics local functions */
  527. +static void graphics_setxy(int col, int row);
  528. +static void graphics_scroll();
  529. +
  530. +/* FIXME: where do these really belong? */
  531. +static inline void outb(unsigned short port, unsigned char val)
  532. +{
  533. + __asm __volatile ("outb %0,%1"::"a" (val), "d" (port));
  534. +}
  535. +
  536. +static void MapMask(int value) {
  537. + outb(0x3c4, 2);
  538. + outb(0x3c5, value);
  539. +}
  540. +
  541. +/* bit mask register */
  542. +static void BitMask(int value) {
  543. + outb(0x3ce, 8);
  544. + outb(0x3cf, value);
  545. +}
  546. +
  547. +
  548. +
  549. +/* Set the splash image */
  550. +void graphics_set_splash(char *splashfile) {
  551. + grub_strcpy(splashimage, splashfile);
  552. +}
  553. +
  554. +/* Get the current splash image */
  555. +char *graphics_get_splash(void) {
  556. + return splashimage;
  557. +}
  558. +
  559. +/* Initialize a vga16 graphics display with the palette based off of
  560. + * the image in splashimage. If the image doesn't exist, leave graphics
  561. + * mode. */
  562. +int graphics_init()
  563. +{
  564. + if (!graphics_inited) {
  565. + saved_videomode = set_videomode(0x12);
  566. + }
  567. +
  568. + if (!read_image(splashimage)) {
  569. + set_videomode(saved_videomode);
  570. + grub_printf("failed to read image\n");
  571. + return 0;
  572. + }
  573. +
  574. + font8x16 = (unsigned char*)graphics_get_font();
  575. +
  576. + graphics_inited = 1;
  577. +
  578. + /* make sure that the highlight color is set correctly */
  579. + graphics_highlight_color = ((graphics_normal_color >> 4) |
  580. + ((graphics_normal_color & 0xf) << 4));
  581. +
  582. + return 1;
  583. +}
  584. +
  585. +/* Leave graphics mode */
  586. +void graphics_end(void)
  587. +{
  588. + if (graphics_inited) {
  589. + set_videomode(saved_videomode);
  590. + graphics_inited = 0;
  591. + }
  592. +}
  593. +
  594. +/* Print ch on the screen. Handle any needed scrolling or the like */
  595. +void graphics_putchar(int ch) {
  596. + ch &= 0xff;
  597. +
  598. + graphics_cursor(0);
  599. +
  600. + if (ch == '\n') {
  601. + if (fonty + 1 < y1)
  602. + graphics_setxy(fontx, fonty + 1);
  603. + else
  604. + graphics_scroll();
  605. + graphics_cursor(1);
  606. + return;
  607. + } else if (ch == '\r') {
  608. + graphics_setxy(x0, fonty);
  609. + graphics_cursor(1);
  610. + return;
  611. + }
  612. +
  613. + graphics_cursor(0);
  614. +
  615. + text[fonty * 80 + fontx] = ch;
  616. + text[fonty * 80 + fontx] &= 0x00ff;
  617. + if (graphics_current_color & 0xf0)
  618. + text[fonty * 80 + fontx] |= 0x100;
  619. +
  620. + graphics_cursor(0);
  621. +
  622. + if ((fontx + 1) >= x1) {
  623. + graphics_setxy(x0, fonty);
  624. + if (fonty + 1 < y1)
  625. + graphics_setxy(x0, fonty + 1);
  626. + else
  627. + graphics_scroll();
  628. + } else {
  629. + graphics_setxy(fontx + 1, fonty);
  630. + }
  631. +
  632. + graphics_cursor(1);
  633. +}
  634. +
  635. +/* get the current location of the cursor */
  636. +int graphics_getxy(void) {
  637. + return (fontx << 8) | fonty;
  638. +}
  639. +
  640. +void graphics_gotoxy(int x, int y) {
  641. + graphics_cursor(0);
  642. +
  643. + graphics_setxy(x, y);
  644. +
  645. + graphics_cursor(1);
  646. +}
  647. +
  648. +void graphics_cls(void) {
  649. + int i;
  650. + unsigned char *mem, *s1, *s2, *s4, *s8;
  651. +
  652. + graphics_cursor(0);
  653. + graphics_gotoxy(x0, y0);
  654. +
  655. + mem = (unsigned char*)VIDEOMEM;
  656. + s1 = (unsigned char*)VSHADOW1;
  657. + s2 = (unsigned char*)VSHADOW2;
  658. + s4 = (unsigned char*)VSHADOW4;
  659. + s8 = (unsigned char*)VSHADOW8;
  660. +
  661. + for (i = 0; i < 80 * 30; i++)
  662. + text[i] = ' ';
  663. + graphics_cursor(1);
  664. +
  665. + BitMask(0xff);
  666. +
  667. + /* plano 1 */
  668. + MapMask(1);
  669. + grub_memcpy(mem, s1, 38400);
  670. +
  671. + /* plano 2 */
  672. + MapMask(2);
  673. + grub_memcpy(mem, s2, 38400);
  674. +
  675. + /* plano 3 */
  676. + MapMask(4);
  677. + grub_memcpy(mem, s4, 38400);
  678. +
  679. + /* plano 4 */
  680. + MapMask(8);
  681. + grub_memcpy(mem, s8, 38400);
  682. +
  683. + MapMask(15);
  684. +
  685. +}
  686. +
  687. +void graphics_setcolorstate (color_state state) {
  688. + switch (state) {
  689. + case COLOR_STATE_STANDARD:
  690. + graphics_current_color = graphics_standard_color;
  691. + break;
  692. + case COLOR_STATE_NORMAL:
  693. + graphics_current_color = graphics_normal_color;
  694. + break;
  695. + case COLOR_STATE_HIGHLIGHT:
  696. + graphics_current_color = graphics_highlight_color;
  697. + break;
  698. + default:
  699. + graphics_current_color = graphics_standard_color;
  700. + break;
  701. + }
  702. +
  703. + graphics_color_state = state;
  704. +}
  705. +
  706. +void graphics_setcolor (int normal_color, int highlight_color) {
  707. + graphics_normal_color = normal_color;
  708. + graphics_highlight_color = highlight_color;
  709. +
  710. + graphics_setcolorstate (graphics_color_state);
  711. +}
  712. +
  713. +void graphics_setcursor (int on) {
  714. + /* FIXME: we don't have a cursor in graphics */
  715. + return;
  716. +}
  717. +
  718. +/* Read in the splashscreen image and set the palette up appropriately.
  719. + * Format of splashscreen is an xpm (can be gzipped) with 16 colors and
  720. + * 640x480. */
  721. +int read_image(char *s)
  722. +{
  723. + char buf[32], pal[16];
  724. + unsigned char c, base, mask, *s1, *s2, *s4, *s8;
  725. + unsigned i, len, idx, colors, x, y, width, height;
  726. +
  727. + if (!grub_open(s))
  728. + return 0;
  729. +
  730. + /* read header */
  731. + if (!grub_read((char*)&buf, 10) || grub_memcmp(buf, "/* XPM */\n", 10)) {
  732. + grub_close();
  733. + return 0;
  734. + }
  735. +
  736. + /* parse info */
  737. + while (grub_read(&c, 1)) {
  738. + if (c == '"')
  739. + break;
  740. + }
  741. +
  742. + while (grub_read(&c, 1) && (c == ' ' || c == '\t'))
  743. + ;
  744. +
  745. + i = 0;
  746. + width = c - '0';
  747. + while (grub_read(&c, 1)) {
  748. + if (c >= '0' && c <= '9')
  749. + width = width * 10 + c - '0';
  750. + else
  751. + break;
  752. + }
  753. + while (grub_read(&c, 1) && (c == ' ' || c == '\t'))
  754. + ;
  755. +
  756. + height = c - '0';
  757. + while (grub_read(&c, 1)) {
  758. + if (c >= '0' && c <= '9')
  759. + height = height * 10 + c - '0';
  760. + else
  761. + break;
  762. + }
  763. + while (grub_read(&c, 1) && (c == ' ' || c == '\t'))
  764. + ;
  765. +
  766. + colors = c - '0';
  767. + while (grub_read(&c, 1)) {
  768. + if (c >= '0' && c <= '9')
  769. + colors = colors * 10 + c - '0';
  770. + else
  771. + break;
  772. + }
  773. +
  774. + base = 0;
  775. + while (grub_read(&c, 1) && c != '"')
  776. + ;
  777. +
  778. + /* palette */
  779. + for (i = 0, idx = 1; i < colors; i++) {
  780. + len = 0;
  781. +
  782. + while (grub_read(&c, 1) && c != '"')
  783. + ;
  784. + grub_read(&c, 1); /* char */
  785. + base = c;
  786. + grub_read(buf, 4); /* \t c # */
  787. +
  788. + while (grub_read(&c, 1) && c != '"') {
  789. + if (len < sizeof(buf))
  790. + buf[len++] = c;
  791. + }
  792. +
  793. + if (len == 6 && idx < 15) {
  794. + int r = ((hex(buf[0]) << 4) | hex(buf[1])) >> 2;
  795. + int g = ((hex(buf[2]) << 4) | hex(buf[3])) >> 2;
  796. + int b = ((hex(buf[4]) << 4) | hex(buf[5])) >> 2;
  797. +
  798. + pal[idx] = base;
  799. + graphics_set_palette(idx, r, g, b);
  800. + ++idx;
  801. + }
  802. + }
  803. +
  804. + x = y = len = 0;
  805. +
  806. + s1 = (unsigned char*)VSHADOW1;
  807. + s2 = (unsigned char*)VSHADOW2;
  808. + s4 = (unsigned char*)VSHADOW4;
  809. + s8 = (unsigned char*)VSHADOW8;
  810. +
  811. + for (i = 0; i < 38400; i++)
  812. + s1[i] = s2[i] = s4[i] = s8[i] = 0;
  813. +
  814. + /* parse xpm data */
  815. + while (y < height) {
  816. + while (1) {
  817. + if (!grub_read(&c, 1)) {
  818. + grub_close();
  819. + return 0;
  820. + }
  821. + if (c == '"')
  822. + break;
  823. + }
  824. +
  825. + while (grub_read(&c, 1) && c != '"') {
  826. + for (i = 1; i < 15; i++)
  827. + if (pal[i] == c) {
  828. + c = i;
  829. + break;
  830. + }
  831. +
  832. + mask = 0x80 >> (x & 7);
  833. + if (c & 1)
  834. + s1[len + (x >> 3)] |= mask;
  835. + if (c & 2)
  836. + s2[len + (x >> 3)] |= mask;
  837. + if (c & 4)
  838. + s4[len + (x >> 3)] |= mask;
  839. + if (c & 8)
  840. + s8[len + (x >> 3)] |= mask;
  841. +
  842. + if (++x >= 640) {
  843. + x = 0;
  844. +
  845. + if (y < 480)
  846. + len += 80;
  847. + ++y;
  848. + }
  849. + }
  850. + }
  851. +
  852. + grub_close();
  853. +
  854. + graphics_set_palette(0, (background >> 16), (background >> 8) & 63,
  855. + background & 63);
  856. + graphics_set_palette(15, (foreground >> 16), (foreground >> 8) & 63,
  857. + foreground & 63);
  858. + graphics_set_palette(0x11, (border >> 16), (border >> 8) & 63,
  859. + border & 63);
  860. +
  861. + return 1;
  862. +}
  863. +
  864. +
  865. +/* Convert a character which is a hex digit to the appropriate integer */
  866. +int hex(int v)
  867. +{
  868. + if (v >= 'A' && v <= 'F')
  869. + return (v - 'A' + 10);
  870. + if (v >= 'a' && v <= 'f')
  871. + return (v - 'a' + 10);
  872. + return (v - '0');
  873. +}
  874. +
  875. +
  876. +/* move the graphics cursor location to col, row */
  877. +static void graphics_setxy(int col, int row) {
  878. + if (col >= x0 && col < x1) {
  879. + fontx = col;
  880. + cursorX = col << 3;
  881. + }
  882. + if (row >= y0 && row < y1) {
  883. + fonty = row;
  884. + cursorY = row << 4;
  885. + }
  886. +}
  887. +
  888. +/* scroll the screen */
  889. +static void graphics_scroll() {
  890. + int i, j;
  891. +
  892. + /* we don't want to scroll recursively... that would be bad */
  893. + if (no_scroll)
  894. + return;
  895. + no_scroll = 1;
  896. +
  897. + /* move everything up a line */
  898. + for (j = y0 + 1; j < y1; j++) {
  899. + graphics_gotoxy(x0, j - 1);
  900. + for (i = x0; i < x1; i++) {
  901. + graphics_putchar(text[j * 80 + i]);
  902. + }
  903. + }
  904. +
  905. + /* last line should be blank */
  906. + graphics_gotoxy(x0, y1 - 1);
  907. + for (i = x0; i < x1; i++)
  908. + graphics_putchar(' ');
  909. + graphics_setxy(x0, y1 - 1);
  910. +
  911. + no_scroll = 0;
  912. +}
  913. +
  914. +
  915. +void graphics_cursor(int set) {
  916. + unsigned char *pat, *mem, *ptr, chr[16 << 2];
  917. + int i, ch, invert, offset;
  918. +
  919. + if (set && no_scroll)
  920. + return;
  921. +
  922. + offset = cursorY * 80 + fontx;
  923. + ch = text[fonty * 80 + fontx] & 0xff;
  924. + invert = (text[fonty * 80 + fontx] & 0xff00) != 0;
  925. + pat = font8x16 + (ch << 4);
  926. +
  927. + mem = (unsigned char*)VIDEOMEM + offset;
  928. +
  929. + if (!set) {
  930. + for (i = 0; i < 16; i++) {
  931. + unsigned char mask = pat[i];
  932. +
  933. + if (!invert) {
  934. + chr[i ] = ((unsigned char*)VSHADOW1)[offset];
  935. + chr[16 + i] = ((unsigned char*)VSHADOW2)[offset];
  936. + chr[32 + i] = ((unsigned char*)VSHADOW4)[offset];
  937. + chr[48 + i] = ((unsigned char*)VSHADOW8)[offset];
  938. +
  939. + /* FIXME: if (shade) */
  940. + if (1) {
  941. + if (ch == DISP_VERT || ch == DISP_LL ||
  942. + ch == DISP_UR || ch == DISP_LR) {
  943. + unsigned char pmask = ~(pat[i] >> 1);
  944. +
  945. + chr[i ] &= pmask;
  946. + chr[16 + i] &= pmask;
  947. + chr[32 + i] &= pmask;
  948. + chr[48 + i] &= pmask;
  949. + }
  950. + if (i > 0 && ch != DISP_VERT) {
  951. + unsigned char pmask = ~(pat[i - 1] >> 1);
  952. +
  953. + chr[i ] &= pmask;
  954. + chr[16 + i] &= pmask;
  955. + chr[32 + i] &= pmask;
  956. + chr[48 + i] &= pmask;
  957. + if (ch == DISP_HORIZ || ch == DISP_UR || ch == DISP_LR) {
  958. + pmask = ~pat[i - 1];
  959. +
  960. + chr[i ] &= pmask;
  961. + chr[16 + i] &= pmask;
  962. + chr[32 + i] &= pmask;
  963. + chr[48 + i] &= pmask;
  964. + }
  965. + }
  966. + }
  967. + chr[i ] |= mask;
  968. + chr[16 + i] |= mask;
  969. + chr[32 + i] |= mask;
  970. + chr[48 + i] |= mask;
  971. +
  972. + offset += 80;
  973. + }
  974. + else {
  975. + chr[i ] = mask;
  976. + chr[16 + i] = mask;
  977. + chr[32 + i] = mask;
  978. + chr[48 + i] = mask;
  979. + }
  980. + }
  981. + }
  982. + else {
  983. + MapMask(15);
  984. + ptr = mem;
  985. + for (i = 0; i < 16; i++, ptr += 80) {
  986. + cursorBuf[i] = pat[i];
  987. + *ptr = ~pat[i];
  988. + }
  989. + return;
  990. + }
  991. +
  992. + offset = 0;
  993. + for (i = 1; i < 16; i <<= 1, offset += 16) {
  994. + int j;
  995. +
  996. + MapMask(i);
  997. + ptr = mem;
  998. + for (j = 0; j < 16; j++, ptr += 80)
  999. + *ptr = chr[j + offset];
  1000. + }
  1001. +
  1002. + MapMask(15);
  1003. +}
  1004. +
  1005. +#endif /* SUPPORT_GRAPHICS */
  1006. --- grub-0.95/stage2/Makefile.am.graphics 2004-06-13 13:57:27.000000000 -0400
  1007. +++ grub-0.95/stage2/Makefile.am 2004-06-18 17:36:58.289966104 -0400
  1008. @@ -7,7 +7,7 @@
  1009. fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \
  1010. imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \
  1011. nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \
  1012. - terminfo.h tparm.h nbi.h ufs2.h vstafs.h xfs.h
  1013. + terminfo.h tparm.h nbi.h ufs2.h vstafs.h xfs.h graphics.h
  1014. EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS)
  1015. # For <stage1.h>.
  1016. @@ -19,7 +19,7 @@
  1017. disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \
  1018. fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs2.c \
  1019. fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \
  1020. - terminfo.c tparm.c
  1021. + terminfo.c tparm.c graphics.c
  1022. libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
  1023. -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
  1024. -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
  1025. @@ -80,8 +80,14 @@
  1026. HERCULES_FLAGS =
  1027. endif
  1028. +if GRAPHICS_SUPPORT
  1029. +GRAPHICS_FLAGS = -DSUPPORT_GRAPHICS=1
  1030. +else
  1031. +GRAPHICS_FLAGS =
  1032. +endif
  1033. +
  1034. STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
  1035. - $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS)
  1036. + $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) $(GRAPHICS_FLAGS)
  1037. STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
  1038. STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1
  1039. @@ -91,7 +97,8 @@
  1040. cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \
  1041. fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
  1042. fsys_reiserfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c gunzip.c \
  1043. - hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c
  1044. + hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c \
  1045. + graphics.c
  1046. pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
  1047. pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
  1048. pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
  1049. --- grub-0.95/stage2/term.h.graphics 2003-07-09 07:45:53.000000000 -0400
  1050. +++ grub-0.95/stage2/term.h 2004-06-18 17:35:52.496968160 -0400
  1051. @@ -60,6 +60,8 @@
  1052. const char *name;
  1053. /* The feature flags defined above. */
  1054. unsigned long flags;
  1055. + /* Default for maximum number of lines if not specified */
  1056. + unsigned short max_lines;
  1057. /* Put a character. */
  1058. void (*putchar) (int c);
  1059. /* Check if any input character is available. */
  1060. @@ -79,6 +81,11 @@
  1061. void (*setcolor) (int normal_color, int highlight_color);
  1062. /* Turn on/off the cursor. */
  1063. int (*setcursor) (int on);
  1064. +
  1065. + /* function to start a terminal */
  1066. + int (*startup) (void);
  1067. + /* function to use to shutdown a terminal */
  1068. + void (*shutdown) (void);
  1069. };
  1070. /* This lists up available terminals. */
  1071. @@ -124,4 +131,23 @@
  1072. int hercules_setcursor (int on);
  1073. #endif
  1074. +#ifdef SUPPORT_GRAPHICS
  1075. +extern int foreground, background, border, graphics_inited;
  1076. +
  1077. +void graphics_set_splash(char *splashfile);
  1078. +int set_videomode (int mode);
  1079. +void graphics_putchar (int c);
  1080. +int graphics_getxy(void);
  1081. +void graphics_gotoxy(int x, int y);
  1082. +void graphics_cls(void);
  1083. +void graphics_setcolorstate (color_state state);
  1084. +void graphics_setcolor (int normal_color, int highlight_color);
  1085. +void graphics_setcursor (int on);
  1086. +int graphics_init(void);
  1087. +void graphics_end(void);
  1088. +
  1089. +int hex(int v);
  1090. +void graphics_set_palette(int idx, int red, int green, int blue);
  1091. +#endif /* SUPPORT_GRAPHICS */
  1092. +
  1093. #endif /* ! GRUB_TERM_HEADER */
  1094. --- /dev/null 2004-02-23 16:02:56.000000000 -0500
  1095. +++ grub-0.95/stage2/graphics.h 2004-06-18 17:35:52.490969072 -0400
  1096. @@ -0,0 +1,42 @@
  1097. +/* graphics.h - graphics console interface */
  1098. +/*
  1099. + * GRUB -- GRand Unified Bootloader
  1100. + * Copyright (C) 2002 Free Software Foundation, Inc.
  1101. + *
  1102. + * This program is free software; you can redistribute it and/or modify
  1103. + * it under the terms of the GNU General Public License as published by
  1104. + * the Free Software Foundation; either version 2 of the License, or
  1105. + * (at your option) any later version.
  1106. + *
  1107. + * This program is distributed in the hope that it will be useful,
  1108. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  1109. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1110. + * GNU General Public License for more details.
  1111. + *
  1112. + * You should have received a copy of the GNU General Public License
  1113. + * along with this program; if not, write to the Free Software
  1114. + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  1115. + */
  1116. +
  1117. +#ifndef GRAPHICS_H
  1118. +#define GRAPHICS_H
  1119. +
  1120. +/* magic constant */
  1121. +#define VIDEOMEM 0xA0000
  1122. +
  1123. +/* function prototypes */
  1124. +char *graphics_get_splash(void);
  1125. +
  1126. +int read_image(char *s);
  1127. +void graphics_cursor(int set);
  1128. +
  1129. +/* function prototypes for asm functions */
  1130. +void * graphics_get_font();
  1131. +void graphics_set_palette(int idx, int red, int green, int blue);
  1132. +void set_int1c_handler();
  1133. +void unset_int1c_handler();
  1134. +
  1135. +extern short cursorX, cursorY;
  1136. +extern char cursorBuf[16];
  1137. +
  1138. +#endif /* GRAPHICS_H */
  1139. --- grub-0.95/stage2/shared.h.graphics 2004-06-18 17:35:52.372987008 -0400
  1140. +++ grub-0.95/stage2/shared.h 2004-06-18 17:35:52.492968768 -0400
  1141. @@ -873,6 +873,7 @@
  1142. int grub_tolower (int c);
  1143. int grub_isspace (int c);
  1144. int grub_strncat (char *s1, const char *s2, int n);
  1145. +void grub_memcpy(void *dest, const void *src, int len);
  1146. void *grub_memmove (void *to, const void *from, int len);
  1147. void *grub_memset (void *start, int c, int len);
  1148. int grub_strncat (char *s1, const char *s2, int n);
  1149. --- grub-0.95/stage2/char_io.c.graphics 2004-05-23 12:45:43.000000000 -0400
  1150. +++ grub-0.95/stage2/char_io.c 2004-06-18 17:35:52.485969832 -0400
  1151. @@ -35,6 +35,7 @@
  1152. {
  1153. "console",
  1154. 0,
  1155. + 24,
  1156. console_putchar,
  1157. console_checkkey,
  1158. console_getkey,
  1159. @@ -43,13 +44,16 @@
  1160. console_cls,
  1161. console_setcolorstate,
  1162. console_setcolor,
  1163. - console_setcursor
  1164. + console_setcursor,
  1165. + 0,
  1166. + 0
  1167. },
  1168. #ifdef SUPPORT_SERIAL
  1169. {
  1170. "serial",
  1171. /* A serial device must be initialized. */
  1172. TERM_NEED_INIT,
  1173. + 24,
  1174. serial_putchar,
  1175. serial_checkkey,
  1176. serial_getkey,
  1177. @@ -58,6 +62,8 @@
  1178. serial_cls,
  1179. serial_setcolorstate,
  1180. 0,
  1181. + 0,
  1182. + 0,
  1183. 0
  1184. },
  1185. #endif /* SUPPORT_SERIAL */
  1186. @@ -65,6 +71,7 @@
  1187. {
  1188. "hercules",
  1189. 0,
  1190. + 24,
  1191. hercules_putchar,
  1192. console_checkkey,
  1193. console_getkey,
  1194. @@ -73,9 +80,28 @@
  1195. hercules_cls,
  1196. hercules_setcolorstate,
  1197. hercules_setcolor,
  1198. - hercules_setcursor
  1199. + hercules_setcursor,
  1200. + 0,
  1201. + 0
  1202. },
  1203. #endif /* SUPPORT_HERCULES */
  1204. +#ifdef SUPPORT_GRAPHICS
  1205. + { "graphics",
  1206. + TERM_NEED_INIT, /* flags */
  1207. + 30, /* number of lines */
  1208. + graphics_putchar, /* putchar */
  1209. + console_checkkey, /* checkkey */
  1210. + console_getkey, /* getkey */
  1211. + graphics_getxy, /* getxy */
  1212. + graphics_gotoxy, /* gotoxy */
  1213. + graphics_cls, /* cls */
  1214. + graphics_setcolorstate, /* setcolorstate */
  1215. + graphics_setcolor, /* setcolor */
  1216. + graphics_setcursor, /* nocursor */
  1217. + graphics_init, /* initialize */
  1218. + graphics_end /* shutdown */
  1219. + },
  1220. +#endif /* SUPPORT_GRAPHICS */
  1221. /* This must be the last entry. */
  1222. { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
  1223. };
  1224. @@ -1046,13 +1072,15 @@
  1225. the following grub_printf call will print newlines. */
  1226. count_lines = -1;
  1227. + grub_printf("\n");
  1228. if (current_term->setcolorstate)
  1229. current_term->setcolorstate (COLOR_STATE_HIGHLIGHT);
  1230. - grub_printf ("\n[Hit return to continue]");
  1231. + grub_printf ("[Hit return to continue]");
  1232. if (current_term->setcolorstate)
  1233. current_term->setcolorstate (COLOR_STATE_NORMAL);
  1234. +
  1235. do
  1236. {
  1237. @@ -1090,7 +1118,7 @@
  1238. cls (void)
  1239. {
  1240. /* If the terminal is dumb, there is no way to clean the terminal. */
  1241. - if (current_term->flags & TERM_DUMB)
  1242. + if (current_term->flags & TERM_DUMB)
  1243. grub_putchar ('\n');
  1244. else
  1245. current_term->cls ();
  1246. @@ -1214,6 +1242,16 @@
  1247. return ! errnum;
  1248. }
  1249. +void
  1250. +grub_memcpy(void *dest, const void *src, int len)
  1251. +{
  1252. + int i;
  1253. + register char *d = (char*)dest, *s = (char*)src;
  1254. +
  1255. + for (i = 0; i < len; i++)
  1256. + d[i] = s[i];
  1257. +}
  1258. +
  1259. void *
  1260. grub_memmove (void *to, const void *from, int len)
  1261. {
  1262. --- grub-0.95/configure.ac.graphics 2004-06-18 17:35:52.211011632 -0400
  1263. +++ grub-0.95/configure.ac 2004-06-18 17:35:52.498967856 -0400
  1264. @@ -595,6 +595,11 @@
  1265. [ --enable-diskless enable diskless support])
  1266. AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes)
  1267. +dnl Graphical splashscreen support
  1268. +AC_ARG_ENABLE(graphics,
  1269. + [ --disable-graphics disable graphics terminal support])
  1270. +AM_CONDITIONAL(GRAPHICS_SUPPORT, test "x$enable_graphics" != xno)
  1271. +
  1272. dnl Hercules terminal
  1273. AC_ARG_ENABLE(hercules,
  1274. [ --disable-hercules disable hercules terminal support])