Print this page
bug fix
adding functionality and fixing bugs
adding functions to menuadm
menuadm to replace bootadm menu interaction
hypervisor + bug fix
@@ -21,10 +21,14 @@
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
*/
+/*
+ * Copyright 2012 Daniil Lunev. All rights reserved.
+ */
+
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -37,11 +41,11 @@
#define HYPER_KERNEL_DIR "/platform/i86xpv/kernel"
#define METAL_KERNEL_DIR "/platform/i86pc/kernel"
#define BOOTRC_FILE "/boot/solaris/bootenv.rc"
-#define ZFS_BOOTSTR "$ZFS-BOOTFS"
+#define ZFS_BOOTSTR "$ZFS_BOOTFS"
#define BFLAG "-B"
#define DEFAULT_SERIAL "9600,8,n,1"
#define TTYXMODE_TO_COMNUM(ttyxmode) ((int)(*((ttyxmode) + 3) - '`'))
@@ -761,12 +765,14 @@
char *title = NULL;
char *findroot = NULL;
char *bootfs = NULL;
char *kernel = NULL;
+ char *opts = NULL;
char *mod_kernel = NULL;
char *module = NULL;
+ char *tmp = NULL;
char *kern_path = NULL;
char *kern_bargs = NULL;
int curdef, newdef;
@@ -839,14 +845,16 @@
* Process important lines from menu.lst boot entry.
*/
if (lp->flags == BAM_TITLE) {
title = strdupa(lp->arg);
} else if (lp->cmd != NULL) {
- if (strcmp(lp->cmd, "findroot") == 0) {
+ if (strcmp(lp->cmd, "pool_label") == 0) {
findroot = strdupa(lp->arg);
- } else if (strcmp(lp->cmd, "bootfs") == 0) {
+ } else if (strcmp(lp->cmd, "data_set") == 0) {
bootfs = strdupa(lp->arg);
+ } else if (strcmp(lp->cmd, "kernel_options") == 0) {
+ opts = strdupa(lp->arg);
} else if (strcmp(lp->cmd,
menu_cmds[MODULE_DOLLAR_CMD]) == 0) {
module = strdupa(lp->arg);
} else if ((strcmp(lp->cmd,
menu_cmds[KERNEL_DOLLAR_CMD]) == 0) &&
@@ -864,10 +872,11 @@
if (lp == ent->end)
break;
}
+
/*
* If findroot, module or kern_path are NULL, the boot entry is
* malformed.
*/
if (findroot == NULL) {
@@ -946,10 +955,13 @@
*/
len = (strlen(kern_path) * 2) + WHITESPC(1) + 1;
zfslen = (zfs_boot ? (WHITESPC(1) + strlen(ZFS_BOOT)) : 0);
mod_kernel = alloca(len + zfslen);
+ if (opts)
+ (void) snprintf(mod_kernel, len + strlen(opts) + 1, "%s %s %s", kern_path, kern_path, opts);
+ else
(void) snprintf(mod_kernel, len, "%s %s", kern_path, kern_path);
if (kp_allocated)
free(kern_path);
@@ -1060,13 +1072,13 @@
* Process important lines from menu.lst boot entry.
*/
if (lp->flags == BAM_TITLE) {
title = strdupa(lp->arg);
} else if (lp->cmd != NULL) {
- if (strcmp(lp->cmd, "findroot") == 0) {
+ if (strcmp(lp->cmd, "pool_label") == 0) {
findroot = strdupa(lp->arg);
- } else if (strcmp(lp->cmd, "bootfs") == 0) {
+ } else if (strcmp(lp->cmd, "data_set") == 0) {
bootfs = strdupa(lp->arg);
} else if (strcmp(lp->cmd,
menu_cmds[MODULE_DOLLAR_CMD]) == 0) {
if (strstr(lp->arg, "boot_archive") == NULL) {
module = strdupa(lp->arg);