1
0

refactor: move kernelinfo to distro module

This commit is contained in:
2023-05-23 21:33:50 +00:00
parent 0edb0ac0af
commit c1ec4add81
11 changed files with 59 additions and 54 deletions

View File

@ -320,7 +320,7 @@ func ContainerKernels(d container.Image, kcfg *config.KernelConfig) (err error)
release := strings.Replace(pkgname, "linux-image-", "", -1)
ki := config.KernelInfo{
ki := distro.KernelInfo{
Distro: d.Distro,
KernelVersion: path.Base(modules),
KernelRelease: release,

32
distro/kernel.go Normal file
View File

@ -0,0 +1,32 @@
package distro
// ByRootFS is sorting by .RootFS lexicographically
type ByRootFS []KernelInfo
func (a ByRootFS) Len() int { return len(a) }
func (a ByRootFS) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByRootFS) Less(i, j int) bool { return a[i].RootFS < a[j].RootFS }
// KernelInfo defines kernels.toml entries
type KernelInfo struct {
Distro Distro
// Must be *exactly* same as in `uname -r`
KernelVersion string
KernelRelease string
// Build-time information
KernelSource string // module/exploit will be build on host
ContainerName string
// Runtime information
KernelPath string
InitrdPath string
ModulesPath string
RootFS string
// Debug symbols
VmlinuxPath string
}