Hi!
When I heard that new vsta is moving tovards grub, I decided to make
grub actually usable. (I really did not like its old interface). So I
made following patch which might be quite interesting.
Sorry for being slightly offtopic, and merry chrismas,
Pavel
(Hmm, is there better place for this mail?)
-- -- I'm really pavel@atrey.karlin.mff.cuni.cz. Pavel Look at http://atrey.karlin.mff.cuni.cz/~pavel ;-). Hi! I patched grub to make it compile (for me) and to make it user interface better. (Much better in my eyes, now grub is usable for me.) Timeout=0 now has good sense, and only key in buffer or holding of shift will stop booting sequence. You can jump directly to entry in menu by selecting first character of its title. Space is bind to editing of second line of current config entry - this is for lilo-like editing of command line. Share and enjoy! Pavel PS: I know some of my changes are dirty hack which should be implemented other way. If you are willing to accept changes (and tell me how to code that better in one case), I'll clean it up. diff -ur 0.4-grub/configure grub-mine/configure --- 0.4-grub/configure Mon Oct 7 06:45:42 1996 +++ grub-mine/configure Tue Aug 5 02:10:32 1997 @@ -1,4 +1,5 @@ #!/bin/sh +PATH=$PATH:. # # My mini-configure, used only for: @@ -374,7 +370,7 @@ for link_addr in $addrs_to_check ; do echo "Linking test_asm.o with ${LD} at $link_addr" >> ../config.log - ${LD} -Ttext $link_addr -o test_asm test_asm.o >> ../config.log 2>&1 + ${LD} -N -Ttext $link_addr -o test_asm test_asm.o >> ../config.log 2>&1 check_exit_status ${LD} echo "Running test_offset on test_asm" >> ../config.log @@ -439,6 +435,5 @@ # Delete test directory # -rm -rf .conf_test_dir diff -ur 0.4-grub/docs/commands.txt grub-mine/docs/commands.txt --- 0.4-grub/docs/commands.txt Mon Oct 7 09:32:27 1996 +++ grub-mine/docs/commands.txt Tue Aug 5 03:28:07 1997 @@ -20,7 +20,7 @@ -- Options are separated by spaces. - -- All numbers can be either decimal or hexidecimal. A hexidecimal number + -- Any number can be either decimal or hexadecimal. A hexadecimal number must be preceeded by "0x", and is case insensitive. -- Extra options/text at the end of the line is ignored unless otherwise @@ -208,5 +208,4 @@ (so "sector" is offset from the start of the disk). Filesystem test mode is turned off by any uses of the "install=" or - "testload=" commands. - + "testload=" commands. \ No newline at end of file diff -ur 0.4-grub/shared_src/asm.S grub-mine/shared_src/asm.S --- 0.4-grub/shared_src/asm.S Sun Sep 29 02:35:28 1996 +++ grub-mine/shared_src/asm.S Sun Dec 21 23:49:47 1997 @@ -120,9 +120,10 @@ call EXT_C(prot_to_real) /* - * This next part is sort of evil. It takes advantage of the - * byte ordering on the x86 to work in either 16-bit or 32-bit - * mode, so think about it before changing it. + * ? This next part is sort of evil. It takes advantage of the + * ? byte ordering on the x86 to work in either 16-bit or 32-bit + * ? mode, so think about it before changing it. + * XXX comment seems outdated to me, pavel@atrey.karlin.mff.cuni.cz */ ENTRY(hard_stop) @@ -639,7 +640,7 @@ push %eax push %ebx - movl 0x10(%esp), %bl + movb 0x10(%esp), %bl /* if not '\n', just print the character */ cmpb $0xa, %bl @@ -1373,6 +1374,11 @@ jmp pending notpending: + movb $0x2, %ah + int $0x16 + testb $0x43, %al + mov $0x0, %ebx + jnz pending movl $0xFFFFFFFF, %ebx pending: diff -ur 0.4-grub/shared_src/char_io.c grub-mine/shared_src/char_io.c --- 0.4-grub/shared_src/char_io.c Thu Sep 19 11:03:58 1996 +++ grub-mine/shared_src/char_io.c Tue Aug 5 13:22:05 1997 @@ -130,9 +130,7 @@ void init_page(void) { - cls(); - - printf("\n GRUB version %s (%dK lower / %dK upper memory)\n\n", + printf("Grub V%s (mem %dK/%dK)", version_string, mbi.mem_lower, mbi.mem_upper); } @@ -180,7 +178,7 @@ void cl_init() { /* distinguish us from other lines and error messages! */ - putchar('\n'); + /* putchar('\n'); - better not, it looks horibly */ /* print full line and set position here */ ystart = (getxy() & 0xFF); Only in grub-mine/shared_src: char_io.c~ diff -ur 0.4-grub/shared_src/cmdline.c grub-mine/shared_src/cmdline.c --- 0.4-grub/shared_src/cmdline.c Thu Oct 3 17:26:24 1996 +++ grub-mine/shared_src/cmdline.c Sun Dec 21 21:14:47 1997 @@ -77,9 +77,7 @@ void init_cmdline(void) { - printf(" [ Minimal BASH-like line editing is supported. For the first word, TAB - lists possible command completions. Anywhere else TAB lists the possible - completions of a device/filename. ESC at any time exits. ]\n"); + printf(" (tab help, esc exit)\n" ); } @@ -162,6 +160,7 @@ if (!script) { + cls(); init_page(); init_cmdline(); } @@ -203,7 +202,7 @@ print_error(); } - if (run_cmdline && get_cmdline("command> ", commands, cur_heap, 2048)) + if (run_cmdline && get_cmdline("Grub: ", commands, cur_heap, 2048)) return 1; if (strcmp("boot", cur_heap) == 0 || (script && !*cur_heap)) Only in grub-mine/shared_src: cmdline.c~ diff -ur 0.4-grub/stage1/Makefile grub-mine/stage1/Makefile --- 0.4-grub/stage1/Makefile Wed Sep 18 05:13:00 1996 +++ grub-mine/stage1/Makefile Tue Aug 5 01:54:41 1997 @@ -13,7 +13,6 @@ $(LD) -N -Ttext 7C00 -o stage1.exec stage1.o dd if=stage1.exec of=stage1.noheader bs=$(HEADER_7C00) skip=1 dd if=stage1.noheader of=../bin/stage1 bs=512 count=1 - rm stage1.exec stage1.noheader clean: rm -f stage1.o Only in grub-mine/stage1: Makefile~ diff -ur 0.4-grub/stage1/stage1.S grub-mine/stage1/stage1.S --- 0.4-grub/stage1/stage1.S Wed Sep 18 08:51:49 1996 +++ grub-mine/stage1/stage1.S Tue Aug 5 03:07:49 1997 @@ -44,8 +44,8 @@ #define CHAR_a 'a' /* messages displayed at all times */ -#define CHAR_S 'S' -#define CHAR_J 'J' +#define CHAR_S '.' +#define CHAR_J '.' /* error messages */ Only in grub-mine/stage1: stage1.S~ Only in grub-mine/stage1: stage1.exec Only in grub-mine/stage1: stage1.noheader Only in grub-mine/stage1: stage1.o diff -ur 0.4-grub/stage2/Makefile grub-mine/stage2/Makefile --- 0.4-grub/stage2/Makefile Wed Sep 18 05:17:11 1996 +++ grub-mine/stage2/Makefile Tue Aug 5 02:35:50 1997 @@ -61,9 +61,8 @@ # "asm.o" absolutely has to come first in the link line! ../bin/stage2: $(SHARED_OBJS) $(OBJS) Makefile ../Makefile $(LD) -N -Ttext 8000 -o stage2.exec $(SHARED_OBJS) $(OBJS) - $(STRIP) stage2.exec - dd if=stage2.exec of=../bin/stage2 bs=$(HEADER_8000) skip=1 - rm stage2.exec +# $(STRIP) stage2.exec + dd if=stage2.exec of=../bin/stage2 bs=128 skip=1 clean: rm -f $(SHARED_OBJS) $(OBJS) diff -ur 0.4-grub/stage2/main.c grub-mine/stage2/main.c --- 0.4-grub/stage2/main.c Thu Sep 19 02:01:02 1996 +++ grub-mine/stage2/main.c Sun Dec 21 23:40:21 1997 @@ -136,7 +136,7 @@ void run_menu(char *menu_entries, char *config_entries, int num_entries, - char *heap, int entryno) + char *heap, int entryno, int xfer) { int c, time1, time2 = -1, first_entry = 0; char *cur_entry; @@ -151,22 +151,19 @@ first_entry++; entryno--; } + cls(); init_page(); print_border(3, 12); - printf("\n - Use the \x18 and \x19 keys for selecting which entry is highlighted.\n"); + printf("\n"); if (config_entries) - printf(" Press enter to boot the selected OS, \'e\' to edit the - commands before booting, or \'c\' for a command-line."); - else - printf( -" Press \'b\' to boot, enter to edit the selected command in the - boot sequence, \'c\' for a command-line, \'o\' to open a new line - after (\'O\' for before) the selected line, \'d\' to remove the - selected line, or escape to go back to the main menu."); + printf( "\n \x18, \x19 move, enter boot, end edit, tab command mode, space edit & launch." ); + else { + printf( "\n \x18, \x19 move, Boot, enter edit, tab command mode, esc back.\n" ); + printf( " INSert line, Insert line after, DELete line, esc back." ); + } print_entries(3, 12, first_entry, menu_entries); @@ -181,25 +178,10 @@ /* initilize to NULL just in case... */ cur_entry = NULL; - if (timeout >= 0 && (time1 = getrtsecs()) != time2 && time1 != 0xFF) + if (xfer || checkkey() != -1) { - if (timeout <= 0) - { - timeout = -1; - break; - } - - /* else not booting yet! */ - time2 = time1; - gotoxy(3, 22); - printf("The highlighted entry will be booted automatically in %d seconds. ", timeout); - gotoxy(74, 4+entryno); - timeout--; - } - - if (checkkey() != -1) - { - c = getkey(); + if (!(c = xfer)) + c = getkey(); if (timeout >= 0) { @@ -242,28 +224,26 @@ } } - c = ASCII_CHAR(c); - if (config_entries) { - if ((c == '\n') || (c == '\r')) + if ((ASCII_CHAR(c) == '\n') || (ASCII_CHAR(c) == '\r')) break; } else { - if ((c == 'd') || (c == 'o') || (c == 'O')) + if ((c == KEY_DELETE) || (c == KEY_INSERT) || (ASCII_CHAR(c) == 'i')) { set_line(4+entryno, 0x7); /* insert after is almost exactly like insert before */ - if (c == 'o') + if (ASCII_CHAR(c) == 'i') { entryno++; - c = 'O'; + c = KEY_INSERT; } cur_entry = get_entry(menu_entries, first_entry+entryno, 0); - if (c == 'O') + if (c == KEY_INSERT) { bcopy(cur_entry, cur_entry+2, ((int)heap) - ((int)cur_entry)); @@ -295,14 +275,14 @@ } cur_entry = menu_entries; - if (c == 27) + if (ASCII_CHAR(c) == 27) return; - if (c == 'b') + if (ASCII_CHAR(c) == 'b') break; } - if ((config_entries && (c == 'e')) - || (!config_entries && ((c == '\n') || (c == '\r')))) + if ((config_entries && ((c == KEY_END) || (ASCII_CHAR(c) == ' '))) + || (!config_entries && ((ASCII_CHAR(c) == '\n') || (ASCII_CHAR(c) == '\r')))) { int num_entries = 0, i = 0; char *new_heap; @@ -332,7 +312,11 @@ *(new_heap++) = 0; if (config_entries) - run_menu(heap, NULL, num_entries, new_heap, 0); + { + cls(); + run_menu(heap, NULL, num_entries, new_heap, + (ASCII_CHAR(c)==' '?1:0), (ASCII_CHAR(c)==' '?'\n':0)); + } else { cls(); @@ -366,16 +350,53 @@ bcopy(new_heap, cur_entry, j); heap += (j - i); + if (xfer) + { xfer = 0; break; } } + xfer = 0; } goto restart; } - if (c == 'c') + if (ASCII_CHAR(c) == 9) { + cls(); enter_cmdline(NULL, heap); goto restart; } + c = ASCII_CHAR(c) | 0x20; + if (config_entries && (((c > 'a') && (c < 'z')) || ((c > '0') && (c < '9')))) { + /* Unknown key, try comparing it to first char of title of each */ + int i; + char *cur_entry; + for(i=0; i<num_entries; i++) { + cur_entry = get_entry(menu_entries, i, 0); + if ((*cur_entry | 0x20) == c) + break; + } + if (i<num_entries) { + entryno = i; + first_entry = 0; + goto restart; + /* OK, it should be selected by now. */ + } + } + } + + if (timeout >= 0 && (time1 = getrtsecs()) != time2 && time1 != 0xFF) + { + if (timeout <= 0) + { + timeout = -1; + break; + } + + /* else not booting yet! */ + time2 = time1; + gotoxy(3, 22); + printf("The highlighted entry will be booted automatically in %d seconds. ", timeout); + gotoxy(74, 4+entryno); + timeout--; } } @@ -467,6 +488,7 @@ char *config_entries = (char *)(mbi.mmap_addr + mbi.mmap_length); char *menu_entries = (char *)(BUFFERADDR + (32 * 1024)); + printf( ". " ); /* * Here load the configuration file. */ @@ -554,8 +576,8 @@ * Run menu interface (this shouldn't return!). */ + cls(); run_menu(menu_entries, config_entries, num_entries, - menu_entries+menu_len, default_entry); + menu_entries+menu_len, default_entry, 0); + while(1); } - -Received on Tue Dec 23 12:40:56 1997
This archive was generated by hypermail 2.1.8 : Thu Sep 22 2005 - 15:12:43 PDT