?? grub-0.97-patch5-splash
字號:
diff -Naur grub-0.97_emulation/ChangeLog grub-0.97_splash/ChangeLog--- grub-0.97_emulation/ChangeLog 2006-10-24 12:28:51.000000000 +0800+++ grub-0.97_splash/ChangeLog 2006-10-24 12:28:51.000000000 +0800@@ -1,6 +1,28 @@ 2005-05-11 From Tinybit <tinybit@163.net>:+ For splashimage support:+ * configure.ac: splashimage++ * stage2/asm.S: splashimage++ * stage2/builtins.c: splashimage++ * stage2/char_io.c: splashimage++ * stage2/graphics.c: (new file) splashimage++ * stage2/graphics.h: (new file) splashimage++ * stage2/Makefile.am: splashimage++ * stage2/shared.h: splashimage++ * stage2/stage2.c: splashimage++ * stage2/term.h: splashimage++ From Tinybit <tinybit@163.net>: For disk drive emulation: * stage2/asm.S (int13_handler, etc): floppy and harddisk emulation diff -Naur grub-0.97_emulation/configure.ac grub-0.97_splash/configure.ac--- grub-0.97_emulation/configure.ac 2006-10-24 12:28:51.000000000 +0800+++ grub-0.97_splash/configure.ac 2006-10-24 12:28:51.000000000 +0800@@ -602,6 +602,11 @@ [ --enable-diskless enable diskless support]) AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes) +dnl Graphical splashscreen support+AC_ARG_ENABLE(graphics,+ [ --disable-graphics disable graphics terminal support])+AM_CONDITIONAL(GRAPHICS_SUPPORT, test "x$enable_graphics" != xno)+ dnl Hercules terminal AC_ARG_ENABLE(hercules, [ --disable-hercules disable hercules terminal support])diff -Naur grub-0.97_emulation/INSTALL grub-0.97_splash/INSTALL--- grub-0.97_emulation/INSTALL 2006-10-24 12:28:51.000000000 +0800+++ grub-0.97_splash/INSTALL 2006-10-24 12:28:51.000000000 +0800@@ -239,6 +239,9 @@ `--without-curses' Don't use the curses library. +`--disable-graphics'+ Omit the graphics console support in Stage 2.+ `--disable-hercules' Omit the hercules console support in Stage 2. diff -Naur grub-0.97_emulation/stage2/asm.S grub-0.97_splash/stage2/asm.S--- grub-0.97_emulation/stage2/asm.S 2006-10-24 12:28:51.000000000 +0800+++ grub-0.97_splash/stage2/asm.S 2006-10-24 12:28:51.000000000 +0800@@ -7255,6 +7255,165 @@ pop %ebx pop %ebp ret++/* graphics mode functions */+#ifdef SUPPORT_GRAPHICS+VARIABLE(cursorX)+.word 0+VARIABLE(cursorY)+.word 0+VARIABLE(cursorCount)+.word 0+VARIABLE(cursorBuf)+.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0++ +/*+ * int set_videomode(mode)+ * BIOS call "INT 10H Function 0h" to set video mode+ * Call with %ah = 0x0+ * %al = video mode+ * Returns old videomode.+ */+ENTRY(set_videomode)+ push %ebp+ push %ebx+ push %ecx++ movb 0x10(%esp), %cl++ call EXT_C(prot_to_real)++ .code16++ //sti /* it is not bad keeping interrupt off */++ xorw %bx, %bx+ movb $0xf, %ah+ int $0x10 /* Get Current Video mode */+ movb %al, %ch+ xorb %ah, %ah+ movb %cl, %al+ int $0x10 /* Set Video mode */++ DATA32 call EXT_C(real_to_prot)+ .code32++ xorb %ah, %ah+ movb %ch, %al++ pop %ecx+ pop %ebx+ pop %ebp+ ret+++/*+ * unsigned char * graphics_get_font()+ * BIOS call "INT 10H Function 11h" to set font+ * Call with %ah = 0x11+ */+ENTRY(graphics_get_font)+ push %ebp+ push %ebx+ push %ecx+ push %edx++ call EXT_C(prot_to_real)++ .code16++ //sti /* it is not bad keeping interrupt off */++ movw $0x1130, %ax+ movb $6, %bh /* font 8x16 */+ int $0x10+ movw %bp, %dx+ movw %es, %cx++ DATA32 call EXT_C(real_to_prot)+ .code32++ xorl %eax, %eax+ movw %cx, %ax+ shll $4, %eax+ movw %dx, %ax++ pop %edx+ pop %ecx+ pop %ebx+ pop %ebp+ ret+ ++ +/*+ * graphics_set_palette(index, red, green, blue)+ * BIOS call "INT 10H Function 10h" to set individual dac register+ * Call with %ah = 0x10+ * %bx = register number+ * %ch = new value for green (0-63)+ * %cl = new value for blue (0-63)+ * %dh = new value for red (0-63)+ */++ENTRY(graphics_set_palette)+ push %ebp+ push %eax+ push %ebx+ push %ecx+ push %edx++ movw $0x3c8, %bx /* address write mode register */++ /* wait vertical retrace */++ movw $0x3da, %dx+l1b: inb %dx, %al /* wait vertical active display */+ test $8, %al+ jnz l1b++l2b: inb %dx, %al /* wait vertical retrace */+ test $8, %al+ jnz l2b++ mov %bx, %dx+ movb 0x18(%esp), %al /* index */+ outb %al, %dx+ inc %dx++ movb 0x1c(%esp), %al /* red */+ outb %al, %dx++ movb 0x20(%esp), %al /* green */+ outb %al, %dx++ movb 0x24(%esp), %al /* blue */+ outb %al, %dx++ movw 0x18(%esp), %bx++ call EXT_C(prot_to_real)++ .code16++ //sti /* it is not bad keeping interrupt off */++ movb %bl, %bh+ movw $0x1000, %ax+ int $0x10++ DATA32 call EXT_C(real_to_prot)+ .code32 ++ pop %edx+ pop %ecx+ pop %ebx+ pop %eax+ pop %ebp+ ret++#endif /* SUPPORT_GRAPHICS */ /* * getrtsecs()diff -Naur grub-0.97_emulation/stage2/builtins.c grub-0.97_splash/stage2/builtins.c--- grub-0.97_emulation/stage2/builtins.c 2006-10-24 12:28:51.000000000 +0800+++ grub-0.97_splash/stage2/builtins.c 2006-10-24 12:28:51.000000000 +0800@@ -569,12 +569,22 @@ boot_func (char *arg, int flags) { int old_cursor;+ struct term_entry *prev_term = current_term; /* Clear the int15 handler if we can boot the kernel successfully. This assumes that the boot code never fails only if KERNEL_TYPE is not KERNEL_TYPE_NONE. Is this assumption is bad? */ if (kernel_type != KERNEL_TYPE_NONE) unset_int15_handler (); + /* if our terminal needed initialization, we should shut it down+ * before booting the kernel, but we want to save what it was so+ * we can come back if needed */+ if (current_term->shutdown) + {+ (*current_term->shutdown)();+ current_term = term_table; /* assumption: console is first */+ }+ #ifdef SUPPORT_NETBOOT /* Shut down the networking. */ cleanup_net ();@@ -910,7 +920,14 @@ //return 1; } + /* if we get back here, we should go back to what our term was before */ setcursor (old_cursor);+ current_term = prev_term;+ if (current_term->startup)+ /* if our terminal fails to initialize, fall back to console since+ * it should always work */+ if ((*current_term->startup)() == 0)+ current_term = term_table; /* we know that console is first */ return errnum; } @@ -2375,6 +2392,142 @@ #endif /* SUPPORT_NETBOOT */ +static int terminal_func (char *arg, int flags);++#ifdef SUPPORT_GRAPHICS++static int+splashimage_func(char *arg, int flags)+{+ char splashimage[64];+ //int i;++ /* filename can only be 64 characters due to our buffer size */+ if (strlen(arg) > 63)+ return errnum = ERR_WONT_FIT;+ +// if (flags == BUILTIN_CMDLINE) {+ if (! grub_open(arg))+ return 1;+ grub_close();+// }++ strcpy(splashimage, arg);++ /* get rid of TERM_NEED_INIT from the graphics terminal. */+ for (i = 0; term_table[i].name; i++) {+ if (grub_strcmp (term_table[i].name, "graphics") == 0) {+ term_table[i].flags &= ~TERM_NEED_INIT;+ break;+ }+ }+ + graphics_set_splash (splashimage);++ if (/* flags == BUILTIN_CMDLINE && */ graphics_inited) {+ graphics_end();+ if (! graphics_init())+ return errnum = ERR_EXEC_FORMAT;+ graphics_cls();+ }++ /* FIXME: should we be explicitly switching the terminal as a + * side effect here? */+ terminal_func("graphics", flags);++ return 0;+}++static struct builtin builtin_splashimage =+{+ "splashimage",+ splashimage_func,+ BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,+ "splashimage FILE",+ "Load FILE as the background image when in graphics mode."+};+++/* foreground */+static int+foreground_func(char *arg, int flags)+{+ if (grub_strlen(arg) == 6) {+ int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2;+ int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2;+ int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2;++ foreground = (r << 16) | (g << 8) | b;+ if (graphics_inited)+ graphics_set_palette(15, r, g, b);++ return (0);+ }++ return (1);+}++static struct builtin builtin_foreground =+{+ "foreground",+ foreground_func,+ BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,+ "foreground RRGGBB",+ "Sets the foreground color when in graphics mode."+ "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."+};+++/* background */+static int+background_func(char *arg, int flags)+{+ if (grub_strlen(arg) == 6) {+ int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2;+ int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2;+ int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2;++ background = (r << 16) | (g << 8) | b;+ if (graphics_inited)+ graphics_set_palette(0, r, g, b);+ return (0);+ }++ return (1);+}++static struct builtin builtin_background =+{+ "background",+ background_func,+ BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,+ "background RRGGBB",+ "Sets the background color when in graphics mode."+ "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."+};++#endif /* SUPPORT_GRAPHICS */++/* clear */+static int +clear_func() +{+ if (current_term->cls)+ current_term->cls();++ return 0;+}++static struct builtin builtin_clear =+{+ "clear",+ clear_func,+ BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST,+ "clear",+ "Clear the screen"+};++ /* displayapm */ static int displayapm_func (char *arg, int flags)@@ -7914,7 +8067,7 @@ }; -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES)+#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS) /* terminal */ static int terminal_func (char *arg, int flags)@@ -8077,13 +8230,18 @@ if (lines) max_lines = lines; else- /* 24 would be a good default value. */- max_lines = 24;+ max_lines = current_term->max_lines; /* If the interface is currently the command-line, restart it to repaint the screen. */ if (current_term != prev_term && (flags & BUILTIN_CMDLINE))+ {+ if (prev_term->shutdown)+ prev_term->shutdown();+ if (current_term->startup)+ current_term->startup(); grub_longjmp (restart_cmdline_env, 0);+ } return 0; }@@ -8093,7 +8251,7 @@ "terminal", terminal_func, BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST,- "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules]",+ "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules] [graphics]", "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"@@ -8105,7 +8263,7 @@ " seconds. The option --lines specifies the maximum number of lines." " The option --silent is used to suppress messages." };-#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */+#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */ #ifdef SUPPORT_SERIAL@@ -8790,6 +8948,9 @@ /* The table of builtin commands. Sorted in dictionary order. */ struct builtin *builtin_table[] = {+#ifdef SUPPORT_GRAPHICS+ &builtin_background,+#endif &builtin_blocklist, #ifndef GRUB_UTIL &builtin_boot,
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -