osbase/kmod: fix module deps naming

Linux for some reason converts '-' to '_' in module names, but not for
dependencies. There are also instances of comma-separated dependency
lists, normalize these as well.

Fail building of metadata in case dependencies do not resolve.
Previously we just wrote zero as dependency index which is obviously
invalid. With the current config and these fixes everything resolves and
this ensures that with any future kconfig changes we actually load
everything correctly.

Change-Id: Ifedb5c7a251ba6ddbe4cd66408b0259a72d6521d
Reviewed-on: https://review.monogon.dev/c/monogon/+/4454
Tested-by: Jenkins CI
Reviewed-by: Tim Windelschmidt <tim@monogon.tech>
diff --git a/osbase/kmod/modinfo.go b/osbase/kmod/modinfo.go
index 42ef446..d211fb5 100644
--- a/osbase/kmod/modinfo.go
+++ b/osbase/kmod/modinfo.go
@@ -48,7 +48,14 @@
 	if len(i["depends"]) == 1 && i["depends"][0] == "" {
 		return nil
 	}
-	return i["depends"]
+	out := make([]string, 0, len(i["depends"]))
+	for _, dep := range i["depends"] {
+		parts := strings.Split(dep, ",")
+		for _, part := range parts {
+			out = append(out, strings.ReplaceAll(part, "-", "_"))
+		}
+	}
+	return out
 }
 
 type OptionalDependencies struct {