Hi, On 2024-02-26 15:20, Martin Cracauer wrote: > Package: u-boot-qemu > Version: 2021.01+dfsg-5 > Severity: important > Tags: patch > X-Debbugs-Cc: [email protected] > > > > > -- System Information: > Debian Release: 11.6 > APT prefers oldstable-updates > APT policy: (500, 'oldstable-updates'), (500, 'oldstable-security'), (500, > 'oldstable') > Architecture: amd64 (x86_64) > Foreign Architectures: i386 > > Kernel: Linux 5.15.90-cracauerdlwavehh (SMP w/64 CPU threads) > Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_CPU_OUT_OF_SPEC, > TAINT_OOT_MODULE > Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set > Shell: /bin/sh linked to /bin/bash > Init: systemd (via /run/systemd/system) > > -- no debconf information > > > /usr/lib/u-boot/qemu-riscv64/u-boot.bin as included in this debian > release does not work for booting in qemu for RISCV64, when combined > with /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf (also from > this debian version). See below for qemu command line. > > If instead you use the version of u-boot.bin included in the FreeBSD > port it works with the same fw_jump.elf. > > sha256 of faulty version of u-boot.bin (Debian): > 1b5505b90c933a61c2edbf579dd190ea18582e151290d547f68a1eb465f52fe6
To give more details this is /usr/lib/u-boot/qemu-riscv64/u-boot.bin. > sha256 of working version of u-boot.bin: > 70f2d929cc60fb9449290a650f62a5ec7d9fdb43db4251a85b294b08d0d7c3d2 > > To get the working version (source code): > https://ftp.denx.de/pub/u-boot/u-boot-2024.01.tar.bz2 > > To get the working version (FreeBSD package): > https://pkg0.tuk.freebsd.org/FreeBSD:14:aarch64/latest/All/u-boot-qemu-riscv64-2024.01.pkg > > I extracted the actual u-boot.bin from FreeBSD for you to try out: > https://www.cons.org/riscv/u-boot.bin > > > Example qemu line showing the problem and solution. Just exchange the > two u-boot.bin's. Note that the FreeBSD image is irrelevant here, the > booting never reaches it. I run this on Debian/amd64. > > qemu-system-riscv64 \ > -M virt \ > -smp 8 \ > -m 32G \ > -nographic \ > -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \ > -kernel u-boot.bin \ > -drive file=FreeBSD-14.0-RELEASE-riscv-riscv64.raw,format=raw,id=hd0 \ > -device virtio-blk-device,drive=hd0 \ > -nographic \ > -netdev user,id=net0,ipv6=off,hostfwd=tcp::3234-:22 \ > -device virtio-net-device,netdev=net0 \ > -device virtio-rng-pci Given you want to load opensbi with -bios, you need to run u-boot as supervisor mode. It means that you need to use /usr/lib/u-boot/qemu-riscv64_smode/u-boot.bin instead. The FreeBSD version is also u-boot for running in supervisor mode, that's why it works here. /usr/lib/u-boot/qemu-riscv64/u-boot.bin is for running in machine mode, so using directly -bios /usr/lib/u-boot/qemu-riscv64/u-boot.bin. Regards Aurelien -- Aurelien Jarno GPG: 4096R/1DDD8C9B [email protected] http://aurel32.net

