From 6b2d3e0987f34314e997705c8a2f733ab2d656c0 Mon Sep 17 00:00:00 2001 From: Lukas Date: Wed, 10 Nov 2021 09:43:30 +0100 Subject: [PATCH] new specific base for live version --- leaves/bhl.cfg | 70 +++++++++++++++++++++++++++++++++++++++++++++++++ leaves/bhla.cfg | 36 +++++++++++++++++++++++++ leaves/bhli.cfg | 38 +++++++++++++++++++++++++++ 3 files changed, 144 insertions(+) create mode 100644 leaves/bhl.cfg create mode 100644 leaves/bhla.cfg create mode 100644 leaves/bhli.cfg diff --git a/leaves/bhl.cfg b/leaves/bhl.cfg new file mode 100644 index 0000000..1621982 --- /dev/null +++ b/leaves/bhl.cfg @@ -0,0 +1,70 @@ + +# __ ____ ____ _____ +# ____ / /_ __ __/ / /___ ____ ___ ___ / __ \/ ___/ +# / __ \/ __ \/ / / / / / __ \/ __ `__ \/ _ \ / / / /\__ \ +# / /_/ / / / / /_/ / / / /_/ / / / / / / __/ / /_/ /___/ / +# / .___/_/ /_/\__, /_/_/\____/_/ /_/ /_/\___/ \____//____/ +# /_/ /____/ + +# What ? This kickstart file provides a basic, generic building block to build a virtualization host. +# 'b' for basic building block, 'h' for hypervisor' + +# This is NOT a standalone kickstart file + +%packages --exclude-weakdeps # Beginning of the packages section. Does not include weak dependencies. + +qemu-kvm +libvirt +libvirt-daemon-config-network +libvirt-daemon-kvm +virt-install +virt-top +libguestfs-tools +python3-libguestfs +guestfs-tools # Complementary tools useful for interacting with vith guest systems + +%end # End of the packages section + +%post --log=/root/bhl.log # Beginning of %post section. Those commands are executed inside the chroot environment. Logging is enabled to help with post-installation troubleshooting + +mkdir /var/lib/libvirt/iso # Create a directory to store iso images + +wget https://boot.netboot.xyz/ipxe/netboot.xyz.iso -P /var/lib/libvirt/iso/ # fetch netboot.xyz iso + +# fetch custom script and make it executable +wget https://git.phyllo.me/home/PhyllomeOS/raw/branch/main/post/configure-vmm-and-desktop.sh -P /usr/sbin/ +chmod +x /usr/sbin/configure-vmm-and-desktop.sh + +# fetch custom script and make it executable +wget https://git.phyllo.me/home/PhyllomeOS/raw/branch/main/post/create-live-vm.sh -P /usr/sbin/ +chmod +x /usr/sbin/create-live-vm.sh + +# fetch custom script and make it executable +wget https://git.phyllo.me/home/PhyllomeOS/raw/branch/main/post/virtualization-tweaks-root-needed.sh -P /usr/sbin/ +chmod +x /usr/sbin/virtualization-tweaks-root-needed.sh + +# # Create new file /etc/systemd/system/postinstall.service using cat: +# cat > /etc/systemd/system/post-install.service<< EOF +# [Unit] +# Description=Post-installation configuration for Phyllome OS +# After=gdm.service +# Requires=gdm.service +# +# [Service] +# Type=oneshot +# ExecStart=/bin/bash /usr/sbin/post-install.sh +# RemainAfterExit=yes +# +# [Install] +# WantedBy=multi-user.target +# EOF +# +# systemctl enable /etc/systemd/system/post-install.service # Enable systemd unit + +# Add a network bridge. Still need to declare it to libvirt/virt-manager +# nmcli con add ifname br0 type bridge con-name br0 +# nmcli con add type bridge-slave ifname enp1s0 master br0 # to-do : generalize this command so that it could regardless of the name of the ethernet device +# nmcli con up br0 + +%end # End of the %post section + diff --git a/leaves/bhla.cfg b/leaves/bhla.cfg new file mode 100644 index 0000000..37560e5 --- /dev/null +++ b/leaves/bhla.cfg @@ -0,0 +1,36 @@ +# __ ____ ____ _____ +# ____ / /_ __ __/ / /___ ____ ___ ___ / __ \/ ___/ +# / __ \/ __ \/ / / / / / __ \/ __ `__ \/ _ \ / / / /\__ \ +# / /_/ / / / / /_/ / / / /_/ / / / / / / __/ / /_/ /___/ / +# / .___/_/ /_/\__, /_/_/\____/_/ /_/ /_/\___/ \____//____/ +# /_/ /____/ + +# What ? This kickstart file configures an hypervisor for AMD (tm) CPUs +# 'b' for basic building block, 'h' for hypervisor', 'a' for amd + +# This is NOT a standalone kickstart file + +%post --log=/root/bhla.log # Beginning of %post section. Those commands are executed inside the chroot environment. Logging is enabled to help with post-installation troubleshooting + +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. + +# 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 + +echo "options kvm_amd nested=1" >> /etc/modprobe.d/kvm.conf # Add support for nested-virtualization + +# The following part seems useless +# dracut --add-drivers " vfio vfio-pci vfio_iommu_type1 vfio_virqfd " --force # Instruct dracut to load the vfio drivers +# dracut --force # Regenerate initramfs +# Doesn't seem to work +# dracut: Cannot find /usr/lib/dracut/dracut-init.sh. +# dracut: Are you running from a git checkout? +# dracut: Try passing -l as an argument to /usr/bin/dracut + +# The following part seems useless too. No need to regenerate grub +# grub2-mkconfig -o /boot/grub2/grub.cfg # Update grub. Does it fail ? /usr/sbin/grub2-probe: error: failed to get canonical path of `LiveOS_rootfs'. + +%end # End of the %post section \ No newline at end of file diff --git a/leaves/bhli.cfg b/leaves/bhli.cfg new file mode 100644 index 0000000..79d86c2 --- /dev/null +++ b/leaves/bhli.cfg @@ -0,0 +1,38 @@ +# __ ____ ____ _____ +# ____ / /_ __ __/ / /___ ____ ___ ___ / __ \/ ___/ +# / __ \/ __ \/ / / / / / __ \/ __ `__ \/ _ \ / / / /\__ \ +# / /_/ / / / / /_/ / / / /_/ / / / / / / __/ / /_/ /___/ / +# / .___/_/ /_/\__, /_/_/\____/_/ /_/ /_/\___/ \____//____/ +# /_/ /____/ + +# What ? This kickstart file configures an hypervisor for Intel(tm) CPUs and Intel(tm) graphic cards +# 'b' for basic building block, 'h' for hypervisor', 'i' for intel + +# This is NOT a standalone kickstart file + +%post --log=/root/blhi.log # Beginning of %post section. Those commands are executed inside the chroot environment. Logging is enabled to help with post-installtion troubleshooting + +sed -i 's/\(quiet\)/\1 intel_iommu=on iommu=pt rd.driver.pre=vfio-pci i915.enable_gvt=1/i' /etc/default/grub # Load kernel modules in grub. + +# 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 +echo "kvmgt" > /etc/modules-load.d/kvmgt.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm) +echo "vfio-mdev" > /etc/modules-load.d/vfio-mdev.conf # Load specific kernel modules kvmgt and vfio-mdev, for Intel (tm) GVT-g and Nvidia (tm) + +echo "options kvm_intel nested=1" >> /etc/modprobe.d/kvm.conf # Add support for nested-virtualization + +# The following part seems useless +# dracut --add-drivers " vfio vfio-pci vfio_iommu_type1 vfio_virqfd vfio-mdev kvmgt " --force # Instruct dracut to load the vfio drivers +# dracut --force # Regenerate initramfs +# Doesn't seem to work +# dracut: Cannot find /usr/lib/dracut/dracut-init.sh. +# dracut: Are you running from a git checkout? +# dracut: Try passing -l as an argument to /usr/bin/dracut + +# The following part seems useless too. No need to regenerate grub +# grub2-mkconfig -o /boot/grub2/grub.cfg # Update grub. Does it fail ? /usr/sbin/grub2-probe: error: failed to get canonical path of `LiveOS_rootfs'. + +%end # End of the %post sectionsud \ No newline at end of file