NetBSD/hpcshをjornadaにインストールする方法。オフィシャルページをまず読んでから始めてほしいが、User How-Toは内容が古いというか、これじゃぁ起動の確認くらいしかできないのでちょいと細かめに記載する。
もちろんここの方法以外にもやり方はあると思うので絶対だと信じないで欲しい。
実機でインストーラ使ってもいいのだけれど、とても遅いので作業用パソコンにて実行する。
hpcsh/ +-binary/ | +kernel/ | | +-netbsd.GENERIC.gz, netbsd-HPW650PA.gz | | | +sets/ | +- base.tgz, comp.tgz, etc.tgz, games.tgz, man.tgz, misc.tgz, text.tgz, | kern-GENERIC.tgz, kern-HPW650PA.tgz | xbase.tgz, xcomp.tgz, xetc.tgz, xfont.tgz, xserver.tgz | +-installation/ +- hpcboot-sh3.exe, hpcboot-sh4.exe, miniroot, netbsd.gz
他にインストール用ドキュメント、各ファイルのチェックサムファイル等があるが割愛。
お薦めできないといいつつ今回は自分で作ったcurrentを使う。が、どのバージョンでも基本的には同じ(はず)。
作業用パソコンにインストール先となるCFを繋げる。
sd1 at scsibus0 target 0 lun 1: <Generic, USB CF Reader, 1.01> disk removable sd1: fabricating a geometry sd1: 488 MB, 488 cyl, 64 head, 32 sec, 512 bytes/sect x 1000944 sectors
こんな感じで認識した。総セクタは1000944であることをとりあえず記憶する。
普通のCFの場合、最初はCFは全部MSDOSの領域になっている。そこでfdiskで編集する。
# fdisk sd1 Disk: /dev/rsd1d NetBSD disklabel disk geometry: cylinders: 488, heads: 64, sectors/track: 32 (2048 sectors/cylinder) total sectors: 1000944 BIOS disk geometry: cylinders: 993, heads: 16, sectors/track: 63 (1008 sectors/cylinder) total sectors: 1000944 Partition table: 0: Primary 'big' DOS, 16-bit FAT (> 32MB) (sysid 6) start 63, size 999873 (488 MB, Cyls 0-991), Active 1: <UNUSED> 2: <UNUSED> 3: <UNUSED>
488MBのFAT16形式のMSDOS領域しかないことがわかる。
WindowsCEで動作するブートローダ用のMSDOS領域とインストール先のNetBSD領域の2つにする。 先頭にmsdos用を最低限作成(ここでは4MByte)し、残りをNetBSD用にする。
# fdisk -u /dev/sd1d Disk: /dev/rsd1d NetBSD disklabel disk geometry: cylinders: 488, heads: 64, sectors/track: 32 (2048 sectors/cylinder) total sectors: 1000944 BIOS disk geometry: cylinders: 993, heads: 16, sectors/track: 63 (1008 sectors/cylinder) total sectors: 1000944 Do you want to change our idea of what BIOS thinks? [n] (改行) Partition table: 0: Primary 'big' DOS, 16-bit FAT (> 32MB) (sysid 6) start 63, size 999873 (488 MB, Cyls 0-991), Active 1: <UNUSED> 2: <UNUSED> 3: <UNUSED> Which partition do you want to change?: [none] 0 The data for partition 0 is: 0: Primary DOS with 12 bit FAT (sysid 1) start 63, size 999873 (488 MB, Cyls 0-991), Active sysid: [0..255 default: 6] 1 start: [0..993cyl default: 63, 0cyl, 0MB](改行) size: [0..993cyl default: 999873, 992cyl, 488MB] 4M bootmenu: [] (改行) The bootselect code is not installed, do you want to install it now? [n] (改行) Partition table: start 63, size 8001 (4 MB, Cyls 0-7), Active 1: <UNUSED> 2: <UNUSED> 3: <UNUSED> Which partition do you want to change?: [none] 1 The data for partition 1 is: <UNUSED> sysid: [0..255 default: 169] (改行) start: [0..993cyl default: 8064, 8cyl, 4MB] (改行) size: [0..985cyl default: 992880, 985cyl, 485MB] (改行) bootmenu: [] (改行) The bootselect code is not installed, do you want to install it now? [n] (改行) Partition table: 0: Primary DOS with 12 bit FAT (sysid 1) start 63, size 8001 (4 MB, Cyls 0-7), Active 1: NetBSD (sysid 169) start 8064, size 992880 (485 MB, Cyls 8-992) PBR is not bootable: All bytes are identical (0x00) 2: <UNUSED> 3: <UNUSED> Which partition do you want to change?: [none] (改行) Installed bootfile doesn't support required options. Update the bootcode from /usr/mdec/mbr? [n] (改行) We haven't written the MBR back to disk yet. This is your last chance. Partition table: 0: Primary DOS with 12 bit FAT (sysid 1) start 63, size 8001 (4 MB, Cyls 0-7), Active 1: NetBSD (sysid 169) start 8064, size 992880 (485 MB, Cyls 8-992) PBR is not bootable: All bytes are identical (0x00) 2: <UNUSED> 3: <UNUSED> Should we write new partition table? [n] y #
今回はMSDOS領域を4MBと極めて小さくしたため、懐かしのFAT12となる。32MBくらいにしてFAT16にした方がいいかも。ちなみに領域番号は以下のコマンドで確認できる。
# fdisk -l
NetBSD用領域にNetBSDのパーティションを定義する。
好きなように設定すればいいが今回は以下のような感じにする。
パーティション | 説明 |
---|---|
a | NetBSDのroot。面倒なのでこの1パーティション |
b | 本来はswap用だが今回は作らない |
c | NetBSDのmbrパーティション領域全部。つまり今回はaと同じ。 |
d | ディスク全体。 |
e | msdos領域。 |
1パーティションにインストール。swap領域も今回は作らない。
最近のNetBSDはfdiskの情報からなにやら適当に作ってくれるらしいので、認識情報に合わせて作業すればよい。
# disklabel -i -I sd1 partition> P 6 partitions: # size offset fstype [fsize bsize cpg/sgs] c: 992880 8064 unused 0 0 # (Cyl. 3*- 488*) d: 1000944 0 unused 0 0 # (Cyl. 0 - 488*) e: 8001 63 MSDOS # (Cyl. 0*- 3*) f: 992880 8064 4.2BSD 0 0 0 # (Cyl. 3*- 488*) partition> a Filesystem type [?] [unused]: 4.2BSD Start offset ('x' to start after partition 'x') [0c, 0s, 0M]: 8064 Partition size ('$' for all remaining) [0c, 0s, 0M]: $ a: 992880 8064 4.2BSD 0 0 0 # (Cyl. 3*- 488*) partition> f Filesystem type [?] [4.2BSD]: unused Start offset ('x' to start after partition 'x') [3.9375c, 8064s, 3.9375M]: 0 Partition size ('$' for all remaining) [484.805c, 992880s, 484.805M]: 0 partition> P 6 partitions: # size offset fstype [fsize bsize cpg/sgs] a: 992880 8064 4.2BSD 0 0 0 # (Cyl. 3*- 488*) c: 992880 8064 unused 0 0 # (Cyl. 3*- 488*) d: 1000944 0 unused 0 0 # (Cyl. 0 - 488*) e: 8001 63 MSDOS # (Cyl. 0*- 3*) partition> W Label disk [n]? y Label written partition> Q #
今回は実はfをaに変えただけ。
NetBSD領域のインストールパーティションと、先頭のMSDOS領域を初期化する。
# newfs /dev/rsd1a newfs /dev/rsd1a /dev/rsd1a: 484.8MB (992880 sectors) block size 8192, fragment size 1024 using 11 cylinder groups of 44.08MB, 5642 blks, 10944 inodes. super-block backups (for fsck_ffs -b #) at: 32, 90304, 180576, 270848, 361120, 451392, 541664, 631936, 722208, 812480, ............................................................................... #
# newfs_msdos /dev/rsd1e /dev/rsd1e: 7960 sectors in 995 FAT12 clusters (4096 bytes/cluster) MBR type: 1 bps=512 spc=8 res=1 nft=2 rde=512 sec=8001 mid=0xf8 spf=3 spt=32 hds=64 hid=63
配布セットを展開するためにmountする。mountポイントは適当にどこでも。
# mount /dev/sd1a /hoge #
使用したい配布セットを展開する。
# tar zxpf /path/to/配布セット.tgz -C /hoge #
展開する配布セットは hpcsh/binary/sets/の下にあるtgzファイル。この中で最低限必要なものは base.tgz, etc.tgz, kern-GENERIC.tgz の3つ。
ローカルなX環境のためにはxbase.tgz, xetc.tgz, xfont.tgz, xsever.tgz。
コンパイル環境を含めて全部を入れると約320MByteになる。
# df /hoge Filesystem 1K-blocks Used Avail Capacity Mounted on /dev/sd1a 481199 324880 132260 71% /hoge
なお、jornada6x0の場合、カーネルはkern-GENERICを使う。kern-HPW650PA.tgzを展開してはいけないので注意。
配布セットを展開し終えたら、本来はインストーラがやってくれるべき内容を手動で実行する。
# cd /hoge/dev # ./MAKEDEV all
以下の内容で/hoge/etc/fstabを作成
/dev/wd0a / ffs rw,noatime,nodevmtime 1 1 kernfs /kern kernfs rw procfs /proc procfs rw
ここで指定するファイルシステムはhpcsh起動時のものなので、デバイス名は/dev/sd1aではなくて/dev/wd0aとなる。何やらオプションを色々付けているがここではとりあえず気にしない。
/kern や /proc は展開しても出来ないらしいので作る。
# mkdir /hoge/kern /hoge/proc
これをこの時点でやっておくべきか若干悩むがとりあえず設定してしまう。
/hoge/etc/rc.confをテキストエディタで開き以下のように変更する。
rc.conf=YES hostname="hoge"
もちろんhostnameは好きな名前を付けてよい。
ひとまず最低限の設定は終わったのでumountする。
# umount /hoge
NetBSD/hpcshはWindowsCE上のプログラムであるhpcbootから起動するため、WindowsCEが認識する領域にWindowsCE用のプログラムをいれておく必要がある。
ブートローダーとなるプログラムは配布セットのinstallation/にあるhpcboot-sh3.exeである。これをCFのMSDOS領域にコピーする。
# mount -t msdos /dev/sd1e /hoge # cp /path/to/installation/hpcboot-sh3.exe /hoge/hpcboot.exe # umount /hoge
ここではhpcboot.exeにリネームしているがこれは単に気分的な物。
パソコンでの作業はこれでひとまず終わりなので、CFを取り出す。
CFスロットの場合[メモリカード2]が見える。これをエクスプローラから開くとhpcbootが見える。
全画面で起動する。ここで左上のプルダウンボックスで[/]を選び、その横にカーネル名である[netbsd]を入れる。その下の機種名プルダウンボックスは[Jornada 690 (Japanese)]を選ぶ。
準備が整ったら[Boot]ボタンを押す。確認ダイアログが出るので、よければYを押す。ここでカーネルの読込みが行われる。
読込みが終わると、最後の確認ダイアログが出る。この先は後には戻れない。一度NetBSDを起動するとWindowsCE上の情報は保存した情報やOSの設定情報を含めて全て失われるので注意。必要な情報がある場合は、必ず他のCFなど外部の媒体に保存すること。本体メモリに保存したファイルも消えてしまう。私の場合WindowsCEは本来の用途にまったく使用していないので構わず先に進む。
しばらく待つと画面が真っ暗になりNetBSDのカーネルメッセージが青地で出力され、やがてlogin: プロンプトになる。
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 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 4.99.17 (GENERIC) #0: Wed Apr 11 14:00:58 JST 2007 root@sweety:/export/current/daily/20070411/obj/hpcsh/sys/arch/hpcsh/compile/GENERIC HP Jornada 690 (Japanese) total memory = 32768 KB avail memory = 30028 KB timecounter: Timecounters tick every 10.000 msec mainbus0 (root) cpu0 at mainbus0: HITACHI SH3 132.706 MHz PCLOCK 22.118 MHz cpu0: 16KB/16B 4-way set-associative I/D-unified cache. cpu0: P0, U0, P3 write-back; P1 write-back cpu0: 4-way set-associative 128 TLB entries cpu0: VPN mode, multiple virtual storage mode btnmgr0 at mainbus0 wskbd2 at btnmgr0 mux 1 shb0 at mainbus0 rtc0 at shb0 scif0 at shb0 adc0 at shb0 j6x0pwr0 at adc0 j6x0tp0 at adc0 wsmouse0 at j6x0tp0 mux 0 wskbd1 at j6x0tp0 mux 1 j6x0lcd0 at shb0: brightness 28, contrast 11 hd64461if0 at shb0 hd64461video0 at hd64461if0: frame buffer = 512 KB , console hpcfb0 at hd64461video0: 640x240 pixels, 65536 colors, 80x24 chars wsdisplay0 at hpcfb0 kbdmux 1: console (std, vt100 emulation) wsmux1: connecting to wsdisplay0 wskbd2: connecting to wsdisplay0 wskbd1: connecting to wsdisplay0 hpcfb: 640x240 pixels, 65536 colors, 80x24 chars hpcfb: 640x240 pixels, 65536 colors, 80x24 chars hpcfb: 640x240 pixels, 65536 colors, 80x24 chars wsdisplay0: screen 1-3 added (std, vt100 emulation) hd64461pcmcia0 at hd64461if0 pcmcia0 at hd64461pcmcia0 pcmcia1 at hd64461pcmcia0 wdc0 at pcmcia1 function 0: <TOSHIBA THNCF512MMA , , , > wdc0: memory mapped mode atabus0 at wdc0 channel 0 hd64461gpio at hd64461if0 not configured hd64461afe at hd64461if0 not configured com0 at hd64461if0: device problem. don't attach. hd64461fir at hd64461if0 not configured pfckbd0 at mainbus0 hpckbd0 at pfckbd0 wskbd0 at hpckbd0: console keyboard, using wsdisplay0 hpcapm0 at mainbus0: pseudo power management module apmdev0 at hpcapm0: Power Management spec V1.2 timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0 timecounter: Timecounter "tmu_pclock_4" frequency 5529659 Hz quality 0 wd0 at atabus0 drive 0: <TOSHIBA THNCF512MMA> wd0: drive supports 1-sector PIO transfers, LBA addressing wd0: 488 MB, 993 cyl, 16 head, 63 sec, 512 bytes/sect x 1000944 sectors boot device: wd0 root on wd0a dumps on wd0b root file system type: ffs