Skip to contentSkip to conversation

NetBSD disk wedge support

PATCH In review Grégoire Sutre 2 participants 3 messages Feb 3, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NetBSD disk wedge support

The attached patch makes it possible to install GRUB from NetBSD on a GPT partition. Those are available as so-called disk wedges on NetBSD (see [1]). Tested under NetBSD -current.

Grégoire

[1] http://netbsd.gw.com/cgi-bin/man-cgi?dk++NetBSD-current

=== modified file 'grub-core/kern/emu/hostdisk.c'

kern/emu/hostdisk.c +10 -0
@@ -98,10 +98,11 @@ struct hd_geometry
 
 #if defined(__NetBSD__)
 # define HAVE_DIOCGDINFO
 # include <sys/ioctl.h>
 # include <sys/disklabel.h>    /* struct disklabel */
+# include <sys/disk.h>    /* struct dkwedge_info */
 #else /* !defined(__NetBSD__) && !defined(__FreeBSD__) && !defined(__FreeBSD_kernel__) */
 # undef HAVE_DIOCGDINFO
 #endif /* defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) */
 
 #if defined(__NetBSD__)
@@ -481,10 +482,13 @@ grub_hostdisk_find_partition_start (cons
 #ifdef __sun__
   struct extpart_info pinfo;
 # elif !defined(HAVE_DIOCGDINFO)
   struct hd_geometry hdg;
 # else /* defined(HAVE_DIOCGDINFO) */
+#  if defined(__NetBSD__)
+  struct dkwedge_info dkw;
+#  endif /* defined(__NetBSD__) */
   struct disklabel label;
   int p_index;
 # endif /* !defined(HAVE_DIOCGDINFO) */
 
 # ifdef HAVE_DEVICE_MAPPER
@@ -572,10 +576,16 @@ devmapper_fail:
 # elif !defined(HAVE_DIOCGDINFO)
   if (ioctl (fd, HDIO_GETGEO, &hdg))
 # else /* defined(HAVE_DIOCGDINFO) */
 #  if defined(__NetBSD__)
   configure_device_driver (fd);
+  /* First handle the case of disk wedges.  */
+  if (ioctl (fd, DIOCGWEDGEINFO, &dkw) == 0)
+    {
+      close (fd);
+      return (grub_disk_addr_t) dkw.dkw_offset;
+    }
 #  endif /* defined(__NetBSD__) */
   if (ioctl (fd, DIOCGDINFO, &label) == -1)
 # endif /* !defined(HAVE_DIOCGDINFO) */
     {
       grub_error (GRUB_ERR_BAD_DEVICE,

=== modified file 'util/getroot.c'

getroot.c +43 -13

88 lines not on this page · raw message

2012-02-03 Grégoire Sutre <[email protected]>

NetBSD disk wedge support.

* grub-core/kern/emu/hostdisk.c (grub_hostdisk_find_partition_start) [__NetBSD__]: Handle NetBSD disk wedges.
* util/getroot.c (convert_system_partition_to_system_disk) [__NetBSD__]: Likewise.

#1 lore raw

Go ahead.

Quoted 13 lines · Grégoire Sutre

The attached patch makes it possible to install GRUB from NetBSD on a GPT partition. Those are available as so-called disk wedges on NetBSD (see [1]). Tested under NetBSD -current.

Grégoire

[1] http://netbsd.gw.com/cgi-bin/man-cgi?dk++NetBSD-current

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 2 lines
Regards
Vladimir 'φ-coder/phcoder' Serbinenko
#2 lore raw
Quoted 1 line · Vladimir 'φ-coder/phcoder' Serbinenko

Go ahead.

Done, thanks.

Grégoire

Quoted 16 lines · Grégoire Sutre
Quoted 13 lines

The attached patch makes it possible to install GRUB from NetBSD on a GPT partition. Those are available as so-called disk wedges on NetBSD (see [1]). Tested under NetBSD -current.

Grégoire

[1] http://netbsd.gw.com/cgi-bin/man-cgi?dk++NetBSD-current

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel