1 Submitted By: Jim Gifford (jim at linuxfromscratch dot org)
3 Initial Package Version: 0.97
5 Upstream Status: Unknown
6 Description: Contains various fixes and enhancements
9 XFS Filesystem Boot Freeze Fixes
10 Removed 2GB Memory Limitation
12 Fixes for initrd support
13 Grub installation Fixes
14 Linux 2.6 geometry Fixes
16 Autoconf and aclocal updates
18 http://trac.cross-lfs.org/browser/trunk/patches/grub-0.97-fixes-1.patch
20 diff -Naur grub-0.97.orig/aclocal.m4 grub-0.97/aclocal.m4
21 --- grub-0.97.orig/aclocal.m4 2005-05-07 19:41:18.000000000 -0700
22 +++ grub-0.97/aclocal.m4 2006-07-04 00:08:22.000000000 -0700
24 -# generated automatically by aclocal 1.9.4 -*- Autoconf -*-
25 +# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
27 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
28 -# Free Software Foundation, Inc.
29 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
30 +# 2005 Free Software Foundation, Inc.
31 # This file is free software; the Free Software Foundation
32 # gives unlimited permission to copy and/or distribute it,
33 # with or without modifications, as long as this notice is preserved.
35 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A
39 -# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
40 -# Generated from amversion.in; do not edit by hand.
42 -# This program is free software; you can redistribute it and/or modify
43 -# it under the terms of the GNU General Public License as published by
44 -# the Free Software Foundation; either version 2, or (at your option)
47 -# This program is distributed in the hope that it will be useful,
48 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
49 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50 -# GNU General Public License for more details.
52 -# You should have received a copy of the GNU General Public License
53 -# along with this program; if not, write to the Free Software
54 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
55 +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc.
57 +# This file is free software; the Free Software Foundation
58 +# gives unlimited permission to copy and/or distribute it,
59 +# with or without modifications, as long as this notice is preserved.
61 # AM_AUTOMAKE_VERSION(VERSION)
62 # ----------------------------
64 # Call AM_AUTOMAKE_VERSION so it can be traced.
65 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
66 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
67 - [AM_AUTOMAKE_VERSION([1.9.4])])
71 -# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
72 + [AM_AUTOMAKE_VERSION([1.9.6])])
74 -# This program is free software; you can redistribute it and/or modify
75 -# it under the terms of the GNU General Public License as published by
76 -# the Free Software Foundation; either version 2, or (at your option)
78 +# AM_AUX_DIR_EXPAND -*- Autoconf -*-
80 -# This program is distributed in the hope that it will be useful,
81 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
82 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83 -# GNU General Public License for more details.
85 -# You should have received a copy of the GNU General Public License
86 -# along with this program; if not, write to the Free Software
87 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
89 +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
91 +# This file is free software; the Free Software Foundation
92 +# gives unlimited permission to copy and/or distribute it,
93 +# with or without modifications, as long as this notice is preserved.
95 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
96 # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
98 am_aux_dir=`cd $ac_aux_dir && pwd`
101 -# AM_CONDITIONAL -*- Autoconf -*-
102 +# AM_CONDITIONAL -*- Autoconf -*-
104 -# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
106 -# This program is free software; you can redistribute it and/or modify
107 -# it under the terms of the GNU General Public License as published by
108 -# the Free Software Foundation; either version 2, or (at your option)
109 -# any later version.
111 -# This program is distributed in the hope that it will be useful,
112 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
113 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
114 -# GNU General Public License for more details.
116 -# You should have received a copy of the GNU General Public License
117 -# along with this program; if not, write to the Free Software
118 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
120 +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
121 +# Free Software Foundation, Inc.
123 +# This file is free software; the Free Software Foundation
124 +# gives unlimited permission to copy and/or distribute it,
125 +# with or without modifications, as long as this notice is preserved.
130 # AM_CONDITIONAL(NAME, SHELL-CONDITION)
131 # -------------------------------------
132 @@ -149,26 +116,15 @@
133 Usually this means the macro was only invoked conditionally.]])
136 -# serial 7 -*- Autoconf -*-
138 -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
139 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
140 # Free Software Foundation, Inc.
142 +# This file is free software; the Free Software Foundation
143 +# gives unlimited permission to copy and/or distribute it,
144 +# with or without modifications, as long as this notice is preserved.
146 -# This program is free software; you can redistribute it and/or modify
147 -# it under the terms of the GNU General Public License as published by
148 -# the Free Software Foundation; either version 2, or (at your option)
149 -# any later version.
151 -# This program is distributed in the hope that it will be useful,
152 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
153 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
154 -# GNU General Public License for more details.
156 -# You should have received a copy of the GNU General Public License
157 -# along with this program; if not, write to the Free Software
158 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
163 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
164 # written in clear, in which case automake, when reading aclocal.m4,
166 # CC etc. in the Makefile, will ask for an AC_PROG_CC use...
170 # _AM_DEPENDENCIES(NAME)
171 # ----------------------
172 # See how the compiler implements dependency checking.
173 @@ -317,27 +272,16 @@
174 AC_SUBST([AMDEPBACKSLASH])
177 -# Generate code to set up dependency tracking. -*- Autoconf -*-
179 -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004
180 -# Free Software Foundation, Inc.
182 -# This program is free software; you can redistribute it and/or modify
183 -# it under the terms of the GNU General Public License as published by
184 -# the Free Software Foundation; either version 2, or (at your option)
185 -# any later version.
186 +# Generate code to set up dependency tracking. -*- Autoconf -*-
188 -# This program is distributed in the hope that it will be useful,
189 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
190 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
191 -# GNU General Public License for more details.
193 -# You should have received a copy of the GNU General Public License
194 -# along with this program; if not, write to the Free Software
195 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
197 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
198 +# Free Software Foundation, Inc.
200 +# This file is free software; the Free Software Foundation
201 +# gives unlimited permission to copy and/or distribute it,
202 +# with or without modifications, as long as this notice is preserved.
207 # _AM_OUTPUT_DEPENDENCY_COMMANDS
208 # ------------------------------
209 @@ -396,30 +340,19 @@
210 [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
213 -# Do all the work for Automake. -*- Autoconf -*-
214 +# Do all the work for Automake. -*- Autoconf -*-
216 -# This macro actually does too much some checks are only needed if
217 -# your package does certain things. But this isn't really a big deal.
219 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
220 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
221 # Free Software Foundation, Inc.
223 +# This file is free software; the Free Software Foundation
224 +# gives unlimited permission to copy and/or distribute it,
225 +# with or without modifications, as long as this notice is preserved.
227 -# This program is free software; you can redistribute it and/or modify
228 -# it under the terms of the GNU General Public License as published by
229 -# the Free Software Foundation; either version 2, or (at your option)
230 -# any later version.
232 -# This program is distributed in the hope that it will be useful,
233 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
234 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
235 -# GNU General Public License for more details.
237 -# You should have received a copy of the GNU General Public License
238 -# along with this program; if not, write to the Free Software
239 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
244 +# This macro actually does too much. Some checks are only needed if
245 +# your package does certain things. But this isn't really a big deal.
247 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
248 # AM_INIT_AUTOMAKE([OPTIONS])
249 @@ -521,51 +454,27 @@
251 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
253 +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
255 +# This file is free software; the Free Software Foundation
256 +# gives unlimited permission to copy and/or distribute it,
257 +# with or without modifications, as long as this notice is preserved.
261 # Define $install_sh.
263 -# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
265 -# This program is free software; you can redistribute it and/or modify
266 -# it under the terms of the GNU General Public License as published by
267 -# the Free Software Foundation; either version 2, or (at your option)
268 -# any later version.
270 -# This program is distributed in the hope that it will be useful,
271 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
272 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
273 -# GNU General Public License for more details.
275 -# You should have received a copy of the GNU General Public License
276 -# along with this program; if not, write to the Free Software
277 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
280 AC_DEFUN([AM_PROG_INSTALL_SH],
281 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
282 install_sh=${install_sh-"$am_aux_dir/install-sh"}
283 AC_SUBST(install_sh)])
286 -# Copyright (C) 2003 Free Software Foundation, Inc.
288 -# This program is free software; you can redistribute it and/or modify
289 -# it under the terms of the GNU General Public License as published by
290 -# the Free Software Foundation; either version 2, or (at your option)
291 -# any later version.
293 -# This program is distributed in the hope that it will be useful,
294 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
295 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
296 -# GNU General Public License for more details.
298 -# You should have received a copy of the GNU General Public License
299 -# along with this program; if not, write to the Free Software
300 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
302 +# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
304 +# This file is free software; the Free Software Foundation
305 +# gives unlimited permission to copy and/or distribute it,
306 +# with or without modifications, as long as this notice is preserved.
311 # Check whether the underlying file-system supports filenames
312 # with a leading dot. For instance MS-DOS doesn't.
313 @@ -580,28 +489,17 @@
314 rmdir .tst 2>/dev/null
315 AC_SUBST([am__leading_dot])])
317 -# Add --enable-maintainer-mode option to configure.
318 +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
321 -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004
322 +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
323 # Free Software Foundation, Inc.
325 +# This file is free software; the Free Software Foundation
326 +# gives unlimited permission to copy and/or distribute it,
327 +# with or without modifications, as long as this notice is preserved.
329 -# This program is free software; you can redistribute it and/or modify
330 -# it under the terms of the GNU General Public License as published by
331 -# the Free Software Foundation; either version 2, or (at your option)
332 -# any later version.
334 -# This program is distributed in the hope that it will be useful,
335 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
336 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
337 -# GNU General Public License for more details.
339 -# You should have received a copy of the GNU General Public License
340 -# along with this program; if not, write to the Free Software
341 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
347 AC_DEFUN([AM_MAINTAINER_MODE],
348 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
349 @@ -620,26 +518,15 @@
351 AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
353 -# Check to see how 'make' treats includes. -*- Autoconf -*-
355 -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
356 +# Check to see how 'make' treats includes. -*- Autoconf -*-
358 -# This program is free software; you can redistribute it and/or modify
359 -# it under the terms of the GNU General Public License as published by
360 -# the Free Software Foundation; either version 2, or (at your option)
361 -# any later version.
363 -# This program is distributed in the hope that it will be useful,
364 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
365 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
366 -# GNU General Public License for more details.
368 -# You should have received a copy of the GNU General Public License
369 -# along with this program; if not, write to the Free Software
370 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
372 +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
374 +# This file is free software; the Free Software Foundation
375 +# gives unlimited permission to copy and/or distribute it,
376 +# with or without modifications, as long as this notice is preserved.
383 @@ -683,27 +570,16 @@
390 -# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
392 -# This program is free software; you can redistribute it and/or modify
393 -# it under the terms of the GNU General Public License as published by
394 -# the Free Software Foundation; either version 2, or (at your option)
395 -# any later version.
396 +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
398 -# This program is distributed in the hope that it will be useful,
399 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
400 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
401 -# GNU General Public License for more details.
403 -# You should have received a copy of the GNU General Public License
404 -# along with this program; if not, write to the Free Software
405 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
407 +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
408 +# Free Software Foundation, Inc.
410 +# This file is free software; the Free Software Foundation
411 +# gives unlimited permission to copy and/or distribute it,
412 +# with or without modifications, as long as this notice is preserved.
417 # AM_MISSING_PROG(NAME, PROGRAM)
418 # ------------------------------
419 @@ -729,27 +605,16 @@
423 +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
425 +# This file is free software; the Free Software Foundation
426 +# gives unlimited permission to copy and/or distribute it,
427 +# with or without modifications, as long as this notice is preserved.
431 # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
433 -# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
435 -# This program is free software; you can redistribute it and/or modify
436 -# it under the terms of the GNU General Public License as published by
437 -# the Free Software Foundation; either version 2, or (at your option)
438 -# any later version.
440 -# This program is distributed in the hope that it will be useful,
441 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
442 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
443 -# GNU General Public License for more details.
445 -# You should have received a copy of the GNU General Public License
446 -# along with this program; if not, write to the Free Software
447 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
451 # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
452 # created by `make install' are always world readable, even if the
453 # installer happens to have an overly restrictive umask (e.g. 077).
454 @@ -803,26 +668,15 @@
456 AC_SUBST([mkdir_p])])
458 -# Helper functions for option handling. -*- Autoconf -*-
459 +# Helper functions for option handling. -*- Autoconf -*-
461 -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
463 -# This program is free software; you can redistribute it and/or modify
464 -# it under the terms of the GNU General Public License as published by
465 -# the Free Software Foundation; either version 2, or (at your option)
466 -# any later version.
468 -# This program is distributed in the hope that it will be useful,
469 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
470 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
471 -# GNU General Public License for more details.
473 -# You should have received a copy of the GNU General Public License
474 -# along with this program; if not, write to the Free Software
475 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
477 +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
479 +# This file is free software; the Free Software Foundation
480 +# gives unlimited permission to copy and/or distribute it,
481 +# with or without modifications, as long as this notice is preserved.
486 # _AM_MANGLE_OPTION(NAME)
487 # -----------------------
488 @@ -847,28 +701,16 @@
489 AC_DEFUN([_AM_IF_OPTION],
490 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
493 -# Check to make sure that the build environment is sane.
496 -# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
498 -# This program is free software; you can redistribute it and/or modify
499 -# it under the terms of the GNU General Public License as published by
500 -# the Free Software Foundation; either version 2, or (at your option)
501 -# any later version.
502 +# Check to make sure that the build environment is sane. -*- Autoconf -*-
504 -# This program is distributed in the hope that it will be useful,
505 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
506 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
507 -# GNU General Public License for more details.
509 -# You should have received a copy of the GNU General Public License
510 -# along with this program; if not, write to the Free Software
511 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
513 +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
514 +# Free Software Foundation, Inc.
516 +# This file is free software; the Free Software Foundation
517 +# gives unlimited permission to copy and/or distribute it,
518 +# with or without modifications, as long as this notice is preserved.
525 @@ -911,25 +753,14 @@
529 -# AM_PROG_INSTALL_STRIP
531 -# Copyright (C) 2001, 2003 Free Software Foundation, Inc.
533 -# This program is free software; you can redistribute it and/or modify
534 -# it under the terms of the GNU General Public License as published by
535 -# the Free Software Foundation; either version 2, or (at your option)
536 -# any later version.
538 -# This program is distributed in the hope that it will be useful,
539 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
540 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
541 -# GNU General Public License for more details.
543 -# You should have received a copy of the GNU General Public License
544 -# along with this program; if not, write to the Free Software
545 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
547 +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
549 +# This file is free software; the Free Software Foundation
550 +# gives unlimited permission to copy and/or distribute it,
551 +# with or without modifications, as long as this notice is preserved.
553 +# AM_PROG_INSTALL_STRIP
554 +# ---------------------
555 # One issue with vendor `install' (even GNU) is that you can't
556 # specify the program used to strip binaries. This is especially
557 # annoying in cross-compiling environments, where the build's strip
558 @@ -952,25 +783,13 @@
560 # Check how to create a tarball. -*- Autoconf -*-
562 -# Copyright (C) 2004 Free Software Foundation, Inc.
564 -# This program is free software; you can redistribute it and/or modify
565 -# it under the terms of the GNU General Public License as published by
566 -# the Free Software Foundation; either version 2, or (at your option)
567 -# any later version.
569 -# This program is distributed in the hope that it will be useful,
570 -# but WITHOUT ANY WARRANTY; without even the implied warranty of
571 -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
572 -# GNU General Public License for more details.
574 -# You should have received a copy of the GNU General Public License
575 -# along with this program; if not, write to the Free Software
576 -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
580 +# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
582 +# This file is free software; the Free Software Foundation
583 +# gives unlimited permission to copy and/or distribute it,
584 +# with or without modifications, as long as this notice is preserved.
588 # _AM_PROG_TAR(FORMAT)
589 # --------------------
590 diff -Naur grub-0.97.orig/ChangeLog grub-0.97/ChangeLog
591 --- grub-0.97.orig/ChangeLog 2005-05-07 19:47:02.000000000 -0700
592 +++ grub-0.97/ChangeLog 2006-07-04 00:01:50.000000000 -0700
594 +2006-05-02 Pavel Roskin <proski@gnu.org>
596 + * stage2/stage2.c (run_menu): Fix "savedefault" to save only top
597 + level menu positions. Remember current position when calling a
598 + submenu. Don't recalculate it when booting from a submenu.
600 + * grub/main.c (main): Make sure the boot drive number doesn't
603 +2006-05-02 Vesa Jaaskelainen <chaac@nic.fi>
605 + * stage2/shared.h (vbe_mode): Back ported aligment fix from GRUB 2
606 + to GRUB Legacy. Problem reported by Gerardo Richarte.
608 +2006-04-23 Robert Millan <robertmh@gnu.org>
610 + * grub/asmstub.c (get_diskinfo): Optimize sysctl routine.
612 +2006-04-20 Robert Millan <robertmh@gnu.org>
614 + Fixes for kernel of FreeBSD:
615 + * grub/asmstub.c (get_diskinfo): Toggle "kern.geom.debugflags" sysctl
616 + before opening a device for writing.
617 + * util/grub-install.in: Devices don't have this "r" prefix anymore.
619 +2006-04-16 Yoshinori K. Okuji <okuji@enbug.org>
621 + * docs/multiboot.texi: Correct the offset of address
622 + fields. Reported by Jeroen Dekkers.
624 +2006-03-21 Yoshinori K. Okuji <okuji@enbug.org>
626 + * stage2/builtins.c (setup_func): Specify the size of DEVICE to
627 + grub_strncat instead of a strange number 256. Reported by Vitaly
628 + Fertman <vitaly@namesys.com>.
630 +2005-09-29 Yoshinori K. Okuji <okuji@enbug.org>
632 + * docs/multiboot.texi: Fix a bug in the byte order of
633 + boot_device. I hope this won't affect any OS image.
634 + Increased the version number to 0.6.94.
636 +2005-09-28 Yoshinori K. Okuji <okuji@enbug.org>
638 + * stage2/boot.c (load_image): Even if an OS image is an ELF
639 + object, use the a.out kludge if MULTIBOOT_AOUT_KLUDGE is
642 2005-05-08 Yoshinori K. Okuji <okuji@enbug.org>
644 * configure.ac (AC_INIT): Upgraded to 0.97.
645 diff -Naur grub-0.97.orig/configure grub-0.97/configure
646 --- grub-0.97.orig/configure 2005-05-07 19:48:12.000000000 -0700
647 +++ grub-0.97/configure 2006-07-04 00:08:05.000000000 -0700
652 -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT PERL CC ac_ct_CC CFLAGS LDFLAGS CPPFLAGS EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CCAS RANLIB ac_ct_RANLIB STAGE1_CFLAGS STAGE2_CFLAGS GRUB_CFLAGS OBJCOPY ac_ct_OBJCOPY GRUB_LIBS CPP EGREP NETBOOT_SUPPORT_TRUE NETBOOT_SUPPORT_FALSE DISKLESS_SUPPORT_TRUE DISKLESS_SUPPORT_FALSE HERCULES_SUPPORT_TRUE HERCULES_SUPPORT_FALSE SERIAL_SUPPORT_TRUE SERIAL_SUPPORT_FALSE SERIAL_SPEED_SIMULATION_TRUE SERIAL_SPEED_SIMULATION_FALSE BUILD_EXAMPLE_KERNEL_TRUE BUILD_EXAMPLE_KERNEL_FALSE FSYS_CFLAGS NET_CFLAGS NET_EXTRAFLAGS NETBOOT_DRIVERS CCASFLAGS LIBOBJS LTLIBOBJS'
653 +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar build build_cpu build_vendor build_os host host_cpu host_vendor host_os MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT PERL CC ac_ct_CC CFLAGS LDFLAGS CPPFLAGS EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CCAS RANLIB ac_ct_RANLIB STAGE1_CFLAGS STAGE2_CFLAGS GRUB_CFLAGS OBJCOPY ac_ct_OBJCOPY GRUB_LIBS CPP EGREP NETBOOT_SUPPORT_TRUE NETBOOT_SUPPORT_FALSE DISKLESS_SUPPORT_TRUE DISKLESS_SUPPORT_FALSE GRAPHICS_SUPPORT_TRUE GRAPHICS_SUPPORT_FALSE HERCULES_SUPPORT_TRUE HERCULES_SUPPORT_FALSE SERIAL_SUPPORT_TRUE SERIAL_SUPPORT_FALSE SERIAL_SPEED_SIMULATION_TRUE SERIAL_SPEED_SIMULATION_FALSE BUILD_EXAMPLE_KERNEL_TRUE BUILD_EXAMPLE_KERNEL_FALSE FSYS_CFLAGS NET_CFLAGS NET_EXTRAFLAGS NETBOOT_DRIVERS CCASFLAGS LIBOBJS LTLIBOBJS'
656 # Initialize some variables set by options.
658 set the default memory location for WD/SMC
659 --enable-cs-scan=LIST probe for CS89x0 base address using LIST
660 --enable-diskless enable diskless support
661 + --disable-graphics disable graphics terminal support
662 --disable-hercules disable hercules terminal support
663 --disable-serial disable serial terminal support
664 --enable-serial-speed-simulation
665 @@ -5966,6 +5967,22 @@
669 +# Check whether --enable-graphics or --disable-graphics was given.
670 +if test "${enable_graphics+set}" = set; then
671 + enableval="$enable_graphics"
676 +if test "x$enable_graphics" != xno; then
677 + GRAPHICS_SUPPORT_TRUE=
678 + GRAPHICS_SUPPORT_FALSE='#'
680 + GRAPHICS_SUPPORT_TRUE='#'
681 + GRAPHICS_SUPPORT_FALSE=
685 # Check whether --enable-hercules or --disable-hercules was given.
686 if test "${enable_hercules+set}" = set; then
687 enableval="$enable_hercules"
688 @@ -6270,6 +6287,13 @@
689 Usually this means the macro was only invoked conditionally." >&2;}
690 { (exit 1); exit 1; }; }
692 +if test -z "${GRAPHICS_SUPPORT_TRUE}" && test -z "${GRAPHICS_SUPPORT_FALSE}"; then
693 + { { echo "$as_me:$LINENO: error: conditional \"GRAPHICS_SUPPORT\" was never defined.
694 +Usually this means the macro was only invoked conditionally." >&5
695 +echo "$as_me: error: conditional \"GRAPHICS_SUPPORT\" was never defined.
696 +Usually this means the macro was only invoked conditionally." >&2;}
697 + { (exit 1); exit 1; }; }
699 if test -z "${HERCULES_SUPPORT_TRUE}" && test -z "${HERCULES_SUPPORT_FALSE}"; then
700 { { echo "$as_me:$LINENO: error: conditional \"HERCULES_SUPPORT\" was never defined.
701 Usually this means the macro was only invoked conditionally." >&5
702 @@ -6907,6 +6931,8 @@
703 s,@NETBOOT_SUPPORT_FALSE@,$NETBOOT_SUPPORT_FALSE,;t t
704 s,@DISKLESS_SUPPORT_TRUE@,$DISKLESS_SUPPORT_TRUE,;t t
705 s,@DISKLESS_SUPPORT_FALSE@,$DISKLESS_SUPPORT_FALSE,;t t
706 +s,@GRAPHICS_SUPPORT_TRUE@,$GRAPHICS_SUPPORT_TRUE,;t t
707 +s,@GRAPHICS_SUPPORT_FALSE@,$GRAPHICS_SUPPORT_FALSE,;t t
708 s,@HERCULES_SUPPORT_TRUE@,$HERCULES_SUPPORT_TRUE,;t t
709 s,@HERCULES_SUPPORT_FALSE@,$HERCULES_SUPPORT_FALSE,;t t
710 s,@SERIAL_SUPPORT_TRUE@,$SERIAL_SUPPORT_TRUE,;t t
711 diff -Naur grub-0.97.orig/configure.ac grub-0.97/configure.ac
712 --- grub-0.97.orig/configure.ac 2005-05-07 19:36:03.000000000 -0700
713 +++ grub-0.97/configure.ac 2006-07-03 23:58:41.000000000 -0700
715 [ --enable-diskless enable diskless support])
716 AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes)
718 +dnl Graphical splashscreen support
719 +AC_ARG_ENABLE(graphics,
720 + [ --disable-graphics disable graphics terminal support])
721 +AM_CONDITIONAL(GRAPHICS_SUPPORT, test "x$enable_graphics" != xno)
723 dnl Hercules terminal
724 AC_ARG_ENABLE(hercules,
725 [ --disable-hercules disable hercules terminal support])
726 diff -Naur grub-0.97.orig/docs/grub.8 grub-0.97/docs/grub.8
727 --- grub-0.97.orig/docs/grub.8 2005-05-07 19:48:56.000000000 -0700
728 +++ grub-0.97/docs/grub.8 2006-07-04 00:01:50.000000000 -0700
730 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23.
731 -.TH GRUB "8" "May 2005" "grub (GNU GRUB 0.97)" FSF
732 +.TH GRUB "8" "September 2005" "grub (GNU GRUB 0.97)" FSF
734 grub \- the grub shell
736 diff -Naur grub-0.97.orig/docs/grub.texi grub-0.97/docs/grub.texi
737 --- grub-0.97.orig/docs/grub.texi 2005-05-07 19:59:59.000000000 -0700
738 +++ grub-0.97/docs/grub.texi 2006-07-04 00:00:54.000000000 -0700
739 @@ -2199,6 +2199,7 @@
740 * rarp:: Initialize a network device via RARP
741 * serial:: Set up a serial device
742 * setkey:: Configure the key map
743 +* splashimage:: Use a splash image
744 * terminal:: Choose a terminal
745 * terminfo:: Define escape sequences for a terminal
746 * tftpserver:: Specify a TFTP server
747 @@ -2578,6 +2579,16 @@
752 +@subsection splashimage
754 +@deffn Command splashimage file
755 +Select an image to use as the background image. This should be
756 +specified using normal GRUB device naming syntax. The format of the
757 +file is a gzipped xpm which is 640x480 with a 14 color palette.
764 @@ -2685,6 +2696,7 @@
765 * module:: Load a module
766 * modulenounzip:: Load a module without decompression
767 * pause:: Wait for a key press
768 +* print:: Print a message
769 * quit:: Exit from the grub shell
770 * reboot:: Reboot your computer
771 * read:: Read data from memory
772 @@ -3091,6 +3103,16 @@
779 +@deffn Command print message @dots{}
780 +Print the @var{message}. Note that placing @key{^G} (ASCII code 7) in the
781 +message will cause the speaker to emit the standard beep sound, which is
782 +useful for visually impaired people.
789 diff -Naur grub-0.97.orig/docs/multiboot.texi grub-0.97/docs/multiboot.texi
790 --- grub-0.97.orig/docs/multiboot.texi 2003-07-09 04:45:36.000000000 -0700
791 +++ grub-0.97/docs/multiboot.texi 2006-07-04 00:01:50.000000000 -0700
794 Copyright @copyright{} 1995, 96 Bryan Ford <baford@@cs.utah.edu>
795 Copyright @copyright{} 1995, 96 Erich Stefan Boleyn <erich@@uruk.org>
796 -Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
797 +Copyright @copyright{} 1999, 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc.
799 Permission is granted to make and distribute verbatim copies of
800 this manual provided the copyright notice and this permission notice
802 @vskip 0pt plus 1filll
803 Copyright @copyright{} 1995, 96 Bryan Ford <baford@@cs.utah.edu>
804 Copyright @copyright{} 1995, 96 Erich Stefan Boleyn <erich@@uruk.org>
805 -Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
806 +Copyright @copyright{} 1999, 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc.
808 Permission is granted to make and distribute verbatim copies of
809 this manual provided the copyright notice and this permission notice
811 @top Multiboot Specification
813 This file documents Multiboot Specification, the proposal for the boot
814 -sequence standard. This edition documents version 0.6.93.
815 +sequence standard. This edition documents version 0.6.94.
822 If bit 16 in the @samp{flags} word is set, then the fields at offsets
823 -8-24 in the Multiboot header are valid, and the boot loader should use
824 +12-28 in the Multiboot header are valid, and the boot loader should use
825 them instead of the fields in the actual executable header to calculate
826 where to load the OS image. This information does not need to be
827 provided if the kernel image is in @sc{elf} format, but it @emph{must}
831 +-------+-------+-------+-------+
832 -| drive | part1 | part2 | part3 |
833 +| part3 | part2 | part1 | drive |
834 +-------+-------+-------+-------+
837 @@ -1199,6 +1199,13 @@
838 @email{bug-grub@@gnu.org}, from Bryan Ford and Erich Stefan Boleyn.
842 +The byte order of the @samp{boot_device} in Multiboot information is
843 +reversed. This was a mistake.
846 +The offset of the address fields were wrong.
851 diff -Naur grub-0.97.orig/grub/asmstub.c grub-0.97/grub/asmstub.c
852 --- grub-0.97.orig/grub/asmstub.c 2005-02-16 12:45:14.000000000 -0800
853 +++ grub-0.97/grub/asmstub.c 2006-07-04 00:01:50.000000000 -0700
855 #include <sys/time.h>
858 +#include <sys/mman.h>
862 +#define PAGESIZE 4096
866 # include <sys/ioctl.h> /* ioctl */
868 # endif /* ! BLKFLSBUF */
869 #endif /* __linux__ */
871 +#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
872 +# include <sys/sysctl.h>
875 /* We want to prevent any circularararity in our stubs, as well as
876 libc name clashes. */
877 #define WITHOUT_LIBC_STUBS 1
879 assert (grub_scratch_mem == 0);
880 scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15);
887 + /* Align to a multiple of PAGESIZE, assumed to be a power of two. */
888 + p = (char *) (((long) scratch) & ~(PAGESIZE - 1));
890 + /* The simulated stack needs to be executable, since GCC uses stack
891 + * trampolines to implement nested functions.
893 + ret = mprotect (p, 0x100000 + EXTENDED_MEMSIZE + 15,
894 + PROT_READ | PROT_WRITE | PROT_EXEC);
898 grub_scratch_mem = (char *) ((((int) scratch) >> 4) << 4);
900 /* FIXME: simulate the memory holes using mprot, if available. */
903 /* Open read/write, or read-only if that failed. */
905 - disks[drive].flags = open (devname, O_RDWR);
907 +/* By default, kernel of FreeBSD does not allow overwriting MBR */
908 +#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
909 +#define GEOM_SYSCTL "kern.geom.debugflags"
910 + int old_flags, flags;
911 + size_t sizeof_int = sizeof (int);
913 + if (sysctlbyname (GEOM_SYSCTL, &old_flags, &sizeof_int, NULL, 0) != 0)
914 + grub_printf ("failed to get " GEOM_SYSCTL "sysctl: %s\n", strerror (errno));
916 + if ((old_flags & 0x10) == 0)
918 + /* "allow foot shooting", see geom(4) */
919 + flags = old_flags | 0x10;
921 + if (sysctlbyname (GEOM_SYSCTL, NULL, NULL, &flags, sizeof (int)) != 0)
924 + grub_printf ("failed to set " GEOM_SYSCTL "sysctl: %s\n", strerror (errno));
930 + disks[drive].flags = open (devname, O_RDWR);
931 +#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
932 + if (flags != old_flags)
934 + if (sysctlbyname (GEOM_SYSCTL, NULL, NULL, &old_flags, sizeof (int)) != 0)
935 + grub_printf ("failed to set " GEOM_SYSCTL "sysctl: %s\n", strerror (errno));
940 if (disks[drive].flags == -1)
942 diff -Naur grub-0.97.orig/grub/main.c grub-0.97/grub/main.c
943 --- grub-0.97.orig/grub/main.c 2003-07-09 04:45:36.000000000 -0700
944 +++ grub-0.97/grub/main.c 2006-07-04 00:01:50.000000000 -0700
946 #define WITHOUT_LIBC_STUBS 1
951 char *program_name = 0;
952 int use_config_file = 1;
957 + if (boot_drive >= NUM_DISKS)
959 + fprintf (stderr, "boot_drive should be from 0 to %d\n",
965 case OPT_NO_CONFIG_FILE:
966 diff -Naur grub-0.97.orig/lib/device.c grub-0.97/lib/device.c
967 --- grub-0.97.orig/lib/device.c 2005-03-27 15:14:25.000000000 -0800
968 +++ grub-0.97/lib/device.c 2006-07-04 00:00:44.000000000 -0700
969 @@ -131,6 +131,152 @@
973 +#if defined(__linux__)
974 +/* The 2.6 kernel has removed all of the geometry handling for IDE drives
975 + * that did fixups for LBA, etc. This means that the geometry we get
976 + * with the ioctl has a good chance of being wrong. So, we get to
977 + * also know about partition tables and try to read what the geometry
978 + * is there. *grumble* Very closely based on code from cfdisk
980 +static void get_kernel_geometry(int fd, long long *cyl, int *heads, int *sectors) {
981 + struct hd_geometry hdg;
983 + if (ioctl (fd, HDIO_GETGEO, &hdg))
986 + *cyl = hdg.cylinders;
987 + *heads = hdg.heads;
988 + *sectors = hdg.sectors;
992 + unsigned char boot_ind; /* 0x80 - active */
993 + unsigned char head; /* starting head */
994 + unsigned char sector; /* starting sector */
995 + unsigned char cyl; /* starting cylinder */
996 + unsigned char sys_ind; /* What partition type */
997 + unsigned char end_head; /* end head */
998 + unsigned char end_sector; /* end sector */
999 + unsigned char end_cyl; /* end cylinder */
1000 + unsigned char start4[4]; /* starting sector counting from 0 */
1001 + unsigned char size4[4]; /* nr of sectors in partition */
1004 +#define ALIGNMENT 2
1007 + unsigned char align[ALIGNMENT];
1008 + unsigned char b[SECTOR_SIZE];
1011 + unsigned char align[ALIGNMENT];
1012 + unsigned char buffer[0x1BE];
1013 + struct partition part[4];
1014 + unsigned char magicflag[2];
1018 +#define PART_TABLE_FLAG0 0x55
1019 +#define PART_TABLE_FLAG1 0xAA
1022 +get_partition_table_geometry(partition_table *bufp, long long *cyl, int *heads,
1024 + struct partition *p;
1029 + if (bufp->p.magicflag[0] != PART_TABLE_FLAG0 ||
1030 + bufp->p.magicflag[1] != PART_TABLE_FLAG1) {
1031 + /* Matthew Wilcox: slightly friendlier version of
1032 + fatal(_("Bad signature on partition table"), 3);
1034 + fprintf(stderr, "Unknown partition table signature\n");
1039 + for (i=0; i<4; i++) {
1040 + p = &(bufp->p.part[i]);
1041 + if (p->sys_ind != 0) {
1042 + h = p->end_head + 1;
1043 + s = (p->end_sector & 077);
1048 + } else if (hh != h || ss != s)
1053 + if (!first && !bad) {
1059 +static long long my_lseek (unsigned int fd, long long offset,
1060 + unsigned int origin)
1062 +#if defined(__linux__) && (!defined(__GLIBC__) || \
1063 + ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))))
1064 + /* Maybe libc doesn't have large file support. */
1065 + loff_t offset, result;
1066 + static int _llseek (uint filedes, ulong hi, ulong lo,
1067 + loff_t *res, uint wh);
1068 + _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo,
1069 + loff_t *, res, uint, wh);
1071 + if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET) < 0)
1072 + return (long long) -1;
1075 + return lseek(fd, offset, SEEK_SET);
1079 +static void get_linux_geometry (int fd, struct geometry *geom) {
1080 + long long kern_cyl = 0; int kern_head = 0, kern_sectors = 0;
1081 + long long pt_cyl = 0; int pt_head = 0, pt_sectors = 0;
1082 + partition_table bufp;
1083 + char *buff, *buf_unaligned;
1085 + buf_unaligned = malloc(sizeof(partition_table) + 4095);
1086 + buff = (char *) (((unsigned long)buf_unaligned + 4096 - 1) &
1089 + get_kernel_geometry(fd, &kern_cyl, &kern_head, &kern_sectors);
1091 + if (my_lseek (fd, 0*SECTOR_SIZE, SEEK_SET) < 0) {
1092 + fprintf(stderr, "Unable to seek");
1095 + if (read(fd, buff, SECTOR_SIZE) == SECTOR_SIZE) {
1096 + memcpy(bufp.c.b, buff, SECTOR_SIZE);
1097 + get_partition_table_geometry(&bufp, &pt_cyl, &pt_head, &pt_sectors);
1099 + fprintf(stderr, "Unable to read partition table: %s\n", strerror(errno));
1102 + if (pt_head && pt_sectors) {
1105 + geom->heads = pt_head;
1106 + geom->sectors = pt_sectors;
1107 + cyl_size = pt_head * pt_sectors;
1108 + geom->cylinders = geom->total_sectors/cyl_size;
1110 + geom->heads = kern_head;
1111 + geom->sectors = kern_sectors;
1112 + geom->cylinders = kern_cyl;
1119 /* Get the geometry of a drive DRIVE. */
1121 get_drive_geometry (struct geometry *geom, char **map, int drive)
1122 @@ -151,21 +297,16 @@
1123 #if defined(__linux__)
1126 - struct hd_geometry hdg;
1129 - if (ioctl (fd, HDIO_GETGEO, &hdg))
1132 if (ioctl (fd, BLKGETSIZE, &nr))
1135 /* Got the geometry, so save it. */
1136 - geom->cylinders = hdg.cylinders;
1137 - geom->heads = hdg.heads;
1138 - geom->sectors = hdg.sectors;
1139 geom->total_sectors = nr;
1141 + get_linux_geometry(fd, geom);
1142 + if (!geom->heads && !geom->cylinders && !geom->sectors)
1147 @@ -403,6 +544,18 @@
1151 +get_cciss_disk_name (char *name, int controller, int drive)
1153 + sprintf (name, "/dev/cciss/c%dd%d", controller, drive);
1157 +get_ida_disk_name (char *name, int controller, int drive)
1159 + sprintf (name, "/dev/ida/c%dd%d", controller, drive);
1163 get_ataraid_disk_name (char *name, int unit)
1165 sprintf (name, "/dev/ataraid/d%c", unit + '0');
1166 @@ -801,6 +954,74 @@
1171 + /* This is for CCISS, its like the DAC960 - we have
1172 + /dev/cciss/<controller>d<logical drive>p<partition>
1174 + It currently supports up to 3 controllers, 10 logical volumes
1177 + Code gratuitously copied from DAC960 above.
1178 + Horms <horms@verge.net.au> 23rd July 2004
1181 + int controller, drive;
1183 + for (controller = 0; controller < 2; controller++)
1185 + for (drive = 0; drive < 9; drive++)
1189 + get_cciss_disk_name (name, controller, drive);
1190 + if (check_device (name))
1192 + (*map)[num_hd + 0x80] = strdup (name);
1193 + assert ((*map)[num_hd + 0x80]);
1195 + /* If the device map file is opened, write the map. */
1197 + fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
1205 + /* This is for Compaq Smart Array, its like the DAC960 - we have
1206 + /dev/ida/<controller>d<logical drive>p<partition>
1208 + It currently supports up to 3 controllers, 10 logical volumes
1211 + Code gratuitously copied from DAC960 above.
1212 + Piotr Roszatycki <dexter@debian.org>
1215 + int controller, drive;
1217 + for (controller = 0; controller < 2; controller++)
1219 + for (drive = 0; drive < 9; drive++)
1223 + get_ida_disk_name (name, controller, drive);
1224 + if (check_device (name))
1226 + (*map)[num_hd + 0x80] = strdup (name);
1227 + assert ((*map)[num_hd + 0x80]);
1229 + /* If the device map file is opened, write the map. */
1231 + fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
1238 #endif /* __linux__ */
1240 /* OK, close the device map file if opened. */
1241 @@ -844,6 +1065,7 @@
1243 char dev[PATH_MAX]; /* XXX */
1245 + off_t offset = (off_t) sector * (off_t) SECTOR_SIZE;
1247 if ((partition & 0x00FF00) != 0x00FF00)
1249 @@ -861,8 +1083,14 @@
1250 if (strcmp (dev + strlen(dev) - 5, "/disc") == 0)
1251 strcpy (dev + strlen(dev) - 5, "/part");
1253 - sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1);
1255 + sprintf (dev + strlen(dev), "%s%d",
1256 + /* Compaq smart and others */
1257 + (strncmp(dev, "/dev/ida/", 9) == 0 ||
1258 + strncmp(dev, "/dev/ataraid/", 13) == 0 ||
1259 + strncmp(dev, "/dev/cciss/", 11) == 0 ||
1260 + strncmp(dev, "/dev/rd/", 8) == 0) ? "p" : "",
1261 + ((partition >> 16) & 0xFF) + 1);
1263 /* Open the partition. */
1264 fd = open (dev, O_RDWR);
1266 @@ -870,35 +1098,13 @@
1267 errnum = ERR_NO_PART;
1271 -#if defined(__linux__) && (!defined(__GLIBC__) || \
1272 - ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))))
1273 - /* Maybe libc doesn't have large file support. */
1275 - loff_t offset, result;
1276 - static int _llseek (uint filedes, ulong hi, ulong lo,
1277 - loff_t *res, uint wh);
1278 - _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo,
1279 - loff_t *, res, uint, wh);
1281 - offset = (loff_t) sector * (loff_t) SECTOR_SIZE;
1282 - if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET))
1284 - errnum = ERR_DEV_VALUES;
1290 - off_t offset = (off_t) sector * (off_t) SECTOR_SIZE;
1292 - if (lseek (fd, offset, SEEK_SET) != offset)
1294 - errnum = ERR_DEV_VALUES;
1299 + if (my_lseek(fd, offset, SEEK_SET) != offset)
1301 + errnum = ERR_DEV_VALUES;
1305 if (write (fd, buf, size * SECTOR_SIZE) != (size * SECTOR_SIZE))
1307 diff -Naur grub-0.97.orig/stage2/asm.S grub-0.97/stage2/asm.S
1308 --- grub-0.97.orig/stage2/asm.S 2004-06-19 09:55:22.000000000 -0700
1309 +++ grub-0.97/stage2/asm.S 2006-07-04 00:01:19.000000000 -0700
1310 @@ -1651,7 +1651,29 @@
1314 -3: /* use keyboard controller */
1316 + * try to switch gateA20 using PORT92, the "Fast A20 and Init"
1321 + /* skip the port92 code if it's unimplemented (read returns 0xff) */
1325 + /* set or clear bit1, the ALT_A20_GATE bit */
1333 + /* clear the INIT_NOW bit don't accidently reset the machine */
1337 +6: /* use keyboard controller */
1341 @@ -1661,9 +1683,12 @@
1347 andb $K_IBUF_FUL, %al
1351 movb $KB_OUTPUT_MASK, %al
1354 @@ -1684,6 +1709,8 @@
1360 andb $K_IBUF_FUL, %al
1363 @@ -1991,6 +2018,11 @@
1364 ENTRY(console_getkey)
1368 + call EXT_C(console_checkkey)
1372 call EXT_C(prot_to_real)
1375 @@ -2216,7 +2248,304 @@
1382 +/* graphics mode functions */
1383 +#ifdef SUPPORT_GRAPHICS
1388 +VARIABLE(cursorCount)
1390 +VARIABLE(cursorBuf)
1391 +.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
1395 + * set_int1c_handler(void)
1397 +ENTRY(set_int1c_handler)
1400 + /* save the original int1c handler */
1403 + movw %ax, ABS(int1c_offset)
1405 + movw %ax, ABS(int1c_segment)
1407 + /* save the new int1c handler */
1408 + movw $ABS(int1c_handler), %ax
1418 + * unset_int1c_handler(void)
1420 +ENTRY(unset_int1c_handler)
1423 + /* check if int1c_handler is set */
1425 + movw $ABS(int1c_handler), %ax
1432 + /* restore the original */
1433 + movw ABS(int1c_offset), %ax
1435 + movw ABS(int1c_segment), %ax
1444 + * blinks graphics cursor
1451 + mov $0xA000, %ax /* video in es:di */
1454 + movw $ABS(cursorY), %si
1455 + mov %ds:(%si), %bx
1457 + movw $ABS(cursorX), %si
1458 + mov %ds:(%si), %bx
1459 + shr $3, %bx /* %bx /= 8 */
1463 + movw $ABS(cursorBuf), %si /* fontBuf in ds:si */
1465 + /* prepare for data moving */
1466 + mov $16, %dx /* altura da fonte */
1467 + mov $80, %bx /* bytes por linha */
1470 + movb %ds:(%si), %al
1472 + movb %al, %ds:(%si) /* invert cursorBuf */
1473 + movb %al, %es:(%di) /* write to video */
1484 + mov $ABS(cursorCount), %si
1485 + mov %ds:(%si), %ax
1487 + mov %ax, %ds:(%si)
1492 + mov %ax, %ds:(%si)
1498 + /* call previous int1c handler */
1501 +int1c_offset: .word 0
1502 +int1c_segment: .word 0
1507 + * unsigned char set_videomode(unsigned char mode)
1508 + * BIOS call "INT 10H Function 0h" to set video mode
1509 + * Call with %ah = 0x0
1510 + * %al = video mode
1511 + * Returns old videomode.
1513 +ENTRY(set_videomode)
1521 + call EXT_C(prot_to_real)
1526 + int $0x10 /* Get Current Video mode */
1530 + int $0x10 /* Set Video mode */
1532 + DATA32 call EXT_C(real_to_prot)
1545 + * int get_videomode()
1546 + * BIOS call "INT 10H Function 0Fh" to get current video mode
1547 + * Call with %al = 0x0
1549 + * Returns current videomode.
1551 +ENTRY(get_videomode)
1557 + call EXT_C(prot_to_real)
1562 + int $0x10 /* Get Current Video mode */
1563 + movb %al, %cl /* For now we only want display mode */
1565 + DATA32 call EXT_C(real_to_prot)
1578 + * unsigned char * graphics_get_font()
1579 + * BIOS call "INT 10H Function 11h" to set font
1580 + * Call with %ah = 0x11
1582 +ENTRY(graphics_get_font)
1588 + call EXT_C(prot_to_real)
1592 + movb $6, %bh /* font 8x16 */
1597 + DATA32 call EXT_C(real_to_prot)
1613 + * graphics_set_palette(index, red, green, blue)
1614 + * BIOS call "INT 10H Function 10h" to set individual dac register
1615 + * Call with %ah = 0x10
1616 + * %bx = register number
1617 + * %ch = new value for green (0-63)
1618 + * %cl = new value for blue (0-63)
1619 + * %dh = new value for red (0-63)
1622 +ENTRY(graphics_set_palette)
1629 + movw $0x3c8, %bx /* address write mode register */
1631 + /* wait vertical retrace */
1634 + inb %dx, %al /* wait vertical active display */
1639 + inb %dx, %al /* wait vertical retrace */
1644 + movb 0x18(%esp), %al /* index */
1648 + movb 0x1c(%esp), %al /* red */
1651 + movb 0x20(%esp), %al /* green */
1654 + movb 0x24(%esp), %al /* blue */
1657 + movw 0x18(%esp), %bx
1659 + call EXT_C(prot_to_real)
1666 + DATA32 call EXT_C(real_to_prot)
1675 +#endif /* SUPPORT_GRAPHICS */
1680 * if a seconds value can be read, read it and return it (BCD),
1681 diff -Naur grub-0.97.orig/stage2/boot.c grub-0.97/stage2/boot.c
1682 --- grub-0.97.orig/stage2/boot.c 2004-03-30 03:44:08.000000000 -0800
1683 +++ grub-0.97/stage2/boot.c 2006-07-04 00:01:50.000000000 -0700
1685 /* boot.c - load and bootstrap a kernel */
1687 * GRUB -- GRand Unified Bootloader
1688 - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
1689 + * Copyright (C) 1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc.
1691 * This program is free software; you can redistribute it and/or modify
1692 * it under the terms of the GNU General Public License as published by
1694 entry_func entry_addr;
1695 static struct mod_list mll[99];
1696 static int linux_mem_size;
1697 +static int elf_kernel_addr;
1698 +static int elf_kernel_size;
1701 * The next two functions, 'load_image' and 'load_module', are the building
1703 lh = (struct linux_kernel_header *) buffer;
1705 /* ELF loading supported if multiboot, FreeBSD and NetBSD. */
1706 - if ((type == KERNEL_TYPE_MULTIBOOT
1707 + if (((type == KERNEL_TYPE_MULTIBOOT && ! (flags & MULTIBOOT_AOUT_KLUDGE))
1708 || pu.elf->e_ident[EI_OSABI] == ELFOSABI_FREEBSD
1709 || grub_strcmp (pu.elf->e_ident + EI_BRAND, "FreeBSD") == 0
1710 || suggested_type == KERNEL_TYPE_NETBSD)
1713 /* reset this to zero for now */
1715 + elf_kernel_addr = ~0;
1717 /* scan for program segments */
1718 for (i = 0; i < pu.elf->e_phnum; i++)
1720 /* mark memory as used */
1721 if (cur_addr < memaddr + memsiz)
1722 cur_addr = memaddr + memsiz;
1723 + if (elf_kernel_addr > cur_addr)
1724 + elf_kernel_addr = cur_addr;
1725 printf (", <0x%x:0x%x:0x%x>", memaddr, filesiz,
1727 /* increment number of segments */
1732 + elf_kernel_size = cur_addr - elf_kernel_addr;
1737 @@ -824,8 +831,11 @@
1738 moveto = (mbi.mem_upper + 0x400) << 10;
1740 moveto = (moveto - len) & 0xfffff000;
1741 - max_addr = (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0203
1742 - ? lh->initrd_addr_max : LINUX_INITRD_MAX_ADDRESS);
1743 + max_addr = LINUX_INITRD_MAX_ADDRESS;
1744 + if (lh->header == LINUX_MAGIC_SIGNATURE &&
1745 + lh->version >= 0x0203 &&
1746 + lh->initrd_addr_max < max_addr)
1747 + max_addr = lh->initrd_addr_max;
1748 if (moveto + len >= max_addr)
1749 moveto = (max_addr - len) & 0xfffff000;
1751 @@ -864,6 +874,129 @@
1755 +#define mem_align4k(p) ((p) + 0xFFF) & 0xFFFFF000
1758 +kfreebsd_setenv (char *env, const char *var, const char *value)
1762 + if (env[0] == '\0' && env[1] == '\0')
1771 + grub_sprintf (env, "%s=%s", var, value);
1772 + env[grub_strlen (env) + 1] = '\0';
1776 +kfreebsd_read_hints (char *buf)
1778 + char *buf_end = buf;
1780 + if (grub_open ("/boot/device.hints"))
1787 + env_len = grub_read (buf, -1);
1790 + buf_end += env_len;
1791 + *(buf_end++) = '\0';
1798 + envp = line_start = buf;
1801 + char *envp_current = envp;
1806 + while (*envp == ' ')
1811 + grub_memmove (envp_current, envp, env_len + 1);
1812 + envp = envp_current;
1815 + while (*envp != '\n')
1822 + grub_memmove (envp_current, envp, env_len + 1);
1823 + envp = envp_current;
1829 + grub_memmove (line_start, envp, env_len + 1);
1833 + line_start = envp;
1841 + buf_end = buf + env_len;
1842 + *(buf_end++) = '\0';
1849 +kfreebsd_set_module_string (u32_t type, u32_t *dst, char *src)
1854 + *(dst++) = size = grub_strlen (src) + 1;
1855 + grub_strcpy ((void *) dst, src);
1857 + return dst + (size + sizeof(u32_t) - 1) / sizeof(u32_t);
1861 +kfreebsd_set_module_var (u32_t type, u32_t *dst, u32_t src)
1864 + *(dst++) = sizeof(u32_t);
1871 +kfreebsd_set_modules (u32_t *modulep)
1873 + /* XXX: Need to copy the whole module structure. */
1874 + /* XXX: How to pass the module name ? */
1880 * All "*_boot" commands depend on the images being loaded into memory
1881 @@ -877,7 +1010,10 @@
1882 bsd_boot (kernel_t type, int bootdev, char *arg)
1893 @@ -886,8 +1022,21 @@
1897 + while (*arg != '/')
1901 while (*(++arg) && *arg != ' ');
1905 + bsd_root = grub_strstr (str, "root=");
1909 + /* XXX: should copy the str or terminate it. */
1915 @@ -910,6 +1059,8 @@
1920 + clval |= RB_PAUSE;
1924 @@ -927,14 +1078,17 @@
1926 if (type == KERNEL_TYPE_FREEBSD)
1931 clval |= RB_BOOTINFO;
1933 bi.bi_version = BOOTINFO_VERSION;
1936 - while ((--arg) > (char *) MB_CMDLINE_BUF && *arg != '/');
1938 - bi.bi_kernelname = arg + 1;
1939 + bi.bi_pad[0] = bi.bi_pad[1] = 0;
1941 + if (*kernelname == '/')
1942 + bi.bi_kernelname = kernelname;
1944 bi.bi_kernelname = 0;
1946 @@ -961,6 +1115,30 @@
1947 bi.bi_basemem = mbi.mem_lower;
1948 bi.bi_extmem = extended_memory;
1950 + /* Setup the environment. */
1951 + bi.bi_envp = cur_addr = mem_align4k (cur_addr);
1952 + grub_memset ((void *) cur_addr, 0, 2);
1953 + cur_addr = (int) kfreebsd_read_hints ((void *) cur_addr);
1955 + envp = (char *) bi.bi_envp;
1956 + kfreebsd_setenv (envp, "kernelname", kernelname);
1957 + kfreebsd_setenv (envp, "vfs.root.mountfrom", bsd_root);
1959 + /* Setup the modules list. */
1960 + bi.bi_modulep = cur_addr = mem_align4k (cur_addr);
1961 + modp = (u32_t *) bi.bi_modulep;
1962 + /* The first module is the kernel. */
1963 + modp = kfreebsd_set_module_string (MODINFO_NAME, modp, kernelname);
1964 + modp = kfreebsd_set_module_string (MODINFO_TYPE, modp, "elf kernel");
1965 + modp = kfreebsd_set_module_string (MODINFO_ARGS, modp, arg);
1966 + modp = kfreebsd_set_module_var (MODINFO_ADDR, modp, elf_kernel_addr);
1967 + modp = kfreebsd_set_module_var (MODINFO_SIZE, modp, elf_kernel_size);
1968 + /* Now the real modules. */
1969 + modp = kfreebsd_set_modules(modp);
1971 + /* Set the kernel end. */
1972 + bi.bi_kernend = cur_addr = mem_align4k (((int) modp) + 1);
1974 if (mbi.flags & MB_INFO_AOUT_SYMS)
1976 bi.bi_symtab = mbi.syms.a.addr;
1977 @@ -970,8 +1148,9 @@
1979 else if (mbi.flags & MB_INFO_ELF_SHDR)
1981 - /* FIXME: Should check if a symbol table exists and, if exists,
1982 - pass the table to BI. */
1983 + bi.bi_symtab = mbi.syms.e.addr;
1984 + bi.bi_esymtab = mbi.syms.e.addr
1985 + + mbi.syms.e.size * mbi.syms.e.num * mbi.syms.e.shndx;
1989 diff -Naur grub-0.97.orig/stage2/builtins.c grub-0.97/stage2/builtins.c
1990 --- grub-0.97.orig/stage2/builtins.c 2005-02-15 13:58:23.000000000 -0800
1991 +++ grub-0.97/stage2/builtins.c 2006-07-04 00:01:50.000000000 -0700
1993 #include <filesys.h>
1996 +#ifdef SUPPORT_GRAPHICS
1997 +# include <graphics.h>
2000 #ifdef SUPPORT_NETBOOT
2002 # include <etherboot.h>
2004 inside other functions. */
2005 static int configfile_func (char *arg, int flags);
2007 +static int savedefault_helper (char *arg, int flags);
2009 +static int savedefault_shell (char *arg, int flags);
2011 /* Initialize the data for builtins. */
2013 init_builtins (void)
2014 @@ -237,12 +245,22 @@
2016 boot_func (char *arg, int flags)
2018 + struct term_entry *prev_term = current_term;
2019 /* Clear the int15 handler if we can boot the kernel successfully.
2020 This assumes that the boot code never fails only if KERNEL_TYPE is
2021 not KERNEL_TYPE_NONE. Is this assumption is bad? */
2022 if (kernel_type != KERNEL_TYPE_NONE)
2023 unset_int15_handler ();
2025 + /* if our terminal needed initialization, we should shut it down
2026 + * before booting the kernel, but we want to save what it was so
2027 + * we can come back if needed */
2028 + if (current_term->shutdown)
2030 + current_term->shutdown();
2031 + current_term = term_table; /* assumption: console is first */
2034 #ifdef SUPPORT_NETBOOT
2035 /* Shut down the networking. */
2037 @@ -306,6 +324,13 @@
2041 + /* if we get back here, we should go back to what our term was before */
2042 + current_term = prev_term;
2043 + if (current_term->startup)
2044 + /* if our terminal fails to initialize, fall back to console since
2045 + * it should always work */
2046 + if (current_term->startup() == 0)
2047 + current_term = term_table; /* we know that console is first */
2051 @@ -852,6 +877,251 @@
2053 #endif /* SUPPORT_NETBOOT */
2055 +#ifdef SUPPORT_GRAPHICS
2057 +static int splashimage_func(char *arg, int flags) {
2060 + /* filename can only be 256 characters due to our buffer size */
2061 + if (grub_strlen(arg) > 256) {
2062 + grub_printf("Splash image filename too large\n");
2063 + grub_printf("Press any key to continue...");
2068 + /* get rid of TERM_NEED_INIT from the graphics terminal. */
2069 + for (i = 0; term_table[i].name; i++) {
2070 + if (grub_strcmp (term_table[i].name, "graphics") == 0) {
2071 + term_table[i].flags &= ~TERM_NEED_INIT;
2076 + graphics_set_splash(arg);
2078 + if (flags == BUILTIN_CMDLINE && graphics_inited) {
2080 + if (graphics_init() == 0) {
2081 + /* Fallback to default term */
2082 + current_term = term_table;
2083 + max_lines = current_term->max_lines;
2084 + if (current_term->cls)
2085 + current_term->cls();
2086 + grub_printf("Failed to set splash image and/or graphics mode\n");
2092 + if (flags == BUILTIN_MENU)
2093 + current_term = term_table + i;
2098 +static struct builtin builtin_splashimage =
2102 + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
2103 + "splashimage FILE",
2104 + "Load FILE as the background image when in graphics mode."
2110 +shade_func(char *arg, int flags)
2114 + if (!arg || safe_parse_maxint(&arg, &new_shade) == 0)
2117 + if (shade != new_shade) {
2118 + shade = new_shade;
2119 + if (flags == BUILTIN_CMDLINE && graphics_inited) {
2129 +static struct builtin builtin_shade =
2133 + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
2135 + "If set to 0, disables the use of shaded text, else enables it."
2141 +foreground_func(char *arg, int flags)
2143 + if (grub_strlen(arg) == 6) {
2144 + int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2;
2145 + int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2;
2146 + int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2;
2148 + foreground = (r << 16) | (g << 8) | b;
2149 + if (graphics_inited)
2150 + graphics_set_palette(15, r, g, b);
2158 +static struct builtin builtin_foreground =
2162 + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
2163 + "foreground RRGGBB",
2164 + "Sets the foreground color when in graphics mode."
2165 + "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
2171 +background_func(char *arg, int flags)
2173 + if (grub_strlen(arg) == 6) {
2174 + int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2;
2175 + int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2;
2176 + int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2;
2178 + background = (r << 16) | (g << 8) | b;
2179 + if (graphics_inited)
2180 + graphics_set_palette(0, r, g, b);
2187 +static struct builtin builtin_background =
2191 + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
2192 + "background RRGGBB",
2193 + "Sets the background color when in graphics mode."
2194 + "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
2200 +border_func(char *arg, int flags)
2202 + if (grub_strlen(arg) == 6) {
2203 + int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2;
2204 + int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2;
2205 + int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2;
2207 + window_border = (r << 16) | (g << 8) | b;
2208 + if (graphics_inited)
2209 + graphics_set_palette(0x11, r, g, b);
2217 +static struct builtin builtin_border =
2221 + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
2223 + "Sets the border video color when in graphics mode."
2224 + "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal."
2230 +viewport_func (char *arg, int flags)
2233 + int x0 = 0, y0 = 0, x1 = 80, y1 = 30;
2234 + int *pos[4] = { &x0, &y0, &x1, &y1 };
2238 + for (i = 0; i < 4; i++) {
2241 + while (*arg && (*arg == ' ' || *arg == '\t'))
2243 + if (!safe_parse_maxint(&arg, pos[i]))
2245 + while (*arg && (*arg != ' ' && *arg != '\t'))
2249 + /* minimum size is 65 colums and 16 rows */
2250 + if (x0 > x1 - 66 || y0 > y1 - 16 || x0 < 0 || y0 < 0 || x1 > 80 || y1 > 30)
2258 + if (flags == BUILTIN_CMDLINE && graphics_inited) {
2267 +static struct builtin builtin_viewport =
2271 + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST,
2272 + "viewport x0 y0 x1 y1",
2273 + "Changes grub internals to output text in the window defined by"
2274 + " four parameters. The x and y parameters are 0 based. This option"
2275 + " only works with the graphics interface."
2278 +#endif /* SUPPORT_GRAPHICS */
2285 + if (current_term->cls)
2286 + current_term->cls();
2291 +static struct builtin builtin_clear =
2295 + BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
2297 + "Clear the screen"
2303 @@ -1454,14 +1724,20 @@
2307 -#define MAX_SHORT_DOC_LEN 39
2308 -#define MAX_LONG_DOC_LEN 66
2311 help_func (char *arg, int flags)
2315 + int all = 0, max_short_doc_len, max_long_doc_len;
2316 + max_short_doc_len = 39;
2317 + max_long_doc_len = 66;
2318 +#ifdef SUPPORT_GRAPHICS
2319 + if (grub_memcmp (current_term->name, "graphics", sizeof ("graphics") - 1) == 0)
2321 + max_short_doc_len = (view_x1 - view_x0 + 1) / 2 - 1;
2322 + max_long_doc_len = (view_x1 - view_x0) - 14;
2326 if (grub_memcmp (arg, "--all", sizeof ("--all") - 1) == 0)
2329 @@ -1491,13 +1767,13 @@
2331 len = grub_strlen ((*builtin)->short_doc);
2332 /* If the length of SHORT_DOC is too long, truncate it. */
2333 - if (len > MAX_SHORT_DOC_LEN - 1)
2334 - len = MAX_SHORT_DOC_LEN - 1;
2335 + if (len > max_short_doc_len - 1)
2336 + len = max_short_doc_len - 1;
2338 for (i = 0; i < len; i++)
2339 grub_putchar ((*builtin)->short_doc[i]);
2341 - for (; i < MAX_SHORT_DOC_LEN; i++)
2342 + for (; i < max_short_doc_len; i++)
2346 @@ -1546,10 +1822,10 @@
2349 /* If LEN is too long, fold DOC. */
2350 - if (len > MAX_LONG_DOC_LEN)
2351 + if (len > max_long_doc_len)
2353 /* Fold this line at the position of a space. */
2354 - for (len = MAX_LONG_DOC_LEN; len > 0; len--)
2355 + for (len = max_long_doc_len; len > 0; len--)
2356 if (doc[len - 1] == ' ')
2359 @@ -2323,6 +2599,25 @@
2360 "Probe I/O ports used for the drive DRIVE."
2365 +print_func (char *arg, int flags)
2367 + printf("%s\n", arg);
2372 +static struct builtin builtin_print =
2376 + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_NO_ECHO,
2377 + "print [MESSAGE ...]",
2385 @@ -3221,7 +3516,102 @@
2387 savedefault_func (char *arg, int flags)
2389 -#if !defined(SUPPORT_DISKLESS) && !defined(GRUB_UTIL)
2390 +#if !defined(SUPPORT_DISKLESS)
2391 + #if !defined(GRUB_UTIL)
2392 + savedefault_helper(arg, flags);
2394 + savedefault_shell(arg, flags);
2396 +#else /* !SUPPORT_DISKLESS */
2397 + errnum = ERR_UNRECOGNIZED;
2399 +#endif /* !SUPPORT_DISKLESS */
2402 +#if !defined(SUPPORT_DISKLESS) && defined(GRUB_UTIL)
2403 +/* savedefault_shell */
2405 +savedefault_shell(char *arg, int flags)
2407 + int once_only = 0;
2409 + int curr_default = -1;
2410 + int curr_prev_default = -1;
2411 + int new_prev_default = -1;
2413 + size_t bytes = 10;
2415 + char *default_file = (char *) DEFAULT_FILE_BUF;
2421 + if (grub_memcmp ("--default=", arg, sizeof ("--default=") - 1) == 0)
2423 + char *p = arg + sizeof ("--default=") - 1;
2424 + if (! safe_parse_maxint (&p, &new_default))
2426 + arg = skip_to (0, arg);
2428 + else if (grub_memcmp ("--once", arg, sizeof ("--once") - 1) == 0)
2431 + arg = skip_to (0, arg);
2437 + *default_file = 0;
2438 + grub_strncat (default_file, config_file, DEFAULT_FILE_BUFLEN);
2439 + for (i = grub_strlen(default_file); i >= 0; i--)
2440 + if (default_file[i] == '/')
2445 + default_file[i] = 0;
2446 + grub_strncat (default_file + i, "default", DEFAULT_FILE_BUFLEN - i);
2448 + if(!(fp = fopen(default_file,"w")))
2450 + errnum = ERR_READ;
2456 + sscanf(line, "%d:%d", &curr_prev_default, &curr_default);
2458 + if(curr_default != -1)
2459 + new_prev_default = curr_default;
2462 + if(curr_prev_default != -1)
2463 + new_prev_default = curr_prev_default;
2465 + new_prev_default = 0;
2469 + sprintf(buf, "%d:%d\n", new_prev_default, new_default);
2471 + sprintf(buf, "%d\n", new_default);
2481 +/* savedefault_helper */
2483 +savedefault_helper (char *arg, int flags)
2485 +#if !defined(SUPPORT_DISKLESS)
2486 unsigned long tmp_drive = saved_drive;
2487 unsigned long tmp_partition = saved_partition;
2488 char *default_file = (char *) DEFAULT_FILE_BUF;
2489 @@ -3300,19 +3690,23 @@
2493 - if (len != sizeof (buf))
2495 - /* This is too small. Do not modify the file manually, please! */
2496 - errnum = ERR_READ;
2500 if (sector_count > 2)
2502 /* Is this possible?! Too fragmented! */
2503 errnum = ERR_FSYS_CORRUPT;
2508 + if((tmp = grub_strstr(buf, ":")) != NULL)
2510 + int f_len = grub_strlen(buf) - grub_strlen(tmp);
2513 + for(a = 0; a < f_len; a++)
2514 + grub_memcpy(&def[a], &buf[a], sizeof(char));
2515 + safe_parse_maxint (&def, &entryno);
2518 /* Set up a string to be written. */
2519 grub_memset (buf, '\n', sizeof (buf));
2520 @@ -3830,15 +4224,15 @@
2523 grub_sprintf (tmp, ",%d", (partition >> 16) & 0xFF);
2524 - grub_strncat (device, tmp, 256);
2525 + grub_strncat (device, tmp, sizeof (device));
2527 if ((partition & 0x00FF00) != 0x00FF00)
2530 grub_sprintf (tmp, ",%c", 'a' + ((partition >> 8) & 0xFF));
2531 - grub_strncat (device, tmp, 256);
2532 + grub_strncat (device, tmp, sizeof (device));
2534 - grub_strncat (device, ")", 256);
2535 + grub_strncat (device, ")", sizeof (device));
2538 int embed_stage1_5 (char *stage1_5, int drive, int partition)
2539 @@ -4085,7 +4479,7 @@
2543 -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES)
2544 +#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS)
2547 terminal_func (char *arg, int flags)
2548 @@ -4244,17 +4638,29 @@
2550 current_term = term_table + default_term;
2551 current_term->flags = term_flags;
2557 - /* 24 would be a good default value. */
2560 + max_lines = current_term->max_lines;
2562 /* If the interface is currently the command-line,
2563 restart it to repaint the screen. */
2564 - if (current_term != prev_term && (flags & BUILTIN_CMDLINE))
2565 + if ((current_term != prev_term) && (flags & BUILTIN_CMDLINE)){
2566 + if (prev_term->shutdown)
2567 + prev_term->shutdown();
2568 + if (current_term->startup) {
2569 + /* If startup fails, return to previous term */
2570 + if (current_term->startup() == 0) {
2571 + current_term = prev_term;
2572 + max_lines = current_term->max_lines;
2573 + if (current_term->cls) {
2574 + current_term->cls();
2578 grub_longjmp (restart_cmdline_env, 0);
2583 @@ -4264,7 +4670,7 @@
2586 BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
2587 - "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules]",
2588 + "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules] [graphics]",
2589 "Select a terminal. When multiple terminals are specified, wait until"
2590 " you push any key to continue. If both console and serial are specified,"
2591 " the terminal to which you input a key first will be selected. If no"
2592 @@ -4276,7 +4682,7 @@
2593 " seconds. The option --lines specifies the maximum number of lines."
2594 " The option --silent is used to suppress messages."
2596 -#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */
2597 +#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */
2600 #ifdef SUPPORT_SERIAL
2601 @@ -4795,13 +5201,20 @@
2602 /* The table of builtin commands. Sorted in dictionary order. */
2603 struct builtin *builtin_table[] =
2605 +#ifdef SUPPORT_GRAPHICS
2606 + &builtin_background,
2610 #ifdef SUPPORT_NETBOOT
2612 #endif /* SUPPORT_NETBOOT */
2613 +#ifdef SUPPORT_GRAPHICS
2617 &builtin_chainloader,
2621 &builtin_configfile,
2622 @@ -4821,6 +5234,9 @@
2626 +#ifdef SUPPORT_GRAPHICS
2627 + &builtin_foreground,
2632 @@ -4848,6 +5264,7 @@
2639 #endif /* GRUB_UTIL */
2640 @@ -4864,9 +5281,13 @@
2641 #endif /* SUPPORT_SERIAL */
2644 -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES)
2645 +#ifdef SUPPORT_GRAPHICS
2647 + &builtin_splashimage,
2648 +#endif /* SUPPORT_GRAPHICS */
2649 +#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS)
2651 -#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */
2652 +#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */
2653 #ifdef SUPPORT_SERIAL
2655 #endif /* SUPPORT_SERIAL */
2656 @@ -4880,5 +5301,8 @@
2660 +#ifdef SUPPORT_GRAPHICS
2661 + &builtin_viewport,
2665 diff -Naur grub-0.97.orig/stage2/char_io.c grub-0.97/stage2/char_io.c
2666 --- grub-0.97.orig/stage2/char_io.c 2005-02-01 12:51:23.000000000 -0800
2667 +++ grub-0.97/stage2/char_io.c 2006-07-03 23:59:27.000000000 -0700
2669 # include <serial.h>
2672 +#ifdef SUPPORT_GRAPHICS
2673 +# include <graphics.h>
2677 struct term_entry term_table[] =
2688 console_setcolorstate,
2691 + console_setcursor,
2695 #ifdef SUPPORT_SERIAL
2698 /* A serial device must be initialized. */
2706 serial_setcolorstate,
2712 #endif /* SUPPORT_SERIAL */
2723 hercules_setcolorstate,
2725 - hercules_setcursor
2726 + hercules_setcursor,
2730 #endif /* SUPPORT_HERCULES */
2731 +#ifdef SUPPORT_GRAPHICS
2733 + TERM_NEED_INIT, /* flags */
2734 + 30, /* number of lines */
2735 + graphics_putchar, /* putchar */
2736 + console_checkkey, /* checkkey */
2737 + console_getkey, /* getkey */
2738 + graphics_getxy, /* getxy */
2739 + graphics_gotoxy, /* gotoxy */
2740 + graphics_cls, /* cls */
2741 + graphics_setcolorstate, /* setcolorstate */
2742 + graphics_setcolor, /* setcolor */
2743 + graphics_setcursor, /* nocursor */
2744 + graphics_init, /* initialize */
2745 + graphics_end /* shutdown */
2747 +#endif /* SUPPORT_GRAPHICS */
2748 /* This must be the last entry. */
2749 - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
2750 + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
2753 /* This must be console. */
2754 @@ -305,9 +335,10 @@
2756 /* XXX: These should be defined in shared.h, but I leave these here,
2757 until this code is freezed. */
2758 -#define CMDLINE_WIDTH 78
2759 #define CMDLINE_MARGIN 10
2762 + /* command-line limits */
2763 + int cmdline_width = 78, col_start = 0;
2764 int xpos, lpos, c, section;
2765 /* The length of PROMPT. */
2769 /* If the cursor is in the first section, display the first section
2770 instead of the second. */
2771 - if (section == 1 && plen + lpos < CMDLINE_WIDTH)
2772 + if (section == 1 && plen + lpos < cmdline_width)
2774 else if (xpos - count < 1)
2777 grub_putchar ('\b');
2780 - gotoxy (xpos, getxy () & 0xFF);
2781 + gotoxy (xpos + col_start, getxy () & 0xFF);
2788 /* If the cursor goes outside, scroll the screen to the right. */
2789 - if (xpos + count >= CMDLINE_WIDTH)
2790 + if (xpos + count >= cmdline_width)
2798 - gotoxy (xpos, getxy () & 0xFF);
2799 + gotoxy (xpos + col_start, getxy () & 0xFF);
2803 @@ -398,14 +429,14 @@
2806 /* Recompute the section number. */
2807 - if (lpos + plen < CMDLINE_WIDTH)
2808 + if (lpos + plen < cmdline_width)
2811 - section = ((lpos + plen - CMDLINE_WIDTH)
2812 - / (CMDLINE_WIDTH - 1 - CMDLINE_MARGIN) + 1);
2813 + section = ((lpos + plen - cmdline_width)
2814 + / (cmdline_width - 1 - CMDLINE_MARGIN) + 1);
2816 /* From the start to the end. */
2817 - len = CMDLINE_WIDTH;
2818 + len = cmdline_width;
2820 grub_putchar ('\r');
2826 - start = ((section - 1) * (CMDLINE_WIDTH - 1 - CMDLINE_MARGIN)
2827 - + CMDLINE_WIDTH - plen - CMDLINE_MARGIN);
2828 + start = ((section - 1) * (cmdline_width - 1 - CMDLINE_MARGIN)
2829 + + cmdline_width - plen - CMDLINE_MARGIN);
2830 xpos = lpos + 1 - start;
2835 /* If the cursor is at the last position, put `>' or a space,
2836 depending on if there are more characters in BUF. */
2837 - if (pos == CMDLINE_WIDTH)
2838 + if (pos == cmdline_width)
2840 if (start + len < llen)
2843 grub_putchar ('\b');
2846 - gotoxy (xpos, getxy () & 0xFF);
2847 + gotoxy (xpos + col_start, getxy () & 0xFF);
2850 /* Initialize the command-line. */
2851 @@ -518,10 +549,10 @@
2855 - if (xpos + l >= CMDLINE_WIDTH)
2856 + if (xpos + l >= cmdline_width)
2858 - else if (xpos + l + llen - lpos > CMDLINE_WIDTH)
2859 - cl_refresh (0, CMDLINE_WIDTH - xpos);
2860 + else if (xpos + l + llen - lpos > cmdline_width)
2861 + cl_refresh (0, cmdline_width - xpos);
2863 cl_refresh (0, l + llen - lpos);
2865 @@ -533,12 +564,22 @@
2866 grub_memmove (buf + lpos, buf + lpos + count, llen - count + 1);
2869 - if (xpos + llen + count - lpos > CMDLINE_WIDTH)
2870 - cl_refresh (0, CMDLINE_WIDTH - xpos);
2871 + if (xpos + llen + count - lpos > cmdline_width)
2872 + cl_refresh (0, cmdline_width - xpos);
2874 cl_refresh (0, llen + count - lpos);
2877 + max_lines = current_term->max_lines;
2878 +#ifdef SUPPORT_GRAPHICS
2879 + if (grub_memcmp (current_term->name, "graphics", sizeof ("graphics") - 1) == 0)
2881 + cmdline_width = (view_x1 - view_x0) - 2;
2882 + col_start = view_x0;
2883 + max_lines = view_y1 - view_y0;
2887 plen = grub_strlen (prompt);
2888 llen = grub_strlen (cmdline);
2890 @@ -1006,6 +1047,48 @@
2892 #endif /* ! STAGE1_5 */
2895 +/* Internal pager. */
2899 + if (count_lines >= 0)
2902 + if (count_lines >= max_lines - 2)
2906 + /* It's important to disable the feature temporarily, because
2907 + the following grub_printf call will print newlines. */
2910 + grub_printf("\n");
2911 + if (current_term->setcolorstate)
2912 + current_term->setcolorstate (COLOR_STATE_HIGHLIGHT);
2914 + grub_printf ("[Hit return to continue]");
2916 + if (current_term->setcolorstate)
2917 + current_term->setcolorstate (COLOR_STATE_NORMAL);
2922 + tmp = ASCII_CHAR (getkey ());
2924 + while (tmp != '\n' && tmp != '\r');
2925 + grub_printf ("\r \r");
2927 + /* Restart to count lines. */
2936 /* Display an ASCII character. */
2938 grub_putchar (int c)
2939 @@ -1034,38 +1117,11 @@
2944 /* Internal `more'-like feature. */
2945 - if (count_lines >= 0)
2948 - if (count_lines >= max_lines - 2)
2952 - /* It's important to disable the feature temporarily, because
2953 - the following grub_printf call will print newlines. */
2956 - if (current_term->setcolorstate)
2957 - current_term->setcolorstate (COLOR_STATE_HIGHLIGHT);
2959 - grub_printf ("\n[Hit return to continue]");
2961 - if (current_term->setcolorstate)
2962 - current_term->setcolorstate (COLOR_STATE_NORMAL);
2966 - tmp = ASCII_CHAR (getkey ());
2968 - while (tmp != '\n' && tmp != '\r');
2969 - grub_printf ("\r \r");
2971 - /* Restart to count lines. */
2976 + flag = do_more ();
2981 current_term->putchar (c);
2982 @@ -1090,7 +1146,7 @@
2985 /* If the terminal is dumb, there is no way to clean the terminal. */
2986 - if (current_term->flags & TERM_DUMB)
2987 + if (current_term->flags & TERM_DUMB)
2988 grub_putchar ('\n');
2990 current_term->cls ();
2991 @@ -1175,13 +1231,13 @@
2992 #endif /* ! STAGE1_5 */
2995 -memcheck (int addr, int len)
2996 +memcheck (unsigned long int addr, unsigned long int len)
2999 - auto int start_addr (void);
3000 - auto int end_addr (void);
3001 + auto unsigned long int start_addr (void);
3002 + auto int unsigned long end_addr (void);
3004 - auto int start_addr (void)
3005 + auto unsigned long int start_addr (void)
3008 # if defined(HAVE_START_SYMBOL)
3009 @@ -1192,7 +1248,7 @@
3013 - auto int end_addr (void)
3014 + auto unsigned long int end_addr (void)
3017 # if defined(HAVE_END_SYMBOL)
3018 @@ -1217,6 +1273,16 @@
3023 +grub_memcpy(void *dest, const void *src, int len)
3026 + register char *d = (char*)dest, *s = (char*)src;
3028 + for (i = 0; i < len; i++)
3033 grub_memmove (void *to, const void *from, int len)
3035 diff -Naur grub-0.97.orig/stage2/cmdline.c grub-0.97/stage2/cmdline.c
3036 --- grub-0.97.orig/stage2/cmdline.c 2004-08-16 16:23:01.000000000 -0700
3037 +++ grub-0.97/stage2/cmdline.c 2006-07-03 23:58:41.000000000 -0700
3040 print_cmdline_message (int forever)
3042 - printf (" [ Minimal BASH-like line editing is supported. For the first word, TAB\n"
3043 - " lists possible command completions. Anywhere else TAB lists the possible\n"
3044 - " completions of a device/filename.%s ]\n",
3045 - (forever ? "" : " ESC at any time exits."));
3046 + grub_printf(" [ Minimal BASH-like line editing is supported. For\n"
3047 + " the first word, TAB lists possible command\n"
3048 + " completions. Anywhere else TAB lists the possible\n"
3049 + " completions of a device/filename.%s ]\n",
3050 + (forever ? "" : " ESC at any time\n exits."));
3053 /* Find the builtin whose command name is COMMAND and return the
3054 diff -Naur grub-0.97.orig/stage2/freebsd.h grub-0.97/stage2/freebsd.h
3055 --- grub-0.97.orig/stage2/freebsd.h 2003-07-09 04:45:52.000000000 -0700
3056 +++ grub-0.97/stage2/freebsd.h 2006-07-03 23:59:36.000000000 -0700
3060 * GRUB -- GRand Unified Bootloader
3061 - * Copyright (C) 2001 Free Software Foundation, Inc.
3062 + * Copyright (C) 2001, 2004 Free Software Foundation, Inc.
3064 * This program is free software; you can redistribute it and/or modify
3065 * it under the terms of the GNU General Public License as published by
3067 #define RB_CDROM 0x2000 /* use cdrom as root */
3068 #define RB_GDB 0x8000 /* use GDB remote debugger instead of DDB */
3069 #define RB_MUTE 0x10000 /* Come up with the console muted */
3070 +#define RB_SELFTEST 0x20000 /* don't complete the boot; do selftest */
3071 +#define RB_RESERVED1 0x40000 /* reserved for internal use of boot blocks */
3072 +#define RB_RESERVED2 0x80000 /* reserved for internal use of boot blocks */
3073 +#define RB_PAUSE 0x100000 /* pause after each output line during probe */
3074 #define RB_MULTIPLE 0x20000000 /* Use multiple consoles */
3076 #define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */
3079 #define N_BIOS_GEOM 8
3081 +typedef unsigned char u8_t;
3082 +typedef unsigned int u32_t;
3085 * A zero bootinfo field often means that there is no info available.
3086 * Flags are used to indicate the validity of fields where zero is a
3091 - unsigned int bi_version;
3092 - unsigned char *bi_kernelname;
3093 - struct nfs_diskless *bi_nfs_diskless;
3095 + u8_t *bi_kernelname;
3096 + u32_t bi_nfs_diskless;
3097 /* End of fields that are always present. */
3098 #define bi_endcommon bi_n_bios_used
3099 - unsigned int bi_n_bios_used;
3100 - unsigned long bi_bios_geom[N_BIOS_GEOM];
3101 - unsigned int bi_size;
3102 - unsigned char bi_memsizes_valid;
3103 - unsigned char bi_bios_dev;
3104 - unsigned char bi_pad[2];
3105 - unsigned long bi_basemem;
3106 - unsigned long bi_extmem;
3107 - unsigned long bi_symtab;
3108 - unsigned long bi_esymtab;
3109 + u32_t bi_n_bios_used;
3110 + u32_t bi_bios_geom[N_BIOS_GEOM];
3112 + u8_t bi_memsizes_valid;
3119 + /* Items below only from advanced bootloader */
3125 +#define MODINFO_END 0x0000 /* End of list */
3126 +#define MODINFO_NAME 0x0001 /* Name of module (string) */
3127 +#define MODINFO_TYPE 0x0002 /* Type of module (string) */
3128 +#define MODINFO_ADDR 0x0003 /* Loaded address */
3129 +#define MODINFO_SIZE 0x0004 /* Size of module */
3130 +#define MODINFO_EMPTY 0x0005 /* Has been deleted */
3131 +#define MODINFO_ARGS 0x0006 /* Parameters string */
3132 +#define MODINFO_METADATA 0x8000 /* Module-specfic */
3134 diff -Naur grub-0.97.orig/stage2/graphics.c grub-0.97/stage2/graphics.c
3135 --- grub-0.97.orig/stage2/graphics.c 1969-12-31 16:00:00.000000000 -0800
3136 +++ grub-0.97/stage2/graphics.c 2006-07-03 23:58:41.000000000 -0700
3139 + * graphics.c - graphics mode support for GRUB
3140 + * Implemented as a terminal type by Jeremy Katz <katzj@redhat.com> based
3141 + * on a patch by Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
3142 + * Options and enhancements made by Herton Ronaldo Krzesinski
3143 + * <herton@mandriva.com>
3145 + * GRUB -- GRand Unified Bootloader
3146 + * Copyright (C) 2001,2002 Red Hat, Inc.
3147 + * Portions copyright (C) 2000 Conectiva, Inc.
3149 + * This program is free software; you can redistribute it and/or modify
3150 + * it under the terms of the GNU General Public License as published by
3151 + * the Free Software Foundation; either version 2 of the License, or
3152 + * (at your option) any later version.
3154 + * This program is distributed in the hope that it will be useful,
3155 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3156 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3157 + * GNU General Public License for more details.
3159 + * You should have received a copy of the GNU General Public License
3160 + * along with this program; if not, write to the Free Software
3161 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3164 +#ifdef SUPPORT_GRAPHICS
3167 +#include <shared.h>
3168 +#include <graphics.h>
3170 +int saved_videomode;
3171 +unsigned char *font8x16;
3173 +int graphics_inited = 0;
3174 +static char splashimage[256];
3176 +int shade = 1, no_cursor = 0;
3178 +#define VSHADOW VSHADOW1
3179 +unsigned char VSHADOW1[38400];
3180 +unsigned char VSHADOW2[38400];
3181 +unsigned char VSHADOW4[38400];
3182 +unsigned char VSHADOW8[38400];
3184 +/* define the default viewable area */
3190 +/* text buffer has to be kept around so that we can write things as we
3191 + * scroll and the like */
3192 +unsigned short text[80 * 30];
3194 +/* graphics options */
3195 +int foreground = (63 << 16) | (63 << 8) | (63), background = 0, window_border = 0;
3197 +/* current position */
3198 +static int fontx = 0;
3199 +static int fonty = 0;
3201 +/* global state so that we don't try to recursively scroll or cursor */
3202 +static int no_scroll = 0;
3205 +static int graphics_standard_color = A_NORMAL;
3206 +static int graphics_normal_color = A_NORMAL;
3207 +static int graphics_highlight_color = A_REVERSE;
3208 +static int graphics_current_color = A_NORMAL;
3209 +static color_state graphics_color_state = COLOR_STATE_STANDARD;
3211 +static inline void outb(unsigned short port, unsigned char val)
3213 + __asm __volatile ("outb %0,%1"::"a" (val), "d" (port));
3216 +static void MapMask(int value) {
3218 + outb(0x3c5, value);
3221 +/* bit mask register */
3222 +static void BitMask(int value) {
3224 + outb(0x3cf, value);
3227 +/* move the graphics cursor location to col, row */
3228 +static void graphics_setxy(int col, int row) {
3229 + if (col >= view_x0 && col < view_x1) {
3231 + cursorX = col << 3;
3233 + if (row >= view_y0 && row < view_y1) {
3235 + cursorY = row << 4;
3239 +/* scroll the screen */
3240 +static void graphics_scroll() {
3243 + /* we don't want to scroll recursively... that would be bad */
3248 + /* disable pager temporarily */
3252 + /* move everything up a line */
3253 + for (j = view_y0 + 1; j < view_y1; j++) {
3254 + graphics_gotoxy(view_x0, j - 1);
3255 + for (i = view_x0; i < view_x1; i++) {
3256 + graphics_putchar(text[j * 80 + i]);
3260 + /* last line should be blank */
3261 + graphics_gotoxy(view_x0, view_y1 - 1);
3262 + for (i = view_x0; i < view_x1; i++)
3263 + graphics_putchar(' ');
3264 + graphics_setxy(view_x0, view_y1 - 1);
3271 +/* Set the splash image */
3272 +void graphics_set_splash(char *splashfile) {
3273 + grub_strcpy(splashimage, splashfile);
3276 +/* Get the current splash image */
3277 +char *graphics_get_splash(void) {
3278 + return splashimage;
3282 + * Initialize a vga16 graphics display with the palette based off of
3283 + * the image in splashimage. If the image doesn't exist, leave graphics
3284 + * mode. The mode initiated is 12h. From "Ralf Brown's Interrupt List":
3285 + * text/ text pixel pixel colors disply scrn system
3286 + * grph resol box resolution pages addr
3287 + * 12h G 80x30 8x16 640x480 16/256K . A000 VGA,ATI VIP
3288 + * G 80x30 8x16 640x480 16/64 . A000 ATI EGA Wonder
3289 + * G . . 640x480 16 . . UltraVision+256K EGA
3291 +int graphics_init()
3293 + if (!graphics_inited) {
3294 + saved_videomode = set_videomode(0x12);
3295 + if (get_videomode() != 0x12) {
3296 + set_videomode(saved_videomode);
3299 + graphics_inited = 1;
3304 + font8x16 = (unsigned char*)graphics_get_font();
3306 + /* make sure that the highlight color is set correctly */
3307 + graphics_highlight_color = ((graphics_normal_color >> 4) |
3308 + ((graphics_normal_color & 0xf) << 4));
3312 + if (!read_image(splashimage)) {
3313 + grub_printf("Failed to read splash image (%s)\n", splashimage);
3314 + grub_printf("Press any key to continue...");
3316 + set_videomode(saved_videomode);
3317 + graphics_inited = 0;
3321 + set_int1c_handler();
3326 +/* Leave graphics mode */
3327 +void graphics_end(void)
3329 + if (graphics_inited) {
3330 + unset_int1c_handler();
3331 + set_videomode(saved_videomode);
3332 + graphics_inited = 0;
3337 +/* Print ch on the screen. Handle any needed scrolling or the like */
3338 +void graphics_putchar(int ch) {
3341 + graphics_cursor(0);
3344 + if (fonty + 1 < view_y1)
3345 + graphics_setxy(fontx, fonty + 1);
3347 + graphics_scroll();
3348 + graphics_cursor(1);
3350 + } else if (ch == '\r') {
3351 + graphics_setxy(view_x0, fonty);
3352 + graphics_cursor(1);
3356 + graphics_cursor(0);
3358 + text[fonty * 80 + fontx] = ch;
3359 + text[fonty * 80 + fontx] &= 0x00ff;
3360 + if (graphics_current_color & 0xf0)
3361 + text[fonty * 80 + fontx] |= 0x100;
3363 + graphics_cursor(0);
3365 + if ((fontx + 1) >= view_x1) {
3366 + graphics_setxy(view_x0, fonty);
3367 + if (fonty + 1 < view_y1)
3368 + graphics_setxy(view_x0, fonty + 1);
3370 + graphics_scroll();
3371 + graphics_cursor(1);
3373 + graphics_cursor(0);
3375 + graphics_setxy(fontx + 1, fonty);
3378 + graphics_cursor(1);
3381 +/* get the current location of the cursor */
3382 +int graphics_getxy(void) {
3383 + return (fontx << 8) | fonty;
3386 +void graphics_gotoxy(int x, int y) {
3387 + graphics_cursor(0);
3389 + graphics_setxy(x, y);
3391 + graphics_cursor(1);
3394 +void graphics_cls(void) {
3396 + unsigned char *mem, *s1, *s2, *s4, *s8;
3398 + graphics_cursor(0);
3399 + graphics_gotoxy(view_x0, view_y0);
3401 + mem = (unsigned char*)VIDEOMEM;
3402 + s1 = (unsigned char*)VSHADOW1;
3403 + s2 = (unsigned char*)VSHADOW2;
3404 + s4 = (unsigned char*)VSHADOW4;
3405 + s8 = (unsigned char*)VSHADOW8;
3407 + for (i = 0; i < 80 * 30; i++)
3409 + graphics_cursor(1);
3415 + grub_memcpy(mem, s1, 38400);
3419 + grub_memcpy(mem, s2, 38400);
3423 + grub_memcpy(mem, s4, 38400);
3427 + grub_memcpy(mem, s8, 38400);
3433 + set_int1c_handler();
3437 +void graphics_setcolorstate (color_state state) {
3439 + case COLOR_STATE_STANDARD:
3440 + graphics_current_color = graphics_standard_color;
3442 + case COLOR_STATE_NORMAL:
3443 + graphics_current_color = graphics_normal_color;
3445 + case COLOR_STATE_HIGHLIGHT:
3446 + graphics_current_color = graphics_highlight_color;
3449 + graphics_current_color = graphics_standard_color;
3453 + graphics_color_state = state;
3456 +void graphics_setcolor (int normal_color, int highlight_color) {
3457 + graphics_normal_color = normal_color;
3458 + graphics_highlight_color = highlight_color;
3460 + graphics_setcolorstate (graphics_color_state);
3463 +int graphics_setcursor (int on) {
3464 + if (!no_cursor && !on) {
3466 + unset_int1c_handler();
3467 + graphics_cursor(0);
3469 + else if(no_cursor && on) {
3471 + set_int1c_handler();
3472 + graphics_cursor(1);
3477 +/* Read in the splashscreen image and set the palette up appropriately.
3478 + * Format of splashscreen is an xpm (can be gzipped) with 16 colors and
3480 +int read_image(char *s)
3482 + char buf[32], pal[16], c;
3483 + unsigned char base, mask, *s1, *s2, *s4, *s8;
3484 + unsigned i, len, idx, colors, x, y, width, height;
3486 + if (!grub_open(s))
3490 + if (!grub_read((char*)&buf, 10) || grub_memcmp(buf, "/* XPM */\n", 10)) {
3496 + while (grub_read(&c, 1)) {
3501 + while (grub_read(&c, 1) && (c == ' ' || c == '\t'))
3506 + while (grub_read(&c, 1)) {
3507 + if (c >= '0' && c <= '9')
3508 + width = width * 10 + c - '0';
3512 + while (grub_read(&c, 1) && (c == ' ' || c == '\t'))
3516 + while (grub_read(&c, 1)) {
3517 + if (c >= '0' && c <= '9')
3518 + height = height * 10 + c - '0';
3522 + while (grub_read(&c, 1) && (c == ' ' || c == '\t'))
3526 + while (grub_read(&c, 1)) {
3527 + if (c >= '0' && c <= '9')
3528 + colors = colors * 10 + c - '0';
3534 + while (grub_read(&c, 1) && c != '"')
3538 + for (i = 0, idx = 1; i < colors; i++) {
3541 + while (grub_read(&c, 1) && c != '"')
3543 + grub_read(&c, 1); /* char */
3545 + grub_read(buf, 4); /* \t c # */
3547 + while (grub_read(&c, 1) && c != '"') {
3548 + if (len < sizeof(buf))
3552 + if (len == 6 && idx < 15) {
3553 + int r = ((hex(buf[0]) << 4) | hex(buf[1])) >> 2;
3554 + int g = ((hex(buf[2]) << 4) | hex(buf[3])) >> 2;
3555 + int b = ((hex(buf[4]) << 4) | hex(buf[5])) >> 2;
3558 + graphics_set_palette(idx, r, g, b);
3565 + s1 = (unsigned char*)VSHADOW1;
3566 + s2 = (unsigned char*)VSHADOW2;
3567 + s4 = (unsigned char*)VSHADOW4;
3568 + s8 = (unsigned char*)VSHADOW8;
3570 + for (i = 0; i < 38400; i++)
3571 + s1[i] = s2[i] = s4[i] = s8[i] = 0;
3573 + /* parse xpm data */
3574 + while (y < height) {
3576 + if (!grub_read(&c, 1)) {
3584 + while (grub_read(&c, 1) && c != '"') {
3585 + for (i = 1; i < 15; i++)
3586 + if (pal[i] == c) {
3591 + mask = 0x80 >> (x & 7);
3593 + s1[len + (x >> 3)] |= mask;
3595 + s2[len + (x >> 3)] |= mask;
3597 + s4[len + (x >> 3)] |= mask;
3599 + s8[len + (x >> 3)] |= mask;
3613 + graphics_set_palette(0, (background >> 16), (background >> 8) & 63,
3615 + graphics_set_palette(15, (foreground >> 16), (foreground >> 8) & 63,
3617 + graphics_set_palette(0x11, (window_border >> 16), (window_border >> 8) & 63,
3618 + window_border & 63);
3623 +/* Convert a character which is a hex digit to the appropriate integer */
3626 + if (v >= 'A' && v <= 'F')
3627 + return (v - 'A' + 10);
3628 + if (v >= 'a' && v <= 'f')
3629 + return (v - 'a' + 10);
3633 +void graphics_cursor(int set) {
3634 + unsigned char *pat, *mem, *ptr, chr[16 << 2];
3635 + int i, ch, invert, offset;
3637 + if (set && (no_cursor || no_scroll))
3640 + offset = cursorY * 80 + fontx;
3641 + ch = text[fonty * 80 + fontx] & 0xff;
3642 + invert = (text[fonty * 80 + fontx] & 0xff00) != 0;
3643 + pat = font8x16 + (ch << 4);
3645 + mem = (unsigned char*)VIDEOMEM + offset;
3648 + for (i = 0; i < 16; i++) {
3649 + unsigned char mask = pat[i];
3652 + chr[i ] = ((unsigned char*)VSHADOW1)[offset];
3653 + chr[16 + i] = ((unsigned char*)VSHADOW2)[offset];
3654 + chr[32 + i] = ((unsigned char*)VSHADOW4)[offset];
3655 + chr[48 + i] = ((unsigned char*)VSHADOW8)[offset];
3658 + if (ch == DISP_VERT || ch == DISP_LL ||
3659 + ch == DISP_UR || ch == DISP_LR) {
3660 + unsigned char pmask = ~(pat[i] >> 1);
3663 + chr[16 + i] &= pmask;
3664 + chr[32 + i] &= pmask;
3665 + chr[48 + i] &= pmask;
3667 + if (i > 0 && ch != DISP_VERT) {
3668 + unsigned char pmask = ~(pat[i - 1] >> 1);
3671 + chr[16 + i] &= pmask;
3672 + chr[32 + i] &= pmask;
3673 + chr[48 + i] &= pmask;
3674 + if (ch == DISP_HORIZ || ch == DISP_UR || ch == DISP_LR) {
3675 + pmask = ~pat[i - 1];
3678 + chr[16 + i] &= pmask;
3679 + chr[32 + i] &= pmask;
3680 + chr[48 + i] &= pmask;
3685 + chr[16 + i] |= mask;
3686 + chr[32 + i] |= mask;
3687 + chr[48 + i] |= mask;
3693 + chr[16 + i] = mask;
3694 + chr[32 + i] = mask;
3695 + chr[48 + i] = mask;
3702 + for (i = 0; i < 16; i++, ptr += 80) {
3703 + cursorBuf[i] = pat[i];
3710 + for (i = 1; i < 16; i <<= 1, offset += 16) {
3715 + for (j = 0; j < 16; j++, ptr += 80)
3716 + *ptr = chr[j + offset];
3722 +#endif /* SUPPORT_GRAPHICS */
3723 diff -Naur grub-0.97.orig/stage2/graphics.h grub-0.97/stage2/graphics.h
3724 --- grub-0.97.orig/stage2/graphics.h 1969-12-31 16:00:00.000000000 -0800
3725 +++ grub-0.97/stage2/graphics.h 2006-07-03 23:58:41.000000000 -0700
3727 +/* graphics.h - graphics console interface */
3729 + * GRUB -- GRand Unified Bootloader
3730 + * Copyright (C) 2002 Free Software Foundation, Inc.
3732 + * This program is free software; you can redistribute it and/or modify
3733 + * it under the terms of the GNU General Public License as published by
3734 + * the Free Software Foundation; either version 2 of the License, or
3735 + * (at your option) any later version.
3737 + * This program is distributed in the hope that it will be useful,
3738 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3739 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3740 + * GNU General Public License for more details.
3742 + * You should have received a copy of the GNU General Public License
3743 + * along with this program; if not, write to the Free Software
3744 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
3750 +/* magic constant */
3751 +#define VIDEOMEM 0xA0000
3753 +/* function prototypes */
3754 +char *graphics_get_splash(void);
3756 +int read_image(char *s);
3757 +void graphics_cursor(int set);
3759 +/* function prototypes for asm functions */
3760 +void * graphics_get_font();
3761 +void graphics_set_palette(int idx, int red, int green, int blue);
3762 +void set_int1c_handler();
3763 +void unset_int1c_handler();
3765 +extern short cursorX, cursorY;
3766 +extern char cursorBuf[16];
3768 +extern int view_x0, view_y0, view_x1, view_y1;
3770 +#endif /* GRAPHICS_H */
3771 diff -Naur grub-0.97.orig/stage2/Makefile.am grub-0.97/stage2/Makefile.am
3772 --- grub-0.97.orig/stage2/Makefile.am 2005-02-02 12:37:35.000000000 -0800
3773 +++ grub-0.97/stage2/Makefile.am 2006-07-03 23:58:41.000000000 -0700
3775 fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \
3776 imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \
3777 nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \
3778 - terminfo.h tparm.h nbi.h ufs2.h vstafs.h xfs.h
3779 + terminfo.h tparm.h nbi.h ufs2.h vstafs.h xfs.h graphics.h
3780 EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS)
3784 disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \
3785 fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs2.c \
3786 fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \
3787 - terminfo.c tparm.c
3788 + terminfo.c tparm.c graphics.c
3789 libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \
3790 -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \
3791 -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \
3796 +if GRAPHICS_SUPPORT
3797 +GRAPHICS_FLAGS = -DSUPPORT_GRAPHICS=1
3802 STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \
3803 - $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS)
3804 + $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) $(GRAPHICS_FLAGS)
3806 STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000
3807 STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1
3809 cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \
3810 fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \
3811 fsys_reiserfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c gunzip.c \
3812 - hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c
3813 + hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c \
3815 pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
3816 pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS)
3817 pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK)
3818 diff -Naur grub-0.97.orig/stage2/shared.h grub-0.97/stage2/shared.h
3819 --- grub-0.97.orig/stage2/shared.h 2004-06-19 09:40:09.000000000 -0700
3820 +++ grub-0.97/stage2/shared.h 2006-07-04 00:01:50.000000000 -0700
3821 @@ -499,7 +499,11 @@
3822 unsigned char linear_reserved_field_position;
3823 unsigned long max_pixel_clock;
3825 - unsigned char reserved3[189];
3826 + /* Reserved field to make structure to be 256 bytes long, VESA BIOS
3827 + Extension 3.0 Specification says to reserve 189 bytes here but
3828 + that doesn't make structure to be 256 bytes. So additional one is
3830 + unsigned char reserved3[189 + 1];
3831 } __attribute__ ((packed));
3834 @@ -792,6 +796,11 @@
3835 /* Set the cursor position. */
3836 void gotoxy (int x, int y);
3839 + Returns 1 = if pager was used
3840 + 0 = if pager wasn't used */
3841 +int do_more (void);
3843 /* Displays an ASCII character. IBM displays will translate some
3844 characters to special graphical ones (see the DISP_* constants). */
3845 void grub_putchar (int c);
3847 int grub_tolower (int c);
3848 int grub_isspace (int c);
3849 int grub_strncat (char *s1, const char *s2, int n);
3850 +void grub_memcpy(void *dest, const void *src, int len);
3851 void *grub_memmove (void *to, const void *from, int len);
3852 void *grub_memset (void *start, int c, int len);
3853 int grub_strncat (char *s1, const char *s2, int n);
3855 int nul_terminate (char *str);
3856 int get_based_digit (int c, int base);
3857 int safe_parse_maxint (char **str_ptr, int *myint_ptr);
3858 -int memcheck (int start, int len);
3859 +int memcheck (unsigned long int start, unsigned long int len);
3860 void grub_putstr (const char *str);
3862 #ifndef NO_DECOMPRESSION
3863 diff -Naur grub-0.97.orig/stage2/stage2.c grub-0.97/stage2/stage2.c
3864 --- grub-0.97.orig/stage2/stage2.c 2005-03-19 09:51:57.000000000 -0800
3865 +++ grub-0.97/stage2/stage2.c 2006-07-04 00:01:50.000000000 -0700
3870 +#ifdef SUPPORT_GRAPHICS
3871 +# include <graphics.h>
3874 +int col_start, col_end, row_start, box_size;
3876 grub_jmp_buf restart_env;
3878 #if defined(PRESET_MENU_STRING) || defined(SUPPORT_DISKLESS)
3879 @@ -105,13 +111,13 @@
3880 if (highlight && current_term->setcolorstate)
3881 current_term->setcolorstate (COLOR_STATE_HIGHLIGHT);
3884 + gotoxy (2 + col_start, y);
3886 - for (x = 3; x < 75; x++)
3887 + for (x = 3 + col_start; x < (col_end - 5); x++)
3889 - if (*entry && x <= 72)
3890 + if (*entry && x <= (col_end - 8))
3893 + if (x == (col_end - 8))
3894 grub_putchar (DISP_RIGHT);
3896 grub_putchar (*entry++);
3902 + gotoxy ((col_end - 6), y);
3904 if (current_term->setcolorstate)
3905 current_term->setcolorstate (COLOR_STATE_STANDARD);
3910 - gotoxy (77, y + 1);
3911 + gotoxy ((col_end - 3), y + 1);
3914 grub_putchar (DISP_UP);
3915 @@ -151,14 +157,14 @@
3919 - gotoxy (77, y + size);
3920 + gotoxy ((col_end - 3), y + size);
3923 grub_putchar (DISP_DOWN);
3927 - gotoxy (74, y + entryno + 1);
3928 + gotoxy ((col_end - 6), y + entryno + 1);
3932 @@ -196,30 +202,30 @@
3933 if (current_term->setcolorstate)
3934 current_term->setcolorstate (COLOR_STATE_NORMAL);
3937 + gotoxy (1 + col_start, y);
3939 grub_putchar (DISP_UL);
3940 - for (i = 0; i < 73; i++)
3941 + for (i = col_start; i < (col_end - 7); i++)
3942 grub_putchar (DISP_HORIZ);
3943 grub_putchar (DISP_UR);
3948 - gotoxy (1, y + i);
3949 + gotoxy (1 + col_start, y + i);
3954 grub_putchar (DISP_VERT);
3955 - gotoxy (75, y + i);
3956 + gotoxy ((col_end - 5), y + i);
3957 grub_putchar (DISP_VERT);
3962 grub_putchar (DISP_LL);
3963 - for (i = 0; i < 73; i++)
3964 + for (i = col_start; i < (col_end - 7); i++)
3965 grub_putchar (DISP_HORIZ);
3966 grub_putchar (DISP_LR);
3970 int c, time1, time2 = -1, first_entry = 0;
3971 char *cur_entry = 0;
3972 + struct term_entry *prev_term = NULL;
3975 * Main loop for menu UI.
3976 @@ -250,6 +257,22 @@
3984 + /* if we're using viewport we need to make sure to setup
3985 + coordinates correctly. */
3986 +#ifdef SUPPORT_GRAPHICS
3987 + if (grub_memcmp (current_term->name, "graphics", sizeof ("graphics") - 1) == 0)
3989 + col_start = view_x0;
3990 + col_end = view_x1;
3991 + row_start = view_y0;
3992 + box_size = (view_y1 - view_y0) - 13;
3996 /* If the timeout was expired or wasn't set, force to show the menu
3998 if (grub_timeout < 0)
3999 @@ -302,36 +325,36 @@
4000 if (current_term->flags & TERM_DUMB)
4001 print_entries_raw (num_entries, first_entry, menu_entries);
4003 - print_border (3, 12);
4004 + print_border (3 + row_start, box_size);
4007 - Use the %c and %c keys to select which entry is highlighted.\n",
4008 + Use the %c and %c keys to select which entry is highlighted.\n",
4009 DISP_UP, DISP_DOWN);
4011 if (! auth && password)
4014 - Press enter to boot the selected OS or \'p\' to enter a\n\
4015 - password to unlock the next set of features.");
4016 + Press enter to boot the selected OS or \'p\' to enter a\n\
4017 + password to unlock the next set of features.");
4023 - Press enter to boot the selected OS, \'e\' to edit the\n\
4024 - commands before booting, or \'c\' for a command-line.");
4025 + Press enter to boot the selected OS, \'e\' to edit the\n\
4026 + commands before booting, or \'c\' for a command-line.");
4029 - Press \'b\' to boot, \'e\' to edit the selected command in the\n\
4030 - boot sequence, \'c\' for a command-line, \'o\' to open a new line\n\
4031 - after (\'O\' for before) the selected line, \'d\' to remove the\n\
4032 - selected line, or escape to go back to the main menu.");
4033 + Press \'b\' to boot, \'e\' to edit the selected command in the\n\
4034 + boot sequence, \'c\' for a command-line, \'o\' to open a new line\n\
4035 + after (\'O\' for before) the selected line, \'d\' to remove the\n\
4036 + selected line, or escape to go back to the main menu.");
4039 if (current_term->flags & TERM_DUMB)
4040 grub_printf ("\n\nThe selected entry is %d ", entryno);
4042 - print_entries (3, 12, first_entry, entryno, menu_entries);
4043 + print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries);
4046 /* XX using RT clock now, need to initialize value */
4047 @@ -358,10 +381,10 @@
4048 entryno, grub_timeout);
4052 - grub_printf ("The highlighted entry will be booted automatically in %d seconds. ",
4053 + gotoxy (3 + col_start, 10 + box_size + row_start);
4054 + grub_printf (" The highlighted entry will be booted automatically in %d seconds. ",
4056 - gotoxy (74, 4 + entryno);
4057 + gotoxy ((col_end - 6), 4 + entryno + row_start);
4061 @@ -387,12 +410,12 @@
4062 if (current_term->flags & TERM_DUMB)
4063 grub_putchar ('\r');
4066 + gotoxy (3 + col_start, 10 + box_size + row_start);
4069 fallback_entryno = -1;
4070 if (! (current_term->flags & TERM_DUMB))
4071 - gotoxy (74, 4 + entryno);
4072 + gotoxy ((col_end - 6), 4 + entryno + row_start);
4075 /* We told them above (at least in SUPPORT_SERIAL) to use
4076 @@ -408,12 +431,12 @@
4080 - print_entry (4 + entryno, 0,
4081 + print_entry (4 + entryno + row_start, 0,
4082 get_entry (menu_entries,
4083 first_entry + entryno,
4086 - print_entry (4 + entryno, 1,
4087 + print_entry (4 + entryno + row_start, 1,
4088 get_entry (menu_entries,
4089 first_entry + entryno,
4092 else if (first_entry > 0)
4095 - print_entries (3, 12, first_entry, entryno,
4096 + print_entries (3 + row_start, box_size, first_entry, entryno,
4100 @@ -433,29 +456,29 @@
4105 + if (entryno < (box_size - 1))
4107 - print_entry (4 + entryno, 0,
4108 + print_entry (4 + entryno + row_start, 0,
4109 get_entry (menu_entries,
4110 first_entry + entryno,
4113 - print_entry (4 + entryno, 1,
4114 + print_entry (4 + entryno + row_start, 1,
4115 get_entry (menu_entries,
4116 first_entry + entryno,
4119 - else if (num_entries > 12 + first_entry)
4120 + else if (num_entries > box_size + first_entry)
4123 - print_entries (3, 12, first_entry, entryno, menu_entries);
4124 + print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries);
4131 - first_entry -= 12;
4132 + first_entry -= box_size;
4133 if (first_entry < 0)
4135 entryno += first_entry;
4136 @@ -463,20 +486,20 @@
4140 - print_entries (3, 12, first_entry, entryno, menu_entries);
4141 + print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries);
4146 - first_entry += 12;
4147 + first_entry += box_size;
4148 if (first_entry + entryno + 1 >= num_entries)
4150 - first_entry = num_entries - 12;
4151 + first_entry = num_entries - box_size;
4152 if (first_entry < 0)
4154 entryno = num_entries - first_entry - 1;
4156 - print_entries (3, 12, first_entry, entryno, menu_entries);
4157 + print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries);
4162 if ((c == 'd') || (c == 'o') || (c == 'O'))
4164 if (! (current_term->flags & TERM_DUMB))
4165 - print_entry (4 + entryno, 0,
4166 + print_entry (4 + entryno + row_start, 0,
4167 get_entry (menu_entries,
4168 first_entry + entryno,
4172 if (entryno >= num_entries)
4174 - if (first_entry && num_entries < 12 + first_entry)
4175 + if (first_entry && num_entries < box_size + first_entry)
4183 - print_entries (3, 12, first_entry, entryno, menu_entries);
4184 + print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries);
4187 cur_entry = menu_entries;
4189 if (current_term->flags & TERM_DUMB)
4190 grub_printf ("\r ");
4193 + gotoxy (1 + col_start, 9 + box_size + row_start);
4195 /* Wipe out the previously entered password */
4196 grub_memset (entered, 0, sizeof (entered));
4197 @@ -651,7 +674,10 @@
4201 - run_menu (heap, NULL, new_num_entries, new_heap, 0);
4203 + current_entryno = first_entry + entryno;
4204 + run_menu (heap, NULL, new_num_entries, new_heap, 0);
4209 @@ -714,6 +740,15 @@
4213 + /* if our terminal needed initialization, we should shut it down
4214 + * before booting the kernel, but we want to save what it was so
4215 + * we can come back if needed */
4216 + prev_term = current_term;
4217 + if (current_term->shutdown)
4219 + current_term->shutdown();
4220 + current_term = term_table; /* assumption: console is first */
4226 cur_entry = get_entry (config_entries, first_entry + entryno, 1);
4228 /* Set CURRENT_ENTRYNO for the command "savedefault". */
4229 - current_entryno = first_entry + entryno;
4230 + if (config_entries)
4231 + current_entryno = first_entry + entryno;
4233 if (run_script (cur_entry, heap))
4235 @@ -748,6 +784,13 @@
4239 + /* if we get back here, we should go back to what our term was before */
4240 + current_term = prev_term;
4241 + if (current_term->startup)
4242 + /* if our terminal fails to initialize, fall back to console since
4243 + * it should always work */
4244 + if (current_term->startup() == 0)
4245 + current_term = term_table; /* we know that console is first */
4249 @@ -891,8 +934,18 @@
4250 len = grub_read (buf, sizeof (buf));
4255 buf[sizeof (buf) - 1] = 0;
4256 - safe_parse_maxint (&p, &saved_entryno);
4258 + if((tmp = grub_strstr(p, ":")) != NULL)
4261 + grub_memcpy(&def, &tmp, sizeof(p));
4263 + grub_memcpy(&def, &p, sizeof(p));
4265 + safe_parse_maxint (&def, &saved_entryno);
4269 @@ -1050,6 +1103,16 @@
4273 + /* go ahead and make sure the terminal is setup */
4274 + if (current_term->startup)
4276 + /* If initialization fails, go back to default terminal */
4277 + if (current_term->startup() == 0)
4279 + current_term = term_table;
4285 /* If no acceptable config file, goto command-line, starting
4286 diff -Naur grub-0.97.orig/stage2/term.h grub-0.97/stage2/term.h
4287 --- grub-0.97.orig/stage2/term.h 2003-07-09 04:45:53.000000000 -0700
4288 +++ grub-0.97/stage2/term.h 2006-07-03 23:58:41.000000000 -0700
4291 /* The feature flags defined above. */
4292 unsigned long flags;
4293 + /* Default for maximum number of lines if not specified */
4294 + unsigned short max_lines;
4295 /* Put a character. */
4296 void (*putchar) (int c);
4297 /* Check if any input character is available. */
4299 void (*setcolor) (int normal_color, int highlight_color);
4300 /* Turn on/off the cursor. */
4301 int (*setcursor) (int on);
4302 + /* function to start a terminal */
4303 + int (*startup) (void);
4304 + /* function to use to shutdown a terminal */
4305 + void (*shutdown) (void);
4308 /* This lists up available terminals. */
4309 @@ -124,4 +130,24 @@
4310 int hercules_setcursor (int on);
4313 +#ifdef SUPPORT_GRAPHICS
4314 +extern int foreground, background, window_border, graphics_inited, saved_videomode;
4316 +void graphics_set_splash(char *splashfile);
4317 +int set_videomode(int mode);
4318 +int get_videomode(void);
4319 +void graphics_putchar (int c);
4320 +int graphics_getxy(void);
4321 +void graphics_gotoxy(int x, int y);
4322 +void graphics_cls(void);
4323 +void graphics_setcolorstate (color_state state);
4324 +void graphics_setcolor (int normal_color, int highlight_color);
4325 +int graphics_setcursor (int on);
4326 +int graphics_init(void);
4327 +void graphics_end(void);
4330 +void graphics_set_palette(int idx, int red, int green, int blue);
4331 +#endif /* SUPPORT_GRAPHICS */
4333 #endif /* ! GRUB_TERM_HEADER */
4334 diff -Naur grub-0.97.orig/THANKS grub-0.97/THANKS
4335 --- grub-0.97.orig/THANKS 2005-05-07 19:17:43.000000000 -0700
4336 +++ grub-0.97/THANKS 2006-07-04 00:01:50.000000000 -0700
4338 Yedidyah Bar-David <didi@post.tau.ac.il>
4339 Yury V. Umanets <umka@namesys.com>
4340 Yuri Zaporogets <yuriz@ukr.net>
4341 +Vitaly Fertman <vitaly@namesys.com>
4342 diff -Naur grub-0.97.orig/util/grub-install.in grub-0.97/util/grub-install.in
4343 --- grub-0.97.orig/util/grub-install.in 2004-07-24 11:57:31.000000000 -0700
4344 +++ grub-0.97/util/grub-install.in 2006-07-04 00:01:50.000000000 -0700
4349 +# Usage: getraid_mdadm mddevice
4350 +# Routine to find a physical device from an md device
4351 +# If found, the first grub BIOS device (from device.map) is returned
4352 +# If no BIOS drives match the RAID devices, the first device returned
4353 +# from mdadm -D is returned
4356 + mdadm=$(mdadm -D "$device") || {
4357 + echo "$PROG: mdadm -D $device failed" >&2
4361 + echo "$mdadm" | awk '
4362 + $1 == "Number" && $2 == "Major" { start = 1; next }
4363 + $1 == "UUID" { print "uuid=" $3; start = 0; next }
4365 + $2 == 0 && $3 == 0 { next }
4366 + { devices = devices "\n" $NF }
4367 + END { print "devices='\''" devices "'\''" }
4371 + # Convert RAID devices list into a list of disks
4372 + tmp_disks=`echo "$devices" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
4373 + -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
4374 + -e 's%\(fd[0-9]*\)$%\1%' \
4375 + -e 's%/part[0-9]*$%/disc%' \
4376 + -e 's%\(c[0-7]d[0-9]*\).*$%\1%' \
4378 + sed -n '1h;2,$H;${g;s/\n/|/g;p}'`
4380 + # Find first BIOS disk that's a member of the RAID array
4381 + # Default to first RAID member if no tmp_disks are BIOS devices
4382 + set -- `egrep $tmp_disks $device_map | \
4385 + device=${2:-${tmp_disks%%|*}}
4387 + # Return first partition on BIOS disk that's part of the RAID
4388 + echo "$devices" | \
4389 + sed -n "\:${device}:p" | \
4393 # Usage: convert os_device
4394 # Convert an OS device to the corresponding GRUB drive.
4395 # This part is OS-specific.
4397 # Break the device name into the disk part and the partition part.
4400 + # Find an actual physical device if we're passed a RAID device
4402 + /dev/md*) set -- `getraid_mdadm $1`
4404 tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \
4405 -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \
4406 -e 's%\(fd[0-9]*\)$%\1%' \
4408 tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'`
4409 tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;;
4410 freebsd* | kfreebsd*-gnu)
4411 - tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%r\1%' \
4412 - | sed 's%r\{0,1\}\(da[0-9]*\).*$%r\1%'`
4413 + tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%\1%' \
4414 + | sed 's%r\{0,1\}\(da[0-9]*\).*$%\1%'`
4415 tmp_part=`echo "$1" \
4416 | sed "s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" \
4417 | sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%"`
4420 # Get the drive name.
4421 tmp_drive=`grep -v '^#' $device_map | grep "$tmp_disk *$" \
4422 - | sed 's%.*\(([hf]d[0-9][a-g0-9,]*)\).*%\1%'`
4423 + | sed 's%.*\(([hf]d[0-9][a-z0-9,]*)\).*%\1%'`
4425 # If not found, print an error message and exit.
4426 if test "x$tmp_drive" = x; then
4427 @@ -148,13 +196,13 @@
4429 if echo $tmp_part | grep "^s" >/dev/null; then
4430 tmp_pc_slice=`echo $tmp_part \
4431 - | sed "s%s\([0-9]*\)[a-g]*$%\1%"`
4432 + | sed "s%s\([0-9]*\)[a-z]*$%\1%"`
4433 tmp_drive=`echo "$tmp_drive" \
4434 | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"`
4436 - if echo $tmp_part | grep "[a-g]$" >/dev/null; then
4437 + if echo $tmp_part | grep "[a-z]$" >/dev/null; then
4438 tmp_bsd_partition=`echo "$tmp_part" \
4439 - | sed "s%[^a-g]*\([a-g]\)$%\1%"`
4440 + | sed "s%[^a-z]*\([a-z]\)$%\1%"`
4441 tmp_drive=`echo "$tmp_drive" \
4442 | sed "s%)%,$tmp_bsd_partition)%"`
4444 @@ -336,6 +384,10 @@
4445 # Create a safe temporary file.
4446 test -n "$mklog" && log_file=`$mklog`
4448 + # Before all invocations of the grub shell, call sync to make sure
4449 + # the raw device is in sync with any bufferring in filesystems.
4452 $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
4455 @@ -450,6 +502,24 @@
4456 # Create a safe temporary file.
4457 test -n "$mklog" && log_file=`$mklog`
4459 +# Sync to prevent GRUB from not finding stage files (notably, on XFS)
4462 +# XFS needs special magic
4464 +if which xfs_freeze > /dev/null ; then
4466 +Due to a bug in xfs_freeze, the following command might produce a segmentation
4467 +fault when ${grubdir} is not in an XFS filesystem. This error is harmless and
4470 + if xfs_freeze -f ${grubdir} ; then xfs_frozen=true ; fi
4473 +# Before all invocations of the grub shell, call sync to make sure
4474 +# the raw device is in sync with any bufferring in filesystems.
4477 # Now perform the installation.
4478 $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file
4480 @@ -457,6 +527,10 @@
4484 +if ${xfs_frozen} ; then
4485 + xfs_freeze -u ${grubdir}
4488 if grep "Error [0-9]*: " $log_file >/dev/null || test $debug = yes; then