Illumos support.

* Makefile.util.def (10_illumos): New script.
	* configure.ac: Set COND_HOST_ILLUMOS.
	* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors) [__sun__]:
	Support Illumos calls.
	(find_partition_start) [__sun__]: Likewise.
	(convert_system_partition_to_system_disk) [__sun__]: Likewise.
	(device_is_wholedisk) [__sun__]: Handle Illumos naming scheme.
	(grub_util_biosdisk_get_grub_dev) [__sun__]: Handle Illumos.
	* util/getroot.c (find_root_device_from_libzfs) [__sun__]: Return raw
	device.
	* util/grub-probe.c (probe) [__sun__]: Do character check.
	* util/grub.d/10_illumos.in: New file.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-11-08 12:38:30 +01:00
parent cac14fb663
commit 958ee22168
7 changed files with 159 additions and 14 deletions

View file

@ -61,6 +61,11 @@
# include <grub/util/libnvpair.h>
#endif
#ifdef __sun__
# include <sys/types.h>
# include <sys/mkdev.h>
#endif
#include <grub/mm.h>
#include <grub/misc.h>
#include <grub/emu/misc.h>
@ -289,7 +294,19 @@ find_root_device_from_libzfs (const char *dir)
struct stat st;
if (stat (device, &st) == 0)
{
device = xstrdup (device);
#ifdef __sun__
if (grub_memcmp (device, "/dev/dsk/", sizeof ("/dev/dsk/") - 1)
== 0)
device = xasprintf ("/dev/rdsk/%s",
device + sizeof ("/dev/dsk/") - 1);
else if (grub_memcmp (device, "/devices", sizeof ("/devices") - 1)
== 0
&& grub_memcmp (device + strlen (device) - 4,
",raw", 4) != 0)
device = xasprintf ("%s,raw", device);
else
#endif
device = xstrdup (device);
break;
}