USL-5PにNetBSD/landiskをインストール (NetBSD 6.0.1)
2013/01/02(水) 17:39 NetBSD はてブ情報 はてブに登録 はてブ数

NetBSD/landiskをUSL-5Pで久しぶりに動かしました。
前回が2006年9月ですから、6年3か月ぶりですか。

あまりに久しぶりなのでメモしておきます。

なにはなくともシリアルコンソールを取らねばなりません。

そしてそのためにはプラスねじを一本外し、カバーを外す必要があります。
カバーは固く、少しの勇気をもってLANポート側からフロントのスイッチ側にカバーをスライドさせます。

シリアルポートはボード上のボタン電池の近所にある四つの穴ですね。
三角形のマーク(▲)が1番ポートです。
ピン番号内容
1番3.3V
2番TxD
3番RxD
4番GND
スルーホールなのでピンヘッダをはんだ付けする方法もありますが、LANTANK用のシリアルケーブルやサンハヤトのTTW-200のようなコンタクトピンになっているケーブルを使うと抜き差しが便利です。TTW-200だと少し太いかなぁ。今度買ってみよう。
今回はLANTANK用のシリアルケーブルを使いました。ただし、このケーブルだとTxD, RxDのピン配置が逆なので、一度ぜんぶピンごと抜いてさしなおす必要があります。

オリジナルのピン配置を書いておきます。グレーとイエローを入れ替えるんですね。
ピン番号内容
1番3.3Vオレンジ
2番RxDグレー
3番TxDイエロー
4番GNDホワイト
5番なし
ケーブルの準備ができたらテストしてみましょう。スピードは9600bpsです。

前回はどういうわけかUSL-5Pですべての作業をしていたみたいですが、作業効率も考えるとIntelマシンのパワーを使うのが何かと楽ちんです。今回はVMware Player上のNetBSD 6.0.1をThinkPadに接続したコンパクトフラッシュリーダライタを経由してコンパクトフラッシュにNetBSDをインストールしました。

以前のインストールメモです

使用したCFはSanDiskの256MB CFです。容量的にはkernel, base, etc, modulesを展開しておわりですね。compを入れたらあふれました...

準備として、VMwareに母艦のCFを見せる設定をVMware側に行っておきましょう。

NetBSD/landiskのリリース物を入手し、VMware側で展開しておきます。

最初は、CFのパーティションをつぶします。ddでゼロを書き込みます。
nb601# dd if=/dev/zero of=/dev/rsd0d bs=1k count=10
10+0 records in
10+0 records out
10240 bytes transferred in 0.125 secs (81920 bytes/sec)
次にMBRを書き込みます。先ほど展開しておいたNetBSD/landiskのmbrを書き込みます。landiskはi386ばりにMBRを解釈してくれて、MBR->ブートローダ->カーネルをFFSからブートします。MS-DOSパーティションやLinux ext3パーティションなどは不要です。
nb601# dd if=./usr/mdec/mbr of=/dev/rsd0d bs=512 count=1
1+0 records in
1+0 records out
512 bytes transferred in 0.019 secs (26947 bytes/sec)
fdiskでパーティションを切ります。パーティション0に対してシリンダの32番目から全体をNetBSD区画にしてしまいます。
nb601# fdisk -0 -u sd0
fdisk: Cannot determine the number of heads
Disk: /dev/rsd0d
NetBSD disklabel disk geometry:
cylinders: 245, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
total sectors: 501760

BIOS disk geometry:
cylinders: 245, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
total sectors: 501760

Partitions aligned to 2048 sector boundaries, offset 32

Do you want to change our idea of what BIOS thinks? [n]

Partition 0:
<UNUSED>
The data for partition 0 is:
<UNUSED>
sysid: [0..255 default: 169]
start: [0..245cyl default: 32, 0cyl, 0MB]
size: [0..245cyl default: 501728, 245cyl, 245MB]
bootmenu: [] NetBSD

Installed bootfile doesn't support required options.
Update the bootcode from /usr/mdec/mbr_bootsel? [n]

We haven't written the MBR back to disk yet.  This is your last chance.
Partition table:
0: NetBSD (sysid 169)
    bootmenu: NetBSD
    start 32, size 501728 (245 MB, Cyls 0-244)
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
Bootselector disabled.
No active partition.
Should we write new partition table? [n] y
アクティブ領域を設定します。当然ですがパーティション0をアクティブにします。
nb601# fdisk -a sd0
Disk: /dev/rsd0d
NetBSD disklabel disk geometry:
cylinders: 245, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
total sectors: 501760

BIOS disk geometry:
cylinders: 245, heads: 64, sectors/track: 32 (2048 sectors/cylinder)
total sectors: 501760

Partitions aligned to 2048 sector boundaries, offset 32

Partition table:
0: NetBSD (sysid 169)
    bootmenu: NetBSD
    start 32, size 501728 (245 MB, Cyls 0-244)
1: <UNUSED>
2: <UNUSED>
3: <UNUSED>
Bootselector disabled.
No active partition.
Do you want to change the active partition? [n] y
Choosing 4 will make no partition active.
active partition: [0..4 default: 4] 0
Are you happy with this choice? [n] y

We haven't written the MBR back to disk yet.  This is your last chance.
Should we write new partition table? [n] y
disklabelを書きます。お好みです。swapをどうしようかと思ったのですが、FFS上のファイルをスワップにしてもいいですし、いざとなったらNFS上にスワップを作っちゃえばいいや、ということで少しでも容量を稼ぎます。
nb601# disklabel sd0
# /dev/rsd0d:
type: SCSI
disk: MCR   HS-CF
label: fictitious
flags: removable
bytes/sector: 512
sectors/track: 32
tracks/cylinder: 64
sectors/cylinder: 2048
cylinders: 245
total sectors: 501760
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # microseconds
track-to-track seek: 0  # microseconds
drivedata: 0

4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:    501728        32     4.2BSD      0     0     0  # (Cyl.      0*-    244)
 c:    501728        32     unused      0     0        # (Cyl.      0*-    244)
 d:    501760         0     unused      0     0        # (Cyl.      0 -    244)
nb601# disklabel -i -I sd0
Enter '?' for help
partition> a
Filesystem type [?] [4.2BSD]:
Start offset ('x' to start after partition 'x') [0.015625c, 32s, 0.015625M]:
Partition size ('$' for all remaining) [244.984375c, 501728s, 244.984375M]:
partition> P
4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:    501728        32     4.2BSD      0     0     0  # (Cyl.      0*-    244)
 d:    501760         0     unused      0     0        # (Cyl.      0 -    244)
partition> c
Filesystem type [?] [unused]:
Start offset ('x' to start after partition 'x') [0c, 0s, 0M]: 32
Partition size ('$' for all remaining) [0c, 0s, 0M]: $
 c:    501728        32     unused      0     0        # (Cyl.      0*-    244)
partition> P
4 partitions:
#        size    offset     fstype [fsize bsize cpg/sgs]
 a:    501728        32     4.2BSD      0     0     0  # (Cyl.      0*-    244)
 c:    501728        32     unused      0     0        # (Cyl.      0*-    244)
 d:    501760         0     unused      0     0        # (Cyl.      0 -    244)
partition> W
Label disk [n]? y
Label written
partition> Q
NetBSDパーティションをnewfsでフォーマットします。
(なぜか手順が残ってなかったなー)
nb601# newfs /dev/rsd0a
作成したsd0aにinstallbootでプライマリブートローダをぶち込みます。
nb601# installboot -m landisk -v /dev/rsd0a ./usr/mdec/bootxx_ffsv1
File system:         /dev/rsd0a
Primary bootstrap:   ./usr/mdec/bootxx_ffsv1
次にセカンダリブートローダです。こちらはファイルのコピーですからまずはsd0aをマウントします。
nb601# mount /dev/sd0a /mnt
セカンダリブートローダをコピーします。ちゃんとlandisk用のbootをつかいましょう。母艦のbootをコピーしないように。
nb601# cp ./usr/mdec/boot /mnt
次は配布物をインストールしていきます。
手元の環境ではGENERICカーネルも展開済みだったのでコピーしました。
ほんとうならpax -rzpe -f kern-GENERIC.tgzあたりですかね。
nb601# cp netbsd /mnt
base, etc, modulesを展開していきます。6系からmodulesを入れないといけませんねぇ。これを忘れると/sbin/initが起動しないんだったかな。
nb601# pax -rzpe -f /root/601/landisk/base.tgz; pax -rzpe -f /root/601/landisk/etc.tgz ; pax -rzpe -f /root/601/landisk/modules.tgz
MAKEDEVでデバイスを作っておきます。
nb601# cd dev
nb601# ./MAKEDEV all
/etc/fstabを書いておきます。起動するだけならtouch /etc/fstabでもいいかも。
nb601# cd ../etc
nb601# echo /dev/wd0a / ffs rw 1 1 > fstab
ここらへんまで来たらもう起動してもいいんですが、マルチユーザにしたければ/etc/rc.confにrc_configured=YESを書いてあげないといけません。
次の例ではラインエディタであるedを使っています。
nb601# ed rc.conf
515
/NO
# Use program=YES to enable program, NO to disable it. program_flags are
/
rc_configured=NO
s/NO/YES
rc_configured=YES
w
516
q
インストールは終わりです。
マウントポイントから離れて、アンマウントします。
nb601# cd /
nb601# umount /mnt
いざ、起動です。
SH IPL+g version 0.9, Copyright (C) 2000 Free Software Foundation, Inc.

This software comes with ABSOLUTELY NO WARRANTY; for details type `w'.
This is free software, and you are welcome to redistribute it under
certain conditions; type `l' for details.

2002/09/09 Making.  2004/09/08 I-O DATA NSU Update.
266:133:33 on base clock 22.22MHz and SDRAM 4 burst. CF boot.

PCIC initialization done.
MASTER:48bit LBA mode non support
Disk drive detected: SanDisk SDCFB-256 HDX 3.19     111702D2206F0252
LBA: 0007A800
DiskSize: 256901120Byte
PIO MODE1
Set Transfer Mode result: 50
> b
Set Transfer Mode result: 50
Initialize Device Parameters result: 50
IDLE result: 50

NetBSD MBR boot

NetBSD/landisk ffsv1 Primary Bootstrap

>> NetBSD/landisk Boot, Revision 1.0
Press return to boot now, any other key for boot menu
booting hd0a:netbsd - starting in 0
3409060+135044 [268048+257712]=0x3e202c
Start @ 0x8c001000 [1=0x8c362428-0x8c3e302c]...
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 6.0.1 (GENERIC)
Model: I-O DATA LANDISK
total memory = 65536 KB
avail memory = 58416 KB
mainbus0 (root)
cpu0 at mainbus0: SH4 266.666 MHz PCLOCK 33.333 MHz
cpu0: 8KB/32B direct-mapped Instruction cache.
cpu0: 16KB/32B direct-mapped Data cache.
cpu0: U0, P0, P3 write-through; P1 write-through
cpu0: full-associative 4 ITLB, 64 UTLB entries
cpu0: multiple virtual storage mode, SQ access: kernel, wired 3
shpcic0 at mainbus0: Hitachi SH7751R PCI Controller (host bridge, revision 0x01)
pci0 at shpcic0
re0 at pci0 dev 0 function 0: RealTek 8139C+ 10/100BaseTX (rev. 0x20)
re0: interrupting at irq 5
re0: Ethernet address XX:XX:XX:XX:XX:XX
rlphy0 at re0 phy 0: Realtek internal PHY
rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ohci0 at pci0 dev 2 function 0: NEC USB Host Controller (rev. 0x43)
ohci0: interrupting at irq 7
ohci0: OHCI version 1.0
usb0 at ohci0: USB revision 1.0
ohci1 at pci0 dev 2 function 1: NEC USB Host Controller (rev. 0x43)
ohci1: interrupting at irq 8
ohci1: OHCI version 1.0
usb1 at ohci1: USB revision 1.0
ehci0 at pci0 dev 2 function 2: NEC USB Host Controller (rev. 0x04)
ehci0: interrupting at irq 5
ehci0: companion controllers, 3 ports each: ohci0 ohci1
usb2 at ehci0: USB revision 2.0
shb0 at mainbus0
scif0 at shb0
scif0: console
rs5c313rtc0 at shb0: RICOH 5C313 real time clock
obio0 at mainbus0
wdc0 at obio0 port 0x14000000-0x1400000f irq 10
atabus0 at wdc0 channel 0
btn0 at obio0 irq 12: USL-5P buttons
pwrsw0 at obio0 irq 11: Power Switch
uhub0 at usb0: NEC OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1 at usb1: NEC OHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub2 at usb2: NEC EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
wd0 at atabus0 drive 0
wd0: <SanDisk SDCFB-256>
wd0: 245 MB, 980 cyl, 16 head, 32 sec, 512 bytes/sect x 501760 sectors
boot device: wd0
root on wd0a dumps on wd0b
Wed Jan  2 19:38:48 UTC 2013
Starting root file system check:
/dev/rwd0a: file system is clean; not checking
Starting file system checks:
Setting tty flags.
Setting sysctl variables:
ddb.onpanic: 1 -> 0
Starting network.
/etc/rc: WARNING: $hostname not set.
IPv6 mode: host
Configuring network interfaces:.
Adding interface aliases:.
Building databases: dev, dev, utmp, utmpx, services.
Starting syslogd.
Mounting all filesystems...
Clearing temporary files.
Checking quotas: done.
Setting securelevel: kern.securelevel: 0 -> 1
/etc/rc: WARNING: No swap space configured!
/etc/rc.d/swap2 exited with code 1
Starting virecover.
Checking for core dump...
savecore: /dev/rwd0b: Device not configured
Jan  2 19:39:03  savecore: /dev/rwd0b: Device not configured
Starting local daemons:.
Updating motd.
postfix: rebuilding /etc/mail/aliases (missing /etc/mail/aliases.db)
newaliases: warning: valid_hostname: empty hostname
newaliases: fatal: unable to use my own hostname
Jan  2 19:39:06  postfix/sendmail[313]: fatal: unable to use my own hostname
/etc/rc.d/postfix exited with code 1
Starting inetd.
Starting cron.
The following components reported failures:
    /etc/rc.d/swap2 /etc/rc.d/postfix
See /var/run/rc.log for more information.
Wed Jan  2 19:39:07 UTC 2013

NetBSD/landisk (Amnesiac) (console)

login: root
Jan  2 19:39:13  login: ROOT LOGIN (root) on tty console
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 6.0.1 (GENERIC)

Welcome to NetBSD!

Terminal type? [unknown] xterm
Terminal type is xterm.
We recommend that you create a non-root account and use su(1) for root access.
# uname -a
NetBSD  6.0.1 NetBSD 6.0.1 (GENERIC) landisk
#
ここまでくれば、あとはボチボチと設定していけばいいでしょう。

名前:  非公開コメント   

  • TB-URL  http://www.tokuda.net/diary/0794/tb/