OpenBSD上で作成するので、OpenBSDが動いているマシンが必要です。
インストールに必要なファイル一式を用意しておきましょう。i386でインストールしたい場合はi386/以下を、amd64でインストールしたい場合はamd64/以下をダウンロードしておきます。
# ls OpenBSD/4.7/i386
INSTALL.i386 bsd cdboot etc47.tgz game47.tgz misc47.tgz xfont47.tgz
INSTALL.linux bsd.mp cdbr floppy47.fs index.txt pxeboot xserv47.tgz
SHA256 bsd.rd cdemu47.iso floppyB47.fs install47.iso xbase47.tgz xshare47.tgz
base47.tgz cd47.iso comp47.tgz floppyC47.fs man47.tgz xetc47.tgz
# ls OpenBSD/4.7/amd64
INSTALL.amd64 bsd cd47.iso comp47.tgz game47.tgz man47.tgz xbase47.tgz xserv47.tgz
SHA256 bsd.mp cdboot etc47.tgz index.txt misc47.tgz xetc47.tgz xshare47.tgz
base47.tgz bsd.rd cdbr floppy47.fs install47.iso pxeboot xfont47.tgz
#
OpenBSDの動作しているマシンにUSBメモリースティックを差し込みます。次に下記のコマンドを実行して、USBメモリースティックが認識されているか調べます。
# dmesg | grep ^sd
sd0 at scsibus0 targ 1 lun 0: <Generic, USB Flash Disk, 8.07> SCSI2 0/direct removable
sd0: 7540MB, 961 cyl, 255 head, 63 sec, 512 bytes/sec, 15441920 sec total
sd0として認識されているので、fdiskコマンドを使ってsd0にMBRを作成します。
# fdisk -iy sd0
-----------------------------------------------------
------ ATTENTION - UPDATING MASTER BOOT RECORD ------
-----------------------------------------------------
#
disklabelコマンドを使って、OpenBSDパーティションの作成を行ないます。今回は面倒なので全ての領域をOpenBSDに割り当ててしまいます。
# disklabel -E sd0
# Inside MBR partition 3: type A6 start 63 size 15438402
Treating sectors 63-15438465 as the OpenBSD portion of the disk.
You can use the 'b' command to change this.
Initial label editor (enter '?' for help at any prompt)
> d *
> a
partition: [a]
offset: [63]
size: [15438402]
FS type: [4.2BSD]
> q
Write new label?: [y] y
#
newfsコマンドで、作成したパーティションにファイルシステムを作成します。
# newfs sd0a
/dev/rsd0a: 7538.3MB in 15438400 sectors of 512 bytes
38 cylinder groups of 202.47MB, 12958 blocks, 25984 inodes each
super-block backups (for fsck -b #) at:
32, 414688, 829344, 1244000, 1658656, 2073312, 2487968, 2902624, 3317280, 3731936,
4146592, 4561248, 4975904, 5390560, 5805216, 6219872, 6634528, 7049184, 7463840,
7878496, 8293152, 8707808, 9122464, 9537120, 9951776, 10366432, 10781088, 11195744,
11610400, 12025056, 12439712, 12854368, 13269024, 13683680, 14098336, 14512992,
14927648, 15342304,
#
適当なディレクトリを作成してUSBのパーティションをマウントします。そして、インストールで使用するファイルをUSBにコピーします
# mkdir -p /mnt/usb
# mount /dev/sd0a /mnt/usb
# cp -r 4.7/i386 /mnt/usb/
または
# cp -r 4.7/amd64 /mnt/usb/
OSをブートさせるためのコードをUSBドライブに作成します。
# cp /boot /mnt/usb/boot
# /usr/mdec/installboot -v /mnt/usb/boot /usr/mdec/biosboot sd0c
boot: /mnt/usb/boot
proto: /usr/mdec/biosboot
device: /dev/rsd0c
/usr/mdec/biosboot: entry point 0
proto bootblock size 512
/mnt/usb/boot is 3 blocks x 16384 bytes
fs block shift 2; part offset 63; inode block 24, offset 936
using MBR partition 3: type 166 (0xa6) offset 63 (0x3f)
#
カーネルをルートディレクトリにコピーします。
# cd /mnt/usb/4.7/i386/
または
# cd /mnt/usb/4.7/amd64/
# cp bsd* ../../
# cd ../../
# ls
4.7 boot bsd bsd.mp bsd.rd
# mv bsd bsd.org
# mv bsd.rd bsd
# cd /
# umount /mnt/usb
おしまい。