I have a sh script that should be executed during system boot, as I understand before graphic driver modules are loaded.
Probably this is not relevant for the answer, but this script serves for PCI passthrough of a GPU in the special case a system has two identical GPUs sharing the same id, to override the driver assignment only on one of the two GPUs.
For arch linux systems, a wiki says that one should:
Edit /etc/mkinitcpio.conf:
Add modconf to the HOOKS array and /usr/local/bin/vfio-pci-override.sh
to the FILES array.
Edit /etc/modprobe.d/vfio.conf:
Add the following line: install vfio-pci /usr/local/bin/vfio-pci-override.sh
Regenerate the initramfs and reboot.
What is the Ubuntu equivalent of mkinitcpio.conf and how should it be modified in this case? Just in case, the script is the following:
#!/bin/sh
DEVS="0000:01:00.0 0000:01:00.1"
if [ ! -z "$(ls -A /sys/class/iommu)" ]; then
for DEV in $DEVS; do
echo "vfio-pci" > /sys/bus/pci/devices/$DEV/driver_override
done
fi