diff --git a/leaves/vhamd.cfg b/leaves/vhamd.cfg new file mode 100644 index 0000000..8d3c503 --- /dev/null +++ b/leaves/vhamd.cfg @@ -0,0 +1,22 @@ +# __ ____ ____ _____ +# ____ / /_ __ __/ / /___ ____ ___ ___ / __ \/ ___/ +# / __ \/ __ \/ / / / / / __ \/ __ `__ \/ _ \ / / / /\__ \ +# / /_/ / / / / /_/ / / / /_/ / / / / / / __/ / /_/ /___/ / +# / .___/_/ /_/\__, /_/_/\____/_/ /_/ /_/\___/ \____//____/ +# /_/ /____/ + +# What ? This Kickstart file bootstraps a minimal headless guest hypervisor optimized for AMD CPUs. +# 'v' for virtual machine, 'h' for hypervisor', 'a' for amd, 'm' for minimal, 'd' for development only. + +# ATTENTION : this kickstart file will automatically DESTROY the main virtual disk 'vda' and all of its contents. +# Bye bye! + +%include vhmd.cfg # Includes vhmd.cfg, a hypervisor. + +%post # Beginning of %post section + +sed -i 's/\(quiet\)/\1 amd_iommu=on amd_iommu=pt rd.driver.pre=vfio-pci/i' /etc/default/grub # Load kernel modules in grub. +dracut --force # Regenerate initramfs +grub2-mkconfig -o /boot/grub2/grub.cfg # Update grub + +%end # End of the %post section \ No newline at end of file diff --git a/leaves/vhmd.cfg b/leaves/vhmd.cfg new file mode 100644 index 0000000..97ba0d7 --- /dev/null +++ b/leaves/vhmd.cfg @@ -0,0 +1,53 @@ +# __ ____ ____ _____ +# ____ / /_ __ __/ / /___ ____ ___ ___ / __ \/ ___/ +# / __ \/ __ \/ / / / / / __ \/ __ `__ \/ _ \ / / / /\__ \ +# / /_/ / / / / /_/ / / / /_/ / / / / / / __/ / /_/ /___/ / +# / .___/_/ /_/\__, /_/_/\____/_/ /_/ /_/\___/ \____//____/ +# /_/ /____/ + +# What ? This kickstart file provides the base configuration for a hypervisor or virtual machine monitor. +# 'v' for virtual machine, 'h' for hypervisor', 'm' for minimal, 'd' for development only. + +# ATTENTION : this kickstart file will automatically DESTROY the main virtual disk 'vda' and all of its contents. +# Bye bye! + +%include vmd.cfg # Include vmd.cfg, a minimal system based on Fedora 34. + +%packages + +qemu-kvm +libvirt +libvirt-daemon-config-network +libvirt-daemon-kvm # Install minimal tools dedicated to virtualization. +virt-install +virt-top +libguestfs-tools +python3-libguestfs +guestfs-tools # Complementary tools useful for interacting with v> + +%end + +%post # Beginning of %post section + +# usermod -a -G libvirt liveuser # Make user "liveuser" part of the existing libvirt group to allow it to interact with the guest-hypervisor. # It won't work with initial-setup + +# Load kernel modules by adding vfio, vfio_pci, vfio_iommu_type1, vfio_virqfd +echo "vfio" > /etc/modules-load.d/vfio.conf +echo "vfio-pci" > /etc/modules-load.d/vfio-pci.conf +echo "vfio_iommu_type1" > /etc/modules-load.d/vfio_iommu_type1.conf +echo "vfio_virqfd" > /etc/modules-load.d/vfio_virqfd.conf + +dracut --add-drivers "vfio vfio-pci vfio_iommu_type1 vfio_virqfd" --force # Instruct dracut to load the vfio drivers: +mkdir /var/lib/libvirt/iso # Create a directory to store iso images +# chown liveuser:liveuser /var/lib/libvirt/iso # Make the user "liveuser" the owner of this directory +virsh pool-create-as --name iso --type dir --target /var/lib/libvirt/iso # Make libvirt aware of this new directory by creating a so-called `pool` within this directory +mkdir /var/lib/libvirt/rom # Create a directory to store rom files +# chown liveuser:liveuser /var/lib/libvirt/rom # Make the user "test" its owner +virsh pool-create-as --name rom --type dir --target /var/lib/libvirt/rom # Make libvirt aware of this new directory by creating a so-called `pool` within this directory +# chown liveuser:liveuser /var/lib/libvirt/images # Make the user "test" the owner of this directory + +nmcli con add ifname br0 type bridge con-name br0 # Add a network bridge +nmcli con add type bridge-slave ifname enp1s0 master br0 +nmcli con up br0 + +%end # End of the %post section \ No newline at end of file