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
#
ここまでくれば、あとはボチボチと設定していけばいいでしょう。

NetBSD/evbarm on Raspberry Pi (6.0.1)
2012/12/26(水) 26:39 Raspberry Pi, NetBSD はてブ情報 はてブに登録 はてブ数

oh
data_abort_handler: data_aborts fsr=0x801 far=0xe
Fatal kernel mode data abort: 'Alignment Fault 1'
trapframe: 0xca2b0f10
FSR=00000801, FAR=0000000e, spsr=20000013
r0 =c1ae14d4, r1 =00000001, r2 =0000000a, r3 =00000020
r4 =c144d508, r5 =c1ae14d4, r6 =c144d50c, r7 =00000000
r8 =c144d568, r9 =00000001, r10=00000000, r11=ca2b0f68
r12=ca2b0f6c, ssp=ca2b0f5c, slr=c01297a8, pc =c000e574

Stopped in pid 0.24 (system) at netbsd:bufq_disksort_get+0x24:  strne   r3, [r2,
 #0x004]
db>

NetBSD/evbarm on Raspberry Pi (20121222)
2012/12/25(火) 26:38 Raspberry Pi, NetBSD はてブ情報 はてブに登録 はてブ数

Oh...
U-Boot> fatload mmc 0 8000 netbsd.20121222.bin
reading netbsd.20121222.bin

2943040 bytes read
U-Boot> go 8000
## Starting application at 0x00008000 ...

NetBSD/evbarm (rpi) booting ...
[ Kernel symbol table missing! ]
Loaded initial symtab at 0xc02548c4, strtab at 0xc027aab0, # entries 9681
pmap_postinit: Allocated 35 static L1 descriptor tables
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.99.16 (RPI) #0: Sat Dec 22 06:28:16 UTC 2012
        builds@b8.netbsd.org:/home/builds/ab/HEAD/evbarm/201212220210Z-obj/home/builds/ab/HEAD/src/sys/arch/evbarm/compile/RPI
total memory = 128 MB
avail memory = 122 MB
cprng kernel: WARNING insufficient entropy at creation.
mainbus0 (root)
cpu0 at mainbus0 core 0: ARM1176JZ-S r0p7 (ARM11J core)
cpu0: DC enabled IC enabled WB enabled LABT
cpu0: 16KB/32B 4-way L1 Instruction cache
cpu0: 16KB/32B 4-way write-back-locking-C L1 Data cache
vfp0 at cpu0: VFP11
obio0 at mainbus0
bcmicu0 at obio0
bcmmbox0 at obio0: VC mailbox
bcmtmr0 at obio0 intr 3: VC System Timer
bcmpm0 at obio0: Power management, Reset and Watchdog controller
plcom0 at obio0 intr 57
plcom0: txfifo disabled
plcom0: console
sdhc0 at obio0 intr 62: SDHC controller
sdhc0: interrupting on intr 62
sdhc0: SD Host Specification 3.0, rev.153
sdmmc0 at sdhc0 slot 0
ld0 at sdmmc0: <0x1d:0x4144:SD   :0x00:0x0000080a:0x087>
ld0: 15740 MB, 7994 cyl, 64 head, 63 sec, 512 bytes/sect x 32235520 sectors
ld0: 4-bit width, bus clock 25.000 MHz
cprng sysctl: WARNING insufficient entropy at creation.
boot device: <unknown>
root on ld0a dumps on ld0b
mountroot: trying nfs...
mountroot: trying msdos...
mountroot: trying ext2fs...
mountroot: trying ffs...
root file system type: ffs
WARNING: no TOD clock present
WARNING: using filesystem time
WARNING: CHECK AND RESET THE DATE!
warning: no /dev/console
init: copying out path `/sbin/init' 11
data_abort_handler: data_aborts fsr=0x1 far=0x28207697
Fatal kernel mode data abort: 'Alignment Fault 1'
trapframe: 0xc76c5d00
FSR=00000001, FAR=28207697, spsr=20000113
r0 =00000004, r1 =00000000, r2 =c10bb010, r3 =00000000
r4 =28207665, r5 =00000000, r6 =00000000, r7 =c10bb010
r8 =c02f0d3c, r9 =00000000, r10=00000000, r11=c76c5d88
r12=00000001, ssp=c76c5d50, slr=c01c04c4, pc =c01c0550

Stopped in pid 2.1 (sh) at      netbsd:uvm_pagealloc_pgfl+0xbc: ldrh    r3, [r4,
 #0x32]
db> tr
netbsd:uvm_pagealloc_pgfl+0xc
        scp=0xc01c04a0 rlv=0xc01c17d4 (netbsd:uvm_pagealloc_strat+0x200)
        rsp=0xc76c5d8c rfp=0xc76c5dd0
        r10=0x04000000 r9=0xc02f17e0
        r8=0x00000000 r7=0xbfffd000 r6=0x00000000 r5=0xc02f0c04
        r4=0xc144a6f0
netbsd:uvm_pagealloc_strat+0xc
        scp=0xc01c15e0 rlv=0xc01b1938 (netbsd:uvmfault_promote+0x138)
        rsp=0xc76c5dd4 rfp=0xc76c5e10
        r10=0x00000000 r9=0xc76c5ee8
        r8=0xc144a760 r7=0xc76c5ef0 r6=0xc1449c30 r5=0xc144a6f0
        r4=0xc12f0090
netbsd:uvmfault_promote+0xc
        scp=0xc01b180c rlv=0xc01b318c (netbsd:uvm_fault_internal+0x114c)
        rsp=0xc76c5e14 rfp=0xc76c5f3c
        r10=0xc76c5e90 r9=0x0000a000
        r8=0x00000000 r7=0x00000000 r6=0xc76c5ee8 r5=0x000000e5
        r4=0xc144a760
netbsd:uvm_fault_internal+0xc
        scp=0xc01b204c rlv=0xc002f280 (netbsd:data_abort_handler+0x2f0)
        rsp=0xc76c5f40 rfp=0xc76c5fac
        r10=0xbfffd000 r9=0x00000002
        r8=0xc76c4000 r7=0x00000001 r6=0x00000000 r5=0xc13a9540
        r4=0xc76c5fb0
netbsd:data_abort_handler+0xc
        scp=0xc002ef9c rlv=0xc0020a5c (netbsd:address_exception_entry+0x50)
        rsp=0xc76c5fb0 rfp=0xbfffdb0c
        r10=0xffffffff r9=0xbfffdb30
        r8=0x20307400 r7=0x00000010 r6=0x0000247c r5=0x201ea2f4
        r4=0xc02518f0
db>

Raspberry Pi で NetBSD/evbarmをブートさせる(手抜き版)
2012/09/05(水) 25:53 Raspberry Pi, NetBSD はてブ情報 はてブに登録 はてブ数

Linuxが起動するSDカードを用意しておく。

Raspberry Pi用のkernelを作るか入手する。
今回は20120820なソースからビルドしたものを使った。

kernelをbinary形式に変換。
# objcopy -O srec netbsd netbsd.srec
# objcopy -I srec -O binary netbsd.srec netbsd.bin
Linuxが起動するSDカードのMS-DOSパーティションをマウント。

FreeBSD Developer's Notebookで紹介されている
U-Bootをダウンロード、展開しておき、MS-DOSパーティションにあるファイルを全部入れ替える。

ついでに先ほど作ったnetbsd.binもコピーしておく。

Raspberyy PiにSDカードを入れて起動する。もちろん、シリアルコンソールが使える状態で。

fatloadコマンドで0x00008000にkernelをロードさせて、goコマンドでジャンプ。
U-Boot> fatload mmc 0 00008000 netbsd.bin
U-Boot> go 00008000
## Starting application at 0x00008000 ...

NetBSD/evbarm (rpi) booting ...
initarm: Configuring system ...
physmemory: 32768 pages at 0x00000000 -> 0x07ffffff
Allocating page tables
Creating L1 page table at 0x002e0000
Mapping kernel
pmap_map_chunk: pa=0x0 va=0xc0000000 size=0x23b000 resid=0x23b000 prot=0x3 cache=1
SSLLLPPPPPPPPPPP
pmap_map_chunk: pa=0x23b000 va=0xc023b000 size=0xa2000 resid=0xa2000 prot=0x3 cache=1
PPPPPLLLLLLLLLPPPPPPPPPPPPP
Constructing L2 page tables
pmap_map_chunk: pa=0x2eb000 va=0xc02eb000 size=0x1000 resid=0x1000 prot=0x3 cache=1
P
pmap_map_chunk: pa=0x2ec000 va=0xc02ec000 size=0x1000 resid=0x1000 prot=0x3 cache=1
P
pmap_map_chunk: pa=0x2ed000 va=0xc02ed000 size=0x1000 resid=0x1000 prot=0x3 cache=1
P
pmap_map_chunk: pa=0x2ee000 va=0xc02ee000 size=0x1000 resid=0x1000 prot=0x3 cache=1
P
pmap_map_chunk: pa=0x2ef000 va=0xc02ef000 size=0x2000 resid=0x2000 prot=0x3 cache=1
PP
pmap_map_chunk: pa=0x2e0000 va=0xc02e0000 size=0x4000 resid=0x4000 prot=0x3 cache=2
PPPP
pmap_map_chunk: pa=0x2dd000 va=0xc02dd000 size=0x1000 resid=0x1000 prot=0x3 cache=2
P
pmap_map_chunk: pa=0x2de000 va=0xc02de000 size=0x1000 resid=0x1000 prot=0x3 cache=2
P
pmap_map_chunk: pa=0x2df000 va=0xc02df000 size=0x1000 resid=0x1000 prot=0x3 cache=2
P
pmap_map_chunk: pa=0x2e4000 va=0xc02e4000 size=0x1000 resid=0x1000 prot=0x3 cache=2
P
pmap_map_chunk: pa=0x2e5000 va=0xc02e5000 size=0x1000 resid=0x1000 prot=0x3 cache=2
P
pmap_map_chunk: pa=0x2e6000 va=0xc02e6000 size=0x1000 resid=0x1000 prot=0x3 cache=2
P
pmap_map_chunk: pa=0x2e7000 va=0xc02e7000 size=0x1000 resid=0x1000 prot=0x3 cache=2
P
pmap_map_chunk: pa=0x2e8000 va=0xc02e8000 size=0x1000 resid=0x1000 prot=0x3 cache=2
P
pmap_map_chunk: pa=0x2e9000 va=0xc02e9000 size=0x1000 resid=0x1000 prot=0x3 cache=2
P
devmap: 20000000 -> 20ffffff @ f2000000
pmap_map_chunk: pa=0x20000000 va=0xf2000000 size=0x1000000 resid=0x1000000 prot=0x3 cache=0
SSSSSSSSSSSSSSSS
                             Physical              Virtual        Num
                       Starting    Ending    Starting    Ending   Pages
               SDRAM: 0x00000000 0x07ffffff 0xc0000000 0xc7ffffff 32768
        text section: 0x00000000 0x0023ab37 0xc0000000 0xc023ab37 571
        data section: 0x00240000 0x002c3a00 0xc0240000 0xc02c3a00 132
         bss section: 0x002c3a00 0x002dc5a0 0xc02c3a00 0xc02dc5a0 26
   L1 page directory: 0x002e0000 0x002e3fff 0xc02e0000 0xc02e3fff 4
   Exception Vectors: 0x002ea000 0x002eafff 0xffff0000 0xffff0fff 1
           FIQ stack: 0x002eb000 0x002ebfff 0xc02eb000 0xc02ebfff 1
           IRQ stack: 0x002ec000 0x002ecfff 0xc02ec000 0xc02ecfff 1
           ABT stack: 0x002ed000 0x002edfff 0xc02ed000 0xc02edfff 1
           UND stack: 0x002ee000 0x002eefff 0xc02ee000 0xc02eefff 1
           SVC stack: 0x002ef000 0x002f0fff 0xc02ef000 0xc02f0fff 2
      Message Buffer: 0x002f1000 0x002f1fff                       1
         Free Memory: 0x002f2000 0x07ffffff 0xc02f2000 0xc7ffffff 32014
switching to new L1 page table  @0x2e0000...OK.
freestart = 0x002f2000, free_pages = 32014 (0x00007d0e)
bootstrap done.
init subsystems: stacks vectors undefined page pmap done.
Loaded initial symtab at 0xc024451c, strtab at 0xc0269dd8, # entries 9534
pmap_postinit: Allocated 35 static L1 descriptor tables
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.99.10 (RPI) #0: Fri Aug 24 10:18:39 UTC 2012
        root@.localdomain:/export/o/20120820/evbarm/sys/arch/evbarm/compile/RPI
total memory = 128 MB
avail memory = 122 MB
cprng kernel: WARNING insufficient entropy at creation.
mainbus0 (root)
cpu0 at mainbus0: ARM1176JZ-S r0p7 (ARM11J core)
cpu0: DC enabled IC enabled WB enabled LABT
cpu0: 16KB/32B 4-way Instruction cache
cpu0: 16KB/32B 4-way write-back-locking-C Data cache
vfp0 at cpu0: VFP11
obio0 at mainbus0
bcmicu0 at obio0
bcmmbox0 at obio0: VC mailbox
bcmtmr0 at obio0 intr 3: VC System Timer
bcmpm0 at obio0: Power management, Reset and Watchdog controller
plcom0 at obio0 intr 57
plcom0: txfifo disabled
plcom0: console
sdhc0 at obio0 intr 62: SDHC controller
sdhc0: interrupting on intr 62
sdhc0: SD Host Specification 3.0, rev.153
sdmmc0 at sdhc0 slot 0
ld0 at sdmmc0: <SD   >
ld0: 15740 MB, 7994 cyl, 64 head, 63 sec, 512 bytes/sect x 32235520 sectors
ld0: 4-bit width, bus clock 25.000 MHz
cprng sysctl: WARNING insufficient entropy at creation.
boot device: <unknown>
root on ld0a dumps on ld0b
vfs_mountroot: can't open root device
cannot mount root, error = 6
root device (default ld0a):

Raspberry Piのブートプロセスを想像する
2012/09/02(日) 20:41 Raspberry Pi はてブ情報 はてブに登録 はてブ数

Raspberry PiのLinuxイメージの中身をみて、どういう仕組みでブートしていたのかを想像していたときの記録が出てきたのでメモとして残しておきます。

disklabeはこんな感じ。MSDOSとext2パーティションが見えています。
#        size    offset     fstype [fsize bsize cpg/sgs]
 d:  32235520         0     unused      0     0        # (Cyl.      0 -  15739)
 e:    114688      8192      MSDOS                     # (Cyl.      4 -     59)
 f:   3665920    122880 Linux Ext2      0     0        # (Cyl.     60 -   1849)
MS-DOSパーティションをマウントして中を見てみます。
# ls /mnt
arm128_start.elf          cmdline.txt               kernel_emergency.img
arm192_start.elf          config.txt                loader.bin
arm224_start.elf          issue.txt                 start.elf
arm240_start.elf          kernel.img
bootcode.bin              kernel_cutdown.img
テキストファイルの中身を見ていきましょう。

cmdline.txtはLinuxカーネルに与えるパラメータを書いているようです。
# cat cmdline.txt 
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
少し見やすくしてみます。
dwc_otg.lpm_enable=0 
console=ttyAMA0,115200 
kgdboc=ttyAMA0,115200 
console=tty1 
root=/dev/mmcblk0p2 
rootfstype=ext4 
elevator=deadline 
rootwait
config.txtは何でしょうね。このファイルを変更すると、HDMIの設定やフレームバッファの設定が変更できるのでしょうか。オーバークロックの設定もあって、気になります。
# cat config.txt 
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
#hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# for more options see http://elinux.org/RPi_config.txt
issue.txtはこのカーネルが作られたときの情報なのでしょうかね。URLを見てみると、spindleというのはRaspberry Piのイメージを作るプロジェクトのようですね。
# cat issue.txt 
Raspberry Pi reference 2012-08-16 (armhf)
Generated using spindle, http://asbradbury.org/projects/spindle/, f85b818, stage4-lxde-edu.qed
バイナリファイルはfileコマンドでさらっと。

たくさんあるarmXXX_start.elfは搭載メモリによって用意されているようなのですが良くわかりません。readelf -aしてみると、エントリポイント含めたアドレスだけが違っているようです。startっていう名前からして、いかにも最初に呼ばれそうな感じがしますが、ELFを解釈できる誰かが動いてから最初に、っていう感じですかね。
# file *.elf
arm128_start.elf: ELF 32-bit LSB executable, version 1 (SYSV), statically linked, stripped
arm192_start.elf: ELF 32-bit LSB executable, version 1 (SYSV), statically linked, stripped
arm224_start.elf: ELF 32-bit LSB executable, version 1 (SYSV), statically linked, stripped
arm240_start.elf: ELF 32-bit LSB executable, version 1 (SYSV), statically linked, stripped
start.elf:        ELF 32-bit LSB executable, version 1 (SYSV), statically linked, stripped
IMGファイルは名前のとおりカーネル本体なのでしょう。標準カーネルと軽量カーネルと緊急用カーネルといったところでしょうか。
# file *.img
kernel.img:           DBase 3 index file
kernel_cutdown.img:   DBase 3 index file
kernel_emergency.img: DBase 3 index file
BINファイルはARMのbinaryファイルなのでしょう。この二つのbinaryファイルがLinuxカーネルを呼んでいるんでしょうねぇ。さっきのstart.elfはどう絡むんでしょうか。
# file *.bin
bootcode.bin: data
loader.bin:   data