feat: support duplicate device IDs in dracut

This commit is contained in:
jedrw 2025-01-02 14:38:13 +00:00
parent c1f11ce1c3
commit adedfb01b9
5 changed files with 170 additions and 57 deletions

View file

@ -51,7 +51,7 @@ func getBootloader(config *Config) {
// This function adds the default kernel arguments we want to the config/cmdline file
// This gives us a file we can read all the kernel arguments this system needs
// in case of an unknown bootloader
func Set_Cmdline(gpu_IDs []string) {
func Set_Cmdline(gpu_IDs []string, includeDeviceIdsForVfio bool) {
// Get the system info
cpuinfo := cpuid.CPU
@ -69,8 +69,10 @@ func Set_Cmdline(gpu_IDs []string) {
fileio.AppendContent(" intel_iommu=on", config.Path.CMDLINE)
}
// Add the GPU ids for vfio to the kernel arguments
fileio.AppendContent(fmt.Sprintf(" vfio_pci.ids=%s", strings.Join(gpu_IDs, ",")), config.Path.CMDLINE)
if includeDeviceIdsForVfio {
// Add the GPU ids for vfio to the kernel arguments
fileio.AppendContent(fmt.Sprintf(" vfio_pci.ids=%s", strings.Join(gpu_IDs, ",")), config.Path.CMDLINE)
}
}
// Set_KernelStub configures systemd-boot using kernelstub.