Print this page
9250 remove xpv related code from bootadm

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/boot/bootadm/bootadm.c
          +++ new/usr/src/cmd/boot/bootadm/bootadm.c
↓ open down ↓ 281 lines elided ↑ open up ↑
 282  282  
 283  283  /* Menu related sub commands */
 284  284  static subcmd_defn_t menu_subcmds[] = {
 285  285          "set_option",           OPT_ABSENT,     set_option, 0,  /* PUB */
 286  286          "list_entry",           OPT_OPTIONAL,   list_entry, 1,  /* PUB */
 287  287          "delete_all_entries",   OPT_ABSENT,     delete_all_entries, 0, /* PVT */
 288  288          "update_entry",         OPT_REQ,        update_entry, 0, /* menu */
 289  289          "update_temp",          OPT_OPTIONAL,   update_temp, 0, /* reboot */
 290  290          "upgrade",              OPT_ABSENT,     upgrade_menu, 0, /* menu */
 291  291          "list_setting",         OPT_OPTIONAL,   list_setting, 1, /* menu */
 292      -        "disable_hypervisor",   OPT_ABSENT,     cvt_to_metal, 0, /* menu */
 293      -        "enable_hypervisor",    OPT_ABSENT,     cvt_to_hyper, 0, /* menu */
 294  292          NULL,                   0,              NULL, 0 /* must be last */
 295  293  };
 296  294  
 297  295  /* Archive related sub commands */
 298  296  static subcmd_defn_t arch_subcmds[] = {
 299  297          "update",               OPT_ABSENT,     update_archive, 0, /* PUB */
 300  298          "update_all",           OPT_ABSENT,     update_all, 0,  /* PVT */
 301  299          "list",                 OPT_OPTIONAL,   list_archive, 1, /* PUB */
 302  300          NULL,                   0,              NULL, 0 /* must be last */
 303  301  };
↓ open down ↓ 241 lines elided ↑ open up ↑
 545  543                          break;
 546  544                  case BAM_INSTALL:
 547  545                          ret = bam_install(bam_subcmd, bam_opt);
 548  546                          break;
 549  547                  default:
 550  548                          usage();
 551  549                          bam_exit(1);
 552  550          }
 553  551  
 554  552          if (ret != BAM_SUCCESS)
 555      -                bam_exit((ret == BAM_NOCHANGE) ? 2 : 1);
      553 +                bam_exit(1);
 556  554  
 557  555          bam_unlock();
 558  556          return (0);
 559  557  }
 560  558  
 561  559  /*
 562  560   * Equivalence of public and internal commands:
 563  561   *      update-archive  -- -a update
 564  562   *      list-archive    -- -a list
 565  563   *      set-menu        -- -m set_option
↓ open down ↓ 51 lines elided ↑ open up ↑
 617  615   * A combination of public and private commands are parsed here.
 618  616   * The internal syntax and the corresponding functionality are:
 619  617   *      -a update                       -- update-archive
 620  618   *      -a list                         -- list-archive
 621  619   *      -a update-all                   -- (reboot to sync all mnted OS archive)
 622  620   *      -i install_bootloader           -- install-bootloader
 623  621   *      -m update_entry                 -- update-menu
 624  622   *      -m list_entry                   -- list-menu
 625  623   *      -m update_temp                  -- (reboot -- [boot-args])
 626  624   *      -m delete_all_entries           -- (called from install)
 627      - *      -m enable_hypervisor [args]     -- cvt_to_hyper
 628      - *      -m disable_hypervisor           -- cvt_to_metal
 629  625   *      -m list_setting [entry] [value] -- list_setting
 630  626   *
 631  627   * A set of private flags is there too:
 632  628   *      -F              -- purge the cache directories and rebuild them
 633  629   *      -e              -- use the (faster) archive update approach (used by
 634  630   *                         reboot)
 635  631   */
 636  632  static void
 637  633  parse_args_internal(int argc, char *argv[])
 638  634  {
↓ open down ↓ 116 lines elided ↑ open up ↑
 755  751                          if ((strcmp(bam_platform, "i86pc") != 0) &&
 756  752                              (strcmp(bam_platform, "sun4u") != 0) &&
 757  753                              (strcmp(bam_platform, "sun4v") != 0)) {
 758  754                                  error = 1;
 759  755                                  bam_error(_("invalid platform %s - must be "
 760  756                                      "one of sun4u, sun4v or i86pc\n"),
 761  757                                      bam_platform);
 762  758                          }
 763  759                          break;
 764  760                  case 'X':
 765      -                        bam_is_hv = BAM_HV_PRESENT;
      761 +                        /* obsolete */
 766  762                          break;
 767  763                  case 'Z':
 768  764                          bam_zfs = 1;
 769  765                          break;
 770  766                  case 'e':
 771  767                          bam_extend = 1;
 772  768                          break;
 773  769                  case '?':
 774  770                          error = 1;
 775  771                          bam_error(_("invalid option or missing option "
↓ open down ↓ 85 lines elided ↑ open up ↑
 861  857                   * subcmd is "fastboot".
 862  858                   */
 863  859                  if (bam_argc > 1 || (bam_argc == 1 &&
 864  860                      strcmp(bam_argv[0], "fastboot") != 0)) {
 865  861                          bam_error(_("invalid trailing arguments\n"));
 866  862                          usage();
 867  863                          return (BAM_ERROR);
 868  864                  }
 869  865                  if (bam_argc == 1)
 870  866                          sync_menu = 0;
 871      -        } else if (((strcmp(subcmd, "enable_hypervisor") != 0) &&
 872      -            (strcmp(subcmd, "list_setting") != 0)) && (bam_argc || bam_argv)) {
      867 +        } else if (strcmp(subcmd, "list_setting") != 0 &&
      868 +            (bam_argc || bam_argv)) {
 873  869                  /*
 874      -                 * Of the remaining subcommands, only "enable_hypervisor" and
 875      -                 * "list_setting" take trailing arguments.
      870 +                 * Of the remaining subcommands, only "list_setting" takes
      871 +                 * trailing arguments.
 876  872                   */
 877  873                  bam_error(_("invalid trailing arguments\n"));
 878  874                  usage();
 879  875                  return (BAM_ERROR);
 880  876          }
 881  877  
 882  878          if (bam_root == NULL) {
 883  879                  bam_root = rootbuf;
 884  880                  bam_rootlen = 1;
 885  881          }
↓ open down ↓ 538 lines elided ↑ open up ↑
1424 1420          }
1425 1421  
1426 1422          /*
1427 1423           * We already checked the following case in
1428 1424           * check_subcmd_and_suboptions() above. Complete the
1429 1425           * final step now.
1430 1426           */
1431 1427          if (strcmp(subcmd, "set_option") == 0) {
1432 1428                  assert(largc == 1 && largv[0] && largv[1] == NULL);
1433 1429                  opt = largv[0];
1434      -        } else if ((strcmp(subcmd, "enable_hypervisor") != 0) &&
1435      -            (strcmp(subcmd, "list_setting") != 0)) {
     1430 +        } else if (strcmp(subcmd, "list_setting") != 0) {
1436 1431                  assert(largc == 0 && largv == NULL);
1437 1432          }
1438 1433  
1439 1434          ret = get_boot_cap(bam_root);
1440 1435          if (ret != BAM_SUCCESS) {
1441 1436                  BAM_DPRINTF(("%s: Failed to get boot capability\n", fcn));
1442 1437                  goto out;
1443 1438          }
1444 1439  
1445 1440          /*
↓ open down ↓ 2 lines elided ↑ open up ↑
1448 1443           */
1449 1444          if (strcmp(subcmd, "update_entry") == 0) {
1450 1445                  ret = f(menu, menu_root, osdev);
1451 1446          } else if (strcmp(subcmd, "upgrade") == 0) {
1452 1447                  ret = f(menu, bam_root, menu_root);
1453 1448          } else if (strcmp(subcmd, "list_entry") == 0) {
1454 1449                  ret = f(menu, menu_path, opt);
1455 1450          } else if (strcmp(subcmd, "list_setting") == 0) {
1456 1451                  ret = f(menu, ((largc > 0) ? largv[0] : ""),
1457 1452                      ((largc > 1) ? largv[1] : ""));
1458      -        } else if (strcmp(subcmd, "disable_hypervisor") == 0) {
1459      -                if (is_sparc()) {
1460      -                        bam_error(_("%s operation unsupported on SPARC "
1461      -                            "machines\n"), subcmd);
1462      -                        ret = BAM_ERROR;
1463      -                } else {
1464      -                        ret = f(menu, bam_root, NULL);
1465      -                }
1466      -        } else if (strcmp(subcmd, "enable_hypervisor") == 0) {
1467      -                if (is_sparc()) {
1468      -                        bam_error(_("%s operation unsupported on SPARC "
1469      -                            "machines\n"), subcmd);
1470      -                        ret = BAM_ERROR;
1471      -                } else {
1472      -                        char *extra_args = NULL;
1473      -
1474      -                        /*
1475      -                         * Compress all arguments passed in the largv[] array
1476      -                         * into one string that can then be appended to the
1477      -                         * end of the kernel$ string the routine to enable the
1478      -                         * hypervisor will build.
1479      -                         *
1480      -                         * This allows the caller to supply arbitrary unparsed
1481      -                         * arguments, such as dom0 memory settings or APIC
1482      -                         * options.
1483      -                         *
1484      -                         * This concatenation will be done without ANY syntax
1485      -                         * checking whatsoever, so it's the responsibility of
1486      -                         * the caller to make sure the arguments are valid and
1487      -                         * do not duplicate arguments the conversion routines
1488      -                         * may create.
1489      -                         */
1490      -                        if (largc > 0) {
1491      -                                int extra_len, i;
1492      -
1493      -                                for (extra_len = 0, i = 0; i < largc; i++)
1494      -                                        extra_len += strlen(largv[i]);
1495      -
1496      -                                /*
1497      -                                 * Allocate space for argument strings,
1498      -                                 * intervening spaces and terminating NULL.
1499      -                                 */
1500      -                                extra_args = alloca(extra_len + largc);
1501      -
1502      -                                (void) strcpy(extra_args, largv[0]);
1503      -
1504      -                                for (i = 1; i < largc; i++) {
1505      -                                        (void) strcat(extra_args, " ");
1506      -                                        (void) strcat(extra_args, largv[i]);
1507      -                                }
1508      -                        }
1509      -
1510      -                        ret = f(menu, bam_root, extra_args);
1511      -                }
1512 1453          } else
1513 1454                  ret = f(menu, NULL, opt);
1514 1455  
1515 1456          if (ret == BAM_WRITE) {
1516 1457                  BAM_DPRINTF(("%s: writing menu to clean-menu-root: <%s>\n",
1517 1458                      fcn, clean_menu_root));
1518 1459                  ret = menu_write(clean_menu_root, menu);
1519 1460          }
1520 1461  
1521 1462  out:
↓ open down ↓ 3100 lines elided ↑ open up ↑
4622 4563                  entry->flags |= BAM_ENTRY_DBOOT | BAM_ENTRY_FAILSAFE
4623 4564                      | BAM_ENTRY_64BIT;
4624 4565          } else if (strncmp(arg, MULTI_BOOT, sizeof (MULTI_BOOT) - 1) == 0) {
4625 4566                  BAM_DPRINTF(("%s: setting MULTIBOOT flag: %s\n", fcn, arg));
4626 4567                  entry->flags |= BAM_ENTRY_MULTIBOOT;
4627 4568          } else if (strncmp(arg, MULTI_BOOT_FAILSAFE,
4628 4569              sizeof (MULTI_BOOT_FAILSAFE) - 1) == 0) {
4629 4570                  BAM_DPRINTF(("%s: setting MULTIBOOT|MULTIBOOT_FAILSAFE "
4630 4571                      "flag: %s\n", fcn, arg));
4631 4572                  entry->flags |= BAM_ENTRY_MULTIBOOT | BAM_ENTRY_FAILSAFE;
4632      -        } else if (strstr(arg, XEN_KERNEL_SUBSTR)) {
4633      -                BAM_DPRINTF(("%s: setting XEN HV flag: %s\n", fcn, arg));
4634      -                entry->flags |= BAM_ENTRY_HV;
4635 4573          } else if (!(entry->flags & (BAM_ENTRY_BOOTADM|BAM_ENTRY_LU))) {
4636 4574                  BAM_DPRINTF(("%s: is HAND kernel flag: %s\n", fcn, arg));
4637 4575                  return (BAM_ERROR);
4638 4576          } else if (strncmp(arg, KERNEL_PREFIX, strlen(KERNEL_PREFIX)) == 0 &&
4639 4577              strstr(arg, UNIX_SPACE)) {
4640 4578                  entry->flags |= BAM_ENTRY_DBOOT | BAM_ENTRY_32BIT;
4641 4579          } else if (strncmp(arg, KERNEL_PREFIX, strlen(KERNEL_PREFIX)) == 0 &&
4642 4580              strstr(arg, AMD_UNIX_SPACE)) {
4643 4581                  entry->flags |= BAM_ENTRY_DBOOT | BAM_ENTRY_64BIT;
4644 4582          } else {
↓ open down ↓ 20 lines elided ↑ open up ↑
4665 4603                  BAM_DPRINTF(("%s: not module cmd: %s\n", fcn, cmd));
4666 4604                  return (BAM_ERROR);
4667 4605          }
4668 4606  
4669 4607          if (strcmp(arg, DIRECT_BOOT_ARCHIVE) == 0 ||
4670 4608              strcmp(arg, DIRECT_BOOT_ARCHIVE_32) == 0 ||
4671 4609              strcmp(arg, DIRECT_BOOT_ARCHIVE_64) == 0 ||
4672 4610              strcmp(arg, MULTIBOOT_ARCHIVE) == 0 ||
4673 4611              strcmp(arg, FAILSAFE_ARCHIVE) == 0 ||
4674 4612              strcmp(arg, FAILSAFE_ARCHIVE_32) == 0 ||
4675      -            strcmp(arg, FAILSAFE_ARCHIVE_64) == 0 ||
4676      -            strcmp(arg, XEN_KERNEL_MODULE_LINE) == 0 ||
4677      -            strcmp(arg, XEN_KERNEL_MODULE_LINE_ZFS) == 0) {
     4613 +            strcmp(arg, FAILSAFE_ARCHIVE_64) == 0) {
4678 4614                  BAM_DPRINTF(("%s: bootadm or LU module cmd: %s\n", fcn, arg));
4679 4615                  return (BAM_SUCCESS);
4680 4616          } else if (!(entry->flags & BAM_ENTRY_BOOTADM) &&
4681 4617              !(entry->flags & BAM_ENTRY_LU)) {
4682 4618                  /* don't emit warning for hand entries */
4683 4619                  BAM_DPRINTF(("%s: is HAND module: %s\n", fcn, arg));
4684 4620                  return (BAM_ERROR);
4685 4621          } else {
4686 4622                  BAM_DPRINTF(("%s: is UNKNOWN module: %s\n", fcn, arg));
4687 4623                  bam_error(_("module command on line %d not recognized.\n"),
↓ open down ↓ 3558 lines elided ↑ open up ↑
8246 8182  
8247 8183                          ent->flags |= BAM_ENTRY_UPGFSKERNEL;
8248 8184  
8249 8185                  }
8250 8186                  BAM_DPRINTF(("%s: kernel match: %s, %s\n", fcn,
8251 8187                      kernel, lp->arg));
8252 8188  
8253 8189                  /*
8254 8190                   * Check for matching module entry (failsafe or normal).
8255 8191                   * If it fails to match, we go around the loop again.
8256      -                 * For xpv entries, there are two module lines, so we
8257      -                 * do the check twice.
8258 8192                   */
8259 8193                  lp = lp->next;  /* advance to module line */
8260      -                if (check_cmd(lp->cmd, MODULE_CMD, lp->arg, module) ||
8261      -                    (((lp = lp->next) != NULL) &&
8262      -                    check_cmd(lp->cmd, MODULE_CMD, lp->arg, module))) {
     8194 +                if (check_cmd(lp->cmd, MODULE_CMD, lp->arg, module)) {
8263 8195                          /* match found */
8264 8196                          BAM_DPRINTF(("%s: module match: %s, %s\n", fcn,
8265 8197                              module, lp->arg));
8266 8198                          break;
8267 8199                  }
8268 8200  
8269 8201                  if (strcmp(module, FAILSAFE_ARCHIVE) == 0 &&
8270 8202                      (strcmp(lp->prev->arg, FAILSAFE_ARCHIVE_32) == 0 ||
8271 8203                      strcmp(lp->prev->arg, FAILSAFE_ARCHIVE_64) == 0)) {
8272 8204                          ent->flags |= BAM_ENTRY_UPGFSMODULE;
↓ open down ↓ 308 lines elided ↑ open up ↑
8581 8513          /* add the entry for normal Solaris */
8582 8514          INJECT_ERROR1("UPDATE_ENTRY_MULTIBOOT",
8583 8515              bam_direct = BAM_DIRECT_MULTIBOOT);
8584 8516          if (bam_direct == BAM_DIRECT_DBOOT) {
8585 8517                  entry = update_boot_entry(mp, title, grubsign, grubroot,
8586 8518                      (bam_zfs ? DIRECT_BOOT_KERNEL_ZFS : DIRECT_BOOT_KERNEL),
8587 8519                      NULL, DIRECT_BOOT_ARCHIVE,
8588 8520                      root_optional(osroot, menu_root));
8589 8521                  BAM_DPRINTF(("%s: updated boot entry bam_zfs=%d, "
8590 8522                      "grubsign = %s\n", fcn, bam_zfs, grubsign));
8591      -                if ((entry != BAM_ERROR) && (bam_is_hv == BAM_HV_PRESENT)) {
8592      -                        (void) update_boot_entry(mp, NEW_HV_ENTRY, grubsign,
8593      -                            grubroot, XEN_MENU, bam_zfs ?
8594      -                            XEN_KERNEL_MODULE_LINE_ZFS : XEN_KERNEL_MODULE_LINE,
8595      -                            DIRECT_BOOT_ARCHIVE,
8596      -                            root_optional(osroot, menu_root));
8597      -                        BAM_DPRINTF(("%s: updated HV entry bam_zfs=%d, "
8598      -                            "grubsign = %s\n", fcn, bam_zfs, grubsign));
8599      -                }
8600 8523          } else {
8601 8524                  entry = update_boot_entry(mp, title, grubsign, grubroot,
8602 8525                      MULTI_BOOT, NULL, MULTIBOOT_ARCHIVE,
8603 8526                      root_optional(osroot, menu_root));
8604      -
8605 8527                  BAM_DPRINTF(("%s: updated MULTIBOOT entry grubsign = %s\n",
8606 8528                      fcn, grubsign));
8607 8529          }
8608 8530  
8609 8531          /*
8610 8532           * Add the entry for failsafe archive.  On a bfu'd system, the
8611 8533           * failsafe may be different than the installed kernel.
8612 8534           */
8613 8535          (void) snprintf(failsafe, sizeof (failsafe), "%s%s",
8614 8536              osroot, FAILSAFE_ARCHIVE_32);
↓ open down ↓ 1517 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX