使用 Linux Grub2 引導 Solaris

其他Linux/Unix/BSD/OSX等发行版讨论
回复
头像
torachiyo
帖子: 81
注册时间: 2015-11-29 8:32
系统: Kali Linux

使用 Linux Grub2 引導 Solaris

#1

帖子 torachiyo » 2018-09-24 18:44

##########################################################
### MBR 分割表類型引導
##########################################################
範例: Linux Mint 18.3 引導 OpenSolaris Dev svn 134 (MBR 分割區)

Solaris 安裝完成後,打開終端機執行 Format 查看分割與分片區狀態

* 查看分割區狀態

代码: 全选

# format
> 0
> fdisk
             Total disk size is 4177 cylinders
             Cylinder size is 16065 (512 byte) blocks

                                               Cylinders
      Partition   Status    Type          Start   End   Length    %
      =========   ======    ============  =====   ===   ======   ===
          1       Active    Linux native      0  2088    2089     50
          2                 Solaris2       2088  4175    2088     50
Linux 安裝在第一分割區
Solaris 安裝在第二分割區

* 查看分片狀態

代码: 全选

# format
> partition
partition> p

Current partition table (original):
Total disk cylinders available: 2086 + 2 (reserved cylinders)

Part      Tag    Flag     Cylinders        Size            Blocks
  0 unassigned    wm       0               0         (0/0/0)           0
  1       root    wm       1 - 2085       15.97GB    (2085/0/0) 33495525
  2     backup    wu       0 - 2085       15.98GB    (2086/0/0) 33511590
  3 unassigned    wm       0               0         (0/0/0)           0
  4 unassigned    wm       0               0         (0/0/0)           0
  5 unassigned    wm       0               0         (0/0/0)           0
  6 unassigned    wm       0               0         (0/0/0)           0
  7 unassigned    wm       0               0         (0/0/0)           0
  8       boot    wu       0 -    0        7.84MB    (1/0/0)       16065
  9 unassigned    wm       0               0         (0/0/0)           0
正常 MBR 分割區 boot 分片是在 8。
zfs根目錄是在 root 分片

不會修復 Linux Grub2 的,先安裝 Solaris 然後再安裝 Linux

然後進到 Linux 編輯 /boot/grub/grub.cfg Grub2選單
加入 OpenSolaris 引導
# MBR第二分割區 = msdos2
# boot 分片 8 = sunpc9 (+1就對了)
引導參數如下:

代码: 全选

menuentry 'OpenSolaris 2010 svn 134' {
	insmod part_msdos
        insmod part_sunpc
        insmod part_gpt
        insmod zfs
	set root='hd0,msdos2,sunpc9'
	chainloader (hd0,msdos2,sunpc9)+1
}
##########################################################
### GPT 分割表類型引導
##########################################################
範例: Kali Linux 引導 OpenIndiana 2018.04 hipster (GPT 分割區)

* 安裝注意事項:
與 Linux 共存安裝在其他的GPT分割區,現在好像只能使用手動安裝,OpenIndiana Live 裡面沒提供 gdisk,所以必須在Live系統內下載gdisk,預先分割Solaris安裝空間。
然後使用腳本安裝。或者參考 https://forum.ubuntu.org.cn/viewtopic.p ... 5&t=488510

安裝腳本:

代码: 全选

https://github.com/Mint-Fans/linux-package/raw/Solaris/Live-Install-Script.tar.gz
gptfdisk:

代码: 全选

https://github.com/Mint-Fans/linux-package/raw/Solaris/gptfdisk-1.0.3.tar.gz
範例:
* 分割OpenIndiana安裝空間

代码: 全选

# gdisk /dev/dsk/c4t2d0

Command (? for help): n
Partition number (2-128, default 2): 
First sector (34-67108830, default = 33554432) or {+-}size{KMGTP}: 
Last sector (33554432-67108830, default = 67108830) or {+-}size{KMGTP}: 
Hex code or GUID (L to show codes, Enter = BF01): 
Changed type of partition to 'Solaris /usr & Mac ZFS'

Command (? for help): p

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048        33554431   16.0 GiB    8300  
   2        33554432        67108830   16.0 GiB    BF01  Solaris /usr & Mac ZFS
保存

代码: 全选

Command (? for help): w
Y
第一分割區為Linux安裝空間
第二分割區為OpenIndiana安裝空間

* 查看分片狀態

代码: 全选

# format
> partition
partition> p

Part      Tag    Flag     First Sector        Size        Last Sector
  0 unassigned    wm                 0          0              0    
  1        usr    wm          33554432      16.00GB         67108830    
  2 unassigned    wm                 0          0              0    
  3 unassigned    wm                 0          0              0    
  4 unassigned    wm                 0          0              0    
  5 unassigned    wm                 0          0              0    
  6 unassigned    wm                 0          0              0    
GPT 分割表的分片跟MBR的好像不一樣
s0 是第一分割區
s1 是第二分割區

然後使用腳本安裝,或者參考 https://forum.ubuntu.org.cn/viewtopic.p ... 5&t=488510

一樣,不會修復 Linux Grub2 的,先安裝 Solaris 然後再安裝 Linux

然後進到 Linux 編輯 /boot/grub/grub.cfg Grub2選單
加入 OpenIndiana 引導
# GPT第二分割區 = gpt2
# GPT 類型不必指定分片了
引導參數如下:

代码: 全选

menuentry 'OpenIndiana 2018.04 hipster' {
        insmod part_gpt
	set root='hd0,gpt2'
	chainloader (hd0,gpt2)+1
}
##########################################################
### 甲骨文官方公佈的Grub2引導參數分析
##########################################################
甲骨文官方公佈的引導參數還沒在 OpenSolaris / OpenIndiana 上面測試成功。

OpenSolaris 只支援 MBR 分割區安裝,Solaris 11 或 OpenIndiana 支援 MBR 與 GPT 分割區安裝。

分析一下甲骨文官方公佈的引導參數

代码: 全选

menuentry "<title>" {
        insmod part_msdos
        insmod part_sunpc
        insmod part_gpt
        insmod zfs
        search --no-floppy --fs-uuid --set=root bbb75569aebe4013
        set be_name=opensolaris
        zfs-bootfs /ROOT/$be_name/@/ zfs_bootfs
        set kern=/platform/i86pc/kernel/amd64/unix
        echo -n "Loading ${root}/ROOT/$be_name/@$kern: "
        $multiboot /ROOT/$be_name/@/$kern $kern -B $zfs_bootfs
        set gfxpayload="1024x768x32;1024x768x16;800x600x16;640x480x16;640x480x15;640x480x32"
        insmod gzio
        echo -n "Loading ${root}/ROOT/$be_name/@/platform/i86pc/amd64/boot_archive: "
        $module /ROOT/$be_name/@/platform/i86pc/amd64/boot_archive
}
uuid 可以在 Grub2 選單按 c 然後 ls 查看
图片

search --no-floppy --fs-uuid --set=root bbb75569aebe4013 這一行其實可以改成 set root='hd0,msdos2,sunpc2'也就是指向 root 分片。
或者改成 search --set=root --label rpool --hint hd0,msdos2 自動搜尋 rpool 標籤。
回复