Initial setup in simulation using QEMU(for risc v)

  1. Yocto project supports RISC-V architecture with meta-riscv layers ().
  2. Steps generally involve setting up the Yocto build environment with the correct layers, specifying the target machine as a RISC-V platform (like qemu-riscv64).
  3. You configure and build a custom image using BitBake. Common base images include core-image-minimal. (OK)
  4. The build creates images and root filesystems which can be run in QEMU using runqemu targeting the qemu-riscv64 machine.
  5. There are prebuilt layers and images available targeting SiFive RISC-V platforms and generic RISC-V QEMU emulation ().
  6. To invoke QEMU for RISC-V, you run a command like runqemu qemu-riscv64.
  7. The process includes configuring local.conf and bblayers.conf to include meta-riscv and setting MACHINE to qemu-riscv64.

I will fetch detailed instructions on setting up meta-riscv, configuring Yocto for RISC-V machine, building an image, and running it on QEMU. This will provide a step-by-step guide for the user.{"urls":"[https://github.com/riscv/meta-riscv","https://bootlin.com/blog/updated-yocto-support-for-sifive-risc-v-platforms/","https://docs.yoctoproject.org/dev-manual/qemu.html"]}To generate a custom Linux image using Yocto for RISC-V with QEMU, the general steps are as follows:

Initially I had cloned into the branch of mickledore (without realizing the corresponding version does not exist for meta-riscv)

Screenshot from 2025-09-01 18-07-04.png

  1. Set up the Yocto build environment by cloning Poky and required layers, including the meta-riscv layer which supports RISC-V architecture. (Like a preexisting recipie)

    Screenshot from 2025-09-01 18-06-57.png

image.png

  1. Add the meta-riscv layer to your bblayers.conf. (Or the layer can be added from build directory)

    Screenshot from 2025-09-01 18-16-00.png

  2. Set the MACHINE variable in your local.conf to a RISC-V target supported by the layer, such as qemu-riscv64.

    ~/yocto/build/conf$ nano local.conf 
    
  3. Customize your image by selecting or creating your own image recipe, commonly starting with core-image-minimal.

  4. Build the image using BitBake: bitbake core-image-minimal.

  5. Once the build finishes, run the image using QEMU emulator targeting RISC-V with the command: runqemu qemu-riscv64.