attempt to run something in qemu

This commit is contained in:
Jeff Carr 2022-12-31 13:28:30 -06:00
parent 7bb98cfc99
commit 6ca887ba15
1 changed files with 42 additions and 0 deletions

42
qemu/Makefile Normal file
View File

@ -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