Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

qemu/riscv64: Add riscv64 to the architectures supported #46

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/smoke-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ name: smoke-tests
on:
pull_request:
branches: [ main ]
paths:
- './qemu/gen-vm'

jobs:

Expand Down Expand Up @@ -46,3 +44,23 @@ jobs:
USERNAME: ubuntu
PASS: password
ARCH: arm64

ubuntu-latest-riscv64:
name: ubuntu-latest-riscv64
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-riscv64
KVM: none
USERNAME: ubuntu
PASS: password
ARCH: riscv64
8 changes: 6 additions & 2 deletions qemu/gen-vm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# (C) Stephen Bates <sbates@raithlin>
#
# A simple script generate a Ubuntu Noble VM using bare QEMU (i.e. not
# libvirt) and cloud-init.
# libvirt) and cloud-init..
#
# Jammy (or Later)
# ----------------
Expand Down 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