-
-
Notifications
You must be signed in to change notification settings - Fork 85
4. Virtualization
Athena OS can be used also on virtualization platforms as VirtualBox, VMware Workstation, QEMU, and so on.
Some of them are not easy to configure and the correct steps for using them are shown in the next sections.
For using QEMU on Windows Host, it is important to enable Virtualization by the BIOS and have Hyper-V enabled in order to use WHPX as accelerator.
First, reboot and access to your BIOS, select the Virtualization Technology, Intel Virtual Technology, or SVM Mode option (the feature name will depend on your manufacturer). Enable the virtualization feature. Save configuration and reboot.
After reboot, when landed on Windows, create a file called hyperv-home.bat
with the following content:
pushd "%~dp0"
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hv-home.txt
for /f %%i in ('findstr /i . hv-home.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
del hv-home.txt
Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL
pause
Run it. This script will download and install Hyper-V feature if your Windows does not have it.
Then, by Windows search bar reach Turn Windows features on or off
and check for Hyper-V
, Virtual Machine Platform
and Windows Hypervisor Platform
. Click OK and reboot.
Open PowerShell as Administrator and run bcdedit /enum
and be sure that hypervisorlaunchtype
is set to Auto
(that means "ON"). If not, run bcdedit /set hypervisorlaunchtype auto
.
Now install QEMU for Windows from the official website. After the installation, go to the Windows search bar and reach Edit the system environment variables
. Click on Environment Variables...
, go to Path
, click on Edit...
, click on New
and add the QEMU installation path (by default is: C:\Program Files\qemu
). Click OK on all opened windows.
Since it could be very useful running our Athena OS by UEFI, we need to retrieve UEFI libraries for allowing QEMU to work in UEFI mode. For doing this, from https://www.kraxel.org/repos/jenkins/edk2/ download the latest version of edk2.git-ovmf-x64-0-20220719.209.gf0064ac3af.EOL.no.nore.updates.noarch.rpm
file, then by 7zip, extract the content in a new folder. You will get a .cpio
file. Again, by 7zip, extract the content of this .cpio
file in a folder. It will contain our .fd
file for allowing QEMU to run in UEFI mode. We will use the path to this file in the final QEMU command.
Now it is all set for running Athena OS on QEMU!
Open PowerShell. For first we need to create a disk where we must install Athena OS. Do it by running:
qemu-img create -f qcow2 athena30.img 30G
30G
is the disk space we would like to assign to the disk. athena30.img
will be created in the current directory but if you wish, you can type the entire path you would like to store it.
Now, we can run Athena OS by QEMU:
qemu-system-x86_64.exe -boot order=dc -hda .\athena30.img -cdrom .\VirtualShare\athena-2023.01.23-x86_64.iso -m 4G -accel whpx,kernel-irqchip=off -smp 2 -device VGA -device qemu-xhci -bios C:\Users\<USERNAME>\Downloads\edk2.git-ovmf-x64-0-20220719.209.gf0064ac3af.EOL.no.nore.updates.noarch\usr\share\edk2.git\ovmf-x64\OVMF_CODE-pure-efi.fd -cpu Nehalem -chardev socket,id=qga0,server=on,wait=off -device virtio-serial-pci,id=virtio-serial0 -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=qga0,id=channel0,name=org.qemu.guest_agent.0
By this command, QEMU will boot the Athena OS ISO that we use for installing Athena. After the installation, turn off the virtual machine and, for booting directly to the Athena OS disk, just remove -cdrom <path-to-iso>
argument. The final QEMU command to call is:
qemu-system-x86_64.exe -boot order=c -hda .\athena30.img -m 4G -accel whpx,kernel-irqchip=off -smp 2 -device VGA -device qemu-xhci -bios 'C:\Users\Username\Downloads\edk2.git-ovmf-x64-0-20220719.209.gf0064ac3af.EOL.no.nore.updates.noarch\usr\share\edk2.git\ovmf-x64\OVMF_CODE-pure-efi.fd' -cpu Nehalem -chardev socket,id=qga0,server=on,wait=off -device virtio-serial-pci,id=virtio-serial0 -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=qga0,id=channel0,name=org.qemu.guest_agent.0
The command above enables the virtual machine to use QEMU Guest Agent. In general, a Linux distro that would like to use it, need to install qemu-guest-agent
package, then run sudo systemctl restart qemu-guest-agent
. At the end, just verify it is active by running sudo systemctl status qemu-guest-agent
.
Parameter | Description |
---|---|
-boot order=dc |
Set the boot order. d refers to the -cdrom entry and c to the -hda entry. |
-hda <path-to-img> |
Specify the disk to boot. |
-cdrom <path-to-iso> |
Specify the ISO to boot. |
-m <size> |
Set the RAM size. |
-accel <accelerator> |
Specify the accelerator to use. |
-smp <core-number> |
Set the number of cores to use. |
-bios <path-to-bios-mode-file> |
Specify the BIOS mode to use (i.e., UEFI). |
-cpu <CPU type> |
Set the CPU type to use. |
-chardev socket,id=qga0,server=on,wait=off -device virtio-serial-pci,id=virtio-serial0 -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=qga0,id=channel0,name=org.qemu.guest_agent.0 |
Enable the usage of QEMU Guest Agent. |
The main disadvantage of using QEMU on a Windows host does not allow to perform a GPU Passthrough, it means that all virtual machines running there will work by Software Rendering as graphics.
- https://www.qemu.org/docs/master/about/build-platforms.html
- https://pureinfotech.com/enable-hyper-v-windows-11/
- https://linuxhint.com/qemu-windows/
- https://superuser.com/questions/1208850/why-cant-virtualbox-or-vmware-run-with-hyper-v-enabled-on-windows-10
- https://raduzaharia.medium.com/system-emulation-using-qemu-hardware-pass-through-and-acceleration-97ae11e613be
- https://superuser.com/questions/1471510/why-vm-qemu-is-very-slow-still-a-newbie-here
- https://edwardhalferty.com/2020/11/02/os-dev-with-qemu-ovmf-and-gdb-on-windows/
- https://www.reddit.com/r/virtualization/comments/plx1xo/hyperv_gpu_passthrough_to_linux_vm/
For first, install QEMU-related packages:
sudo pacman -S qemu-full virt-manager dnsmasq
Then, run the right services:
sudo systemctl enable libvirtd
sudo systemctl start libvirtd
sudo systemctl enable dnsmasq
sudo systemctl start dnsmasq
For creating a virtual machine, open Virtual Manager, click on File -> New Virtual Machine, then:
- expand
Architecture options
and select the architecture you need, and keepLocal install media (ISO image or CDROM)
option and clickForward
; - click
Browse...
and select for the ISO, then choose the operating system you are installing on the search field below of the window; - set memory size and CPUs;
- set the size of the disk;
- set the name of the VM and check on
Customize configuration before install
; - in the new window, select
CPUs
tab, expandTopology
, selectManually set CPU topology
and exchange the value ofSockets
with the value ofCores
; - click
Apply
and thenBegin Installation
on the top-left side of the window.