Skip to content

Commit

Permalink
qemu/riscv64: Add riscv64 to the architectures supported
Browse files Browse the repository at this point in the history
Add support for riscv64 to the gen-vm and run-vm scripts. Note this
means a couple of packages need to be installed (qemu-system-misc and
u-boot-qemu). Add this to our smoke-test GitHub workflow.
  • Loading branch information
sbates130272 committed Nov 22, 2024
1 parent 9e4e07e commit ec2e84c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,23 @@ jobs:
USERNAME: ubuntu
PASS: password
ARCH: arm64

ubuntu-latest-arm64:
name: ubuntu-latest-arm64
runs-on: ubuntu-latest
steps:
- name: Check out code using action/checkout
uses: actions/[email protected]
- name: Install a couple of packages via the apt package manager
run: sudo apt update && sudo apt install -y qemu-system-misc u-boot-qemu cloud-image-utils
- name: Generate an ssh key-pair for this test
run: ssh-keygen -t rsa -q -f "$HOME/.ssh/id_rsa" -N ""
- name: Run a riscv64 qemu-based ./gen-vm smoke-test
run: ./gen-vm
working-directory: qemu
env:
VM_NAME: qemu-minimal-smoke-test-arm64
KVM: none
USERNAME: ubuntu
PASS: password
ARCH: riscv64
6 changes: 5 additions & 1 deletion qemu/gen-vm
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ if [ ${ARCH} == "amd64" ]; then
elif [ ${ARCH} == "arm64" ]; then
QARCH="aarch64"
QARCH_ARGS="-machine virt,gic-version=max${KVM} -cpu max -bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd"
elif [ ${ARCH} == "riscv64" ]; then
QARCH="riscv64"
QARCH_ARGS="-machine virt,${KVM} -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf"
else
echo "Error: No ARCH mapping exists for ${ARCH}! Exiting."; exit -1
fi
Expand All @@ -146,7 +149,8 @@ qemu-system-${QARCH} \
-nographic \
-drive if=virtio,format=qcow2,file=${IMAGES}/${VM_NAME}-backing.qcow2 \
-drive if=virtio,format=qcow2,file=${IMAGES}/${VM_NAME}-seed.qcow2 \
-nic user,id=user0,model=virtio-net-pci
-netdev user,id=net0 \
-device virtio-net-pci,netdev=net0

qemu-img create -F qcow2 -b ${IMAGES}/${VM_NAME}-backing.qcow2 -f qcow2 \
${IMAGES}/${VM_NAME}.qcow2
6 changes: 5 additions & 1 deletion qemu/run-vm
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ if [ ${ARCH} == "amd64" ]; then
elif [ ${ARCH} == "arm64" ]; then
QARCH="aarch64"
QARCH_ARGS="-machine virt,gic-version=max${KVM} -cpu max -bios /usr/share/qemu-efi-aarch64/QEMU_EFI.fd"
elif [ ${ARCH} == "riscv64" ]; then
QARCH="riscv64"
QARCH_ARGS="-machine virt,${KVM} -kernel /usr/lib/u-boot/qemu-riscv64_smode/uboot.elf"
else
echo "Error: No ARCH mapping exists for ${ARCH}! Exiting."; exit -1
fi
Expand All @@ -51,4 +54,5 @@ qemu-system-${QARCH} \
${FILESYSTEM_ARGS} \
-nographic \
-drive if=virtio,format=qcow2,file=${IMAGES}/${VM_NAME}.qcow2 \
-nic user,id=user0,model=virtio-net-pci,hostfwd=tcp::${SSH_PORT}-:22
-netdev user,id=net0,hostfwd=tcp::${SSH_PORT}-:22 \
-device virtio-net-pci,netdev=net0

0 comments on commit ec2e84c

Please sign in to comment.