NanoPi NEOでNetBSDを使ってみる

この記事は、NetBSD Advent Calendar 2017の11日目の記事です。 すっかり遅くなっていますが、代わりに投稿できるようになっていたので、 勝手に投稿してしまいます。 とは言っても、小ネタですが…。

はじめに

オープンソースカンファレンス2017 Chibaに行った際に、えびはらさんに、 NanoPi NEOを紹介いただきました。 Allwinner H3と言うsun8iアーキテクチャーのArm Cortex-A7の4コアのCPUと、 512MBのメインメモリーを搭載しています。 ビデオ出力はありません。シリアルコンソールでの接続になります。 また、Gigabit EthernetとUSB 2.0のポートを1つずつ持っています。 私は、秋月電子通商 のウェブサイトで購入しました。

microSDカードを準備する

lNetBSD/evbearmv7hf-elのSUNXIカーネルが使用できます。 NetBSD/evbarm on Allwinner Technology SoCsにある通りですが、 まずはhttp://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/から、 evbarm-earmv7hf/binary/gzimg/armv7.img.gzをダウンロードします。

次に、これを2GB以上のmicroSDカードに書き込みます。 以下のように実行します。


# gzcat armv7.img.gz | dd of=/dev/ld0d bs=1m

AllwinnerのSoCを搭載したマシンで起動させるには、u-bootを使用する必要 があります。 以下のようにして、u-bootのバイナリーを作成します。


$ cd /usr/pkgsrc/sysutils/u-boot-nanopi-neo
$ make install
これで、/usr/pkg/share/u-boot/nanopi-neo/u-boot-sunxi-with-spl.bin にu-bootのバイナリーが作成できました。

このu-bootバイナリーをmicroSDカードに書き込みます。 以下のように操作します。


# dd if=/usr/pkg/share/u-boot/nanopi-neo/u-boot-sunxi-with-spl.bin of=/dev/rld0d bs=1k seek=8 conv=sync
これで、起動する準備ができました。

起動させる

NanoPi NEOのmicroSDカードスロットに挿入し、シリアルコンソールとUTPケーブル も接続してmicro USBケーブルで電源を接続します。

シリアルコンソールで接続するNetBSDマシンでは、以下のように実行して 出力を待っておきます。


$ cu -s 115200 -l /dev/ttyU0
rootユーザーでは、sshでログインできませんので、 特にmicroSDカードの内容を先に変更しておくのでなければ、シリアルコンソールは 必須です。

カーネルの起動メッセージは以下のようになります。


Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017
    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 8.99.9 (SUNXI) #0: Fri Dec 22 11:22:37 UTC 2017
 mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/evbarm/compile/SUNXI
total memory = 512 MB
avail memory = 499 MB
timecounter: Timecounters tick every 10.000 msec
armfdt0 (root)
fdt0 at armfdt0: FriendlyARM NanoPi NEO
fdt1 at fdt0
fdt2 at fdt0
fdt3 at fdt0
cpus0 at fdt0
cpu0 at cpus0: Cortex-A7 r0p5 (Cortex V7A core)
cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu0: 32KB/32B 2-way L1 VIPT Instruction cache
cpu0: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
cpu0: 512KB/64B 8-way write-through L2 PIPT Unified cache
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
cpufreqdt0 at cpu0
cpu1 at cpus0
cpu2 at cpus0
cpu3 at cpus0
gic0 at fdt1: GIC
armgic0 at gic0: Generic Interrupt Controller, 160 sources (150 valid)
armgic0: 16 Priorities, 128 SPIs, 7 PPIs, 15 SGIs
fclock0 at fdt2: 24000000 Hz fixed clock
fclock1 at fdt2: 32768 Hz fixed clock
fclock2 at fdt2: 16000000 Hz fixed clock
gtmr0 at fdt0: Generic Timer
gtmr0: interrupting on GIC irq 27
armgtmr0 at gtmr0: ARMv7 Generic 64-bit Timer (24000 kHz)
timecounter: Timecounter "armgtmr0" frequency 24000000 Hz quality 500
sun8ih3ccu0 at fdt1: H3 CCU
sun8ih3rccu0 at fdt1: H3 PRCM CCU
sunxigpio0 at fdt1: PIO
gpio0 at sunxigpio0: 94 pins
sunxigpio0: interrupting on GIC irq 43
sunxigpio1 at fdt1: PIO
gpio1 at sunxigpio1: 12 pins
sunxigpio1: interrupting on GIC irq 77
fregulator0 at fdt0: vcc3v3
gregulator0 at fdt0: cpux-supply
fregulator1 at fdt0: vcc3v0
fregulator2 at fdt0: vcc5v0
sunxisid0 at fdt1: Security ID EFUSE
sunxiusbphy0 at fdt1: USB PHY
/soc/syscon@1c00000 at fdt1 not configured
sunxiemac0 at fdt1: EMAC
sunxiemac0: interrupting on GIC irq 114
ukphy0 at sunxiemac0 phy 1: OUI 0x0088a0, model 0x0000, rev. 0
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
sun6idma0 at fdt1: DMA controller (12 channels)
sun6idma0: interrupting on GIC irq 82
h3codec0 at fdt1: H3 Audio Codec (analog part)
psci0 at fdt0: PSCI 0.1
gpioleds0 at fdt0: nanopi:blue:status nanopi:green:pwr
gpiokeys0 at fdt0: k1
sunximmc0 at fdt1: SD/MMC controller
sunximmc0: interrupting on GIC irq 92
ehci0 at fdt1: EHCI
ehci0: interrupting on GIC irq 110
ehci0: EHCI version 1.0
ehci0: 1 companion controller, 1 port
usb0 at ehci0: USB revision 2.0
ohci0 at fdt1: OHCI
ohci0: interrupting on GIC irq 111
ohci0: OHCI version 1.0
usb1 at ohci0: USB revision 1.0
sunxitimer0 at fdt1: Timer
timecounter: Timecounter "Timer 2" frequency 24000000 Hz quality 200
sunxiwdt0 at fdt1: Watchdog
sunxiwdt0: default watchdog period is 16 seconds
com0 at fdt1: ns16550a, working fifo
com0: console
com0: interrupting on GIC irq 32
sunxirtc0 at fdt1: RTC
sunxithermal0 at fdt1: Thermal sensor controller
sunxithermal0: interrupting on GIC irq 63
sunxithermal0: cpu: alarm 90C hyst 15C shut 105C
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
cpu2: Cortex-A7 r0p5 (Cortex V7A core)
cpu2: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu2: 32KB/32B 2-way L1 VIPT Instruction cache
cpu2: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
cpu2: 512KB/64B 8-way write-through L2 PIPT Unified cache
vfp2 at cpu2: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
cpu1: Cortex-A7 r0p5 (Cortex V7A core)
cpu1: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu1: 32KB/32B 2-way L1 VIPT Instruction cache
cpu1: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
cpu1: 512KB/64B 8-way write-through L2 PIPT Unified cache
vfp1 at cpu1: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
cpu3: Cortex-A7 r0p5 (Cortex V7A core)
cpu3: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu3: 32KB/32B 2-way L1 VIPT Instruction cache
cpu3: 32KB/64B 4-way write-back-locking-C L1 PIPT Data cache
cpu3: 512KB/64B 8-way write-through L2 PIPT Unified cache
vfp3 at cpu3: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
cpufreqdt0: 1008.000 MHz, 1300000 uV
cpufreqdt0: 816.000 MHz, 1100000 uV
cpufreqdt0: 480.000 MHz, 1100000 uV
sdmmc0 at sunximmc0
uhub0 at usb0: Generic (0000) EHCI root hub (0000), class 9/0, rev 2.00/1.00, addr 1
uhub0: 1 port with 1 removable, self powered
uhub1 at usb1: Generic (0000) OHCI root hub (0000), class 9/0, rev 1.00/1.00, addr 1
uhub1: 1 port with 1 removable, self powered
IPsec: Initialized Security Association Processing.
sdmmc0: SD card status: 4-bit, C10, U1
ld0 at sdmmc0: <0x03:0x5344:SL32G:0x80:0x61532365:0x0f3>
ld0: 29476 MB, 7486 cyl, 128 head, 63 sec, 512 bytes/sect x 60367872 sectors
ld0: 4-bit width, High-Speed/SDR25, 50.000 MHz
boot device: ld0
root on ld0a dumps on ld0b
root file system type: ffs
kern.module.path=/stand/evbarm/8.99.9/modules
これで、emac0と言うネットワークインターフェイスが 使用できます。

まとめ

Friendly ElecのNanoPi NEOで、NetBSD/evbearmv7hf-elのSUNXIカーネルを 起動させ、ネットワーク機能を使うことができました。 ヒートシンクを付けていますが、それなりに暖かくなります。 CPUはコア数も多く速いようなので、USB接続のSSDを付けてpkgsrcの開発に 使用するのが良さそうです。

0 件のコメント:

コメントを投稿

注: コメントを投稿できるのは、このブログのメンバーだけです。

NetBSD上のFirefox 124.0.1で、ClearKey EMEの動作確認をする

pkgsrc/www/firefoxをbuildした後に確認している事項として、ClearKey EMEを利用できるか試している。 以下の2つで、映像と音声が再生できれば問題ないはずと思っている。 dash.jsのClearkey DRM instantiati...