Twitterでのこのtweetがきっかけ。
このやりとりが発端となり、河豚板のUEFI対応を開始する。
OpenBSDの場合に現状で考えられる起動方法とパーティショニングのパターンを以下に示す。
#ref(): File not found: "MBR2.png" at page "EBUG勉強会/20190223_UEFI_GPT"
UEFI登場以前から用いられてきた方法
#ref(): File not found: "GPT3.png" at page "EBUG勉強会/20190223_UEFI_GPT"
起動にUEFI、ディスクパーテショニングにGPTを用いるパターン
となっている。
UEFIとしてEFIアプリケーションがロードされるが、パーテショニングとしてMBRが使われるパターン。GPTは存在しない。
amd64のインストールメディアやarm64で使われている。
amd64のインストールメディアとarm64とでは細かい箇所で異なっている部分がある(右図はarm64)。
#ref(): File not found: "Hyb3.png" at page "EBUG勉強会/20190223_UEFI_GPT"
MBRとGPTの両方に同じパーテショニング情報を書込み、ブートローダもLegacy BIOS, UEFI共にセットアップしたもの。
2015年に安岡昌彦氏によりカーネルにUEFI対応の機能が実装された。
現在では、インストーラ含め、関連ユティリティがUEFI/GPTに対応している。
前述のように、Legacy BIOS、UEFIのいずれからでも起動可。
Legacy BIOS、UEFIのどちらで起動したかによって、パーティションニングのデフォルトも変わる。
UEFIで起動した場合
Available disks are: wd0 wd1.
Which disk is the root disk? ('?' for details) [wd0] wd1
No valid MBR or GPT.
Use (W)hole disk MBR, whole disk (G)PT or (E)dit? [gpt] ←インストーラをUEFIで起動した
Setting OpenBSD GPT partition to whole wd1...done. ので、GPTがデフォルト
The auto-allocated layout for wd1 is:
# size offset fstype [fsize bsize cpg]
a: 819776.0K 1024 4.2BSD 2048 16384 1 # /
b: 83090.0K 1640576 swap
c: 2097152.0K 0 unused
d: 930704.0K 1806784 4.2BSD 2048 16384 1 # /usr
e: 263024.0K 3668192 4.2BSD 2048 16384 1 # /home
i: 480.0K 64 MSDOS ←EFI Sys領域
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a]
Legacy BIOSで起動した場合
Available disks are: wd0 wd1.
Which disk is the root disk? ('?' for details) [wd0] wd1
No valid MBR or GPT.
Use (W)hole disk MBR, whole disk (G)PT or (E)dit? [whole] ←MBRがデフォルト
Setting OpenBSD MBR partition to whole wd1...done.
The auto-allocated layout for wd1 is:
# size offset fstype [fsize bsize cpg]
a: 800.6M 64 4.2BSD 2048 16384 1 # /
b: 81.1M 1639616 swap
c: 2048.0M 0 unused
d: 908.9M 1805824 4.2BSD 2048 16384 1 # /usr
e: 256.9M 3667232 4.2BSD 2048 16384 1 # /home
Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a]
パーティションの初期化時に、オプションによってMBRかGPTかを指定する。 MBRで初期化
# fdisk -i wd1
Do you wish to write new MBR and partition table? [n] y
Writing MBR at offset 0.
# fdisk wd1
Disk: wd1 geometry: 520/128/63 [4194304 Sectors]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
-------------------------------------------------------------------------------
0: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
*3: A6 0 1 2 - 519 127 63 [ 64: 4193216 ] OpenBSD
GPTで初期化
# fdisk -i -g wd1
Do you wish to write new GPT? [n] y
Writing MBR at offset 0.
Writing GPT.
# fdisk wd1
Disk: wd1 Usable LBA: 64 to 4194240 [4194304 Sectors]
#: type [ start: size ]
------------------------------------------------------------------------
3: OpenBSD [ 64: 4194177 ]
パーティションの詳細を見る
↓
# fdisk -v wd1
Primary GPT:
Disk: wd1 Usable LBA: 64 to 4194240 [4194304 Sectors]
GUID: 09d92128-d884-40f8-9e17-a606721cd8c7
#: type [ start: size ]
guid name
------------------------------------------------------------------------
3: OpenBSD [ 64: 4194177 ]
376b4152-9c45-4d7a-8392-5f0f3e015d51 OpenBSD Area
Secondary GPT:
Disk: wd1 Usable LBA: 64 to 4194240 [4194304 Sectors]
GUID: 09d92128-d884-40f8-9e17-a606721cd8c7
#: type [ start: size ]
guid name
------------------------------------------------------------------------
3: OpenBSD [ 64: 4194177 ]
376b4152-9c45-4d7a-8392-5f0f3e015d51 OpenBSD Area
MBR:
Disk: wd1 geometry: 520/128/63 [4194304 Sectors]
Offset: 0 Signature: 0xAA55
Starting Ending LBA Info:
#: id C H S - C H S [ start: size ]
---------------------------------------------------------------------------
0: EE 0 0 2 - 532610 4 4 [ 1: 4294967295 ] EFI GPT
1: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
2: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
3: 00 0 0 0 - 0 0 0 [ 0: 0 ] unused
#