NanoPi NEO2でFreeBSDを動かすメモ

やること

NanoPi NEO2でFreeBSDを無理やり動かしてみた。

ソースのチェックアウト

SubversionFreeBSDソースコードをチェックアウトする。

cd /usr
svnlite co svn://svn.freebsd.org/base/head src

NTPD用ユーザー作成

20180719にntpdは専用のユーザーで動かすようになったらしいので、ユーザーを作っておく。

pw groupadd -g 123 -n ntpd
pw useradd -n ntpd -u 123 -g ntpd -s /usr/sbin/nologin -w none

u-boot

nanopi用のu-bootがなかったため、NanoPi NEO2と同じAllwinner H5を使っているorange Pi Pc2用u-bootをportsからインストールする。

cd /usr/ports/sysutils/u-boot-orangepi-pc2
make install

NanoPi NEO2用Crochetでビルド

NanoPi NEO2用にCrochetをカスタマイズした。それをgithubから持ってくる。

github.com

mkdir ~/nanopineo2
cd ~/nanopineo2
git clone https://github.com/rixwwd/crochet.git
cd crochet
git checkout nanopi-neo2

ビルドオプションなどをつけたい場合は、

./crochet.sh -c config.sh

特に何も気にしない場合は、

./crochet.sh -b nanopi-neo2

ビルド完了まで待つ。(結構かかる)

SDに書き込む

crochetのwordにFreeBSD-aarch64-12.0-GENERIC-336857-nanopi-neo2.imgのようにSDカードのイメージができる。 いつも通りddで書き込んで完了。

dmesg

KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2018 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
    The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.0-CURRENT #0 r336857: Sun Jul 29 16:50:21 JST 2018
    root@freebsd-vbox:/root/nanopineo2/crochet/work/obj/usr/src/arm64.aarch64/sys/GENERIC arm64
FreeBSD clang version 6.0.1 (tags/RELEASE_601/final 335540) (based on LLVM 6.0.1)
WARNING: WITNESS option enabled, expect reduced performance.
VT: init without driver.
Starting CPU 1 (1)
Starting CPU 2 (2)
Starting CPU 3 (3)
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
random: unblocking device.
random: entropy device external interface
MAP 47fff000 mode 2 pages 1
MAP 48003000 mode 2 pages 1
MAP 58f16000 mode 2 pages 1
MAP 5dfb8000 mode 2 pages 1
kbd0 at kbdmux0
ofwbus0: <Open Firmware Device Tree>
ofw_clkbus0: <OFW clocks bus> on ofwbus0
clk_fixed0: <Fixed clock> on ofw_clkbus0
clk_fixed1: <Fixed clock> on ofw_clkbus0
clk_fixed2: <Fixed factor clock> on ofw_clkbus0
simplebus0: <Flattened device tree simple bus> on ofwbus0
ccu_h3ng0: <Allwinner H3/H5 Clock Control Unit NG> mem 0x1c20000-0x1c203ff on simplebus0
regfix0: <Fixed Regulator> on simplebus0
psci0: <ARM Power State Co-ordination Interface Driver> on ofwbus0
gic0: <ARM Generic Interrupt Controller> mem 0x1c81000-0x1c81fff,0x1c82000-0x1c82fff,0x1c84000-0x1c85fff,0x1c86000-0x1c87fff irq 28 on simplebus0
gic0: pn 0x2, arch 0x2, rev 0x1, implementer 0x43b irqs 224
gpio0: <Allwinner GPIO/Pinmux controller> mem 0x1c20800-0x1c20bff irq 17,18,19 on simplebus0
gpiobus0: <OFW GPIO bus> on gpio0
gpio1: <Allwinner GPIO/Pinmux controller> mem 0x1f02c00-0x1f02fff irq 32 on simplebus0
gpio1: Could not find clock at offset 0 (19)
device_attach: gpio1 attach returned 6
gpio1: <Allwinner GPIO/Pinmux controller> mem 0x1f02c00-0x1f02fff irq 32 on simplebus0
gpio1: Could not find clock at offset 0 (19)
device_attach: gpio1 attach returned 6
generic_timer0: <ARMv8 Generic Timer> irq 0,1,2,3 on ofwbus0
Timecounter "ARM MPCore Timecounter" frequency 24000000 Hz quality 1000
Event timer "ARM MPCore Eventtimer" frequency 24000000 Hz quality 1000
rtc0: <Allwinner RTC> mem 0x1f00000-0x1f00053 irq 29,30 on simplebus0
rtc0: registered as a time-of-day clock, resolution 1.000000s
gpio1: <Allwinner GPIO/Pinmux controller> mem 0x1f02c00-0x1f02fff irq 32 on simplebus0
gpio1: Could not find clock at offset 0 (19)
device_attach: gpio1 attach returned 6
awusbphy0: <Allwinner USB PHY> mem 0x1c19400-0x1c1942b,0x1c1a800-0x1c1a803,0x1c1b800-0x1c1b803,0x1c1c800-0x1c1c803,0x1c1d800-0x1c1d803 on simplebus0
gpio1: <Allwinner GPIO/Pinmux controller> mem 0x1f02c00-0x1f02fff irq 32 on simplebus0
gpio1: Could not find clock at offset 0 (19)
device_attach: gpio1 attach returned 6
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
cpu1: <Open Firmware CPU> on cpulist0
cpu2: <Open Firmware CPU> on cpulist0
cpu3: <Open Firmware CPU> on cpulist0
syscon_generic0: <syscon> mem 0x1c00000-0x1c00fff on simplebus0
aw_mmc0: <Allwinner Integrated MMC/SD controller> mem 0x1c0f000-0x1c0ffff irq 5 on simplebus0
mmc0: <MMC/SD bus> on aw_mmc0
ehci0: <Allwinner Integrated USB 2.0 controller> mem 0x1c1a000-0x1c1a0ff irq 9 on simplebus0
usbus0: EHCI version 1.0
usbus0 on ehci0
ohci0: <Generic OHCI Controller> mem 0x1c1a400-0x1c1a4ff irq 10 on simplebus0
usbus1 on ohci0
ehci1: <Allwinner Integrated USB 2.0 controller> mem 0x1c1b000-0x1c1b0ff irq 11 on simplebus0
usbus2: EHCI version 1.0
usbus2 on ehci1
ohci1: <Generic OHCI Controller> mem 0x1c1b400-0x1c1b4ff irq 12 on simplebus0
usbus3 on ohci1
gpioc0: <GPIO controller> on gpio0
aw_wdog0: <Allwinner A31 Watchdog> mem 0x1c20ca0-0x1c20cbf irq 22 on simplebus0
uart0: <16750 or compatible> mem 0x1c28000-0x1c283ff irq 23 on simplebus0
uart0: console (115384,n,8,1)
awg0: <Allwinner Gigabit Ethernet> mem 0x1c30000-0x1c3ffff irq 27 on simplebus0
miibus0: <MII bus> on awg0
rgephy0: <RTL8169S/8110S/8211 1000BASE-T media interface> PHY 0 on miibus0
rgephy0:  none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow
rgephy1: <RTL8169S/8110S/8211 1000BASE-T media interface> PHY 7 on miibus0
rgephy1:  none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow
awg0: Ethernet address: f2:00:xx:xx:xx:xx
gpio1: <Allwinner GPIO/Pinmux controller> mem 0x1f02c00-0x1f02fff irq 32 on simplebus0
gpio1: Could not find clock at offset 0 (19)
device_attach: gpio1 attach returned 6
cryptosoft0: <software crypto>
Timecounters tick every 1.000 msec
usbus0: 480Mbps High Speed USB v2.0
usbus1: 12Mbps Full Speed USB v1.0
usbus2: 480Mbps High Speed USB v2.0
usbus3: 12Mbps Full Speed USB v1.0
ugen1.1: <Generic OHCI root HUB> at usbus1
uhub0: <Generic OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus1
ugen0.1: <Allwinner EHCI root HUB> at usbus0
uhub1: <Allwinner EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
ugen2.1: <Allwinner EHCI root HUB> at usbus2
uhub2: <Allwinner EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus2
ugen3.1: <Generic OHCI root HUB> at usbus3
uhub3: <Generic OHCI root HUB, class 9/0, rev 1.00/1.00, addr 1> on usbus3
mmcsd0: 15GB <SDHC SA16G 2.7 SN 27258937 MFG 05/2017 by 2 TM> at mmc0 50.0MHz/4bit/32768-block
Release APs...done
CPU  0: ARM Cortex-A53 r0p4mmc0: Trying to mount root from ufs:/dev/mmcsd0s2a [rw,noatime]...
 affinity:ACMD42 failed, RESULT: 4
  0mmc0: 
Card at relative address 4660 failed to set bus width
 Instruction Set Attributes 0 = <AES+PMULL,SHA1,SHA2,CRC32>
 Instruction Set Attributes 1 = <>
         Processor Features 0 = <AdvSIMD,Float,EL3 32,EL2 32,EL1 32,EL0 32>
         Processor Features 1 = <0>
      Memory Model Features 0 = <4k Granule,64k Granule,MixedEndian,S/NS Mem,16bit ASID,1TB PA>
      Memory Model Features 1 = <>
      Memory Model Features 2 = <32b CCIDX,48b VA>
             Debug Features 0 = <2 CTX Breakpoints,4 Watchpoints,6 Breakpoints,PMUv3,Debug v8>
             Debug Features 1 = <0>
         Auxiliary Features 0 = <0>
         Auxiliary Features 1 = <0>
CPU  1: ARM Cortex-A53 r0p4 affinity:  1
CPU  2: ARM Cortex-A53 r0p4 affinity:  2
CPU  3: ARM Cortex-A53 r0p4 affinity:  3
WARNING: WITNESS option enabled, expect reduced performance.
uhub0: 1 port with 1 removable, self powered
uhub3: 1 port with 1 removable, self powered
uhub1: 1 port with 1 removable, self powered
uhub2: 1 port with 1 removable, self powered
lo0: link state changed to UP
awg0: link state changed to DOWN
awg0: link state changed to UP