OpenBSD/sgi、IP26カーネルインストールにまつわるトラブル

! WARNING !
ここに記述してある事は、100%役に立ちません。
完全に備忘録です。

OpenBSD/sgiでIP26のカーネルは正式サポートされていません。
したがって、外部のサイト(ftp.jaist.ac.jp等)から
カーネルの入ったbase57.tgzをダウンロードしても、
IP26のカーネルは含まれていません。

インストール時に、最後に「カーネル無いよ」と警告が出ます。

Set name(s)? (or 'abort' or 'done') [done] 
Cannot determine prefetch area. Continue without verification? [no] yes
Installing base57.tgz   100% |**************************| 56003 KB    03:49    
Extracting etc.tgz      100% |**************************|   110 KB    00:00    
Location of sets? (disk http nfs or 'done') [http] done
Are you *SURE* your install is complete without 'bsd.IP26'? [no] yes
Time appears wrong.  Set to 'Sun Sep  6 08:56:36 JST 2015'? [yes] 
Saving configuration files...done.
Making all device nodes...sh(8003) in realloc(): error: chunk info corrupted
Abort trap 
done.
Installing boot loader in volume header.
Writing file /mnt/usr/mdec/boot-IP26
sgivol: stat /mnt/usr/mdec/boot-IP26: No such file or directory

WARNING: Boot install failed. Booting from disk will not be possible

この問題を解決するには、手動でカーネルブートローダーを設置してやる必要があります。
(NFS BOOTは試していません)

処理を行っているのは、

Super User's BSD Cross Reference: /OpenBSD/distrib/sgi/ramdisk/install.md

ですので、まずはboot-IP26を作ってやらなければなりません。

Super User's BSD Cross Reference: /OpenBSD/sys/arch/sgi/stand/boot64/Makefile
Super User's BSD Cross Reference: /OpenBSD/distrib/sgi/iso/Makefile
Super User's BSD Cross Reference: /OpenBSD/distrib/sets/lists/base/md.sgi

に追記をしてリリースイメージ作成時にboot-IP26を作るようにします。

boot-IP26の書き込み方法ですが、
自分は、"WARNING: Boot install failed. Booting from disk will not be possible"のエラーが出ても無視して処理を続行し、
インストール作業を終了させて#が出た後に、

# /mnt/usr/mdec/sgivol -w boot /mnt/usr/mdec/boot-IP26 sd0
Writing file /mnt/usr/mdec/boot-IP26
File /mnt/usr/mdec/boot-IP26 has 101640 bytes
disklabel shows 17783112 sectors with 512 bytes per sector
checksum: 00000000
root part: 0
swap part: 1
bootfile: /bsd

Volume header files:
boot     offset    2 blocks, length   101640 bytes (199 blocks)

SGI partitions:
 0:a blocks 17779977 first     3135 type  4 (BSD4.2)
 8:i blocks     3135 first        0 type  0 (Volume Header)
10:k blocks 17783112 first        0 type  6 (Volume)
# mv /mnt/usr/mdec/bsd.IP26 /mnt/bsd

カーネルの設置とブートローダーの書き込みを行いました。

で、どーやって肝心のboot-IP26やbsd.IP26を持ってくるか?ですが、
ftpで転送をかけました...
が、OpenBSDramdisk kernel内で使えるようにするため?か、
このftpは制限がかかっていて、使いづらい事この上ないです...

# ftp
usage: ftp [-o output] ftp://[user:password@]host[:port]/file[/] ...
       ftp [-o output] http://host[:port]/file ...
       ftp [-o output] file:file ...
       ftp [-o output] host:/file[/] ...

Super User's BSD Cross Reference: /OpenBSD/usr.bin/ftp/main.c

どうやってもユーザーとパスワードを設定してftpサーバにログインすることができなかったので、
anonymous ftpサーバをたてました。

# ftp -o boot-IP26 192.168.1.22:/pub/boot-IP26 
Connected to 192.168.1.22.
220 macbook2006 FTP server (NetBSD-ftpd 20100320) ready.
331 Guest login ok, type your name as password.
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
200 Type set to I.
250 CWD command successful.
Retrieving /pub/boot-IP26
local: boot-IP26 remote: boot-IP26
150 Opening BINARY mode data connection for 'boot-IP26' (101640 bytes).
226 Transfer complete.
101640 bytes received in 0.18 seconds (536.81 KB/s)
221-
    Data traffic for this session was 101640 bytes in 1 file.
    Total traffic for this session was 102251 bytes in 1 transfer.
221 Thank you for using the FTP service on macbook2006.

ブートローダーとカーネル設置してようやくHDDから起動出来るようになったと思ったら、

>> scsi(0)disk(1)rdisk(0)partition(8)boot
1024+36576+3920+1544+320 entry: 0xa80000002fff4b90

OpenBSD/sgi-IP26 ARCBios boot version 1.6
arg 0: scsi(0)disk(1)rdisk(0)partition(8)boot
arg 1: ConsoleIn=serial(0)
arg 2: ConsoleOut=serial(0)
arg 3: SystemPartition=scsi(0)disk(1)rdisk(0)partition(8)
arg 4: OSLoader=sash
arg 5: OSLoadPartition=scsi(0)disk(1)rdisk(0)partition(0)
arg 6: OSLoadFilename=/bsd
Boot: scsi(0)disk(1)rdisk(0)partition(0)/bsd
3577576+722344 [78+201600+120374]=0x468958
ARCS64 Firmware
Found SGI-IP26, setting up.
Initial setup done, switching console.
[ using 322760 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
	The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2015 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 5.7-stable (GENERIC-IP26) #1: Tue Mar 10 00:34:22 MDT 2015
    naruaki@fuel.my.domain:/usr/src/sys/arch/sgi/compile/GENERIC-IP26
real mem = 536870912 (512MB)
rsvd mem = 1064960 (2MB)
avail mem = 526630912 (502MB)
mainbus0 at root: POWER Indigo2 R8000
...
warning: /dev/console does not exist

応答しません。これはIP26カーネルが不安定なため、

Making all device nodes...sh(8003) in realloc(): error: chunk info corrupted
Abort trap 

インストール時にMAKEDEVが動かないため、/dev/consoleが作られないためです。
しかたがないので、再度ramdisk kernelから起動して、
MAKEDEV stdで/dev/consoleを作ってやります。

Welcome to the OpenBSD/sgi 5.7 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell? S
# mount /dev/sd0a /mnt
# cd /mnt/dev
# ls
MAKEDEV rsd0d   rsd0h   rsd0l   rsd0p   sd0d    sd0h    sd0l    sd0p
rsd0a   rsd0e   rsd0i   rsd0m   sd0a    sd0e    sd0i    sd0m
rsd0b   rsd0f   rsd0j   rsd0n   sd0b    sd0f    sd0j    sd0n
rsd0c   rsd0g   rsd0k   rsd0o   sd0c    sd0g    sd0k    sd0o
# ./MAKEDEV std
# ls
MAKEDEV mem     rsd0d   rsd0i   rsd0n   sd0c    sd0h    sd0m    stdin
console null    rsd0e   rsd0j   rsd0o   sd0d    sd0i    sd0n    stdout
klog    rsd0a   rsd0f   rsd0k   rsd0p   sd0e    sd0j    sd0o    tty
kmem    rsd0b   rsd0g   rsd0l   sd0a    sd0f    sd0k    sd0p    zero
ksyms   rsd0c   rsd0h   rsd0m   sd0b    sd0g    sd0l    stderr

ようやく独り立ち出来るようになりましたが、

System Maintenance Menu

1) Start System
2) Install System Software
3) Run Diagnostics
4) Recover System
5) Enter Command Monitor

Option? 5
Command Monitor.  Type "exit" to return to the menu.
>> scsi(0)disk(1)rdisk(0)partition(8)boot
1024+36576+3920+1544+320 entry: 0xa80000002fff4b90

OpenBSD/sgi-IP26 ARCBios boot version 1.6
arg 0: scsi(0)disk(1)rdisk(0)partition(8)boot
arg 1: ConsoleIn=serial(0)
arg 2: ConsoleOut=serial(0)
arg 3: SystemPartition=scsi(0)disk(1)rdisk(0)partition(8)
arg 4: OSLoader=sash
arg 5: OSLoadPartition=scsi(0)disk(1)rdisk(0)partition(0)
arg 6: OSLoadFilename=/bsd
Boot: scsi(0)disk(1)rdisk(0)partition(0)/bsd
3577576+722344 [78+201600+120374]=0x468958
ARCS64 Firmware
Found SGI-IP26, setting up.
Initial setup done, switching console.
[ using 322760 bytes of bsd ELF symbol table ]
Copyright (c) 1982, 1986, 1989, 1991, 1993
	The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2015 OpenBSD. All rights reserved.  http://www.OpenBSD.org

OpenBSD 5.7-stable (GENERIC-IP26) #1: Tue Mar 10 00:34:22 MDT 2015
    naruaki@fuel.my.domain:/usr/src/sys/arch/sgi/compile/GENERIC-IP26
real mem = 536870912 (512MB)
rsvd mem = 1064960 (2MB)
avail mem = 526630912 (502MB)
mainbus0 at root: POWER Indigo2 R8000
cpu0 at mainbus0: MIPS R8000 CPU rev 0.0 75 MHz, R8010 FPU rev 0.1
cpu0: cache L1-I 16KB D 16KB direct, L2 2048KB direct
int0 at mainbus0 addr 0x1fbd9000
tcc0 at mainbus0: streaming cache revision 0
imc0 at mainbus0: revision 5
gio0 at imc0
grtwo0 at gio0 addr 0x1f000000: GR5-XZ
grtwo0: device has not been setup by firmware!
hpc0 at gio0 addr 0x1fb80000: SGI HPC3 (onboard)
zs0 at hpc0 offset 0x00059830 irq 29: 85230
zstty0 at zs0 channel 1: console
zstty1 at zs0 channel 0
pckbc0 at hpc0 offset 0x00059840 irq 28
sq0 at hpc0 offset 0x00054000 irq 3: Seeq 80c03, address 08:00:69:08:a8:e8
wdsc0 at hpc0 offset 0x00044000 irq 1: WD33C93B, 20.0 MHz, burst DMA
wdsc0: microcode revision 0x0d, fast SCSI
scsibus0 at wdsc0: 8 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0: <SEAGATE, ST19171N, 0023> SCSI2 0/direct fixed serial.SEAGATE_ST19171N_LA718859
sd0: 8683MB, 512 bytes/sector, 17783112 sectors
wdsc1 at hpc0 offset 0x0004c000 irq 2: WD33C93B, 20.0 MHz, burst DMA
wdsc1: microcode revision 0x0d, fast SCSI
scsibus1 at wdsc1: 8 targets, initiator 0
haltwo at hpc0 offset 0x00058000 irq 12 not configured
pione at hpc0 offset 0x00059800 irq 5 not configured
panel0 at hpc0 offset 0x00059850 irq 9: power button
dsclock0 at hpc0 offset 0x00060000
eisa0 at imc0 irq 27
vscsi0 at root
scsibus2 at vscsi0: 256 targets
softraid0 at root
scsibus3 at softraid0: 256 targets
boot device: sd0
root on sd0a (7a66b1019d03f648.a) swap on sd0b dump on sd0b
WARNING: / was not properly unmounted
Automatic boot in progress: starting file system checks.
Can't open 7a66b1019d03f648.a: No such file or directory
CAN'T CHECK FILE SYSTEM.
7a66b1019d03f648.a: UNEXPECTED INCONSISTENCY; RUN fsck_ffs MANUALLY.
Automatic file system check failed; help!
Enter pathname of shell or RETURN for sh: 
# fsck -y                                                               
Can't open 7a66b1019d03f648.a: No such file or directory
# exit
WARNING: R/W mount of / denied.  Filesystem is not clean - run fsck
mount_ffs: 7a66b1019d03f648.a on /: filesystem must be mounted read-only; you may need to run fscWARNING: R/W mount of / denied.  Filesystem is not clean - run fsck
k
mount_ffs: 7a66b1019d03f648.a on /: filesystem must be mounted read-only; you may need to run fsck
setting tty flags
pfctl: /dev/pf: No such file or directory
pfctl: /dev/pf: No such file or directory
starting network
/etc/rc[362]: cannot create /dev/random: Read-only file system
pfctl: /dev/pf: No such file or directory
dd: /dev/random: Read-only file system
chmod: /var/db/host.random: Read-only file system
dd: /var/db/host.random: Read-only file system
dd: /etc/random.seed: Read-only file system
chmod: /etc/random.seed: Read-only file system
rm: dmesg.boot: Read-only file system
rm: utmp: Read-only file system
install: utmp: Read-only file system
rm: *: Read-only file system
/etc/rc[385]: cannot create /var/run/dmesg.boot: Read-only file system
starting early daemons: syslogd pflogd(failed).
starting RPC daemons:.
WARNING: R/W mount of / denied.  Filesystem is not clean - run fsck
mount_ffs: 7a66b1019d03f648.a on /: filesystem must be mounted read-only; you may need to run fsck
savecore: no core dump
checking quotas: done.
kvm_mkdb: can't dbopen /var/db/kvm_bsd.tmp: Read-only file system
kvm_mkdb: will try again using /bsd instead
kvm_mkdb: can't dbopen /var/db/kvm_bsd.tmp: Read-only file system
dev_mkdb: /var/run/dev.tmp: Read-only file system
chmod: /dev/tty[pqrstuvwxyzPQRST]*: No such file or directory
chown: /dev/tty[pqrstuvwxyzPQRST]*: No such file or directory
clearing /tmp
rm: [a-km-pr-uw-zA-Z]*: Read-only file system
kern.securelevel: 0 -> 1
mktemp: cannot make temp file /tmp/_motd.NdqG9uwqJa: Read-only file system
creating runtime link editor directory cache.
ldconfig: /var/run/ld.so.hints.VEtMUTQhpl: Read-only file system
preserving editor files.
Bus error 
starting network daemons: smtpdpanic: trap: utlbmod: invalid pte
Stopped at      Debugger+0x4:   jr      ra
Debugger+0x8:    move   zero,zero
RUN AT LEAST 'trace' AND 'ps' AND INCLUDE OUTPUT WHEN REPORTING THIS PANIC!
DO NOT EVEN BOTHER REPORTING THIS WITHOUT INCLUDING THAT INFORMATION!

起動して5秒でpanic!

どっかのシリーズもののAVみたいなオチがつきましたが、現状そんな感じです。