--- grub-2.00.orig/configure Tue Jun 26 13:59:16 2012 +++ grub-2.00/configure Thu Aug 8 14:23:48 2013 @@ -20050,7 +20050,7 @@ LIBS="" # debug flags. -WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Waddress -Wattributes -Wcast-align -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wempty-body -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign" +WARN_FLAGS="-Wall -W -Wshadow -Wold-style-definition -Wpointer-arith -Wundef -Wextra -Waddress -Wattributes -Wcast-align -Wchar-subscripts -Wcomment -Wdeprecated-declarations -Wdisabled-optimization -Wdiv-by-zero -Wendif-labels -Wfloat-equal -Wformat-extra-args -Wformat-security -Wformat-y2k -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Winit-self -Wint-to-pointer-cast -Winvalid-pch -Wmain -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-noreturn -Wmultichar -Wnonnull -Woverflow -Wparentheses -Wpointer-arith -Wpointer-to-int-cast -Wreturn-type -Wsequence-point -Wshadow -Wsign-compare -Wstrict-aliasing -Wswitch -Wtrigraphs -Wundef -Wunknown-pragmas -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings -Wnested-externs -Wstrict-prototypes -Wpointer-sign" HOST_CFLAGS="$HOST_CFLAGS $WARN_FLAGS" TARGET_CFLAGS="$TARGET_CFLAGS $WARN_FLAGS -g -Wredundant-decls -Wmissing-prototypes -Wmissing-declarations" TARGET_CCASFLAGS="$TARGET_CCASFLAGS -g" @@ -20485,6 +20485,7 @@ } _ACEOF if { ac_try='${CC-cc} ${CFLAGS} -S conftest.c' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 (eval $ac_try) 2>&5 diff -ru grub-2.00.orig/grub-core/kern/emu/hostdisk.c grub-2.00/grub-core/kern/emu/hostdisk.c --- grub-2.00.orig/grub-core/kern/emu/hostdisk.c Mon Jun 25 10:32:04 2012 +++ grub-2.00/grub-core/kern/emu/hostdisk.c Thu Aug 8 14:53:37 2013 @@ -96,7 +96,7 @@ # include #endif -#if defined(__NetBSD__) +#if defined(__NetBSD__) || defined(__OpenBSD__) # define HAVE_DIOCGDINFO # include # include /* struct disklabel */ @@ -105,11 +105,16 @@ # undef HAVE_DIOCGDINFO #endif /* defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) */ -#if defined(__NetBSD__) +#if defined(__NetBSD__) || defined(__OpenBSD__) # ifdef HAVE_GETRAWPARTITION # include /* getrawpartition */ # endif /* HAVE_GETRAWPARTITION */ +# if defined(__NetBSD__) # include +# endif +# if defined(__OpenBSD__) +# include +# endif # ifndef RAW_FLOPPY_MAJOR # define RAW_FLOPPY_MAJOR 9 # endif /* ! RAW_FLOPPY_MAJOR */ @@ -243,7 +248,7 @@ grub_util_get_fd_size (int fd, const char *name, unsigned *log_secsize) { #if !defined (__GNU__) -# if defined(__NetBSD__) +# if defined(__NetBSD__) || defined(__OpenBSD__) struct disklabel label; # elif defined (__sun__) struct dk_minfo minfo; @@ -260,9 +265,9 @@ #if defined(__linux__) || defined(__CYGWIN__) || defined(__FreeBSD__) || \ defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__) \ - || defined (__sun__) + || defined (__sun__) || defined(__OpenBSD__) -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__) || defined (__sun__) +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__NetBSD__) || defined (__sun__) || defined(__OpenBSD__) if (! S_ISCHR (st.st_mode)) # else if (! S_ISBLK (st.st_mode)) @@ -273,8 +278,10 @@ if (ioctl (fd, DIOCGMEDIASIZE, &nr)) # elif defined(__APPLE__) if (ioctl (fd, DKIOCGETBLOCKCOUNT, &nr)) -# elif defined(__NetBSD__) +# elif defined(__NetBSD__) || defined(__OpenBSD__) +# if defined(__NetBSD__) configure_device_driver (fd); +# endif if (ioctl (fd, DIOCGDINFO, &label) == -1) # elif defined (__sun__) if (!ioctl (fd, DKIOCGMEDIAINFO, &minfo)) @@ -291,7 +298,7 @@ goto fail; # elif defined(__sun__) sector_size = minfo.dki_lbsize; -# elif defined(__NetBSD__) +# elif defined(__NetBSD__) || defined(__OpenBSD__) sector_size = label.d_secsize; # else if (ioctl (fd, BLKSSZGET, §or_size)) @@ -308,7 +315,7 @@ # if defined (__APPLE__) return nr << log_sector_size; -# elif defined(__NetBSD__) +# elif defined(__NetBSD__) || defined(__OpenBSD__) return (grub_uint64_t) label.d_secperunit << log_sector_size; # elif defined (__sun__) return minfo.dki_capacity << log_sector_size; --- grub-2.00.orig/util/getroot.c Fri Jun 22 17:42:07 2012 +++ grub-2.00/util/getroot.c Thu Aug 8 14:40:22 2013 @@ -54,7 +54,8 @@ #include #include -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) +# include # include #endif @@ -121,7 +122,7 @@ # include #endif -#if defined(__NetBSD__) +#if defined(__NetBSD__) || defined(__OpenBSD__) # define HAVE_DIOCGDINFO # include # include /* struct disklabel */ @@ -130,11 +131,13 @@ # undef HAVE_DIOCGDINFO #endif /* defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) */ -#if defined(__NetBSD__) +#if defined(__NetBSD__) || defined(__OpenBSD__) # ifdef HAVE_GETRAWPARTITION # include /* getrawpartition */ # endif /* HAVE_GETRAWPARTITION */ +#if defined(__NetBSD__) # include +#endif # ifndef FLOPPY_MAJOR # define FLOPPY_MAJOR 2 # endif /* ! FLOPPY_MAJOR */ @@ -2004,7 +2007,7 @@ } return path; -#elif defined(__NetBSD__) +#elif defined(__NetBSD__) || defined(__OpenBSD__) int rawpart = -1; # ifdef HAVE_GETRAWPARTITION rawpart = getrawpartition(); @@ -2012,6 +2015,7 @@ if (rawpart < 0) return xstrdup (os_dev); +#if defined(__NetBSD__) /* NetBSD disk wedges are of the form "/dev/rdk.*". */ if (strncmp ("/dev/rdk", os_dev, sizeof("/dev/rdk") - 1) == 0) { @@ -2038,6 +2042,7 @@ close (fd); return xasprintf ("/dev/r%s%c", dkw.dkw_parent, 'a' + rawpart); } +#endif /* NetBSD (disk label) partitions are of the form "/dev/r[a-z]+[0-9][a-z]". */ if (strncmp ("/dev/r", os_dev, sizeof("/dev/r") - 1) == 0 && @@ -2210,7 +2215,7 @@ #endif return make_device_name (drive, -1, -1); -#if defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined (__sun__) +#if defined(__linux__) || defined(__CYGWIN__) || defined(HAVE_DIOCGDINFO) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined (__sun__) || defined(__OpenBSD__) /* Linux counts partitions uniformly, whether a BSD partition or a DOS partition, so mapping them to GRUB devices is not trivial.