NetBSD/evbarm (APC8750) 2013/10/24
2013/10/24(木) 26:38 NetBSD はてブ情報 はてブに登録 はてブ数

やっとここまで来ました!
WMT # set serverip 192.168.0.10; tftpboot 8000; go 8000
EEP-less strapping = TRUE
*** Warning: no boot file name; using 'C0A80002.img'
TFTP from server 192.168.0.10; our IP address is 192.168.0.2
Filename 'C0A80002.img'.
Load address: 0x8000
Loading: #################################################################
         ###########################################T ######################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ################################T #################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ####################T #############################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #####################################################T ############
         #################################################################
         ##################
done
Bytes transferred = 6747520 (66f580 hex)
## Starting application at 0x00008000 ...
00008328
NetBSD
00000000 00000000 0088a74b 00000412
00000000 00000412 00000008 00000412
c0000000 00000000 0088a74b 0000041e
00003000 0000041e 00000008 0000041e
fe000000 d8000000 010fffff 00000412
00003f80 d8000412 00000010 00000412
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000
NS
NetBSD/evbarm (APC) booting ...
initarm: Configuring system ...
arm32_bootmem_init: memstart=0, memsize=0x20000000, kernelstart=0x8000
arm32_bootmem_init: kernelend=0x68b000
arm32_bootmem_init: adding 129397 free pages: [0x68b000..0x1fffffff] (VA 0xc068b000)
arm32_bootmem_init: adding 8 free pages: [0..0x7fff] (VA 0xc0000000)
arm32_kernel_vm_init: 2 L2 pages are needed to map 0x6b6000 kernel bytes
arm32_kernel_vm_init: allocating page tables for vectoradd_pages: adding pv 0xc0677cac (pa 0x68b000, va 0xc068b000, 1 pages) at tail
 kerneladd_pages: appending pv 0xc06826ec (0x68c000..0x68ffff) to 0x68b000..0x68bfff
add_pages: appending pv 0xc0677f30 (0x690000..0x690fff) to 0x68b000..0x68ffff
add_pages: appending pv 0xc0677f44 (0x691000..0x691fff) to 0x68b000..0x690fff
 vmadd_pages: appending pv 0xc0677f58 (0x692000..0x692fff) to 0x68b000..0x691fff
add_pages: appending pv 0xc0677f6c (0x693000..0x693fff) to 0x68b000..0x692fff
add_pages: appending pv 0xc0677f80 (0x694000..0x694fff) to 0x68b000..0x693fff
add_pages: appending pv 0xc0677f94 (0x695000..0x695fff) to 0x68b000..0x694fff
add_pages: appending pv 0xc0677fa8 (0x696000..0x696fff) to 0x68b000..0x695fff
add_pages: appending pv 0xc0677fbc (0x697000..0x697fff) to 0x68b000..0x696fff
add_pages: appending pv 0xc0677fd0 (0x698000..0x698fff) to 0x68b000..0x697fff
add_pages: appending pv 0xc0677fe4 (0x699000..0x699fff) to 0x68b000..0x698fff
arm32_kernel_vm_init: allocating stacks
add_pages: appending pv 0xc0678230 (0x69a000..0x69afff) to 0x68b000..0x699fff
add_pages: appending pv 0xc0678244 (0x69b000..0x69bfff) to 0x68b000..0x69afff
add_pages: appending pv 0xc0678258 (0x69c000..0x69cfff) to 0x68b000..0x69bfff
add_pages: appending pv 0xc067826c (0x69d000..0x69dfff) to 0x68b000..0x69cfff
add_pages: appending pv 0xc0678280 (0x69e000..0x69ffff) to 0x68b000..0x69dfff
add_pages: appending pv 0xc067821c (0x6a0000..0x6a1fff) to 0x68b000..0x69ffff
add_pages: appending pv 0xc0677d24 (0x6a2000..0x6a5fff) to 0x68b000..0x6a1fff
Creating L1 page table at 0x0068c000
arm32_kernel_vm_init: adding L2 pt (VA 0xc068b000, PA 0x68b000) for VA 0xffff0000
 (vectors)arm32_kernel_vm_init: adding L2 pt (VA 0xc0690000, PA 0x690000) for VA 0xc0000000 (kernel)
arm32_kernel_vm_init: adding L2 pt (VA 0xc0691000, PA 0x691000) for VA 0xc0400000 (kernel)
arm32_kernel_vm_init: adding L2 pt (VA 0xc0692000, PA 0x692000) for VA 0xc1000000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc0693000, PA 0x693000) for VA 0xc1400000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc0694000, PA 0x694000) for VA 0xc1800000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc0695000, PA 0x695000) for VA 0xc1c00000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc0696000, PA 0x696000) for VA 0xc2000000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc0697000, PA 0x697000) for VA 0xc2400000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc0698000, PA 0x698000) for VA 0xc2800000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc0699000, PA 0x699000) for VA 0xc2c00000 (vm)
Mapping kernel
arm32_kernel_vm_init: adding chunk for kernel text 0x8000..0x1cffff (VA 0xc0008000)
add_pages: adding pv 0xc0677c98 (pa 0x8000, va 0xc0008000, 456 pages) before pa 0x68b000
arm32_kernel_vm_init: adding chunk for kernel data/bss 0x1d0000..0x68afff (VA 0xc01d0000)
add_pages: appending pv 0xc0677cfc (0x1d0000..0x68afff) to 0x8000..0x1cffff
add_pages: merging pv 0xc0677cac (0x68b000..0x6a5fff) to 0x8000..0x68afff
Listing Chunks
arm32_kernel_vm_init: pv 0xc0677c98: chunk VA 0xc0008000..0xc06a5fff (PA 0x8000, prot 3, cache 1)

Mapping Chunks
arm32_kernel_vm_init: mapping last chunk VA 0xc0008000..0xc06a5fff (PA 0x8000, prot 3, cache 1)
pmap_map_chunk: pa=0x8000 va=0xc0008000 size=0x69e000 resid=0x69e000 prot=0x3 cache=1
PPPPPPPPLLLLLLLLLLLLLLLSSSSSLLLLLLLLLLPPPPPP
devmap: d8000000 -> d8ffffff @ fe000000
pmap_map_chunk: pa=0xd8000000 va=0xfe000000 size=0x1000000 resid=0x1000000 prot=0x3 cache=0
SSSSSSSSSSSSSSSS
                             Physical              Virtual        Num
                       Starting    Ending    Starting    Ending   Pages
               SDRAM: 0x00000000 0x1fffffff 0xc0000000 0xdfffffff 131072
        text section: 0x00008000 0x001cffff 0xc0008000 0xc01cffff 456
        data section: 0x001d0000 0x00677580 0xc01d0000 0xc0677580 1192
         bss section: 0x00677580 0x0068a74c 0xc0677580 0xc068a74c 20
   L1 page directory: 0x0068c000 0x0068ffff 0xc068c000 0xc068ffff 4
   ABT stack (CPU 0): 0x0069a000 0x0069afff 0xc069a000 0xc069afff 1
   FIQ stack (CPU 0): 0x0069b000 0x0069bfff 0xc069b000 0xc069bfff 1
   IRQ stack (CPU 0): 0x0069c000 0x0069cfff 0xc069c000 0xc069cfff 1
   UND stack (CPU 0): 0x0069d000 0x0069dfff 0xc069d000 0xc069dfff 1
  IDLE stack (CPU 0): 0x0069e000 0x0069ffff 0xc069e000 0xc069ffff 2
           SVC stack: 0x006a0000 0x006a1fff 0xc06a0000 0xc06a1fff 2
      Message Buffer: 0x006a2000 0x006a5fff 0xc06a2000 0xc06a5fff 4
   Exception Vectors: 0x006a6000 0x006a6fff 0xffff0000 0xffff0fff 1
         Free Memory: 0x006a7000 0x1fffffff                       129369
         Free Memory: 0x00000000 0x00007fff                       8
switching to new L1 page table @0x68c000...TTBR0=0x68c000 OK
done.
nfreeblocks = 2, free_pages = 129377 (0x1f961)
bootstrap done.
vectors 0xffff0000
init subsystems: stacks vectors undefined page pmap_physload pmap [ Kernel symbol table missing! ]
done.
Loaded initial symtab at 0xc01d4360, strtab at 0xc01f42a0, # entries 8165
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, 2013
    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.24 (APC) #5: Thu Oct 24 17:27:18 UTC 2013
        root@oct.localdomain:/usr/obj/sys/arch/evbarm/compile/APC
total memory = 512 MB
avail memory = 495 MB
sysctl_createv: sysctl_create(machine_arch) returned 17
mainbus0 (root)
cpu0 at mainbus0 core 0: ARM1176JZ-S r0p7 (ARM11J V6ZK 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
wmicu0 at obio0 addr 0xd8140000-0xd814ffff
wmtmr0 at obio0 addr 0xd8100000-0xd810ffff intr 48 : WMT System Timer
wmtcom0 at obio0 addr 0xd8200000-0xd820ffff intr 32 : WMT UART
rn_init: radix functions require max_keylen be set
boot device: <unknown>
root on md0a dumps on md0b
mountroot: trying nfs...
mountroot: trying msdos...
mountroot: trying ffs...
root file system type: ffs
WARNING: no TOD clock present
WARNING: using filesystem time
WARNING: CHECK AND RESET THE DATE!
init: copying out flags `-s' 3
init: copying out path `/sbin/init' 11
erase ^?, werase ^W, kill ^U, intr ^C

# ls /
.profile        kern            sbin            sysinstmsgs.fr  usr
bin             libexec         sysinst         sysinstmsgs.pl  var
dev             mnt             sysinstmsgs.de  targetroot
etc             mnt2            sysinstmsgs.es  tmp
# ls /usr/sbin
chroot
# ls /usr/bin
cu        gunzip    gzip      more      sed       tip
ftp       gzcat     less      progress  tar       tset
# ls /bin
cat   chmod dd    ed    ls    mv    pwd   rmdir stty
chgrp cp    df    ln    mkdir pax   rm    sh    sync
# echo hello > /foo.txt
# cat /foo.txt
hello
#

NetBSD/evbarm (APC8750) 2013/8/16
2013/08/16(金) 26:53 NetBSD はてブ情報 はてブに登録 はてブ数

少しだけ進みました。
NetBSD/evbarm (APC) booting ...
[ Kernel symbol table missing! ]
Loaded initial symtab at 0xc01b4364, strtab at 0xc01d3494, # entries 7940
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, 2013
    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.23 (APC) #16: Fri Aug 16 16:42:14 UTC 2013
        root@builder.localdomain:/usr/obj/sys/arch/evbarm/compile/APC
total memory = 512 MB
avail memory = 499 MB
mainbus0 (root)
cpu0 at mainbus0 core 0: ARM1176JZ-S r0p7 (ARM11J V6ZK 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
wmicu0 at obio0 addr 0xd8140000-0xd814ffff
com0 at obio0 addr 0xd8200000-0xd820ffff intr 322: ns8250 or ns16450, no fifo
com0: console
wmtmr0 at obio0 addr 0xd8100000-0xd810ffff intr 48: VC System Timer
rn_init: radix functions require max_keylen be set
boot device: <unknown>
root device:
えらい苦労して、割り込みコントローラ(wmicu)をシリアル(com)の前にアタッチさせて、表示上はうまく動いているように見えますが、肝心のシリアルで入力ができないです。

昨日からの変更点をつらつらまとめておきます。

comがxintを使っていたのをintrに変えました。xintをIRQと勘違いしていました。sizeも指定が必要で64kB (0x10000) を使っています。intrは32です。サイズ指定に伴い、bus_space_mapの第三引数を8の即値からoba->oba_sizeに変更しました。

addrに仮想アドレスを指定していたものを物理アドレスに変更しました。昨日の、Fatal kernel mode data abortのエラーは、これで収まりました。いい加減な話ですが、エラーメッセージで検索すると、物理・仮想アドレス周りが怪しいということで。

これ以外にもdata abort関連のエラーに遭遇しました。大げさなエラーですが、たいていはゼロで割ったり、NULLを参照したり、自分で書いたプログラムが大抵バグを引き起こしていました。多くは、コンパイルを通すためにコメントアウトしたり、中身を見ないで適当な辻褄合わせをしたところでした。結局は負債となって、自分に帰ってくるだけですね。

obioはcomよりもwmicuを先にattachさせるために、obio_attach_criticalという関数を一つ書きました。そこでconfig_foundを呼ぶことでwmicuを先に呼び出します。kern/subr_autoconf.cの中をさまよって、結局のところXXX_matchが呼ばれた時の戻り値の大きいものをattachするということがわかったので、wm8750_intr.cのmatchの戻り値を(とりあえず)10にしておきました。

obio_attach_criticalの方法は、@nonakapさんからxscale/pxa2x0.cでも同様のことをやっていることを教えてもらい、それを真似したものです。とはいえ、なんとなく強引な気もします。きっと、attachの順序のルールを読み解けば、なんとかなるんじゃないかと思って、あれこれやってみたのですが、結局はダメでした。たとえば、デバイス名のアルファベット順にattachするのでは、などと思いましたが、まったく関係がありません。完全には追えていませんが、files.XXXXのインクルードされた順、というのが現時点での「だいたいあってる」回答のようです。実際には、configされた時点で決まるようで、自動生成されるevbarm/compile/obj/APC/ioconf.cの記述が手掛かりのようです。ちなみに、これを手で直すのはやめといたほうがよいそうです。このあたりは、@cvsyncさんにもアドバイスをいただきました。

wmtmrはコンパイルを通すために削除していたbus_space_mapを復活させました。ちなみに、comが先にattachされている時代に、wm8750_tmr.cのdelayが呼ばれて落ちるという事象がありました。delayの中でscのNULLチェックに引っかかってpanicしていました。attachされる前なので当然です。仕方がないので、NULLであれば黙ってreturnするという処理でごまかしました。matchの戻り値でコントロールすれば、このごまかし処理も不要になりそうですね。

wmintrもwmtmrと同様にbus_space_mapを復活させました。ぐらいかな。matchの戻り値の増加は先の説明のとおりです。実は、割り込みコントローラが2個あるのですが、二つ目のコントローラ分はサボっています。そもそも、ちゃんと動いているのかわからないし。

com, obioをevbarm/apcからarm/wmtに移しました。com, obioはもともとevbarm/hdl_gからコピーしてきたものなのでevbarm/apcにありましたが、WM8750的にはオンボードということでarm/wmtがいいかなぁということで。

全体的に、モグラたたきをしながらボチボチ進めている感じです。
シリアルがちゃんと動くようになれば、mdで/sbin/initぐらいまで行けたりしますかね。シリアルは、入力だけでなく出力も遅すぎなので、いろいろ足りてない感じなんでしょうね。

NetBSD/evbarm (APC8750)
2013/08/15(木) 28:59 NetBSD はてブ情報 はてブに登録 はてブ数

ここまで進んだー。
わーい。Raspberry PIをベースにしています。

モノはこれです。
http://apc.io/products/8750a/
WMT # set serverip 192.168.0.10
WMT # tftpboot 8000 netbsd.bin
EEP-less strapping = TRUE
TFTP from server 192.168.0.10; our IP address is 192.168.0.2
Filename 'netbsd.bin'.
Load address: 0x8000
Loading: #################################################################
         #################################################################
         #######################################T ##########################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ######################################
done
Bytes transferred = 2520256 (2674c0 hex)
WMT # go 8000
## Starting application at 0x00008000 ...
00008328
NetBSD
00000000 00000000 0048096b 00000412
00000000 00000412 00000004 00000412
c0000000 00000000 0048096b 0000041e
00003000 0000041e 00000004 0000041e
fe000000 d8000000 010fffff 00000412
00003f80 d8000412 00000010 00000412
00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000

NetBSD/evbarm (APC) booting ...
initarm: Configuring system ...
arm32_bootmem_init: memstart=0, memsize=0x20000000, kernelstart=0x8000
arm32_bootmem_init: kernelend=0x281000
arm32_bootmem_init: adding 130431 free pages: [0x281000..0x1fffffff] (VA 0xc0281000)
arm32_bootmem_init: adding 8 free pages: [0..0x7fff] (VA 0xc0000000)
arm32_kernel_vm_init: 1 L2 pages are needed to map 0x2ac000 kernel bytes
arm32_kernel_vm_init: allocating page tables for vectoradd_pages: adding pv 0xc026fbe8 (pa 0x281000, va 0xc0281000, 1 pages) at tail
 kerneladd_pages: appending pv 0xc026fe70 (0x282000..0x282fff) to 0x281000..0x281fff
 vmadd_pages: appending pv 0xc026fe84 (0x283000..0x283fff) to 0x281000..0x282fff
add_pages: appending pv 0xc027892c (0x284000..0x287fff) to 0x281000..0x283fff
add_pages: appending pv 0xc026fe98 (0x288000..0x288fff) to 0x281000..0x287fff
add_pages: appending pv 0xc026feac (0x289000..0x289fff) to 0x281000..0x288fff
add_pages: appending pv 0xc026fec0 (0x28a000..0x28afff) to 0x281000..0x289fff
add_pages: appending pv 0xc026fed4 (0x28b000..0x28bfff) to 0x281000..0x28afff
add_pages: appending pv 0xc026fee8 (0x28c000..0x28cfff) to 0x281000..0x28bfff
add_pages: appending pv 0xc026fefc (0x28d000..0x28dfff) to 0x281000..0x28cfff
add_pages: appending pv 0xc026ff10 (0x28e000..0x28efff) to 0x281000..0x28dfff
add_pages: appending pv 0xc027016c (0x28f000..0x28ffff) to 0x281000..0x28efff
add_pages: appending pv 0xc0270180 (0x290000..0x290fff) to 0x281000..0x28ffff
add_pages: appending pv 0xc0270194 (0x291000..0x291fff) to 0x281000..0x290fff
add_pages: appending pv 0xc02701a8 (0x292000..0x292fff) to 0x281000..0x291fff
add_pages: appending pv 0xc02701bc (0x293000..0x294fff) to 0x281000..0x292fff
add_pages: appending pv 0xc0270158 (0x295000..0x296fff) to 0x281000..0x294fff
add_pages: appending pv 0xc026fc64 (0x297000..0x29afff) to 0x281000..0x296fff
Creating L1 page table at 0x00284000
arm32_kernel_vm_init: adding L2 pt (VA 0xc0281000, PA 0x281000) for VA 0xffff0000
 (vectors)arm32_kernel_vm_init: adding L2 pt (VA 0xc0282000, PA 0x282000) for VA 0xc0000000 (kernel)
arm32_kernel_vm_init: adding L2 pt (VA 0xc0283000, PA 0x283000) for VA 0xc1000000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc0288000, PA 0x288000) for VA 0xc1400000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc0289000, PA 0x289000) for VA 0xc1800000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc028a000, PA 0x28a000) for VA 0xc1c00000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc028b000, PA 0x28b000) for VA 0xc2000000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc028c000, PA 0x28c000) for VA 0xc2400000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc028d000, PA 0x28d000) for VA 0xc2800000 (vm)
arm32_kernel_vm_init: adding L2 pt (VA 0xc028e000, PA 0x28e000) for VA 0xc2c00000 (vm)
Mapping kernel
arm32_kernel_vm_init: adding chunk for kernel text 0x8000..0x1affff (VA 0xc0008000)
add_pages: adding pv 0xc026fbd4 (pa 0x8000, va 0xc0008000, 424 pages) before pa 0x281000
arm32_kernel_vm_init: adding chunk for kernel data/bss 0x1b0000..0x280fff (VA 0xc01b0000)
add_pages: appending pv 0xc026fc3c (0x1b0000..0x280fff) to 0x8000..0x1affff
add_pages: merging pv 0xc026fbe8 (0x281000..0x29afff) to 0x8000..0x280fff
Listing Chunks
arm32_kernel_vm_init: pv 0xc026fbd4: chunk VA 0xc0008000..0xc029afff (PA 0x8000, prot 3, cache 1)

Mapping Chunks
arm32_kernel_vm_init: mapping last chunk VA 0xc0008000..0xc029afff (PA 0x8000, prot 3, cache 1)
pmap_map_chunk: pa=0x8000 va=0xc0008000 size=0x293000 resid=0x293000 prot=0x3 cache=1
PPPPPPPPLLLLLLLLLLLLLLLSLLLLLLLLLPPPPPPPPPPP
devmap: d8000000 -> d8ffffff @ fe000000
pmap_map_chunk: pa=0xd8000000 va=0xfe000000 size=0x1000000 resid=0x1000000 prot=0x3 cache=0
SSSSSSSSSSSSSSSS
                             Physical              Virtual        Num
                       Starting    Ending    Starting    Ending   Pages
               SDRAM: 0x00000000 0x1fffffff 0xc0000000 0xdfffffff 131072
        text section: 0x00008000 0x001affff 0xc0008000 0xc01affff 424
        data section: 0x001b0000 0x0026f4c0 0xc01b0000 0xc026f4c0 192
         bss section: 0x0026f4c0 0x0028096c 0xc026f4c0 0xc028096c 18
   L1 page directory: 0x00284000 0x00287fff 0xc0284000 0xc0287fff 4
   ABT stack (CPU 0): 0x0028f000 0x0028ffff 0xc028f000 0xc028ffff 1
   FIQ stack (CPU 0): 0x00290000 0x00290fff 0xc0290000 0xc0290fff 1
   IRQ stack (CPU 0): 0x00291000 0x00291fff 0xc0291000 0xc0291fff 1
   UND stack (CPU 0): 0x00292000 0x00292fff 0xc0292000 0xc0292fff 1
  IDLE stack (CPU 0): 0x00293000 0x00294fff 0xc0293000 0xc0294fff 2
           SVC stack: 0x00295000 0x00296fff 0xc0295000 0xc0296fff 2
      Message Buffer: 0x00297000 0x0029afff 0xc0297000 0xc029afff 4
   Exception Vectors: 0x0029b000 0x0029bfff 0xffff0000 0xffff0fff 1
         Free Memory: 0x0029c000 0x1fffffff                       130404
         Free Memory: 0x00000000 0x00007fff                       8
switching to new L1 page table @0x284000...TTBR0=0x284000 OK
done.
nfreeblocks = 2, free_pages = 130412 (0x1fd6c)
bootstrap done.
vectors 0xffff0000
init subsystems: stacks vectors undefined page pmap_physload pmap [ Kernel symbol table missing! ]
done.
Loaded initial symtab at 0xc01b4390, strtab at 0xc01d34f0, # entries 7943
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, 2013
    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.23 (APC) #8: Thu Aug 15 19:47:45 UTC 2013
        root@builder.localdomain:/usr/obj/sys/arch/evbarm/compile/APC
total memory = 512 MB
avail memory = 499 MB
mainbus0 (root)
cpu0 at mainbus0 core 0: ARM1176JZ-S r0p7 (ARM11J V6ZK 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
com0 at obio0 addr 0xfe200000 xint -1071199468data_abort_handler: data_aborts fsr=0x1808 far=0xca070000
Fatal kernel mode data abort: 'External Non-Linefetch Abort (S)'
trapframe: 0xc0296d00
FSR=00001808, FAR=ca070000, spsr=800001d3
r0 =00000000, r1 =ca070000, r2 =00000001, r3 =00000000
r4 =c1a55d88, r5 =c02702fc, r6 =c0296d5b, r7 =c01b16dc
r8 =c018c70c, r9 =c0180f38, r10=00000000, r11=c0296d7c
r12=c000f0d4, ssp=c0296d50, slr=c001297c, pc =c000f0d4

Stopped in pid 0.1 (system) at  netbsd:generic_bs_w_1:  strb    r3, [r1, r2]
db>

BeagleBone Black でNetBSD
2013/05/14(火) 24:16 NetBSD はてブ情報 はてブに登録 はてブ数

BeagleBone Blackを買いました。

http://beagleboard.org/Products/BeagleBone%20Black

シリアルは秋月のFDTI USBシリアルケーブル(3.3V) がぴったりです。
電源はminiUSBで給電して動作しました。

20130514_235422~01.jpg

スペック概要は次の表のとおりです。
CPUAM3359 ARM Cortex-A8 1GHz
Memory 2GB on-board storage using eMMC, 512MB DDR3 (800MHz x 16), microSD card slot
USBHS USB 2.0 Client Port, LS/FS/HS USB 2.0 Host Port
VideomicroHDMI, cape add-ons
AudiomicroHDMI, cape add-ons
Supported Interfaces4x UART, 8x PWM, LCD, GPMC, MMC1, 2x SPI, 2x I2C, A/D Converter, 2xCAN Bus, 4 Timers
購入したのはTechShareで、価格は5,460円 (送料210円) でした。5/11に注文して5/13に到着だったので思った以上に早く到着しました。

NetBSDを動かすわけですが、前のモデルのBeagleBoneのkernelがあるので、それを起動させてみることにしました。

シリアルをつないで起動するとU-bootが起動します。

素早く、enterを押してU-bootのプロンプトに。

FATでフォーマットしたmicroSDにnetbsd.binをロードして、起動します。
U-Boot# fatload mmc 0 80300000 netbsd.bin
reading netbsd.bin
2997696 bytes read in 346 ms (8.3 MiB/s)
U-Boot# go 80300000
## Starting application at 0x80300000 ...
deghuboot arg = 0x1, 0x9fe4368c, 0x9fe4368c, 0x80300000
sdram_config = 0x61c05332
[ Kernel symbol table missing! ]
Loaded initial symtab at 0x80554d78, strtab at 0x8057c198, # entries 10034
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, 2013
    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.19 (BEAGLEBONE) #0: Sat May 11 00:21:12 UTC 2013
        builds@b6.netbsd.org:/home/builds/ab/HEAD/evbarm/201305102100Z-obj/home/builds/ab/HEAD/src/sys/arch/evbarm/compile/BEAGLEBONE
total memory = 512 MB
avail memory = 498 MB
cprng kernel: WARNING insufficient entropy at creation.
mainbus0 (root)
cpu0 at mainbus0 core 0: 550 MHz Cortex-A8 r3p2 (Cortex V7A core)
cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu0: 32KB/64B 4-way L1 Instruction cache
cpu0: 32KB/64B 4-way write-back-locking-C L1 Data cache
cpu0: 256KB/64B 8-way write-through L2 Unified cache
vfp0 at cpu0: NEON MPE (VFP 3.0+)
obio0 at mainbus0 base 0x44000000-0x4fffffff: On-Board IO
omapicu0 at obio0 addr 0x48200000-0x48200fff intrbase 0
prcm0 at obio0 addr 0x44e00000-0x44e01fff: Power, Reset and Clock Management
sitaracm0 at obio0 addr 0x44e10000-0x44e11fff: control module, rev 1.0
gpmc0 at mainbus0 base 0x50000000: General Purpose Memory Controller, rev 6.0
gpmc0: CS#0 valid, addr 0x08000000, size 256MB
com0 at obio0 addr 0x44e09000-0x44e09fff intr 72: ns16550a, working fifo
com0: console
sdhc0 at obio0 addr 0x48060100-0x48060fff intr 64: SDHC controller
sdhc0: SD Host Specification 2.0, rev.49
sdmmc0 at sdhc0 slot 0
sdhc1 at obio0 addr 0x481d8100-0x481d8fff intr 28: SDHC controller
sdhc1: SD Host Specification 2.0, rev.49
sdmmc1 at sdhc1 slot 0
tiiic0 at obio0 addr 0x44e0b000-0x44e0bfff intr 70: rev 0.11
iic0 at tiiic0: I2C bus
seeprom0 at iic0 addr 0x50: AT24Cxx EEPROM: size 32768
tps65217pmic0 at iic0 addr 0x24: TPS65217C Power Management Multi-Channel IC (rev 1.2)
tps65217pmic0: power sources [USB] max 300 mA, AC max 2500 mA
tps65217pmic0: [LDO1: 1800 mV] [LDO2: 3300 mV] [LDO3: 1800 mV] [LDO4: 3300 mV] [DCDC1: 1500 mV] [DCDC2: 1100 mV] [DCDC3: 1100 mV]
omapdmtimer0 at obio0 addr 0x48040000-0x48040fff intr 68: DMTIMER2
omapdmtimer1 at obio0 addr 0x44e31000-0x44e31fff intr 67: DMTIMER1ms
omapdmtimer2 at obio0 addr 0x48044000-0x48044fff intr 92: DMTIMER4
omapwdt32k0 at obio0 addr 0x44e35000-0x44e35fff: rev 0.1
cpsw0 at obio0 addr 0x4a100000-0x4a107fff intrbase 40: TI CPSW Ethernet
cpsw0: Ethernet address XX:XX:XX:XX:XX:XX
ukphy0 at cpsw0 phy 2WARNING: module error: vfs load failed for `miiverbose', error 45
: OUI 0x00800f, model 0x000f, rev. 1
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
ld0 at sdmmc1: <0xfe:0x014e:MMC02G:0x00:0x48168605:0x000>
ld0: 1832 MB, 930 cyl, 64 head, 63 sec, 512 bytes/sect x 3751936 sectors
ld0: 4-bit width, bus clock 52.000 MHz
ld1 at sdmmc0: <0x03:0x5344:SU16G:0x80:0x6161a51b:0x0b6>
ld1: 15193 MB, 7717 cyl, 64 head, 63 sec, 512 bytes/sect x 31116288 sectors
ld1: 4-bit width, bus clock 25.000 MHz
cprng sysctl: WARNING insufficient entropy at creation.
boot device: <unknown>
root device:
root deviceを聞くところまであっさりと起動しましたね。

microSDにファイルシステムを作ってあげれば、さらに先に進めそうな気がしますね。

USL-5Pとudlとwsconsとttys
2013/01/05(土) 16:38 NetBSD はてブ情報 はてブに登録 はてブ数

せっかくインストールしたUSL-5Pもシリアルやssh経由だけで使うのも何とも味気ないものですから、豊富なUSBポートを活用してディスプレイとキーボードをつないでみましょう。

ディスプレイはCentury LCD-8000U, キーボードはELECOM TK-UP84CPWHです。

もちろんX Window Systemを動かすのが見た目のインパクトも大きいのですが、kernelにもXにもパッチが必要で割と手間がかかります。ということで、まずはコンソールだけでもやってみようと思ったのであります。

2012年3月にもコンソールに挑戦して敗北していることもあって、いっちょう今回は逃げずに頑張ってみましょうと。

結論から言うと動きました。

pg92onUSL5P.jpg

landiskに関してはkernelに
options         WSEMUL_VT100            # VT100 / VT220 emulation
を定義して作り直す必要がありました。これをつけないと
wsconscfg: WSDISPLAYIO_ADDSCREEN: Device not configured
というエラーメッセージが出てしまいます。実は、これはwscons.confの
screen  1       -       vt100
に書かれているvt100をみて、wsconsが「vt100のエミュレーションないなー、デバイスコンフィグできませんなー」ということのようですね。

wsconscfgコマンドを使うとわかるのですが、
usl5p# wsconscfg -e dumb 1
usl5p# wsconscfg -e vt100 1
てな具合で、知っている端末エミュレーションだとエラーを出さずに成功し、
usl5p# wsconscfg -e sun 1
wsconscfg: WSDISPLAYIO_ADDSCREEN: Device not configured
てな具合で、知らない端末エミュレーションだと上のようなエラーを出すようです。知らない端末だと教えてくれるといいんですけど、wsdisplay.c#364あたりからすると、return ENXIO つまりDevice not configuredを返しているので、そこまでハンドリングできないようです。

そしてなぜか、screen 2, screen 3を作ろうとすると、メモリをアロケートできませんというエラーが出ます。
options        WSDISPLAY_DEFAULTSCREENS=4
をカーネルのコンフィグに足してみましたが、状況変わらず。これについてはちょっとあきらめることにしました。

先のwscons.confで作ったscreenに対応するttyがttysに書かれた/dev/ttyE1になるようですね。
ttyE1   "/usr/libexec/getty Pc"         vt220   on secure
よくわかっていないのですが、console = screen 0 = ttyE0と考えておけばよいのかなぁ。そいでもって、screen 1 = ttyE1で有効にしてやれば動くと。

/etc/ttyactionにもこういうの書いてあるし。ttyE0とconsoleは深い関係にありそうですなー。この辺の整合性が取れていないとconsoleでもrootでログインできなくなっちゃったりするんでしょうね。
ttyE0   *       chown ${USER}:tty /dev/console
と思ったらNetBSD/landiskにはなかったな。うーん。

さて、wsconsですが、黒字に白文字というのはいかにもパッとしません。
きっと色ぐらいは変えられるだろうと思い、wsconsctlなどといういかにもなコマンドを発見し、おー、オプションに-aを渡せば設定項目が全部表示されるんだねー。と思い。
usl5p# wsconsctl -a
type=usb
bell.pitch=1500
bell.period=100
bell.volume=50
bell.pitch.default=1500
bell.period.default=100
bell.volume.default=50
wsconsctl: "map" not shown with -a; use "wsconsctl map" to view.
repeat.del1=400
repeat.deln=100
repeat.del1.default=400
repeat.deln.default=100
ledstate=0
encoding=us
keyclick=0
scroll.mode=0
scroll.modifier=1
あれぇ? 色に関する項目がないですねぇ。
どうやら、オプションに-dを与えないとディスプレイ関連の設定値は出てこないんですね。
usl5p# wsconsctl -f /dev/ttyE1 -d -a
type=unknown_49
scroll.fastlines=25
scroll.slowlines=2
msg.default.attrs=color
msg.default.bg=black
msg.default.fg=white
msg.kernel.attrs=color
msg.kernel.bg=black
msg.kernel.fg=white
これで設定がわかりました。白背景に黒文字にしたければ次のようにします。
usl5p# wsconsctl -f /dev/ttyE1 -d -w msg.default.bg=white
msg.default.bg -> white
usl5p# wsconsctl -f /dev/ttyE1 -d -w msg.default.fg=black
msg.default.fg -> black
この設定をwscons.confのsetvarで書いてやればいいみたいですね。

起動時に試してみたら、確かに文字の所は設定が反映されて白背景に黒文字ですけれど、それ以外のスペースの部分は黒いままだったりして... まぁ、ログインしてCtrl-lで全面描画されるので良いんですけど。そもそもの背景色を設定する方法がほかにあるのかもしれません。

設定をまとめておきましょう。

カーネル (実際に必要なのは最後の一行だけですけど)
n601# diff -u GENERIC USL-5P.nfs
--- GENERIC     2013-01-05 18:03:35.000000000 +0000
+++ USL-5P.nfs  2013-01-05 18:06:35.000000000 +0000
@@ -175,8 +175,8 @@

 # Kernel root file system and dump configuration.
 #config                netbsd  root on ? type ?
-config         netbsd  root on wd0a type ffs
-#config                netbsd  root on ? type nfs
+#config                netbsd  root on wd0a type ffs
+config         netbsd  root on ? type nfs


 #
@@ -224,8 +224,8 @@
 # The 0x0001 flag force the driver to use DMA, even if the driver doesn't know
 # how to set up DMA modes for this chip. This may work, or may cause
 # a machine hang with some controllers.
-pciide*        at pci? dev ? function ? flags 0x0000   # GENERIC pciide driver
-acardide*      at pci? dev ? function ?        # Acard IDE controllers
+#pciide*       at pci? dev ? function ? flags 0x0000   # GENERIC pciide driver
+#acardide*     at pci? dev ? function ?        # Acard IDE controllers

 wdc0   at obio? port 0x14000000 irq 10         # CF
 #wdc1  at obio? port 0x18000000 irq 9          # iConnect
@@ -477,3 +477,14 @@
 # wscons pseudo-devices
 pseudo-device  wsmux                   # mouse & keyboard multiplexor
 #pseudo-device wsfont
+
+options        WSDISPLAY_CUSTOM_OUTPUT # color customization from wsconsctl(8)
+options        WSDISPLAY_CUSTOM_BORDER # custom border colors via wsconsctl(8)
+#options       WSDISPLAY_BORDER_COLOR=WSCOL_BLUE       # default color
+options        WSDISPLAY_COMPAT_PCVT           # emulate some ioctls
+options        WSDISPLAY_COMPAT_SYSCONS        # emulate some ioctls
+options        WSDISPLAY_COMPAT_USL            # wsconscfg VT handling
+options        WSDISPLAY_COMPAT_RAWKBD         # can get raw scancodes
+#options       WSDISPLAY_DEFAULTSCREENS=4
+options        WSDISPLAY_SCROLLSUPPORT
+options        WSEMUL_VT100            # VT100 / VT220 emulation
/etc/rc.conf
wscons=YES
/etc/ttys
console "/usr/libexec/getty std.9600"   vt220   on secure
constty "/usr/libexec/getty std.9600"   vt220   off secure
ttyE0   "/usr/libexec/getty Pc"         vt220   off secure
ttyE1   "/usr/libexec/getty Pc"         vt220   on secure
ttyE2   "/usr/libexec/getty Pc"         vt220   off secure
ttyE3   "/usr/libexec/getty Pc"         vt220   off secure
tty00   "/usr/libexec/getty std.9600"   unknown off secure
tty01   "/usr/libexec/getty std.9600"   unknown off secure
tty02   "/usr/libexec/getty std.9600"   unknown off secure
tty03   "/usr/libexec/getty std.9600"   unknown off secure
tty04   "/usr/libexec/getty std.9600"   unknown off secure
tty05   "/usr/libexec/getty std.9600"   unknown off secure
tty06   "/usr/libexec/getty std.9600"   unknown off secure
tty07   "/usr/libexec/getty std.9600"   unknown off secure

/etc/wscons.conf (screensの部分とsetvarの部分を抜粋)
#screen 0       -       vt100
screen  1       -       vt100
#screen 2       -       vt100
#screen 3       -       vt100
#screen 4       -       -

setvar ttyE1    msg.default.bg  white
setvar ttyE1    msg.default.fg  black