enable test support for mkinitcpio and dracut

This commit is contained in:
HikariKnight 2022-03-12 20:29:58 +01:00
parent f3391a622e
commit f196052c27
No known key found for this signature in database
GPG key ID: E8B239063B022F5A
6 changed files with 44 additions and 13 deletions

View file

@ -36,12 +36,16 @@ function make_BACKUP () {
fi fi
mkdir -p "$BACKUPDIR/etc/modprobe.d" if [ -d "/etc/modprobe.d" ];
# If a vfio.conf file exists, backup that too
if [ -f "/etc/modprobe.d/vfio.conf" ];
then then
cp -v "/etc/modprobe.d/vfio.conf" "$BACKUPDIR/etc/modprobe.d/vfio.conf" mkdir -p "$BACKUPDIR/etc/modprobe.d"
# If a vfio.conf file exists, backup that too
if [ -f "/etc/modprobe.d/vfio.conf" ];
then
cp -v "/etc/modprobe.d/vfio.conf" "$BACKUPDIR/etc/modprobe.d/vfio.conf"
fi
fi fi
@ -79,6 +83,13 @@ Rebuilding initramfs"
Rebuilding initramfs" Rebuilding initramfs"
sudo dracut -f -kver "$(uname -r)" sudo dracut -f -kver "$(uname -r)"
elif [ -f "/etc/mkinitcpio.conf" ];
then
cp -v "$SCRIPTDIR/$MKINITCPIO" "/etc/mkinitcpio.conf"
echo "
Rebuilding initramfs"
sudo mkinitcpio -P
else else
echo " echo "
Unsupported initramfs infrastructure Unsupported initramfs infrastructure

View file

@ -49,7 +49,24 @@ USB_CTL_ID=()
"$SCRIPTDIR/lib/get_GPU_ROM.sh" "$ROM_PCI_ID" "$SCRIPTDIR/lib/get_GPU_ROM.sh" "$ROM_PCI_ID"
# Start setting up modules # Start setting up modules
exec "$SCRIPTDIR/lib/set_INITRAMFSTOOLS.sh" "$GPU_DEVID" if [ -d "/etc/initramfs-tools" ];
then
exec "$SCRIPTDIR/lib/set_INITRAMFSTOOLS.sh" "$GPU_DEVID"
elif [ -d "/etc/dracut.conf" ];
then
exec "$SCRIPTDIR/lib/set_DRACUT.sh" "$GPU_DEVID"
elif [ -f "/etc/mkinitcpio.conf" ];
then
exec "$SCRIPTDIR/lib/set_MKINITCPIO.sh" "$GPU_DEVID"
else
# Bind GPU to VFIO
"$SCRIPTDIR/lib/set_VFIO.sh" "$1"
# Configure modprobe
"$SCRIPTDIR/lib/set_MODPROBE.sh" "$1"
fi
;; ;;
*) *)
exec "$SCRIPTDIR/lib/get_GPU.sh" exec "$SCRIPTDIR/lib/get_GPU.sh"

View file

@ -16,9 +16,7 @@ function set_DRACUT () {
"$SCRIPTDIR/lib/set_VFIO.sh" "$1" "$SCRIPTDIR/lib/set_VFIO.sh" "$1"
# Configure modprobe # Configure modprobe
"$SCRIPTDIR/lib/set_MODPROBE.sh" "$1" exec "$SCRIPTDIR/lib/set_MODPROBE.sh" "$1"
exec "$SCRIPTDIR/lib/get_USB_CTL.sh"
} }
function main () { function main () {

View file

@ -52,9 +52,7 @@ function set_INITRAMFSTOOLS () {
"$SCRIPTDIR/lib/set_VFIO.sh" "$1" "$SCRIPTDIR/lib/set_VFIO.sh" "$1"
# Configure modprobe # Configure modprobe
"$SCRIPTDIR/lib/set_MODPROBE.sh" "$1" exec "$SCRIPTDIR/lib/set_MODPROBE.sh" "$1"
exec "$SCRIPTDIR/lib/get_USB_CTL.sh"
} }

View file

@ -17,6 +17,11 @@ function set_MKINITCPIO () {
perl -pi -e "s/MODULES=\(${CURRENTMODULES}\)/MODULES=\(vfio vfio_iommu_type1 vfio_pci vfio_virqfd ${MODULES}\)/" "$SCRIPTDIR/$MKINITCPIO" perl -pi -e "s/MODULES=\(${CURRENTMODULES}\)/MODULES=\(vfio vfio_iommu_type1 vfio_pci vfio_virqfd ${MODULES}\)/" "$SCRIPTDIR/$MKINITCPIO"
fi fi
# Bind GPU to VFIO
"$SCRIPTDIR/lib/set_VFIO.sh" "$1"
# Configure modprobe
exec "$SCRIPTDIR/lib/set_MODPROBE.sh" "$1"
} }
function main () { function main () {

View file

@ -26,6 +26,8 @@ softdep nouveau pre: vfio vfio_pci
softdep amdgpu pre: vfio vfio_pci softdep amdgpu pre: vfio vfio_pci
softdep radeon pre: vfio vfio_pci softdep radeon pre: vfio vfio_pci
" "${GPU_DEVID}" > "$SCRIPTDIR/$MODPROBE/vfio.conf" " "${GPU_DEVID}" > "$SCRIPTDIR/$MODPROBE/vfio.conf"
exec "$SCRIPTDIR/lib/get_USB_CTL.sh"
} }
function main () { function main () {