-
-
Save daluu/bb5832838e413e6b30e73f1d0eb7d95e to your computer and use it in GitHub Desktop.
Revisions
-
citruz revised this gist
Jun 1, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -10,6 +10,8 @@ > 07.03.2021: Updated instructions to apply patch cleanly > 01.06.2021: Updated instructions for Xcode 12.4 and above ## Building QEMU - Clone QEMU and checkout version 5.2.0 ```bash -
citruz revised this gist
Jun 1, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,9 +21,9 @@ git checkout v5.2.0 ```bash curl https://patchwork.kernel.org/series/418581/mbox/ | git am --exclude=MAINTAINERS ``` - If you use Xcode 12.4 or above, you will need another patch to fix the QEMU build. Download [xcode-12-4.patch](https://gist.github.com/citruz/9896cd6fb63288ac95f81716756cb9aa/raw/2d613e9a003b28dfe688f33055706d3873025a40/xcode-12-4.patch) from below and apply it using ```bash git apply xcode-12-4.patch ``` - Install the **ARM** version of the brew package manager. The (recommended) installation via Rosetta will cause problems when building QEMU. Even if brew screams at you at every launch that this is not a supported configuration I had no major problems so far. You can follow [this guide](https://soffes.blog/homebrew-on-apple-silicon) (see the "Multiple Homebrews" section). - Install required packages for building: -
citruz revised this gist
Jun 1, 2021 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,6 +21,10 @@ git checkout v5.2.0 ```bash curl https://patchwork.kernel.org/series/418581/mbox/ | git am --exclude=MAINTAINERS ``` - If you use Xcode 12.4 or above, you will need another patch to fix the QEMU build ```bash curl https://gist.github.com/citruz/9896cd6fb63288ac95f81716756cb9aa/raw/2d613e9a003b28dfe688f33055706d3873025a40/xcode-12-4.patch | git apply ``` - Install the **ARM** version of the brew package manager. The (recommended) installation via Rosetta will cause problems when building QEMU. Even if brew screams at you at every launch that this is not a supported configuration I had no major problems so far. You can follow [this guide](https://soffes.blog/homebrew-on-apple-silicon) (see the "Multiple Homebrews" section). - Install required packages for building: ```bash -
citruz revised this gist
Jun 1, 2021 . 1 changed file with 49 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,49 @@ diff --git a/Makefile b/Makefile index bcbbec71a1..8b75085fa5 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ x := $(shell rm -rf meson-private meson-info meson-logs) endif # 1. ensure config-host.mak is up-to-date -config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION +config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/QEMU_VERSION @echo config-host.mak is out-of-date, running configure @if test -f meson-private/coredata.dat; then \ ./config.status --skip-meson; \ @@ -204,7 +204,7 @@ clean: recurse-clean rm -f TAGS cscope.* *.pod *~ */*~ rm -f fsdev/*.pod scsi/*.pod -VERSION = $(shell cat $(SRC_PATH)/VERSION) +VERSION = $(shell cat $(SRC_PATH)/QEMU_VERSION) dist: qemu-$(VERSION).tar.bz2 diff --git a/QEMU_VERSION b/QEMU_VERSION new file mode 100644 index 0000000000..5214c0b8b9 --- /dev/null +++ b/QEMU_VERSION @@ -0,0 +1 @@ +5.2.0 diff --git a/VERSION b/VERSION deleted file mode 100644 index 5214c0b8b9..0000000000 --- a/VERSION +++ /dev/null @@ -1 +0,0 @@ -5.2.0 diff --git a/meson.build b/meson.build index 2dc66ae930..a8f8a02b3f 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project('qemu', ['c'], meson_version: '>=0.55.0', default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11', 'b_colorout=auto'] + (meson.version().version_compare('>=0.56.0') ? [ 'b_staticpic=false' ] : []), - version: run_command('head', meson.source_root() / 'VERSION').stdout().strip()) + version: run_command('head', meson.source_root() / 'QEMU_VERSION').stdout().strip()) not_found = dependency('', required: false) if meson.version().version_compare('>=0.56.0') -
citruz revised this gist
Mar 23, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ brew install libffi gettext pkg-config autoconf automake pixman ```bash mkdir build cd build ../configure --target-list=aarch64-softmmu --disable-gnutls make -j8 sudo make install ``` -
citruz revised this gist
Mar 7, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -17,7 +17,7 @@ git clone https://github.com/qemu/qemu cd qemu git checkout v5.2.0 ``` - Apply the patchseries by Alexander Graf https://lore.kernel.org/qemu-devel/[email protected]/ ```bash curl https://patchwork.kernel.org/series/418581/mbox/ | git am --exclude=MAINTAINERS ``` -
citruz revised this gist
Mar 7, 2021 . 1 changed file with 9 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,11 +8,18 @@ > 31.01.2020: Updated with patchseries v6 > 07.03.2021: Updated instructions to apply patch cleanly ## Building QEMU - Clone QEMU and checkout version 5.2.0 ```bash git clone https://github.com/qemu/qemu cd qemu git checkout v5.2.0 ``` - Apply the patchseries by Alexander Graf https://patchwork.kernel.org/project/qemu-devel/list/?series=418581 ```bash curl https://patchwork.kernel.org/series/418581/mbox/ | git am --exclude=MAINTAINERS ``` - Install the **ARM** version of the brew package manager. The (recommended) installation via Rosetta will cause problems when building QEMU. Even if brew screams at you at every launch that this is not a supported configuration I had no major problems so far. You can follow [this guide](https://soffes.blog/homebrew-on-apple-silicon) (see the "Multiple Homebrews" section). - Install required packages for building: -
citruz revised this gist
Jan 31, 2021 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,11 +6,13 @@ > 08.12.2020: Updated with patchseries v4 > 31.01.2020: Updated with patchseries v6 ## Building QEMU - Clone or download QEMU (I went with v5.2.0-rc3 but I don't think it matters) - Apply the patchseries by Alexander Graf https://patchwork.kernel.org/project/qemu-devel/list/?series=418581 ```bash curl https://patchwork.kernel.org/series/418581/mbox/ | git am ``` - Install the **ARM** version of the brew package manager. The (recommended) installation via Rosetta will cause problems when building QEMU. Even if brew screams at you at every launch that this is not a supported configuration I had no major problems so far. You can follow [this guide](https://soffes.blog/homebrew-on-apple-silicon) (see the "Multiple Homebrews" section). - Install required packages for building: -
citruz revised this gist
Dec 8, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,7 +22,7 @@ brew install libffi gettext pkg-config autoconf automake pixman mkdir build cd build ../configure --target-list=aarch64-softmmu make -j8 sudo make install ``` - For some reason, the qemu binary is modified during `make install`. You need to resign it with the correct entitlements, otherwise you will get an `Unknown Error`: -
citruz revised this gist
Dec 8, 2020 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,14 +2,15 @@ > 30.11.2020: Updated with the new patchseries and instructions for Windows > 02.12.2020: Added tweaks > 08.12.2020: Updated with patchseries v4 ## Building QEMU - Clone or download QEMU (I went with v5.2.0-rc3 but I don't think it matters) - Apply the patchseries by Alexander Graf https://patchwork.kernel.org/project/qemu-devel/list/?series=395899 ```bash curl https://patchwork.kernel.org/series/395899/mbox/ | git am ``` - Install the **ARM** version of the brew package manager. The (recommended) installation via Rosetta will cause problems when building QEMU. Even if brew screams at you at every launch that this is not a supported configuration I had no major problems so far. You can follow [this guide](https://soffes.blog/homebrew-on-apple-silicon) (see the "Multiple Homebrews" section). - Install required packages for building: -
citruz revised this gist
Dec 2, 2020 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -50,7 +50,8 @@ qemu-system-aarch64 \ -serial telnet::4444,server,nowait \ -drive if=none,file=disk.qcow2,format=qcow2,id=hd0 \ -device virtio-blk-device,drive=hd0,serial="dummyserial" \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0 \ -vga none -device ramfb \ -cdrom /path/to/ubuntu.iso \ -device usb-ehci -device usb-kbd -device usb-mouse -usb \ @@ -98,7 +99,10 @@ Proper NAT networking is currently not possible with QEMU due to the lack of tap ```bash -nic user,model=virtio,hostfwd=tcp:127.0.0.1:3389-0.0.0.0:3389 \ ``` In this case the port for RDP is forwarded so that I can connect to the VM at localhost:3389. The same for Ubuntu/SSH: ```bash -netdev user,id=net0,hostfwd=tcp:127.0.0.1:2222-0.0.0.0:22 \ ``` ### Disk Snapshots Some users experience a random filesystem corruptions when booting Windows which can be avoided with the `cache=writethrough` for the hard drive. You can also perform disk snapshots to save the state of the hard disk at a certain point in time and restore it later. To do this, shut the VM down and create a new disk with your original image as the backing file: -
citruz revised this gist
Dec 2, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,8 @@ # Running Linux and Windows on M1 with QEMU > 30.11.2020: Updated with the new patchseries and instructions for Windows > 2.12.2020: Added tweaks ## Building QEMU -
citruz revised this gist
Dec 2, 2020 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ # Running Linux and Windows on M1 with QEMU > 30.11.2020: Updated with the new patchseries and instructions for Windows > 2.12.2020: Added tweaks ## Building QEMU - Clone or download QEMU (I went with v5.2.0-rc3 but I don't think it matters) -
citruz revised this gist
Dec 2, 2020 . 1 changed file with 25 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,7 @@ ```bash curl https://patchwork.kernel.org/series/392975/mbox/ | git am ``` - Install the **ARM** version of the brew package manager. The (recommended) installation via Rosetta will cause problems when building QEMU. Even if brew screams at you at every launch that this is not a supported configuration I had no major problems so far. You can follow [this guide](https://soffes.blog/homebrew-on-apple-silicon) (see the "Multiple Homebrews" section). - Install required packages for building: ```bash brew install libffi gettext pkg-config autoconf automake pixman @@ -46,8 +47,7 @@ qemu-system-aarch64 \ -serial telnet::4444,server,nowait \ -drive if=none,file=disk.qcow2,format=qcow2,id=hd0 \ -device virtio-blk-device,drive=hd0,serial="dummyserial" \ -nic user,model=virtio \ -vga none -device ramfb \ -cdrom /path/to/ubuntu.iso \ -device usb-ehci -device usb-kbd -device usb-mouse -usb \ @@ -72,10 +72,9 @@ qemu-system-aarch64 \ -drive file=/usr/local/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on \ -drive file=ovmf_vars.fd,if=pflash,format=raw \ -serial telnet::4444,server,nowait \ -drive if=none,file=Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX,format=vhdx,id=hd0,cache=writethrough \ -device nvme,drive=hd0,serial="dummyserial" \ -nic user,model=virtio \ -vga none -device ramfb \ -device usb-ehci -device usb-kbd -device usb-mouse -usb \ -monitor stdio @@ -87,4 +86,24 @@ qemu-system-aarch64 \ Windows does not support VirtIO network interfaces out of the box. To get it working, you need to install additional drivers. See this [gist](https://gist.github.com/niw/e4313b9c14e968764a52375da41b4278#enable-the-internet) for a guide (be sure to use version [0.1.190](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.190-1/virtio-win-0.1.190.iso) instead of 0.1.185) ### Resolution The resolution is set to 800x600 by default. To change it, hit Esc at the immediately after starting the VM, while you see the tianocore logo, to get into the OVMF config menu. Choose `Device Manager` -> `OVMF Platform Configuration` -> `Change Preferred` -> Select `1024x768` -> `Commit Changes and Exit` -> Esc -> `Reset`. ## Tweaks ### Port Forwarding Proper NAT networking is currently not possible with QEMU due to the lack of tap devices in macOS Big Sur. If you just want to be able to connect to a port on the VM (e.g. for SSH or RDP), you can configure QEMU to forward a local port to the VM: ```bash -nic user,model=virtio,hostfwd=tcp:127.0.0.1:3389-0.0.0.0:3389 \ ``` In this case the port for RDP is forwarded so that I can connect to the VM at localhost:3389. ### Disk Snapshots Some users experience a random filesystem corruptions when booting Windows which can be avoided with the `cache=writethrough` for the hard drive. You can also perform disk snapshots to save the state of the hard disk at a certain point in time and restore it later. To do this, shut the VM down and create a new disk with your original image as the backing file: ```bash qemu-img create -b Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX -F vhdx -f qcow2 disk.qcow2 ``` Now, adjust the `-drive` parameter so that QEMU boots from your new image: ```bash -drive if=none,file=disk.qcow2,format=qcow2,id=hd0,cache=writethrough \ ``` If something goes wrong you can now delete `disk.qcow2` and recreate it using the same commmand to back to the original state. -
citruz revised this gist
Dec 1, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -87,4 +87,4 @@ qemu-system-aarch64 \ Windows does not support VirtIO network interfaces out of the box. To get it working, you need to install additional drivers. See this [gist](https://gist.github.com/niw/e4313b9c14e968764a52375da41b4278#enable-the-internet) for a guide (be sure to use version [0.1.190](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.190-1/virtio-win-0.1.190.iso) instead of 0.1.185) ### Resolution The resolution is set to 800x600 by default. To change it, hit Esc at the immediately after starting the VM, while you see the tianocore logo, to get into the OVMF config menu. Choose `Device Manager` -> `OVMF Platform Configuration` -> `Change Preferred` -> Select `1024x768` -> `Commit Changes and Exit` -> Esc -> `Reset`. -
citruz revised this gist
Dec 1, 2020 . 1 changed file with 12 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,13 +31,18 @@ sudo codesign --entitlements /path/to/qemu/accel/hvf/entitlements.plist --force ```bash qemu-img create -f qcow2 disk.qcow2 10G ``` - Create an empty file for persisting UEFI variables: ```bash dd if=/dev/zero conv=sync bs=1m count=64 of=ovmf_vars.fd ``` - Run qemu with the following command-line arguments: ```bash qemu-system-aarch64 \ -accel hvf \ -m 2048 \ -cpu cortex-a57 -M virt,highmem=off \ -drive file=/usr/local/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on \ -drive file=ovmf_vars.fd,if=pflash,format=raw \ -serial telnet::4444,server,nowait \ -drive if=none,file=disk.qcow2,format=qcow2,id=hd0 \ -device virtio-blk-device,drive=hd0,serial="dummyserial" \ @@ -53,14 +58,19 @@ qemu-system-aarch64 \ ## Create Windows VM - Download Windows for ARM from [here](https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64) - Create an empty file for persisting UEFI variables: ```bash dd if=/dev/zero conv=sync bs=1m count=64 of=ovmf_vars.fd ``` - For Windows, we need to replace the VirtIO block device with something that is supported natively by the OS. Otherwise, the command-line is almost unchanged - You may want to pass multiple cores to the VM using `-smp X`: ```bash qemu-system-aarch64 \ -accel hvf \ -m 2048 -smp 2 \ -cpu cortex-a72 -M virt,highmem=off \ -drive file=/usr/local/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on \ -drive file=ovmf_vars.fd,if=pflash,format=raw \ -serial telnet::4444,server,nowait \ -drive if=none,file=Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX,format=vhdx,id=hd0 \ -device nvme,drive=hd0,serial="dummyserial" \ -
citruz revised this gist
Nov 30, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -77,4 +77,4 @@ qemu-system-aarch64 \ Windows does not support VirtIO network interfaces out of the box. To get it working, you need to install additional drivers. See this [gist](https://gist.github.com/niw/e4313b9c14e968764a52375da41b4278#enable-the-internet) for a guide (be sure to use version [0.1.190](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.190-1/virtio-win-0.1.190.iso) instead of 0.1.185) ### Resolution The resolution is set to 800x600 by default. To change it, hit Esc at the immediately after starting the VM, while you see the tianocore logo, to get into the OVMF config menu. Choose `Device Manager` -> `OVMF Platform Configuration` -> `Change Preferred` -> Select `1024x768` -> `Commit Changes and Exit` -> Esc -> `Reset`. This change will not persist, you have to repeat the same steps after every boot. -
citruz revised this gist
Nov 30, 2020 . No changes.There are no files selected for viewing
-
citruz revised this gist
Nov 30, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -74,7 +74,7 @@ qemu-system-aarch64 \ ## Limitations ### Networking on Windows Windows does not support VirtIO network interfaces out of the box. To get it working, you need to install additional drivers. See this [gist](https://gist.github.com/niw/e4313b9c14e968764a52375da41b4278#enable-the-internet) for a guide (be sure to use version [0.1.190](https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.190-1/virtio-win-0.1.190.iso) instead of 0.1.185) ### Resolution The resolution is fixed at 800x600. You can change it in OVMF but it does not seem to have an effect. -
citruz revised this gist
Nov 30, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -74,7 +74,7 @@ qemu-system-aarch64 \ ## Limitations ### Networking on Windows Windows does not support VirtIO network interfaces out of the box. To get it working, you need to install additional drivers. See this [gist](https://gist.github.com/niw/e4313b9c14e968764a52375da41b4278#enable-the-internet) for a guide (be sure to use version (0.1.190)[https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.190-1/virtio-win-0.1.190.iso] instead of 0.1.185) ### Resolution The resolution is fixed at 800x600. You can change it in OVMF but it does not seem to have an effect. -
citruz revised this gist
Nov 30, 2020 . 2 changed files with 34 additions and 26 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,13 @@ # Running Linux and Windows on M1 with QEMU > 30.11.2020: Updated with the new patchseries and instructions for Windows ## Building QEMU - Clone or download QEMU (I went with v5.2.0-rc3 but I don't think it matters) - Apply the patchseries by Alexander Graf https://patchwork.kernel.org/project/qemu-devel/list/?series=392975 ```bash curl https://patchwork.kernel.org/series/392975/mbox/ | git am ``` - Install required packages for building: ```bash brew install libffi gettext pkg-config autoconf automake pixman @@ -12,7 +16,7 @@ brew install libffi gettext pkg-config autoconf automake pixman ```bash mkdir build cd build ../configure --target-list=aarch64-softmmu make sudo make install ``` @@ -21,7 +25,7 @@ sudo make install sudo codesign --entitlements /path/to/qemu/accel/hvf/entitlements.plist --force -s - `which qemu-system-aarch64` ``` ## Create Ubuntu VM - Download Ubuntu Server for ARM https://ubuntu.com/download/server/arm - Create a hard disk: ```bash @@ -32,7 +36,7 @@ qemu-img create -f qcow2 disk.qcow2 10G qemu-system-aarch64 \ -accel hvf \ -m 2048 \ -cpu cortex-a57 -M virt,highmem=off \ -bios edk2-aarch64-code.fd \ -serial telnet::4444,server,nowait \ -drive if=none,file=disk.qcow2,format=qcow2,id=hd0 \ @@ -47,10 +51,30 @@ qemu-system-aarch64 \ - You should be able to install Ubuntu as normal - If you want a desktop environment, you can install it using `sudo apt-get install ubuntu-desktop` ## Create Windows VM - Download Windows for ARM from [here](https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewARM64) - For Windows, we need to replace the VirtIO block device with something that is supported natively by the OS. Otherwise, the command-line is almost unchanged - You may want to pass multiple cores to the VM using `-smp X`: ```bash qemu-system-aarch64 \ -accel hvf \ -m 2048 -smp 2 \ -cpu cortex-a72 -M virt,highmem=off \ -bios edk2-aarch64-code.fd \ -serial telnet::4444,server,nowait \ -drive if=none,file=Windows10_InsiderPreview_Client_ARM64_en-us_20231.VHDX,format=vhdx,id=hd0 \ -device nvme,drive=hd0,serial="dummyserial" \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0 \ -vga none -device ramfb \ -device usb-ehci -device usb-kbd -device usb-mouse -usb \ -monitor stdio ``` ## Limitations ### Networking on Windows Windows does not support VirtIO network interfaces out of the box. To get it working, you need to install additional drivers. See this [gist](https://gist.github.com/niw/e4313b9c14e968764a52375da41b4278#enable-the-internet) for a guide. ### Resolution The resolution is fixed at 800x600. You can change it in OVMF but it does not seem to have an effect. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,16 +0,0 @@ -
citruz revised this gist
Nov 29, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -45,7 +45,7 @@ qemu-system-aarch64 \ -monitor stdio ``` - You should be able to install Ubuntu as normal - If you want a desktop environment, you can install it using `sudo apt-get install ubuntu-desktop` ## Limitations -
citruz renamed this gist
Nov 29, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
citruz revised this gist
Nov 29, 2020 . 1 changed file with 41 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,6 @@ # Running Ubuntu on M1 with QEMU ## Building QEMU - Clone or download QEMU (I went with v5.2.0-rc3 but I don't think it matters) - Apply the patchseries by Alexander Graf, either manually or using git-pw https://patchwork.kernel.org/project/qemu-devel/list/?series=391797 - Apply the additional patch from below ([source](https://twitter.com/_AlexGraf/status/1332835011825963009)) @@ -13,3 +16,41 @@ cd build make sudo make install ``` - For some reason, the qemu binary is modified during `make install`. You need to resign it with the correct entitlements, otherwise you will get an `Unknown Error`: ```bash sudo codesign --entitlements /path/to/qemu/accel/hvf/entitlements.plist --force -s - `which qemu-system-aarch64` ``` ## Create VM - Download Ubuntu Server for ARM https://ubuntu.com/download/server/arm - Create a hard disk: ```bash qemu-img create -f qcow2 disk.qcow2 10G ``` - Run qemu with the following command-line arguments: ```bash qemu-system-aarch64 \ -accel hvf \ -m 2048 \ -cpu cortex-a57 -M virt \ -bios edk2-aarch64-code.fd \ -serial telnet::4444,server,nowait \ -drive if=none,file=disk.qcow2,format=qcow2,id=hd0 \ -device virtio-blk-device,drive=hd0,serial="dummyserial" \ -device virtio-net-device,netdev=net0 \ -netdev user,id=net0 \ -vga none -device ramfb \ -cdrom /path/to/ubuntu.iso \ -device usb-ehci -device usb-kbd -device usb-mouse -usb \ -monitor stdio ``` - You should be able to install Ubuntu as normal - If you want a GUI, you can install it afterwards using `sudo apt-get install ubuntu-desktop` ## Limitations ### Resolution The resolution is fixed at 800x600. You can change it in OVMF but it does not seem to have an effect. ### Power Management Power down and reset don't work properly yet. -
citruz revised this gist
Nov 29, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ - Clone or download QEMU (I went with v5.2.0-rc3 but I don't think it matters) - Apply the patchseries by Alexander Graf, either manually or using git-pw https://patchwork.kernel.org/project/qemu-devel/list/?series=391797 - Apply the additional patch from below ([source](https://twitter.com/_AlexGraf/status/1332835011825963009)) - Install required packages for building: ```bash brew install libffi gettext pkg-config autoconf automake pixman -
citruz revised this gist
Nov 29, 2020 . 2 changed files with 17 additions and 19 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,6 @@ - Clone or download QEMU (I went with v5.2.0-rc3 but I don't think it matters) - Apply the patchseries by Alexander Graf, either manually or using git-pw https://patchwork.kernel.org/project/qemu-devel/list/?series=391797 - Apply the additional patch from below ((source)[https://twitter.com/_AlexGraf/status/1332835011825963009]) - Install required packages for building: ```bash brew install libffi gettext pkg-config autoconf automake pixman This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,16 @@ --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -150,9 +150,14 @@ int hvf_arch_init_vcpu(CPUState *cpu) { ARMCPU *arm_cpu = ARM_CPU(cpu); CPUARMState *env = &arm_cpu->env; + hv_return_t ret; env->aarch64 = 1; + ret = hv_vcpu_set_sys_reg(cpu->hvf_fd, HV_SYS_REG_SCTLR_EL1, + arm_cpu->reset_sctlr); + assert_hvf_ok(ret); + return 0; } -
citruz created this gist
Nov 29, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ - Clone or download QEMU (I went with v5.2.0-rc3 but I don't think it matters) - Apply the patchseries by Alexander Graf, either manually or using git-pw https://patchwork.kernel.org/project/qemu-devel/list/?series=391797 - Apply the following additional patch: https://twitter.com/_AlexGraf/status/1332835011825963009 ```patch --- a/target/arm/hvf/hvf.c +++ b/target/arm/hvf/hvf.c @@ -150,9 +150,14 @@ int hvf_arch_init_vcpu(CPUState *cpu) { ARMCPU *arm_cpu = ARM_CPU(cpu); CPUARMState *env = &arm_cpu->env; + hv_return_t ret; env->aarch64 = 1; + ret = hv_vcpu_set_sys_reg(cpu->hvf_fd, HV_SYS_REG_SCTLR_EL1, + arm_cpu->reset_sctlr); + assert_hvf_ok(ret); + return 0; } ``` - Install required packages for building: ```bash brew install libffi gettext pkg-config autoconf automake pixman ``` - Run the following commands to build qemu: ```bash mkdir build cd build ../configure --target-list=aarch64-softmmu --enable-hvf make sudo make install ```