I tested the stage2 emulator, and found a minor bug (that didn't
update the cursor correctly when pushing space key) and an option is
necessary to wait until I attach with a debugger when I want to debug
the start-up code. Here is my patch for these.
Another problem: grub won't load the configuration file,
menu.lst. Investigating the problem with GDB, this seems to be because
install_partition is invalid. I'm wondering if it's good that the
partition where /sbin/grub is located is used as install_partition, or
if it's good that users can specify it by a command-line option. Which
way do you think is good for it?
Index: grub/ChangeLog
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/ChangeLog,v
retrieving revision 1.17
diff -c -r1.17 ChangeLog
*** ChangeLog 1999/03/23 14:28:55 1.17
--- ChangeLog 1999/03/25 02:22:38
***************
*** 1,3 ****
--- 1,13 ----
+ 1999-03-25 OKUJI Yoshinori <[EMAIL PROTECTED]>
+
+ * char_io.c (get_cmdline): Call cl_setcpos even if lpos == llen,
+ because ncurses won't update the cursor position.
+
+ * grub/main.c (OPT_HOLD): New macro.
+ (longopts): New option --hold.
+ (usage): Add the documentation about --hold.
+ (main): Set hold if --hold is specified. Wait until clear it.
+
1999-03-22 Gordon Matzigkeit <[EMAIL PROTECTED]>
* shared_src/cmdline.c (enter_cmdline): Check the return value of
Index: grub/grub/main.c
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/grub/main.c,v
retrieving revision 1.2
diff -c -r1.2 main.c
*** main.c 1999/03/15 02:08:02 1.2
--- main.c 1999/03/25 02:22:50
***************
*** 23,39 ****
--- 23,42 ----
#include <stdio.h>
#include <getopt.h>
+ #include <unistd.h>
char *program_name = 0;
#define OPT_HELP -2
#define OPT_VERSION -3
+ #define OPT_HOLD -4
#define OPTSTRING ""
static struct option longopts[] =
{
{"help", no_argument, 0, OPT_HELP},
{"version", no_argument, 0, OPT_VERSION},
+ {"hold", no_argument, 0, OPT_HOLD},
{0},
};
***************
*** 52,57 ****
--- 55,61 ----
\n\
--help display this message and exit\n\
--version print version information and exit\n\
+ --hold wait until a debugger will attach\n\
",
program_name);
***************
*** 63,68 ****
--- 67,73 ----
main (int argc, char **argv)
{
int c;
+ int hold = 0;
program_name = argv[0];
/* Parse command-line options. */
***************
*** 84,94 ****
--- 89,107 ----
exit (0);
break;
+ case OPT_HOLD:
+ hold = 1;
+ break;
+
default:
usage (1);
}
}
while (c != EOF);
+
+ /* Wait until clear the variable `hold' by a debugger. */
+ while (hold)
+ sleep (1);
/* Transfer control to the stage2 simulator. */
exit (grub_stage2 ());
Index: grub/shared_src/char_io.c
===================================================================
RCS file: /gd/gnu/anoncvsroot/grub/shared_src/char_io.c,v
retrieving revision 1.9
diff -c -r1.9 char_io.c
*** char_io.c 1999/03/23 14:28:58 1.9
--- char_io.c 1999/03/25 02:22:51
***************
*** 362,367 ****
--- 362,368 ----
cmdline[lpos + 1] = 0;
cl_print (cmdline + lpos);
lpos++;
+ cl_setcpos ();
}
else
{
----------------------------------------------------------------------
OKUJI Yoshinori <[EMAIL PROTECTED]> ^o-o^
http://duff.kuicr.kyoto-u.ac.jp/~okuji (in English) m /