Grub hat wieder ein huebsches Splashimage.

git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@801 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
ms
2007-08-22 16:23:15 +00:00
parent 3fa3a0f947
commit 4ff9093d27
10 changed files with 1945 additions and 508 deletions

View File

@@ -0,0 +1,28 @@
diff -ur grub-0.91/docs/grub.texi grub/docs/grub.texi
--- grub-0.91/docs/grub.texi Mon Jan 21 22:57:46 2002
+++ grub/docs/grub.texi Mon Jan 21 22:57:51 2002
@@ -1891,6 +1891,7 @@
* rarp:: Initialize a network device via RARP
* serial:: Set up a serial device
* setkey:: Configure the key map
+* splashimage:: Use a splash image
* terminal:: Choose a terminal
* tftpserver:: Specify a TFTP server
* unhide:: Unhide a partition
@@ -2260,6 +2261,16 @@
@end deffn
+@node splashimage
+@subsection splashimage
+
+@deffn Command splashimage file
+Select an image to use as the background image. This should be
+specified using normal GRUB device naming syntax. The format of the
+file is a gzipped xpm which is 640x480 with a 14 color palette.
+@end deffn
+
+
@node terminal
@subsection terminal

View File

@@ -0,0 +1,39 @@
--- grub-0.93/stage2/builtins.c.bootterm 2002-12-29 02:01:50.000000000 -0500
+++ grub-0.93/stage2/builtins.c 2002-12-29 02:01:07.000000000 -0500
@@ -233,12 +233,22 @@
static int
boot_func (char *arg, int flags)
{
+ 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 ();
@@ -302,6 +312,13 @@
return 1;
}
+ /* if we get back here, we should go back to what our term was before */
+ 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 0;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
--- grub-0.95/stage2/graphics.c.old 2005-01-11 09:34:17.125451981 -0500
+++ grub-0.95/stage2/graphics.c 2005-01-11 09:34:03.743949015 -0500
@@ -108,12 +108,8 @@
* mode. */
int graphics_init()
{
- if (!graphics_inited) {
- saved_videomode = set_videomode(0x12);
- }
-
if (!read_image(splashimage)) {
- set_videomode(saved_videomode);
+ current_term = term_table;
grub_printf("failed to read image\n");
return 0;
}
@@ -303,6 +299,8 @@
if (!xpm_open(s))
return 0;
+ saved_videomode = set_videomode(0x12);
+
/* parse info */
while (grub_read(&c, 1)) {
if (c == '"')

View File

@@ -0,0 +1,55 @@
--- grub-0.95/stage2/graphics.c.xpmjunk 2005-01-04 17:01:35.492804523 -0500
+++ grub-0.95/stage2/graphics.c 2005-01-04 17:02:52.722495885 -0500
@@ -262,6 +262,35 @@
return;
}
+/* Open the file, and search for a valid XPM header. Return 1 if one is found,
+ * leaving the current position as the start of the next line. Else,
+ * return 0.
+ */
+int xpm_open(const char *s) {
+ char buf, prev, target[]="/* XPM */\n";
+ int pos=0;
+
+ if (!grub_open(s))
+ return 0;
+
+ prev='\n';
+ buf=0;
+ do {
+ if (grub_read(&buf, 1) != 1) {
+ grub_close();
+ return 0;
+ }
+ if ((pos == 0 && prev == '\n') || pos > 0) {
+ if (buf == target[pos])
+ pos++;
+ else
+ pos=0;
+ }
+ prev=buf;
+ } while (target[pos]);
+ return 1;
+}
+
/* Read in the splashscreen image and set the palette up appropriately.
* Format of splashscreen is an xpm (can be gzipped) with 16 colors and
* 640x480. */
@@ -271,15 +300,9 @@
unsigned char c, base, mask, *s1, *s2, *s4, *s8;
unsigned i, len, idx, colors, x, y, width, height;
- if (!grub_open(s))
+ if (!xpm_open(s))
return 0;
- /* read header */
- if (!grub_read((char*)&buf, 10) || grub_memcmp(buf, "/* XPM */\n", 10)) {
- grub_close();
- return 0;
- }
-
/* parse info */
while (grub_read(&c, 1)) {
if (c == '"')