Run VM on MacOS (Arm Based) - gpillon/k4all GitHub Wiki

Running K4all Locally on macOS

To run K4all on your Mac, you need to follow the steps outlined below. This guide will help you set up the environment and run the K4all virtual machine using QEMU.

Prerequisites

  1. Install QEMU: Ensure that QEMU is installed on your macOS system. You can install QEMU using Homebrew with the following command:

    brew install qemu
    
  2. Set Up the K4all Directory: Open a terminal and create a folder named k4all to serve as your working directory:

    mkdir ~/k4all
    cd ~/k4all
    
  3. Download UEFI BIOS for QEMU: Download the edk2-aarch64-code.fd file (UEFI BIOS) for QEMU and extract it in the k4all folder:

    curl -L -O https://github.com/qemu/qemu/raw/master/pc-bios/edk2-aarch64-code.fd.bz2
    bunzip2 edk2-aarch64-code.fd.bz2
    
  4. Download the K4all Bootstrap Image: Download the K4all bootstrap image into the k4all directory:

    VERSION=v1.5.3
    # on fish shell use 'set VERSION v1.5.3'
    curl -L -o k4all-bootstrap-aarch64.qcow2 https://github.com/gpillon/k4all/releases/download/$VERSION/k4all-bootstrap-$VERSION-aarch64.qcow2
    

Running K4all with QEMU

Use the following command to execute the K4all virtual machine on your Mac:

qemu-system-aarch64 \
    -m 4G \
    -smp 4 \
    -device virtio-scsi-pci,id=scsi \
    -drive file=k4all-bootstrap-aarch64.qcow2,format=qcow2,if=none,id=disk0 \
    -device scsi-hd,drive=disk0 \
    -boot d \
    -M virt,accel=hvf \
    -drive if=pflash,format=raw,file=edk2-aarch64-code.fd \
    -cpu host \
    -device intel-hda -device hda-output \
    -device qemu-xhci \
    -device virtio-gpu \
    -device usb-kbd \
    -device virtio-mouse-pci \
    -display cocoa,full-grab=on \
    -device virtio-net-device,netdev=net0 \
    -netdev user,id=net0,hostfwd=tcp::22-:22,hostfwd=tcp::80-:80,hostfwd=tcp::443-:443,hostfwd=tcp::6443-:6443 \
    -chardev qemu-vdagent,id=spice,name=vdagent,clipboard=on \
    -device virtio-serial-pci \
    -device virtserialport,chardev=spice,name=com.redhat.spice.0 \
    -vnc :1

Notes

  • Ensure that the path to the edk2-aarch64-code.fd file is correct in your setup.
  • You may adjust the amount of memory (-m) and the number of CPU cores (-smp) based on your system’s resources.

This configuration will create a QEMU instance running K4all with network port forwarding for essential services.