Print this page
9250 remove xpv related code from bootadm

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/boot/bootadm/bootadm_upgrade.c
          +++ new/usr/src/cmd/boot/bootadm/bootadm_upgrade.c
↓ open down ↓ 34 lines elided ↑ open up ↑
  35   35  #include <fcntl.h>
  36   36  #include <strings.h>
  37   37  
  38   38  #include <sys/mman.h>
  39   39  #include <sys/elf.h>
  40   40  #include <sys/multiboot.h>
  41   41  
  42   42  #include "bootadm.h"
  43   43  
  44   44  direct_or_multi_t bam_direct = BAM_DIRECT_NOT_SET;
  45      -hv_t bam_is_hv = BAM_HV_UNKNOWN;
  46   45  findroot_t bam_is_findroot = BAM_FINDROOT_UNKNOWN;
  47   46  
  48   47  static void
  49   48  get_findroot_cap(const char *osroot)
  50   49  {
  51   50          FILE            *fp;
  52   51          char            path[PATH_MAX];
  53   52          char            buf[BAM_MAXLINE];
  54   53          struct stat     sb;
  55   54          int             dboot;
↓ open down ↓ 141 lines elided ↑ open up ↑
 197  196                  if (mbh->magic == MB_HEADER_MAGIC) {
 198  197                          BAM_DPRINTF(("%s: is DBOOT unix\n", fcn));
 199  198                          bam_direct = BAM_DIRECT_DBOOT;
 200  199                          break;
 201  200                  }
 202  201          }
 203  202          (void) munmap(image, 8192);
 204  203          (void) close(fd);
 205  204  
 206  205          INJECT_ERROR1("GET_CAP_MULTIBOOT", bam_direct = BAM_DIRECT_MULTIBOOT);
 207      -        if (bam_direct == BAM_DIRECT_DBOOT) {
 208      -                if (bam_is_hv == BAM_HV_PRESENT) {
 209      -                        BAM_DPRINTF(("%s: is xVM system\n", fcn));
 210      -                } else {
 211      -                        BAM_DPRINTF(("%s: is *NOT* xVM system\n", fcn));
 212      -                }
 213      -        } else {
      206 +        if (bam_direct != BAM_DIRECT_DBOOT) {
 214  207                  BAM_DPRINTF(("%s: is MULTIBOOT unix\n", fcn));
 215  208          }
 216  209  
 217  210          /* Not a fatal error if this fails */
 218  211          get_findroot_cap(osroot);
 219  212  
 220  213          BAM_DPRINTF(("%s: returning SUCCESS\n", fcn));
 221  214          return (BAM_SUCCESS);
 222  215  }
 223  216  
↓ open down ↓ 581 lines elided ↑ open up ↑
 805  798          if (update_num) {
 806  799                  BAM_DPRINTF(("%s: updated numbering\n", fcn));
 807  800                  update_numbering(mp);
 808  801          }
 809  802  
 810  803          BAM_DPRINTF(("%s: returning SUCCESS\n", fcn));
 811  804          return (BAM_SUCCESS);
 812  805  }
 813  806  
 814  807  static error_t
 815      -bam_add_hv(menu_t *mp, char *grubsign, char *grubroot, int root_opt)
 816      -{
 817      -        entry_t         *entry;
 818      -        const char      *fcn = "bam_add_hv()";
 819      -
 820      -        bam_print(_("adding xVM entries...\n"));
 821      -
 822      -        entry = find_matching_entry(mp->entries, grubsign, grubroot, root_opt);
 823      -        while (entry != NULL) {
 824      -                if (entry->flags & BAM_ENTRY_HV) {
 825      -                        BAM_DPRINTF(("%s: entry %d already converted to "
 826      -                            "xvm HV\n", fcn, entry->entryNum));
 827      -                        return (BAM_SUCCESS);
 828      -                }
 829      -                entry = find_matching_entry(entry->next, grubsign, grubroot,
 830      -                    root_opt);
 831      -        }
 832      -
 833      -        (void) add_boot_entry(mp, NEW_HV_ENTRY, grubsign, XEN_MENU,
 834      -            XEN_KERNEL_MODULE_LINE, DIRECT_BOOT_ARCHIVE, NULL);
 835      -
 836      -        BAM_DPRINTF(("%s: added xVM HV entry via add_boot_entry()\n", fcn));
 837      -
 838      -        update_numbering(mp);
 839      -
 840      -        BAM_DPRINTF(("%s: returning SUCCESS\n", fcn));
 841      -
 842      -        return (BAM_SUCCESS);
 843      -}
 844      -
 845      -static error_t
 846  808  bam_add_dboot(
 847  809          menu_t *mp,
 848  810          char *osroot,
 849  811          char *grubsign,
 850  812          char *grubroot,
 851  813          int root_opt)
 852  814  {
 853  815          int             msg = 0;
 854  816          entry_t         *entry;
 855  817          line_t          *line;
↓ open down ↓ 72 lines elided ↑ open up ↑
 928  890  
 929  891  /*ARGSUSED*/
 930  892  error_t
 931  893  upgrade_menu(menu_t *mp, char *osroot, char *menu_root)
 932  894  {
 933  895          char            *osdev;
 934  896          char            *grubsign;
 935  897          char            *grubroot;
 936  898          int             ret1;
 937  899          int             ret2;
 938      -        int             ret3;
 939  900          const char      *fcn = "upgrade_menu()";
 940  901  
 941  902          assert(osroot);
 942  903          assert(menu_root);
 943  904  
 944  905          BAM_DPRINTF(("%s: entered. args: %s %s\n", fcn, osroot, menu_root));
 945  906  
 946  907          /*
 947      -         * We only support upgrades. Xen may not be present
 948      -         * on smaller metaclusters so we don't check for that.
      908 +         * We only support upgrades.
 949  909           */
 950  910          if (bam_is_findroot != BAM_FINDROOT_PRESENT ||
 951  911              bam_direct != BAM_DIRECT_DBOOT) {
 952  912                  bam_error(_("automated downgrade of GRUB menu to older "
 953  913                      "version not supported.\n"));
 954  914                  return (BAM_ERROR);
 955  915          }
 956  916  
 957  917          /*
 958  918           * First get the GRUB signature
↓ open down ↓ 19 lines elided ↑ open up ↑
 978  938          INJECT_ERROR1("UPGRADE_GRUBROOT", grubroot = NULL);
 979  939  
 980  940          free(osdev);
 981  941  
 982  942          ret1 = bam_add_findroot(mp, grubsign,
 983  943              grubroot, root_optional(osroot, menu_root));
 984  944          INJECT_ERROR1("UPGRADE_ADD_FINDROOT", ret1 = BAM_ERROR);
 985  945          if (ret1 == BAM_ERROR)
 986  946                  goto abort;
 987  947  
 988      -        if (bam_is_hv == BAM_HV_PRESENT) {
 989      -                ret2 = bam_add_hv(mp, grubsign, grubroot,
 990      -                    root_optional(osroot, menu_root));
 991      -                INJECT_ERROR1("UPGRADE_ADD_HV", ret2 = BAM_ERROR);
 992      -                if (ret2 == BAM_ERROR)
 993      -                        goto abort;
 994      -        } else
 995      -                ret2 = BAM_SUCCESS;
 996      -
 997      -        ret3 = bam_add_dboot(mp, osroot, grubsign,
      948 +        ret2 = bam_add_dboot(mp, osroot, grubsign,
 998  949              grubroot, root_optional(osroot, menu_root));
 999      -        INJECT_ERROR1("UPGRADE_ADD_DBOOT", ret3 = BAM_ERROR);
1000      -        if (ret3 == BAM_ERROR)
      950 +        INJECT_ERROR1("UPGRADE_ADD_DBOOT", ret2 = BAM_ERROR);
      951 +        if (ret2 == BAM_ERROR)
1001  952                  goto abort;
1002  953  
1003      -        if (ret1 == BAM_MSG || ret2 == BAM_MSG || ret3 == BAM_MSG) {
      954 +        if (ret1 == BAM_MSG || ret2 == BAM_MSG) {
1004  955                  bam_error(_("one or more GRUB menu entries were not "
1005  956                      "automatically upgraded\nFor details on manually "
1006  957                      "updating entries, see %s\n"), MENU_URL(osroot));
1007  958          } else {
1008  959                  bam_warn_hand_entries(mp, osroot);
1009  960          }
1010  961  
1011  962          free(grubsign);
1012  963  
1013  964          BAM_DPRINTF(("%s: returning ret = %d\n", fcn, BAM_WRITE));
1014  965          return (BAM_WRITE);
1015  966  
1016  967  abort:
1017  968          free(grubsign);
1018  969          bam_error(_("error upgrading GRUB menu entries on %s. Aborting.\n"
1019  970              "For details on manually updating entries, see %s\n"), osroot,
1020  971              MENU_URL(osroot));
1021  972          return (BAM_ERROR);
1022  973  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX