source:
patches/grub-0.97-fixes-1.patch@
ad4134f
Last change on this file since ad4134f was 5a4020f, checked in by , 18 years ago | |
---|---|
|
|
File size: 129.7 KB |
-
aclocal.m4
Submitted By: Jim Gifford (jim at linuxfromscratch dot org) Date: 2006-07-04 Initial Package Version: 0.97 Origin: Debian Upstream Status: Unknown Description: Contains various fixes and enhancements Graphics mode support Fixes for Raid Support XFS Filesystem Boot Freeze Fixes Removed 2GB Memory Limitation Freebsd support Fixes for initrd support Grub installation Fixes Linux 2.6 geometry Fixes Intel Mac Support Autoconf and aclocal updates diff -Naur grub-0.97.orig/aclocal.m4 grub-0.97/aclocal.m4
old new 1 # generated automatically by aclocal 1.9. 4-*- Autoconf -*-1 # generated automatically by aclocal 1.9.6 -*- Autoconf -*- 2 2 3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 4 # Free Software Foundation, Inc.3 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 4 # 2005 Free Software Foundation, Inc. 5 5 # This file is free software; the Free Software Foundation 6 6 # gives unlimited permission to copy and/or distribute it, 7 7 # with or without modifications, as long as this notice is preserved. … … 11 11 # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 12 12 # PARTICULAR PURPOSE. 13 13 14 # -*- Autoconf -*- 15 # Copyright (C) 2002, 2003 Free Software Foundation, Inc. 16 # Generated from amversion.in; do not edit by hand. 17 18 # This program is free software; you can redistribute it and/or modify 19 # it under the terms of the GNU General Public License as published by 20 # the Free Software Foundation; either version 2, or (at your option) 21 # any later version. 22 23 # This program is distributed in the hope that it will be useful, 24 # but WITHOUT ANY WARRANTY; without even the implied warranty of 25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 # GNU General Public License for more details. 27 28 # You should have received a copy of the GNU General Public License 29 # along with this program; if not, write to the Free Software 30 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14 # Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. 15 # 16 # This file is free software; the Free Software Foundation 17 # gives unlimited permission to copy and/or distribute it, 18 # with or without modifications, as long as this notice is preserved. 31 19 32 20 # AM_AUTOMAKE_VERSION(VERSION) 33 21 # ---------------------------- … … 40 28 # Call AM_AUTOMAKE_VERSION so it can be traced. 41 29 # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. 42 30 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], 43 [AM_AUTOMAKE_VERSION([1.9.4])]) 44 45 # AM_AUX_DIR_EXPAND 46 47 # Copyright (C) 2001, 2003 Free Software Foundation, Inc. 31 [AM_AUTOMAKE_VERSION([1.9.6])]) 48 32 49 # This program is free software; you can redistribute it and/or modify 50 # it under the terms of the GNU General Public License as published by 51 # the Free Software Foundation; either version 2, or (at your option) 52 # any later version. 33 # AM_AUX_DIR_EXPAND -*- Autoconf -*- 53 34 54 # This program is distributed in the hope that it will be useful, 55 # but WITHOUT ANY WARRANTY; without even the implied warranty of 56 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 57 # GNU General Public License for more details. 58 59 # You should have received a copy of the GNU General Public License 60 # along with this program; if not, write to the Free Software 61 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 62 # 02111-1307, USA. 35 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. 36 # 37 # This file is free software; the Free Software Foundation 38 # gives unlimited permission to copy and/or distribute it, 39 # with or without modifications, as long as this notice is preserved. 63 40 64 41 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets 65 42 # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to … … 106 83 am_aux_dir=`cd $ac_aux_dir && pwd` 107 84 ]) 108 85 109 # AM_CONDITIONAL 86 # AM_CONDITIONAL -*- Autoconf -*- 110 87 111 # Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. 112 113 # This program is free software; you can redistribute it and/or modify 114 # it under the terms of the GNU General Public License as published by 115 # the Free Software Foundation; either version 2, or (at your option) 116 # any later version. 117 118 # This program is distributed in the hope that it will be useful, 119 # but WITHOUT ANY WARRANTY; without even the implied warranty of 120 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 121 # GNU General Public License for more details. 122 123 # You should have received a copy of the GNU General Public License 124 # along with this program; if not, write to the Free Software 125 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 126 # 02111-1307, USA. 88 # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 89 # Free Software Foundation, Inc. 90 # 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. 127 94 128 # serial 695 # serial 7 129 96 130 97 # AM_CONDITIONAL(NAME, SHELL-CONDITION) 131 98 # ------------------------------------- … … 149 116 Usually this means the macro was only invoked conditionally.]]) 150 117 fi])]) 151 118 152 # serial 7 -*- Autoconf -*-153 119 154 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 120 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 155 121 # Free Software Foundation, Inc. 122 # 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. 156 126 157 # This program is free software; you can redistribute it and/or modify 158 # it under the terms of the GNU General Public License as published by 159 # the Free Software Foundation; either version 2, or (at your option) 160 # any later version. 161 162 # This program is distributed in the hope that it will be useful, 163 # but WITHOUT ANY WARRANTY; without even the implied warranty of 164 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 165 # GNU General Public License for more details. 166 167 # You should have received a copy of the GNU General Public License 168 # along with this program; if not, write to the Free Software 169 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 170 # 02111-1307, USA. 171 127 # serial 8 172 128 173 129 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be 174 130 # written in clear, in which case automake, when reading aclocal.m4, … … 177 133 # CC etc. in the Makefile, will ask for an AC_PROG_CC use... 178 134 179 135 180 181 136 # _AM_DEPENDENCIES(NAME) 182 137 # ---------------------- 183 138 # See how the compiler implements dependency checking. … … 317 272 AC_SUBST([AMDEPBACKSLASH]) 318 273 ]) 319 274 320 # Generate code to set up dependency tracking. -*- Autoconf -*- 321 322 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 323 # Free Software Foundation, Inc. 324 325 # This program is free software; you can redistribute it and/or modify 326 # it under the terms of the GNU General Public License as published by 327 # the Free Software Foundation; either version 2, or (at your option) 328 # any later version. 275 # Generate code to set up dependency tracking. -*- Autoconf -*- 329 276 330 # This program is distributed in the hope that it will be useful, 331 # but WITHOUT ANY WARRANTY; without even the implied warranty of 332 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 333 # GNU General Public License for more details. 334 335 # You should have received a copy of the GNU General Public License 336 # along with this program; if not, write to the Free Software 337 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 338 # 02111-1307, USA. 277 # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 278 # Free Software Foundation, Inc. 279 # 280 # This file is free software; the Free Software Foundation 281 # gives unlimited permission to copy and/or distribute it, 282 # with or without modifications, as long as this notice is preserved. 339 283 340 #serial 2284 #serial 3 341 285 342 286 # _AM_OUTPUT_DEPENDENCY_COMMANDS 343 287 # ------------------------------ … … 396 340 [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) 397 341 ]) 398 342 399 # Do all the work for Automake. -*- Autoconf -*-343 # Do all the work for Automake. -*- Autoconf -*- 400 344 401 # This macro actually does too much some checks are only needed if 402 # your package does certain things. But this isn't really a big deal. 403 404 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 345 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 405 346 # Free Software Foundation, Inc. 347 # 348 # This file is free software; the Free Software Foundation 349 # gives unlimited permission to copy and/or distribute it, 350 # with or without modifications, as long as this notice is preserved. 406 351 407 # This program is free software; you can redistribute it and/or modify 408 # it under the terms of the GNU General Public License as published by 409 # the Free Software Foundation; either version 2, or (at your option) 410 # any later version. 411 412 # This program is distributed in the hope that it will be useful, 413 # but WITHOUT ANY WARRANTY; without even the implied warranty of 414 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 415 # GNU General Public License for more details. 416 417 # You should have received a copy of the GNU General Public License 418 # along with this program; if not, write to the Free Software 419 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 420 # 02111-1307, USA. 352 # serial 12 421 353 422 # serial 11 354 # This macro actually does too much. Some checks are only needed if 355 # your package does certain things. But this isn't really a big deal. 423 356 424 357 # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) 425 358 # AM_INIT_AUTOMAKE([OPTIONS]) … … 521 454 done 522 455 echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) 523 456 457 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. 458 # 459 # This file is free software; the Free Software Foundation 460 # gives unlimited permission to copy and/or distribute it, 461 # with or without modifications, as long as this notice is preserved. 462 524 463 # AM_PROG_INSTALL_SH 525 464 # ------------------ 526 465 # Define $install_sh. 527 528 # Copyright (C) 2001, 2003 Free Software Foundation, Inc.529 530 # This program is free software; you can redistribute it and/or modify531 # it under the terms of the GNU General Public License as published by532 # the Free Software Foundation; either version 2, or (at your option)533 # any later version.534 535 # This program is distributed in the hope that it will be useful,536 # but WITHOUT ANY WARRANTY; without even the implied warranty of537 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the538 # GNU General Public License for more details.539 540 # You should have received a copy of the GNU General Public License541 # along with this program; if not, write to the Free Software542 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA543 # 02111-1307, USA.544 545 466 AC_DEFUN([AM_PROG_INSTALL_SH], 546 467 [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 547 468 install_sh=${install_sh-"$am_aux_dir/install-sh"} 548 469 AC_SUBST(install_sh)]) 549 470 550 # -*- Autoconf -*- 551 # Copyright (C) 2003 Free Software Foundation, Inc. 552 553 # This program is free software; you can redistribute it and/or modify 554 # it under the terms of the GNU General Public License as published by 555 # the Free Software Foundation; either version 2, or (at your option) 556 # any later version. 557 558 # This program is distributed in the hope that it will be useful, 559 # but WITHOUT ANY WARRANTY; without even the implied warranty of 560 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 561 # GNU General Public License for more details. 562 563 # You should have received a copy of the GNU General Public License 564 # along with this program; if not, write to the Free Software 565 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 566 # 02111-1307, USA. 471 # Copyright (C) 2003, 2005 Free Software Foundation, Inc. 472 # 473 # This file is free software; the Free Software Foundation 474 # gives unlimited permission to copy and/or distribute it, 475 # with or without modifications, as long as this notice is preserved. 567 476 568 # serial 1477 # serial 2 569 478 570 479 # Check whether the underlying file-system supports filenames 571 480 # with a leading dot. For instance MS-DOS doesn't. … … 580 489 rmdir .tst 2>/dev/null 581 490 AC_SUBST([am__leading_dot])]) 582 491 583 # Add --enable-maintainer-mode option to configure. 492 # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- 584 493 # From Jim Meyering 585 494 586 # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004 495 # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 587 496 # Free Software Foundation, Inc. 497 # 498 # This file is free software; the Free Software Foundation 499 # gives unlimited permission to copy and/or distribute it, 500 # with or without modifications, as long as this notice is preserved. 588 501 589 # This program is free software; you can redistribute it and/or modify 590 # it under the terms of the GNU General Public License as published by 591 # the Free Software Foundation; either version 2, or (at your option) 592 # any later version. 593 594 # This program is distributed in the hope that it will be useful, 595 # but WITHOUT ANY WARRANTY; without even the implied warranty of 596 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 597 # GNU General Public License for more details. 598 599 # You should have received a copy of the GNU General Public License 600 # along with this program; if not, write to the Free Software 601 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 602 # 02111-1307, USA. 603 604 # serial 3 502 # serial 4 605 503 606 504 AC_DEFUN([AM_MAINTAINER_MODE], 607 505 [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) … … 620 518 621 519 AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) 622 520 623 # Check to see how 'make' treats includes. -*- Autoconf -*- 624 625 # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. 521 # Check to see how 'make' treats includes. -*- Autoconf -*- 626 522 627 # This program is free software; you can redistribute it and/or modify 628 # it under the terms of the GNU General Public License as published by 629 # the Free Software Foundation; either version 2, or (at your option) 630 # any later version. 631 632 # This program is distributed in the hope that it will be useful, 633 # but WITHOUT ANY WARRANTY; without even the implied warranty of 634 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 635 # GNU General Public License for more details. 636 637 # You should have received a copy of the GNU General Public License 638 # along with this program; if not, write to the Free Software 639 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 640 # 02111-1307, USA. 523 # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. 524 # 525 # This file is free software; the Free Software Foundation 526 # gives unlimited permission to copy and/or distribute it, 527 # with or without modifications, as long as this notice is preserved. 641 528 642 # serial 2529 # serial 3 643 530 644 531 # AM_MAKE_INCLUDE() 645 532 # ----------------- … … 683 570 rm -f confinc confmf 684 571 ]) 685 572 686 # -*- Autoconf -*- 687 688 689 # Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. 690 691 # This program is free software; you can redistribute it and/or modify 692 # it under the terms of the GNU General Public License as published by 693 # the Free Software Foundation; either version 2, or (at your option) 694 # any later version. 573 # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- 695 574 696 # This program is distributed in the hope that it will be useful, 697 # but WITHOUT ANY WARRANTY; without even the implied warranty of 698 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 699 # GNU General Public License for more details. 700 701 # You should have received a copy of the GNU General Public License 702 # along with this program; if not, write to the Free Software 703 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 704 # 02111-1307, USA. 575 # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 576 # Free Software Foundation, Inc. 577 # 578 # This file is free software; the Free Software Foundation 579 # gives unlimited permission to copy and/or distribute it, 580 # with or without modifications, as long as this notice is preserved. 705 581 706 # serial 3582 # serial 4 707 583 708 584 # AM_MISSING_PROG(NAME, PROGRAM) 709 585 # ------------------------------ … … 729 605 fi 730 606 ]) 731 607 608 # Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. 609 # 610 # This file is free software; the Free Software Foundation 611 # gives unlimited permission to copy and/or distribute it, 612 # with or without modifications, as long as this notice is preserved. 613 732 614 # AM_PROG_MKDIR_P 733 615 # --------------- 734 616 # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. 735 736 # Copyright (C) 2003, 2004 Free Software Foundation, Inc. 737 738 # This program is free software; you can redistribute it and/or modify 739 # it under the terms of the GNU General Public License as published by 740 # the Free Software Foundation; either version 2, or (at your option) 741 # any later version. 742 743 # This program is distributed in the hope that it will be useful, 744 # but WITHOUT ANY WARRANTY; without even the implied warranty of 745 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 746 # GNU General Public License for more details. 747 748 # You should have received a copy of the GNU General Public License 749 # along with this program; if not, write to the Free Software 750 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 751 # 02111-1307, USA. 752 617 # 753 618 # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories 754 619 # created by `make install' are always world readable, even if the 755 620 # installer happens to have an overly restrictive umask (e.g. 077). … … 803 668 fi 804 669 AC_SUBST([mkdir_p])]) 805 670 806 # Helper functions for option handling. -*- Autoconf -*-671 # Helper functions for option handling. -*- Autoconf -*- 807 672 808 # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. 809 810 # This program is free software; you can redistribute it and/or modify 811 # it under the terms of the GNU General Public License as published by 812 # the Free Software Foundation; either version 2, or (at your option) 813 # any later version. 814 815 # This program is distributed in the hope that it will be useful, 816 # but WITHOUT ANY WARRANTY; without even the implied warranty of 817 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 818 # GNU General Public License for more details. 819 820 # You should have received a copy of the GNU General Public License 821 # along with this program; if not, write to the Free Software 822 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 823 # 02111-1307, USA. 673 # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. 674 # 675 # This file is free software; the Free Software Foundation 676 # gives unlimited permission to copy and/or distribute it, 677 # with or without modifications, as long as this notice is preserved. 824 678 825 # serial 2679 # serial 3 826 680 827 681 # _AM_MANGLE_OPTION(NAME) 828 682 # ----------------------- … … 847 701 AC_DEFUN([_AM_IF_OPTION], 848 702 [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) 849 703 850 # 851 # Check to make sure that the build environment is sane. 852 # 853 854 # Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. 855 856 # This program is free software; you can redistribute it and/or modify 857 # it under the terms of the GNU General Public License as published by 858 # the Free Software Foundation; either version 2, or (at your option) 859 # any later version. 704 # Check to make sure that the build environment is sane. -*- Autoconf -*- 860 705 861 # This program is distributed in the hope that it will be useful, 862 # but WITHOUT ANY WARRANTY; without even the implied warranty of 863 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 864 # GNU General Public License for more details. 865 866 # You should have received a copy of the GNU General Public License 867 # along with this program; if not, write to the Free Software 868 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 869 # 02111-1307, USA. 706 # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 707 # Free Software Foundation, Inc. 708 # 709 # This file is free software; the Free Software Foundation 710 # gives unlimited permission to copy and/or distribute it, 711 # with or without modifications, as long as this notice is preserved. 870 712 871 # serial 3713 # serial 4 872 714 873 715 # AM_SANITY_CHECK 874 716 # --------------- … … 911 753 fi 912 754 AC_MSG_RESULT(yes)]) 913 755 914 # AM_PROG_INSTALL_STRIP 915 916 # Copyright (C) 2001, 2003 Free Software Foundation, Inc. 917 918 # This program is free software; you can redistribute it and/or modify 919 # it under the terms of the GNU General Public License as published by 920 # the Free Software Foundation; either version 2, or (at your option) 921 # any later version. 922 923 # This program is distributed in the hope that it will be useful, 924 # but WITHOUT ANY WARRANTY; without even the implied warranty of 925 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 926 # GNU General Public License for more details. 927 928 # You should have received a copy of the GNU General Public License 929 # along with this program; if not, write to the Free Software 930 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 931 # 02111-1307, USA. 756 # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. 757 # 758 # This file is free software; the Free Software Foundation 759 # gives unlimited permission to copy and/or distribute it, 760 # with or without modifications, as long as this notice is preserved. 932 761 762 # AM_PROG_INSTALL_STRIP 763 # --------------------- 933 764 # One issue with vendor `install' (even GNU) is that you can't 934 765 # specify the program used to strip binaries. This is especially 935 766 # annoying in cross-compiling environments, where the build's strip … … 952 783 953 784 # Check how to create a tarball. -*- Autoconf -*- 954 785 955 # Copyright (C) 2004 Free Software Foundation, Inc. 956 957 # This program is free software; you can redistribute it and/or modify 958 # it under the terms of the GNU General Public License as published by 959 # the Free Software Foundation; either version 2, or (at your option) 960 # any later version. 961 962 # This program is distributed in the hope that it will be useful, 963 # but WITHOUT ANY WARRANTY; without even the implied warranty of 964 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 965 # GNU General Public License for more details. 966 967 # You should have received a copy of the GNU General Public License 968 # along with this program; if not, write to the Free Software 969 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 970 # 02111-1307, USA. 971 972 # serial 1 786 # Copyright (C) 2004, 2005 Free Software Foundation, Inc. 787 # 788 # This file is free software; the Free Software Foundation 789 # gives unlimited permission to copy and/or distribute it, 790 # with or without modifications, as long as this notice is preserved. 973 791 792 # serial 2 974 793 975 794 # _AM_PROG_TAR(FORMAT) 976 795 # -------------------- -
ChangeLog
diff -Naur grub-0.97.orig/ChangeLog grub-0.97/ChangeLog
old new 1 2006-05-02 Pavel Roskin <proski@gnu.org> 2 3 * stage2/stage2.c (run_menu): Fix "savedefault" to save only top 4 level menu positions. Remember current position when calling a 5 submenu. Don't recalculate it when booting from a submenu. 6 7 * grub/main.c (main): Make sure the boot drive number doesn't 8 exceed 255. 9 10 2006-05-02 Vesa Jaaskelainen <chaac@nic.fi> 11 12 * stage2/shared.h (vbe_mode): Back ported aligment fix from GRUB 2 13 to GRUB Legacy. Problem reported by Gerardo Richarte. 14 15 2006-04-23 Robert Millan <robertmh@gnu.org> 16 17 * grub/asmstub.c (get_diskinfo): Optimize sysctl routine. 18 19 2006-04-20 Robert Millan <robertmh@gnu.org> 20 21 Fixes for kernel of FreeBSD: 22 * grub/asmstub.c (get_diskinfo): Toggle "kern.geom.debugflags" sysctl 23 before opening a device for writing. 24 * util/grub-install.in: Devices don't have this "r" prefix anymore. 25 26 2006-04-16 Yoshinori K. Okuji <okuji@enbug.org> 27 28 * docs/multiboot.texi: Correct the offset of address 29 fields. Reported by Jeroen Dekkers. 30 31 2006-03-21 Yoshinori K. Okuji <okuji@enbug.org> 32 33 * stage2/builtins.c (setup_func): Specify the size of DEVICE to 34 grub_strncat instead of a strange number 256. Reported by Vitaly 35 Fertman <vitaly@namesys.com>. 36 37 2005-09-29 Yoshinori K. Okuji <okuji@enbug.org> 38 39 * docs/multiboot.texi: Fix a bug in the byte order of 40 boot_device. I hope this won't affect any OS image. 41 Increased the version number to 0.6.94. 42 43 2005-09-28 Yoshinori K. Okuji <okuji@enbug.org> 44 45 * stage2/boot.c (load_image): Even if an OS image is an ELF 46 object, use the a.out kludge if MULTIBOOT_AOUT_KLUDGE is 47 specified. 48 1 49 2005-05-08 Yoshinori K. Okuji <okuji@enbug.org> 2 50 3 51 * configure.ac (AC_INIT): Upgraded to 0.97. -
configure
diff -Naur grub-0.97.orig/configure grub-0.97/configure
old new 311 311 # include <unistd.h> 312 312 #endif" 313 313 314 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'314 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' 315 315 ac_subst_files='' 316 316 317 317 # Initialize some variables set by options. … … 914 914 set the default memory location for WD/SMC 915 915 --enable-cs-scan=LIST probe for CS89x0 base address using LIST 916 916 --enable-diskless enable diskless support 917 --disable-graphics disable graphics terminal support 917 918 --disable-hercules disable hercules terminal support 918 919 --disable-serial disable serial terminal support 919 920 --enable-serial-speed-simulation … … 5966 5967 fi 5967 5968 5968 5969 5970 # Check whether --enable-graphics or --disable-graphics was given. 5971 if test "${enable_graphics+set}" = set; then 5972 enableval="$enable_graphics" 5973 5974 fi; 5975 5976 5977 if test "x$enable_graphics" != xno; then 5978 GRAPHICS_SUPPORT_TRUE= 5979 GRAPHICS_SUPPORT_FALSE='#' 5980 else 5981 GRAPHICS_SUPPORT_TRUE='#' 5982 GRAPHICS_SUPPORT_FALSE= 5983 fi 5984 5985 5969 5986 # Check whether --enable-hercules or --disable-hercules was given. 5970 5987 if test "${enable_hercules+set}" = set; then 5971 5988 enableval="$enable_hercules" … … 6270 6287 Usually this means the macro was only invoked conditionally." >&2;} 6271 6288 { (exit 1); exit 1; }; } 6272 6289 fi 6290 if test -z "${GRAPHICS_SUPPORT_TRUE}" && test -z "${GRAPHICS_SUPPORT_FALSE}"; then 6291 { { echo "$as_me:$LINENO: error: conditional \"GRAPHICS_SUPPORT\" was never defined. 6292 Usually this means the macro was only invoked conditionally." >&5 6293 echo "$as_me: error: conditional \"GRAPHICS_SUPPORT\" was never defined. 6294 Usually this means the macro was only invoked conditionally." >&2;} 6295 { (exit 1); exit 1; }; } 6296 fi 6273 6297 if test -z "${HERCULES_SUPPORT_TRUE}" && test -z "${HERCULES_SUPPORT_FALSE}"; then 6274 6298 { { echo "$as_me:$LINENO: error: conditional \"HERCULES_SUPPORT\" was never defined. 6275 6299 Usually this means the macro was only invoked conditionally." >&5 … … 6907 6931 s,@NETBOOT_SUPPORT_FALSE@,$NETBOOT_SUPPORT_FALSE,;t t 6908 6932 s,@DISKLESS_SUPPORT_TRUE@,$DISKLESS_SUPPORT_TRUE,;t t 6909 6933 s,@DISKLESS_SUPPORT_FALSE@,$DISKLESS_SUPPORT_FALSE,;t t 6934 s,@GRAPHICS_SUPPORT_TRUE@,$GRAPHICS_SUPPORT_TRUE,;t t 6935 s,@GRAPHICS_SUPPORT_FALSE@,$GRAPHICS_SUPPORT_FALSE,;t t 6910 6936 s,@HERCULES_SUPPORT_TRUE@,$HERCULES_SUPPORT_TRUE,;t t 6911 6937 s,@HERCULES_SUPPORT_FALSE@,$HERCULES_SUPPORT_FALSE,;t t 6912 6938 s,@SERIAL_SUPPORT_TRUE@,$SERIAL_SUPPORT_TRUE,;t t -
configure.ac
diff -Naur grub-0.97.orig/configure.ac grub-0.97/configure.ac
old new 595 595 [ --enable-diskless enable diskless support]) 596 596 AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes) 597 597 598 dnl Graphical splashscreen support 599 AC_ARG_ENABLE(graphics, 600 [ --disable-graphics disable graphics terminal support]) 601 AM_CONDITIONAL(GRAPHICS_SUPPORT, test "x$enable_graphics" != xno) 602 598 603 dnl Hercules terminal 599 604 AC_ARG_ENABLE(hercules, 600 605 [ --disable-hercules disable hercules terminal support]) -
docs/grub.8
diff -Naur grub-0.97.orig/docs/grub.8 grub-0.97/docs/grub.8
old new 1 1 .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. 2 .TH GRUB "8" " May2005" "grub (GNU GRUB 0.97)" FSF2 .TH GRUB "8" "September 2005" "grub (GNU GRUB 0.97)" FSF 3 3 .SH NAME 4 4 grub \- the grub shell 5 5 .SH SYNOPSIS -
docs/grub.texi
diff -Naur grub-0.97.orig/docs/grub.texi grub-0.97/docs/grub.texi
old new 2199 2199 * rarp:: Initialize a network device via RARP 2200 2200 * serial:: Set up a serial device 2201 2201 * setkey:: Configure the key map 2202 * splashimage:: Use a splash image 2202 2203 * terminal:: Choose a terminal 2203 2204 * terminfo:: Define escape sequences for a terminal 2204 2205 * tftpserver:: Specify a TFTP server … … 2578 2579 @end deffn 2579 2580 2580 2581 2582 @node splashimage 2583 @subsection splashimage 2584 2585 @deffn Command splashimage file 2586 Select an image to use as the background image. This should be 2587 specified using normal GRUB device naming syntax. The format of the 2588 file is a gzipped xpm which is 640x480 with a 14 color palette. 2589 @end deffn 2590 2591 2581 2592 @node terminal 2582 2593 @subsection terminal 2583 2594 … … 2685 2696 * module:: Load a module 2686 2697 * modulenounzip:: Load a module without decompression 2687 2698 * pause:: Wait for a key press 2699 * print:: Print a message 2688 2700 * quit:: Exit from the grub shell 2689 2701 * reboot:: Reboot your computer 2690 2702 * read:: Read data from memory … … 3091 3103 @end deffn 3092 3104 3093 3105 3106 @node print 3107 @subsection print 3108 3109 @deffn Command print message @dots{} 3110 Print the @var{message}. Note that placing @key{^G} (ASCII code 7) in the 3111 message will cause the speaker to emit the standard beep sound, which is 3112 useful for visually impaired people. 3113 @end deffn 3114 3115 3094 3116 @node quit 3095 3117 @subsection quit 3096 3118 -
docs/multiboot.texi
diff -Naur grub-0.97.orig/docs/multiboot.texi grub-0.97/docs/multiboot.texi
old new 25 25 @ifinfo 26 26 Copyright @copyright{} 1995, 96 Bryan Ford <baford@@cs.utah.edu> 27 27 Copyright @copyright{} 1995, 96 Erich Stefan Boleyn <erich@@uruk.org> 28 Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc.28 Copyright @copyright{} 1999, 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc. 29 29 30 30 Permission is granted to make and distribute verbatim copies of 31 31 this manual provided the copyright notice and this permission notice … … 57 57 @vskip 0pt plus 1filll 58 58 Copyright @copyright{} 1995, 96 Bryan Ford <baford@@cs.utah.edu> 59 59 Copyright @copyright{} 1995, 96 Erich Stefan Boleyn <erich@@uruk.org> 60 Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc.60 Copyright @copyright{} 1999, 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc. 61 61 62 62 Permission is granted to make and distribute verbatim copies of 63 63 this manual provided the copyright notice and this permission notice … … 80 80 @top Multiboot Specification 81 81 82 82 This file documents Multiboot Specification, the proposal for the boot 83 sequence standard. This edition documents version 0.6.9 3.83 sequence standard. This edition documents version 0.6.94. 84 84 @end ifnottex 85 85 86 86 @menu … … 426 426 kernel. 427 427 428 428 If bit 16 in the @samp{flags} word is set, then the fields at offsets 429 8-24in the Multiboot header are valid, and the boot loader should use429 12-28 in the Multiboot header are valid, and the boot loader should use 430 430 them instead of the fields in the actual executable header to calculate 431 431 where to load the OS image. This information does not need to be 432 432 provided if the kernel image is in @sc{elf} format, but it @emph{must} … … 677 677 @example 678 678 @group 679 679 +-------+-------+-------+-------+ 680 | drive | part1 | part2 | part3|680 | part3 | part2 | part1 | drive | 681 681 +-------+-------+-------+-------+ 682 682 @end group 683 683 @end example … … 1199 1199 @email{bug-grub@@gnu.org}, from Bryan Ford and Erich Stefan Boleyn. 1200 1200 @end itemize 1201 1201 1202 @item 1203 The byte order of the @samp{boot_device} in Multiboot information is 1204 reversed. This was a mistake. 1205 1206 @item 1207 The offset of the address fields were wrong. 1208 1202 1209 @item 0.6 1203 1210 @itemize @bullet 1204 1211 @item -
grub/asmstub.c
diff -Naur grub-0.97.orig/grub/asmstub.c grub-0.97/grub/asmstub.c
old new 42 42 #include <sys/time.h> 43 43 #include <termios.h> 44 44 #include <signal.h> 45 #include <sys/mman.h> 46 47 #include <limits.h> 48 #ifndef PAGESIZE 49 #define PAGESIZE 4096 50 #endif 45 51 46 52 #ifdef __linux__ 47 53 # include <sys/ioctl.h> /* ioctl */ … … 55 61 # endif /* ! BLKFLSBUF */ 56 62 #endif /* __linux__ */ 57 63 64 #if defined(__FreeBSD_kernel__) || defined(__FreeBSD__) 65 # include <sys/sysctl.h> 66 #endif 67 58 68 /* We want to prevent any circularararity in our stubs, as well as 59 69 libc name clashes. */ 60 70 #define WITHOUT_LIBC_STUBS 1 … … 144 154 assert (grub_scratch_mem == 0); 145 155 scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15); 146 156 assert (scratch); 157 158 { 159 char *p; 160 int ret; 161 162 /* Align to a multiple of PAGESIZE, assumed to be a power of two. */ 163 p = (char *) (((long) scratch) & ~(PAGESIZE - 1)); 164 165 /* The simulated stack needs to be executable, since GCC uses stack 166 * trampolines to implement nested functions. 167 */ 168 ret = mprotect (p, 0x100000 + EXTENDED_MEMSIZE + 15, 169 PROT_READ | PROT_WRITE | PROT_EXEC); 170 assert (ret == 0); 171 } 172 147 173 grub_scratch_mem = (char *) ((((int) scratch) >> 4) << 4); 148 174 149 175 /* FIXME: simulate the memory holes using mprot, if available. */ … … 777 803 778 804 /* Open read/write, or read-only if that failed. */ 779 805 if (! read_only) 780 disks[drive].flags = open (devname, O_RDWR); 806 { 807 /* By default, kernel of FreeBSD does not allow overwriting MBR */ 808 #if defined(__FreeBSD_kernel__) || defined(__FreeBSD__) 809 #define GEOM_SYSCTL "kern.geom.debugflags" 810 int old_flags, flags; 811 size_t sizeof_int = sizeof (int); 812 813 if (sysctlbyname (GEOM_SYSCTL, &old_flags, &sizeof_int, NULL, 0) != 0) 814 grub_printf ("failed to get " GEOM_SYSCTL "sysctl: %s\n", strerror (errno)); 815 816 if ((old_flags & 0x10) == 0) 817 { 818 /* "allow foot shooting", see geom(4) */ 819 flags = old_flags | 0x10; 820 821 if (sysctlbyname (GEOM_SYSCTL, NULL, NULL, &flags, sizeof (int)) != 0) 822 { 823 flags = old_flags; 824 grub_printf ("failed to set " GEOM_SYSCTL "sysctl: %s\n", strerror (errno)); 825 } 826 } 827 else 828 flags = old_flags; 829 #endif 830 disks[drive].flags = open (devname, O_RDWR); 831 #if defined(__FreeBSD_kernel__) || defined(__FreeBSD__) 832 if (flags != old_flags) 833 { 834 if (sysctlbyname (GEOM_SYSCTL, NULL, NULL, &old_flags, sizeof (int)) != 0) 835 grub_printf ("failed to set " GEOM_SYSCTL "sysctl: %s\n", strerror (errno)); 836 } 837 #endif 838 } 781 839 782 840 if (disks[drive].flags == -1) 783 841 { -
grub/main.c
diff -Naur grub-0.97.orig/grub/main.c grub-0.97/grub/main.c
old new 32 32 #define WITHOUT_LIBC_STUBS 1 33 33 #include <shared.h> 34 34 #include <term.h> 35 #include <device.h> 35 36 36 37 char *program_name = 0; 37 38 int use_config_file = 1; … … 192 193 perror ("strtoul"); 193 194 exit (1); 194 195 } 196 if (boot_drive >= NUM_DISKS) 197 { 198 fprintf (stderr, "boot_drive should be from 0 to %d\n", 199 NUM_DISKS - 1); 200 exit (1); 201 } 195 202 break; 196 203 197 204 case OPT_NO_CONFIG_FILE: -
lib/device.c
diff -Naur grub-0.97.orig/lib/device.c grub-0.97/lib/device.c
old new 131 131 #include <shared.h> 132 132 #include <device.h> 133 133 134 #if defined(__linux__) 135 /* The 2.6 kernel has removed all of the geometry handling for IDE drives 136 * that did fixups for LBA, etc. This means that the geometry we get 137 * with the ioctl has a good chance of being wrong. So, we get to 138 * also know about partition tables and try to read what the geometry 139 * is there. *grumble* Very closely based on code from cfdisk 140 */ 141 static void get_kernel_geometry(int fd, long long *cyl, int *heads, int *sectors) { 142 struct hd_geometry hdg; 143 144 if (ioctl (fd, HDIO_GETGEO, &hdg)) 145 return; 146 147 *cyl = hdg.cylinders; 148 *heads = hdg.heads; 149 *sectors = hdg.sectors; 150 } 151 152 struct partition { 153 unsigned char boot_ind; /* 0x80 - active */ 154 unsigned char head; /* starting head */ 155 unsigned char sector; /* starting sector */ 156 unsigned char cyl; /* starting cylinder */ 157 unsigned char sys_ind; /* What partition type */ 158 unsigned char end_head; /* end head */ 159 unsigned char end_sector; /* end sector */ 160 unsigned char end_cyl; /* end cylinder */ 161 unsigned char start4[4]; /* starting sector counting from 0 */ 162 unsigned char size4[4]; /* nr of sectors in partition */ 163 }; 164 165 #define ALIGNMENT 2 166 typedef union { 167 struct { 168 unsigned char align[ALIGNMENT]; 169 unsigned char b[SECTOR_SIZE]; 170 } c; 171 struct { 172 unsigned char align[ALIGNMENT]; 173 unsigned char buffer[0x1BE]; 174 struct partition part[4]; 175 unsigned char magicflag[2]; 176 } p; 177 } partition_table; 178 179 #define PART_TABLE_FLAG0 0x55 180 #define PART_TABLE_FLAG1 0xAA 181 182 static void 183 get_partition_table_geometry(partition_table *bufp, long long *cyl, int *heads, 184 int *sectors) { 185 struct partition *p; 186 int i,h,s,hh,ss; 187 int first = 1; 188 int bad = 0; 189 190 if (bufp->p.magicflag[0] != PART_TABLE_FLAG0 || 191 bufp->p.magicflag[1] != PART_TABLE_FLAG1) { 192 /* Matthew Wilcox: slightly friendlier version of 193 fatal(_("Bad signature on partition table"), 3); 194 */ 195 fprintf(stderr, "Unknown partition table signature\n"); 196 return; 197 } 198 199 hh = ss = 0; 200 for (i=0; i<4; i++) { 201 p = &(bufp->p.part[i]); 202 if (p->sys_ind != 0) { 203 h = p->end_head + 1; 204 s = (p->end_sector & 077); 205 if (first) { 206 hh = h; 207 ss = s; 208 first = 0; 209 } else if (hh != h || ss != s) 210 bad = 1; 211 } 212 } 213 214 if (!first && !bad) { 215 *heads = hh; 216 *sectors = ss; 217 } 218 } 219 220 static long long my_lseek (unsigned int fd, long long offset, 221 unsigned int origin) 222 { 223 #if defined(__linux__) && (!defined(__GLIBC__) || \ 224 ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))) 225 /* Maybe libc doesn't have large file support. */ 226 loff_t offset, result; 227 static int _llseek (uint filedes, ulong hi, ulong lo, 228 loff_t *res, uint wh); 229 _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo, 230 loff_t *, res, uint, wh); 231 232 if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET) < 0) 233 return (long long) -1; 234 return result; 235 #else 236 return lseek(fd, offset, SEEK_SET); 237 #endif 238 } 239 240 static void get_linux_geometry (int fd, struct geometry *geom) { 241 long long kern_cyl = 0; int kern_head = 0, kern_sectors = 0; 242 long long pt_cyl = 0; int pt_head = 0, pt_sectors = 0; 243 partition_table bufp; 244 char *buff, *buf_unaligned; 245 246 buf_unaligned = malloc(sizeof(partition_table) + 4095); 247 buff = (char *) (((unsigned long)buf_unaligned + 4096 - 1) & 248 (~(4096-1))); 249 250 get_kernel_geometry(fd, &kern_cyl, &kern_head, &kern_sectors); 251 252 if (my_lseek (fd, 0*SECTOR_SIZE, SEEK_SET) < 0) { 253 fprintf(stderr, "Unable to seek"); 254 } 255 256 if (read(fd, buff, SECTOR_SIZE) == SECTOR_SIZE) { 257 memcpy(bufp.c.b, buff, SECTOR_SIZE); 258 get_partition_table_geometry(&bufp, &pt_cyl, &pt_head, &pt_sectors); 259 } else { 260 fprintf(stderr, "Unable to read partition table: %s\n", strerror(errno)); 261 } 262 263 if (pt_head && pt_sectors) { 264 int cyl_size; 265 266 geom->heads = pt_head; 267 geom->sectors = pt_sectors; 268 cyl_size = pt_head * pt_sectors; 269 geom->cylinders = geom->total_sectors/cyl_size; 270 } else { 271 geom->heads = kern_head; 272 geom->sectors = kern_sectors; 273 geom->cylinders = kern_cyl; 274 } 275 276 return; 277 } 278 #endif 279 134 280 /* Get the geometry of a drive DRIVE. */ 135 281 void 136 282 get_drive_geometry (struct geometry *geom, char **map, int drive) … … 151 297 #if defined(__linux__) 152 298 /* Linux */ 153 299 { 154 struct hd_geometry hdg;155 300 unsigned long nr; 156 157 if (ioctl (fd, HDIO_GETGEO, &hdg))158 goto fail;159 301 160 302 if (ioctl (fd, BLKGETSIZE, &nr)) 161 303 goto fail; 162 304 163 305 /* Got the geometry, so save it. */ 164 geom->cylinders = hdg.cylinders;165 geom->heads = hdg.heads;166 geom->sectors = hdg.sectors;167 306 geom->total_sectors = nr; 168 307 get_linux_geometry(fd, geom); 308 if (!geom->heads && !geom->cylinders && !geom->sectors) 309 goto fail; 169 310 goto success; 170 311 } 171 312 … … 403 544 } 404 545 405 546 static void 547 get_cciss_disk_name (char *name, int controller, int drive) 548 { 549 sprintf (name, "/dev/cciss/c%dd%d", controller, drive); 550 } 551 552 static void 553 get_ida_disk_name (char *name, int controller, int drive) 554 { 555 sprintf (name, "/dev/ida/c%dd%d", controller, drive); 556 } 557 558 static void 406 559 get_ataraid_disk_name (char *name, int unit) 407 560 { 408 561 sprintf (name, "/dev/ataraid/d%c", unit + '0'); … … 801 954 } 802 955 } 803 956 } 957 958 /* This is for CCISS, its like the DAC960 - we have 959 /dev/cciss/<controller>d<logical drive>p<partition> 960 961 It currently supports up to 3 controllers, 10 logical volumes 962 and 10 partitions 963 964 Code gratuitously copied from DAC960 above. 965 Horms <horms@verge.net.au> 23rd July 2004 966 */ 967 { 968 int controller, drive; 969 970 for (controller = 0; controller < 2; controller++) 971 { 972 for (drive = 0; drive < 9; drive++) 973 { 974 char name[24]; 975 976 get_cciss_disk_name (name, controller, drive); 977 if (check_device (name)) 978 { 979 (*map)[num_hd + 0x80] = strdup (name); 980 assert ((*map)[num_hd + 0x80]); 981 982 /* If the device map file is opened, write the map. */ 983 if (fp) 984 fprintf (fp, "(hd%d)\t%s\n", num_hd, name); 985 986 num_hd++; 987 } 988 } 989 } 990 } 991 992 /* This is for Compaq Smart Array, its like the DAC960 - we have 993 /dev/ida/<controller>d<logical drive>p<partition> 994 995 It currently supports up to 3 controllers, 10 logical volumes 996 and 15 partitions 997 998 Code gratuitously copied from DAC960 above. 999 Piotr Roszatycki <dexter@debian.org> 1000 */ 1001 { 1002 int controller, drive; 1003 1004 for (controller = 0; controller < 2; controller++) 1005 { 1006 for (drive = 0; drive < 9; drive++) 1007 { 1008 char name[24]; 1009 1010 get_ida_disk_name (name, controller, drive); 1011 if (check_device (name)) 1012 { 1013 (*map)[num_hd + 0x80] = strdup (name); 1014 assert ((*map)[num_hd + 0x80]); 1015 1016 /* If the device map file is opened, write the map. */ 1017 if (fp) 1018 fprintf (fp, "(hd%d)\t%s\n", num_hd, name); 1019 1020 num_hd++; 1021 } 1022 } 1023 } 1024 } 804 1025 #endif /* __linux__ */ 805 1026 806 1027 /* OK, close the device map file if opened. */ … … 844 1065 { 845 1066 char dev[PATH_MAX]; /* XXX */ 846 1067 int fd; 1068 off_t offset = (off_t) sector * (off_t) SECTOR_SIZE; 847 1069 848 1070 if ((partition & 0x00FF00) != 0x00FF00) 849 1071 { … … 861 1083 if (strcmp (dev + strlen(dev) - 5, "/disc") == 0) 862 1084 strcpy (dev + strlen(dev) - 5, "/part"); 863 1085 } 864 sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1); 865 1086 sprintf (dev + strlen(dev), "%s%d", 1087 /* Compaq smart and others */ 1088 (strncmp(dev, "/dev/ida/", 9) == 0 || 1089 strncmp(dev, "/dev/ataraid/", 13) == 0 || 1090 strncmp(dev, "/dev/cciss/", 11) == 0 || 1091 strncmp(dev, "/dev/rd/", 8) == 0) ? "p" : "", 1092 ((partition >> 16) & 0xFF) + 1); 1093 866 1094 /* Open the partition. */ 867 1095 fd = open (dev, O_RDWR); 868 1096 if (fd < 0) … … 870 1098 errnum = ERR_NO_PART; 871 1099 return 0; 872 1100 } 873 874 #if defined(__linux__) && (!defined(__GLIBC__) || \875 ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1))))876 /* Maybe libc doesn't have large file support. */877 {878 loff_t offset, result;879 static int _llseek (uint filedes, ulong hi, ulong lo,880 loff_t *res, uint wh);881 _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo,882 loff_t *, res, uint, wh);883 1101 884 offset = (loff_t) sector * (loff_t) SECTOR_SIZE;885 if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET))886 {887 errnum = ERR_DEV_VALUES;888 return 0;889 }890 }891 #else892 {893 off_t offset = (off_t) sector * (off_t) SECTOR_SIZE;894 1102 895 if (lseek (fd, offset, SEEK_SET) != offset) 896 { 897 errnum = ERR_DEV_VALUES; 898 return 0; 899 } 900 } 901 #endif 1103 if (my_lseek(fd, offset, SEEK_SET) != offset) 1104 { 1105 errnum = ERR_DEV_VALUES; 1106 return 0; 1107 } 902 1108 903 1109 if (write (fd, buf, size * SECTOR_SIZE) != (size * SECTOR_SIZE)) 904 1110 { -
stage2/asm.S
diff -Naur grub-0.97.orig/stage2/asm.S grub-0.97/stage2/asm.S
old new 1651 1651 jnz 3f 1652 1652 ret 1653 1653 1654 3: /* use keyboard controller */ 1654 3: /* 1655 * try to switch gateA20 using PORT92, the "Fast A20 and Init" 1656 * register 1657 */ 1658 mov $0x92, %dx 1659 inb %dx, %al 1660 /* skip the port92 code if it's unimplemented (read returns 0xff) */ 1661 cmpb $0xff, %al 1662 jz 6f 1663 1664 /* set or clear bit1, the ALT_A20_GATE bit */ 1665 movb 4(%esp), %ah 1666 testb %ah, %ah 1667 jz 4f 1668 orb $2, %al 1669 jmp 5f 1670 4: and $0xfd, %al 1671 1672 /* clear the INIT_NOW bit don't accidently reset the machine */ 1673 5: and $0xfe, %al 1674 outb %al, %dx 1675 1676 6: /* use keyboard controller */ 1655 1677 pushl %eax 1656 1678 1657 1679 call gloop1 … … 1661 1683 1662 1684 gloopint1: 1663 1685 inb $K_STATUS 1686 cmpb $0xff, %al 1687 jz gloopint1_done 1664 1688 andb $K_IBUF_FUL, %al 1665 1689 jnz gloopint1 1666 1690 1691 gloopint1_done: 1667 1692 movb $KB_OUTPUT_MASK, %al 1668 1693 cmpb $0, 0x8(%esp) 1669 1694 jz gdoit … … 1684 1709 1685 1710 gloop1: 1686 1711 inb $K_STATUS 1712 cmpb $0xff, %al 1713 jz gloop2ret 1687 1714 andb $K_IBUF_FUL, %al 1688 1715 jnz gloop1 1689 1716 … … 1991 2018 ENTRY(console_getkey) 1992 2019 push %ebp 1993 2020 2021 wait_for_key: 2022 call EXT_C(console_checkkey) 2023 incl %eax 2024 jz wait_for_key 2025 1994 2026 call EXT_C(prot_to_real) 1995 2027 .code16 1996 2028 … … 2216 2248 pop %ebx 2217 2249 pop %ebp 2218 2250 ret 2219 2251 2252 2253 /* graphics mode functions */ 2254 #ifdef SUPPORT_GRAPHICS 2255 VARIABLE(cursorX) 2256 .word 0 2257 VARIABLE(cursorY) 2258 .word 0 2259 VARIABLE(cursorCount) 2260 .word 0 2261 VARIABLE(cursorBuf) 2262 .byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 2263 2264 2265 /* 2266 * set_int1c_handler(void) 2267 */ 2268 ENTRY(set_int1c_handler) 2269 pushl %edi 2270 2271 /* save the original int1c handler */ 2272 movl $0x70, %edi 2273 movw (%edi), %ax 2274 movw %ax, ABS(int1c_offset) 2275 movw 2(%edi), %ax 2276 movw %ax, ABS(int1c_segment) 2277 2278 /* save the new int1c handler */ 2279 movw $ABS(int1c_handler), %ax 2280 movw %ax, (%edi) 2281 xorw %ax, %ax 2282 movw %ax, 2(%edi) 2283 2284 popl %edi 2285 ret 2286 2287 2288 /* 2289 * unset_int1c_handler(void) 2290 */ 2291 ENTRY(unset_int1c_handler) 2292 pushl %edi 2293 2294 /* check if int1c_handler is set */ 2295 movl $0x70, %edi 2296 movw $ABS(int1c_handler), %ax 2297 cmpw %ax, (%edi) 2298 jne int1c_1 2299 xorw %ax, %ax 2300 cmpw %ax, 2(%edi) 2301 jne int1c_1 2302 2303 /* restore the original */ 2304 movw ABS(int1c_offset), %ax 2305 movw %ax, (%edi) 2306 movw ABS(int1c_segment), %ax 2307 movw %ax, 2(%edi) 2308 2309 int1c_1: 2310 popl %edi 2311 ret 2312 2313 2314 /* 2315 * blinks graphics cursor 2316 */ 2317 .code16 2318 write_data: 2319 movw $0, %ax 2320 movw %ax, %ds 2321 2322 mov $0xA000, %ax /* video in es:di */ 2323 mov %ax, %es 2324 mov $80, %ax 2325 movw $ABS(cursorY), %si 2326 mov %ds:(%si), %bx 2327 mul %bx 2328 movw $ABS(cursorX), %si 2329 mov %ds:(%si), %bx 2330 shr $3, %bx /* %bx /= 8 */ 2331 add %bx, %ax 2332 mov %ax, %di 2333 2334 movw $ABS(cursorBuf), %si /* fontBuf in ds:si */ 2335 2336 /* prepare for data moving */ 2337 mov $16, %dx /* altura da fonte */ 2338 mov $80, %bx /* bytes por linha */ 2339 2340 write_loop: 2341 movb %ds:(%si), %al 2342 xorb $0xff, %al 2343 movb %al, %ds:(%si) /* invert cursorBuf */ 2344 movb %al, %es:(%di) /* write to video */ 2345 add %bx, %di 2346 inc %si 2347 dec %dx 2348 jg write_loop 2349 ret 2350 2351 int1c_handler: 2352 pusha 2353 mov $0, %ax 2354 mov %ax, %ds 2355 mov $ABS(cursorCount), %si 2356 mov %ds:(%si), %ax 2357 inc %ax 2358 mov %ax, %ds:(%si) 2359 cmp $9, %ax 2360 jne int1c_done 2361 2362 mov $0, %ax 2363 mov %ax, %ds:(%si) 2364 call write_data 2365 2366 int1c_done: 2367 popa 2368 iret 2369 /* call previous int1c handler */ 2370 /* ljmp */ 2371 .byte 0xea 2372 int1c_offset: .word 0 2373 int1c_segment: .word 0 2374 .code32 2375 2376 2377 /* 2378 * unsigned char set_videomode(unsigned char mode) 2379 * BIOS call "INT 10H Function 0h" to set video mode 2380 * Call with %ah = 0x0 2381 * %al = video mode 2382 * Returns old videomode. 2383 */ 2384 ENTRY(set_videomode) 2385 pushl %ebp 2386 movl %esp,%ebp 2387 pushl %ebx 2388 pushl %ecx 2389 2390 movb 8(%ebp), %cl 2391 2392 call EXT_C(prot_to_real) 2393 .code16 2394 2395 xorb %al, %al 2396 movb $0xf, %ah 2397 int $0x10 /* Get Current Video mode */ 2398 movb %al, %ch 2399 xorb %ah, %ah 2400 movb %cl, %al 2401 int $0x10 /* Set Video mode */ 2402 2403 DATA32 call EXT_C(real_to_prot) 2404 .code32 2405 2406 xorl %eax, %eax 2407 movb %ch, %al 2408 2409 popl %ecx 2410 popl %ebx 2411 popl %ebp 2412 ret 2413 2414 2415 /* 2416 * int get_videomode() 2417 * BIOS call "INT 10H Function 0Fh" to get current video mode 2418 * Call with %al = 0x0 2419 * %ah = 0xF 2420 * Returns current videomode. 2421 */ 2422 ENTRY(get_videomode) 2423 pushl %ebp 2424 movl %esp,%ebp 2425 pushl %ebx 2426 pushl %ecx 2427 2428 call EXT_C(prot_to_real) 2429 .code16 2430 2431 xorb %al, %al 2432 movb $0xF, %ah 2433 int $0x10 /* Get Current Video mode */ 2434 movb %al, %cl /* For now we only want display mode */ 2435 2436 DATA32 call EXT_C(real_to_prot) 2437 .code32 2438 2439 xorl %eax, %eax 2440 movb %cl, %al 2441 2442 popl %ecx 2443 popl %ebx 2444 popl %ebp 2445 ret 2446 2447 2448 /* 2449 * unsigned char * graphics_get_font() 2450 * BIOS call "INT 10H Function 11h" to set font 2451 * Call with %ah = 0x11 2452 */ 2453 ENTRY(graphics_get_font) 2454 push %ebp 2455 push %ebx 2456 push %ecx 2457 push %edx 2458 2459 call EXT_C(prot_to_real) 2460 .code16 2461 2462 movw $0x1130, %ax 2463 movb $6, %bh /* font 8x16 */ 2464 int $0x10 2465 movw %bp, %dx 2466 movw %es, %cx 2467 2468 DATA32 call EXT_C(real_to_prot) 2469 .code32 2470 2471 xorl %eax, %eax 2472 movw %cx, %ax 2473 shll $4, %eax 2474 movw %dx, %ax 2475 2476 pop %edx 2477 pop %ecx 2478 pop %ebx 2479 pop %ebp 2480 ret 2481 2482 2483 /* 2484 * graphics_set_palette(index, red, green, blue) 2485 * BIOS call "INT 10H Function 10h" to set individual dac register 2486 * Call with %ah = 0x10 2487 * %bx = register number 2488 * %ch = new value for green (0-63) 2489 * %cl = new value for blue (0-63) 2490 * %dh = new value for red (0-63) 2491 */ 2492 2493 ENTRY(graphics_set_palette) 2494 push %ebp 2495 push %eax 2496 push %ebx 2497 push %ecx 2498 push %edx 2499 2500 movw $0x3c8, %bx /* address write mode register */ 2501 2502 /* wait vertical retrace */ 2503 movw $0x3da, %dx 2504 l1b: 2505 inb %dx, %al /* wait vertical active display */ 2506 test $8, %al 2507 jnz l1b 2508 2509 l2b: 2510 inb %dx, %al /* wait vertical retrace */ 2511 test $8, %al 2512 jnz l2b 2513 2514 mov %bx, %dx 2515 movb 0x18(%esp), %al /* index */ 2516 outb %al, %dx 2517 inc %dx 2518 2519 movb 0x1c(%esp), %al /* red */ 2520 outb %al, %dx 2521 2522 movb 0x20(%esp), %al /* green */ 2523 outb %al, %dx 2524 2525 movb 0x24(%esp), %al /* blue */ 2526 outb %al, %dx 2527 2528 movw 0x18(%esp), %bx 2529 2530 call EXT_C(prot_to_real) 2531 .code16 2532 2533 movb %bl, %bh 2534 movw $0x1000, %ax 2535 int $0x10 2536 2537 DATA32 call EXT_C(real_to_prot) 2538 .code32 2539 2540 pop %edx 2541 pop %ecx 2542 pop %ebx 2543 pop %eax 2544 pop %ebp 2545 ret 2546 #endif /* SUPPORT_GRAPHICS */ 2547 2548 2220 2549 /* 2221 2550 * getrtsecs() 2222 2551 * if a seconds value can be read, read it and return it (BCD), -
stage2/boot.c
diff -Naur grub-0.97.orig/stage2/boot.c grub-0.97/stage2/boot.c
old new 1 1 /* boot.c - load and bootstrap a kernel */ 2 2 /* 3 3 * GRUB -- GRand Unified Bootloader 4 * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.4 * Copyright (C) 1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License as published by … … 29 29 entry_func entry_addr; 30 30 static struct mod_list mll[99]; 31 31 static int linux_mem_size; 32 static int elf_kernel_addr; 33 static int elf_kernel_size; 32 34 33 35 /* 34 36 * The next two functions, 'load_image' and 'load_module', are the building … … 96 98 lh = (struct linux_kernel_header *) buffer; 97 99 98 100 /* ELF loading supported if multiboot, FreeBSD and NetBSD. */ 99 if (( type == KERNEL_TYPE_MULTIBOOT101 if (((type == KERNEL_TYPE_MULTIBOOT && ! (flags & MULTIBOOT_AOUT_KLUDGE)) 100 102 || pu.elf->e_ident[EI_OSABI] == ELFOSABI_FREEBSD 101 103 || grub_strcmp (pu.elf->e_ident + EI_BRAND, "FreeBSD") == 0 102 104 || suggested_type == KERNEL_TYPE_NETBSD) … … 594 596 595 597 /* reset this to zero for now */ 596 598 cur_addr = 0; 599 elf_kernel_addr = ~0; 597 600 598 601 /* scan for program segments */ 599 602 for (i = 0; i < pu.elf->e_phnum; i++) … … 630 633 /* mark memory as used */ 631 634 if (cur_addr < memaddr + memsiz) 632 635 cur_addr = memaddr + memsiz; 636 if (elf_kernel_addr > cur_addr) 637 elf_kernel_addr = cur_addr; 633 638 printf (", <0x%x:0x%x:0x%x>", memaddr, filesiz, 634 639 memsiz - filesiz); 635 640 /* increment number of segments */ … … 647 652 } 648 653 } 649 654 655 elf_kernel_size = cur_addr - elf_kernel_addr; 656 650 657 if (! errnum) 651 658 { 652 659 if (! loaded) … … 824 831 moveto = (mbi.mem_upper + 0x400) << 10; 825 832 826 833 moveto = (moveto - len) & 0xfffff000; 827 max_addr = (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0203 828 ? lh->initrd_addr_max : LINUX_INITRD_MAX_ADDRESS); 834 max_addr = LINUX_INITRD_MAX_ADDRESS; 835 if (lh->header == LINUX_MAGIC_SIGNATURE && 836 lh->version >= 0x0203 && 837 lh->initrd_addr_max < max_addr) 838 max_addr = lh->initrd_addr_max; 829 839 if (moveto + len >= max_addr) 830 840 moveto = (max_addr - len) & 0xfffff000; 831 841 … … 864 874 } 865 875 #endif 866 876 877 #define mem_align4k(p) ((p) + 0xFFF) & 0xFFFFF000 878 879 static void 880 kfreebsd_setenv (char *env, const char *var, const char *value) 881 { 882 while (1) 883 { 884 if (env[0] == '\0' && env[1] == '\0') 885 { 886 env++; 887 break; 888 } 889 else 890 env++; 891 } 892 893 grub_sprintf (env, "%s=%s", var, value); 894 env[grub_strlen (env) + 1] = '\0'; 895 } 896 897 static char * 898 kfreebsd_read_hints (char *buf) 899 { 900 char *buf_end = buf; 901 902 if (grub_open ("/boot/device.hints")) 903 { 904 char *line_start; 905 int line_len = 0; 906 char *envp; 907 int env_len; 908 909 env_len = grub_read (buf, -1); 910 if (env_len) 911 { 912 buf_end += env_len; 913 *(buf_end++) = '\0'; 914 } 915 else 916 return buf_end; 917 918 grub_close (); 919 920 envp = line_start = buf; 921 while (*envp) 922 { 923 char *envp_current = envp; 924 925 switch (*envp) 926 { 927 case ' ': 928 while (*envp == ' ') 929 { 930 envp++; 931 env_len--; 932 } 933 grub_memmove (envp_current, envp, env_len + 1); 934 envp = envp_current; 935 break; 936 case '#': 937 while (*envp != '\n') 938 { 939 envp++; 940 env_len--; 941 } 942 if (!line_len) 943 envp++; 944 grub_memmove (envp_current, envp, env_len + 1); 945 envp = envp_current; 946 break; 947 case '\n': 948 if (!line_len) 949 { 950 env_len--; 951 grub_memmove (line_start, envp, env_len + 1); 952 } 953 *(envp++) = '\0'; 954 line_len = 0; 955 line_start = envp; 956 default: 957 envp++; 958 line_len++; 959 break; 960 } 961 } 962 963 buf_end = buf + env_len; 964 *(buf_end++) = '\0'; 965 } 966 967 return buf_end; 968 } 969 970 static u32_t * 971 kfreebsd_set_module_string (u32_t type, u32_t *dst, char *src) 972 { 973 int size; 974 975 *(dst++) = type; 976 *(dst++) = size = grub_strlen (src) + 1; 977 grub_strcpy ((void *) dst, src); 978 979 return dst + (size + sizeof(u32_t) - 1) / sizeof(u32_t); 980 } 981 982 static u32_t * 983 kfreebsd_set_module_var (u32_t type, u32_t *dst, u32_t src) 984 { 985 *(dst++) = type; 986 *(dst++) = sizeof(u32_t); 987 *(dst++) = src; 988 989 return dst; 990 } 991 992 static u32_t * 993 kfreebsd_set_modules (u32_t *modulep) 994 { 995 /* XXX: Need to copy the whole module structure. */ 996 /* XXX: How to pass the module name ? */ 997 998 return modulep; 999 } 867 1000 868 1001 /* 869 1002 * All "*_boot" commands depend on the images being loaded into memory … … 877 1010 bsd_boot (kernel_t type, int bootdev, char *arg) 878 1011 { 879 1012 char *str; 880 int clval = 0, i; 1013 char *kernelname; 1014 char *bsd_root; 1015 int clval = 0; 1016 int i; 881 1017 struct bootinfo bi; 882 1018 883 1019 #ifdef GRUB_UTIL … … 886 1022 stop_floppy (); 887 1023 #endif 888 1024 1025 while (*arg != '/') 1026 arg++; 1027 kernelname = arg; 1028 889 1029 while (*(++arg) && *arg != ' '); 1030 *(arg++) = 0; 890 1031 str = arg; 1032 1033 bsd_root = grub_strstr (str, "root="); 1034 if (bsd_root) 1035 { 1036 bsd_root += 5; 1037 /* XXX: should copy the str or terminate it. */ 1038 } 1039 891 1040 while (*str) 892 1041 { 893 1042 if (*str == '-') … … 910 1059 clval |= RB_GDB; 911 1060 if (*str == 'h') 912 1061 clval |= RB_SERIAL; 1062 if (*str == 'p') 1063 clval |= RB_PAUSE; 913 1064 if (*str == 'm') 914 1065 clval |= RB_MUTE; 915 1066 if (*str == 'r') … … 927 1078 928 1079 if (type == KERNEL_TYPE_FREEBSD) 929 1080 { 1081 char *envp; 1082 u32_t *modp; 1083 930 1084 clval |= RB_BOOTINFO; 931 1085 932 1086 bi.bi_version = BOOTINFO_VERSION; 933 1087 934 *arg= 0;935 while ((--arg) > (char *) MB_CMDLINE_BUF && *arg != '/'); 936 if (* arg== '/')937 bi.bi_kernelname = arg + 1;1088 bi.bi_pad[0] = bi.bi_pad[1] = 0; 1089 1090 if (*kernelname == '/') 1091 bi.bi_kernelname = kernelname; 938 1092 else 939 1093 bi.bi_kernelname = 0; 940 1094 … … 961 1115 bi.bi_basemem = mbi.mem_lower; 962 1116 bi.bi_extmem = extended_memory; 963 1117 1118 /* Setup the environment. */ 1119 bi.bi_envp = cur_addr = mem_align4k (cur_addr); 1120 grub_memset ((void *) cur_addr, 0, 2); 1121 cur_addr = (int) kfreebsd_read_hints ((void *) cur_addr); 1122 1123 envp = (char *) bi.bi_envp; 1124 kfreebsd_setenv (envp, "kernelname", kernelname); 1125 kfreebsd_setenv (envp, "vfs.root.mountfrom", bsd_root); 1126 1127 /* Setup the modules list. */ 1128 bi.bi_modulep = cur_addr = mem_align4k (cur_addr); 1129 modp = (u32_t *) bi.bi_modulep; 1130 /* The first module is the kernel. */ 1131 modp = kfreebsd_set_module_string (MODINFO_NAME, modp, kernelname); 1132 modp = kfreebsd_set_module_string (MODINFO_TYPE, modp, "elf kernel"); 1133 modp = kfreebsd_set_module_string (MODINFO_ARGS, modp, arg); 1134 modp = kfreebsd_set_module_var (MODINFO_ADDR, modp, elf_kernel_addr); 1135 modp = kfreebsd_set_module_var (MODINFO_SIZE, modp, elf_kernel_size); 1136 /* Now the real modules. */ 1137 modp = kfreebsd_set_modules(modp); 1138 1139 /* Set the kernel end. */ 1140 bi.bi_kernend = cur_addr = mem_align4k (((int) modp) + 1); 1141 964 1142 if (mbi.flags & MB_INFO_AOUT_SYMS) 965 1143 { 966 1144 bi.bi_symtab = mbi.syms.a.addr; … … 970 1148 #if 0 971 1149 else if (mbi.flags & MB_INFO_ELF_SHDR) 972 1150 { 973 /* FIXME: Should check if a symbol table exists and, if exists, 974 pass the table to BI. */ 1151 bi.bi_symtab = mbi.syms.e.addr; 1152 bi.bi_esymtab = mbi.syms.e.addr 1153 + mbi.syms.e.size * mbi.syms.e.num * mbi.syms.e.shndx; 975 1154 } 976 1155 #endif 977 1156 else -
stage2/builtins.c
diff -Naur grub-0.97.orig/stage2/builtins.c grub-0.97/stage2/builtins.c
old new 28 28 #include <filesys.h> 29 29 #include <term.h> 30 30 31 #ifdef SUPPORT_GRAPHICS 32 # include <graphics.h> 33 #endif 34 31 35 #ifdef SUPPORT_NETBOOT 32 36 # define GRUB 1 33 37 # include <etherboot.h> … … 82 86 inside other functions. */ 83 87 static int configfile_func (char *arg, int flags); 84 88 89 static int savedefault_helper (char *arg, int flags); 90 91 static int savedefault_shell (char *arg, int flags); 92 85 93 /* Initialize the data for builtins. */ 86 94 void 87 95 init_builtins (void) … … 237 245 static int 238 246 boot_func (char *arg, int flags) 239 247 { 248 struct term_entry *prev_term = current_term; 240 249 /* Clear the int15 handler if we can boot the kernel successfully. 241 250 This assumes that the boot code never fails only if KERNEL_TYPE is 242 251 not KERNEL_TYPE_NONE. Is this assumption is bad? */ 243 252 if (kernel_type != KERNEL_TYPE_NONE) 244 253 unset_int15_handler (); 245 254 255 /* if our terminal needed initialization, we should shut it down 256 * before booting the kernel, but we want to save what it was so 257 * we can come back if needed */ 258 if (current_term->shutdown) 259 { 260 current_term->shutdown(); 261 current_term = term_table; /* assumption: console is first */ 262 } 263 246 264 #ifdef SUPPORT_NETBOOT 247 265 /* Shut down the networking. */ 248 266 cleanup_net (); … … 306 324 return 1; 307 325 } 308 326 327 /* if we get back here, we should go back to what our term was before */ 328 current_term = prev_term; 329 if (current_term->startup) 330 /* if our terminal fails to initialize, fall back to console since 331 * it should always work */ 332 if (current_term->startup() == 0) 333 current_term = term_table; /* we know that console is first */ 309 334 return 0; 310 335 } 311 336 … … 852 877 }; 853 878 #endif /* SUPPORT_NETBOOT */ 854 879 880 #ifdef SUPPORT_GRAPHICS 881 855 882 883 static int splashimage_func(char *arg, int flags) { 884 int i; 885 886 /* filename can only be 256 characters due to our buffer size */ 887 if (grub_strlen(arg) > 256) { 888 grub_printf("Splash image filename too large\n"); 889 grub_printf("Press any key to continue..."); 890 getkey(); 891 return 1; 892 } 893 894 /* get rid of TERM_NEED_INIT from the graphics terminal. */ 895 for (i = 0; term_table[i].name; i++) { 896 if (grub_strcmp (term_table[i].name, "graphics") == 0) { 897 term_table[i].flags &= ~TERM_NEED_INIT; 898 break; 899 } 900 } 901 902 graphics_set_splash(arg); 903 904 if (flags == BUILTIN_CMDLINE && graphics_inited) { 905 graphics_end(); 906 if (graphics_init() == 0) { 907 /* Fallback to default term */ 908 current_term = term_table; 909 max_lines = current_term->max_lines; 910 if (current_term->cls) 911 current_term->cls(); 912 grub_printf("Failed to set splash image and/or graphics mode\n"); 913 return 1; 914 } 915 graphics_cls(); 916 } 917 918 if (flags == BUILTIN_MENU) 919 current_term = term_table + i; 920 921 return 0; 922 } 923 924 static struct builtin builtin_splashimage = 925 { 926 "splashimage", 927 splashimage_func, 928 BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, 929 "splashimage FILE", 930 "Load FILE as the background image when in graphics mode." 931 }; 932 933 856 934 935 /* shade */ 936 static int 937 shade_func(char *arg, int flags) 938 { 939 int new_shade; 940 941 if (!arg || safe_parse_maxint(&arg, &new_shade) == 0) 942 return (1); 943 944 if (shade != new_shade) { 945 shade = new_shade; 946 if (flags == BUILTIN_CMDLINE && graphics_inited) { 947 graphics_end(); 948 graphics_init(); 949 graphics_cls(); 950 } 951 } 952 953 return 0; 954 } 955 956 static struct builtin builtin_shade = 957 { 958 "shade", 959 shade_func, 960 BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, 961 "shade INTEGER", 962 "If set to 0, disables the use of shaded text, else enables it." 963 }; 964 965 857 966 967 /* foreground */ 968 static int 969 foreground_func(char *arg, int flags) 970 { 971 if (grub_strlen(arg) == 6) { 972 int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2; 973 int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2; 974 int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2; 975 976 foreground = (r << 16) | (g << 8) | b; 977 if (graphics_inited) 978 graphics_set_palette(15, r, g, b); 979 980 return 0; 981 } 982 983 return 1; 984 } 985 986 static struct builtin builtin_foreground = 987 { 988 "foreground", 989 foreground_func, 990 BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, 991 "foreground RRGGBB", 992 "Sets the foreground color when in graphics mode." 993 "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal." 994 }; 995 996 858 997 998 /* background */ 999 static int 1000 background_func(char *arg, int flags) 1001 { 1002 if (grub_strlen(arg) == 6) { 1003 int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2; 1004 int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2; 1005 int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2; 1006 1007 background = (r << 16) | (g << 8) | b; 1008 if (graphics_inited) 1009 graphics_set_palette(0, r, g, b); 1010 return 0; 1011 } 1012 1013 return 1; 1014 } 1015 1016 static struct builtin builtin_background = 1017 { 1018 "background", 1019 background_func, 1020 BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, 1021 "background RRGGBB", 1022 "Sets the background color when in graphics mode." 1023 "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal." 1024 }; 1025 1026 859 1027 1028 /* border */ 1029 static int 1030 border_func(char *arg, int flags) 1031 { 1032 if (grub_strlen(arg) == 6) { 1033 int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2; 1034 int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2; 1035 int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2; 1036 1037 window_border = (r << 16) | (g << 8) | b; 1038 if (graphics_inited) 1039 graphics_set_palette(0x11, r, g, b); 1040 1041 return 0; 1042 } 1043 1044 return 1; 1045 } 1046 1047 static struct builtin builtin_border = 1048 { 1049 "border", 1050 border_func, 1051 BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, 1052 "border RRGGBB", 1053 "Sets the border video color when in graphics mode." 1054 "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal." 1055 }; 1056 1057 860 1058 1059 /* viewport */ 1060 static int 1061 viewport_func (char *arg, int flags) 1062 { 1063 int i; 1064 int x0 = 0, y0 = 0, x1 = 80, y1 = 30; 1065 int *pos[4] = { &x0, &y0, &x1, &y1 }; 1066 1067 if (!arg) 1068 return (1); 1069 for (i = 0; i < 4; i++) { 1070 if (!*arg) 1071 return (1); 1072 while (*arg && (*arg == ' ' || *arg == '\t')) 1073 ++arg; 1074 if (!safe_parse_maxint(&arg, pos[i])) 1075 return (1); 1076 while (*arg && (*arg != ' ' && *arg != '\t')) 1077 ++arg; 1078 } 1079 1080 /* minimum size is 65 colums and 16 rows */ 1081 if (x0 > x1 - 66 || y0 > y1 - 16 || x0 < 0 || y0 < 0 || x1 > 80 || y1 > 30) 1082 return 1; 1083 1084 view_x0 = x0; 1085 view_y0 = y0; 1086 view_x1 = x1; 1087 view_y1 = y1; 1088 1089 if (flags == BUILTIN_CMDLINE && graphics_inited) { 1090 graphics_end(); 1091 graphics_init(); 1092 graphics_cls(); 1093 } 1094 1095 return 0; 1096 } 1097 1098 static struct builtin builtin_viewport = 1099 { 1100 "viewport", 1101 viewport_func, 1102 BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, 1103 "viewport x0 y0 x1 y1", 1104 "Changes grub internals to output text in the window defined by" 1105 " four parameters. The x and y parameters are 0 based. This option" 1106 " only works with the graphics interface." 1107 }; 1108 1109 #endif /* SUPPORT_GRAPHICS */ 1110 1111 861 1112 1113 /* clear */ 1114 static int 1115 clear_func() 1116 { 1117 if (current_term->cls) 1118 current_term->cls(); 1119 1120 return 0; 1121 } 1122 1123 static struct builtin builtin_clear = 1124 { 1125 "clear", 1126 clear_func, 1127 BUILTIN_CMDLINE | BUILTIN_HELP_LIST, -
stage2/char_io.c
+ "clear", + "Clear the screen" +}; + /* displayapm */ static int @@ -1454,14 +1724,20 @@ /* help */ -#define MAX_SHORT_DOC_LEN 39 -#define MAX_LONG_DOC_LEN 66 - static int help_func (char *arg, int flags) { - int all = 0; - + int all = 0, max_short_doc_len, max_long_doc_len; + max_short_doc_len = 39; + max_long_doc_len = 66; +#ifdef SUPPORT_GRAPHICS + if (grub_memcmp (current_term->name, "graphics", sizeof ("graphics") - 1) == 0) + { + max_short_doc_len = (view_x1 - view_x0 + 1) / 2 - 1; + max_long_doc_len = (view_x1 - view_x0) - 14; + } +#endif + if (grub_memcmp (arg, "--all", sizeof ("--all") - 1) == 0) { all = 1; @@ -1491,13 +1767,13 @@ len = grub_strlen ((*builtin)->short_doc); /* If the length of SHORT_DOC is too long, truncate it. */ - if (len > MAX_SHORT_DOC_LEN - 1) - len = MAX_SHORT_DOC_LEN - 1; + if (len > max_short_doc_len - 1) + len = max_short_doc_len - 1; for (i = 0; i < len; i++) grub_putchar ((*builtin)->short_doc[i]); - for (; i < MAX_SHORT_DOC_LEN; i++) + for (; i < max_short_doc_len; i++) grub_putchar (' '); if (! left) @@ -1546,10 +1822,10 @@ int i; /* If LEN is too long, fold DOC. */ - if (len > MAX_LONG_DOC_LEN) + if (len > max_long_doc_len) { /* Fold this line at the position of a space. */ - for (len = MAX_LONG_DOC_LEN; len > 0; len--) + for (len = max_long_doc_len; len > 0; len--) if (doc[len - 1] == ' ') break; } @@ -2323,6 +2599,25 @@ "Probe I/O ports used for the drive DRIVE." }; +/* print */ +static int +print_func (char *arg, int flags) +{ + printf("%s\n", arg); + + return 0; +} + +static struct builtin builtin_print = +{ + "print", + print_func, + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_NO_ECHO, + "print [MESSAGE ...]", + "Print MESSAGE." +}; + + /* kernel */ static int @@ -3221,7 +3516,102 @@ static int savedefault_func (char *arg, int flags) { -#if !defined(SUPPORT_DISKLESS) && !defined(GRUB_UTIL) +#if !defined(SUPPORT_DISKLESS) + #if !defined(GRUB_UTIL) + savedefault_helper(arg, flags); + #else + savedefault_shell(arg, flags); + #endif +#else /* !SUPPORT_DISKLESS */ + errnum = ERR_UNRECOGNIZED; + return 1; +#endif /* !SUPPORT_DISKLESS */ +} + +#if !defined(SUPPORT_DISKLESS) && defined(GRUB_UTIL) +/* savedefault_shell */ +static int +savedefault_shell(char *arg, int flags) + { + int once_only = 0; + int new_default; + int curr_default = -1; + int curr_prev_default = -1; + int new_prev_default = -1; + FILE *fp; + size_t bytes = 10; + char line[bytes]; + char *default_file = (char *) DEFAULT_FILE_BUF; + char buf[bytes]; + int i; + + while (1) + { + if (grub_memcmp ("--default=", arg, sizeof ("--default=") - 1) == 0) + { + char *p = arg + sizeof ("--default=") - 1; + if (! safe_parse_maxint (&p, &new_default)) + return 1; + arg = skip_to (0, arg); + } + else if (grub_memcmp ("--once", arg, sizeof ("--once") - 1) == 0) + { + once_only = 1; + arg = skip_to (0, arg); + } + else + break; + } + + *default_file = 0; + grub_strncat (default_file, config_file, DEFAULT_FILE_BUFLEN); + for (i = grub_strlen(default_file); i >= 0; i--) + if (default_file[i] == '/') + { + i++; + break; + } + default_file[i] = 0; + grub_strncat (default_file + i, "default", DEFAULT_FILE_BUFLEN - i); + + if(!(fp = fopen(default_file,"w"))) + { + errnum = ERR_READ; + goto fail; + } + + read(&line, -1); + + sscanf(line, "%d:%d", &curr_prev_default, &curr_default); + + if(curr_default != -1) + new_prev_default = curr_default; + else + { + if(curr_prev_default != -1) + new_prev_default = curr_prev_default; + else + new_prev_default = 0; + } + + if(once_only) + sprintf(buf, "%d:%d\n", new_prev_default, new_default); + else + sprintf(buf, "%d\n", new_default); + + fprintf(fp, buf); + +fail: + fclose(fp); + return errnum; +} +#endif + +/* savedefault_helper */ +static int +savedefault_helper (char *arg, int flags) +{ +#if !defined(SUPPORT_DISKLESS) unsigned long tmp_drive = saved_drive; unsigned long tmp_partition = saved_partition; char *default_file = (char *) DEFAULT_FILE_BUF; @@ -3300,19 +3690,23 @@ disk_read_hook = 0; grub_close (); - if (len != sizeof (buf)) - { - /* This is too small. Do not modify the file manually, please! */ - errnum = ERR_READ; - goto fail; - } - if (sector_count > 2) { /* Is this possible?! Too fragmented! */ errnum = ERR_FSYS_CORRUPT; goto fail; } + + char *tmp; + if((tmp = grub_strstr(buf, ":")) != NULL) + { + int f_len = grub_strlen(buf) - grub_strlen(tmp); + char *def; + int a; + for(a = 0; a < f_len; a++) + grub_memcpy(&def[a], &buf[a], sizeof(char)); + safe_parse_maxint (&def, &entryno); + } /* Set up a string to be written. */ grub_memset (buf, '\n', sizeof (buf)); @@ -3830,15 +4224,15 @@ { char tmp[16]; grub_sprintf (tmp, ",%d", (partition >> 16) & 0xFF); - grub_strncat (device, tmp, 256); + grub_strncat (device, tmp, sizeof (device)); } if ((partition & 0x00FF00) != 0x00FF00) { char tmp[16]; grub_sprintf (tmp, ",%c", 'a' + ((partition >> 8) & 0xFF)); - grub_strncat (device, tmp, 256); + grub_strncat (device, tmp, sizeof (device)); } - grub_strncat (device, ")", 256); + grub_strncat (device, ")", sizeof (device)); } int embed_stage1_5 (char *stage1_5, int drive, int partition) @@ -4085,7 +4479,7 @@ }; -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) +#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS) /* terminal */ static int terminal_func (char *arg, int flags) @@ -4244,17 +4638,29 @@ end: current_term = term_table + default_term; current_term->flags = term_flags; - + if (lines) max_lines = lines; else - /* 24 would be a good default value. */ - max_lines = 24; - + max_lines = current_term->max_lines; + /* If the interface is currently the command-line, restart it to repaint the screen. */ - if (current_term != prev_term && (flags & BUILTIN_CMDLINE)) + if ((current_term != prev_term) && (flags & BUILTIN_CMDLINE)){ + if (prev_term->shutdown) + prev_term->shutdown(); + if (current_term->startup) { + /* If startup fails, return to previous term */ + if (current_term->startup() == 0) { + current_term = prev_term; + max_lines = current_term->max_lines; + if (current_term->cls) { + current_term->cls(); + } + } + } grub_longjmp (restart_cmdline_env, 0); + } return 0; } @@ -4264,7 +4670,7 @@ "terminal", terminal_func, BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, - "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules]", + "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules] [graphics]", "Select a terminal. When multiple terminals are specified, wait until" " you push any key to continue. If both console and serial are specified," " the terminal to which you input a key first will be selected. If no" @@ -4276,7 +4682,7 @@ " seconds. The option --lines specifies the maximum number of lines." " The option --silent is used to suppress messages." }; -#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */ +#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */ #ifdef SUPPORT_SERIAL @@ -4795,13 +5201,20 @@ /* The table of builtin commands. Sorted in dictionary order. */ struct builtin *builtin_table[] = { +#ifdef SUPPORT_GRAPHICS + &builtin_background, +#endif &builtin_blocklist, &builtin_boot, #ifdef SUPPORT_NETBOOT &builtin_bootp, #endif /* SUPPORT_NETBOOT */ +#ifdef SUPPORT_GRAPHICS + &builtin_border, +#endif &builtin_cat, &builtin_chainloader, + &builtin_clear, &builtin_cmp, &builtin_color, &builtin_configfile, @@ -4821,6 +5234,9 @@ &builtin_embed, &builtin_fallback, &builtin_find, +#ifdef SUPPORT_GRAPHICS + &builtin_foreground, +#endif &builtin_fstest, &builtin_geometry, &builtin_halt, @@ -4848,6 +5264,7 @@ &builtin_parttype, &builtin_password, &builtin_pause, + &builtin_print, #ifdef GRUB_UTIL &builtin_quit, #endif /* GRUB_UTIL */ @@ -4864,9 +5281,13 @@ #endif /* SUPPORT_SERIAL */ &builtin_setkey, &builtin_setup, -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) +#ifdef SUPPORT_GRAPHICS + &builtin_shade, + &builtin_splashimage, +#endif /* SUPPORT_GRAPHICS */ +#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS) &builtin_terminal, -#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */ +#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */ #ifdef SUPPORT_SERIAL &builtin_terminfo, #endif /* SUPPORT_SERIAL */ @@ -4880,5 +5301,8 @@ &builtin_unhide, &builtin_uppermem, &builtin_vbeprobe, +#ifdef SUPPORT_GRAPHICS + &builtin_viewport, +#endif 0 }; diff -Naur grub-0.97.orig/stage2/char_io.c grub-0.97/stage2/char_io.c
old new 29 29 # include <serial.h> 30 30 #endif 31 31 32 #ifdef SUPPORT_GRAPHICS 33 # include <graphics.h> 34 #endif 35 32 36 #ifndef STAGE1_5 33 37 struct term_entry term_table[] = 34 38 { 35 39 { 36 40 "console", 37 41 0, 42 24, 38 43 console_putchar, 39 44 console_checkkey, 40 45 console_getkey, … … 43 48 console_cls, 44 49 console_setcolorstate, 45 50 console_setcolor, 46 console_setcursor 51 console_setcursor, 52 0, 53 0 47 54 }, 48 55 #ifdef SUPPORT_SERIAL 49 56 { 50 57 "serial", 51 58 /* A serial device must be initialized. */ 52 59 TERM_NEED_INIT, 60 24, 53 61 serial_putchar, 54 62 serial_checkkey, 55 63 serial_getkey, … … 58 66 serial_cls, 59 67 serial_setcolorstate, 60 68 0, 69 0, 70 0, 61 71 0 62 72 }, 63 73 #endif /* SUPPORT_SERIAL */ … … 65 75 { 66 76 "hercules", 67 77 0, 78 24, 68 79 hercules_putchar, 69 80 console_checkkey, 70 81 console_getkey, … … 73 84 hercules_cls, 74 85 hercules_setcolorstate, 75 86 hercules_setcolor, 76 hercules_setcursor 87 hercules_setcursor, 88 0, 89 0 77 90 }, 78 91 #endif /* SUPPORT_HERCULES */ 92 #ifdef SUPPORT_GRAPHICS 93 { "graphics", 94 TERM_NEED_INIT, /* flags */ 95 30, /* number of lines */ 96 graphics_putchar, /* putchar */ 97 console_checkkey, /* checkkey */ 98 console_getkey, /* getkey */ 99 graphics_getxy, /* getxy */ 100 graphics_gotoxy, /* gotoxy */ 101 graphics_cls, /* cls */ 102 graphics_setcolorstate, /* setcolorstate */ 103 graphics_setcolor, /* setcolor */ 104 graphics_setcursor, /* nocursor */ 105 graphics_init, /* initialize */ 106 graphics_end /* shutdown */ 107 }, 108 #endif /* SUPPORT_GRAPHICS */ 79 109 /* This must be the last entry. */ 80 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }110 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 81 111 }; 82 112 83 113 /* This must be console. */ … … 305 335 306 336 /* XXX: These should be defined in shared.h, but I leave these here, 307 337 until this code is freezed. */ 308 #define CMDLINE_WIDTH 78309 338 #define CMDLINE_MARGIN 10 310 339 340 /* command-line limits */ 341 int cmdline_width = 78, col_start = 0; 311 342 int xpos, lpos, c, section; 312 343 /* The length of PROMPT. */ 313 344 int plen; … … 338 369 339 370 /* If the cursor is in the first section, display the first section 340 371 instead of the second. */ 341 if (section == 1 && plen + lpos < CMDLINE_WIDTH)372 if (section == 1 && plen + lpos < cmdline_width) 342 373 cl_refresh (1, 0); 343 374 else if (xpos - count < 1) 344 375 cl_refresh (1, 0); … … 354 385 grub_putchar ('\b'); 355 386 } 356 387 else 357 gotoxy (xpos , getxy () & 0xFF);388 gotoxy (xpos + col_start, getxy () & 0xFF); 358 389 } 359 390 } 360 391 … … 364 395 lpos += count; 365 396 366 397 /* If the cursor goes outside, scroll the screen to the right. */ 367 if (xpos + count >= CMDLINE_WIDTH)398 if (xpos + count >= cmdline_width) 368 399 cl_refresh (1, 0); 369 400 else 370 401 { … … 383 414 } 384 415 } 385 416 else 386 gotoxy (xpos , getxy () & 0xFF);417 gotoxy (xpos + col_start, getxy () & 0xFF); 387 418 } 388 419 } 389 420 … … 398 429 if (full) 399 430 { 400 431 /* Recompute the section number. */ 401 if (lpos + plen < CMDLINE_WIDTH)432 if (lpos + plen < cmdline_width) 402 433 section = 0; 403 434 else 404 section = ((lpos + plen - CMDLINE_WIDTH)405 / ( CMDLINE_WIDTH- 1 - CMDLINE_MARGIN) + 1);435 section = ((lpos + plen - cmdline_width) 436 / (cmdline_width - 1 - CMDLINE_MARGIN) + 1); 406 437 407 438 /* From the start to the end. */ 408 len = CMDLINE_WIDTH;439 len = cmdline_width; 409 440 pos = 0; 410 441 grub_putchar ('\r'); 411 442 … … 445 476 if (! full) 446 477 offset = xpos - 1; 447 478 448 start = ((section - 1) * ( CMDLINE_WIDTH- 1 - CMDLINE_MARGIN)449 + CMDLINE_WIDTH- plen - CMDLINE_MARGIN);479 start = ((section - 1) * (cmdline_width - 1 - CMDLINE_MARGIN) 480 + cmdline_width - plen - CMDLINE_MARGIN); 450 481 xpos = lpos + 1 - start; 451 482 start += offset; 452 483 } … … 471 502 472 503 /* If the cursor is at the last position, put `>' or a space, 473 504 depending on if there are more characters in BUF. */ 474 if (pos == CMDLINE_WIDTH)505 if (pos == cmdline_width) 475 506 { 476 507 if (start + len < llen) 477 508 grub_putchar ('>'); … … 488 519 grub_putchar ('\b'); 489 520 } 490 521 else 491 gotoxy (xpos , getxy () & 0xFF);522 gotoxy (xpos + col_start, getxy () & 0xFF); 492 523 } 493 524 494 525 /* Initialize the command-line. */ … … 518 549 519 550 llen += l; 520 551 lpos += l; 521 if (xpos + l >= CMDLINE_WIDTH)552 if (xpos + l >= cmdline_width) 522 553 cl_refresh (1, 0); 523 else if (xpos + l + llen - lpos > CMDLINE_WIDTH)524 cl_refresh (0, CMDLINE_WIDTH- xpos);554 else if (xpos + l + llen - lpos > cmdline_width) 555 cl_refresh (0, cmdline_width - xpos); 525 556 else 526 557 cl_refresh (0, l + llen - lpos); 527 558 } … … 533 564 grub_memmove (buf + lpos, buf + lpos + count, llen - count + 1); 534 565 llen -= count; 535 566 536 if (xpos + llen + count - lpos > CMDLINE_WIDTH)537 cl_refresh (0, CMDLINE_WIDTH- xpos);567 if (xpos + llen + count - lpos > cmdline_width) 568 cl_refresh (0, cmdline_width - xpos); 538 569 else 539 570 cl_refresh (0, llen + count - lpos); 540 571 } 541 572 573 max_lines = current_term->max_lines; 574 #ifdef SUPPORT_GRAPHICS 575 if (grub_memcmp (current_term->name, "graphics", sizeof ("graphics") - 1) == 0) 576 { 577 cmdline_width = (view_x1 - view_x0) - 2; 578 col_start = view_x0; 579 max_lines = view_y1 - view_y0; 580 } 581 #endif 582 542 583 plen = grub_strlen (prompt); 543 584 llen = grub_strlen (cmdline); 544 585 … … 1006 1047 } 1007 1048 #endif /* ! STAGE1_5 */ 1008 1049 1050 #ifndef STAGE1_5 1051 /* Internal pager. */ 1052 int 1053 do_more (void) 1054 { 1055 if (count_lines >= 0) 1056 { 1057 count_lines++; 1058 if (count_lines >= max_lines - 2) 1059 { 1060 int tmp; 1061 1062 /* It's important to disable the feature temporarily, because 1063 the following grub_printf call will print newlines. */ 1064 count_lines = -1; 1065 1066 grub_printf("\n"); 1067 if (current_term->setcolorstate) 1068 current_term->setcolorstate (COLOR_STATE_HIGHLIGHT); 1069 1070 grub_printf ("[Hit return to continue]"); 1071 1072 if (current_term->setcolorstate) 1073 current_term->setcolorstate (COLOR_STATE_NORMAL); 1074 1075 1076 do 1077 { 1078 tmp = ASCII_CHAR (getkey ()); 1079 } 1080 while (tmp != '\n' && tmp != '\r'); 1081 grub_printf ("\r \r"); 1082 1083 /* Restart to count lines. */ 1084 count_lines = 0; 1085 return 1; 1086 } 1087 } 1088 return 0; 1089 } 1090 #endif 1091 1009 1092 /* Display an ASCII character. */ 1010 1093 void 1011 1094 grub_putchar (int c) … … 1034 1117 1035 1118 if (c == '\n') 1036 1119 { 1120 int flag; 1037 1121 /* Internal `more'-like feature. */ 1038 if (count_lines >= 0) 1039 { 1040 count_lines++; 1041 if (count_lines >= max_lines - 2) 1042 { 1043 int tmp; 1044 1045 /* It's important to disable the feature temporarily, because 1046 the following grub_printf call will print newlines. */ 1047 count_lines = -1; 1048 1049 if (current_term->setcolorstate) 1050 current_term->setcolorstate (COLOR_STATE_HIGHLIGHT); 1051 1052 grub_printf ("\n[Hit return to continue]"); 1053 1054 if (current_term->setcolorstate) 1055 current_term->setcolorstate (COLOR_STATE_NORMAL); 1056 1057 do 1058 { 1059 tmp = ASCII_CHAR (getkey ()); 1060 } 1061 while (tmp != '\n' && tmp != '\r'); 1062 grub_printf ("\r \r"); 1063 1064 /* Restart to count lines. */ 1065 count_lines = 0; 1066 return; 1067 } 1068 } 1122 flag = do_more (); 1123 if (flag) 1124 return; 1069 1125 } 1070 1126 1071 1127 current_term->putchar (c); … … 1090 1146 cls (void) 1091 1147 { 1092 1148 /* If the terminal is dumb, there is no way to clean the terminal. */ 1093 if (current_term->flags & TERM_DUMB) 1149 if (current_term->flags & TERM_DUMB) 1094 1150 grub_putchar ('\n'); 1095 1151 else 1096 1152 current_term->cls (); … … 1175 1231 #endif /* ! STAGE1_5 */ 1176 1232 1177 1233 int 1178 memcheck ( int addr,int len)1234 memcheck (unsigned long int addr, unsigned long int len) 1179 1235 { 1180 1236 #ifdef GRUB_UTIL 1181 auto int start_addr (void);1182 auto int end_addr (void);1237 auto unsigned long int start_addr (void); 1238 auto int unsigned long end_addr (void); 1183 1239 1184 auto int start_addr (void)1240 auto unsigned long int start_addr (void) 1185 1241 { 1186 1242 int ret; 1187 1243 # if defined(HAVE_START_SYMBOL) … … 1192 1248 return ret; 1193 1249 } 1194 1250 1195 auto int end_addr (void)1251 auto unsigned long int end_addr (void) 1196 1252 { 1197 1253 int ret; 1198 1254 # if defined(HAVE_END_SYMBOL) … … 1217 1273 return ! errnum; 1218 1274 } 1219 1275 1276 void 1277 grub_memcpy(void *dest, const void *src, int len) 1278 { 1279 int i; 1280 register char *d = (char*)dest, *s = (char*)src; 1281 1282 for (i = 0; i < len; i++) 1283 d[i] = s[i]; 1284 } 1285 1220 1286 void * 1221 1287 grub_memmove (void *to, const void *from, int len) 1222 1288 { -
stage2/cmdline.c
diff -Naur grub-0.97.orig/stage2/cmdline.c grub-0.97/stage2/cmdline.c
old new 50 50 void 51 51 print_cmdline_message (int forever) 52 52 { 53 printf (" [ Minimal BASH-like line editing is supported. For the first word, TAB\n" 54 " lists possible command completions. Anywhere else TAB lists the possible\n" 55 " completions of a device/filename.%s ]\n", 56 (forever ? "" : " ESC at any time exits.")); 53 grub_printf(" [ Minimal BASH-like line editing is supported. For\n" 54 " the first word, TAB lists possible command\n" 55 " completions. Anywhere else TAB lists the possible\n" 56 " completions of a device/filename.%s ]\n", 57 (forever ? "" : " ESC at any time\n exits.")); 57 58 } 58 59 59 60 /* Find the builtin whose command name is COMMAND and return the -
stage2/freebsd.h
diff -Naur grub-0.97.orig/stage2/freebsd.h grub-0.97/stage2/freebsd.h
old new 1 1 2 2 /* 3 3 * GRUB -- GRand Unified Bootloader 4 * Copyright (C) 2001 Free Software Foundation, Inc.4 * Copyright (C) 2001, 2004 Free Software Foundation, Inc. 5 5 * 6 6 * This program is free software; you can redistribute it and/or modify 7 7 * it under the terms of the GNU General Public License as published by … … 35 35 #define RB_CDROM 0x2000 /* use cdrom as root */ 36 36 #define RB_GDB 0x8000 /* use GDB remote debugger instead of DDB */ 37 37 #define RB_MUTE 0x10000 /* Come up with the console muted */ 38 #define RB_SELFTEST 0x20000 /* don't complete the boot; do selftest */ 39 #define RB_RESERVED1 0x40000 /* reserved for internal use of boot blocks */ 40 #define RB_RESERVED2 0x80000 /* reserved for internal use of boot blocks */ 41 #define RB_PAUSE 0x100000 /* pause after each output line during probe */ 38 42 #define RB_MULTIPLE 0x20000000 /* Use multiple consoles */ 39 43 40 44 #define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */ … … 70 74 71 75 #define N_BIOS_GEOM 8 72 76 77 typedef unsigned char u8_t; 78 typedef unsigned int u32_t; 79 73 80 /* 74 81 * A zero bootinfo field often means that there is no info available. 75 82 * Flags are used to indicate the validity of fields where zero is a … … 77 84 */ 78 85 struct bootinfo 79 86 { 80 u nsigned int bi_version;81 u nsigned char*bi_kernelname;82 struct nfs_diskless *bi_nfs_diskless;87 u32_t bi_version; 88 u8_t *bi_kernelname; 89 u32_t bi_nfs_diskless; 83 90 /* End of fields that are always present. */ 84 91 #define bi_endcommon bi_n_bios_used 85 unsigned int bi_n_bios_used; 86 unsigned long bi_bios_geom[N_BIOS_GEOM]; 87 unsigned int bi_size; 88 unsigned char bi_memsizes_valid; 89 unsigned char bi_bios_dev; 90 unsigned char bi_pad[2]; 91 unsigned long bi_basemem; 92 unsigned long bi_extmem; 93 unsigned long bi_symtab; 94 unsigned long bi_esymtab; 92 u32_t bi_n_bios_used; 93 u32_t bi_bios_geom[N_BIOS_GEOM]; 94 u32_t bi_size; 95 u8_t bi_memsizes_valid; 96 u8_t bi_bios_dev; 97 u8_t bi_pad[2]; 98 u32_t bi_basemem; 99 u32_t bi_extmem; 100 u32_t bi_symtab; 101 u32_t bi_esymtab; 102 /* Items below only from advanced bootloader */ 103 u32_t bi_kernend; 104 u32_t bi_envp; 105 u32_t bi_modulep; 95 106 }; 107 108 #define MODINFO_END 0x0000 /* End of list */ 109 #define MODINFO_NAME 0x0001 /* Name of module (string) */ 110 #define MODINFO_TYPE 0x0002 /* Type of module (string) */ 111 #define MODINFO_ADDR 0x0003 /* Loaded address */ 112 #define MODINFO_SIZE 0x0004 /* Size of module */ 113 #define MODINFO_EMPTY 0x0005 /* Has been deleted */ 114 #define MODINFO_ARGS 0x0006 /* Parameters string */ 115 #define MODINFO_METADATA 0x8000 /* Module-specfic */ 116 -
stage2/graphics.c
diff -Naur grub-0.97.orig/stage2/graphics.c grub-0.97/stage2/graphics.c
old new 1 /* 2 * graphics.c - graphics mode support for GRUB 3 * Implemented as a terminal type by Jeremy Katz <katzj@redhat.com> based 4 * on a patch by Paulo César Pereira de Andrade <pcpa@conectiva.com.br> 5 * Options and enhancements made by Herton Ronaldo Krzesinski 6 * <herton@mandriva.com> 7 * 8 * GRUB -- GRand Unified Bootloader 9 * Copyright (C) 2001,2002 Red Hat, Inc. 10 * Portions copyright (C) 2000 Conectiva, Inc. 11 * 12 * This program is free software; you can redistribute it and/or modify 13 * it under the terms of the GNU General Public License as published by 14 * the Free Software Foundation; either version 2 of the License, or 15 * (at your option) any later version. 16 * 17 * This program is distributed in the hope that it will be useful, 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 * GNU General Public License for more details. 21 * 22 * You should have received a copy of the GNU General Public License 23 * along with this program; if not, write to the Free Software 24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 25 */ 26 27 #ifdef SUPPORT_GRAPHICS 28 29 #include <term.h> 30 #include <shared.h> 31 #include <graphics.h> 32 33 int saved_videomode; 34 unsigned char *font8x16; 35 36 int graphics_inited = 0; 37 static char splashimage[256]; 38 39 int shade = 1, no_cursor = 0; 40 41 #define VSHADOW VSHADOW1 42 unsigned char VSHADOW1[38400]; 43 unsigned char VSHADOW2[38400]; 44 unsigned char VSHADOW4[38400]; 45 unsigned char VSHADOW8[38400]; 46 47 /* define the default viewable area */ 48 int view_x0 = 0; 49 int view_y0 = 0; 50 int view_x1 = 80; 51 int view_y1 = 30; 52 53 /* text buffer has to be kept around so that we can write things as we 54 * scroll and the like */ 55 unsigned short text[80 * 30]; 56 57 /* graphics options */ 58 int foreground = (63 << 16) | (63 << 8) | (63), background = 0, window_border = 0; 59 60 /* current position */ 61 static int fontx = 0; 62 static int fonty = 0; 63 64 /* global state so that we don't try to recursively scroll or cursor */ 65 static int no_scroll = 0; 66 67 /* color state */ 68 static int graphics_standard_color = A_NORMAL; 69 static int graphics_normal_color = A_NORMAL; 70 static int graphics_highlight_color = A_REVERSE; 71 static int graphics_current_color = A_NORMAL; 72 static color_state graphics_color_state = COLOR_STATE_STANDARD; 73 74 static inline void outb(unsigned short port, unsigned char val) 75 { 76 __asm __volatile ("outb %0,%1"::"a" (val), "d" (port)); 77 } 78 79 static void MapMask(int value) { 80 outb(0x3c4, 2); 81 outb(0x3c5, value); 82 } 83 84 /* bit mask register */ 85 static void BitMask(int value) { 86 outb(0x3ce, 8); 87 outb(0x3cf, value); 88 } 89 90 /* move the graphics cursor location to col, row */ 91 static void graphics_setxy(int col, int row) { 92 if (col >= view_x0 && col < view_x1) { 93 fontx = col; 94 cursorX = col << 3; 95 } 96 if (row >= view_y0 && row < view_y1) { 97 fonty = row; 98 cursorY = row << 4; 99 } 100 } 101 102 /* scroll the screen */ 103 static void graphics_scroll() { 104 int i, j, k; 105 106 /* we don't want to scroll recursively... that would be bad */ 107 if (no_scroll) 108 return; 109 no_scroll = 1; 110 111 /* disable pager temporarily */ 112 k = count_lines; 113 count_lines = -1; 114 115 /* move everything up a line */ 116 for (j = view_y0 + 1; j < view_y1; j++) { 117 graphics_gotoxy(view_x0, j - 1); 118 for (i = view_x0; i < view_x1; i++) { 119 graphics_putchar(text[j * 80 + i]); 120 } 121 } 122 123 /* last line should be blank */ 124 graphics_gotoxy(view_x0, view_y1 - 1); 125 for (i = view_x0; i < view_x1; i++) 126 graphics_putchar(' '); 127 graphics_setxy(view_x0, view_y1 - 1); 128 129 count_lines = k; 130 131 no_scroll = 0; 132 } 133 134 /* Set the splash image */ 135 void graphics_set_splash(char *splashfile) { 136 grub_strcpy(splashimage, splashfile); 137 } 138 139 /* Get the current splash image */ 140 char *graphics_get_splash(void) { 141 return splashimage; 142 } 143 144 /* 145 * Initialize a vga16 graphics display with the palette based off of 146 * the image in splashimage. If the image doesn't exist, leave graphics 147 * mode. The mode initiated is 12h. From "Ralf Brown's Interrupt List": 148 * text/ text pixel pixel colors disply scrn system 149 * grph resol box resolution pages addr 150 * 12h G 80x30 8x16 640x480 16/256K . A000 VGA,ATI VIP 151 * G 80x30 8x16 640x480 16/64 . A000 ATI EGA Wonder 152 * G . . 640x480 16 . . UltraVision+256K EGA 153 */ 154 int graphics_init() 155 { 156 if (!graphics_inited) { 157 saved_videomode = set_videomode(0x12); 158 if (get_videomode() != 0x12) { 159 set_videomode(saved_videomode); 160 return 0; 161 } 162 graphics_inited = 1; 163 } 164 else 165 return 1; 166 167 font8x16 = (unsigned char*)graphics_get_font(); 168 169 /* make sure that the highlight color is set correctly */ 170 graphics_highlight_color = ((graphics_normal_color >> 4) | 171 ((graphics_normal_color & 0xf) << 4)); 172 173 graphics_cls(); 174 175 if (!read_image(splashimage)) { 176 grub_printf("Failed to read splash image (%s)\n", splashimage); 177 grub_printf("Press any key to continue..."); 178 getkey(); 179 set_videomode(saved_videomode); 180 graphics_inited = 0; 181 return 0; 182 } 183 184 set_int1c_handler(); 185 186 return 1; 187 } 188 189 /* Leave graphics mode */ 190 void graphics_end(void) 191 { 192 if (graphics_inited) { 193 unset_int1c_handler(); 194 set_videomode(saved_videomode); 195 graphics_inited = 0; 196 no_cursor = 0; 197 } 198 } 199 200 /* Print ch on the screen. Handle any needed scrolling or the like */ 201 void graphics_putchar(int ch) { 202 ch &= 0xff; 203 204 graphics_cursor(0); 205 206 if (ch == '\n') { 207 if (fonty + 1 < view_y1) 208 graphics_setxy(fontx, fonty + 1); 209 else 210 graphics_scroll(); 211 graphics_cursor(1); 212 return; 213 } else if (ch == '\r') { 214 graphics_setxy(view_x0, fonty); 215 graphics_cursor(1); 216 return; 217 } 218 219 graphics_cursor(0); 220 221 text[fonty * 80 + fontx] = ch; 222 text[fonty * 80 + fontx] &= 0x00ff; 223 if (graphics_current_color & 0xf0) 224 text[fonty * 80 + fontx] |= 0x100; 225 226 graphics_cursor(0); 227 228 if ((fontx + 1) >= view_x1) { 229 graphics_setxy(view_x0, fonty); 230 if (fonty + 1 < view_y1) 231 graphics_setxy(view_x0, fonty + 1); 232 else 233 graphics_scroll(); 234 graphics_cursor(1); 235 do_more (); 236 graphics_cursor(0); 237 } else { 238 graphics_setxy(fontx + 1, fonty); 239 } 240 241 graphics_cursor(1); 242 } 243 244 /* get the current location of the cursor */ 245 int graphics_getxy(void) { 246 return (fontx << 8) | fonty; 247 } 248 249 void graphics_gotoxy(int x, int y) { 250 graphics_cursor(0); 251 252 graphics_setxy(x, y); 253 254 graphics_cursor(1); 255 } 256 257 void graphics_cls(void) { 258 int i; 259 unsigned char *mem, *s1, *s2, *s4, *s8; 260 261 graphics_cursor(0); 262 graphics_gotoxy(view_x0, view_y0); 263 264 mem = (unsigned char*)VIDEOMEM; 265 s1 = (unsigned char*)VSHADOW1; 266 s2 = (unsigned char*)VSHADOW2; 267 s4 = (unsigned char*)VSHADOW4; 268 s8 = (unsigned char*)VSHADOW8; 269 270 for (i = 0; i < 80 * 30; i++) 271 text[i] = ' '; 272 graphics_cursor(1); 273 274 BitMask(0xff); 275 276 /* plane 1 */ 277 MapMask(1); 278 grub_memcpy(mem, s1, 38400); 279 280 /* plane 2 */ 281 MapMask(2); 282 grub_memcpy(mem, s2, 38400); 283 284 /* plane 3 */ 285 MapMask(4); 286 grub_memcpy(mem, s4, 38400); 287 288 /* plane 4 */ 289 MapMask(8); 290 grub_memcpy(mem, s8, 38400); 291 292 MapMask(15); 293 294 if (no_cursor) { 295 no_cursor = 0; 296 set_int1c_handler(); 297 } 298 } 299 300 void graphics_setcolorstate (color_state state) { 301 switch (state) { 302 case COLOR_STATE_STANDARD: 303 graphics_current_color = graphics_standard_color; 304 break; 305 case COLOR_STATE_NORMAL: 306 graphics_current_color = graphics_normal_color; 307 break; 308 case COLOR_STATE_HIGHLIGHT: 309 graphics_current_color = graphics_highlight_color; 310 break; 311 default: 312 graphics_current_color = graphics_standard_color; 313 break; 314 } 315 316 graphics_color_state = state; 317 } 318 319 void graphics_setcolor (int normal_color, int highlight_color) { 320 graphics_normal_color = normal_color; 321 graphics_highlight_color = highlight_color; 322 323 graphics_setcolorstate (graphics_color_state); 324 } 325 326 int graphics_setcursor (int on) { 327 if (!no_cursor && !on) { 328 no_cursor = 1; 329 unset_int1c_handler(); 330 graphics_cursor(0); 331 } 332 else if(no_cursor && on) { 333 no_cursor = 0; 334 set_int1c_handler(); 335 graphics_cursor(1); 336 } 337 return 0; 338 } 339 340 /* Read in the splashscreen image and set the palette up appropriately. 341 * Format of splashscreen is an xpm (can be gzipped) with 16 colors and 342 * 640x480. */ 343 int read_image(char *s) 344 { 345 char buf[32], pal[16], c; 346 unsigned char base, mask, *s1, *s2, *s4, *s8; 347 unsigned i, len, idx, colors, x, y, width, height; 348 349 if (!grub_open(s)) 350 return 0; 351 352 /* read header */ 353 if (!grub_read((char*)&buf, 10) || grub_memcmp(buf, "/* XPM */\n", 10)) { 354 grub_close(); 355 return 0; 356 } 357 358 /* parse info */ 359 while (grub_read(&c, 1)) { 360 if (c == '"') 361 break; 362 } 363 364 while (grub_read(&c, 1) && (c == ' ' || c == '\t')) 365 ; 366 367 i = 0; 368 width = c - '0'; 369 while (grub_read(&c, 1)) { 370 if (c >= '0' && c <= '9') 371 width = width * 10 + c - '0'; 372 else 373 break; 374 } 375 while (grub_read(&c, 1) && (c == ' ' || c == '\t')) 376 ; 377 378 height = c - '0'; 379 while (grub_read(&c, 1)) { 380 if (c >= '0' && c <= '9') 381 height = height * 10 + c - '0'; 382 else 383 break; 384 } 385 while (grub_read(&c, 1) && (c == ' ' || c == '\t')) 386 ; 387 388 colors = c - '0'; 389 while (grub_read(&c, 1)) { 390 if (c >= '0' && c <= '9') 391 colors = colors * 10 + c - '0'; 392 else 393 break; 394 } 395 396 base = 0; 397 while (grub_read(&c, 1) && c != '"') 398 ; 399 400 /* palette */ 401 for (i = 0, idx = 1; i < colors; i++) { 402 len = 0; 403 404 while (grub_read(&c, 1) && c != '"') 405 ; 406 grub_read(&c, 1); /* char */ 407 base = c; 408 grub_read(buf, 4); /* \t c # */ 409 410 while (grub_read(&c, 1) && c != '"') { 411 if (len < sizeof(buf)) 412 buf[len++] = c; 413 } 414 415 if (len == 6 && idx < 15) { 416 int r = ((hex(buf[0]) << 4) | hex(buf[1])) >> 2; 417 int g = ((hex(buf[2]) << 4) | hex(buf[3])) >> 2; 418 int b = ((hex(buf[4]) << 4) | hex(buf[5])) >> 2; 419 420 pal[idx] = base; 421 graphics_set_palette(idx, r, g, b); 422 ++idx; 423 } 424 } 425 426 x = y = len = 0; 427 428 s1 = (unsigned char*)VSHADOW1; 429 s2 = (unsigned char*)VSHADOW2; 430 s4 = (unsigned char*)VSHADOW4; 431 s8 = (unsigned char*)VSHADOW8; 432 433 for (i = 0; i < 38400; i++) 434 s1[i] = s2[i] = s4[i] = s8[i] = 0; 435 436 /* parse xpm data */ 437 while (y < height) { 438 while (1) { 439 if (!grub_read(&c, 1)) { 440 grub_close(); 441 return 0; 442 } 443 if (c == '"') 444 break; 445 } 446 447 while (grub_read(&c, 1) && c != '"') { 448 for (i = 1; i < 15; i++) 449 if (pal[i] == c) { 450 c = i; 451 break; 452 } 453 454 mask = 0x80 >> (x & 7); 455 if (c & 1) 456 s1[len + (x >> 3)] |= mask; 457 if (c & 2) 458 s2[len + (x >> 3)] |= mask; 459 if (c & 4) 460 s4[len + (x >> 3)] |= mask; 461 if (c & 8) 462 s8[len + (x >> 3)] |= mask; 463 464 if (++x >= 640) { 465 x = 0; 466 467 if (y < 480) 468 len += 80; 469 ++y; 470 } 471 } 472 } 473 474 grub_close(); 475 476 graphics_set_palette(0, (background >> 16), (background >> 8) & 63, 477 background & 63); 478 graphics_set_palette(15, (foreground >> 16), (foreground >> 8) & 63, 479 foreground & 63); 480 graphics_set_palette(0x11, (window_border >> 16), (window_border >> 8) & 63, 481 window_border & 63); 482 483 return 1; 484 } 485 486 /* Convert a character which is a hex digit to the appropriate integer */ 487 int hex(int v) 488 { 489 if (v >= 'A' && v <= 'F') 490 return (v - 'A' + 10); 491 if (v >= 'a' && v <= 'f') 492 return (v - 'a' + 10); 493 return (v - '0'); 494 } 495 496 void graphics_cursor(int set) { 497 unsigned char *pat, *mem, *ptr, chr[16 << 2]; 498 int i, ch, invert, offset; 499 500 if (set && (no_cursor || no_scroll)) 501 return; 502 503 offset = cursorY * 80 + fontx; 504 ch = text[fonty * 80 + fontx] & 0xff; 505 invert = (text[fonty * 80 + fontx] & 0xff00) != 0; 506 pat = font8x16 + (ch << 4); 507 508 mem = (unsigned char*)VIDEOMEM + offset; 509 510 if (!set) { 511 for (i = 0; i < 16; i++) { 512 unsigned char mask = pat[i]; 513 514 if (!invert) { 515 chr[i ] = ((unsigned char*)VSHADOW1)[offset]; 516 chr[16 + i] = ((unsigned char*)VSHADOW2)[offset]; 517 chr[32 + i] = ((unsigned char*)VSHADOW4)[offset]; 518 chr[48 + i] = ((unsigned char*)VSHADOW8)[offset]; 519 520 if (shade) { 521 if (ch == DISP_VERT || ch == DISP_LL || 522 ch == DISP_UR || ch == DISP_LR) { 523 unsigned char pmask = ~(pat[i] >> 1); 524 525 chr[i ] &= pmask; 526 chr[16 + i] &= pmask; 527 chr[32 + i] &= pmask; 528 chr[48 + i] &= pmask; 529 } 530 if (i > 0 && ch != DISP_VERT) { 531 unsigned char pmask = ~(pat[i - 1] >> 1); 532 533 chr[i ] &= pmask; 534 chr[16 + i] &= pmask; 535 chr[32 + i] &= pmask; 536 chr[48 + i] &= pmask; 537 if (ch == DISP_HORIZ || ch == DISP_UR || ch == DISP_LR) { 538 pmask = ~pat[i - 1]; 539 540 chr[i ] &= pmask; 541 chr[16 + i] &= pmask; 542 chr[32 + i] &= pmask; 543 chr[48 + i] &= pmask; 544 } 545 } 546 } 547 chr[i ] |= mask; 548 chr[16 + i] |= mask; 549 chr[32 + i] |= mask; 550 chr[48 + i] |= mask; 551 552 offset += 80; 553 } 554 else { 555 chr[i ] = mask; 556 chr[16 + i] = mask; 557 chr[32 + i] = mask; 558 chr[48 + i] = mask; 559 } 560 } 561 } 562 else { 563 MapMask(15); 564 ptr = mem; 565 for (i = 0; i < 16; i++, ptr += 80) { 566 cursorBuf[i] = pat[i]; 567 *ptr = ~pat[i]; 568 } 569 return; 570 } 571 572 offset = 0; 573 for (i = 1; i < 16; i <<= 1, offset += 16) { 574 int j; 575 576 MapMask(i); 577 ptr = mem; 578 for (j = 0; j < 16; j++, ptr += 80) 579 *ptr = chr[j + offset]; 580 } 581 582 MapMask(15); 583 } 584 585 #endif /* SUPPORT_GRAPHICS */ -
stage2/graphics.h
diff -Naur grub-0.97.orig/stage2/graphics.h grub-0.97/stage2/graphics.h
old new 1 /* graphics.h - graphics console interface */ 2 /* 3 * GRUB -- GRand Unified Bootloader 4 * Copyright (C) 2002 Free Software Foundation, Inc. 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 */ 20 21 #ifndef GRAPHICS_H 22 #define GRAPHICS_H 23 24 /* magic constant */ 25 #define VIDEOMEM 0xA0000 26 27 /* function prototypes */ 28 char *graphics_get_splash(void); 29 30 int read_image(char *s); 31 void graphics_cursor(int set); 32 33 /* function prototypes for asm functions */ 34 void * graphics_get_font(); 35 void graphics_set_palette(int idx, int red, int green, int blue); 36 void set_int1c_handler(); 37 void unset_int1c_handler(); 38 39 extern short cursorX, cursorY; 40 extern char cursorBuf[16]; 41 extern int shade; 42 extern int view_x0, view_y0, view_x1, view_y1; 43 44 #endif /* GRAPHICS_H */ -
stage2/Makefile.am
diff -Naur grub-0.97.orig/stage2/Makefile.am grub-0.97/stage2/Makefile.am
old new 7 7 fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \ 8 8 imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \ 9 9 nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \ 10 terminfo.h tparm.h nbi.h ufs2.h vstafs.h xfs.h 10 terminfo.h tparm.h nbi.h ufs2.h vstafs.h xfs.h graphics.h 11 11 EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS) 12 12 13 13 # For <stage1.h>. … … 19 19 disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \ 20 20 fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs2.c \ 21 21 fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \ 22 terminfo.c tparm.c 22 terminfo.c tparm.c graphics.c 23 23 libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \ 24 24 -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ 25 25 -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \ … … 79 79 HERCULES_FLAGS = 80 80 endif 81 81 82 if GRAPHICS_SUPPORT 83 GRAPHICS_FLAGS = -DSUPPORT_GRAPHICS=1 84 else 85 GRAPHICS_FLAGS = 86 endif 87 82 88 STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ 83 $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) 89 $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) $(GRAPHICS_FLAGS) 84 90 85 91 STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 86 92 STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 … … 90 96 cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \ 91 97 fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \ 92 98 fsys_reiserfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c gunzip.c \ 93 hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c 99 hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c \ 100 graphics.c 94 101 pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) 95 102 pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) 96 103 pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) -
stage2/shared.h
diff -Naur grub-0.97.orig/stage2/shared.h grub-0.97/stage2/shared.h
old new 499 499 unsigned char linear_reserved_field_position; 500 500 unsigned long max_pixel_clock; 501 501 502 unsigned char reserved3[189]; 502 /* Reserved field to make structure to be 256 bytes long, VESA BIOS 503 Extension 3.0 Specification says to reserve 189 bytes here but 504 that doesn't make structure to be 256 bytes. So additional one is 505 added here. */ 506 unsigned char reserved3[189 + 1]; 503 507 } __attribute__ ((packed)); 504 508 505 509 … … 792 796 /* Set the cursor position. */ 793 797 void gotoxy (int x, int y); 794 798 799 /* Internal pager 800 Returns 1 = if pager was used 801 0 = if pager wasn't used */ 802 int do_more (void); 803 795 804 /* Displays an ASCII character. IBM displays will translate some 796 805 characters to special graphical ones (see the DISP_* constants). */ 797 806 void grub_putchar (int c); … … 871 880 int grub_tolower (int c); 872 881 int grub_isspace (int c); 873 882 int grub_strncat (char *s1, const char *s2, int n); 883 void grub_memcpy(void *dest, const void *src, int len); 874 884 void *grub_memmove (void *to, const void *from, int len); 875 885 void *grub_memset (void *start, int c, int len); 876 886 int grub_strncat (char *s1, const char *s2, int n); … … 911 921 int nul_terminate (char *str); 912 922 int get_based_digit (int c, int base); 913 923 int safe_parse_maxint (char **str_ptr, int *myint_ptr); 914 int memcheck ( int start,int len);924 int memcheck (unsigned long int start, unsigned long int len); 915 925 void grub_putstr (const char *str); 916 926 917 927 #ifndef NO_DECOMPRESSION -
stage2/stage2.c
diff -Naur grub-0.97.orig/stage2/stage2.c grub-0.97/stage2/stage2.c
old new 20 20 #include <shared.h> 21 21 #include <term.h> 22 22 23 #ifdef SUPPORT_GRAPHICS 24 # include <graphics.h> 25 #endif 26 27 int col_start, col_end, row_start, box_size; 28 23 29 grub_jmp_buf restart_env; 24 30 25 31 #if defined(PRESET_MENU_STRING) || defined(SUPPORT_DISKLESS) … … 105 111 if (highlight && current_term->setcolorstate) 106 112 current_term->setcolorstate (COLOR_STATE_HIGHLIGHT); 107 113 108 gotoxy (2 , y);114 gotoxy (2 + col_start, y); 109 115 grub_putchar (' '); 110 for (x = 3 ; x < 75; x++)116 for (x = 3 + col_start; x < (col_end - 5); x++) 111 117 { 112 if (*entry && x <= 72)118 if (*entry && x <= (col_end - 8)) 113 119 { 114 if (x == 72)120 if (x == (col_end - 8)) 115 121 grub_putchar (DISP_RIGHT); 116 122 else 117 123 grub_putchar (*entry++); … … 119 125 else 120 126 grub_putchar (' '); 121 127 } 122 gotoxy ( 74, y);128 gotoxy ((col_end - 6), y); 123 129 124 130 if (current_term->setcolorstate) 125 131 current_term->setcolorstate (COLOR_STATE_STANDARD); … … 131 137 { 132 138 int i; 133 139 134 gotoxy ( 77, y + 1);140 gotoxy ((col_end - 3), y + 1); 135 141 136 142 if (first) 137 143 grub_putchar (DISP_UP); … … 151 157 menu_entries++; 152 158 } 153 159 154 gotoxy ( 77, y + size);160 gotoxy ((col_end - 3), y + size); 155 161 156 162 if (*menu_entries) 157 163 grub_putchar (DISP_DOWN); 158 164 else 159 165 grub_putchar (' '); 160 166 161 gotoxy ( 74, y + entryno + 1);167 gotoxy ((col_end - 6), y + entryno + 1); 162 168 } 163 169 164 170 static void … … 196 202 if (current_term->setcolorstate) 197 203 current_term->setcolorstate (COLOR_STATE_NORMAL); 198 204 199 gotoxy (1 , y);205 gotoxy (1 + col_start, y); 200 206 201 207 grub_putchar (DISP_UL); 202 for (i = 0; i < 73; i++)208 for (i = col_start; i < (col_end - 7); i++) 203 209 grub_putchar (DISP_HORIZ); 204 210 grub_putchar (DISP_UR); 205 211 206 212 i = 1; 207 213 while (1) 208 214 { 209 gotoxy (1 , y + i);215 gotoxy (1 + col_start, y + i); 210 216 211 217 if (i > size) 212 218 break; 213 219 214 220 grub_putchar (DISP_VERT); 215 gotoxy ( 75, y + i);221 gotoxy ((col_end - 5), y + i); 216 222 grub_putchar (DISP_VERT); 217 223 218 224 i++; 219 225 } 220 226 221 227 grub_putchar (DISP_LL); 222 for (i = 0; i < 73; i++)228 for (i = col_start; i < (col_end - 7); i++) 223 229 grub_putchar (DISP_HORIZ); 224 230 grub_putchar (DISP_LR); 225 231 … … 233 239 { 234 240 int c, time1, time2 = -1, first_entry = 0; 235 241 char *cur_entry = 0; 242 struct term_entry *prev_term = NULL; 236 243 237 244 /* 238 245 * Main loop for menu UI. … … 250 257 } 251 258 } 252 259 260 col_start = 0; 261 col_end = 80; 262 row_start = 0; 263 box_size = 12; 264 /* if we're using viewport we need to make sure to setup 265 coordinates correctly. */ 266 #ifdef SUPPORT_GRAPHICS 267 if (grub_memcmp (current_term->name, "graphics", sizeof ("graphics") - 1) == 0) 268 { 269 col_start = view_x0; 270 col_end = view_x1; 271 row_start = view_y0; 272 box_size = (view_y1 - view_y0) - 13; 273 } 274 #endif 275 253 276 /* If the timeout was expired or wasn't set, force to show the menu 254 277 interface. */ 255 278 if (grub_timeout < 0) … … 302 325 if (current_term->flags & TERM_DUMB) 303 326 print_entries_raw (num_entries, first_entry, menu_entries); 304 327 else 305 print_border (3 , 12);328 print_border (3 + row_start, box_size); 306 329 307 330 grub_printf ("\n\ 308 331 Use the %c and %c keys to select which entry is highlighted.\n", 309 332 DISP_UP, DISP_DOWN); 310 333 311 334 if (! auth && password) 312 335 { 313 336 printf ("\ 314 315 337 Press enter to boot the selected OS or \'p\' to enter a\n\ 338 password to unlock the next set of features."); 316 339 } 317 340 else 318 341 { 319 342 if (config_entries) 320 343 printf ("\ 321 322 344 Press enter to boot the selected OS, \'e\' to edit the\n\ 345 commands before booting, or \'c\' for a command-line."); 323 346 else 324 347 printf ("\ 325 326 327 328 348 Press \'b\' to boot, \'e\' to edit the selected command in the\n\ 349 boot sequence, \'c\' for a command-line, \'o\' to open a new line\n\ 350 after (\'O\' for before) the selected line, \'d\' to remove the\n\ 351 selected line, or escape to go back to the main menu."); 329 352 } 330 353 331 354 if (current_term->flags & TERM_DUMB) 332 355 grub_printf ("\n\nThe selected entry is %d ", entryno); 333 356 else 334 print_entries (3 , 12, first_entry, entryno, menu_entries);357 print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries); 335 358 } 336 359 337 360 /* XX using RT clock now, need to initialize value */ … … 358 381 entryno, grub_timeout); 359 382 else 360 383 { 361 gotoxy (3 , 22);362 grub_printf (" The highlighted entry will be booted automatically in %d seconds.",384 gotoxy (3 + col_start, 10 + box_size + row_start); 385 grub_printf (" The highlighted entry will be booted automatically in %d seconds. ", 363 386 grub_timeout); 364 gotoxy ( 74, 4 + entryno);387 gotoxy ((col_end - 6), 4 + entryno + row_start); 365 388 } 366 389 367 390 grub_timeout--; … … 387 410 if (current_term->flags & TERM_DUMB) 388 411 grub_putchar ('\r'); 389 412 else 390 gotoxy (3 , 22);413 gotoxy (3 + col_start, 10 + box_size + row_start); 391 414 printf (" "); 392 415 grub_timeout = -1; 393 416 fallback_entryno = -1; 394 417 if (! (current_term->flags & TERM_DUMB)) 395 gotoxy ( 74, 4 + entryno);418 gotoxy ((col_end - 6), 4 + entryno + row_start); 396 419 } 397 420 398 421 /* We told them above (at least in SUPPORT_SERIAL) to use … … 408 431 { 409 432 if (entryno > 0) 410 433 { 411 print_entry (4 + entryno , 0,434 print_entry (4 + entryno + row_start, 0, 412 435 get_entry (menu_entries, 413 436 first_entry + entryno, 414 437 0)); 415 438 entryno--; 416 print_entry (4 + entryno , 1,439 print_entry (4 + entryno + row_start, 1, 417 440 get_entry (menu_entries, 418 441 first_entry + entryno, 419 442 0)); … … 421 444 else if (first_entry > 0) 422 445 { 423 446 first_entry--; 424 print_entries (3 , 12, first_entry, entryno,447 print_entries (3 + row_start, box_size, first_entry, entryno, 425 448 menu_entries); 426 449 } 427 450 } … … 433 456 entryno++; 434 457 else 435 458 { 436 if (entryno < 11)459 if (entryno < (box_size - 1)) 437 460 { 438 print_entry (4 + entryno , 0,461 print_entry (4 + entryno + row_start, 0, 439 462 get_entry (menu_entries, 440 463 first_entry + entryno, 441 464 0)); 442 465 entryno++; 443 print_entry (4 + entryno , 1,466 print_entry (4 + entryno + row_start, 1, 444 467 get_entry (menu_entries, 445 468 first_entry + entryno, 446 469 0)); 447 470 } 448 else if (num_entries > 12+ first_entry)471 else if (num_entries > box_size + first_entry) 449 472 { 450 473 first_entry++; 451 print_entries (3 , 12, first_entry, entryno, menu_entries);474 print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries); 452 475 } 453 476 } 454 477 } 455 478 else if (c == 7) 456 479 { 457 480 /* Page Up */ 458 first_entry -= 12;481 first_entry -= box_size; 459 482 if (first_entry < 0) 460 483 { 461 484 entryno += first_entry; … … 463 486 if (entryno < 0) 464 487 entryno = 0; 465 488 } 466 print_entries (3 , 12, first_entry, entryno, menu_entries);489 print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries); 467 490 } 468 491 else if (c == 3) 469 492 { 470 493 /* Page Down */ 471 first_entry += 12;494 first_entry += box_size; 472 495 if (first_entry + entryno + 1 >= num_entries) 473 496 { 474 first_entry = num_entries - 12;497 first_entry = num_entries - box_size; 475 498 if (first_entry < 0) 476 499 first_entry = 0; 477 500 entryno = num_entries - first_entry - 1; 478 501 } 479 print_entries (3 , 12, first_entry, entryno, menu_entries);502 print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries); 480 503 } 481 504 482 505 if (config_entries) … … 489 512 if ((c == 'd') || (c == 'o') || (c == 'O')) 490 513 { 491 514 if (! (current_term->flags & TERM_DUMB)) 492 print_entry (4 + entryno , 0,515 print_entry (4 + entryno + row_start, 0, 493 516 get_entry (menu_entries, 494 517 first_entry + entryno, 495 518 0)); … … 537 560 538 561 if (entryno >= num_entries) 539 562 entryno--; 540 if (first_entry && num_entries < 12+ first_entry)563 if (first_entry && num_entries < box_size + first_entry) 541 564 first_entry--; 542 565 } 543 566 … … 549 572 grub_printf ("\n"); 550 573 } 551 574 else 552 print_entries (3 , 12, first_entry, entryno, menu_entries);575 print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries); 553 576 } 554 577 555 578 cur_entry = menu_entries; … … 570 593 if (current_term->flags & TERM_DUMB) 571 594 grub_printf ("\r "); 572 595 else 573 gotoxy (1 , 21);596 gotoxy (1 + col_start, 9 + box_size + row_start); 574 597 575 598 /* Wipe out the previously entered password */ 576 599 grub_memset (entered, 0, sizeof (entered)); … … 651 674 *(new_heap++) = 0; 652 675 653 676 if (config_entries) 654 run_menu (heap, NULL, new_num_entries, new_heap, 0); 677 { 678 current_entryno = first_entry + entryno; 679 run_menu (heap, NULL, new_num_entries, new_heap, 0); 680 } 655 681 else 656 682 { 657 683 cls (); … … 714 740 715 741 cls (); 716 742 setcursor (1); 743 /* if our terminal needed initialization, we should shut it down 744 * before booting the kernel, but we want to save what it was so 745 * we can come back if needed */ 746 prev_term = current_term; 747 if (current_term->shutdown) 748 { 749 current_term->shutdown(); 750 current_term = term_table; /* assumption: console is first */ 751 } 717 752 718 753 while (1) 719 754 { … … 727 762 cur_entry = get_entry (config_entries, first_entry + entryno, 1); 728 763 729 764 /* Set CURRENT_ENTRYNO for the command "savedefault". */ 730 current_entryno = first_entry + entryno; 765 if (config_entries) 766 current_entryno = first_entry + entryno; 731 767 732 768 if (run_script (cur_entry, heap)) 733 769 { … … 748 784 break; 749 785 } 750 786 787 /* if we get back here, we should go back to what our term was before */ 788 current_term = prev_term; 789 if (current_term->startup) 790 /* if our terminal fails to initialize, fall back to console since 791 * it should always work */ 792 if (current_term->startup() == 0) 793 current_term = term_table; /* we know that console is first */ 751 794 show_menu = 1; 752 795 goto restart; 753 796 } … … 891 934 len = grub_read (buf, sizeof (buf)); 892 935 if (len > 0) 893 936 { 937 char *tmp; 938 char *def; 894 939 buf[sizeof (buf) - 1] = 0; 895 safe_parse_maxint (&p, &saved_entryno); 940 941 if((tmp = grub_strstr(p, ":")) != NULL) 942 { 943 *tmp++; 944 grub_memcpy(&def, &tmp, sizeof(p)); 945 }else 946 grub_memcpy(&def, &p, sizeof(p)); 947 948 safe_parse_maxint (&def, &saved_entryno); 896 949 } 897 950 898 951 grub_close (); … … 1050 1103 while (is_preset); 1051 1104 } 1052 1105 1106 /* go ahead and make sure the terminal is setup */ 1107 if (current_term->startup) 1108 { 1109 /* If initialization fails, go back to default terminal */ 1110 if (current_term->startup() == 0) 1111 { 1112 current_term = term_table; 1113 } 1114 } 1115 1053 1116 if (! num_entries) 1054 1117 { 1055 1118 /* If no acceptable config file, goto command-line, starting -
stage2/term.h
diff -Naur grub-0.97.orig/stage2/term.h grub-0.97/stage2/term.h
old new 60 60 const char *name; 61 61 /* The feature flags defined above. */ 62 62 unsigned long flags; 63 /* Default for maximum number of lines if not specified */ 64 unsigned short max_lines; 63 65 /* Put a character. */ 64 66 void (*putchar) (int c); 65 67 /* Check if any input character is available. */ … … 79 81 void (*setcolor) (int normal_color, int highlight_color); 80 82 /* Turn on/off the cursor. */ 81 83 int (*setcursor) (int on); 84 /* function to start a terminal */ 85 int (*startup) (void); 86 /* function to use to shutdown a terminal */ 87 void (*shutdown) (void); 82 88 }; 83 89 84 90 /* This lists up available terminals. */ … … 124 130 int hercules_setcursor (int on); 125 131 #endif 126 132 133 #ifdef SUPPORT_GRAPHICS 134 extern int foreground, background, window_border, graphics_inited, saved_videomode; 135 136 void graphics_set_splash(char *splashfile); 137 int set_videomode(int mode); 138 int get_videomode(void); 139 void graphics_putchar (int c); 140 int graphics_getxy(void); 141 void graphics_gotoxy(int x, int y); 142 void graphics_cls(void); 143 void graphics_setcolorstate (color_state state); 144 void graphics_setcolor (int normal_color, int highlight_color); 145 int graphics_setcursor (int on); 146 int graphics_init(void); 147 void graphics_end(void); 148 149 int hex(int v); 150 void graphics_set_palette(int idx, int red, int green, int blue); 151 #endif /* SUPPORT_GRAPHICS */ 152 127 153 #endif /* ! GRUB_TERM_HEADER */ -
grub-0.97
diff -Naur grub-0.97.orig/THANKS grub-0.97/THANKS
old new 121 121 Yedidyah Bar-David <didi@post.tau.ac.il> 122 122 Yury V. Umanets <umka@namesys.com> 123 123 Yuri Zaporogets <yuriz@ukr.net> 124 Vitaly Fertman <vitaly@namesys.com> -
util/grub-install.in
diff -Naur grub-0.97.orig/util/grub-install.in grub-0.97/util/grub-install.in
old new 81 81 EOF 82 82 } 83 83 84 # Usage: getraid_mdadm mddevice 85 # Routine to find a physical device from an md device 86 # If found, the first grub BIOS device (from device.map) is returned 87 # If no BIOS drives match the RAID devices, the first device returned 88 # from mdadm -D is returned 89 getraid_mdadm() { 90 device=$1 91 mdadm=$(mdadm -D "$device") || { 92 echo "$PROG: mdadm -D $device failed" >&2 93 exit 1 94 } 95 eval "$( 96 echo "$mdadm" | awk ' 97 $1 == "Number" && $2 == "Major" { start = 1; next } 98 $1 == "UUID" { print "uuid=" $3; start = 0; next } 99 !start { next } 100 $2 == 0 && $3 == 0 { next } 101 { devices = devices "\n" $NF } 102 END { print "devices='\''" devices "'\''" } 103 ' 104 )" 105 106 # Convert RAID devices list into a list of disks 107 tmp_disks=`echo "$devices" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \ 108 -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \ 109 -e 's%\(fd[0-9]*\)$%\1%' \ 110 -e 's%/part[0-9]*$%/disc%' \ 111 -e 's%\(c[0-7]d[0-9]*\).*$%\1%' \ 112 -e '/^$/d' | 113 sed -n '1h;2,$H;${g;s/\n/|/g;p}'` 114 115 # Find first BIOS disk that's a member of the RAID array 116 # Default to first RAID member if no tmp_disks are BIOS devices 117 set -- `egrep $tmp_disks $device_map | \ 118 sort | \ 119 sed -n 1p ` 120 device=${2:-${tmp_disks%%|*}} 121 122 # Return first partition on BIOS disk that's part of the RAID 123 echo "$devices" | \ 124 sed -n "\:${device}:p" | \ 125 sed -n 1p 126 } 127 84 128 # Usage: convert os_device 85 129 # Convert an OS device to the corresponding GRUB drive. 86 130 # This part is OS-specific. … … 96 140 # Break the device name into the disk part and the partition part. 97 141 case "$host_os" in 98 142 linux*) 143 # Find an actual physical device if we're passed a RAID device 144 case $1 in 145 /dev/md*) set -- `getraid_mdadm $1` 146 esac 99 147 tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \ 100 148 -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \ 101 149 -e 's%\(fd[0-9]*\)$%\1%' \ … … 112 160 tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'` 113 161 tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;; 114 162 freebsd* | kfreebsd*-gnu) 115 tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$% r\1%' \116 | sed 's%r\{0,1\}\(da[0-9]*\).*$% r\1%'`163 tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%\1%' \ 164 | sed 's%r\{0,1\}\(da[0-9]*\).*$%\1%'` 117 165 tmp_part=`echo "$1" \ 118 166 | sed "s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" \ 119 167 | sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%"` … … 131 179 132 180 # Get the drive name. 133 181 tmp_drive=`grep -v '^#' $device_map | grep "$tmp_disk *$" \ 134 | sed 's%.*\(([hf]d[0-9][a- g0-9,]*)\).*%\1%'`182 | sed 's%.*\(([hf]d[0-9][a-z0-9,]*)\).*%\1%'` 135 183 136 184 # If not found, print an error message and exit. 137 185 if test "x$tmp_drive" = x; then … … 148 196 gnu*) 149 197 if echo $tmp_part | grep "^s" >/dev/null; then 150 198 tmp_pc_slice=`echo $tmp_part \ 151 | sed "s%s\([0-9]*\)[a- g]*$%\1%"`199 | sed "s%s\([0-9]*\)[a-z]*$%\1%"` 152 200 tmp_drive=`echo "$tmp_drive" \ 153 201 | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"` 154 202 fi 155 if echo $tmp_part | grep "[a- g]$" >/dev/null; then203 if echo $tmp_part | grep "[a-z]$" >/dev/null; then 156 204 tmp_bsd_partition=`echo "$tmp_part" \ 157 | sed "s%[^a- g]*\([a-g]\)$%\1%"`205 | sed "s%[^a-z]*\([a-z]\)$%\1%"` 158 206 tmp_drive=`echo "$tmp_drive" \ 159 207 | sed "s%)%,$tmp_bsd_partition)%"` 160 208 fi … … 336 384 # Create a safe temporary file. 337 385 test -n "$mklog" && log_file=`$mklog` 338 386 387 # Before all invocations of the grub shell, call sync to make sure 388 # the raw device is in sync with any bufferring in filesystems. 389 sync 390 339 391 $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file 340 392 quit 341 393 EOF … … 450 502 # Create a safe temporary file. 451 503 test -n "$mklog" && log_file=`$mklog` 452 504 505 # Sync to prevent GRUB from not finding stage files (notably, on XFS) 506 sync 507 508 # XFS needs special magic 509 xfs_frozen=false 510 if which xfs_freeze > /dev/null ; then 511 cat << EOF 512 Due to a bug in xfs_freeze, the following command might produce a segmentation 513 fault when ${grubdir} is not in an XFS filesystem. This error is harmless and 514 can be ignored. 515 EOF 516 if xfs_freeze -f ${grubdir} ; then xfs_frozen=true ; fi 517 fi 518 519 # Before all invocations of the grub shell, call sync to make sure 520 # the raw device is in sync with any bufferring in filesystems. 521 sync 522 453 523 # Now perform the installation. 454 524 $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file 455 525 root $root_drive … … 457 527 quit 458 528 EOF 459 529 530 if ${xfs_frozen} ; then 531 xfs_freeze -u ${grubdir} 532 fi 533 460 534 if grep "Error [0-9]*: " $log_file >/dev/null || test $debug = yes; then 461 535 cat $log_file 1>&2 462 536 exit 1
Note:
See TracBrowser
for help on using the repository browser.