引导和关闭 Oracle® Solaris 11.2 系统

退出打印视图

更新时间: 2014 年 7 月
 
 

x86: 如何向 GRUB 菜单添加引导项

使用 bootadm 命令的 add-entry 子命令向 GRUB 菜单添加带有指定项标题的新项。如果指定项编号,新项将会插入到 GRUB 菜单中的指定位置。或者,如果项编号高于菜单中项的当前编号,此项将作为菜单中的最后一项进行添加。

  1. 承担 root 角色。

    请参见在 Oracle Solaris 11.2 中确保用户和进程的安全 中的使用所指定的管理权限

  2. (u53ef选)列出 GRUB 菜单中的当前引导项。
    # bootadm list-menu
  3. 向 GRUB 菜单添加新引导项。
    # bootadm add-entry -P pool -i [entry-number] entry-title
  4. 为新添加的项设置 bootfs 属性,如下所示:
    # bootadm change-entry -i new-entry-number bootfs='pool-name/ROOT/be-name'

    通过此步骤,可确保新添加的引导项不使用根池中设置的缺省 bootfs 值,根池在 bootfs pool-level 属性中指定。

  5. 确认已添加引导项。
    # bootadm list-menu

    注 - 如果未看到更改,请检查 grub.cfg 文件以确认进行了更改。
示例 2-8  x86: 向 GRUB 菜单添加引导项

以下示例显示了如何使用 bootadm add-entry 命令向 GRUB 菜单添加菜单项。在此示例中,添加了项编号 2。

# bootadm list-menu
The location of the boot loader configuration file is /rpool/boot/grub
default 2
console graphics
timeout 30
0 Oracle Solaris 11/11
1 Oracle Solaris 11.2
# bootadm add-entry -i 2  Oracle Solaris 11_test
# bootadm change-entry -i 2 bootfs='rpool/ROOT/test'
# bootadm list-menu
The location of the boot loader configuration file is /rpool/boot/grub
default 2
console graphics
timeout 30
0 Oracle Solaris 11/11
1 Oracle Solaris 11.2
2 Oracle Solaris 11_test

通过指定项编号查看新菜单项的内容,如下所示:

# bootadm list-menu -i 2
     the location of the boot loader configuration files is: /rpool/boot/grub
     title: Oracle Solaris 11_test
     kernel: /platform/i86pc/kernel/amd64/unix
     kernel arguments: -B $ZFS-BOOTFS
     boot archive: /platform/i86pc/amd64/boot_archive
     ZFS root pool: rpool