NetBSD/riscv on RZ/Five

普通の手順でLinuxをビルドして動かした後に放置してたRZ/Fiveを起こしてみる。

いや、なんかNetBSD 11の riscv-riscv64/binary/sets/dtb.tgz の中に該当のデバイスツリーがあるんで、いけるんかな?と。

全然仕組みわかってないんだが、SDカードにFATとFFSのパーティション作って、FATの方をEFI風(そのもの?)に efi/boot/bootriscv64.efi を置いて、FFSの方は普通にバイナリを展開。

ブートローダ (spl, fit) はLinuxの時のままなので、ext4のboot/Imageを探しに行って止まる。

U-Boot 2023.10 (Mar 10 2025 - 02:39:04 +0000)

CPU: rv64imafdc
Model: Renesas SMARC EVK based on r9a07g043f01
DRAM: 896 MiB
SW_ET0_EN: OFF
Core: 31 devices, 20 uclasses, devicetree: separate
WDT: watchdog@0000000012800800
WDT: Started watchdog@12800800 with servicing every 1000ms (60s timeout)
MMC: sd@11c00000: 0, sd@11c10000: 1
Loading Environment from MMC... OK
In: serial@1004b800
Out: serial@1004b800
Err: serial@1004b800
Net:
Error: ethernet@11c30000 address not set.
No ethernet found.

Hit any key to stop autoboot: 0
## Resetting to default environment
switch to partitions #0, OK
mmc1 is current device
Can't set block device
Can't set block device
Error: Bad gzipped data
Bad Linux RISCV Image magic!
=>

ここは良くわかってなくてテキトーなんだけど、Linuxのイメージの代わりにefiバイナリを読ませてみる。

=> load mmc 1:1 0x48000000 /r9a07g043f01-smarc.dtb
30707 bytes read in 18 ms (1.6 MiB/s)
=> load mmc 1:1 0x48080000 /efi/boot/bootriscv64.efi
185024 bytes read in 37 ms (4.8 MiB/s)
=> bootefi 0x48080000 0x48000000

すると、

No EFI system partition
No EFI system partition
Failed to persist EFI variables

Error: ethernet@11c30000 address not set.

Error: ethernet@11c30000 address not set.

やっぱダメか、と思ったら、

Booting /\efi\boot\bootriscv64.efi

(この後空行多数)

  \\-__,------,___.
\\ __,---` NetBSD/riscv efiboot (riscv64)
\\ `---,_. Revision 2.15 (Wed Jan 14 04:24:13 UTC 2026)
\\-,_____,.---`
\\
\\
\\

Press return to boot now, any other key for boot prompt
booting netbsd - starting in 0 seconds.
4613090+1897760+1470052+627100 [606192+368729]=0xaeea50

キター?

------------
NetBSD start

sp: 0x0000_0000_75e0_3000
pc: 0x0000_0000_7560_0080
hart: 0x0000_0000_0000_0000
dtb: 0x0000_0000_7620_0000
vendor: 0x0000_0000_0000_031e
l1: 0x0000_0000_75e0_c000
l2: 0x0000_0000_75e0_b000
uspace: 0x0000_0000_75e0_1000
bootstk: 0x0000_0000_75e0_3000
vtopdiff:0xffff_ffbf_8aa0_0000

bss: 0x0000_0000_75f6_6e64 - 0x0000_0000_75e0_d000

l2pde: 0x0000_0000_75e0_b800: 0x0000_0000_1d78_3001

kern: 0x0000_0000_75e0_c000: 0x0000_0000_1d58_00ef
kern: 0x0000_0000_75e0_c008: 0x0000_0000_1d60_00ef
kern: 0x0000_0000_75e0_c010: 0x0000_0000_1d68_00ef
kern: 0x0000_0000_75e0_c018: 0x0000_0000_1d70_00ef
kern: 0x0000_0000_75e0_c020: 0x0000_0000_1d78_00ef
kern: 0x0000_0000_75e0_c028: 0x0000_0000_1d80_00ef
kern: 0x0000_0000_75e0_c030: 0x0000_0000_1d88_00ef
kern: 0x0000_0000_75e0_c038: 0x0000_0000_1d90_00ef
kern: 0x0000_0000_75e0_c040: 0x0000_0000_1d98_00ef
kern: 0x0000_0000_75e0_c048: 0x0000_0000_1da0_00ef
kern: 0x0000_0000_75e0_c050: 0x0000_0000_1da8_00ef
kern: 0x0000_0000_75e0_c058: 0x0000_0000_1db0_00ef
kern: 0x0000_0000_75e0_c060: 0x0000_0000_1db8_00ef
kern: 0x0000_0000_75e0_c068: 0x0000_0000_1dc0_00ef
kern: 0x0000_0000_75e0_c070: 0x0000_0000_1dc8_00ef
kern: 0x0000_0000_75e0_c078: 0x0000_0000_1dd0_00ef
dtb: 0x0000_0000_75e0_c080: 0x0000_0000_1d88_00e7
PM
[ 1.0000000] FDT<0xffffffc002000000>
[ 1.0000000] devmap 0xffffffc00082f610
[ 1.0000000] bootstrap
[ 1.0000000] stdout
[ 1.0000000] fdt size 8000/79b6
[ 1.0000000] consinit ok
[ 1.0000000] NetBSD/riscv (fdt) booting ...
[ 1.0000000] FDT /memory @ 0x48000000 size 0x10000000
[ 1.0000000] FDT /memory @ 0x60000000 size 0x166cd000
[ 1.0000000] FDT /memory @ 0x766d1000 size 0x830000
[ 1.0000000] FDT /memory @ 0x76f22000 size 0x9028000
[ 1.0000000] FDT /memory @ 0x7ff4b000 size 0xb5000
[ 1.0000000] init_riscv: memory start 48000000 end 80000000 (len 38000000)
[ 1.0000000] cpu_kernel_vm_init: kernel phys start 0x75600000 end 0x76000000
[ 1.0000000] dm: 0xffffffc00080bc08 : 0x100000e7
[ 1.0000000] bootargs: rw rootwait earlycon root=/dev/mmcblk1p2
[ 1.0000000] msgbufaddr = 0xffffffe07fff0000
[ 1.0000000] ------------------------------------------
[ 1.0000000] kern_vtopdiff = 0xffffffbf8aa00000
[ 1.0000000] memory_start = 0x 48000000
[ 1.0000000] memory_end = 0x 80000000
[ 1.0000000] memory_size = 0x 38000000
[ 1.0000000] kernstart_phys = 0x 75600000
[ 1.0000000] kernend_phys = 0x 76000000
[ 1.0000000] msgbufaddr = 0xffffffe07fff0000
[ 1.0000000] VM_MIN_KERNEL_ADDRESS = 0xffffffc000000000
[ 1.0000000] kernstart_mega = 0xffffffc000000000
[ 1.0000000] kernstart = 0xffffffc000000000
[ 1.0000000] kernend = 0xffffffc000a00000
[ 1.0000000] kernend_mega = 0xffffffc000a00000
[ 1.0000000] VM_MAX_KERNEL_ADDRESS = 0xffffffd000000000
[ 1.0000000] pmap_direct_base = 0xffffffe000000000
[ 1.0000000] ------------------------------------------
[ 1.0000000] adding 0x48000000 - 0x58000000 to freelist 0
[ 1.0000000] adding 0x60000000 - 0x75600000 to freelist 0
[ 1.0000000] adding 0x76000000 - 0x76200000 to freelist 0
[ 1.0000000] adding 0x76208000 - 0x766cd000 to freelist 0
[ 1.0000000] adding 0x766d1000 - 0x76f01000 to freelist 0
[ 1.0000000] adding 0x76f22000 - 0x7ff4a000 to freelist 0
[ 1.0000000] adding 0x7ff4b000 - 0x7fff0000 to freelist 0
[ 1.0000000] common cpusets bs_pde 0xffffffc00080b000 ASID max 1ff kcpusets nkmempages limits: ffffffc004000000 - ffffffd000000000
[ 1.0000000] kva : ffffffc004000000 - ffffffc041a00000
[ 1.0000000] mpstart
[ 1.0000000] Loaded initial symtab at 0xffffffc000869b68, strtab at 0xffffffc0008fdb58, # entries 23984
[ 1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
[ 1.0000000] 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
[ 1.0000000] 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023,
[ 1.0000000] 2024, 2025, 2026
[ 1.0000000] The NetBSD Foundation, Inc. All rights reserved.
[ 1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
[ 1.0000000] The Regents of the University of California. All rights reserved.

[ 1.0000000] NetBSD 11.0_BETA (GENERIC64) #0: Wed Jan 14 13:33:46 JST 2026
[ 1.0000000] compile@xaveria.iwate.ceres.ne.jp:/home/compile/build/20260114_11.0_BETA/riscv64/obj/sys/arch/riscv/compile/GENERIC64
[ 1.0000000] total memory = 775944 KB
[ 1.0000000] avail memory = 750436 KB
[ 1.0000000] mainbus0 (root)
[ 1.0000000] simplebus0 at mainbus0: Renesas SMARC EVK based on r9a07g043f01
[ 1.0000000] simplebus1 at simplebus0
[ 1.0000000] cpus0 at simplebus0
[ 1.0000000] simplebus2 at simplebus0
[ 1.0000000] cpu0 at cpus0: vendor 31e arch 8000000000008a45 imp. 500
[ 1.0000000] fclock0 at simplebus0: 11289600 Hz fixed clock (audio1-clk)
[ 1.0000000] fclock1 at simplebus0: 12288000 Hz fixed clock (audio2-clk)
[ 1.0000000] fclock2 at simplebus0: 0 Hz fixed clock (can-clk)
[ 1.0000000] fclock3 at simplebus0: 24000000 Hz fixed clock (x1-clock)
[ 1.0000000] fclock4 at simplebus0: 24000000 Hz fixed clock (extal-clk)
[ 1.0000000] intc0 at cpu0: local interrupt controller
[ 1.0000000] fregulator0 at simplebus0: fixed-3.3V
[ 1.0000000] fregulator1 at simplebus0: fixed-1.8V
[ 1.0000000] fregulator2 at simplebus0: USB0_VBUS_OTG
[ 1.0000000] /soc/interrupt-controller@12c00000 at simplebus1 not configured
[ 1.0000000] /soc/clock-controller@11010000 at simplebus1 not configured
[ 1.0000000] /soc/dma-controller@11820000 at simplebus1 not configured
[ 1.0000000] /soc/pinctrl@11030000 at simplebus1 not configured
[ 1.0000000] /soc/i2c@10058000 at simplebus1 not configured
[ 1.0000000] /soc/interrupt-controller@110a0000 at simplebus1 not configured
[ 1.0000000] /regulator-vccq-sdhi1 at simplebus0 not configured
[ 1.0000000] /soc/ethernet@11c30000 at simplebus1 not configured
[ 1.0000000] /soc/usbphy-ctrl@11c40000 at simplebus1 not configured
[ 1.0000000] /soc/usb-phy@11c50200 at simplebus1 not configured
[ 1.0000000] /soc/usb-phy@11c70200 at simplebus1 not configured
[ 1.0000000] /soc/usb@11c50000 at simplebus1 not configured
[ 1.0000000] /soc/usb@11c70000 at simplebus1 not configured
[ 1.0000000] /soc/thermal@10059400 at simplebus1 not configured
[ 1.0000000] /soc/cache-controller@13400000 at simplebus1 not configured
[ 1.0000000] /opp-table-0 at simplebus0 not configured
[ 1.0000000] /sound at simplebus0 not configured
[ 1.0000000] /soc/ssi@1004a000 at simplebus1 not configured
[ 1.0000000] /soc/i2c@10058400 at simplebus1 not configured
[ 1.0000000] /soc/spi@1004b000 at simplebus1 not configured
[ 1.0000000] /soc/serial@1004b800 at simplebus1 not configured
[ 1.0000000] /soc/can@10050000 at simplebus1 not configured
[ 1.0000000] /soc/adc@10059000 at simplebus1 not configured
[ 1.0000000] /soc/mmc@11c00000 at simplebus1 not configured
[ 1.0000000] /soc/mmc@11c10000 at simplebus1 not configured
[ 1.0000000] /soc/usb@11c50100 at simplebus1 not configured
[ 1.0000000] /soc/usb@11c70100 at simplebus1 not configured
[ 1.0000000] /soc/usb@11c60000 at simplebus1 not configured
[ 1.0000000] /soc/watchdog@12800800 at simplebus1 not configured
[ 1.0000000] /soc/timer@12801400 at simplebus1 not configured
[ 1.0000000] /soc/timer@12801800 at simplebus1 not configured
[ 1.0000000] WARNING: system needs entropy for security; see entropy(7)
[ 1.0000030] cpu_boot_secondary_processors: starting secondary processors
[ 1.0000030] cpu_boot_secondary_processors: secondary processors hatched. 1 running
[ 1.4493202] swwdog0: software watchdog initialized
[ 1.4616401] boot device: <unknown>
[ 1.4616401] unknown device major 0xffffffffffffffff
[ 2.4693079] unknown device major 0xffffffffffffffff
[ 3.4693079] unknown device major 0xffffffffffffffff
[ 4.4693081] unknown device major 0xffffffffffffffff
[ 5.4693073] unknown device major 0xffffffffffffffff
[ 6.4692600] unknown device major 0xffffffffffffffff
[ 7.4692592] unknown device major 0xffffffffffffffff
[ 8.4692590] unknown device major 0xffffffffffffffff
[ 9.4692585] unknown device major 0xffffffffffffffff
[ 10.4692571] unknown device major 0xffffffffffffffff
[ 11.4692577] unknown device major 0xffffffffffffffff
[ 12.4692596] unknown device major 0xffffffffffffffff
[ 13.4692573] unknown device major 0xffffffffffffffff
[ 14.4692576] unknown device major 0xffffffffffffffff
[ 15.4692579] unknown device major 0xffffffffffffffff
[ 16.4692588] unknown device major 0xffffffffffffffff
[ 17.4692564] unknown device major 0xffffffffffffffff
[ 18.4692599] unknown device major 0xffffffffffffffff
[ 19.4692595] unknown device major 0xffffffffffffffff
[ 20.4692575] unknown device major 0xffffffffffffffff
[ 21.4692592] unknown device major 0xffffffffffffffff
[ 21.4692592] root device:

まあ、デバイスドライバ全然ないからダメですよね。dtbがあるのはLinuxにあるdtsを持ってきたからでしょう(知ってた)。

つづく(たぶん続かない)