make generating the module list its own function and fix minor things

This commit is contained in:
HikariKnight 2023-04-09 20:40:33 +02:00
parent 8312d8853c
commit e93d215669
5 changed files with 47 additions and 25 deletions

View file

@ -2,6 +2,7 @@ package configs
import (
"fmt"
"strings"
"github.com/HikariKnight/quickpassthrough/pkg/fileio"
)
@ -10,7 +11,7 @@ func Set_Dracut() {
config := GetConfig()
// Write the dracut config file
fileio.AppendContent("add_drivers+=\" vfio_pci vfio vfio_iommu_type1 vfio_virqfd \"\n", fmt.Sprintf("%s/vfio.conf", config.Path.DRACUT))
fileio.AppendContent(fmt.Sprintf("add_drivers+=\" %s \"\n", strings.Join(vfio_modules(), " ")), fmt.Sprintf("%s/vfio.conf", config.Path.DRACUT))
// Add to our kernel arguments file that vfio_pci should load early (dracut does this using kernel arguments)
fileio.AppendContent(" rd.driver.pre=vfio_pci", config.Path.CMDLINE)