Skip to content

Instantly share code, notes, and snippets.

@bvibber
Created January 7, 2019 03:51
Show Gist options
  • Save bvibber/3f68154b4c19e966d0ec616ac8e1988d to your computer and use it in GitHub Desktop.
Save bvibber/3f68154b4c19e966d0ec616ac8e1988d to your computer and use it in GitHub Desktop.
Fedora aarch64 QEMU system image runner script
#!/bin/bash
# Starter script for Fedora aarch64 in QEMU, cobbled from various sources.
# Requires qemu-system-aarch64 to be installed.
# Configuration options:
IMAGE=fedora-29-aarch64.img
RAM=2048
CPUS=4
# Get a Fedora Minimal or Server aarch64 system image from
# https://alt.fedoraproject.org/alt/
# Decompress with 'xz -d' and put it somewhere handy.
# On first boot, there will be some setup questions before login.
# Note -- must also obtain QEMU_EFI.fd firmware file to boot!
# On Fedora, install qemu and grab it from /usr/share/edk2/aarch64
# or find a snapshot from Linaro etc.
# And now we run:
qemu-system-aarch64 \
-no-user-config \
-nodefaults \
-display none \
-m ${RAM} \
-cpu cortex-a57 -machine virt \
-smp ${CPUS} \
-bios QEMU_EFI.fd \
-device virtio-scsi-device,id=scsi \
-drive file=${IMAGE},format=raw,if=none,id=hd0 -device scsi-hd,drive=hd0 \
-netdev user,id=usernet -device virtio-net-device,netdev=usernet \
-boot efi \
-serial mon:stdio
# Additional notes:
# This bridges the serial console to your terminal, which is handy.
# The 'mon:' in the -serial line fixes ctrl+C so it doesn't kill qemu;
# to close the emulator you must either shut down the VM from inside
# or kill the process.
# Ok that's it. Enjoy!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment