How riscv-vela/vela works
Project type and purpose
• This is a small tooling project whose sole purpose is to prepare and launch an Ubuntu virtual machine under QEMU (likely for RISC-V or similar targets since it installs opensbi and u-boot-qemu).
• There is no “application” inside; it’s an environment-provisioning tool.
File structure
• README.md: explains dependencies and usage.
• init.sh: prepares an Ubuntu disk image.
• run.sh: launches QEMU with the built image, firmware, bootloader, and network forwarding.
README for additional insights
• Dependencies: opensbi, qemu-system-misc, u-boot-qemu.
• Usage:
• ./init.sh → build a disk image
• ./run.sh → start QEMU with SBI + U-Boot chain and forward host port 2222 → VM’s SSH 22
• The intended flow: Host packages → init.sh → disk.img → run.sh → VM up → ssh.
Main components
a. Host machine
• OS (e.g., Ubuntu)
• Installed packages: QEMU, OpenSBI, U-Boot
• Scripts: init.sh, run.sh
b. Disk image preparation
• init.sh steps (e.g., debootstrap or dd operations → ubuntu.img)
c. Emulation/VM stack (run.sh)
• QEMU process
• OpenSBI firmware
• U-Boot bootloader
• Kernel and initrd inside ubuntu.img
d. Networking
• QEMU user-mode or TAP networking
• Host port 2222 forwarded → VM port 22
e. Client interaction
• SSH client on host → SSH server in VM
Relationships and interactions
• init.sh writes and configures ubuntu.img
• run.sh invokes qemu-system-... with flags pointing to:
• OpenSBI binary (–bios)
• U-Boot binary (–kernel or –bios chain)
• Disk image (–drive file=ubuntu.img)
• Network forwarding (–net user,hostfwd=…)
• QEMU spawns a virtual machine, OpenSBI hands off to U-Boot, which loads the Linux kernel from the disk image.
• The VM runs SSHd; the host’s SSH client connects via localhost:2222.
Architectural patterns and design principles
• Clear separation of concerns:
• Image preparation (init.sh)
• VM provisioning (run.sh)
• Boot chain layering: OpenSBI → U-Boot → Linux Kernel → Userland
• Reproducibility: script-driven, minimal manual steps
• Network isolation with controlled port forwarding
Technologies, frameworks, libraries
• QEMU system emulator
• OpenSBI (RISC-V SBI implementation)
• U-Boot (bootloader)
• Ubuntu disk image & debootstrap (presumed in init.sh)
• SSH (network service)
Essential details to capture
• The bootloader chain (OpenSBI → U-Boot → Linux)
• The fact that init.sh is decoupled from run.sh
• The network forwarding configuration
• Which binary flags in run.sh point to which components