1diff -uprN grub-0.97/acinclude.m4 grub/acinclude.m4
2--- grub-0.97/acinclude.m4	2004-04-27 21:48:06.000000000 +0100
3+++ grub/acinclude.m4	2007-11-05 01:29:46.000000000 +0000
4@@ -57,7 +57,7 @@ else
5 fi
6 grub_cv_prog_objcopy_absolute=yes
7 for link_addr in 2000 8000 7C00; do
8-  if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then :
9+  if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} ${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec]); then :
10   else
11     AC_MSG_ERROR([${CC-cc} cannot link at address $link_addr])
12   fi
13diff -uprN grub-0.97/ChangeLog grub/ChangeLog
14--- grub-0.97/ChangeLog	2005-05-08 03:47:02.000000000 +0100
15+++ grub/ChangeLog	2008-05-20 12:04:18.000000000 +0100
16@@ -1,3 +1,127 @@
17+2008-05-20  Robert Millan  <rmh@aybabtu.com>
18+
19+	* netboot/cs89x0.c: Fix license violation.
20+	* netboot/cs89x0.h: Likewise.
21+
22+2008-04-10  Pavel Roskin  <proski@gnu.org>
23+
24+	* configure.ac: Always use "_cv_" in cache variables for
25+	compatibility with Autoconf 2.62.
26+
27+2008-03-28  Robert Millan  <rmh@aybabtu.com>
28+
29+	Surpass 1 TiB disk addressing limit.  Note: there are no plans to handle
30+	the 2 TiB disk limit in GRUB Legacy, since that would need considerable
31+	rework.  If you have >2TiB disks, use GRUB 2 instead.
32+
33+	* grub/asmstub.c (biosdisk): Add unsigned qualifier to `sector'.
34+	* stage2/bios.c (biosdisk): Likewise.
35+	* stage2/disk_io.c (rawread, devread, rawwrite, devwrite): Likewise.
36+	* stage2/shared.h (rawread, devread, rawwrite, devwrite): Likewise.
37+	* lib/device.c (get_drive_geometry): Replace BLKGETSIZE with
38+	BLKGETSIZE64.
39+
40+2007-10-29  Pavel Roskin  <proski@gnu.org>
41+
42+	* configure.ac: Test if '--build-id=none' is supported by the
43+	linker and add it to LDFLAGS if possible.  Build ID causes
44+	objcopy to generate huge binary files.
45+	* aclocal.m4 (grub_PROG_OBJCOPY_ABSOLUTE): Use LDFLAGS when
46+	linking, so that build ID doesn't break the test.
47+	* stage1/Makefile.am: Preserve LDFLAGS, use stage1_exec_LDFLAGS.
48+
49+2007-02-22  Pavel Roskin  <proski@gnu.org>
50+
51+	* stage2/iso9660.h: Remove unnecessary packed attributes.
52+
53+2007-02-22  Robert Millan  <rmh@aybabtu.com>
54+
55+	* util/mkbimage: Update my email address, and remove my name from
56+	some places where unnecessary credit is given.
57+
58+2006-09-10  Pavel Roskin  <proski@gnu.org>
59+
60+	* netboot/natsemi.c: Fix compile error with gcc 4.1.1.  Cast
61+	cannot make a variable volatile - it should be declared as such.
62+	* netboot/sis900.c: Likewise.
63+
64+2006-09-08  Pavel Roskin  <proski@gnu.org>
65+
66+	* netboot/etherboot.h: Remove incorrect extern declarations of
67+	the variables later declared static.  Move BOOTP_DATA_ADDR ...
68+	* netboot/main.c: ... here.  Eliminate end_of_rfc1533 - it's
69+	write-only.
70+
71+2006-06-24  Yoshinori K. Okuji  <okuji@enbug.org>
72+
73+	* docs/grub.texi: Changed the license term to the GNU Free
74+	Documentation License 1.2.
75+
76+	* docs/multiboot.texi: Reformatted to show the license term
77+	and the version number explicitly.
78+
79+	* docs/fdl.texi: New file.
80+
81+	* docs/Makefile.am (grub_TEXINFOS): Added fdl.texi.
82+
83+2006-06-24  Robert Millan  <robertmh@gnu.org>
84+
85+	* lib/device.c (write_to_partition): /dev/ataraid/ and /dev/rd/
86+	partitions have a "p" prefix.  Add it.
87+
88+2006-06-24  Robert Millan  <robertmh@gnu.org>
89+
90+	* lib/device.c (get_i2o_disk_name): New function.
91+	(init_device_map) [__linux__]: Add support for I2O devices.
92+
93+2006-05-02  Pavel Roskin  <proski@gnu.org>
94+
95+	* stage2/stage2.c (run_menu): Fix "savedefault" to save only top
96+	level menu positions.  Remember current position when calling a
97+	submenu.  Don't recalculate it when booting from a submenu.
98+
99+	* grub/main.c (main): Make sure the boot drive number doesn't
100+	exceed 255.
101+
102+2006-05-02  Vesa Jaaskelainen  <chaac@nic.fi>
103+
104+	* stage2/shared.h (vbe_mode): Back ported aligment fix from GRUB 2
105+	to GRUB Legacy.  Problem reported by Gerardo Richarte.
106+
107+2006-04-23  Robert Millan  <robertmh@gnu.org>
108+
109+	* grub/asmstub.c (get_diskinfo): Optimize sysctl routine.
110+
111+2006-04-20  Robert Millan  <robertmh@gnu.org>
112+
113+	Fixes for kernel of FreeBSD:
114+	* grub/asmstub.c (get_diskinfo): Toggle "kern.geom.debugflags" sysctl
115+	before opening a device for writing.
116+	* util/grub-install.in: Devices don't have this "r" prefix anymore.
117+
118+2006-04-16  Yoshinori K. Okuji  <okuji@enbug.org>
119+
120+	* docs/multiboot.texi: Correct the offset of address
121+	fields. Reported by Jeroen Dekkers.
122+
123+2006-03-21  Yoshinori K. Okuji  <okuji@enbug.org>
124+
125+	* stage2/builtins.c (setup_func): Specify the size of DEVICE to
126+	grub_strncat instead of a strange number 256. Reported by Vitaly
127+	Fertman <vitaly@namesys.com>.
128+
129+2005-09-29  Yoshinori K. Okuji  <okuji@enbug.org>
130+
131+	* docs/multiboot.texi: Fix a bug in the byte order of
132+	boot_device. I hope this won't affect any OS image.
133+	Increased the version number to 0.6.94.
134+
135+2005-09-28  Yoshinori K. Okuji  <okuji@enbug.org>
136+
137+	* stage2/boot.c (load_image): Even if an OS image is an ELF
138+	object, use the a.out kludge if MULTIBOOT_AOUT_KLUDGE is
139+	specified.
140+
141 2005-05-08  Yoshinori K. Okuji  <okuji@enbug.org>
142
143 	* configure.ac (AC_INIT): Upgraded to 0.97.
144diff -uprN grub-0.97/configure grub/configure
145--- grub-0.97/configure	2005-05-08 03:48:12.000000000 +0100
146+++ grub/configure	2007-11-05 01:29:46.000000000 +0000
147@@ -3694,6 +3694,64 @@ if test "x$undef_flag" = xyes; then
148   CPPFLAGS="$CPPFLAGS -Wundef"
149 fi
150
151+# Check if build ID can be disabled in the linker
152+echo "$as_me:$LINENO: checking whether linker accepts \`--build-id=none'" >&5
153+echo $ECHO_N "checking whether linker accepts \`--build-id=none'... $ECHO_C" >&6
154+save_LDFLAGS="$LDFLAGS"
155+LDFLAGS="$LDFLAGS -Wl,--build-id=none"
156+cat >conftest.$ac_ext <<_ACEOF
157+/* confdefs.h.  */
158+_ACEOF
159+cat confdefs.h >>conftest.$ac_ext
160+cat >>conftest.$ac_ext <<_ACEOF
161+/* end confdefs.h.  */
162+
163+int
164+main ()
165+{
166+
167+  ;
168+  return 0;
169+}
170+_ACEOF
171+rm -f conftest.$ac_objext conftest$ac_exeext
172+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
173+  (eval $ac_link) 2>conftest.er1
174+  ac_status=$?
175+  grep -v '^ *+' conftest.er1 >conftest.err
176+  rm -f conftest.er1
177+  cat conftest.err >&5
178+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
179+  (exit $ac_status); } &&
180+	 { ac_try='test -z "$ac_c_werror_flag"
181+			 || test ! -s conftest.err'
182+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
183+  (eval $ac_try) 2>&5
184+  ac_status=$?
185+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
186+  (exit $ac_status); }; } &&
187+	 { ac_try='test -s conftest$ac_exeext'
188+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
189+  (eval $ac_try) 2>&5
190+  ac_status=$?
191+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
192+  (exit $ac_status); }; }; then
193+  build_id_flag=yes
194+else
195+  echo "$as_me: failed program was:" >&5
196+sed 's/^/| /' conftest.$ac_ext >&5
197+
198+build_id_flag=no
199+fi
200+rm -f conftest.err conftest.$ac_objext \
201+      conftest$ac_exeext conftest.$ac_ext
202+echo "$as_me:$LINENO: result: $build_id_flag" >&5
203+echo "${ECHO_T}$build_id_flag" >&6
204+LDFLAGS="$save_LDFLAGS"
205+if test "x$build_id_flag" = xyes; then
206+  LDFLAGS="$LDFLAGS -Wl,--build-id=none"
207+fi
208+
209 if test "x$with_binutils" != x; then
210   # Extract the first word of "objcopy", so it can be a program name with args.
211 set dummy objcopy; ac_word=$2
212@@ -3892,7 +3950,7 @@ echo "$as_me: error: ${CC-cc} cannot com
213 fi
214 grub_cv_prog_objcopy_absolute=yes
215 for link_addr in 2000 8000 7C00; do
216-  if { ac_try='${CC-cc} ${CFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec'
217+  if { ac_try='${CC-cc} ${CFLAGS} ${LDFLAGS} -nostdlib -Wl,-N -Wl,-Ttext -Wl,$link_addr conftest.o -o conftest.exec'
218   { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
219   (eval $ac_try) 2>&5
220   ac_status=$?
221diff -uprN grub-0.97/configure.ac grub/configure.ac
222--- grub-0.97/configure.ac	2005-05-08 03:36:03.000000000 +0100
223+++ grub/configure.ac	2008-04-10 23:26:50.000000000 +0100
224@@ -86,13 +86,13 @@ if test "x$ac_cv_prog_gcc" = xyes; then
225     fi
226     STAGE1_CFLAGS="-O2"
227     GRUB_CFLAGS="-O2"
228-    AC_CACHE_CHECK([whether optimization for size works], size_flag, [
229+    AC_CACHE_CHECK([whether optimization for size works], grub_cv_cc_Os, [
230       saved_CFLAGS=$CFLAGS
231       CFLAGS="-Os -g"
232-      AC_TRY_COMPILE(, , size_flag=yes, size_flag=no)
233+      AC_TRY_COMPILE(, , grub_cv_cc_Os=yes, grub_cv_cc_Os=no)
234       CFLAGS=$saved_CFLAGS
235     ])
236-    if test "x$size_flag" = xyes; then
237+    if test "x$grub_cv_cc_Os" = xyes; then
238       STAGE2_CFLAGS="-Os"
239     else
240       STAGE2_CFLAGS="-O2 -fno-strength-reduce -fno-unroll-loops"
241@@ -100,16 +100,16 @@ if test "x$ac_cv_prog_gcc" = xyes; then
242     # OpenBSD has a GCC extension for protecting applications from
243     # stack smashing attacks, but GRUB doesn't want this feature.
244     AC_CACHE_CHECK([whether gcc has -fno-stack-protector],
245-		   no_stack_protector_flag, [
246+		   grub_cv_cc_no_stack_protector, [
247       saved_CFLAGS=$CFLAGS
248       CFLAGS="-fno-stack-protector"
249       AC_TRY_COMPILE(,
250 		     ,
251-		     no_stack_protector_flag=yes,
252-		     no_stack_protector_flag=no)
253+		     grub_cv_cc_no_stack_protector=yes,
254+		     grub_cv_cc_no_stack_protector=no)
255       CFLAGS=$saved_CFLAGS
256     ])
257-    if test "x$no_stack_protector_flag" = xyes; then
258+    if test "x$grub_cv_cc_no_stack_protector" = xyes; then
259       STAGE2_CFLAGS="$STAGE2_CFLAGS -fno-stack-protector"
260     fi
261   fi
262@@ -123,33 +123,44 @@ AC_SUBST(GRUB_CFLAGS)
263 CPPFLAGS="$CPPFLAGS -Wall -Wmissing-prototypes -Wunused -Wshadow"
264 CPPFLAGS="$CPPFLAGS -Wpointer-arith"
265
266-AC_CACHE_CHECK([whether -Wundef works], undef_flag, [
267+AC_CACHE_CHECK([whether -Wundef works], grub_cv_cc_Wundef, [
268   saved_CPPFLAGS="$CPPFLAGS"
269   CPPFLAGS="-Wundef"
270-  AC_TRY_COMPILE(, , undef_flag=yes, undef_flag=no)
271+  AC_TRY_COMPILE(, , grub_cv_cc_Wundef=yes, grub_cv_cc_Wundef=no)
272   CPPFLAGS="$saved_CPPFLAGS"
273 ])
274
275 # The options `-falign-*' are supported by gcc 3.0 or later.
276 # Probably it is sufficient to only check for -falign-loops.
277-AC_CACHE_CHECK([whether -falign-loops works], [falign_loop_flag], [
278+AC_CACHE_CHECK([whether -falign-loops works], [grub_cv_cc_falign_loop], [
279   saved_CPPFLAGS="$CPPFLAGS"
280   CPPFLAGS="-falign-loops=1"
281-  AC_TRY_COMPILE(, , [falign_loop_flag=yes], [falign_loop_flag=no])
282+  AC_TRY_COMPILE(, , [grub_cv_cc_falign_loop=yes], [grub_cv_cc_falign_loop=no])
283   CPPFLAGS="$saved_CPPFLAGS"
284 ])
285
286 # Force no alignment to save space.
287-if test "x$falign_loop_flag" = xyes; then
288+if test "x$grub_cv_cc_falign_loop" = xyes; then
289   CPPFLAGS="$CPPFLAGS -falign-jumps=1 -falign-loops=1 -falign-functions=1"
290 else
291   CPPFLAGS="$CPPFLAGS -malign-jumps=1 -malign-loops=1 -malign-functions=1"
292 fi
293
294-if test "x$undef_flag" = xyes; then
295+if test "x$grub_cv_cc_Wundef" = xyes; then
296   CPPFLAGS="$CPPFLAGS -Wundef"
297 fi
298
299+# Check if build ID can be disabled in the linker
300+AC_MSG_CHECKING([whether linker accepts `--build-id=none'])
301+save_LDFLAGS="$LDFLAGS"
302+LDFLAGS="$LDFLAGS -Wl,--build-id=none"
303+AC_TRY_LINK(, , build_id_flag=yes, build_id_flag=no)
304+AC_MSG_RESULT([$build_id_flag])
305+LDFLAGS="$save_LDFLAGS"
306+if test "x$build_id_flag" = xyes; then
307+  LDFLAGS="$LDFLAGS -Wl,--build-id=none"
308+fi
309+
310 if test "x$with_binutils" != x; then
311 dnl  AC_PATH_TOOL(OBJCOPY, objcopy, , "$with_binutils:$PATH")
312   AC_PATH_PROG(OBJCOPY, objcopy, , "$with_binutils:$PATH")
313diff -uprN grub-0.97/docs/grub.8 grub/docs/grub.8
314--- grub-0.97/docs/grub.8	2005-05-08 03:48:56.000000000 +0100
315+++ grub/docs/grub.8	2006-06-24 15:40:02.000000000 +0100
316@@ -1,5 +1,5 @@
317 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.23.
318-.TH GRUB "8" "May 2005" "grub (GNU GRUB 0.97)" FSF
319+.TH GRUB "8" "June 2006" "grub (GNU GRUB 0.97)" FSF
320 .SH NAME
321 grub \- the grub shell
322 .SH SYNOPSIS
323diff -uprN grub-0.97/docs/grub-install.8 grub/docs/grub-install.8
324--- grub-0.97/docs/grub-install.8	2005-05-08 03:48:56.000000000 +0100
325+++ grub/docs/grub-install.8	2006-06-24 15:40:02.000000000 +0100
326@@ -1,5 +1,5 @@
327 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.23.
328-.TH GRUB-INSTALL "8" "May 2005" "grub-install (GNU GRUB 0.97)" FSF
329+.TH GRUB-INSTALL "8" "June 2006" "grub-install (GNU GRUB 0.97)" FSF
330 .SH NAME
331 grub-install \- install GRUB on your drive
332 .SH SYNOPSIS
333diff -uprN grub-0.97/docs/grub-md5-crypt.8 grub/docs/grub-md5-crypt.8
334--- grub-0.97/docs/grub-md5-crypt.8	2005-05-08 03:48:56.000000000 +0100
335+++ grub/docs/grub-md5-crypt.8	2006-06-24 15:40:02.000000000 +0100
336@@ -1,5 +1,5 @@
337 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.23.
338-.TH GRUB-MD5-CRYPT "8" "May 2005" "grub-md5-crypt (GNU GRUB )" FSF
339+.TH GRUB-MD5-CRYPT "8" "June 2006" "grub-md5-crypt (GNU GRUB )" FSF
340 .SH NAME
341 grub-md5-crypt \- Encrypt a password in MD5 format
342 .SH SYNOPSIS
343diff -uprN grub-0.97/docs/grub-terminfo.8 grub/docs/grub-terminfo.8
344--- grub-0.97/docs/grub-terminfo.8	2005-05-08 03:48:56.000000000 +0100
345+++ grub/docs/grub-terminfo.8	2006-06-24 15:40:02.000000000 +0100
346@@ -1,5 +1,5 @@
347 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.23.
348-.TH GRUB-TERMINFO "8" "May 2005" "grub-terminfo (GNU GRUB 0.97)" FSF
349+.TH GRUB-TERMINFO "8" "June 2006" "grub-terminfo (GNU GRUB 0.97)" FSF
350 .SH NAME
351 grub-terminfo \- Generate a terminfo command from a terminfo name
352 .SH SYNOPSIS
353diff -uprN grub-0.97/docs/grub.texi grub/docs/grub.texi
354--- grub-0.97/docs/grub.texi	2005-05-08 03:59:59.000000000 +0100
355+++ grub/docs/grub.texi	2006-06-24 15:40:02.000000000 +0100
356@@ -2,22 +2,41 @@
357 @c -*-texinfo-*-
358 @c %**start of header
359 @setfilename grub.info
360-@settitle GRUB Manual
361-@c %**end of header
362-
363 @include version.texi
364-
365+@settitle GNU GRUB Manual @value{VERSION}
366 @c Unify all our little indices for now.
367 @syncodeindex fn cp
368 @syncodeindex vr cp
369 @syncodeindex ky cp
370 @syncodeindex pg cp
371 @syncodeindex tp cp
372+@c %**end of header
373
374 @footnotestyle separate
375 @paragraphindent 3
376 @finalout
377
378+@copying
379+This manual is for GNU GRUB (version @value{VERSION},
380+@value{UPDATED}).
381+
382+Copyright @copyright{} 1999,2000,2001,2002,2004,2006 Free Software Foundation, Inc.
383+
384+@quotation
385+Permission is granted to copy, distribute and/or modify this document
386+under the terms of the GNU Free Documentation License, Version 1.2 or
387+any later version published by the Free Software Foundation; with no
388+Invariant Sections, with the Front-Cover Texts being ``A GNU Manual,''
389+and with the Back-Cover Texts as in (a) below.  A copy of the
390+license is included in the section entitled ``GNU Free Documentation
391+License.''
392+
393+(a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
394+this GNU Manual, like GNU software.  Copies published by the Free
395+Software Foundation raise funds for GNU development.''
396+@end quotation
397+@end copying
398+
399 @dircategory Kernel
400 @direntry
401 * GRUB: (grub).                 The GRand Unified Bootloader
402@@ -34,53 +53,16 @@
403
404 @setchapternewpage odd
405
406-@ifinfo
407-Copyright @copyright{} 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
408-
409-Permission is granted to make and distribute verbatim copies of
410-this manual provided the copyright notice and this permission notice
411-are preserved on all copies.
412-
413-@ignore
414-Permission is granted to process this file through TeX and print the
415-results, provided the printed document carries a copying permission
416-notice identical to this one except for the removal of this paragraph
417-(this paragraph not being relevant to the printed manual).
418-
419-@end ignore
420-
421-Permission is granted to copy and distribute modified versions of this
422-manual under the conditions for verbatim copying, provided also that
423-the entire resulting derived work is distributed under the terms of a
424-permission notice identical to this one.
425-
426-Permission is granted to copy and distribute translations of this manual
427-into another language, under the above conditions for modified versions.
428-@end ifinfo
429-
430 @titlepage
431 @sp 10
432-@title the GRUB manual
433+@title the GNU GRUB manual
434 @subtitle The GRand Unified Bootloader, version @value{VERSION}, @value{UPDATED}.
435 @author Gordon Matzigkeit
436 @author Yoshinori K. Okuji
437 @c The following two commands start the copyright page.
438 @page
439 @vskip 0pt plus 1filll
440-Copyright @copyright{} 1999,2000,2001,2002,2004 Free Software Foundation, Inc.
441-
442-Permission is granted to make and distribute verbatim copies of
443-this manual provided the copyright notice and this permission notice
444-are preserved on all copies.
445-Permission is granted to copy and distribute modified versions of this
446-manual under the conditions for verbatim copying, provided that the entire
447-resulting derived work is distributed under the terms of a permission
448-notice identical to this one.
449-
450-Permission is granted to copy and distribute translations of this manual
451-into another language, under the above conditions for modified versions,
452-except that this permission notice may be stated in a translation approved
453-by Free Software Foundation.
454+@insertcopying
455 @end titlepage
456
457 @c Output the table of contents at the beginning.
458@@ -91,12 +73,14 @@ by Free Software Foundation.
459
460 @ifnottex
461 @node Top
462-@top GRUB manual
463+@top GNU GRUB manual
464
465 This is the documentation of GNU GRUB, the GRand Unified Bootloader,
466 a flexible and powerful boot loader program for @sc{pc}s.
467
468 This edition documents version @value{VERSION}.
469+
470+@insertcopying
471 @end ifnottex
472
473 @menu
474@@ -124,6 +108,7 @@ This edition documents version @value{VE
475 * Reporting bugs::              Where you should send a bug report
476 * Future::                      Some future plans on GRUB
477 * Internals::                   Hacking GRUB
478+* Copying This Manual::         Copying This Manual
479 * Index::
480 @end menu
481
482@@ -3965,6 +3950,16 @@ homepage}.
483 @include internals.texi
484
485
486+@node Copying This Manual
487+@appendix Copying This Manual
488+
489+@menu
490+* GNU Free Documentation License::  License for copying this manual.
491+@end menu
492+
493+@include fdl.texi
494+
495+
496 @node Index
497 @unnumbered Index
498
499diff -uprN grub-0.97/docs/Makefile.am grub/docs/Makefile.am
500--- grub-0.97/docs/Makefile.am	2003-07-09 12:45:35.000000000 +0100
501+++ grub/docs/Makefile.am	2006-06-24 15:40:02.000000000 +0100
502@@ -1,5 +1,5 @@
503 info_TEXINFOS = grub.texi multiboot.texi
504-grub_TEXINFOS = internals.texi
505+grub_TEXINFOS = internals.texi fdl.texi
506 EXAMPLES = boot.S kernel.c multiboot.h
507 multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot.h.texi
508 man_MANS = grub.8 mbchk.1 grub-install.8 grub-md5-crypt.8 grub-terminfo.8
509diff -uprN grub-0.97/docs/Makefile.in grub/docs/Makefile.in
510--- grub-0.97/docs/Makefile.in	2005-05-08 03:42:34.000000000 +0100
511+++ grub/docs/Makefile.in	2006-06-24 15:40:02.000000000 +0100
512@@ -202,7 +202,7 @@ sharedstatedir = @sharedstatedir@
513 sysconfdir = @sysconfdir@
514 target_alias = @target_alias@
515 info_TEXINFOS = grub.texi multiboot.texi
516-grub_TEXINFOS = internals.texi
517+grub_TEXINFOS = internals.texi fdl.texi
518 EXAMPLES = boot.S kernel.c multiboot.h
519 multiboot_TEXINFOS = boot.S.texi kernel.c.texi multiboot.h.texi
520 man_MANS = grub.8 mbchk.1 grub-install.8 grub-md5-crypt.8 grub-terminfo.8
521diff -uprN grub-0.97/docs/mbchk.1 grub/docs/mbchk.1
522--- grub-0.97/docs/mbchk.1	2005-05-08 03:48:56.000000000 +0100
523+++ grub/docs/mbchk.1	2006-06-24 15:40:02.000000000 +0100
524@@ -1,5 +1,5 @@
525 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.23.
526-.TH MBCHK "1" "May 2005" "mbchk (GNU GRUB 0.97)" FSF
527+.TH MBCHK "1" "June 2006" "mbchk (GNU GRUB 0.97)" FSF
528 .SH NAME
529 mbchk \- check the format of a Multiboot kernel
530 .SH SYNOPSIS
531diff -uprN grub-0.97/docs/multiboot.texi grub/docs/multiboot.texi
532--- grub-0.97/docs/multiboot.texi	2003-07-09 12:45:36.000000000 +0100
533+++ grub/docs/multiboot.texi	2006-06-24 15:40:02.000000000 +0100
534@@ -1,32 +1,28 @@
535 \input texinfo @c -*-texinfo-*-
536-@c -*-texinfo-*-
537 @c %**start of header
538 @setfilename multiboot.info
539-@settitle Multiboot Specification
540-@c %**end of header
541-
542+@set VERSION 0.6.95
543+@settitle Multiboot Specification version @value{VERSION}
544 @c Unify all our little indices for now.
545 @syncodeindex fn cp
546 @syncodeindex vr cp
547 @syncodeindex ky cp
548 @syncodeindex pg cp
549 @syncodeindex tp cp
550+@c %**end of header
551
552 @footnotestyle separate
553 @paragraphindent 3
554 @finalout
555
556+@copying
557+Copyright @copyright{} 1995,96 Bryan Ford <baford@@cs.utah.edu>
558
559-@dircategory Kernel
560-@direntry
561-* Multiboot Specification: (multiboot).		Multiboot Specification.
562-@end direntry
563+Copyright @copyright{} 1995,96 Erich Stefan Boleyn <erich@@uruk.org>
564
565-@ifinfo
566-Copyright @copyright{} 1995, 96 Bryan Ford <baford@@cs.utah.edu>
567-Copyright @copyright{} 1995, 96 Erich Stefan Boleyn <erich@@uruk.org>
568-Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
569+Copyright @copyright{} 1999,2000,2001,2002,2005,2006 Free Software Foundation, Inc.
570
571+@quotation
572 Permission is granted to make and distribute verbatim copies of
573 this manual provided the copyright notice and this permission notice
574 are preserved on all copies.
575@@ -36,7 +32,6 @@ Permission is granted to process this fi
576 results, provided the printed document carries a copying permission
577 notice identical to this one except for the removal of this paragraph
578 (this paragraph not being relevant to the printed manual).
579-
580 @end ignore
581
582 Permission is granted to copy and distribute modified versions of this
583@@ -45,31 +40,23 @@ the entire resulting derived work is dis
584 permission notice identical to this one.
585
586 Permission is granted to copy and distribute translations of this manual
587-into another language, under the above conditions for modified versions.
588-@end ifinfo
589+into another language, under the above conditions for modified
590+versions.
591+@end quotation
592+@end copying
593+
594+@dircategory Kernel
595+@direntry
596+* Multiboot Specification: (multiboot).		Multiboot Specification.
597+@end direntry
598
599 @titlepage
600 @sp 10
601-@title The Multiboot Specification
602+@title The Multiboot Specification version @value{VERSION}
603 @author Yoshinori K. Okuji, Bryan Ford, Erich Stefan Boleyn, Kunihiro Ishiguro
604 @page
605-
606 @vskip 0pt plus 1filll
607-Copyright @copyright{} 1995, 96 Bryan Ford <baford@@cs.utah.edu>
608-Copyright @copyright{} 1995, 96 Erich Stefan Boleyn <erich@@uruk.org>
609-Copyright @copyright{} 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
610-
611-Permission is granted to make and distribute verbatim copies of
612-this manual provided the copyright notice and this permission notice
613-are preserved on all copies.
614-
615-Permission is granted to copy and distribute modified versions of this
616-manual under the conditions for verbatim copying, provided also that
617-the entire resulting derived work is distributed under the terms of a
618-permission notice identical to this one.
619-
620-Permission is granted to copy and distribute translations of this manual
621-into another language, under the above conditions for modified versions.
622+@insertcopying
623 @end titlepage
624
625 @finalout
626@@ -80,7 +67,9 @@ into another language, under the above c
627 @top Multiboot Specification
628
629 This file documents Multiboot Specification, the proposal for the boot
630-sequence standard. This edition documents version 0.6.93.
631+sequence standard. This edition documents version @value{VERSION}.
632+
633+@insertcopying
634 @end ifnottex
635
636 @menu
637@@ -426,7 +415,7 @@ mode table (@pxref{Boot information form
638 kernel.
639
640 If bit 16 in the @samp{flags} word is set, then the fields at offsets
641-8-24 in the Multiboot header are valid, and the boot loader should use
642+12-28 in the Multiboot header are valid, and the boot loader should use
643 them instead of the fields in the actual executable header to calculate
644 where to load the OS image. This information does not need to be
645 provided if the kernel image is in @sc{elf} format, but it @emph{must}
646@@ -677,7 +666,7 @@ follows:
647 @example
648 @group
649 +-------+-------+-------+-------+
650-| drive | part1 | part2 | part3 |
651+| part3 | part2 | part1 | drive |
652 +-------+-------+-------+-------+
653 @end group
654 @end example
655@@ -1197,6 +1186,17 @@ Rewritten, using more strict words.
656 @item
657 The maintainer changes to the GNU GRUB maintainer team
658 @email{bug-grub@@gnu.org}, from Bryan Ford and Erich Stefan Boleyn.
659+
660+@item
661+The byte order of the @samp{boot_device} in Multiboot information is
662+reversed. This was a mistake.
663+
664+@item
665+The offset of the address fields were wrong.
666+
667+@item
668+The format is adapted to a newer Texinfo, and the version number is
669+specified more explicitly in the title.
670 @end itemize
671
672 @item 0.6
673diff -uprN grub-0.97/grub/asmstub.c grub/grub/asmstub.c
674--- grub-0.97/grub/asmstub.c	2005-02-16 20:45:14.000000000 +0000
675+++ grub/grub/asmstub.c	2008-03-28 13:22:28.000000000 +0000
676@@ -55,6 +55,10 @@ int grub_stage2 (void);
677 # endif /* ! BLKFLSBUF */
678 #endif /* __linux__ */
679
680+#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
681+# include <sys/sysctl.h>
682+#endif
683+
684 /* We want to prevent any circularararity in our stubs, as well as
685    libc name clashes. */
686 #define WITHOUT_LIBC_STUBS 1
687@@ -777,7 +781,39 @@ get_diskinfo (int drive, struct geometry
688
689       /* Open read/write, or read-only if that failed. */
690       if (! read_only)
691-	disks[drive].flags = open (devname, O_RDWR);
692+	{
693+/* By default, kernel of FreeBSD does not allow overwriting MBR */
694+#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
695+#define GEOM_SYSCTL	"kern.geom.debugflags"
696+	  int old_flags, flags;
697+	  size_t sizeof_int = sizeof (int);
698+
699+	  if (sysctlbyname (GEOM_SYSCTL, &old_flags, &sizeof_int, NULL, 0) != 0)
700+	    grub_printf ("failed to get " GEOM_SYSCTL "sysctl: %s\n", strerror (errno));
701+
702+	  if ((old_flags & 0x10) == 0)
703+	    {
704+	      /* "allow foot shooting", see geom(4) */
705+	      flags = old_flags | 0x10;
706+
707+	      if (sysctlbyname (GEOM_SYSCTL, NULL, NULL, &flags, sizeof (int)) != 0)
708+		{
709+		  flags = old_flags;
710+		  grub_printf ("failed to set " GEOM_SYSCTL "sysctl: %s\n", strerror (errno));
711+		}
712+	    }
713+	  else
714+	    flags = old_flags;
715+#endif
716+	  disks[drive].flags = open (devname, O_RDWR);
717+#if defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
718+	  if (flags != old_flags)
719+	    {
720+	      if (sysctlbyname (GEOM_SYSCTL, NULL, NULL, &old_flags, sizeof (int)) != 0)
721+	        grub_printf ("failed to set " GEOM_SYSCTL "sysctl: %s\n", strerror (errno));
722+	    }
723+#endif
724+	}
725
726       if (disks[drive].flags == -1)
727 	{
728@@ -926,7 +962,7 @@ hex_dump (void *buf, size_t size)
729
730 int
731 biosdisk (int subfunc, int drive, struct geometry *geometry,
732-	  int sector, int nsec, int segment)
733+	  unsigned int sector, int nsec, int segment)
734 {
735   char *buf;
736   int fd = geometry->flags;
737diff -uprN grub-0.97/grub/main.c grub/grub/main.c
738--- grub-0.97/grub/main.c	2003-07-09 12:45:36.000000000 +0100
739+++ grub/grub/main.c	2006-05-05 22:43:46.000000000 +0100
740@@ -32,6 +32,7 @@ int grub_stage2 (void);
741 #define WITHOUT_LIBC_STUBS 1
742 #include <shared.h>
743 #include <term.h>
744+#include <device.h>
745
746 char *program_name = 0;
747 int use_config_file = 1;
748@@ -192,6 +193,12 @@ main (int argc, char **argv)
749 	      perror ("strtoul");
750 	      exit (1);
751 	    }
752+	  if (boot_drive >= NUM_DISKS)
753+	    {
754+	      fprintf (stderr, "boot_drive should be from 0 to %d\n",
755+		       NUM_DISKS - 1);
756+	      exit (1);
757+	    }
758 	  break;
759
760 	case OPT_NO_CONFIG_FILE:
761diff -uprN grub-0.97/lib/device.c grub/lib/device.c
762--- grub-0.97/lib/device.c	2005-03-28 00:14:25.000000000 +0100
763+++ grub/lib/device.c	2008-03-28 13:22:28.000000000 +0000
764@@ -69,9 +69,9 @@ struct hd_geometry
765 # ifndef CDROM_GET_CAPABILITY
766 #  define CDROM_GET_CAPABILITY	0x5331	/* get capabilities */
767 # endif /* ! CDROM_GET_CAPABILITY */
768-# ifndef BLKGETSIZE
769-#  define BLKGETSIZE	_IO(0x12,96)	/* return device size */
770-# endif /* ! BLKGETSIZE */
771+# ifndef BLKGETSIZE64
772+#  define BLKGETSIZE64	_IOR(0x12,114,size_t)	/* return device size */
773+# endif /* ! BLKGETSIZE64 */
774 #endif /* __linux__ */
775
776 /* Use __FreeBSD_kernel__ instead of __FreeBSD__ for compatibility with
777@@ -152,19 +152,19 @@ get_drive_geometry (struct geometry *geo
778   /* Linux */
779   {
780     struct hd_geometry hdg;
781-    unsigned long nr;
782+    unsigned long long nr;
783
784     if (ioctl (fd, HDIO_GETGEO, &hdg))
785       goto fail;
786
787-    if (ioctl (fd, BLKGETSIZE, &nr))
788+    if (ioctl (fd, BLKGETSIZE64, &nr))
789       goto fail;
790
791     /* Got the geometry, so save it. */
792     geom->cylinders = hdg.cylinders;
793     geom->heads = hdg.heads;
794     geom->sectors = hdg.sectors;
795-    geom->total_sectors = nr;
796+    geom->total_sectors = nr / 512;
797
798     goto success;
799   }
800@@ -407,6 +407,12 @@ get_ataraid_disk_name (char *name, int u
801 {
802   sprintf (name, "/dev/ataraid/d%c", unit + '0');
803 }
804+
805+static void
806+get_i2o_disk_name (char *name, char unit)
807+{
808+  sprintf (name, "/dev/i2o/hd%c", unit);
809+}
810 #endif
811
812 /* Check if DEVICE can be read. If an error occurs, return zero,
813@@ -801,6 +807,29 @@ init_device_map (char ***map, const char
814 	  }
815       }
816   }
817+
818+  /* This is for I2O - we have /dev/i2o/hd<logical drive><partition> */
819+  {
820+    int unit;
821+
822+    for (unit = 'a'; unit < 'f'; unit++)
823+      {
824+        char name[24];
825+
826+        get_i2o_disk_name (name, unit);
827+        if (check_device (name))
828+          {
829+              (*map)[num_hd + 0x80] = strdup (name);
830+                  assert ((*map)[num_hd + 0x80]);
831+
832+	    /* If the device map file is opened, write the map.  */
833+               if (fp)
834+                     fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
835+
836+	    num_hd++;
837+          }
838+      }
839+  }
840 #endif /* __linux__ */
841
842   /* OK, close the device map file if opened.  */
843@@ -861,6 +890,12 @@ write_to_partition (char **map, int driv
844       if (strcmp (dev + strlen(dev) - 5, "/disc") == 0)
845 	strcpy (dev + strlen(dev) - 5, "/part");
846     }
847+  else
848+    {
849+      if ((strncmp (dev, "/dev/ataraid/", 13) == 0) ||
850+         (strncmp (dev, "/dev/rd/", 8) == 0))
851+        strcpy (dev + strlen(dev), "p");
852+    }
853   sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1);
854
855   /* Open the partition.  */
856diff -uprN grub-0.97/netboot/3c509.c grub/netboot/3c509.c
857--- grub-0.97/netboot/3c509.c	2003-07-09 12:45:37.000000000 +0100
858+++ grub/netboot/3c509.c	2002-01-02 21:56:40.000000000 +0000
859@@ -18,7 +18,7 @@ Author: Martin Renters.
860
861 3c509 support added by Serge Babkin (babkin@hq.icb.chel.su)
862
863-$Id: 3c509.c,v 1.4 2002/01/02 21:56:40 okuji Exp $
864+$Id: 3c509.c 609 2002-01-02 21:56:40Z okuji $
865
866 ***************************************************************************/
867
868diff -uprN grub-0.97/netboot/cs89x0.c grub/netboot/cs89x0.c
869--- grub-0.97/netboot/cs89x0.c	2003-07-09 12:45:37.000000000 +0100
870+++ grub/netboot/cs89x0.c	2008-05-20 12:04:18.000000000 +0100
871@@ -1,3 +1,21 @@
872+/**
873+   Per an email message from Russ Nelson <nelson@crynwr.com> on
874+   18 March 2008 this file is now licensed under GPL Version 2.
875+
876+   From: Russ Nelson <nelson@crynwr.com>
877+   Date: Tue, 18 Mar 2008 12:42:00 -0400
878+   Subject: Re: [Etherboot-developers] cs89x0 driver in etherboot
879+   -- quote from email
880+   As copyright holder, if I say it doesn't conflict with the GPL,
881+   then it doesn't conflict with the GPL.
882+
883+   However, there's no point in causing people's brains to overheat,
884+   so yes, I grant permission for the code to be relicensed under the
885+   GPLv2.  Please make sure that this change in licensing makes its
886+   way upstream.  -russ
887+   -- quote from email
888+**/
889+
890 /* cs89x0.c: A Crystal Semiconductor CS89[02]0 driver for etherboot. */
891 /*
892   Permission is granted to distribute the enclosed cs89x0.[ch] driver
893diff -uprN grub-0.97/netboot/cs89x0.h grub/netboot/cs89x0.h
894--- grub-0.97/netboot/cs89x0.h	2003-07-09 12:45:37.000000000 +0100
895+++ grub/netboot/cs89x0.h	2008-05-20 12:04:18.000000000 +0100
896@@ -1,3 +1,21 @@
897+/**
898+   Per an email message from Russ Nelson <nelson@crynwr.com> on
899+   18 March 2008 this file is now licensed under GPL Version 2.
900+
901+   From: Russ Nelson <nelson@crynwr.com>
902+   Date: Tue, 18 Mar 2008 12:42:00 -0400
903+   Subject: Re: [Etherboot-developers] cs89x0 driver in etherboot
904+   -- quote from email
905+   As copyright holder, if I say it doesn't conflict with the GPL,
906+   then it doesn't conflict with the GPL.
907+
908+   However, there's no point in causing people's brains to overheat,
909+   so yes, I grant permission for the code to be relicensed under the
910+   GPLv2.  Please make sure that this change in licensing makes its
911+   way upstream.  -russ
912+   -- quote from email
913+**/
914+
915 /*  Copyright, 1988-1992, Russell Nelson, Crynwr Software
916
917    This program is free software; you can redistribute it and/or modify
918diff -uprN grub-0.97/netboot/etherboot.h grub/netboot/etherboot.h
919--- grub-0.97/netboot/etherboot.h	2003-07-09 12:45:37.000000000 +0100
920+++ grub/netboot/etherboot.h	2006-09-08 13:56:22.000000000 +0100
921@@ -531,9 +531,6 @@ extern int ip_abort;
922 extern int network_ready;
923 extern struct rom_info rom;
924 extern struct arptable_t arptable[MAX_ARP];
925-extern struct bootpd_t bootp_data;
926-#define	BOOTP_DATA_ADDR	(&bootp_data)
927-extern unsigned char *end_of_rfc1533;
928
929 /* config.c */
930 extern struct nic nic;
931diff -uprN grub-0.97/netboot/main.c grub/netboot/main.c
932--- grub-0.97/netboot/main.c	2004-05-20 23:19:33.000000000 +0100
933+++ grub/netboot/main.c	2006-09-08 13:56:22.000000000 +0100
934@@ -56,7 +56,8 @@ static int vendorext_isvalid;
935 static unsigned long netmask;
936 static struct bootpd_t bootp_data;
937 static unsigned long xid;
938-static unsigned char *end_of_rfc1533 = NULL;
939+
940+#define	BOOTP_DATA_ADDR	(&bootp_data)
941
942 #ifndef	NO_DHCP_SUPPORT
943 #endif /* NO_DHCP_SUPPORT */
944@@ -967,7 +968,6 @@ decode_rfc1533 (unsigned char *p, int bl
945
946   if (block == 0)
947     {
948-      end_of_rfc1533 = NULL;
949       vendorext_isvalid = 0;
950
951       if (grub_memcmp (p, rfc1533_cookie, 4))
952@@ -1021,7 +1021,7 @@ decode_rfc1533 (unsigned char *p, int bl
953 	}
954       else if (c == RFC1533_END)
955 	{
956-	  end_of_rfc1533 = endp = p;
957+	  endp = p;
958 	  continue;
959 	}
960       else if (c == RFC1533_NETMASK)
961diff -uprN grub-0.97/netboot/natsemi.c grub/netboot/natsemi.c
962--- grub-0.97/netboot/natsemi.c	2003-07-09 12:45:38.000000000 +0100
963+++ grub/netboot/natsemi.c	2006-09-10 08:26:10.000000000 +0100
964@@ -608,7 +608,7 @@ natsemi_transmit(struct nic  *nic,
965 		 const char  *p)     /* Packet */
966 {
967     u32 status, to, nstype;
968-    u32 tx_status;
969+    volatile u32 tx_status;
970
971     /* Stop the transmitter */
972     outl(TxOff, ioaddr + ChipCmd);
973@@ -647,7 +647,7 @@ natsemi_transmit(struct nic  *nic,
974
975     to = currticks() + TX_TIMEOUT;
976
977-    while ((((volatile u32) tx_status=txd.cmdsts) & OWN) && (currticks() < to))
978+    while (((tx_status=txd.cmdsts) & OWN) && (currticks() < to))
979         /* wait */ ;
980
981     if (currticks() >= to) {
982diff -uprN grub-0.97/netboot/sis900.c grub/netboot/sis900.c
983--- grub-0.97/netboot/sis900.c	2003-07-09 12:45:38.000000000 +0100
984+++ grub/netboot/sis900.c	2006-09-10 08:26:10.000000000 +0100
985@@ -901,7 +901,7 @@ sis900_transmit(struct nic  *nic,
986                 const char  *p)     /* Packet */
987 {
988     u32 status, to, nstype;
989-    u32 tx_status;
990+    volatile u32 tx_status;
991
992     /* Stop the transmitter */
993     outl(TxDIS, ioaddr + cr);
994@@ -940,7 +940,7 @@ sis900_transmit(struct nic  *nic,
995
996     to = currticks() + TX_TIMEOUT;
997
998-    while ((((volatile u32) tx_status=txd.cmdsts) & OWN) && (currticks() < to))
999+    while (((tx_status=txd.cmdsts) & OWN) && (currticks() < to))
1000         /* wait */ ;
1001
1002     if (currticks() >= to) {
1003diff -uprN grub-0.97/netboot/sk_g16.c grub/netboot/sk_g16.c
1004--- grub-0.97/netboot/sk_g16.c	2003-07-09 12:45:38.000000000 +0100
1005+++ grub/netboot/sk_g16.c	2002-01-02 21:56:40.000000000 +0000
1006@@ -13,12 +13,12 @@ Changes to make it work with Etherboot b
1007  *
1008  * Module         : sk_g16.c
1009  *
1010- * Version        : $Revision: 1.4 $
1011+ * Version        : $Revision: 609 $
1012  *
1013  * Author         : Patrick J.D. Weichmann
1014  *
1015  * Date Created   : 94/05/26
1016- * Last Updated   : $Date: 2002/01/02 21:56:40 $
1017+ * Last Updated   : $Date: 2002-01-02 21:56:40 +0000 (mer 02 jan 2002) $
1018  *
1019  * Description    : Schneider & Koch G16 Ethernet Device Driver for
1020  *                  Linux Kernel >= 1.1.22
1021diff -uprN grub-0.97/netboot/sk_g16.h grub/netboot/sk_g16.h
1022--- grub-0.97/netboot/sk_g16.h	2003-07-09 12:45:38.000000000 +0100
1023+++ grub/netboot/sk_g16.h	2000-07-29 20:22:54.000000000 +0100
1024@@ -4,7 +4,7 @@
1025  * of the GNU Public License, incorporated herein by reference.
1026  *
1027  * Module         : sk_g16.h
1028- * Version        : $Revision: 1.3 $
1029+ * Version        : $Revision: 388 $
1030  *
1031  * Author         : M.Hipp (mhipp@student.uni-tuebingen.de)
1032  * changes by     : Patrick J.D. Weichmann
1033@@ -15,8 +15,8 @@
1034  *                  the am7990 (LANCE) chip used for writing a
1035  *                  network device driver which uses this chip
1036  *
1037- * $Log: sk_g16.h,v $
1038- * Revision 1.3  2000/07/29 19:22:54  okuji
1039+ * $Log$
1040+ * Revision 1.3  2000-07-29 19:22:54  okuji
1041  * update the network support to etherboot-4.6.4.
1042  *
1043 -*/
1044diff -uprN grub-0.97/stage1/Makefile.am grub/stage1/Makefile.am
1045--- grub-0.97/stage1/Makefile.am	2004-07-16 12:44:56.000000000 +0100
1046+++ grub/stage1/Makefile.am	2007-11-05 01:29:46.000000000 +0000
1047@@ -5,7 +5,7 @@ CLEANFILES = $(nodist_pkglib_DATA)
1048
1049 # We can't use builtins or standard includes.
1050 AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
1051-LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
1052+stage1_exec_LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
1053
1054 noinst_PROGRAMS = stage1.exec
1055 stage1_exec_SOURCES = stage1.S stage1.h
1056diff -uprN grub-0.97/stage1/Makefile.in grub/stage1/Makefile.in
1057--- grub-0.97/stage1/Makefile.in	2005-05-08 03:42:36.000000000 +0100
1058+++ grub/stage1/Makefile.in	2007-11-05 01:29:46.000000000 +0000
1059@@ -110,7 +110,7 @@ INSTALL_DATA = @INSTALL_DATA@
1060 INSTALL_PROGRAM = @INSTALL_PROGRAM@
1061 INSTALL_SCRIPT = @INSTALL_SCRIPT@
1062 INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
1063-LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
1064+LDFLAGS = @LDFLAGS@
1065 LIBOBJS = @LIBOBJS@
1066 LIBS = @LIBS@
1067 LTLIBOBJS = @LTLIBOBJS@
1068@@ -188,6 +188,7 @@ CLEANFILES = $(nodist_pkglib_DATA)
1069
1070 # We can't use builtins or standard includes.
1071 AM_CCASFLAGS = $(STAGE1_CFLAGS) -fno-builtin -nostdinc
1072+stage1_exec_LDFLAGS = -nostdlib -Wl,-N,-Ttext,7C00
1073 stage1_exec_SOURCES = stage1.S stage1.h
1074 SUFFIXES = .exec
1075 all: all-am
1076diff -uprN grub-0.97/stage2/bios.c grub/stage2/bios.c
1077--- grub-0.97/stage2/bios.c	2004-03-27 16:34:04.000000000 +0000
1078+++ grub/stage2/bios.c	2008-03-28 13:22:28.000000000 +0000
1079@@ -47,7 +47,7 @@ extern int get_diskinfo_floppy (int driv
1080    return the error number. Otherwise, return 0.  */
1081 int
1082 biosdisk (int read, int drive, struct geometry *geometry,
1083-	  int sector, int nsec, int segment)
1084+	  unsigned int sector, int nsec, int segment)
1085 {
1086   int err;
1087
1088diff -uprN grub-0.97/stage2/boot.c grub/stage2/boot.c
1089--- grub-0.97/stage2/boot.c	2004-03-30 12:44:08.000000000 +0100
1090+++ grub/stage2/boot.c	2005-09-28 22:47:55.000000000 +0100
1091@@ -1,7 +1,7 @@
1092 /* boot.c - load and bootstrap a kernel */
1093 /*
1094  *  GRUB  --  GRand Unified Bootloader
1095- *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
1096+ *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005  Free Software Foundation, Inc.
1097  *
1098  *  This program is free software; you can redistribute it and/or modify
1099  *  it under the terms of the GNU General Public License as published by
1100@@ -96,7 +96,7 @@ load_image (char *kernel, char *arg, ker
1101   lh = (struct linux_kernel_header *) buffer;
1102
1103   /* ELF loading supported if multiboot, FreeBSD and NetBSD.  */
1104-  if ((type == KERNEL_TYPE_MULTIBOOT
1105+  if (((type == KERNEL_TYPE_MULTIBOOT && ! (flags & MULTIBOOT_AOUT_KLUDGE))
1106        || pu.elf->e_ident[EI_OSABI] == ELFOSABI_FREEBSD
1107        || grub_strcmp (pu.elf->e_ident + EI_BRAND, "FreeBSD") == 0
1108        || suggested_type == KERNEL_TYPE_NETBSD)
1109diff -uprN grub-0.97/stage2/builtins.c grub/stage2/builtins.c
1110--- grub-0.97/stage2/builtins.c	2005-02-15 21:58:23.000000000 +0000
1111+++ grub/stage2/builtins.c	2006-03-21 20:51:58.000000000 +0000
1112@@ -3830,15 +3830,15 @@ setup_func (char *arg, int flags)
1113 	{
1114 	  char tmp[16];
1115 	  grub_sprintf (tmp, ",%d", (partition >> 16) & 0xFF);
1116-	  grub_strncat (device, tmp, 256);
1117+	  grub_strncat (device, tmp, sizeof (device));
1118 	}
1119       if ((partition & 0x00FF00) != 0x00FF00)
1120 	{
1121 	  char tmp[16];
1122 	  grub_sprintf (tmp, ",%c", 'a' + ((partition >> 8) & 0xFF));
1123-	  grub_strncat (device, tmp, 256);
1124+	  grub_strncat (device, tmp, sizeof (device));
1125 	}
1126-      grub_strncat (device, ")", 256);
1127+      grub_strncat (device, ")", sizeof (device));
1128     }
1129
1130   int embed_stage1_5 (char *stage1_5, int drive, int partition)
1131diff -uprN grub-0.97/stage2/disk_io.c grub/stage2/disk_io.c
1132--- grub-0.97/stage2/disk_io.c	2004-05-23 17:35:24.000000000 +0100
1133+++ grub/stage2/disk_io.c	2008-03-28 13:22:28.000000000 +0000
1134@@ -137,7 +137,7 @@ log2 (unsigned long word)
1135 }
1136
1137 int
1138-rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
1139+rawread (int drive, unsigned int sector, int byte_offset, int byte_len, char *buf)
1140 {
1141   int slen, sectors_per_vtrack;
1142   int sector_size_bits = log2 (buf_geom.sector_size);
1143@@ -261,7 +261,7 @@ rawread (int drive, int sector, int byte
1144        */
1145       if (disk_read_func)
1146 	{
1147-	  int sector_num = sector;
1148+	  unsigned int sector_num = sector;
1149 	  int length = buf_geom.sector_size - byte_offset;
1150 	  if (length > size)
1151 	    length = size;
1152@@ -291,7 +291,7 @@ rawread (int drive, int sector, int byte
1153
1154
1155 int
1156-devread (int sector, int byte_offset, int byte_len, char *buf)
1157+devread (unsigned int sector, int byte_offset, int byte_len, char *buf)
1158 {
1159   /*
1160    *  Check partition boundaries
1161@@ -330,7 +330,7 @@ devread (int sector, int byte_offset, in
1162
1163 #ifndef STAGE1_5
1164 int
1165-rawwrite (int drive, int sector, char *buf)
1166+rawwrite (int drive, unsigned int sector, char *buf)
1167 {
1168   if (sector == 0)
1169     {
1170@@ -363,7 +363,7 @@ rawwrite (int drive, int sector, char *b
1171 }
1172
1173 int
1174-devwrite (int sector, int sector_count, char *buf)
1175+devwrite (unsigned int sector, int sector_count, char *buf)
1176 {
1177 #if defined(GRUB_UTIL) && defined(__linux__)
1178   if (current_partition != 0xFFFFFF
1179diff -uprN grub-0.97/stage2/fsys_ffs.c grub/stage2/fsys_ffs.c
1180--- grub-0.97/stage2/fsys_ffs.c	2003-07-09 12:45:52.000000000 +0100
1181+++ grub/stage2/fsys_ffs.c	2001-11-12 06:57:29.000000000 +0000
1182@@ -50,7 +50,7 @@
1183  * the rights to redistribute these changes.
1184  *
1185  *	from: Mach, Revision 2.2  92/04/04  11:35:49  rpd
1186- *	$Id: fsys_ffs.c,v 1.10 2001/11/12 06:57:29 okuji Exp $
1187+ *	$Id: fsys_ffs.c 594 2001-11-12 06:57:29Z okuji $
1188  */
1189
1190 #ifdef FSYS_FFS
1191diff -uprN grub-0.97/stage2/fsys_ufs2.c grub/stage2/fsys_ufs2.c
1192--- grub-0.97/stage2/fsys_ufs2.c	2004-06-19 13:17:52.000000000 +0100
1193+++ grub/stage2/fsys_ufs2.c	2004-06-19 13:17:52.000000000 +0100
1194@@ -51,7 +51,7 @@
1195  * the rights to redistribute these changes.
1196  *
1197  *	from: Mach, Revision 2.2  92/04/04  11:35:49  rpd
1198- *	$Id: fsys_ufs2.c,v 1.2 2004/06/19 12:17:52 okuji Exp $
1199+ *	$Id: fsys_ufs2.c 841 2004-06-19 12:17:52Z okuji $
1200  */
1201
1202 #ifdef FSYS_UFS2
1203diff -uprN grub-0.97/stage2/imgact_aout.h grub/stage2/imgact_aout.h
1204--- grub-0.97/stage2/imgact_aout.h	2003-07-09 12:45:53.000000000 +0100
1205+++ grub/stage2/imgact_aout.h	1999-06-24 01:03:29.000000000 +0100
1206@@ -32,7 +32,7 @@
1207  * SUCH DAMAGE.
1208  *
1209  *	from: @(#)exec.h	8.1 (Berkeley) 6/11/93
1210- *	$Id: imgact_aout.h,v 1.1 1999/06/24 00:03:22 okuji Exp $
1211+ *	$Id: imgact_aout.h 98 1999-06-24 00:03:29Z okuji $
1212  */
1213 /*
1214  *  11/23/95 - Kludge to get "ntohl" null macro added.  -- ESB
1215diff -uprN grub-0.97/stage2/iso9660.h grub/stage2/iso9660.h
1216--- grub-0.97/stage2/iso9660.h	2004-03-27 16:02:38.000000000 +0000
1217+++ grub/stage2/iso9660.h	2007-02-22 23:40:25.000000000 +0000
1218@@ -73,11 +73,11 @@ typedef	union {
1219
1220 typedef	struct __iso_16bit {
1221   u_int16_t l, b;
1222-} iso_16bit_t __attribute__ ((packed));
1223+} iso_16bit_t;
1224
1225 typedef	struct __iso_32bit {
1226   u_int32_t l, b;
1227-} iso_32bit_t __attribute__ ((packed));
1228+} iso_32bit_t;
1229
1230 typedef u_int8_t		iso_date_t[7];
1231
1232diff -uprN grub-0.97/stage2/shared.h grub/stage2/shared.h
1233--- grub-0.97/stage2/shared.h	2004-06-19 17:40:09.000000000 +0100
1234+++ grub/stage2/shared.h	2008-03-28 13:22:28.000000000 +0000
1235@@ -499,7 +499,11 @@ struct vbe_mode
1236   unsigned char linear_reserved_field_position;
1237   unsigned long max_pixel_clock;
1238
1239-  unsigned char reserved3[189];
1240+  /* Reserved field to make structure to be 256 bytes long, VESA BIOS
1241+     Extension 3.0 Specification says to reserve 189 bytes here but
1242+     that doesn't make structure to be 256 bytes.  So additional one is
1243+     added here.  */
1244+  unsigned char reserved3[189 + 1];
1245 } __attribute__ ((packed));
1246
1247
1248@@ -807,7 +811,7 @@ int checkkey (void);
1249 /* Low-level disk I/O */
1250 int get_diskinfo (int drive, struct geometry *geometry);
1251 int biosdisk (int subfunc, int drive, struct geometry *geometry,
1252-	      int sector, int nsec, int segment);
1253+	      unsigned int sector, int nsec, int segment);
1254 void stop_floppy (void);
1255
1256 /* Command-line interface functions. */
1257@@ -920,10 +924,10 @@ int gunzip_test_header (void);
1258 int gunzip_read (char *buf, int len);
1259 #endif /* NO_DECOMPRESSION */
1260
1261-int rawread (int drive, int sector, int byte_offset, int byte_len, char *buf);
1262-int devread (int sector, int byte_offset, int byte_len, char *buf);
1263-int rawwrite (int drive, int sector, char *buf);
1264-int devwrite (int sector, int sector_len, char *buf);
1265+int rawread (int drive, unsigned int sector, int byte_offset, int byte_len, char *buf);
1266+int devread (unsigned int sector, int byte_offset, int byte_len, char *buf);
1267+int rawwrite (int drive, unsigned int sector, char *buf);
1268+int devwrite (unsigned int sector, int sector_len, char *buf);
1269
1270 /* Parse a device string and initialize the global parameters. */
1271 char *set_device (char *device);
1272diff -uprN grub-0.97/stage2/stage2.c grub/stage2/stage2.c
1273--- grub-0.97/stage2/stage2.c	2005-03-19 17:51:57.000000000 +0000
1274+++ grub/stage2/stage2.c	2006-05-05 23:06:31.000000000 +0100
1275@@ -651,7 +651,10 @@ restart:
1276 		  *(new_heap++) = 0;
1277
1278 		  if (config_entries)
1279-		    run_menu (heap, NULL, new_num_entries, new_heap, 0);
1280+		    {
1281+		      current_entryno = first_entry + entryno;
1282+		      run_menu (heap, NULL, new_num_entries, new_heap, 0);
1283+		    }
1284 		  else
1285 		    {
1286 		      cls ();
1287@@ -727,7 +730,8 @@ restart:
1288 	cur_entry = get_entry (config_entries, first_entry + entryno, 1);
1289
1290       /* Set CURRENT_ENTRYNO for the command "savedefault".  */
1291-      current_entryno = first_entry + entryno;
1292+      if (config_entries)
1293+	current_entryno = first_entry + entryno;
1294
1295       if (run_script (cur_entry, heap))
1296 	{
1297diff -uprN grub-0.97/stage2/tparm.c grub/stage2/tparm.c
1298--- grub-0.97/stage2/tparm.c	2003-07-09 12:45:53.000000000 +0100
1299+++ grub/stage2/tparm.c	2002-11-29 20:39:24.000000000 +0000
1300@@ -63,7 +63,7 @@ typedef char grub_bool;
1301 #define MAX_FORMAT_LEN 256
1302 #define max(a,b) ((a) > (b) ? (a) : (b))
1303
1304-//MODULE_ID("$Id: tparm.c,v 1.1 2002/11/29 20:39:24 okuji Exp $")
1305+//MODULE_ID("$Id: tparm.c 708 2002-11-29 20:39:24Z okuji $")
1306
1307 /*
1308  *	char *
1309diff -uprN grub-0.97/stamp-h.in grub/stamp-h.in
1310--- grub-0.97/stamp-h.in	1970-01-01 01:00:00.000000000 +0100
1311+++ grub/stamp-h.in	1999-09-13 14:32:31.000000000 +0100
1312@@ -0,0 +1 @@
1313+timestamp
1314diff -uprN grub-0.97/THANKS grub/THANKS
1315--- grub-0.97/THANKS	2005-05-08 03:17:43.000000000 +0100
1316+++ grub/THANKS	2006-03-21 20:51:58.000000000 +0000
1317@@ -121,3 +121,4 @@ Vesa Jaaskelainen <jaaskela@tietomyrsky.
1318 Yedidyah Bar-David <didi@post.tau.ac.il>
1319 Yury V. Umanets <umka@namesys.com>
1320 Yuri Zaporogets <yuriz@ukr.net>
1321+Vitaly Fertman <vitaly@namesys.com>
1322diff -uprN grub-0.97/util/grub-install.in grub/util/grub-install.in
1323--- grub-0.97/util/grub-install.in	2004-07-24 19:57:31.000000000 +0100
1324+++ grub/util/grub-install.in	2006-04-20 14:46:46.000000000 +0100
1325@@ -112,8 +112,8 @@ convert () {
1326 	tmp_disk=`echo "$1" | sed 's%\([sh]d[0-9]*\).*%\1%'`
1327 	tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;;
1328     freebsd* | kfreebsd*-gnu)
1329-	tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%r\1%' \
1330-			    | sed 's%r\{0,1\}\(da[0-9]*\).*$%r\1%'`
1331+	tmp_disk=`echo "$1" | sed 's%r\{0,1\}\([saw]d[0-9]*\).*$%\1%' \
1332+			    | sed 's%r\{0,1\}\(da[0-9]*\).*$%\1%'`
1333 	tmp_part=`echo "$1" \
1334 	    | sed "s%.*/r\{0,1\}[saw]d[0-9]\(s[0-9]*[a-h]\)%\1%" \
1335        	    | sed "s%.*/r\{0,1\}da[0-9]\(s[0-9]*[a-h]\)%\1%"`
1336diff -uprN grub-0.97/util/mkbimage grub/util/mkbimage
1337--- grub-0.97/util/mkbimage	2004-07-24 19:57:31.000000000 +0100
1338+++ grub/util/mkbimage	2007-02-22 16:01:03.000000000 +0000
1339@@ -1,7 +1,7 @@
1340 #!/bin/sh
1341 # MaKe a Bootable IMAGE --- 1.44, 2.88 and El Torito no-emulation mode
1342 # C) 2001,2002,2003 Thierry Laronde <tlaronde@polynum.org>
1343-# C) 2001,2002,2003 Robert Millan <robertmh@gnu.org>
1344+# C) 2001,2002,2003 Robert Millan <rmh@aybabtu.com>
1345
1346
1347 # This program is free software; you can redistribute it and/or modify
1348@@ -19,7 +19,7 @@
1349 # program's maintainer or write to: The Free Software Foundation,
1350 # Inc.; 59 Temple Place, Suite 330; Boston, MA 02111-1307, USA.
1351
1352-# $Id: mkbimage,v 1.19 2004/07/21 14:43:04 robertmh Exp $
1353+# $Id: mkbimage 1233 2007-02-22 16:01:03Z robertmh $
1354
1355 # Global variables
1356 tarfile=
1357@@ -58,7 +58,7 @@ stage2_os_name=
1358
1359 # Name by which this script was invoked.
1360 program=`echo "$0" | sed -e 's/[^\/]*\///g'`
1361-version_number='$Revision: 1.19 $'
1362+version_number='$Revision: 1233 $'
1363
1364 usage="
1365 Usage: $program [-hVF] [-t TYPE] [-d DIRECTORY] [-s FS_TYPE] -f TAR_FILE
1366@@ -94,15 +94,13 @@ Options:
1367 	    display Version information and exit
1368
1369 Copyright (c) 2001,2002,2003 Thierry Laronde <tlaronde@polynum.org>.
1370-Copyright (c) 2001,2002 Robert Millan <zeratul2@wanadoo.es>.
1371 GPLed."
1372
1373 version="mkbimage $version_number
1374
1375-Written by Thierry Laronde and Robert Millan.
1376+Written by Thierry Laronde.
1377
1378 Copyright (c) 2001,2002,2003 Thierry Laronde <tlaronde@polynum.org>.
1379-Copyright (c) 2001,2002,2003 Robert Millan <zeratul2@wanadoo.es>.
1380
1381 This is free software under the GPL version 2 or later; see the source for
1382 copying conditions.  There is NO warranty, not even for MERCHANTABILITY or
1383