[Solved] was: Re: Problem running FreeBSD/RISC-V in QEMU

From: lars.sonchocky-helldorf@hamburg.de <lars.sonchocky-helldorf_at_hamburg.de>
Date: Sat, 21 May 2022 04:30:56 UTC
this old snapshot works! Fine!

root@freebsd:~ # uname -a
FreeBSD freebsd 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n255198-1907e1c07c3: Thu May  5 06:03:11 UTC 2022     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/riscv.riscv64/sys/GENERIC riscv
root@freebsd:~ # 



run on macOS 11.6.5:

MBP15:~ lars$ uname -a
Darwin MBP15.local 20.6.0 Darwin Kernel Version 20.6.0: Tue Feb 22 21:10:41 PST 2022; root:xnu-7195.141.26~1/RELEASE_X86_64 x86_64
MBP15:~ lars$ 

using this command:

qemu-system-riscv64 \
    -machine virt \
    -smp 2 \
    -m 2G \
    -nographic \
    -bios /Volumes/Data/Projects/RISC-V/FreeBSD/fw_jump.elf \
    -kernel /Volumes/Data/Projects/RISC-V/FreeBSD/u-boot.bin \
    -drive file=/Volumes/Data/Projects/RISC-V/FreeBSD/FreeBSD-14.0-CURRENT-riscv-riscv64-20220505-1907e1c07c3-255198.raw,format=raw,id=hd0 \
    -device virtio-blk-device,drive=hd0 \
    -device virtio-net-device,netdev=net0 \
    -netdev user,id=net0,ipv6=off,hostfwd=tcp::8022-:22


Thanks a lot!

	Lars

> Am 20.05.2022 um 22:44 schrieb Mitchell Horne <mhorne@FreeBSD.org>:
> 
> On 2022-05-20 8:36 a.m., lars.sonchocky-helldorf@hamburg.de wrote:
>> Hi everybody,
>> I am trying to run FreeBSD/RISC-V in QEMU.
>> For that purpose I have installed FreeBSD/amd64 inside Virtual Box on a macOS machine:
>> FreeBSD FreeBSD14 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n255696-716fd348e01: Thu May 19 08:29:12 UTC 2022     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64
>> and then followed those instructions:
>> https://wiki.freebsd.org/riscv#Quick_Start
>> The boot process is initialized but then however I get repeatedly:
>> failed to allocate staging area: 9
>> here is the part where it fails, truncated, since the above message is repeated endlessly:
>> Loading kernel...
>> /boot/kernel/kernel text=0x5a5e88 text=0x172c34 data=0xf8350 data=0x1eac+0x273b9c 0x8+0x1efc360+0x8+0xf28d3
>> Loading configured modules...
>> can't find '/etc/hostid'
>> can't find '/boot/entropy'
>> Using DTB provided by EFI at 0x87efb000.
>> Kernel entry at 0xf660002e...
>> Kernel args: (null)
>> failed to allocate staging area: 9
>> failed to allocate staging area: 9
>> What is going wrong here?
> 
> Seems to be a bug made visible by the recent upgrade of LLVM/clang. It was reported here:
> 
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=264021
> 
> If you grab the snapshot from 2 weeks ago, it might not exhibit this problem. Otherwise, it looks like a fix is in progress.
> 
> https://download.freebsd.org/snapshots/VM-IMAGES/14.0-CURRENT/riscv64/20220505/
> 
> Cheers,
> Mitchell
> 
>> Thanks in advance and if you need more information please let me know!
>> Kind regards,
>> 	Lars