From 6ca887ba15f67da69277459969c3cd47f284484a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 31 Dec 2022 13:28:30 -0600 Subject: [PATCH] attempt to run something in qemu --- qemu/Makefile | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 qemu/Makefile diff --git a/qemu/Makefile b/qemu/Makefile new file mode 100644 index 0000000..82b13ac --- /dev/null +++ b/qemu/Makefile @@ -0,0 +1,42 @@ +# howto qemu an riscv image on a x86 box +# https://wiki.debian.org/RISC-V +# qemu-system-riscv64 -nographic -machine virt -m 1.9G \ +# -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \ +# -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \ +# -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 \ +# -append "console=ttyS0 rw root=/dev/vda1" \ +# -device virtio-blk-device,drive=hd0 -drive file=rootfs.img,format=raw,id=hd0 \ +# -device virtio-net-device,netdev=usernet -netdev user,id=usernet,hostfwd=tcp::22222-:22 +# + +# jcarr@hpdevone:~/Desktop/syncthing-jcarr/status$ apt-find "opensbi/generic/fw_jump.elf" +# opensbi: /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf +# jcarr@hpdevone:~/Desktop/syncthing-jcarr/status$ apt-find "riscv64-linux-gnu/opensbi/generic/fw_jump.elf" +# opensbi: /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf +# jcarr@hpdevone:~/Desktop/syncthing-jcarr/status$ apt-find "u-boot/qemu-riscv64_smode/uboot.elf" +# u-boot-qemu: /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf +# jcarr@hpdevone:~/Desktop/riscv-images/qemu$ apt-find qemu-system-riscv64 +# qemu-system-misc: /usr/bin/qemu-system-riscv64 + +prep: + apt install opensbi + apt install u-boot-qemu + apt install qemu-system-misc + +qemu: + qemu-system-riscv64 -nographic -machine virt -m 1.9G \ + -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \ + -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \ + -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 \ + -append "console=ttyS0 rw root=/dev/vda1" \ + -device virtio-blk-device,drive=hd0 -drive file=rootfs-riscv64.img,format=raw,id=hd0 \ + -device virtio-net-device,netdev=usernet -netdev user,id=usernet,hostfwd=tcp::22222-:22 + +qemu-visionfive2-v55.img: + qemu-system-riscv64 -nographic -machine virt -m 1.9G \ + -bios /usr/lib/riscv64-linux-gnu/opensbi/generic/fw_jump.elf \ + -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf \ + -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-device,rng=rng0 \ + -append "console=ttyS0 rw root=/dev/vda3" \ + -device virtio-blk-device,drive=hd0 -drive file=visionfive2-v55.img,format=raw,id=hd0 \ + -device virtio-net-device,netdev=usernet -netdev user,id=usernet,hostfwd=tcp::22222-:22