2023-12-15 20:33:46 +00:00
|
|
|
#!/usr/bin/env bash
|
2022-03-15 10:23:57 +00:00
|
|
|
set -x
|
|
|
|
|
2022-05-23 15:06:53 +00:00
|
|
|
sudo apt install -y libncurses-dev gawk flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf git make dpkg-dev libmnl-dev pkg-config iproute2
|
2022-03-15 10:23:57 +00:00
|
|
|
sudo sed -i -- 's/# deb-src/deb-src/g' /etc/apt/sources.list
|
|
|
|
sudo apt update
|
2024-01-29 15:38:44 +00:00
|
|
|
apt-get source linux-image-unsigned-"$(uname -r)"
|
|
|
|
pushd linux-azure*/drivers/vdpa/vdpa_sim/ || exit
|
2024-04-02 15:24:50 +00:00
|
|
|
# REUSE-IgnoreStart
|
2024-01-26 15:30:32 +00:00
|
|
|
cat <<'EOF' >Makefile
|
2022-03-15 10:23:57 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
|
|
obj-m += vdpa_sim.o
|
|
|
|
obj-m += vdpa_sim_net.o
|
|
|
|
obj-m += vdpa_sim_blk.o
|
|
|
|
EOF
|
2024-04-02 15:24:50 +00:00
|
|
|
# REUSE-IgnoreEnd
|
2024-01-29 15:38:44 +00:00
|
|
|
make -C /lib/modules/"$(uname -r)"/build M="$PWD"
|
|
|
|
sudo make -C /lib/modules/"$(uname -r)"/build M="$PWD" modules_install
|
|
|
|
popd || exit
|
2022-03-15 10:23:57 +00:00
|
|
|
sudo depmod -a
|
|
|
|
sudo modprobe vdpa
|
|
|
|
sudo modprobe vhost_vdpa
|
|
|
|
sudo modprobe vdpa_sim
|
|
|
|
sudo modprobe vdpa_sim_blk
|
|
|
|
sudo modprobe vdpa_sim_net
|
|
|
|
# Create /dev/vhost-vdpa-0
|
|
|
|
sudo vdpa dev add name vdpa-blk1 mgmtdev vdpasim_blk
|
|
|
|
# Create /dev/vhost-vdpa-1
|
|
|
|
sudo vdpa dev add name vdpa-blk2 mgmtdev vdpasim_blk
|
|
|
|
# Create /dev/vhost-vdpa-2
|
|
|
|
sudo vdpa dev add name vdpa-net1 mgmtdev vdpasim_net
|
|
|
|
sudo chmod 660 /dev/vhost-vdpa-0
|
|
|
|
sudo chmod 660 /dev/vhost-vdpa-1
|
|
|
|
sudo chmod 660 /dev/vhost-vdpa-2
|
2022-05-23 15:06:53 +00:00
|
|
|
vdpa dev show -jp
|