[Top][All Lists]

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

Re: Bug and patch for BSD partition detection

From: Jochen Hoenicke
Subject: Re: Bug and patch for BSD partition detection
Date: Tue, 5 Dec 2000 17:53:02 +0100 (MET)

On Dec 2, Heikki Vatiainen wrote:
> [I'm not on the bug-grub list, so Cc:s are welcome]
> I was experimenting with installing FreeBSD, NetBSD and OpenBSD to 
> same "primary" FDISK partition. While doing this, I noticed that a 
> change in grub between versions 0.5.95 and 0.5.96 broke the BSD 
> slice (a, b, c, etc.) detection.
> [...]
> The current CVS version was also not working, so I poked around 
> the code a bit and located the problem to the end of 
> stage2/disk_io.c:next_partition() in which an if statement was 
> getting wrong result from IS_PC_SLICE_TYPE_BSD macro.
> My proposed fix is attached below. It always clears the possible
> file system type found from the bits above the 8 lowest bits and
> leaves only the partition type (0xa6 for OpenBSD, 0xa5 for FreeBSD,
> etc.) left. With this fix I can now boot any of the BSDs with the 
> CVS version of grub.
> -#define IS_PC_SLICE_TYPE_BSD(type)     IS_PC_SLICE_TYPE_BSD_WITH_FS(type,0)
> +#define IS_PC_SLICE_TYPE_BSD(type)     IS_PC_SLICE_TYPE_BSD_WITH_FS(((type) 
> & 0xFF),0)

I don't know much about BSD slices and don't have any to test them,
but it looks that your patch breaks some other things, e.g. the
geometry command (are BSD partition still printed?).
IS_PC_SLICE_TYPE_BSD() is sometimes used, to test if this is a kind of
extended partition that contains other partitions.

I think you should only mask out the type in the next_partition method
as in the attached patch.  Does this fix the problem?


diff -u -r1.38 stage2/disk_io.c
--- stage2/disk_io.c    2000/11/08 17:33:41     1.38
+++ stage2/disk_io.c    2000/12/05 16:33:19
@@ -574,7 +574,7 @@
   /* If previous partition is a BSD partition or a PC slice which
      contains BSD partitions...  */
-  if ((*partition != 0xFFFFFF && IS_PC_SLICE_TYPE_BSD (*type))
+  if ((*partition != 0xFFFFFF && IS_PC_SLICE_TYPE_BSD (*type & 0xff))
       || ! (drive & 0x80))
       if (*type == PC_SLICE_TYPE_NONE)

reply via email to

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