-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
68 lines (57 loc) · 2.86 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
echo "+----------------------------------------------------------------------+"
echo "| Intel Gen 12/13 vGPU SR-IOV on Proxmox Host Enabler (Installer) |"
echo "| https://github.com/Upinel/Intel-vGPU-SRIOV-on-Proxmox |"
echo "+----------------------------------------------------------------------+"
echo "| This source file is subject to version 2.0 of the Apache license, |"
echo "| that is bundled with this package in the file LICENSE, and is |"
echo "| available through the world-wide-web at the following url: |"
echo "| http://www.apache.org/licenses/LICENSE-2.0.html |"
echo "| If you did not receive a copy of the Apache2.0 license and are unable|"
echo "| to obtain it through the world-wide-web, please send a note to |"
echo "| [email protected] so we can mail you a copy immediately. |"
echo "+----------------------------------------------------------------------+"
echo "| Author: Nova Upinel Chow <[email protected]> |"
echo "| Date: 20/Feb/2024 |"
echo "+----------------------------------------------------------------------+"
echo "Enable IO-MMU on PVE Server"
# Kernel version check
kernel_version=$(uname -r | awk -F '[.-]' '{print $1"."$2}')
target_version="6.5"
if [[ $kernel_version < $target_version ]]; then
echo "Current version ($kernel_version) lower than $target_version. Please run ./upgrade_kernel.sh first and back here"
exit 0
fi
# Clean up
rm -rf /var/lib/dkms/i915-sriov-dkms*
rm -rf /usr/src/i915-sriov-dkms*
rm -rf ~/i915-sriov-dkms
KERNEL=$(uname -r); KERNEL=${KERNEL%-pve}
cd ~/PVE-Intel-vGPU-Lazy/i915-sriov-dkms
cp -a ~/PVE-Intel-vGPU-Lazy/i915-sriov-dkms/dkms.conf{,.bak}
sed -i 's/"@_PKGBASE@"/"i915-sriov-dkms"/g' ~/PVE-Intel-vGPU-Lazy/i915-sriov-dkms/dkms.conf
sed -i 's/"@PKGVER@"/"'"$KERNEL"'"/g' ~/PVE-Intel-vGPU-Lazy/i915-sriov-dkms/dkms.conf
sed -i 's/ -j$(nproc)//g' ~/PVE-Intel-vGPU-Lazy/i915-sriov-dkms/dkms.conf
cat ~/PVE-Intel-vGPU-Lazy/i915-sriov-dkms/dkms.conf
dkms add .
cd /usr/src/i915-sriov-dkms-$KERNEL
dkms install -m i915-sriov-dkms -v $KERNEL -k $(uname -r) --force -j 1
dkms status
echo ""
echo "********************************************"
echo "*** Enable IO-MMU on proxmox host ***"
echo "********************************************"
# /etc/default/grub update
cp -a /etc/default/grub{,.bak}
sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="quiet"/GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on iommu=pt i915.enable_guc=3 i915.max_vfs=7"/g' /etc/default/grub
echo ""
echo " Update grub .... "
update-grub
update-initramfs -u -k all
pve-efiboot-tool refresh
echo ""
echo " Install sysfsutils ,set sriov_numvfs=7"
echo "devices/pci0000:00/0000:00:02.0/sriov_numvfs = 7" > /etc/sysfs.conf
echo ""
echo " Please Verify SR-IOV by lspci |grep VGA after reboot ...."
reboot