--- old/usr/src/cmd/boot/bootadm/bootadm.c	2012-07-27 03:18:16.522340104 +0400
+++ new/usr/src/cmd/boot/bootadm/bootadm.c	2012-07-27 03:18:14.944809997 +0400
@@ -118,8 +118,8 @@
 
 #define	GRUB_DIR		"/boot/grub"
 #define	GRUB_STAGE2		GRUB_DIR "/stage2"
-#define	GRUB_MENU		"/boot/grub/menu.lst"
-#define	MENU_TMP		"/boot/grub/menu.lst.tmp"
+#define	GRUB_MENU		"/boot/illumos.cfg"
+#define	MENU_TMP		"/boot/illumos.cfg.tmp"
 #define	GRUB_BACKUP_MENU	"/etc/lu/GRUB_backup_menu"
 #define	RAMDISK_SPECIAL		"/ramdisk"
 #define	STUBBOOT		"/stubboot"
@@ -178,20 +178,21 @@
  * menu_cmd_t and menu_cmds must be kept in sync
  */
 char *menu_cmds[] = {
-	"default",	/* DEFAULT_CMD */
+	"default_entry",/* DEFAULT_CMD */
 	"timeout",	/* TIMEOUT_CMD */
-	"title",	/* TITLE_CMD */
-	"root",		/* ROOT_CMD */
-	"kernel",	/* KERNEL_CMD */
-	"kernel$",	/* KERNEL_DOLLAR_CMD */
-	"module",	/* MODULE_CMD */
-	"module$",	/* MODULE_DOLLAR_CMD */
-	" ",		/* SEP_CMD */
+	"entry_name",	/* TITLE_CMD */
+	"pool_uuid",	/* ROOT_CMD */
+	"kernel_path$",	/* KERNEL_CMD */
+	"kernel_path",	/* KERNEL_DOLLAR_CMD */
+	"module$",	/* MODULE_CMD */
+	"module",	/* MODULE_DOLLAR_CMD */
+	"=",		/* SEP_CMD */
 	"#",		/* COMMENT_CMD */
 	"chainloader",	/* CHAINLOADER_CMD */
 	"args",		/* ARGS_CMD */
-	"findroot",	/* FINDROOT_CMD */
-	"bootfs",	/* BOOTFS_CMD */
+	"pool_label",	/* FINDROOT_CMD */
+	"dataset",	/* BOOTFS_CMD */
+	"kernel_options",/* KERNEL_OPTIONS_CMD */
 	NULL
 };
 
@@ -4690,6 +4691,7 @@
 	menu_cmd_t	k_cmd;
 	menu_cmd_t	m_cmd;
 	const char	*fcn = "add_boot_entry()";
+	char * options;
 
 	assert(mp);
 
@@ -4756,10 +4758,20 @@
 		line_parser(mp, linebuf, &lineNum, &entryNum);
 	}
 
+	options = strpbrk(kernel, " \t");
+	if (options)
+		*options++ = 0;
+
 	(void) snprintf(linebuf, sizeof (linebuf), "%s%s%s",
 	    menu_cmds[k_cmd], menu_cmds[SEP_CMD], kernel);
 	line_parser(mp, linebuf, &lineNum, &entryNum);
 
+	if (options) {
+		(void) snprintf(linebuf, sizeof (linebuf), "%s%s%s",
+		    menu_cmds[KERNEL_OPTIONS_CMD], menu_cmds[SEP_CMD], options);
+		line_parser(mp, linebuf, &lineNum, &entryNum);
+	}
+
 	if (mod_kernel != NULL) {
 		(void) snprintf(linebuf, sizeof (linebuf), "%s%s%s",
 		    menu_cmds[m_cmd], menu_cmds[SEP_CMD], mod_kernel);
@@ -7112,18 +7124,19 @@
 	slice = strrchr(osdev, 's');
 
 	grubsign = s_calloc(1, MAXNAMELEN + 10);
-	if (slice) {
+/*	if (slice) {
 		(void) snprintf(grubsign, MAXNAMELEN + 10, "(%s,%d,%c)",
 		    sign, fdiskpart, slice[1] + 'a' - '0');
 	} else
 		(void) snprintf(grubsign, MAXNAMELEN + 10, "(%s,%d)",
-		    sign, fdiskpart);
+		    sign, fdiskpart);*/
+	grubsign = strdup(sign);
 
 	free(sign);
 
 	BAM_DPRINTF((D_GET_GRUBSIGN_SUCCESS, fcn, grubsign));
 
-	return (grubsign);
+	return (strchr(grubsign,'_') + 1);
 }
 
 static char *
@@ -7812,7 +7825,7 @@
 				continue;
 			}
 			/* findroot command found, try match  */
-			if (strcmp(lp->arg, findroot) != 0) {
+			if (strncmp(lp->arg, strchr(findroot, '_') + 1, strlen(lp->arg)) != 0) {
 				BAM_DPRINTF((D_NOMATCH_FINDROOT,
 				    fcn, findroot, lp->arg));
 				continue;
@@ -7870,6 +7883,7 @@
 		 * For xpv entries, there are two module lines, so we
 		 * do the check twice.
 		 */
+		lp = lp->next;	/* advance to options line */
 		lp = lp->next;	/* advance to module line */
 		if (check_cmd(lp->cmd, MODULE_CMD, lp->arg, module) ||
 		    (((lp = lp->next) != NULL) &&
@@ -7911,6 +7925,7 @@
 	line_t		*tlp;
 	char		linebuf[BAM_MAXLINE];
 	const char	*fcn = "update_boot_entry()";
+	char 		*label;
 
 	/* note: don't match on title, it's updated on upgrade */
 	ent = find_boot_entry(mp, NULL, kernel, findroot, root, module,
@@ -7967,10 +7982,13 @@
 
 	lp->cmd = s_strdup(menu_cmds[FINDROOT_CMD]);
 	lp->sep = s_strdup(menu_cmds[SEP_CMD]);
-	lp->arg = s_strdup(findroot);
+	label = s_strdup(strchr(findroot, '_') + 1);
+	*(strchr(label,',')) = 0;
+	lp->arg = s_strdup(label);
 	(void) snprintf(linebuf, sizeof (linebuf), "%s%s%s",
-	    menu_cmds[FINDROOT_CMD], menu_cmds[SEP_CMD], findroot);
+	    menu_cmds[FINDROOT_CMD], menu_cmds[SEP_CMD], label);
 	lp->line = s_strdup(linebuf);
+	free(label);
 	BAM_DPRINTF((D_ADDING_FINDROOT_LINE, fcn, findroot));
 
 	/* kernel line */
@@ -7978,16 +7996,13 @@
 
 	if (ent->flags & BAM_ENTRY_UPGFSKERNEL) {
 		char		*params = NULL;
+		char		*opts = NULL;
 
-		params = strstr(lp->line, "-s");
-		if (params != NULL)
-			(void) snprintf(linebuf, sizeof (linebuf), "%s%s%s%s",
-			    menu_cmds[KERNEL_DOLLAR_CMD], menu_cmds[SEP_CMD],
-			    kernel, params+2);
-		else
-			(void) snprintf(linebuf, sizeof (linebuf), "%s%s%s",
-			    menu_cmds[KERNEL_DOLLAR_CMD], menu_cmds[SEP_CMD],
-			    kernel);
+		opts = strpbrk(kernel, " \t");
+		*opts++ = '\0';
+		(void) snprintf(linebuf, sizeof (linebuf), "%s%s%s",
+		    menu_cmds[KERNEL_DOLLAR_CMD], menu_cmds[SEP_CMD],
+		    kernel);
 
 		if (lp->cmd != NULL)
 			free(lp->cmd);
@@ -7999,12 +8014,28 @@
 		lp->line = s_strdup(linebuf);
 		ent->flags &= ~BAM_ENTRY_UPGFSKERNEL;
 		BAM_DPRINTF((D_ADDING_KERNEL_DOLLAR, fcn, lp->prev->cmd));
+
+		lp = lp->next;
+		params = strstr(lp->arg, "-s");
+		free(lp->arg);
+		free(lp->line);
+		if (params)
+			(void) snprintf(linebuf, sizeof(linebuf), "%s%s%s -s",
+				lp->cmd, menu_cmds[SEP_CMD],opts);
+		else
+			(void) snprintf(linebuf, sizeof(linebuf), "%s%s%s",
+				lp->cmd, menu_cmds[SEP_CMD],opts);
+		lp->line = s_strdup(linebuf);
+		lp->arg = s_strdup(strchr(linebuf, '=') + 1);
 	}
 
 	if (change_kernel) {
+		char		*opts = NULL;
 		/*
 		 * We're upgrading from multiboot to directboot.
 		 */
+		opts = strpbrk(kernel, " \t");
+		*opts++ = '\0';
 		if (lp->cmd != NULL &&
 		    strcmp(lp->cmd, menu_cmds[KERNEL_CMD]) == 0) {
 			(void) snprintf(linebuf, sizeof (linebuf), "%s%s%s",
@@ -8018,6 +8049,12 @@
 			lp->line = s_strdup(linebuf);
 			lp = lp->next;
 			BAM_DPRINTF((D_ADDING_KERNEL_DOLLAR, fcn, kernel));
+			(void) snprintf(linebuf, sizeof(linebuf), "%s%s%s",
+				lp->cmd, menu_cmds[SEP_CMD],opts);
+			free(lp->arg);
+			free(lp->line);
+			lp->line = s_strdup(linebuf);
+			lp->arg = s_strdup(strchr(linebuf, '=') + 1);
 		}
 		if (lp->cmd != NULL &&
 		    strcmp(lp->cmd, menu_cmds[MODULE_CMD]) == 0) {
@@ -8946,8 +8983,8 @@
 			new_str_len = (sizeof (DIRECT_BOOT_KERNEL) - 1) +
 			    strlen(old_args) + 2;
 			new_arg = s_calloc(1, new_str_len);
-			(void) snprintf(new_arg, new_str_len, "%s %s",
-			    DIRECT_BOOT_KERNEL, old_args);
+			(void) snprintf(new_arg, new_str_len, "%s",
+			    DIRECT_BOOT_KERNEL);
 			free(kernelp->arg);
 			kernelp->arg = new_arg;
 
@@ -9108,9 +9145,10 @@
 		BAM_DPRINTF((D_GET_SET_KERNEL_REPLACED_KERNEL_SAME_ARG, fcn,
 		    kernelp->arg));
 	} else {
-		new_str_len = old_kernel_len + strlen(path) + 8;
+		kernelp = kernelp->next;
+		new_str_len = strlen(kernelp->arg) + strlen(path) + 8;
 		new_arg = s_calloc(1, new_str_len);
-		(void) strncpy(new_arg, kernelp->arg, old_kernel_len);
+		(void) strncpy(new_arg, kernelp->arg, strlen(kernelp->arg));
 		(void) strlcat(new_arg, " ", new_str_len);
 		(void) strlcat(new_arg, path, new_str_len);
 		free(kernelp->arg);
--- old/usr/src/cmd/boot/bootadm/bootadm.h	2012-07-27 03:18:21.716965213 +0400
+++ new/usr/src/cmd/boot/bootadm/bootadm.h	2012-07-27 03:18:20.248833941 +0400
@@ -126,7 +126,8 @@
 	CHAINLOADER_CMD,
 	ARGS_CMD,
 	FINDROOT_CMD,
-	BOOTFS_CMD
+	BOOTFS_CMD,
+	KERNEL_OPTIONS_CMD,
 } menu_cmd_t;
 
 extern char *menu_cmds[];
--- old/usr/src/cmd/eeprom/i386/benv.c	2012-07-27 03:18:24.032552407 +0400
+++ new/usr/src/cmd/eeprom/i386/benv.c	2012-07-27 03:18:22.577581328 +0400
@@ -300,18 +300,18 @@
 	}
 }
 
-#define	BOOTADM_STR	"bootadm: "
+#define	GRUBADM_STR	"grubadm: "
 
 /*
- * bootadm starts all error messages with "bootadm: ".
- * Add a note so users don't get confused on how they ran bootadm.
+ * grubadm starts all error messages with "grubadm: ".
+ * Add a note so users don't get confused on how they ran grubadm.
  */
 static void
 output_error_msg(const char *msg)
 {
-	size_t len = sizeof (BOOTADM_STR) - 1;
+	size_t len = sizeof (GRUBADM_STR) - 1;
 
-	if (strncmp(msg, BOOTADM_STR, len) == 0) {
+	if (strncmp(msg, GRUBADM_STR, len) == 0) {
 		eeprom_error("error returned from %s\n", msg);
 	} else if (msg[0] != '\0') {
 		eeprom_error("%s\n", msg);
@@ -319,7 +319,7 @@
 }
 
 static char *
-get_bootadm_value(char *name, const int quiet)
+get_grubadm_value(char *name, const int quiet)
 {
 	char *ptr, *ret_str, *end_ptr, *orig_ptr;
 	char output[BUFSIZ];
@@ -330,11 +330,11 @@
 
 	if (strcmp(name, "boot-file") == 0) {
 		is_kernel = 1;
-		ptr = "/sbin/bootadm set-menu kernel 2>&1";
+		ptr = "/sbin/grubadm --number -1 --get-kernel 2>&1";
 	} else if (is_console || (strcmp(name, "boot-args") == 0)) {
-		ptr = "/sbin/bootadm set-menu args 2>&1";
+		ptr = "/sbin/grubadm --number -1 --get-opts 2>&1";
 	} else {
-		eeprom_error("Unknown value in get_bootadm_value: %s\n", name);
+		eeprom_error("Unknown value in get_grubadm_value: %s\n", name);
 		return (NULL);
 	}
 
@@ -417,10 +417,10 @@
  * a message.  Return 1 if the value is printed, 0 otherwise.
  */
 static int
-print_bootadm_value(char *name, const int quiet)
+print_grubadm_value(char *name, const int quiet)
 {
 	int rv = 0;
-	char *value = get_bootadm_value(name, quiet);
+	char *value = get_grubadm_value(name, quiet);
 
 	if ((value != NULL) && (value[0] != '\0')) {
 		(void) printf("%s=%s\n", name, value);
@@ -445,7 +445,7 @@
 	 * menu.lst value takes precedence.
 	 */
 	if (strcmp(name, "console") == 0) {
-		if (print_bootadm_value(name, 1) == 0) {
+		if (print_grubadm_value(name, 1) == 0) {
 			if ((p = get_var(name, list)) != NULL) {
 				(void) printf("%s=%s\n", name, p->val ?
 				    p->val : "");
@@ -459,7 +459,7 @@
 		(void) printf("%s=%s\n", name, bootcmd ? bootcmd : "");
 	} else if ((strcmp(name, "boot-file") == 0) ||
 	    (strcmp(name, "boot-args") == 0)) {
-		(void) print_bootadm_value(name, 0);
+		(void) print_grubadm_value(name, 0);
 	} else if ((p = get_var(name, list)) == NULL) {
 		(void) printf("%s: data not available.\n", name);
 	} else {
@@ -479,7 +479,7 @@
 	 * The menu.lst value takes precedence, so try printing that one
 	 * first.
 	 */
-	console_printed = print_bootadm_value("console", 1);
+	console_printed = print_grubadm_value("console", 1);
 
 	for (e = list->next; e != list; e = e->next) {
 		p = (benv_ent_t *)e->item;
@@ -494,8 +494,8 @@
 			(void) printf("%s=%s\n", p->name, p->val ? p->val : "");
 		}
 	}
-	(void) print_bootadm_value("boot-file", 1);
-	(void) print_bootadm_value("boot-args", 1);
+	(void) print_grubadm_value("boot-file", 1);
+	(void) print_grubadm_value("boot-args", 1);
 }
 
 /*
@@ -523,7 +523,7 @@
 }
 
 static void
-set_bootadm_var(char *name, char *value)
+set_grubadm_var(char *name, char *value)
 {
 	char buf[BUFSIZ];
 	char output[BUFSIZ] = "";
@@ -532,7 +532,7 @@
 
 	if (verbose) {
 		(void) printf("old:");
-		(void) print_bootadm_value(name, 0);
+		(void) print_grubadm_value(name, 0);
 	}
 
 	/*
@@ -547,38 +547,38 @@
 
 	is_console = (strcmp(name, "console") == 0);
 	if (strcmp(name, "boot-file") == 0) {
-		(void) snprintf(buf, BUFSIZ, "/sbin/bootadm set-menu "
-		    "kernel='%s' 2>&1", value);
+		(void) snprintf(buf, BUFSIZ, "/sbin/grubadm --number -1 "
+		    "--set-kernel '%s' 2>&1", value);
 	} else if (is_console || (strcmp(name, "boot-args") == 0)) {
 		if (is_console) {
-			args = get_bootadm_value("boot-args", 1);
+			args = get_grubadm_value("boot-args", 1);
 			console = value;
 		} else {
 			args = value;
-			console = get_bootadm_value("console", 1);
+			console = get_grubadm_value("console", 1);
 		}
 		if (((args == NULL) || (args[0] == '\0')) &&
 		    ((console == NULL) || (console[0] == '\0'))) {
-			(void) snprintf(buf, BUFSIZ, "/sbin/bootadm set-menu "
-			    "args= 2>&1");
+			(void) snprintf(buf, BUFSIZ, "/sbin/grubadm --number -1 "
+			    "--set-opts '-B $ZFS_BOOTFS' 2>&1");
 		} else if ((args == NULL) || (args[0] == '\0')) {
-			(void) snprintf(buf, BUFSIZ, "/sbin/bootadm "
-			    "set-menu args='-B console=%s' 2>&1",
+			(void) snprintf(buf, BUFSIZ, "/sbin/grubadm --number -1 "
+			    "--set-opts '-B console=%s' 2>&1",
 			    console);
 		} else if ((console == NULL) || (console[0] == '\0')) {
-			(void) snprintf(buf, BUFSIZ, "/sbin/bootadm "
-			    "set-menu args='%s' 2>&1", args);
+			(void) snprintf(buf, BUFSIZ, "/sbin/grubadm --number -1 "
+			    "--set-opts '%s' 2>&1", args);
 		} else if (strncmp(args, "-B ", 3) != 0) {
-			(void) snprintf(buf, BUFSIZ, "/sbin/bootadm "
-			    "set-menu args='-B console=%s %s' 2>&1",
+			(void) snprintf(buf, BUFSIZ, "/sbin/grubadm --number -1 "
+			    "--set-opts '-B console=%s %s' 2>&1",
 			    console, args);
 		} else {
-			(void) snprintf(buf, BUFSIZ, "/sbin/bootadm "
-			    "set-menu args='-B console=%s,%s' 2>&1",
+			(void) snprintf(buf, BUFSIZ, "/sbin/grubadm --number -1 "
+			    "--set-opts '-B console=%s,%s' 2>&1",
 			    console, args + 3);
 		}
 	} else {
-		eeprom_error("Unknown value in set_bootadm_value: %s\n", name);
+		eeprom_error("Unknown value in set_grubadm_value: %s\n", name);
 		return;
 	}
 
@@ -589,7 +589,7 @@
 
 	if (verbose) {
 		(void) printf("new:");
-		(void) print_bootadm_value(name, 0);
+		(void) print_grubadm_value(name, 0);
 	}
 }
 
@@ -607,7 +607,7 @@
 
 	if ((strcmp(name, "boot-file") == 0) ||
 	    (strcmp(name, "boot-args") == 0)) {
-		set_bootadm_var(name, val);
+		set_grubadm_var(name, val);
 		return (0);
 	}
 
@@ -618,7 +618,7 @@
 	if (strcmp(name, "console") == 0) {
 		old_verbose = verbose;
 		verbose = 0;
-		set_bootadm_var(name, val);
+		set_grubadm_var(name, val);
 		verbose = old_verbose;
 	}
 
--- old/usr/src/cmd/halt/halt.c	2012-07-27 03:18:26.714185290 +0400
+++ new/usr/src/cmd/halt/halt.c	2012-07-27 03:18:25.218615712 +0400
@@ -118,7 +118,7 @@
 	"svc:/system/svc/restarter:default/:properties/restarter/contract"
 
 #define	BEADM_PROG	"/usr/sbin/beadm"
-#define	BOOTADM_PROG	"/sbin/bootadm"
+#define	GRUBADM_PROG	"/sbin/grubadm"
 #define	ZONEADM_PROG	"/usr/sbin/zoneadm"
 
 /*
@@ -943,6 +943,22 @@
 	return (st);
 }
 
+static int
+exec_cmd(char * invoke, char * output)
+{
+	FILE * cmd = popen(invoke, "r");
+	if (! cmd) 
+		return 0;
+	fgets(output, 512, cmd);
+	if (! *output) {
+		pclose(cmd);
+		return 0;
+	}
+	output[strlen(output) - 2] = '\0';
+	pclose(cmd);
+	return 1;
+}
+
 /*
  * Mount the specified BE.
  *
@@ -1058,8 +1074,8 @@
 			rc = errno;
 		}
 
-		if (rc == 0 && (rc = grub_get_boot_args(&fbarg, NULL,
-		    entnum)) == 0) {
+		if (rc == 0 && (rc = exec_cmd("/sbin/grubadm --number -1 --get-opts",
+				fbarg.gba_bootargs)) == 0) {
 			if (strlcpy(bootargs_buf, fbarg.gba_bootargs,
 			    buf_size) >= buf_size) {
 				grub_cleanup_boot_args(&fbarg);
@@ -1510,8 +1526,8 @@
 	/* set new default entry in the GRUB entry */
 	if (fbarg_entnum != GRUB_ENTRY_DEFAULT) {
 		char buf[32];
-		(void) snprintf(buf, sizeof (buf), "default=%u", fbarg_entnum);
-		(void) halt_exec(BOOTADM_PROG, "set-menu", buf, NULL);
+		(void) snprintf(buf, sizeof (buf), "--set-default %u", fbarg_entnum);
+		(void) halt_exec(GRUBADM_PROG, " ", buf, NULL);
 	}
 #endif	/* __i386 */
 
--- old/usr/src/cmd/svc/startd/graph.c	2012-07-27 03:18:29.275934613 +0400
+++ new/usr/src/cmd/svc/startd/graph.c	2012-07-27 03:18:27.748184158 +0400
@@ -3574,6 +3574,22 @@
 	(void) fork_with_timeout("/usr/bin/pkill -KILL -v -u 0,1,15", 1, 5);
 }
 
+static int
+exec_cmd(char * invoke, char * output)
+{
+	FILE * cmd = popen(invoke, "r");
+	if (! cmd) 
+		return 0;
+	fgets(output, 512, cmd);
+	if (! *output) {
+		pclose(cmd);
+		return 0;
+	}
+	output[strlen(output) - 2] = '\0';
+	pclose(cmd);
+	return 1;
+}
+
 static void
 do_uadmin(void)
 {
@@ -3640,8 +3656,8 @@
 #if defined(__i386)
 		int rc;
 
-		if ((rc = grub_get_boot_args(&fbarg, NULL,
-		    GRUB_ENTRY_DEFAULT)) == 0) {
+		if ((rc = exec_cmd("/sbin/grubadm --number -1 --get-opts", 
+			fbarg.gba_bootargs)) == 0) {
 			mdep = (uintptr_t)&fbarg.gba_bootargs;
 		} else {
 			/*
--- old/usr/src/lib/libbe/common/be_utils.c	2012-07-27 03:18:32.474688651 +0400
+++ new/usr/src/lib/libbe/common/be_utils.c	2012-07-27 03:18:30.921682539 +0400
@@ -461,11 +461,11 @@
 		char *tok = NULL;
 
 		(void) strlcpy(temp_line, line, BUFSIZ);
-		tok = strtok(line, BE_WHITE_SPACE);
+		tok = strtok(line, "=\n");
 
 		if (tok == NULL || tok[0] == '#') {
 			continue;
-		} else if (strcmp(tok, "title") == 0) {
+		} else if (strcmp(tok, "entry_name") == 0) {
 			collect_lines = B_FALSE;
 			if ((tok = strtok(NULL, "\n")) == NULL)
 				(void) strlcpy(title, "", sizeof (title));
@@ -480,7 +480,7 @@
 				}
 				num_tmp_lines = 0;
 			}
-		} else if (strcmp(tok, "bootfs") == 0) {
+		} else if (strcmp(tok, "data_set") == 0) {
 			char *bootfs = strtok(NULL, BE_WHITE_SPACE);
 			found_title = B_FALSE;
 			if (bootfs == NULL)
@@ -500,7 +500,7 @@
 				/*
 				 * Store the new title line
 				 */
-				(void) snprintf(str, BUFSIZ, "title %s\n",
+				(void) snprintf(str, BUFSIZ, "entry_name=%s\n",
 				    description ? description : be_name);
 				entries[num_lines] = strdup(str);
 				num_lines++;
@@ -514,11 +514,31 @@
 					tmp_entries[i] = NULL;
 					num_lines++;
 				}
-				num_tmp_lines = 0;
+
+				zprop_get_cbdata_t cb = { 0 };
+				zprop_source_t src;
+				char * bc = strchr(be_root_ds, '/');
+				char sguid[] = "guid";
+
+				*bc = '\0';
+				cb.cb_first = B_TRUE;
+				cb.cb_sources = ZPROP_SRC_ALL;
+				cb.cb_type = ZFS_TYPE_POOL;
+				zprop_get_list(g_zfs, sguid, &cb.cb_proplist, ZFS_TYPE_POOL);
+				zpool_handle_t * z_hndl = zpool_open(g_zfs, be_root_ds);
+				*bc = '/';
+				if (z_hndl) {
+					uint64_t guid = zpool_get_prop_int(z_hndl, cb.cb_proplist->pl_prop, &src);
+					(void) snprintf(str, BUFSIZ, "pool_uuid=%llx\n", guid);
+					entries[num_lines] = strdup(str);
+					num_lines++;
+					zpool_close(z_hndl);
+				}
+num_tmp_lines = 0;
 				/*
 				 * Store the new bootfs line.
 				 */
-				(void) snprintf(str, BUFSIZ, "bootfs %s\n",
+				(void) snprintf(str, BUFSIZ, "data_set=%s\n",
 				    be_root_ds);
 				entries[num_lines] = strdup(str);
 				num_lines++;
@@ -536,6 +556,19 @@
 				entries[num_lines] =
 				    strdup("splashimage "
 				    "/boot/splashimage.xpm\n");
+			} else if ((strcmp(tok, "kernel_path") == 0) || 
+				(strcmp(tok, "module") == 0)) 
+			{
+				char * path;
+				char * st_path;
+				
+				st_path = strtok(NULL, "\n");
+				path = (char *) malloc(512);
+				strcpy(path, tok);
+				strcat(path, "=");
+				strcat(path, st_path);
+				strcat(path, "\n");
+				entries[num_lines] = path;
 			} else {
 				entries[num_lines] = strdup(temp_line);
 			}
@@ -598,18 +631,36 @@
 			(void) fprintf(menu_fp, "%s\n", BE_GRUB_COMMENT);
 		ret = BE_SUCCESS;
 	} else {
-		(void) fprintf(menu_fp, "title %s\n",
+		zprop_get_cbdata_t cb = { 0 };
+		zprop_source_t src;
+		char * bc = strchr(be_root_ds, '/');
+		char sguid[] = "guid";
+
+		(void) fprintf(menu_fp, "entry_name=%s\n",
 		    description ? description : be_name);
-		(void) fprintf(menu_fp, "bootfs %s\n", be_root_ds);
+		*bc = '\0';
+		cb.cb_first = B_TRUE;
+		cb.cb_sources = ZPROP_SRC_ALL;
+		cb.cb_type = ZFS_TYPE_POOL;
+		zprop_get_list(g_zfs, sguid, &cb.cb_proplist, ZFS_TYPE_POOL);
+		zpool_handle_t * z_hndl = zpool_open(g_zfs, be_root_ds);
+		*bc = '/';
+		if (z_hndl) {
+			uint64_t guid = zpool_get_prop_int(z_hndl, cb.cb_proplist->pl_prop, &src);
+			(void) fprintf(menu_fp, "pool_uuid=%llx\n", guid);
+			zpool_close(z_hndl);
+		}
+		(void) fprintf(menu_fp, "data_set=%s\n", be_root_ds);
 
 		/*
 		 * Check to see if this system supports grub
 		 */
 		if (be_has_grub()) {
-			(void) fprintf(menu_fp, "kernel$ "
-			    "/platform/i86pc/kernel/$ISADIR/unix -B "
-			    "$ZFS-BOOTFS\n");
-			(void) fprintf(menu_fp, "module$ "
+			(void) fprintf(menu_fp, "kernel_path="
+			    "/platform/i86pc/kernel/$ISADIR/unix\n");
+			(void) fprintf(menu_fp, "kernel_options="
+			    "-B $ZFS_BOOTFS,console=graphic\n");
+			(void) fprintf(menu_fp, "module="
 			    "/platform/i86pc/$ISADIR/boot_archive\n");
 			(void) fprintf(menu_fp, "%s\n", BE_GRUB_COMMENT);
 		}
@@ -789,7 +840,7 @@
 		(void) strlcpy(tline, menu_buf, sizeof (tline));
 
 		/* Tokenize line */
-		tok = strtok(tline, BE_WHITE_SPACE);
+		tok = strtok(tline, "=\n");
 
 		if (tok == NULL || tok[0] == '#') {
 			/* Found empty line or comment line */
@@ -811,7 +862,7 @@
 				/* Write this line out */
 				(void) fputs(menu_buf, tmp_menu_fp);
 			}
-		} else if (strcmp(tok, "default") == 0) {
+		} else if (strcmp(tok, "default_entry") == 0) {
 			/*
 			 * Record what 'default' is set to because we might
 			 * need to adjust this upon deleting an entry.
@@ -823,7 +874,7 @@
 			}
 
 			(void) fputs(menu_buf, tmp_menu_fp);
-		} else if (strcmp(tok, "title") == 0) {
+		} else if (strcmp(tok, "entry_name") == 0) {
 			/*
 			 * If we've reached a 'title' line and do_buffer is
 			 * is true, that means we've just buffered an entire
@@ -859,7 +910,7 @@
 				goto cleanup;
 			}
 
-		} else if (strcmp(tok, "bootfs") == 0) {
+		} else if (strcmp(tok, "data_set") == 0) {
 			char *bootfs = NULL;
 
 			/*
@@ -1020,15 +1071,15 @@
 				(void) strlcpy(tline, menu_buf, sizeof (tline));
 
 				/* Tokenize line */
-				tok = strtok(tline, BE_WHITE_SPACE);
+				tok = strtok(tline, "=\n");
 
 				if (tok == NULL) {
 					/* Found empty line, write it out */
 					(void) fputs(menu_buf, tmp_menu_fp);
-				} else if (strcmp(tok, "default") == 0) {
+				} else if (strcmp(tok, "default_entry") == 0) {
 					/* Found the default line, adjust it */
 					(void) snprintf(tline, sizeof (tline),
-					    "default %d\n", default_entry);
+					    "default_entry=%d\n", default_entry);
 
 					(void) fputs(tline, tmp_menu_fp);
 				} else {
@@ -1187,11 +1238,11 @@
 	pool_mntpnt = NULL;
 
 	while (fgets(line, BUFSIZ, menu_fp)) {
-		char *tok = strtok(line, BE_WHITE_SPACE);
+		char *tok = strtok(line, "=\n");
 
 		if (tok != NULL && tok[0] != '#') {
 			if (!found_default) {
-				if (strcmp(tok, "default") == 0) {
+				if (strcmp(tok, "default_entry") == 0) {
 					tok = strtok(NULL, BE_WHITE_SPACE);
 					if (tok != NULL) {
 						default_entry = atoi(tok);
@@ -1201,10 +1252,10 @@
 				}
 				continue;
 			}
-			if (strcmp(tok, "title") == 0) {
+			if (strcmp(tok, "entry_name") == 0) {
 				entries++;
 			} else if (default_entry == entries - 1) {
-				if (strcmp(tok, "bootfs") == 0) {
+				if (strcmp(tok, "data_set") == 0) {
 					tok = strtok(NULL, BE_WHITE_SPACE);
 					(void) fclose(menu_fp);
 
@@ -1387,14 +1438,14 @@
 	}
 
 	while (fgets(line, BUFSIZ, grub_fp)) {
-		char *tok = strtok(line, BE_WHITE_SPACE);
+		char *tok = strtok(line, "=\n");
 
 		if (tok == NULL || tok[0] == '#') {
 			continue;
-		} else if (strcmp(tok, "title") == 0) {
+		} else if (strcmp(tok, "entry_name") == 0) {
 			entries++;
 			continue;
-		} else if (strcmp(tok, "bootfs") == 0) {
+		} else if (strcmp(tok, "data_set") == 0) {
 			char *bootfs = strtok(NULL, BE_WHITE_SPACE);
 			if (bootfs == NULL)
 				continue;
@@ -1416,16 +1467,16 @@
 
 	rewind(grub_fp);
 
+	(void) snprintf(temp_line, BUFSIZ, "default_entry=%d\n",
+	    entries - 1 >= 0 ? entries - 1 : 0);
+	(void) fputs(temp_line, temp_fp);
 	while (fgets(line, BUFSIZ, grub_fp)) {
 		char *tok = NULL;
 
 		(void) strncpy(temp_line, line, BUFSIZ);
 
-		if ((tok = strtok(temp_line, BE_WHITE_SPACE)) != NULL &&
-		    strcmp(tok, "default") == 0) {
-			(void) snprintf(temp_line, BUFSIZ, "default %d\n",
-			    entries - 1 >= 0 ? entries - 1 : 0);
-			(void) fputs(temp_line, temp_fp);
+		if ((tok = strtok(temp_line, "=\n")) != NULL &&
+		    strcmp(tok, "default_entry") == 0) {
 		} else {
 			(void) fputs(line, temp_fp);
 		}
@@ -1520,6 +1571,7 @@
 	int temp_menu_len = 0;
 	int tmp_fd;
 	int ret = BE_SUCCESS;
+	int flag = 0;
 	int err = 0;
 	boolean_t pool_mounted = B_FALSE;
 
@@ -1636,7 +1688,7 @@
 		(void) strlcpy(tline, line, sizeof (tline));
 
 		/* Tokenize line */
-		c = strtok(tline, BE_WHITE_SPACE);
+		c = strtok(tline, "=\n");
 
 		if (c == NULL) {
 			/* Found empty line, write it out. */
@@ -1644,7 +1696,7 @@
 		} else if (c[0] == '#') {
 			/* Found a comment line, write it out. */
 			(void) fputs(line, new_fp);
-		} else if (strcmp(c, "title") == 0) {
+		} else if (strcmp(c, "entry_name") == 0) {
 			char *name = NULL;
 			char *desc = NULL;
 
@@ -1652,6 +1704,7 @@
 			 * Found a 'title' line, parse out BE name or
 			 * the description.
 			 */
+			flag = 0;
 			name = strtok(NULL, BE_WHITE_SPACE);
 
 			if (name == NULL) {
@@ -1675,15 +1728,16 @@
 					 * along with the remainder of
 					 * description if there is one.
 					 */
+					++flag;
 					if (desc) {
 						(void) snprintf(new_line,
 						    sizeof (new_line),
-						    "title %s %s\n",
+						    "entry_name=%s %s\n",
 						    be_new_name, desc);
 					} else {
 						(void) snprintf(new_line,
 						    sizeof (new_line),
-						    "title %s\n", be_new_name);
+						    "entry_name=%s\n", be_new_name);
 					}
 
 					(void) fputs(new_line, new_fp);
@@ -1691,7 +1745,7 @@
 					(void) fputs(line, new_fp);
 				}
 			}
-		} else if (strcmp(c, "bootfs") == 0) {
+		} else if (strcmp(c, "data_set") == 0) {
 			/*
 			 * Found a 'bootfs' line, parse out the BE root
 			 * dataset value.
@@ -1710,8 +1764,9 @@
 				 * write out the new root dataset value
 				 */
 				if (strcmp(root_ds, be_root_ds) == 0) {
+					++flag;
 					(void) snprintf(new_line,
-					    sizeof (new_line), "bootfs %s\n",
+					    sizeof (new_line), "data_set=%s\n",
 					    be_new_root_ds);
 
 					(void) fputs(new_line, new_fp);
@@ -1853,10 +1908,10 @@
 	rpool_mntpnt = NULL;
 
 	while (fgets(line, BUFSIZ, menu_fp)) {
-		char *tok = strtok_r(line, BE_WHITE_SPACE, &last);
+		char *tok = strtok_r(line, "=\n", &last);
 
 		if (tok != NULL && tok[0] != '#') {
-			if (strcmp(tok, "bootfs") == 0) {
+			if (strcmp(tok, "data_set") == 0) {
 				tok = strtok_r(last, BE_WHITE_SPACE, &last);
 				if (tok != NULL && strcmp(tok,
 				    be_dataset) == 0) {
@@ -1873,7 +1928,7 @@
 					ret = B_TRUE;
 					goto cleanup;
 				}
-			} else if (strcmp(tok, "title") == 0)
+			} else if (strcmp(tok, "entry_name") == 0)
 				ent_num++;
 		}
 	}
@@ -3639,14 +3694,14 @@
 			if (strncmp(console, "text", strlen("text")) == 0 ||
 			    strncmp(console, "graphics",
 			    strlen("graphics")) == 0) {
-
+/*
 				(void) fprintf(temp_fp, "%s\n", BE_GRUB_SPLASH);
 				(void) fprintf(temp_fp, "%s\n",
 				    BE_GRUB_FOREGROUND);
 				(void) fprintf(temp_fp, "%s\n",
 				    BE_GRUB_BACKGROUND);
 				(void) fprintf(temp_fp, "%s\n",
-				    BE_GRUB_DEFAULT);
+				    BE_GRUB_DEFAULT);*/
 			} else {
 				be_print_err(gettext("be_create_menu: "
 				    "console on serial line, "
@@ -3654,7 +3709,7 @@
 			}
 		}
 
-		(void) fprintf(temp_fp,	"timeout 30\n");
+		(void) fprintf(temp_fp,	"timeout=30\n");
 		(void) fclose(temp_fp);
 
 	} else {
--- old/usr/src/lib/libbe/common/libbe_priv.h	2012-07-27 03:18:35.442599860 +0400
+++ new/usr/src/lib/libbe/common/libbe_priv.h	2012-07-27 03:18:33.755804323 +0400
@@ -49,7 +49,7 @@
 #define	BE_UUID_PROPERTY	"org.opensolaris.libbe:uuid"
 #define	BE_PLCY_STATIC		"static"
 #define	BE_PLCY_VOLATILE	"volatile"
-#define	BE_GRUB_MENU		"/boot/grub/menu.lst"
+#define	BE_GRUB_MENU		"/boot/illumos.cfg"
 #define	BE_SPARC_MENU		"/boot/menu.lst"
 #define	BE_GRUB_COMMENT		"#============ End of LIBBE entry ============="
 #define	BE_GRUB_SPLASH		"splashimage /boot/solaris.xpm"
--- old/usr/src/lib/libc/amd64/sys/uadmin.c	2012-07-27 03:18:38.291968122 +0400
+++ new/usr/src/lib/libc/amd64/sys/uadmin.c	2012-07-27 03:18:36.646397569 +0400
@@ -251,12 +251,12 @@
 			if (isdigit(bargs[0])) {
 				int entry = strtol(bargs, NULL, 10);
 				(void) snprintf(cmdbuf, sizeof (cmdbuf),
-				    "/sbin/bootadm set-menu %sdefault=%d",
+				    "/sbin/grubadm %s --set-default %d",
 				    altroot, entry);
 			} else {
 				(void) snprintf(cmdbuf, sizeof (cmdbuf),
-				    "/sbin/bootadm -m update_temp %s"
-				    "-o %s%s%s", altroot, quote,
+				    "/sbin/grubadm --new --default %s"
+				    "--set-opts %s%s%s", altroot, quote,
 				    &bargs[off], quote);
 			}
 			(void) system(cmdbuf);
--- old/usr/src/lib/libc/i386/sys/uadmin.c	2012-07-27 03:18:40.762663029 +0400
+++ new/usr/src/lib/libc/i386/sys/uadmin.c	2012-07-27 03:18:39.182050500 +0400
@@ -251,12 +251,12 @@
 			if (isdigit(bargs[0])) {
 				int entry = strtol(bargs, NULL, 10);
 				(void) snprintf(cmdbuf, sizeof (cmdbuf),
-				    "/sbin/bootadm set-menu %sdefault=%d",
+				    "/sbin/grubadm %s --set-default %d",
 				    altroot, entry);
 			} else {
 				(void) snprintf(cmdbuf, sizeof (cmdbuf),
-				    "/sbin/bootadm -m update_temp %s"
-				    "-o %s%s%s", altroot, quote,
+				    "/sbin/grubadm --new --default %s"
+				    "--set-opts %s%s%s", altroot, quote,
 				    &bargs[off], quote);
 			}
 			(void) system(cmdbuf);
