[5a4020f] | 1 | Submitted By: Jim Gifford (jim at linuxfromscratch dot org) |
---|
| 2 | Date: 2006-07-04 |
---|
| 3 | Initial Package Version: 0.97 |
---|
| 4 | Origin: Debian |
---|
| 5 | Upstream Status: Unknown |
---|
| 6 | Description: Contains various fixes and enhancements |
---|
| 7 | Graphics mode support |
---|
| 8 | Fixes for Raid Support |
---|
| 9 | XFS Filesystem Boot Freeze Fixes |
---|
| 10 | Removed 2GB Memory Limitation |
---|
| 11 | Freebsd support |
---|
| 12 | Fixes for initrd support |
---|
| 13 | Grub installation Fixes |
---|
| 14 | Linux 2.6 geometry Fixes |
---|
| 15 | Intel Mac Support |
---|
| 16 | Autoconf and aclocal updates |
---|
| 17 | |
---|
| 18 | diff -Naur grub-0.97.orig/aclocal.m4 grub-0.97/aclocal.m4 |
---|
| 19 | --- grub-0.97.orig/aclocal.m4 2005-05-07 19:41:18.000000000 -0700 |
---|
| 20 | +++ grub-0.97/aclocal.m4 2006-07-04 00:08:22.000000000 -0700 |
---|
| 21 | @@ -1,7 +1,7 @@ |
---|
| 22 | -# generated automatically by aclocal 1.9.4 -*- Autoconf -*- |
---|
| 23 | +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- |
---|
| 24 | |
---|
| 25 | -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 |
---|
| 26 | -# Free Software Foundation, Inc. |
---|
| 27 | +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, |
---|
| 28 | +# 2005 Free Software Foundation, Inc. |
---|
| 29 | # This file is free software; the Free Software Foundation |
---|
| 30 | # gives unlimited permission to copy and/or distribute it, |
---|
| 31 | # with or without modifications, as long as this notice is preserved. |
---|
| 32 | @@ -11,23 +11,11 @@ |
---|
| 33 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
---|
| 34 | # PARTICULAR PURPOSE. |
---|
| 35 | |
---|
| 36 | -# -*- Autoconf -*- |
---|
| 37 | -# Copyright (C) 2002, 2003 Free Software Foundation, Inc. |
---|
| 38 | -# Generated from amversion.in; do not edit by hand. |
---|
| 39 | - |
---|
| 40 | -# This program is free software; you can redistribute it and/or modify |
---|
| 41 | -# it under the terms of the GNU General Public License as published by |
---|
| 42 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 43 | -# any later version. |
---|
| 44 | - |
---|
| 45 | -# This program is distributed in the hope that it will be useful, |
---|
| 46 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 47 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 48 | -# GNU General Public License for more details. |
---|
| 49 | - |
---|
| 50 | -# You should have received a copy of the GNU General Public License |
---|
| 51 | -# along with this program; if not, write to the Free Software |
---|
| 52 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 53 | +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. |
---|
| 54 | +# |
---|
| 55 | +# This file is free software; the Free Software Foundation |
---|
| 56 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 57 | +# with or without modifications, as long as this notice is preserved. |
---|
| 58 | |
---|
| 59 | # AM_AUTOMAKE_VERSION(VERSION) |
---|
| 60 | # ---------------------------- |
---|
| 61 | @@ -40,26 +28,15 @@ |
---|
| 62 | # Call AM_AUTOMAKE_VERSION so it can be traced. |
---|
| 63 | # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. |
---|
| 64 | AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], |
---|
| 65 | - [AM_AUTOMAKE_VERSION([1.9.4])]) |
---|
| 66 | - |
---|
| 67 | -# AM_AUX_DIR_EXPAND |
---|
| 68 | - |
---|
| 69 | -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. |
---|
| 70 | + [AM_AUTOMAKE_VERSION([1.9.6])]) |
---|
| 71 | |
---|
| 72 | -# This program is free software; you can redistribute it and/or modify |
---|
| 73 | -# it under the terms of the GNU General Public License as published by |
---|
| 74 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 75 | -# any later version. |
---|
| 76 | +# AM_AUX_DIR_EXPAND -*- Autoconf -*- |
---|
| 77 | |
---|
| 78 | -# This program is distributed in the hope that it will be useful, |
---|
| 79 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 80 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 81 | -# GNU General Public License for more details. |
---|
| 82 | - |
---|
| 83 | -# You should have received a copy of the GNU General Public License |
---|
| 84 | -# along with this program; if not, write to the Free Software |
---|
| 85 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 86 | -# 02111-1307, USA. |
---|
| 87 | +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. |
---|
| 88 | +# |
---|
| 89 | +# This file is free software; the Free Software Foundation |
---|
| 90 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 91 | +# with or without modifications, as long as this notice is preserved. |
---|
| 92 | |
---|
| 93 | # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets |
---|
| 94 | # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to |
---|
| 95 | @@ -106,26 +83,16 @@ |
---|
| 96 | am_aux_dir=`cd $ac_aux_dir && pwd` |
---|
| 97 | ]) |
---|
| 98 | |
---|
| 99 | -# AM_CONDITIONAL -*- Autoconf -*- |
---|
| 100 | +# AM_CONDITIONAL -*- Autoconf -*- |
---|
| 101 | |
---|
| 102 | -# Copyright (C) 1997, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. |
---|
| 103 | - |
---|
| 104 | -# This program is free software; you can redistribute it and/or modify |
---|
| 105 | -# it under the terms of the GNU General Public License as published by |
---|
| 106 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 107 | -# any later version. |
---|
| 108 | - |
---|
| 109 | -# This program is distributed in the hope that it will be useful, |
---|
| 110 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 111 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 112 | -# GNU General Public License for more details. |
---|
| 113 | - |
---|
| 114 | -# You should have received a copy of the GNU General Public License |
---|
| 115 | -# along with this program; if not, write to the Free Software |
---|
| 116 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 117 | -# 02111-1307, USA. |
---|
| 118 | +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 |
---|
| 119 | +# Free Software Foundation, Inc. |
---|
| 120 | +# |
---|
| 121 | +# This file is free software; the Free Software Foundation |
---|
| 122 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 123 | +# with or without modifications, as long as this notice is preserved. |
---|
| 124 | |
---|
| 125 | -# serial 6 |
---|
| 126 | +# serial 7 |
---|
| 127 | |
---|
| 128 | # AM_CONDITIONAL(NAME, SHELL-CONDITION) |
---|
| 129 | # ------------------------------------- |
---|
| 130 | @@ -149,26 +116,15 @@ |
---|
| 131 | Usually this means the macro was only invoked conditionally.]]) |
---|
| 132 | fi])]) |
---|
| 133 | |
---|
| 134 | -# serial 7 -*- Autoconf -*- |
---|
| 135 | |
---|
| 136 | -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 |
---|
| 137 | +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 |
---|
| 138 | # Free Software Foundation, Inc. |
---|
| 139 | +# |
---|
| 140 | +# This file is free software; the Free Software Foundation |
---|
| 141 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 142 | +# with or without modifications, as long as this notice is preserved. |
---|
| 143 | |
---|
| 144 | -# This program is free software; you can redistribute it and/or modify |
---|
| 145 | -# it under the terms of the GNU General Public License as published by |
---|
| 146 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 147 | -# any later version. |
---|
| 148 | - |
---|
| 149 | -# This program is distributed in the hope that it will be useful, |
---|
| 150 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 151 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 152 | -# GNU General Public License for more details. |
---|
| 153 | - |
---|
| 154 | -# You should have received a copy of the GNU General Public License |
---|
| 155 | -# along with this program; if not, write to the Free Software |
---|
| 156 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 157 | -# 02111-1307, USA. |
---|
| 158 | - |
---|
| 159 | +# serial 8 |
---|
| 160 | |
---|
| 161 | # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be |
---|
| 162 | # written in clear, in which case automake, when reading aclocal.m4, |
---|
| 163 | @@ -177,7 +133,6 @@ |
---|
| 164 | # CC etc. in the Makefile, will ask for an AC_PROG_CC use... |
---|
| 165 | |
---|
| 166 | |
---|
| 167 | - |
---|
| 168 | # _AM_DEPENDENCIES(NAME) |
---|
| 169 | # ---------------------- |
---|
| 170 | # See how the compiler implements dependency checking. |
---|
| 171 | @@ -317,27 +272,16 @@ |
---|
| 172 | AC_SUBST([AMDEPBACKSLASH]) |
---|
| 173 | ]) |
---|
| 174 | |
---|
| 175 | -# Generate code to set up dependency tracking. -*- Autoconf -*- |
---|
| 176 | - |
---|
| 177 | -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004 |
---|
| 178 | -# Free Software Foundation, Inc. |
---|
| 179 | - |
---|
| 180 | -# This program is free software; you can redistribute it and/or modify |
---|
| 181 | -# it under the terms of the GNU General Public License as published by |
---|
| 182 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 183 | -# any later version. |
---|
| 184 | +# Generate code to set up dependency tracking. -*- Autoconf -*- |
---|
| 185 | |
---|
| 186 | -# This program is distributed in the hope that it will be useful, |
---|
| 187 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 188 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 189 | -# GNU General Public License for more details. |
---|
| 190 | - |
---|
| 191 | -# You should have received a copy of the GNU General Public License |
---|
| 192 | -# along with this program; if not, write to the Free Software |
---|
| 193 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 194 | -# 02111-1307, USA. |
---|
| 195 | +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 |
---|
| 196 | +# Free Software Foundation, Inc. |
---|
| 197 | +# |
---|
| 198 | +# This file is free software; the Free Software Foundation |
---|
| 199 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 200 | +# with or without modifications, as long as this notice is preserved. |
---|
| 201 | |
---|
| 202 | -#serial 2 |
---|
| 203 | +#serial 3 |
---|
| 204 | |
---|
| 205 | # _AM_OUTPUT_DEPENDENCY_COMMANDS |
---|
| 206 | # ------------------------------ |
---|
| 207 | @@ -396,30 +340,19 @@ |
---|
| 208 | [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) |
---|
| 209 | ]) |
---|
| 210 | |
---|
| 211 | -# Do all the work for Automake. -*- Autoconf -*- |
---|
| 212 | +# Do all the work for Automake. -*- Autoconf -*- |
---|
| 213 | |
---|
| 214 | -# This macro actually does too much some checks are only needed if |
---|
| 215 | -# your package does certain things. But this isn't really a big deal. |
---|
| 216 | - |
---|
| 217 | -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 |
---|
| 218 | +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 |
---|
| 219 | # Free Software Foundation, Inc. |
---|
| 220 | +# |
---|
| 221 | +# This file is free software; the Free Software Foundation |
---|
| 222 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 223 | +# with or without modifications, as long as this notice is preserved. |
---|
| 224 | |
---|
| 225 | -# This program is free software; you can redistribute it and/or modify |
---|
| 226 | -# it under the terms of the GNU General Public License as published by |
---|
| 227 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 228 | -# any later version. |
---|
| 229 | - |
---|
| 230 | -# This program is distributed in the hope that it will be useful, |
---|
| 231 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 232 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 233 | -# GNU General Public License for more details. |
---|
| 234 | - |
---|
| 235 | -# You should have received a copy of the GNU General Public License |
---|
| 236 | -# along with this program; if not, write to the Free Software |
---|
| 237 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 238 | -# 02111-1307, USA. |
---|
| 239 | +# serial 12 |
---|
| 240 | |
---|
| 241 | -# serial 11 |
---|
| 242 | +# This macro actually does too much. Some checks are only needed if |
---|
| 243 | +# your package does certain things. But this isn't really a big deal. |
---|
| 244 | |
---|
| 245 | # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) |
---|
| 246 | # AM_INIT_AUTOMAKE([OPTIONS]) |
---|
| 247 | @@ -521,51 +454,27 @@ |
---|
| 248 | done |
---|
| 249 | echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) |
---|
| 250 | |
---|
| 251 | +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. |
---|
| 252 | +# |
---|
| 253 | +# This file is free software; the Free Software Foundation |
---|
| 254 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 255 | +# with or without modifications, as long as this notice is preserved. |
---|
| 256 | + |
---|
| 257 | # AM_PROG_INSTALL_SH |
---|
| 258 | # ------------------ |
---|
| 259 | # Define $install_sh. |
---|
| 260 | - |
---|
| 261 | -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. |
---|
| 262 | - |
---|
| 263 | -# This program is free software; you can redistribute it and/or modify |
---|
| 264 | -# it under the terms of the GNU General Public License as published by |
---|
| 265 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 266 | -# any later version. |
---|
| 267 | - |
---|
| 268 | -# This program is distributed in the hope that it will be useful, |
---|
| 269 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 270 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 271 | -# GNU General Public License for more details. |
---|
| 272 | - |
---|
| 273 | -# You should have received a copy of the GNU General Public License |
---|
| 274 | -# along with this program; if not, write to the Free Software |
---|
| 275 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 276 | -# 02111-1307, USA. |
---|
| 277 | - |
---|
| 278 | AC_DEFUN([AM_PROG_INSTALL_SH], |
---|
| 279 | [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl |
---|
| 280 | install_sh=${install_sh-"$am_aux_dir/install-sh"} |
---|
| 281 | AC_SUBST(install_sh)]) |
---|
| 282 | |
---|
| 283 | -# -*- Autoconf -*- |
---|
| 284 | -# Copyright (C) 2003 Free Software Foundation, Inc. |
---|
| 285 | - |
---|
| 286 | -# This program is free software; you can redistribute it and/or modify |
---|
| 287 | -# it under the terms of the GNU General Public License as published by |
---|
| 288 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 289 | -# any later version. |
---|
| 290 | - |
---|
| 291 | -# This program is distributed in the hope that it will be useful, |
---|
| 292 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 293 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 294 | -# GNU General Public License for more details. |
---|
| 295 | - |
---|
| 296 | -# You should have received a copy of the GNU General Public License |
---|
| 297 | -# along with this program; if not, write to the Free Software |
---|
| 298 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 299 | -# 02111-1307, USA. |
---|
| 300 | +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. |
---|
| 301 | +# |
---|
| 302 | +# This file is free software; the Free Software Foundation |
---|
| 303 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 304 | +# with or without modifications, as long as this notice is preserved. |
---|
| 305 | |
---|
| 306 | -# serial 1 |
---|
| 307 | +# serial 2 |
---|
| 308 | |
---|
| 309 | # Check whether the underlying file-system supports filenames |
---|
| 310 | # with a leading dot. For instance MS-DOS doesn't. |
---|
| 311 | @@ -580,28 +489,17 @@ |
---|
| 312 | rmdir .tst 2>/dev/null |
---|
| 313 | AC_SUBST([am__leading_dot])]) |
---|
| 314 | |
---|
| 315 | -# Add --enable-maintainer-mode option to configure. |
---|
| 316 | +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- |
---|
| 317 | # From Jim Meyering |
---|
| 318 | |
---|
| 319 | -# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004 |
---|
| 320 | +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 |
---|
| 321 | # Free Software Foundation, Inc. |
---|
| 322 | +# |
---|
| 323 | +# This file is free software; the Free Software Foundation |
---|
| 324 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 325 | +# with or without modifications, as long as this notice is preserved. |
---|
| 326 | |
---|
| 327 | -# This program is free software; you can redistribute it and/or modify |
---|
| 328 | -# it under the terms of the GNU General Public License as published by |
---|
| 329 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 330 | -# any later version. |
---|
| 331 | - |
---|
| 332 | -# This program is distributed in the hope that it will be useful, |
---|
| 333 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 334 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 335 | -# GNU General Public License for more details. |
---|
| 336 | - |
---|
| 337 | -# You should have received a copy of the GNU General Public License |
---|
| 338 | -# along with this program; if not, write to the Free Software |
---|
| 339 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 340 | -# 02111-1307, USA. |
---|
| 341 | - |
---|
| 342 | -# serial 3 |
---|
| 343 | +# serial 4 |
---|
| 344 | |
---|
| 345 | AC_DEFUN([AM_MAINTAINER_MODE], |
---|
| 346 | [AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) |
---|
| 347 | @@ -620,26 +518,15 @@ |
---|
| 348 | |
---|
| 349 | AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) |
---|
| 350 | |
---|
| 351 | -# Check to see how 'make' treats includes. -*- Autoconf -*- |
---|
| 352 | - |
---|
| 353 | -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. |
---|
| 354 | +# Check to see how 'make' treats includes. -*- Autoconf -*- |
---|
| 355 | |
---|
| 356 | -# This program is free software; you can redistribute it and/or modify |
---|
| 357 | -# it under the terms of the GNU General Public License as published by |
---|
| 358 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 359 | -# any later version. |
---|
| 360 | - |
---|
| 361 | -# This program is distributed in the hope that it will be useful, |
---|
| 362 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 363 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 364 | -# GNU General Public License for more details. |
---|
| 365 | - |
---|
| 366 | -# You should have received a copy of the GNU General Public License |
---|
| 367 | -# along with this program; if not, write to the Free Software |
---|
| 368 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 369 | -# 02111-1307, USA. |
---|
| 370 | +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. |
---|
| 371 | +# |
---|
| 372 | +# This file is free software; the Free Software Foundation |
---|
| 373 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 374 | +# with or without modifications, as long as this notice is preserved. |
---|
| 375 | |
---|
| 376 | -# serial 2 |
---|
| 377 | +# serial 3 |
---|
| 378 | |
---|
| 379 | # AM_MAKE_INCLUDE() |
---|
| 380 | # ----------------- |
---|
| 381 | @@ -683,27 +570,16 @@ |
---|
| 382 | rm -f confinc confmf |
---|
| 383 | ]) |
---|
| 384 | |
---|
| 385 | -# -*- Autoconf -*- |
---|
| 386 | - |
---|
| 387 | - |
---|
| 388 | -# Copyright (C) 1997, 1999, 2000, 2001, 2003 Free Software Foundation, Inc. |
---|
| 389 | - |
---|
| 390 | -# This program is free software; you can redistribute it and/or modify |
---|
| 391 | -# it under the terms of the GNU General Public License as published by |
---|
| 392 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 393 | -# any later version. |
---|
| 394 | +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- |
---|
| 395 | |
---|
| 396 | -# This program is distributed in the hope that it will be useful, |
---|
| 397 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 398 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 399 | -# GNU General Public License for more details. |
---|
| 400 | - |
---|
| 401 | -# You should have received a copy of the GNU General Public License |
---|
| 402 | -# along with this program; if not, write to the Free Software |
---|
| 403 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 404 | -# 02111-1307, USA. |
---|
| 405 | +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 |
---|
| 406 | +# Free Software Foundation, Inc. |
---|
| 407 | +# |
---|
| 408 | +# This file is free software; the Free Software Foundation |
---|
| 409 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 410 | +# with or without modifications, as long as this notice is preserved. |
---|
| 411 | |
---|
| 412 | -# serial 3 |
---|
| 413 | +# serial 4 |
---|
| 414 | |
---|
| 415 | # AM_MISSING_PROG(NAME, PROGRAM) |
---|
| 416 | # ------------------------------ |
---|
| 417 | @@ -729,27 +605,16 @@ |
---|
| 418 | fi |
---|
| 419 | ]) |
---|
| 420 | |
---|
| 421 | +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. |
---|
| 422 | +# |
---|
| 423 | +# This file is free software; the Free Software Foundation |
---|
| 424 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 425 | +# with or without modifications, as long as this notice is preserved. |
---|
| 426 | + |
---|
| 427 | # AM_PROG_MKDIR_P |
---|
| 428 | # --------------- |
---|
| 429 | # Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. |
---|
| 430 | - |
---|
| 431 | -# Copyright (C) 2003, 2004 Free Software Foundation, Inc. |
---|
| 432 | - |
---|
| 433 | -# This program is free software; you can redistribute it and/or modify |
---|
| 434 | -# it under the terms of the GNU General Public License as published by |
---|
| 435 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 436 | -# any later version. |
---|
| 437 | - |
---|
| 438 | -# This program is distributed in the hope that it will be useful, |
---|
| 439 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 440 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 441 | -# GNU General Public License for more details. |
---|
| 442 | - |
---|
| 443 | -# You should have received a copy of the GNU General Public License |
---|
| 444 | -# along with this program; if not, write to the Free Software |
---|
| 445 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 446 | -# 02111-1307, USA. |
---|
| 447 | - |
---|
| 448 | +# |
---|
| 449 | # Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories |
---|
| 450 | # created by `make install' are always world readable, even if the |
---|
| 451 | # installer happens to have an overly restrictive umask (e.g. 077). |
---|
| 452 | @@ -803,26 +668,15 @@ |
---|
| 453 | fi |
---|
| 454 | AC_SUBST([mkdir_p])]) |
---|
| 455 | |
---|
| 456 | -# Helper functions for option handling. -*- Autoconf -*- |
---|
| 457 | +# Helper functions for option handling. -*- Autoconf -*- |
---|
| 458 | |
---|
| 459 | -# Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc. |
---|
| 460 | - |
---|
| 461 | -# This program is free software; you can redistribute it and/or modify |
---|
| 462 | -# it under the terms of the GNU General Public License as published by |
---|
| 463 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 464 | -# any later version. |
---|
| 465 | - |
---|
| 466 | -# This program is distributed in the hope that it will be useful, |
---|
| 467 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 468 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 469 | -# GNU General Public License for more details. |
---|
| 470 | - |
---|
| 471 | -# You should have received a copy of the GNU General Public License |
---|
| 472 | -# along with this program; if not, write to the Free Software |
---|
| 473 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 474 | -# 02111-1307, USA. |
---|
| 475 | +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. |
---|
| 476 | +# |
---|
| 477 | +# This file is free software; the Free Software Foundation |
---|
| 478 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 479 | +# with or without modifications, as long as this notice is preserved. |
---|
| 480 | |
---|
| 481 | -# serial 2 |
---|
| 482 | +# serial 3 |
---|
| 483 | |
---|
| 484 | # _AM_MANGLE_OPTION(NAME) |
---|
| 485 | # ----------------------- |
---|
| 486 | @@ -847,28 +701,16 @@ |
---|
| 487 | AC_DEFUN([_AM_IF_OPTION], |
---|
| 488 | [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) |
---|
| 489 | |
---|
| 490 | -# |
---|
| 491 | -# Check to make sure that the build environment is sane. |
---|
| 492 | -# |
---|
| 493 | - |
---|
| 494 | -# Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc. |
---|
| 495 | - |
---|
| 496 | -# This program is free software; you can redistribute it and/or modify |
---|
| 497 | -# it under the terms of the GNU General Public License as published by |
---|
| 498 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 499 | -# any later version. |
---|
| 500 | +# Check to make sure that the build environment is sane. -*- Autoconf -*- |
---|
| 501 | |
---|
| 502 | -# This program is distributed in the hope that it will be useful, |
---|
| 503 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 504 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 505 | -# GNU General Public License for more details. |
---|
| 506 | - |
---|
| 507 | -# You should have received a copy of the GNU General Public License |
---|
| 508 | -# along with this program; if not, write to the Free Software |
---|
| 509 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 510 | -# 02111-1307, USA. |
---|
| 511 | +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 |
---|
| 512 | +# Free Software Foundation, Inc. |
---|
| 513 | +# |
---|
| 514 | +# This file is free software; the Free Software Foundation |
---|
| 515 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 516 | +# with or without modifications, as long as this notice is preserved. |
---|
| 517 | |
---|
| 518 | -# serial 3 |
---|
| 519 | +# serial 4 |
---|
| 520 | |
---|
| 521 | # AM_SANITY_CHECK |
---|
| 522 | # --------------- |
---|
| 523 | @@ -911,25 +753,14 @@ |
---|
| 524 | fi |
---|
| 525 | AC_MSG_RESULT(yes)]) |
---|
| 526 | |
---|
| 527 | -# AM_PROG_INSTALL_STRIP |
---|
| 528 | - |
---|
| 529 | -# Copyright (C) 2001, 2003 Free Software Foundation, Inc. |
---|
| 530 | - |
---|
| 531 | -# This program is free software; you can redistribute it and/or modify |
---|
| 532 | -# it under the terms of the GNU General Public License as published by |
---|
| 533 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 534 | -# any later version. |
---|
| 535 | - |
---|
| 536 | -# This program is distributed in the hope that it will be useful, |
---|
| 537 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 538 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 539 | -# GNU General Public License for more details. |
---|
| 540 | - |
---|
| 541 | -# You should have received a copy of the GNU General Public License |
---|
| 542 | -# along with this program; if not, write to the Free Software |
---|
| 543 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 544 | -# 02111-1307, USA. |
---|
| 545 | +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. |
---|
| 546 | +# |
---|
| 547 | +# This file is free software; the Free Software Foundation |
---|
| 548 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 549 | +# with or without modifications, as long as this notice is preserved. |
---|
| 550 | |
---|
| 551 | +# AM_PROG_INSTALL_STRIP |
---|
| 552 | +# --------------------- |
---|
| 553 | # One issue with vendor `install' (even GNU) is that you can't |
---|
| 554 | # specify the program used to strip binaries. This is especially |
---|
| 555 | # annoying in cross-compiling environments, where the build's strip |
---|
| 556 | @@ -952,25 +783,13 @@ |
---|
| 557 | |
---|
| 558 | # Check how to create a tarball. -*- Autoconf -*- |
---|
| 559 | |
---|
| 560 | -# Copyright (C) 2004 Free Software Foundation, Inc. |
---|
| 561 | - |
---|
| 562 | -# This program is free software; you can redistribute it and/or modify |
---|
| 563 | -# it under the terms of the GNU General Public License as published by |
---|
| 564 | -# the Free Software Foundation; either version 2, or (at your option) |
---|
| 565 | -# any later version. |
---|
| 566 | - |
---|
| 567 | -# This program is distributed in the hope that it will be useful, |
---|
| 568 | -# but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 569 | -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 570 | -# GNU General Public License for more details. |
---|
| 571 | - |
---|
| 572 | -# You should have received a copy of the GNU General Public License |
---|
| 573 | -# along with this program; if not, write to the Free Software |
---|
| 574 | -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
| 575 | -# 02111-1307, USA. |
---|
| 576 | - |
---|
| 577 | -# serial 1 |
---|
| 578 | +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. |
---|
| 579 | +# |
---|
| 580 | +# This file is free software; the Free Software Foundation |
---|
| 581 | +# gives unlimited permission to copy and/or distribute it, |
---|
| 582 | +# with or without modifications, as long as this notice is preserved. |
---|
| 583 | |
---|
| 584 | +# serial 2 |
---|
| 585 | |
---|
| 586 | # _AM_PROG_TAR(FORMAT) |
---|
| 587 | # -------------------- |
---|
| 588 | diff -Naur grub-0.97.orig/ChangeLog grub-0.97/ChangeLog |
---|
| 589 | --- grub-0.97.orig/ChangeLog 2005-05-07 19:47:02.000000000 -0700 |
---|
| 590 | +++ grub-0.97/ChangeLog 2006-07-04 00:01:50.000000000 -0700 |
---|
| 591 | @@ -1,3 +1,51 @@ |
---|
| 592 | +2006-05-02 Pavel Roskin <proski@gnu.org> |
---|
| 593 | + |
---|
| 594 | + * stage2/stage2.c (run_menu): Fix "savedefault" to save only top |
---|
| 595 | + level menu positions. Remember current position when calling a |
---|
| 596 | + submenu. Don't recalculate it when booting from a submenu. |
---|
| 597 | + |
---|
| 598 | + * grub/main.c (main): Make sure the boot drive number doesn't |
---|
| 599 | + exceed 255. |
---|
| 600 | + |
---|
| 601 | +2006-05-02 Vesa Jaaskelainen <chaac@nic.fi> |
---|
| 602 | + |
---|
| 603 | + * stage2/shared.h (vbe_mode): Back ported aligment fix from GRUB 2 |
---|
| 604 | + to GRUB Legacy. Problem reported by Gerardo Richarte. |
---|
| 605 | + |
---|
| 606 | +2006-04-23 Robert Millan <robertmh@gnu.org> |
---|
| 607 | + |
---|
| 608 | + * grub/asmstub.c (get_diskinfo): Optimize sysctl routine. |
---|
| 609 | + |
---|
| 610 | +2006-04-20 Robert Millan <robertmh@gnu.org> |
---|
| 611 | + |
---|
| 612 | + Fixes for kernel of FreeBSD: |
---|
| 613 | + * grub/asmstub.c (get_diskinfo): Toggle "kern.geom.debugflags" sysctl |
---|
| 614 | + before opening a device for writing. |
---|
| 615 | + * util/grub-install.in: Devices don't have this "r" prefix anymore. |
---|
| 616 | + |
---|
| 617 | +2006-04-16 Yoshinori K. Okuji <okuji@enbug.org> |
---|
| 618 | + |
---|
| 619 | + * docs/multiboot.texi: Correct the offset of address |
---|
| 620 | + fields. Reported by Jeroen Dekkers. |
---|
| 621 | + |
---|
| 622 | +2006-03-21 Yoshinori K. Okuji <okuji@enbug.org> |
---|
| 623 | + |
---|
| 624 | + * stage2/builtins.c (setup_func): Specify the size of DEVICE to |
---|
| 625 | + grub_strncat instead of a strange number 256. Reported by Vitaly |
---|
| 626 | + Fertman <vitaly@namesys.com>. |
---|
| 627 | + |
---|
| 628 | +2005-09-29 Yoshinori K. Okuji <okuji@enbug.org> |
---|
| 629 | + |
---|
| 630 | + * docs/multiboot.texi: Fix a bug in the byte order of |
---|
| 631 | + boot_device. I hope this won't affect any OS image. |
---|
| 632 | + Increased the version number to 0.6.94. |
---|
| 633 | + |
---|
| 634 | +2005-09-28 Yoshinori K. Okuji <okuji@enbug.org> |
---|
| 635 | + |
---|
| 636 | + * stage2/boot.c (load_image): Even if an OS image is an ELF |
---|
| 637 | + object, use the a.out kludge if MULTIBOOT_AOUT_KLUDGE is |
---|
| 638 | + specified. |
---|
| 639 | + |
---|
| 640 | 2005-05-08 Yoshinori K. Okuji <okuji@enbug.org> |
---|
| 641 | |
---|
| 642 | * configure.ac (AC_INIT): Upgraded to 0.97. |
---|
| 643 | diff -Naur grub-0.97.orig/configure grub-0.97/configure |
---|
| 644 | --- grub-0.97.orig/configure 2005-05-07 19:48:12.000000000 -0700 |
---|
| 645 | +++ grub-0.97/configure 2006-07-04 00:08:05.000000000 -0700 |
---|
| 646 | @@ -311,7 +311,7 @@ |
---|
| 647 | # include <unistd.h> |
---|
| 648 | #endif" |
---|
| 649 | |
---|
| 650 | -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' |
---|
| 651 | +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' |
---|
| 652 | ac_subst_files='' |
---|
| 653 | |
---|
| 654 | # Initialize some variables set by options. |
---|
| 655 | @@ -914,6 +914,7 @@ |
---|
| 656 | set the default memory location for WD/SMC |
---|
| 657 | --enable-cs-scan=LIST probe for CS89x0 base address using LIST |
---|
| 658 | --enable-diskless enable diskless support |
---|
| 659 | + --disable-graphics disable graphics terminal support |
---|
| 660 | --disable-hercules disable hercules terminal support |
---|
| 661 | --disable-serial disable serial terminal support |
---|
| 662 | --enable-serial-speed-simulation |
---|
| 663 | @@ -5966,6 +5967,22 @@ |
---|
| 664 | fi |
---|
| 665 | |
---|
| 666 | |
---|
| 667 | +# Check whether --enable-graphics or --disable-graphics was given. |
---|
| 668 | +if test "${enable_graphics+set}" = set; then |
---|
| 669 | + enableval="$enable_graphics" |
---|
| 670 | + |
---|
| 671 | +fi; |
---|
| 672 | + |
---|
| 673 | + |
---|
| 674 | +if test "x$enable_graphics" != xno; then |
---|
| 675 | + GRAPHICS_SUPPORT_TRUE= |
---|
| 676 | + GRAPHICS_SUPPORT_FALSE='#' |
---|
| 677 | +else |
---|
| 678 | + GRAPHICS_SUPPORT_TRUE='#' |
---|
| 679 | + GRAPHICS_SUPPORT_FALSE= |
---|
| 680 | +fi |
---|
| 681 | + |
---|
| 682 | + |
---|
| 683 | # Check whether --enable-hercules or --disable-hercules was given. |
---|
| 684 | if test "${enable_hercules+set}" = set; then |
---|
| 685 | enableval="$enable_hercules" |
---|
| 686 | @@ -6270,6 +6287,13 @@ |
---|
| 687 | Usually this means the macro was only invoked conditionally." >&2;} |
---|
| 688 | { (exit 1); exit 1; }; } |
---|
| 689 | fi |
---|
| 690 | +if test -z "${GRAPHICS_SUPPORT_TRUE}" && test -z "${GRAPHICS_SUPPORT_FALSE}"; then |
---|
| 691 | + { { echo "$as_me:$LINENO: error: conditional \"GRAPHICS_SUPPORT\" was never defined. |
---|
| 692 | +Usually this means the macro was only invoked conditionally." >&5 |
---|
| 693 | +echo "$as_me: error: conditional \"GRAPHICS_SUPPORT\" was never defined. |
---|
| 694 | +Usually this means the macro was only invoked conditionally." >&2;} |
---|
| 695 | + { (exit 1); exit 1; }; } |
---|
| 696 | +fi |
---|
| 697 | if test -z "${HERCULES_SUPPORT_TRUE}" && test -z "${HERCULES_SUPPORT_FALSE}"; then |
---|
| 698 | { { echo "$as_me:$LINENO: error: conditional \"HERCULES_SUPPORT\" was never defined. |
---|
| 699 | Usually this means the macro was only invoked conditionally." >&5 |
---|
| 700 | @@ -6907,6 +6931,8 @@ |
---|
| 701 | s,@NETBOOT_SUPPORT_FALSE@,$NETBOOT_SUPPORT_FALSE,;t t |
---|
| 702 | s,@DISKLESS_SUPPORT_TRUE@,$DISKLESS_SUPPORT_TRUE,;t t |
---|
| 703 | s,@DISKLESS_SUPPORT_FALSE@,$DISKLESS_SUPPORT_FALSE,;t t |
---|
| 704 | +s,@GRAPHICS_SUPPORT_TRUE@,$GRAPHICS_SUPPORT_TRUE,;t t |
---|
| 705 | +s,@GRAPHICS_SUPPORT_FALSE@,$GRAPHICS_SUPPORT_FALSE,;t t |
---|
| 706 | s,@HERCULES_SUPPORT_TRUE@,$HERCULES_SUPPORT_TRUE,;t t |
---|
| 707 | s,@HERCULES_SUPPORT_FALSE@,$HERCULES_SUPPORT_FALSE,;t t |
---|
| 708 | s,@SERIAL_SUPPORT_TRUE@,$SERIAL_SUPPORT_TRUE,;t t |
---|
| 709 | diff -Naur grub-0.97.orig/configure.ac grub-0.97/configure.ac |
---|
| 710 | --- grub-0.97.orig/configure.ac 2005-05-07 19:36:03.000000000 -0700 |
---|
| 711 | +++ grub-0.97/configure.ac 2006-07-03 23:58:41.000000000 -0700 |
---|
| 712 | @@ -595,6 +595,11 @@ |
---|
| 713 | [ --enable-diskless enable diskless support]) |
---|
| 714 | AM_CONDITIONAL(DISKLESS_SUPPORT, test "x$enable_diskless" = xyes) |
---|
| 715 | |
---|
| 716 | +dnl Graphical splashscreen support |
---|
| 717 | +AC_ARG_ENABLE(graphics, |
---|
| 718 | + [ --disable-graphics disable graphics terminal support]) |
---|
| 719 | +AM_CONDITIONAL(GRAPHICS_SUPPORT, test "x$enable_graphics" != xno) |
---|
| 720 | + |
---|
| 721 | dnl Hercules terminal |
---|
| 722 | AC_ARG_ENABLE(hercules, |
---|
| 723 | [ --disable-hercules disable hercules terminal support]) |
---|
| 724 | diff -Naur grub-0.97.orig/docs/grub.8 grub-0.97/docs/grub.8 |
---|
| 725 | --- grub-0.97.orig/docs/grub.8 2005-05-07 19:48:56.000000000 -0700 |
---|
| 726 | +++ grub-0.97/docs/grub.8 2006-07-04 00:01:50.000000000 -0700 |
---|
| 727 | @@ -1,5 +1,5 @@ |
---|
| 728 | .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.23. |
---|
| 729 | -.TH GRUB "8" "May 2005" "grub (GNU GRUB 0.97)" FSF |
---|
| 730 | +.TH GRUB "8" "September 2005" "grub (GNU GRUB 0.97)" FSF |
---|
| 731 | .SH NAME |
---|
| 732 | grub \- the grub shell |
---|
| 733 | .SH SYNOPSIS |
---|
| 734 | diff -Naur grub-0.97.orig/docs/grub.texi grub-0.97/docs/grub.texi |
---|
| 735 | --- grub-0.97.orig/docs/grub.texi 2005-05-07 19:59:59.000000000 -0700 |
---|
| 736 | +++ grub-0.97/docs/grub.texi 2006-07-04 00:00:54.000000000 -0700 |
---|
| 737 | @@ -2199,6 +2199,7 @@ |
---|
| 738 | * rarp:: Initialize a network device via RARP |
---|
| 739 | * serial:: Set up a serial device |
---|
| 740 | * setkey:: Configure the key map |
---|
| 741 | +* splashimage:: Use a splash image |
---|
| 742 | * terminal:: Choose a terminal |
---|
| 743 | * terminfo:: Define escape sequences for a terminal |
---|
| 744 | * tftpserver:: Specify a TFTP server |
---|
| 745 | @@ -2578,6 +2579,16 @@ |
---|
| 746 | @end deffn |
---|
| 747 | |
---|
| 748 | |
---|
| 749 | +@node splashimage |
---|
| 750 | +@subsection splashimage |
---|
| 751 | + |
---|
| 752 | +@deffn Command splashimage file |
---|
| 753 | +Select an image to use as the background image. This should be |
---|
| 754 | +specified using normal GRUB device naming syntax. The format of the |
---|
| 755 | +file is a gzipped xpm which is 640x480 with a 14 color palette. |
---|
| 756 | +@end deffn |
---|
| 757 | + |
---|
| 758 | + |
---|
| 759 | @node terminal |
---|
| 760 | @subsection terminal |
---|
| 761 | |
---|
| 762 | @@ -2685,6 +2696,7 @@ |
---|
| 763 | * module:: Load a module |
---|
| 764 | * modulenounzip:: Load a module without decompression |
---|
| 765 | * pause:: Wait for a key press |
---|
| 766 | +* print:: Print a message |
---|
| 767 | * quit:: Exit from the grub shell |
---|
| 768 | * reboot:: Reboot your computer |
---|
| 769 | * read:: Read data from memory |
---|
| 770 | @@ -3091,6 +3103,16 @@ |
---|
| 771 | @end deffn |
---|
| 772 | |
---|
| 773 | |
---|
| 774 | +@node print |
---|
| 775 | +@subsection print |
---|
| 776 | + |
---|
| 777 | +@deffn Command print message @dots{} |
---|
| 778 | +Print the @var{message}. Note that placing @key{^G} (ASCII code 7) in the |
---|
| 779 | +message will cause the speaker to emit the standard beep sound, which is |
---|
| 780 | +useful for visually impaired people. |
---|
| 781 | +@end deffn |
---|
| 782 | + |
---|
| 783 | + |
---|
| 784 | @node quit |
---|
| 785 | @subsection quit |
---|
| 786 | |
---|
| 787 | diff -Naur grub-0.97.orig/docs/multiboot.texi grub-0.97/docs/multiboot.texi |
---|
| 788 | --- grub-0.97.orig/docs/multiboot.texi 2003-07-09 04:45:36.000000000 -0700 |
---|
| 789 | +++ grub-0.97/docs/multiboot.texi 2006-07-04 00:01:50.000000000 -0700 |
---|
| 790 | @@ -25,7 +25,7 @@ |
---|
| 791 | @ifinfo |
---|
| 792 | Copyright @copyright{} 1995, 96 Bryan Ford <baford@@cs.utah.edu> |
---|
| 793 | Copyright @copyright{} 1995, 96 Erich Stefan Boleyn <erich@@uruk.org> |
---|
| 794 | -Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
---|
| 795 | +Copyright @copyright{} 1999, 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc. |
---|
| 796 | |
---|
| 797 | Permission is granted to make and distribute verbatim copies of |
---|
| 798 | this manual provided the copyright notice and this permission notice |
---|
| 799 | @@ -57,7 +57,7 @@ |
---|
| 800 | @vskip 0pt plus 1filll |
---|
| 801 | Copyright @copyright{} 1995, 96 Bryan Ford <baford@@cs.utah.edu> |
---|
| 802 | Copyright @copyright{} 1995, 96 Erich Stefan Boleyn <erich@@uruk.org> |
---|
| 803 | -Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc. |
---|
| 804 | +Copyright @copyright{} 1999, 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc. |
---|
| 805 | |
---|
| 806 | Permission is granted to make and distribute verbatim copies of |
---|
| 807 | this manual provided the copyright notice and this permission notice |
---|
| 808 | @@ -80,7 +80,7 @@ |
---|
| 809 | @top Multiboot Specification |
---|
| 810 | |
---|
| 811 | This file documents Multiboot Specification, the proposal for the boot |
---|
| 812 | -sequence standard. This edition documents version 0.6.93. |
---|
| 813 | +sequence standard. This edition documents version 0.6.94. |
---|
| 814 | @end ifnottex |
---|
| 815 | |
---|
| 816 | @menu |
---|
| 817 | @@ -426,7 +426,7 @@ |
---|
| 818 | kernel. |
---|
| 819 | |
---|
| 820 | If bit 16 in the @samp{flags} word is set, then the fields at offsets |
---|
| 821 | -8-24 in the Multiboot header are valid, and the boot loader should use |
---|
| 822 | +12-28 in the Multiboot header are valid, and the boot loader should use |
---|
| 823 | them instead of the fields in the actual executable header to calculate |
---|
| 824 | where to load the OS image. This information does not need to be |
---|
| 825 | provided if the kernel image is in @sc{elf} format, but it @emph{must} |
---|
| 826 | @@ -677,7 +677,7 @@ |
---|
| 827 | @example |
---|
| 828 | @group |
---|
| 829 | +-------+-------+-------+-------+ |
---|
| 830 | -| drive | part1 | part2 | part3 | |
---|
| 831 | +| part3 | part2 | part1 | drive | |
---|
| 832 | +-------+-------+-------+-------+ |
---|
| 833 | @end group |
---|
| 834 | @end example |
---|
| 835 | @@ -1199,6 +1199,13 @@ |
---|
| 836 | @email{bug-grub@@gnu.org}, from Bryan Ford and Erich Stefan Boleyn. |
---|
| 837 | @end itemize |
---|
| 838 | |
---|
| 839 | +@item |
---|
| 840 | +The byte order of the @samp{boot_device} in Multiboot information is |
---|
| 841 | +reversed. This was a mistake. |
---|
| 842 | + |
---|
| 843 | +@item |
---|
| 844 | +The offset of the address fields were wrong. |
---|
| 845 | + |
---|
| 846 | @item 0.6 |
---|
| 847 | @itemize @bullet |
---|
| 848 | @item |
---|
| 849 | diff -Naur grub-0.97.orig/grub/asmstub.c grub-0.97/grub/asmstub.c |
---|
| 850 | --- grub-0.97.orig/grub/asmstub.c 2005-02-16 12:45:14.000000000 -0800 |
---|
| 851 | +++ grub-0.97/grub/asmstub.c 2006-07-04 00:01:50.000000000 -0700 |
---|
| 852 | @@ -42,6 +42,12 @@ |
---|
| 853 | #include <sys/time.h> |
---|
| 854 | #include <termios.h> |
---|
| 855 | #include <signal.h> |
---|
| 856 | +#include <sys/mman.h> |
---|
| 857 | + |
---|
| 858 | +#include <limits.h> |
---|
| 859 | +#ifndef PAGESIZE |
---|
| 860 | +#define PAGESIZE 4096 |
---|
| 861 | +#endif |
---|
| 862 | |
---|
| 863 | #ifdef __linux__ |
---|
| 864 | # include <sys/ioctl.h> /* ioctl */ |
---|
| 865 | @@ -55,6 +61,10 @@ |
---|
| 866 | # endif /* ! BLKFLSBUF */ |
---|
| 867 | #endif /* __linux__ */ |
---|
| 868 | |
---|
| 869 | +#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__) |
---|
| 870 | +# include <sys/sysctl.h> |
---|
| 871 | +#endif |
---|
| 872 | + |
---|
| 873 | /* We want to prevent any circularararity in our stubs, as well as |
---|
| 874 | libc name clashes. */ |
---|
| 875 | #define WITHOUT_LIBC_STUBS 1 |
---|
| 876 | @@ -144,6 +154,22 @@ |
---|
| 877 | assert (grub_scratch_mem == 0); |
---|
| 878 | scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15); |
---|
| 879 | assert (scratch); |
---|
| 880 | + |
---|
| 881 | + { |
---|
| 882 | + char *p; |
---|
| 883 | + int ret; |
---|
| 884 | + |
---|
| 885 | + /* Align to a multiple of PAGESIZE, assumed to be a power of two. */ |
---|
| 886 | + p = (char *) (((long) scratch) & ~(PAGESIZE - 1)); |
---|
| 887 | + |
---|
| 888 | + /* The simulated stack needs to be executable, since GCC uses stack |
---|
| 889 | + * trampolines to implement nested functions. |
---|
| 890 | + */ |
---|
| 891 | + ret = mprotect (p, 0x100000 + EXTENDED_MEMSIZE + 15, |
---|
| 892 | + PROT_READ | PROT_WRITE | PROT_EXEC); |
---|
| 893 | + assert (ret == 0); |
---|
| 894 | + } |
---|
| 895 | + |
---|
| 896 | grub_scratch_mem = (char *) ((((int) scratch) >> 4) << 4); |
---|
| 897 | |
---|
| 898 | /* FIXME: simulate the memory holes using mprot, if available. */ |
---|
| 899 | @@ -777,7 +803,39 @@ |
---|
| 900 | |
---|
| 901 | /* Open read/write, or read-only if that failed. */ |
---|
| 902 | if (! read_only) |
---|
| 903 | - disks[drive].flags = open (devname, O_RDWR); |
---|
| 904 | + { |
---|
| 905 | +/* By default, kernel of FreeBSD does not allow overwriting MBR */ |
---|
| 906 | +#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__) |
---|
| 907 | +#define GEOM_SYSCTL "kern.geom.debugflags" |
---|
| 908 | + int old_flags, flags; |
---|
| 909 | + size_t sizeof_int = sizeof (int); |
---|
| 910 | + |
---|
| 911 | + if (sysctlbyname (GEOM_SYSCTL, &old_flags, &sizeof_int, NULL, 0) != 0) |
---|
| 912 | + grub_printf ("failed to get " GEOM_SYSCTL "sysctl: %s\n", strerror (errno)); |
---|
| 913 | + |
---|
| 914 | + if ((old_flags & 0x10) == 0) |
---|
| 915 | + { |
---|
| 916 | + /* "allow foot shooting", see geom(4) */ |
---|
| 917 | + flags = old_flags | 0x10; |
---|
| 918 | + |
---|
| 919 | + if (sysctlbyname (GEOM_SYSCTL, NULL, NULL, &flags, sizeof (int)) != 0) |
---|
| 920 | + { |
---|
| 921 | + flags = old_flags; |
---|
| 922 | + grub_printf ("failed to set " GEOM_SYSCTL "sysctl: %s\n", strerror (errno)); |
---|
| 923 | + } |
---|
| 924 | + } |
---|
| 925 | + else |
---|
| 926 | + flags = old_flags; |
---|
| 927 | +#endif |
---|
| 928 | + disks[drive].flags = open (devname, O_RDWR); |
---|
| 929 | +#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__) |
---|
| 930 | + if (flags != old_flags) |
---|
| 931 | + { |
---|
| 932 | + if (sysctlbyname (GEOM_SYSCTL, NULL, NULL, &old_flags, sizeof (int)) != 0) |
---|
| 933 | + grub_printf ("failed to set " GEOM_SYSCTL "sysctl: %s\n", strerror (errno)); |
---|
| 934 | + } |
---|
| 935 | +#endif |
---|
| 936 | + } |
---|
| 937 | |
---|
| 938 | if (disks[drive].flags == -1) |
---|
| 939 | { |
---|
| 940 | diff -Naur grub-0.97.orig/grub/main.c grub-0.97/grub/main.c |
---|
| 941 | --- grub-0.97.orig/grub/main.c 2003-07-09 04:45:36.000000000 -0700 |
---|
| 942 | +++ grub-0.97/grub/main.c 2006-07-04 00:01:50.000000000 -0700 |
---|
| 943 | @@ -32,6 +32,7 @@ |
---|
| 944 | #define WITHOUT_LIBC_STUBS 1 |
---|
| 945 | #include <shared.h> |
---|
| 946 | #include <term.h> |
---|
| 947 | +#include <device.h> |
---|
| 948 | |
---|
| 949 | char *program_name = 0; |
---|
| 950 | int use_config_file = 1; |
---|
| 951 | @@ -192,6 +193,12 @@ |
---|
| 952 | perror ("strtoul"); |
---|
| 953 | exit (1); |
---|
| 954 | } |
---|
| 955 | + if (boot_drive >= NUM_DISKS) |
---|
| 956 | + { |
---|
| 957 | + fprintf (stderr, "boot_drive should be from 0 to %d\n", |
---|
| 958 | + NUM_DISKS - 1); |
---|
| 959 | + exit (1); |
---|
| 960 | + } |
---|
| 961 | break; |
---|
| 962 | |
---|
| 963 | case OPT_NO_CONFIG_FILE: |
---|
| 964 | diff -Naur grub-0.97.orig/lib/device.c grub-0.97/lib/device.c |
---|
| 965 | --- grub-0.97.orig/lib/device.c 2005-03-27 15:14:25.000000000 -0800 |
---|
| 966 | +++ grub-0.97/lib/device.c 2006-07-04 00:00:44.000000000 -0700 |
---|
| 967 | @@ -131,6 +131,152 @@ |
---|
| 968 | #include <shared.h> |
---|
| 969 | #include <device.h> |
---|
| 970 | |
---|
| 971 | +#if defined(__linux__) |
---|
| 972 | +/* The 2.6 kernel has removed all of the geometry handling for IDE drives |
---|
| 973 | + * that did fixups for LBA, etc. This means that the geometry we get |
---|
| 974 | + * with the ioctl has a good chance of being wrong. So, we get to |
---|
| 975 | + * also know about partition tables and try to read what the geometry |
---|
| 976 | + * is there. *grumble* Very closely based on code from cfdisk |
---|
| 977 | + */ |
---|
| 978 | +static void get_kernel_geometry(int fd, long long *cyl, int *heads, int *sectors) { |
---|
| 979 | + struct hd_geometry hdg; |
---|
| 980 | + |
---|
| 981 | + if (ioctl (fd, HDIO_GETGEO, &hdg)) |
---|
| 982 | + return; |
---|
| 983 | + |
---|
| 984 | + *cyl = hdg.cylinders; |
---|
| 985 | + *heads = hdg.heads; |
---|
| 986 | + *sectors = hdg.sectors; |
---|
| 987 | +} |
---|
| 988 | + |
---|
| 989 | +struct partition { |
---|
| 990 | + unsigned char boot_ind; /* 0x80 - active */ |
---|
| 991 | + unsigned char head; /* starting head */ |
---|
| 992 | + unsigned char sector; /* starting sector */ |
---|
| 993 | + unsigned char cyl; /* starting cylinder */ |
---|
| 994 | + unsigned char sys_ind; /* What partition type */ |
---|
| 995 | + unsigned char end_head; /* end head */ |
---|
| 996 | + unsigned char end_sector; /* end sector */ |
---|
| 997 | + unsigned char end_cyl; /* end cylinder */ |
---|
| 998 | + unsigned char start4[4]; /* starting sector counting from 0 */ |
---|
| 999 | + unsigned char size4[4]; /* nr of sectors in partition */ |
---|
| 1000 | +}; |
---|
| 1001 | + |
---|
| 1002 | +#define ALIGNMENT 2 |
---|
| 1003 | +typedef union { |
---|
| 1004 | + struct { |
---|
| 1005 | + unsigned char align[ALIGNMENT]; |
---|
| 1006 | + unsigned char b[SECTOR_SIZE]; |
---|
| 1007 | + } c; |
---|
| 1008 | + struct { |
---|
| 1009 | + unsigned char align[ALIGNMENT]; |
---|
| 1010 | + unsigned char buffer[0x1BE]; |
---|
| 1011 | + struct partition part[4]; |
---|
| 1012 | + unsigned char magicflag[2]; |
---|
| 1013 | + } p; |
---|
| 1014 | +} partition_table; |
---|
| 1015 | + |
---|
| 1016 | +#define PART_TABLE_FLAG0 0x55 |
---|
| 1017 | +#define PART_TABLE_FLAG1 0xAA |
---|
| 1018 | + |
---|
| 1019 | +static void |
---|
| 1020 | +get_partition_table_geometry(partition_table *bufp, long long *cyl, int *heads, |
---|
| 1021 | + int *sectors) { |
---|
| 1022 | + struct partition *p; |
---|
| 1023 | + int i,h,s,hh,ss; |
---|
| 1024 | + int first = 1; |
---|
| 1025 | + int bad = 0; |
---|
| 1026 | + |
---|
| 1027 | + if (bufp->p.magicflag[0] != PART_TABLE_FLAG0 || |
---|
| 1028 | + bufp->p.magicflag[1] != PART_TABLE_FLAG1) { |
---|
| 1029 | + /* Matthew Wilcox: slightly friendlier version of |
---|
| 1030 | + fatal(_("Bad signature on partition table"), 3); |
---|
| 1031 | + */ |
---|
| 1032 | + fprintf(stderr, "Unknown partition table signature\n"); |
---|
| 1033 | + return; |
---|
| 1034 | + } |
---|
| 1035 | + |
---|
| 1036 | + hh = ss = 0; |
---|
| 1037 | + for (i=0; i<4; i++) { |
---|
| 1038 | + p = &(bufp->p.part[i]); |
---|
| 1039 | + if (p->sys_ind != 0) { |
---|
| 1040 | + h = p->end_head + 1; |
---|
| 1041 | + s = (p->end_sector & 077); |
---|
| 1042 | + if (first) { |
---|
| 1043 | + hh = h; |
---|
| 1044 | + ss = s; |
---|
| 1045 | + first = 0; |
---|
| 1046 | + } else if (hh != h || ss != s) |
---|
| 1047 | + bad = 1; |
---|
| 1048 | + } |
---|
| 1049 | + } |
---|
| 1050 | + |
---|
| 1051 | + if (!first && !bad) { |
---|
| 1052 | + *heads = hh; |
---|
| 1053 | + *sectors = ss; |
---|
| 1054 | + } |
---|
| 1055 | +} |
---|
| 1056 | + |
---|
| 1057 | +static long long my_lseek (unsigned int fd, long long offset, |
---|
| 1058 | + unsigned int origin) |
---|
| 1059 | +{ |
---|
| 1060 | +#if defined(__linux__) && (!defined(__GLIBC__) || \ |
---|
| 1061 | + ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))) |
---|
| 1062 | + /* Maybe libc doesn't have large file support. */ |
---|
| 1063 | + loff_t offset, result; |
---|
| 1064 | + static int _llseek (uint filedes, ulong hi, ulong lo, |
---|
| 1065 | + loff_t *res, uint wh); |
---|
| 1066 | + _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo, |
---|
| 1067 | + loff_t *, res, uint, wh); |
---|
| 1068 | + |
---|
| 1069 | + if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET) < 0) |
---|
| 1070 | + return (long long) -1; |
---|
| 1071 | + return result; |
---|
| 1072 | +#else |
---|
| 1073 | + return lseek(fd, offset, SEEK_SET); |
---|
| 1074 | +#endif |
---|
| 1075 | +} |
---|
| 1076 | + |
---|
| 1077 | +static void get_linux_geometry (int fd, struct geometry *geom) { |
---|
| 1078 | + long long kern_cyl = 0; int kern_head = 0, kern_sectors = 0; |
---|
| 1079 | + long long pt_cyl = 0; int pt_head = 0, pt_sectors = 0; |
---|
| 1080 | + partition_table bufp; |
---|
| 1081 | + char *buff, *buf_unaligned; |
---|
| 1082 | + |
---|
| 1083 | + buf_unaligned = malloc(sizeof(partition_table) + 4095); |
---|
| 1084 | + buff = (char *) (((unsigned long)buf_unaligned + 4096 - 1) & |
---|
| 1085 | + (~(4096-1))); |
---|
| 1086 | + |
---|
| 1087 | + get_kernel_geometry(fd, &kern_cyl, &kern_head, &kern_sectors); |
---|
| 1088 | + |
---|
| 1089 | + if (my_lseek (fd, 0*SECTOR_SIZE, SEEK_SET) < 0) { |
---|
| 1090 | + fprintf(stderr, "Unable to seek"); |
---|
| 1091 | + } |
---|
| 1092 | + |
---|
| 1093 | + if (read(fd, buff, SECTOR_SIZE) == SECTOR_SIZE) { |
---|
| 1094 | + memcpy(bufp.c.b, buff, SECTOR_SIZE); |
---|
| 1095 | + get_partition_table_geometry(&bufp, &pt_cyl, &pt_head, &pt_sectors); |
---|
| 1096 | + } else { |
---|
| 1097 | + fprintf(stderr, "Unable to read partition table: %s\n", strerror(errno)); |
---|
| 1098 | + } |
---|
| 1099 | + |
---|
| 1100 | + if (pt_head && pt_sectors) { |
---|
| 1101 | + int cyl_size; |
---|
| 1102 | + |
---|
| 1103 | + geom->heads = pt_head; |
---|
| 1104 | + geom->sectors = pt_sectors; |
---|
| 1105 | + cyl_size = pt_head * pt_sectors; |
---|
| 1106 | + geom->cylinders = geom->total_sectors/cyl_size; |
---|
| 1107 | + } else { |
---|
| 1108 | + geom->heads = kern_head; |
---|
| 1109 | + geom->sectors = kern_sectors; |
---|
| 1110 | + geom->cylinders = kern_cyl; |
---|
| 1111 | + } |
---|
| 1112 | + |
---|
| 1113 | + return; |
---|
| 1114 | +} |
---|
| 1115 | +#endif |
---|
| 1116 | + |
---|
| 1117 | /* Get the geometry of a drive DRIVE. */ |
---|
| 1118 | void |
---|
| 1119 | get_drive_geometry (struct geometry *geom, char **map, int drive) |
---|
| 1120 | @@ -151,21 +297,16 @@ |
---|
| 1121 | #if defined(__linux__) |
---|
| 1122 | /* Linux */ |
---|
| 1123 | { |
---|
| 1124 | - struct hd_geometry hdg; |
---|
| 1125 | unsigned long nr; |
---|
| 1126 | - |
---|
| 1127 | - if (ioctl (fd, HDIO_GETGEO, &hdg)) |
---|
| 1128 | - goto fail; |
---|
| 1129 | |
---|
| 1130 | if (ioctl (fd, BLKGETSIZE, &nr)) |
---|
| 1131 | goto fail; |
---|
| 1132 | |
---|
| 1133 | /* Got the geometry, so save it. */ |
---|
| 1134 | - geom->cylinders = hdg.cylinders; |
---|
| 1135 | - geom->heads = hdg.heads; |
---|
| 1136 | - geom->sectors = hdg.sectors; |
---|
| 1137 | geom->total_sectors = nr; |
---|
| 1138 | - |
---|
| 1139 | + get_linux_geometry(fd, geom); |
---|
| 1140 | + if (!geom->heads && !geom->cylinders && !geom->sectors) |
---|
| 1141 | + goto fail; |
---|
| 1142 | goto success; |
---|
| 1143 | } |
---|
| 1144 | |
---|
| 1145 | @@ -403,6 +544,18 @@ |
---|
| 1146 | } |
---|
| 1147 | |
---|
| 1148 | static void |
---|
| 1149 | +get_cciss_disk_name (char *name, int controller, int drive) |
---|
| 1150 | +{ |
---|
| 1151 | + sprintf (name, "/dev/cciss/c%dd%d", controller, drive); |
---|
| 1152 | +} |
---|
| 1153 | + |
---|
| 1154 | +static void |
---|
| 1155 | +get_ida_disk_name (char *name, int controller, int drive) |
---|
| 1156 | +{ |
---|
| 1157 | + sprintf (name, "/dev/ida/c%dd%d", controller, drive); |
---|
| 1158 | +} |
---|
| 1159 | + |
---|
| 1160 | +static void |
---|
| 1161 | get_ataraid_disk_name (char *name, int unit) |
---|
| 1162 | { |
---|
| 1163 | sprintf (name, "/dev/ataraid/d%c", unit + '0'); |
---|
| 1164 | @@ -801,6 +954,74 @@ |
---|
| 1165 | } |
---|
| 1166 | } |
---|
| 1167 | } |
---|
| 1168 | + |
---|
| 1169 | + /* This is for CCISS, its like the DAC960 - we have |
---|
| 1170 | + /dev/cciss/<controller>d<logical drive>p<partition> |
---|
| 1171 | + |
---|
| 1172 | + It currently supports up to 3 controllers, 10 logical volumes |
---|
| 1173 | + and 10 partitions |
---|
| 1174 | + |
---|
| 1175 | + Code gratuitously copied from DAC960 above. |
---|
| 1176 | + Horms <horms@verge.net.au> 23rd July 2004 |
---|
| 1177 | + */ |
---|
| 1178 | + { |
---|
| 1179 | + int controller, drive; |
---|
| 1180 | + |
---|
| 1181 | + for (controller = 0; controller < 2; controller++) |
---|
| 1182 | + { |
---|
| 1183 | + for (drive = 0; drive < 9; drive++) |
---|
| 1184 | + { |
---|
| 1185 | + char name[24]; |
---|
| 1186 | + |
---|
| 1187 | + get_cciss_disk_name (name, controller, drive); |
---|
| 1188 | + if (check_device (name)) |
---|
| 1189 | + { |
---|
| 1190 | + (*map)[num_hd + 0x80] = strdup (name); |
---|
| 1191 | + assert ((*map)[num_hd + 0x80]); |
---|
| 1192 | + |
---|
| 1193 | + /* If the device map file is opened, write the map. */ |
---|
| 1194 | + if (fp) |
---|
| 1195 | + fprintf (fp, "(hd%d)\t%s\n", num_hd, name); |
---|
| 1196 | + |
---|
| 1197 | + num_hd++; |
---|
| 1198 | + } |
---|
| 1199 | + } |
---|
| 1200 | + } |
---|
| 1201 | + } |
---|
| 1202 | + |
---|
| 1203 | + /* This is for Compaq Smart Array, its like the DAC960 - we have |
---|
| 1204 | + /dev/ida/<controller>d<logical drive>p<partition> |
---|
| 1205 | + |
---|
| 1206 | + It currently supports up to 3 controllers, 10 logical volumes |
---|
| 1207 | + and 15 partitions |
---|
| 1208 | + |
---|
| 1209 | + Code gratuitously copied from DAC960 above. |
---|
| 1210 | + Piotr Roszatycki <dexter@debian.org> |
---|
| 1211 | + */ |
---|
| 1212 | + { |
---|
| 1213 | + int controller, drive; |
---|
| 1214 | + |
---|
| 1215 | + for (controller = 0; controller < 2; controller++) |
---|
| 1216 | + { |
---|
| 1217 | + for (drive = 0; drive < 9; drive++) |
---|
| 1218 | + { |
---|
| 1219 | + char name[24]; |
---|
| 1220 | + |
---|
| 1221 | + get_ida_disk_name (name, controller, drive); |
---|
| 1222 | + if (check_device (name)) |
---|
| 1223 | + { |
---|
| 1224 | + (*map)[num_hd + 0x80] = strdup (name); |
---|
| 1225 | + assert ((*map)[num_hd + 0x80]); |
---|
| 1226 | + |
---|
| 1227 | + /* If the device map file is opened, write the map. */ |
---|
| 1228 | + if (fp) |
---|
| 1229 | + fprintf (fp, "(hd%d)\t%s\n", num_hd, name); |
---|
| 1230 | + |
---|
| 1231 | + num_hd++; |
---|
| 1232 | + } |
---|
| 1233 | + } |
---|
| 1234 | + } |
---|
| 1235 | + } |
---|
| 1236 | #endif /* __linux__ */ |
---|
| 1237 | |
---|
| 1238 | /* OK, close the device map file if opened. */ |
---|
| 1239 | @@ -844,6 +1065,7 @@ |
---|
| 1240 | { |
---|
| 1241 | char dev[PATH_MAX]; /* XXX */ |
---|
| 1242 | int fd; |
---|
| 1243 | + off_t offset = (off_t) sector * (off_t) SECTOR_SIZE; |
---|
| 1244 | |
---|
| 1245 | if ((partition & 0x00FF00) != 0x00FF00) |
---|
| 1246 | { |
---|
| 1247 | @@ -861,8 +1083,14 @@ |
---|
| 1248 | if (strcmp (dev + strlen(dev) - 5, "/disc") == 0) |
---|
| 1249 | strcpy (dev + strlen(dev) - 5, "/part"); |
---|
| 1250 | } |
---|
| 1251 | - sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1); |
---|
| 1252 | - |
---|
| 1253 | + sprintf (dev + strlen(dev), "%s%d", |
---|
| 1254 | + /* Compaq smart and others */ |
---|
| 1255 | + (strncmp(dev, "/dev/ida/", 9) == 0 || |
---|
| 1256 | + strncmp(dev, "/dev/ataraid/", 13) == 0 || |
---|
| 1257 | + strncmp(dev, "/dev/cciss/", 11) == 0 || |
---|
| 1258 | + strncmp(dev, "/dev/rd/", 8) == 0) ? "p" : "", |
---|
| 1259 | + ((partition >> 16) & 0xFF) + 1); |
---|
| 1260 | + |
---|
| 1261 | /* Open the partition. */ |
---|
| 1262 | fd = open (dev, O_RDWR); |
---|
| 1263 | if (fd < 0) |
---|
| 1264 | @@ -870,35 +1098,13 @@ |
---|
| 1265 | errnum = ERR_NO_PART; |
---|
| 1266 | return 0; |
---|
| 1267 | } |
---|
| 1268 | - |
---|
| 1269 | -#if defined(__linux__) && (!defined(__GLIBC__) || \ |
---|
| 1270 | - ((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))) |
---|
| 1271 | - /* Maybe libc doesn't have large file support. */ |
---|
| 1272 | - { |
---|
| 1273 | - loff_t offset, result; |
---|
| 1274 | - static int _llseek (uint filedes, ulong hi, ulong lo, |
---|
| 1275 | - loff_t *res, uint wh); |
---|
| 1276 | - _syscall5 (int, _llseek, uint, filedes, ulong, hi, ulong, lo, |
---|
| 1277 | - loff_t *, res, uint, wh); |
---|
| 1278 | |
---|
| 1279 | - offset = (loff_t) sector * (loff_t) SECTOR_SIZE; |
---|
| 1280 | - if (_llseek (fd, offset >> 32, offset & 0xffffffff, &result, SEEK_SET)) |
---|
| 1281 | - { |
---|
| 1282 | - errnum = ERR_DEV_VALUES; |
---|
| 1283 | - return 0; |
---|
| 1284 | - } |
---|
| 1285 | - } |
---|
| 1286 | -#else |
---|
| 1287 | - { |
---|
| 1288 | - off_t offset = (off_t) sector * (off_t) SECTOR_SIZE; |
---|
| 1289 | |
---|
| 1290 | - if (lseek (fd, offset, SEEK_SET) != offset) |
---|
| 1291 | - { |
---|
| 1292 | - errnum = ERR_DEV_VALUES; |
---|
| 1293 | - return 0; |
---|
| 1294 | - } |
---|
| 1295 | - } |
---|
| 1296 | -#endif |
---|
| 1297 | + if (my_lseek(fd, offset, SEEK_SET) != offset) |
---|
| 1298 | + { |
---|
| 1299 | + errnum = ERR_DEV_VALUES; |
---|
| 1300 | + return 0; |
---|
| 1301 | + } |
---|
| 1302 | |
---|
| 1303 | if (write (fd, buf, size * SECTOR_SIZE) != (size * SECTOR_SIZE)) |
---|
| 1304 | { |
---|
| 1305 | diff -Naur grub-0.97.orig/stage2/asm.S grub-0.97/stage2/asm.S |
---|
| 1306 | --- grub-0.97.orig/stage2/asm.S 2004-06-19 09:55:22.000000000 -0700 |
---|
| 1307 | +++ grub-0.97/stage2/asm.S 2006-07-04 00:01:19.000000000 -0700 |
---|
| 1308 | @@ -1651,7 +1651,29 @@ |
---|
| 1309 | jnz 3f |
---|
| 1310 | ret |
---|
| 1311 | |
---|
| 1312 | -3: /* use keyboard controller */ |
---|
| 1313 | +3: /* |
---|
| 1314 | + * try to switch gateA20 using PORT92, the "Fast A20 and Init" |
---|
| 1315 | + * register |
---|
| 1316 | + */ |
---|
| 1317 | + mov $0x92, %dx |
---|
| 1318 | + inb %dx, %al |
---|
| 1319 | + /* skip the port92 code if it's unimplemented (read returns 0xff) */ |
---|
| 1320 | + cmpb $0xff, %al |
---|
| 1321 | + jz 6f |
---|
| 1322 | + |
---|
| 1323 | + /* set or clear bit1, the ALT_A20_GATE bit */ |
---|
| 1324 | + movb 4(%esp), %ah |
---|
| 1325 | + testb %ah, %ah |
---|
| 1326 | + jz 4f |
---|
| 1327 | + orb $2, %al |
---|
| 1328 | + jmp 5f |
---|
| 1329 | +4: and $0xfd, %al |
---|
| 1330 | + |
---|
| 1331 | + /* clear the INIT_NOW bit don't accidently reset the machine */ |
---|
| 1332 | +5: and $0xfe, %al |
---|
| 1333 | + outb %al, %dx |
---|
| 1334 | + |
---|
| 1335 | +6: /* use keyboard controller */ |
---|
| 1336 | pushl %eax |
---|
| 1337 | |
---|
| 1338 | call gloop1 |
---|
| 1339 | @@ -1661,9 +1683,12 @@ |
---|
| 1340 | |
---|
| 1341 | gloopint1: |
---|
| 1342 | inb $K_STATUS |
---|
| 1343 | + cmpb $0xff, %al |
---|
| 1344 | + jz gloopint1_done |
---|
| 1345 | andb $K_IBUF_FUL, %al |
---|
| 1346 | jnz gloopint1 |
---|
| 1347 | |
---|
| 1348 | +gloopint1_done: |
---|
| 1349 | movb $KB_OUTPUT_MASK, %al |
---|
| 1350 | cmpb $0, 0x8(%esp) |
---|
| 1351 | jz gdoit |
---|
| 1352 | @@ -1684,6 +1709,8 @@ |
---|
| 1353 | |
---|
| 1354 | gloop1: |
---|
| 1355 | inb $K_STATUS |
---|
| 1356 | + cmpb $0xff, %al |
---|
| 1357 | + jz gloop2ret |
---|
| 1358 | andb $K_IBUF_FUL, %al |
---|
| 1359 | jnz gloop1 |
---|
| 1360 | |
---|
| 1361 | @@ -1991,6 +2018,11 @@ |
---|
| 1362 | ENTRY(console_getkey) |
---|
| 1363 | push %ebp |
---|
| 1364 | |
---|
| 1365 | +wait_for_key: |
---|
| 1366 | + call EXT_C(console_checkkey) |
---|
| 1367 | + incl %eax |
---|
| 1368 | + jz wait_for_key |
---|
| 1369 | + |
---|
| 1370 | call EXT_C(prot_to_real) |
---|
| 1371 | .code16 |
---|
| 1372 | |
---|
| 1373 | @@ -2216,7 +2248,304 @@ |
---|
| 1374 | pop %ebx |
---|
| 1375 | pop %ebp |
---|
| 1376 | ret |
---|
| 1377 | - |
---|
| 1378 | + |
---|
| 1379 | + |
---|
| 1380 | +/* graphics mode functions */ |
---|
| 1381 | +#ifdef SUPPORT_GRAPHICS |
---|
| 1382 | +VARIABLE(cursorX) |
---|
| 1383 | +.word 0 |
---|
| 1384 | +VARIABLE(cursorY) |
---|
| 1385 | +.word 0 |
---|
| 1386 | +VARIABLE(cursorCount) |
---|
| 1387 | +.word 0 |
---|
| 1388 | +VARIABLE(cursorBuf) |
---|
| 1389 | +.byte 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 |
---|
| 1390 | + |
---|
| 1391 | + |
---|
| 1392 | +/* |
---|
| 1393 | + * set_int1c_handler(void) |
---|
| 1394 | + */ |
---|
| 1395 | +ENTRY(set_int1c_handler) |
---|
| 1396 | + pushl %edi |
---|
| 1397 | + |
---|
| 1398 | + /* save the original int1c handler */ |
---|
| 1399 | + movl $0x70, %edi |
---|
| 1400 | + movw (%edi), %ax |
---|
| 1401 | + movw %ax, ABS(int1c_offset) |
---|
| 1402 | + movw 2(%edi), %ax |
---|
| 1403 | + movw %ax, ABS(int1c_segment) |
---|
| 1404 | + |
---|
| 1405 | + /* save the new int1c handler */ |
---|
| 1406 | + movw $ABS(int1c_handler), %ax |
---|
| 1407 | + movw %ax, (%edi) |
---|
| 1408 | + xorw %ax, %ax |
---|
| 1409 | + movw %ax, 2(%edi) |
---|
| 1410 | + |
---|
| 1411 | + popl %edi |
---|
| 1412 | + ret |
---|
| 1413 | + |
---|
| 1414 | + |
---|
| 1415 | +/* |
---|
| 1416 | + * unset_int1c_handler(void) |
---|
| 1417 | + */ |
---|
| 1418 | +ENTRY(unset_int1c_handler) |
---|
| 1419 | + pushl %edi |
---|
| 1420 | + |
---|
| 1421 | + /* check if int1c_handler is set */ |
---|
| 1422 | + movl $0x70, %edi |
---|
| 1423 | + movw $ABS(int1c_handler), %ax |
---|
| 1424 | + cmpw %ax, (%edi) |
---|
| 1425 | + jne int1c_1 |
---|
| 1426 | + xorw %ax, %ax |
---|
| 1427 | + cmpw %ax, 2(%edi) |
---|
| 1428 | + jne int1c_1 |
---|
| 1429 | + |
---|
| 1430 | + /* restore the original */ |
---|
| 1431 | + movw ABS(int1c_offset), %ax |
---|
| 1432 | + movw %ax, (%edi) |
---|
| 1433 | + movw ABS(int1c_segment), %ax |
---|
| 1434 | + movw %ax, 2(%edi) |
---|
| 1435 | + |
---|
| 1436 | +int1c_1: |
---|
| 1437 | + popl %edi |
---|
| 1438 | + ret |
---|
| 1439 | + |
---|
| 1440 | + |
---|
| 1441 | +/* |
---|
| 1442 | + * blinks graphics cursor |
---|
| 1443 | + */ |
---|
| 1444 | + .code16 |
---|
| 1445 | +write_data: |
---|
| 1446 | + movw $0, %ax |
---|
| 1447 | + movw %ax, %ds |
---|
| 1448 | + |
---|
| 1449 | + mov $0xA000, %ax /* video in es:di */ |
---|
| 1450 | + mov %ax, %es |
---|
| 1451 | + mov $80, %ax |
---|
| 1452 | + movw $ABS(cursorY), %si |
---|
| 1453 | + mov %ds:(%si), %bx |
---|
| 1454 | + mul %bx |
---|
| 1455 | + movw $ABS(cursorX), %si |
---|
| 1456 | + mov %ds:(%si), %bx |
---|
| 1457 | + shr $3, %bx /* %bx /= 8 */ |
---|
| 1458 | + add %bx, %ax |
---|
| 1459 | + mov %ax, %di |
---|
| 1460 | + |
---|
| 1461 | + movw $ABS(cursorBuf), %si /* fontBuf in ds:si */ |
---|
| 1462 | + |
---|
| 1463 | + /* prepare for data moving */ |
---|
| 1464 | + mov $16, %dx /* altura da fonte */ |
---|
| 1465 | + mov $80, %bx /* bytes por linha */ |
---|
| 1466 | + |
---|
| 1467 | +write_loop: |
---|
| 1468 | + movb %ds:(%si), %al |
---|
| 1469 | + xorb $0xff, %al |
---|
| 1470 | + movb %al, %ds:(%si) /* invert cursorBuf */ |
---|
| 1471 | + movb %al, %es:(%di) /* write to video */ |
---|
| 1472 | + add %bx, %di |
---|
| 1473 | + inc %si |
---|
| 1474 | + dec %dx |
---|
| 1475 | + jg write_loop |
---|
| 1476 | + ret |
---|
| 1477 | + |
---|
| 1478 | +int1c_handler: |
---|
| 1479 | + pusha |
---|
| 1480 | + mov $0, %ax |
---|
| 1481 | + mov %ax, %ds |
---|
| 1482 | + mov $ABS(cursorCount), %si |
---|
| 1483 | + mov %ds:(%si), %ax |
---|
| 1484 | + inc %ax |
---|
| 1485 | + mov %ax, %ds:(%si) |
---|
| 1486 | + cmp $9, %ax |
---|
| 1487 | + jne int1c_done |
---|
| 1488 | + |
---|
| 1489 | + mov $0, %ax |
---|
| 1490 | + mov %ax, %ds:(%si) |
---|
| 1491 | + call write_data |
---|
| 1492 | + |
---|
| 1493 | +int1c_done: |
---|
| 1494 | + popa |
---|
| 1495 | + iret |
---|
| 1496 | + /* call previous int1c handler */ |
---|
| 1497 | + /* ljmp */ |
---|
| 1498 | + .byte 0xea |
---|
| 1499 | +int1c_offset: .word 0 |
---|
| 1500 | +int1c_segment: .word 0 |
---|
| 1501 | + .code32 |
---|
| 1502 | + |
---|
| 1503 | + |
---|
| 1504 | +/* |
---|
| 1505 | + * unsigned char set_videomode(unsigned char mode) |
---|
| 1506 | + * BIOS call "INT 10H Function 0h" to set video mode |
---|
| 1507 | + * Call with %ah = 0x0 |
---|
| 1508 | + * %al = video mode |
---|
| 1509 | + * Returns old videomode. |
---|
| 1510 | + */ |
---|
| 1511 | +ENTRY(set_videomode) |
---|
| 1512 | + pushl %ebp |
---|
| 1513 | + movl %esp,%ebp |
---|
| 1514 | + pushl %ebx |
---|
| 1515 | + pushl %ecx |
---|
| 1516 | + |
---|
| 1517 | + movb 8(%ebp), %cl |
---|
| 1518 | + |
---|
| 1519 | + call EXT_C(prot_to_real) |
---|
| 1520 | + .code16 |
---|
| 1521 | + |
---|
| 1522 | + xorb %al, %al |
---|
| 1523 | + movb $0xf, %ah |
---|
| 1524 | + int $0x10 /* Get Current Video mode */ |
---|
| 1525 | + movb %al, %ch |
---|
| 1526 | + xorb %ah, %ah |
---|
| 1527 | + movb %cl, %al |
---|
| 1528 | + int $0x10 /* Set Video mode */ |
---|
| 1529 | + |
---|
| 1530 | + DATA32 call EXT_C(real_to_prot) |
---|
| 1531 | + .code32 |
---|
| 1532 | + |
---|
| 1533 | + xorl %eax, %eax |
---|
| 1534 | + movb %ch, %al |
---|
| 1535 | + |
---|
| 1536 | + popl %ecx |
---|
| 1537 | + popl %ebx |
---|
| 1538 | + popl %ebp |
---|
| 1539 | + ret |
---|
| 1540 | + |
---|
| 1541 | + |
---|
| 1542 | +/* |
---|
| 1543 | + * int get_videomode() |
---|
| 1544 | + * BIOS call "INT 10H Function 0Fh" to get current video mode |
---|
| 1545 | + * Call with %al = 0x0 |
---|
| 1546 | + * %ah = 0xF |
---|
| 1547 | + * Returns current videomode. |
---|
| 1548 | + */ |
---|
| 1549 | +ENTRY(get_videomode) |
---|
| 1550 | + pushl %ebp |
---|
| 1551 | + movl %esp,%ebp |
---|
| 1552 | + pushl %ebx |
---|
| 1553 | + pushl %ecx |
---|
| 1554 | + |
---|
| 1555 | + call EXT_C(prot_to_real) |
---|
| 1556 | + .code16 |
---|
| 1557 | + |
---|
| 1558 | + xorb %al, %al |
---|
| 1559 | + movb $0xF, %ah |
---|
| 1560 | + int $0x10 /* Get Current Video mode */ |
---|
| 1561 | + movb %al, %cl /* For now we only want display mode */ |
---|
| 1562 | + |
---|
| 1563 | + DATA32 call EXT_C(real_to_prot) |
---|
| 1564 | + .code32 |
---|
| 1565 | + |
---|
| 1566 | + xorl %eax, %eax |
---|
| 1567 | + movb %cl, %al |
---|
| 1568 | + |
---|
| 1569 | + popl %ecx |
---|
| 1570 | + popl %ebx |
---|
| 1571 | + popl %ebp |
---|
| 1572 | + ret |
---|
| 1573 | + |
---|
| 1574 | + |
---|
| 1575 | +/* |
---|
| 1576 | + * unsigned char * graphics_get_font() |
---|
| 1577 | + * BIOS call "INT 10H Function 11h" to set font |
---|
| 1578 | + * Call with %ah = 0x11 |
---|
| 1579 | + */ |
---|
| 1580 | +ENTRY(graphics_get_font) |
---|
| 1581 | + push %ebp |
---|
| 1582 | + push %ebx |
---|
| 1583 | + push %ecx |
---|
| 1584 | + push %edx |
---|
| 1585 | + |
---|
| 1586 | + call EXT_C(prot_to_real) |
---|
| 1587 | + .code16 |
---|
| 1588 | + |
---|
| 1589 | + movw $0x1130, %ax |
---|
| 1590 | + movb $6, %bh /* font 8x16 */ |
---|
| 1591 | + int $0x10 |
---|
| 1592 | + movw %bp, %dx |
---|
| 1593 | + movw %es, %cx |
---|
| 1594 | + |
---|
| 1595 | + DATA32 call EXT_C(real_to_prot) |
---|
| 1596 | + .code32 |
---|
| 1597 | + |
---|
| 1598 | + xorl %eax, %eax |
---|
| 1599 | + movw %cx, %ax |
---|
| 1600 | + shll $4, %eax |
---|
| 1601 | + movw %dx, %ax |
---|
| 1602 | + |
---|
| 1603 | + pop %edx |
---|
| 1604 | + pop %ecx |
---|
| 1605 | + pop %ebx |
---|
| 1606 | + pop %ebp |
---|
| 1607 | + ret |
---|
| 1608 | + |
---|
| 1609 | + |
---|
| 1610 | +/* |
---|
| 1611 | + * graphics_set_palette(index, red, green, blue) |
---|
| 1612 | + * BIOS call "INT 10H Function 10h" to set individual dac register |
---|
| 1613 | + * Call with %ah = 0x10 |
---|
| 1614 | + * %bx = register number |
---|
| 1615 | + * %ch = new value for green (0-63) |
---|
| 1616 | + * %cl = new value for blue (0-63) |
---|
| 1617 | + * %dh = new value for red (0-63) |
---|
| 1618 | + */ |
---|
| 1619 | + |
---|
| 1620 | +ENTRY(graphics_set_palette) |
---|
| 1621 | + push %ebp |
---|
| 1622 | + push %eax |
---|
| 1623 | + push %ebx |
---|
| 1624 | + push %ecx |
---|
| 1625 | + push %edx |
---|
| 1626 | + |
---|
| 1627 | + movw $0x3c8, %bx /* address write mode register */ |
---|
| 1628 | + |
---|
| 1629 | + /* wait vertical retrace */ |
---|
| 1630 | + movw $0x3da, %dx |
---|
| 1631 | +l1b: |
---|
| 1632 | + inb %dx, %al /* wait vertical active display */ |
---|
| 1633 | + test $8, %al |
---|
| 1634 | + jnz l1b |
---|
| 1635 | + |
---|
| 1636 | +l2b: |
---|
| 1637 | + inb %dx, %al /* wait vertical retrace */ |
---|
| 1638 | + test $8, %al |
---|
| 1639 | + jnz l2b |
---|
| 1640 | + |
---|
| 1641 | + mov %bx, %dx |
---|
| 1642 | + movb 0x18(%esp), %al /* index */ |
---|
| 1643 | + outb %al, %dx |
---|
| 1644 | + inc %dx |
---|
| 1645 | + |
---|
| 1646 | + movb 0x1c(%esp), %al /* red */ |
---|
| 1647 | + outb %al, %dx |
---|
| 1648 | + |
---|
| 1649 | + movb 0x20(%esp), %al /* green */ |
---|
| 1650 | + outb %al, %dx |
---|
| 1651 | + |
---|
| 1652 | + movb 0x24(%esp), %al /* blue */ |
---|
| 1653 | + outb %al, %dx |
---|
| 1654 | + |
---|
| 1655 | + movw 0x18(%esp), %bx |
---|
| 1656 | + |
---|
| 1657 | + call EXT_C(prot_to_real) |
---|
| 1658 | + .code16 |
---|
| 1659 | + |
---|
| 1660 | + movb %bl, %bh |
---|
| 1661 | + movw $0x1000, %ax |
---|
| 1662 | + int $0x10 |
---|
| 1663 | + |
---|
| 1664 | + DATA32 call EXT_C(real_to_prot) |
---|
| 1665 | + .code32 |
---|
| 1666 | + |
---|
| 1667 | + pop %edx |
---|
| 1668 | + pop %ecx |
---|
| 1669 | + pop %ebx |
---|
| 1670 | + pop %eax |
---|
| 1671 | + pop %ebp |
---|
| 1672 | + ret |
---|
| 1673 | +#endif /* SUPPORT_GRAPHICS */ |
---|
| 1674 | + |
---|
| 1675 | + |
---|
| 1676 | /* |
---|
| 1677 | * getrtsecs() |
---|
| 1678 | * if a seconds value can be read, read it and return it (BCD), |
---|
| 1679 | diff -Naur grub-0.97.orig/stage2/boot.c grub-0.97/stage2/boot.c |
---|
| 1680 | --- grub-0.97.orig/stage2/boot.c 2004-03-30 03:44:08.000000000 -0800 |
---|
| 1681 | +++ grub-0.97/stage2/boot.c 2006-07-04 00:01:50.000000000 -0700 |
---|
| 1682 | @@ -1,7 +1,7 @@ |
---|
| 1683 | /* boot.c - load and bootstrap a kernel */ |
---|
| 1684 | /* |
---|
| 1685 | * GRUB -- GRand Unified Bootloader |
---|
| 1686 | - * Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc. |
---|
| 1687 | + * Copyright (C) 1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc. |
---|
| 1688 | * |
---|
| 1689 | * This program is free software; you can redistribute it and/or modify |
---|
| 1690 | * it under the terms of the GNU General Public License as published by |
---|
| 1691 | @@ -29,6 +29,8 @@ |
---|
| 1692 | entry_func entry_addr; |
---|
| 1693 | static struct mod_list mll[99]; |
---|
| 1694 | static int linux_mem_size; |
---|
| 1695 | +static int elf_kernel_addr; |
---|
| 1696 | +static int elf_kernel_size; |
---|
| 1697 | |
---|
| 1698 | /* |
---|
| 1699 | * The next two functions, 'load_image' and 'load_module', are the building |
---|
| 1700 | @@ -96,7 +98,7 @@ |
---|
| 1701 | lh = (struct linux_kernel_header *) buffer; |
---|
| 1702 | |
---|
| 1703 | /* ELF loading supported if multiboot, FreeBSD and NetBSD. */ |
---|
| 1704 | - if ((type == KERNEL_TYPE_MULTIBOOT |
---|
| 1705 | + if (((type == KERNEL_TYPE_MULTIBOOT && ! (flags & MULTIBOOT_AOUT_KLUDGE)) |
---|
| 1706 | || pu.elf->e_ident[EI_OSABI] == ELFOSABI_FREEBSD |
---|
| 1707 | || grub_strcmp (pu.elf->e_ident + EI_BRAND, "FreeBSD") == 0 |
---|
| 1708 | || suggested_type == KERNEL_TYPE_NETBSD) |
---|
| 1709 | @@ -594,6 +596,7 @@ |
---|
| 1710 | |
---|
| 1711 | /* reset this to zero for now */ |
---|
| 1712 | cur_addr = 0; |
---|
| 1713 | + elf_kernel_addr = ~0; |
---|
| 1714 | |
---|
| 1715 | /* scan for program segments */ |
---|
| 1716 | for (i = 0; i < pu.elf->e_phnum; i++) |
---|
| 1717 | @@ -630,6 +633,8 @@ |
---|
| 1718 | /* mark memory as used */ |
---|
| 1719 | if (cur_addr < memaddr + memsiz) |
---|
| 1720 | cur_addr = memaddr + memsiz; |
---|
| 1721 | + if (elf_kernel_addr > cur_addr) |
---|
| 1722 | + elf_kernel_addr = cur_addr; |
---|
| 1723 | printf (", <0x%x:0x%x:0x%x>", memaddr, filesiz, |
---|
| 1724 | memsiz - filesiz); |
---|
| 1725 | /* increment number of segments */ |
---|
| 1726 | @@ -647,6 +652,8 @@ |
---|
| 1727 | } |
---|
| 1728 | } |
---|
| 1729 | |
---|
| 1730 | + elf_kernel_size = cur_addr - elf_kernel_addr; |
---|
| 1731 | + |
---|
| 1732 | if (! errnum) |
---|
| 1733 | { |
---|
| 1734 | if (! loaded) |
---|
| 1735 | @@ -824,8 +831,11 @@ |
---|
| 1736 | moveto = (mbi.mem_upper + 0x400) << 10; |
---|
| 1737 | |
---|
| 1738 | moveto = (moveto - len) & 0xfffff000; |
---|
| 1739 | - max_addr = (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0203 |
---|
| 1740 | - ? lh->initrd_addr_max : LINUX_INITRD_MAX_ADDRESS); |
---|
| 1741 | + max_addr = LINUX_INITRD_MAX_ADDRESS; |
---|
| 1742 | + if (lh->header == LINUX_MAGIC_SIGNATURE && |
---|
| 1743 | + lh->version >= 0x0203 && |
---|
| 1744 | + lh->initrd_addr_max < max_addr) |
---|
| 1745 | + max_addr = lh->initrd_addr_max; |
---|
| 1746 | if (moveto + len >= max_addr) |
---|
| 1747 | moveto = (max_addr - len) & 0xfffff000; |
---|
| 1748 | |
---|
| 1749 | @@ -864,6 +874,129 @@ |
---|
| 1750 | } |
---|
| 1751 | #endif |
---|
| 1752 | |
---|
| 1753 | +#define mem_align4k(p) ((p) + 0xFFF) & 0xFFFFF000 |
---|
| 1754 | + |
---|
| 1755 | +static void |
---|
| 1756 | +kfreebsd_setenv (char *env, const char *var, const char *value) |
---|
| 1757 | +{ |
---|
| 1758 | + while (1) |
---|
| 1759 | + { |
---|
| 1760 | + if (env[0] == '\0' && env[1] == '\0') |
---|
| 1761 | + { |
---|
| 1762 | + env++; |
---|
| 1763 | + break; |
---|
| 1764 | + } |
---|
| 1765 | + else |
---|
| 1766 | + env++; |
---|
| 1767 | + } |
---|
| 1768 | + |
---|
| 1769 | + grub_sprintf (env, "%s=%s", var, value); |
---|
| 1770 | + env[grub_strlen (env) + 1] = '\0'; |
---|
| 1771 | +} |
---|
| 1772 | + |
---|
| 1773 | +static char * |
---|
| 1774 | +kfreebsd_read_hints (char *buf) |
---|
| 1775 | +{ |
---|
| 1776 | + char *buf_end = buf; |
---|
| 1777 | + |
---|
| 1778 | + if (grub_open ("/boot/device.hints")) |
---|
| 1779 | + { |
---|
| 1780 | + char *line_start; |
---|
| 1781 | + int line_len = 0; |
---|
| 1782 | + char *envp; |
---|
| 1783 | + int env_len; |
---|
| 1784 | + |
---|
| 1785 | + env_len = grub_read (buf, -1); |
---|
| 1786 | + if (env_len) |
---|
| 1787 | + { |
---|
| 1788 | + buf_end += env_len; |
---|
| 1789 | + *(buf_end++) = '\0'; |
---|
| 1790 | + } |
---|
| 1791 | + else |
---|
| 1792 | + return buf_end; |
---|
| 1793 | + |
---|
| 1794 | + grub_close (); |
---|
| 1795 | + |
---|
| 1796 | + envp = line_start = buf; |
---|
| 1797 | + while (*envp) |
---|
| 1798 | + { |
---|
| 1799 | + char *envp_current = envp; |
---|
| 1800 | + |
---|
| 1801 | + switch (*envp) |
---|
| 1802 | + { |
---|
| 1803 | + case ' ': |
---|
| 1804 | + while (*envp == ' ') |
---|
| 1805 | + { |
---|
| 1806 | + envp++; |
---|
| 1807 | + env_len--; |
---|
| 1808 | + } |
---|
| 1809 | + grub_memmove (envp_current, envp, env_len + 1); |
---|
| 1810 | + envp = envp_current; |
---|
| 1811 | + break; |
---|
| 1812 | + case '#': |
---|
| 1813 | + while (*envp != '\n') |
---|
| 1814 | + { |
---|
| 1815 | + envp++; |
---|
| 1816 | + env_len--; |
---|
| 1817 | + } |
---|
| 1818 | + if (!line_len) |
---|
| 1819 | + envp++; |
---|
| 1820 | + grub_memmove (envp_current, envp, env_len + 1); |
---|
| 1821 | + envp = envp_current; |
---|
| 1822 | + break; |
---|
| 1823 | + case '\n': |
---|
| 1824 | + if (!line_len) |
---|
| 1825 | + { |
---|
| 1826 | + env_len--; |
---|
| 1827 | + grub_memmove (line_start, envp, env_len + 1); |
---|
| 1828 | + } |
---|
| 1829 | + *(envp++) = '\0'; |
---|
| 1830 | + line_len = 0; |
---|
| 1831 | + line_start = envp; |
---|
| 1832 | + default: |
---|
| 1833 | + envp++; |
---|
| 1834 | + line_len++; |
---|
| 1835 | + break; |
---|
| 1836 | + } |
---|
| 1837 | + } |
---|
| 1838 | + |
---|
| 1839 | + buf_end = buf + env_len; |
---|
| 1840 | + *(buf_end++) = '\0'; |
---|
| 1841 | + } |
---|
| 1842 | + |
---|
| 1843 | + return buf_end; |
---|
| 1844 | +} |
---|
| 1845 | + |
---|
| 1846 | +static u32_t * |
---|
| 1847 | +kfreebsd_set_module_string (u32_t type, u32_t *dst, char *src) |
---|
| 1848 | +{ |
---|
| 1849 | + int size; |
---|
| 1850 | + |
---|
| 1851 | + *(dst++) = type; |
---|
| 1852 | + *(dst++) = size = grub_strlen (src) + 1; |
---|
| 1853 | + grub_strcpy ((void *) dst, src); |
---|
| 1854 | + |
---|
| 1855 | + return dst + (size + sizeof(u32_t) - 1) / sizeof(u32_t); |
---|
| 1856 | +} |
---|
| 1857 | + |
---|
| 1858 | +static u32_t * |
---|
| 1859 | +kfreebsd_set_module_var (u32_t type, u32_t *dst, u32_t src) |
---|
| 1860 | +{ |
---|
| 1861 | + *(dst++) = type; |
---|
| 1862 | + *(dst++) = sizeof(u32_t); |
---|
| 1863 | + *(dst++) = src; |
---|
| 1864 | + |
---|
| 1865 | + return dst; |
---|
| 1866 | +} |
---|
| 1867 | + |
---|
| 1868 | +static u32_t * |
---|
| 1869 | +kfreebsd_set_modules (u32_t *modulep) |
---|
| 1870 | +{ |
---|
| 1871 | + /* XXX: Need to copy the whole module structure. */ |
---|
| 1872 | + /* XXX: How to pass the module name ? */ |
---|
| 1873 | + |
---|
| 1874 | + return modulep; |
---|
| 1875 | +} |
---|
| 1876 | |
---|
| 1877 | /* |
---|
| 1878 | * All "*_boot" commands depend on the images being loaded into memory |
---|
| 1879 | @@ -877,7 +1010,10 @@ |
---|
| 1880 | bsd_boot (kernel_t type, int bootdev, char *arg) |
---|
| 1881 | { |
---|
| 1882 | char *str; |
---|
| 1883 | - int clval = 0, i; |
---|
| 1884 | + char *kernelname; |
---|
| 1885 | + char *bsd_root; |
---|
| 1886 | + int clval = 0; |
---|
| 1887 | + int i; |
---|
| 1888 | struct bootinfo bi; |
---|
| 1889 | |
---|
| 1890 | #ifdef GRUB_UTIL |
---|
| 1891 | @@ -886,8 +1022,21 @@ |
---|
| 1892 | stop_floppy (); |
---|
| 1893 | #endif |
---|
| 1894 | |
---|
| 1895 | + while (*arg != '/') |
---|
| 1896 | + arg++; |
---|
| 1897 | + kernelname = arg; |
---|
| 1898 | + |
---|
| 1899 | while (*(++arg) && *arg != ' '); |
---|
| 1900 | + *(arg++) = 0; |
---|
| 1901 | str = arg; |
---|
| 1902 | + |
---|
| 1903 | + bsd_root = grub_strstr (str, "root="); |
---|
| 1904 | + if (bsd_root) |
---|
| 1905 | + { |
---|
| 1906 | + bsd_root += 5; |
---|
| 1907 | + /* XXX: should copy the str or terminate it. */ |
---|
| 1908 | + } |
---|
| 1909 | + |
---|
| 1910 | while (*str) |
---|
| 1911 | { |
---|
| 1912 | if (*str == '-') |
---|
| 1913 | @@ -910,6 +1059,8 @@ |
---|
| 1914 | clval |= RB_GDB; |
---|
| 1915 | if (*str == 'h') |
---|
| 1916 | clval |= RB_SERIAL; |
---|
| 1917 | + if (*str == 'p') |
---|
| 1918 | + clval |= RB_PAUSE; |
---|
| 1919 | if (*str == 'm') |
---|
| 1920 | clval |= RB_MUTE; |
---|
| 1921 | if (*str == 'r') |
---|
| 1922 | @@ -927,14 +1078,17 @@ |
---|
| 1923 | |
---|
| 1924 | if (type == KERNEL_TYPE_FREEBSD) |
---|
| 1925 | { |
---|
| 1926 | + char *envp; |
---|
| 1927 | + u32_t *modp; |
---|
| 1928 | + |
---|
| 1929 | clval |= RB_BOOTINFO; |
---|
| 1930 | |
---|
| 1931 | bi.bi_version = BOOTINFO_VERSION; |
---|
| 1932 | |
---|
| 1933 | - *arg = 0; |
---|
| 1934 | - while ((--arg) > (char *) MB_CMDLINE_BUF && *arg != '/'); |
---|
| 1935 | - if (*arg == '/') |
---|
| 1936 | - bi.bi_kernelname = arg + 1; |
---|
| 1937 | + bi.bi_pad[0] = bi.bi_pad[1] = 0; |
---|
| 1938 | + |
---|
| 1939 | + if (*kernelname == '/') |
---|
| 1940 | + bi.bi_kernelname = kernelname; |
---|
| 1941 | else |
---|
| 1942 | bi.bi_kernelname = 0; |
---|
| 1943 | |
---|
| 1944 | @@ -961,6 +1115,30 @@ |
---|
| 1945 | bi.bi_basemem = mbi.mem_lower; |
---|
| 1946 | bi.bi_extmem = extended_memory; |
---|
| 1947 | |
---|
| 1948 | + /* Setup the environment. */ |
---|
| 1949 | + bi.bi_envp = cur_addr = mem_align4k (cur_addr); |
---|
| 1950 | + grub_memset ((void *) cur_addr, 0, 2); |
---|
| 1951 | + cur_addr = (int) kfreebsd_read_hints ((void *) cur_addr); |
---|
| 1952 | + |
---|
| 1953 | + envp = (char *) bi.bi_envp; |
---|
| 1954 | + kfreebsd_setenv (envp, "kernelname", kernelname); |
---|
| 1955 | + kfreebsd_setenv (envp, "vfs.root.mountfrom", bsd_root); |
---|
| 1956 | + |
---|
| 1957 | + /* Setup the modules list. */ |
---|
| 1958 | + bi.bi_modulep = cur_addr = mem_align4k (cur_addr); |
---|
| 1959 | + modp = (u32_t *) bi.bi_modulep; |
---|
| 1960 | + /* The first module is the kernel. */ |
---|
| 1961 | + modp = kfreebsd_set_module_string (MODINFO_NAME, modp, kernelname); |
---|
| 1962 | + modp = kfreebsd_set_module_string (MODINFO_TYPE, modp, "elf kernel"); |
---|
| 1963 | + modp = kfreebsd_set_module_string (MODINFO_ARGS, modp, arg); |
---|
| 1964 | + modp = kfreebsd_set_module_var (MODINFO_ADDR, modp, elf_kernel_addr); |
---|
| 1965 | + modp = kfreebsd_set_module_var (MODINFO_SIZE, modp, elf_kernel_size); |
---|
| 1966 | + /* Now the real modules. */ |
---|
| 1967 | + modp = kfreebsd_set_modules(modp); |
---|
| 1968 | + |
---|
| 1969 | + /* Set the kernel end. */ |
---|
| 1970 | + bi.bi_kernend = cur_addr = mem_align4k (((int) modp) + 1); |
---|
| 1971 | + |
---|
| 1972 | if (mbi.flags & MB_INFO_AOUT_SYMS) |
---|
| 1973 | { |
---|
| 1974 | bi.bi_symtab = mbi.syms.a.addr; |
---|
| 1975 | @@ -970,8 +1148,9 @@ |
---|
| 1976 | #if 0 |
---|
| 1977 | else if (mbi.flags & MB_INFO_ELF_SHDR) |
---|
| 1978 | { |
---|
| 1979 | - /* FIXME: Should check if a symbol table exists and, if exists, |
---|
| 1980 | - pass the table to BI. */ |
---|
| 1981 | + bi.bi_symtab = mbi.syms.e.addr; |
---|
| 1982 | + bi.bi_esymtab = mbi.syms.e.addr |
---|
| 1983 | + + mbi.syms.e.size * mbi.syms.e.num * mbi.syms.e.shndx; |
---|
| 1984 | } |
---|
| 1985 | #endif |
---|
| 1986 | else |
---|
| 1987 | diff -Naur grub-0.97.orig/stage2/builtins.c grub-0.97/stage2/builtins.c |
---|
| 1988 | --- grub-0.97.orig/stage2/builtins.c 2005-02-15 13:58:23.000000000 -0800 |
---|
| 1989 | +++ grub-0.97/stage2/builtins.c 2006-07-04 00:01:50.000000000 -0700 |
---|
| 1990 | @@ -28,6 +28,10 @@ |
---|
| 1991 | #include <filesys.h> |
---|
| 1992 | #include <term.h> |
---|
| 1993 | |
---|
| 1994 | +#ifdef SUPPORT_GRAPHICS |
---|
| 1995 | +# include <graphics.h> |
---|
| 1996 | +#endif |
---|
| 1997 | + |
---|
| 1998 | #ifdef SUPPORT_NETBOOT |
---|
| 1999 | # define GRUB 1 |
---|
| 2000 | # include <etherboot.h> |
---|
| 2001 | @@ -82,6 +86,10 @@ |
---|
| 2002 | inside other functions. */ |
---|
| 2003 | static int configfile_func (char *arg, int flags); |
---|
| 2004 | |
---|
| 2005 | +static int savedefault_helper (char *arg, int flags); |
---|
| 2006 | + |
---|
| 2007 | +static int savedefault_shell (char *arg, int flags); |
---|
| 2008 | + |
---|
| 2009 | /* Initialize the data for builtins. */ |
---|
| 2010 | void |
---|
| 2011 | init_builtins (void) |
---|
| 2012 | @@ -237,12 +245,22 @@ |
---|
| 2013 | static int |
---|
| 2014 | boot_func (char *arg, int flags) |
---|
| 2015 | { |
---|
| 2016 | + struct term_entry *prev_term = current_term; |
---|
| 2017 | /* Clear the int15 handler if we can boot the kernel successfully. |
---|
| 2018 | This assumes that the boot code never fails only if KERNEL_TYPE is |
---|
| 2019 | not KERNEL_TYPE_NONE. Is this assumption is bad? */ |
---|
| 2020 | if (kernel_type != KERNEL_TYPE_NONE) |
---|
| 2021 | unset_int15_handler (); |
---|
| 2022 | |
---|
| 2023 | + /* if our terminal needed initialization, we should shut it down |
---|
| 2024 | + * before booting the kernel, but we want to save what it was so |
---|
| 2025 | + * we can come back if needed */ |
---|
| 2026 | + if (current_term->shutdown) |
---|
| 2027 | + { |
---|
| 2028 | + current_term->shutdown(); |
---|
| 2029 | + current_term = term_table; /* assumption: console is first */ |
---|
| 2030 | + } |
---|
| 2031 | + |
---|
| 2032 | #ifdef SUPPORT_NETBOOT |
---|
| 2033 | /* Shut down the networking. */ |
---|
| 2034 | cleanup_net (); |
---|
| 2035 | @@ -306,6 +324,13 @@ |
---|
| 2036 | return 1; |
---|
| 2037 | } |
---|
| 2038 | |
---|
| 2039 | + /* if we get back here, we should go back to what our term was before */ |
---|
| 2040 | + current_term = prev_term; |
---|
| 2041 | + if (current_term->startup) |
---|
| 2042 | + /* if our terminal fails to initialize, fall back to console since |
---|
| 2043 | + * it should always work */ |
---|
| 2044 | + if (current_term->startup() == 0) |
---|
| 2045 | + current_term = term_table; /* we know that console is first */ |
---|
| 2046 | return 0; |
---|
| 2047 | } |
---|
| 2048 | |
---|
| 2049 | @@ -852,6 +877,251 @@ |
---|
| 2050 | }; |
---|
| 2051 | #endif /* SUPPORT_NETBOOT */ |
---|
| 2052 | |
---|
| 2053 | +#ifdef SUPPORT_GRAPHICS |
---|
| 2054 | + |
---|
| 2055 | +static int splashimage_func(char *arg, int flags) { |
---|
| 2056 | + int i; |
---|
| 2057 | + |
---|
| 2058 | + /* filename can only be 256 characters due to our buffer size */ |
---|
| 2059 | + if (grub_strlen(arg) > 256) { |
---|
| 2060 | + grub_printf("Splash image filename too large\n"); |
---|
| 2061 | + grub_printf("Press any key to continue..."); |
---|
| 2062 | + getkey(); |
---|
| 2063 | + return 1; |
---|
| 2064 | + } |
---|
| 2065 | + |
---|
| 2066 | + /* get rid of TERM_NEED_INIT from the graphics terminal. */ |
---|
| 2067 | + for (i = 0; term_table[i].name; i++) { |
---|
| 2068 | + if (grub_strcmp (term_table[i].name, "graphics") == 0) { |
---|
| 2069 | + term_table[i].flags &= ~TERM_NEED_INIT; |
---|
| 2070 | + break; |
---|
| 2071 | + } |
---|
| 2072 | + } |
---|
| 2073 | + |
---|
| 2074 | + graphics_set_splash(arg); |
---|
| 2075 | + |
---|
| 2076 | + if (flags == BUILTIN_CMDLINE && graphics_inited) { |
---|
| 2077 | + graphics_end(); |
---|
| 2078 | + if (graphics_init() == 0) { |
---|
| 2079 | + /* Fallback to default term */ |
---|
| 2080 | + current_term = term_table; |
---|
| 2081 | + max_lines = current_term->max_lines; |
---|
| 2082 | + if (current_term->cls) |
---|
| 2083 | + current_term->cls(); |
---|
| 2084 | + grub_printf("Failed to set splash image and/or graphics mode\n"); |
---|
| 2085 | + return 1; |
---|
| 2086 | + } |
---|
| 2087 | + graphics_cls(); |
---|
| 2088 | + } |
---|
| 2089 | + |
---|
| 2090 | + if (flags == BUILTIN_MENU) |
---|
| 2091 | + current_term = term_table + i; |
---|
| 2092 | + |
---|
| 2093 | + return 0; |
---|
| 2094 | +} |
---|
| 2095 | + |
---|
| 2096 | +static struct builtin builtin_splashimage = |
---|
| 2097 | +{ |
---|
| 2098 | + "splashimage", |
---|
| 2099 | + splashimage_func, |
---|
| 2100 | + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, |
---|
| 2101 | + "splashimage FILE", |
---|
| 2102 | + "Load FILE as the background image when in graphics mode." |
---|
| 2103 | +}; |
---|
| 2104 | + |
---|
| 2105 | + |
---|
| 2106 | +/* shade */ |
---|
| 2107 | +static int |
---|
| 2108 | +shade_func(char *arg, int flags) |
---|
| 2109 | +{ |
---|
| 2110 | + int new_shade; |
---|
| 2111 | + |
---|
| 2112 | + if (!arg || safe_parse_maxint(&arg, &new_shade) == 0) |
---|
| 2113 | + return (1); |
---|
| 2114 | + |
---|
| 2115 | + if (shade != new_shade) { |
---|
| 2116 | + shade = new_shade; |
---|
| 2117 | + if (flags == BUILTIN_CMDLINE && graphics_inited) { |
---|
| 2118 | + graphics_end(); |
---|
| 2119 | + graphics_init(); |
---|
| 2120 | + graphics_cls(); |
---|
| 2121 | + } |
---|
| 2122 | + } |
---|
| 2123 | + |
---|
| 2124 | + return 0; |
---|
| 2125 | +} |
---|
| 2126 | + |
---|
| 2127 | +static struct builtin builtin_shade = |
---|
| 2128 | +{ |
---|
| 2129 | + "shade", |
---|
| 2130 | + shade_func, |
---|
| 2131 | + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, |
---|
| 2132 | + "shade INTEGER", |
---|
| 2133 | + "If set to 0, disables the use of shaded text, else enables it." |
---|
| 2134 | +}; |
---|
| 2135 | + |
---|
| 2136 | + |
---|
| 2137 | +/* foreground */ |
---|
| 2138 | +static int |
---|
| 2139 | +foreground_func(char *arg, int flags) |
---|
| 2140 | +{ |
---|
| 2141 | + if (grub_strlen(arg) == 6) { |
---|
| 2142 | + int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2; |
---|
| 2143 | + int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2; |
---|
| 2144 | + int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2; |
---|
| 2145 | + |
---|
| 2146 | + foreground = (r << 16) | (g << 8) | b; |
---|
| 2147 | + if (graphics_inited) |
---|
| 2148 | + graphics_set_palette(15, r, g, b); |
---|
| 2149 | + |
---|
| 2150 | + return 0; |
---|
| 2151 | + } |
---|
| 2152 | + |
---|
| 2153 | + return 1; |
---|
| 2154 | +} |
---|
| 2155 | + |
---|
| 2156 | +static struct builtin builtin_foreground = |
---|
| 2157 | +{ |
---|
| 2158 | + "foreground", |
---|
| 2159 | + foreground_func, |
---|
| 2160 | + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, |
---|
| 2161 | + "foreground RRGGBB", |
---|
| 2162 | + "Sets the foreground color when in graphics mode." |
---|
| 2163 | + "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal." |
---|
| 2164 | +}; |
---|
| 2165 | + |
---|
| 2166 | + |
---|
| 2167 | +/* background */ |
---|
| 2168 | +static int |
---|
| 2169 | +background_func(char *arg, int flags) |
---|
| 2170 | +{ |
---|
| 2171 | + if (grub_strlen(arg) == 6) { |
---|
| 2172 | + int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2; |
---|
| 2173 | + int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2; |
---|
| 2174 | + int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2; |
---|
| 2175 | + |
---|
| 2176 | + background = (r << 16) | (g << 8) | b; |
---|
| 2177 | + if (graphics_inited) |
---|
| 2178 | + graphics_set_palette(0, r, g, b); |
---|
| 2179 | + return 0; |
---|
| 2180 | + } |
---|
| 2181 | + |
---|
| 2182 | + return 1; |
---|
| 2183 | +} |
---|
| 2184 | + |
---|
| 2185 | +static struct builtin builtin_background = |
---|
| 2186 | +{ |
---|
| 2187 | + "background", |
---|
| 2188 | + background_func, |
---|
| 2189 | + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, |
---|
| 2190 | + "background RRGGBB", |
---|
| 2191 | + "Sets the background color when in graphics mode." |
---|
| 2192 | + "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal." |
---|
| 2193 | +}; |
---|
| 2194 | + |
---|
| 2195 | + |
---|
| 2196 | +/* border */ |
---|
| 2197 | +static int |
---|
| 2198 | +border_func(char *arg, int flags) |
---|
| 2199 | +{ |
---|
| 2200 | + if (grub_strlen(arg) == 6) { |
---|
| 2201 | + int r = ((hex(arg[0]) << 4) | hex(arg[1])) >> 2; |
---|
| 2202 | + int g = ((hex(arg[2]) << 4) | hex(arg[3])) >> 2; |
---|
| 2203 | + int b = ((hex(arg[4]) << 4) | hex(arg[5])) >> 2; |
---|
| 2204 | + |
---|
| 2205 | + window_border = (r << 16) | (g << 8) | b; |
---|
| 2206 | + if (graphics_inited) |
---|
| 2207 | + graphics_set_palette(0x11, r, g, b); |
---|
| 2208 | + |
---|
| 2209 | + return 0; |
---|
| 2210 | + } |
---|
| 2211 | + |
---|
| 2212 | + return 1; |
---|
| 2213 | +} |
---|
| 2214 | + |
---|
| 2215 | +static struct builtin builtin_border = |
---|
| 2216 | +{ |
---|
| 2217 | + "border", |
---|
| 2218 | + border_func, |
---|
| 2219 | + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, |
---|
| 2220 | + "border RRGGBB", |
---|
| 2221 | + "Sets the border video color when in graphics mode." |
---|
| 2222 | + "RR is red, GG is green, and BB blue. Numbers must be in hexadecimal." |
---|
| 2223 | +}; |
---|
| 2224 | + |
---|
| 2225 | + |
---|
| 2226 | +/* viewport */ |
---|
| 2227 | +static int |
---|
| 2228 | +viewport_func (char *arg, int flags) |
---|
| 2229 | +{ |
---|
| 2230 | + int i; |
---|
| 2231 | + int x0 = 0, y0 = 0, x1 = 80, y1 = 30; |
---|
| 2232 | + int *pos[4] = { &x0, &y0, &x1, &y1 }; |
---|
| 2233 | + |
---|
| 2234 | + if (!arg) |
---|
| 2235 | + return (1); |
---|
| 2236 | + for (i = 0; i < 4; i++) { |
---|
| 2237 | + if (!*arg) |
---|
| 2238 | + return (1); |
---|
| 2239 | + while (*arg && (*arg == ' ' || *arg == '\t')) |
---|
| 2240 | + ++arg; |
---|
| 2241 | + if (!safe_parse_maxint(&arg, pos[i])) |
---|
| 2242 | + return (1); |
---|
| 2243 | + while (*arg && (*arg != ' ' && *arg != '\t')) |
---|
| 2244 | + ++arg; |
---|
| 2245 | + } |
---|
| 2246 | + |
---|
| 2247 | + /* minimum size is 65 colums and 16 rows */ |
---|
| 2248 | + if (x0 > x1 - 66 || y0 > y1 - 16 || x0 < 0 || y0 < 0 || x1 > 80 || y1 > 30) |
---|
| 2249 | + return 1; |
---|
| 2250 | + |
---|
| 2251 | + view_x0 = x0; |
---|
| 2252 | + view_y0 = y0; |
---|
| 2253 | + view_x1 = x1; |
---|
| 2254 | + view_y1 = y1; |
---|
| 2255 | + |
---|
| 2256 | + if (flags == BUILTIN_CMDLINE && graphics_inited) { |
---|
| 2257 | + graphics_end(); |
---|
| 2258 | + graphics_init(); |
---|
| 2259 | + graphics_cls(); |
---|
| 2260 | + } |
---|
| 2261 | + |
---|
| 2262 | + return 0; |
---|
| 2263 | +} |
---|
| 2264 | + |
---|
| 2265 | +static struct builtin builtin_viewport = |
---|
| 2266 | +{ |
---|
| 2267 | + "viewport", |
---|
| 2268 | + viewport_func, |
---|
| 2269 | + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_HELP_LIST, |
---|
| 2270 | + "viewport x0 y0 x1 y1", |
---|
| 2271 | + "Changes grub internals to output text in the window defined by" |
---|
| 2272 | + " four parameters. The x and y parameters are 0 based. This option" |
---|
| 2273 | + " only works with the graphics interface." |
---|
| 2274 | +}; |
---|
| 2275 | + |
---|
| 2276 | +#endif /* SUPPORT_GRAPHICS */ |
---|
| 2277 | + |
---|
| 2278 | + |
---|
| 2279 | +/* clear */ |
---|
| 2280 | +static int |
---|
| 2281 | +clear_func() |
---|
| 2282 | +{ |
---|
| 2283 | + if (current_term->cls) |
---|
| 2284 | + current_term->cls(); |
---|
| 2285 | + |
---|
| 2286 | + return 0; |
---|
| 2287 | +} |
---|
| 2288 | + |
---|
| 2289 | +static struct builtin builtin_clear = |
---|
| 2290 | +{ |
---|
| 2291 | + "clear", |
---|
| 2292 | + clear_func, |
---|
| 2293 | + BUILTIN_CMDLINE | BUILTIN_HELP_LIST, |
---|
| 2294 | + "clear", |
---|
| 2295 | + "Clear the screen" |
---|
| 2296 | +}; |
---|
| 2297 | + |
---|
| 2298 | |
---|
| 2299 | /* displayapm */ |
---|
| 2300 | static int |
---|
| 2301 | @@ -1454,14 +1724,20 @@ |
---|
| 2302 | |
---|
| 2303 | |
---|
| 2304 | /* help */ |
---|
| 2305 | -#define MAX_SHORT_DOC_LEN 39 |
---|
| 2306 | -#define MAX_LONG_DOC_LEN 66 |
---|
| 2307 | - |
---|
| 2308 | static int |
---|
| 2309 | help_func (char *arg, int flags) |
---|
| 2310 | { |
---|
| 2311 | - int all = 0; |
---|
| 2312 | - |
---|
| 2313 | + int all = 0, max_short_doc_len, max_long_doc_len; |
---|
| 2314 | + max_short_doc_len = 39; |
---|
| 2315 | + max_long_doc_len = 66; |
---|
| 2316 | +#ifdef SUPPORT_GRAPHICS |
---|
| 2317 | + if (grub_memcmp (current_term->name, "graphics", sizeof ("graphics") - 1) == 0) |
---|
| 2318 | + { |
---|
| 2319 | + max_short_doc_len = (view_x1 - view_x0 + 1) / 2 - 1; |
---|
| 2320 | + max_long_doc_len = (view_x1 - view_x0) - 14; |
---|
| 2321 | + } |
---|
| 2322 | +#endif |
---|
| 2323 | + |
---|
| 2324 | if (grub_memcmp (arg, "--all", sizeof ("--all") - 1) == 0) |
---|
| 2325 | { |
---|
| 2326 | all = 1; |
---|
| 2327 | @@ -1491,13 +1767,13 @@ |
---|
| 2328 | |
---|
| 2329 | len = grub_strlen ((*builtin)->short_doc); |
---|
| 2330 | /* If the length of SHORT_DOC is too long, truncate it. */ |
---|
| 2331 | - if (len > MAX_SHORT_DOC_LEN - 1) |
---|
| 2332 | - len = MAX_SHORT_DOC_LEN - 1; |
---|
| 2333 | + if (len > max_short_doc_len - 1) |
---|
| 2334 | + len = max_short_doc_len - 1; |
---|
| 2335 | |
---|
| 2336 | for (i = 0; i < len; i++) |
---|
| 2337 | grub_putchar ((*builtin)->short_doc[i]); |
---|
| 2338 | |
---|
| 2339 | - for (; i < MAX_SHORT_DOC_LEN; i++) |
---|
| 2340 | + for (; i < max_short_doc_len; i++) |
---|
| 2341 | grub_putchar (' '); |
---|
| 2342 | |
---|
| 2343 | if (! left) |
---|
| 2344 | @@ -1546,10 +1822,10 @@ |
---|
| 2345 | int i; |
---|
| 2346 | |
---|
| 2347 | /* If LEN is too long, fold DOC. */ |
---|
| 2348 | - if (len > MAX_LONG_DOC_LEN) |
---|
| 2349 | + if (len > max_long_doc_len) |
---|
| 2350 | { |
---|
| 2351 | /* Fold this line at the position of a space. */ |
---|
| 2352 | - for (len = MAX_LONG_DOC_LEN; len > 0; len--) |
---|
| 2353 | + for (len = max_long_doc_len; len > 0; len--) |
---|
| 2354 | if (doc[len - 1] == ' ') |
---|
| 2355 | break; |
---|
| 2356 | } |
---|
| 2357 | @@ -2323,6 +2599,25 @@ |
---|
| 2358 | "Probe I/O ports used for the drive DRIVE." |
---|
| 2359 | }; |
---|
| 2360 | |
---|
| 2361 | +/* print */ |
---|
| 2362 | +static int |
---|
| 2363 | +print_func (char *arg, int flags) |
---|
| 2364 | +{ |
---|
| 2365 | + printf("%s\n", arg); |
---|
| 2366 | + |
---|
| 2367 | + return 0; |
---|
| 2368 | +} |
---|
| 2369 | + |
---|
| 2370 | +static struct builtin builtin_print = |
---|
| 2371 | +{ |
---|
| 2372 | + "print", |
---|
| 2373 | + print_func, |
---|
| 2374 | + BUILTIN_CMDLINE | BUILTIN_MENU | BUILTIN_NO_ECHO, |
---|
| 2375 | + "print [MESSAGE ...]", |
---|
| 2376 | + "Print MESSAGE." |
---|
| 2377 | +}; |
---|
| 2378 | + |
---|
| 2379 | + |
---|
| 2380 | |
---|
| 2381 | /* kernel */ |
---|
| 2382 | static int |
---|
| 2383 | @@ -3221,7 +3516,102 @@ |
---|
| 2384 | static int |
---|
| 2385 | savedefault_func (char *arg, int flags) |
---|
| 2386 | { |
---|
| 2387 | -#if !defined(SUPPORT_DISKLESS) && !defined(GRUB_UTIL) |
---|
| 2388 | +#if !defined(SUPPORT_DISKLESS) |
---|
| 2389 | + #if !defined(GRUB_UTIL) |
---|
| 2390 | + savedefault_helper(arg, flags); |
---|
| 2391 | + #else |
---|
| 2392 | + savedefault_shell(arg, flags); |
---|
| 2393 | + #endif |
---|
| 2394 | +#else /* !SUPPORT_DISKLESS */ |
---|
| 2395 | + errnum = ERR_UNRECOGNIZED; |
---|
| 2396 | + return 1; |
---|
| 2397 | +#endif /* !SUPPORT_DISKLESS */ |
---|
| 2398 | +} |
---|
| 2399 | + |
---|
| 2400 | +#if !defined(SUPPORT_DISKLESS) && defined(GRUB_UTIL) |
---|
| 2401 | +/* savedefault_shell */ |
---|
| 2402 | +static int |
---|
| 2403 | +savedefault_shell(char *arg, int flags) |
---|
| 2404 | + { |
---|
| 2405 | + int once_only = 0; |
---|
| 2406 | + int new_default; |
---|
| 2407 | + int curr_default = -1; |
---|
| 2408 | + int curr_prev_default = -1; |
---|
| 2409 | + int new_prev_default = -1; |
---|
| 2410 | + FILE *fp; |
---|
| 2411 | + size_t bytes = 10; |
---|
| 2412 | + char line[bytes]; |
---|
| 2413 | + char *default_file = (char *) DEFAULT_FILE_BUF; |
---|
| 2414 | + char buf[bytes]; |
---|
| 2415 | + int i; |
---|
| 2416 | + |
---|
| 2417 | + while (1) |
---|
| 2418 | + { |
---|
| 2419 | + if (grub_memcmp ("--default=", arg, sizeof ("--default=") - 1) == 0) |
---|
| 2420 | + { |
---|
| 2421 | + char *p = arg + sizeof ("--default=") - 1; |
---|
| 2422 | + if (! safe_parse_maxint (&p, &new_default)) |
---|
| 2423 | + return 1; |
---|
| 2424 | + arg = skip_to (0, arg); |
---|
| 2425 | + } |
---|
| 2426 | + else if (grub_memcmp ("--once", arg, sizeof ("--once") - 1) == 0) |
---|
| 2427 | + { |
---|
| 2428 | + once_only = 1; |
---|
| 2429 | + arg = skip_to (0, arg); |
---|
| 2430 | + } |
---|
| 2431 | + else |
---|
| 2432 | + break; |
---|
| 2433 | + } |
---|
| 2434 | + |
---|
| 2435 | + *default_file = 0; |
---|
| 2436 | + grub_strncat (default_file, config_file, DEFAULT_FILE_BUFLEN); |
---|
| 2437 | + for (i = grub_strlen(default_file); i >= 0; i--) |
---|
| 2438 | + if (default_file[i] == '/') |
---|
| 2439 | + { |
---|
| 2440 | + i++; |
---|
| 2441 | + break; |
---|
| 2442 | + } |
---|
| 2443 | + default_file[i] = 0; |
---|
| 2444 | + grub_strncat (default_file + i, "default", DEFAULT_FILE_BUFLEN - i); |
---|
| 2445 | + |
---|
| 2446 | + if(!(fp = fopen(default_file,"w"))) |
---|
| 2447 | + { |
---|
| 2448 | + errnum = ERR_READ; |
---|
| 2449 | + goto fail; |
---|
| 2450 | + } |
---|
| 2451 | + |
---|
| 2452 | + read(&line, -1); |
---|
| 2453 | + |
---|
| 2454 | + sscanf(line, "%d:%d", &curr_prev_default, &curr_default); |
---|
| 2455 | + |
---|
| 2456 | + if(curr_default != -1) |
---|
| 2457 | + new_prev_default = curr_default; |
---|
| 2458 | + else |
---|
| 2459 | + { |
---|
| 2460 | + if(curr_prev_default != -1) |
---|
| 2461 | + new_prev_default = curr_prev_default; |
---|
| 2462 | + else |
---|
| 2463 | + new_prev_default = 0; |
---|
| 2464 | + } |
---|
| 2465 | + |
---|
| 2466 | + if(once_only) |
---|
| 2467 | + sprintf(buf, "%d:%d\n", new_prev_default, new_default); |
---|
| 2468 | + else |
---|
| 2469 | + sprintf(buf, "%d\n", new_default); |
---|
| 2470 | + |
---|
| 2471 | + fprintf(fp, buf); |
---|
| 2472 | + |
---|
| 2473 | +fail: |
---|
| 2474 | + fclose(fp); |
---|
| 2475 | + return errnum; |
---|
| 2476 | +} |
---|
| 2477 | +#endif |
---|
| 2478 | + |
---|
| 2479 | +/* savedefault_helper */ |
---|
| 2480 | +static int |
---|
| 2481 | +savedefault_helper (char *arg, int flags) |
---|
| 2482 | +{ |
---|
| 2483 | +#if !defined(SUPPORT_DISKLESS) |
---|
| 2484 | unsigned long tmp_drive = saved_drive; |
---|
| 2485 | unsigned long tmp_partition = saved_partition; |
---|
| 2486 | char *default_file = (char *) DEFAULT_FILE_BUF; |
---|
| 2487 | @@ -3300,19 +3690,23 @@ |
---|
| 2488 | disk_read_hook = 0; |
---|
| 2489 | grub_close (); |
---|
| 2490 | |
---|
| 2491 | - if (len != sizeof (buf)) |
---|
| 2492 | - { |
---|
| 2493 | - /* This is too small. Do not modify the file manually, please! */ |
---|
| 2494 | - errnum = ERR_READ; |
---|
| 2495 | - goto fail; |
---|
| 2496 | - } |
---|
| 2497 | - |
---|
| 2498 | if (sector_count > 2) |
---|
| 2499 | { |
---|
| 2500 | /* Is this possible?! Too fragmented! */ |
---|
| 2501 | errnum = ERR_FSYS_CORRUPT; |
---|
| 2502 | goto fail; |
---|
| 2503 | } |
---|
| 2504 | + |
---|
| 2505 | + char *tmp; |
---|
| 2506 | + if((tmp = grub_strstr(buf, ":")) != NULL) |
---|
| 2507 | + { |
---|
| 2508 | + int f_len = grub_strlen(buf) - grub_strlen(tmp); |
---|
| 2509 | + char *def; |
---|
| 2510 | + int a; |
---|
| 2511 | + for(a = 0; a < f_len; a++) |
---|
| 2512 | + grub_memcpy(&def[a], &buf[a], sizeof(char)); |
---|
| 2513 | + safe_parse_maxint (&def, &entryno); |
---|
| 2514 | + } |
---|
| 2515 | |
---|
| 2516 | /* Set up a string to be written. */ |
---|
| 2517 | grub_memset (buf, '\n', sizeof (buf)); |
---|
| 2518 | @@ -3830,15 +4224,15 @@ |
---|
| 2519 | { |
---|
| 2520 | char tmp[16]; |
---|
| 2521 | grub_sprintf (tmp, ",%d", (partition >> 16) & 0xFF); |
---|
| 2522 | - grub_strncat (device, tmp, 256); |
---|
| 2523 | + grub_strncat (device, tmp, sizeof (device)); |
---|
| 2524 | } |
---|
| 2525 | if ((partition & 0x00FF00) != 0x00FF00) |
---|
| 2526 | { |
---|
| 2527 | char tmp[16]; |
---|
| 2528 | grub_sprintf (tmp, ",%c", 'a' + ((partition >> 8) & 0xFF)); |
---|
| 2529 | - grub_strncat (device, tmp, 256); |
---|
| 2530 | + grub_strncat (device, tmp, sizeof (device)); |
---|
| 2531 | } |
---|
| 2532 | - grub_strncat (device, ")", 256); |
---|
| 2533 | + grub_strncat (device, ")", sizeof (device)); |
---|
| 2534 | } |
---|
| 2535 | |
---|
| 2536 | int embed_stage1_5 (char *stage1_5, int drive, int partition) |
---|
| 2537 | @@ -4085,7 +4479,7 @@ |
---|
| 2538 | }; |
---|
| 2539 | |
---|
| 2540 | |
---|
| 2541 | -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) |
---|
| 2542 | +#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS) |
---|
| 2543 | /* terminal */ |
---|
| 2544 | static int |
---|
| 2545 | terminal_func (char *arg, int flags) |
---|
| 2546 | @@ -4244,17 +4638,29 @@ |
---|
| 2547 | end: |
---|
| 2548 | current_term = term_table + default_term; |
---|
| 2549 | current_term->flags = term_flags; |
---|
| 2550 | - |
---|
| 2551 | + |
---|
| 2552 | if (lines) |
---|
| 2553 | max_lines = lines; |
---|
| 2554 | else |
---|
| 2555 | - /* 24 would be a good default value. */ |
---|
| 2556 | - max_lines = 24; |
---|
| 2557 | - |
---|
| 2558 | + max_lines = current_term->max_lines; |
---|
| 2559 | + |
---|
| 2560 | /* If the interface is currently the command-line, |
---|
| 2561 | restart it to repaint the screen. */ |
---|
| 2562 | - if (current_term != prev_term && (flags & BUILTIN_CMDLINE)) |
---|
| 2563 | + if ((current_term != prev_term) && (flags & BUILTIN_CMDLINE)){ |
---|
| 2564 | + if (prev_term->shutdown) |
---|
| 2565 | + prev_term->shutdown(); |
---|
| 2566 | + if (current_term->startup) { |
---|
| 2567 | + /* If startup fails, return to previous term */ |
---|
| 2568 | + if (current_term->startup() == 0) { |
---|
| 2569 | + current_term = prev_term; |
---|
| 2570 | + max_lines = current_term->max_lines; |
---|
| 2571 | + if (current_term->cls) { |
---|
| 2572 | + current_term->cls(); |
---|
| 2573 | + } |
---|
| 2574 | + } |
---|
| 2575 | + } |
---|
| 2576 | grub_longjmp (restart_cmdline_env, 0); |
---|
| 2577 | + } |
---|
| 2578 | |
---|
| 2579 | return 0; |
---|
| 2580 | } |
---|
| 2581 | @@ -4264,7 +4670,7 @@ |
---|
| 2582 | "terminal", |
---|
| 2583 | terminal_func, |
---|
| 2584 | BUILTIN_MENU | BUILTIN_CMDLINE | BUILTIN_HELP_LIST, |
---|
| 2585 | - "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules]", |
---|
| 2586 | + "terminal [--dumb] [--no-echo] [--no-edit] [--timeout=SECS] [--lines=LINES] [--silent] [console] [serial] [hercules] [graphics]", |
---|
| 2587 | "Select a terminal. When multiple terminals are specified, wait until" |
---|
| 2588 | " you push any key to continue. If both console and serial are specified," |
---|
| 2589 | " the terminal to which you input a key first will be selected. If no" |
---|
| 2590 | @@ -4276,7 +4682,7 @@ |
---|
| 2591 | " seconds. The option --lines specifies the maximum number of lines." |
---|
| 2592 | " The option --silent is used to suppress messages." |
---|
| 2593 | }; |
---|
| 2594 | -#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */ |
---|
| 2595 | +#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */ |
---|
| 2596 | |
---|
| 2597 | |
---|
| 2598 | #ifdef SUPPORT_SERIAL |
---|
| 2599 | @@ -4795,13 +5201,20 @@ |
---|
| 2600 | /* The table of builtin commands. Sorted in dictionary order. */ |
---|
| 2601 | struct builtin *builtin_table[] = |
---|
| 2602 | { |
---|
| 2603 | +#ifdef SUPPORT_GRAPHICS |
---|
| 2604 | + &builtin_background, |
---|
| 2605 | +#endif |
---|
| 2606 | &builtin_blocklist, |
---|
| 2607 | &builtin_boot, |
---|
| 2608 | #ifdef SUPPORT_NETBOOT |
---|
| 2609 | &builtin_bootp, |
---|
| 2610 | #endif /* SUPPORT_NETBOOT */ |
---|
| 2611 | +#ifdef SUPPORT_GRAPHICS |
---|
| 2612 | + &builtin_border, |
---|
| 2613 | +#endif |
---|
| 2614 | &builtin_cat, |
---|
| 2615 | &builtin_chainloader, |
---|
| 2616 | + &builtin_clear, |
---|
| 2617 | &builtin_cmp, |
---|
| 2618 | &builtin_color, |
---|
| 2619 | &builtin_configfile, |
---|
| 2620 | @@ -4821,6 +5234,9 @@ |
---|
| 2621 | &builtin_embed, |
---|
| 2622 | &builtin_fallback, |
---|
| 2623 | &builtin_find, |
---|
| 2624 | +#ifdef SUPPORT_GRAPHICS |
---|
| 2625 | + &builtin_foreground, |
---|
| 2626 | +#endif |
---|
| 2627 | &builtin_fstest, |
---|
| 2628 | &builtin_geometry, |
---|
| 2629 | &builtin_halt, |
---|
| 2630 | @@ -4848,6 +5264,7 @@ |
---|
| 2631 | &builtin_parttype, |
---|
| 2632 | &builtin_password, |
---|
| 2633 | &builtin_pause, |
---|
| 2634 | + &builtin_print, |
---|
| 2635 | #ifdef GRUB_UTIL |
---|
| 2636 | &builtin_quit, |
---|
| 2637 | #endif /* GRUB_UTIL */ |
---|
| 2638 | @@ -4864,9 +5281,13 @@ |
---|
| 2639 | #endif /* SUPPORT_SERIAL */ |
---|
| 2640 | &builtin_setkey, |
---|
| 2641 | &builtin_setup, |
---|
| 2642 | -#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) |
---|
| 2643 | +#ifdef SUPPORT_GRAPHICS |
---|
| 2644 | + &builtin_shade, |
---|
| 2645 | + &builtin_splashimage, |
---|
| 2646 | +#endif /* SUPPORT_GRAPHICS */ |
---|
| 2647 | +#if defined(SUPPORT_SERIAL) || defined(SUPPORT_HERCULES) || defined(SUPPORT_GRAPHICS) |
---|
| 2648 | &builtin_terminal, |
---|
| 2649 | -#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES */ |
---|
| 2650 | +#endif /* SUPPORT_SERIAL || SUPPORT_HERCULES || SUPPORT_GRAPHICS */ |
---|
| 2651 | #ifdef SUPPORT_SERIAL |
---|
| 2652 | &builtin_terminfo, |
---|
| 2653 | #endif /* SUPPORT_SERIAL */ |
---|
| 2654 | @@ -4880,5 +5301,8 @@ |
---|
| 2655 | &builtin_unhide, |
---|
| 2656 | &builtin_uppermem, |
---|
| 2657 | &builtin_vbeprobe, |
---|
| 2658 | +#ifdef SUPPORT_GRAPHICS |
---|
| 2659 | + &builtin_viewport, |
---|
| 2660 | +#endif |
---|
| 2661 | 0 |
---|
| 2662 | }; |
---|
| 2663 | diff -Naur grub-0.97.orig/stage2/char_io.c grub-0.97/stage2/char_io.c |
---|
| 2664 | --- grub-0.97.orig/stage2/char_io.c 2005-02-01 12:51:23.000000000 -0800 |
---|
| 2665 | +++ grub-0.97/stage2/char_io.c 2006-07-03 23:59:27.000000000 -0700 |
---|
| 2666 | @@ -29,12 +29,17 @@ |
---|
| 2667 | # include <serial.h> |
---|
| 2668 | #endif |
---|
| 2669 | |
---|
| 2670 | +#ifdef SUPPORT_GRAPHICS |
---|
| 2671 | +# include <graphics.h> |
---|
| 2672 | +#endif |
---|
| 2673 | + |
---|
| 2674 | #ifndef STAGE1_5 |
---|
| 2675 | struct term_entry term_table[] = |
---|
| 2676 | { |
---|
| 2677 | { |
---|
| 2678 | "console", |
---|
| 2679 | 0, |
---|
| 2680 | + 24, |
---|
| 2681 | console_putchar, |
---|
| 2682 | console_checkkey, |
---|
| 2683 | console_getkey, |
---|
| 2684 | @@ -43,13 +48,16 @@ |
---|
| 2685 | console_cls, |
---|
| 2686 | console_setcolorstate, |
---|
| 2687 | console_setcolor, |
---|
| 2688 | - console_setcursor |
---|
| 2689 | + console_setcursor, |
---|
| 2690 | + 0, |
---|
| 2691 | + 0 |
---|
| 2692 | }, |
---|
| 2693 | #ifdef SUPPORT_SERIAL |
---|
| 2694 | { |
---|
| 2695 | "serial", |
---|
| 2696 | /* A serial device must be initialized. */ |
---|
| 2697 | TERM_NEED_INIT, |
---|
| 2698 | + 24, |
---|
| 2699 | serial_putchar, |
---|
| 2700 | serial_checkkey, |
---|
| 2701 | serial_getkey, |
---|
| 2702 | @@ -58,6 +66,8 @@ |
---|
| 2703 | serial_cls, |
---|
| 2704 | serial_setcolorstate, |
---|
| 2705 | 0, |
---|
| 2706 | + 0, |
---|
| 2707 | + 0, |
---|
| 2708 | 0 |
---|
| 2709 | }, |
---|
| 2710 | #endif /* SUPPORT_SERIAL */ |
---|
| 2711 | @@ -65,6 +75,7 @@ |
---|
| 2712 | { |
---|
| 2713 | "hercules", |
---|
| 2714 | 0, |
---|
| 2715 | + 24, |
---|
| 2716 | hercules_putchar, |
---|
| 2717 | console_checkkey, |
---|
| 2718 | console_getkey, |
---|
| 2719 | @@ -73,11 +84,30 @@ |
---|
| 2720 | hercules_cls, |
---|
| 2721 | hercules_setcolorstate, |
---|
| 2722 | hercules_setcolor, |
---|
| 2723 | - hercules_setcursor |
---|
| 2724 | + hercules_setcursor, |
---|
| 2725 | + 0, |
---|
| 2726 | + 0 |
---|
| 2727 | }, |
---|
| 2728 | #endif /* SUPPORT_HERCULES */ |
---|
| 2729 | +#ifdef SUPPORT_GRAPHICS |
---|
| 2730 | + { "graphics", |
---|
| 2731 | + TERM_NEED_INIT, /* flags */ |
---|
| 2732 | + 30, /* number of lines */ |
---|
| 2733 | + graphics_putchar, /* putchar */ |
---|
| 2734 | + console_checkkey, /* checkkey */ |
---|
| 2735 | + console_getkey, /* getkey */ |
---|
| 2736 | + graphics_getxy, /* getxy */ |
---|
| 2737 | + graphics_gotoxy, /* gotoxy */ |
---|
| 2738 | + graphics_cls, /* cls */ |
---|
| 2739 | + graphics_setcolorstate, /* setcolorstate */ |
---|
| 2740 | + graphics_setcolor, /* setcolor */ |
---|
| 2741 | + graphics_setcursor, /* nocursor */ |
---|
| 2742 | + graphics_init, /* initialize */ |
---|
| 2743 | + graphics_end /* shutdown */ |
---|
| 2744 | + }, |
---|
| 2745 | +#endif /* SUPPORT_GRAPHICS */ |
---|
| 2746 | /* This must be the last entry. */ |
---|
| 2747 | - { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } |
---|
| 2748 | + { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } |
---|
| 2749 | }; |
---|
| 2750 | |
---|
| 2751 | /* This must be console. */ |
---|
| 2752 | @@ -305,9 +335,10 @@ |
---|
| 2753 | |
---|
| 2754 | /* XXX: These should be defined in shared.h, but I leave these here, |
---|
| 2755 | until this code is freezed. */ |
---|
| 2756 | -#define CMDLINE_WIDTH 78 |
---|
| 2757 | #define CMDLINE_MARGIN 10 |
---|
| 2758 | - |
---|
| 2759 | + |
---|
| 2760 | + /* command-line limits */ |
---|
| 2761 | + int cmdline_width = 78, col_start = 0; |
---|
| 2762 | int xpos, lpos, c, section; |
---|
| 2763 | /* The length of PROMPT. */ |
---|
| 2764 | int plen; |
---|
| 2765 | @@ -338,7 +369,7 @@ |
---|
| 2766 | |
---|
| 2767 | /* If the cursor is in the first section, display the first section |
---|
| 2768 | instead of the second. */ |
---|
| 2769 | - if (section == 1 && plen + lpos < CMDLINE_WIDTH) |
---|
| 2770 | + if (section == 1 && plen + lpos < cmdline_width) |
---|
| 2771 | cl_refresh (1, 0); |
---|
| 2772 | else if (xpos - count < 1) |
---|
| 2773 | cl_refresh (1, 0); |
---|
| 2774 | @@ -354,7 +385,7 @@ |
---|
| 2775 | grub_putchar ('\b'); |
---|
| 2776 | } |
---|
| 2777 | else |
---|
| 2778 | - gotoxy (xpos, getxy () & 0xFF); |
---|
| 2779 | + gotoxy (xpos + col_start, getxy () & 0xFF); |
---|
| 2780 | } |
---|
| 2781 | } |
---|
| 2782 | |
---|
| 2783 | @@ -364,7 +395,7 @@ |
---|
| 2784 | lpos += count; |
---|
| 2785 | |
---|
| 2786 | /* If the cursor goes outside, scroll the screen to the right. */ |
---|
| 2787 | - if (xpos + count >= CMDLINE_WIDTH) |
---|
| 2788 | + if (xpos + count >= cmdline_width) |
---|
| 2789 | cl_refresh (1, 0); |
---|
| 2790 | else |
---|
| 2791 | { |
---|
| 2792 | @@ -383,7 +414,7 @@ |
---|
| 2793 | } |
---|
| 2794 | } |
---|
| 2795 | else |
---|
| 2796 | - gotoxy (xpos, getxy () & 0xFF); |
---|
| 2797 | + gotoxy (xpos + col_start, getxy () & 0xFF); |
---|
| 2798 | } |
---|
| 2799 | } |
---|
| 2800 | |
---|
| 2801 | @@ -398,14 +429,14 @@ |
---|
| 2802 | if (full) |
---|
| 2803 | { |
---|
| 2804 | /* Recompute the section number. */ |
---|
| 2805 | - if (lpos + plen < CMDLINE_WIDTH) |
---|
| 2806 | + if (lpos + plen < cmdline_width) |
---|
| 2807 | section = 0; |
---|
| 2808 | else |
---|
| 2809 | - section = ((lpos + plen - CMDLINE_WIDTH) |
---|
| 2810 | - / (CMDLINE_WIDTH - 1 - CMDLINE_MARGIN) + 1); |
---|
| 2811 | + section = ((lpos + plen - cmdline_width) |
---|
| 2812 | + / (cmdline_width - 1 - CMDLINE_MARGIN) + 1); |
---|
| 2813 | |
---|
| 2814 | /* From the start to the end. */ |
---|
| 2815 | - len = CMDLINE_WIDTH; |
---|
| 2816 | + len = cmdline_width; |
---|
| 2817 | pos = 0; |
---|
| 2818 | grub_putchar ('\r'); |
---|
| 2819 | |
---|
| 2820 | @@ -445,8 +476,8 @@ |
---|
| 2821 | if (! full) |
---|
| 2822 | offset = xpos - 1; |
---|
| 2823 | |
---|
| 2824 | - start = ((section - 1) * (CMDLINE_WIDTH - 1 - CMDLINE_MARGIN) |
---|
| 2825 | - + CMDLINE_WIDTH - plen - CMDLINE_MARGIN); |
---|
| 2826 | + start = ((section - 1) * (cmdline_width - 1 - CMDLINE_MARGIN) |
---|
| 2827 | + + cmdline_width - plen - CMDLINE_MARGIN); |
---|
| 2828 | xpos = lpos + 1 - start; |
---|
| 2829 | start += offset; |
---|
| 2830 | } |
---|
| 2831 | @@ -471,7 +502,7 @@ |
---|
| 2832 | |
---|
| 2833 | /* If the cursor is at the last position, put `>' or a space, |
---|
| 2834 | depending on if there are more characters in BUF. */ |
---|
| 2835 | - if (pos == CMDLINE_WIDTH) |
---|
| 2836 | + if (pos == cmdline_width) |
---|
| 2837 | { |
---|
| 2838 | if (start + len < llen) |
---|
| 2839 | grub_putchar ('>'); |
---|
| 2840 | @@ -488,7 +519,7 @@ |
---|
| 2841 | grub_putchar ('\b'); |
---|
| 2842 | } |
---|
| 2843 | else |
---|
| 2844 | - gotoxy (xpos, getxy () & 0xFF); |
---|
| 2845 | + gotoxy (xpos + col_start, getxy () & 0xFF); |
---|
| 2846 | } |
---|
| 2847 | |
---|
| 2848 | /* Initialize the command-line. */ |
---|
| 2849 | @@ -518,10 +549,10 @@ |
---|
| 2850 | |
---|
| 2851 | llen += l; |
---|
| 2852 | lpos += l; |
---|
| 2853 | - if (xpos + l >= CMDLINE_WIDTH) |
---|
| 2854 | + if (xpos + l >= cmdline_width) |
---|
| 2855 | cl_refresh (1, 0); |
---|
| 2856 | - else if (xpos + l + llen - lpos > CMDLINE_WIDTH) |
---|
| 2857 | - cl_refresh (0, CMDLINE_WIDTH - xpos); |
---|
| 2858 | + else if (xpos + l + llen - lpos > cmdline_width) |
---|
| 2859 | + cl_refresh (0, cmdline_width - xpos); |
---|
| 2860 | else |
---|
| 2861 | cl_refresh (0, l + llen - lpos); |
---|
| 2862 | } |
---|
| 2863 | @@ -533,12 +564,22 @@ |
---|
| 2864 | grub_memmove (buf + lpos, buf + lpos + count, llen - count + 1); |
---|
| 2865 | llen -= count; |
---|
| 2866 | |
---|
| 2867 | - if (xpos + llen + count - lpos > CMDLINE_WIDTH) |
---|
| 2868 | - cl_refresh (0, CMDLINE_WIDTH - xpos); |
---|
| 2869 | + if (xpos + llen + count - lpos > cmdline_width) |
---|
| 2870 | + cl_refresh (0, cmdline_width - xpos); |
---|
| 2871 | else |
---|
| 2872 | cl_refresh (0, llen + count - lpos); |
---|
| 2873 | } |
---|
| 2874 | |
---|
| 2875 | + max_lines = current_term->max_lines; |
---|
| 2876 | +#ifdef SUPPORT_GRAPHICS |
---|
| 2877 | + if (grub_memcmp (current_term->name, "graphics", sizeof ("graphics") - 1) == 0) |
---|
| 2878 | + { |
---|
| 2879 | + cmdline_width = (view_x1 - view_x0) - 2; |
---|
| 2880 | + col_start = view_x0; |
---|
| 2881 | + max_lines = view_y1 - view_y0; |
---|
| 2882 | + } |
---|
| 2883 | +#endif |
---|
| 2884 | + |
---|
| 2885 | plen = grub_strlen (prompt); |
---|
| 2886 | llen = grub_strlen (cmdline); |
---|
| 2887 | |
---|
| 2888 | @@ -1006,6 +1047,48 @@ |
---|
| 2889 | } |
---|
| 2890 | #endif /* ! STAGE1_5 */ |
---|
| 2891 | |
---|
| 2892 | +#ifndef STAGE1_5 |
---|
| 2893 | +/* Internal pager. */ |
---|
| 2894 | +int |
---|
| 2895 | +do_more (void) |
---|
| 2896 | +{ |
---|
| 2897 | + if (count_lines >= 0) |
---|
| 2898 | + { |
---|
| 2899 | + count_lines++; |
---|
| 2900 | + if (count_lines >= max_lines - 2) |
---|
| 2901 | + { |
---|
| 2902 | + int tmp; |
---|
| 2903 | + |
---|
| 2904 | + /* It's important to disable the feature temporarily, because |
---|
| 2905 | + the following grub_printf call will print newlines. */ |
---|
| 2906 | + count_lines = -1; |
---|
| 2907 | + |
---|
| 2908 | + grub_printf("\n"); |
---|
| 2909 | + if (current_term->setcolorstate) |
---|
| 2910 | + current_term->setcolorstate (COLOR_STATE_HIGHLIGHT); |
---|
| 2911 | + |
---|
| 2912 | + grub_printf ("[Hit return to continue]"); |
---|
| 2913 | + |
---|
| 2914 | + if (current_term->setcolorstate) |
---|
| 2915 | + current_term->setcolorstate (COLOR_STATE_NORMAL); |
---|
| 2916 | + |
---|
| 2917 | + |
---|
| 2918 | + do |
---|
| 2919 | + { |
---|
| 2920 | + tmp = ASCII_CHAR (getkey ()); |
---|
| 2921 | + } |
---|
| 2922 | + while (tmp != '\n' && tmp != '\r'); |
---|
| 2923 | + grub_printf ("\r \r"); |
---|
| 2924 | + |
---|
| 2925 | + /* Restart to count lines. */ |
---|
| 2926 | + count_lines = 0; |
---|
| 2927 | + return 1; |
---|
| 2928 | + } |
---|
| 2929 | + } |
---|
| 2930 | + return 0; |
---|
| 2931 | +} |
---|
| 2932 | +#endif |
---|
| 2933 | + |
---|
| 2934 | /* Display an ASCII character. */ |
---|
| 2935 | void |
---|
| 2936 | grub_putchar (int c) |
---|
| 2937 | @@ -1034,38 +1117,11 @@ |
---|
| 2938 | |
---|
| 2939 | if (c == '\n') |
---|
| 2940 | { |
---|
| 2941 | + int flag; |
---|
| 2942 | /* Internal `more'-like feature. */ |
---|
| 2943 | - if (count_lines >= 0) |
---|
| 2944 | - { |
---|
| 2945 | - count_lines++; |
---|
| 2946 | - if (count_lines >= max_lines - 2) |
---|
| 2947 | - { |
---|
| 2948 | - int tmp; |
---|
| 2949 | - |
---|
| 2950 | - /* It's important to disable the feature temporarily, because |
---|
| 2951 | - the following grub_printf call will print newlines. */ |
---|
| 2952 | - count_lines = -1; |
---|
| 2953 | - |
---|
| 2954 | - if (current_term->setcolorstate) |
---|
| 2955 | - current_term->setcolorstate (COLOR_STATE_HIGHLIGHT); |
---|
| 2956 | - |
---|
| 2957 | - grub_printf ("\n[Hit return to continue]"); |
---|
| 2958 | - |
---|
| 2959 | - if (current_term->setcolorstate) |
---|
| 2960 | - current_term->setcolorstate (COLOR_STATE_NORMAL); |
---|
| 2961 | - |
---|
| 2962 | - do |
---|
| 2963 | - { |
---|
| 2964 | - tmp = ASCII_CHAR (getkey ()); |
---|
| 2965 | - } |
---|
| 2966 | - while (tmp != '\n' && tmp != '\r'); |
---|
| 2967 | - grub_printf ("\r \r"); |
---|
| 2968 | - |
---|
| 2969 | - /* Restart to count lines. */ |
---|
| 2970 | - count_lines = 0; |
---|
| 2971 | - return; |
---|
| 2972 | - } |
---|
| 2973 | - } |
---|
| 2974 | + flag = do_more (); |
---|
| 2975 | + if (flag) |
---|
| 2976 | + return; |
---|
| 2977 | } |
---|
| 2978 | |
---|
| 2979 | current_term->putchar (c); |
---|
| 2980 | @@ -1090,7 +1146,7 @@ |
---|
| 2981 | cls (void) |
---|
| 2982 | { |
---|
| 2983 | /* If the terminal is dumb, there is no way to clean the terminal. */ |
---|
| 2984 | - if (current_term->flags & TERM_DUMB) |
---|
| 2985 | + if (current_term->flags & TERM_DUMB) |
---|
| 2986 | grub_putchar ('\n'); |
---|
| 2987 | else |
---|
| 2988 | current_term->cls (); |
---|
| 2989 | @@ -1175,13 +1231,13 @@ |
---|
| 2990 | #endif /* ! STAGE1_5 */ |
---|
| 2991 | |
---|
| 2992 | int |
---|
| 2993 | -memcheck (int addr, int len) |
---|
| 2994 | +memcheck (unsigned long int addr, unsigned long int len) |
---|
| 2995 | { |
---|
| 2996 | #ifdef GRUB_UTIL |
---|
| 2997 | - auto int start_addr (void); |
---|
| 2998 | - auto int end_addr (void); |
---|
| 2999 | + auto unsigned long int start_addr (void); |
---|
| 3000 | + auto int unsigned long end_addr (void); |
---|
| 3001 | |
---|
| 3002 | - auto int start_addr (void) |
---|
| 3003 | + auto unsigned long int start_addr (void) |
---|
| 3004 | { |
---|
| 3005 | int ret; |
---|
| 3006 | # if defined(HAVE_START_SYMBOL) |
---|
| 3007 | @@ -1192,7 +1248,7 @@ |
---|
| 3008 | return ret; |
---|
| 3009 | } |
---|
| 3010 | |
---|
| 3011 | - auto int end_addr (void) |
---|
| 3012 | + auto unsigned long int end_addr (void) |
---|
| 3013 | { |
---|
| 3014 | int ret; |
---|
| 3015 | # if defined(HAVE_END_SYMBOL) |
---|
| 3016 | @@ -1217,6 +1273,16 @@ |
---|
| 3017 | return ! errnum; |
---|
| 3018 | } |
---|
| 3019 | |
---|
| 3020 | +void |
---|
| 3021 | +grub_memcpy(void *dest, const void *src, int len) |
---|
| 3022 | +{ |
---|
| 3023 | + int i; |
---|
| 3024 | + register char *d = (char*)dest, *s = (char*)src; |
---|
| 3025 | + |
---|
| 3026 | + for (i = 0; i < len; i++) |
---|
| 3027 | + d[i] = s[i]; |
---|
| 3028 | +} |
---|
| 3029 | + |
---|
| 3030 | void * |
---|
| 3031 | grub_memmove (void *to, const void *from, int len) |
---|
| 3032 | { |
---|
| 3033 | diff -Naur grub-0.97.orig/stage2/cmdline.c grub-0.97/stage2/cmdline.c |
---|
| 3034 | --- grub-0.97.orig/stage2/cmdline.c 2004-08-16 16:23:01.000000000 -0700 |
---|
| 3035 | +++ grub-0.97/stage2/cmdline.c 2006-07-03 23:58:41.000000000 -0700 |
---|
| 3036 | @@ -50,10 +50,11 @@ |
---|
| 3037 | void |
---|
| 3038 | print_cmdline_message (int forever) |
---|
| 3039 | { |
---|
| 3040 | - printf (" [ Minimal BASH-like line editing is supported. For the first word, TAB\n" |
---|
| 3041 | - " lists possible command completions. Anywhere else TAB lists the possible\n" |
---|
| 3042 | - " completions of a device/filename.%s ]\n", |
---|
| 3043 | - (forever ? "" : " ESC at any time exits.")); |
---|
| 3044 | + grub_printf(" [ Minimal BASH-like line editing is supported. For\n" |
---|
| 3045 | + " the first word, TAB lists possible command\n" |
---|
| 3046 | + " completions. Anywhere else TAB lists the possible\n" |
---|
| 3047 | + " completions of a device/filename.%s ]\n", |
---|
| 3048 | + (forever ? "" : " ESC at any time\n exits.")); |
---|
| 3049 | } |
---|
| 3050 | |
---|
| 3051 | /* Find the builtin whose command name is COMMAND and return the |
---|
| 3052 | diff -Naur grub-0.97.orig/stage2/freebsd.h grub-0.97/stage2/freebsd.h |
---|
| 3053 | --- grub-0.97.orig/stage2/freebsd.h 2003-07-09 04:45:52.000000000 -0700 |
---|
| 3054 | +++ grub-0.97/stage2/freebsd.h 2006-07-03 23:59:36.000000000 -0700 |
---|
| 3055 | @@ -1,7 +1,7 @@ |
---|
| 3056 | |
---|
| 3057 | /* |
---|
| 3058 | * GRUB -- GRand Unified Bootloader |
---|
| 3059 | - * Copyright (C) 2001 Free Software Foundation, Inc. |
---|
| 3060 | + * Copyright (C) 2001, 2004 Free Software Foundation, Inc. |
---|
| 3061 | * |
---|
| 3062 | * This program is free software; you can redistribute it and/or modify |
---|
| 3063 | * it under the terms of the GNU General Public License as published by |
---|
| 3064 | @@ -35,6 +35,10 @@ |
---|
| 3065 | #define RB_CDROM 0x2000 /* use cdrom as root */ |
---|
| 3066 | #define RB_GDB 0x8000 /* use GDB remote debugger instead of DDB */ |
---|
| 3067 | #define RB_MUTE 0x10000 /* Come up with the console muted */ |
---|
| 3068 | +#define RB_SELFTEST 0x20000 /* don't complete the boot; do selftest */ |
---|
| 3069 | +#define RB_RESERVED1 0x40000 /* reserved for internal use of boot blocks */ |
---|
| 3070 | +#define RB_RESERVED2 0x80000 /* reserved for internal use of boot blocks */ |
---|
| 3071 | +#define RB_PAUSE 0x100000 /* pause after each output line during probe */ |
---|
| 3072 | #define RB_MULTIPLE 0x20000000 /* Use multiple consoles */ |
---|
| 3073 | |
---|
| 3074 | #define RB_BOOTINFO 0x80000000 /* have `struct bootinfo *' arg */ |
---|
| 3075 | @@ -70,6 +74,9 @@ |
---|
| 3076 | |
---|
| 3077 | #define N_BIOS_GEOM 8 |
---|
| 3078 | |
---|
| 3079 | +typedef unsigned char u8_t; |
---|
| 3080 | +typedef unsigned int u32_t; |
---|
| 3081 | + |
---|
| 3082 | /* |
---|
| 3083 | * A zero bootinfo field often means that there is no info available. |
---|
| 3084 | * Flags are used to indicate the validity of fields where zero is a |
---|
| 3085 | @@ -77,19 +84,33 @@ |
---|
| 3086 | */ |
---|
| 3087 | struct bootinfo |
---|
| 3088 | { |
---|
| 3089 | - unsigned int bi_version; |
---|
| 3090 | - unsigned char *bi_kernelname; |
---|
| 3091 | - struct nfs_diskless *bi_nfs_diskless; |
---|
| 3092 | + u32_t bi_version; |
---|
| 3093 | + u8_t *bi_kernelname; |
---|
| 3094 | + u32_t bi_nfs_diskless; |
---|
| 3095 | /* End of fields that are always present. */ |
---|
| 3096 | #define bi_endcommon bi_n_bios_used |
---|
| 3097 | - unsigned int bi_n_bios_used; |
---|
| 3098 | - unsigned long bi_bios_geom[N_BIOS_GEOM]; |
---|
| 3099 | - unsigned int bi_size; |
---|
| 3100 | - unsigned char bi_memsizes_valid; |
---|
| 3101 | - unsigned char bi_bios_dev; |
---|
| 3102 | - unsigned char bi_pad[2]; |
---|
| 3103 | - unsigned long bi_basemem; |
---|
| 3104 | - unsigned long bi_extmem; |
---|
| 3105 | - unsigned long bi_symtab; |
---|
| 3106 | - unsigned long bi_esymtab; |
---|
| 3107 | + u32_t bi_n_bios_used; |
---|
| 3108 | + u32_t bi_bios_geom[N_BIOS_GEOM]; |
---|
| 3109 | + u32_t bi_size; |
---|
| 3110 | + u8_t bi_memsizes_valid; |
---|
| 3111 | + u8_t bi_bios_dev; |
---|
| 3112 | + u8_t bi_pad[2]; |
---|
| 3113 | + u32_t bi_basemem; |
---|
| 3114 | + u32_t bi_extmem; |
---|
| 3115 | + u32_t bi_symtab; |
---|
| 3116 | + u32_t bi_esymtab; |
---|
| 3117 | + /* Items below only from advanced bootloader */ |
---|
| 3118 | + u32_t bi_kernend; |
---|
| 3119 | + u32_t bi_envp; |
---|
| 3120 | + u32_t bi_modulep; |
---|
| 3121 | }; |
---|
| 3122 | + |
---|
| 3123 | +#define MODINFO_END 0x0000 /* End of list */ |
---|
| 3124 | +#define MODINFO_NAME 0x0001 /* Name of module (string) */ |
---|
| 3125 | +#define MODINFO_TYPE 0x0002 /* Type of module (string) */ |
---|
| 3126 | +#define MODINFO_ADDR 0x0003 /* Loaded address */ |
---|
| 3127 | +#define MODINFO_SIZE 0x0004 /* Size of module */ |
---|
| 3128 | +#define MODINFO_EMPTY 0x0005 /* Has been deleted */ |
---|
| 3129 | +#define MODINFO_ARGS 0x0006 /* Parameters string */ |
---|
| 3130 | +#define MODINFO_METADATA 0x8000 /* Module-specfic */ |
---|
| 3131 | + |
---|
| 3132 | diff -Naur grub-0.97.orig/stage2/graphics.c grub-0.97/stage2/graphics.c |
---|
| 3133 | --- grub-0.97.orig/stage2/graphics.c 1969-12-31 16:00:00.000000000 -0800 |
---|
| 3134 | +++ grub-0.97/stage2/graphics.c 2006-07-03 23:58:41.000000000 -0700 |
---|
| 3135 | @@ -0,0 +1,585 @@ |
---|
| 3136 | +/* |
---|
| 3137 | + * graphics.c - graphics mode support for GRUB |
---|
| 3138 | + * Implemented as a terminal type by Jeremy Katz <katzj@redhat.com> based |
---|
| 3139 | + * on a patch by Paulo César Pereira de Andrade <pcpa@conectiva.com.br> |
---|
| 3140 | + * Options and enhancements made by Herton Ronaldo Krzesinski |
---|
| 3141 | + * <herton@mandriva.com> |
---|
| 3142 | + * |
---|
| 3143 | + * GRUB -- GRand Unified Bootloader |
---|
| 3144 | + * Copyright (C) 2001,2002 Red Hat, Inc. |
---|
| 3145 | + * Portions copyright (C) 2000 Conectiva, Inc. |
---|
| 3146 | + * |
---|
| 3147 | + * This program is free software; you can redistribute it and/or modify |
---|
| 3148 | + * it under the terms of the GNU General Public License as published by |
---|
| 3149 | + * the Free Software Foundation; either version 2 of the License, or |
---|
| 3150 | + * (at your option) any later version. |
---|
| 3151 | + * |
---|
| 3152 | + * This program is distributed in the hope that it will be useful, |
---|
| 3153 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 3154 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 3155 | + * GNU General Public License for more details. |
---|
| 3156 | + * |
---|
| 3157 | + * You should have received a copy of the GNU General Public License |
---|
| 3158 | + * along with this program; if not, write to the Free Software |
---|
| 3159 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 3160 | + */ |
---|
| 3161 | + |
---|
| 3162 | +#ifdef SUPPORT_GRAPHICS |
---|
| 3163 | + |
---|
| 3164 | +#include <term.h> |
---|
| 3165 | +#include <shared.h> |
---|
| 3166 | +#include <graphics.h> |
---|
| 3167 | + |
---|
| 3168 | +int saved_videomode; |
---|
| 3169 | +unsigned char *font8x16; |
---|
| 3170 | + |
---|
| 3171 | +int graphics_inited = 0; |
---|
| 3172 | +static char splashimage[256]; |
---|
| 3173 | + |
---|
| 3174 | +int shade = 1, no_cursor = 0; |
---|
| 3175 | + |
---|
| 3176 | +#define VSHADOW VSHADOW1 |
---|
| 3177 | +unsigned char VSHADOW1[38400]; |
---|
| 3178 | +unsigned char VSHADOW2[38400]; |
---|
| 3179 | +unsigned char VSHADOW4[38400]; |
---|
| 3180 | +unsigned char VSHADOW8[38400]; |
---|
| 3181 | + |
---|
| 3182 | +/* define the default viewable area */ |
---|
| 3183 | +int view_x0 = 0; |
---|
| 3184 | +int view_y0 = 0; |
---|
| 3185 | +int view_x1 = 80; |
---|
| 3186 | +int view_y1 = 30; |
---|
| 3187 | + |
---|
| 3188 | +/* text buffer has to be kept around so that we can write things as we |
---|
| 3189 | + * scroll and the like */ |
---|
| 3190 | +unsigned short text[80 * 30]; |
---|
| 3191 | + |
---|
| 3192 | +/* graphics options */ |
---|
| 3193 | +int foreground = (63 << 16) | (63 << 8) | (63), background = 0, window_border = 0; |
---|
| 3194 | + |
---|
| 3195 | +/* current position */ |
---|
| 3196 | +static int fontx = 0; |
---|
| 3197 | +static int fonty = 0; |
---|
| 3198 | + |
---|
| 3199 | +/* global state so that we don't try to recursively scroll or cursor */ |
---|
| 3200 | +static int no_scroll = 0; |
---|
| 3201 | + |
---|
| 3202 | +/* color state */ |
---|
| 3203 | +static int graphics_standard_color = A_NORMAL; |
---|
| 3204 | +static int graphics_normal_color = A_NORMAL; |
---|
| 3205 | +static int graphics_highlight_color = A_REVERSE; |
---|
| 3206 | +static int graphics_current_color = A_NORMAL; |
---|
| 3207 | +static color_state graphics_color_state = COLOR_STATE_STANDARD; |
---|
| 3208 | + |
---|
| 3209 | +static inline void outb(unsigned short port, unsigned char val) |
---|
| 3210 | +{ |
---|
| 3211 | + __asm __volatile ("outb %0,%1"::"a" (val), "d" (port)); |
---|
| 3212 | +} |
---|
| 3213 | + |
---|
| 3214 | +static void MapMask(int value) { |
---|
| 3215 | + outb(0x3c4, 2); |
---|
| 3216 | + outb(0x3c5, value); |
---|
| 3217 | +} |
---|
| 3218 | + |
---|
| 3219 | +/* bit mask register */ |
---|
| 3220 | +static void BitMask(int value) { |
---|
| 3221 | + outb(0x3ce, 8); |
---|
| 3222 | + outb(0x3cf, value); |
---|
| 3223 | +} |
---|
| 3224 | + |
---|
| 3225 | +/* move the graphics cursor location to col, row */ |
---|
| 3226 | +static void graphics_setxy(int col, int row) { |
---|
| 3227 | + if (col >= view_x0 && col < view_x1) { |
---|
| 3228 | + fontx = col; |
---|
| 3229 | + cursorX = col << 3; |
---|
| 3230 | + } |
---|
| 3231 | + if (row >= view_y0 && row < view_y1) { |
---|
| 3232 | + fonty = row; |
---|
| 3233 | + cursorY = row << 4; |
---|
| 3234 | + } |
---|
| 3235 | +} |
---|
| 3236 | + |
---|
| 3237 | +/* scroll the screen */ |
---|
| 3238 | +static void graphics_scroll() { |
---|
| 3239 | + int i, j, k; |
---|
| 3240 | + |
---|
| 3241 | + /* we don't want to scroll recursively... that would be bad */ |
---|
| 3242 | + if (no_scroll) |
---|
| 3243 | + return; |
---|
| 3244 | + no_scroll = 1; |
---|
| 3245 | + |
---|
| 3246 | + /* disable pager temporarily */ |
---|
| 3247 | + k = count_lines; |
---|
| 3248 | + count_lines = -1; |
---|
| 3249 | + |
---|
| 3250 | + /* move everything up a line */ |
---|
| 3251 | + for (j = view_y0 + 1; j < view_y1; j++) { |
---|
| 3252 | + graphics_gotoxy(view_x0, j - 1); |
---|
| 3253 | + for (i = view_x0; i < view_x1; i++) { |
---|
| 3254 | + graphics_putchar(text[j * 80 + i]); |
---|
| 3255 | + } |
---|
| 3256 | + } |
---|
| 3257 | + |
---|
| 3258 | + /* last line should be blank */ |
---|
| 3259 | + graphics_gotoxy(view_x0, view_y1 - 1); |
---|
| 3260 | + for (i = view_x0; i < view_x1; i++) |
---|
| 3261 | + graphics_putchar(' '); |
---|
| 3262 | + graphics_setxy(view_x0, view_y1 - 1); |
---|
| 3263 | + |
---|
| 3264 | + count_lines = k; |
---|
| 3265 | + |
---|
| 3266 | + no_scroll = 0; |
---|
| 3267 | +} |
---|
| 3268 | + |
---|
| 3269 | +/* Set the splash image */ |
---|
| 3270 | +void graphics_set_splash(char *splashfile) { |
---|
| 3271 | + grub_strcpy(splashimage, splashfile); |
---|
| 3272 | +} |
---|
| 3273 | + |
---|
| 3274 | +/* Get the current splash image */ |
---|
| 3275 | +char *graphics_get_splash(void) { |
---|
| 3276 | + return splashimage; |
---|
| 3277 | +} |
---|
| 3278 | + |
---|
| 3279 | +/* |
---|
| 3280 | + * Initialize a vga16 graphics display with the palette based off of |
---|
| 3281 | + * the image in splashimage. If the image doesn't exist, leave graphics |
---|
| 3282 | + * mode. The mode initiated is 12h. From "Ralf Brown's Interrupt List": |
---|
| 3283 | + * text/ text pixel pixel colors disply scrn system |
---|
| 3284 | + * grph resol box resolution pages addr |
---|
| 3285 | + * 12h G 80x30 8x16 640x480 16/256K . A000 VGA,ATI VIP |
---|
| 3286 | + * G 80x30 8x16 640x480 16/64 . A000 ATI EGA Wonder |
---|
| 3287 | + * G . . 640x480 16 . . UltraVision+256K EGA |
---|
| 3288 | + */ |
---|
| 3289 | +int graphics_init() |
---|
| 3290 | +{ |
---|
| 3291 | + if (!graphics_inited) { |
---|
| 3292 | + saved_videomode = set_videomode(0x12); |
---|
| 3293 | + if (get_videomode() != 0x12) { |
---|
| 3294 | + set_videomode(saved_videomode); |
---|
| 3295 | + return 0; |
---|
| 3296 | + } |
---|
| 3297 | + graphics_inited = 1; |
---|
| 3298 | + } |
---|
| 3299 | + else |
---|
| 3300 | + return 1; |
---|
| 3301 | + |
---|
| 3302 | + font8x16 = (unsigned char*)graphics_get_font(); |
---|
| 3303 | + |
---|
| 3304 | + /* make sure that the highlight color is set correctly */ |
---|
| 3305 | + graphics_highlight_color = ((graphics_normal_color >> 4) | |
---|
| 3306 | + ((graphics_normal_color & 0xf) << 4)); |
---|
| 3307 | + |
---|
| 3308 | + graphics_cls(); |
---|
| 3309 | + |
---|
| 3310 | + if (!read_image(splashimage)) { |
---|
| 3311 | + grub_printf("Failed to read splash image (%s)\n", splashimage); |
---|
| 3312 | + grub_printf("Press any key to continue..."); |
---|
| 3313 | + getkey(); |
---|
| 3314 | + set_videomode(saved_videomode); |
---|
| 3315 | + graphics_inited = 0; |
---|
| 3316 | + return 0; |
---|
| 3317 | + } |
---|
| 3318 | + |
---|
| 3319 | + set_int1c_handler(); |
---|
| 3320 | + |
---|
| 3321 | + return 1; |
---|
| 3322 | +} |
---|
| 3323 | + |
---|
| 3324 | +/* Leave graphics mode */ |
---|
| 3325 | +void graphics_end(void) |
---|
| 3326 | +{ |
---|
| 3327 | + if (graphics_inited) { |
---|
| 3328 | + unset_int1c_handler(); |
---|
| 3329 | + set_videomode(saved_videomode); |
---|
| 3330 | + graphics_inited = 0; |
---|
| 3331 | + no_cursor = 0; |
---|
| 3332 | + } |
---|
| 3333 | +} |
---|
| 3334 | + |
---|
| 3335 | +/* Print ch on the screen. Handle any needed scrolling or the like */ |
---|
| 3336 | +void graphics_putchar(int ch) { |
---|
| 3337 | + ch &= 0xff; |
---|
| 3338 | + |
---|
| 3339 | + graphics_cursor(0); |
---|
| 3340 | + |
---|
| 3341 | + if (ch == '\n') { |
---|
| 3342 | + if (fonty + 1 < view_y1) |
---|
| 3343 | + graphics_setxy(fontx, fonty + 1); |
---|
| 3344 | + else |
---|
| 3345 | + graphics_scroll(); |
---|
| 3346 | + graphics_cursor(1); |
---|
| 3347 | + return; |
---|
| 3348 | + } else if (ch == '\r') { |
---|
| 3349 | + graphics_setxy(view_x0, fonty); |
---|
| 3350 | + graphics_cursor(1); |
---|
| 3351 | + return; |
---|
| 3352 | + } |
---|
| 3353 | + |
---|
| 3354 | + graphics_cursor(0); |
---|
| 3355 | + |
---|
| 3356 | + text[fonty * 80 + fontx] = ch; |
---|
| 3357 | + text[fonty * 80 + fontx] &= 0x00ff; |
---|
| 3358 | + if (graphics_current_color & 0xf0) |
---|
| 3359 | + text[fonty * 80 + fontx] |= 0x100; |
---|
| 3360 | + |
---|
| 3361 | + graphics_cursor(0); |
---|
| 3362 | + |
---|
| 3363 | + if ((fontx + 1) >= view_x1) { |
---|
| 3364 | + graphics_setxy(view_x0, fonty); |
---|
| 3365 | + if (fonty + 1 < view_y1) |
---|
| 3366 | + graphics_setxy(view_x0, fonty + 1); |
---|
| 3367 | + else |
---|
| 3368 | + graphics_scroll(); |
---|
| 3369 | + graphics_cursor(1); |
---|
| 3370 | + do_more (); |
---|
| 3371 | + graphics_cursor(0); |
---|
| 3372 | + } else { |
---|
| 3373 | + graphics_setxy(fontx + 1, fonty); |
---|
| 3374 | + } |
---|
| 3375 | + |
---|
| 3376 | + graphics_cursor(1); |
---|
| 3377 | +} |
---|
| 3378 | + |
---|
| 3379 | +/* get the current location of the cursor */ |
---|
| 3380 | +int graphics_getxy(void) { |
---|
| 3381 | + return (fontx << 8) | fonty; |
---|
| 3382 | +} |
---|
| 3383 | + |
---|
| 3384 | +void graphics_gotoxy(int x, int y) { |
---|
| 3385 | + graphics_cursor(0); |
---|
| 3386 | + |
---|
| 3387 | + graphics_setxy(x, y); |
---|
| 3388 | + |
---|
| 3389 | + graphics_cursor(1); |
---|
| 3390 | +} |
---|
| 3391 | + |
---|
| 3392 | +void graphics_cls(void) { |
---|
| 3393 | + int i; |
---|
| 3394 | + unsigned char *mem, *s1, *s2, *s4, *s8; |
---|
| 3395 | + |
---|
| 3396 | + graphics_cursor(0); |
---|
| 3397 | + graphics_gotoxy(view_x0, view_y0); |
---|
| 3398 | + |
---|
| 3399 | + mem = (unsigned char*)VIDEOMEM; |
---|
| 3400 | + s1 = (unsigned char*)VSHADOW1; |
---|
| 3401 | + s2 = (unsigned char*)VSHADOW2; |
---|
| 3402 | + s4 = (unsigned char*)VSHADOW4; |
---|
| 3403 | + s8 = (unsigned char*)VSHADOW8; |
---|
| 3404 | + |
---|
| 3405 | + for (i = 0; i < 80 * 30; i++) |
---|
| 3406 | + text[i] = ' '; |
---|
| 3407 | + graphics_cursor(1); |
---|
| 3408 | + |
---|
| 3409 | + BitMask(0xff); |
---|
| 3410 | + |
---|
| 3411 | + /* plane 1 */ |
---|
| 3412 | + MapMask(1); |
---|
| 3413 | + grub_memcpy(mem, s1, 38400); |
---|
| 3414 | + |
---|
| 3415 | + /* plane 2 */ |
---|
| 3416 | + MapMask(2); |
---|
| 3417 | + grub_memcpy(mem, s2, 38400); |
---|
| 3418 | + |
---|
| 3419 | + /* plane 3 */ |
---|
| 3420 | + MapMask(4); |
---|
| 3421 | + grub_memcpy(mem, s4, 38400); |
---|
| 3422 | + |
---|
| 3423 | + /* plane 4 */ |
---|
| 3424 | + MapMask(8); |
---|
| 3425 | + grub_memcpy(mem, s8, 38400); |
---|
| 3426 | + |
---|
| 3427 | + MapMask(15); |
---|
| 3428 | + |
---|
| 3429 | + if (no_cursor) { |
---|
| 3430 | + no_cursor = 0; |
---|
| 3431 | + set_int1c_handler(); |
---|
| 3432 | + } |
---|
| 3433 | +} |
---|
| 3434 | + |
---|
| 3435 | +void graphics_setcolorstate (color_state state) { |
---|
| 3436 | + switch (state) { |
---|
| 3437 | + case COLOR_STATE_STANDARD: |
---|
| 3438 | + graphics_current_color = graphics_standard_color; |
---|
| 3439 | + break; |
---|
| 3440 | + case COLOR_STATE_NORMAL: |
---|
| 3441 | + graphics_current_color = graphics_normal_color; |
---|
| 3442 | + break; |
---|
| 3443 | + case COLOR_STATE_HIGHLIGHT: |
---|
| 3444 | + graphics_current_color = graphics_highlight_color; |
---|
| 3445 | + break; |
---|
| 3446 | + default: |
---|
| 3447 | + graphics_current_color = graphics_standard_color; |
---|
| 3448 | + break; |
---|
| 3449 | + } |
---|
| 3450 | + |
---|
| 3451 | + graphics_color_state = state; |
---|
| 3452 | +} |
---|
| 3453 | + |
---|
| 3454 | +void graphics_setcolor (int normal_color, int highlight_color) { |
---|
| 3455 | + graphics_normal_color = normal_color; |
---|
| 3456 | + graphics_highlight_color = highlight_color; |
---|
| 3457 | + |
---|
| 3458 | + graphics_setcolorstate (graphics_color_state); |
---|
| 3459 | +} |
---|
| 3460 | + |
---|
| 3461 | +int graphics_setcursor (int on) { |
---|
| 3462 | + if (!no_cursor && !on) { |
---|
| 3463 | + no_cursor = 1; |
---|
| 3464 | + unset_int1c_handler(); |
---|
| 3465 | + graphics_cursor(0); |
---|
| 3466 | + } |
---|
| 3467 | + else if(no_cursor && on) { |
---|
| 3468 | + no_cursor = 0; |
---|
| 3469 | + set_int1c_handler(); |
---|
| 3470 | + graphics_cursor(1); |
---|
| 3471 | + } |
---|
| 3472 | + return 0; |
---|
| 3473 | +} |
---|
| 3474 | + |
---|
| 3475 | +/* Read in the splashscreen image and set the palette up appropriately. |
---|
| 3476 | + * Format of splashscreen is an xpm (can be gzipped) with 16 colors and |
---|
| 3477 | + * 640x480. */ |
---|
| 3478 | +int read_image(char *s) |
---|
| 3479 | +{ |
---|
| 3480 | + char buf[32], pal[16], c; |
---|
| 3481 | + unsigned char base, mask, *s1, *s2, *s4, *s8; |
---|
| 3482 | + unsigned i, len, idx, colors, x, y, width, height; |
---|
| 3483 | + |
---|
| 3484 | + if (!grub_open(s)) |
---|
| 3485 | + return 0; |
---|
| 3486 | + |
---|
| 3487 | + /* read header */ |
---|
| 3488 | + if (!grub_read((char*)&buf, 10) || grub_memcmp(buf, "/* XPM */\n", 10)) { |
---|
| 3489 | + grub_close(); |
---|
| 3490 | + return 0; |
---|
| 3491 | + } |
---|
| 3492 | + |
---|
| 3493 | + /* parse info */ |
---|
| 3494 | + while (grub_read(&c, 1)) { |
---|
| 3495 | + if (c == '"') |
---|
| 3496 | + break; |
---|
| 3497 | + } |
---|
| 3498 | + |
---|
| 3499 | + while (grub_read(&c, 1) && (c == ' ' || c == '\t')) |
---|
| 3500 | + ; |
---|
| 3501 | + |
---|
| 3502 | + i = 0; |
---|
| 3503 | + width = c - '0'; |
---|
| 3504 | + while (grub_read(&c, 1)) { |
---|
| 3505 | + if (c >= '0' && c <= '9') |
---|
| 3506 | + width = width * 10 + c - '0'; |
---|
| 3507 | + else |
---|
| 3508 | + break; |
---|
| 3509 | + } |
---|
| 3510 | + while (grub_read(&c, 1) && (c == ' ' || c == '\t')) |
---|
| 3511 | + ; |
---|
| 3512 | + |
---|
| 3513 | + height = c - '0'; |
---|
| 3514 | + while (grub_read(&c, 1)) { |
---|
| 3515 | + if (c >= '0' && c <= '9') |
---|
| 3516 | + height = height * 10 + c - '0'; |
---|
| 3517 | + else |
---|
| 3518 | + break; |
---|
| 3519 | + } |
---|
| 3520 | + while (grub_read(&c, 1) && (c == ' ' || c == '\t')) |
---|
| 3521 | + ; |
---|
| 3522 | + |
---|
| 3523 | + colors = c - '0'; |
---|
| 3524 | + while (grub_read(&c, 1)) { |
---|
| 3525 | + if (c >= '0' && c <= '9') |
---|
| 3526 | + colors = colors * 10 + c - '0'; |
---|
| 3527 | + else |
---|
| 3528 | + break; |
---|
| 3529 | + } |
---|
| 3530 | + |
---|
| 3531 | + base = 0; |
---|
| 3532 | + while (grub_read(&c, 1) && c != '"') |
---|
| 3533 | + ; |
---|
| 3534 | + |
---|
| 3535 | + /* palette */ |
---|
| 3536 | + for (i = 0, idx = 1; i < colors; i++) { |
---|
| 3537 | + len = 0; |
---|
| 3538 | + |
---|
| 3539 | + while (grub_read(&c, 1) && c != '"') |
---|
| 3540 | + ; |
---|
| 3541 | + grub_read(&c, 1); /* char */ |
---|
| 3542 | + base = c; |
---|
| 3543 | + grub_read(buf, 4); /* \t c # */ |
---|
| 3544 | + |
---|
| 3545 | + while (grub_read(&c, 1) && c != '"') { |
---|
| 3546 | + if (len < sizeof(buf)) |
---|
| 3547 | + buf[len++] = c; |
---|
| 3548 | + } |
---|
| 3549 | + |
---|
| 3550 | + if (len == 6 && idx < 15) { |
---|
| 3551 | + int r = ((hex(buf[0]) << 4) | hex(buf[1])) >> 2; |
---|
| 3552 | + int g = ((hex(buf[2]) << 4) | hex(buf[3])) >> 2; |
---|
| 3553 | + int b = ((hex(buf[4]) << 4) | hex(buf[5])) >> 2; |
---|
| 3554 | + |
---|
| 3555 | + pal[idx] = base; |
---|
| 3556 | + graphics_set_palette(idx, r, g, b); |
---|
| 3557 | + ++idx; |
---|
| 3558 | + } |
---|
| 3559 | + } |
---|
| 3560 | + |
---|
| 3561 | + x = y = len = 0; |
---|
| 3562 | + |
---|
| 3563 | + s1 = (unsigned char*)VSHADOW1; |
---|
| 3564 | + s2 = (unsigned char*)VSHADOW2; |
---|
| 3565 | + s4 = (unsigned char*)VSHADOW4; |
---|
| 3566 | + s8 = (unsigned char*)VSHADOW8; |
---|
| 3567 | + |
---|
| 3568 | + for (i = 0; i < 38400; i++) |
---|
| 3569 | + s1[i] = s2[i] = s4[i] = s8[i] = 0; |
---|
| 3570 | + |
---|
| 3571 | + /* parse xpm data */ |
---|
| 3572 | + while (y < height) { |
---|
| 3573 | + while (1) { |
---|
| 3574 | + if (!grub_read(&c, 1)) { |
---|
| 3575 | + grub_close(); |
---|
| 3576 | + return 0; |
---|
| 3577 | + } |
---|
| 3578 | + if (c == '"') |
---|
| 3579 | + break; |
---|
| 3580 | + } |
---|
| 3581 | + |
---|
| 3582 | + while (grub_read(&c, 1) && c != '"') { |
---|
| 3583 | + for (i = 1; i < 15; i++) |
---|
| 3584 | + if (pal[i] == c) { |
---|
| 3585 | + c = i; |
---|
| 3586 | + break; |
---|
| 3587 | + } |
---|
| 3588 | + |
---|
| 3589 | + mask = 0x80 >> (x & 7); |
---|
| 3590 | + if (c & 1) |
---|
| 3591 | + s1[len + (x >> 3)] |= mask; |
---|
| 3592 | + if (c & 2) |
---|
| 3593 | + s2[len + (x >> 3)] |= mask; |
---|
| 3594 | + if (c & 4) |
---|
| 3595 | + s4[len + (x >> 3)] |= mask; |
---|
| 3596 | + if (c & 8) |
---|
| 3597 | + s8[len + (x >> 3)] |= mask; |
---|
| 3598 | + |
---|
| 3599 | + if (++x >= 640) { |
---|
| 3600 | + x = 0; |
---|
| 3601 | + |
---|
| 3602 | + if (y < 480) |
---|
| 3603 | + len += 80; |
---|
| 3604 | + ++y; |
---|
| 3605 | + } |
---|
| 3606 | + } |
---|
| 3607 | + } |
---|
| 3608 | + |
---|
| 3609 | + grub_close(); |
---|
| 3610 | + |
---|
| 3611 | + graphics_set_palette(0, (background >> 16), (background >> 8) & 63, |
---|
| 3612 | + background & 63); |
---|
| 3613 | + graphics_set_palette(15, (foreground >> 16), (foreground >> 8) & 63, |
---|
| 3614 | + foreground & 63); |
---|
| 3615 | + graphics_set_palette(0x11, (window_border >> 16), (window_border >> 8) & 63, |
---|
| 3616 | + window_border & 63); |
---|
| 3617 | + |
---|
| 3618 | + return 1; |
---|
| 3619 | +} |
---|
| 3620 | + |
---|
| 3621 | +/* Convert a character which is a hex digit to the appropriate integer */ |
---|
| 3622 | +int hex(int v) |
---|
| 3623 | +{ |
---|
| 3624 | + if (v >= 'A' && v <= 'F') |
---|
| 3625 | + return (v - 'A' + 10); |
---|
| 3626 | + if (v >= 'a' && v <= 'f') |
---|
| 3627 | + return (v - 'a' + 10); |
---|
| 3628 | + return (v - '0'); |
---|
| 3629 | +} |
---|
| 3630 | + |
---|
| 3631 | +void graphics_cursor(int set) { |
---|
| 3632 | + unsigned char *pat, *mem, *ptr, chr[16 << 2]; |
---|
| 3633 | + int i, ch, invert, offset; |
---|
| 3634 | + |
---|
| 3635 | + if (set && (no_cursor || no_scroll)) |
---|
| 3636 | + return; |
---|
| 3637 | + |
---|
| 3638 | + offset = cursorY * 80 + fontx; |
---|
| 3639 | + ch = text[fonty * 80 + fontx] & 0xff; |
---|
| 3640 | + invert = (text[fonty * 80 + fontx] & 0xff00) != 0; |
---|
| 3641 | + pat = font8x16 + (ch << 4); |
---|
| 3642 | + |
---|
| 3643 | + mem = (unsigned char*)VIDEOMEM + offset; |
---|
| 3644 | + |
---|
| 3645 | + if (!set) { |
---|
| 3646 | + for (i = 0; i < 16; i++) { |
---|
| 3647 | + unsigned char mask = pat[i]; |
---|
| 3648 | + |
---|
| 3649 | + if (!invert) { |
---|
| 3650 | + chr[i ] = ((unsigned char*)VSHADOW1)[offset]; |
---|
| 3651 | + chr[16 + i] = ((unsigned char*)VSHADOW2)[offset]; |
---|
| 3652 | + chr[32 + i] = ((unsigned char*)VSHADOW4)[offset]; |
---|
| 3653 | + chr[48 + i] = ((unsigned char*)VSHADOW8)[offset]; |
---|
| 3654 | + |
---|
| 3655 | + if (shade) { |
---|
| 3656 | + if (ch == DISP_VERT || ch == DISP_LL || |
---|
| 3657 | + ch == DISP_UR || ch == DISP_LR) { |
---|
| 3658 | + unsigned char pmask = ~(pat[i] >> 1); |
---|
| 3659 | + |
---|
| 3660 | + chr[i ] &= pmask; |
---|
| 3661 | + chr[16 + i] &= pmask; |
---|
| 3662 | + chr[32 + i] &= pmask; |
---|
| 3663 | + chr[48 + i] &= pmask; |
---|
| 3664 | + } |
---|
| 3665 | + if (i > 0 && ch != DISP_VERT) { |
---|
| 3666 | + unsigned char pmask = ~(pat[i - 1] >> 1); |
---|
| 3667 | + |
---|
| 3668 | + chr[i ] &= pmask; |
---|
| 3669 | + chr[16 + i] &= pmask; |
---|
| 3670 | + chr[32 + i] &= pmask; |
---|
| 3671 | + chr[48 + i] &= pmask; |
---|
| 3672 | + if (ch == DISP_HORIZ || ch == DISP_UR || ch == DISP_LR) { |
---|
| 3673 | + pmask = ~pat[i - 1]; |
---|
| 3674 | + |
---|
| 3675 | + chr[i ] &= pmask; |
---|
| 3676 | + chr[16 + i] &= pmask; |
---|
| 3677 | + chr[32 + i] &= pmask; |
---|
| 3678 | + chr[48 + i] &= pmask; |
---|
| 3679 | + } |
---|
| 3680 | + } |
---|
| 3681 | + } |
---|
| 3682 | + chr[i ] |= mask; |
---|
| 3683 | + chr[16 + i] |= mask; |
---|
| 3684 | + chr[32 + i] |= mask; |
---|
| 3685 | + chr[48 + i] |= mask; |
---|
| 3686 | + |
---|
| 3687 | + offset += 80; |
---|
| 3688 | + } |
---|
| 3689 | + else { |
---|
| 3690 | + chr[i ] = mask; |
---|
| 3691 | + chr[16 + i] = mask; |
---|
| 3692 | + chr[32 + i] = mask; |
---|
| 3693 | + chr[48 + i] = mask; |
---|
| 3694 | + } |
---|
| 3695 | + } |
---|
| 3696 | + } |
---|
| 3697 | + else { |
---|
| 3698 | + MapMask(15); |
---|
| 3699 | + ptr = mem; |
---|
| 3700 | + for (i = 0; i < 16; i++, ptr += 80) { |
---|
| 3701 | + cursorBuf[i] = pat[i]; |
---|
| 3702 | + *ptr = ~pat[i]; |
---|
| 3703 | + } |
---|
| 3704 | + return; |
---|
| 3705 | + } |
---|
| 3706 | + |
---|
| 3707 | + offset = 0; |
---|
| 3708 | + for (i = 1; i < 16; i <<= 1, offset += 16) { |
---|
| 3709 | + int j; |
---|
| 3710 | + |
---|
| 3711 | + MapMask(i); |
---|
| 3712 | + ptr = mem; |
---|
| 3713 | + for (j = 0; j < 16; j++, ptr += 80) |
---|
| 3714 | + *ptr = chr[j + offset]; |
---|
| 3715 | + } |
---|
| 3716 | + |
---|
| 3717 | + MapMask(15); |
---|
| 3718 | +} |
---|
| 3719 | + |
---|
| 3720 | +#endif /* SUPPORT_GRAPHICS */ |
---|
| 3721 | diff -Naur grub-0.97.orig/stage2/graphics.h grub-0.97/stage2/graphics.h |
---|
| 3722 | --- grub-0.97.orig/stage2/graphics.h 1969-12-31 16:00:00.000000000 -0800 |
---|
| 3723 | +++ grub-0.97/stage2/graphics.h 2006-07-03 23:58:41.000000000 -0700 |
---|
| 3724 | @@ -0,0 +1,44 @@ |
---|
| 3725 | +/* graphics.h - graphics console interface */ |
---|
| 3726 | +/* |
---|
| 3727 | + * GRUB -- GRand Unified Bootloader |
---|
| 3728 | + * Copyright (C) 2002 Free Software Foundation, Inc. |
---|
| 3729 | + * |
---|
| 3730 | + * This program is free software; you can redistribute it and/or modify |
---|
| 3731 | + * it under the terms of the GNU General Public License as published by |
---|
| 3732 | + * the Free Software Foundation; either version 2 of the License, or |
---|
| 3733 | + * (at your option) any later version. |
---|
| 3734 | + * |
---|
| 3735 | + * This program is distributed in the hope that it will be useful, |
---|
| 3736 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 3737 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 3738 | + * GNU General Public License for more details. |
---|
| 3739 | + * |
---|
| 3740 | + * You should have received a copy of the GNU General Public License |
---|
| 3741 | + * along with this program; if not, write to the Free Software |
---|
| 3742 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
---|
| 3743 | + */ |
---|
| 3744 | + |
---|
| 3745 | +#ifndef GRAPHICS_H |
---|
| 3746 | +#define GRAPHICS_H |
---|
| 3747 | + |
---|
| 3748 | +/* magic constant */ |
---|
| 3749 | +#define VIDEOMEM 0xA0000 |
---|
| 3750 | + |
---|
| 3751 | +/* function prototypes */ |
---|
| 3752 | +char *graphics_get_splash(void); |
---|
| 3753 | + |
---|
| 3754 | +int read_image(char *s); |
---|
| 3755 | +void graphics_cursor(int set); |
---|
| 3756 | + |
---|
| 3757 | +/* function prototypes for asm functions */ |
---|
| 3758 | +void * graphics_get_font(); |
---|
| 3759 | +void graphics_set_palette(int idx, int red, int green, int blue); |
---|
| 3760 | +void set_int1c_handler(); |
---|
| 3761 | +void unset_int1c_handler(); |
---|
| 3762 | + |
---|
| 3763 | +extern short cursorX, cursorY; |
---|
| 3764 | +extern char cursorBuf[16]; |
---|
| 3765 | +extern int shade; |
---|
| 3766 | +extern int view_x0, view_y0, view_x1, view_y1; |
---|
| 3767 | + |
---|
| 3768 | +#endif /* GRAPHICS_H */ |
---|
| 3769 | diff -Naur grub-0.97.orig/stage2/Makefile.am grub-0.97/stage2/Makefile.am |
---|
| 3770 | --- grub-0.97.orig/stage2/Makefile.am 2005-02-02 12:37:35.000000000 -0800 |
---|
| 3771 | +++ grub-0.97/stage2/Makefile.am 2006-07-03 23:58:41.000000000 -0700 |
---|
| 3772 | @@ -7,7 +7,7 @@ |
---|
| 3773 | fat.h filesys.h freebsd.h fs.h hercules.h i386-elf.h \ |
---|
| 3774 | imgact_aout.h iso9660.h jfs.h mb_header.h mb_info.h md5.h \ |
---|
| 3775 | nbi.h pc_slice.h serial.h shared.h smp-imps.h term.h \ |
---|
| 3776 | - terminfo.h tparm.h nbi.h ufs2.h vstafs.h xfs.h |
---|
| 3777 | + terminfo.h tparm.h nbi.h ufs2.h vstafs.h xfs.h graphics.h |
---|
| 3778 | EXTRA_DIST = setjmp.S apm.S $(noinst_SCRIPTS) |
---|
| 3779 | |
---|
| 3780 | # For <stage1.h>. |
---|
| 3781 | @@ -19,7 +19,7 @@ |
---|
| 3782 | disk_io.c fsys_ext2fs.c fsys_fat.c fsys_ffs.c fsys_iso9660.c \ |
---|
| 3783 | fsys_jfs.c fsys_minix.c fsys_reiserfs.c fsys_ufs2.c \ |
---|
| 3784 | fsys_vstafs.c fsys_xfs.c gunzip.c md5.c serial.c stage2.c \ |
---|
| 3785 | - terminfo.c tparm.c |
---|
| 3786 | + terminfo.c tparm.c graphics.c |
---|
| 3787 | libgrub_a_CFLAGS = $(GRUB_CFLAGS) -I$(top_srcdir)/lib \ |
---|
| 3788 | -DGRUB_UTIL=1 -DFSYS_EXT2FS=1 -DFSYS_FAT=1 -DFSYS_FFS=1 \ |
---|
| 3789 | -DFSYS_ISO9660=1 -DFSYS_JFS=1 -DFSYS_MINIX=1 -DFSYS_REISERFS=1 \ |
---|
| 3790 | @@ -79,8 +79,14 @@ |
---|
| 3791 | HERCULES_FLAGS = |
---|
| 3792 | endif |
---|
| 3793 | |
---|
| 3794 | +if GRAPHICS_SUPPORT |
---|
| 3795 | +GRAPHICS_FLAGS = -DSUPPORT_GRAPHICS=1 |
---|
| 3796 | +else |
---|
| 3797 | +GRAPHICS_FLAGS = |
---|
| 3798 | +endif |
---|
| 3799 | + |
---|
| 3800 | STAGE2_COMPILE = $(STAGE2_CFLAGS) -fno-builtin -nostdinc \ |
---|
| 3801 | - $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) |
---|
| 3802 | + $(NETBOOT_FLAGS) $(SERIAL_FLAGS) $(HERCULES_FLAGS) $(GRAPHICS_FLAGS) |
---|
| 3803 | |
---|
| 3804 | STAGE1_5_LINK = -nostdlib -Wl,-N -Wl,-Ttext -Wl,2000 |
---|
| 3805 | STAGE1_5_COMPILE = $(STAGE2_COMPILE) -DNO_DECOMPRESSION=1 -DSTAGE1_5=1 |
---|
| 3806 | @@ -90,7 +96,8 @@ |
---|
| 3807 | cmdline.c common.c console.c disk_io.c fsys_ext2fs.c \ |
---|
| 3808 | fsys_fat.c fsys_ffs.c fsys_iso9660.c fsys_jfs.c fsys_minix.c \ |
---|
| 3809 | fsys_reiserfs.c fsys_ufs2.c fsys_vstafs.c fsys_xfs.c gunzip.c \ |
---|
| 3810 | - hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c |
---|
| 3811 | + hercules.c md5.c serial.c smp-imps.c stage2.c terminfo.c tparm.c \ |
---|
| 3812 | + graphics.c |
---|
| 3813 | pre_stage2_exec_CFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) |
---|
| 3814 | pre_stage2_exec_CCASFLAGS = $(STAGE2_COMPILE) $(FSYS_CFLAGS) |
---|
| 3815 | pre_stage2_exec_LDFLAGS = $(PRE_STAGE2_LINK) |
---|
| 3816 | diff -Naur grub-0.97.orig/stage2/shared.h grub-0.97/stage2/shared.h |
---|
| 3817 | --- grub-0.97.orig/stage2/shared.h 2004-06-19 09:40:09.000000000 -0700 |
---|
| 3818 | +++ grub-0.97/stage2/shared.h 2006-07-04 00:01:50.000000000 -0700 |
---|
| 3819 | @@ -499,7 +499,11 @@ |
---|
| 3820 | unsigned char linear_reserved_field_position; |
---|
| 3821 | unsigned long max_pixel_clock; |
---|
| 3822 | |
---|
| 3823 | - unsigned char reserved3[189]; |
---|
| 3824 | + /* Reserved field to make structure to be 256 bytes long, VESA BIOS |
---|
| 3825 | + Extension 3.0 Specification says to reserve 189 bytes here but |
---|
| 3826 | + that doesn't make structure to be 256 bytes. So additional one is |
---|
| 3827 | + added here. */ |
---|
| 3828 | + unsigned char reserved3[189 + 1]; |
---|
| 3829 | } __attribute__ ((packed)); |
---|
| 3830 | |
---|
| 3831 | |
---|
| 3832 | @@ -792,6 +796,11 @@ |
---|
| 3833 | /* Set the cursor position. */ |
---|
| 3834 | void gotoxy (int x, int y); |
---|
| 3835 | |
---|
| 3836 | +/* Internal pager |
---|
| 3837 | + Returns 1 = if pager was used |
---|
| 3838 | + 0 = if pager wasn't used */ |
---|
| 3839 | +int do_more (void); |
---|
| 3840 | + |
---|
| 3841 | /* Displays an ASCII character. IBM displays will translate some |
---|
| 3842 | characters to special graphical ones (see the DISP_* constants). */ |
---|
| 3843 | void grub_putchar (int c); |
---|
| 3844 | @@ -871,6 +880,7 @@ |
---|
| 3845 | int grub_tolower (int c); |
---|
| 3846 | int grub_isspace (int c); |
---|
| 3847 | int grub_strncat (char *s1, const char *s2, int n); |
---|
| 3848 | +void grub_memcpy(void *dest, const void *src, int len); |
---|
| 3849 | void *grub_memmove (void *to, const void *from, int len); |
---|
| 3850 | void *grub_memset (void *start, int c, int len); |
---|
| 3851 | int grub_strncat (char *s1, const char *s2, int n); |
---|
| 3852 | @@ -911,7 +921,7 @@ |
---|
| 3853 | int nul_terminate (char *str); |
---|
| 3854 | int get_based_digit (int c, int base); |
---|
| 3855 | int safe_parse_maxint (char **str_ptr, int *myint_ptr); |
---|
| 3856 | -int memcheck (int start, int len); |
---|
| 3857 | +int memcheck (unsigned long int start, unsigned long int len); |
---|
| 3858 | void grub_putstr (const char *str); |
---|
| 3859 | |
---|
| 3860 | #ifndef NO_DECOMPRESSION |
---|
| 3861 | diff -Naur grub-0.97.orig/stage2/stage2.c grub-0.97/stage2/stage2.c |
---|
| 3862 | --- grub-0.97.orig/stage2/stage2.c 2005-03-19 09:51:57.000000000 -0800 |
---|
| 3863 | +++ grub-0.97/stage2/stage2.c 2006-07-04 00:01:50.000000000 -0700 |
---|
| 3864 | @@ -20,6 +20,12 @@ |
---|
| 3865 | #include <shared.h> |
---|
| 3866 | #include <term.h> |
---|
| 3867 | |
---|
| 3868 | +#ifdef SUPPORT_GRAPHICS |
---|
| 3869 | +# include <graphics.h> |
---|
| 3870 | +#endif |
---|
| 3871 | + |
---|
| 3872 | +int col_start, col_end, row_start, box_size; |
---|
| 3873 | + |
---|
| 3874 | grub_jmp_buf restart_env; |
---|
| 3875 | |
---|
| 3876 | #if defined(PRESET_MENU_STRING) || defined(SUPPORT_DISKLESS) |
---|
| 3877 | @@ -105,13 +111,13 @@ |
---|
| 3878 | if (highlight && current_term->setcolorstate) |
---|
| 3879 | current_term->setcolorstate (COLOR_STATE_HIGHLIGHT); |
---|
| 3880 | |
---|
| 3881 | - gotoxy (2, y); |
---|
| 3882 | + gotoxy (2 + col_start, y); |
---|
| 3883 | grub_putchar (' '); |
---|
| 3884 | - for (x = 3; x < 75; x++) |
---|
| 3885 | + for (x = 3 + col_start; x < (col_end - 5); x++) |
---|
| 3886 | { |
---|
| 3887 | - if (*entry && x <= 72) |
---|
| 3888 | + if (*entry && x <= (col_end - 8)) |
---|
| 3889 | { |
---|
| 3890 | - if (x == 72) |
---|
| 3891 | + if (x == (col_end - 8)) |
---|
| 3892 | grub_putchar (DISP_RIGHT); |
---|
| 3893 | else |
---|
| 3894 | grub_putchar (*entry++); |
---|
| 3895 | @@ -119,7 +125,7 @@ |
---|
| 3896 | else |
---|
| 3897 | grub_putchar (' '); |
---|
| 3898 | } |
---|
| 3899 | - gotoxy (74, y); |
---|
| 3900 | + gotoxy ((col_end - 6), y); |
---|
| 3901 | |
---|
| 3902 | if (current_term->setcolorstate) |
---|
| 3903 | current_term->setcolorstate (COLOR_STATE_STANDARD); |
---|
| 3904 | @@ -131,7 +137,7 @@ |
---|
| 3905 | { |
---|
| 3906 | int i; |
---|
| 3907 | |
---|
| 3908 | - gotoxy (77, y + 1); |
---|
| 3909 | + gotoxy ((col_end - 3), y + 1); |
---|
| 3910 | |
---|
| 3911 | if (first) |
---|
| 3912 | grub_putchar (DISP_UP); |
---|
| 3913 | @@ -151,14 +157,14 @@ |
---|
| 3914 | menu_entries++; |
---|
| 3915 | } |
---|
| 3916 | |
---|
| 3917 | - gotoxy (77, y + size); |
---|
| 3918 | + gotoxy ((col_end - 3), y + size); |
---|
| 3919 | |
---|
| 3920 | if (*menu_entries) |
---|
| 3921 | grub_putchar (DISP_DOWN); |
---|
| 3922 | else |
---|
| 3923 | grub_putchar (' '); |
---|
| 3924 | |
---|
| 3925 | - gotoxy (74, y + entryno + 1); |
---|
| 3926 | + gotoxy ((col_end - 6), y + entryno + 1); |
---|
| 3927 | } |
---|
| 3928 | |
---|
| 3929 | static void |
---|
| 3930 | @@ -196,30 +202,30 @@ |
---|
| 3931 | if (current_term->setcolorstate) |
---|
| 3932 | current_term->setcolorstate (COLOR_STATE_NORMAL); |
---|
| 3933 | |
---|
| 3934 | - gotoxy (1, y); |
---|
| 3935 | + gotoxy (1 + col_start, y); |
---|
| 3936 | |
---|
| 3937 | grub_putchar (DISP_UL); |
---|
| 3938 | - for (i = 0; i < 73; i++) |
---|
| 3939 | + for (i = col_start; i < (col_end - 7); i++) |
---|
| 3940 | grub_putchar (DISP_HORIZ); |
---|
| 3941 | grub_putchar (DISP_UR); |
---|
| 3942 | |
---|
| 3943 | i = 1; |
---|
| 3944 | while (1) |
---|
| 3945 | { |
---|
| 3946 | - gotoxy (1, y + i); |
---|
| 3947 | + gotoxy (1 + col_start, y + i); |
---|
| 3948 | |
---|
| 3949 | if (i > size) |
---|
| 3950 | break; |
---|
| 3951 | |
---|
| 3952 | grub_putchar (DISP_VERT); |
---|
| 3953 | - gotoxy (75, y + i); |
---|
| 3954 | + gotoxy ((col_end - 5), y + i); |
---|
| 3955 | grub_putchar (DISP_VERT); |
---|
| 3956 | |
---|
| 3957 | i++; |
---|
| 3958 | } |
---|
| 3959 | |
---|
| 3960 | grub_putchar (DISP_LL); |
---|
| 3961 | - for (i = 0; i < 73; i++) |
---|
| 3962 | + for (i = col_start; i < (col_end - 7); i++) |
---|
| 3963 | grub_putchar (DISP_HORIZ); |
---|
| 3964 | grub_putchar (DISP_LR); |
---|
| 3965 | |
---|
| 3966 | @@ -233,6 +239,7 @@ |
---|
| 3967 | { |
---|
| 3968 | int c, time1, time2 = -1, first_entry = 0; |
---|
| 3969 | char *cur_entry = 0; |
---|
| 3970 | + struct term_entry *prev_term = NULL; |
---|
| 3971 | |
---|
| 3972 | /* |
---|
| 3973 | * Main loop for menu UI. |
---|
| 3974 | @@ -250,6 +257,22 @@ |
---|
| 3975 | } |
---|
| 3976 | } |
---|
| 3977 | |
---|
| 3978 | + col_start = 0; |
---|
| 3979 | + col_end = 80; |
---|
| 3980 | + row_start = 0; |
---|
| 3981 | + box_size = 12; |
---|
| 3982 | + /* if we're using viewport we need to make sure to setup |
---|
| 3983 | + coordinates correctly. */ |
---|
| 3984 | +#ifdef SUPPORT_GRAPHICS |
---|
| 3985 | + if (grub_memcmp (current_term->name, "graphics", sizeof ("graphics") - 1) == 0) |
---|
| 3986 | + { |
---|
| 3987 | + col_start = view_x0; |
---|
| 3988 | + col_end = view_x1; |
---|
| 3989 | + row_start = view_y0; |
---|
| 3990 | + box_size = (view_y1 - view_y0) - 13; |
---|
| 3991 | + } |
---|
| 3992 | +#endif |
---|
| 3993 | + |
---|
| 3994 | /* If the timeout was expired or wasn't set, force to show the menu |
---|
| 3995 | interface. */ |
---|
| 3996 | if (grub_timeout < 0) |
---|
| 3997 | @@ -302,36 +325,36 @@ |
---|
| 3998 | if (current_term->flags & TERM_DUMB) |
---|
| 3999 | print_entries_raw (num_entries, first_entry, menu_entries); |
---|
| 4000 | else |
---|
| 4001 | - print_border (3, 12); |
---|
| 4002 | + print_border (3 + row_start, box_size); |
---|
| 4003 | |
---|
| 4004 | grub_printf ("\n\ |
---|
| 4005 | - Use the %c and %c keys to select which entry is highlighted.\n", |
---|
| 4006 | + Use the %c and %c keys to select which entry is highlighted.\n", |
---|
| 4007 | DISP_UP, DISP_DOWN); |
---|
| 4008 | |
---|
| 4009 | if (! auth && password) |
---|
| 4010 | { |
---|
| 4011 | printf ("\ |
---|
| 4012 | - Press enter to boot the selected OS or \'p\' to enter a\n\ |
---|
| 4013 | - password to unlock the next set of features."); |
---|
| 4014 | + Press enter to boot the selected OS or \'p\' to enter a\n\ |
---|
| 4015 | + password to unlock the next set of features."); |
---|
| 4016 | } |
---|
| 4017 | else |
---|
| 4018 | { |
---|
| 4019 | if (config_entries) |
---|
| 4020 | printf ("\ |
---|
| 4021 | - Press enter to boot the selected OS, \'e\' to edit the\n\ |
---|
| 4022 | - commands before booting, or \'c\' for a command-line."); |
---|
| 4023 | + Press enter to boot the selected OS, \'e\' to edit the\n\ |
---|
| 4024 | + commands before booting, or \'c\' for a command-line."); |
---|
| 4025 | else |
---|
| 4026 | printf ("\ |
---|
| 4027 | - Press \'b\' to boot, \'e\' to edit the selected command in the\n\ |
---|
| 4028 | - boot sequence, \'c\' for a command-line, \'o\' to open a new line\n\ |
---|
| 4029 | - after (\'O\' for before) the selected line, \'d\' to remove the\n\ |
---|
| 4030 | - selected line, or escape to go back to the main menu."); |
---|
| 4031 | + Press \'b\' to boot, \'e\' to edit the selected command in the\n\ |
---|
| 4032 | + boot sequence, \'c\' for a command-line, \'o\' to open a new line\n\ |
---|
| 4033 | + after (\'O\' for before) the selected line, \'d\' to remove the\n\ |
---|
| 4034 | + selected line, or escape to go back to the main menu."); |
---|
| 4035 | } |
---|
| 4036 | |
---|
| 4037 | if (current_term->flags & TERM_DUMB) |
---|
| 4038 | grub_printf ("\n\nThe selected entry is %d ", entryno); |
---|
| 4039 | else |
---|
| 4040 | - print_entries (3, 12, first_entry, entryno, menu_entries); |
---|
| 4041 | + print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries); |
---|
| 4042 | } |
---|
| 4043 | |
---|
| 4044 | /* XX using RT clock now, need to initialize value */ |
---|
| 4045 | @@ -358,10 +381,10 @@ |
---|
| 4046 | entryno, grub_timeout); |
---|
| 4047 | else |
---|
| 4048 | { |
---|
| 4049 | - gotoxy (3, 22); |
---|
| 4050 | - grub_printf ("The highlighted entry will be booted automatically in %d seconds. ", |
---|
| 4051 | + gotoxy (3 + col_start, 10 + box_size + row_start); |
---|
| 4052 | + grub_printf (" The highlighted entry will be booted automatically in %d seconds. ", |
---|
| 4053 | grub_timeout); |
---|
| 4054 | - gotoxy (74, 4 + entryno); |
---|
| 4055 | + gotoxy ((col_end - 6), 4 + entryno + row_start); |
---|
| 4056 | } |
---|
| 4057 | |
---|
| 4058 | grub_timeout--; |
---|
| 4059 | @@ -387,12 +410,12 @@ |
---|
| 4060 | if (current_term->flags & TERM_DUMB) |
---|
| 4061 | grub_putchar ('\r'); |
---|
| 4062 | else |
---|
| 4063 | - gotoxy (3, 22); |
---|
| 4064 | + gotoxy (3 + col_start, 10 + box_size + row_start); |
---|
| 4065 | printf (" "); |
---|
| 4066 | grub_timeout = -1; |
---|
| 4067 | fallback_entryno = -1; |
---|
| 4068 | if (! (current_term->flags & TERM_DUMB)) |
---|
| 4069 | - gotoxy (74, 4 + entryno); |
---|
| 4070 | + gotoxy ((col_end - 6), 4 + entryno + row_start); |
---|
| 4071 | } |
---|
| 4072 | |
---|
| 4073 | /* We told them above (at least in SUPPORT_SERIAL) to use |
---|
| 4074 | @@ -408,12 +431,12 @@ |
---|
| 4075 | { |
---|
| 4076 | if (entryno > 0) |
---|
| 4077 | { |
---|
| 4078 | - print_entry (4 + entryno, 0, |
---|
| 4079 | + print_entry (4 + entryno + row_start, 0, |
---|
| 4080 | get_entry (menu_entries, |
---|
| 4081 | first_entry + entryno, |
---|
| 4082 | 0)); |
---|
| 4083 | entryno--; |
---|
| 4084 | - print_entry (4 + entryno, 1, |
---|
| 4085 | + print_entry (4 + entryno + row_start, 1, |
---|
| 4086 | get_entry (menu_entries, |
---|
| 4087 | first_entry + entryno, |
---|
| 4088 | 0)); |
---|
| 4089 | @@ -421,7 +444,7 @@ |
---|
| 4090 | else if (first_entry > 0) |
---|
| 4091 | { |
---|
| 4092 | first_entry--; |
---|
| 4093 | - print_entries (3, 12, first_entry, entryno, |
---|
| 4094 | + print_entries (3 + row_start, box_size, first_entry, entryno, |
---|
| 4095 | menu_entries); |
---|
| 4096 | } |
---|
| 4097 | } |
---|
| 4098 | @@ -433,29 +456,29 @@ |
---|
| 4099 | entryno++; |
---|
| 4100 | else |
---|
| 4101 | { |
---|
| 4102 | - if (entryno < 11) |
---|
| 4103 | + if (entryno < (box_size - 1)) |
---|
| 4104 | { |
---|
| 4105 | - print_entry (4 + entryno, 0, |
---|
| 4106 | + print_entry (4 + entryno + row_start, 0, |
---|
| 4107 | get_entry (menu_entries, |
---|
| 4108 | first_entry + entryno, |
---|
| 4109 | 0)); |
---|
| 4110 | entryno++; |
---|
| 4111 | - print_entry (4 + entryno, 1, |
---|
| 4112 | + print_entry (4 + entryno + row_start, 1, |
---|
| 4113 | get_entry (menu_entries, |
---|
| 4114 | first_entry + entryno, |
---|
| 4115 | 0)); |
---|
| 4116 | } |
---|
| 4117 | - else if (num_entries > 12 + first_entry) |
---|
| 4118 | + else if (num_entries > box_size + first_entry) |
---|
| 4119 | { |
---|
| 4120 | first_entry++; |
---|
| 4121 | - print_entries (3, 12, first_entry, entryno, menu_entries); |
---|
| 4122 | + print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries); |
---|
| 4123 | } |
---|
| 4124 | } |
---|
| 4125 | } |
---|
| 4126 | else if (c == 7) |
---|
| 4127 | { |
---|
| 4128 | /* Page Up */ |
---|
| 4129 | - first_entry -= 12; |
---|
| 4130 | + first_entry -= box_size; |
---|
| 4131 | if (first_entry < 0) |
---|
| 4132 | { |
---|
| 4133 | entryno += first_entry; |
---|
| 4134 | @@ -463,20 +486,20 @@ |
---|
| 4135 | if (entryno < 0) |
---|
| 4136 | entryno = 0; |
---|
| 4137 | } |
---|
| 4138 | - print_entries (3, 12, first_entry, entryno, menu_entries); |
---|
| 4139 | + print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries); |
---|
| 4140 | } |
---|
| 4141 | else if (c == 3) |
---|
| 4142 | { |
---|
| 4143 | /* Page Down */ |
---|
| 4144 | - first_entry += 12; |
---|
| 4145 | + first_entry += box_size; |
---|
| 4146 | if (first_entry + entryno + 1 >= num_entries) |
---|
| 4147 | { |
---|
| 4148 | - first_entry = num_entries - 12; |
---|
| 4149 | + first_entry = num_entries - box_size; |
---|
| 4150 | if (first_entry < 0) |
---|
| 4151 | first_entry = 0; |
---|
| 4152 | entryno = num_entries - first_entry - 1; |
---|
| 4153 | } |
---|
| 4154 | - print_entries (3, 12, first_entry, entryno, menu_entries); |
---|
| 4155 | + print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries); |
---|
| 4156 | } |
---|
| 4157 | |
---|
| 4158 | if (config_entries) |
---|
| 4159 | @@ -489,7 +512,7 @@ |
---|
| 4160 | if ((c == 'd') || (c == 'o') || (c == 'O')) |
---|
| 4161 | { |
---|
| 4162 | if (! (current_term->flags & TERM_DUMB)) |
---|
| 4163 | - print_entry (4 + entryno, 0, |
---|
| 4164 | + print_entry (4 + entryno + row_start, 0, |
---|
| 4165 | get_entry (menu_entries, |
---|
| 4166 | first_entry + entryno, |
---|
| 4167 | 0)); |
---|
| 4168 | @@ -537,7 +560,7 @@ |
---|
| 4169 | |
---|
| 4170 | if (entryno >= num_entries) |
---|
| 4171 | entryno--; |
---|
| 4172 | - if (first_entry && num_entries < 12 + first_entry) |
---|
| 4173 | + if (first_entry && num_entries < box_size + first_entry) |
---|
| 4174 | first_entry--; |
---|
| 4175 | } |
---|
| 4176 | |
---|
| 4177 | @@ -549,7 +572,7 @@ |
---|
| 4178 | grub_printf ("\n"); |
---|
| 4179 | } |
---|
| 4180 | else |
---|
| 4181 | - print_entries (3, 12, first_entry, entryno, menu_entries); |
---|
| 4182 | + print_entries (3 + row_start, box_size, first_entry, entryno, menu_entries); |
---|
| 4183 | } |
---|
| 4184 | |
---|
| 4185 | cur_entry = menu_entries; |
---|
| 4186 | @@ -570,7 +593,7 @@ |
---|
| 4187 | if (current_term->flags & TERM_DUMB) |
---|
| 4188 | grub_printf ("\r "); |
---|
| 4189 | else |
---|
| 4190 | - gotoxy (1, 21); |
---|
| 4191 | + gotoxy (1 + col_start, 9 + box_size + row_start); |
---|
| 4192 | |
---|
| 4193 | /* Wipe out the previously entered password */ |
---|
| 4194 | grub_memset (entered, 0, sizeof (entered)); |
---|
| 4195 | @@ -651,7 +674,10 @@ |
---|
| 4196 | *(new_heap++) = 0; |
---|
| 4197 | |
---|
| 4198 | if (config_entries) |
---|
| 4199 | - run_menu (heap, NULL, new_num_entries, new_heap, 0); |
---|
| 4200 | + { |
---|
| 4201 | + current_entryno = first_entry + entryno; |
---|
| 4202 | + run_menu (heap, NULL, new_num_entries, new_heap, 0); |
---|
| 4203 | + } |
---|
| 4204 | else |
---|
| 4205 | { |
---|
| 4206 | cls (); |
---|
| 4207 | @@ -714,6 +740,15 @@ |
---|
| 4208 | |
---|
| 4209 | cls (); |
---|
| 4210 | setcursor (1); |
---|
| 4211 | + /* if our terminal needed initialization, we should shut it down |
---|
| 4212 | + * before booting the kernel, but we want to save what it was so |
---|
| 4213 | + * we can come back if needed */ |
---|
| 4214 | + prev_term = current_term; |
---|
| 4215 | + if (current_term->shutdown) |
---|
| 4216 | + { |
---|
| 4217 | + current_term->shutdown(); |
---|
| 4218 | + current_term = term_table; /* assumption: console is first */ |
---|
| 4219 | + } |
---|
| 4220 | |
---|
| 4221 | while (1) |
---|
| 4222 | { |
---|
| 4223 | @@ -727,7 +762,8 @@ |
---|
| 4224 | cur_entry = get_entry (config_entries, first_entry + entryno, 1); |
---|
| 4225 | |
---|
| 4226 | /* Set CURRENT_ENTRYNO for the command "savedefault". */ |
---|
| 4227 | - current_entryno = first_entry + entryno; |
---|
| 4228 | + if (config_entries) |
---|
| 4229 | + current_entryno = first_entry + entryno; |
---|
| 4230 | |
---|
| 4231 | if (run_script (cur_entry, heap)) |
---|
| 4232 | { |
---|
| 4233 | @@ -748,6 +784,13 @@ |
---|
| 4234 | break; |
---|
| 4235 | } |
---|
| 4236 | |
---|
| 4237 | + /* if we get back here, we should go back to what our term was before */ |
---|
| 4238 | + current_term = prev_term; |
---|
| 4239 | + if (current_term->startup) |
---|
| 4240 | + /* if our terminal fails to initialize, fall back to console since |
---|
| 4241 | + * it should always work */ |
---|
| 4242 | + if (current_term->startup() == 0) |
---|
| 4243 | + current_term = term_table; /* we know that console is first */ |
---|
| 4244 | show_menu = 1; |
---|
| 4245 | goto restart; |
---|
| 4246 | } |
---|
| 4247 | @@ -891,8 +934,18 @@ |
---|
| 4248 | len = grub_read (buf, sizeof (buf)); |
---|
| 4249 | if (len > 0) |
---|
| 4250 | { |
---|
| 4251 | + char *tmp; |
---|
| 4252 | + char *def; |
---|
| 4253 | buf[sizeof (buf) - 1] = 0; |
---|
| 4254 | - safe_parse_maxint (&p, &saved_entryno); |
---|
| 4255 | + |
---|
| 4256 | + if((tmp = grub_strstr(p, ":")) != NULL) |
---|
| 4257 | + { |
---|
| 4258 | + *tmp++; |
---|
| 4259 | + grub_memcpy(&def, &tmp, sizeof(p)); |
---|
| 4260 | + }else |
---|
| 4261 | + grub_memcpy(&def, &p, sizeof(p)); |
---|
| 4262 | + |
---|
| 4263 | + safe_parse_maxint (&def, &saved_entryno); |
---|
| 4264 | } |
---|
| 4265 | |
---|
| 4266 | grub_close (); |
---|
| 4267 | @@ -1050,6 +1103,16 @@ |
---|
| 4268 | while (is_preset); |
---|
| 4269 | } |
---|
| 4270 | |
---|
| 4271 | + /* go ahead and make sure the terminal is setup */ |
---|
| 4272 | + if (current_term->startup) |
---|
| 4273 | + { |
---|
| 4274 | + /* If initialization fails, go back to default terminal */ |
---|
| 4275 | + if (current_term->startup() == 0) |
---|
| 4276 | + { |
---|
| 4277 | + current_term = term_table; |
---|
| 4278 | + } |
---|
| 4279 | + } |
---|
| 4280 | + |
---|
| 4281 | if (! num_entries) |
---|
| 4282 | { |
---|
| 4283 | /* If no acceptable config file, goto command-line, starting |
---|
| 4284 | diff -Naur grub-0.97.orig/stage2/term.h grub-0.97/stage2/term.h |
---|
| 4285 | --- grub-0.97.orig/stage2/term.h 2003-07-09 04:45:53.000000000 -0700 |
---|
| 4286 | +++ grub-0.97/stage2/term.h 2006-07-03 23:58:41.000000000 -0700 |
---|
| 4287 | @@ -60,6 +60,8 @@ |
---|
| 4288 | const char *name; |
---|
| 4289 | /* The feature flags defined above. */ |
---|
| 4290 | unsigned long flags; |
---|
| 4291 | + /* Default for maximum number of lines if not specified */ |
---|
| 4292 | + unsigned short max_lines; |
---|
| 4293 | /* Put a character. */ |
---|
| 4294 | void (*putchar) (int c); |
---|
| 4295 | /* Check if any input character is available. */ |
---|
| 4296 | @@ -79,6 +81,10 @@ |
---|
| 4297 | void (*setcolor) (int normal_color, int highlight_color); |
---|
| 4298 | /* Turn on/off the cursor. */ |
---|
| 4299 | int (*setcursor) (int on); |
---|
| 4300 | + /* function to start a terminal */ |
---|
| 4301 | + int (*startup) (void); |
---|
| 4302 | + /* function to use to shutdown a terminal */ |
---|
| 4303 | + void (*shutdown) (void); |
---|
| 4304 | }; |
---|
| 4305 | |
---|
| 4306 | /* This lists up available terminals. */ |
---|
| 4307 | @@ -124,4 +130,24 @@ |
---|
| 4308 | int hercules_setcursor (int on); |
---|
| 4309 | #endif |
---|
| 4310 | |
---|
| 4311 | +#ifdef SUPPORT_GRAPHICS |
---|
| 4312 | +extern int foreground, background, window_border, graphics_inited, saved_videomode; |
---|
| 4313 | + |
---|
| 4314 | +void graphics_set_splash(char *splashfile); |
---|
| 4315 | +int set_videomode(int mode); |
---|
| 4316 | +int get_videomode(void); |
---|
| 4317 | +void graphics_putchar (int c); |
---|
| 4318 | +int graphics_getxy(void); |
---|
| 4319 | +void graphics_gotoxy(int x, int y); |
---|
| 4320 | +void graphics_cls(void); |
---|
| 4321 | +void graphics_setcolorstate (color_state state); |
---|
| 4322 | +void graphics_setcolor (int normal_color, int highlight_color); |
---|
| 4323 | +int graphics_setcursor (int on); |
---|
| 4324 | +int graphics_init(void); |
---|
| 4325 | +void graphics_end(void); |
---|
| 4326 | + |
---|
| 4327 | +int hex(int v); |
---|
| 4328 | +void graphics_set_palette(int idx, int red, int green, int blue); |
---|
| 4329 | +#endif /* SUPPORT_GRAPHICS */ |
---|
| 4330 | + |
---|
| 4331 | #endif /* ! GRUB_TERM_HEADER */ |
---|
| 4332 | diff -Naur grub-0.97.orig/THANKS grub-0.97/THANKS |
---|
| 4333 | --- grub-0.97.orig/THANKS 2005-05-07 19:17:43.000000000 -0700 |
---|
| 4334 | +++ grub-0.97/THANKS 2006-07-04 00:01:50.000000000 -0700 |
---|
| 4335 | @@ -121,3 +121,4 @@ |
---|
| 4336 | Yedidyah Bar-David <didi@post.tau.ac.il> |
---|
| 4337 | Yury V. Umanets <umka@namesys.com> |
---|
| 4338 | Yuri Zaporogets <yuriz@ukr.net> |
---|
| 4339 | +Vitaly Fertman <vitaly@namesys.com> |
---|
| 4340 | diff -Naur grub-0.97.orig/util/grub-install.in grub-0.97/util/grub-install.in |
---|
| 4341 | --- grub-0.97.orig/util/grub-install.in 2004-07-24 11:57:31.000000000 -0700 |
---|
| 4342 | +++ grub-0.97/util/grub-install.in 2006-07-04 00:01:50.000000000 -0700 |
---|
| 4343 | @@ -81,6 +81,50 @@ |
---|
| 4344 | EOF |
---|
| 4345 | } |
---|
| 4346 | |
---|
| 4347 | +# Usage: getraid_mdadm mddevice |
---|
| 4348 | +# Routine to find a physical device from an md device |
---|
| 4349 | +# If found, the first grub BIOS device (from device.map) is returned |
---|
| 4350 | +# If no BIOS drives match the RAID devices, the first device returned |
---|
| 4351 | +# from mdadm -D is returned |
---|
| 4352 | +getraid_mdadm() { |
---|
| 4353 | + device=$1 |
---|
| 4354 | + mdadm=$(mdadm -D "$device") || { |
---|
| 4355 | + echo "$PROG: mdadm -D $device failed" >&2 |
---|
| 4356 | + exit 1 |
---|
| 4357 | + } |
---|
| 4358 | + eval "$( |
---|
| 4359 | + echo "$mdadm" | awk ' |
---|
| 4360 | + $1 == "Number" && $2 == "Major" { start = 1; next } |
---|
| 4361 | + $1 == "UUID" { print "uuid=" $3; start = 0; next } |
---|
| 4362 | + !start { next } |
---|
| 4363 | + $2 == 0 && $3 == 0 { next } |
---|
| 4364 | + { devices = devices "\n" $NF } |
---|
| 4365 | + END { print "devices='\''" devices "'\''" } |
---|
| 4366 | + ' |
---|
| 4367 | + )" |
---|
| 4368 | + |
---|
| 4369 | + # Convert RAID devices list into a list of disks |
---|
| 4370 | + tmp_disks=`echo "$devices" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \ |
---|
| 4371 | + -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \ |
---|
| 4372 | + -e 's%\(fd[0-9]*\)$%\1%' \ |
---|
| 4373 | + -e 's%/part[0-9]*$%/disc%' \ |
---|
| 4374 | + -e 's%\(c[0-7]d[0-9]*\).*$%\1%' \ |
---|
| 4375 | + -e '/^$/d' | |
---|
| 4376 | + sed -n '1h;2,$H;${g;s/\n/|/g;p}'` |
---|
| 4377 | + |
---|
| 4378 | + # Find first BIOS disk that's a member of the RAID array |
---|
| 4379 | + # Default to first RAID member if no tmp_disks are BIOS devices |
---|
| 4380 | + set -- `egrep $tmp_disks $device_map | \ |
---|
| 4381 | + sort | \ |
---|
| 4382 | + sed -n 1p ` |
---|
| 4383 | + device=${2:-${tmp_disks%%|*}} |
---|
| 4384 | + |
---|
| 4385 | + # Return first partition on BIOS disk that's part of the RAID |
---|
| 4386 | + echo "$devices" | \ |
---|
| 4387 | + sed -n "\:${device}:p" | \ |
---|
| 4388 | + sed -n 1p |
---|
| 4389 | +} |
---|
| 4390 | + |
---|
| 4391 | # Usage: convert os_device |
---|
| 4392 | # Convert an OS device to the corresponding GRUB drive. |
---|
| 4393 | # This part is OS-specific. |
---|
| 4394 | @@ -96,6 +140,10 @@ |
---|
| 4395 | # Break the device name into the disk part and the partition part. |
---|
| 4396 | case "$host_os" in |
---|
| 4397 | linux*) |
---|
| 4398 | + # Find an actual physical device if we're passed a RAID device |
---|
| 4399 | + case $1 in |
---|
| 4400 | + /dev/md*) set -- `getraid_mdadm $1` |
---|
| 4401 | + esac |
---|
| 4402 | tmp_disk=`echo "$1" | sed -e 's%\([sh]d[a-z]\)[0-9]*$%\1%' \ |
---|
| 4403 | -e 's%\(d[0-9]*\)p[0-9]*$%\1%' \ |
---|
| 4404 | -e 's%\(fd[0-9]*\)$%\1%' \ |
---|
| 4405 | @@ -112,8 +160,8 @@ |
---|
| 4406 | tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'` |
---|
| 4407 | tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;; |
---|
| 4408 | freebsd* | kfreebsd*-gnu) |
---|
| 4409 | - tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%r\1%' \ |
---|
| 4410 | - | sed 's%r\{0,1\}\(da[0-9]*\).*$%r\1%'` |
---|
| 4411 | + tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%\1%' \ |
---|
| 4412 | + | sed 's%r\{0,1\}\(da[0-9]*\).*$%\1%'` |
---|
| 4413 | tmp_part=`echo "$1" \ |
---|
| 4414 | | sed "s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" \ |
---|
| 4415 | | sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%"` |
---|
| 4416 | @@ -131,7 +179,7 @@ |
---|
| 4417 | |
---|
| 4418 | # Get the drive name. |
---|
| 4419 | tmp_drive=`grep -v '^#' $device_map | grep "$tmp_disk *$" \ |
---|
| 4420 | - | sed 's%.*\(([hf]d[0-9][a-g0-9,]*)\).*%\1%'` |
---|
| 4421 | + | sed 's%.*\(([hf]d[0-9][a-z0-9,]*)\).*%\1%'` |
---|
| 4422 | |
---|
| 4423 | # If not found, print an error message and exit. |
---|
| 4424 | if test "x$tmp_drive" = x; then |
---|
| 4425 | @@ -148,13 +196,13 @@ |
---|
| 4426 | gnu*) |
---|
| 4427 | if echo $tmp_part | grep "^s" >/dev/null; then |
---|
| 4428 | tmp_pc_slice=`echo $tmp_part \ |
---|
| 4429 | - | sed "s%s\([0-9]*\)[a-g]*$%\1%"` |
---|
| 4430 | + | sed "s%s\([0-9]*\)[a-z]*$%\1%"` |
---|
| 4431 | tmp_drive=`echo "$tmp_drive" \ |
---|
| 4432 | | sed "s%)%,\`expr "$tmp_pc_slice" - 1\`)%"` |
---|
| 4433 | fi |
---|
| 4434 | - if echo $tmp_part | grep "[a-g]$" >/dev/null; then |
---|
| 4435 | + if echo $tmp_part | grep "[a-z]$" >/dev/null; then |
---|
| 4436 | tmp_bsd_partition=`echo "$tmp_part" \ |
---|
| 4437 | - | sed "s%[^a-g]*\([a-g]\)$%\1%"` |
---|
| 4438 | + | sed "s%[^a-z]*\([a-z]\)$%\1%"` |
---|
| 4439 | tmp_drive=`echo "$tmp_drive" \ |
---|
| 4440 | | sed "s%)%,$tmp_bsd_partition)%"` |
---|
| 4441 | fi |
---|
| 4442 | @@ -336,6 +384,10 @@ |
---|
| 4443 | # Create a safe temporary file. |
---|
| 4444 | test -n "$mklog" && log_file=`$mklog` |
---|
| 4445 | |
---|
| 4446 | + # Before all invocations of the grub shell, call sync to make sure |
---|
| 4447 | + # the raw device is in sync with any bufferring in filesystems. |
---|
| 4448 | + sync |
---|
| 4449 | + |
---|
| 4450 | $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file |
---|
| 4451 | quit |
---|
| 4452 | EOF |
---|
| 4453 | @@ -450,6 +502,24 @@ |
---|
| 4454 | # Create a safe temporary file. |
---|
| 4455 | test -n "$mklog" && log_file=`$mklog` |
---|
| 4456 | |
---|
| 4457 | +# Sync to prevent GRUB from not finding stage files (notably, on XFS) |
---|
| 4458 | +sync |
---|
| 4459 | + |
---|
| 4460 | +# XFS needs special magic |
---|
| 4461 | +xfs_frozen=false |
---|
| 4462 | +if which xfs_freeze > /dev/null ; then |
---|
| 4463 | + cat << EOF |
---|
| 4464 | +Due to a bug in xfs_freeze, the following command might produce a segmentation |
---|
| 4465 | +fault when ${grubdir} is not in an XFS filesystem. This error is harmless and |
---|
| 4466 | +can be ignored. |
---|
| 4467 | +EOF |
---|
| 4468 | + if xfs_freeze -f ${grubdir} ; then xfs_frozen=true ; fi |
---|
| 4469 | +fi |
---|
| 4470 | + |
---|
| 4471 | +# Before all invocations of the grub shell, call sync to make sure |
---|
| 4472 | +# the raw device is in sync with any bufferring in filesystems. |
---|
| 4473 | +sync |
---|
| 4474 | + |
---|
| 4475 | # Now perform the installation. |
---|
| 4476 | $grub_shell --batch $no_floppy --device-map=$device_map <<EOF >$log_file |
---|
| 4477 | root $root_drive |
---|
| 4478 | @@ -457,6 +527,10 @@ |
---|
| 4479 | quit |
---|
| 4480 | EOF |
---|
| 4481 | |
---|
| 4482 | +if ${xfs_frozen} ; then |
---|
| 4483 | + xfs_freeze -u ${grubdir} |
---|
| 4484 | +fi |
---|
| 4485 | + |
---|
| 4486 | if grep "Error [0-9]*: " $log_file >/dev/null || test $debug = yes; then |
---|
| 4487 | cat $log_file 1>&2 |
---|
| 4488 | exit 1 |
---|