Skip to content

Instantly share code, notes, and snippets.

@luccamendonca
Created October 29, 2021 22:31
Show Gist options
  • Save luccamendonca/132118fbc6b0132e9b692c460cfa5293 to your computer and use it in GitHub Desktop.
Save luccamendonca/132118fbc6b0132e9b692c460cfa5293 to your computer and use it in GitHub Desktop.
MacOS QEMU Debian example (x86_64)
.PHONY: setup install run
QEMU_BASE_DIR=${HOME}/QEMU
HD_DIR=${QEMU_BASE_DIR}/os-disk.qcow2
HD_SIZE=30G
ISO_DIR=${QEMU_BASE_DIR}/os-install.iso
ISO_URL=https://cdimage.debian.org/cdimage/unofficial/non-free/cd-including-firmware/current/amd64/iso-dvd/firmware-11.1.0-amd64-DVD-1.iso
define NETWORK_WARNING
================================================================================
You'll need to DELETE the Thunderbolt Bridge and create one called bridge0.
Also, set the GUEST DNS to Google's (8.8.8.8, 8.8.4.4).
Ignore this if the above pre-requisites are already satisfied or if the GUEST
network works just fine on the first boot
================================================================================
endef
export NETWORK_WARNING
setup:
@echo "Creating the qcow2 virtual disk..."
@qemu-img create -f qcow2 ${HD_DIR} ${HD_SIZE}
@echo "Downloading OS ISO from ${ISO_URL}"
@wget ${ISO_URL} -O ${ISO_DIR}
@echo; echo "$$NETWORK_WARNING"
install:
@${QEMU_BASE_DIR}/qemu-cmd.sh ${HD_DIR} ${ISO_DIR} &
run:
@${QEMU_BASE_DIR}/qemu-cmd.sh ${HD_DIR} &
#!/bin/bash
BASEDIR=$(dirname $0)
HARD_DRIVE=${1:-$BASEDIR/os-disk.qcow2}
[ -z "$2" ] && CDROM_ARG= || CDROM_ARG="-cdrom $2"
cmd="qemu-system-x86_64 \
-machine q35,accel=hvf \
-cpu Nehalem \
-smp 6 \
-m 8G \
-hda $HARD_DRIVE \
$CDROM_ARG \
-vga virtio \
-usb \
-device usb-tablet \
-display default,show-cursor=on"
eval $cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment