Glam Prestige Journal

Bright entertainment trends with youth appeal.

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

1 Answer

The package is called (man page) initramfs-tools (see wiki: ).

initramfs-tools - an introduction to writing scripts for mkinitramfs

initramfs-tools has one main script and two different sets of subscripts which will be used during different phases of execution. Each of these will be discussed separately below with the help of an imaginary tool which performs a frobnication of a lvm partition prior to mounting the root partition.

Configuration:

/etc/initramfs/initramfs.conf

Mind that ...

/etc/initramfs/conf.d/

can be used for configuration files and

/etc/initramfs/conf-hooks.d/

for adding hooks. To rebuild you can use ...

 update-initramfs -u
3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy