Skip to content

Instantly share code, notes, and snippets.

@nrjdalal
Last active December 18, 2025 13:51
Show Gist options
  • Select an option

  • Save nrjdalal/e70249bb5d2e9d844cc203fd11f74c55 to your computer and use it in GitHub Desktop.

Select an option

Save nrjdalal/e70249bb5d2e9d844cc203fd11f74c55 to your computer and use it in GitHub Desktop.

Revisions

  1. nrjdalal revised this gist Jun 28, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion QEMU-Silicon-Mac-Virtualization.md
    Original file line number Diff line number Diff line change
    @@ -50,7 +50,7 @@ sudo make install
    ## First run, close manually after installation aka first reboot.
    ```zsh
    curl https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso -o ubuntu-lts.iso
    curl https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.4-live-server-arm64.iso -o ubuntu-lts.iso

    qemu-img create -f qcow2 virtual-disk.qcow2 8G

  2. nrjdalal revised this gist Jun 7, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion QEMU-Silicon-Mac-Virtualization.md
    Original file line number Diff line number Diff line change
    @@ -94,7 +94,7 @@ qemu-system-aarch64 \
    ```
    2. Login via SSH using -
    ```zsh
    ssh <username>@<servername> -p 9922
    ssh <username>@127.0.0.1 -p 9922
    ```
    3. Visit http content at -
    ```zsh
  3. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion QEMU-Silicon-Mac-Virtualization.md
    Original file line number Diff line number Diff line change
    @@ -96,7 +96,7 @@ qemu-system-aarch64 \
    ```zsh
    ssh <username>@<servername> -p 9922
    ```
    3. See http content at -
    3. Visit http content at -
    ```zsh
    open http://127.0.0.1:9980
    ```
  4. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 21 additions and 2 deletions.
    23 changes: 21 additions & 2 deletions QEMU-Silicon-Mac-Virtualization.md
    Original file line number Diff line number Diff line change
    @@ -49,7 +49,6 @@ sudo make install
    > # Create Ubuntu Server using QEMU on Silicon based Apple Macs
    ## First run, close manually after installation aka first reboot.

    ```zsh
    curl https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso -o ubuntu-lts.iso

    @@ -69,7 +68,6 @@ qemu-system-aarch64 \
    -drive "format=qcow2,file=virtual-disk.qcow2" \
    -cdrom ubuntu-lts.iso
    ```

    ## Second run, enjoy your Ubuntu Server.
    ```zsh
    qemu-system-aarch64 \
    @@ -80,4 +78,25 @@ qemu-system-aarch64 \
    -drive "format=raw,file=edk2-aarch64-code.fd,if=pflash,readonly=on" \
    -drive "format=raw,file=ovmf_vars.fd,if=pflash" \
    -drive "format=qcow2,file=virtual-disk.qcow2"
    ```
    ## Bonus, connect via SSH and serve port 80 at localhost.
    1. Start server using -
    ```zsh
    qemu-system-aarch64 \
    -machine virt,accel=hvf,highmem=off \
    -cpu cortex-a72 -smp 4 -m 4G \
    -device virtio-gpu-pci \
    -device virtio-keyboard-pci \
    -drive "format=raw,file=edk2-aarch64-code.fd,if=pflash,readonly=on" \
    -drive "format=raw,file=ovmf_vars.fd,if=pflash" \
    -drive "format=qcow2,file=virtual-disk.qcow2" \
    -nic hostfwd=tcp:127.0.0.1:9922-0.0.0.0:22,hostfwd=tcp:127.0.0.1:9980-0.0.0.0:80 &
    ```
    2. Login via SSH using -
    ```zsh
    ssh <username>@<servername> -p 9922
    ```
    3. See http content at -
    ```zsh
    open http://127.0.0.1:9980
    ```
  5. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions QEMU-Silicon-Mac-Virtualization.md
    Original file line number Diff line number Diff line change
    @@ -79,6 +79,5 @@ qemu-system-aarch64 \
    -device virtio-keyboard-pci \
    -drive "format=raw,file=edk2-aarch64-code.fd,if=pflash,readonly=on" \
    -drive "format=raw,file=ovmf_vars.fd,if=pflash" \
    -drive "format=qcow2,file=virtual-disk.qcow2" \
    -cdrom ubuntu-lts.iso
    -drive "format=qcow2,file=virtual-disk.qcow2"
    ```
  6. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 15 additions and 0 deletions.
    15 changes: 15 additions & 0 deletions QEMU-Silicon-Mac-Virtualization.md
    Original file line number Diff line number Diff line change
    @@ -48,6 +48,8 @@ sudo make install

    > # Create Ubuntu Server using QEMU on Silicon based Apple Macs
    ## First run, close manually after installation aka first reboot.

    ```zsh
    curl https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso -o ubuntu-lts.iso

    @@ -57,6 +59,19 @@ cp $(dirname $(which qemu-img))/../share/qemu/edk2-aarch64-code.fd .

    dd if=/dev/zero conv=sync bs=1m count=64 of=ovmf_vars.fd

    qemu-system-aarch64 \
    -machine virt,accel=hvf,highmem=off \
    -cpu cortex-a72 -smp 4 -m 4G \
    -device virtio-gpu-pci \
    -device virtio-keyboard-pci \
    -drive "format=raw,file=edk2-aarch64-code.fd,if=pflash,readonly=on" \
    -drive "format=raw,file=ovmf_vars.fd,if=pflash" \
    -drive "format=qcow2,file=virtual-disk.qcow2" \
    -cdrom ubuntu-lts.iso
    ```

    ## Second run, enjoy your Ubuntu Server.
    ```zsh
    qemu-system-aarch64 \
    -machine virt,accel=hvf,highmem=off \
    -cpu cortex-a72 -smp 4 -m 4G \
  7. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion QEMU-Silicon-Mac-Virtualization.md
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,7 @@ zsh -c "$(curl -fsSL https://raw.githubusercontent.com/nrjdalal/silicon-virtuali
    ## Option 2 - Manually
    * ### Install Xcode command line tools
    ```zsh
    xcode-select --install 2>/dev/null
    xcode-select --install
    ```
    * ### Install Homebrew arm64
    ```zsh
  8. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion QEMU-Silicon-Mac-Virtualization.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    > # Install QEMU on Silicon based Apple Macs as of June 2021
    > # Install QEMU on Silicon based Apple Macs (June 2021)
    ## Option 1 - Automatically
    ```zsh
  9. nrjdalal renamed this gist Jun 6, 2021. 1 changed file with 0 additions and 0 deletions.
  10. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions QEMU-Silicon-Mac-Installation.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Install QEMU on Silicon based Apple Macs as of June 2021
    > # Install QEMU on Silicon based Apple Macs as of June 2021
    ## Option 1 - Automatically
    ```zsh
    @@ -46,7 +46,7 @@ make -j8
    sudo make install
    ```

    # Create Ubuntu Server using QEMU on Silicon based Apple Macs
    > # Create Ubuntu Server using QEMU on Silicon based Apple Macs
    ```zsh
    curl https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso -o ubuntu-lts.iso
  11. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 22 additions and 22 deletions.
    44 changes: 22 additions & 22 deletions QEMU-Silicon-Mac-Installation.md
    Original file line number Diff line number Diff line change
    @@ -15,28 +15,6 @@ xcode-select --install 2>/dev/null
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$(logname)/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
    ```

    # Create Ubuntu Server using QEMU on Silicon based Apple Macs

    ```zsh
    curl https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso -o ubuntu-lts.iso

    qemu-img create -f qcow2 virtual-disk.qcow2 8G

    cp $(dirname $(which qemu-img))/../share/qemu/edk2-aarch64-code.fd .

    dd if=/dev/zero conv=sync bs=1m count=64 of=ovmf_vars.fd

    qemu-system-aarch64 \
    -machine virt,accel=hvf,highmem=off \
    -cpu cortex-a72 -smp 4 -m 4G \
    -device virtio-gpu-pci \
    -device virtio-keyboard-pci \
    -drive "format=raw,file=edk2-aarch64-code.fd,if=pflash,readonly=on" \
    -drive "format=raw,file=ovmf_vars.fd,if=pflash" \
    -drive "format=qcow2,file=virtual-disk.qcow2" \
    -cdrom ubuntu-lts.iso
    ```
    * ### Install necessary packages for building
    ```zsh
    brew install libffi gettext glib pkg-config autoconf automake pixman ninja
    @@ -66,4 +44,26 @@ make -j8
    * ### Install qemu
    ```zsh
    sudo make install
    ```

    # Create Ubuntu Server using QEMU on Silicon based Apple Macs

    ```zsh
    curl https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso -o ubuntu-lts.iso

    qemu-img create -f qcow2 virtual-disk.qcow2 8G

    cp $(dirname $(which qemu-img))/../share/qemu/edk2-aarch64-code.fd .

    dd if=/dev/zero conv=sync bs=1m count=64 of=ovmf_vars.fd

    qemu-system-aarch64 \
    -machine virt,accel=hvf,highmem=off \
    -cpu cortex-a72 -smp 4 -m 4G \
    -device virtio-gpu-pci \
    -device virtio-keyboard-pci \
    -drive "format=raw,file=edk2-aarch64-code.fd,if=pflash,readonly=on" \
    -drive "format=raw,file=ovmf_vars.fd,if=pflash" \
    -drive "format=qcow2,file=virtual-disk.qcow2" \
    -cdrom ubuntu-lts.iso
    ```
  12. nrjdalal revised this gist Jun 6, 2021. 2 changed files with 22 additions and 21 deletions.
    21 changes: 0 additions & 21 deletions QEMU-Mac-Ubuntu-Server.md
    Original file line number Diff line number Diff line change
    @@ -1,21 +0,0 @@
    # Create Ubuntu Server using QEMU on Silicon based Apple Macs

    ```zsh
    curl https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso -o ubuntu-lts.iso

    qemu-img create -f qcow2 virtual-disk.qcow2 8G

    cp $(dirname $(which qemu-img))/../share/qemu/edk2-aarch64-code.fd .

    dd if=/dev/zero conv=sync bs=1m count=64 of=ovmf_vars.fd

    qemu-system-aarch64 \
    -machine virt,accel=hvf,highmem=off \
    -cpu cortex-a72 -smp 4 -m 4G \
    -device virtio-gpu-pci \
    -device virtio-keyboard-pci \
    -drive "format=raw,file=edk2-aarch64-code.fd,if=pflash,readonly=on" \
    -drive "format=raw,file=ovmf_vars.fd,if=pflash" \
    -drive "format=qcow2,file=virtual-disk.qcow2" \
    -cdrom ubuntu-lts.iso
    ```
    22 changes: 22 additions & 0 deletions QEMU-Silicon-Mac-Installation.md
    Original file line number Diff line number Diff line change
    @@ -15,6 +15,28 @@ xcode-select --install 2>/dev/null
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$(logname)/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
    ```

    # Create Ubuntu Server using QEMU on Silicon based Apple Macs

    ```zsh
    curl https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso -o ubuntu-lts.iso

    qemu-img create -f qcow2 virtual-disk.qcow2 8G

    cp $(dirname $(which qemu-img))/../share/qemu/edk2-aarch64-code.fd .

    dd if=/dev/zero conv=sync bs=1m count=64 of=ovmf_vars.fd

    qemu-system-aarch64 \
    -machine virt,accel=hvf,highmem=off \
    -cpu cortex-a72 -smp 4 -m 4G \
    -device virtio-gpu-pci \
    -device virtio-keyboard-pci \
    -drive "format=raw,file=edk2-aarch64-code.fd,if=pflash,readonly=on" \
    -drive "format=raw,file=ovmf_vars.fd,if=pflash" \
    -drive "format=qcow2,file=virtual-disk.qcow2" \
    -cdrom ubuntu-lts.iso
    ```
    * ### Install necessary packages for building
    ```zsh
    brew install libffi gettext glib pkg-config autoconf automake pixman ninja
  13. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion QEMU-Silicon-Mac-Installation.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # Latest way to install QEMU on Silicon based Apple Macs as of June 2021
    # Install QEMU on Silicon based Apple Macs as of June 2021

    ## Option 1 - Automatically
    ```zsh
  14. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 21 additions and 0 deletions.
    21 changes: 21 additions & 0 deletions QEMU-Mac-Ubuntu-Server.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    # Create Ubuntu Server using QEMU on Silicon based Apple Macs

    ```zsh
    curl https://cdimage.ubuntu.com/releases/20.04/release/ubuntu-20.04.2-live-server-arm64.iso -o ubuntu-lts.iso

    qemu-img create -f qcow2 virtual-disk.qcow2 8G

    cp $(dirname $(which qemu-img))/../share/qemu/edk2-aarch64-code.fd .

    dd if=/dev/zero conv=sync bs=1m count=64 of=ovmf_vars.fd

    qemu-system-aarch64 \
    -machine virt,accel=hvf,highmem=off \
    -cpu cortex-a72 -smp 4 -m 4G \
    -device virtio-gpu-pci \
    -device virtio-keyboard-pci \
    -drive "format=raw,file=edk2-aarch64-code.fd,if=pflash,readonly=on" \
    -drive "format=raw,file=ovmf_vars.fd,if=pflash" \
    -drive "format=qcow2,file=virtual-disk.qcow2" \
    -cdrom ubuntu-lts.iso
    ```
  15. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 10 additions and 0 deletions.
    10 changes: 10 additions & 0 deletions QEMU-Silicon-Mac-Installation.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,16 @@
    zsh -c "$(curl -fsSL https://raw.githubusercontent.com/nrjdalal/silicon-virtualizer/master/install-qemu.sh)"
    ```
    ## Option 2 - Manually
    * ### Install Xcode command line tools
    ```zsh
    xcode-select --install 2>/dev/null
    ```
    * ### Install Homebrew arm64
    ```zsh
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/$(logname)/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
    ```
    * ### Install necessary packages for building
    ```zsh
    brew install libffi gettext glib pkg-config autoconf automake pixman ninja
  16. nrjdalal revised this gist Jun 6, 2021. No changes.
  17. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions QEMU-Silicon-Mac-Installation.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,10 @@
    zsh -c "$(curl -fsSL https://raw.githubusercontent.com/nrjdalal/silicon-virtualizer/master/install-qemu.sh)"
    ```
    ## Option 2 - Manually
    * ### Install necessary packages for building
    ```zsh
    brew install libffi gettext glib pkg-config autoconf automake pixman ninja
    ```
    * ### Clone qemu
    ```zsh
    git clone https://github.com/qemu/qemu
  18. nrjdalal revised this gist Jun 6, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion QEMU-Silicon-Mac-Installation.md
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@
    zsh -c "$(curl -fsSL https://raw.githubusercontent.com/nrjdalal/silicon-virtualizer/master/install-qemu.sh)"
    ```
    ## Option 2 - Manually
    * ### Install qemu
    * ### Clone qemu
    ```zsh
    git clone https://github.com/qemu/qemu
    ```
  19. nrjdalal created this gist Jun 6, 2021.
    33 changes: 33 additions & 0 deletions QEMU-Silicon-Mac-Installation.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,33 @@
    # Latest way to install QEMU on Silicon based Apple Macs as of June 2021

    ## Option 1 - Automatically
    ```zsh
    zsh -c "$(curl -fsSL https://raw.githubusercontent.com/nrjdalal/silicon-virtualizer/master/install-qemu.sh)"
    ```
    ## Option 2 - Manually
    * ### Install qemu
    ```zsh
    git clone https://github.com/qemu/qemu
    ```
    * ### Change directory to qemu repository
    ```zsh
    cd qemu
    ```
    * ### Checkout to commit dated June 03, 2021 v6.0.0
    ```zsh
    git checkout 3c93dfa42c394fdd55684f2fbf24cf2f39b97d47
    ```
    * ### Apply patch series v8 by Alexander Graf
    ```zsh
    curl https://patchwork.kernel.org/series/485309/mbox/ | git am
    ```
    * ### Building qemu installer
    ```zsh
    mkdir build && cd build
    ../configure --target-list=aarch64-softmmu
    make -j8
    ```
    * ### Install qemu
    ```zsh
    sudo make install
    ```