diff --git a/ChangeLog b/ChangeLog index 78b781efb..afbfdaa5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,149 @@ +2002-06-12 Yoshinori K. Okuji + + The terminal handling code is rewritten radically. + + * stage2/console.c: New file. + * stage2/term.h: Likewise. + + * stage2/Makefile.am (noinst_HEADERS): Added term.h. + (libgrub_a_SOURCES): Added serial.c. + (pre_stage2_exec_SOURCES): Added console.c. + + * stage2/asm.S (console_putchar): Rewritten from scratch. + [!STAGE1_5] (translation_table): New variable. + [!STAGE1_5] (translate_keycode): New function. + [!STAGE1_5] (console_getkey): Call translate_keycode. + [!STAGE1_5] (console_checkkey): Likewise. + [!STAGE1_5] (nocursor): Renamed to ... + [!STAGE1_5] (console_nocursor): ... this. + [!STAGE1_5] (console_set_attrib): Removed. + + * stage2/builtins.c: Include term.h. + (terminal): Removed. + (normal_color): Likewise. + (highlight_color): Likewise. + (cat_func): Display a question mark when a non-printable + character was read. + (terminal_func): Rewritten almost from scratch. + + * stage2/char_io.c: Include term.h. + [!STAGE1_5] (auto_fill): Removed. + [!STAGE1_5] (term_table): New variable. + [!STAGE1_5] (current_term): Likewise. + [!STAGE1_5] (real_get_cmdline): New function. The code was + stolen from the previous version of get_cmdline. + [!STAGE1_5] (get_cmdline): Rewritten from scratch. + [!STAGE1_5] (translate_keycode): Removed. + [!STAGE1_5] (getkey): Rewritten from scratch. + [!STAGE1_5] (checkkey): Likewise. + (grub_putchar): Likewise. + [!STAGE1_5] (gotoxy): Likewise. + [!STAGE1_5] (getxy): Likewise. + [!STAGE1_5] (cls): Likewise. + [!STAGE1_5] (nocursor): New function. + [SUPPORT_SERIAL] (serial_getxy): Removed. + [SUPPORT_SERIAL] (serial_gotoxy): Likewise. + [SUPPORT_SERIAL] (serial_cls): Likewise. + [SUPPORT_SERIAL] (serial_getxy): Likewise. + [!STAGE1_5] (set_attrib): Likewise. + + * stage2/cmdline.c (init_cmdline): Set COUNT_LINES to -1. + + * stage2/common.c [!STAGE1_5] (err_list): Removed + ERR_NEED_SERIAL and added ERR_DEV_NEED_INIT. + + * stage2/hercules.c: Rewritten almost from scratch. + * stage2/hercules.h (herc_putchar): Removed. + (herc_cls): Likewise. + (herc_getxy): Likewise. + (herc_gotoxy): Likewise. + (herc_set_attrib): Likewise. + + * stage2/serial.c: Rewritten almost from scratch. + * stage2/serial.h: Likewise. + + * stage2/shared.h [GRUB_UTIL] (DISP_UL): Set to the same value + as VGA's. + [GRUB_UTIL] (DISP_UR): Likewise. + [GRUB_UTIL] (DISP_LL): Likewise. + [GRUB_UTIL] (DISP_LR): Likewise. + [GRUB_UTIL] (DISP_HORIZ): Likewise. + [GRUB_UTIL] (DISP_VERT): Likewise. + [GRUB_UTIL] (DISP_LEFT): Likewise. + [GRUB_UTIL] (DISP_RIGHT): Likewise. + [GRUB_UTIL] (DISP_UP): Likewise. + [GRUB_UTIL] (DISP_DOWN): Likewise. + (grub_error_t): Removed ERR_NEED_SERIAL. + Added ERR_DEV_NEED_INIT. + (normal_color): Removed. + (highlight_color): Likewise. + (console_cls): Removed, because this is declared in term.h. + (console_getxy): Likewise. + (console_gotoxy): Likewise. + (console_putchar): Likewise. + (console_getkey): Likewise. + (console_checkkey): Likewise. + (console_set_attrib): Removed. + (set_attrib): Likewise. + [GRUB_UTIL] (nocursor): Declared. + (auto_fill): Removed. + (terminal): Likewise. + (TERMINAL_CONSOLE): Likewise. + (TERMINAL_SERIAL): Likewise. + (TERMINAL_HERCULES): Likewise. + (TERMINAL_DUMB): Likewise. + (translate_keycode): Likewise. + + * stage2/stage2.c: Include term.h. + (print_entry): Rewritten from scratch. + (print_entries): Likewise. + (print_border): Likewise. + (set_line): Removed. + (set_line_normal): Likewise. + (set_line_highlight): Likewise. + + * grub/Makefile.am (AM_CFLAGS): Added -DSUPPORT_HERCULES=1. + + * grub/asmstub.c: Don't include hercules.h. Include term.h. + (console_current_color): New variable. + (console_translate_key): New function. + (console_checkkey): Rewritten from scratch. + (console_getkey): Likewise. + (console_putchar): Likewise. + (console_set_attrib): Removed. + (console_highlight): New function. + (console_setcolor): Likewise. + (console_nocursor): Likewise. + (serial_getkey): Removed. + (serial_checkkey): Likewise. + (serial_putchar): Likewise. + (serial_exists): Likewise. + (serial_get_port): Likewise. + (serial_init): Likewise. + (serial_hw_fetch): New function. + (serial_hw_put): Likewise. + (serial_hw_delay): Likewise. + (serial_hw_get_port): Likewise. + (serial_hw_init): Likewise. + (set_serial_device): Renamed to ... + (serial_set_device): ... this. + (herc_putchar): Renamed to ... + (hercules_putchar): ... this. + (herc_cls): Renamed to ... + (hercules_cls): ... this. + (herc_getxy): Renamed to ... + (hercules_getxy): ... this. + (herc_gotoxy): Renamed to ... + (hercules_gotoxy): ... this. + (hercules_highlight): New function. + (hercules_setcolor): Likewise. + (hercules_nocursor): Likewise. + (herc_set_attrib): Removed. + + * grub/main.c: Include term.h. + (main): If USE_CURSES is false, set CURRENT_TERM->FLAGS to + TERM_NO_EDIT | TERM_DUMB. TERMINAL is not used any longer. + 2002-06-01 Yoshinori K. Okuji * docs/grub.texi (FAQ): Removed. See the GNU GRUB FAQ on the web diff --git a/NEWS b/NEWS index 319bb286c..8426b0d17 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,14 @@ New in 0.93: details. * The appendix "FAQ" in the manual is removed. See the GNU GRUB FAQ on the web instead. +* The terminal handling code is rewritten radically, and many bugfixes + are made at the same time. +* The command "color" is effective even in the command-line. +* The command "terminal" takes two new options, ``--no-echo'' and + ``--no-edit''. If you specify ``--no-echo'', GRUB won't echo back + input characters. If you specify ``--no-edit'', GRUB will disable the + BASH-like editing feature. These options are useful when using an + intelligent terminal (such as the comint mode in GNU Emacs). New in 0.92 - 2002-04-30: * The command "displaymem" uses only hex digits for consistency. diff --git a/docs/grub.texi b/docs/grub.texi index 00f8eab70..2074921ee 100644 --- a/docs/grub.texi +++ b/docs/grub.texi @@ -2273,7 +2273,7 @@ character each of the symbols corresponds: @node terminal @subsection terminal -@deffn Command terminal [@option{--dumb}] [@option{--timeout=secs}] [@option{--lines=lines}] [@option{--silent}] [@option{console}] [@option{serial}] [@option{hercules}] +@deffn Command terminal [@option{--dumb}] [@option{--no-echo}] [@option{--no-edit}] [@option{--timeout=secs}] [@option{--lines=lines}] [@option{--silent}] [@option{console}] [@option{serial}] [@option{hercules}] Select a terminal for user interaction. The terminal is assumed to be VT100-compatible unless @option{--dumb} is specified. If both @option{console} and @option{serial} are specified, then GRUB will use @@ -2292,7 +2292,13 @@ terminal, and it is used for the internal pager function. If you don't specify this option, the number is assumed as 24. The option @option{--silent} suppresses the message to prompt you to -hit any key. This might be useful if your system has no terminal device. +hit any key. This might be useful if your system has no terminal +device. + +The option @option{--no-echo} has GRUB not to echo back input +characters. This implies the option @option{--no-edit}. + +The option @option{--no-edit} disables the BASH-like editing feature. @end deffn diff --git a/docs/stamp-vti b/docs/stamp-vti index 71aed969f..c055f06c8 100644 --- a/docs/stamp-vti +++ b/docs/stamp-vti @@ -1,4 +1,4 @@ -@set UPDATED 1 June 2002 +@set UPDATED 12 June 2002 @set UPDATED-MONTH June 2002 @set EDITION 0.93 @set VERSION 0.93 diff --git a/docs/version.texi b/docs/version.texi index 71aed969f..c055f06c8 100644 --- a/docs/version.texi +++ b/docs/version.texi @@ -1,4 +1,4 @@ -@set UPDATED 1 June 2002 +@set UPDATED 12 June 2002 @set UPDATED-MONTH June 2002 @set EDITION 0.93 @set VERSION 0.93 diff --git a/grub/Makefile.am b/grub/Makefile.am index e985577ad..108cc803d 100644 --- a/grub/Makefile.am +++ b/grub/Makefile.am @@ -7,7 +7,8 @@ SERIAL_FLAGS = -DSUPPORT_SERIAL=1 endif AM_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \ - -DFSYS_FFS=1 -DFSYS_MINIX=1 $(SERIAL_FLAGS) \ + -DFSYS_FFS=1 -DFSYS_MINIX=1 -DSUPPORT_HERCULES=1 \ + $(SERIAL_FLAGS) \ -fwritable-strings -I$(top_srcdir)/stage2 \ -I$(top_srcdir)/stage1 -I$(top_srcdir)/lib diff --git a/grub/Makefile.in b/grub/Makefile.in index 7c8af1962..c191449af 100644 --- a/grub/Makefile.in +++ b/grub/Makefile.in @@ -92,7 +92,8 @@ sbin_PROGRAMS = grub @SERIAL_SPEED_SIMULATION_FALSE@SERIAL_FLAGS = -DSUPPORT_SERIAL=1 AM_CFLAGS = $(GRUB_CFLAGS) -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 \ - -DFSYS_FFS=1 -DFSYS_MINIX=1 $(SERIAL_FLAGS) \ + -DFSYS_FFS=1 -DFSYS_MINIX=1 -DSUPPORT_HERCULES=1 \ + $(SERIAL_FLAGS) \ -fwritable-strings -I$(top_srcdir)/stage2 \ -I$(top_srcdir)/stage1 -I$(top_srcdir)/lib diff --git a/grub/asmstub.c b/grub/asmstub.c index 78abe0fc8..ba6b0c4ef 100644 --- a/grub/asmstub.c +++ b/grub/asmstub.c @@ -1,7 +1,7 @@ /* asmstub.c - a version of shared_src/asm.S that works under Unix */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -61,7 +61,7 @@ int grub_stage2 (void); #include #include #include -#include +#include /* Simulated memory sizes. */ #define EXTENDED_MEMSIZE (3 * 1024 * 1024) /* 3MB */ @@ -87,6 +87,9 @@ char **device_map = 0; /* The jump buffer for exiting correctly. */ static jmp_buf env_for_exit; +/* The current color for console. */ +static int console_current_color = A_NORMAL; + /* The file descriptor for a serial device. */ static int serial_fd = -1; @@ -507,46 +510,48 @@ currticks (void) return ticks_per_csec + ticks_per_usec; } -/* low-level character I/O */ -void -console_cls (void) -{ -#ifdef HAVE_LIBCURSES - if (use_curses) - clear (); -#endif -} - - -/* returns packed values, LSB+1 is x, LSB is y */ -int -console_getxy (void) -{ - int y, x; -#ifdef HAVE_LIBCURSES - if (use_curses) - getyx (stdscr, y, x); - else -#endif - y = x = 0; - return (x << 8) | (y & 0xff); -} - - -void -console_gotoxy (int x, int y) -{ -#ifdef HAVE_LIBCURSES - if (use_curses) - move (y, x); -#endif -} - /* displays an ASCII character. IBM displays will translate some characters to special graphical ones */ void console_putchar (int c) { + /* Curses doesn't have VGA fonts. */ + switch (c) + { + case DISP_UL: + c = ACS_ULCORNER; + break; + case DISP_UR: + c = ACS_URCORNER; + break; + case DISP_LL: + c = ACS_LLCORNER; + break; + case DISP_LR: + c = ACS_LRCORNER; + break; + case DISP_HORIZ: + c = ACS_HLINE; + break; + case DISP_VERT: + c = ACS_VLINE; + break; + case DISP_LEFT: + c = ACS_LARROW; + break; + case DISP_RIGHT: + c = ACS_RARROW; + break; + case DISP_UP: + c = ACS_UARROW; + break; + case DISP_DOWN: + c = ACS_DARROW; + break; + default: + break; + } + #ifdef HAVE_LIBCURSES if (use_curses) { @@ -562,13 +567,26 @@ console_putchar (int c) else move (y + 1, x); } + else if (isprint (c)) + { + int x, y; + + getyx (stdscr, y, x); + if (x + 1 == COLS) + { + console_putchar ('\r'); + console_putchar ('\n'); + } + addch (c | console_current_color); + } else { addch (c); -#ifdef REFRESH_IMMEDIATELY - refresh (); -#endif } + +#ifdef REFRESH_IMMEDIATELY + refresh (); +#endif } else #endif @@ -579,7 +597,6 @@ console_putchar (int c) } } - /* The store for ungetch simulation. This is necessary, because ncurses-1.9.9g is still used in the world and its ungetch is completely broken. */ @@ -587,38 +604,34 @@ console_putchar (int c) static int save_char = ERR; #endif -/* returns packed BIOS/ASCII code */ -int -console_getkey (void) +static int +console_translate_key (int c) { - int c; - -#ifdef HAVE_LIBCURSES - if (use_curses) + switch (c) { - /* If checkkey has already got a character, then return it. */ - if (save_char != ERR) - { - c = save_char; - save_char = ERR; - return c; - } - - wtimeout (stdscr, -1); - c = getch (); - wtimeout (stdscr, 100); + case KEY_LEFT: + return 2; + case KEY_RIGHT: + return 6; + case KEY_UP: + return 16; + case KEY_DOWN: + return 14; + case KEY_DC: + return 4; + case KEY_BACKSPACE: + return 8; + case KEY_HOME: + return 1; + case KEY_END: + return 5; + default: + break; } - else -#endif - c = getchar (); - /* Quit if we get EOF. */ - if (c == -1) - stop (); return c; } - /* like 'getkey', but doesn't wait, returns -1 if nothing available */ int console_checkkey (void) @@ -637,7 +650,7 @@ console_checkkey (void) /* If C is not ERR, then put it back in the input queue. */ if (c != ERR) save_char = c; - return c; + return console_translate_key (c); } #endif @@ -646,23 +659,87 @@ console_checkkey (void) return ' '; } - -/* sets text mode character attribute at the cursor position */ -void -console_set_attrib (int attr) +/* returns packed BIOS/ASCII code */ +int +console_getkey (void) { + int c; + #ifdef HAVE_LIBCURSES if (use_curses) { - /* FIXME: I don't know why, but chgat doesn't work as expected, so - use this dirty way... - okuji */ - chtype ch = inch (); - addch ((ch & A_CHARTEXT) | attr); -# if 0 - chgat (1, attr, 0, NULL); -# endif + /* If checkkey has already got a character, then return it. */ + if (save_char != ERR) + { + c = save_char; + save_char = ERR; + return console_translate_key (c); + } + + wtimeout (stdscr, -1); + c = getch (); + wtimeout (stdscr, 100); } + else #endif + c = getchar (); + + /* Quit if we get EOF. */ + if (c == -1) + stop (); + + return console_translate_key (c); +} + +/* returns packed values, LSB+1 is x, LSB is y */ +int +console_getxy (void) +{ + int y, x; +#ifdef HAVE_LIBCURSES + if (use_curses) + getyx (stdscr, y, x); + else +#endif + y = x = 0; + return (x << 8) | (y & 0xff); +} + +void +console_gotoxy (int x, int y) +{ +#ifdef HAVE_LIBCURSES + if (use_curses) + move (y, x); +#endif +} + +/* low-level character I/O */ +void +console_cls (void) +{ +#ifdef HAVE_LIBCURSES + if (use_curses) + clear (); +#endif +} + +void +console_highlight (int state) +{ + console_current_color = state ? A_REVERSE : A_NORMAL; +} + +void +console_setcolor (int normal_color, int highlight_color) +{ + /* Nothing to do. */ +} + +void +console_nocursor (void) +{ + /* Nothing to do. */ } /* Low-level disk I/O. Our stubbed version just returns a file @@ -923,71 +1000,50 @@ stop_floppy (void) /* NOTUSED */ } -/* The serial version of getkey. */ +/* Fetch a key from a serial device. */ int -serial_getkey (void) -{ - char c; -#ifdef SIMULATE_SLOWNESS_OF_SERIAL - struct timeval otv, tv; - - gettimeofday (&otv, 0); -#endif /* SIMULATE_SLOWNESS_OF_SERIAL */ - - if (nread (serial_fd, &c, 1) != 1) - stop (); - -#ifdef SIMULATE_SLOWNESS_OF_SERIAL - while (1) - { - long delta; - - gettimeofday (&tv, 0); - delta = tv.tv_usec - otv.tv_usec; - if (delta < 0) - delta += 1000000; - - if (delta >= 1000000 / (serial_speed >> 3)) - break; - } -#endif /* SIMULATE_SLOWNESS_OF_SERIAL */ - - return c; -} - -/* The serial version of checkkey. */ -int -serial_checkkey (void) +serial_hw_fetch (void) { fd_set fds; struct timeval to; + char c; /* Wait only for the serial device. */ FD_ZERO (&fds); FD_SET (serial_fd, &fds); - /* Set the timeout to 100ms. */ to.tv_sec = 0; - to.tv_usec = 100000; + to.tv_usec = 0; - return select (serial_fd + 1, &fds, 0, 0, &to) > 0 ? : -1; + if (select (serial_fd + 1, &fds, 0, 0, &to) > 0) + { + if (nread (serial_fd, &c, 1) != 1) + stop (); + + return c; + } + + return -1; } -/* The serial version of grub_putchar. */ +/* Put a character to a serial device. */ void -serial_putchar (int c) +serial_hw_put (int c) { char ch = (char) c; -#ifdef SIMULATE_SLOWNESS_OF_SERIAL - struct timeval otv, tv; - - gettimeofday (&otv, 0); -#endif /* SIMULATE_SLOWNESS_OF_SERIAL */ if (nwrite (serial_fd, &ch, 1) != 1) stop (); - +} + +void +serial_hw_delay (void) +{ #ifdef SIMULATE_SLOWNESS_OF_SERIAL + struct timeval otv, tv; + + gettimeofday (&otv, 0); + while (1) { long delta; @@ -1027,25 +1083,19 @@ get_termios_speed (int speed) /* Get the port number of the unit UNIT. In the grub shell, this doesn't make sense. */ unsigned short -serial_get_port (int unit) +serial_hw_get_port (int unit) { return 0; } -/* Check if a serial port is set up. */ -int -serial_exists (void) -{ - return serial_fd >= 0; -} - /* Initialize a serial device. In the grub shell, PORT is unused. */ int -serial_init (unsigned short port, unsigned int speed, - int word_len, int parity, int stop_bit_len) +serial_hw_init (unsigned short port, unsigned int speed, + int word_len, int parity, int stop_bit_len) { struct termios termios; speed_t termios_speed; + int i; /* Check if the file name is specified. */ if (! serial_device) @@ -1142,6 +1192,16 @@ serial_init (unsigned short port, unsigned int speed, #ifdef SIMULATE_SLOWNESS_OF_SERIAL serial_speed = speed; #endif /* SIMUATE_SLOWNESS_OF_SERIAL */ + + /* Get rid of the flag TERM_NEED_INIT from the serial terminal. */ + for (i = 0; term_table[i].name; i++) + { + if (strcmp (term_table[i].name, "serial") == 0) + { + term_table[i].flags &= ~(TERM_NEED_INIT); + break; + } + } return 1; @@ -1154,7 +1214,7 @@ serial_init (unsigned short port, unsigned int speed, /* Set the file name of a serial device (or a pty device). This is a function specific to the grub shell. */ void -set_serial_device (const char *device) +serial_set_device (const char *device) { if (serial_device) free (serial_device); @@ -1164,31 +1224,43 @@ set_serial_device (const char *device) /* There is no difference between console and hercules in the grub shell. */ void -herc_cls (void) +hercules_putchar (int c) { - console_cls (); + console_putchar (c); } int -herc_getxy (void) +hercules_getxy (void) { return console_getxy (); } void -herc_gotoxy (int x, int y) +hercules_gotoxy (int x, int y) { console_gotoxy (x, y); } void -herc_putchar (int c) +hercules_cls (void) { - console_putchar (c); + console_cls (); } void -herc_set_attrib (int attr) +hercules_highlight (int state) { - console_set_attrib (attr); + console_highlight (state); +} + +void +hercules_setcolor (int normal_color, int highlight_color) +{ + console_setcolor (normal_color, highlight_color); +} + +void +hercules_nocursor (void) +{ + console_nocursor (); } diff --git a/grub/main.c b/grub/main.c index 7b3fa8bc0..dfe847e98 100644 --- a/grub/main.c +++ b/grub/main.c @@ -30,7 +30,8 @@ int grub_stage2 (void); #include #define WITHOUT_LIBC_STUBS 1 -#include "shared.h" +#include +#include char *program_name = 0; int use_config_file = 1; @@ -256,8 +257,8 @@ main (int argc, char **argv) /* If we don't have curses (!HAVE_LIBCURSES or --no-curses or --batch) put terminal to dumb for better handling of line i/o */ - if (!use_curses) - terminal |= TERMINAL_DUMB; + if (! use_curses) + current_term->flags = TERM_NO_EDIT | TERM_DUMB; /* Transfer control to the stage2 simulator. */ exit (grub_stage2 ()); diff --git a/stage2/Makefile.am b/stage2/Makefile.am index bb17f5b00..7b0c13f35 100644 --- a/stage2/Makefile.am +++ b/stage2/Makefile.am @@ -5,8 +5,9 @@ noinst_SCRIPTS = $(TESTS) # For dist target. noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \ - imgact_aout.h jfs.h mb_header.h mb_info.h md5.h pc_slice.h \ - serial.h shared.h smp-imps.h nbi.h vstafs.h xfs.h + imgact_aout.h jfs.h mb_header.h mb_info.h md5.h nbi.h \ + pc_slice.h serial.h shared.h smp-imps.h term.h nbi.h vstafs.h \ + xfs.h EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS) # For . @@ -14,10 +15,10 @@ INCLUDES = -I$(top_srcdir)/stage1 # The library for /sbin/grub. noinst_LIBRARIES = libgrub.a -libgrub_a_SOURCES = boot.c builtins.c common.c char_io.c cmdline.c \ - disk_io.c gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c \ - fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_vstafs.c \ - fsys_xfs.c stage2.c md5.c +libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \ + disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_jfs.c \ + fsys_minix.c fsys_reiserfs.c fsys_vstafs.c fsys_xfs.c gunzip.c \ + md5.c serial.c stage2.c libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 -DFSYS_VSTAFS=1 \ @@ -81,11 +82,11 @@ STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 # For stage2 target. -pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c common.c \ - char_io.c cmdline.c disk_io.c gunzip.c fsys_ext2fs.c \ +pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \ + cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \ fsys_fat.c fsys_ffs.c fsys_jfs.c fsys_minix.c fsys_reiserfs.c \ - fsys_vstafs.c fsys_xfs.c hercules.c serial.c smp-imps.c \ - stage2.c md5.c + fsys_vstafs.c fsys_xfs.c gunzip.c hercules.c md5.c serial.c \ + smp-imps.c stage2.c pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) pre_stage2_exec_ASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) diff --git a/stage2/Makefile.in b/stage2/Makefile.in index 079dc2d0a..e70f05bf1 100644 --- a/stage2/Makefile.in +++ b/stage2/Makefile.in @@ -96,8 +96,9 @@ noinst_SCRIPTS = $(TESTS) # For dist target. noinst_HEADERS = apic.h defs.h dir.h disk_inode.h disk_inode_ffs.h \ fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \ - imgact_aout.h jfs.h mb_header.h mb_info.h md5.h pc_slice.h \ - serial.h shared.h smp-imps.h nbi.h vstafs.h xfs.h + imgact_aout.h jfs.h mb_header.h mb_info.h md5.h nbi.h \ + pc_slice.h serial.h shared.h smp-imps.h term.h nbi.h vstafs.h \ + xfs.h EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS) @@ -106,10 +107,10 @@ INCLUDES = -I$(top_srcdir)/stage1 # The library for /sbin/grub. noinst_LIBRARIES = libgrub.a -libgrub_a_SOURCES = boot.c builtins.c common.c char_io.c cmdline.c \ - disk_io.c gunzip.c fsys_ffs.c fsys_ext2fs.c fsys_fat.c \ - fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_vstafs.c \ - fsys_xfs.c stage2.c md5.c +libgrub_a_SOURCES = boot.c builtins.c char_io.c cmdline.c common.c \ + disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_jfs.c \ + fsys_minix.c fsys_reiserfs.c fsys_vstafs.c fsys_xfs.c gunzip.c \ + md5.c serial.c stage2.c libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \ -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ @@ -165,11 +166,11 @@ STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 # For stage2 target. -pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c common.c \ - char_io.c cmdline.c disk_io.c gunzip.c fsys_ext2fs.c \ +pre_stage2_exec_SOURCES = asm.S bios.c boot.c builtins.c char_io.c \ + cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \ fsys_fat.c fsys_ffs.c fsys_jfs.c fsys_minix.c fsys_reiserfs.c \ - fsys_vstafs.c fsys_xfs.c hercules.c serial.c smp-imps.c \ - stage2.c md5.c + fsys_vstafs.c fsys_xfs.c gunzip.c hercules.c md5.c serial.c \ + smp-imps.c stage2.c pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) pre_stage2_exec_ASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) @@ -311,15 +312,15 @@ LIBRARIES = $(noinst_LIBRARIES) libgrub_a_AR = $(AR) cru libgrub_a_LIBADD = am_libgrub_a_OBJECTS = libgrub_a-boot.$(OBJEXT) \ - libgrub_a-builtins.$(OBJEXT) libgrub_a-common.$(OBJEXT) \ - libgrub_a-char_io.$(OBJEXT) libgrub_a-cmdline.$(OBJEXT) \ - libgrub_a-disk_io.$(OBJEXT) libgrub_a-gunzip.$(OBJEXT) \ - libgrub_a-fsys_ffs.$(OBJEXT) libgrub_a-fsys_ext2fs.$(OBJEXT) \ - libgrub_a-fsys_fat.$(OBJEXT) libgrub_a-fsys_jfs.$(OBJEXT) \ - libgrub_a-fsys_minix.$(OBJEXT) \ + libgrub_a-builtins.$(OBJEXT) libgrub_a-char_io.$(OBJEXT) \ + libgrub_a-cmdline.$(OBJEXT) libgrub_a-common.$(OBJEXT) \ + libgrub_a-disk_io.$(OBJEXT) libgrub_a-fsys_ext2fs.$(OBJEXT) \ + libgrub_a-fsys_fat.$(OBJEXT) libgrub_a-fsys_ffs.$(OBJEXT) \ + libgrub_a-fsys_jfs.$(OBJEXT) libgrub_a-fsys_minix.$(OBJEXT) \ libgrub_a-fsys_reiserfs.$(OBJEXT) \ libgrub_a-fsys_vstafs.$(OBJEXT) libgrub_a-fsys_xfs.$(OBJEXT) \ - libgrub_a-stage2.$(OBJEXT) libgrub_a-md5.$(OBJEXT) + libgrub_a-gunzip.$(OBJEXT) libgrub_a-md5.$(OBJEXT) \ + libgrub_a-serial.$(OBJEXT) libgrub_a-stage2.$(OBJEXT) libgrub_a_OBJECTS = $(am_libgrub_a_OBJECTS) EXTRA_PROGRAMS = nbloader.exec$(EXEEXT) pxeloader.exec$(EXEEXT) \ diskless.exec$(EXEEXT) @@ -350,9 +351,10 @@ PROGRAMS = $(noinst_PROGRAMS) am_diskless_exec_OBJECTS = diskless_exec-asm.$(OBJEXT) \ diskless_exec-bios.$(OBJEXT) diskless_exec-boot.$(OBJEXT) \ - diskless_exec-builtins.$(OBJEXT) diskless_exec-common.$(OBJEXT) \ + diskless_exec-builtins.$(OBJEXT) \ diskless_exec-char_io.$(OBJEXT) diskless_exec-cmdline.$(OBJEXT) \ - diskless_exec-disk_io.$(OBJEXT) diskless_exec-gunzip.$(OBJEXT) \ + diskless_exec-common.$(OBJEXT) diskless_exec-console.$(OBJEXT) \ + diskless_exec-disk_io.$(OBJEXT) \ diskless_exec-fsys_ext2fs.$(OBJEXT) \ diskless_exec-fsys_fat.$(OBJEXT) \ diskless_exec-fsys_ffs.$(OBJEXT) \ @@ -360,10 +362,10 @@ am_diskless_exec_OBJECTS = diskless_exec-asm.$(OBJEXT) \ diskless_exec-fsys_minix.$(OBJEXT) \ diskless_exec-fsys_reiserfs.$(OBJEXT) \ diskless_exec-fsys_vstafs.$(OBJEXT) \ - diskless_exec-fsys_xfs.$(OBJEXT) \ - diskless_exec-hercules.$(OBJEXT) diskless_exec-serial.$(OBJEXT) \ - diskless_exec-smp-imps.$(OBJEXT) diskless_exec-stage2.$(OBJEXT) \ - diskless_exec-md5.$(OBJEXT) + diskless_exec-fsys_xfs.$(OBJEXT) diskless_exec-gunzip.$(OBJEXT) \ + diskless_exec-hercules.$(OBJEXT) diskless_exec-md5.$(OBJEXT) \ + diskless_exec-serial.$(OBJEXT) diskless_exec-smp-imps.$(OBJEXT) \ + diskless_exec-stage2.$(OBJEXT) diskless_exec_OBJECTS = $(am_diskless_exec_OBJECTS) diskless_exec_DEPENDENCIES = ../netboot/libdrivers.a am_e2fs_stage1_5_exec_OBJECTS = e2fs_stage1_5_exec-start.$(OBJEXT) \ @@ -428,11 +430,11 @@ nbloader_exec_DEPENDENCIES = am_pre_stage2_exec_OBJECTS = pre_stage2_exec-asm.$(OBJEXT) \ pre_stage2_exec-bios.$(OBJEXT) pre_stage2_exec-boot.$(OBJEXT) \ pre_stage2_exec-builtins.$(OBJEXT) \ - pre_stage2_exec-common.$(OBJEXT) \ pre_stage2_exec-char_io.$(OBJEXT) \ pre_stage2_exec-cmdline.$(OBJEXT) \ + pre_stage2_exec-common.$(OBJEXT) \ + pre_stage2_exec-console.$(OBJEXT) \ pre_stage2_exec-disk_io.$(OBJEXT) \ - pre_stage2_exec-gunzip.$(OBJEXT) \ pre_stage2_exec-fsys_ext2fs.$(OBJEXT) \ pre_stage2_exec-fsys_fat.$(OBJEXT) \ pre_stage2_exec-fsys_ffs.$(OBJEXT) \ @@ -441,10 +443,11 @@ am_pre_stage2_exec_OBJECTS = pre_stage2_exec-asm.$(OBJEXT) \ pre_stage2_exec-fsys_reiserfs.$(OBJEXT) \ pre_stage2_exec-fsys_vstafs.$(OBJEXT) \ pre_stage2_exec-fsys_xfs.$(OBJEXT) \ + pre_stage2_exec-gunzip.$(OBJEXT) \ pre_stage2_exec-hercules.$(OBJEXT) \ - pre_stage2_exec-serial.$(OBJEXT) \ + pre_stage2_exec-md5.$(OBJEXT) pre_stage2_exec-serial.$(OBJEXT) \ pre_stage2_exec-smp-imps.$(OBJEXT) \ - pre_stage2_exec-stage2.$(OBJEXT) pre_stage2_exec-md5.$(OBJEXT) + pre_stage2_exec-stage2.$(OBJEXT) pre_stage2_exec_OBJECTS = $(am_pre_stage2_exec_OBJECTS) @NETBOOT_SUPPORT_TRUE@pre_stage2_exec_DEPENDENCIES = \ @NETBOOT_SUPPORT_TRUE@ ../netboot/libdrivers.a @@ -506,6 +509,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp @AMDEP_TRUE@ $(DEPDIR)/diskless_exec-char_io.Po \ @AMDEP_TRUE@ $(DEPDIR)/diskless_exec-cmdline.Po \ @AMDEP_TRUE@ $(DEPDIR)/diskless_exec-common.Po \ +@AMDEP_TRUE@ $(DEPDIR)/diskless_exec-console.Po \ @AMDEP_TRUE@ $(DEPDIR)/diskless_exec-disk_io.Po \ @AMDEP_TRUE@ $(DEPDIR)/diskless_exec-fsys_ext2fs.Po \ @AMDEP_TRUE@ $(DEPDIR)/diskless_exec-fsys_fat.Po \ @@ -561,6 +565,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp @AMDEP_TRUE@ $(DEPDIR)/libgrub_a-fsys_xfs.Po \ @AMDEP_TRUE@ $(DEPDIR)/libgrub_a-gunzip.Po \ @AMDEP_TRUE@ $(DEPDIR)/libgrub_a-md5.Po \ +@AMDEP_TRUE@ $(DEPDIR)/libgrub_a-serial.Po \ @AMDEP_TRUE@ $(DEPDIR)/libgrub_a-stage2.Po \ @AMDEP_TRUE@ $(DEPDIR)/minix_stage1_5_exec-bios.Po \ @AMDEP_TRUE@ $(DEPDIR)/minix_stage1_5_exec-char_io.Po \ @@ -574,6 +579,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp @AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-char_io.Po \ @AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-cmdline.Po \ @AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-common.Po \ +@AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-console.Po \ @AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-disk_io.Po \ @AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Po \ @AMDEP_TRUE@ $(DEPDIR)/pre_stage2_exec-fsys_fat.Po \ @@ -646,21 +652,22 @@ clean-noinstLIBRARIES: -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) libgrub_a-boot.$(OBJEXT): boot.c libgrub_a-builtins.$(OBJEXT): builtins.c -libgrub_a-common.$(OBJEXT): common.c libgrub_a-char_io.$(OBJEXT): char_io.c libgrub_a-cmdline.$(OBJEXT): cmdline.c +libgrub_a-common.$(OBJEXT): common.c libgrub_a-disk_io.$(OBJEXT): disk_io.c -libgrub_a-gunzip.$(OBJEXT): gunzip.c -libgrub_a-fsys_ffs.$(OBJEXT): fsys_ffs.c libgrub_a-fsys_ext2fs.$(OBJEXT): fsys_ext2fs.c libgrub_a-fsys_fat.$(OBJEXT): fsys_fat.c +libgrub_a-fsys_ffs.$(OBJEXT): fsys_ffs.c libgrub_a-fsys_jfs.$(OBJEXT): fsys_jfs.c libgrub_a-fsys_minix.$(OBJEXT): fsys_minix.c libgrub_a-fsys_reiserfs.$(OBJEXT): fsys_reiserfs.c libgrub_a-fsys_vstafs.$(OBJEXT): fsys_vstafs.c libgrub_a-fsys_xfs.$(OBJEXT): fsys_xfs.c -libgrub_a-stage2.$(OBJEXT): stage2.c +libgrub_a-gunzip.$(OBJEXT): gunzip.c libgrub_a-md5.$(OBJEXT): md5.c +libgrub_a-serial.$(OBJEXT): serial.c +libgrub_a-stage2.$(OBJEXT): stage2.c libgrub.a: $(libgrub_a_OBJECTS) $(libgrub_a_DEPENDENCIES) -rm -f libgrub.a $(libgrub_a_AR) libgrub.a $(libgrub_a_OBJECTS) $(libgrub_a_LIBADD) @@ -672,11 +679,11 @@ diskless_exec-asm.$(OBJEXT): asm.S diskless_exec-bios.$(OBJEXT): bios.c diskless_exec-boot.$(OBJEXT): boot.c diskless_exec-builtins.$(OBJEXT): builtins.c -diskless_exec-common.$(OBJEXT): common.c diskless_exec-char_io.$(OBJEXT): char_io.c diskless_exec-cmdline.$(OBJEXT): cmdline.c +diskless_exec-common.$(OBJEXT): common.c +diskless_exec-console.$(OBJEXT): console.c diskless_exec-disk_io.$(OBJEXT): disk_io.c -diskless_exec-gunzip.$(OBJEXT): gunzip.c diskless_exec-fsys_ext2fs.$(OBJEXT): fsys_ext2fs.c diskless_exec-fsys_fat.$(OBJEXT): fsys_fat.c diskless_exec-fsys_ffs.$(OBJEXT): fsys_ffs.c @@ -685,11 +692,12 @@ diskless_exec-fsys_minix.$(OBJEXT): fsys_minix.c diskless_exec-fsys_reiserfs.$(OBJEXT): fsys_reiserfs.c diskless_exec-fsys_vstafs.$(OBJEXT): fsys_vstafs.c diskless_exec-fsys_xfs.$(OBJEXT): fsys_xfs.c +diskless_exec-gunzip.$(OBJEXT): gunzip.c diskless_exec-hercules.$(OBJEXT): hercules.c +diskless_exec-md5.$(OBJEXT): md5.c diskless_exec-serial.$(OBJEXT): serial.c diskless_exec-smp-imps.$(OBJEXT): smp-imps.c diskless_exec-stage2.$(OBJEXT): stage2.c -diskless_exec-md5.$(OBJEXT): md5.c diskless.exec$(EXEEXT): $(diskless_exec_OBJECTS) $(diskless_exec_DEPENDENCIES) @rm -f diskless.exec$(EXEEXT) $(LINK) $(diskless_exec_LDFLAGS) $(diskless_exec_OBJECTS) $(diskless_exec_LDADD) $(LIBS) @@ -756,11 +764,11 @@ pre_stage2_exec-asm.$(OBJEXT): asm.S pre_stage2_exec-bios.$(OBJEXT): bios.c pre_stage2_exec-boot.$(OBJEXT): boot.c pre_stage2_exec-builtins.$(OBJEXT): builtins.c -pre_stage2_exec-common.$(OBJEXT): common.c pre_stage2_exec-char_io.$(OBJEXT): char_io.c pre_stage2_exec-cmdline.$(OBJEXT): cmdline.c +pre_stage2_exec-common.$(OBJEXT): common.c +pre_stage2_exec-console.$(OBJEXT): console.c pre_stage2_exec-disk_io.$(OBJEXT): disk_io.c -pre_stage2_exec-gunzip.$(OBJEXT): gunzip.c pre_stage2_exec-fsys_ext2fs.$(OBJEXT): fsys_ext2fs.c pre_stage2_exec-fsys_fat.$(OBJEXT): fsys_fat.c pre_stage2_exec-fsys_ffs.$(OBJEXT): fsys_ffs.c @@ -769,11 +777,12 @@ pre_stage2_exec-fsys_minix.$(OBJEXT): fsys_minix.c pre_stage2_exec-fsys_reiserfs.$(OBJEXT): fsys_reiserfs.c pre_stage2_exec-fsys_vstafs.$(OBJEXT): fsys_vstafs.c pre_stage2_exec-fsys_xfs.$(OBJEXT): fsys_xfs.c +pre_stage2_exec-gunzip.$(OBJEXT): gunzip.c pre_stage2_exec-hercules.$(OBJEXT): hercules.c +pre_stage2_exec-md5.$(OBJEXT): md5.c pre_stage2_exec-serial.$(OBJEXT): serial.c pre_stage2_exec-smp-imps.$(OBJEXT): smp-imps.c pre_stage2_exec-stage2.$(OBJEXT): stage2.c -pre_stage2_exec-md5.$(OBJEXT): md5.c pre_stage2.exec$(EXEEXT): $(pre_stage2_exec_OBJECTS) $(pre_stage2_exec_DEPENDENCIES) @rm -f pre_stage2.exec$(EXEEXT) $(LINK) $(pre_stage2_exec_LDFLAGS) $(pre_stage2_exec_OBJECTS) $(pre_stage2_exec_LDADD) $(LIBS) @@ -831,6 +840,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-char_io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-cmdline.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-console.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-disk_io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-fsys_ext2fs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/diskless_exec-fsys_fat.Po@am__quote@ @@ -886,6 +896,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgrub_a-fsys_xfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgrub_a-gunzip.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgrub_a-md5.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgrub_a-serial.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/libgrub_a-stage2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/minix_stage1_5_exec-bios.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/minix_stage1_5_exec-char_io.Po@am__quote@ @@ -899,6 +910,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-char_io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-cmdline.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-console.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-disk_io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@$(DEPDIR)/pre_stage2_exec-fsys_fat.Po@am__quote@ @@ -1104,18 +1116,6 @@ libgrub_a-builtins.obj: builtins.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-builtins.obj `cygpath -w builtins.c` -libgrub_a-common.o: common.c -@AMDEP_TRUE@ source='common.c' object='libgrub_a-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-common.Po' tmpdepfile='$(DEPDIR)/libgrub_a-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-common.o `test -f common.c || echo '$(srcdir)/'`common.c - -libgrub_a-common.obj: common.c -@AMDEP_TRUE@ source='common.c' object='libgrub_a-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-common.Po' tmpdepfile='$(DEPDIR)/libgrub_a-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-common.obj `cygpath -w common.c` - libgrub_a-char_io.o: char_io.c @AMDEP_TRUE@ source='char_io.c' object='libgrub_a-char_io.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-char_io.Po' tmpdepfile='$(DEPDIR)/libgrub_a-char_io.TPo' @AMDEPBACKSLASH@ @@ -1140,6 +1140,18 @@ libgrub_a-cmdline.obj: cmdline.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-cmdline.obj `cygpath -w cmdline.c` +libgrub_a-common.o: common.c +@AMDEP_TRUE@ source='common.c' object='libgrub_a-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-common.Po' tmpdepfile='$(DEPDIR)/libgrub_a-common.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-common.o `test -f common.c || echo '$(srcdir)/'`common.c + +libgrub_a-common.obj: common.c +@AMDEP_TRUE@ source='common.c' object='libgrub_a-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-common.Po' tmpdepfile='$(DEPDIR)/libgrub_a-common.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-common.obj `cygpath -w common.c` + libgrub_a-disk_io.o: disk_io.c @AMDEP_TRUE@ source='disk_io.c' object='libgrub_a-disk_io.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-disk_io.Po' tmpdepfile='$(DEPDIR)/libgrub_a-disk_io.TPo' @AMDEPBACKSLASH@ @@ -1152,30 +1164,6 @@ libgrub_a-disk_io.obj: disk_io.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-disk_io.obj `cygpath -w disk_io.c` -libgrub_a-gunzip.o: gunzip.c -@AMDEP_TRUE@ source='gunzip.c' object='libgrub_a-gunzip.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-gunzip.Po' tmpdepfile='$(DEPDIR)/libgrub_a-gunzip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-gunzip.o `test -f gunzip.c || echo '$(srcdir)/'`gunzip.c - -libgrub_a-gunzip.obj: gunzip.c -@AMDEP_TRUE@ source='gunzip.c' object='libgrub_a-gunzip.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-gunzip.Po' tmpdepfile='$(DEPDIR)/libgrub_a-gunzip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-gunzip.obj `cygpath -w gunzip.c` - -libgrub_a-fsys_ffs.o: fsys_ffs.c -@AMDEP_TRUE@ source='fsys_ffs.c' object='libgrub_a-fsys_ffs.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ffs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ffs.o `test -f fsys_ffs.c || echo '$(srcdir)/'`fsys_ffs.c - -libgrub_a-fsys_ffs.obj: fsys_ffs.c -@AMDEP_TRUE@ source='fsys_ffs.c' object='libgrub_a-fsys_ffs.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ffs.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ffs.obj `cygpath -w fsys_ffs.c` - libgrub_a-fsys_ext2fs.o: fsys_ext2fs.c @AMDEP_TRUE@ source='fsys_ext2fs.c' object='libgrub_a-fsys_ext2fs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-fsys_ext2fs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ext2fs.TPo' @AMDEPBACKSLASH@ @@ -1200,6 +1188,18 @@ libgrub_a-fsys_fat.obj: fsys_fat.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_fat.obj `cygpath -w fsys_fat.c` +libgrub_a-fsys_ffs.o: fsys_ffs.c +@AMDEP_TRUE@ source='fsys_ffs.c' object='libgrub_a-fsys_ffs.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ffs.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ffs.o `test -f fsys_ffs.c || echo '$(srcdir)/'`fsys_ffs.c + +libgrub_a-fsys_ffs.obj: fsys_ffs.c +@AMDEP_TRUE@ source='fsys_ffs.c' object='libgrub_a-fsys_ffs.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-fsys_ffs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_ffs.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_ffs.obj `cygpath -w fsys_ffs.c` + libgrub_a-fsys_jfs.o: fsys_jfs.c @AMDEP_TRUE@ source='fsys_jfs.c' object='libgrub_a-fsys_jfs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-fsys_jfs.Po' tmpdepfile='$(DEPDIR)/libgrub_a-fsys_jfs.TPo' @AMDEPBACKSLASH@ @@ -1260,17 +1260,17 @@ libgrub_a-fsys_xfs.obj: fsys_xfs.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-fsys_xfs.obj `cygpath -w fsys_xfs.c` -libgrub_a-stage2.o: stage2.c -@AMDEP_TRUE@ source='stage2.c' object='libgrub_a-stage2.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-stage2.Po' tmpdepfile='$(DEPDIR)/libgrub_a-stage2.TPo' @AMDEPBACKSLASH@ +libgrub_a-gunzip.o: gunzip.c +@AMDEP_TRUE@ source='gunzip.c' object='libgrub_a-gunzip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-gunzip.Po' tmpdepfile='$(DEPDIR)/libgrub_a-gunzip.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-stage2.o `test -f stage2.c || echo '$(srcdir)/'`stage2.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-gunzip.o `test -f gunzip.c || echo '$(srcdir)/'`gunzip.c -libgrub_a-stage2.obj: stage2.c -@AMDEP_TRUE@ source='stage2.c' object='libgrub_a-stage2.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-stage2.Po' tmpdepfile='$(DEPDIR)/libgrub_a-stage2.TPo' @AMDEPBACKSLASH@ +libgrub_a-gunzip.obj: gunzip.c +@AMDEP_TRUE@ source='gunzip.c' object='libgrub_a-gunzip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-gunzip.Po' tmpdepfile='$(DEPDIR)/libgrub_a-gunzip.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-stage2.obj `cygpath -w stage2.c` + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-gunzip.obj `cygpath -w gunzip.c` libgrub_a-md5.o: md5.c @AMDEP_TRUE@ source='md5.c' object='libgrub_a-md5.o' libtool=no @AMDEPBACKSLASH@ @@ -1284,6 +1284,30 @@ libgrub_a-md5.obj: md5.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-md5.obj `cygpath -w md5.c` +libgrub_a-serial.o: serial.c +@AMDEP_TRUE@ source='serial.c' object='libgrub_a-serial.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-serial.Po' tmpdepfile='$(DEPDIR)/libgrub_a-serial.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-serial.o `test -f serial.c || echo '$(srcdir)/'`serial.c + +libgrub_a-serial.obj: serial.c +@AMDEP_TRUE@ source='serial.c' object='libgrub_a-serial.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-serial.Po' tmpdepfile='$(DEPDIR)/libgrub_a-serial.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-serial.obj `cygpath -w serial.c` + +libgrub_a-stage2.o: stage2.c +@AMDEP_TRUE@ source='stage2.c' object='libgrub_a-stage2.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-stage2.Po' tmpdepfile='$(DEPDIR)/libgrub_a-stage2.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-stage2.o `test -f stage2.c || echo '$(srcdir)/'`stage2.c + +libgrub_a-stage2.obj: stage2.c +@AMDEP_TRUE@ source='stage2.c' object='libgrub_a-stage2.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/libgrub_a-stage2.Po' tmpdepfile='$(DEPDIR)/libgrub_a-stage2.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgrub_a_CFLAGS) $(CFLAGS) -c -o libgrub_a-stage2.obj `cygpath -w stage2.c` + diskless_exec-bios.o: bios.c @AMDEP_TRUE@ source='bios.c' object='diskless_exec-bios.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-bios.Po' tmpdepfile='$(DEPDIR)/diskless_exec-bios.TPo' @AMDEPBACKSLASH@ @@ -1320,18 +1344,6 @@ diskless_exec-builtins.obj: builtins.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-builtins.obj `cygpath -w builtins.c` -diskless_exec-common.o: common.c -@AMDEP_TRUE@ source='common.c' object='diskless_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-common.Po' tmpdepfile='$(DEPDIR)/diskless_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-common.o `test -f common.c || echo '$(srcdir)/'`common.c - -diskless_exec-common.obj: common.c -@AMDEP_TRUE@ source='common.c' object='diskless_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-common.Po' tmpdepfile='$(DEPDIR)/diskless_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-common.obj `cygpath -w common.c` - diskless_exec-char_io.o: char_io.c @AMDEP_TRUE@ source='char_io.c' object='diskless_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-char_io.Po' tmpdepfile='$(DEPDIR)/diskless_exec-char_io.TPo' @AMDEPBACKSLASH@ @@ -1356,6 +1368,30 @@ diskless_exec-cmdline.obj: cmdline.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-cmdline.obj `cygpath -w cmdline.c` +diskless_exec-common.o: common.c +@AMDEP_TRUE@ source='common.c' object='diskless_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-common.Po' tmpdepfile='$(DEPDIR)/diskless_exec-common.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-common.o `test -f common.c || echo '$(srcdir)/'`common.c + +diskless_exec-common.obj: common.c +@AMDEP_TRUE@ source='common.c' object='diskless_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-common.Po' tmpdepfile='$(DEPDIR)/diskless_exec-common.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-common.obj `cygpath -w common.c` + +diskless_exec-console.o: console.c +@AMDEP_TRUE@ source='console.c' object='diskless_exec-console.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-console.Po' tmpdepfile='$(DEPDIR)/diskless_exec-console.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-console.o `test -f console.c || echo '$(srcdir)/'`console.c + +diskless_exec-console.obj: console.c +@AMDEP_TRUE@ source='console.c' object='diskless_exec-console.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-console.Po' tmpdepfile='$(DEPDIR)/diskless_exec-console.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-console.obj `cygpath -w console.c` + diskless_exec-disk_io.o: disk_io.c @AMDEP_TRUE@ source='disk_io.c' object='diskless_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/diskless_exec-disk_io.TPo' @AMDEPBACKSLASH@ @@ -1368,18 +1404,6 @@ diskless_exec-disk_io.obj: disk_io.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-disk_io.obj `cygpath -w disk_io.c` -diskless_exec-gunzip.o: gunzip.c -@AMDEP_TRUE@ source='gunzip.c' object='diskless_exec-gunzip.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/diskless_exec-gunzip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-gunzip.o `test -f gunzip.c || echo '$(srcdir)/'`gunzip.c - -diskless_exec-gunzip.obj: gunzip.c -@AMDEP_TRUE@ source='gunzip.c' object='diskless_exec-gunzip.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/diskless_exec-gunzip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-gunzip.obj `cygpath -w gunzip.c` - diskless_exec-fsys_ext2fs.o: fsys_ext2fs.c @AMDEP_TRUE@ source='fsys_ext2fs.c' object='diskless_exec-fsys_ext2fs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-fsys_ext2fs.Po' tmpdepfile='$(DEPDIR)/diskless_exec-fsys_ext2fs.TPo' @AMDEPBACKSLASH@ @@ -1476,6 +1500,18 @@ diskless_exec-fsys_xfs.obj: fsys_xfs.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-fsys_xfs.obj `cygpath -w fsys_xfs.c` +diskless_exec-gunzip.o: gunzip.c +@AMDEP_TRUE@ source='gunzip.c' object='diskless_exec-gunzip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/diskless_exec-gunzip.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-gunzip.o `test -f gunzip.c || echo '$(srcdir)/'`gunzip.c + +diskless_exec-gunzip.obj: gunzip.c +@AMDEP_TRUE@ source='gunzip.c' object='diskless_exec-gunzip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/diskless_exec-gunzip.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-gunzip.obj `cygpath -w gunzip.c` + diskless_exec-hercules.o: hercules.c @AMDEP_TRUE@ source='hercules.c' object='diskless_exec-hercules.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-hercules.Po' tmpdepfile='$(DEPDIR)/diskless_exec-hercules.TPo' @AMDEPBACKSLASH@ @@ -1488,6 +1524,18 @@ diskless_exec-hercules.obj: hercules.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-hercules.obj `cygpath -w hercules.c` +diskless_exec-md5.o: md5.c +@AMDEP_TRUE@ source='md5.c' object='diskless_exec-md5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-md5.Po' tmpdepfile='$(DEPDIR)/diskless_exec-md5.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-md5.o `test -f md5.c || echo '$(srcdir)/'`md5.c + +diskless_exec-md5.obj: md5.c +@AMDEP_TRUE@ source='md5.c' object='diskless_exec-md5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-md5.Po' tmpdepfile='$(DEPDIR)/diskless_exec-md5.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-md5.obj `cygpath -w md5.c` + diskless_exec-serial.o: serial.c @AMDEP_TRUE@ source='serial.c' object='diskless_exec-serial.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-serial.Po' tmpdepfile='$(DEPDIR)/diskless_exec-serial.TPo' @AMDEPBACKSLASH@ @@ -1524,18 +1572,6 @@ diskless_exec-stage2.obj: stage2.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-stage2.obj `cygpath -w stage2.c` -diskless_exec-md5.o: md5.c -@AMDEP_TRUE@ source='md5.c' object='diskless_exec-md5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-md5.Po' tmpdepfile='$(DEPDIR)/diskless_exec-md5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-md5.o `test -f md5.c || echo '$(srcdir)/'`md5.c - -diskless_exec-md5.obj: md5.c -@AMDEP_TRUE@ source='md5.c' object='diskless_exec-md5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/diskless_exec-md5.Po' tmpdepfile='$(DEPDIR)/diskless_exec-md5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(diskless_exec_CFLAGS) $(CFLAGS) -c -o diskless_exec-md5.obj `cygpath -w md5.c` - e2fs_stage1_5_exec-common.o: common.c @AMDEP_TRUE@ source='common.c' object='e2fs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/e2fs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/e2fs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ @@ -1932,18 +1968,6 @@ pre_stage2_exec-builtins.obj: builtins.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-builtins.obj `cygpath -w builtins.c` -pre_stage2_exec-common.o: common.c -@AMDEP_TRUE@ source='common.c' object='pre_stage2_exec-common.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-common.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-common.o `test -f common.c || echo '$(srcdir)/'`common.c - -pre_stage2_exec-common.obj: common.c -@AMDEP_TRUE@ source='common.c' object='pre_stage2_exec-common.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-common.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-common.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-common.obj `cygpath -w common.c` - pre_stage2_exec-char_io.o: char_io.c @AMDEP_TRUE@ source='char_io.c' object='pre_stage2_exec-char_io.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-char_io.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-char_io.TPo' @AMDEPBACKSLASH@ @@ -1968,6 +1992,30 @@ pre_stage2_exec-cmdline.obj: cmdline.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-cmdline.obj `cygpath -w cmdline.c` +pre_stage2_exec-common.o: common.c +@AMDEP_TRUE@ source='common.c' object='pre_stage2_exec-common.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-common.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-common.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-common.o `test -f common.c || echo '$(srcdir)/'`common.c + +pre_stage2_exec-common.obj: common.c +@AMDEP_TRUE@ source='common.c' object='pre_stage2_exec-common.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-common.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-common.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-common.obj `cygpath -w common.c` + +pre_stage2_exec-console.o: console.c +@AMDEP_TRUE@ source='console.c' object='pre_stage2_exec-console.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-console.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-console.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-console.o `test -f console.c || echo '$(srcdir)/'`console.c + +pre_stage2_exec-console.obj: console.c +@AMDEP_TRUE@ source='console.c' object='pre_stage2_exec-console.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-console.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-console.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-console.obj `cygpath -w console.c` + pre_stage2_exec-disk_io.o: disk_io.c @AMDEP_TRUE@ source='disk_io.c' object='pre_stage2_exec-disk_io.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-disk_io.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-disk_io.TPo' @AMDEPBACKSLASH@ @@ -1980,18 +2028,6 @@ pre_stage2_exec-disk_io.obj: disk_io.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-disk_io.obj `cygpath -w disk_io.c` -pre_stage2_exec-gunzip.o: gunzip.c -@AMDEP_TRUE@ source='gunzip.c' object='pre_stage2_exec-gunzip.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-gunzip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-gunzip.o `test -f gunzip.c || echo '$(srcdir)/'`gunzip.c - -pre_stage2_exec-gunzip.obj: gunzip.c -@AMDEP_TRUE@ source='gunzip.c' object='pre_stage2_exec-gunzip.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-gunzip.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-gunzip.obj `cygpath -w gunzip.c` - pre_stage2_exec-fsys_ext2fs.o: fsys_ext2fs.c @AMDEP_TRUE@ source='fsys_ext2fs.c' object='pre_stage2_exec-fsys_ext2fs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-fsys_ext2fs.TPo' @AMDEPBACKSLASH@ @@ -2088,6 +2124,18 @@ pre_stage2_exec-fsys_xfs.obj: fsys_xfs.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-fsys_xfs.obj `cygpath -w fsys_xfs.c` +pre_stage2_exec-gunzip.o: gunzip.c +@AMDEP_TRUE@ source='gunzip.c' object='pre_stage2_exec-gunzip.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-gunzip.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-gunzip.o `test -f gunzip.c || echo '$(srcdir)/'`gunzip.c + +pre_stage2_exec-gunzip.obj: gunzip.c +@AMDEP_TRUE@ source='gunzip.c' object='pre_stage2_exec-gunzip.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-gunzip.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-gunzip.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-gunzip.obj `cygpath -w gunzip.c` + pre_stage2_exec-hercules.o: hercules.c @AMDEP_TRUE@ source='hercules.c' object='pre_stage2_exec-hercules.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-hercules.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-hercules.TPo' @AMDEPBACKSLASH@ @@ -2100,6 +2148,18 @@ pre_stage2_exec-hercules.obj: hercules.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-hercules.obj `cygpath -w hercules.c` +pre_stage2_exec-md5.o: md5.c +@AMDEP_TRUE@ source='md5.c' object='pre_stage2_exec-md5.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-md5.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-md5.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-md5.o `test -f md5.c || echo '$(srcdir)/'`md5.c + +pre_stage2_exec-md5.obj: md5.c +@AMDEP_TRUE@ source='md5.c' object='pre_stage2_exec-md5.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-md5.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-md5.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-md5.obj `cygpath -w md5.c` + pre_stage2_exec-serial.o: serial.c @AMDEP_TRUE@ source='serial.c' object='pre_stage2_exec-serial.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-serial.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-serial.TPo' @AMDEPBACKSLASH@ @@ -2136,18 +2196,6 @@ pre_stage2_exec-stage2.obj: stage2.c @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-stage2.obj `cygpath -w stage2.c` -pre_stage2_exec-md5.o: md5.c -@AMDEP_TRUE@ source='md5.c' object='pre_stage2_exec-md5.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-md5.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-md5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-md5.o `test -f md5.c || echo '$(srcdir)/'`md5.c - -pre_stage2_exec-md5.obj: md5.c -@AMDEP_TRUE@ source='md5.c' object='pre_stage2_exec-md5.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/pre_stage2_exec-md5.Po' tmpdepfile='$(DEPDIR)/pre_stage2_exec-md5.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(pre_stage2_exec_CFLAGS) $(CFLAGS) -c -o pre_stage2_exec-md5.obj `cygpath -w md5.c` - reiserfs_stage1_5_exec-common.o: common.c @AMDEP_TRUE@ source='common.c' object='reiserfs_stage1_5_exec-common.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/reiserfs_stage1_5_exec-common.Po' tmpdepfile='$(DEPDIR)/reiserfs_stage1_5_exec-common.TPo' @AMDEPBACKSLASH@ diff --git a/stage2/asm.S b/stage2/asm.S index 0fc3b67fb..d2e84aa54 100644 --- a/stage2/asm.S +++ b/stage2/asm.S @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 1999,2000,2001,2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1313,41 +1313,7 @@ probe_values: # include "apm.S" #endif /* ! STAGE1_5 */ -/* - * console_putchar(c) - * - * Puts character on the screen, interpreting '\n' as in the UNIX fashion. - * - * BIOS call "INT 10H Function 0Eh" to write character to console - * Call with %ah = 0x0e - * %al = character - * %bh = page - * %bl = foreground color ( graphics modes) - */ - - -ENTRY(console_putchar) - push %ebp - push %eax - push %ebx - - movb 0x10(%esp), %bl - call EXT_C(prot_to_real) - .code16 - - movb %bl, %al - movb $0xe, %ah - movw $1, %bx - int $0x10 - - DATA32 call EXT_C(real_to_prot) - .code32 - - pop %ebx - pop %eax - pop %ebp - ret #ifndef STAGE1_5 /* get_code_end() : return the address of the end of the code @@ -1824,68 +1790,249 @@ ENTRY(multi_boot) /* error */ call EXT_C(stop) +#endif /* ! STAGE1_5 */ + +/* + * void console_putchar (int c) + * + * Put the character C on the console. Because GRUB wants to write a + * character with an attribute, this implementation is a bit tricky. + * If C is a control character (CR, LF, BEL, BS), use INT 10, AH = 0Eh + * (TELETYPE OUTPUT). Otherwise, save the original position, put a space, + * save the current position, restore the original position, write the + * character and the attribute, and restore the current position. + * + * The reason why this is so complicated is that there is no easy way to + * get the height of the screen, and the TELETYPE OUPUT BIOS call doesn't + * support setting a background attribute. + */ +ENTRY(console_putchar) + movl 0x4(%esp), %edx + pusha +#ifdef STAGE1_5 + movb $0x07, %bl +#else + movl EXT_C(console_current_color), %ebx +#endif + + call EXT_C(prot_to_real) + .code16 + movb %dl, %al + xorb %bh, %bh + +#ifndef STAGE1_5 + /* use teletype output if control character */ + cmpb $0x7, %al + je 1f + cmpb $0x8, %al + je 1f + cmpb $0xa, %al + je 1f + cmpb $0xd, %al + je 1f + + /* save the character and the attribute on the stack */ + pushw %ax + pushw %bx + + /* get the current position */ + movb $0x3, %ah + int $0x10 + + /* check the column with the width */ + cmpb $79, %dl + jl 2f + + /* print CR and LF, if next write will exceed the width */ + movw $0x0e0d, %ax + int $0x10 + movb $0x0a, %al + int $0x10 + + /* get the current position */ + movb $0x3, %ah + int $0x10 + +2: + /* restore the character and the attribute */ + popw %bx + popw %ax + + /* write the character with the attribute */ + movb $0x9, %ah + movw $1, %cx + int $0x10 + + /* move the cursor forward */ + incb %dl + movb $0x2, %ah + int $0x10 + + jmp 3f +#endif /* ! STAGE1_5 */ + +1: movb $0xe, %ah + int $0x10 + +3: DATA32 call EXT_C(real_to_prot) + .code32 + + popa + ret + + +#ifndef STAGE1_5 + +/* this table is used in translate_keycode below */ +translation_table: + .word KEY_LEFT, 2 + .word KEY_RIGHT, 6 + .word KEY_UP, 16 + .word KEY_DOWN, 14 + .word KEY_HOME, 1 + .word KEY_END, 5 + .word KEY_DC, 4 + .word KEY_BACKSPACE, 8 + .word 0 + +/* + * translate_keycode translates the key code %dx to an ascii code. + */ + .code16 + +translate_keycode: + pushw %bx + pushw %si + + movw $ABS(translation_table), %si + +1: lodsw + /* check if this is the end */ + testw %ax, %ax + jz 2f + /* load the ascii code into %ax */ + movw %ax, %bx + lodsw + /* check if this matches the key code */ + cmpw %bx, %dx + jne 1b + /* translate %dx, if successful */ + movw %ax, %dx + +2: popw %si + popw %bx + ret + + .code32 + /* - * console_cls() - * BIOS call "INT 10H Function 0Fh" to get current video mode - * Call with %ah = 0x0f - * Returns %al = (video mode) - * %bh = (page number) - * BIOS call "INT 10H Function 00h" to set the video mode (clears screen) - * Call with %ah = 0x00 - * %al = (video mode) + * remap_ascii_char remaps the ascii code %dl to another if the code is + * contained in ASCII_KEY_MAP. + */ + .code16 + +remap_ascii_char: + pushw %si + + movw $ABS(EXT_C(ascii_key_map)), %si +1: + lodsw + /* check if this is the end */ + testw %ax, %ax + jz 2f + /* check if this matches the ascii code */ + cmpb %al, %dl + jne 1b + /* if so, perform the mapping */ + movb %ah, %dl +2: + /* restore %si */ + popw %si + + ret + + .code32 + + .align 4 +ENTRY(ascii_key_map) + .space (KEY_MAP_SIZE + 1) * 2 + + +/* + * int console_getkey (void) + * BIOS call "INT 16H Function 00H" to read character from keyboard + * Call with %ah = 0x0 + * Return: %ah = keyboard scan code + * %al = ASCII character */ - -ENTRY(console_cls) +ENTRY(console_getkey) push %ebp - push %ebx /* save EBX */ call EXT_C(prot_to_real) .code16 - movb $0xf, %ah - int $0x10 /* Get Current Video mode */ - xorb %ah, %ah - int $0x10 /* Set Video mode (clears screen) */ + int $0x16 + movw %ax, %dx /* real_to_prot uses %eax */ + call translate_keycode + call remap_ascii_char + DATA32 call EXT_C(real_to_prot) .code32 - pop %ebx + movw %dx, %ax + + pop %ebp + ret + + +/* + * int console_checkkey (void) + * if there is a character pending, return it; otherwise return -1 + * BIOS call "INT 16H Function 01H" to check whether a character is pending + * Call with %ah = 0x1 + * Return: + * If key waiting to be input: + * %ah = keyboard scan code + * %al = ASCII character + * Zero flag = clear + * else + * Zero flag = set + */ +ENTRY(console_checkkey) + push %ebp + xorl %edx, %edx + + call EXT_C(prot_to_real) /* enter real mode */ + .code16 + + movb $0x1, %ah + int $0x16 + + DATA32 jz notpending + + movw %ax, %dx + call translate_keycode + call remap_ascii_char + DATA32 jmp pending + +notpending: + movl $0xFFFFFFFF, %edx + +pending: + DATA32 call EXT_C(real_to_prot) + .code32 + + mov %edx, %eax + pop %ebp ret /* - * nocursor() - * BIOS call "INT 10H Function 01h" to set cursor type - * Call with %ah = 0x01 - * %ch = cursor starting scanline - * %cl = cursor ending scanline - */ - -ENTRY(nocursor) - push %ebp - push %ebx /* save EBX */ - - call EXT_C(prot_to_real) - .code16 - - movw $0x2000, %cx - movb $0x1, %ah - int $0x10 - - DATA32 call EXT_C(real_to_prot) - .code32 - - pop %ebx - pop %ebp - ret - - -/* - * console_getxy() + * int console_getxy (void) * BIOS call "INT 10H Function 03h" to get cursor position * Call with %ah = 0x03 * %bh = page @@ -1919,7 +2066,7 @@ ENTRY(console_getxy) /* - * console_gotoxy(x,y) + * void console_gotoxy(int x, int y) * BIOS call "INT 10H Function 02h" to set cursor position * Call with %ah = 0x02 * %bh = page @@ -1949,58 +2096,30 @@ ENTRY(console_gotoxy) pop %ebp ret - + /* - * console_set_attrib(attr) : Sets the character attributes for character at - * current cursor position. - * - * Bitfields for character's display attribute: - * Bit(s) Description - * 7 foreground blink - * 6-4 background color - * 3 foreground bright - * 2-0 foreground color - * - * Values for character color: - * Normal Bright - * 000b black dark gray - * 001b blue light blue - * 010b green light green - * 011b cyan light cyan - * 100b red light red - * 101b magenta light magenta - * 110b brown yellow - * 111b light gray white - * - * BIOS call "INT 10H Function 08h" to read character and attribute data - * Call with %ah = 0x08 - * %bh = page - * Returns %ah = character attribute - * %al = character value - * BIOS call "INT 10H Function 09h" to write character and attribute data - * Call with %ah = 0x09 - * %al = character value - * %bh = page - * %bl = character attribute - * %cx = count to display (???, possible side-effects!!) + * void console_cls (void) + * BIOS call "INT 10H Function 0Fh" to get current video mode + * Call with %ah = 0x0f + * Returns %al = (video mode) + * %bh = (page number) + * BIOS call "INT 10H Function 00h" to set the video mode (clears screen) + * Call with %ah = 0x00 + * %al = (video mode) */ -ENTRY(console_set_attrib) - push %ebp - push %ebx - movl 0xc(%esp), %ecx - xorl %ebx, %ebx +ENTRY(console_cls) + push %ebp + push %ebx /* save EBX */ call EXT_C(prot_to_real) .code16 - movb $0x8, %ah - int $0x10 - movb $0x9, %ah - movb %cl, %bl - movw $1, %cx - int $0x10 + movb $0xf, %ah + int $0x10 /* Get Current Video mode */ + xorb %ah, %ah + int $0x10 /* Set Video mode (clears screen) */ DATA32 call EXT_C(real_to_prot) .code32 @@ -2009,7 +2128,31 @@ ENTRY(console_set_attrib) pop %ebp ret + +/* + * void console_nocursor (void) + * BIOS call "INT 10H Function 01h" to set cursor type + * Call with %ah = 0x01 + * %ch = cursor starting scanline + * %cl = cursor ending scanline + */ +ENTRY(console_nocursor) + push %ebp + + call EXT_C(prot_to_real) + .code16 + + movw $0x2000, %cx + movb $0x1, %ah + int $0x10 + + DATA32 call EXT_C(real_to_prot) + .code32 + + pop %ebp + ret + /* * getrtsecs() * if a seconds value can be read, read it and return it (BCD), @@ -2074,114 +2217,6 @@ ENTRY(currticks) popl %ebp ret - -/* - * remap_ascii_char remaps the ascii code %bl to another if the code is - * contained in ASCII_KEY_MAP. - */ - .code16 - -remap_ascii_char: - pushw %si - - movw $ABS(EXT_C(ascii_key_map)), %si -1: - lodsw - /* check if this is the end */ - testw %ax, %ax - jz 2f - /* check if this matches the ascii code */ - cmpb %al, %bl - jne 1b - /* if so, perform the mapping */ - movb %ah, %bl -2: - /* restore %si */ - popw %si - - ret - - .code32 - - .align 4 -ENTRY(ascii_key_map) - .space (KEY_MAP_SIZE + 1) * 2 - - -/* - * console_getkey() - * BIOS call "INT 16H Function 00H" to read character from keyboard - * Call with %ah = 0x0 - * Return: %ah = keyboard scan code - * %al = ASCII character - */ - -ENTRY(console_getkey) - push %ebp - push %ebx /* save %ebx */ - - call EXT_C(prot_to_real) - .code16 - - int $0x16 - - movw %ax, %bx /* real_to_prot uses %eax */ - call remap_ascii_char - - DATA32 call EXT_C(real_to_prot) - .code32 - - movw %bx, %ax - - pop %ebx - pop %ebp - ret - - -/* - * console_checkkey() - * if there is a character pending, return it; otherwise return -1 - * BIOS call "INT 16H Function 01H" to check whether a character is pending - * Call with %ah = 0x1 - * Return: - * If key waiting to be input: - * %ah = keyboard scan code - * %al = ASCII character - * Zero flag = clear - * else - * Zero flag = set - */ -ENTRY(console_checkkey) - push %ebp - push %ebx - - xorl %ebx, %ebx - - call EXT_C(prot_to_real) /* enter real mode */ - .code16 - - movb $0x1, %ah - int $0x16 - - DATA32 jz notpending - - movw %ax, %bx - call remap_ascii_char - DATA32 jmp pending - -notpending: - movl $0xFFFFFFFF, %ebx - -pending: - DATA32 call EXT_C(real_to_prot) - .code32 - - mov %ebx, %eax - - pop %ebx - pop %ebp - ret - #endif /* STAGE1_5 */ /* diff --git a/stage2/builtins.c b/stage2/builtins.c index 4c9a4e197..8aaa01985 100644 --- a/stage2/builtins.c +++ b/stage2/builtins.c @@ -26,6 +26,7 @@ #include #include +#include #ifdef SUPPORT_NETBOOT # define GRUB 1 @@ -47,8 +48,6 @@ # include #endif -/* Terminal types. */ -int terminal = TERMINAL_CONSOLE; /* The type of kernel loaded. */ kernel_t kernel_type; /* The boot device. */ @@ -70,9 +69,6 @@ char *password; password_t password_type; /* The flag for indicating that the user is authoritative. */ int auth = 0; -/* Color settings. */ -int normal_color; -int highlight_color; /* The timeout. */ int grub_timeout = -1; /* Whether to show the menu or not. */ @@ -99,8 +95,6 @@ void init_config (void) { default_entry = 0; - normal_color = A_NORMAL; - highlight_color = A_REVERSE; password = 0; fallback_entry = -1; grub_timeout = -1; @@ -413,8 +407,15 @@ cat_func (char *arg, int flags) return 1; while (grub_read (&c, 1)) - grub_putchar (c); - + { + /* Because running "cat" with a binary file can confuse the terminal, + print only some characters as they are. */ + if (grub_isspace (c) || (c >= ' ' && c <= '~')) + grub_putchar (c); + else + grub_putchar ('?'); + } + grub_close (); return 0; } @@ -696,8 +697,9 @@ color_func (char *arg, int flags) return 1; } - normal_color = new_normal_color; - highlight_color = new_highlight_color; + if (current_term->setcolor) + current_term->setcolor (new_normal_color, new_highlight_color); + return 0; } @@ -3276,7 +3278,7 @@ static struct builtin builtin_savedefault = static int serial_func (char *arg, int flags) { - unsigned short port = serial_get_port (0); + unsigned short port = serial_hw_get_port (0); unsigned int speed = 9600; int word_len = UART_8BITS_WORD; int parity = UART_NO_PARITY; @@ -3301,7 +3303,7 @@ serial_func (char *arg, int flags) return 1; } - port = serial_get_port (unit); + port = serial_hw_get_port (unit); } else if (grub_memcmp (arg, "--speed=", sizeof ("--speed=") - 1) == 0) { @@ -3388,7 +3390,7 @@ serial_func (char *arg, int flags) *q++ = *p++; *q = 0; - set_serial_device (dev); + serial_set_device (dev); } # endif /* GRUB_UTIL */ else @@ -3398,7 +3400,7 @@ serial_func (char *arg, int flags) } /* Initialize the serial unit. */ - if (! serial_init (port, speed, word_len, parity, stop_bit_len)) + if (! serial_hw_init (port, speed, word_len, parity, stop_bit_len)) { errnum = ERR_BAD_ARGUMENT; return 1; @@ -3981,18 +3983,26 @@ static struct builtin builtin_setup = static int terminal_func (char *arg, int flags) { - int default_terminal = 0; + /* The index of the default terminal in TERM_TABLE. */ + int default_term = -1; + struct term_entry *prev_term = current_term; int to = -1; - int dumb = 0; - int saved_terminal = terminal; int lines = 0; int no_message = 0; + unsigned long term_flags = 0; + /* XXX: Assume less than 32 terminals. */ + unsigned long term_bitmap = 0; /* Get GNU-style long options. */ while (1) { if (grub_memcmp (arg, "--dumb", sizeof ("--dumb") - 1) == 0) - dumb = 1; + term_flags |= TERM_DUMB; + else if (grub_memcmp (arg, "--no-echo", sizeof ("--no-echo") - 1) == 0) + /* ``--no-echo'' implies ``--no-edit''. */ + term_flags |= (TERM_NO_ECHO | TERM_NO_EDIT); + else if (grub_memcmp (arg, "--no-edit", sizeof ("--no-edit") - 1) == 0) + term_flags |= TERM_NO_EDIT; else if (grub_memcmp (arg, "--timeout=", sizeof ("--timeout=") - 1) == 0) { char *val = arg + sizeof ("--timeout=") - 1; @@ -4025,72 +4035,51 @@ terminal_func (char *arg, int flags) /* If no argument is specified, show current setting. */ if (! *arg) { - if (terminal & TERMINAL_CONSOLE) - grub_printf ("console%s\n", - terminal & TERMINAL_DUMB ? " (dumb)" : ""); -#ifdef SUPPORT_HERCULES - else if (terminal & TERMINAL_HERCULES) - grub_printf ("hercules%s\n", - terminal & TERMINAL_DUMB ? " (dumb)" : ""); -#endif /* SUPPORT_HERCULES */ -#ifdef SUPPORT_SERIAL - else if (terminal & TERMINAL_SERIAL) - grub_printf ("serial%s\n", - terminal & TERMINAL_DUMB ? " (dumb)" : " (vt100)"); -#endif /* SUPPORT_SERIAL */ - + grub_printf ("%s%s%s%s\n", + current_term->name, + current_term->flags & TERM_DUMB ? " (dumb)" : "", + current_term->flags & TERM_NO_EDIT ? " (no edit)" : "", + current_term->flags & TERM_NO_ECHO ? " (no echo)" : ""); return 0; } - /* Clear current setting. */ - terminal = dumb ? TERMINAL_DUMB : 0; - while (*arg) { - if (grub_memcmp (arg, "console", sizeof ("console") - 1) == 0) + int i; + char *next = skip_to (0, arg); + + nul_terminate (arg); + + for (i = 0; term_table[i].name; i++) { - terminal |= TERMINAL_CONSOLE; - if (! default_terminal) - default_terminal = TERMINAL_CONSOLE; - } -#ifdef SUPPORT_HERCULES - else if (grub_memcmp (arg, "hercules", sizeof ("hercules") - 1) == 0) - { - terminal |= TERMINAL_HERCULES; - if (! default_terminal) - default_terminal = TERMINAL_HERCULES; - } -#endif /* SUPPORT_HERCULES */ -#ifdef SUPPORT_SERIAL - else if (grub_memcmp (arg, "serial", sizeof ("serial") - 1) == 0) - { - if (serial_exists ()) + if (grub_strcmp (arg, term_table[i].name) == 0) { - terminal |= TERMINAL_SERIAL; - if (! default_terminal) - default_terminal = TERMINAL_SERIAL; - } - else - { - terminal = saved_terminal; - errnum = ERR_NEED_SERIAL; - return 1; + if (term_table[i].flags & TERM_NEED_INIT) + { + errnum = ERR_DEV_NEED_INIT; + return 1; + } + + if (default_term < 0) + default_term = i; + + term_bitmap |= (1 << i); + break; } } -#endif /* SUPPORT_SERIAL */ - else + + if (! term_table[i].name) { - terminal = saved_terminal; errnum = ERR_BAD_ARGUMENT; return 1; } - arg = skip_to (0, arg); + arg = next; } -#ifdef SUPPORT_SERIAL - /* If a seial console is turned on, wait until the user pushes any key. */ - if (terminal & TERMINAL_SERIAL) + /* If multiple terminals are specified, wait until the user pushes any + key on one of the terminals. */ + if (term_bitmap & ~(1 << default_term)) { int time1, time2 = -1; @@ -4104,25 +4093,22 @@ terminal_func (char *arg, int flags) /* Wait for a key input. */ while (to) { - if ((terminal & TERMINAL_CONSOLE) && console_checkkey () != -1) - { - terminal &= (TERMINAL_CONSOLE | TERMINAL_DUMB); - (void) getkey (); - return 0; - } - else if ((terminal & TERMINAL_SERIAL) && serial_checkkey () != -1) - { - terminal &= (TERMINAL_SERIAL | TERMINAL_DUMB); - (void) getkey (); + int i; - /* If the interface is currently the command-line, restart - it to repaint the screen. */ - if (flags & BUILTIN_CMDLINE) - grub_longjmp (restart_cmdline_env, 0); - - return 0; + for (i = 0; term_table[i].name; i++) + { + if (term_bitmap & (1 << i)) + { + if (term_table[i].checkkey () >= 0) + { + (void) term_table[i].getkey (); + default_term = i; + + goto end; + } + } } - + /* Prompt the user, once per sec. */ if ((time1 = getrtsecs ()) != time2 && time1 != 0xFF) { @@ -4134,18 +4120,23 @@ terminal_func (char *arg, int flags) to--; } } - - /* Expired. */ - terminal &= (default_terminal | TERMINAL_DUMB); } -#endif /* SUPPORT_SERIAL */ + end: + current_term = term_table + default_term; + current_term->flags = term_flags; + if (lines) max_lines = lines; else /* 24 would be a good default value. */ max_lines = 24; + /* If the interface is currently the command-line, + restart it to repaint the screen. */ + if (current_term != prev_term && (flags & BUILTIN_CMDLINE)) + grub_longjmp (restart_cmdline_env, 0); + return 0; } @@ -4154,12 +4145,14 @@ static struct builtin builtin_terminal = "terminal", terminal_func, BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "terminal [--dumb] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial]", - "Select a terminal. When serial is specified, wait until you push any key" - " to continue. If both console and serial are specified, the terminal" - " to which you input a key first will be selected. If no argument is" - " specified, print current setting. The option --dumb specifies that" - " your terminal is dumb, otherwise, vt100-compatibility is assumed." + "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules]", + "Select a terminal. When multiple terminals are specified, wait until" + " you push any key to continue. If both console and serial are specified," + " the terminal to which you input a key first will be selected. If no" + " argument is specified, print current setting. The option --dumb" + " specifies that your terminal is dumb, otherwise, vt100-compatibility" + " is assumed. If you specify --no-echo, input characters won't be echoed." + " If you specify --no-edit, the BASH-like editing feature will be disabled." " If --timeout is present, this command will wait at most for SECS" " seconds. The option --lines specifies the maximum number of lines." " The option --silent is used to suppress messages." diff --git a/stage2/char_io.c b/stage2/char_io.c index d82ed5be7..e7f3ca19e 100644 --- a/stage2/char_io.c +++ b/stage2/char_io.c @@ -19,6 +19,7 @@ */ #include +#include #ifdef SUPPORT_HERCULES # include @@ -29,7 +30,59 @@ #endif #ifndef STAGE1_5 -int auto_fill = 1; +struct term_entry term_table[] = + { + { + "console", + 0, + console_putchar, + console_checkkey, + console_getkey, + console_getxy, + console_gotoxy, + console_cls, + console_highlight, + console_setcolor, + console_nocursor + }, +#ifdef SUPPORT_SERIAL + { + "serial", + /* A serial device must be initialized. */ + TERM_NEED_INIT, + serial_putchar, + serial_checkkey, + serial_getkey, + serial_getxy, + serial_gotoxy, + serial_cls, + serial_highlight, + 0, + 0 + }, +#endif /* SUPPORT_SERIAL */ +#ifdef SUPPORT_HERCULES + { + "hercules", + 0, + hercules_putchar, + console_checkkey, + console_getkey, + hercules_getxy, + hercules_gotoxy, + hercules_cls, + hercules_highlight, + hercules_setcolor, + hercules_nocursor + }, +#endif /* SUPPORT_HERCULES */ + /* This must be the last entry. */ + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + }; + +/* This must be console. */ +struct term_entry *current_term = term_table; + int max_lines = 24; int count_lines = -1; int use_pager = 1; @@ -101,7 +154,7 @@ grub_printf (const char *format,...) while ((c = *(format++)) != 0) { if (c != '%') - putchar (c); + grub_putchar (c); else switch (c = *(format++)) { @@ -120,19 +173,19 @@ grub_printf (const char *format,...) ptr = str; while (*ptr) - putchar (*(ptr++)); + grub_putchar (*(ptr++)); break; #ifndef STAGE1_5 case 'c': - putchar ((*(dataptr++)) & 0xff); + grub_putchar ((*(dataptr++)) & 0xff); break; case 's': ptr = (char *) (*(dataptr++)); while ((c = *(ptr++)) != 0) - putchar (c); + grub_putchar (c); break; #endif } @@ -220,17 +273,9 @@ add_history (const char *cmdline, int no) num_history++; } -/* Don't use this with a MAXLEN greater than 1600 or so! The problem - is that GET_CMDLINE depends on the everything fitting on the screen - at once. So, the whole screen is about 2000 characters, minus the - PROMPT, and space for error and status lines, etc. MAXLEN must be - at least 1, and PROMPT and CMDLINE must be valid strings (not NULL - or zero-length). - - If ECHO_CHAR is nonzero, echo it instead of the typed character. */ -int -get_cmdline (char *prompt, char *cmdline, int maxlen, - int echo_char, int readline) +static int +real_get_cmdline (char *prompt, char *cmdline, int maxlen, + int echo_char, int readline) { /* This is a rather complicated function. So explain the concept. @@ -279,8 +324,6 @@ get_cmdline (char *prompt, char *cmdline, int maxlen, char *buf = (char *) CMDLINE_BUF; /* The kill buffer. */ char *kill_buf = (char *) KILL_BUF; - /* The original state of AUTO_FILL. */ - int saved_auto_fill = auto_fill; /* Nested function definitions for code simplicity. */ @@ -308,29 +351,15 @@ get_cmdline (char *prompt, char *cmdline, int maxlen, { xpos -= count; - if ((terminal & TERMINAL_CONSOLE) -# ifdef SUPPORT_HERCULES - || (terminal & TERMINAL_HERCULES) -# endif /* SUPPORT_HERCULES */ - ) - { - int y = getxy () & 0xFF; - - gotoxy (xpos, y); - } -# ifdef SUPPORT_SERIAL - else if (! (terminal & TERMINAL_DUMB) && (count > 4)) - { - grub_printf ("\e[%dD", count); - } - else + if (current_term->flags & TERM_DUMB) { int i; for (i = 0; i < count; i++) grub_putchar ('\b'); } -# endif /* SUPPORT_SERIAL */ + else + gotoxy (xpos, getxy () & 0xFF); } } @@ -346,22 +375,7 @@ get_cmdline (char *prompt, char *cmdline, int maxlen, { xpos += count; - if ((terminal & TERMINAL_CONSOLE) -# ifdef SUPPORT_HERCULES - || (terminal & TERMINAL_HERCULES) -# endif /* SUPPORT_HERCULES */ - ) - { - int y = getxy () & 0xFF; - - gotoxy (xpos, y); - } -# ifdef SUPPORT_SERIAL - else if (! (terminal & TERMINAL_DUMB) && (count > 4)) - { - grub_printf ("\e[%dC", count); - } - else + if (current_term->flags & TERM_DUMB) { int i; @@ -373,7 +387,8 @@ get_cmdline (char *prompt, char *cmdline, int maxlen, grub_putchar (echo_char); } } -# endif /* SUPPORT_SERIAL */ + else + gotoxy (xpos, getxy () & 0xFF); } } @@ -388,8 +403,7 @@ get_cmdline (char *prompt, char *cmdline, int maxlen, if (full) { /* Recompute the section number. */ - if ((terminal & TERMINAL_DUMB) - || (lpos + plen < CMDLINE_WIDTH)) + if (lpos + plen < CMDLINE_WIDTH) section = 0; else section = ((lpos + plen - CMDLINE_WIDTH) @@ -453,50 +467,33 @@ get_cmdline (char *prompt, char *cmdline, int maxlen, pos++; } - if (! (terminal & TERMINAL_DUMB)) + /* Fill up the rest of the line with spaces. */ + for (; i < start + len; i++) { - /* Fill up the rest of the line with spaces. */ - for (; i < start + len; i++) - { - grub_putchar (' '); - pos++; - } + grub_putchar (' '); + pos++; + } + + /* If the cursor is at the last position, put `>' or a space, + depending on if there are more characters in BUF. */ + if (pos == CMDLINE_WIDTH) + { + if (start + len < llen) + grub_putchar ('>'); + else + grub_putchar (' '); - /* If the cursor is at the last position, put `>' or a space, - depending on if there are more characters in BUF. */ - if (pos == CMDLINE_WIDTH) - { - if (start + len < llen) - grub_putchar ('>'); - else - grub_putchar (' '); - - pos++; - } - - /* Back to XPOS. */ - if ((terminal & TERMINAL_CONSOLE) -# ifdef SUPPORT_HERCULES - || (terminal & TERMINAL_HERCULES) -# endif /* SUPPORT_HERCULES */ - ) - { - int y = getxy () & 0xFF; - - gotoxy (xpos, y); - } -# ifdef SUPPORT_SERIAL - else if (! (terminal & TERMINAL_SERIAL) && (pos - xpos > 4)) - { - grub_printf ("\e[%dD", pos - xpos); - } - else - { - for (i = 0; i < pos - xpos; i++) - grub_putchar ('\b'); - } -# endif /* SUPPORT_SERIAL */ - } + pos++; + } + + /* Back to XPOS. */ + if (current_term->flags & TERM_DUMB) + { + for (i = 0; i < pos - xpos; i++) + grub_putchar ('\b'); + } + else + gotoxy (xpos, getxy () & 0xFF); } /* Initialize the command-line. */ @@ -562,15 +559,10 @@ get_cmdline (char *prompt, char *cmdline, int maxlen, lpos = llen; grub_strcpy (buf, cmdline); - /* Disable the auto fill mode. */ - auto_fill = 0; - cl_init (); - while (ASCII_CHAR (c = getkey ()) != '\n' && ASCII_CHAR (c) != '\r') + while ((c = ASCII_CHAR (getkey ())) != '\n' && c != '\r') { - c = translate_keycode (c); - /* If READLINE is non-zero, handle readline-like key bindings. */ if (readline) { @@ -617,11 +609,7 @@ get_cmdline (char *prompt, char *cmdline, int maxlen, completion. */ grub_memmove (completion_buffer, buf + i, lpos - i); completion_buffer[lpos - i] = 0; - /* Enable the auto fill mode temporarily. */ - auto_fill = 1; ret = print_completions (is_filename, 1); - /* Disable the auto fill mode again. */ - auto_fill = 0; errnum = ERR_NONE; if (ret >= 0) @@ -633,13 +621,8 @@ get_cmdline (char *prompt, char *cmdline, int maxlen, { /* There are more than one candidates, so print the list. */ - grub_putchar ('\n'); - /* Enable the auto fill mode temporarily. */ - auto_fill = 1; print_completions (is_filename, 0); - /* Disable the auto fill mode again. */ - auto_fill = 0; errnum = ERR_NONE; } } @@ -792,124 +775,66 @@ get_cmdline (char *prompt, char *cmdline, int maxlen, if (readline && lpos < llen) add_history (cmdline, 0); - /* Restore the auto fill mode. */ - auto_fill = saved_auto_fill; - return 0; } -/* Translate a special key to a common ascii code. */ +/* Don't use this with a MAXLEN greater than 1600 or so! The problem + is that GET_CMDLINE depends on the everything fitting on the screen + at once. So, the whole screen is about 2000 characters, minus the + PROMPT, and space for error and status lines, etc. MAXLEN must be + at least 1, and PROMPT and CMDLINE must be valid strings (not NULL + or zero-length). + + If ECHO_CHAR is nonzero, echo it instead of the typed character. */ int -translate_keycode (int c) +get_cmdline (char *prompt, char *cmdline, int maxlen, + int echo_char, int readline) { -# ifdef SUPPORT_SERIAL - if (terminal & TERMINAL_SERIAL) + /* Because it is hard to deal with different conditions simultaneously, + less functional cases are handled here. Assume that TERM_NO_ECHO + implies TERM_NO_EDIT. */ + if (current_term->flags & (TERM_NO_ECHO | TERM_NO_EDIT)) { - /* In a serial terminal, things are complicated, because several - key codes start from the character ESC, while we want to accept - ESC itself. */ - if (c == '\e') + char *p = cmdline; + int c; + + /* Make sure that MAXLEN is not too large. */ + if (maxlen > MAX_CMDLINE) + maxlen = MAX_CMDLINE; + + /* Print only the prompt. The contents of CMDLINE is simply discarded, + even if it is not empty. */ + grub_printf ("%s", prompt); + + /* Gather characters until a newline is gotten. */ + while ((c = ASCII_CHAR (getkey ())) != '\n' && c != '\r') { - int start; + /* Return immediately if ESC is pressed. */ + if (c == 27) + return 1; - /* Get current time. */ - start = currticks (); - - while (checkkey () == -1) + /* Printable characters are added into CMDLINE. */ + if (c >= ' ' && c <= '~') { - /* Wait for a next character, at least for 0.1 sec - (18.2 ticks/sec). */ - int now; - - now = currticks (); - if (now - start >= 2) - return c; - } + if (! (current_term->flags & TERM_NO_ECHO)) + grub_putchar (c); - c = getkey (); - if (c == '[') - { - int c1, c2; - - /* To filter illegal states. */ - c = 0; - c1 = getkey (); - switch (c1) - { - case 'A': /* KEY_UP */ - c = 16; - break; - case 'B': /* KEY_DOWN */ - c = 14; - break; - case 'C': /* KEY_RIGHT */ - c = 6; - break; - case 'D': /* KEY_LEFT */ - c = 2; - break; - case 'F': /* End */ - c = 5; - break; - case 'H': /* Home */ - c = 1; - break; - case '1': - c2 = getkey (); - if (c2 == '~') - { - /* One of control keys (pos1,....). */ - c = 1; - } - break; - case '3': - c2 = getkey (); - if (c2 == '~') - { - /* One of control keys (del,....). */ - c = 4; - } - break; - case '4': /* Del */ - c = 4; - break; - } + /* Preceding space characters must be ignored. */ + if (c != ' ' || p != cmdline) + *p++ = c; } } + + *p = 0; + + if (! (current_term->flags & TERM_NO_ECHO)) + grub_putchar ('\n'); + + return 0; } - else -# endif /* SUPPORT_SERIAL */ - { - switch (c) - { - case KEY_LEFT: - c = 2; - break; - case KEY_RIGHT: - c = 6; - break; - case KEY_UP: - c = 16; - break; - case KEY_DOWN: - c = 14; - break; - case KEY_HOME: - c = 1; - break; - case KEY_END: - c = 5; - break; - case KEY_DC: - c = 4; - break; - case KEY_BACKSPACE: - c = 8; - break; - } - } - - return ASCII_CHAR (c); + + /* Complicated features are left to real_get_cmdline. */ + return real_get_cmdline (prompt, cmdline, maxlen, echo_char, readline); } #endif /* STAGE1_5 */ @@ -1029,7 +954,7 @@ grub_strncat (char *s1, const char *s2, int n) a static library supporting minimal standard C functions and link each image with the library. Complicated things should be left to computer, definitely. -okuji */ -#if ! defined(STAGE1_5) || defined(FSYS_VSTAFS) +#if !defined(STAGE1_5) || defined(FSYS_VSTAFS) int grub_strcmp (const char *s1, const char *s2) { @@ -1052,55 +977,35 @@ grub_strcmp (const char *s1, const char *s2) int getkey (void) { - int c = -1; - - if ((terminal & TERMINAL_CONSOLE) -#ifdef SUPPORT_HERCULES - || (terminal & TERMINAL_HERCULES) -#endif /* SUPPORT_HERCULES */ - ) - c = console_getkey (); -#ifdef SUPPORT_SERIAL - else if (terminal & TERMINAL_SERIAL) - c = serial_getkey (); -#endif /* SUPPORT_SERIAL */ - - return c; + return current_term->getkey (); } /* Check if a key code is available. */ int checkkey (void) { - int c = -1; - - if ((terminal & TERMINAL_CONSOLE) -#ifdef SUPPORT_HERCULES - || (terminal & TERMINAL_HERCULES) -#endif /* SUPPORT_HERCULES */ - ) - c = console_checkkey (); - -#ifdef SUPPORT_SERIAL - if (terminal & TERMINAL_SERIAL) - c = serial_checkkey (); -#endif /* SUPPORT_SERIAL */ - - return c; + return current_term->checkkey (); } - #endif /* ! STAGE1_5 */ /* Display an ASCII character. */ void grub_putchar (int c) { -#ifndef STAGE1_5 - static int col = 0; -#endif - if (c == '\n') grub_putchar ('\r'); +#ifndef STAGE1_5 + else if (c == '\t' && current_term->getxy) + { + int n; + + n = 8 - ((current_term->getxy () >> 8) & 3); + while (n--) + grub_putchar (' '); + + return; + } +#endif /* ! STAGE1_5 */ #ifdef STAGE1_5 @@ -1109,27 +1014,10 @@ grub_putchar (int c) #else /* ! STAGE1_5 */ - /* Track the cursor by software here. */ - /* XXX: This doesn't handle horizontal or vertical tabs. */ - if (c == '\r') - col = 0; - else if (c == '\b') - { - if (col > 0) - col--; - } - else if (c >= ' ' && c <= '~') - { - /* Fold a line only if AUTO_FILL is true. */ - if (auto_fill && col >= 79) - grub_putchar ('\n'); - - col++; - } - else if (c == '\n') + if (c == '\n') { /* Internal `more'-like feature. */ - if (count_lines != -1) + if (count_lines >= 0) { count_lines++; if (count_lines >= max_lines - 2) @@ -1139,14 +1027,21 @@ grub_putchar (int c) /* It's important to disable the feature temporarily, because the following grub_printf call will print newlines. */ count_lines = -1; + + if (current_term->highlight) + current_term->highlight (1); + + grub_printf ("\n[Hit return to continue]"); + + if (current_term->highlight) + current_term->highlight (0); - grub_printf ("\n\n[Hit return to continue]"); do { tmp = ASCII_CHAR (getkey ()); } while (tmp != '\n' && tmp != '\r'); - grub_printf ("\n\n"); + grub_printf ("\r \r"); /* Restart to count lines. */ count_lines = 0; @@ -1155,18 +1050,7 @@ grub_putchar (int c) } } - if (terminal & TERMINAL_CONSOLE) - console_putchar (c); - -# ifdef SUPPORT_HERCULES - if (terminal & TERMINAL_HERCULES) - herc_putchar (c); -# endif /* SUPPORT_HERCULES */ - -# ifdef SUPPORT_SERIAL - if (terminal & TERMINAL_SERIAL) - serial_putchar (c); -# endif /* SUPPORT_SERIAL */ + current_term->putchar (c); #endif /* ! STAGE1_5 */ } @@ -1175,169 +1059,30 @@ grub_putchar (int c) void gotoxy (int x, int y) { - if (terminal & TERMINAL_CONSOLE) - console_gotoxy (x, y); -#ifdef SUPPORT_HERCULES - else if (terminal & TERMINAL_HERCULES) - herc_gotoxy (x, y); -#endif /* SUPPORT_HERCULES */ -#ifdef SUPPORT_SERIAL - else if (terminal & TERMINAL_SERIAL) - serial_gotoxy (x, y); -#endif /* SUPPORT_SERIAL */ + current_term->gotoxy (x, y); } -#ifdef SUPPORT_SERIAL -/* The serial part of gotoxy. */ -void -serial_gotoxy (int x, int y) -{ - grub_printf ("\e[%d;%dH", y + 1, x + 1); -} -#endif /* SUPPORT_SERIAL */ - int getxy (void) { - int ret = 0; - - if (terminal & TERMINAL_CONSOLE) - ret = console_getxy (); -#ifdef SUPPORT_HERCULES - else if (terminal & TERMINAL_HERCULES) - ret = herc_getxy (); -#endif /* SUPPORT_HERCULES */ -#ifdef SUPPORT_SERIAL - else if (terminal & TERMINAL_SERIAL) - ret = serial_getxy (); -#endif /* SUPPORT_SERIAL */ - - return ret; + return current_term->getxy (); } -#ifdef SUPPORT_SERIAL -/* The serial part of getxy. */ -int -serial_getxy (void) -{ - int x, y; - int start, now; - char buf[32]; /* XXX */ - int i; - int c; - char *p; - - /* Drain the input buffer. */ - while (serial_checkkey () != -1) - serial_getkey (); - - /* CPR. */ - grub_printf ("\e[6n"); - - /* Get current time. */ - while ((start = getrtsecs ()) == 0xFF) - ; - - again: - i = 0; - c = 0; - do - { - if (serial_checkkey () != -1) - { - c = serial_getkey (); - if (i == 1 && c != '[') - i = 0; - - if (i == 0 && c != '\e') - continue; - - if (i != 0 && c == '\e') - i = 0; - - buf[i] = c; - i++; - } - else - { - /* Get current time. */ - while ((now = getrtsecs ()) == 0xFF) - ; - - /* FIXME: Remove this magic number. */ - if (now - start > 10) - { - /* Something is quite wrong. */ - return 0; - } - } - } - while (c != 'R' && i < sizeof (buf)); - - if (c != 'R') - goto again; - - p = buf + 2; - if (! safe_parse_maxint (&p, &y)) - { - errnum = 0; - goto again; - } - - if (*p != ';') - goto again; - - p++; - if (! safe_parse_maxint (&p, &x)) - { - errnum = 0; - goto again; - } - - if (*p != 'R') - goto again; - - return ((x - 1) << 8) | (y - 1); -} -#endif /* SUPPORT_SERIAL */ - void cls (void) -{ - if (terminal & TERMINAL_CONSOLE) - console_cls (); -#ifdef SUPPORT_HERCULES - else if (terminal & TERMINAL_HERCULES) - herc_cls (); -#endif /* SUPPORT_HERCULES */ -#ifdef SUPPORT_SERIAL - else if (terminal & TERMINAL_SERIAL) - serial_cls (); -#endif /* SUPPORT_SERIAL */ -} - -#ifdef SUPPORT_SERIAL -/* The serial part of cls. */ -void -serial_cls (void) { /* If the terminal is dumb, there is no way to clean the terminal. */ - if (terminal & TERMINAL_DUMB) + if (current_term->flags & TERM_DUMB) grub_putchar ('\n'); else - grub_printf ("\e[H\e[J"); + current_term->cls (); } -#endif /* SUPPORT_SERIAL */ void -set_attrib (int attr) +nocursor (void) { -#ifdef SUPPORT_HERCULES - if (terminal & TERMINAL_HERCULES) - herc_set_attrib (attr); - else -#endif /* SUPPORT_HERCULES */ - console_set_attrib (attr); + if (current_term->nocursor) + current_term->nocursor (); } #endif /* ! STAGE1_5 */ diff --git a/stage2/cmdline.c b/stage2/cmdline.c index 614fdd7bb..308631660 100644 --- a/stage2/cmdline.c +++ b/stage2/cmdline.c @@ -103,7 +103,8 @@ init_cmdline (void) saved_partition = install_partition; current_drive = 0xFF; errnum = 0; - + count_lines = -1; + /* Restore memory probe state. */ mbi.mem_upper = saved_mem_upper; if (mbi.mmap_length) diff --git a/stage2/common.c b/stage2/common.c index e9cfeb535..2e047c94a 100644 --- a/stage2/common.c +++ b/stage2/common.c @@ -63,6 +63,7 @@ char *err_list[] = [ERR_BOOT_FAILURE] = "Unknown boot failure", [ERR_BOOT_FEATURES] = "Unsupported Multiboot features requested", [ERR_DEV_FORMAT] = "Unrecognized device string", + [ERR_DEV_NEED_INIT] = "Device not initialized yet", [ERR_DEV_VALUES] = "Invalid device requested", [ERR_EXEC_FORMAT] = "Invalid or unsupported executable format", [ERR_FILELENGTH] = @@ -73,7 +74,6 @@ char *err_list[] = [ERR_GEOM] = "Selected cylinder exceeds maximum supported by BIOS", [ERR_NEED_LX_KERNEL] = "Linux kernel must be loaded before initrd", [ERR_NEED_MB_KERNEL] = "Multiboot kernel must be loaded before modules", - [ERR_NEED_SERIAL] = "Serial device not configured", [ERR_NO_DISK] = "Selected disk does not exist", [ERR_NO_DISK_SPACE] = "No spare sectors on the disk", [ERR_NO_PART] = "No such partition", diff --git a/stage2/hercules.c b/stage2/hercules.c index 37cde57a3..d010c6146 100644 --- a/stage2/hercules.c +++ b/stage2/hercules.c @@ -1,7 +1,7 @@ /* hercules.c - hercules console interface */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2001 Free Software Foundation, Inc. + * Copyright (C) 2001,2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,9 +22,16 @@ #include #include +#include /* The position of the cursor. */ -static unsigned hercx, hercy; +static int herc_x; +static int herc_y; + +static int herc_normal_color = A_NORMAL; +static int herc_highlight_color = A_REVERSE; +static int herc_current_color = A_NORMAL; +static int herc_highlight_state = 0; /* Write a byte to a port. */ static inline void @@ -36,36 +43,47 @@ outb (unsigned short port, unsigned char value) static void herc_set_cursor (void) { - unsigned offset = hercy * HERCULES_WIDTH + hercx; + unsigned offset = herc_y * HERCULES_WIDTH + herc_x; outb (HERCULES_INDEX_REG, 0x0f); - outb (0x80, 0x0f); + outb (0x80, 0); outb (HERCULES_DATA_REG, offset & 0xFF); - outb (0x80, offset & 0xFF); + outb (0x80, 0); outb (HERCULES_INDEX_REG, 0x0e); - outb (0x80, 0x0e); + outb (0x80, 0); outb (HERCULES_DATA_REG, offset >> 8); - outb (0x80, offset >> 8); + outb (0x80, 0); +} + +static void +herc_turn_cursor (int state) +{ + outb (HERCULES_INDEX_REG, 0x0a); + outb (0x80, 0); + outb (HERCULES_DATA_REG, state ? 0 : (1 << 5)); + outb (0x80, 0); } void -herc_putchar (int c) +hercules_putchar (int c) { - switch (c) { case '\b': - if (hercx) - hercx--; + if (herc_x > 0) + herc_x--; break; case '\n': - hercy++; + herc_y++; break; case '\r': - hercx = 0; + herc_x = 0; + break; + + case '\a': break; default: @@ -73,23 +91,24 @@ herc_putchar (int c) volatile unsigned short *video = (unsigned short *) HERCULES_VIDEO_ADDR; - video[hercy * HERCULES_WIDTH + hercx] = 0x0700 | c; - hercx++; - if (hercx >= HERCULES_WIDTH) + video[herc_y * HERCULES_WIDTH + herc_x] + = (herc_current_color << 8) | c; + herc_x++; + if (herc_x >= HERCULES_WIDTH) { - hercx = 0; - hercy++; + herc_x = 0; + herc_y++; } } break; } - if (hercy >= HERCULES_HEIGHT) + if (herc_y >= HERCULES_HEIGHT) { - int i; volatile unsigned long *video = (unsigned long *) HERCULES_VIDEO_ADDR; + int i; - hercy = HERCULES_HEIGHT - 1; + herc_y = HERCULES_HEIGHT - 1; grub_memmove ((char *) HERCULES_VIDEO_ADDR, (char *) HERCULES_VIDEO_ADDR + HERCULES_WIDTH * 2, HERCULES_WIDTH * (HERCULES_HEIGHT - 1) * 2); @@ -101,7 +120,7 @@ herc_putchar (int c) } void -herc_cls (void) +hercules_cls (void) { int i; volatile unsigned long *video = (unsigned long *) HERCULES_VIDEO_ADDR; @@ -109,35 +128,45 @@ herc_cls (void) for (i = 0; i < HERCULES_WIDTH * HERCULES_HEIGHT / 2; i++) video[i] = 0x07200720; - hercx = hercy = 0; + herc_x = herc_y = 0; herc_set_cursor (); + herc_turn_cursor (1); } int -herc_getxy (void) +hercules_getxy (void) { - return (hercx << 8) | hercy; + return (herc_x << 8) | herc_y; } void -herc_gotoxy (int x, int y) +hercules_gotoxy (int x, int y) { - hercx = x; - hercy = y; + herc_x = x; + herc_y = y; herc_set_cursor (); } void -herc_set_attrib (int attr) +hercules_highlight (int state) { - volatile unsigned char *video = (unsigned char *) HERCULES_VIDEO_ADDR; - - if (attr & 0xF0) - attr = 0x70; - else - attr = 0x07; + herc_current_color = state ? herc_highlight_color : herc_normal_color; + herc_highlight_state = state; +} - video[((hercy * HERCULES_WIDTH + hercx) << 1) + 1] = attr; +void +hercules_setcolor (int normal_color, int highlight_color) +{ + herc_normal_color = normal_color; + herc_highlight_color = highlight_color; + + hercules_highlight (herc_highlight_state); +} + +void +hercules_nocursor (void) +{ + herc_turn_cursor (0); } #endif /* SUPPORT_HERCULES */ diff --git a/stage2/hercules.h b/stage2/hercules.h index 055bf6f60..aaf794fa1 100644 --- a/stage2/hercules.h +++ b/stage2/hercules.h @@ -28,11 +28,4 @@ #define HERCULES_INDEX_REG 0x3b4 #define HERCULES_DATA_REG 0x3b5 -/* Functions. */ -void herc_putchar (int c); -void herc_cls (void); -int herc_getxy (void); -void herc_gotoxy (int x, int y); -void herc_set_attrib (int attr); - #endif /* ! GRUB_HERCULES_HEADER */ diff --git a/stage2/serial.c b/stage2/serial.c index a72b9bfce..925bfa8fd 100644 --- a/stage2/serial.c +++ b/stage2/serial.c @@ -1,7 +1,7 @@ /* serial.c - serial device interface */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,7 +22,21 @@ #include #include +#include +/* An input buffer. */ +static char input_buf[8]; +static int npending = 0; + +static int serial_x; +static int serial_y; + +static int keep_track = 1; + + +/* Hardware-dependent definitions. */ + +#ifndef GRUB_UTIL /* The structure for speed vs. divisor. */ struct divisor { @@ -31,21 +45,20 @@ struct divisor }; /* Store the port number of a serial unit. */ -static unsigned short serial_port = 0; +static unsigned short serial_hw_port = 0; /* The table which lists common configurations. */ static struct divisor divisor_tab[] = -{ - { 2400, 0x0030 }, - { 4800, 0x0018 }, - { 9600, 0x000C }, - { 19200, 0x0006 }, - { 38400, 0x0003 }, - { 57600, 0x0002 }, - { 115200, 0x0001 } -}; + { + { 2400, 0x0030 }, + { 4800, 0x0018 }, + { 9600, 0x000C }, + { 19200, 0x0006 }, + { 38400, 0x0003 }, + { 57600, 0x0002 }, + { 115200, 0x0001 } + }; - /* Read a byte from a port. */ static inline unsigned char inb (unsigned short port) @@ -63,55 +76,45 @@ outb (unsigned short port, unsigned char value) asm volatile ("outb %b0, %w1" : : "a" (value), "Nd" (port)); } -/* The serial version of getkey. */ +/* Fetch a key. */ int -serial_getkey (void) +serial_hw_fetch (void) { - /* Wait until data is ready. */ - while ((inb (serial_port + UART_LSR) & UART_DATA_READY) == 0) - ; + if (inb ((serial_hw_port + UART_LSR) & UART_DATA_READY) == 0) + return inb (serial_hw_port + UART_RX); - /* Read and return the data. */ - return inb (serial_port + UART_RX); + return -1; } -/* The serial version of checkkey. This doesn't return a character code, - but that doesn't matter actually. */ -int -serial_checkkey (void) -{ - unsigned char status; - - status = inb (serial_port + UART_LSR); - return status & UART_DATA_READY ? : -1; -} - -/* The serial version of grub_putchar. */ +/* Put a chararacter. */ void -serial_putchar (int c) +serial_hw_put (int c) { - /* Perhaps a timeout is necessary. */ int timeout = 10000; /* Wait until the transmitter holding register is empty. */ - while ((inb (serial_port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0) - if (--timeout == 0) - /* There is something wrong. But what can I do? */ - return; - - outb (serial_port + UART_TX, c); + while ((inb (serial_hw_port + UART_LSR) & UART_EMPTY_TRANSMITTER) == 0) + { + if (--timeout == 0) + /* There is something wrong. But what can I do? */ + return; + + /* Insert a delay. */ + serial_hw_delay (); + } + + outb (serial_hw_port + UART_TX, c); } -/* Check if a serial port is set up. */ -int -serial_exists (void) +void +serial_hw_delay (void) { - return serial_port != 0; + outb (0x80, 0); } /* Return the port number for the UNITth serial device. */ unsigned short -serial_get_port (int unit) +serial_hw_get_port (int unit) { /* The BIOS data area. */ const unsigned short *addr = (const unsigned short *) 0x0400; @@ -127,8 +130,8 @@ serial_get_port (int unit) WORD_LEN, PARITY and STOP_BIT_LEN are defined in the header file as macros. */ int -serial_init (unsigned short port, unsigned int speed, - int word_len, int parity, int stop_bit_len) +serial_hw_init (unsigned short port, unsigned int speed, + int word_len, int parity, int stop_bit_len) { int i; unsigned short div = 0; @@ -165,13 +168,255 @@ serial_init (unsigned short port, unsigned int speed, outb (port + UART_MCR, UART_ENABLE_MODEM); /* Store the port number. */ - serial_port = port; + serial_hw_port = port; /* Drain the input buffer. */ while (serial_checkkey () != -1) (void) serial_getkey (); + + /* Get rid of TERM_NEED_INIT from the serial terminal. */ + for (i = 0; term_table[i].name; i++) + if (grub_strcmp (term_table[i].name, "serial") == 0) + { + term_table[i].flags &= ~TERM_NEED_INIT; + break; + } + + /* FIXME: should check if the serial terminal was found. */ return 1; } +#endif /* ! GRUB_UTIL */ + + +/* Generic definitions. */ + +static void +serial_translate_key_sequence (void) +{ + const struct + { + char key; + char ascii; + } + three_code_table[] = + { + {'A', 16}, + {'B', 14}, + {'C', 6}, + {'D', 2}, + {'F', 5}, + {'H', 1}, + {'4', 4} + }; + + const struct + { + short key; + char ascii; + } + four_code_table[] = + { + {('1' | ('~' << 8)), 1}, + {('3' | ('~' << 8)), 4} + }; + + /* The buffer must start with ``ESC [''. */ + if (*((unsigned short *) input_buf) != ('\e' | ('[' << 8))) + return; + + if (npending >= 3) + { + int i; + + for (i = 0; + i < sizeof (three_code_table) / sizeof (three_code_table[0]); + i++) + if (three_code_table[i].key == input_buf[2]) + { + input_buf[0] = three_code_table[i].ascii; + npending -= 2; + grub_memmove (input_buf + 1, input_buf + 3, npending - 1); + return; + } + } + + if (npending >= 4) + { + int i; + short key = *((short *) (input_buf + 2)); + + for (i = 0; + i < sizeof (four_code_table) / sizeof (four_code_table[0]); + i++) + if (four_code_table[i].key == key) + { + input_buf[0] = four_code_table[i].ascii; + npending -= 3; + grub_memmove (input_buf + 1, input_buf + 4, npending - 1); + return; + } + } +} + +static +int fill_input_buf (void) +{ + int i; + + for (i = 0; i < 1000 && npending < sizeof (input_buf); i++) + { + int c; + + c = serial_hw_fetch (); + if (c >= 0) + input_buf[npending++] = c; + + /* Insert a delay. */ + serial_hw_delay (); + } + + /* Translate some key sequences. */ + serial_translate_key_sequence (); + + return npending; +} + +/* The serial version of getkey. */ +int +serial_getkey (void) +{ + int c; + + while (! fill_input_buf ()) + ; + + c = input_buf[0]; + npending--; + grub_memmove (input_buf, input_buf + 1, npending); + + return c; +} + +/* The serial version of checkkey. */ +int +serial_checkkey (void) +{ + if (fill_input_buf ()) + return input_buf[0]; + + return -1; +} + +/* The serial version of grub_putchar. */ +void +serial_putchar (int c) +{ + /* Keep track of the cursor. */ + if (keep_track) + { + /* The serial terminal doesn't have VGA fonts. */ + switch (c) + { + case DISP_UL: + c = ACS_ULCORNER; + break; + case DISP_UR: + c = ACS_URCORNER; + break; + case DISP_LL: + c = ACS_LLCORNER; + break; + case DISP_LR: + c = ACS_LRCORNER; + break; + case DISP_HORIZ: + c = ACS_HLINE; + break; + case DISP_VERT: + c = ACS_VLINE; + break; + case DISP_LEFT: + c = ACS_LARROW; + break; + case DISP_RIGHT: + c = ACS_RARROW; + break; + case DISP_UP: + c = ACS_UARROW; + break; + case DISP_DOWN: + c = ACS_DARROW; + break; + default: + break; + } + + switch (c) + { + case '\r': + serial_x = 0; + break; + + case '\n': + serial_y++; + break; + + case '\b': + if (serial_x > 0) + serial_x--; + break; + + case '\a': + break; + + default: + if (serial_x >= 79) + { + serial_putchar ('\r'); + serial_putchar ('\n'); + } + serial_x++; + break; + } + } + + serial_hw_put (c); +} + +int +serial_getxy (void) +{ + return (serial_x << 8) | serial_y; +} + +void +serial_gotoxy (int x, int y) +{ + keep_track = 0; + grub_printf ("\e[%d;%dH", y + 1, x + 1); + keep_track = 1; + + serial_x = x; + serial_y = y; +} + +void +serial_cls (void) +{ + keep_track = 0; + grub_printf ("\e[H\e[J"); + keep_track = 1; + + serial_x = serial_y = 0; +} + +void +serial_highlight (int state) +{ + keep_track = 0; + grub_printf ("\e[%cm", state ? '7' : '0'); + keep_track = 1; +} #endif /* SUPPORT_SERIAL */ diff --git a/stage2/serial.h b/stage2/serial.h index 3364688cf..76c222720 100644 --- a/stage2/serial.h +++ b/stage2/serial.h @@ -1,7 +1,7 @@ /* serial.h - serial device interface */ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -68,38 +68,26 @@ /* Function prototypes. */ -/* The serial part of grub_putchar. */ -void serial_putchar (int c); +/* Fetch a key. */ +int serial_hw_fetch (void); -/* The serial part of getkey. */ -int serial_getkey (void); +/* Put a character. */ +void serial_hw_put (int c); -/* The serial part of checkkey. */ -int serial_checkkey (void); - -/* The serial part of cls. */ -void serial_cls (void); - -/* The serial part of getxy. */ -int serial_getxy (void); - -/* The serial part of gotoxy. */ -void serial_gotoxy (int x, int y); +/* Insert a delay. */ +void serial_hw_delay (void); /* Return the port number for the UNITth serial device. */ -unsigned short serial_get_port (int unit); +unsigned short serial_hw_get_port (int unit); /* Initialize a serial device. */ -int serial_init (unsigned short port, unsigned int speed, - int word_len, int parity, int stop_bit_len); - -/* Check if a serial port is set up. */ -int serial_exists (void); +int serial_hw_init (unsigned short port, unsigned int speed, + int word_len, int parity, int stop_bit_len); #ifdef GRUB_UTIL /* Set the file name of a serial device (or a pty device). This is a function specific to the grub shell. */ -void set_serial_device (const char *device); +void serial_set_device (const char *device); #endif /* GRUB_UTIL */ #endif /* ! GRUB_SERIAL_HEADER */ diff --git a/stage2/shared.h b/stage2/shared.h index b540852c9..539abbe93 100644 --- a/stage2/shared.h +++ b/stage2/shared.h @@ -334,29 +334,16 @@ extern char *grub_scratch_mem; #define ACS_DARROW 'v' /* Special graphics characters for IBM displays. */ -#ifdef GRUB_UTIL -# define DISP_UL ACS_ULCORNER -# define DISP_UR ACS_URCORNER -# define DISP_LL ACS_LLCORNER -# define DISP_LR ACS_LRCORNER -# define DISP_HORIZ ACS_HLINE -# define DISP_VERT ACS_VLINE -# define DISP_LEFT ACS_LARROW -# define DISP_RIGHT ACS_RARROW -# define DISP_UP ACS_UARROW -# define DISP_DOWN ACS_DARROW -#else /* ! GRUB_UTIL */ -# define DISP_UL 218 -# define DISP_UR 191 -# define DISP_LL 192 -# define DISP_LR 217 -# define DISP_HORIZ 196 -# define DISP_VERT 179 -# define DISP_LEFT 0x1b -# define DISP_RIGHT 0x1a -# define DISP_UP 0x18 -# define DISP_DOWN 0x19 -#endif /* ! GRUB_UTIL */ +#define DISP_UL 218 +#define DISP_UR 191 +#define DISP_LL 192 +#define DISP_LR 217 +#define DISP_HORIZ 196 +#define DISP_VERT 179 +#define DISP_LEFT 0x1b +#define DISP_RIGHT 0x1a +#define DISP_UP 0x18 +#define DISP_DOWN 0x19 /* Remap some libc-API-compatible function names so that we prevent circularararity. */ @@ -546,7 +533,7 @@ typedef enum ERR_BAD_ARGUMENT, ERR_UNALIGNED, ERR_PRIVILEGED, - ERR_NEED_SERIAL, + ERR_DEV_NEED_INIT, ERR_NO_DISK_SPACE, ERR_NUMBER_OVERFLOW, @@ -628,8 +615,6 @@ extern void (*disk_read_func) (int, int, int); #ifndef STAGE1_5 /* The flag for debug mode. */ extern int debug; -/* Color settings */ -extern int normal_color, highlight_color; #endif /* STAGE1_5 */ extern unsigned long current_drive; @@ -781,56 +766,29 @@ int currticks (void); /* Clear the screen. */ void cls (void); -/* The console part of cls. */ -void console_cls (void); - -#ifndef GRUB_UTIL /* Turn off cursor. */ void nocursor (void); -#endif /* Get the current cursor position (where 0,0 is the top left hand corner of the screen). Returns packed values, (RET >> 8) is x, (RET & 0xff) is y. */ int getxy (void); -/* The console part of getxy. */ -int console_getxy (void); - /* Set the cursor position. */ void gotoxy (int x, int y); -/* The console part of gotoxy. */ -void console_gotoxy (int x, int y); - /* Displays an ASCII character. IBM displays will translate some characters to special graphical ones (see the DISP_* constants). */ void grub_putchar (int c); -/* The console part of grub_putchar. */ -void console_putchar (int c); - /* Wait for a keypress, and return its packed BIOS/ASCII key code. Use ASCII_CHAR(ret) to extract the ASCII code. */ int getkey (void); -/* The console part of getkey. */ -int console_getkey (void); - /* Like GETKEY, but doesn't block, and returns -1 if no keystroke is available. */ int checkkey (void); -/* The console part of checkkey. */ -int console_checkkey (void); - -/* Sets text mode character attribute at the cursor position. See A_* - constants defined above. */ -void set_attrib (int attr); - -/* The console part of set_attrib. */ -void console_set_attrib (int attr); - /* Low-level disk I/O */ int get_diskinfo (int drive, struct geometry *geometry); int biosdisk (int subfunc, int drive, struct geometry *geometry, @@ -883,18 +841,6 @@ extern kernel_t kernel_type; extern int show_menu; extern int grub_timeout; -/* Control the auto fill mode. */ -extern int auto_fill; - -/* This variable specifies which console should be used. */ -extern int terminal; - -#define TERMINAL_CONSOLE (1 << 0) /* keyboard and screen */ -#define TERMINAL_SERIAL (1 << 1) /* serial console */ -#define TERMINAL_HERCULES (1 << 2) /* hercules */ - -#define TERMINAL_DUMB (1 << 16) /* dumb terminal */ - void init_builtins (void); void init_config (void); char *skip_to (int after_equal, char *cmdline); @@ -951,7 +897,6 @@ int nul_terminate (char *str); int get_based_digit (int c, int base); int safe_parse_maxint (char **str_ptr, int *myint_ptr); int memcheck (int start, int len); -int translate_keycode (int c); #ifndef NO_DECOMPRESSION /* Compression support. */ diff --git a/stage2/stage2.c b/stage2/stage2.c index 1d9eccc12..522d5902f 100644 --- a/stage2/stage2.c +++ b/stage2/stage2.c @@ -1,6 +1,6 @@ /* * GRUB -- GRand Unified Bootloader - * Copyright (C) 2000, 2001 Free Software Foundation, Inc. + * Copyright (C) 2000,2001,2002 Free Software Foundation, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,7 +17,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include "shared.h" +#include +#include grub_jmp_buf restart_env; @@ -75,7 +76,6 @@ close_preset_menu (void) #endif /* ! PRESET_MENU_STRING && ! SUPPORT_DISKLESS */ - static char * get_entry (char *list, int num, int nested) { @@ -93,63 +93,67 @@ get_entry (char *list, int num, int nested) return list; } - +/* Print an entry in a line of the menu box. */ static void -print_entries (int y, int size, int first, char *menu_entries) +print_entry (int y, int highlight, char *entry) +{ + int x; + + highlight = (highlight && current_term->highlight); + + if (highlight) + current_term->highlight (1); + + gotoxy (2, y); + grub_putchar (' '); + for (x = 3; x < 75; x++) + { + if (*entry && x < 71) + grub_putchar (*entry++); + else + grub_putchar (' '); + } + gotoxy (74, y); + + if (highlight) + current_term->highlight (0); +} + +/* Print entries in the menu box. */ +static void +print_entries (int y, int size, int first, int entryno, char *menu_entries) { int i; - int disp_up = DISP_UP; - int disp_down = DISP_DOWN; - -#ifdef SUPPORT_SERIAL - if (terminal & TERMINAL_SERIAL) - { - disp_up = ACS_UARROW; - disp_down = ACS_DARROW; - } -#endif /* SUPPORT_SERIAL */ gotoxy (77, y + 1); if (first) - grub_putchar (disp_up); + grub_putchar (DISP_UP); else grub_putchar (' '); menu_entries = get_entry (menu_entries, first, 0); - for (i = 1; i <= size; i++) + for (i = 0; i < size; i++) { - int j = 0; - - gotoxy (3, y + i); + print_entry (y + i + 1, entryno == i, menu_entries); while (*menu_entries) - { - if (j < 71) - { - grub_putchar (*menu_entries); - j++; - } - - menu_entries++; - } + menu_entries++; if (*(menu_entries - 1)) menu_entries++; - - for (; j < 71; j++) - grub_putchar (' '); } gotoxy (77, y + size); if (*menu_entries) - grub_putchar (disp_down); + grub_putchar (DISP_DOWN); else grub_putchar (' '); -} + gotoxy (74, y + entryno + 1); +} static void print_entries_raw (int size, int first, char *menu_entries) @@ -182,138 +186,33 @@ static void print_border (int y, int size) { int i; - int disp_ul = DISP_UL; - int disp_ur = DISP_UR; - int disp_ll = DISP_LL; - int disp_lr = DISP_LR; - int disp_horiz = DISP_HORIZ; - int disp_vert = DISP_VERT; - -#ifdef SUPPORT_SERIAL - if (terminal & TERMINAL_SERIAL) - { - disp_ul = ACS_ULCORNER; - disp_ur = ACS_URCORNER; - disp_ll = ACS_LLCORNER; - disp_lr = ACS_LRCORNER; - disp_horiz = ACS_HLINE; - disp_vert = ACS_VLINE; - } -#endif /* SUPPORT_SERIAL */ -#ifndef GRUB_UTIL - /* Color the menu. The menu is 75 * 14 characters. */ -# ifdef SUPPORT_SERIAL - if ((terminal & TERMINAL_CONSOLE) -# ifdef SUPPORT_HERCULES - || (terminal & TERMINAL_HERCULES) -# endif - ) -# endif - { - for (i = 0; i < 14; i++) - { - int j; - for (j = 0; j < 75; j++) - { - gotoxy (j + 1, i + y); - set_attrib (normal_color); - } - } - } -#endif - gotoxy (1, y); - grub_putchar (disp_ul); + grub_putchar (DISP_UL); for (i = 0; i < 73; i++) - grub_putchar (disp_horiz); - grub_putchar (disp_ur); + grub_putchar (DISP_HORIZ); + grub_putchar (DISP_UR); i = 1; - while (1) { gotoxy (1, y + i); if (i > size) break; - - grub_putchar (disp_vert); + + grub_putchar (DISP_VERT); gotoxy (75, y + i); - grub_putchar (disp_vert); + grub_putchar (DISP_VERT); i++; } - grub_putchar (disp_ll); + grub_putchar (DISP_LL); for (i = 0; i < 73; i++) - grub_putchar (disp_horiz); - grub_putchar (disp_lr); -} - -static void -set_line (int y, int entryno, int attr, char *menu_entries) -{ - int x; - -#ifdef SUPPORT_SERIAL - if (terminal & TERMINAL_SERIAL) - { - menu_entries = get_entry (menu_entries, entryno, 0); - gotoxy (2, y); - grub_putchar (' '); - for (x = 3; x < 75; x++) - { - if (*menu_entries && x < 71) - grub_putchar (*menu_entries++); - else - grub_putchar (' '); - } - } - else -#endif /* SUPPORT_SERIAL */ - { - for (x = 2; x < 75; x++) - { - gotoxy (x, y); - set_attrib (attr); - } - } - - gotoxy (74, y); -} - -/* Set the attribute of the line Y to normal state. */ -static void -set_line_normal (int y, int entryno, char *menu_entries) -{ -#ifdef GRUB_UTIL - set_line (y, entryno, A_NORMAL, menu_entries); -#else - set_line (y, entryno, normal_color, menu_entries); -#endif -} - -/* Set the attribute of the line Y to highlight state. */ -static void -set_line_highlight (int y, int entryno, char *menu_entries) -{ -#ifdef SUPPORT_SERIAL - if (terminal & TERMINAL_SERIAL) - grub_printf ("\e[7m"); -#endif /* SUPPORT_SERIAL */ - -#ifdef GRUB_UTIL - set_line (y, entryno, A_REVERSE, menu_entries); -#else - set_line (y, entryno, highlight_color, menu_entries); -#endif - -#ifdef SUPPORT_SERIAL - if (terminal & TERMINAL_SERIAL) - grub_printf ("\e[0m"); -#endif /* SUPPORT_SERIAL */ + grub_putchar (DISP_HORIZ); + grub_putchar (DISP_LR); } static void @@ -322,8 +221,6 @@ run_menu (char *menu_entries, char *config_entries, int num_entries, { int c, time1, time2 = -1, first_entry = 0; char *cur_entry = 0; - int disp_up = DISP_UP; - int disp_down = DISP_DOWN; /* * Main loop for menu UI. @@ -331,8 +228,8 @@ run_menu (char *menu_entries, char *config_entries, int num_entries, restart: /* Dumb terminal always use all entries for display - invariant for TERMINAL_DUMB: first_entry == 0 */ - if (! (terminal & TERMINAL_DUMB)) + invariant for TERM_DUMB: first_entry == 0 */ + if (! (current_term->flags & TERM_DUMB)) { while (entryno > 11) { @@ -387,49 +284,17 @@ restart: /* Only display the menu if the user wants to see it. */ if (show_menu) { - /* Disable the auto fill mode. */ - auto_fill = 0; - init_page (); -#ifndef GRUB_UTIL -# ifdef SUPPORT_SERIAL - if (terminal & TERMINAL_CONSOLE) -# endif /* SUPPORT_SERIAL */ - nocursor (); -#endif /* ! GRUB_UTIL */ + nocursor (); - if (! (terminal & TERMINAL_DUMB)) - print_border (3, 12); - -#ifdef GRUB_UTIL - /* In the grub shell, always use ACS_*. */ - disp_up = ACS_UARROW; - disp_down = ACS_DARROW; -#else /* ! GRUB_UTIL */ -# ifdef SUPPORT_SERIAL - if ((terminal & TERMINAL_CONSOLE) -# ifdef SUPPORT_HERCULES - || (terminal & TERMINAL_HERCULES) -# endif /* SUPPORT_HERCULES */ - ) - { - disp_up = DISP_UP; - disp_down = DISP_DOWN; - } + if (! (current_term->flags & TERM_DUMB)) + print_border (3, 12); else - { - disp_up = ACS_UARROW; - disp_down = ACS_DARROW; - } -# endif /* SUPPORT_SERIAL */ -#endif /* ! GRUB_UTIL */ - - if (terminal & TERMINAL_DUMB) - print_entries_raw (num_entries, first_entry, menu_entries); + print_entries_raw (num_entries, first_entry, menu_entries); grub_printf ("\n\ Use the %c and %c keys to select which entry is highlighted.\n", - disp_up, disp_down); + DISP_UP, DISP_DOWN); if (! auth && password) { @@ -451,16 +316,10 @@ restart: selected line, or escape to go back to the main menu."); } - if (terminal & TERMINAL_DUMB) + if (current_term->flags & TERM_DUMB) grub_printf ("\n\nThe selected entry is %d ", entryno); else - { - print_entries (3, 12, first_entry, menu_entries); - - /* highlight initial line */ - set_line_highlight (4 + entryno, first_entry + entryno, - menu_entries); - } + print_entries (3, 12, first_entry, entryno, menu_entries); } /* XX using RT clock now, need to initialize value */ @@ -480,15 +339,16 @@ restart: } /* else not booting yet! */ - time2 = time1; + time2 = time1; - if (terminal & TERMINAL_DUMB) + if (current_term->flags & TERM_DUMB) grub_printf ("\r Entry %d will be booted automatically in %d seconds. ", entryno, grub_timeout); else - { + { gotoxy (3, 22); - printf ("The highlighted entry will be booted automatically in %d seconds. ", grub_timeout); + grub_printf ("The highlighted entry will be booted automatically in %d seconds. ", + grub_timeout); gotoxy (74, 4 + entryno); } @@ -500,26 +360,26 @@ restart: pressed. This avoids polling (relevant in the grub-shell and later on in grub if interrupt driven I/O is done). */ - if ((checkkey () != -1) || (grub_timeout == -1)) + if (checkkey () >= 0 || grub_timeout < 0) { /* Key was pressed, show which entry is selected before GETKEY, since we're comming in here also on GRUB_TIMEOUT == -1 and hang in GETKEY */ - if (terminal & TERMINAL_DUMB) + if (current_term->flags & TERM_DUMB) grub_printf ("\r Highlighted entry is %d: ", entryno); - c = translate_keycode (getkey ()); + c = ASCII_CHAR (getkey ()); if (grub_timeout >= 0) { - if (terminal & TERMINAL_DUMB) + if (current_term->flags & TERM_DUMB) grub_putchar ('\r'); else gotoxy (3, 22); printf (" "); grub_timeout = -1; fallback_entry = -1; - if (! (terminal & TERMINAL_DUMB)) + if (! (current_term->flags & TERM_DUMB)) gotoxy (74, 4 + entryno); } @@ -527,7 +387,7 @@ restart: '^' or 'v' so accept these keys. */ if (c == 16 || c == '^') { - if (terminal & TERMINAL_DUMB) + if (current_term->flags & TERM_DUMB) { if (entryno > 0) entryno--; @@ -536,40 +396,49 @@ restart: { if (entryno > 0) { - set_line_normal (4 + entryno, first_entry + entryno, - menu_entries); + print_entry (4 + entryno, 0, + get_entry (menu_entries, + first_entry + entryno, + 0)); entryno--; - set_line_highlight (4 + entryno, first_entry + entryno, - menu_entries); + print_entry (4 + entryno, 1, + get_entry (menu_entries, + first_entry + entryno, + 0)); } else if (first_entry > 0) { first_entry--; - print_entries (3, 12, first_entry, menu_entries); - set_line_highlight (4, first_entry + entryno, - menu_entries); + print_entries (3, 12, first_entry, entryno, + menu_entries); } } } - if ((c == 14 || c == 'v') && first_entry + entryno + 1 < num_entries) + else if ((c == 14 || c == 'v') + && first_entry + entryno + 1 < num_entries) { - if (terminal & TERMINAL_DUMB) + if (current_term->flags & TERM_DUMB) entryno++; else - if (entryno < 11) - { - set_line_normal (4 + entryno, first_entry + entryno, - menu_entries); - entryno++; - set_line_highlight (4 + entryno, first_entry + entryno, - menu_entries); + { + if (entryno < 11) + { + print_entry (4 + entryno, 0, + get_entry (menu_entries, + first_entry + entryno, + 0)); + entryno++; + print_entry (4 + entryno, 1, + get_entry (menu_entries, + first_entry + entryno, + 0)); } else if (num_entries > 12 + first_entry) { first_entry++; - print_entries (3, 12, first_entry, menu_entries); - set_line_highlight (15, first_entry + entryno, menu_entries); + print_entries (3, 12, first_entry, entryno, menu_entries); } + } } if (config_entries) @@ -581,16 +450,18 @@ restart: { if ((c == 'd') || (c == 'o') || (c == 'O')) { - if (! (terminal & TERMINAL_DUMB)) - set_line_normal (4 + entryno, first_entry + entryno, - menu_entries); + if (! (current_term->flags & TERM_DUMB)) + print_entry (4 + entryno, 0, + get_entry (menu_entries, + first_entry + entryno, + 0)); /* insert after is almost exactly like insert before */ if (c == 'o') { /* But `o' differs from `O', since it may causes the menu screen to scroll up. */ - if (entryno < 11 || (terminal & TERMINAL_DUMB)) + if (entryno < 11 || (current_term->flags & TERM_DUMB)) entryno++; else first_entry++; @@ -604,8 +475,8 @@ restart: if (c == 'O') { - memmove (cur_entry + 2, cur_entry, - ((int) heap) - ((int) cur_entry)); + grub_memmove (cur_entry + 2, cur_entry, + ((int) heap) - ((int) cur_entry)); cur_entry[0] = ' '; cur_entry[1] = 0; @@ -620,7 +491,8 @@ restart: first_entry + entryno + 1, 0); - memmove (cur_entry, ptr, ((int) heap) - ((int) ptr)); + grub_memmove (cur_entry, ptr, + ((int) heap) - ((int) ptr)); heap -= (((int) ptr) - ((int) cur_entry)); num_entries--; @@ -631,7 +503,7 @@ restart: first_entry--; } - if (terminal & TERMINAL_DUMB) + if (current_term->flags & TERM_DUMB) { grub_printf ("\n\n"); print_entries_raw (num_entries, first_entry, @@ -639,11 +511,7 @@ restart: grub_printf ("\n"); } else - { - print_entries (3, 12, first_entry, menu_entries); - set_line_highlight (4 + entryno, first_entry + entryno, - menu_entries); - } + print_entries (3, 12, first_entry, entryno, menu_entries); } cur_entry = menu_entries; @@ -661,13 +529,13 @@ restart: char entered[32]; char *pptr = password; - if (terminal & TERMINAL_DUMB) + if (current_term->flags & TERM_DUMB) grub_printf ("\r "); else gotoxy (1, 21); /* Wipe out the previously entered password */ - memset (entered, 0, sizeof (entered)); + grub_memset (entered, 0, sizeof (entered)); get_cmdline (" Password: ", entered, 31, '*', 0); while (! isspace (*pptr) && *pptr) @@ -704,7 +572,7 @@ restart: } else { - printf ("Failed!\n Press any key to continue..."); + grub_printf ("Failed!\n Press any key to continue..."); getkey (); goto restart; } @@ -774,11 +642,11 @@ restart: } /* align rest of commands properly */ - memmove (cur_entry + j, cur_entry + i, - ((int) heap) - (((int) cur_entry) + i)); + grub_memmove (cur_entry + j, cur_entry + i, + (int) heap - ((int) cur_entry + i)); /* copy command to correct area */ - memmove (cur_entry, new_heap, j); + grub_memmove (cur_entry, new_heap, j); heap += (j - i); } @@ -801,15 +669,13 @@ restart: } } } - + /* Attempt to boot an entry. */ boot_entry: - /* Enable the auto fill mode. */ - auto_fill = 1; cls (); - + while (1) { if (config_entries) @@ -916,7 +782,7 @@ cmain (void) auto void reset (void); void reset (void) { - auto_fill = 1; + count_lines = -1; config_len = 0; menu_len = 0; num_entries = 0;