QMEU on Ubuntu22.04 with support by Fleximg

AWS-Marketplace

https://aws.amazon.com/marketplace/pp/prodview-zf5awcserlfru#pdp-usage

Usage Instructions

*Note
1. Compile Linux source code, Buildroot root file system with a minimum of 4GB memory, 2-core CPU, and 32GB disk space.
2. If you download a different version of the kernel and root file system, you must start from the first step again. Otherwise, proceed directly to step thirteen.

Operating Steps:

Step 1. Download the required version of the Linux source code.
Step 2. Extract the kernel package: tar -zxvf linux-x.xx.xx.tar.gz
Step 3. Create a compilation script in the linux-x.xx.xx directory.

#!/bin/bash
export PATH=/usr/bin/:$PATH
export CROSS_COMPILE=riscv64-linux-gnu-
export ARCH=riscv
make clean
make menuconfig
make -j8

Step 4. Run the script and configure.
Step 5. Download the required version of the Buildroot minimal root file system.
Step 6. Extract the Buildroot package: tar -zxvf buildroot-xxxx.xx.x.tar.gz
Step 7. Go to the /work/risc-v/buildroot-xxxx.xx.x/config directory,copy qemu_riscv64_virt_defconfig to the /work/risc-v/buildroot-xxxx.xx.x directory,and overwrite .config.
Step 8. Create a compilation script in the buildroot-xxxx.xx.x directory.

#!/bin/sh
make qemu_riscv64_virt_defconfig
make menuconfig
make -j8

Step 9. Run the script and configure.
Step 10. Enter the work directory and create an image.
Step 11. Copy /work/risc-v/linux-x.xx.xx/arch/riscv/boot/Image to image/.
Step 12. Copy /work/risc-v/buildroot-xxxx.xx.x/output/images/rootfs.ext2 to image/.
Step 13. Start QEMU and load the kernel image file, and mount the root file system.

cd /work/risc-v

qemu-system-riscv64 -nographic -machine virt -kernel ./image/Image -append "root=/dev/vda rw console=ttyS0" -drive file=image/rootfs.ext2,format=raw,id=hd0 -device virtio-blk-device,drive=hd0

Step 14. After successfully loading the Linux kernel and mounting the root file system, the QEMU interface will look as follows, indicating the successful setup of the Linux system environment based on the QEMU RISC-V platform.The login account and password are both root.

Welcome to Buildroot Linux.
buildroot login:
password:

QEMU Official document

https://wiki.qemu.org/Documentation