bug-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-grub] 0.91 booting xfs on (hd0,4)


From: Yoshinori K. Okuji
Subject: Re: [Bug-grub] 0.91 booting xfs on (hd0,4)
Date: Fri, 08 Feb 2002 08:35:31 +0900
User-agent: Wanderlust/2.6.0 (Twist And Shout) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (Unebigoryoae) APEL/10.3 Emacs/20.7 (i686-pc-linux-gnu) MULE/4.0 (HANANOEN)

Here is the patch. I haven't tested this code, because I don't have XFS.
So I'd appreciate if you would send a report.

Thanks,
Okuji
Index: ChangeLog
===================================================================
RCS file: /cvsroot/grub/grub/ChangeLog,v
retrieving revision 1.472
diff -u -r1.472 ChangeLog
--- ChangeLog   5 Feb 2002 05:00:03 -0000       1.472
+++ ChangeLog   7 Feb 2002 23:27:43 -0000
@@ -1,3 +1,14 @@
+2002-02-08  Yoshinori K. Okuji  <address@hidden>
+
+       * stage2/fsys_jfs.c (jfs_read) [STAGE1_5]: Set and reset
+       DISK_READ_FUNC even in Stage 1.5.
+       * stage2/fsys_xfs.c (xfs_read) [STAGE1_5]: Likewise.
+
+       * stage2/stage1_5.c (saved_sector): Initialized with -1.
+       (cmain): Check if SAVED_SECTOR was set appropriately after
+       reading the second sector of Stage 2. If SAVED_SECTOR is not
+       set (i.e. it is equal to -1), print an error and stop.
+       
 2002-02-05  Yoshinori K. Okuji  <address@hidden>
 
        * stage2/builtins.c (setup_func): Add a VSTa fs entry into
Index: stage2/fsys_jfs.c
===================================================================
RCS file: /cvsroot/grub/grub/stage2/fsys_jfs.c,v
retrieving revision 1.1
diff -u -r1.1 fsys_jfs.c
--- stage2/fsys_jfs.c   27 Oct 2001 16:04:25 -0000      1.1
+++ stage2/fsys_jfs.c   7 Feb 2002 23:27:44 -0000
@@ -1,7 +1,7 @@
 /* fsys_jfs.c - an implementation for the IBM JFS file system */
 /*  
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2001  Free Software Foundation, Inc.
+ *  Copyright (C) 2001,2002  Free Software Foundation, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -243,14 +243,12 @@
                        endofcur = (offset + xadlen) << jfs.l2bsize; 
                        toread = (endofcur >= endpos)
                                  ? len : (endofcur - filepos);
-#ifndef STAGE1_5
+
                        disk_read_func = disk_read_hook;
-#endif /* STAGE1_5 */
                        devread (addressXAD (xad) << jfs.bdlog,
                                 filepos - (offset << jfs.l2bsize), toread, 
buf);
-#ifndef STAGE1_5
                        disk_read_func = NULL;
-#endif /* STAGE1_5 */
+
                        buf += toread;
                        len -= toread;
                        filepos += toread;
Index: stage2/fsys_xfs.c
===================================================================
RCS file: /cvsroot/grub/grub/stage2/fsys_xfs.c,v
retrieving revision 1.1
diff -u -r1.1 fsys_xfs.c
--- stage2/fsys_xfs.c   27 Oct 2001 16:04:25 -0000      1.1
+++ stage2/fsys_xfs.c   7 Feb 2002 23:27:44 -0000
@@ -1,7 +1,7 @@
 /* fsys_xfs.c - an implementation for the SGI XFS file system */
 /*  
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2001  Free Software Foundation, Inc.
+ *  Copyright (C) 2001,2002  Free Software Foundation, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -499,14 +499,12 @@
                        endofcur = (offset + xadlen) << xfs.blklog; 
                        toread = (endofcur >= endpos)
                                  ? len : (endofcur - filepos);
-#ifndef STAGE1_5
+
                        disk_read_func = disk_read_hook;
-#endif /* STAGE1_5 */
                        devread (fsb2daddr (xad->start),
                                 filepos - (offset << xfs.blklog), toread, buf);
-#ifndef STAGE1_5
                        disk_read_func = NULL;
-#endif /* STAGE1_5 */
+
                        buf += toread;
                        len -= toread;
                        filepos += toread;
Index: stage2/stage1_5.c
===================================================================
RCS file: /cvsroot/grub/grub/stage2/stage1_5.c,v
retrieving revision 1.6
diff -u -r1.6 stage1_5.c
--- stage2/stage1_5.c   12 Nov 2001 06:57:29 -0000      1.6
+++ stage2/stage1_5.c   7 Feb 2002 23:27:44 -0000
@@ -1,6 +1,6 @@
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 2001  Free Software Foundation, Inc.
+ *  Copyright (C) 2001,2002  Free Software Foundation, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -19,7 +19,7 @@
 
 #include "shared.h"
 
-static int saved_sector;
+static int saved_sector = -1;
 
 static void
 disk_read_savesect_func (int sector, int offset, int length)
@@ -30,7 +30,7 @@
 void
 cmain (void)
 {
-  printf ("\n\nGRUB loading, please wait...\n");
+  grub_printf ("\n\nGRUB loading, please wait...\n");
 
   /*
    *  Here load the true second-stage boot-loader.
@@ -43,6 +43,13 @@
       disk_read_hook = disk_read_savesect_func;
       grub_read ((char *) 0x8000, SECTOR_SIZE * 2);
       disk_read_hook = NULL;
+
+      /* Sanity check: catch an internal error.  */
+      if (saved_sector == -1)
+       {
+         grub_printf ("internal error: the second sector of Stage 2 is 
unknown.");
+         stop ();
+       }
       
       ret = grub_read ((char *) 0x8000 + SECTOR_SIZE * 2, -1);
       

reply via email to

[Prev in Thread] Current Thread [Next in Thread]