On Sun, Dec 22, 2024 at 11:29:19AM -0600, Rob Landley wrote: > On 11/24/24 00:50, Stafford Horne wrote: > > > Speaking of which, is there a way to get or1k to exit the emulator? I told > > > the kernel to reboot but it says "reboot failed, system halted" and hangs > > > instead of exiting qemu. (My testroot runs qemu under "timeout -i 10" to > > > kill it after 10 seconds of inactivity, I.E. nothing written to stdout, > > > but > > > it still counts as a failure on one of the criteria.) > > > > With the or1k-sim board it is not possible. Traditionally on or1k we use > > special NOP instructions to reboot simulators i.e. 'l.nop 1'. The QEMU > > team was > > not happy to support this mechanism. > > > > > > https://lore.kernel.org/openrisc/fb69c137317a365dcb549dfef1ecd2fbff48e92c.1492384862.git.sho...@gmail.com/T/#mef76d30d294aed84548b1e0d3e23aae499deaeec > > > > As an alertnative we can use the 'virt' board which supports shutdown and > > restart via the generic syscon drivers. > > > > $ grep -C1 SYSCON arch/openrisc/configs/virt_defconfig > > CONFIG_POWER_RESET=y > > CONFIG_POWER_RESET_SYSCON=y > > CONFIG_POWER_RESET_SYSCON_POWEROFF=y > > CONFIG_SYSCON_REBOOT_MODE=y > > # CONFIG_HWMON is not set > > I built the 6.12 ARCH=openrisc virt_defconfig and got it to boot my > initramfs, but while it does shut down, it hasn't got network or block > device support. > > 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. $ 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 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 -device virtio-blk-device,drive=d0 -drive file=${DISK},id=d0,if=none,format=qcow2 > 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. -Stafford