From dce149dc0ce7b13bc6a27997c0b2fe9b9591c752 Mon Sep 17 00:00:00 2001
From: Alexander Miroshnichenko <alex@millerson.name>
Date: Tue, 1 Oct 2024 15:59:44 +0300
Subject: [PATCH] Add Gentoo kernel config search path
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Signed-off-by: Alexander Miroshnichenko <alex@millerson.name>
---
 generator/kmod.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/generator/kmod.go b/generator/kmod.go
index d4bf31dbed5e..46960d639cc2 100644
--- a/generator/kmod.go
+++ b/generator/kmod.go
@@ -734,6 +734,11 @@ func readCompiledInComponents(kernelVersion string) (set, error) {
 		debug("reading %s", f.Name())
 		defer f.Close()
 		r = f
+	} else if f, err := os.Open("/lib/modules/" + kernelVersion + "/config"); err == nil {
+		// Gentoo have config in src.
+		debug("reading %s", f.Name())
+		defer f.Close()
+		r = f
 	} else if f, err := os.Open("/proc/config"); err == nil {
 		debug("reading %s", f.Name())
 		defer f.Close()
-- 
2.39.3

