Hello,

Just for curiosity I found this instructions:

https://wiki.netbsd.org/ports/qemu_riscv/

$ gunzip netbsd-GENERIC64.gz
$ gunzip riscv64.img.gz
$ qemu-img resize riscv64.img 20g

$ qemu-system-riscv64 \
      -M virt \
      -m 4g \
      -kernel netbsd-GENERIC64 \
      -drive if=none,file=riscv64.img,id=hd0,format=raw \
      -device virtio-blk-device,drive=hd0 \
      -device virtio-rng-device \
      -netdev type=user,id=net0 \
      -device virtio-net-device,netdev=net0,mac=00:11:22:33:44:55 \
      -append "root=dk1" \
      -nographic

I executed them in my NetBSD 10.1 raspberrypi4 host. Riscv guest system boots and works fine (a bit slow, of course) but it cannot reach outside world:

raspa4-riscv# ftp ftp.netbsd.org
Trying [2001:470:a085:999::21]:21 ...

It stucks there for looong time. It appears that user mode network does not work well.

Also tried to install sets from sysint program and network did not work either.

I have set up a bridge mode network and worked just fine following the guide:

"Configure NetBSD to do this all at boot time by editing /etc/ifconfig.tap0:

create
descr "NetBSD VM" up
! ifconfig bridge0 create
! ifconfig bridge0 descr "LAN VM bridge" up
! brconfig bridge0 add tap0 add wm0"

and modified startup script to use the tap0 device:

netbsd-raspa4$ cat arranca-riscv-bridged.sh
#!/bin/sh

qemu-system-riscv64 \
      -M virt \
      -m 2g \
      -kernel netbsd-GENERIC64 \
      -drive if=none,file=riscv64.img,id=hd0,format=raw \
      -device virtio-blk-device,drive=hd0 \
      -device virtio-rng-device \
      -netdev tap,id=tap0,ifname=tap0,script=no\
      -device virtio-net-device,netdev=tap0,mac=00:11:22:33:44:55 \
      -append "root=dk1" \
      -nographic

It worked just fine.

After a while I found the following  in the NetBSD Guide:


"""30.4.2. NetBSD VMs lacking IPv6
QEMU's networking will sometimes configure an invalid IPv6 route on IPv4-only configurations, meaning programs like the NetBSD packaging tools will prefer IPv6 and spend a long time timing out before succeeding.

Work around this by editing /etc/rc.conf to prefer IPv4 addresses:

ip6addrctl=YES
ip6addrctl_policy="ipv4_prefer """

I modified rc.conf that way, rebooted the guest and It worked!:


raspa4-riscv# ftp  ftp.netbsd.org
Trying 199.233.217.201:21 ...
Connected to ftp.netbsd.org.
220 ftp.NetBSD.org FTP server (NetBSD-ftpd 20230930) ready.
Name (ftp.netbsd.org:root): anonymous
331 Guest login ok, type your name as password.
Password:
230-
        The NetBSD Project FTP Server located in San Jose, CA, USA
        1 Gbps connectivity

So, I suggest it would be a good idea to modify the WEB page at
https://wiki.netbsd.org/ports/qemu_riscv/ to include that rc.conf modification.

Thanks so much.

Regards.
Ramiro.




Reply via email to