Skip to content

Commit

Permalink
Complete Host Preparations Conversion!
Browse files Browse the repository at this point in the history
  • Loading branch information
royalgraphx committed Jun 26, 2023
1 parent 69c1b5b commit d946d54
Show file tree
Hide file tree
Showing 19 changed files with 270 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Depending on your machine's CPU, you need to enable certain settings in your BIO

<br>

If you do not have any virtualization settings, chances are they're already enabled, but double check that your BIOS is up to date, and that your CPU and motherboard support virtualization.
If you do not have any virtualization settings, chances are they're already enabled, but double-check that your BIOS is up to date and that your CPU and motherboard support virtualization.

<br>
<br>
Expand Down
15 changes: 15 additions & 0 deletions docs/404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
layout: default
title: 404
nav_exclude: true
---

<p align="center">
<img src="../assets/DarwinKVMLogo.png" width="30%" height="30%">
</p>

<p align="center">
<img width="650" height="200" src="../assets/Header404.png">
</p>

<h1 align="center"><a href="index.html">Return Home</a></h1>
17 changes: 17 additions & 0 deletions docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ favicon_ico: "/assets/favicon.ico"

url: https://royalgraphx.github.io/DarwinKVM/docs

callouts_opacity: 0.4
callouts:
highlight:
color: canary
important:
title: Important
color: blueish
new:
title: New
color: teal
note:
title: Note
color: grey-lt
warning:
title: Warning
color: reddish

include:
- docs
- _sass
Expand Down
24 changes: 24 additions & 0 deletions docs/_sass/custom/setup.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
$pink-000: #f77ef1;
$pink-100: #f967f1;
$pink-200: #e94ee1;
$pink-300: #dd2cd4;
$canary-000: #e7e142;
$canary-100: #bcb716;
$canary-200: #ece626;
$canary-300: #fff839;
$teal-000: #008080;
$teal-100: #009688;
$teal-200: #00796B;
$teal-300: #00dfc5;
$reddish-000: #FF4D4D;
$reddish-100: #E63939;
$reddish-200: #C62828;
$reddish-300: #eb2a2a;
$blueish-000: #253746;
$blueish-100: #1E2A37;
$blueish-200: #18222C;
$blueish-300: #7cbae3;
$different-blue-100: #6DA6D2;
$different-blue-200: #519CCB;
$different-blue-300: #368AC2;
$different-blue-400: #1C79BA;
Binary file added docs/assets/Header404.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/docs/01-About.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ This repository and its contents are to be a continuation of my work on [LegacyO

This is for experienced users. You should already be familiar with 3 core concepts: [Virtualization](https://libvirt.org/)/[QEMU](https://www.qemu.org/docs/master/), [OpenCore](https://dortania.github.io/OpenCore-Install-Guide/), and [macOS](https://en.wikipedia.org/wiki/MacOS). If you feel as though you are not up to speed on any of these concepts, please take the time to first gain adequate knowledge as it will vastly improve your chances of having a working system you can daily drive. This guide is written completely from my perspective as I've learned throughout my time in the Hackintosh community. What you would typically do if you wanted to run macOS on your system you would have to use the OpenCore bootloader to provide macOS with the necessary information it needs. A Virtual Machine is no different. In theory, what we are simply doing is creating an OpenCore disk image that acts as if it were the equivalent of a USB or an EFI partition post-installation. While there exist many projects that utilize QEMU/KVM, for daily driving you must have a compatible GPU. What this means for the user of any projects that are seen as the equivalent to "Prebuilt EFI's" is that there is no learning involved. This causes the user to not understand why certain things are broken on their system and possibly may never fix those issues, potentially leaving them in the background. This guide is for those who are looking to properly create a macOS Virtual Machine from the ground up. <b>PLEASE READ CAREFULLY.</b> Try not to ask for support before rereading, many times you will misread something on accident or are simply not paying enough attention to what it's instructing you to do.

<h1>You can now proceed to the <a href="docs/02-HostPreparations">Host Preparations</a> section!</h1>
<h1>You can now proceed to the <a href="02-HostPreparations/">Host Preparations</a> section!</h1>
18 changes: 17 additions & 1 deletion docs/docs/02-HostPreparations/01-BIOS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,20 @@ layout: default
title: Part 1. BIOS Settings
parent: Host Preparations
nav_order: 1
---
---

# BIOS Settings
#### Will depend on your Host Hardware.
#### This section has been derived from the <a href="https://gitlab.com/risingprismtv/single-gpu-passthrough/-/wikis/1)-Preparations">Preparations</a> section via <a href="https://gitlab.com/risingprismtv/single-gpu-passthrough/-/wikis/home">RisingPrism</a>.

Depending on your machine's CPU, you need to enable certain settings in your BIOS for your passthrough to succeed. Enable the settings listed in this table:

| AMD | Intel |
| ---- | ----- |
| IOMMU | VT-d |
| NX Mode | XD (eXecute Disable) Bit |
| SVM Mode | VT-x |

If you do not have any virtualization settings, chances are they're already enabled, but double-check that your BIOS is up to date and that your CPU and motherboard support virtualization.

## You can now continue to the next <a href="02-GRUB.html">page</a>.
32 changes: 31 additions & 1 deletion docs/docs/02-HostPreparations/02-GRUB.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,34 @@ layout: default
title: Part 2. GRUB Configuration
parent: Host Preparations
nav_order: 2
---
---

# GRUB Configuration
#### Enabling flags needed for Virtualization/QEMU/KVM/libvirtd
#### This section has been derived from the <a href="https://gitlab.com/risingprismtv/single-gpu-passthrough/-/wikis/2)-Editing-GRUB">Editing GRUB</a> section via <a href="https://gitlab.com/risingprismtv/single-gpu-passthrough/-/wikis/home">RisingPrism</a>.

Start by using your favorite terminal text editor. In this example, we'll be using nano. Note: If you're not using GRUB, follow the same steps, but refer to the Arch Wiki on how to edit the config file.

```
sudo nano /etc/default/grub
```

We'll need to check our GRUB CMD Line flags and add various ones depending on the users' hardware.

| AMD CPU | Intel CPU | AMD GPU | Needed Regardless |
| ---- | ----- | ----- | ----- |
| amd_iommu=on | intel_iommu=on | video=efifb:off | iommu=pt |

Example GRUB configuration for an AMD CPU + AMD GPU host:

```
amd_iommu=on iommu=pt video=efifb:off
```

When you're done make sure you use ``grub-mkconfig`` to update the GRUB Bootloader. Restart Required.

```
sudo grub-mkconfig -o /boot/grub/grub.cfg
```

## You can now continue to the next <a href="03-Bridge.html">page</a>.
52 changes: 51 additions & 1 deletion docs/docs/02-HostPreparations/03-Bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,54 @@ layout: default
title: Part 3. Bridge Networking
parent: Host Preparations
nav_order: 3
---
---

<p align="center">
<img width="650" height="200" src="../../assets/HeaderBridgeNetworkingTextOnly.png">
</p>

# Bridge Networking
#### Creation of the Bridge interface for your DKVM.
#### This section has been derived from the <a href="https://github.com/royalgraphx/DarwinKVM/tree/main/BridgeNetworking">Bridge Networking</a> Submodule.

## Overview

First things first, I highly recommend you take the time out of your day to not skip this process, just as you shouldn't skip over any other steps. To understand the point of a network bridge, you'll need to know that when you use QEMU or Virt-Manager to start a Virtual Machine with networking, you will typically be using the default network provided by libvirt. This creates its own DHCP server, meaning that our Machines are created with IP addresses such that, we see "192.168.68.2" or something along those lines, which does not match up with our local IPs on our broader network. The point of setting this Bridge interface up is to strip our ethernet controller of an assigned IP address and stop any other Network Managers that may be present on the users' system so that we can leverage systemd-networkd to automate the bridge creation. What it simply does, is create a new interface named "br0". It then modifies the users' current ethernet interface to "master br0", meaning that br0 is now providing the information to the users' physical ethernet interface. We then give br0 an IP address via DHCP using ipv4. When we use Virt-Manager in this configuration, we can use a bridge interface, we set it to ``br0`` and the result is our Virtual Machines now appear on the broader network as physical, real devices. Allowing SSH via and to any other devices on the LAN.

## Prerequisites to the script

In my opinion, this is the number one step to set up practically right after the installation of a new host operating system. Allowing your virtual machines to be visible to the broader network may seem like something you can ignore, and while you very well can... I enjoy my Virtual Machines appearing as real, physical ethernet devices. The most popular and commonly used package for managing your network connection will most likely be "NetworkManager", and this can be checked by issuing a systemctl command to check the status.

```
sudo systemctl status NetworkManager
```

If you see that it is running, you can choose to stop it but for this guide, we'll be making use of the DKVM Bridge Networking submodule. It contains a script that will quickly go through a few checks and create a bridge interface for your use. You must have systemd in some form, install it prior or check your system for systemd-networkd with the following command.

```
sudo systemctl status systemd-networkd
```

For more information and the completion of this section, refer to [Bridge Networking](https://github.com/royalgraphx/DarwinKVM/tree/main/BridgeNetworking).

## Post installation results

<h3 align="center">This is the guest macOS talking to devices on the broader network.</h3>

<p align="center">
<img src="../../assets/BridgeNetworkingHypervisorSSH.png">
</p>

<p align="center">
<img src="../../assets/BridgeNetworkingLocalTerminal.png">
</p>

<p align="center">
<img src="../../assets/BridgeNetworkingRPI.png">
</p>

<p align="center">
<img src="../../assets/BridgeNetworkingRouterDash.png">
</p>

## You can now continue to the next <a href="04-PackageInstall.html">page</a>.
23 changes: 22 additions & 1 deletion docs/docs/02-HostPreparations/04-PackageInstall.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,25 @@ layout: default
title: Part 4. Package Installation
parent: Host Preparations
nav_order: 4
---
---

# Package Installation
#### Package requirements for base DKVM.
#### This section has been derived from the <a href="https://gitlab.com/risingprismtv/single-gpu-passthrough/-/wikis/4)-Configuration-of-libvirt">Configuration of libvirt</a> section via <a href="https://gitlab.com/risingprismtv/single-gpu-passthrough/-/wikis/home">RisingPrism</a>.

Since everything in this guide is outlined for simply Arch, you may need to find the package equivalent to your system. Here is the command to install all required packages.

```
sudo pacman -S virt-manager qemu vde2 ebtables iptables-nft nftables dnsmasq bridge-utils ovmf
```

Please note: Conflicts may happen when installing these programs.
A warning like the below example may appear in your terminal:

```
iptables and iptables-nft are in conflict. Remove iptables? [y/N]
```

If you do encounter this kind of message, press y and enter to continue the installation.

## You can now continue to the next <a href="05-Libvirtd.html">page</a>.
74 changes: 73 additions & 1 deletion docs/docs/02-HostPreparations/05-Libvirtd.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,76 @@ layout: default
title: Part 5. Libvirtd Configuration
parent: Host Preparations
nav_order: 5
---
---

# Libvirtd Configuration
#### Necessary changes to use Virt-Manager via User.
#### This section has been derived from the <a href="https://gitlab.com/risingprismtv/single-gpu-passthrough/-/wikis/4)-Configuration-of-libvirt">Configuration of libvirt</a> section via <a href="https://gitlab.com/risingprismtv/single-gpu-passthrough/-/wikis/home">RisingPrism</a>.

{: .warning }
Adding yourself to the libvirt group allows for password-less root both from the host and guest. If you are uncomfortable with that and want to avoid this, consider using [Polkit](https://wiki.archlinux.org/title/Polkit) instead which will prompt you for your password. While this is safe for our use case, be aware of what you're doing when following guides online.

## Modifying Files

There are two files we must edit. Please make the changes accordingly. Not too much to say, follow this step-by-step and you'll be fine along with getting logs printed.

### libvirtd.conf

Use your favorite text editor to make the following changes to:
```
/etc/libvirt/libvirtd.conf
```

``Read/Write permissions and Group - Uncomment the following lines.``

```
unix_sock_group = "libvirt"
unix_sock_rw_perms = "0770"
```

``Logging - Add to the very bottom.``

```
log_filters="3:qemu 1:libvirt"
log_outputs="2:file:/var/log/libvirt/libvirtd.log"
```

### qemu.conf

Use your favorite text editor to make the following changes:
```
/etc/libvirt/qemu.conf
```

``Read/Write permissions and Group - Uncomment and Edit the following lines to your username.``

```
user = "root"
group = "root"
```

Example properly modified snippet:

```
user = "royalgraphx"
group = "royalgraphx"
```

## Libvirtd Services

You now need to add your user to the kvm and libvirt groups, to allow libvirt to write files properly:

```
sudo usermod -a -G kvm,libvirt $(whoami)
```

Now enable and start the libvirtd Service to fully apply changes:

```
sudo systemctl enable --start libvirtd
```

{: .important }
If you did not set up the bridge interface and will be using Virt-Managers default NIC, you will also set the virtual networks to auto-start on boot: ```sudo virsh net-autostart default```. Skip this if you did set up the br0 interface.

## You can now continue to the next <a href="../03-GatheringFiles/">page</a>.
4 changes: 3 additions & 1 deletion docs/docs/03-GatheringFiles/04-Tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ layout: default
title: Part 4 - Tools
parent: Gathering Files
nav_order: 5
---
---

<h1>You can now proceed to the <a href="../04-Configs/">Configs</a> section!</h1>
4 changes: 3 additions & 1 deletion docs/docs/04-Configs/01-VMCascadeLake/08-UEFI.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ title: Part 8 - UEFI
parent: Virtual Machine Cascade Lake
grand_parent: Configs
nav_order: 9
---
---

<h1>You can now proceed to the <a href="../../05-FetchingBaseSystem/">Fetching BaseSystem</a> section!</h1>
4 changes: 3 additions & 1 deletion docs/docs/05-FetchingBaseSystem/01-macrecovery.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ layout: default
title: Part 1 - macrecovery
parent: Fetching BaseSystem
nav_order: 1
---
---

<h1>You can now proceed to the <a href="../06-InstallingmacOS/">Installing macOS</a> section!</h1>
4 changes: 3 additions & 1 deletion docs/docs/06-InstallingmacOS/05-Installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ layout: default
title: Part 5 - Installing via recoveryOS
parent: Installing macOS
nav_order: 6
---
---

<h1>You can now proceed to the <a href="../07-SingleGPUPassthrough/">Single GPU Passthrough</a> section! You can also follow the <a href="../08-DualGPUPassthrough/">Dual GPU Passthrough</a> section.</h1>
4 changes: 3 additions & 1 deletion docs/docs/07-SingleGPUPassthrough/03-VManUpdate.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ layout: default
title: Part 3 - Virt-Manager Configuration
parent: Single GPU Passthrough
nav_order: 3
---
---

<h1>You can now proceed to the <a href="../09-Finish.html">Finish!</a> page.</h1>
2 changes: 1 addition & 1 deletion docs/docs/08-DualGPUPassthrough/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ has_toc: false
<img width="650" height="200" src="../../assets/HeaderDGPU.png">
</p>

Support for this section is in development.
Support for this section is in development. The README will be available first, then it will be converted to display properly here as well. Click here to go back <a href="../01-About.html/">home</a>.
3 changes: 1 addition & 2 deletions docs/docs/09-Finish.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ nav_order: 10
<img width="650" height="200" src="../assets/HeaderCongrats.png">
</p>

<h1 align="center">Thanks for reading!</h1>
<h2 align="center">For further customization please refer to Submodules</h2>
<h4 align="center">Enjoy a screenshot of Sonoma with GPU Accel. Don't forget to add the bootflag!</h4>

<p align="center">
<img src="../Assets/macOSSonomaGPUAccel.png">
<img src="../assets/macOSSonomaGPUAccel.png">
</p>
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,5 @@ permalink: /

- Thanks for reading!


<h1>You can now proceed to the <a href="docs/01-About.html">About</a> section!</h1>

0 comments on commit d946d54

Please sign in to comment.