-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·97 lines (78 loc) · 2.72 KB
/
setup.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/env bash
set -euo pipefail
./install_dependency.sh
# setup virsh
# sudo virt-install \
# --virt-type=kvm \
# --name "network-server" \
# --ram 245760 \
# --vcpus=80 \
# --os-variant=ubuntu22.04 \
# --hvm \
# --cdrom=$(realpath ubuntu2204.iso)\
# --network=default,model=virtio \
# --graphics vnc \
# --disk path=/data/server.qcow2,size=256,bus=virtio,format=qcow2
VM="network-server"
# sudo virsh define $VM.xml
setup_bridge () {
# sudo ip link delete bridge_vm type bridge
local bridge_name="bridge_vm"
sudo ip link add name $bridge_name type bridge
sudo ip link set enp202s0f0np0 master $bridge_name
# get from ip address show enp202s0f0np0
IP="10.10.1.2/24"
sudo ip address add $IP dev bridge_vm
}
# bridge_vm network config
# <interface type='bridge'>
# <mac address='52:54:00:ba:6d:b5'/>
# <source bridge='bridge_vm'/>
# <model type='virtio'/>
# <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
# </interface>
# install mft
install_mft () {
mkdir -p mft
cd mft
wget https://www.mellanox.com/downloads/MFT/mft-4.30.1-8-x86_64-deb.tgz
tar xzvf mft-4.30.1-8-x86_64-deb.tgz
cd mft-4.30.1-8-x86_64-deb/
sudo ./install.sh
sudo mst start
# expected output
# schai@node-3:~/linux-6.12.9$ sudo mst status
# MST modules:
# ------------
# MST PCI module is not loaded
# MST PCI configuration module loaded
# MST devices:
# ------------
# /dev/mst/mt4119_pciconf0 - PCI configuration cycles access.
# domain:bus:dev.fn=0000:31:00.0 addr.reg=88 data.reg=92 cr_bar.gw_offset=-1
# Chip revision is: 00
# (eno12399np0)
# /dev/mst/mt4125_pciconf0 - PCI configuration cycles access.
# domain:bus:dev.fn=0000:ca:00.0 addr.reg=88 data.reg=92 cr_bar.gw_offset=-1
# Chip revision is: 00
# enp202s0f0np0
}
install_ofed () {
wget https://content.mellanox.com/ofed/MLNX_OFED-24.10-1.1.4.0/MLNX_OFED_LINUX-24.10-1.1.4.0-ubuntu22.04-x86_64.iso
sudo mkdir -p /mnt
sudo mount -o ro,loop MLNX_OFED_LINUX-24.10-1.1.4.0-ubuntu22.04-x86_64.iso /mnt
cd /mnt
./mlnxofedinstall --without-dkms --add-kernel-support --kernel `uname -r` --without-fw-update --force
}
prepare_kernel () {
cd ~
wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.12.9.tar.xz
tar -xf linux-6.12.9.tar.xz
cp iommu-vm/ubuntu-6.12.9-config linux-6.12.9/.config
cd linux-6.12.9/
make olddefconfig
echo "compilation begins"
make -j 32 LOCALVERSION=-vanilla
sudo make modules_install -j`nproc` INSTALL_MOD_STRIP=1
sudo make install
}