Print this page
bug fix
adding functionality and fixing bugs
adding functions to menuadm
menuadm to replace bootadm menu interaction
hypervisor + bug fix
        
*** 21,30 ****
--- 21,34 ----
  
  /*
   * 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,47 ****
  
  #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 BFLAG                           "-B"
  #define DEFAULT_SERIAL                  "9600,8,n,1"
  
  #define TTYXMODE_TO_COMNUM(ttyxmode)    ((int)(*((ttyxmode) + 3) - '`'))
--- 41,51 ----
  
  #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 BFLAG                           "-B"
  #define DEFAULT_SERIAL                  "9600,8,n,1"
  
  #define TTYXMODE_TO_COMNUM(ttyxmode)    ((int)(*((ttyxmode) + 3) - '`'))
*** 761,772 ****
--- 765,778 ----
  
          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,852 ****
                   * 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) {
                                  findroot = strdupa(lp->arg);
!                         } else if (strcmp(lp->cmd, "bootfs") == 0) {
                                  bootfs = 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) &&
--- 845,860 ----
                   * 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, "pool_label") == 0) {
                                  findroot = strdupa(lp->arg);
!                         } 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,873 ****
--- 872,882 ----
  
                  if (lp == ent->end)
                          break;
          }
  
+         
          /*
           * If findroot, module or kern_path are NULL, the boot entry is
           * malformed.
           */
          if (findroot == NULL) {
*** 946,955 ****
--- 955,967 ----
           */
          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,1072 ****
                   * 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) {
                                  findroot = strdupa(lp->arg);
!                         } else if (strcmp(lp->cmd, "bootfs") == 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);
--- 1072,1084 ----
                   * 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, "pool_label") == 0) {
                                  findroot = strdupa(lp->arg);
!                         } 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);