On 12/23/24 07:05, Stafford Horne wrote:
The kernel config looks like it should have virt block device support, but
nether -hda README nor "-drive file=README,format=raw,id=hd0 -device
virtio-blk-device,drive=hd0" seem to be wiring it up in qemu where the
kernel can find it?
The default virt_defconfig should have the drivers we need. The OpenRISC virt
platform supports PCI and virtio devices, so I select many of the related
drivers.
For some reason this message did not show up in qemu-devel's web
archive, but when I reply all qemu-devel is in the list? Weird.
$ grep -C1 -e PCI -e VIRT arch/openrisc/configs/virt_defconfig
# CONFIG_WIRELESS is not set
CONFIG_PCI=y
CONFIG_PCIEPORTBUS=y
CONFIG_PCI_HOST_GENERIC=y
CONFIG_DEVTMPFS=y
--
CONFIG_BLK_DEV_NBD=y
CONFIG_VIRTIO_BLK=y
CONFIG_NETDEVICES=y
CONFIG_VIRTIO_NET=y
CONFIG_ETHOC=y
I've already got all those except VIRTIO_BLK and VIRTIO_NET.
In my qemu startup I wire in the hard drive and network in my qemu start script:
- https://github.com/stffrdhrn/or1k-utils/blob/master/scripts/qemu-or1k-linux
This uses:
-device virtio-net-pci,netdev=user -netdev
user,id=user,net=$IPRANGE.1/24,host=$IPRANGE.100
My other virto targets are just doing:
-netdev user,id=net0 -device virtio-net-device,netdev=net0
And yes, that works here with VIRTIO_NET enabled. (Dunno why it isn't in
the kernel defconfig...)
-device virtio-blk-device,drive=d0 -drive
file=${DISK},id=d0,if=none,format=qcow2
-drive file=file.img,format=raw,id=hd0 -device virtio-blk-device,drive=hd0
My -device looks similar but -drive is file=file.img,format=raw,id=hd0
No idea what if= does? I haven't seemed to need it...
Haven't tried to get fancy with the network yet. The buildroot config is
still or1ksim...
Yeah, its nothing fancy for me either. The buildroot with systemV init scripts
get everything working for me.
My init script (the HERE document starting around
https://github.com/landley/toybox/blob/master/mkroot/mkroot.sh#L102 )
ancestrally goes back to
https://linuxfromscratch.org/hints/downloads/files/OLD/bsd-init.txt and
boils down to "call stuff like mount/ifconfig/route in a shell script
until it's time to exec whatever inherits PID 1".
*shrug* Works fine for embedded systems and small automated containers
that do a thing and then exit. (You'll notice this one tries to mount
/dev/?da on /mnt and then run /mnt/init if it exists: that way I can
plug in an -hda blah.squashfs and have it do stuff automatically.
Toybox's timeout command has a -i option that's an inactivity timer: if
nothing is produced on stdout for X seconds, kill the child. So it can
run forever as long as it's DOING something, but if it stops producing
output for X seconds it gets ended.)
-Stafford
Thanks, I think this target is good for release. Now to figure out why
sh2eb network isn't working after the restore (it used to!). Nor is
microblaze's network...
Rob